[dpdk-dev,v6,1/2] net/ixgbe: support multiqueue mode VMDq DCB with SRIOV
diff mbox

Message ID 1477414269-27156-2-git-send-email-bernard.iremonger@intel.com
State Superseded, archived
Delegated to: Bruce Richardson
Headers show

Commit Message

Bernard Iremonger Oct. 25, 2016, 4:51 p.m. UTC
The folowing changes have been made to allow Data Centre Bridge
(DCB) configuration when SRIOV is enabled.

Modify ixgbe_check_mq_mode function,
when SRIOV is enabled, enable mq_mode
ETH_MQ_RX_VMDQ_DCB and ETH_MQ_TX_VMDQ_DCB.

Modify ixgbe_dcb_tx_hw_config function,
replace the struct ixgbe_hw parameter with a
struct rte_eth_dev parameter and handle SRIOV enabled.

Modify ixgbe_dev_mq_rx_configure function,
when SRIOV is enabled, enable mq_mode ETH_MQ_RX_VMDQ_DCB.

Modify ixgbe_configure_dcb function,
revise check on dev->data->nb_rx_queues.

Signed-off-by: Rahul R Shah <rahul.r.shah@intel.com>
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Wenzhuo Lu <Wenzhuo.lu@intel.com>
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 11 ++++++-----
 drivers/net/ixgbe/ixgbe_rxtx.c   | 35 ++++++++++++++++++++++-------------
 2 files changed, 28 insertions(+), 18 deletions(-)

Comments

