1 ---------------------------------
5 ---------------------------------
7 --- low-level dpdk wrapper
8 local
ffi = require
"ffi"
13 enum rte_lcore_state_t {
14 WAIT, RUNNING, FINISHED
19 struct rte_mbuf* next;
26 uint16_t header_lengths;
60 struct rte_pktmbuf
pkt;
61 union rte_ipsec ol_ipsec;
71 uint8_t link_status: 1;
72 } __attribute__((aligned(8)));
74 struct rte_fdir_filter {
81 uint32_t ipv6_addr[4];
85 uint32_t ipv6_addr[4];
98 struct rte_fdir_masks {
103 uint8_t set_ipv6_mask;
104 uint8_t comp_ipv6_dst;
105 uint32_t dst_ipv4_mask;
106 uint32_t src_ipv4_mask;
107 uint16_t dst_ipv6_mask;
108 uint16_t src_ipv6_mask;
109 uint16_t src_port_mask;
110 uint16_t dst_port_mask;
115 struct rte_eth_stats {
129 uint64_t tx_pause_xon;
130 uint64_t rx_pause_xon;
131 uint64_t tx_pause_xoff;
132 uint64_t rx_pause_xoff;
134 uint64_t q_ipackets[16];
136 uint64_t q_opackets[16];
138 uint64_t q_ibytes[16];
140 uint64_t q_obytes[16];
142 uint64_t q_errors[16];
154 struct mg_rss_hash_mask{
164 -- dpdk functions and wrappers
167 int rte_eal_init(
int argc,
const char* argv[]);
170 int rte_eal_get_lcore_state(
int core);
171 enum rte_lcore_state_t rte_eal_get_lcore_state(
unsigned int slave_id);
172 int rte_eal_wait_lcore(
int core);
173 uint32_t get_current_core();
174 uint32_t get_current_socket();
177 struct mempool* init_mem(uint32_t nb_mbuf, uint32_t sock, uint32_t mbuf_size);
178 struct rte_mbuf* alloc_mbuf(
struct mempool* mp);
179 void alloc_mbufs(
struct mempool* mp,
struct rte_mbuf* bufs[], uint32_t len, uint16_t pkt_len);
180 void rte_pktmbuf_free_export(
struct rte_mbuf* m);
181 uint16_t rte_mbuf_refcnt_read_export(
struct rte_mbuf* m);
182 uint16_t rte_mbuf_refcnt_update_export(
struct rte_mbuf* m, int16_t value);
185 void register_pmd_drivers();
186 int rte_eal_pci_probe();
187 int rte_eth_dev_count();
188 uint64_t get_mac_addr(
int port,
char* buf);
189 void rte_eth_link_get(uint8_t port,
struct rte_eth_link* link);
190 void rte_eth_link_get_nowait(uint8_t port,
struct rte_eth_link* link);
192 int configure_device(
int port,
int rx_queues,
int tx_queues,
int rx_descs,
int tx_descs, uint16_t link_speed,
struct mempool* mempool,
bool drop_en, uint8_t rss_enable,
struct mg_rss_hash_mask * hash_functions);
193 void get_mac_addr(
int port,
char* buf);
194 uint32_t get_pci_id(uint8_t port);
195 uint32_t read_reg32(uint8_t port, uint32_t reg);
196 uint64_t read_reg64(uint8_t port, uint32_t reg);
197 void write_reg32(uint8_t port, uint32_t reg, uint32_t val);
198 void write_reg64(uint8_t port, uint32_t reg, uint64_t val);
199 void sync_clocks(uint8_t port1, uint8_t port2, uint32_t timl, uint32_t timh, uint32_t adjl, uint32_t adjh);
200 int32_t get_clock_difference(uint8_t port1, uint8_t port2);
201 uint8_t get_socket(uint8_t port);
202 void rte_eth_promiscuous_enable(uint8_t port);
203 void rte_eth_promiscuous_disable(uint8_t port);
204 void* get_eth_dev(
int port);
205 void* get_i40e_dev(
int port);
206 int get_i40e_vsi_seid(
int port);
209 uint16_t rte_eth_rx_burst_export(uint8_t port_id, uint16_t queue_id,
struct rte_mbuf** rx_pkts, uint16_t nb_pkts);
210 uint16_t rte_eth_tx_burst_export(uint8_t port_id, uint16_t queue_id,
struct rte_mbuf** tx_pkts, uint16_t nb_pkts);
211 int rte_eth_dev_tx_queue_start(uint8_t port_id, uint16_t rx_queue_id);
212 int rte_eth_dev_tx_queue_stop(uint8_t port_id, uint16_t rx_queue_id);
213 void send_all_packets(uint8_t port_id, uint16_t queue_id,
struct rte_mbuf** pkts, uint16_t num_pkts);
214 void send_all_packets_with_delay_invalid_size(uint8_t port_id, uint16_t queue_id,
struct rte_mbuf** load_pkts, uint16_t num_pkts,
struct mempool* pool);
215 void send_all_packets_with_delay_bad_crc(uint8_t port_id, uint16_t queue_id,
struct rte_mbuf** load_pkts, uint16_t num_pkts,
struct mempool* pool);
216 uint64_t get_bad_pkts_sent(uint8_t port_id);
217 uint64_t get_bad_bytes_sent(uint8_t port_id);
220 int rte_eth_dev_fdir_add_perfect_filter(uint8_t port_id,
struct rte_fdir_filter* fdir_filter, uint16_t soft_id, uint8_t rx_queue, uint8_t drop);
221 int rte_eth_dev_fdir_set_masks(uint8_t port_id,
struct rte_fdir_masks* fdir_mask);
225 void calc_ipv4_pseudo_header_checksum(
void* data,
int offset);
226 void calc_ipv4_pseudo_header_checksums(
struct rte_mbuf** pkts, uint16_t num_pkts,
int offset);
227 void calc_ipv6_pseudo_header_checksum(
void* data,
int offset);
228 void calc_ipv6_pseudo_header_checksums(
struct rte_mbuf** pkts, uint16_t num_pkts,
int offset);
231 void rte_delay_ms_export(uint32_t ms);
232 void rte_delay_us_export(uint32_t us);
233 uint64_t rte_rdtsc();
234 uint64_t rte_get_tsc_hz();
237 uint8_t is_running(uint32_t extra_time);
238 void set_runtime(uint32_t ms);
241 void read_timestamps_software(uint8_t port_id, uint16_t queue_id, uint32_t* data, uint64_t size);
244 void rte_eth_stats_get(uint8_t port,
struct rte_eth_stats* stats);
local ffi
low-level dpdk wrapper
RTE_FDIR_L4TYPE_NONE
None.
local pkt
Module for packets (rte_mbuf)