1
2
3
4
5#ifndef _ARK_PKTGEN_H_
6#define _ARK_PKTGEN_H_
7
8#include <stdint.h>
9#include <inttypes.h>
10
11#define ARK_PKTGEN_BASE_ADR 0x10000
12
13typedef void *ark_pkt_gen_t;
14
15
16
17
18
19
20
21
22
23
24
25struct ark_pkt_gen_regs {
26 uint32_t r0;
27 volatile uint32_t pkt_start_stop;
28 volatile uint32_t pkt_ctrl;
29 uint32_t pkt_payload;
30 uint32_t pkt_spacing;
31 uint32_t pkt_size_min;
32 uint32_t pkt_size_max;
33 uint32_t pkt_size_incr;
34 volatile uint32_t num_pkts;
35 volatile uint32_t pkts_sent;
36 uint32_t src_mac_addr_l;
37 uint32_t src_mac_addr_h;
38 uint32_t dst_mac_addr_l;
39 uint32_t dst_mac_addr_h;
40 uint32_t eth_type;
41 uint32_t hdr_dw[7];
42 uint32_t start_offset;
43 uint32_t bytes_per_cycle;
44} __rte_packed;
45
46struct ark_pkt_gen_inst {
47 struct rte_eth_dev_info *dev_info;
48 struct ark_pkt_gen_regs *regs;
49 int l2_mode;
50 int ordinal;
51};
52
53
54ark_pkt_gen_t ark_pktgen_init(void *arg, int ord, int l2_mode);
55void ark_pktgen_uninit(ark_pkt_gen_t handle);
56void ark_pktgen_run(ark_pkt_gen_t handle);
57void ark_pktgen_pause(ark_pkt_gen_t handle);
58uint32_t ark_pktgen_paused(ark_pkt_gen_t handle);
59uint32_t ark_pktgen_is_gen_forever(ark_pkt_gen_t handle);
60uint32_t ark_pktgen_is_running(ark_pkt_gen_t handle);
61uint32_t ark_pktgen_tx_done(ark_pkt_gen_t handle);
62void ark_pktgen_reset(ark_pkt_gen_t handle);
63void ark_pktgen_wait_done(ark_pkt_gen_t handle);
64uint32_t ark_pktgen_get_pkts_sent(ark_pkt_gen_t handle);
65void ark_pktgen_set_payload_byte(ark_pkt_gen_t handle, uint32_t b);
66void ark_pktgen_set_pkt_spacing(ark_pkt_gen_t handle, uint32_t x);
67void ark_pktgen_set_pkt_size_min(ark_pkt_gen_t handle, uint32_t x);
68void ark_pktgen_set_pkt_size_max(ark_pkt_gen_t handle, uint32_t x);
69void ark_pktgen_set_pkt_size_incr(ark_pkt_gen_t handle, uint32_t x);
70void ark_pktgen_set_num_pkts(ark_pkt_gen_t handle, uint32_t x);
71void ark_pktgen_set_src_mac_addr(ark_pkt_gen_t handle, uint64_t mac_addr);
72void ark_pktgen_set_dst_mac_addr(ark_pkt_gen_t handle, uint64_t mac_addr);
73void ark_pktgen_set_eth_type(ark_pkt_gen_t handle, uint32_t x);
74void ark_pktgen_set_hdr_dW(ark_pkt_gen_t handle, uint32_t *hdr);
75void ark_pktgen_set_start_offset(ark_pkt_gen_t handle, uint32_t x);
76void ark_pktgen_parse(char *argv);
77void ark_pktgen_setup(ark_pkt_gen_t handle);
78
79#endif
80