#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 */
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}};
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];
* 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],
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();
#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
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;
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];
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 */
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;
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],
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;
#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
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;
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;
#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 */
* 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],
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");
#define RTE_LOGTYPE_L3FWD RTE_LOGTYPE_USER1
-#define MAX_PORTS 32
-
#define MAX_JUMBO_PKT_LEN 9600
#define IPV6_ADDR_LEN 16
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;
} __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
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;
#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 */
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 */
* 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],
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");
#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
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;
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 {
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];
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 */
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;
/* 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],
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.