[dpdk-dev] [PATCH] lib: fix DCB config issue on ixgbe

2016-04-12 Thread Lu, Wenzhuo
Hi Thomas,

> -Original Message-
> From: Thomas Monjalon [mailto:thomas.monjalon at 6wind.com]
> Sent: Monday, April 11, 2016 5:52 PM
> To: Lu, Wenzhuo
> Cc: dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] lib: fix DCB config issue on ixgbe
> 
> 2016-04-11 16:24, Wenzhuo Lu:
> > An issue is found that DCB cannot be configged on ixgbe NICs. It's
> > said the TX queue number is not right.
> > On ixgbe the max TX queue number is not fixed, it depends on the
> > multi-queue mode. The API rte_eth_dev_configure should be used to
> > config this mode. But the input of this API includes TX queue number.
> > The problem is before the mode is configged, we cannot decide the TX
> > queue number.
> >
> > This patch adds an API to config RX & TX multi-queue mode separately.
> > After the mode is configged, the max RX & TX queue number is decided.
> > Then we can set the appropriate RX & TX queue number.
> >
> > Fixes: 96c0450dff86 (ixgbe: fix dropping packets from unsupported Tx
> > queues)
> > Signed-off-by: Wenzhuo Lu 
> > ---
> >  app/test-pmd/testpmd.c | 40 
> > +++---
> >  lib/librte_ether/rte_ethdev.c  | 17 +++
> >  lib/librte_ether/rte_ethdev.h  | 19 
> >  lib/librte_ether/rte_ether_version.map |  1 +
> >  4 files changed, 59 insertions(+), 18 deletions(-)
> 
> Obviously, it will be considered for 16.07.
OK. I've got some feedback from the users that DCB is working, so I think it's 
not a critical issue and maybe only testpmd is impacted.
I'll send a new version later. As rte_ether_version.map should be change for 
16.07.
Thanks.


[dpdk-dev] [PATCH] lib: fix DCB config issue on ixgbe

2016-04-11 Thread Wenzhuo Lu
An issue is found that DCB cannot be configged on ixgbe
NICs. It's said the TX queue number is not right.
On ixgbe the max TX queue number is not fixed, it depends
on the multi-queue mode. The API rte_eth_dev_configure
should be used to config this mode. But the input of this
API includes TX queue number. The problem is before the
mode is configged, we cannot decide the TX queue number.

This patch adds an API to config RX & TX multi-queue mode
separately. After the mode is configged, the max RX & TX
queue number is decided. Then we can set the appropriate
RX & TX queue number.

