aboutsummaryrefslogtreecommitdiffstats
path: root/examples/server_node_efd
diff options
context:
space:
mode:
authorLuca Boccassi <luca.boccassi@gmail.com>2017-11-08 14:15:11 +0000
committerLuca Boccassi <luca.boccassi@gmail.com>2017-11-08 14:45:54 +0000
commit055c52583a2794da8ba1e85a48cce3832372b12f (patch)
tree8ceb1cb78fbb46a0f341f8ee24feb3c6b5540013 /examples/server_node_efd
parentf239aed5e674965691846e8ce3f187dd47523689 (diff)
New upstream version 17.11-rc3
Change-Id: I6a5baa40612fe0c20f30b5fa773a6cbbac63a685 Signed-off-by: Luca Boccassi <luca.boccassi@gmail.com>
Diffstat (limited to 'examples/server_node_efd')
-rw-r--r--examples/server_node_efd/node/node.c22
-rw-r--r--examples/server_node_efd/server/Makefile2
-rw-r--r--examples/server_node_efd/server/init.c19
-rw-r--r--examples/server_node_efd/server/main.c4
-rw-r--r--examples/server_node_efd/shared/common.h4
5 files changed, 25 insertions, 26 deletions
diff --git a/examples/server_node_efd/node/node.c b/examples/server_node_efd/node/node.c
index 86e57c89..5aa1258e 100644
--- a/examples/server_node_efd/node/node.c
+++ b/examples/server_node_efd/node/node.c
@@ -57,7 +57,6 @@
#include <rte_mempool.h>
#include <rte_mbuf.h>
#include <rte_interrupts.h>
-#include <rte_pci.h>
#include <rte_ether.h>
#include <rte_ethdev.h>
#include <rte_string_fns.h>
@@ -77,7 +76,7 @@ static uint8_t node_id;
#define MBQ_CAPACITY 32
/* maps input ports to output ports for packets */
-static uint8_t output_ports[RTE_MAX_ETHPORTS];
+static uint16_t output_ports[RTE_MAX_ETHPORTS];
/* buffers up a set of packet that are ready to send */
struct rte_eth_dev_tx_buffer *tx_buffer[RTE_MAX_ETHPORTS];
@@ -154,7 +153,7 @@ static void
flush_tx_error_callback(struct rte_mbuf **unsent, uint16_t count,
void *userdata) {
int i;
- uint8_t port_id = (uintptr_t)userdata;
+ uint16_t port_id = (uintptr_t)userdata;
tx_stats->tx_drop[port_id] += count;
@@ -165,7 +164,7 @@ flush_tx_error_callback(struct rte_mbuf **unsent, uint16_t count,
}
static void
-configure_tx_buffer(uint8_t port_id, uint16_t size)
+configure_tx_buffer(uint16_t port_id, uint16_t size)
{
int ret;
@@ -174,16 +173,17 @@ configure_tx_buffer(uint8_t port_id, uint16_t size)
RTE_ETH_TX_BUFFER_SIZE(size), 0,
rte_eth_dev_socket_id(port_id));
if (tx_buffer[port_id] == NULL)
- rte_exit(EXIT_FAILURE, "Cannot allocate buffer for tx "
- "on port %u\n", (unsigned int) port_id);
+ rte_exit(EXIT_FAILURE,
+ "Cannot allocate buffer for tx on port %u\n", port_id);
rte_eth_tx_buffer_init(tx_buffer[port_id], size);
ret = rte_eth_tx_buffer_set_err_callback(tx_buffer[port_id],
flush_tx_error_callback, (void *)(intptr_t)port_id);
if (ret < 0)
- rte_exit(EXIT_FAILURE, "Cannot set error callback for "
- "tx buffer on port %u\n", (unsigned int) port_id);
+ rte_exit(EXIT_FAILURE,
+ "Cannot set error callback for tx buffer on port %u\n",
+ port_id);
}
/*
@@ -282,8 +282,8 @@ static inline void
transmit_packet(struct rte_mbuf *buf)
{
int sent;
- const uint8_t in_port = buf->port;
- const uint8_t out_port = output_ports[in_port];
+ const uint16_t in_port = buf->port;
+ const uint16_t out_port = output_ports[in_port];
struct rte_eth_dev_tx_buffer *buffer = tx_buffer[out_port];
sent = rte_eth_tx_buffer(out_port, node_id, buffer, buf);
@@ -381,7 +381,7 @@ main(int argc, char *argv[])
for (;;) {
uint16_t rx_pkts = PKT_READ_SIZE;
- uint8_t port;
+ uint16_t port;
/*
* Try dequeuing max possible packets first, if that fails,
diff --git a/examples/server_node_efd/server/Makefile b/examples/server_node_efd/server/Makefile
index a2f2f361..9f1fe289 100644
--- a/examples/server_node_efd/server/Makefile
+++ b/examples/server_node_efd/server/Makefile
@@ -49,7 +49,7 @@ APP = server
# all source are stored in SRCS-y
SRCS-y := main.c init.c args.c
-INC := $(wildcard *.h)
+INC := $(sort $(wildcard *.h))
CFLAGS += $(WERROR_FLAGS) -O3
CFLAGS += -I$(SRCDIR)/../shared
diff --git a/examples/server_node_efd/server/init.c b/examples/server_node_efd/server/init.c
index d114e5bf..0bcab8cc 100644
--- a/examples/server_node_efd/server/init.c
+++ b/examples/server_node_efd/server/init.c
@@ -56,7 +56,6 @@
#include <rte_memcpy.h>
#include <rte_mbuf.h>
#include <rte_interrupts.h>
-#include <rte_pci.h>
#include <rte_ether.h>
#include <rte_ethdev.h>
#include <rte_malloc.h>
@@ -121,7 +120,7 @@ init_mbuf_pools(void)
* - start the port and report its status to stdout
*/
static int
-init_port(uint8_t port_num)
+init_port(uint16_t port_num)
{
/* for port configuration all features are off by default */
const struct rte_eth_conf port_conf = {
@@ -136,7 +135,7 @@ init_port(uint8_t port_num)
uint16_t q;
int retval;
- printf("Port %u init ... ", (unsigned int)port_num);
+ printf("Port %u init ... ", port_num);
fflush(stdout);
/*
@@ -255,11 +254,12 @@ populate_efd_table(void)
/* Check the link status of all ports in up to 9s, and print them finally */
static void
-check_all_ports_link_status(uint8_t port_num, uint32_t port_mask)
+check_all_ports_link_status(uint16_t port_num, uint32_t port_mask)
{
#define CHECK_INTERVAL 100 /* 100ms */
#define MAX_CHECK_TIME 90 /* 9s (90 * 100ms) in total */
- uint8_t portid, count, all_ports_up, print_flag = 0;
+ uint8_t count, all_ports_up, print_flag = 0;
+ uint16_t portid;
struct rte_eth_link link;
printf("\nChecking link status");
@@ -274,14 +274,15 @@ check_all_ports_link_status(uint8_t port_num, uint32_t port_mask)
/* print link status if flag set */
if (print_flag == 1) {
if (link.link_status)
- printf("Port %d Link Up - speed %u "
- "Mbps - %s\n", info->id[portid],
- (unsigned int)link.link_speed,
+ printf(
+ "Port%d Link Up. Speed %u Mbps - %s\n",
+ info->id[portid],
+ link.link_speed,
(link.link_duplex == ETH_LINK_FULL_DUPLEX) ?
("full-duplex") : ("half-duplex\n"));
else
printf("Port %d Link Down\n",
- (uint8_t)info->id[portid]);
+ info->id[portid]);
continue;
}
/* clear all_ports_up flag if any link down */
diff --git a/examples/server_node_efd/server/main.c b/examples/server_node_efd/server/main.c
index dcdc0a48..aa1c6f57 100644
--- a/examples/server_node_efd/server/main.c
+++ b/examples/server_node_efd/server/main.c
@@ -44,7 +44,6 @@
#include <rte_common.h>
#include <rte_memory.h>
-#include <rte_memzone.h>
#include <rte_eal.h>
#include <rte_launch.h>
#include <rte_per_lcore.h>
@@ -59,7 +58,6 @@
#include <rte_mbuf.h>
#include <rte_ether.h>
#include <rte_interrupts.h>
-#include <rte_pci.h>
#include <rte_ethdev.h>
#include <rte_byteorder.h>
#include <rte_malloc.h>
@@ -95,7 +93,7 @@ struct efd_stats {
static struct node_rx_buf *cl_rx_buf;
static const char *
-get_printable_mac_addr(uint8_t port)
+get_printable_mac_addr(uint16_t port)
{
static const char err_address[] = "00:00:00:00:00:00";
static char addresses[RTE_MAX_ETHPORTS][sizeof(err_address)];
diff --git a/examples/server_node_efd/shared/common.h b/examples/server_node_efd/shared/common.h
index 8a134799..b1e0abe5 100644
--- a/examples/server_node_efd/shared/common.h
+++ b/examples/server_node_efd/shared/common.h
@@ -65,9 +65,9 @@ struct filter_stats {
struct shared_info {
uint8_t num_nodes;
- uint8_t num_ports;
+ uint16_t num_ports;
uint32_t num_flows;
- uint8_t id[RTE_MAX_ETHPORTS];
+ uint16_t id[RTE_MAX_ETHPORTS];
struct rx_stats rx_stats;
struct tx_stats tx_stats[MAX_NODES];
struct filter_stats filter_stats[MAX_NODES];