Skip to contentSkip to conversation

pmd: add DCB for VF for ixgbe

PATCH In review Michal Jastrzebski 4 participants 6 messages Jan 12, 2015 – Jan 14, 2015 4 messages not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 pmd: add DCB for VF for ixgbe

Date: Mon, 12 Jan 2015 15:39:40 +0100
Message-Id: <1421073581-6644-2-git-send-email-michalx.k.jastrzebski-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
X-Mailer: git-send-email 2.1.1
In-Reply-To: <1421073581-6644-1-git-send-email-michalx.k.jastrzebski-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
References: <1421073581-6644-1-git-send-email-michalx.k.jastrzebski-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

From: Pawel Wodkowski <[email protected]>

This patch add support for DCB in SRIOV mode. When no PFC

is enabled this feature might be used as multiple queues

(up to 8 or 4) for VF.

It incorporate following modifications:

- Allow zero rx/tx queues to be passed to rte_eth_dev_configure().

Rationale:

in SRIOV mode PF use first free VF to RX/TX. If VF count

is 16 or 32 all recources are assigned to VFs so PF can

be used only for configuration.

- split nb_q_per_pool to nb_rx_q_per_pool and nb_tx_q_per_pool

Rationale:

rx and tx number of queue might be different if RX and TX are

configured in different mode. This allow to inform VF about

proper number of queues.

- extern mailbox API for DCB mode

---

 lib/librte_ether/rte_ethdev.c       |   84 +++++++++++++++++++++---------
 lib/librte_ether/rte_ethdev.h       |    5 +-
 lib/librte_pmd_e1000/igb_pf.c       |    3 +-
 lib/librte_pmd_ixgbe/ixgbe_ethdev.c |   10 ++--
 lib/librte_pmd_ixgbe/ixgbe_ethdev.h |    1 +
 lib/librte_pmd_ixgbe/ixgbe_pf.c     |   98 ++++++++++++++++++++++++++++++-----
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c   |    7 ++-
 7 files changed, 159 insertions(+), 49 deletions(-)
lib/librte_ether/rte_ethdev.c +0 -0

index 95f2ceb..4c1a494 100644

--- a/lib/librte_ether/rte_ethdev.c

+++ b/lib/librte_ether/rte_ethdev.c

@@ -333,7 +333,7 @@ rte_eth_dev_rx_queue_config(struct rte_eth_dev *dev, uint16_t nb_queues)

dev->data->rx_queues = rte_zmalloc("ethdev->rx_queues",

sizeof(dev->data->rx_queues[0]) * nb_queues,

RTE_CACHE_LINE_SIZE);

