examples: use global RTE_MAX_ETHPORTS
Signed-off-by: Intel
This commit is contained in:
parent
e60f71ebd6
commit
1c17baf486
@ -77,8 +77,6 @@
|
||||
|
||||
#define RTE_LOGTYPE_L3FWD RTE_LOGTYPE_USER1
|
||||
|
||||
#define MAX_PORTS 32
|
||||
|
||||
#define MBUF_SIZE (2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM)
|
||||
|
||||
/* allow max jumbo frame 9.5 KB */
|
||||
@ -127,7 +125,7 @@ static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT;
|
||||
static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT;
|
||||
|
||||
/* ethernet addresses of ports */
|
||||
static struct ether_addr ports_eth_addr[MAX_PORTS];
|
||||
static struct ether_addr ports_eth_addr[RTE_MAX_ETHPORTS];
|
||||
static struct ether_addr remote_eth_addr =
|
||||
{{0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff}};
|
||||
|
||||
@ -148,8 +146,8 @@ struct mbuf_table {
|
||||
struct lcore_queue_conf {
|
||||
uint16_t n_rx_queue;
|
||||
uint8_t rx_queue_list[MAX_RX_QUEUE_PER_LCORE];
|
||||
uint16_t tx_queue_id[MAX_PORTS];
|
||||
struct mbuf_table tx_mbufs[MAX_PORTS];
|
||||
uint16_t tx_queue_id[RTE_MAX_ETHPORTS];
|
||||
struct mbuf_table tx_mbufs[RTE_MAX_ETHPORTS];
|
||||
|
||||
} __rte_cache_aligned;
|
||||
struct lcore_queue_conf lcore_queue_conf[RTE_MAX_LCORE];
|
||||
@ -348,7 +346,7 @@ main_loop(__attribute__((unused)) void *dummy)
|
||||
* This could be optimized (use queueid instead of
|
||||
* portid), but it is not called so often
|
||||
*/
|
||||
for (portid = 0; portid < MAX_PORTS; portid++) {
|
||||
for (portid = 0; portid < RTE_MAX_ETHPORTS; portid++) {
|
||||
if (qconf->tx_mbufs[portid].len == 0)
|
||||
continue;
|
||||
send_burst(&lcore_queue_conf[lcore_id],
|
||||
@ -617,8 +615,8 @@ MAIN(int argc, char **argv)
|
||||
rte_panic("Cannot probe PCI\n");
|
||||
|
||||
nb_ports = rte_eth_dev_count();
|
||||
if (nb_ports > MAX_PORTS)
|
||||
nb_ports = MAX_PORTS;
|
||||
if (nb_ports > RTE_MAX_ETHPORTS)
|
||||
nb_ports = RTE_MAX_ETHPORTS;
|
||||
|
||||
nb_lcores = rte_lcore_count();
|
||||
|
||||
|
@ -75,8 +75,6 @@
|
||||
|
||||
#define RTE_LOGTYPE_L2FWD RTE_LOGTYPE_USER1
|
||||
|
||||
#define L2FWD_MAX_PORTS 32
|
||||
|
||||
#define MBUF_SIZE (2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM)
|
||||
#define NB_MBUF 8192
|
||||
|
||||
@ -111,13 +109,13 @@ static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT;
|
||||
static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT;
|
||||
|
||||
/* ethernet addresses of ports */
|
||||
static struct ether_addr l2fwd_ports_eth_addr[L2FWD_MAX_PORTS];
|
||||
static struct ether_addr l2fwd_ports_eth_addr[RTE_MAX_ETHPORTS];
|
||||
|
||||
/* mask of enabled ports */
|
||||
static uint32_t l2fwd_enabled_port_mask = 0;
|
||||
|
||||
/* list of enabled ports */
|
||||
static uint32_t l2fwd_dst_ports[L2FWD_MAX_PORTS];
|
||||
static uint32_t l2fwd_dst_ports[RTE_MAX_ETHPORTS];
|
||||
|
||||
static unsigned int l2fwd_rx_queue_per_lcore = 1;
|
||||
|
||||
@ -131,7 +129,7 @@ struct mbuf_table {
|
||||
struct lcore_queue_conf {
|
||||
unsigned n_rx_port;
|
||||
unsigned rx_port_list[MAX_RX_QUEUE_PER_LCORE];
|
||||
struct mbuf_table tx_mbufs[L2FWD_MAX_PORTS];
|
||||
struct mbuf_table tx_mbufs[RTE_MAX_ETHPORTS];
|
||||
|
||||
} __rte_cache_aligned;
|
||||
struct lcore_queue_conf lcore_queue_conf[RTE_MAX_LCORE];
|
||||
@ -176,7 +174,7 @@ struct l2fwd_port_statistics {
|
||||
uint64_t rx;
|
||||
uint64_t dropped;
|
||||
} __rte_cache_aligned;
|
||||
struct l2fwd_port_statistics port_statistics[L2FWD_MAX_PORTS];
|
||||
struct l2fwd_port_statistics port_statistics[RTE_MAX_ETHPORTS];
|
||||
|
||||
/* A tsc-based timer responsible for triggering statistics printout */
|
||||
#define TIMER_MILLISECOND 2000000ULL /* around 1ms at 2 Ghz */
|
||||
@ -202,7 +200,7 @@ print_stats(void)
|
||||
|
||||
printf("\nPort statistics ====================================");
|
||||
|
||||
for (portid = 0; portid < L2FWD_MAX_PORTS; portid++) {
|
||||
for (portid = 0; portid < RTE_MAX_ETHPORTS; portid++) {
|
||||
/* skip disabled ports */
|
||||
if ((l2fwd_enabled_port_mask & (1 << portid)) == 0)
|
||||
continue;
|
||||
@ -336,7 +334,7 @@ l2fwd_main_loop(void)
|
||||
diff_tsc = cur_tsc - prev_tsc;
|
||||
if (unlikely(diff_tsc > BURST_TX_DRAIN)) {
|
||||
|
||||
for (portid = 0; portid < L2FWD_MAX_PORTS; portid++) {
|
||||
for (portid = 0; portid < RTE_MAX_ETHPORTS; portid++) {
|
||||
if (qconf->tx_mbufs[portid].len == 0)
|
||||
continue;
|
||||
l2fwd_send_burst(&lcore_queue_conf[lcore_id],
|
||||
@ -622,11 +620,11 @@ MAIN(int argc, char **argv)
|
||||
if (nb_ports == 0)
|
||||
rte_exit(EXIT_FAILURE, "No Ethernet ports - bye\n");
|
||||
|
||||
if (nb_ports > L2FWD_MAX_PORTS)
|
||||
nb_ports = L2FWD_MAX_PORTS;
|
||||
if (nb_ports > RTE_MAX_ETHPORTS)
|
||||
nb_ports = RTE_MAX_ETHPORTS;
|
||||
|
||||
/* reset l2fwd_dst_ports */
|
||||
for (portid = 0; portid < L2FWD_MAX_PORTS; portid++)
|
||||
for (portid = 0; portid < RTE_MAX_ETHPORTS; portid++)
|
||||
l2fwd_dst_ports[portid] = 0;
|
||||
last_port = 0;
|
||||
|
||||
|
@ -94,8 +94,6 @@
|
||||
|
||||
#define RTE_LOGTYPE_L3FWD RTE_LOGTYPE_USER1
|
||||
|
||||
#define MAX_PORTS 32
|
||||
|
||||
#define MBUF_SIZE (2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM)
|
||||
#define NB_MBUF 8192
|
||||
|
||||
@ -137,7 +135,7 @@ static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT;
|
||||
static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT;
|
||||
|
||||
/* ethernet addresses of ports */
|
||||
static struct ether_addr ports_eth_addr[MAX_PORTS];
|
||||
static struct ether_addr ports_eth_addr[RTE_MAX_ETHPORTS];
|
||||
|
||||
/* mask of enabled ports */
|
||||
static uint32_t enabled_port_mask = 0;
|
||||
@ -303,7 +301,7 @@ struct lcore_conf {
|
||||
uint16_t n_rx_queue;
|
||||
struct lcore_rx_queue rx_queue_list[MAX_RX_QUEUE_PER_LCORE];
|
||||
uint16_t tx_queue_id;
|
||||
struct mbuf_table tx_mbufs[MAX_PORTS];
|
||||
struct mbuf_table tx_mbufs[RTE_MAX_ETHPORTS];
|
||||
lookup_struct_t * lookup_struct;
|
||||
} __rte_cache_aligned;
|
||||
|
||||
@ -476,7 +474,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint8_t portid, lookup_struct_t * l3fwd
|
||||
#endif
|
||||
|
||||
dst_port = get_dst_port(ipv4_hdr, portid, l3fwd_lookup_struct);
|
||||
if (dst_port >= MAX_PORTS || (enabled_port_mask & 1 << dst_port) == 0)
|
||||
if (dst_port >= RTE_MAX_ETHPORTS || (enabled_port_mask & 1 << dst_port) == 0)
|
||||
dst_port = portid;
|
||||
|
||||
/* 02:00:00:00:00:xx */
|
||||
@ -540,7 +538,7 @@ main_loop(__attribute__((unused)) void *dummy)
|
||||
* This could be optimized (use queueid instead of
|
||||
* portid), but it is not called so often
|
||||
*/
|
||||
for (portid = 0; portid < MAX_PORTS; portid++) {
|
||||
for (portid = 0; portid < RTE_MAX_ETHPORTS; portid++) {
|
||||
if (qconf->tx_mbufs[portid].len == 0)
|
||||
continue;
|
||||
send_burst(&lcore_conf[lcore_id],
|
||||
@ -975,8 +973,8 @@ MAIN(int argc, char **argv)
|
||||
rte_exit(EXIT_FAILURE, "Cannot probe PCI\n");
|
||||
|
||||
nb_ports = rte_eth_dev_count();
|
||||
if (nb_ports > MAX_PORTS)
|
||||
nb_ports = MAX_PORTS;
|
||||
if (nb_ports > RTE_MAX_ETHPORTS)
|
||||
nb_ports = RTE_MAX_ETHPORTS;
|
||||
|
||||
if (check_port_config(nb_ports) < 0)
|
||||
rte_exit(EXIT_FAILURE, "check_port_config failed\n");
|
||||
|
@ -105,8 +105,6 @@
|
||||
|
||||
#define RTE_LOGTYPE_L3FWD RTE_LOGTYPE_USER1
|
||||
|
||||
#define MAX_PORTS 32
|
||||
|
||||
#define MAX_JUMBO_PKT_LEN 9600
|
||||
|
||||
#define IPV6_ADDR_LEN 16
|
||||
@ -164,7 +162,7 @@ static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT;
|
||||
static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT;
|
||||
|
||||
/* ethernet addresses of ports */
|
||||
static struct ether_addr ports_eth_addr[MAX_PORTS];
|
||||
static struct ether_addr ports_eth_addr[RTE_MAX_ETHPORTS];
|
||||
|
||||
/* mask of enabled ports */
|
||||
static uint32_t enabled_port_mask = 0;
|
||||
@ -182,7 +180,7 @@ struct lcore_rx_queue {
|
||||
} __rte_cache_aligned;
|
||||
|
||||
#define MAX_RX_QUEUE_PER_LCORE 16
|
||||
#define MAX_TX_QUEUE_PER_PORT MAX_PORTS
|
||||
#define MAX_TX_QUEUE_PER_PORT RTE_MAX_ETHPORTS
|
||||
#define MAX_RX_QUEUE_PER_PORT 128
|
||||
|
||||
#define MAX_LCORE_PARAMS 1024
|
||||
@ -374,8 +372,8 @@ static lookup_struct_t *ipv4_l3fwd_lookup_struct[NB_SOCKETS];
|
||||
struct lcore_conf {
|
||||
uint16_t n_rx_queue;
|
||||
struct lcore_rx_queue rx_queue_list[MAX_RX_QUEUE_PER_LCORE];
|
||||
uint16_t tx_queue_id[MAX_PORTS];
|
||||
struct mbuf_table tx_mbufs[MAX_PORTS];
|
||||
uint16_t tx_queue_id[RTE_MAX_ETHPORTS];
|
||||
struct mbuf_table tx_mbufs[RTE_MAX_ETHPORTS];
|
||||
lookup_struct_t * ipv4_lookup_struct;
|
||||
lookup_struct_t * ipv6_lookup_struct;
|
||||
} __rte_cache_aligned;
|
||||
@ -599,7 +597,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint8_t portid, struct lcore_conf *qcon
|
||||
#endif
|
||||
|
||||
dst_port = get_ipv4_dst_port(ipv4_hdr, portid, qconf->ipv4_lookup_struct);
|
||||
if (dst_port >= MAX_PORTS || (enabled_port_mask & 1 << dst_port) == 0)
|
||||
if (dst_port >= RTE_MAX_ETHPORTS || (enabled_port_mask & 1 << dst_port) == 0)
|
||||
dst_port = portid;
|
||||
|
||||
/* 02:00:00:00:00:xx */
|
||||
@ -627,7 +625,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint8_t portid, struct lcore_conf *qcon
|
||||
|
||||
dst_port = get_ipv6_dst_port(ipv6_hdr, portid, qconf->ipv6_lookup_struct);
|
||||
|
||||
if (dst_port >= MAX_PORTS || (enabled_port_mask & 1 << dst_port) == 0)
|
||||
if (dst_port >= RTE_MAX_ETHPORTS || (enabled_port_mask & 1 << dst_port) == 0)
|
||||
dst_port = portid;
|
||||
|
||||
/* 02:00:00:00:00:xx */
|
||||
@ -690,7 +688,7 @@ main_loop(__attribute__((unused)) void *dummy)
|
||||
* This could be optimized (use queueid instead of
|
||||
* portid), but it is not called so often
|
||||
*/
|
||||
for (portid = 0; portid < MAX_PORTS; portid++) {
|
||||
for (portid = 0; portid < RTE_MAX_ETHPORTS; portid++) {
|
||||
if (qconf->tx_mbufs[portid].len == 0)
|
||||
continue;
|
||||
send_burst(&lcore_conf[lcore_id],
|
||||
@ -1251,8 +1249,8 @@ MAIN(int argc, char **argv)
|
||||
rte_exit(EXIT_FAILURE, "Cannot probe PCI\n");
|
||||
|
||||
nb_ports = rte_eth_dev_count();
|
||||
if (nb_ports > MAX_PORTS)
|
||||
nb_ports = MAX_PORTS;
|
||||
if (nb_ports > RTE_MAX_ETHPORTS)
|
||||
nb_ports = RTE_MAX_ETHPORTS;
|
||||
|
||||
if (check_port_config(nb_ports) < 0)
|
||||
rte_exit(EXIT_FAILURE, "check_port_config failed\n");
|
||||
|
@ -76,8 +76,6 @@
|
||||
|
||||
#define RTE_LOGTYPE_LSI RTE_LOGTYPE_USER1
|
||||
|
||||
#define LSI_MAX_PORTS 32
|
||||
|
||||
#define MBUF_SIZE (2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM)
|
||||
#define NB_MBUF 8192
|
||||
|
||||
@ -112,7 +110,7 @@ static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT;
|
||||
static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT;
|
||||
|
||||
/* ethernet addresses of ports */
|
||||
static struct ether_addr lsi_ports_eth_addr[LSI_MAX_PORTS];
|
||||
static struct ether_addr lsi_ports_eth_addr[RTE_MAX_ETHPORTS];
|
||||
|
||||
/* mask of enabled ports */
|
||||
static uint32_t lsi_enabled_port_mask = 0;
|
||||
@ -120,7 +118,7 @@ static uint32_t lsi_enabled_port_mask = 0;
|
||||
static unsigned int lsi_rx_queue_per_lcore = 1;
|
||||
|
||||
/* destination port for L2 forwarding */
|
||||
static unsigned lsi_dst_ports[LSI_MAX_PORTS] = {0};
|
||||
static unsigned lsi_dst_ports[RTE_MAX_ETHPORTS] = {0};
|
||||
|
||||
#define MAX_PKT_BURST 32
|
||||
struct mbuf_table {
|
||||
@ -134,7 +132,7 @@ struct lcore_queue_conf {
|
||||
unsigned n_rx_port;
|
||||
unsigned rx_port_list[MAX_RX_QUEUE_PER_LCORE];
|
||||
unsigned tx_queue_id;
|
||||
struct mbuf_table tx_mbufs[LSI_MAX_PORTS];
|
||||
struct mbuf_table tx_mbufs[RTE_MAX_ETHPORTS];
|
||||
|
||||
} __rte_cache_aligned;
|
||||
struct lcore_queue_conf lcore_queue_conf[RTE_MAX_LCORE];
|
||||
@ -182,7 +180,7 @@ struct lsi_port_statistics {
|
||||
uint64_t rx;
|
||||
uint64_t dropped;
|
||||
} __rte_cache_aligned;
|
||||
struct lsi_port_statistics port_statistics[LSI_MAX_PORTS];
|
||||
struct lsi_port_statistics port_statistics[RTE_MAX_ETHPORTS];
|
||||
|
||||
/* A tsc-based timer responsible for triggering statistics printout */
|
||||
#define TIMER_MILLISECOND 2000000ULL /* around 1ms at 2 Ghz */
|
||||
@ -209,7 +207,7 @@ print_stats(void)
|
||||
|
||||
printf("\nPort statistics ====================================");
|
||||
|
||||
for (portid = 0; portid < LSI_MAX_PORTS; portid++) {
|
||||
for (portid = 0; portid < RTE_MAX_ETHPORTS; portid++) {
|
||||
/* skip ports that are not enabled */
|
||||
if ((lsi_enabled_port_mask & (1 << portid)) == 0)
|
||||
continue;
|
||||
@ -355,7 +353,7 @@ lsi_main_loop(void)
|
||||
|
||||
/* this could be optimized (use queueid instead of
|
||||
* portid), but it is not called so often */
|
||||
for (portid = 0; portid < LSI_MAX_PORTS; portid++) {
|
||||
for (portid = 0; portid < RTE_MAX_ETHPORTS; portid++) {
|
||||
if (qconf->tx_mbufs[portid].len == 0)
|
||||
continue;
|
||||
lsi_send_burst(&lcore_queue_conf[lcore_id],
|
||||
@ -676,8 +674,8 @@ MAIN(int argc, char **argv)
|
||||
if (nb_ports == 0)
|
||||
rte_panic("No Ethernet port - bye\n");
|
||||
|
||||
if (nb_ports > LSI_MAX_PORTS)
|
||||
nb_ports = LSI_MAX_PORTS;
|
||||
if (nb_ports > RTE_MAX_ETHPORTS)
|
||||
nb_ports = RTE_MAX_ETHPORTS;
|
||||
|
||||
/*
|
||||
* Each logical core is assigned a dedicated TX queue on each port.
|
||||
|
Loading…
Reference in New Issue
Block a user