Wu, Jingjing Oct. 26, 2016, 2:38 p.m. UTC | #1
> -----Original Message-----
> From: Iremonger, Bernard
> Sent: Wednesday, October 26, 2016 12:51 AM
> To: dev@dpdk.org; Shah, Rahul R <rahul.r.shah@intel.com>; Lu, Wenzhuo
> <wenzhuo.lu@intel.com>; Dumitrescu, Cristian <cristian.dumitrescu@intel.com>; Wu, Jingjing
> <jingjing.wu@intel.com>
> Cc: Iremonger, Bernard <bernard.iremonger@intel.com>
> Subject: [PATCH v6 1/2] net/ixgbe: support multiqueue mode VMDq DCB with SRIOV
> 
> The folowing changes have been made to allow Data Centre Bridge
> (DCB) configuration when SRIOV is enabled.
> 
> Modify ixgbe_check_mq_mode function,
> when SRIOV is enabled, enable mq_mode
> ETH_MQ_RX_VMDQ_DCB and ETH_MQ_TX_VMDQ_DCB.
> 
> Modify ixgbe_dcb_tx_hw_config function,
> replace the struct ixgbe_hw parameter with a
> struct rte_eth_dev parameter and handle SRIOV enabled.
> 
> Modify ixgbe_dev_mq_rx_configure function,
> when SRIOV is enabled, enable mq_mode ETH_MQ_RX_VMDQ_DCB.
> 
> Modify ixgbe_configure_dcb function,
> revise check on dev->data->nb_rx_queues.
> 
> Signed-off-by: Rahul R Shah <rahul.r.shah@intel.com>
> Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
> Acked-by: Wenzhuo Lu <Wenzhuo.lu@intel.com>
> ---
>  drivers/net/ixgbe/ixgbe_ethdev.c | 11 ++++++-----
>  drivers/net/ixgbe/ixgbe_rxtx.c   | 35 ++++++++++++++++++++++-------------
>  2 files changed, 28 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
> index 4ca5747..4d5ce83 100644
> --- a/drivers/net/ixgbe/ixgbe_ethdev.c
> +++ b/drivers/net/ixgbe/ixgbe_ethdev.c
> @@ -1977,6 +1977,9 @@ ixgbe_check_mq_mode(struct rte_eth_dev *dev)
>  		/* check multi-queue mode */
>  		switch (dev_conf->rxmode.mq_mode) {
>  		case ETH_MQ_RX_VMDQ_DCB:
> +			PMD_INIT_LOG(INFO, "ETH_MQ_RX_VMDQ_DCB mode supported in SRIOV");
> +			dev->data->dev_conf.rxmode.mq_mode = ETH_MQ_RX_VMDQ_DCB;
This line is duplicated, mq_mode is ETH_MQ_RX_VMDQ_DCB already. And it's better to
check if the nb_queue is valid.
Bernard Iremonger Oct. 26, 2016, 3:29 p.m. UTC | #2
Hi Jingjing,

<snip>

> > Subject: [PATCH v6 1/2] net/ixgbe: support multiqueue mode VMDq DCB
> > with SRIOV
> >
> > The folowing changes have been made to allow Data Centre Bridge
> > (DCB) configuration when SRIOV is enabled.
> >
> > Modify ixgbe_check_mq_mode function,
> > when SRIOV is enabled, enable mq_mode
> > ETH_MQ_RX_VMDQ_DCB and ETH_MQ_TX_VMDQ_DCB.
> >
> > Modify ixgbe_dcb_tx_hw_config function, replace the struct ixgbe_hw
> > parameter with a struct rte_eth_dev parameter and handle SRIOV
> > enabled.
> >
> > Modify ixgbe_dev_mq_rx_configure function, when SRIOV is enabled,
> > enable mq_mode ETH_MQ_RX_VMDQ_DCB.
> >
> > Modify ixgbe_configure_dcb function,
> > revise check on dev->data->nb_rx_queues.
> >
> > Signed-off-by: Rahul R Shah <rahul.r.shah@intel.com>
> > Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
> > Acked-by: Wenzhuo Lu <Wenzhuo.lu@intel.com>
> > ---
> >  drivers/net/ixgbe/ixgbe_ethdev.c | 11 ++++++-----
> >  drivers/net/ixgbe/ixgbe_rxtx.c   | 35 ++++++++++++++++++++++-----------
> --
> >  2 files changed, 28 insertions(+), 18 deletions(-)
> >
> > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c
> > b/drivers/net/ixgbe/ixgbe_ethdev.c
> > index 4ca5747..4d5ce83 100644
> > --- a/drivers/net/ixgbe/ixgbe_ethdev.c
> > +++ b/drivers/net/ixgbe/ixgbe_ethdev.c
> > @@ -1977,6 +1977,9 @@ ixgbe_check_mq_mode(struct rte_eth_dev
> *dev)
> >  		/* check multi-queue mode */
> >  		switch (dev_conf->rxmode.mq_mode) {
> >  		case ETH_MQ_RX_VMDQ_DCB:
> > +			PMD_INIT_LOG(INFO, "ETH_MQ_RX_VMDQ_DCB
> mode supported in SRIOV");
> > +			dev->data->dev_conf.rxmode.mq_mode =
> ETH_MQ_RX_VMDQ_DCB;
> This line is duplicated, mq_mode is ETH_MQ_RX_VMDQ_DCB already.

The mq_mode is assigned at this point in the other cases. This case is coded in line with the other cases.

>  and it's better to check if the nb_queue is valid.

What value is expected for nb_queue at this point?

Regards,

Bernard.


>
Bernard Iremonger Oct. 26, 2016, 4:09 p.m. UTC | #3
Hi Jingling,

<snip>

> > > Subject: [PATCH v6 1/2] net/ixgbe: support multiqueue mode VMDq DCB
> > > with SRIOV
> > >
> > > The folowing changes have been made to allow Data Centre Bridge
> > > (DCB) configuration when SRIOV is enabled.
> > >
> > > Modify ixgbe_check_mq_mode function, when SRIOV is enabled, enable
> > > mq_mode ETH_MQ_RX_VMDQ_DCB and ETH_MQ_TX_VMDQ_DCB.
> > >
> > > Modify ixgbe_dcb_tx_hw_config function, replace the struct ixgbe_hw
> > > parameter with a struct rte_eth_dev parameter and handle SRIOV
> > > enabled.
> > >
> > > Modify ixgbe_dev_mq_rx_configure function, when SRIOV is enabled,
> > > enable mq_mode ETH_MQ_RX_VMDQ_DCB.
> > >
> > > Modify ixgbe_configure_dcb function, revise check on
> > > dev->data->nb_rx_queues.
> > >
> > > Signed-off-by: Rahul R Shah <rahul.r.shah@intel.com>
> > > Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
> > > Acked-by: Wenzhuo Lu <Wenzhuo.lu@intel.com>
> > > ---
> > >  drivers/net/ixgbe/ixgbe_ethdev.c | 11 ++++++-----
> > >  drivers/net/ixgbe/ixgbe_rxtx.c   | 35 ++++++++++++++++++++++--------
> ---
> > --
> > >  2 files changed, 28 insertions(+), 18 deletions(-)
> > >
> > > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c
> > > b/drivers/net/ixgbe/ixgbe_ethdev.c
> > > index 4ca5747..4d5ce83 100644
> > > --- a/drivers/net/ixgbe/ixgbe_ethdev.c
> > > +++ b/drivers/net/ixgbe/ixgbe_ethdev.c
> > > @@ -1977,6 +1977,9 @@ ixgbe_check_mq_mode(struct rte_eth_dev
> > *dev)
> > >  		/* check multi-queue mode */
> > >  		switch (dev_conf->rxmode.mq_mode) {
> > >  		case ETH_MQ_RX_VMDQ_DCB:
> > > +			PMD_INIT_LOG(INFO, "ETH_MQ_RX_VMDQ_DCB
> > mode supported in SRIOV");
> > > +			dev->data->dev_conf.rxmode.mq_mode =
> > ETH_MQ_RX_VMDQ_DCB;
> > This line is duplicated, mq_mode is ETH_MQ_RX_VMDQ_DCB already.
> 
> The mq_mode is assigned at this point in the other cases. This case is coded
> in line with the other cases.
> 
> >  and it's better to check if the nb_queue is valid.
> 
The nb_rx_q and nb_tx_q are checked after the switch statements at line 2027 with the v6 patch applied.

Regards,

Bernard.
Wu, Jingjing Oct. 26, 2016, 4:33 p.m. UTC | #4
> -----Original Message-----
> From: Iremonger, Bernard
> Sent: Thursday, October 27, 2016 12:10 AM
> To: Wu, Jingjing <jingjing.wu@intel.com>; dev@dpdk.org; Shah, Rahul R
> <rahul.r.shah@intel.com>; Lu, Wenzhuo <wenzhuo.lu@intel.com>; Dumitrescu, Cristian
> <cristian.dumitrescu@intel.com>
> Subject: RE: [PATCH v6 1/2] net/ixgbe: support multiqueue mode VMDq DCB with SRIOV
> 
> Hi Jingling,
> 
> <snip>
> 
> > > > Subject: [PATCH v6 1/2] net/ixgbe: support multiqueue mode VMDq DCB
> > > > with SRIOV
> > > >
> > > > The folowing changes have been made to allow Data Centre Bridge
> > > > (DCB) configuration when SRIOV is enabled.
> > > >
> > > > Modify ixgbe_check_mq_mode function, when SRIOV is enabled, enable
> > > > mq_mode ETH_MQ_RX_VMDQ_DCB and ETH_MQ_TX_VMDQ_DCB.
> > > >
> > > > Modify ixgbe_dcb_tx_hw_config function, replace the struct ixgbe_hw
> > > > parameter with a struct rte_eth_dev parameter and handle SRIOV
> > > > enabled.
> > > >
> > > > Modify ixgbe_dev_mq_rx_configure function, when SRIOV is enabled,
> > > > enable mq_mode ETH_MQ_RX_VMDQ_DCB.
> > > >
> > > > Modify ixgbe_configure_dcb function, revise check on
> > > > dev->data->nb_rx_queues.
> > > >
> > > > Signed-off-by: Rahul R Shah <rahul.r.shah@intel.com>
> > > > Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
> > > > Acked-by: Wenzhuo Lu <Wenzhuo.lu@intel.com>
> > > > ---
> > > >  drivers/net/ixgbe/ixgbe_ethdev.c | 11 ++++++-----
> > > >  drivers/net/ixgbe/ixgbe_rxtx.c   | 35 ++++++++++++++++++++++--------
> > ---
> > > --
> > > >  2 files changed, 28 insertions(+), 18 deletions(-)
> > > >
> > > > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c
> > > > b/drivers/net/ixgbe/ixgbe_ethdev.c
> > > > index 4ca5747..4d5ce83 100644
> > > > --- a/drivers/net/ixgbe/ixgbe_ethdev.c
> > > > +++ b/drivers/net/ixgbe/ixgbe_ethdev.c
> > > > @@ -1977,6 +1977,9 @@ ixgbe_check_mq_mode(struct rte_eth_dev
> > > *dev)
> > > >  		/* check multi-queue mode */
> > > >  		switch (dev_conf->rxmode.mq_mode) {
> > > >  		case ETH_MQ_RX_VMDQ_DCB:
> > > > +			PMD_INIT_LOG(INFO, "ETH_MQ_RX_VMDQ_DCB
> > > mode supported in SRIOV");
> > > > +			dev->data->dev_conf.rxmode.mq_mode =
> > > ETH_MQ_RX_VMDQ_DCB;
> > > This line is duplicated, mq_mode is ETH_MQ_RX_VMDQ_DCB already.
> >
> > The mq_mode is assigned at this point in the other cases. This case is coded
> > in line with the other cases.
> >
> > >  and it's better to check if the nb_queue is valid.
> >
> The nb_rx_q and nb_tx_q are checked after the switch statements at line 2027 with the v6
> patch applied.
Thanks, it's fine then. :)
> Regards,
> 
> Bernard.

Patch
diff mbox

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 4ca5747..4d5ce83 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -1977,6 +1977,9 @@  ixgbe_check_mq_mode(struct rte_eth_dev *dev)
 		/* check multi-queue mode */
 		switch (dev_conf->rxmode.mq_mode) {
 		case ETH_MQ_RX_VMDQ_DCB:
+			PMD_INIT_LOG(INFO, "ETH_MQ_RX_VMDQ_DCB mode supported in SRIOV");
+			dev->data->dev_conf.rxmode.mq_mode = ETH_MQ_RX_VMDQ_DCB;
+			break;
 		case ETH_MQ_RX_VMDQ_DCB_RSS:
 			/* DCB/RSS VMDQ in SRIOV mode, not implement yet */
 			PMD_INIT_LOG(ERR, "SRIOV active,"
@@ -2012,11 +2015,9 @@  ixgbe_check_mq_mode(struct rte_eth_dev *dev)
 
 		switch (dev_conf->txmode.mq_mode) {
 		case ETH_MQ_TX_VMDQ_DCB:
-			/* DCB VMDQ in SRIOV mode, not implement yet */
-			PMD_INIT_LOG(ERR, "SRIOV is active,"
-					" unsupported VMDQ mq_mode tx %d.",
-					dev_conf->txmode.mq_mode);
-			return -EINVAL;
+			PMD_INIT_LOG(INFO, "ETH_MQ_TX_VMDQ_DCB mode supported in SRIOV");
+			dev->data->dev_conf.txmode.mq_mode = ETH_MQ_TX_VMDQ_DCB;
+			break;
 		default: /* ETH_MQ_TX_VMDQ_ONLY or ETH_MQ_TX_NONE */
 			dev->data->dev_conf.txmode.mq_mode = ETH_MQ_TX_VMDQ_ONLY;
 			break;
diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c
index 2ce8234..b2d9f45 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx.c
@@ -1,7 +1,7 @@ 
 /*-
  *   BSD LICENSE
  *
- *   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
  *   Copyright 2014 6WIND S.A.
  *   All rights reserved.
  *
@@ -3313,15 +3313,16 @@  ixgbe_vmdq_dcb_configure(struct rte_eth_dev *dev)
 
 /**
  * ixgbe_dcb_config_tx_hw_config - Configure general DCB TX parameters
- * @hw: pointer to hardware structure
+ * @dev: pointer to eth_dev structure
  * @dcb_config: pointer to ixgbe_dcb_config structure
  */
 static void
-ixgbe_dcb_tx_hw_config(struct ixgbe_hw *hw,
+ixgbe_dcb_tx_hw_config(struct rte_eth_dev *dev,
 		       struct ixgbe_dcb_config *dcb_config)
 {
 	uint32_t reg;
 	uint32_t q;
+	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
 	PMD_INIT_FUNC_TRACE();
 	if (hw->mac.type != ixgbe_mac_82598EB) {
@@ -3340,10 +3341,17 @@  ixgbe_dcb_tx_hw_config(struct ixgbe_hw *hw,
 			reg |= IXGBE_MTQC_VT_ENA;
 		IXGBE_WRITE_REG(hw, IXGBE_MTQC, reg);
 
-		/* Disable drop for all queues */
-		for (q = 0; q < 128; q++)
-			IXGBE_WRITE_REG(hw, IXGBE_QDE,
-				(IXGBE_QDE_WRITE | (q << IXGBE_QDE_IDX_SHIFT)));
+		if (RTE_ETH_DEV_SRIOV(dev).active == 0) {
+			/* Disable drop for all queues in VMDQ mode*/
+			for (q = 0; q < 128; q++)
+				IXGBE_WRITE_REG(hw, IXGBE_QDE,
+						(IXGBE_QDE_WRITE | (q << IXGBE_QDE_IDX_SHIFT)));
+		} else {
+			/* Enable drop for all queues in SRIOV mode */
+			for (q = 0; q < 128; q++)
+				IXGBE_WRITE_REG(hw, IXGBE_QDE,
+						(IXGBE_QDE_WRITE | (q << IXGBE_QDE_IDX_SHIFT) | IXGBE_QDE_ENABLE));
+		}
 
 		/* Enable the Tx desc arbiter */
 		reg = IXGBE_READ_REG(hw, IXGBE_RTTDCS);
@@ -3378,7 +3386,7 @@  ixgbe_vmdq_dcb_hw_tx_config(struct rte_eth_dev *dev,
 			vmdq_tx_conf->nb_queue_pools == ETH_16_POOLS ? 0xFFFF : 0xFFFFFFFF);
 
 	/*Configure general DCB TX parameters*/
-	ixgbe_dcb_tx_hw_config(hw, dcb_config);
+	ixgbe_dcb_tx_hw_config(dev, dcb_config);
 }
 
 static void
@@ -3661,7 +3669,7 @@  ixgbe_dcb_hw_configure(struct rte_eth_dev *dev,
 		/*get DCB TX configuration parameters from rte_eth_conf*/
 		ixgbe_dcb_tx_config(dev, dcb_config);
 		/*Configure general DCB TX parameters*/
-		ixgbe_dcb_tx_hw_config(hw, dcb_config);
+		ixgbe_dcb_tx_hw_config(dev, dcb_config);
 		break;
 	default:
 		PMD_INIT_LOG(ERR, "Incorrect DCB TX mode configuration");
@@ -3810,7 +3818,7 @@  void ixgbe_configure_dcb(struct rte_eth_dev *dev)
 	    (dev_conf->rxmode.mq_mode != ETH_MQ_RX_DCB_RSS))
 		return;
 
-	if (dev->data->nb_rx_queues != ETH_DCB_NUM_QUEUES)
+	if (dev->data->nb_rx_queues > ETH_DCB_NUM_QUEUES)
 		return;
 
 	/** Configure DCB hardware **/
@@ -4082,12 +4090,13 @@  ixgbe_dev_mq_rx_configure(struct rte_eth_dev *dev)
 		case ETH_MQ_RX_VMDQ_RSS:
 			ixgbe_config_vf_rss(dev);
 			break;
-
-		/* FIXME if support DCB/RSS together with VMDq & SRIOV */
 		case ETH_MQ_RX_VMDQ_DCB:
+			ixgbe_vmdq_dcb_configure(dev);
+			break;
+		/* FIXME if support DCB/RSS together with VMDq & SRIOV */
 		case ETH_MQ_RX_VMDQ_DCB_RSS:
 			PMD_INIT_LOG(ERR,
-				"Could not support DCB with VMDq & SRIOV");
+				"Could not support DCB/RSS with VMDq & SRIOV");
 			return -1;
 		default:
 			ixgbe_config_vf_default(dev);