Fixes: 96c0450dff86 (ixgbe: fix dropping packets from unsupported Tx queues)
Signed-off-by: Wenzhuo Lu 
---
 app/test-pmd/testpmd.c | 40 +++---
 lib/librte_ether/rte_ethdev.c  | 17 +++
 lib/librte_ether/rte_ethdev.h  | 19 
 lib/librte_ether/rte_ether_version.map |  1 +
 4 files changed, 59 insertions(+), 18 deletions(-)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 1398c6c..c726e1c 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1925,17 +1925,31 @@ init_port_dcb_config(portid_t pid,
 uint8_t pfc_en)
 {
struct rte_eth_conf port_conf;
-   struct rte_eth_dev_info dev_info;
struct rte_port *rte_port;
int retval;
uint16_t i;

-   rte_eth_dev_info_get(pid, _info);
+   rte_port = [pid];
+
+   memset(_conf, 0, sizeof(struct rte_eth_conf));
+   /* Enter DCB configuration status */
+   dcb_config = 1;
+
+   /*set configuration of DCB in vt mode and DCB in non-vt mode*/
+   retval = get_eth_dcb_conf(_conf, dcb_mode, num_tcs, pfc_en);
+   if (retval < 0)
+   return retval;
+
+   rte_eth_dev_mq_mode_set(pid,
+   port_conf.rxmode.mq_mode,
+   port_conf.txmode.mq_mode);
+   rte_eth_dev_info_get(pid, _port->dev_info);

/* If dev_info.vmdq_pool_base is greater than 0,
 * the queue id of vmdq pools is started after pf queues.
 */
-   if (dcb_mode == DCB_VT_ENABLED && dev_info.vmdq_pool_base > 0) {
+   if (dcb_mode == DCB_VT_ENABLED &&
+   rte_port->dev_info.vmdq_pool_base > 0) {
printf("VMDQ_DCB multi-queue mode is nonsensical"
" for port %d.", pid);
return -1;
@@ -1945,13 +1959,13 @@ init_port_dcb_config(portid_t pid,
 * and has the same number of rxq and txq in dcb mode
 */
if (dcb_mode == DCB_VT_ENABLED) {
-   nb_rxq = dev_info.max_rx_queues;
-   nb_txq = dev_info.max_tx_queues;
+   nb_rxq = rte_port->dev_info.max_rx_queues;
+   nb_txq = rte_port->dev_info.max_tx_queues;
} else {
/*if vt is disabled, use all pf queues */
-   if (dev_info.vmdq_pool_base == 0) {
-   nb_rxq = dev_info.max_rx_queues;
-   nb_txq = dev_info.max_tx_queues;
+   if (rte_port->dev_info.vmdq_pool_base == 0) {
+   nb_rxq = rte_port->dev_info.max_rx_queues;
+   nb_txq = rte_port->dev_info.max_tx_queues;
} else {
nb_rxq = (queueid_t)num_tcs;
nb_txq = (queueid_t)num_tcs;
@@ -1960,16 +1974,6 @@ init_port_dcb_config(portid_t pid,
}
rx_free_thresh = 64;

-   memset(_conf, 0, sizeof(struct rte_eth_conf));
-   /* Enter DCB configuration status */
-   dcb_config = 1;
-
-   /*set configuration of DCB in vt mode and DCB in non-vt mode*/
-   retval = get_eth_dcb_conf(_conf, dcb_mode, num_tcs, pfc_en);
-   if (retval < 0)
-   return retval;
-
-   rte_port = [pid];
memcpy(_port->dev_conf, _conf, sizeof(struct rte_eth_conf));

rxtx_port_config(rte_port);
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index a31018e..b4eaa29 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -3369,3 +3369,20 @@ rte_eth_dev_l2_tunnel_offload_set(uint8_t port_id,
-ENOTSUP);
return (*dev->dev_ops->l2_tunnel_offload_set)(dev, l2_tunnel, mask, en);
 }
+
+int
+rte_eth_dev_mq_mode_set(uint8_t port_id,
+   enum rte_eth_rx_mq_mode rx_mq_mode,
+   enum rte_eth_tx_mq_mode tx_mq_mode)
+{
+   struct rte_eth_dev *dev;
+
+   RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+
+   dev = _eth_devices[port_id];
+
+   dev->data->dev_conf.rxmode.mq_mode = rx_mq_mode;
+   dev->data->dev_conf.txmode.mq_mode = tx_mq_mode;
+
+   return 0;
+}
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 022733e..852acca 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -4279,6 +4279,25 @@ 

[dpdk-dev] [PATCH] lib: fix DCB config issue on ixgbe

2016-04-11 Thread Thomas Monjalon
2016-04-11 16:24, Wenzhuo Lu:
> An issue is found that DCB cannot be configged on ixgbe
> NICs. It's said the TX queue number is not right.
> On ixgbe the max TX queue number is not fixed, it depends
> on the multi-queue mode. The API rte_eth_dev_configure
> should be used to config this mode. But the input of this
> API includes TX queue number. The problem is before the
> mode is configged, we cannot decide the TX queue number.
> 
> This patch adds an API to config RX & TX multi-queue mode
> separately. After the mode is configged, the max RX & TX
> queue number is decided. Then we can set the appropriate
> RX & TX queue number.
> 
> Fixes: 96c0450dff86 (ixgbe: fix dropping packets from unsupported Tx queues)
> Signed-off-by: Wenzhuo Lu 
> ---
>  app/test-pmd/testpmd.c | 40 
> +++---
>  lib/librte_ether/rte_ethdev.c  | 17 +++
>  lib/librte_ether/rte_ethdev.h  | 19 
>  lib/librte_ether/rte_ether_version.map |  1 +
>  4 files changed, 59 insertions(+), 18 deletions(-)

Obviously, it will be considered for 16.07.