DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jingjing Wu <jingjing.wu@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH] i40e: fix the VF rss issue when nb_rx_queue is less than nb_tx_queue
Date: Mon, 13 Jul 2015 09:21:41 +0800	[thread overview]
Message-ID: <1436750501-6585-1-git-send-email-jingjing.wu@intel.com> (raw)

From: "jingjing.wu" <jingjing.wu@intel.com>

I40e VF driver uses the num_queue_pairs in vf structure to construct
queue index look up table. When the nb_rx_queue is less than nb_tx_queue,
num_queue_pairs is equal to nb_tx_queue. It will make the table use
invalid queue index, then application cannot poll packets on these queues.

This patch also moves the inline function i40e_align_floor from i40e_ethdev.c
to i40e_ethdev.h.

Signed-off-by: jingjing.wu <jingjing.wu@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c    | 8 --------
 drivers/net/i40e/i40e_ethdev.h    | 8 ++++++++
 drivers/net/i40e/i40e_ethdev_vf.c | 6 +++++-
 3 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 5fb6b4c..051fd02 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -282,14 +282,6 @@ static struct eth_driver rte_i40e_pmd = {
 };
 
 static inline int
-i40e_align_floor(int n)
-{
-	if (n == 0)
-		return 0;
-	return (1 << (sizeof(n) * CHAR_BIT - 1 - __builtin_clz(n)));
-}
-
-static inline int
 rte_i40e_dev_atomic_read_link_status(struct rte_eth_dev *dev,
 				     struct rte_eth_link *link)
 {
diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h
index 883ee06..6185657 100644
--- a/drivers/net/i40e/i40e_ethdev.h
+++ b/drivers/net/i40e/i40e_ethdev.h
@@ -563,6 +563,14 @@ i40e_init_adminq_parameter(struct i40e_hw *hw)
 	hw->aq.asq_buf_size = I40E_AQ_BUF_SZ;
 }
 
+static inline int
+i40e_align_floor(int n)
+{
+	if (n == 0)
+		return 0;
+	return 1 << (sizeof(n) * CHAR_BIT - 1 - __builtin_clz(n));
+}
+
 #define I40E_VALID_FLOW(flow_type) \
 	((flow_type) == RTE_ETH_FLOW_FRAG_IPV4 || \
 	(flow_type) == RTE_ETH_FLOW_NONFRAG_IPV4_TCP || \
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index b150b62..c4ce2cf 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1481,6 +1481,8 @@ i40evf_rx_init(struct rte_eth_dev *dev)
 
 	i40evf_config_rss(vf);
 	for (i = 0; i < dev->data->nb_rx_queues; i++) {
+		if (!rxq[i] || !rxq[i]->q_set)
+			continue;
 		if (i40evf_rxq_init(dev, rxq[i]) < 0)
 			return -EFAULT;
 	}
@@ -1857,6 +1859,7 @@ i40evf_config_rss(struct i40e_vf *vf)
 	struct i40e_hw *hw = I40E_VF_TO_HW(vf);
 	struct rte_eth_rss_conf rss_conf;
 	uint32_t i, j, lut = 0, nb_q = (I40E_VFQF_HLUT_MAX_INDEX + 1) * 4;
+	uint16_t num;
 
 	if (vf->dev_data->dev_conf.rxmode.mq_mode != ETH_MQ_RX_RSS) {
 		i40evf_disable_rss(vf);
@@ -1864,9 +1867,10 @@ i40evf_config_rss(struct i40e_vf *vf)
 		return 0;
 	}
 
+	num = i40e_align_floor(vf->dev_data->nb_rx_queues);
 	/* Fill out the look up table */
 	for (i = 0, j = 0; i < nb_q; i++, j++) {
-		if (j >= vf->num_queue_pairs)
+		if (j >= num)
 			j = 0;
 		lut = (lut << 8) | j;
 		if ((i & 3) == 3)
-- 
2.4.0

             reply	other threads:[~2015-07-13  1:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-13  1:21 Jingjing Wu [this message]
2015-07-14 18:08 ` Zhang, Helin
2015-07-19 23:04   ` Thomas Monjalon
2015-07-17  9:07 ` Xu, Qian Q

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1436750501-6585-1-git-send-email-jingjing.wu@intel.com \
    --to=jingjing.wu@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).