- if (dev->data->rx_queues == NULL) {

+ if (dev->data->rx_queues == NULL && nb_queues > 0) {

dev->data->nb_rx_queues = 0;

return -(ENOMEM);

}

@@ -475,7 +475,7 @@ rte_eth_dev_tx_queue_config(struct rte_eth_dev *dev, uint16_t nb_queues)

dev->data->tx_queues = rte_zmalloc("ethdev->tx_queues",

sizeof(dev->data->tx_queues[0]) * nb_queues,

RTE_CACHE_LINE_SIZE);

- if (dev->data->tx_queues == NULL) {

+ if (dev->data->tx_queues == NULL && nb_queues > 0) {

dev->data->nb_tx_queues = 0;

return -(ENOMEM);

}

@@ -507,6 +507,7 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,

const struct rte_eth_conf *dev_conf)

{

struct rte_eth_dev *dev = &rte_eth_devices[port_id];

+ struct rte_eth_dev_info dev_info;

if (RTE_ETH_DEV_SRIOV(dev).active != 0) {

/* check multi-queue mode */

@@ -524,11 +525,33 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,

return (-EINVAL);

}

+ if ((dev_conf->rxmode.mq_mode == ETH_MQ_RX_VMDQ_DCB) &&

+ (dev_conf->txmode.mq_mode == ETH_MQ_TX_VMDQ_DCB)) {

+ enum rte_eth_nb_pools rx_pools =

+ dev_conf->rx_adv_conf.vmdq_dcb_conf.nb_queue_pools;

+ enum rte_eth_nb_pools tx_pools =

+ dev_conf->tx_adv_conf.vmdq_dcb_tx_conf.nb_queue_pools;

+

+ if (rx_pools != tx_pools) {

+ /* Only equal number of pools is supported when

+ * DCB+VMDq in SRIOV */

+ PMD_DEBUG_TRACE("ethdev port_id=%" PRIu8

+ " SRIOV active, DCB+VMDQ mode, "

+ "number of rx and tx pools is not eqaul\n",

+ port_id);

+ return (-EINVAL);

+ }

+ }

+

+ uint16_t nb_rx_q_per_pool = RTE_ETH_DEV_SRIOV(dev).nb_rx_q_per_pool;

+ uint16_t nb_tx_q_per_pool = RTE_ETH_DEV_SRIOV(dev).nb_tx_q_per_pool;

+

switch (dev_conf->rxmode.mq_mode) {

- case ETH_MQ_RX_VMDQ_RSS:

case ETH_MQ_RX_VMDQ_DCB:

+ break;

+ case ETH_MQ_RX_VMDQ_RSS:

case ETH_MQ_RX_VMDQ_DCB_RSS:

- /* DCB/RSS VMDQ in SRIOV mode, not implement yet */

+ /* RSS, DCB+RSS VMDQ in SRIOV mode, not implement yet */

PMD_DEBUG_TRACE("ethdev port_id=%" PRIu8

" SRIOV active, "

"unsupported VMDQ mq_mode rx %u\n",

@@ -537,37 +560,32 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,

default: /* ETH_MQ_RX_VMDQ_ONLY or ETH_MQ_RX_NONE */

/* if nothing mq mode configure, use default scheme */

dev->data->dev_conf.rxmode.mq_mode = ETH_MQ_RX_VMDQ_ONLY;

- if (RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool > 1)

- RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool = 1;

+ if (nb_rx_q_per_pool > 1)

+ nb_rx_q_per_pool = 1;

break;

}

switch (dev_conf->txmode.mq_mode) {

- case ETH_MQ_TX_VMDQ_DCB:

- /* DCB VMDQ in SRIOV mode, not implement yet */

- PMD_DEBUG_TRACE("ethdev port_id=%" PRIu8

- " SRIOV active, "

- "unsupported VMDQ mq_mode tx %u\n",

- port_id, dev_conf->txmode.mq_mode);

- return (-EINVAL);

+ case ETH_MQ_TX_VMDQ_DCB: /* DCB VMDQ in SRIOV mode*/

+ break;

default: /* ETH_MQ_TX_VMDQ_ONLY or ETH_MQ_TX_NONE */

/* if nothing mq mode configure, use default scheme */

dev->data->dev_conf.txmode.mq_mode = ETH_MQ_TX_VMDQ_ONLY;

- if (RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool > 1)

- RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool = 1;

+ if (nb_tx_q_per_pool > 1)

+ nb_tx_q_per_pool = 1;

break;

}

/* check valid queue number */

- if ((nb_rx_q > RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool) ||

- (nb_tx_q > RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool)) {

+ if (nb_rx_q > nb_rx_q_per_pool || nb_tx_q > nb_tx_q_per_pool) {

PMD_DEBUG_TRACE("ethdev port_id=%d SRIOV active, "

- "queue number must less equal to %d\n",

- port_id, RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool);

+ "rx/tx queue number must less equal to %d/%d\n",

+ port_id, RTE_ETH_DEV_SRIOV(dev).nb_rx_q_per_pool,

+ RTE_ETH_DEV_SRIOV(dev).nb_tx_q_per_pool);

return (-EINVAL);

}

} else {

- /* For vmdb+dcb mode check our configuration before we go further */

+ /* For vmdq+dcb mode check our configuration before we go further */

if (dev_conf->rxmode.mq_mode == ETH_MQ_RX_VMDQ_DCB) {

const struct rte_eth_vmdq_dcb_conf *conf;

@@ -606,11 +624,20 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,

}

}

+ /* For DCB we need to obtain maximum number of queues dinamically,

+ * as this depends on max VF exported in PF */

+ if ((dev_conf->rxmode.mq_mode == ETH_MQ_RX_DCB) ||

+ (dev_conf->txmode.mq_mode == ETH_MQ_TX_DCB)) {

+

+ FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);

+ (*dev->dev_ops->dev_infos_get)(dev, &dev_info);

+ }

+

/* For DCB mode check our configuration before we go further */

if (dev_conf->rxmode.mq_mode == ETH_MQ_RX_DCB) {

const struct rte_eth_dcb_rx_conf *conf;

- if (nb_rx_q != ETH_DCB_NUM_QUEUES) {

+ if (nb_rx_q != dev_info.max_rx_queues) {

PMD_DEBUG_TRACE("ethdev port_id=%d DCB, nb_rx_q "

"!= %d\n",

port_id, ETH_DCB_NUM_QUEUES);

@@ -630,7 +657,7 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,

if (dev_conf->txmode.mq_mode == ETH_MQ_TX_DCB) {

const struct rte_eth_dcb_tx_conf *conf;

- if (nb_tx_q != ETH_DCB_NUM_QUEUES) {

+ if (nb_tx_q != dev_info.max_tx_queues) {

PMD_DEBUG_TRACE("ethdev port_id=%d DCB, nb_tx_q "

"!= %d\n",

port_id, ETH_DCB_NUM_QUEUES);

@@ -690,7 +717,10 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,

}

if (nb_rx_q == 0) {

PMD_DEBUG_TRACE("ethdev port_id=%d nb_rx_q == 0\n", port_id);

- return (-EINVAL);

+ /* In SRIOV there can be no free resource for PF. So permit use only

+ * for configuration. */

+ if (RTE_ETH_DEV_SRIOV(dev).active == 0)

+ return (-EINVAL);

}

if (nb_tx_q > dev_info.max_tx_queues) {

@@ -698,9 +728,13 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,

port_id, nb_tx_q, dev_info.max_tx_queues);

return (-EINVAL);

}

+

if (nb_tx_q == 0) {

PMD_DEBUG_TRACE("ethdev port_id=%d nb_tx_q == 0\n", port_id);

- return (-EINVAL);

+ /* In SRIOV there can be no free resource for PF. So permit use only

+ * for configuration. */

+ if (RTE_ETH_DEV_SRIOV(dev).active == 0)

+ return (-EINVAL);

}

/* Copy the dev_conf parameter into the dev structure */

@@ -750,7 +784,7 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,

ETHER_MAX_LEN;

}

- /* multipe queue mode checking */

+ /* multiple queue mode checking */

diag = rte_eth_dev_check_mq_mode(port_id, nb_rx_q, nb_tx_q, dev_conf);

if (diag != 0) {

PMD_DEBUG_TRACE("port%d rte_eth_dev_check_mq_mode = %d\n",

lib/librte_ether/rte_ethdev.h +0 -0

index ce0528f..04fda83 100644

--- a/lib/librte_ether/rte_ethdev.h

+++ b/lib/librte_ether/rte_ethdev.h

@@ -299,7 +299,7 @@ enum rte_eth_rx_mq_mode {

enum rte_eth_tx_mq_mode {

ETH_MQ_TX_NONE = 0, /**< It is in neither DCB nor VT mode. */

ETH_MQ_TX_DCB, /**< For TX side,only DCB is on. */

- ETH_MQ_TX_VMDQ_DCB, /**< For TX side,both DCB and VT is on. */

+ ETH_MQ_TX_VMDQ_DCB, /**< For TX side,both DCB and VT is on. */

ETH_MQ_TX_VMDQ_ONLY, /**< Only VT on, no DCB */

};

@@ -1569,7 +1569,8 @@ struct rte_eth_dev {

struct rte_eth_dev_sriov {

uint8_t active; /**< SRIOV is active with 16, 32 or 64 pools */

- uint8_t nb_q_per_pool; /**< rx queue number per pool */

+ uint8_t nb_rx_q_per_pool; /**< rx queue number per pool */

+ uint8_t nb_tx_q_per_pool; /**< tx queue number per pool */

uint16_t def_vmdq_idx; /**< Default pool num used for PF */

uint16_t def_pool_q_idx; /**< Default pool queue start reg index */

};

lib/librte_pmd_e1000/igb_pf.c +0 -0

index bc3816a..9d2f858 100644

--- a/lib/librte_pmd_e1000/igb_pf.c

+++ b/lib/librte_pmd_e1000/igb_pf.c

@@ -115,7 +115,8 @@ void igb_pf_host_init(struct rte_eth_dev *eth_dev)

rte_panic("Cannot allocate memory for private VF data\n");

RTE_ETH_DEV_SRIOV(eth_dev).active = ETH_8_POOLS;

- RTE_ETH_DEV_SRIOV(eth_dev).nb_q_per_pool = nb_queue;

+ RTE_ETH_DEV_SRIOV(eth_dev).nb_rx_q_per_pool = nb_queue;

+ RTE_ETH_DEV_SRIOV(eth_dev).nb_tx_q_per_pool = nb_queue;

RTE_ETH_DEV_SRIOV(eth_dev).def_vmdq_idx = vf_num;

RTE_ETH_DEV_SRIOV(eth_dev).def_pool_q_idx = (uint16_t)(vf_num * nb_queue);

lib/librte_pmd_ixgbe/ixgbe_ethdev.c +0 -0

index 3fc3738..347f03c 100644

--- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c

+++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c

@@ -3555,14 +3555,14 @@ static int ixgbe_set_vf_rate_limit(struct rte_eth_dev *dev, uint16_t vf,

struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);

struct ixgbe_vf_info *vfinfo =

*(IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private));

- uint8_t nb_q_per_pool = RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool;

+ uint8_t nb_tx_q_per_pool = RTE_ETH_DEV_SRIOV(dev).nb_tx_q_per_pool;

uint32_t queue_stride =

IXGBE_MAX_RX_QUEUE_NUM / RTE_ETH_DEV_SRIOV(dev).active;

uint32_t queue_idx = vf * queue_stride, idx = 0, vf_idx;

- uint32_t queue_end = queue_idx + nb_q_per_pool - 1;

+ uint32_t tx_queue_end = queue_idx + nb_tx_q_per_pool - 1;

uint16_t total_rate = 0;

- if (queue_end >= hw->mac.max_tx_queues)

+ if (tx_queue_end >= hw->mac.max_tx_queues)

return -EINVAL;

if (vfinfo != NULL) {

@@ -3577,7 +3577,7 @@ static int ixgbe_set_vf_rate_limit(struct rte_eth_dev *dev, uint16_t vf,

return -EINVAL;

/* Store tx_rate for this vf. */

- for (idx = 0; idx < nb_q_per_pool; idx++) {

+ for (idx = 0; idx < nb_tx_q_per_pool; idx++) {

if (((uint64_t)0x1 << idx) & q_msk) {

if (vfinfo[vf].tx_rate[idx] != tx_rate)

vfinfo[vf].tx_rate[idx] = tx_rate;

@@ -3595,7 +3595,7 @@ static int ixgbe_set_vf_rate_limit(struct rte_eth_dev *dev, uint16_t vf,

}

/* Set RTTBCNRC of each queue/pool for vf X */

- for (; queue_idx <= queue_end; queue_idx++) {

+ for (; queue_idx <= tx_queue_end; queue_idx++) {

if (0x1 & q_msk)

ixgbe_set_queue_rate_limit(dev, queue_idx, tx_rate);

q_msk = q_msk >> 1;

lib/librte_pmd_ixgbe/ixgbe_ethdev.h +0 -0

index ca99170..ebf16e9 100644

--- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.h

+++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.h

@@ -159,6 +159,7 @@ struct ixgbe_vf_info {

uint16_t tx_rate[IXGBE_MAX_QUEUE_NUM_PER_VF];

uint16_t vlan_count;

uint8_t spoofchk_enabled;

+ unsigned int vf_api;

};

/*

lib/librte_pmd_ixgbe/ixgbe_pf.c +0 -0

index 51da1fd..4d30bcf 100644

--- a/lib/librte_pmd_ixgbe/ixgbe_pf.c

+++ b/lib/librte_pmd_ixgbe/ixgbe_pf.c

@@ -127,7 +127,8 @@ void ixgbe_pf_host_init(struct rte_eth_dev *eth_dev)

RTE_ETH_DEV_SRIOV(eth_dev).active = ETH_16_POOLS;

}

- RTE_ETH_DEV_SRIOV(eth_dev).nb_q_per_pool = nb_queue;

+ RTE_ETH_DEV_SRIOV(eth_dev).nb_rx_q_per_pool = nb_queue;

+ RTE_ETH_DEV_SRIOV(eth_dev).nb_tx_q_per_pool = nb_queue;

RTE_ETH_DEV_SRIOV(eth_dev).def_vmdq_idx = vf_num;

RTE_ETH_DEV_SRIOV(eth_dev).def_pool_q_idx = (uint16_t)(vf_num * nb_queue);

@@ -189,7 +190,7 @@ int ixgbe_pf_host_configure(struct rte_eth_dev *eth_dev)

hw->mac.ops.set_vmdq(hw, 0, RTE_ETH_DEV_SRIOV(eth_dev).def_vmdq_idx);

/*

- * SW msut set GCR_EXT.VT_Mode the same as GPIE.VT_Mode

+ * SW must set GCR_EXT.VT_Mode the same as GPIE.VT_Mode

*/

gcr_ext = IXGBE_READ_REG(hw, IXGBE_GCR_EXT);

gcr_ext &= ~IXGBE_GCR_EXT_VT_MODE_MASK;

@@ -214,19 +215,19 @@ int ixgbe_pf_host_configure(struct rte_eth_dev *eth_dev)

}

IXGBE_WRITE_REG(hw, IXGBE_GCR_EXT, gcr_ext);

- IXGBE_WRITE_REG(hw, IXGBE_GPIE, gpie);

+ IXGBE_WRITE_REG(hw, IXGBE_GPIE, gpie);

- /*

+ /*

* enable vlan filtering and allow all vlan tags through

*/

- vlanctrl = IXGBE_READ_REG(hw, IXGBE_VLNCTRL);

- vlanctrl |= IXGBE_VLNCTRL_VFE ; /* enable vlan filters */

- IXGBE_WRITE_REG(hw, IXGBE_VLNCTRL, vlanctrl);

+ vlanctrl = IXGBE_READ_REG(hw, IXGBE_VLNCTRL);

+ vlanctrl |= IXGBE_VLNCTRL_VFE ; /* enable vlan filters */

+ IXGBE_WRITE_REG(hw, IXGBE_VLNCTRL, vlanctrl);

- /* VFTA - enable all vlan filters */

- for (i = 0; i < IXGBE_MAX_VFTA; i++) {

- IXGBE_WRITE_REG(hw, IXGBE_VFTA(i), 0xFFFFFFFF);

- }

+ /* VFTA - enable all vlan filters */

+ for (i = 0; i < IXGBE_MAX_VFTA; i++) {

+ IXGBE_WRITE_REG(hw, IXGBE_VFTA(i), 0xFFFFFFFF);

+ }

/* Enable MAC Anti-Spoofing */

hw->mac.ops.set_mac_anti_spoofing(hw, FALSE, vf_num);

@@ -369,6 +370,73 @@ ixgbe_vf_reset(struct rte_eth_dev *dev, uint16_t vf, uint32_t *msgbuf)

}

static int

+ixgbe_negotiate_vf_api(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf)

+{

+ struct ixgbe_vf_info *vfinfo =

+ *(IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private));

+ int api = msgbuf[1];

+

+ switch (api) {

+ case ixgbe_mbox_api_10:

+ case ixgbe_mbox_api_11:

+ vfinfo[vf].vf_api = api;

+ return 0;

+ default:

+ break;

+ }

+

+ RTE_LOG(DEBUG, PMD, "VF %d requested invalid api version %u\n", vf, api);

+ return -1;

+}

+

+static int

+ixgbe_get_vf_queues(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf)

+{

+ struct ixgbe_vf_info *vfinfo =

+ *(IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private));

+ struct ixgbe_dcb_config *dcb_cfg =

+ IXGBE_DEV_PRIVATE_TO_DCB_CFG(dev->data->dev_private);

+

+ uint8_t num_tcs = dcb_cfg->num_tcs.pg_tcs;

+

+ /* verify the PF is supporting the correct APIs */

+ switch (vfinfo[vf].vf_api) {

+ case ixgbe_mbox_api_10:

+ case ixgbe_mbox_api_11:

+ break;

+ default:

+ return -1;

+ }

+

+ if (RTE_ETH_DEV_SRIOV(dev).active) {

+ if (dev->data->dev_conf.rxmode.mq_mode == ETH_MQ_RX_VMDQ_DCB)

+ msgbuf[IXGBE_VF_TX_QUEUES] = num_tcs;

+ else

+ msgbuf[IXGBE_VF_TX_QUEUES] = 1;

+

+ if (dev->data->dev_conf.txmode.mq_mode == ETH_MQ_TX_VMDQ_DCB)

+ msgbuf[IXGBE_VF_RX_QUEUES] = num_tcs;

+ else

+ msgbuf[IXGBE_VF_RX_QUEUES] = 1;

+ } else {

+ /* only allow 1 Tx queue for bandwidth limiting */

+ msgbuf[IXGBE_VF_TX_QUEUES] = 1;

+ msgbuf[IXGBE_VF_RX_QUEUES] = 1;

+ }

+

+ /* notify VF of need for VLAN tag stripping, and correct queue */

+ if (num_tcs)

+ msgbuf[IXGBE_VF_TRANS_VLAN] = num_tcs;

+ else

+ msgbuf[IXGBE_VF_TRANS_VLAN] = 0;

+

+ /* notify VF of default queue */

+ msgbuf[IXGBE_VF_DEF_QUEUE] = 0;

+

+ return 0;

+}

+

+static int

ixgbe_vf_set_mac_addr(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf)

{

struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);

@@ -512,6 +580,12 @@ ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t vf)

case IXGBE_VF_SET_VLAN:

retval = ixgbe_vf_set_vlan(dev, vf, msgbuf);

break;

+ case IXGBE_VF_API_NEGOTIATE:

+ retval = ixgbe_negotiate_vf_api(dev, vf, msgbuf);

+ break;

+ case IXGBE_VF_GET_QUEUES:

+ retval = ixgbe_get_vf_queues(dev, vf, msgbuf);

+ break;

default:

PMD_DRV_LOG(DEBUG, "Unhandled Msg %8.8x", (unsigned)msgbuf[0]);

retval = IXGBE_ERR_MBX;

@@ -526,7 +600,7 @@ ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t vf)

msgbuf[0] |= IXGBE_VT_MSGTYPE_CTS;

- ixgbe_write_mbx(hw, msgbuf, 1, vf);

+ ixgbe_write_mbx(hw, msgbuf, mbx_size, vf);

return retval;

}

lib/librte_pmd_ixgbe/ixgbe_rxtx.c +0 -0

index e10d6a2..49b44fe 100644

--- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c

+++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c

@@ -3166,10 +3166,9 @@ void ixgbe_configure_dcb(struct rte_eth_dev *dev)

/* check support mq_mode for DCB */

if ((dev_conf->rxmode.mq_mode != ETH_MQ_RX_VMDQ_DCB) &&

- (dev_conf->rxmode.mq_mode != ETH_MQ_RX_DCB))

- return;

-

- if (dev->data->nb_rx_queues != ETH_DCB_NUM_QUEUES)

+ (dev_conf->rxmode.mq_mode != ETH_MQ_RX_DCB) &&

+ (dev_conf->txmode.mq_mode != ETH_MQ_TX_VMDQ_DCB) &&

+ (dev_conf->txmode.mq_mode != ETH_MQ_TX_DCB))

return;

/** Configure DCB hardware **/

Signature · 1 line
1.7.9.5

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 1,039 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Michal Jastrzebski
Sent: Monday, January 12, 2015 3:43 PM
To: [email protected]
Subject: [dpdk-dev] [PATCH 1/2] pmd: add DCB for VF for ixgbe

Date: Mon, 12 Jan 2015 15:39:40 +0100
Message-Id: <1421073581-6644-2-git-send-email- [email protected]>
X-Mailer: git-send-email 2.1.1
In-Reply-To: <1421073581-6644-1-git-send-email- [email protected]>
References: <1421073581-6644-1-git-send-email- [email protected]>

From: Pawel Wodkowski <[email protected]>

This patch add support for DCB in SRIOV mode. When no PFC

is enabled this feature might be used as multiple queues

(up to 8 or 4) for VF.

It incorporate following modifications:

- Allow zero rx/tx queues to be passed to rte_eth_dev_configure().

Rationale:

in SRIOV mode PF use first free VF to RX/TX. If VF count

is 16 or 32 all recources are assigned to VFs so PF can

be used only for configuration.

- split nb_q_per_pool to nb_rx_q_per_pool and nb_tx_q_per_pool

Rationale:

rx and tx number of queue might be different if RX and TX are

configured in different mode. This allow to inform VF about

proper number of queues.

- extern mailbox API for DCB mode

---

 lib/librte_ether/rte_ethdev.c       |   84 +++++++++++++++++++++---------
 lib/librte_ether/rte_ethdev.h       |    5 +-
 lib/librte_pmd_e1000/igb_pf.c       |    3 +-
 lib/librte_pmd_ixgbe/ixgbe_ethdev.c |   10 ++--
 lib/librte_pmd_ixgbe/ixgbe_ethdev.h |    1 +
 lib/librte_pmd_ixgbe/ixgbe_pf.c     |   98 ++++++++++++++++++++++++++++++--

---

 lib/librte_pmd_ixgbe/ixgbe_rxtx.c   |    7 ++-
 7 files changed, 159 insertions(+), 49 deletions(-)
lib/librte_ether/rte_ethdev.c +0 -0

index 95f2ceb..4c1a494 100644

--- a/lib/librte_ether/rte_ethdev.c

+++ b/lib/librte_ether/rte_ethdev.c

lib/librte_ether/rte_ethdev.c +4 -2
@@ -333,7 +333,7 @@ rte_eth_dev_rx_queue_config(struct rte_eth_dev
 *dev, uint16_t nb_queues)
 
 		dev->data->rx_queues = rte_zmalloc("ethdev->rx_queues",
 
 				sizeof(dev->data->rx_queues[0]) * nb_queues,
 
 				RTE_CACHE_LINE_SIZE);
 
-		if (dev->data->rx_queues == NULL) {
 
+		if (dev->data->rx_queues == NULL && nb_queues > 0) {
 
 			dev->data->nb_rx_queues = 0;
 
 			return -(ENOMEM);
 
 		}
@@ -475,7 +475,7 @@ rte_eth_dev_tx_queue_config(struct rte_eth_dev
 *dev, uint16_t nb_queues)
 
 		dev->data->tx_queues = rte_zmalloc("ethdev->tx_queues",
 
 				sizeof(dev->data->tx_queues[0]) * nb_queues,
 
 				RTE_CACHE_LINE_SIZE);
 
-		if (dev->data->tx_queues == NULL) {
 
+		if (dev->data->tx_queues == NULL && nb_queues > 0) {
 
 			dev->data->nb_tx_queues = 0;
 
 			return -(ENOMEM);
 
 		}
@@ -507,6 +507,7 @@ rte_eth_dev_check_mq_mode(uint8_t port_id,
 uint16_t nb_rx_q, uint16_t nb_tx_q,
 
 		      const struct rte_eth_conf *dev_conf)
 
 {
 
 	struct rte_eth_dev *dev = &rte_eth_devices[port_id];
 
+	struct rte_eth_dev_info dev_info;
 
 
 
 	if (RTE_ETH_DEV_SRIOV(dev).active != 0) {
 
 		/* check multi-queue mode */
@@ -524,11 +525,33 @@ rte_eth_dev_check_mq_mode(uint8_t port_id,
 uint16_t nb_rx_q, uint16_t nb_tx_q,
 
 			return (-EINVAL);
 
 		}
 
 
 
+		if ((dev_conf->rxmode.mq_mode ==

ETH_MQ_RX_VMDQ_DCB) &&

lib/librte_ether/rte_ethdev.c +1 -0
+			(dev_conf->txmode.mq_mode ==

ETH_MQ_TX_VMDQ_DCB)) {

lib/librte_ether/rte_ethdev.c +2 -0
+			enum rte_eth_nb_pools rx_pools =
 
+						dev_conf-
Quoted 1 line

rx_adv_conf.vmdq_dcb_conf.nb_queue_pools;

lib/librte_ether/rte_ethdev.c +2 -0
+			enum rte_eth_nb_pools tx_pools =
 
+						dev_conf-
Quoted 1 line

tx_adv_conf.vmdq_dcb_tx_conf.nb_queue_pools;

lib/librte_ether/rte_ethdev.c +3 -0
+
 
+			if (rx_pools != tx_pools) {
 
+				/* Only equal number of pools is supported

when

lib/librte_ether/rte_ethdev.c +2 -0
+				 * DCB+VMDq in SRIOV */
 
+				PMD_DEBUG_TRACE("ethdev port_id=%"

PRIu8

lib/librte_ether/rte_ethdev.c +1 -0
+						" SRIOV active, DCB+VMDQ

mode, "

lib/librte_ether/rte_ethdev.c +1 -0
+						"number of rx and tx pools is

not eqaul\n",

lib/librte_ether/rte_ethdev.c +6 -0
+						port_id);
 
+				return (-EINVAL);
 
+			}
 
+		}
 
+
 
+		uint16_t nb_rx_q_per_pool =

RTE_ETH_DEV_SRIOV(dev).nb_rx_q_per_pool;

lib/librte_ether/rte_ethdev.c +1 -0
+		uint16_t nb_tx_q_per_pool =

RTE_ETH_DEV_SRIOV(dev).nb_tx_q_per_pool;

lib/librte_ether/rte_ethdev.c +3 -2
+
 
 		switch (dev_conf->rxmode.mq_mode) {
 
-		case ETH_MQ_RX_VMDQ_RSS:
 
 		case ETH_MQ_RX_VMDQ_DCB:
 
+			break;
 
+		case ETH_MQ_RX_VMDQ_RSS:
 
 		case ETH_MQ_RX_VMDQ_DCB_RSS:
 
-			/* DCB/RSS VMDQ in SRIOV mode, not implement yet

*/

lib/librte_ether/rte_ethdev.c +1 -0
+			/* RSS, DCB+RSS VMDQ in SRIOV mode, not

implement yet */

lib/librte_ether/rte_ethdev.c +0 -0
 			PMD_DEBUG_TRACE("ethdev port_id=%" PRIu8
 
 					" SRIOV active, "
 
 					"unsupported VMDQ mq_mode rx

%u\n",

lib/librte_ether/rte_ethdev.c +2 -8
@@ -537,37 +560,32 @@ rte_eth_dev_check_mq_mode(uint8_t port_id,
 uint16_t nb_rx_q, uint16_t nb_tx_q,
 
 		default: /* ETH_MQ_RX_VMDQ_ONLY or ETH_MQ_RX_NONE
 */
 
 			/* if nothing mq mode configure, use default scheme
 */
 
 			dev->data->dev_conf.rxmode.mq_mode =
 ETH_MQ_RX_VMDQ_ONLY;
 
-			if (RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool > 1)
 
-				RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool =
 1;
 
+			if (nb_rx_q_per_pool > 1)
 
+				nb_rx_q_per_pool = 1;
 
 			break;
 
 		}
 
 
 
 		switch (dev_conf->txmode.mq_mode) {
 
-		case ETH_MQ_TX_VMDQ_DCB:
 
-			/* DCB VMDQ in SRIOV mode, not implement yet */
 
-			PMD_DEBUG_TRACE("ethdev port_id=%" PRIu8
 
-					" SRIOV active, "
 
-					"unsupported VMDQ mq_mode tx
 %u\n",
 
-					port_id, dev_conf-
Quoted 1 line

txmode.mq_mode);

lib/librte_ether/rte_ethdev.c +1 -1
-			return (-EINVAL);
 
+		case ETH_MQ_TX_VMDQ_DCB: /* DCB VMDQ in SRIOV

mode*/

lib/librte_ether/rte_ethdev.c +1 -0
+			break;
 
 		default: /* ETH_MQ_TX_VMDQ_ONLY or ETH_MQ_TX_NONE

*/

/* if nothing mq mode configure, use default scheme
*/

dev->data->dev_conf.txmode.mq_mode =
ETH_MQ_TX_VMDQ_ONLY;

lib/librte_ether/rte_ethdev.c +0 -2
-			if (RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool > 1)
 
-				RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool =

1;

lib/librte_ether/rte_ethdev.c +3 -2
+			if (nb_tx_q_per_pool > 1)
 
+				nb_tx_q_per_pool = 1;
 
 			break;
 
 		}
 
 
 
 		/* check valid queue number */
 
-		if ((nb_rx_q > RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool) ||
 
-		    (nb_tx_q > RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool)) {
 
+		if (nb_rx_q > nb_rx_q_per_pool || nb_tx_q >

nb_tx_q_per_pool) {

PMD_DEBUG_TRACE("ethdev port_id=%d SRIOV
active, "

lib/librte_ether/rte_ethdev.c +0 -2
-				    "queue number must less equal to %d\n",
 
-					port_id,

RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool);

lib/librte_ether/rte_ethdev.c +1 -0
+				    "rx/tx queue number must less equal to

%d/%d\n",

lib/librte_ether/rte_ethdev.c +1 -0
+					port_id,

RTE_ETH_DEV_SRIOV(dev).nb_rx_q_per_pool,

+

	RTE_ETH_DEV_SRIOV(dev).nb_tx_q_per_pool);
lib/librte_ether/rte_ethdev.c +0 -1
 			return (-EINVAL);
 
 		}
 
 	} else {
 
-		/* For vmdb+dcb mode check our configuration before we go

further */

lib/librte_ether/rte_ethdev.c +1 -0
+		/* For vmdq+dcb mode check our configuration before we go

further */

if (dev_conf->rxmode.mq_mode == ETH_MQ_RX_VMDQ_DCB)
{

lib/librte_ether/rte_ethdev.c +4 -0
 			const struct rte_eth_vmdq_dcb_conf *conf;
@@ -606,11 +624,20 @@ rte_eth_dev_check_mq_mode(uint8_t port_id,
 uint16_t nb_rx_q, uint16_t nb_tx_q,
 
 			}
 
 		}
 
 
 
+		/* For DCB we need to obtain maximum number of queues
 dinamically,
 
+		 * as this depends on max VF exported in PF */
 
+		if ((dev_conf->rxmode.mq_mode == ETH_MQ_RX_DCB) ||
 
+			(dev_conf->txmode.mq_mode == ETH_MQ_TX_DCB))

{

lib/librte_ether/rte_ethdev.c +2 -0
+
 
+				FUNC_PTR_OR_ERR_RET(*dev->dev_ops-
Quoted 1 line

dev_infos_get, -ENOTSUP);

lib/librte_ether/rte_ethdev.c +1 -0
+				(*dev->dev_ops->dev_infos_get)(dev,

&dev_info);

lib/librte_ether/rte_ethdev.c +2 -0
+		}
 
+
 
 		/* For DCB mode check our configuration before we go further

*/

lib/librte_ether/rte_ethdev.c +1 -1
 		if (dev_conf->rxmode.mq_mode == ETH_MQ_RX_DCB) {
 
 			const struct rte_eth_dcb_rx_conf *conf;
 
 
 
-			if (nb_rx_q != ETH_DCB_NUM_QUEUES) {
 
+			if (nb_rx_q != dev_info.max_rx_queues) {
 
 				PMD_DEBUG_TRACE("ethdev port_id=%d

DCB, nb_rx_q "

lib/librte_ether/rte_ethdev.c +0 -0
 						"!= %d\n",
 
 						port_id,

ETH_DCB_NUM_QUEUES);

lib/librte_ether/rte_ethdev.c +1 -1
@@ -630,7 +657,7 @@ rte_eth_dev_check_mq_mode(uint8_t port_id,
 uint16_t nb_rx_q, uint16_t nb_tx_q,
 
 		if (dev_conf->txmode.mq_mode == ETH_MQ_TX_DCB) {
 
 			const struct rte_eth_dcb_tx_conf *conf;
 
 
 
-			if (nb_tx_q != ETH_DCB_NUM_QUEUES) {
 
+			if (nb_tx_q != dev_info.max_tx_queues) {
 
 				PMD_DEBUG_TRACE("ethdev port_id=%d

DCB, nb_tx_q "

lib/librte_ether/rte_ethdev.c +0 -0
 						"!= %d\n",
 
 						port_id,

ETH_DCB_NUM_QUEUES);

lib/librte_ether/rte_ethdev.c +0 -0
@@ -690,7 +717,10 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t
 nb_rx_q, uint16_t nb_tx_q,
 
 	}
 
 	if (nb_rx_q == 0) {
 
 		PMD_DEBUG_TRACE("ethdev port_id=%d nb_rx_q == 0\n",

port_id);

lib/librte_ether/rte_ethdev.c +1 -1
-		return (-EINVAL);
 
+		/* In SRIOV there can be no free resource for PF. So permit use

only

lib/librte_ether/rte_ethdev.c +4 -0
+		 * for configuration. */
 
+		if (RTE_ETH_DEV_SRIOV(dev).active == 0)
 
+			return (-EINVAL);
 
 	}
 
 
 
 	if (nb_tx_q > dev_info.max_tx_queues) {
@@ -698,9 +728,13 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t
 nb_rx_q, uint16_t nb_tx_q,
 
 				port_id, nb_tx_q, dev_info.max_tx_queues);
 
 		return (-EINVAL);
 
 	}
 
+
 
 	if (nb_tx_q == 0) {
 
 		PMD_DEBUG_TRACE("ethdev port_id=%d nb_tx_q == 0\n",

port_id);

lib/librte_ether/rte_ethdev.c +1 -1
-		return (-EINVAL);
 
+		/* In SRIOV there can be no free resource for PF. So permit use

only

lib/librte_ether/rte_ethdev.c +4 -1
+		 * for configuration. */
 
+		if (RTE_ETH_DEV_SRIOV(dev).active == 0)
 
+			return (-EINVAL);
 
 	}
 
 
 
 	/* Copy the dev_conf parameter into the dev structure */
@@ -750,7 +784,7 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t
 nb_rx_q, uint16_t nb_tx_q,
 
 							ETHER_MAX_LEN;
 
 	}
 
 
 
-	/* multipe queue mode checking */
 
+	/* multiple queue mode checking */
 
 	diag = rte_eth_dev_check_mq_mode(port_id, nb_rx_q, nb_tx_q,

dev_conf);

lib/librte_ether/rte_ethdev.c +0 -0
 	if (diag != 0) {
 
 		PMD_DEBUG_TRACE("port%d rte_eth_dev_check_mq_mode =

%d\n",

lib/librte_ether/rte_ethdev.h +0 -0

index ce0528f..04fda83 100644

--- a/lib/librte_ether/rte_ethdev.h

+++ b/lib/librte_ether/rte_ethdev.h

lib/librte_ether/rte_ethdev.h +0 -1
@@ -299,7 +299,7 @@ enum rte_eth_rx_mq_mode {
 
 enum rte_eth_tx_mq_mode {
 
 	ETH_MQ_TX_NONE    = 0,  /**< It is in neither DCB nor VT mode. */
 
 	ETH_MQ_TX_DCB,          /**< For TX side,only DCB is on. */
 
-	ETH_MQ_TX_VMDQ_DCB,	/**< For TX side,both DCB and VT is

on. */

lib/librte_ether/rte_ethdev.h +1 -0
+	ETH_MQ_TX_VMDQ_DCB,     /**< For TX side,both DCB and VT is on.

*/

lib/librte_ether/rte_ethdev.h +2 -1
 	ETH_MQ_TX_VMDQ_ONLY,    /**< Only VT on, no DCB */
 
 };
@@ -1569,7 +1569,8 @@ struct rte_eth_dev {
 
 
 
 struct rte_eth_dev_sriov {
 
 	uint8_t active;               /**< SRIOV is active with 16, 32 or 64 pools */
 
-	uint8_t nb_q_per_pool;        /**< rx queue number per pool */
 
+	uint8_t nb_rx_q_per_pool;        /**< rx queue number per pool */
 
+	uint8_t nb_tx_q_per_pool;        /**< tx queue number per pool */
 
 	uint16_t def_vmdq_idx;        /**< Default pool num used for PF */
 
 	uint16_t def_pool_q_idx;      /**< Default pool queue start reg index */
 
 };
lib/librte_pmd_e1000/igb_pf.c +0 -0

index bc3816a..9d2f858 100644

--- a/lib/librte_pmd_e1000/igb_pf.c

+++ b/lib/librte_pmd_e1000/igb_pf.c

lib/librte_pmd_e1000/igb_pf.c +2 -1
@@ -115,7 +115,8 @@ void igb_pf_host_init(struct rte_eth_dev *eth_dev)
 
 		rte_panic("Cannot allocate memory for private VF data\n");
 
 
 
 	RTE_ETH_DEV_SRIOV(eth_dev).active = ETH_8_POOLS;
 
-	RTE_ETH_DEV_SRIOV(eth_dev).nb_q_per_pool = nb_queue;
 
+	RTE_ETH_DEV_SRIOV(eth_dev).nb_rx_q_per_pool = nb_queue;
 
+	RTE_ETH_DEV_SRIOV(eth_dev).nb_tx_q_per_pool = nb_queue;
 
 	RTE_ETH_DEV_SRIOV(eth_dev).def_vmdq_idx = vf_num;
 
 	RTE_ETH_DEV_SRIOV(eth_dev).def_pool_q_idx = (uint16_t)(vf_num *

nb_queue);

lib/librte_pmd_ixgbe/ixgbe_ethdev.c +0 -0

index 3fc3738..347f03c 100644

--- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c

+++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c

lib/librte_pmd_ixgbe/ixgbe_ethdev.c +1 -1
@@ -3555,14 +3555,14 @@ static int ixgbe_set_vf_rate_limit(struct
 rte_eth_dev *dev, uint16_t vf,
 
 	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data-
 >dev_private);
 
 	struct ixgbe_vf_info *vfinfo =
 
 		*(IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data-
 >dev_private));
 
-	uint8_t  nb_q_per_pool = RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool;
 
+	uint8_t  nb_tx_q_per_pool =
 RTE_ETH_DEV_SRIOV(dev).nb_tx_q_per_pool;
 
lib/librte_pmd_ixgbe/ixgbe_ethdev.c +0 -0
 	uint32_t queue_stride =
 
 		IXGBE_MAX_RX_QUEUE_NUM /

RTE_ETH_DEV_SRIOV(dev).active;

lib/librte_pmd_ixgbe/ixgbe_ethdev.c +4 -4
 	uint32_t queue_idx = vf * queue_stride, idx = 0, vf_idx;
 
-	uint32_t queue_end = queue_idx + nb_q_per_pool - 1;
 
+	uint32_t tx_queue_end = queue_idx + nb_tx_q_per_pool - 1;
 
 	uint16_t total_rate = 0;
 
 
 
-	if (queue_end >= hw->mac.max_tx_queues)
 
+	if (tx_queue_end >= hw->mac.max_tx_queues)
 
 		return -EINVAL;
 
 
 
 	if (vfinfo != NULL) {
@@ -3577,7 +3577,7 @@ static int ixgbe_set_vf_rate_limit(struct rte_eth_dev
 *dev, uint16_t vf,
 
 		return -EINVAL;
 
 
 
 	/* Store tx_rate for this vf. */
 
-	for (idx = 0; idx < nb_q_per_pool; idx++) {
 
+	for (idx = 0; idx < nb_tx_q_per_pool; idx++) {
 
 		if (((uint64_t)0x1 << idx) & q_msk) {
 
 			if (vfinfo[vf].tx_rate[idx] != tx_rate)
 
 				vfinfo[vf].tx_rate[idx] = tx_rate;
@@ -3595,7 +3595,7 @@ static int ixgbe_set_vf_rate_limit(struct rte_eth_dev
 *dev, uint16_t vf,
 
 	}
 
 
 
 	/* Set RTTBCNRC of each queue/pool for vf X  */
 
-	for (; queue_idx <= queue_end; queue_idx++) {
 
+	for (; queue_idx <= tx_queue_end; queue_idx++) {
 
 		if (0x1 & q_msk)
 
 			ixgbe_set_queue_rate_limit(dev, queue_idx, tx_rate);
 
 		q_msk = q_msk >> 1;
lib/librte_pmd_ixgbe/ixgbe_ethdev.h +0 -0

index ca99170..ebf16e9 100644

--- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.h

+++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.h

lib/librte_pmd_ixgbe/ixgbe_ethdev.h +1 -0
@@ -159,6 +159,7 @@ struct ixgbe_vf_info {
 
 	uint16_t tx_rate[IXGBE_MAX_QUEUE_NUM_PER_VF];
 
 	uint16_t vlan_count;
 
 	uint8_t spoofchk_enabled;
 
+	unsigned int vf_api;
 
 };
 
 
 
 /*
lib/librte_pmd_ixgbe/ixgbe_pf.c +0 -0

index 51da1fd..4d30bcf 100644

--- a/lib/librte_pmd_ixgbe/ixgbe_pf.c

+++ b/lib/librte_pmd_ixgbe/ixgbe_pf.c

lib/librte_pmd_ixgbe/ixgbe_pf.c +2 -1
@@ -127,7 +127,8 @@ void ixgbe_pf_host_init(struct rte_eth_dev *eth_dev)
 
 		RTE_ETH_DEV_SRIOV(eth_dev).active = ETH_16_POOLS;
 
 	}
 
 
 
-	RTE_ETH_DEV_SRIOV(eth_dev).nb_q_per_pool = nb_queue;
 
+	RTE_ETH_DEV_SRIOV(eth_dev).nb_rx_q_per_pool = nb_queue;
 
+	RTE_ETH_DEV_SRIOV(eth_dev).nb_tx_q_per_pool = nb_queue;
 
 	RTE_ETH_DEV_SRIOV(eth_dev).def_vmdq_idx = vf_num;
 
 	RTE_ETH_DEV_SRIOV(eth_dev).def_pool_q_idx = (uint16_t)(vf_num *

nb_queue);

lib/librte_pmd_ixgbe/ixgbe_pf.c +0 -0
@@ -189,7 +190,7 @@ int ixgbe_pf_host_configure(struct rte_eth_dev
 *eth_dev)
 
 	hw->mac.ops.set_vmdq(hw, 0,
 RTE_ETH_DEV_SRIOV(eth_dev).def_vmdq_idx);
 
 
 
lib/librte_pmd_ixgbe/ixgbe_pf.c +11 -10
 	/*
 
-	 * SW msut set GCR_EXT.VT_Mode the same as GPIE.VT_Mode
 
+	 * SW must set GCR_EXT.VT_Mode the same as GPIE.VT_Mode
 
 	 */
 
 	gcr_ext = IXGBE_READ_REG(hw, IXGBE_GCR_EXT);
 
 	gcr_ext &= ~IXGBE_GCR_EXT_VT_MODE_MASK;
@@ -214,19 +215,19 @@ int ixgbe_pf_host_configure(struct rte_eth_dev
 *eth_dev)
 
 	}
 
 
 
 	IXGBE_WRITE_REG(hw, IXGBE_GCR_EXT, gcr_ext);
 
-        IXGBE_WRITE_REG(hw, IXGBE_GPIE, gpie);
 
+	IXGBE_WRITE_REG(hw, IXGBE_GPIE, gpie);
 
 
 
-        /*
 
+	/*
 
 	 * enable vlan filtering and allow all vlan tags through
 
 	 */
 
-        vlanctrl = IXGBE_READ_REG(hw, IXGBE_VLNCTRL);
 
-        vlanctrl |= IXGBE_VLNCTRL_VFE ; /* enable vlan filters */
 
-        IXGBE_WRITE_REG(hw, IXGBE_VLNCTRL, vlanctrl);
 
+	vlanctrl = IXGBE_READ_REG(hw, IXGBE_VLNCTRL);
 
+	vlanctrl |= IXGBE_VLNCTRL_VFE ; /* enable vlan filters */
 
+	IXGBE_WRITE_REG(hw, IXGBE_VLNCTRL, vlanctrl);
 
 
 
-        /* VFTA - enable all vlan filters */
 
-        for (i = 0; i < IXGBE_MAX_VFTA; i++) {
 
-                IXGBE_WRITE_REG(hw, IXGBE_VFTA(i), 0xFFFFFFFF);
 
-        }
 
+	/* VFTA - enable all vlan filters */
 
+	for (i = 0; i < IXGBE_MAX_VFTA; i++) {
 
+		IXGBE_WRITE_REG(hw, IXGBE_VFTA(i), 0xFFFFFFFF);
 
+	}
 
 
 
 	/* Enable MAC Anti-Spoofing */
 
 	hw->mac.ops.set_mac_anti_spoofing(hw, FALSE, vf_num);
@@ -369,6 +370,73 @@ ixgbe_vf_reset(struct rte_eth_dev *dev, uint16_t vf,
 uint32_t *msgbuf)
 
 }
 
 
 
 static int
 
+ixgbe_negotiate_vf_api(struct rte_eth_dev *dev, uint32_t vf, uint32_t

*msgbuf)

lib/librte_pmd_ixgbe/ixgbe_pf.c +3 -0
+{
 
+	struct ixgbe_vf_info *vfinfo =
 
+		*(IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data-
Quoted 1 line

dev_private));

lib/librte_pmd_ixgbe/ixgbe_pf.c +12 -0
+	int api = msgbuf[1];
 
+
 
+	switch (api) {
 
+	case ixgbe_mbox_api_10:
 
+	case ixgbe_mbox_api_11:
 
+		vfinfo[vf].vf_api = api;
 
+		return 0;
 
+	default:
 
+		break;
 
+	}
 
+
 
+	RTE_LOG(DEBUG, PMD, "VF %d requested invalid api version %u\n", vf,

api);

lib/librte_pmd_ixgbe/ixgbe_pf.c +8 -0
+	return -1;
 
+}
 
+
 
+static int
 
+ixgbe_get_vf_queues(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf)
 
+{
 
+	struct ixgbe_vf_info *vfinfo =
 
+		*(IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data-
Quoted 1 line

dev_private));

lib/librte_pmd_ixgbe/ixgbe_pf.c +2 -0
+	struct ixgbe_dcb_config *dcb_cfg =
 
+			IXGBE_DEV_PRIVATE_TO_DCB_CFG(dev->data-
Quoted 1 line

dev_private);

lib/librte_pmd_ixgbe/ixgbe_pf.c +14 -0
+
 
+	uint8_t num_tcs = dcb_cfg->num_tcs.pg_tcs;
 
+
 
+	/* verify the PF is supporting the correct APIs */
 
+	switch (vfinfo[vf].vf_api) {
 
+	case ixgbe_mbox_api_10:
 
+	case ixgbe_mbox_api_11:
 
+		break;
 
+	default:
 
+		return -1;
 
+	}
 
+
 
+	if (RTE_ETH_DEV_SRIOV(dev).active) {
 
+		if (dev->data->dev_conf.rxmode.mq_mode ==

ETH_MQ_RX_VMDQ_DCB)

lib/librte_pmd_ixgbe/ixgbe_pf.c +5 -0
+			msgbuf[IXGBE_VF_TX_QUEUES] = num_tcs;
 
+		else
 
+			msgbuf[IXGBE_VF_TX_QUEUES] = 1;
 
+
 
+		if (dev->data->dev_conf.txmode.mq_mode ==

ETH_MQ_TX_VMDQ_DCB)

lib/librte_pmd_ixgbe/ixgbe_pf.c +22 -0
+			msgbuf[IXGBE_VF_RX_QUEUES] = num_tcs;
 
+		else
 
+			msgbuf[IXGBE_VF_RX_QUEUES] = 1;
 
+	}	else {
 
+		/* only allow 1 Tx queue for bandwidth limiting */
 
+		msgbuf[IXGBE_VF_TX_QUEUES] = 1;
 
+		msgbuf[IXGBE_VF_RX_QUEUES] = 1;
 
+	}
 
+
 
+	/* notify VF of need for VLAN tag stripping, and correct queue */
 
+	if (num_tcs)
 
+		msgbuf[IXGBE_VF_TRANS_VLAN] = num_tcs;
 
+	else
 
+		msgbuf[IXGBE_VF_TRANS_VLAN] = 0;
 
+
 
+	/* notify VF of default queue */
 
+	msgbuf[IXGBE_VF_DEF_QUEUE] = 0;
 
+
 
+	return 0;
 
+}
 
+
 
+static int
 
 ixgbe_vf_set_mac_addr(struct rte_eth_dev *dev, uint32_t vf, uint32_t

*msgbuf)

{

struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data-

Quoted 1 line

dev_private);

lib/librte_pmd_ixgbe/ixgbe_pf.c +6 -0
@@ -512,6 +580,12 @@ ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev,
 uint16_t vf)
 
 	case IXGBE_VF_SET_VLAN:
 
 		retval = ixgbe_vf_set_vlan(dev, vf, msgbuf);
 
 		break;
 
+	case IXGBE_VF_API_NEGOTIATE:
 
+		retval = ixgbe_negotiate_vf_api(dev, vf, msgbuf);
 
+		break;
 
+	case IXGBE_VF_GET_QUEUES:
 
+		retval = ixgbe_get_vf_queues(dev, vf, msgbuf);
 
+		break;
 
 	default:
 
 		PMD_DRV_LOG(DEBUG, "Unhandled Msg %8.8x",

(unsigned)msgbuf[0]);

lib/librte_pmd_ixgbe/ixgbe_pf.c +1 -1
 		retval = IXGBE_ERR_MBX;
@@ -526,7 +600,7 @@ ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev,
 uint16_t vf)
 
 
 
 	msgbuf[0] |= IXGBE_VT_MSGTYPE_CTS;
 
 
 
-	ixgbe_write_mbx(hw, msgbuf, 1, vf);
 
+	ixgbe_write_mbx(hw, msgbuf, mbx_size, vf);
 
 
 
 	return retval;
 
 }
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +0 -0

index e10d6a2..49b44fe 100644

--- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c

+++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c

lib/librte_pmd_ixgbe/ixgbe_rxtx.c +3 -5
@@ -3166,10 +3166,9 @@ void ixgbe_configure_dcb(struct rte_eth_dev *dev)
 
 
 
 	/* check support mq_mode for DCB */
 
 	if ((dev_conf->rxmode.mq_mode != ETH_MQ_RX_VMDQ_DCB) &&
 
-	    (dev_conf->rxmode.mq_mode != ETH_MQ_RX_DCB))
 
-		return;
 
-
 
-	if (dev->data->nb_rx_queues != ETH_DCB_NUM_QUEUES)
 
+	    (dev_conf->rxmode.mq_mode != ETH_MQ_RX_DCB) &&
 
+	    (dev_conf->txmode.mq_mode != ETH_MQ_TX_VMDQ_DCB) &&
 
+	    (dev_conf->txmode.mq_mode != ETH_MQ_TX_DCB))
 
 		return;
 
 
 
 	/** Configure DCB hardware **/
 
--
Quoted 3 lines

1.7.9.5

Self nacked - because of wrong message format.

A message that is not in the archive (sent off-list or not yet received): 60ABE07DBB3A454EB7FAD707B4BB1582138D2553-kPTMFJFq+rHjxeytcECX8bfspsVTdybXVpNB7YpNyf8@public.gmane.org

#4 lore raw
Quoted 1,025 lines · MichalX K
Quoted 1,025 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Michal Jastrzebski
Sent: Monday, January 12, 2015 3:43 PM
To: [email protected]
Subject: [dpdk-dev] [PATCH 1/2] pmd: add DCB for VF for ixgbe

Date: Mon, 12 Jan 2015 15:39:40 +0100
Message-Id: <1421073581-6644-2-git-send-email- [email protected]>
X-Mailer: git-send-email 2.1.1
In-Reply-To: <1421073581-6644-1-git-send-email- [email protected]>
References: <1421073581-6644-1-git-send-email- [email protected]>

From: Pawel Wodkowski <[email protected]>

This patch add support for DCB in SRIOV mode. When no PFC

is enabled this feature might be used as multiple queues

(up to 8 or 4) for VF.

It incorporate following modifications:

- Allow zero rx/tx queues to be passed to rte_eth_dev_configure().

Rationale:

in SRIOV mode PF use first free VF to RX/TX. If VF count

is 16 or 32 all recources are assigned to VFs so PF can

be used only for configuration.

- split nb_q_per_pool to nb_rx_q_per_pool and nb_tx_q_per_pool

Rationale:

rx and tx number of queue might be different if RX and TX are

configured in different mode. This allow to inform VF about

proper number of queues.

- extern mailbox API for DCB mode

---

  lib/librte_ether/rte_ethdev.c       |   84 +++++++++++++++++++++---------
  lib/librte_ether/rte_ethdev.h       |    5 +-
  lib/librte_pmd_e1000/igb_pf.c       |    3 +-
  lib/librte_pmd_ixgbe/ixgbe_ethdev.c |   10 ++--
  lib/librte_pmd_ixgbe/ixgbe_ethdev.h |    1 +
  lib/librte_pmd_ixgbe/ixgbe_pf.c     |   98 ++++++++++++++++++++++++++++++--

---

  lib/librte_pmd_ixgbe/ixgbe_rxtx.c   |    7 ++-
  7 files changed, 159 insertions(+), 49 deletions(-)
lib/librte_ether/rte_ethdev.c +0 -0

index 95f2ceb..4c1a494 100644

--- a/lib/librte_ether/rte_ethdev.c

+++ b/lib/librte_ether/rte_ethdev.c

lib/librte_ether/rte_ethdev.c +4 -2
@@ -333,7 +333,7 @@ rte_eth_dev_rx_queue_config(struct rte_eth_dev
 *dev, uint16_t nb_queues)
 
  		dev->data->rx_queues = rte_zmalloc("ethdev->rx_queues",
 
  				sizeof(dev->data->rx_queues[0]) * nb_queues,
 
  				RTE_CACHE_LINE_SIZE);
 
-		if (dev->data->rx_queues == NULL) {
 
+		if (dev->data->rx_queues == NULL && nb_queues > 0) {
 
  			dev->data->nb_rx_queues = 0;
 
  			return -(ENOMEM);
 
  		}
@@ -475,7 +475,7 @@ rte_eth_dev_tx_queue_config(struct rte_eth_dev
 *dev, uint16_t nb_queues)
 
  		dev->data->tx_queues = rte_zmalloc("ethdev->tx_queues",
 
  				sizeof(dev->data->tx_queues[0]) * nb_queues,
 
  				RTE_CACHE_LINE_SIZE);
 
-		if (dev->data->tx_queues == NULL) {
 
+		if (dev->data->tx_queues == NULL && nb_queues > 0) {
 
  			dev->data->nb_tx_queues = 0;
 
  			return -(ENOMEM);
 
  		}
@@ -507,6 +507,7 @@ rte_eth_dev_check_mq_mode(uint8_t port_id,
 uint16_t nb_rx_q, uint16_t nb_tx_q,
 
  		      const struct rte_eth_conf *dev_conf)
 
  {
 
  	struct rte_eth_dev *dev = &rte_eth_devices[port_id];
 
+	struct rte_eth_dev_info dev_info;
 
 
 
  	if (RTE_ETH_DEV_SRIOV(dev).active != 0) {
 
  		/* check multi-queue mode */
@@ -524,11 +525,33 @@ rte_eth_dev_check_mq_mode(uint8_t port_id,
 uint16_t nb_rx_q, uint16_t nb_tx_q,
 
  			return (-EINVAL);
 
  		}
 
 
 
+		if ((dev_conf->rxmode.mq_mode ==

ETH_MQ_RX_VMDQ_DCB) &&

lib/librte_ether/rte_ethdev.c +1 -0
+			(dev_conf->txmode.mq_mode ==

ETH_MQ_TX_VMDQ_DCB)) {

lib/librte_ether/rte_ethdev.c +2 -0
+			enum rte_eth_nb_pools rx_pools =
 
+						dev_conf-
Quoted 1 line

rx_adv_conf.vmdq_dcb_conf.nb_queue_pools;

lib/librte_ether/rte_ethdev.c +2 -0
+			enum rte_eth_nb_pools tx_pools =
 
+						dev_conf-
Quoted 1 line

tx_adv_conf.vmdq_dcb_tx_conf.nb_queue_pools;

lib/librte_ether/rte_ethdev.c +3 -0
+
 
+			if (rx_pools != tx_pools) {
 
+				/* Only equal number of pools is supported

when

lib/librte_ether/rte_ethdev.c +2 -0
+				 * DCB+VMDq in SRIOV */
 
+				PMD_DEBUG_TRACE("ethdev port_id=%"

PRIu8

lib/librte_ether/rte_ethdev.c +1 -0
+						" SRIOV active, DCB+VMDQ

mode, "

lib/librte_ether/rte_ethdev.c +1 -0
+						"number of rx and tx pools is

not eqaul\n",

lib/librte_ether/rte_ethdev.c +6 -0
+						port_id);
 
+				return (-EINVAL);
 
+			}
 
+		}
 
+
 
+		uint16_t nb_rx_q_per_pool =

RTE_ETH_DEV_SRIOV(dev).nb_rx_q_per_pool;

lib/librte_ether/rte_ethdev.c +1 -0
+		uint16_t nb_tx_q_per_pool =

RTE_ETH_DEV_SRIOV(dev).nb_tx_q_per_pool;

lib/librte_ether/rte_ethdev.c +3 -2
+
 
  		switch (dev_conf->rxmode.mq_mode) {
 
-		case ETH_MQ_RX_VMDQ_RSS:
 
  		case ETH_MQ_RX_VMDQ_DCB:
 
+			break;
 
+		case ETH_MQ_RX_VMDQ_RSS:
 
  		case ETH_MQ_RX_VMDQ_DCB_RSS:
 
-			/* DCB/RSS VMDQ in SRIOV mode, not implement yet

*/

lib/librte_ether/rte_ethdev.c +1 -0
+			/* RSS, DCB+RSS VMDQ in SRIOV mode, not

implement yet */

PMD_DEBUG_TRACE("ethdev port_id=%" PRIu8

" SRIOV active, "

"unsupported VMDQ mq_mode rx
%u\n",

lib/librte_ether/rte_ethdev.c +2 -8
@@ -537,37 +560,32 @@ rte_eth_dev_check_mq_mode(uint8_t port_id,
 uint16_t nb_rx_q, uint16_t nb_tx_q,
 
  		default: /* ETH_MQ_RX_VMDQ_ONLY or ETH_MQ_RX_NONE
 */
 
  			/* if nothing mq mode configure, use default scheme
 */
 
  			dev->data->dev_conf.rxmode.mq_mode =
 ETH_MQ_RX_VMDQ_ONLY;
 
-			if (RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool > 1)
 
-				RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool =
 1;
 
+			if (nb_rx_q_per_pool > 1)
 
+				nb_rx_q_per_pool = 1;
 
  			break;
 
  		}
 
 
 
  		switch (dev_conf->txmode.mq_mode) {
 
-		case ETH_MQ_TX_VMDQ_DCB:
 
-			/* DCB VMDQ in SRIOV mode, not implement yet */
 
-			PMD_DEBUG_TRACE("ethdev port_id=%" PRIu8
 
-					" SRIOV active, "
 
-					"unsupported VMDQ mq_mode tx
 %u\n",
 
-					port_id, dev_conf-
Quoted 1 line

txmode.mq_mode);

lib/librte_ether/rte_ethdev.c +1 -1
-			return (-EINVAL);
 
+		case ETH_MQ_TX_VMDQ_DCB: /* DCB VMDQ in SRIOV

mode*/

lib/librte_ether/rte_ethdev.c +1 -0
+			break;
 
  		default: /* ETH_MQ_TX_VMDQ_ONLY or ETH_MQ_TX_NONE

*/

/* if nothing mq mode configure, use default scheme
*/

dev->data->dev_conf.txmode.mq_mode =
ETH_MQ_TX_VMDQ_ONLY;

lib/librte_ether/rte_ethdev.c +0 -2
-			if (RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool > 1)
 
-				RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool =

1;

lib/librte_ether/rte_ethdev.c +3 -2
+			if (nb_tx_q_per_pool > 1)
 
+				nb_tx_q_per_pool = 1;
 
  			break;
 
  		}
 
 
 
  		/* check valid queue number */
 
-		if ((nb_rx_q > RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool) ||
 
-		    (nb_tx_q > RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool)) {
 
+		if (nb_rx_q > nb_rx_q_per_pool || nb_tx_q >

nb_tx_q_per_pool) {

PMD_DEBUG_TRACE("ethdev port_id=%d SRIOV
active, "

lib/librte_ether/rte_ethdev.c +0 -2
-				    "queue number must less equal to %d\n",
 
-					port_id,

RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool);

lib/librte_ether/rte_ethdev.c +1 -0
+				    "rx/tx queue number must less equal to

%d/%d\n",

lib/librte_ether/rte_ethdev.c +1 -0
+					port_id,

RTE_ETH_DEV_SRIOV(dev).nb_rx_q_per_pool,

+

	RTE_ETH_DEV_SRIOV(dev).nb_tx_q_per_pool);
  			return (-EINVAL);

  		}

  	} else {
lib/librte_ether/rte_ethdev.c +0 -1
-		/* For vmdb+dcb mode check our configuration before we go

further */

lib/librte_ether/rte_ethdev.c +1 -0
+		/* For vmdq+dcb mode check our configuration before we go

further */

if (dev_conf->rxmode.mq_mode == ETH_MQ_RX_VMDQ_DCB)
{

const struct rte_eth_vmdq_dcb_conf *conf;

lib/librte_ether/rte_ethdev.c +4 -0
@@ -606,11 +624,20 @@ rte_eth_dev_check_mq_mode(uint8_t port_id,
 uint16_t nb_rx_q, uint16_t nb_tx_q,
 
  			}
 
  		}
 
 
 
+		/* For DCB we need to obtain maximum number of queues
 dinamically,
 
+		 * as this depends on max VF exported in PF */
 
+		if ((dev_conf->rxmode.mq_mode == ETH_MQ_RX_DCB) ||
 
+			(dev_conf->txmode.mq_mode == ETH_MQ_TX_DCB))

{

lib/librte_ether/rte_ethdev.c +2 -0
+
 
+				FUNC_PTR_OR_ERR_RET(*dev->dev_ops-
Quoted 1 line

dev_infos_get, -ENOTSUP);

lib/librte_ether/rte_ethdev.c +1 -0
+				(*dev->dev_ops->dev_infos_get)(dev,

&dev_info);

lib/librte_ether/rte_ethdev.c +2 -0
+		}
 
+
 
  		/* For DCB mode check our configuration before we go further

*/

  		if (dev_conf->rxmode.mq_mode == ETH_MQ_RX_DCB) {

const struct rte_eth_dcb_rx_conf *conf;

lib/librte_ether/rte_ethdev.c +1 -1
-			if (nb_rx_q != ETH_DCB_NUM_QUEUES) {
 
+			if (nb_rx_q != dev_info.max_rx_queues) {
 
  				PMD_DEBUG_TRACE("ethdev port_id=%d

DCB, nb_rx_q "

"!= %d\n",

port_id,
ETH_DCB_NUM_QUEUES);

lib/librte_ether/rte_ethdev.c +1 -1
@@ -630,7 +657,7 @@ rte_eth_dev_check_mq_mode(uint8_t port_id,
 uint16_t nb_rx_q, uint16_t nb_tx_q,
 
  		if (dev_conf->txmode.mq_mode == ETH_MQ_TX_DCB) {
 
  			const struct rte_eth_dcb_tx_conf *conf;
 
 
 
-			if (nb_tx_q != ETH_DCB_NUM_QUEUES) {
 
+			if (nb_tx_q != dev_info.max_tx_queues) {
 
  				PMD_DEBUG_TRACE("ethdev port_id=%d

DCB, nb_tx_q "

"!= %d\n",

port_id,
ETH_DCB_NUM_QUEUES);

lib/librte_ether/rte_ethdev.c +0 -0
@@ -690,7 +717,10 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t
 nb_rx_q, uint16_t nb_tx_q,
 
  	}
 
  	if (nb_rx_q == 0) {
 
  		PMD_DEBUG_TRACE("ethdev port_id=%d nb_rx_q == 0\n",

port_id);

lib/librte_ether/rte_ethdev.c +1 -1
-		return (-EINVAL);
 
+		/* In SRIOV there can be no free resource for PF. So permit use

only

lib/librte_ether/rte_ethdev.c +4 -0
+		 * for configuration. */
 
+		if (RTE_ETH_DEV_SRIOV(dev).active == 0)
 
+			return (-EINVAL);
 
  	}
 
 
 
  	if (nb_tx_q > dev_info.max_tx_queues) {
@@ -698,9 +728,13 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t
 nb_rx_q, uint16_t nb_tx_q,
 
  				port_id, nb_tx_q, dev_info.max_tx_queues);
 
  		return (-EINVAL);
 
  	}
 
+
 
  	if (nb_tx_q == 0) {
 
  		PMD_DEBUG_TRACE("ethdev port_id=%d nb_tx_q == 0\n",

port_id);

lib/librte_ether/rte_ethdev.c +1 -1
-		return (-EINVAL);
 
+		/* In SRIOV there can be no free resource for PF. So permit use

only

lib/librte_ether/rte_ethdev.c +4 -1
+		 * for configuration. */
 
+		if (RTE_ETH_DEV_SRIOV(dev).active == 0)
 
+			return (-EINVAL);
 
  	}
 
 
 
  	/* Copy the dev_conf parameter into the dev structure */
@@ -750,7 +784,7 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t
 nb_rx_q, uint16_t nb_tx_q,
 
  							ETHER_MAX_LEN;
 
  	}
 
 
 
-	/* multipe queue mode checking */
 
+	/* multiple queue mode checking */
 
  	diag = rte_eth_dev_check_mq_mode(port_id, nb_rx_q, nb_tx_q,

dev_conf);

  	if (diag != 0) {

PMD_DEBUG_TRACE("port%d rte_eth_dev_check_mq_mode =
%d\n",

lib/librte_ether/rte_ethdev.h +0 -0

index ce0528f..04fda83 100644

--- a/lib/librte_ether/rte_ethdev.h

+++ b/lib/librte_ether/rte_ethdev.h

lib/librte_ether/rte_ethdev.h +0 -1
@@ -299,7 +299,7 @@ enum rte_eth_rx_mq_mode {
 
  enum rte_eth_tx_mq_mode {
 
  	ETH_MQ_TX_NONE    = 0,  /**< It is in neither DCB nor VT mode. */
 
  	ETH_MQ_TX_DCB,          /**< For TX side,only DCB is on. */
 
-	ETH_MQ_TX_VMDQ_DCB,	/**< For TX side,both DCB and VT is

on. */

lib/librte_ether/rte_ethdev.h +1 -0
+	ETH_MQ_TX_VMDQ_DCB,     /**< For TX side,both DCB and VT is on.

*/

ETH_MQ_TX_VMDQ_ONLY, /**< Only VT on, no DCB */

  };
lib/librte_ether/rte_ethdev.h +2 -1
@@ -1569,7 +1569,8 @@ struct rte_eth_dev {
 
 
 
  struct rte_eth_dev_sriov {
 
  	uint8_t active;               /**< SRIOV is active with 16, 32 or 64 pools */
 
-	uint8_t nb_q_per_pool;        /**< rx queue number per pool */
 
+	uint8_t nb_rx_q_per_pool;        /**< rx queue number per pool */
 
+	uint8_t nb_tx_q_per_pool;        /**< tx queue number per pool */
 
  	uint16_t def_vmdq_idx;        /**< Default pool num used for PF */
 
  	uint16_t def_pool_q_idx;      /**< Default pool queue start reg index */
 
  };
lib/librte_pmd_e1000/igb_pf.c +0 -0

index bc3816a..9d2f858 100644

--- a/lib/librte_pmd_e1000/igb_pf.c

+++ b/lib/librte_pmd_e1000/igb_pf.c

lib/librte_pmd_e1000/igb_pf.c +2 -1
@@ -115,7 +115,8 @@ void igb_pf_host_init(struct rte_eth_dev *eth_dev)
 
  		rte_panic("Cannot allocate memory for private VF data\n");
 
 
 
  	RTE_ETH_DEV_SRIOV(eth_dev).active = ETH_8_POOLS;
 
-	RTE_ETH_DEV_SRIOV(eth_dev).nb_q_per_pool = nb_queue;
 
+	RTE_ETH_DEV_SRIOV(eth_dev).nb_rx_q_per_pool = nb_queue;
 
+	RTE_ETH_DEV_SRIOV(eth_dev).nb_tx_q_per_pool = nb_queue;
 
  	RTE_ETH_DEV_SRIOV(eth_dev).def_vmdq_idx = vf_num;
 
  	RTE_ETH_DEV_SRIOV(eth_dev).def_pool_q_idx = (uint16_t)(vf_num *

nb_queue);

lib/librte_pmd_ixgbe/ixgbe_ethdev.c +0 -0

index 3fc3738..347f03c 100644

--- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c

+++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c

lib/librte_pmd_ixgbe/ixgbe_ethdev.c +1 -1
@@ -3555,14 +3555,14 @@ static int ixgbe_set_vf_rate_limit(struct
 rte_eth_dev *dev, uint16_t vf,
 
  	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data-
 > dev_private);
  	struct ixgbe_vf_info *vfinfo =
 
  		*(IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data-
 > dev_private));
-	uint8_t  nb_q_per_pool = RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool;
 
+	uint8_t  nb_tx_q_per_pool =
 RTE_ETH_DEV_SRIOV(dev).nb_tx_q_per_pool;
 
  	uint32_t queue_stride =
 

IXGBE_MAX_RX_QUEUE_NUM /
RTE_ETH_DEV_SRIOV(dev).active;

  	uint32_t queue_idx = vf * queue_stride, idx = 0, vf_idx;
lib/librte_pmd_ixgbe/ixgbe_ethdev.c +4 -4
-	uint32_t queue_end = queue_idx + nb_q_per_pool - 1;
 
+	uint32_t tx_queue_end = queue_idx + nb_tx_q_per_pool - 1;
 
  	uint16_t total_rate = 0;
 
 
 
-	if (queue_end >= hw->mac.max_tx_queues)
 
+	if (tx_queue_end >= hw->mac.max_tx_queues)
 
  		return -EINVAL;
 
 
 
  	if (vfinfo != NULL) {
@@ -3577,7 +3577,7 @@ static int ixgbe_set_vf_rate_limit(struct rte_eth_dev
 *dev, uint16_t vf,
 
  		return -EINVAL;
 
 
 
  	/* Store tx_rate for this vf. */
 
-	for (idx = 0; idx < nb_q_per_pool; idx++) {
 
+	for (idx = 0; idx < nb_tx_q_per_pool; idx++) {
 
  		if (((uint64_t)0x1 << idx) & q_msk) {
 
  			if (vfinfo[vf].tx_rate[idx] != tx_rate)
 
  				vfinfo[vf].tx_rate[idx] = tx_rate;
@@ -3595,7 +3595,7 @@ static int ixgbe_set_vf_rate_limit(struct rte_eth_dev
 *dev, uint16_t vf,
 
  	}
 
 
 
  	/* Set RTTBCNRC of each queue/pool for vf X  */
 
-	for (; queue_idx <= queue_end; queue_idx++) {
 
+	for (; queue_idx <= tx_queue_end; queue_idx++) {
 
  		if (0x1 & q_msk)
 
  			ixgbe_set_queue_rate_limit(dev, queue_idx, tx_rate);
 
  		q_msk = q_msk >> 1;
lib/librte_pmd_ixgbe/ixgbe_ethdev.h +0 -0

index ca99170..ebf16e9 100644

--- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.h

+++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.h

lib/librte_pmd_ixgbe/ixgbe_ethdev.h +1 -0
@@ -159,6 +159,7 @@ struct ixgbe_vf_info {
 
  	uint16_t tx_rate[IXGBE_MAX_QUEUE_NUM_PER_VF];
 
  	uint16_t vlan_count;
 
  	uint8_t spoofchk_enabled;
 
+	unsigned int vf_api;
 
  };
 
 
 
  /*
lib/librte_pmd_ixgbe/ixgbe_pf.c +0 -0

index 51da1fd..4d30bcf 100644

--- a/lib/librte_pmd_ixgbe/ixgbe_pf.c

+++ b/lib/librte_pmd_ixgbe/ixgbe_pf.c

lib/librte_pmd_ixgbe/ixgbe_pf.c +2 -1
@@ -127,7 +127,8 @@ void ixgbe_pf_host_init(struct rte_eth_dev *eth_dev)
 
  		RTE_ETH_DEV_SRIOV(eth_dev).active = ETH_16_POOLS;
 
  	}
 
 
 
-	RTE_ETH_DEV_SRIOV(eth_dev).nb_q_per_pool = nb_queue;
 
+	RTE_ETH_DEV_SRIOV(eth_dev).nb_rx_q_per_pool = nb_queue;
 
+	RTE_ETH_DEV_SRIOV(eth_dev).nb_tx_q_per_pool = nb_queue;
 
  	RTE_ETH_DEV_SRIOV(eth_dev).def_vmdq_idx = vf_num;
 
  	RTE_ETH_DEV_SRIOV(eth_dev).def_pool_q_idx = (uint16_t)(vf_num *

nb_queue);

lib/librte_pmd_ixgbe/ixgbe_pf.c +0 -0
@@ -189,7 +190,7 @@ int ixgbe_pf_host_configure(struct rte_eth_dev
 *eth_dev)
 
  	hw->mac.ops.set_vmdq(hw, 0,
 RTE_ETH_DEV_SRIOV(eth_dev).def_vmdq_idx);
 
 
 

/*

lib/librte_pmd_ixgbe/ixgbe_pf.c +11 -10
-	 * SW msut set GCR_EXT.VT_Mode the same as GPIE.VT_Mode
 
+	 * SW must set GCR_EXT.VT_Mode the same as GPIE.VT_Mode
 
  	 */
 
  	gcr_ext = IXGBE_READ_REG(hw, IXGBE_GCR_EXT);
 
  	gcr_ext &= ~IXGBE_GCR_EXT_VT_MODE_MASK;
@@ -214,19 +215,19 @@ int ixgbe_pf_host_configure(struct rte_eth_dev
 *eth_dev)
 
  	}
 
 
 
  	IXGBE_WRITE_REG(hw, IXGBE_GCR_EXT, gcr_ext);
 
-        IXGBE_WRITE_REG(hw, IXGBE_GPIE, gpie);
 
+	IXGBE_WRITE_REG(hw, IXGBE_GPIE, gpie);
 
 
 
-        /*
 
+	/*
 
  	 * enable vlan filtering and allow all vlan tags through
 
  	 */
 
-        vlanctrl = IXGBE_READ_REG(hw, IXGBE_VLNCTRL);
 
-        vlanctrl |= IXGBE_VLNCTRL_VFE ; /* enable vlan filters */
 
-        IXGBE_WRITE_REG(hw, IXGBE_VLNCTRL, vlanctrl);
 
+	vlanctrl = IXGBE_READ_REG(hw, IXGBE_VLNCTRL);
 
+	vlanctrl |= IXGBE_VLNCTRL_VFE ; /* enable vlan filters */
 
+	IXGBE_WRITE_REG(hw, IXGBE_VLNCTRL, vlanctrl);
 
 
 
-        /* VFTA - enable all vlan filters */
 
-        for (i = 0; i < IXGBE_MAX_VFTA; i++) {
 
-                IXGBE_WRITE_REG(hw, IXGBE_VFTA(i), 0xFFFFFFFF);
 
-        }
 
+	/* VFTA - enable all vlan filters */
 
+	for (i = 0; i < IXGBE_MAX_VFTA; i++) {
 
+		IXGBE_WRITE_REG(hw, IXGBE_VFTA(i), 0xFFFFFFFF);
 
+	}
 
 
 
  	/* Enable MAC Anti-Spoofing */
 
  	hw->mac.ops.set_mac_anti_spoofing(hw, FALSE, vf_num);
@@ -369,6 +370,73 @@ ixgbe_vf_reset(struct rte_eth_dev *dev, uint16_t vf,
 uint32_t *msgbuf)
 
  }
 
 
 
  static int
 
+ixgbe_negotiate_vf_api(struct rte_eth_dev *dev, uint32_t vf, uint32_t

*msgbuf)

lib/librte_pmd_ixgbe/ixgbe_pf.c +3 -0
+{
 
+	struct ixgbe_vf_info *vfinfo =
 
+		*(IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data-
Quoted 1 line

dev_private));

lib/librte_pmd_ixgbe/ixgbe_pf.c +12 -0
+	int api = msgbuf[1];
 
+
 
+	switch (api) {
 
+	case ixgbe_mbox_api_10:
 
+	case ixgbe_mbox_api_11:
 
+		vfinfo[vf].vf_api = api;
 
+		return 0;
 
+	default:
 
+		break;
 
+	}
 
+
 
+	RTE_LOG(DEBUG, PMD, "VF %d requested invalid api version %u\n", vf,

api);

lib/librte_pmd_ixgbe/ixgbe_pf.c +8 -0
+	return -1;
 
+}
 
+
 
+static int
 
+ixgbe_get_vf_queues(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf)
 
+{
 
+	struct ixgbe_vf_info *vfinfo =
 
+		*(IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data-
Quoted 1 line

dev_private));

lib/librte_pmd_ixgbe/ixgbe_pf.c +2 -0
+	struct ixgbe_dcb_config *dcb_cfg =
 
+			IXGBE_DEV_PRIVATE_TO_DCB_CFG(dev->data-
Quoted 1 line

dev_private);

lib/librte_pmd_ixgbe/ixgbe_pf.c +14 -0
+
 
+	uint8_t num_tcs = dcb_cfg->num_tcs.pg_tcs;
 
+
 
+	/* verify the PF is supporting the correct APIs */
 
+	switch (vfinfo[vf].vf_api) {
 
+	case ixgbe_mbox_api_10:
 
+	case ixgbe_mbox_api_11:
 
+		break;
 
+	default:
 
+		return -1;
 
+	}
 
+
 
+	if (RTE_ETH_DEV_SRIOV(dev).active) {
 
+		if (dev->data->dev_conf.rxmode.mq_mode ==

ETH_MQ_RX_VMDQ_DCB)

lib/librte_pmd_ixgbe/ixgbe_pf.c +5 -0
+			msgbuf[IXGBE_VF_TX_QUEUES] = num_tcs;
 
+		else
 
+			msgbuf[IXGBE_VF_TX_QUEUES] = 1;
 
+
 
+		if (dev->data->dev_conf.txmode.mq_mode ==

ETH_MQ_TX_VMDQ_DCB)

lib/librte_pmd_ixgbe/ixgbe_pf.c +22 -0
+			msgbuf[IXGBE_VF_RX_QUEUES] = num_tcs;
 
+		else
 
+			msgbuf[IXGBE_VF_RX_QUEUES] = 1;
 
+	}	else {
 
+		/* only allow 1 Tx queue for bandwidth limiting */
 
+		msgbuf[IXGBE_VF_TX_QUEUES] = 1;
 
+		msgbuf[IXGBE_VF_RX_QUEUES] = 1;
 
+	}
 
+
 
+	/* notify VF of need for VLAN tag stripping, and correct queue */
 
+	if (num_tcs)
 
+		msgbuf[IXGBE_VF_TRANS_VLAN] = num_tcs;
 
+	else
 
+		msgbuf[IXGBE_VF_TRANS_VLAN] = 0;
 
+
 
+	/* notify VF of default queue */
 
+	msgbuf[IXGBE_VF_DEF_QUEUE] = 0;
 
+
 
+	return 0;
 
+}
 
+
 
+static int
 
  ixgbe_vf_set_mac_addr(struct rte_eth_dev *dev, uint32_t vf, uint32_t

*msgbuf)

  {

struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data-

Quoted 1 line

dev_private);

lib/librte_pmd_ixgbe/ixgbe_pf.c +6 -0
@@ -512,6 +580,12 @@ ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev,
 uint16_t vf)
 
  	case IXGBE_VF_SET_VLAN:
 
  		retval = ixgbe_vf_set_vlan(dev, vf, msgbuf);
 
  		break;
 
+	case IXGBE_VF_API_NEGOTIATE:
 
+		retval = ixgbe_negotiate_vf_api(dev, vf, msgbuf);
 
+		break;
 
+	case IXGBE_VF_GET_QUEUES:
 
+		retval = ixgbe_get_vf_queues(dev, vf, msgbuf);
 
+		break;
 
  	default:
 
  		PMD_DRV_LOG(DEBUG, "Unhandled Msg %8.8x",

(unsigned)msgbuf[0]);

  		retval = IXGBE_ERR_MBX;
lib/librte_pmd_ixgbe/ixgbe_pf.c +1 -1
@@ -526,7 +600,7 @@ ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev,
 uint16_t vf)
 
 
 
  	msgbuf[0] |= IXGBE_VT_MSGTYPE_CTS;
 
 
 
-	ixgbe_write_mbx(hw, msgbuf, 1, vf);
 
+	ixgbe_write_mbx(hw, msgbuf, mbx_size, vf);
 
 
 
  	return retval;
 
  }
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +0 -0

index e10d6a2..49b44fe 100644

--- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c

+++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c

lib/librte_pmd_ixgbe/ixgbe_rxtx.c +3 -4
@@ -3166,10 +3166,9 @@ void ixgbe_configure_dcb(struct rte_eth_dev *dev)
 
 
 
  	/* check support mq_mode for DCB */
 
  	if ((dev_conf->rxmode.mq_mode != ETH_MQ_RX_VMDQ_DCB) &&
 
-	    (dev_conf->rxmode.mq_mode != ETH_MQ_RX_DCB))
 
-		return;
 
-
 
-	if (dev->data->nb_rx_queues != ETH_DCB_NUM_QUEUES)
 
+	    (dev_conf->rxmode.mq_mode != ETH_MQ_RX_DCB) &&
 
+	    (dev_conf->txmode.mq_mode != ETH_MQ_TX_VMDQ_DCB) &&
 
+	    (dev_conf->txmode.mq_mode != ETH_MQ_TX_DCB))
 
  		return;
Quoted 8 lines
Quoted 7 lines

/** Configure DCB hardware **/

--

1.7.9.5

Self nacked - because of wrong message format.

Yeah, there is something really wrong with this email formatting.... ;) Note that since u (i guess) haven't used 'git send-email' for this series - it doesn't look like a series (at least in my thunderbird).

#5 lore raw
In reply to a message not in the archive
Quoted 31 lines · Michal Jastrzebski

Date: Mon, 12 Jan 2015 15:39:40 +0100
Message-Id: <1421073581-6644-2-git-send-email-michalx.k.jastrzebski-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
X-Mailer: git-send-email 2.1.1
In-Reply-To: <1421073581-6644-1-git-send-email-michalx.k.jastrzebski-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
References: <1421073581-6644-1-git-send-email-michalx.k.jastrzebski-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

From: Pawel Wodkowski <[email protected]>

This patch add support for DCB in SRIOV mode. When no PFC

is enabled this feature might be used as multiple queues

(up to 8 or 4) for VF.

It incorporate following modifications:

- Allow zero rx/tx queues to be passed to rte_eth_dev_configure().

Rationale:

in SRIOV mode PF use first free VF to RX/TX. If VF count

is 16 or 32 all recources are assigned to VFs so PF can

be used only for configuration.

- split nb_q_per_pool to nb_rx_q_per_pool and nb_tx_q_per_pool

Quoted 7 lines

Rationale:

rx and tx number of queue might be different if RX and TX are

configured in different mode. This allow to inform VF about

proper number of queues.

Nice move! Ouyang, this is a nice answer to my recent remarks about your PATCH4 in "Enable VF RSS for Niantic" series.

Michal, could u, pls., respin this series after fixing the formatting and (maybe) using "git send-email" for sending? ;)

thanks,
vlad

Quoted 902 lines

- extern mailbox API for DCB mode

---

  lib/librte_ether/rte_ethdev.c       |   84 +++++++++++++++++++++---------
  lib/librte_ether/rte_ethdev.h       |    5 +-
  lib/librte_pmd_e1000/igb_pf.c       |    3 +-
  lib/librte_pmd_ixgbe/ixgbe_ethdev.c |   10 ++--
  lib/librte_pmd_ixgbe/ixgbe_ethdev.h |    1 +
  lib/librte_pmd_ixgbe/ixgbe_pf.c     |   98 ++++++++++++++++++++++++++++++-----
  lib/librte_pmd_ixgbe/ixgbe_rxtx.c   |    7 ++-
  7 files changed, 159 insertions(+), 49 deletions(-)
lib/librte_ether/rte_ethdev.c +0 -0

index 95f2ceb..4c1a494 100644

--- a/lib/librte_ether/rte_ethdev.c

+++ b/lib/librte_ether/rte_ethdev.c

lib/librte_ether/rte_ethdev.c +31 -13
@@ -333,7 +333,7 @@ rte_eth_dev_rx_queue_config(struct rte_eth_dev *dev, uint16_t nb_queues)
 
  		dev->data->rx_queues = rte_zmalloc("ethdev->rx_queues",
 
  				sizeof(dev->data->rx_queues[0]) * nb_queues,
 
  				RTE_CACHE_LINE_SIZE);
 
-		if (dev->data->rx_queues == NULL) {
 
+		if (dev->data->rx_queues == NULL && nb_queues > 0) {
 
  			dev->data->nb_rx_queues = 0;
 
  			return -(ENOMEM);
 
  		}
@@ -475,7 +475,7 @@ rte_eth_dev_tx_queue_config(struct rte_eth_dev *dev, uint16_t nb_queues)
 
  		dev->data->tx_queues = rte_zmalloc("ethdev->tx_queues",
 
  				sizeof(dev->data->tx_queues[0]) * nb_queues,
 
  				RTE_CACHE_LINE_SIZE);
 
-		if (dev->data->tx_queues == NULL) {
 
+		if (dev->data->tx_queues == NULL && nb_queues > 0) {
 
  			dev->data->nb_tx_queues = 0;
 
  			return -(ENOMEM);
 
  		}
@@ -507,6 +507,7 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
 
  		      const struct rte_eth_conf *dev_conf)
 
  {
 
  	struct rte_eth_dev *dev = &rte_eth_devices[port_id];
 
+	struct rte_eth_dev_info dev_info;
 
 
 
  	if (RTE_ETH_DEV_SRIOV(dev).active != 0) {
 
  		/* check multi-queue mode */
@@ -524,11 +525,33 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
 
  			return (-EINVAL);
 
  		}
 
 
 
+		if ((dev_conf->rxmode.mq_mode == ETH_MQ_RX_VMDQ_DCB) &&
 
+			(dev_conf->txmode.mq_mode == ETH_MQ_TX_VMDQ_DCB)) {
 
+			enum rte_eth_nb_pools rx_pools =
 
+						dev_conf->rx_adv_conf.vmdq_dcb_conf.nb_queue_pools;
 
+			enum rte_eth_nb_pools tx_pools =
 
+						dev_conf->tx_adv_conf.vmdq_dcb_tx_conf.nb_queue_pools;
 
+
 
+			if (rx_pools != tx_pools) {
 
+				/* Only equal number of pools is supported when
 
+				 * DCB+VMDq in SRIOV */
 
+				PMD_DEBUG_TRACE("ethdev port_id=%" PRIu8
 
+						" SRIOV active, DCB+VMDQ mode, "
 
+						"number of rx and tx pools is not eqaul\n",
 
+						port_id);
 
+				return (-EINVAL);
 
+			}
 
+		}
 
+
 
+		uint16_t nb_rx_q_per_pool = RTE_ETH_DEV_SRIOV(dev).nb_rx_q_per_pool;
 
+		uint16_t nb_tx_q_per_pool = RTE_ETH_DEV_SRIOV(dev).nb_tx_q_per_pool;
 
+
 
  		switch (dev_conf->rxmode.mq_mode) {
 
-		case ETH_MQ_RX_VMDQ_RSS:
 
  		case ETH_MQ_RX_VMDQ_DCB:
 
+			break;
 
+		case ETH_MQ_RX_VMDQ_RSS:
 
  		case ETH_MQ_RX_VMDQ_DCB_RSS:
 
-			/* DCB/RSS VMDQ in SRIOV mode, not implement yet */
 
+			/* RSS, DCB+RSS VMDQ in SRIOV mode, not implement yet */
 
  			PMD_DEBUG_TRACE("ethdev port_id=%" PRIu8
 
  					" SRIOV active, "
 
  					"unsupported VMDQ mq_mode rx %u\n",
@@ -537,37 +560,32 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
 
  		default: /* ETH_MQ_RX_VMDQ_ONLY or ETH_MQ_RX_NONE */
 
  			/* if nothing mq mode configure, use default scheme */
 
  			dev->data->dev_conf.rxmode.mq_mode = ETH_MQ_RX_VMDQ_ONLY;
 
-			if (RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool > 1)
 
-				RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool = 1;
 
+			if (nb_rx_q_per_pool > 1)
 
+				nb_rx_q_per_pool = 1;
 
  			break;
 
  		}
 
 
 
  		switch (dev_conf->txmode.mq_mode) {
 
-		case ETH_MQ_TX_VMDQ_DCB:
 
-			/* DCB VMDQ in SRIOV mode, not implement yet */
 
-			PMD_DEBUG_TRACE("ethdev port_id=%" PRIu8
 
-					" SRIOV active, "
 
-					"unsupported VMDQ mq_mode tx %u\n",
 
-					port_id, dev_conf->txmode.mq_mode);
 
-			return (-EINVAL);
 
+		case ETH_MQ_TX_VMDQ_DCB: /* DCB VMDQ in SRIOV mode*/
 
+			break;
 

default: /* ETH_MQ_TX_VMDQ_ONLY or ETH_MQ_TX_NONE */

/* if nothing mq mode configure, use default scheme */

  			dev->data->dev_conf.txmode.mq_mode = ETH_MQ_TX_VMDQ_ONLY;
lib/librte_ether/rte_ethdev.c +28 -12
-			if (RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool > 1)
 
-				RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool = 1;
 
+			if (nb_tx_q_per_pool > 1)
 
+				nb_tx_q_per_pool = 1;
 
  			break;
 
  		}
 
 
 
  		/* check valid queue number */
 
-		if ((nb_rx_q > RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool) ||
 
-		    (nb_tx_q > RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool)) {
 
+		if (nb_rx_q > nb_rx_q_per_pool || nb_tx_q > nb_tx_q_per_pool) {
 
  			PMD_DEBUG_TRACE("ethdev port_id=%d SRIOV active, "
 
-				    "queue number must less equal to %d\n",
 
-					port_id, RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool);
 
+				    "rx/tx queue number must less equal to %d/%d\n",
 
+					port_id, RTE_ETH_DEV_SRIOV(dev).nb_rx_q_per_pool,
 
+					RTE_ETH_DEV_SRIOV(dev).nb_tx_q_per_pool);
 
  			return (-EINVAL);
 
  		}
 
  	} else {
 
-		/* For vmdb+dcb mode check our configuration before we go further */
 
+		/* For vmdq+dcb mode check our configuration before we go further */
 
  		if (dev_conf->rxmode.mq_mode == ETH_MQ_RX_VMDQ_DCB) {
 
  			const struct rte_eth_vmdq_dcb_conf *conf;
@@ -606,11 +624,20 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
 
  			}
 
  		}
 
 
 
+		/* For DCB we need to obtain maximum number of queues dinamically,
 
+		 * as this depends on max VF exported in PF */
 
+		if ((dev_conf->rxmode.mq_mode == ETH_MQ_RX_DCB) ||
 
+			(dev_conf->txmode.mq_mode == ETH_MQ_TX_DCB)) {
 
+
 
+				FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
 
+				(*dev->dev_ops->dev_infos_get)(dev, &dev_info);
 
+		}
 
+
 
  		/* For DCB mode check our configuration before we go further */
 
  		if (dev_conf->rxmode.mq_mode == ETH_MQ_RX_DCB) {
 
  			const struct rte_eth_dcb_rx_conf *conf;
 
 
 
-			if (nb_rx_q != ETH_DCB_NUM_QUEUES) {
 
+			if (nb_rx_q != dev_info.max_rx_queues) {
 
  				PMD_DEBUG_TRACE("ethdev port_id=%d DCB, nb_rx_q "
 
  						"!= %d\n",
 
  						port_id, ETH_DCB_NUM_QUEUES);
@@ -630,7 +657,7 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
 
  		if (dev_conf->txmode.mq_mode == ETH_MQ_TX_DCB) {
 
  			const struct rte_eth_dcb_tx_conf *conf;
 
 
 
-			if (nb_tx_q != ETH_DCB_NUM_QUEUES) {
 
+			if (nb_tx_q != dev_info.max_tx_queues) {
 
  				PMD_DEBUG_TRACE("ethdev port_id=%d DCB, nb_tx_q "
 
  						"!= %d\n",
 
  						port_id, ETH_DCB_NUM_QUEUES);
@@ -690,7 +717,10 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
 
  	}
 
  	if (nb_rx_q == 0) {
 
  		PMD_DEBUG_TRACE("ethdev port_id=%d nb_rx_q == 0\n", port_id);
 
-		return (-EINVAL);
 
+		/* In SRIOV there can be no free resource for PF. So permit use only
 
+		 * for configuration. */
 
+		if (RTE_ETH_DEV_SRIOV(dev).active == 0)
 
+			return (-EINVAL);
 
  	}
 
 
 
  	if (nb_tx_q > dev_info.max_tx_queues) {
@@ -698,9 +728,13 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
 
  				port_id, nb_tx_q, dev_info.max_tx_queues);
 
  		return (-EINVAL);
 
  	}
 
+
 
  	if (nb_tx_q == 0) {
 
  		PMD_DEBUG_TRACE("ethdev port_id=%d nb_tx_q == 0\n", port_id);
 
-		return (-EINVAL);
 
+		/* In SRIOV there can be no free resource for PF. So permit use only
 
+		 * for configuration. */
 
+		if (RTE_ETH_DEV_SRIOV(dev).active == 0)
 
+			return (-EINVAL);
 
  	}
 
 
 
  	/* Copy the dev_conf parameter into the dev structure */
@@ -750,7 +784,7 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
 
  							ETHER_MAX_LEN;
 
  	}
 
 
 
-	/* multipe queue mode checking */
 
+	/* multiple queue mode checking */
 
  	diag = rte_eth_dev_check_mq_mode(port_id, nb_rx_q, nb_tx_q, dev_conf);
 
  	if (diag != 0) {
 
  		PMD_DEBUG_TRACE("port%d rte_eth_dev_check_mq_mode = %d\n",
lib/librte_ether/rte_ethdev.h +0 -0

index ce0528f..04fda83 100644

--- a/lib/librte_ether/rte_ethdev.h

+++ b/lib/librte_ether/rte_ethdev.h

lib/librte_ether/rte_ethdev.h +3 -2
@@ -299,7 +299,7 @@ enum rte_eth_rx_mq_mode {
 
  enum rte_eth_tx_mq_mode {
 
  	ETH_MQ_TX_NONE    = 0,  /**< It is in neither DCB nor VT mode. */
 
  	ETH_MQ_TX_DCB,          /**< For TX side,only DCB is on. */
 
-	ETH_MQ_TX_VMDQ_DCB,	/**< For TX side,both DCB and VT is on. */
 
+	ETH_MQ_TX_VMDQ_DCB,     /**< For TX side,both DCB and VT is on. */
 
  	ETH_MQ_TX_VMDQ_ONLY,    /**< Only VT on, no DCB */
 
  };
@@ -1569,7 +1569,8 @@ struct rte_eth_dev {
 
 
 
  struct rte_eth_dev_sriov {
 
  	uint8_t active;               /**< SRIOV is active with 16, 32 or 64 pools */
 
-	uint8_t nb_q_per_pool;        /**< rx queue number per pool */
 
+	uint8_t nb_rx_q_per_pool;        /**< rx queue number per pool */
 
+	uint8_t nb_tx_q_per_pool;        /**< tx queue number per pool */
 
 
  	uint16_t def_vmdq_idx;        /**< Default pool num used for PF */
 
  	uint16_t def_pool_q_idx;      /**< Default pool queue start reg index */
 
  };
lib/librte_pmd_e1000/igb_pf.c +0 -0

index bc3816a..9d2f858 100644

--- a/lib/librte_pmd_e1000/igb_pf.c

+++ b/lib/librte_pmd_e1000/igb_pf.c

lib/librte_pmd_e1000/igb_pf.c +2 -1
@@ -115,7 +115,8 @@ void igb_pf_host_init(struct rte_eth_dev *eth_dev)
 
  		rte_panic("Cannot allocate memory for private VF data\n");
 
 
 
  	RTE_ETH_DEV_SRIOV(eth_dev).active = ETH_8_POOLS;
 
-	RTE_ETH_DEV_SRIOV(eth_dev).nb_q_per_pool = nb_queue;
 
+	RTE_ETH_DEV_SRIOV(eth_dev).nb_rx_q_per_pool = nb_queue;
 
+	RTE_ETH_DEV_SRIOV(eth_dev).nb_tx_q_per_pool = nb_queue;
 
  	RTE_ETH_DEV_SRIOV(eth_dev).def_vmdq_idx = vf_num;
 
  	RTE_ETH_DEV_SRIOV(eth_dev).def_pool_q_idx = (uint16_t)(vf_num * nb_queue);
lib/librte_pmd_ixgbe/ixgbe_ethdev.c +0 -0

index 3fc3738..347f03c 100644

--- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c

+++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c

lib/librte_pmd_ixgbe/ixgbe_ethdev.c +1 -1
@@ -3555,14 +3555,14 @@ static int ixgbe_set_vf_rate_limit(struct rte_eth_dev *dev, uint16_t vf,
 
  	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
  	struct ixgbe_vf_info *vfinfo =
 
  		*(IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private));
 
-	uint8_t  nb_q_per_pool = RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool;
 
+	uint8_t  nb_tx_q_per_pool = RTE_ETH_DEV_SRIOV(dev).nb_tx_q_per_pool;
 
  	uint32_t queue_stride =
 
  		IXGBE_MAX_RX_QUEUE_NUM / RTE_ETH_DEV_SRIOV(dev).active;
 
  	uint32_t queue_idx = vf * queue_stride, idx = 0, vf_idx;
lib/librte_pmd_ixgbe/ixgbe_ethdev.c +4 -4
-	uint32_t queue_end = queue_idx + nb_q_per_pool - 1;
 
+	uint32_t tx_queue_end = queue_idx + nb_tx_q_per_pool - 1;
 
  	uint16_t total_rate = 0;
 
 
 
-	if (queue_end >= hw->mac.max_tx_queues)
 
+	if (tx_queue_end >= hw->mac.max_tx_queues)
 
  		return -EINVAL;
 
 
 
  	if (vfinfo != NULL) {
@@ -3577,7 +3577,7 @@ static int ixgbe_set_vf_rate_limit(struct rte_eth_dev *dev, uint16_t vf,
 
  		return -EINVAL;
 
 
 
  	/* Store tx_rate for this vf. */
 
-	for (idx = 0; idx < nb_q_per_pool; idx++) {
 
+	for (idx = 0; idx < nb_tx_q_per_pool; idx++) {
 
  		if (((uint64_t)0x1 << idx) & q_msk) {
 
  			if (vfinfo[vf].tx_rate[idx] != tx_rate)
 
  				vfinfo[vf].tx_rate[idx] = tx_rate;
@@ -3595,7 +3595,7 @@ static int ixgbe_set_vf_rate_limit(struct rte_eth_dev *dev, uint16_t vf,
 
  	}
 
 
 
  	/* Set RTTBCNRC of each queue/pool for vf X  */
 
-	for (; queue_idx <= queue_end; queue_idx++) {
 
+	for (; queue_idx <= tx_queue_end; queue_idx++) {
 
  		if (0x1 & q_msk)
 
  			ixgbe_set_queue_rate_limit(dev, queue_idx, tx_rate);
 
  		q_msk = q_msk >> 1;
lib/librte_pmd_ixgbe/ixgbe_ethdev.h +0 -0

index ca99170..ebf16e9 100644

--- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.h

+++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.h

lib/librte_pmd_ixgbe/ixgbe_ethdev.h +1 -0
@@ -159,6 +159,7 @@ struct ixgbe_vf_info {
 
  	uint16_t tx_rate[IXGBE_MAX_QUEUE_NUM_PER_VF];
 
  	uint16_t vlan_count;
 
  	uint8_t spoofchk_enabled;
 
+	unsigned int vf_api;
 
  };
 
 
 
  /*
lib/librte_pmd_ixgbe/ixgbe_pf.c +0 -0

index 51da1fd..4d30bcf 100644

--- a/lib/librte_pmd_ixgbe/ixgbe_pf.c

+++ b/lib/librte_pmd_ixgbe/ixgbe_pf.c

lib/librte_pmd_ixgbe/ixgbe_pf.c +86 -12
@@ -127,7 +127,8 @@ void ixgbe_pf_host_init(struct rte_eth_dev *eth_dev)
 
  		RTE_ETH_DEV_SRIOV(eth_dev).active = ETH_16_POOLS;
 
  	}
 
 
 
-	RTE_ETH_DEV_SRIOV(eth_dev).nb_q_per_pool = nb_queue;
 
+	RTE_ETH_DEV_SRIOV(eth_dev).nb_rx_q_per_pool = nb_queue;
 
+	RTE_ETH_DEV_SRIOV(eth_dev).nb_tx_q_per_pool = nb_queue;
 
  	RTE_ETH_DEV_SRIOV(eth_dev).def_vmdq_idx = vf_num;
 
  	RTE_ETH_DEV_SRIOV(eth_dev).def_pool_q_idx = (uint16_t)(vf_num * nb_queue);
@@ -189,7 +190,7 @@ int ixgbe_pf_host_configure(struct rte_eth_dev *eth_dev)
 
  	hw->mac.ops.set_vmdq(hw, 0, RTE_ETH_DEV_SRIOV(eth_dev).def_vmdq_idx);
 
 
 
  	/*
 
-	 * SW msut set GCR_EXT.VT_Mode the same as GPIE.VT_Mode
 
+	 * SW must set GCR_EXT.VT_Mode the same as GPIE.VT_Mode
 
  	 */
 
  	gcr_ext = IXGBE_READ_REG(hw, IXGBE_GCR_EXT);
 
  	gcr_ext &= ~IXGBE_GCR_EXT_VT_MODE_MASK;
@@ -214,19 +215,19 @@ int ixgbe_pf_host_configure(struct rte_eth_dev *eth_dev)
 
  	}
 
 
 
  	IXGBE_WRITE_REG(hw, IXGBE_GCR_EXT, gcr_ext);
 
-        IXGBE_WRITE_REG(hw, IXGBE_GPIE, gpie);
 
+	IXGBE_WRITE_REG(hw, IXGBE_GPIE, gpie);
 
 
 
-        /*
 
+	/*
 
  	 * enable vlan filtering and allow all vlan tags through
 
  	 */
 
-        vlanctrl = IXGBE_READ_REG(hw, IXGBE_VLNCTRL);
 
-        vlanctrl |= IXGBE_VLNCTRL_VFE ; /* enable vlan filters */
 
-        IXGBE_WRITE_REG(hw, IXGBE_VLNCTRL, vlanctrl);
 
+	vlanctrl = IXGBE_READ_REG(hw, IXGBE_VLNCTRL);
 
+	vlanctrl |= IXGBE_VLNCTRL_VFE ; /* enable vlan filters */
 
+	IXGBE_WRITE_REG(hw, IXGBE_VLNCTRL, vlanctrl);
 
 
 
-        /* VFTA - enable all vlan filters */
 
-        for (i = 0; i < IXGBE_MAX_VFTA; i++) {
 
-                IXGBE_WRITE_REG(hw, IXGBE_VFTA(i), 0xFFFFFFFF);
 
-        }
 
+	/* VFTA - enable all vlan filters */
 
+	for (i = 0; i < IXGBE_MAX_VFTA; i++) {
 
+		IXGBE_WRITE_REG(hw, IXGBE_VFTA(i), 0xFFFFFFFF);
 
+	}
 
 
 
  	/* Enable MAC Anti-Spoofing */
 
  	hw->mac.ops.set_mac_anti_spoofing(hw, FALSE, vf_num);
@@ -369,6 +370,73 @@ ixgbe_vf_reset(struct rte_eth_dev *dev, uint16_t vf, uint32_t *msgbuf)
 
  }
 
 
 
  static int
 
+ixgbe_negotiate_vf_api(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf)
 
+{
 
+	struct ixgbe_vf_info *vfinfo =
 
+		*(IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private));
 
+	int api = msgbuf[1];
 
+
 
+	switch (api) {
 
+	case ixgbe_mbox_api_10:
 
+	case ixgbe_mbox_api_11:
 
+		vfinfo[vf].vf_api = api;
 
+		return 0;
 
+	default:
 
+		break;
 
+	}
 
+
 
+	RTE_LOG(DEBUG, PMD, "VF %d requested invalid api version %u\n", vf, api);
 
+	return -1;
 
+}
 
+
 
+static int
 
+ixgbe_get_vf_queues(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf)
 
+{
 
+	struct ixgbe_vf_info *vfinfo =
 
+		*(IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private));
 
+	struct ixgbe_dcb_config *dcb_cfg =
 
+			IXGBE_DEV_PRIVATE_TO_DCB_CFG(dev->data->dev_private);
 
+
 
+	uint8_t num_tcs = dcb_cfg->num_tcs.pg_tcs;
 
+
 
+	/* verify the PF is supporting the correct APIs */
 
+	switch (vfinfo[vf].vf_api) {
 
+	case ixgbe_mbox_api_10:
 
+	case ixgbe_mbox_api_11:
 
+		break;
 
+	default:
 
+		return -1;
 
+	}
 
+
 
+	if (RTE_ETH_DEV_SRIOV(dev).active) {
 
+		if (dev->data->dev_conf.rxmode.mq_mode == ETH_MQ_RX_VMDQ_DCB)
 
+			msgbuf[IXGBE_VF_TX_QUEUES] = num_tcs;
 
+		else
 
+			msgbuf[IXGBE_VF_TX_QUEUES] = 1;
 
+
 
+		if (dev->data->dev_conf.txmode.mq_mode == ETH_MQ_TX_VMDQ_DCB)
 
+			msgbuf[IXGBE_VF_RX_QUEUES] = num_tcs;
 
+		else
 
+			msgbuf[IXGBE_VF_RX_QUEUES] = 1;
 
+	}	else {
 
+		/* only allow 1 Tx queue for bandwidth limiting */
 
+		msgbuf[IXGBE_VF_TX_QUEUES] = 1;
 
+		msgbuf[IXGBE_VF_RX_QUEUES] = 1;
 
+	}
 
+
 
+	/* notify VF of need for VLAN tag stripping, and correct queue */
 
+	if (num_tcs)
 
+		msgbuf[IXGBE_VF_TRANS_VLAN] = num_tcs;
 
+	else
 
+		msgbuf[IXGBE_VF_TRANS_VLAN] = 0;
 
+
 
+	/* notify VF of default queue */
 
+	msgbuf[IXGBE_VF_DEF_QUEUE] = 0;
 
+
 
+	return 0;
 
+}
 
+
 
+static int
 
  ixgbe_vf_set_mac_addr(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf)
 
  {
 
  	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -512,6 +580,12 @@ ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t vf)
 
  	case IXGBE_VF_SET_VLAN:
 
  		retval = ixgbe_vf_set_vlan(dev, vf, msgbuf);
 
  		break;
 
+	case IXGBE_VF_API_NEGOTIATE:
 
+		retval = ixgbe_negotiate_vf_api(dev, vf, msgbuf);
 
+		break;
 
+	case IXGBE_VF_GET_QUEUES:
 
+		retval = ixgbe_get_vf_queues(dev, vf, msgbuf);
 
+		break;
 
  	default:
 
  		PMD_DRV_LOG(DEBUG, "Unhandled Msg %8.8x", (unsigned)msgbuf[0]);
 
  		retval = IXGBE_ERR_MBX;
@@ -526,7 +600,7 @@ ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev, uint16_t vf)
 
 
 
  	msgbuf[0] |= IXGBE_VT_MSGTYPE_CTS;
 
 
 
-	ixgbe_write_mbx(hw, msgbuf, 1, vf);
 
+	ixgbe_write_mbx(hw, msgbuf, mbx_size, vf);
 
 
 
  	return retval;
 
  }
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +0 -0

index e10d6a2..49b44fe 100644

--- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c

+++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c

lib/librte_pmd_ixgbe/ixgbe_rxtx.c +3 -4
@@ -3166,10 +3166,9 @@ void ixgbe_configure_dcb(struct rte_eth_dev *dev)
 
 
 
  	/* check support mq_mode for DCB */
 
  	if ((dev_conf->rxmode.mq_mode != ETH_MQ_RX_VMDQ_DCB) &&
 
-	    (dev_conf->rxmode.mq_mode != ETH_MQ_RX_DCB))
 
-		return;
 
-
 
-	if (dev->data->nb_rx_queues != ETH_DCB_NUM_QUEUES)
 
+	    (dev_conf->rxmode.mq_mode != ETH_MQ_RX_DCB) &&
 
+	    (dev_conf->txmode.mq_mode != ETH_MQ_TX_VMDQ_DCB) &&
 
+	    (dev_conf->txmode.mq_mode != ETH_MQ_TX_DCB))
 
  		return;
 
 
 
  	/** Configure DCB hardware **/

A message that is not in the archive (sent off-list or not yet received): 54B4EEA2.1020300-RmZWMc9puTNJc61us3aD9laTQe2KTcn/@public.gmane.org

#7 lore raw
Quoted 49 lines

-----Original Message-----
From: Vlad Zolotarov [mailto:vladz-RmZWMc9puTNJc61us3aD9laTQe2KTcn/@public.gmane.org]
Sent: Tuesday, January 13, 2015 6:09 PM
To: Jastrzebski, MichalX K; [email protected]
Cc: Ouyang, Changchun
Subject: Re: [dpdk-dev] [PATCH 1/2] pmd: add DCB for VF for ixgbe

Quoted 38 lines · Michal Jastrzebski

Date: Mon, 12 Jan 2015 15:39:40 +0100
Message-Id:
<1421073581-6644-2-git-send-email-michalx.k.jastrzebski-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
X-Mailer: git-send-email 2.1.1
In-Reply-To:
<1421073581-6644-1-git-send-email-michalx.k.jastrzebski-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> References:
<1421073581-6644-1-git-send-email-michalx.k.jastrzebski-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

From: Pawel Wodkowski <[email protected]>

This patch add support for DCB in SRIOV mode. When no PFC

is enabled this feature might be used as multiple queues

(up to 8 or 4) for VF.

It incorporate following modifications:

- Allow zero rx/tx queues to be passed to rte_eth_dev_configure().

Rationale:

in SRIOV mode PF use first free VF to RX/TX. If VF count

is 16 or 32 all recources are assigned to VFs so PF can

be used only for configuration.

- split nb_q_per_pool to nb_rx_q_per_pool and nb_tx_q_per_pool

Rationale:

rx and tx number of queue might be different if RX and TX are

Quoted 7 lines
Quoted 3 lines

configured in different mode. This allow to inform VF about

proper number of queues.

Nice move! Ouyang, this is a nice answer to my recent remarks about your PATCH4 in "Enable VF RSS for Niantic" series.

After I respond your last comments, I see this, :-), I am sure we both agree it is the right way to resolve it in vmdq dcb case.

Quoted 1,016 lines

Michal, could u, pls., respin this series after fixing the formatting and (maybe) using "git send-email" for sending? ;)

thanks,
vlad

Quoted 13 lines

- extern mailbox API for DCB mode

---

  lib/librte_ether/rte_ethdev.c       |   84 +++++++++++++++++++++---------
  lib/librte_ether/rte_ethdev.h       |    5 +-
Quoted 7 lines
  lib/librte_pmd_e1000/igb_pf.c       |    3 +-
  lib/librte_pmd_ixgbe/ixgbe_ethdev.c |   10 ++--
  lib/librte_pmd_ixgbe/ixgbe_ethdev.h |    1 +
  lib/librte_pmd_ixgbe/ixgbe_pf.c     |   98

++++++++++++++++++++++++++++++-----

Quoted 17 lines
  lib/librte_pmd_ixgbe/ixgbe_rxtx.c   |    7 ++-
  7 files changed, 159 insertions(+), 49 deletions(-)
lib/librte_ether/rte_ethdev.c +0 -0

index 95f2ceb..4c1a494 100644

--- a/lib/librte_ether/rte_ethdev.c

+++ b/lib/librte_ether/rte_ethdev.c

lib/librte_ether/rte_ethdev.c rte_eth_dev_rx_queue_config(struct rte_eth_dev · line 337

Quoted 5 lines
lib/librte_ether/rte_ethdev.c +0 -0
@@ -333,7 +333,7 @@ rte_eth_dev_rx_queue_config(struct rte_eth_dev
 *dev, uint16_t nb_queues)
 
  		dev->data->rx_queues = rte_zmalloc("ethdev->rx_queues",
 
  				sizeof(dev->data->rx_queues[0]) *

nb_queues,

Quoted 14 lines
lib/librte_ether/rte_ethdev.c +1 -1
  				RTE_CACHE_LINE_SIZE);
 
-		if (dev->data->rx_queues == NULL) {
 
+		if (dev->data->rx_queues == NULL && nb_queues > 0) {
 
  			dev->data->nb_rx_queues = 0;
 
  			return -(ENOMEM);
 
  		}

lib/librte_ether/rte_ethdev.c rte_eth_dev_tx_queue_config(struct rte_eth_dev · line 479

Quoted 5 lines
lib/librte_ether/rte_ethdev.c +0 -0
@@ -475,7 +475,7 @@ rte_eth_dev_tx_queue_config(struct rte_eth_dev
 *dev, uint16_t nb_queues)
 
  		dev->data->tx_queues = rte_zmalloc("ethdev->tx_queues",
 
  				sizeof(dev->data->tx_queues[0]) *

nb_queues,

Quoted 31 lines
lib/librte_ether/rte_ethdev.c +2 -1
  				RTE_CACHE_LINE_SIZE);
 
-		if (dev->data->tx_queues == NULL) {
 
+		if (dev->data->tx_queues == NULL && nb_queues > 0) {
 
  			dev->data->nb_tx_queues = 0;
 
  			return -(ENOMEM);
 
  		}
@@ -507,6 +507,7 @@ rte_eth_dev_check_mq_mode(uint8_t port_id,
 uint16_t nb_rx_q, uint16_t nb_tx_q,
 
  		      const struct rte_eth_conf *dev_conf)
 
  {
 
  	struct rte_eth_dev *dev = &rte_eth_devices[port_id];
 
+	struct rte_eth_dev_info dev_info;
 
 
 
  	if (RTE_ETH_DEV_SRIOV(dev).active != 0) {
 
  		/* check multi-queue mode */

lib/librte_ether/rte_ethdev.c rte_eth_dev_check_mq_mode(uint8_t port_id, · line 533

Quoted 9 lines
lib/librte_ether/rte_ethdev.c +1 -0
@@ -524,11 +525,33 @@ rte_eth_dev_check_mq_mode(uint8_t port_id,
 uint16_t nb_rx_q, uint16_t nb_tx_q,
 
  			return (-EINVAL);
 
  		}
 
 
 
+		if ((dev_conf->rxmode.mq_mode ==

ETH_MQ_RX_VMDQ_DCB) &&

lib/librte_ether/rte_ethdev.c rte_eth_dev_check_mq_mode(uint8_t port_id, · line 534

Quoted 2 lines
lib/librte_ether/rte_ethdev.c +1 -0
+			(dev_conf->txmode.mq_mode ==

ETH_MQ_TX_VMDQ_DCB)) {

Quoted 11 lines
lib/librte_ether/rte_ethdev.c +4 -0
+			enum rte_eth_nb_pools rx_pools =
 
+						dev_conf-
 rx_adv_conf.vmdq_dcb_conf.nb_queue_pools;
 
+			enum rte_eth_nb_pools tx_pools =
 
+						dev_conf-

tx_adv_conf.vmdq_dcb_tx_conf.nb_queue_pools;

lib/librte_ether/rte_ethdev.c

Quoted 5 lines
lib/librte_ether/rte_ethdev.c +3 -0
+
 
+			if (rx_pools != tx_pools) {
 
+				/* Only equal number of pools is supported

when

lib/librte_ether/rte_ethdev.c

Quoted 4 lines
lib/librte_ether/rte_ethdev.c +2 -0
+				 * DCB+VMDq in SRIOV */
 
+				PMD_DEBUG_TRACE("ethdev port_id=%"

PRIu8

lib/librte_ether/rte_ethdev.c

Quoted 2 lines
lib/librte_ether/rte_ethdev.c +1 -0
+						" SRIOV active, DCB+VMDQ

mode, "

lib/librte_ether/rte_ethdev.c

Quoted 2 lines
lib/librte_ether/rte_ethdev.c +1 -0
+						"number of rx and tx pools is

not eqaul\n",

Quoted 22 lines
lib/librte_ether/rte_ethdev.c +10 -1
+						port_id);
 
+				return (-EINVAL);
 
+			}
 
+		}
 
+
 
+		uint16_t nb_rx_q_per_pool =
+RTE_ETH_DEV_SRIOV(dev).nb_rx_q_per_pool;
 
+		uint16_t nb_tx_q_per_pool =
+RTE_ETH_DEV_SRIOV(dev).nb_tx_q_per_pool;
 
+
 
  		switch (dev_conf->rxmode.mq_mode) {
 
-		case ETH_MQ_RX_VMDQ_RSS:

lib/librte_ether/rte_ethdev.c

Quoted 10 lines
lib/librte_ether/rte_ethdev.c +2 -1
 
  		case ETH_MQ_RX_VMDQ_DCB:
 
+			break;
 
+		case ETH_MQ_RX_VMDQ_RSS:
 
  		case ETH_MQ_RX_VMDQ_DCB_RSS:
 
-			/* DCB/RSS VMDQ in SRIOV mode, not implement

yet */

lib/librte_ether/rte_ethdev.c

Quoted 2 lines
lib/librte_ether/rte_ethdev.c +1 -0
+			/* RSS, DCB+RSS VMDQ in SRIOV mode, not

implement yet */

Quoted 6 lines

PMD_DEBUG_TRACE("ethdev port_id=%" PRIu8

" SRIOV active, "

"unsupported VMDQ mq_mode

rx %u\n",

lib/librte_ether/rte_ethdev.c rte_eth_dev_check_mq_mode(uint8_t port_id, · line 562

Quoted 5 lines
lib/librte_ether/rte_ethdev.c +0 -0
@@ -537,37 +560,32 @@ rte_eth_dev_check_mq_mode(uint8_t port_id,
 uint16_t nb_rx_q, uint16_t nb_tx_q,
 
  		default: /* ETH_MQ_RX_VMDQ_ONLY or

ETH_MQ_RX_NONE */

lib/librte_ether/rte_ethdev.c rte_eth_dev_check_mq_mode(uint8_t port_id, · line 563

Quoted 2 lines
lib/librte_ether/rte_ethdev.c +0 -0
  			/* if nothing mq mode configure, use default scheme

*/

lib/librte_ether/rte_ethdev.c rte_eth_dev_check_mq_mode(uint8_t port_id, · line 564

Quoted 2 lines
lib/librte_ether/rte_ethdev.c +0 -0
  			dev->data->dev_conf.rxmode.mq_mode =

ETH_MQ_RX_VMDQ_ONLY;

lib/librte_ether/rte_ethdev.c rte_eth_dev_check_mq_mode(uint8_t port_id, · line 544

Quoted 4 lines
lib/librte_ether/rte_ethdev.c +0 -2
-			if (RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool > 1)
 
-				RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool =

1;

Quoted 12 lines
lib/librte_ether/rte_ethdev.c +2 -0
+			if (nb_rx_q_per_pool > 1)
 
+				nb_rx_q_per_pool = 1;
 
  			break;
 
  		}
 
 
 
  		switch (dev_conf->txmode.mq_mode) {

lib/librte_ether/rte_ethdev.c rte_eth_dev_check_mq_mode(uint8_t port_id, · line 563

Quoted 10 lines
lib/librte_ether/rte_ethdev.c +0 -5
 
-		case ETH_MQ_TX_VMDQ_DCB:
 
-			/* DCB VMDQ in SRIOV mode, not implement yet */
 
-			PMD_DEBUG_TRACE("ethdev port_id=%" PRIu8
 
-					" SRIOV active, "
 
-					"unsupported VMDQ mq_mode

tx %u\n",

lib/librte_ether/rte_ethdev.c rte_eth_dev_check_mq_mode(uint8_t port_id, · line 585

Quoted 7 lines
lib/librte_ether/rte_ethdev.c +1 -2
-					port_id, dev_conf-
 txmode.mq_mode);
 
-			return (-EINVAL);
 
+		case ETH_MQ_TX_VMDQ_DCB: /* DCB VMDQ in SRIOV

mode*/

lib/librte_ether/rte_ethdev.c rte_eth_dev_check_mq_mode(uint8_t port_id, · line 588

Quoted 4 lines
lib/librte_ether/rte_ethdev.c +1 -0
+			break;
 
  		default: /* ETH_MQ_TX_VMDQ_ONLY or

ETH_MQ_TX_NONE */

lib/librte_ether/rte_ethdev.c rte_eth_dev_check_mq_mode(uint8_t port_id, · line 589

Quoted 2 lines
lib/librte_ether/rte_ethdev.c +0 -0
  			/* if nothing mq mode configure, use default scheme

*/

lib/librte_ether/rte_ethdev.c rte_eth_dev_check_mq_mode(uint8_t port_id, · line 590

Quoted 2 lines
lib/librte_ether/rte_ethdev.c +0 -0
  			dev->data->dev_conf.txmode.mq_mode =

ETH_MQ_TX_VMDQ_ONLY;

lib/librte_ether/rte_ethdev.c rte_eth_dev_check_mq_mode(uint8_t port_id,

Quoted 4 lines
lib/librte_ether/rte_ethdev.c +0 -2
-			if (RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool > 1)
 
-				RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool =

1;

Quoted 8 lines
lib/librte_ether/rte_ethdev.c +2 -0
+			if (nb_tx_q_per_pool > 1)
 
+				nb_tx_q_per_pool = 1;
 
  			break;
 
  		}

lib/librte_ether/rte_ethdev.c

Quoted 10 lines
lib/librte_ether/rte_ethdev.c +1 -2
 
 
 
  		/* check valid queue number */
 
-		if ((nb_rx_q > RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool) ||
 
-		    (nb_tx_q > RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool)) {
 
+		if (nb_rx_q > nb_rx_q_per_pool || nb_tx_q >

nb_tx_q_per_pool) {

Quoted 2 lines

PMD_DEBUG_TRACE("ethdev port_id=%d SRIOV

active, "

lib/librte_ether/rte_ethdev.c

Quoted 4 lines
lib/librte_ether/rte_ethdev.c +0 -2
-				    "queue number must less equal to %d\n",
 
-					port_id,

RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool);

lib/librte_ether/rte_ethdev.c

Quoted 2 lines
lib/librte_ether/rte_ethdev.c +1 -0
+				    "rx/tx queue number must less equal

to %d/%d\n",

lib/librte_ether/rte_ethdev.c

Quoted 2 lines
lib/librte_ether/rte_ethdev.c +1 -0
+					port_id,

RTE_ETH_DEV_SRIOV(dev).nb_rx_q_per_pool,

Quoted 2 lines

+

	RTE_ETH_DEV_SRIOV(dev).nb_tx_q_per_pool);

lib/librte_ether/rte_ethdev.c

Quoted 8 lines
  			return (-EINVAL);

  		}

  	} else {
lib/librte_ether/rte_ethdev.c +0 -1
-		/* For vmdb+dcb mode check our configuration before we

go further */

lib/librte_ether/rte_ethdev.c

Quoted 2 lines
lib/librte_ether/rte_ethdev.c +1 -0
+		/* For vmdq+dcb mode check our configuration before we

go further

Quoted 3 lines

+*/

if (dev_conf->rxmode.mq_mode ==

ETH_MQ_RX_VMDQ_DCB) {

Quoted 6 lines

const struct rte_eth_vmdq_dcb_conf *conf;

lib/librte_ether/rte_ethdev.c rte_eth_dev_check_mq_mode(uint8_t port_id, · line 632

Quoted 9 lines
lib/librte_ether/rte_ethdev.c +1 -0
@@ -606,11 +624,20 @@ rte_eth_dev_check_mq_mode(uint8_t port_id,
 uint16_t nb_rx_q, uint16_t nb_tx_q,
 
  			}
 
  		}
 
 
 
+		/* For DCB we need to obtain maximum number of queues

dinamically,

lib/librte_ether/rte_ethdev.c rte_eth_dev_check_mq_mode(uint8_t port_id, · line 637

Quoted 6 lines
lib/librte_ether/rte_ethdev.c +3 -0
+		 * as this depends on max VF exported in PF */
 
+		if ((dev_conf->rxmode.mq_mode == ETH_MQ_RX_DCB) ||
 
+			(dev_conf->txmode.mq_mode ==

ETH_MQ_TX_DCB)) {

lib/librte_ether/rte_ethdev.c

Quoted 7 lines
lib/librte_ether/rte_ethdev.c +2 -0
+
 
+				FUNC_PTR_OR_ERR_RET(*dev->dev_ops-

dev_infos_get, -ENOTSUP);

lib/librte_ether/rte_ethdev.c +1 -0
+				(*dev->dev_ops->dev_infos_get)(dev,

&dev_info);

lib/librte_ether/rte_ethdev.c

Quoted 6 lines
lib/librte_ether/rte_ethdev.c +2 -0
+		}
 
+
 
  		/* For DCB mode check our configuration before we go

further */

lib/librte_ether/rte_ethdev.c

Quoted 12 lines
  		if (dev_conf->rxmode.mq_mode == ETH_MQ_RX_DCB) {

const struct rte_eth_dcb_rx_conf *conf;

lib/librte_ether/rte_ethdev.c +1 -1
-			if (nb_rx_q != ETH_DCB_NUM_QUEUES) {
 
+			if (nb_rx_q != dev_info.max_rx_queues) {
 
  				PMD_DEBUG_TRACE("ethdev port_id=%d

DCB, nb_rx_q "

Quoted 4 lines

"!= %d\n",

port_id,

ETH_DCB_NUM_QUEUES);

Quoted 5 lines
lib/librte_ether/rte_ethdev.c +0 -0
@@ -630,7 +657,7 @@ rte_eth_dev_check_mq_mode(uint8_t port_id,
 uint16_t nb_rx_q, uint16_t nb_tx_q,
 
  		if (dev_conf->txmode.mq_mode == ETH_MQ_TX_DCB) {

lib/librte_ether/rte_ethdev.c rte_eth_dev_check_mq_mode(uint8_t port_id,

Quoted 10 lines
lib/librte_ether/rte_ethdev.c +1 -1
 
  			const struct rte_eth_dcb_tx_conf *conf;
 
 
 
-			if (nb_tx_q != ETH_DCB_NUM_QUEUES) {
 
+			if (nb_tx_q != dev_info.max_tx_queues) {
 
  				PMD_DEBUG_TRACE("ethdev port_id=%d

DCB, nb_tx_q "

Quoted 4 lines

"!= %d\n",

port_id,

ETH_DCB_NUM_QUEUES);

lib/librte_ether/rte_ethdev.c rte_eth_dev_configure(uint8_t port_id, uint16_t · line 723

Quoted 9 lines
lib/librte_ether/rte_ethdev.c +0 -0
@@ -690,7 +717,10 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t
 nb_rx_q, uint16_t nb_tx_q,
 
  	}
 
  	if (nb_rx_q == 0) {
 
  		PMD_DEBUG_TRACE("ethdev port_id=%d nb_rx_q == 0\n",

port_id);

lib/librte_ether/rte_ethdev.c rte_eth_dev_configure(uint8_t port_id, uint16_t

Quoted 4 lines
lib/librte_ether/rte_ethdev.c +1 -1
-		return (-EINVAL);
 
+		/* In SRIOV there can be no free resource for PF. So permit

use

Quoted 18 lines
lib/librte_ether/rte_ethdev.c +4 -0
+only
 
+		 * for configuration. */
 
+		if (RTE_ETH_DEV_SRIOV(dev).active == 0)
 
+			return (-EINVAL);
 
  	}
 
 
 
  	if (nb_tx_q > dev_info.max_tx_queues) {
@@ -698,9 +728,13 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t
 nb_rx_q, uint16_t nb_tx_q,
 
  				port_id, nb_tx_q, dev_info.max_tx_queues);

lib/librte_ether/rte_ethdev.c rte_eth_dev_configure(uint8_t port_id, uint16_t

Quoted 10 lines
lib/librte_ether/rte_ethdev.c +1 -0
 
  		return (-EINVAL);
 
  	}
 
+
 
  	if (nb_tx_q == 0) {
 
  		PMD_DEBUG_TRACE("ethdev port_id=%d nb_tx_q == 0\n",

port_id);

lib/librte_ether/rte_ethdev.c

Quoted 4 lines
lib/librte_ether/rte_ethdev.c +1 -1
-		return (-EINVAL);
 
+		/* In SRIOV there can be no free resource for PF. So permit

use

Quoted 30 lines
lib/librte_ether/rte_ethdev.c +5 -1
+only
 
+		 * for configuration. */
 
+		if (RTE_ETH_DEV_SRIOV(dev).active == 0)
 
+			return (-EINVAL);
 
  	}
 
 
 
  	/* Copy the dev_conf parameter into the dev structure */
@@ -750,7 +784,7 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t
 nb_rx_q, uint16_t nb_tx_q,
 
  							ETHER_MAX_LEN;
 
  	}
 
 
 
-	/* multipe queue mode checking */
 
+	/* multiple queue mode checking */
 
  	diag = rte_eth_dev_check_mq_mode(port_id, nb_rx_q, nb_tx_q,

dev_conf);

Quoted 3 lines
  	if (diag != 0) {

PMD_DEBUG_TRACE("port%d

rte_eth_dev_check_mq_mode = %d\n",

Quoted 11 lines
lib/librte_ether/rte_ethdev.h +0 -0

index ce0528f..04fda83 100644

--- a/lib/librte_ether/rte_ethdev.h

+++ b/lib/librte_ether/rte_ethdev.h

lib/librte_ether/rte_ethdev.h enum rte_eth_rx_mq_mode {

Quoted 8 lines
lib/librte_ether/rte_ethdev.h +0 -1
@@ -299,7 +299,7 @@ enum rte_eth_rx_mq_mode {
 
  enum rte_eth_tx_mq_mode {
 
  	ETH_MQ_TX_NONE    = 0,  /**< It is in neither DCB nor VT mode. */
 
  	ETH_MQ_TX_DCB,          /**< For TX side,only DCB is on. */
 
-	ETH_MQ_TX_VMDQ_DCB,	/**< For TX side,both DCB and VT is

on. */

lib/librte_ether/rte_ethdev.h

Quoted 2 lines
lib/librte_ether/rte_ethdev.h +1 -0
+	ETH_MQ_TX_VMDQ_DCB,     /**< For TX side,both DCB and VT is on.

*/

Quoted 15 lines

ETH_MQ_TX_VMDQ_ONLY, /**< Only VT on, no DCB */

  };
lib/librte_ether/rte_ethdev.h +0 -0
@@ -1569,7 +1569,8 @@ struct rte_eth_dev {
 
 
 
  struct rte_eth_dev_sriov {
 
  	uint8_t active;               /**< SRIOV is active with 16, 32 or 64 pools */
 

lib/librte_ether/rte_ethdev.h struct rte_eth_dev {

Quoted 10 lines
lib/librte_ether/rte_ethdev.h +2 -1
-	uint8_t nb_q_per_pool;        /**< rx queue number per pool */
 
+	uint8_t nb_rx_q_per_pool;        /**< rx queue number per pool */
 
+	uint8_t nb_tx_q_per_pool;        /**< tx queue number per pool */
 
 
  	uint16_t def_vmdq_idx;        /**< Default pool num used for PF */
 
  	uint16_t def_pool_q_idx;      /**< Default pool queue start reg index

*/

Quoted 19 lines
  };
lib/librte_pmd_e1000/igb_pf.c +0 -0

index bc3816a..9d2f858 100644

--- a/lib/librte_pmd_e1000/igb_pf.c

+++ b/lib/librte_pmd_e1000/igb_pf.c

lib/librte_pmd_e1000/igb_pf.c +0 -0
@@ -115,7 +115,8 @@ void igb_pf_host_init(struct rte_eth_dev *eth_dev)
 
  		rte_panic("Cannot allocate memory for private VF data\n");
 
 
 
  	RTE_ETH_DEV_SRIOV(eth_dev).active = ETH_8_POOLS;

lib/librte_pmd_e1000/igb_pf.c void igb_pf_host_init(struct rte_eth_dev *eth_dev)

Quoted 10 lines
lib/librte_pmd_e1000/igb_pf.c +2 -1
 
-	RTE_ETH_DEV_SRIOV(eth_dev).nb_q_per_pool = nb_queue;
 
+	RTE_ETH_DEV_SRIOV(eth_dev).nb_rx_q_per_pool = nb_queue;
 
+	RTE_ETH_DEV_SRIOV(eth_dev).nb_tx_q_per_pool = nb_queue;
 
  	RTE_ETH_DEV_SRIOV(eth_dev).def_vmdq_idx = vf_num;
 
  	RTE_ETH_DEV_SRIOV(eth_dev).def_pool_q_idx =

(uint16_t)(vf_num *

Quoted 15 lines

nb_queue);

lib/librte_pmd_ixgbe/ixgbe_ethdev.c +0 -0

index 3fc3738..347f03c 100644

--- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c

+++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c

lib/librte_pmd_ixgbe/ixgbe_ethdev.c +0 -0
@@ -3555,14 +3555,14 @@ static int ixgbe_set_vf_rate_limit(struct
 rte_eth_dev *dev, uint16_t vf,

lib/librte_pmd_ixgbe/ixgbe_ethdev.c static int ixgbe_set_vf_rate_limit(struct · line 3565

Quoted 10 lines
lib/librte_pmd_ixgbe/ixgbe_ethdev.c +0 -1
 
  	struct ixgbe_hw *hw =
 IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
  	struct ixgbe_vf_info *vfinfo =
 
  		*(IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data-
 dev_private));
 
-	uint8_t  nb_q_per_pool =

RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool;

lib/librte_pmd_ixgbe/ixgbe_ethdev.c static int ixgbe_set_vf_rate_limit(struct · line 3565

Quoted 2 lines
lib/librte_pmd_ixgbe/ixgbe_ethdev.c +1 -0
+	uint8_t  nb_tx_q_per_pool =

RTE_ETH_DEV_SRIOV(dev).nb_tx_q_per_pool;

lib/librte_pmd_ixgbe/ixgbe_ethdev.c static int ixgbe_set_vf_rate_limit(struct · line 3568

Quoted 4 lines
lib/librte_pmd_ixgbe/ixgbe_ethdev.c +0 -0
  	uint32_t queue_stride =
 
  		IXGBE_MAX_RX_QUEUE_NUM /

RTE_ETH_DEV_SRIOV(dev).active;

Quoted 46 lines
  	uint32_t queue_idx = vf * queue_stride, idx = 0, vf_idx;
lib/librte_pmd_ixgbe/ixgbe_ethdev.c +3 -3
-	uint32_t queue_end = queue_idx + nb_q_per_pool - 1;
 
+	uint32_t tx_queue_end = queue_idx + nb_tx_q_per_pool - 1;
 
  	uint16_t total_rate = 0;
 
 
 
-	if (queue_end >= hw->mac.max_tx_queues)
 
+	if (tx_queue_end >= hw->mac.max_tx_queues)
 
  		return -EINVAL;
 
 
 
  	if (vfinfo != NULL) {
@@ -3577,7 +3577,7 @@ static int ixgbe_set_vf_rate_limit(struct
 rte_eth_dev *dev, uint16_t vf,
 
  		return -EINVAL;
 
 
 
  	/* Store tx_rate for this vf. */
 
-	for (idx = 0; idx < nb_q_per_pool; idx++) {
 
+	for (idx = 0; idx < nb_tx_q_per_pool; idx++) {
 
  		if (((uint64_t)0x1 << idx) & q_msk) {
 
  			if (vfinfo[vf].tx_rate[idx] != tx_rate)
 
  				vfinfo[vf].tx_rate[idx] = tx_rate;
@@ -3595,7 +3595,7 @@ static int ixgbe_set_vf_rate_limit(struct
 rte_eth_dev *dev, uint16_t vf,
 
  	}
 
 

lib/librte_pmd_ixgbe/ixgbe_ethdev.c static int ixgbe_set_vf_rate_limit(struct

Quoted 10 lines
lib/librte_pmd_ixgbe/ixgbe_ethdev.c +1 -1
 
  	/* Set RTTBCNRC of each queue/pool for vf X  */
 
-	for (; queue_idx <= queue_end; queue_idx++) {
 
+	for (; queue_idx <= tx_queue_end; queue_idx++) {
 
  		if (0x1 & q_msk)
 
  			ixgbe_set_queue_rate_limit(dev, queue_idx,

tx_rate);

Quoted 45 lines
  		q_msk = q_msk >> 1;
lib/librte_pmd_ixgbe/ixgbe_ethdev.h +0 -0

index ca99170..ebf16e9 100644

--- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.h

+++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.h

lib/librte_pmd_ixgbe/ixgbe_ethdev.h +1 -0
@@ -159,6 +159,7 @@ struct ixgbe_vf_info {
 
  	uint16_t tx_rate[IXGBE_MAX_QUEUE_NUM_PER_VF];
 
  	uint16_t vlan_count;
 
  	uint8_t spoofchk_enabled;
 
+	unsigned int vf_api;
 
  };
 
 
 
  /*
lib/librte_pmd_ixgbe/ixgbe_pf.c +0 -0

index 51da1fd..4d30bcf 100644

--- a/lib/librte_pmd_ixgbe/ixgbe_pf.c

+++ b/lib/librte_pmd_ixgbe/ixgbe_pf.c

lib/librte_pmd_ixgbe/ixgbe_pf.c +0 -0
@@ -127,7 +127,8 @@ void ixgbe_pf_host_init(struct rte_eth_dev
 *eth_dev)
 
  		RTE_ETH_DEV_SRIOV(eth_dev).active = ETH_16_POOLS;
 
  	}
 
 

lib/librte_pmd_ixgbe/ixgbe_pf.c void ixgbe_pf_host_init(struct rte_eth_dev

Quoted 10 lines
lib/librte_pmd_ixgbe/ixgbe_pf.c +2 -1
 
-	RTE_ETH_DEV_SRIOV(eth_dev).nb_q_per_pool = nb_queue;
 
+	RTE_ETH_DEV_SRIOV(eth_dev).nb_rx_q_per_pool = nb_queue;
 
+	RTE_ETH_DEV_SRIOV(eth_dev).nb_tx_q_per_pool = nb_queue;
 
  	RTE_ETH_DEV_SRIOV(eth_dev).def_vmdq_idx = vf_num;
 
  	RTE_ETH_DEV_SRIOV(eth_dev).def_pool_q_idx =

(uint16_t)(vf_num *

Quoted 115 lines

nb_queue);

lib/librte_pmd_ixgbe/ixgbe_pf.c +0 -0
@@ -189,7 +190,7 @@ int ixgbe_pf_host_configure(struct rte_eth_dev
 *eth_dev)
 
  	hw->mac.ops.set_vmdq(hw, 0,
 RTE_ETH_DEV_SRIOV(eth_dev).def_vmdq_idx);
 
 
 

/*

lib/librte_pmd_ixgbe/ixgbe_pf.c +15 -10
-	 * SW msut set GCR_EXT.VT_Mode the same as GPIE.VT_Mode
 
+	 * SW must set GCR_EXT.VT_Mode the same as GPIE.VT_Mode
 
  	 */
 
  	gcr_ext = IXGBE_READ_REG(hw, IXGBE_GCR_EXT);
 
  	gcr_ext &= ~IXGBE_GCR_EXT_VT_MODE_MASK;
@@ -214,19 +215,19 @@ int ixgbe_pf_host_configure(struct rte_eth_dev
 *eth_dev)
 
  	}
 
 
 
  	IXGBE_WRITE_REG(hw, IXGBE_GCR_EXT, gcr_ext);
 
-        IXGBE_WRITE_REG(hw, IXGBE_GPIE, gpie);
 
+	IXGBE_WRITE_REG(hw, IXGBE_GPIE, gpie);
 
 
 
-        /*
 
+	/*
 
  	 * enable vlan filtering and allow all vlan tags through
 
  	 */
 
-        vlanctrl = IXGBE_READ_REG(hw, IXGBE_VLNCTRL);
 
-        vlanctrl |= IXGBE_VLNCTRL_VFE ; /* enable vlan filters */
 
-        IXGBE_WRITE_REG(hw, IXGBE_VLNCTRL, vlanctrl);
 
+	vlanctrl = IXGBE_READ_REG(hw, IXGBE_VLNCTRL);
 
+	vlanctrl |= IXGBE_VLNCTRL_VFE ; /* enable vlan filters */
 
+	IXGBE_WRITE_REG(hw, IXGBE_VLNCTRL, vlanctrl);
 
 
 
-        /* VFTA - enable all vlan filters */
 
-        for (i = 0; i < IXGBE_MAX_VFTA; i++) {
 
-                IXGBE_WRITE_REG(hw, IXGBE_VFTA(i), 0xFFFFFFFF);
 
-        }
 
+	/* VFTA - enable all vlan filters */
 
+	for (i = 0; i < IXGBE_MAX_VFTA; i++) {
 
+		IXGBE_WRITE_REG(hw, IXGBE_VFTA(i), 0xFFFFFFFF);
 
+	}
 
 
 
  	/* Enable MAC Anti-Spoofing */
 
  	hw->mac.ops.set_mac_anti_spoofing(hw, FALSE, vf_num);
@@ -369,6 +370,73 @@ ixgbe_vf_reset(struct rte_eth_dev *dev, uint16_t
 vf, uint32_t *msgbuf)
 
  }
 
 
 
  static int
 
+ixgbe_negotiate_vf_api(struct rte_eth_dev *dev, uint32_t vf, uint32_t
+*msgbuf)
 
+{
 
+	struct ixgbe_vf_info *vfinfo =
 
+		*(IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data-

dev_private));

lib/librte_pmd_ixgbe/ixgbe_pf.c +7 -0
+	int api = msgbuf[1];
 
+
 
+	switch (api) {
 
+	case ixgbe_mbox_api_10:
 
+	case ixgbe_mbox_api_11:
 
+		vfinfo[vf].vf_api = api;
 
+		return 0;

lib/librte_pmd_ixgbe/ixgbe_pf.c

Quoted 10 lines
lib/librte_pmd_ixgbe/ixgbe_pf.c +5 -0
 
+	default:
 
+		break;
 
+	}
 
+
 
+	RTE_LOG(DEBUG, PMD, "VF %d requested invalid api version %u\n",

vf,

Quoted 42 lines
lib/librte_pmd_ixgbe/ixgbe_pf.c +10 -0
+api);
 
+	return -1;
 
+}
 
+
 
+static int
 
+ixgbe_get_vf_queues(struct rte_eth_dev *dev, uint32_t vf, uint32_t
+*msgbuf)
 
+{
 
+	struct ixgbe_vf_info *vfinfo =
 
+		*(IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data-

dev_private));

lib/librte_pmd_ixgbe/ixgbe_pf.c +2 -0
+	struct ixgbe_dcb_config *dcb_cfg =
 
+			IXGBE_DEV_PRIVATE_TO_DCB_CFG(dev->data-

dev_private);

lib/librte_pmd_ixgbe/ixgbe_pf.c +9 -0
+
 
+	uint8_t num_tcs = dcb_cfg->num_tcs.pg_tcs;
 
+
 
+	/* verify the PF is supporting the correct APIs */
 
+	switch (vfinfo[vf].vf_api) {
 
+	case ixgbe_mbox_api_10:
 
+	case ixgbe_mbox_api_11:
 
+		break;
 
+	default:

lib/librte_pmd_ixgbe/ixgbe_pf.c

Quoted 10 lines
lib/librte_pmd_ixgbe/ixgbe_pf.c +5 -0
 
+		return -1;
 
+	}
 
+
 
+	if (RTE_ETH_DEV_SRIOV(dev).active) {
 
+		if (dev->data->dev_conf.rxmode.mq_mode ==

ETH_MQ_RX_VMDQ_DCB)

lib/librte_pmd_ixgbe/ixgbe_pf.c

Quoted 10 lines
lib/librte_pmd_ixgbe/ixgbe_pf.c +5 -0
+			msgbuf[IXGBE_VF_TX_QUEUES] = num_tcs;
 
+		else
 
+			msgbuf[IXGBE_VF_TX_QUEUES] = 1;
 
+
 
+		if (dev->data->dev_conf.txmode.mq_mode ==

ETH_MQ_TX_VMDQ_DCB)

Quoted 67 lines
lib/librte_pmd_ixgbe/ixgbe_pf.c +22 -0
+			msgbuf[IXGBE_VF_RX_QUEUES] = num_tcs;
 
+		else
 
+			msgbuf[IXGBE_VF_RX_QUEUES] = 1;
 
+	}	else {
 
+		/* only allow 1 Tx queue for bandwidth limiting */
 
+		msgbuf[IXGBE_VF_TX_QUEUES] = 1;
 
+		msgbuf[IXGBE_VF_RX_QUEUES] = 1;
 
+	}
 
+
 
+	/* notify VF of need for VLAN tag stripping, and correct queue */
 
+	if (num_tcs)
 
+		msgbuf[IXGBE_VF_TRANS_VLAN] = num_tcs;
 
+	else
 
+		msgbuf[IXGBE_VF_TRANS_VLAN] = 0;
 
+
 
+	/* notify VF of default queue */
 
+	msgbuf[IXGBE_VF_DEF_QUEUE] = 0;
 
+
 
+	return 0;
 
+}
 
+
 
+static int
 
  ixgbe_vf_set_mac_addr(struct rte_eth_dev *dev, uint32_t vf, uint32_t

*msgbuf)

  {

struct ixgbe_hw *hw =
IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);

lib/librte_pmd_ixgbe/ixgbe_pf.c +3 -0
@@ -512,6 +580,12 @@ ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev,
 uint16_t vf)
 
  	case IXGBE_VF_SET_VLAN:
 
  		retval = ixgbe_vf_set_vlan(dev, vf, msgbuf);
 
  		break;
 
+	case IXGBE_VF_API_NEGOTIATE:
 
+		retval = ixgbe_negotiate_vf_api(dev, vf, msgbuf);
 
+		break;

lib/librte_pmd_ixgbe/ixgbe_pf.c ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev,

Quoted 10 lines
lib/librte_pmd_ixgbe/ixgbe_pf.c +3 -0
 
+	case IXGBE_VF_GET_QUEUES:
 
+		retval = ixgbe_get_vf_queues(dev, vf, msgbuf);
 
+		break;
 
  	default:
 
  		PMD_DRV_LOG(DEBUG, "Unhandled Msg %8.8x",

(unsigned)msgbuf[0]);

Quoted 60 lines
  		retval = IXGBE_ERR_MBX;
lib/librte_pmd_ixgbe/ixgbe_pf.c +1 -1
@@ -526,7 +600,7 @@ ixgbe_rcv_msg_from_vf(struct rte_eth_dev *dev,
 uint16_t vf)
 
 
 
  	msgbuf[0] |= IXGBE_VT_MSGTYPE_CTS;
 
 
 
-	ixgbe_write_mbx(hw, msgbuf, 1, vf);
 
+	ixgbe_write_mbx(hw, msgbuf, mbx_size, vf);
 
 
 
  	return retval;
 
  }
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +0 -0

index e10d6a2..49b44fe 100644

--- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c

+++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c

lib/librte_pmd_ixgbe/ixgbe_rxtx.c +3 -4
@@ -3166,10 +3166,9 @@ void ixgbe_configure_dcb(struct rte_eth_dev
 *dev)
 
 
 
  	/* check support mq_mode for DCB */
 
  	if ((dev_conf->rxmode.mq_mode != ETH_MQ_RX_VMDQ_DCB) &&
 
-	    (dev_conf->rxmode.mq_mode != ETH_MQ_RX_DCB))
 
-		return;
 
-
 
-	if (dev->data->nb_rx_queues != ETH_DCB_NUM_QUEUES)
 
+	    (dev_conf->rxmode.mq_mode != ETH_MQ_RX_DCB) &&
 
+	    (dev_conf->txmode.mq_mode != ETH_MQ_TX_VMDQ_DCB) &&
 
+	    (dev_conf->txmode.mq_mode != ETH_MQ_TX_DCB))
 
  		return;
 
 
 
  	/** Configure DCB hardware **/

A message that is not in the archive (sent off-list or not yet received): F52918179C57134FAEC9EA62FA2F96251196BFB9-E2R4CRU6q/[email protected]

#9 lore raw
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

- split nb_q_per_pool to nb_rx_q_per_pool and nb_tx_q_per_pool

Rationale:

rx and tx number of queue might be different if RX and TX are

configured in different mode. This allow to inform VF about

Quoted 9 lines
Quoted 5 lines
Quoted 1 line

proper number of queues.

Nice move! Ouyang, this is a nice answer to my recent remarks about your PATCH4 in "Enable VF RSS for Niantic" series.

After I respond your last comments, I see this, :-), I am sure we both agree it is the right way to resolve it in vmdq dcb case.

I am now dividing this patch with your suggestions and I am little confused.

In this (DCB in SRIOV) case the primary cause for spliting nb_q_per_pool into nb_rx_q_per_pool and nb_tx_q_per_pool was because of this code:

lib/librte_ether/rte_ethdev.c +9 -8
index af9e261..be3afe4 100644
@@ -537,8 +537,8 @@
 		default: /* ETH_MQ_RX_VMDQ_ONLY or ETH_MQ_RX_NONE */
 			/* if nothing mq mode configure, use default scheme */
 			dev->data->dev_conf.rxmode.mq_mode = ETH_MQ_RX_VMDQ_ONLY;
-			if (RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool > 1)
-				RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool = 1;
+			if (RTE_ETH_DEV_SRIOV(dev).nb_rx_q_per_pool > 1)
+				RTE_ETH_DEV_SRIOV(dev).nb_rx_q_per_pool = 1;
 			break;
 		}
 
@@ -553,17 +553,18 @@
 		default: /* ETH_MQ_TX_VMDQ_ONLY or ETH_MQ_TX_NONE */
 			/* if nothing mq mode configure, use default scheme */
 			dev->data->dev_conf.txmode.mq_mode = ETH_MQ_TX_VMDQ_ONLY;
-			if (RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool > 1)
-				RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool = 1;
+			if (RTE_ETH_DEV_SRIOV(dev).nb_tx_q_per_pool > 1)
+				RTE_ETH_DEV_SRIOV(dev).nb_tx_q_per_pool = 1;
 			break;
 		}
 
 		/* check valid queue number */
-		if ((nb_rx_q > RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool) ||
-		    (nb_tx_q > RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool)) {
+		if ((nb_rx_q > RTE_ETH_DEV_SRIOV(dev).nb_rx_q_per_pool) ||
+		    (nb_tx_q > RTE_ETH_DEV_SRIOV(dev).nb_tx_q_per_pool)) {
 			PMD_DEBUG_TRACE("ethdev port_id=%d SRIOV active, "
-				    "queue number must less equal to %d\n",
-					port_id, RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool);
+				    "rx/tx queue number must less equal to %d/%d\n",
+					port_id, RTE_ETH_DEV_SRIOV(dev).nb_rx_q_per_pool,
+					RTE_ETH_DEV_SRIOV(dev).nb_tx_q_per_pool);
 			return (-EINVAL);
 		}
 	} else {

--

This introduced an issue when RX and TX was configure in different way. The problem was that the RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool as common for RX and TX and it is changed. So I did the above. But when testpmd was adjusted for DCB in SRIOV there was another issue. Testpmd is pre-configuring ports by default and since nb_rx_q_per_pool and nb_tx_q_per_pool was already reset to 1 there was no way to use it for DCB in SRIOV. So I did another modification:

Quoted 47 lines
(quoted diff) +12 -14
+		uint16_t nb_rx_q_per_pool = RTE_ETH_DEV_SRIOV(dev).nb_rx_q_per_pool;
+		uint16_t nb_tx_q_per_pool = RTE_ETH_DEV_SRIOV(dev).nb_tx_q_per_pool;
+
  		switch (dev_conf->rxmode.mq_mode) {
-		case ETH_MQ_RX_VMDQ_RSS:
  		case ETH_MQ_RX_VMDQ_DCB:
+			break;
+		case ETH_MQ_RX_VMDQ_RSS:
  		case ETH_MQ_RX_VMDQ_DCB_RSS:
-			/* DCB/RSS VMDQ in SRIOV mode, not implement yet */
+			/* RSS, DCB+RSS VMDQ in SRIOV mode, not implement yet */
  			PMD_DEBUG_TRACE("ethdev port_id=%" PRIu8
  					" SRIOV active, "
  					"unsupported VMDQ mq_mode rx %u\n",
@@ -537,37 +560,32 @@ rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
  		default: /* ETH_MQ_RX_VMDQ_ONLY or ETH_MQ_RX_NONE */
  			/* if nothing mq mode configure, use default scheme */
  			dev->data->dev_conf.rxmode.mq_mode = ETH_MQ_RX_VMDQ_ONLY;
-			if (RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool > 1)
-				RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool = 1;
+			if (nb_rx_q_per_pool > 1)
+				nb_rx_q_per_pool = 1;
  			break;
  		}
 
  		switch (dev_conf->txmode.mq_mode) {
-		case ETH_MQ_TX_VMDQ_DCB:
-			/* DCB VMDQ in SRIOV mode, not implement yet */
-			PMD_DEBUG_TRACE("ethdev port_id=%" PRIu8
-					" SRIOV active, "
-					"unsupported VMDQ mq_mode tx %u\n",
-					port_id, dev_conf->txmode.mq_mode);
-			return (-EINVAL);
+		case ETH_MQ_TX_VMDQ_DCB: /* DCB VMDQ in SRIOV mode*/
+			break;
  		default: /* ETH_MQ_TX_VMDQ_ONLY or ETH_MQ_TX_NONE */
  			/* if nothing mq mode configure, use default scheme */
  			dev->data->dev_conf.txmode.mq_mode = ETH_MQ_TX_VMDQ_ONLY;
-			if (RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool > 1)
-				RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool = 1;
+			if (nb_tx_q_per_pool > 1)
+				nb_tx_q_per_pool = 1;
  			break;
  		}
 
  		/* check valid queue number */
-		if ((nb_rx_q > RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool) ||

Review rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, · line 586

Quoted 10 lines
(quoted diff) +4 -3
-		    (nb_tx_q > RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool)) {
+		if (nb_rx_q > nb_rx_q_per_pool || nb_tx_q > nb_tx_q_per_pool) {
  			PMD_DEBUG_TRACE("ethdev port_id=%d SRIOV active, "
-				    "queue number must less equal to %d\n",
-					port_id, RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool);
+				    "rx/tx queue number must less equal to %d/%d\n",
+					port_id, RTE_ETH_DEV_SRIOV(dev).nb_rx_q_per_pool,
+					RTE_ETH_DEV_SRIOV(dev).nb_tx_q_per_pool);
  			return (-EINVAL);
  		}

For this point I think that splitting RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool might be not needed. From my point of view (DCB), since nb_q_per_pool is untouched, I think I can stay with:

Review rte_eth_dev_check_mq_mode(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, · line 589

Quoted 3 lines
(quoted diff) +3 -0
+		uint16_t nb_rx_q_per_pool = RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool;
+		uint16_t nb_tx_q_per_pool = RTE_ETH_DEV_SRIOV(dev).nb_q_per_pool;
+

What do you think? I noticed that you was discussing some issue about nb_q_per_pool in face of RSS functionality. Can you spoke about my doubts in face of that RSS?

Pawel