[dpdk-dev] [PATCH 8/8] app/testpmd: set up DCB forwarding based on traffic class

2015-10-28 Thread Wu, Jingjing


> -Original Message-
> From: Liu, Jijiang
> Sent: Wednesday, October 28, 2015 9:46 AM
> To: Wu, Jingjing; dev at dpdk.org
> Cc: Zhang, Helin; Tao, Zhe; Pei, Yulong
> Subject: RE: [PATCH 8/8] app/testpmd: set up DCB forwarding based on
> traffic class
> 
> > -}
> These codes are removed, and how to guarantee DCB function of 82599 NIC
> work normally?

In this patch, the mapping relationship is not defined in testpmd.
It can be queried by the rte_eth_dev_get_dcb_info API, and the forwarding
Is setup based on TC. So DCB function of 82599 NIC in testpmd works too.

Thanks
Jingjing


[dpdk-dev] [PATCH 8/8] app/testpmd: set up DCB forwarding based on traffic class

2015-10-28 Thread Liu, Jijiang


> -Original Message-
> From: Wu, Jingjing
> Sent: Thursday, September 24, 2015 2:03 PM
> To: dev at dpdk.org
> Cc: Wu, Jingjing; Liu, Jijiang; Zhang, Helin; Tao, Zhe; Pei, Yulong
> Subject: [PATCH 8/8] app/testpmd: set up DCB forwarding based on traffic
> class
> 
> This patch changes the testpmd DCB forwarding stream to make it based on
> traffic class.
> It also fixes some coding style issues.
> 
> Signed-off-by: Jingjing Wu 
> ---
>  app/test-pmd/cmdline.c |  39 +++-  app/test-pmd/config.c  | 159
> +
>  app/test-pmd/testpmd.c | 151 +-
>  app/test-pmd/testpmd.h |  23 +--
>  4 files changed, 176 insertions(+), 196 deletions(-)
> 
> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index
> 0f8f48f..2ec855f 100644
> --- a/app/test-pmd/cmdline.c
> +++ b/app/test-pmd/cmdline.c
> @@ -1999,37 +1999,46 @@ cmd_config_dcb_parsed(void *parsed_result,
>  __attribute__((unused)) void *data)  {
>   struct cmd_config_dcb *res = parsed_result;
> - struct dcb_config dcb_conf;
>   portid_t port_id = res->port_id;
>   struct rte_port *port;
> + uint8_t pfc_en;
> + int ret;
> 
>   port = &ports[port_id];
>   /** Check if the port is not started **/
>   if (port->port_status != RTE_PORT_STOPPED) {
> - printf("Please stop port %d first\n",port_id);
> + printf("Please stop port %d first\n", port_id);
>   return;
>   }
> 
> - dcb_conf.num_tcs = (enum rte_eth_nb_tcs) res->num_tcs;
> - if ((dcb_conf.num_tcs != ETH_4_TCS) && (dcb_conf.num_tcs !=
> ETH_8_TCS)){
> - printf("The invalid number of traffic class,only 4 or 8
> allowed\n");
> + if ((res->num_tcs != ETH_4_TCS) && (res->num_tcs != ETH_8_TCS)) {
> + printf("The invalid number of traffic class,"
> + " only 4 or 8 allowed.\n");
>   return;
>   }
> 
> - /* DCB in VT mode */
> - if (!strncmp(res->vt_en, "on",2))
> - dcb_conf.dcb_mode = DCB_VT_ENABLED;
> + if (nb_fwd_lcores < res->num_tcs) {
> + printf("nb_cores shouldn't be less than number of TCs.\n");
> + return;
> + }
> + if (!strncmp(res->pfc_en, "on", 2))
> + pfc_en = 1;
>   else
> - dcb_conf.dcb_mode = DCB_ENABLED;
> + pfc_en = 0;
> 
> - if (!strncmp(res->pfc_en, "on",2)) {
> - dcb_conf.pfc_en = 1;
> - }
> + /* DCB in VT mode */
> + if (!strncmp(res->vt_en, "on", 2))
> + ret = init_port_dcb_config(port_id, DCB_VT_ENABLED,
> + (enum rte_eth_nb_tcs)res->num_tcs,
> + pfc_en);
>   else
> - dcb_conf.pfc_en = 0;
> + ret = init_port_dcb_config(port_id, DCB_ENABLED,
> + (enum rte_eth_nb_tcs)res->num_tcs,
> + pfc_en);
> +
> 
> - if (init_port_dcb_config(port_id,&dcb_conf) != 0) {
> - printf("Cannot initialize network ports\n");
> + if (ret != 0) {
> + printf("Cannot initialize network ports.\n");
>   return;
>   }
> 
> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index
> cf2aa6e..e10da57 100644
> --- a/app/test-pmd/config.c
> +++ b/app/test-pmd/config.c
> @@ -1128,113 +1128,92 @@ rss_fwd_config_setup(void)
>   }
>  }
> 
> -/*
> - * In DCB and VT on,the mapping of 128 receive queues to 128 transmit
> queues.
> - */
> -static void
> -dcb_rxq_2_txq_mapping(queueid_t rxq, queueid_t *txq) -{
> - if(dcb_q_mapping == DCB_4_TCS_Q_MAPPING) {
> -
> - if (rxq < 32)
> - /* tc0: 0-31 */
> - *txq = rxq;
> - else if (rxq < 64) {
> - /* tc1: 64-95 */
> - *txq =  (uint16_t)(rxq + 32);
> - }
> - else {
> - /* tc2: 96-111;tc3:112-127 */
> - *txq =  (uint16_t)(rxq/2 + 64);
> - }
> - }
> - else {
> - if (rxq < 16)
> - /* tc0 mapping*/
> - *txq = rxq;
> - else if (rxq < 32) {
> - /* tc1 mapping*/
> -  *txq = (uint16_t)(rxq + 16);
> - }
> - else if (rxq < 64) {
> - /*tc2,tc3 mapping */
> - *txq =  (uint16_t)(rxq + 32);
> - }
> - else {
> - /* tc4,tc5,tc6 and tc7 mapping */
> - *txq =  (uint16_t)(rxq/2 + 64);
> - }
> - }
> -}
These codes are removed, and how to guarantee DCB function of 82599 NIC work 
normally? 
>  /**
> - * For the DCB forwarding test, each core is assigned on every port multi-
> transmit
> - * queue.
> + * For the DCB forwarding test, each core is assigned on each traffic clas

[dpdk-dev] [PATCH 8/8] app/testpmd: set up DCB forwarding based on traffic class

2015-09-24 Thread Jingjing Wu
This patch changes the testpmd DCB forwarding stream to make it
based on traffic class.
It also fixes some coding style issues.

Signed-off-by: Jingjing Wu 
---
 app/test-pmd/cmdline.c |  39 +++-
 app/test-pmd/config.c  | 159 +
 app/test-pmd/testpmd.c | 151 +-
 app/test-pmd/testpmd.h |  23 +--
 4 files changed, 176 insertions(+), 196 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 0f8f48f..2ec855f 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -1999,37 +1999,46 @@ cmd_config_dcb_parsed(void *parsed_result,
 __attribute__((unused)) void *data)
 {
struct cmd_config_dcb *res = parsed_result;
-   struct dcb_config dcb_conf;
portid_t port_id = res->port_id;
struct rte_port *port;
+   uint8_t pfc_en;
+   int ret;

port = &ports[port_id];
/** Check if the port is not started **/
if (port->port_status != RTE_PORT_STOPPED) {
-   printf("Please stop port %d first\n",port_id);
+   printf("Please stop port %d first\n", port_id);
return;
}

-   dcb_conf.num_tcs = (enum rte_eth_nb_tcs) res->num_tcs;
-   if ((dcb_conf.num_tcs != ETH_4_TCS) && (dcb_conf.num_tcs != ETH_8_TCS)){
-   printf("The invalid number of traffic class,only 4 or 8 
allowed\n");
+   if ((res->num_tcs != ETH_4_TCS) && (res->num_tcs != ETH_8_TCS)) {
+   printf("The invalid number of traffic class,"
+   " only 4 or 8 allowed.\n");
return;
}

-   /* DCB in VT mode */
-   if (!strncmp(res->vt_en, "on",2))
-   dcb_conf.dcb_mode = DCB_VT_ENABLED;
+   if (nb_fwd_lcores < res->num_tcs) {
+   printf("nb_cores shouldn't be less than number of TCs.\n");
+   return;
+   }
+   if (!strncmp(res->pfc_en, "on", 2))
+   pfc_en = 1;
else
-   dcb_conf.dcb_mode = DCB_ENABLED;
+   pfc_en = 0;

-   if (!strncmp(res->pfc_en, "on",2)) {
-   dcb_conf.pfc_en = 1;
-   }
+   /* DCB in VT mode */
+   if (!strncmp(res->vt_en, "on", 2))
+   ret = init_port_dcb_config(port_id, DCB_VT_ENABLED,
+   (enum rte_eth_nb_tcs)res->num_tcs,
+   pfc_en);
else
-   dcb_conf.pfc_en = 0;
+   ret = init_port_dcb_config(port_id, DCB_ENABLED,
+   (enum rte_eth_nb_tcs)res->num_tcs,
+   pfc_en);
+

-   if (init_port_dcb_config(port_id,&dcb_conf) != 0) {
-   printf("Cannot initialize network ports\n");
+   if (ret != 0) {
+   printf("Cannot initialize network ports.\n");
return;
}

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index cf2aa6e..e10da57 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -1128,113 +1128,92 @@ rss_fwd_config_setup(void)
}
 }

-/*
- * In DCB and VT on,the mapping of 128 receive queues to 128 transmit queues.
- */
-static void
-dcb_rxq_2_txq_mapping(queueid_t rxq, queueid_t *txq)
-{
-   if(dcb_q_mapping == DCB_4_TCS_Q_MAPPING) {
-
-   if (rxq < 32)
-   /* tc0: 0-31 */
-   *txq = rxq;
-   else if (rxq < 64) {
-   /* tc1: 64-95 */
-   *txq =  (uint16_t)(rxq + 32);
-   }
-   else {
-   /* tc2: 96-111;tc3:112-127 */
-   *txq =  (uint16_t)(rxq/2 + 64);
-   }
-   }
-   else {
-   if (rxq < 16)
-   /* tc0 mapping*/
-   *txq = rxq;
-   else if (rxq < 32) {
-   /* tc1 mapping*/
-*txq = (uint16_t)(rxq + 16);
-   }
-   else if (rxq < 64) {
-   /*tc2,tc3 mapping */
-   *txq =  (uint16_t)(rxq + 32);
-   }
-   else {
-   /* tc4,tc5,tc6 and tc7 mapping */
-   *txq =  (uint16_t)(rxq/2 + 64);
-   }
-   }
-}
-
 /**
- * For the DCB forwarding test, each core is assigned on every port 
multi-transmit
- * queue.
+ * For the DCB forwarding test, each core is assigned on each traffic class.
  *
  * Each core is assigned a multi-stream, each stream being composed of
  * a RX queue to poll on a RX port for input messages, associated with
- * a TX queue of a TX port where to send forwarded packets.
- * All packets received on the RX queue of index "RxQj" of the RX port "RxPi"
- * are sent on the TX queue "TxQl" of the TX port "TxPk" according to the two
- * following rules:
- * In VT mode,
- *- TxPk = (RxPi + 1) if RxPi is even, (RxP