summaryrefslogtreecommitdiffstats
path: root/examples/qos_sched
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/qos_sched
parentf239aed5e674965691846e8ce3f187dd47523689 (diff)
New upstream version 17.11-rc3
Change-Id: I6a5baa40612fe0c20f30b5fa773a6cbbac63a685 Signed-off-by: Luca Boccassi <luca.boccassi@gmail.com>
Diffstat (limited to 'examples/qos_sched')
-rw-r--r--examples/qos_sched/args.c12
-rw-r--r--examples/qos_sched/cmdline.c30
-rw-r--r--examples/qos_sched/init.c33
-rw-r--r--examples/qos_sched/main.c14
-rw-r--r--examples/qos_sched/main.h24
-rw-r--r--examples/qos_sched/stats.c16
6 files changed, 69 insertions, 60 deletions
diff --git a/examples/qos_sched/args.c b/examples/qos_sched/args.c
index 2350d64f..203a3470 100644
--- a/examples/qos_sched/args.c
+++ b/examples/qos_sched/args.c
@@ -252,8 +252,8 @@ app_parse_flow_conf(const char *conf_str)
pconf = &qos_conf[nb_pfc];
- pconf->rx_port = (uint8_t)vals[0];
- pconf->tx_port = (uint8_t)vals[1];
+ pconf->rx_port = vals[0];
+ pconf->tx_port = vals[1];
pconf->rx_core = (uint8_t)vals[2];
pconf->wt_core = (uint8_t)vals[3];
if (ret == 5)
@@ -267,19 +267,19 @@ app_parse_flow_conf(const char *conf_str)
}
if (pconf->rx_port >= RTE_MAX_ETHPORTS) {
- RTE_LOG(ERR, APP, "pfc %u: invalid rx port %"PRIu8" index\n",
+ RTE_LOG(ERR, APP, "pfc %u: invalid rx port %"PRIu16" index\n",
nb_pfc, pconf->rx_port);
return -1;
}
if (pconf->tx_port >= RTE_MAX_ETHPORTS) {
- RTE_LOG(ERR, APP, "pfc %u: invalid tx port %"PRIu8" index\n",
+ RTE_LOG(ERR, APP, "pfc %u: invalid tx port %"PRIu16" index\n",
nb_pfc, pconf->tx_port);
return -1;
}
mask = 1lu << pconf->rx_port;
if (app_used_rx_port_mask & mask) {
- RTE_LOG(ERR, APP, "pfc %u: rx port %"PRIu8" is used already\n",
+ RTE_LOG(ERR, APP, "pfc %u: rx port %"PRIu16" is used already\n",
nb_pfc, pconf->rx_port);
return -1;
}
@@ -288,7 +288,7 @@ app_parse_flow_conf(const char *conf_str)
mask = 1lu << pconf->tx_port;
if (app_used_tx_port_mask & mask) {
- RTE_LOG(ERR, APP, "pfc %u: port %"PRIu8" is used already\n",
+ RTE_LOG(ERR, APP, "pfc %u: port %"PRIu16" is used already\n",
nb_pfc, pconf->tx_port);
return -1;
}
diff --git a/examples/qos_sched/cmdline.c b/examples/qos_sched/cmdline.c
index f79d5246..b62d165b 100644
--- a/examples/qos_sched/cmdline.c
+++ b/examples/qos_sched/cmdline.c
@@ -191,7 +191,7 @@ cmdline_parse_inst_t cmd_appstats = {
struct cmd_subportstats_result {
cmdline_fixed_string_t stats_string;
cmdline_fixed_string_t port_string;
- uint8_t port_number;
+ uint16_t port_number;
cmdline_fixed_string_t subport_string;
uint32_t subport_number;
};
@@ -220,7 +220,7 @@ cmdline_parse_token_num_t cmd_subportstats_subport_number =
UINT32);
cmdline_parse_token_num_t cmd_subportstats_port_number =
TOKEN_NUM_INITIALIZER(struct cmd_subportstats_result, port_number,
- UINT8);
+ UINT16);
cmdline_parse_inst_t cmd_subportstats = {
.f = cmd_subportstats_parsed,
@@ -240,7 +240,7 @@ cmdline_parse_inst_t cmd_subportstats = {
struct cmd_pipestats_result {
cmdline_fixed_string_t stats_string;
cmdline_fixed_string_t port_string;
- uint8_t port_number;
+ uint16_t port_number;
cmdline_fixed_string_t subport_string;
uint32_t subport_number;
cmdline_fixed_string_t pipe_string;
@@ -265,7 +265,7 @@ cmdline_parse_token_string_t cmd_pipestats_port_string =
"port");
cmdline_parse_token_num_t cmd_pipestats_port_number =
TOKEN_NUM_INITIALIZER(struct cmd_pipestats_result, port_number,
- UINT8);
+ UINT16);
cmdline_parse_token_string_t cmd_pipestats_subport_string =
TOKEN_STRING_INITIALIZER(struct cmd_pipestats_result, subport_string,
"subport");
@@ -299,7 +299,7 @@ cmdline_parse_inst_t cmd_pipestats = {
struct cmd_avg_q_result {
cmdline_fixed_string_t qavg_string;
cmdline_fixed_string_t port_string;
- uint8_t port_number;
+ uint16_t port_number;
cmdline_fixed_string_t subport_string;
uint32_t subport_number;
cmdline_fixed_string_t pipe_string;
@@ -327,8 +327,8 @@ cmdline_parse_token_string_t cmd_avg_q_port_string =
TOKEN_STRING_INITIALIZER(struct cmd_avg_q_result, port_string,
"port");
cmdline_parse_token_num_t cmd_avg_q_port_number =
- TOKEN_NUM_INITIALIZER(struct cmd_avg_q_result, port_number,
- UINT8);
+ TOKEN_NUM_INITIALIZER(struct cmd_avg_q_result, port_number,
+ UINT16);
cmdline_parse_token_string_t cmd_avg_q_subport_string =
TOKEN_STRING_INITIALIZER(struct cmd_avg_q_result, subport_string,
"subport");
@@ -378,7 +378,7 @@ cmdline_parse_inst_t cmd_avg_q = {
struct cmd_avg_tcpipe_result {
cmdline_fixed_string_t qavg_string;
cmdline_fixed_string_t port_string;
- uint8_t port_number;
+ uint16_t port_number;
cmdline_fixed_string_t subport_string;
uint32_t subport_number;
cmdline_fixed_string_t pipe_string;
@@ -405,7 +405,7 @@ cmdline_parse_token_string_t cmd_avg_tcpipe_port_string =
"port");
cmdline_parse_token_num_t cmd_avg_tcpipe_port_number =
TOKEN_NUM_INITIALIZER(struct cmd_avg_tcpipe_result, port_number,
- UINT8);
+ UINT16);
cmdline_parse_token_string_t cmd_avg_tcpipe_subport_string =
TOKEN_STRING_INITIALIZER(struct cmd_avg_tcpipe_result, subport_string,
"subport");
@@ -447,7 +447,7 @@ cmdline_parse_inst_t cmd_avg_tcpipe = {
struct cmd_avg_pipe_result {
cmdline_fixed_string_t qavg_string;
cmdline_fixed_string_t port_string;
- uint8_t port_number;
+ uint16_t port_number;
cmdline_fixed_string_t subport_string;
uint32_t subport_number;
cmdline_fixed_string_t pipe_string;
@@ -472,7 +472,7 @@ cmdline_parse_token_string_t cmd_avg_pipe_port_string =
"port");
cmdline_parse_token_num_t cmd_avg_pipe_port_number =
TOKEN_NUM_INITIALIZER(struct cmd_avg_pipe_result, port_number,
- UINT8);
+ UINT16);
cmdline_parse_token_string_t cmd_avg_pipe_subport_string =
TOKEN_STRING_INITIALIZER(struct cmd_avg_pipe_result, subport_string,
"subport");
@@ -506,7 +506,7 @@ cmdline_parse_inst_t cmd_avg_pipe = {
struct cmd_avg_tcsubport_result {
cmdline_fixed_string_t qavg_string;
cmdline_fixed_string_t port_string;
- uint8_t port_number;
+ uint16_t port_number;
cmdline_fixed_string_t subport_string;
uint32_t subport_number;
cmdline_fixed_string_t tc_string;
@@ -531,7 +531,7 @@ cmdline_parse_token_string_t cmd_avg_tcsubport_port_string =
"port");
cmdline_parse_token_num_t cmd_avg_tcsubport_port_number =
TOKEN_NUM_INITIALIZER(struct cmd_avg_tcsubport_result, port_number,
- UINT8);
+ UINT16);
cmdline_parse_token_string_t cmd_avg_tcsubport_subport_string =
TOKEN_STRING_INITIALIZER(struct cmd_avg_tcsubport_result, subport_string,
"subport");
@@ -565,7 +565,7 @@ cmdline_parse_inst_t cmd_avg_tcsubport = {
struct cmd_avg_subport_result {
cmdline_fixed_string_t qavg_string;
cmdline_fixed_string_t port_string;
- uint8_t port_number;
+ uint16_t port_number;
cmdline_fixed_string_t subport_string;
uint32_t subport_number;
};
@@ -588,7 +588,7 @@ cmdline_parse_token_string_t cmd_avg_subport_port_string =
"port");
cmdline_parse_token_num_t cmd_avg_subport_port_number =
TOKEN_NUM_INITIALIZER(struct cmd_avg_subport_result, port_number,
- UINT8);
+ UINT16);
cmdline_parse_token_string_t cmd_avg_subport_subport_string =
TOKEN_STRING_INITIALIZER(struct cmd_avg_subport_result, subport_string,
"subport");
diff --git a/examples/qos_sched/init.c b/examples/qos_sched/init.c
index a82cbd7d..038f0427 100644
--- a/examples/qos_sched/init.c
+++ b/examples/qos_sched/init.c
@@ -100,7 +100,7 @@ static const struct rte_eth_conf port_conf = {
};
static int
-app_init_port(uint8_t portid, struct rte_mempool *mp)
+app_init_port(uint16_t portid, struct rte_mempool *mp)
{
int ret;
struct rte_eth_link link;
@@ -118,6 +118,7 @@ app_init_port(uint8_t portid, struct rte_mempool *mp)
rx_conf.rx_thresh.wthresh = rx_thresh.wthresh;
rx_conf.rx_free_thresh = 32;
rx_conf.rx_drop_en = 0;
+ rx_conf.rx_deferred_start = 0;
tx_conf.tx_thresh.pthresh = tx_thresh.pthresh;
tx_conf.tx_thresh.hthresh = tx_thresh.hthresh;
@@ -125,21 +126,24 @@ app_init_port(uint8_t portid, struct rte_mempool *mp)
tx_conf.tx_free_thresh = 0;
tx_conf.tx_rs_thresh = 0;
tx_conf.txq_flags = ETH_TXQ_FLAGS_NOMULTSEGS | ETH_TXQ_FLAGS_NOOFFLOADS;
+ tx_conf.tx_deferred_start = 0;
/* init port */
- RTE_LOG(INFO, APP, "Initializing port %"PRIu8"... ", portid);
+ RTE_LOG(INFO, APP, "Initializing port %"PRIu16"... ", portid);
fflush(stdout);
ret = rte_eth_dev_configure(portid, 1, 1, &port_conf);
if (ret < 0)
- rte_exit(EXIT_FAILURE, "Cannot configure device: "
- "err=%d, port=%"PRIu8"\n", ret, portid);
+ rte_exit(EXIT_FAILURE,
+ "Cannot configure device: err=%d, port=%u\n",
+ ret, portid);
rx_size = ring_conf.rx_size;
tx_size = ring_conf.tx_size;
ret = rte_eth_dev_adjust_nb_rx_tx_desc(portid, &rx_size, &tx_size);
if (ret < 0)
- rte_exit(EXIT_FAILURE, "rte_eth_dev_adjust_nb_rx_tx_desc: "
- "err=%d, port=%"PRIu8"\n", ret, portid);
+ rte_exit(EXIT_FAILURE,
+ "rte_eth_dev_adjust_nb_rx_tx_desc: err=%d,port=%u\n",
+ ret, portid);
ring_conf.rx_size = rx_size;
ring_conf.tx_size = tx_size;
@@ -148,22 +152,25 @@ app_init_port(uint8_t portid, struct rte_mempool *mp)
ret = rte_eth_rx_queue_setup(portid, 0, (uint16_t)ring_conf.rx_size,
rte_eth_dev_socket_id(portid), &rx_conf, mp);
if (ret < 0)
- rte_exit(EXIT_FAILURE, "rte_eth_tx_queue_setup: "
- "err=%d, port=%"PRIu8"\n", ret, portid);
+ rte_exit(EXIT_FAILURE,
+ "rte_eth_tx_queue_setup: err=%d, port=%u\n",
+ ret, portid);
/* init one TX queue */
fflush(stdout);
ret = rte_eth_tx_queue_setup(portid, 0,
(uint16_t)ring_conf.tx_size, rte_eth_dev_socket_id(portid), &tx_conf);
if (ret < 0)
- rte_exit(EXIT_FAILURE, "rte_eth_tx_queue_setup: err=%d, "
- "port=%"PRIu8" queue=%d\n", ret, portid, 0);
+ rte_exit(EXIT_FAILURE,
+ "rte_eth_tx_queue_setup: err=%d, port=%u queue=%d\n",
+ ret, portid, 0);
/* Start device */
ret = rte_eth_dev_start(portid);
if (ret < 0)
- rte_exit(EXIT_FAILURE, "rte_pmd_port_start: "
- "err=%d, port=%"PRIu8"\n", ret, portid);
+ rte_exit(EXIT_FAILURE,
+ "rte_pmd_port_start: err=%d, port=%u\n",
+ ret, portid);
printf("done: ");
@@ -256,7 +263,7 @@ app_init_sched_port(uint32_t portid, uint32_t socketid)
uint32_t pipe, subport;
int err;
- rte_eth_link_get((uint8_t)portid, &link);
+ rte_eth_link_get(portid, &link);
port_params.socket = socketid;
port_params.rate = (uint64_t) link.link_speed * 1000 * 1000 / 8;
diff --git a/examples/qos_sched/main.c b/examples/qos_sched/main.c
index e10cfd44..1e2fb189 100644
--- a/examples/qos_sched/main.c
+++ b/examples/qos_sched/main.c
@@ -125,8 +125,7 @@ app_main_loop(__attribute__((unused))void *dummy)
/* initialize mbuf memory */
if (mode == APP_RX_MODE) {
for (i = 0; i < rx_idx; i++) {
- RTE_LOG(INFO, APP, "flow %u lcoreid %u "
- "reading port %"PRIu8"\n",
+ RTE_LOG(INFO, APP, "flow%u lcoreid%u reading port%u\n",
i, lcore_id, rx_confs[i]->rx_port);
}
@@ -140,8 +139,8 @@ app_main_loop(__attribute__((unused))void *dummy)
if (wt_confs[i]->m_table == NULL)
rte_panic("flow %u unable to allocate memory buffer\n", i);
- RTE_LOG(INFO, APP, "flow %u lcoreid %u sched+write "
- "port %"PRIu8"\n",
+ RTE_LOG(INFO, APP,
+ "flow %u lcoreid %u sched+write port %u\n",
i, lcore_id, wt_confs[i]->tx_port);
}
@@ -155,8 +154,7 @@ app_main_loop(__attribute__((unused))void *dummy)
if (tx_confs[i]->m_table == NULL)
rte_panic("flow %u unable to allocate memory buffer\n", i);
- RTE_LOG(INFO, APP, "flow %u lcoreid %u "
- "writing port %"PRIu8"\n",
+ RTE_LOG(INFO, APP, "flow%u lcoreid%u write port%u\n",
i, lcore_id, tx_confs[i]->tx_port);
}
@@ -186,7 +184,7 @@ app_stat(void)
struct flow_conf *flow = &qos_conf[i];
rte_eth_stats_get(flow->rx_port, &stats);
- printf("\nRX port %"PRIu8": rx: %"PRIu64 " err: %"PRIu64
+ printf("\nRX port %"PRIu16": rx: %"PRIu64 " err: %"PRIu64
" no_mbuf: %"PRIu64 "\n",
flow->rx_port,
stats.ipackets - rx_stats[i].ipackets,
@@ -195,7 +193,7 @@ app_stat(void)
memcpy(&rx_stats[i], &stats, sizeof(stats));
rte_eth_stats_get(flow->tx_port, &stats);
- printf("TX port %"PRIu8": tx: %" PRIu64 " err: %" PRIu64 "\n",
+ printf("TX port %"PRIu16": tx: %" PRIu64 " err: %" PRIu64 "\n",
flow->tx_port,
stats.opackets - tx_stats[i].opackets,
stats.oerrors - tx_stats[i].oerrors);
diff --git a/examples/qos_sched/main.h b/examples/qos_sched/main.h
index 8d02e1ad..77b6e3ee 100644
--- a/examples/qos_sched/main.h
+++ b/examples/qos_sched/main.h
@@ -106,8 +106,8 @@ struct thread_conf
uint32_t n_mbufs;
struct rte_mbuf **m_table;
- uint8_t rx_port;
- uint8_t tx_port;
+ uint16_t rx_port;
+ uint16_t tx_port;
uint16_t rx_queue;
uint16_t tx_queue;
struct rte_ring *rx_ring;
@@ -125,8 +125,8 @@ struct flow_conf
uint32_t rx_core;
uint32_t wt_core;
uint32_t tx_core;
- uint8_t rx_port;
- uint8_t tx_port;
+ uint16_t rx_port;
+ uint16_t tx_port;
uint16_t rx_queue;
uint16_t tx_queue;
struct rte_ring *rx_ring;
@@ -188,13 +188,15 @@ void app_worker_thread(struct thread_conf **qconf);
void app_mixed_thread(struct thread_conf **qconf);
void app_stat(void);
-int subport_stat(uint8_t port_id, uint32_t subport_id);
-int pipe_stat(uint8_t port_id, uint32_t subport_id, uint32_t pipe_id);
-int qavg_q(uint8_t port_id, uint32_t subport_id, uint32_t pipe_id, uint8_t tc, uint8_t q);
-int qavg_tcpipe(uint8_t port_id, uint32_t subport_id, uint32_t pipe_id, uint8_t tc);
-int qavg_pipe(uint8_t port_id, uint32_t subport_id, uint32_t pipe_id);
-int qavg_tcsubport(uint8_t port_id, uint32_t subport_id, uint8_t tc);
-int qavg_subport(uint8_t port_id, uint32_t subport_id);
+int subport_stat(uint16_t port_id, uint32_t subport_id);
+int pipe_stat(uint16_t port_id, uint32_t subport_id, uint32_t pipe_id);
+int qavg_q(uint16_t port_id, uint32_t subport_id, uint32_t pipe_id,
+ uint8_t tc, uint8_t q);
+int qavg_tcpipe(uint16_t port_id, uint32_t subport_id, uint32_t pipe_id,
+ uint8_t tc);
+int qavg_pipe(uint16_t port_id, uint32_t subport_id, uint32_t pipe_id);
+int qavg_tcsubport(uint16_t port_id, uint32_t subport_id, uint8_t tc);
+int qavg_subport(uint16_t port_id, uint32_t subport_id);
#ifdef __cplusplus
}
diff --git a/examples/qos_sched/stats.c b/examples/qos_sched/stats.c
index 5c894455..b5545e10 100644
--- a/examples/qos_sched/stats.c
+++ b/examples/qos_sched/stats.c
@@ -37,7 +37,8 @@
#include "main.h"
int
-qavg_q(uint8_t port_id, uint32_t subport_id, uint32_t pipe_id, uint8_t tc, uint8_t q)
+qavg_q(uint16_t port_id, uint32_t subport_id, uint32_t pipe_id, uint8_t tc,
+ uint8_t q)
{
struct rte_sched_queue_stats stats;
struct rte_sched_port *port;
@@ -74,7 +75,8 @@ qavg_q(uint8_t port_id, uint32_t subport_id, uint32_t pipe_id, uint8_t tc, uint8
}
int
-qavg_tcpipe(uint8_t port_id, uint32_t subport_id, uint32_t pipe_id, uint8_t tc)
+qavg_tcpipe(uint16_t port_id, uint32_t subport_id, uint32_t pipe_id,
+ uint8_t tc)
{
struct rte_sched_queue_stats stats;
struct rte_sched_port *port;
@@ -114,7 +116,7 @@ qavg_tcpipe(uint8_t port_id, uint32_t subport_id, uint32_t pipe_id, uint8_t tc)
}
int
-qavg_pipe(uint8_t port_id, uint32_t subport_id, uint32_t pipe_id)
+qavg_pipe(uint16_t port_id, uint32_t subport_id, uint32_t pipe_id)
{
struct rte_sched_queue_stats stats;
struct rte_sched_port *port;
@@ -153,7 +155,7 @@ qavg_pipe(uint8_t port_id, uint32_t subport_id, uint32_t pipe_id)
}
int
-qavg_tcsubport(uint8_t port_id, uint32_t subport_id, uint8_t tc)
+qavg_tcsubport(uint16_t port_id, uint32_t subport_id, uint8_t tc)
{
struct rte_sched_queue_stats stats;
struct rte_sched_port *port;
@@ -195,7 +197,7 @@ qavg_tcsubport(uint8_t port_id, uint32_t subport_id, uint8_t tc)
}
int
-qavg_subport(uint8_t port_id, uint32_t subport_id)
+qavg_subport(uint16_t port_id, uint32_t subport_id)
{
struct rte_sched_queue_stats stats;
struct rte_sched_port *port;
@@ -237,7 +239,7 @@ qavg_subport(uint8_t port_id, uint32_t subport_id)
}
int
-subport_stat(uint8_t port_id, uint32_t subport_id)
+subport_stat(uint16_t port_id, uint32_t subport_id)
{
struct rte_sched_subport_stats stats;
struct rte_sched_port *port;
@@ -273,7 +275,7 @@ subport_stat(uint8_t port_id, uint32_t subport_id)
}
int
-pipe_stat(uint8_t port_id, uint32_t subport_id, uint32_t pipe_id)
+pipe_stat(uint16_t port_id, uint32_t subport_id, uint32_t pipe_id)
{
struct rte_sched_queue_stats stats;
struct rte_sched_port *port;