4 * Copyright(c) 2010-2017 Intel Corporation. All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
17 * * Neither the name of Intel Corporation nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40 #define RTE_PORT_ALL (~(portid_t)0x0)
42 #define RTE_TEST_RX_DESC_MAX 2048
43 #define RTE_TEST_TX_DESC_MAX 2048
45 #define RTE_PORT_STOPPED (uint16_t)0
46 #define RTE_PORT_STARTED (uint16_t)1
47 #define RTE_PORT_CLOSED (uint16_t)2
48 #define RTE_PORT_HANDLING (uint16_t)3
51 * It is used to allocate the memory for hash key.
52 * The hash key size is NIC dependent.
54 #define RSS_HASH_KEY_LENGTH 64
57 * Default size of the mbuf data buffer to receive standard 1518-byte
58 * Ethernet frames in a mono-segment memory buffer.
60 #define DEFAULT_MBUF_DATA_SIZE RTE_MBUF_DEFAULT_BUF_SIZE
61 /**< Default size of mbuf data buffer. */
64 * The maximum number of segments per packet is used when creating
65 * scattered transmit packets composed of a list of mbufs.
67 #define RTE_MAX_SEGS_PER_PKT 255 /**< nb_segs is a 8-bit unsigned char. */
69 #define MAX_PKT_BURST 512
70 #define DEF_PKT_BURST 32
72 #define DEF_MBUF_CACHE 250
74 #define RTE_CACHE_LINE_SIZE_ROUNDUP(size) \
75 (RTE_CACHE_LINE_SIZE * ((size + RTE_CACHE_LINE_SIZE - 1) / RTE_CACHE_LINE_SIZE))
77 #define NUMA_NO_CONFIG 0xFF
78 #define UMA_NO_CONFIG 0xFF
80 typedef uint8_t lcoreid_t;
81 typedef uint16_t portid_t;
82 typedef uint16_t queueid_t;
83 typedef uint16_t streamid_t;
85 #define MAX_QUEUE_ID ((1 << (sizeof(queueid_t) * 8)) - 1)
89 PORT_TOPOLOGY_CHAINED,
93 #ifdef RTE_TEST_PMD_RECORD_BURST_STATS
95 * The data structure associated with RX and TX packet burst statistics
96 * that are recorded for each forwarding stream.
98 struct pkt_burst_stats {
99 unsigned int pkt_burst_spread[MAX_PKT_BURST];
104 * The data structure associated with a forwarding stream between a receive
105 * port/queue and a transmit port/queue.
108 /* "read-only" data */
109 portid_t rx_port; /**< port to poll for received packets */
110 queueid_t rx_queue; /**< RX queue to poll on "rx_port" */
111 portid_t tx_port; /**< forwarding port of received packets */
112 queueid_t tx_queue; /**< TX queue to send forwarded packets */
113 streamid_t peer_addr; /**< index of peer ethernet address of packets */
115 unsigned int retry_enabled;
117 /* "read-write" results */
118 unsigned int rx_packets; /**< received packets */
119 unsigned int tx_packets; /**< received packets transmitted */
120 unsigned int fwd_dropped; /**< received packets not forwarded */
121 unsigned int rx_bad_ip_csum ; /**< received packets has bad ip checksum */
122 unsigned int rx_bad_l4_csum ; /**< received packets has bad l4 checksum */
123 unsigned int gro_times; /**< GRO operation times */
124 #ifdef RTE_TEST_PMD_RECORD_CORE_CYCLES
125 uint64_t core_cycles; /**< used for RX and TX processing */
127 #ifdef RTE_TEST_PMD_RECORD_BURST_STATS
128 struct pkt_burst_stats rx_burst_stats;
129 struct pkt_burst_stats tx_burst_stats;
133 /** Offload IP checksum in csum forward engine */
134 #define TESTPMD_TX_OFFLOAD_IP_CKSUM 0x0001
135 /** Offload UDP checksum in csum forward engine */
136 #define TESTPMD_TX_OFFLOAD_UDP_CKSUM 0x0002
137 /** Offload TCP checksum in csum forward engine */
138 #define TESTPMD_TX_OFFLOAD_TCP_CKSUM 0x0004
139 /** Offload SCTP checksum in csum forward engine */
140 #define TESTPMD_TX_OFFLOAD_SCTP_CKSUM 0x0008
141 /** Offload outer IP checksum in csum forward engine for recognized tunnels */
142 #define TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM 0x0010
143 /** Parse tunnel in csum forward engine. If set, dissect tunnel headers
144 * of rx packets. If not set, treat inner headers as payload. */
145 #define TESTPMD_TX_OFFLOAD_PARSE_TUNNEL 0x0020
146 /** Insert VLAN header in forward engine */
147 #define TESTPMD_TX_OFFLOAD_INSERT_VLAN 0x0040
148 /** Insert double VLAN header in forward engine */
149 #define TESTPMD_TX_OFFLOAD_INSERT_QINQ 0x0080
150 /** Offload MACsec in forward engine */
151 #define TESTPMD_TX_OFFLOAD_MACSEC 0x0100
153 /** Descriptor for a single flow. */
155 size_t size; /**< Allocated space including data[]. */
156 struct port_flow *next; /**< Next flow in list. */
157 struct port_flow *tmp; /**< Temporary linking. */
158 uint32_t id; /**< Flow rule ID. */
159 struct rte_flow *flow; /**< Opaque flow object returned by PMD. */
160 struct rte_flow_attr attr; /**< Attributes. */
161 struct rte_flow_item *pattern; /**< Pattern. */
162 struct rte_flow_action *actions; /**< Actions. */
163 uint8_t data[]; /**< Storage for pattern/actions. */
167 * The data structure associated with each port.
170 struct rte_eth_dev_info dev_info; /**< PCI info + driver name */
171 struct rte_eth_conf dev_conf; /**< Port configuration. */
172 struct ether_addr eth_addr; /**< Port ethernet address */
173 struct rte_eth_stats stats; /**< Last port statistics */
174 uint64_t tx_dropped; /**< If no descriptor in TX ring */
175 struct fwd_stream *rx_stream; /**< Port RX stream, if unique */
176 struct fwd_stream *tx_stream; /**< Port TX stream, if unique */
177 unsigned int socket_id; /**< For NUMA support */
178 uint16_t tx_ol_flags;/**< TX Offload Flags (TESTPMD_TX_OFFLOAD...). */
179 uint16_t tso_segsz; /**< Segmentation offload MSS for non-tunneled packets. */
180 uint16_t tunnel_tso_segsz; /**< Segmentation offload MSS for tunneled pkts. */
181 uint16_t tx_vlan_id;/**< The tag ID */
182 uint16_t tx_vlan_id_outer;/**< The outer tag ID */
183 void *fwd_ctx; /**< Forwarding mode context */
184 uint64_t rx_bad_ip_csum; /**< rx pkts with bad ip checksum */
185 uint64_t rx_bad_l4_csum; /**< rx pkts with bad l4 checksum */
186 uint8_t tx_queue_stats_mapping_enabled;
187 uint8_t rx_queue_stats_mapping_enabled;
188 volatile uint16_t port_status; /**< port started or not */
189 uint8_t need_reconfig; /**< need reconfiguring port or not */
190 uint8_t need_reconfig_queues; /**< need reconfiguring queues or not */
191 uint8_t rss_flag; /**< enable rss or not */
192 uint8_t dcb_flag; /**< enable dcb */
193 struct rte_eth_rxconf rx_conf; /**< rx configuration */
194 struct rte_eth_txconf tx_conf; /**< tx configuration */
195 struct ether_addr *mc_addr_pool; /**< pool of multicast addrs */
196 uint32_t mc_addr_nb; /**< nb. of addr. in mc_addr_pool */
197 uint8_t slave_flag; /**< bonding slave port */
198 struct port_flow *flow_list; /**< Associated flows. */
202 * The data structure associated with each forwarding logical core.
203 * The logical cores are internally numbered by a core index from 0 to
204 * the maximum number of logical cores - 1.
205 * The system CPU identifier of all logical cores are setup in a global
206 * CPU id. configuration table.
209 struct rte_mempool *mbp; /**< The mbuf pool to use by this core */
210 void *gro_ctx; /**< GRO context */
211 streamid_t stream_idx; /**< index of 1st stream in "fwd_streams" */
212 streamid_t stream_nb; /**< number of streams in "fwd_streams" */
213 lcoreid_t cpuid_idx; /**< index of logical core in CPU id table */
214 queueid_t tx_queue; /**< TX queue to send forwarded packets */
215 volatile char stopped; /**< stop forwarding when set */
219 * Forwarding mode operations:
220 * - IO forwarding mode (default mode)
221 * Forwards packets unchanged.
223 * - MAC forwarding mode
224 * Set the source and the destination Ethernet addresses of packets
225 * before forwarding them.
227 * - IEEE1588 forwarding mode
228 * Check that received IEEE1588 Precise Time Protocol (PTP) packets are
229 * filtered and timestamped by the hardware.
230 * Forwards packets unchanged on the same port.
231 * Check that sent IEEE1588 PTP packets are timestamped by the hardware.
233 typedef void (*port_fwd_begin_t)(portid_t pi);
234 typedef void (*port_fwd_end_t)(portid_t pi);
235 typedef void (*packet_fwd_t)(struct fwd_stream *fs);
238 const char *fwd_mode_name; /**< Forwarding mode name. */
239 port_fwd_begin_t port_fwd_begin; /**< NULL if nothing special to do. */
240 port_fwd_end_t port_fwd_end; /**< NULL if nothing special to do. */
241 packet_fwd_t packet_fwd; /**< Mandatory. */
244 #define BURST_TX_WAIT_US 1
245 #define BURST_TX_RETRIES 64
247 extern uint32_t burst_tx_delay_time;
248 extern uint32_t burst_tx_retry_num;
250 extern struct fwd_engine io_fwd_engine;
251 extern struct fwd_engine mac_fwd_engine;
252 extern struct fwd_engine mac_swap_engine;
253 extern struct fwd_engine flow_gen_engine;
254 extern struct fwd_engine rx_only_engine;
255 extern struct fwd_engine tx_only_engine;
256 extern struct fwd_engine csum_fwd_engine;
257 extern struct fwd_engine icmp_echo_engine;
258 #ifdef RTE_LIBRTE_IEEE1588
259 extern struct fwd_engine ieee1588_fwd_engine;
262 extern struct fwd_engine * fwd_engines[]; /**< NULL terminated array. */
265 * Forwarding Configuration
269 struct fwd_engine *fwd_eng; /**< Packet forwarding mode. */
270 streamid_t nb_fwd_streams; /**< Nb. of forward streams to process. */
271 lcoreid_t nb_fwd_lcores; /**< Nb. of logical cores to launch. */
272 portid_t nb_fwd_ports; /**< Nb. of ports involved. */
284 #define MAX_TX_QUEUE_STATS_MAPPINGS 1024 /* MAX_PORT of 32 @ 32 tx_queues/port */
285 #define MAX_RX_QUEUE_STATS_MAPPINGS 4096 /* MAX_PORT of 32 @ 128 rx_queues/port */
287 struct queue_stats_mappings {
290 uint8_t stats_counter_id;
291 } __rte_cache_aligned;
293 extern struct queue_stats_mappings tx_queue_stats_mappings_array[];
294 extern struct queue_stats_mappings rx_queue_stats_mappings_array[];
296 /* Assign both tx and rx queue stats mappings to the same default values */
297 extern struct queue_stats_mappings *tx_queue_stats_mappings;
298 extern struct queue_stats_mappings *rx_queue_stats_mappings;
300 extern uint16_t nb_tx_queue_stats_mappings;
301 extern uint16_t nb_rx_queue_stats_mappings;
303 /* globals used for configuration */
304 extern uint16_t verbose_level; /**< Drives messages being displayed, if any. */
305 extern uint8_t interactive;
306 extern uint8_t auto_start;
307 extern uint8_t tx_first;
308 extern char cmdline_filename[PATH_MAX]; /**< offline commands file */
309 extern uint8_t numa_support; /**< set by "--numa" parameter */
310 extern uint16_t port_topology; /**< set by "--port-topology" parameter */
311 extern uint8_t no_flush_rx; /**<set by "--no-flush-rx" parameter */
312 extern uint8_t flow_isolate_all; /**< set by "--flow-isolate-all */
313 extern uint8_t mp_anon; /**< set by "--mp-anon" parameter */
314 extern uint8_t no_link_check; /**<set by "--disable-link-check" parameter */
315 extern volatile int test_done; /* stop packet forwarding when set to 1. */
316 extern uint8_t lsc_interrupt; /**< disabled by "--no-lsc-interrupt" parameter */
317 extern uint8_t rmv_interrupt; /**< disabled by "--no-rmv-interrupt" parameter */
318 extern uint32_t event_print_mask;
319 /**< set by "--print-event xxxx" and "--mask-event xxxx parameters */
321 #ifdef RTE_LIBRTE_IXGBE_BYPASS
322 extern uint32_t bypass_timeout; /**< Store the NIC bypass watchdog timeout */
326 * Store specified sockets on which memory pool to be used by ports
329 uint8_t port_numa[RTE_MAX_ETHPORTS];
332 * Store specified sockets on which RX ring to be used by ports
335 uint8_t rxring_numa[RTE_MAX_ETHPORTS];
338 * Store specified sockets on which TX ring to be used by ports
341 uint8_t txring_numa[RTE_MAX_ETHPORTS];
343 extern uint8_t socket_num;
346 * Configuration of logical cores:
347 * nb_fwd_lcores <= nb_cfg_lcores <= nb_lcores
349 extern lcoreid_t nb_lcores; /**< Number of logical cores probed at init time. */
350 extern lcoreid_t nb_cfg_lcores; /**< Number of configured logical cores. */
351 extern lcoreid_t nb_fwd_lcores; /**< Number of forwarding logical cores. */
352 extern unsigned int fwd_lcores_cpuids[RTE_MAX_LCORE];
353 extern unsigned int num_sockets;
354 extern unsigned int socket_ids[RTE_MAX_NUMA_NODES];
357 * Configuration of Ethernet ports:
358 * nb_fwd_ports <= nb_cfg_ports <= nb_ports
360 extern portid_t nb_ports; /**< Number of ethernet ports probed at init time. */
361 extern portid_t nb_cfg_ports; /**< Number of configured ports. */
362 extern portid_t nb_fwd_ports; /**< Number of forwarding ports. */
363 extern portid_t fwd_ports_ids[RTE_MAX_ETHPORTS];
364 extern struct rte_port *ports;
366 extern struct rte_eth_rxmode rx_mode;
367 extern uint64_t rss_hf;
369 extern queueid_t nb_rxq;
370 extern queueid_t nb_txq;
372 extern uint16_t nb_rxd;
373 extern uint16_t nb_txd;
375 extern int16_t rx_free_thresh;
376 extern int8_t rx_drop_en;
377 extern int16_t tx_free_thresh;
378 extern int16_t tx_rs_thresh;
379 extern int32_t txq_flags;
381 extern uint8_t dcb_config;
382 extern uint8_t dcb_test;
383 extern enum dcb_queue_mapping_mode dcb_q_mapping;
385 extern uint16_t mbuf_data_size; /**< Mbuf data space size. */
386 extern uint32_t param_total_num_mbufs;
388 extern uint16_t stats_period;
390 #ifdef RTE_LIBRTE_LATENCY_STATS
391 extern uint8_t latencystats_enabled;
392 extern lcoreid_t latencystats_lcore_id;
395 #ifdef RTE_LIBRTE_BITRATE
396 extern lcoreid_t bitrate_lcore_id;
397 extern uint8_t bitrate_enabled;
400 extern struct rte_fdir_conf fdir_conf;
403 * Configuration of packet segments used by the "txonly" processing engine.
405 #define TXONLY_DEF_PACKET_LEN 64
406 extern uint16_t tx_pkt_length; /**< Length of TXONLY packet */
407 extern uint16_t tx_pkt_seg_lengths[RTE_MAX_SEGS_PER_PKT]; /**< Seg. lengths */
408 extern uint8_t tx_pkt_nb_segs; /**< Number of segments in TX packets */
416 extern enum tx_pkt_split tx_pkt_split;
418 extern uint16_t nb_pkt_per_burst;
419 extern uint16_t mb_mempool_cache;
420 extern int8_t rx_pthresh;
421 extern int8_t rx_hthresh;
422 extern int8_t rx_wthresh;
423 extern int8_t tx_pthresh;
424 extern int8_t tx_hthresh;
425 extern int8_t tx_wthresh;
427 extern struct fwd_config cur_fwd_config;
428 extern struct fwd_engine *cur_fwd_eng;
429 extern uint32_t retry_enabled;
430 extern struct fwd_lcore **fwd_lcores;
431 extern struct fwd_stream **fwd_streams;
433 extern portid_t nb_peer_eth_addrs; /**< Number of peer ethernet addresses. */
434 extern struct ether_addr peer_eth_addrs[RTE_MAX_ETHPORTS];
436 extern uint32_t burst_tx_delay_time; /**< Burst tx delay time(us) for mac-retry. */
437 extern uint32_t burst_tx_retry_num; /**< Burst tx retry number for mac-retry. */
439 #define GRO_DEFAULT_ITEM_NUM_PER_FLOW 32
440 #define GRO_DEFAULT_FLOW_NUM (RTE_GRO_MAX_BURST_ITEM_NUM / \
441 GRO_DEFAULT_ITEM_NUM_PER_FLOW)
443 #define GRO_DEFAULT_FLUSH_CYCLES 1
444 #define GRO_MAX_FLUSH_CYCLES 4
447 struct rte_gro_param param;
450 extern struct gro_status gro_ports[RTE_MAX_ETHPORTS];
451 extern uint8_t gro_flush_cycles;
453 static inline unsigned int
458 for (i = 0; i < RTE_MAX_LCORE; ++i)
459 if (fwd_lcores_cpuids[i] == rte_lcore_id())
462 rte_panic("lcore_id of current thread not found in fwd_lcores_cpuids\n");
465 static inline struct fwd_lcore *
466 current_fwd_lcore(void)
468 return fwd_lcores[lcore_num()];
473 mbuf_poolname_build(unsigned int sock_id, char* mp_name, int name_size)
475 snprintf(mp_name, name_size, "mbuf_pool_socket_%u", sock_id);
478 static inline struct rte_mempool *
479 mbuf_pool_find(unsigned int sock_id)
481 char pool_name[RTE_MEMPOOL_NAMESIZE];
483 mbuf_poolname_build(sock_id, pool_name, sizeof(pool_name));
484 return rte_mempool_lookup((const char *)pool_name);
488 * Read/Write operations on a PCI register of a port.
490 static inline uint32_t
491 port_pci_reg_read(struct rte_port *port, uint32_t reg_off)
497 ((char *)port->dev_info.pci_dev->mem_resource[0].addr +
499 reg_v = *((volatile uint32_t *)reg_addr);
500 return rte_le_to_cpu_32(reg_v);
503 #define port_id_pci_reg_read(pt_id, reg_off) \
504 port_pci_reg_read(&ports[(pt_id)], (reg_off))
507 port_pci_reg_write(struct rte_port *port, uint32_t reg_off, uint32_t reg_v)
512 ((char *)port->dev_info.pci_dev->mem_resource[0].addr +
514 *((volatile uint32_t *)reg_addr) = rte_cpu_to_le_32(reg_v);
517 #define port_id_pci_reg_write(pt_id, reg_off, reg_value) \
518 port_pci_reg_write(&ports[(pt_id)], (reg_off), (reg_value))
521 unsigned int parse_item_list(char* str, const char* item_name,
522 unsigned int max_items,
523 unsigned int *parsed_items, int check_unique_values);
524 void launch_args_parse(int argc, char** argv);
525 void cmdline_read_from_file(const char *filename);
527 void prompt_exit(void);
528 void nic_stats_display(portid_t port_id);
529 void nic_stats_clear(portid_t port_id);
530 void nic_xstats_display(portid_t port_id);
531 void nic_xstats_clear(portid_t port_id);
532 void nic_stats_mapping_display(portid_t port_id);
533 void port_infos_display(portid_t port_id);
534 void port_offload_cap_display(portid_t port_id);
535 void rx_queue_infos_display(portid_t port_idi, uint16_t queue_id);
536 void tx_queue_infos_display(portid_t port_idi, uint16_t queue_id);
537 void fwd_lcores_config_display(void);
538 void pkt_fwd_config_display(struct fwd_config *cfg);
539 void rxtx_config_display(void);
540 void fwd_config_setup(void);
541 void set_def_fwd_config(void);
542 void reconfig(portid_t new_port_id, unsigned socket_id);
543 int init_fwd_streams(void);
545 void port_mtu_set(portid_t port_id, uint16_t mtu);
546 void port_reg_bit_display(portid_t port_id, uint32_t reg_off, uint8_t bit_pos);
547 void port_reg_bit_set(portid_t port_id, uint32_t reg_off, uint8_t bit_pos,
549 void port_reg_bit_field_display(portid_t port_id, uint32_t reg_off,
550 uint8_t bit1_pos, uint8_t bit2_pos);
551 void port_reg_bit_field_set(portid_t port_id, uint32_t reg_off,
552 uint8_t bit1_pos, uint8_t bit2_pos, uint32_t value);
553 void port_reg_display(portid_t port_id, uint32_t reg_off);
554 void port_reg_set(portid_t port_id, uint32_t reg_off, uint32_t value);
555 int port_flow_validate(portid_t port_id,
556 const struct rte_flow_attr *attr,
557 const struct rte_flow_item *pattern,
558 const struct rte_flow_action *actions);
559 int port_flow_create(portid_t port_id,
560 const struct rte_flow_attr *attr,
561 const struct rte_flow_item *pattern,
562 const struct rte_flow_action *actions);
563 int port_flow_destroy(portid_t port_id, uint32_t n, const uint32_t *rule);
564 int port_flow_flush(portid_t port_id);
565 int port_flow_query(portid_t port_id, uint32_t rule,
566 enum rte_flow_action_type action);
567 void port_flow_list(portid_t port_id, uint32_t n, const uint32_t *group);
568 int port_flow_isolate(portid_t port_id, int set);
570 void rx_ring_desc_display(portid_t port_id, queueid_t rxq_id, uint16_t rxd_id);
571 void tx_ring_desc_display(portid_t port_id, queueid_t txq_id, uint16_t txd_id);
573 int set_fwd_lcores_list(unsigned int *lcorelist, unsigned int nb_lc);
574 int set_fwd_lcores_mask(uint64_t lcoremask);
575 void set_fwd_lcores_number(uint16_t nb_lc);
577 void set_fwd_ports_list(unsigned int *portlist, unsigned int nb_pt);
578 void set_fwd_ports_mask(uint64_t portmask);
579 void set_fwd_ports_number(uint16_t nb_pt);
580 int port_is_forwarding(portid_t port_id);
582 void rx_vlan_strip_set(portid_t port_id, int on);
583 void rx_vlan_strip_set_on_queue(portid_t port_id, uint16_t queue_id, int on);
585 void rx_vlan_filter_set(portid_t port_id, int on);
586 void rx_vlan_all_filter_set(portid_t port_id, int on);
587 int rx_vft_set(portid_t port_id, uint16_t vlan_id, int on);
588 void vlan_extend_set(portid_t port_id, int on);
589 void vlan_tpid_set(portid_t port_id, enum rte_vlan_type vlan_type,
591 void tx_vlan_set(portid_t port_id, uint16_t vlan_id);
592 void tx_qinq_set(portid_t port_id, uint16_t vlan_id, uint16_t vlan_id_outer);
593 void tx_vlan_reset(portid_t port_id);
594 void tx_vlan_pvid_set(portid_t port_id, uint16_t vlan_id, int on);
596 void set_qmap(portid_t port_id, uint8_t is_rx, uint16_t queue_id, uint8_t map_value);
598 void set_verbose_level(uint16_t vb_level);
599 void set_tx_pkt_segments(unsigned *seg_lengths, unsigned nb_segs);
600 void show_tx_pkt_segments(void);
601 void set_tx_pkt_split(const char *name);
602 void set_nb_pkt_per_burst(uint16_t pkt_burst);
603 char *list_pkt_forwarding_modes(void);
604 char *list_pkt_forwarding_retry_modes(void);
605 void set_pkt_forwarding_mode(const char *fwd_mode);
606 void start_packet_forwarding(int with_tx_first);
607 void stop_packet_forwarding(void);
608 void dev_set_link_up(portid_t pid);
609 void dev_set_link_down(portid_t pid);
610 void init_port_config(void);
611 void set_port_slave_flag(portid_t slave_pid);
612 void clear_port_slave_flag(portid_t slave_pid);
613 uint8_t port_is_bonding_slave(portid_t slave_pid);
615 int init_port_dcb_config(portid_t pid, enum dcb_mode_enable dcb_mode,
616 enum rte_eth_nb_tcs num_tcs,
618 int start_port(portid_t pid);
619 void stop_port(portid_t pid);
620 void close_port(portid_t pid);
621 void reset_port(portid_t pid);
622 void attach_port(char *identifier);
623 void detach_port(uint8_t port_id);
624 int all_ports_stopped(void);
625 int port_is_started(portid_t port_id);
626 void pmd_test_exit(void);
627 void fdir_get_infos(portid_t port_id);
628 void fdir_set_flex_mask(portid_t port_id,
629 struct rte_eth_fdir_flex_mask *cfg);
630 void fdir_set_flex_payload(portid_t port_id,
631 struct rte_eth_flex_payload_cfg *cfg);
632 void port_rss_reta_info(portid_t port_id,
633 struct rte_eth_rss_reta_entry64 *reta_conf,
634 uint16_t nb_entries);
636 void set_vf_traffic(portid_t port_id, uint8_t is_rx, uint16_t vf, uint8_t on);
638 int set_queue_rate_limit(portid_t port_id, uint16_t queue_idx, uint16_t rate);
639 int set_vf_rate_limit(portid_t port_id, uint16_t vf, uint16_t rate,
642 void port_rss_hash_conf_show(portid_t port_id, char rss_info[],
644 void port_rss_hash_key_update(portid_t port_id, char rss_type[],
645 uint8_t *hash_key, uint hash_key_len);
646 void get_syn_filter(uint8_t port_id);
647 void get_ethertype_filter(uint8_t port_id, uint16_t index);
648 void get_2tuple_filter(uint8_t port_id, uint16_t index);
649 void get_5tuple_filter(uint8_t port_id, uint16_t index);
650 int rx_queue_id_is_invalid(queueid_t rxq_id);
651 int tx_queue_id_is_invalid(queueid_t txq_id);
652 void setup_gro(const char *onoff, portid_t port_id);
653 void setup_gro_flush_cycles(uint8_t cycles);
654 void show_gro(portid_t port_id);
656 /* Functions to manage the set of filtered Multicast MAC addresses */
657 void mcast_addr_add(uint8_t port_id, struct ether_addr *mc_addr);
658 void mcast_addr_remove(uint8_t port_id, struct ether_addr *mc_addr);
659 void port_dcb_info_display(uint8_t port_id);
661 uint8_t *open_ddp_package_file(const char *file_path, uint32_t *size);
662 int save_ddp_package_file(const char *file_path, uint8_t *buf, uint32_t size);
663 int close_ddp_package_file(uint8_t *buf);
669 int port_id_is_invalid(portid_t port_id, enum print_warning warning);
670 int new_socket_id(unsigned int socket_id);
673 * Work-around of a compilation error with ICC on invocations of the
674 * rte_be_to_cpu_16() function.
677 #define RTE_BE_TO_CPU_16(be_16_v) rte_be_to_cpu_16((be_16_v))
678 #define RTE_CPU_TO_BE_16(cpu_16_v) rte_cpu_to_be_16((cpu_16_v))
680 #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
681 #define RTE_BE_TO_CPU_16(be_16_v) (be_16_v)
682 #define RTE_CPU_TO_BE_16(cpu_16_v) (cpu_16_v)
684 #define RTE_BE_TO_CPU_16(be_16_v) \
685 (uint16_t) ((((be_16_v) & 0xFF) << 8) | ((be_16_v) >> 8))
686 #define RTE_CPU_TO_BE_16(cpu_16_v) \
687 (uint16_t) ((((cpu_16_v) & 0xFF) << 8) | ((cpu_16_v) >> 8))
691 #endif /* _TESTPMD_H_ */