[RFC,v2,3/3] net/idpf: adjust RSS LUT to exclude hairpin queue

Message ID 20220926084248.1421987-4-junfeng.guo@intel.com (mailing list archive)
State New
Delegated to: Thomas Monjalon
Headers
Series enable hairpin queue |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Guo, Junfeng Sept. 26, 2022, 8:42 a.m. UTC
  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.wang@intel.com>
Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>
---
 drivers/net/idpf/idpf_ethdev.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
  

Patch

diff --git a/drivers/net/idpf/idpf_ethdev.c b/drivers/net/idpf/idpf_ethdev.c
index 41e6391d8b..a30b8df778 100644
--- a/drivers/net/idpf/idpf_ethdev.c
+++ b/drivers/net/idpf/idpf_ethdev.c
@@ -624,9 +624,28 @@  idpf_config_rx_queues_irqs(struct rte_eth_dev *dev)
 	return -1;
 }
 
+static int
+idpf_config_rss_lut(struct idpf_vport *vport, uint16_t nb_q)
+{
+	uint16_t lut_size = vport->rss_lut_size;
+	uint16_t i;
+	int ret;
+
+	for (i = 0; i < lut_size; i++)
+		vport->rss_lut[i] = i % nb_q;
+
+	ret = idpf_set_rss_lut(vport);
+	if (ret)
+		PMD_INIT_LOG(ERR, "Failed to configure RSS lut");
+
+	return ret;
+}
+
 static int
 idpf_start_queues(struct rte_eth_dev *dev)
 {
+	struct idpf_vport *vport = (struct idpf_vport *)dev->data->dev_private;
+	uint16_t nb_rxq = dev->data->nb_rx_queues;
 	struct idpf_rx_queue *rxq;
 	struct idpf_tx_queue *txq;
 	int err = 0;
@@ -704,6 +723,11 @@  idpf_start_queues(struct rte_eth_dev *dev)
 		}
 	}
 
+	/* RSS only to the data queues */
+	rxq = dev->data->rx_queues[nb_rxq - 1];
+	if (nb_rxq > 1 && rxq && rxq->hairpin_q)
+		err = idpf_config_rss_lut(vport, nb_rxq - 1);
+
 	return err;
 }