RSS should direct traffic only to the normal data Rx queues,
so when hairpin queue configured, RSS LUT should be adjusted
to exclude the hairpin queue.

Signed-off-by: Xiao Wang <xiao.w.w...@intel.com>
Signed-off-by: Junfeng Guo <junfeng....@intel.com>
Signed-off-by: Mingxia Liu <mingxia....@intel.com>
---
 drivers/net/cpfl/cpfl_ethdev.c | 38 ++++++++++++++++++++--------------
 1 file changed, 23 insertions(+), 15 deletions(-)

diff --git a/drivers/net/cpfl/cpfl_ethdev.c b/drivers/net/cpfl/cpfl_ethdev.c
index f08b7beb13..014735b2b0 100644
--- a/drivers/net/cpfl/cpfl_ethdev.c
+++ b/drivers/net/cpfl/cpfl_ethdev.c
@@ -446,7 +446,8 @@ cpfl_init_rss(struct idpf_vport *vport)
 {
        struct rte_eth_rss_conf *rss_conf;
        struct rte_eth_dev_data *dev_data;
-       uint16_t i, nb_q;
+       struct cpfl_rx_queue *cpfl_rxq;
+       uint16_t i, nb_q, max_nb_data_q;
        int ret = 0;
 
        dev_data = vport->dev_data;
@@ -465,8 +466,16 @@ cpfl_init_rss(struct idpf_vport *vport)
                           vport->rss_key_size);
        }
 
+       /* RSS only to the data queues */
+       max_nb_data_q = nb_q;
+       if (nb_q > 1) {
+               cpfl_rxq = dev_data->rx_queues[nb_q - 1];
+               if (cpfl_rxq && cpfl_rxq->hairpin_info.hairpin_q)
+                       max_nb_data_q = nb_q - 1;
+       }
+
        for (i = 0; i < vport->rss_lut_size; i++)
-               vport->rss_lut[i] = i % nb_q;
+               vport->rss_lut[i] = i % max_nb_data_q;
 
        vport->rss_hf = IDPF_DEFAULT_RSS_HASH_EXPANDED;
 
@@ -673,8 +682,6 @@ cpfl_dev_configure(struct rte_eth_dev *dev)
            (struct cpfl_vport *)dev->data->dev_private;
        struct idpf_vport *vport = &(cpfl_vport->base);
        struct rte_eth_conf *conf = &dev->data->dev_conf;
-       struct idpf_adapter *adapter = vport->adapter;
-       int ret;
 
        if (conf->link_speeds & RTE_ETH_LINK_SPEED_FIXED) {
                PMD_INIT_LOG(ERR, "Setting link speed is not supported");
@@ -713,17 +720,6 @@ cpfl_dev_configure(struct rte_eth_dev *dev)
                return -ENOTSUP;
        }
 
-       if (adapter->caps.rss_caps != 0 && dev->data->nb_rx_queues != 0) {
-               ret = cpfl_init_rss(vport);
-               if (ret != 0) {
-                       PMD_INIT_LOG(ERR, "Failed to init rss");
-                       return ret;
-               }
-       } else {
-               PMD_INIT_LOG(ERR, "RSS is not supported.");
-               return -1;
-       }
-
        vport->max_pkt_len =
                (dev->data->mtu == 0) ? CPFL_DEFAULT_MTU : dev->data->mtu +
                CPFL_ETH_OVERHEAD;
@@ -748,11 +744,23 @@ cpfl_start_queues(struct rte_eth_dev *dev)
        struct cpfl_vport *cpfl_vport =
            (struct cpfl_vport *)dev->data->dev_private;
        struct idpf_vport *vport = &(cpfl_vport->base);
+       struct idpf_adapter *adapter = vport->adapter;
        struct cpfl_rx_queue *cpfl_rxq;
        struct cpfl_tx_queue *cpfl_txq;
        int err = 0;
        int i;
 
+       if (adapter->caps.rss_caps != 0 && dev->data->nb_rx_queues != 0) {
+               err = cpfl_init_rss(vport);
+               if (err != 0) {
+                       PMD_INIT_LOG(ERR, "Failed to init rss");
+                       return err;
+               }
+       } else {
+               PMD_INIT_LOG(ERR, "RSS is not supported.");
+               return -1;
+       }
+
        for (i = 0; i < dev->data->nb_tx_queues; i++) {
                cpfl_txq = dev->data->tx_queues[i];
                if (cpfl_txq == NULL || cpfl_txq->base.tx_deferred_start)
-- 
2.25.1

Reply via email to