summaryrefslogtreecommitdiff
path: root/examples/multi_process/client_server_mp
diff options
context:
space:
mode:
authorZhiyong Yang <zhiyong.yang@intel.com>2017-09-29 15:17:24 +0800
committerThomas Monjalon <thomas@monjalon.net>2017-10-06 18:23:25 +0200
commitf8244c6399d9fae6afab6770ae367aef38742ea5 (patch)
tree9861217c70b10fd192462d338900428365aba00a /examples/multi_process/client_server_mp
parent2db978d04ba91e18fc8647f125f4d7b15965c57c (diff)
downloaddpdk-f8244c6399d9fae6afab6770ae367aef38742ea5.zip
dpdk-f8244c6399d9fae6afab6770ae367aef38742ea5.tar.gz
dpdk-f8244c6399d9fae6afab6770ae367aef38742ea5.tar.xz
ethdev: increase port id range
Extend port_id definition from uint8_t to uint16_t in lib and drivers data structures, specifically rte_eth_dev_data. Modify the APIs, drivers and app using port_id at the same time. Fix some checkpatch issues from the original code and remove some unnecessary cast operations. release_17_11 and deprecation docs have been updated in this patch. Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com> Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Diffstat (limited to 'examples/multi_process/client_server_mp')
-rw-r--r--examples/multi_process/client_server_mp/mp_client/client.c17
-rw-r--r--examples/multi_process/client_server_mp/mp_server/args.c4
-rw-r--r--examples/multi_process/client_server_mp/mp_server/args.h2
-rw-r--r--examples/multi_process/client_server_mp/mp_server/init.c11
-rw-r--r--examples/multi_process/client_server_mp/mp_server/main.c2
-rw-r--r--examples/multi_process/client_server_mp/shared/common.h4
6 files changed, 21 insertions, 19 deletions
diff --git a/examples/multi_process/client_server_mp/mp_client/client.c b/examples/multi_process/client_server_mp/mp_client/client.c
index f8453e5..59f36af 100644
--- a/examples/multi_process/client_server_mp/mp_client/client.c
+++ b/examples/multi_process/client_server_mp/mp_client/client.c
@@ -74,7 +74,7 @@ static uint8_t client_id = 0;
#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];
@@ -150,7 +150,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;
@@ -161,7 +161,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;
@@ -171,15 +171,16 @@ configure_tx_buffer(uint8_t port_id, uint16_t size)
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) port_id);
+ 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) port_id);
+ rte_exit(EXIT_FAILURE,
+ "Cannot set error callback for tx buffer on port %u\n",
+ port_id);
}
/*
@@ -195,8 +196,8 @@ configure_output_ports(const struct port_info *ports)
rte_exit(EXIT_FAILURE, "Too many ethernet ports. RTE_MAX_ETHPORTS = %u\n",
(unsigned)RTE_MAX_ETHPORTS);
for (i = 0; i < ports->num_ports - 1; i+=2){
- uint8_t p1 = ports->id[i];
- uint8_t p2 = ports->id[i+1];
+ uint16_t p1 = ports->id[i];
+ uint16_t p2 = ports->id[i+1];
output_ports[p1] = p2;
output_ports[p2] = p1;
diff --git a/examples/multi_process/client_server_mp/mp_server/args.c b/examples/multi_process/client_server_mp/mp_server/args.c
index bf8c666..a65884f 100644
--- a/examples/multi_process/client_server_mp/mp_server/args.c
+++ b/examples/multi_process/client_server_mp/mp_server/args.c
@@ -74,7 +74,7 @@ parse_portmask(uint8_t max_ports, const char *portmask)
{
char *end = NULL;
unsigned long pm;
- uint8_t count = 0;
+ uint16_t count = 0;
if (portmask == NULL || *portmask == '\0')
return -1;
@@ -128,7 +128,7 @@ parse_num_clients(const char *clients)
* on error.
*/
int
-parse_app_args(uint8_t max_ports, int argc, char *argv[])
+parse_app_args(uint16_t max_ports, int argc, char *argv[])
{
int option_index, opt;
char **argvopt = argv;
diff --git a/examples/multi_process/client_server_mp/mp_server/args.h b/examples/multi_process/client_server_mp/mp_server/args.h
index 23af1bd..33888b8 100644
--- a/examples/multi_process/client_server_mp/mp_server/args.h
+++ b/examples/multi_process/client_server_mp/mp_server/args.h
@@ -34,6 +34,6 @@
#ifndef _ARGS_H_
#define _ARGS_H_
-int parse_app_args(uint8_t max_ports, int argc, char *argv[]);
+int parse_app_args(uint16_t max_ports, int argc, char *argv[]);
#endif /* ifndef _ARGS_H_ */
diff --git a/examples/multi_process/client_server_mp/mp_server/init.c b/examples/multi_process/client_server_mp/mp_server/init.c
index 0bc9292..cacf4e0 100644
--- a/examples/multi_process/client_server_mp/mp_server/init.c
+++ b/examples/multi_process/client_server_mp/mp_server/init.c
@@ -114,7 +114,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 = {
@@ -129,7 +129,7 @@ init_port(uint8_t port_num)
uint16_t q;
int retval;
- printf("Port %u init ... ", (unsigned)port_num);
+ printf("Port %u init ... ", port_num);
fflush(stdout);
/* Standard DPDK port initialisation - config port, then set up
@@ -200,11 +200,12 @@ init_shm_rings(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;
+ uint16_t portid;
+ uint8_t count, all_ports_up, print_flag = 0;
struct rte_eth_link link;
printf("\nChecking link status");
@@ -262,7 +263,7 @@ init(int argc, char *argv[])
{
int retval;
const struct rte_memzone *mz;
- uint8_t i, total_ports;
+ uint16_t i, total_ports;
/* init EAL, parsing EAL args */
retval = rte_eal_init(argc, argv);
diff --git a/examples/multi_process/client_server_mp/mp_server/main.c b/examples/multi_process/client_server_mp/mp_server/main.c
index 7055b54..121383f 100644
--- a/examples/multi_process/client_server_mp/mp_server/main.c
+++ b/examples/multi_process/client_server_mp/mp_server/main.c
@@ -88,7 +88,7 @@ struct client_rx_buf {
static struct client_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/multi_process/client_server_mp/shared/common.h b/examples/multi_process/client_server_mp/shared/common.h
index 631c463..35a3b01 100644
--- a/examples/multi_process/client_server_mp/shared/common.h
+++ b/examples/multi_process/client_server_mp/shared/common.h
@@ -57,8 +57,8 @@ struct tx_stats{
} __rte_cache_aligned;
struct port_info {
- uint8_t num_ports;
- uint8_t id[RTE_MAX_ETHPORTS];
+ uint16_t num_ports;
+ uint16_t id[RTE_MAX_ETHPORTS];
volatile struct rx_stats rx_stats;
volatile struct tx_stats tx_stats[MAX_CLIENTS];
};