i40evf: fix RSS with less Rx queues than Tx queues

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.

Test report: http://dpdk.org/ml/archives/dev/2015-July/021838.html

Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
Tested-by: Qian Xu <qian.q.xu@intel.com>
This commit is contained in:
Jingjing Wu 2015-07-13 09:21:41 +08:00 committed by Thomas Monjalon
parent 492a028c65
commit 999a867c93
3 changed files with 13 additions and 9 deletions

View File

@ -303,14 +303,6 @@ static struct eth_driver rte_i40e_pmd = {
.dev_private_size = sizeof(struct i40e_adapter),
};
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)

View File

@ -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 || \

View File

@ -1524,6 +1524,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;
}
@ -1905,6 +1907,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);
@ -1912,9 +1915,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)