DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/ice: support based RSS configure
@ 2020-06-10  6:33 Junyu Jiang
  2020-06-22  5:33 ` [dpdk-dev] [PATCH v2] " Junyu Jiang
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Junyu Jiang @ 2020-06-10  6:33 UTC (permalink / raw)
  To: dev; +Cc: Qiming Yang, simei.su, Junyu Jiang

Enable/disable RSS for corresponding flow
base on the user's requirement.

Signed-off-by: Junyu Jiang <junyux.jiang@intel.com>
---
 drivers/net/ice/ice_ethdev.c | 181 ++++++++++++++++++++++-------------
 1 file changed, 115 insertions(+), 66 deletions(-)

diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index d5110c439..ee88cb49e 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -2436,6 +2436,103 @@ ice_dev_uninit(struct rte_eth_dev *dev)
 	return 0;
 }
 
+static void
+ice_rss_hash_set(struct ice_pf *pf, uint64_t rss_hf)
+{
+	struct ice_hw *hw = ICE_PF_TO_HW(pf);
+	struct ice_vsi *vsi = pf->main_vsi;
+	int ret;
+
+	/**
+	 * configure RSS for IPv4 with input set IPv4 src/dst
+	 * configure RSS for IPv6 with input set IPv6 src/dst
+	 */
+	if (rss_hf & ETH_RSS_IP) {
+		ret = ice_add_rss_cfg(hw, vsi->idx, ICE_FLOW_HASH_IPV4,
+				      ICE_FLOW_SEG_HDR_IPV4, 0);
+		if (ret)
+			PMD_DRV_LOG(ERR, "%s IPV4 rss flow fail %d",
+				    __func__, ret);
+
+		ret = ice_add_rss_cfg(hw, vsi->idx, ICE_FLOW_HASH_IPV6,
+				      ICE_FLOW_SEG_HDR_IPV6, 0);
+		if (ret)
+			PMD_DRV_LOG(ERR, "%s IPV6 rss flow fail %d",
+				    __func__, ret);
+	}
+	/**
+	 *configure RSS for udp6 with input set IPv6 src/dst, UDP src/dst
+	 *configure RSS for udp4 with input set IP src/dst, UDP src/dst
+	 */
+	if (rss_hf & ETH_RSS_UDP) {
+		ret = ice_add_rss_cfg(hw, vsi->idx, ICE_HASH_UDP_IPV6,
+				      ICE_FLOW_SEG_HDR_UDP |
+				      ICE_FLOW_SEG_HDR_IPV6, 0);
+		if (ret)
+			PMD_DRV_LOG(ERR, "%s UDP_IPV6 rss flow fail %d",
+				    __func__, ret);
+
+		ret = ice_add_rss_cfg(hw, vsi->idx, ICE_HASH_UDP_IPV4,
+				      ICE_FLOW_SEG_HDR_UDP |
+				      ICE_FLOW_SEG_HDR_IPV4, 0);
+		if (ret)
+			PMD_DRV_LOG(ERR, "%s UDP_IPV4 rss flow fail %d",
+				    __func__, ret);
+	}
+	/**
+	 * configure RSS for tcp6 with input set IPv6 src/dst, TCP src/dst
+	 * configure RSS for tcp4 with input set IP src/dst, TCP src/dst
+	 */
+	if (rss_hf & ETH_RSS_TCP) {
+		ret = ice_add_rss_cfg(hw, vsi->idx, ICE_HASH_TCP_IPV6,
+				      ICE_FLOW_SEG_HDR_TCP |
+				      ICE_FLOW_SEG_HDR_IPV6, 0);
+		if (ret)
+			PMD_DRV_LOG(ERR, "%s TCP_IPV6 rss flow fail %d",
+				    __func__, ret);
+		ret = ice_add_rss_cfg(hw, vsi->idx, ICE_HASH_TCP_IPV4,
+				      ICE_FLOW_SEG_HDR_TCP |
+				      ICE_FLOW_SEG_HDR_IPV4, 0);
+		if (ret)
+			PMD_DRV_LOG(ERR, "%s TCP_IPV4 rss flow fail %d",
+				    __func__, ret);
+	}
+	/**
+	 * configure RSS for sctp6 with input set IPv6 src/dst
+	 * configure RSS for sctp4 with input set IP src/dst
+	 */
+	if (rss_hf & ETH_RSS_SCTP) {
+		ret = ice_add_rss_cfg(hw, vsi->idx, ICE_FLOW_HASH_IPV6,
+				      ICE_FLOW_SEG_HDR_SCTP |
+				      ICE_FLOW_SEG_HDR_IPV6, 0);
+		if (ret)
+			PMD_DRV_LOG(ERR, "%s SCTP_IPV6 rss flow fail %d",
+				    __func__, ret);
+		ret = ice_add_rss_cfg(hw, vsi->idx, ICE_FLOW_HASH_IPV4,
+				      ICE_FLOW_SEG_HDR_SCTP |
+				      ICE_FLOW_SEG_HDR_IPV4, 0);
+		if (ret)
+			PMD_DRV_LOG(ERR, "%s SCTP_IPV4 rss flow fail %d",
+				    __func__, ret);
+	}
+
+	/* configure RSS for gtpu with input set TEID */
+	ret = ice_add_rss_cfg(hw, vsi->idx, ICE_FLOW_HASH_GTP_U_IPV4_TEID,
+			      ICE_FLOW_SEG_HDR_GTPU_IP, 0);
+	if (ret)
+		PMD_DRV_LOG(ERR, "%s GTPU_TEID rss flow fail %d",
+			    __func__, ret);
+	/**
+	 * configure RSS for pppoe/pppod with input set
+	 * Source MAC and Session ID
+	 */
+	ret = ice_add_rss_cfg(hw, vsi->idx, ICE_FLOW_HASH_PPPOE_SESS_ID_ETH,
+			      ICE_FLOW_SEG_HDR_PPPOE, 0);
+	if (ret)
+		PMD_DRV_LOG(ERR, "%s PPPoE/PPPoD_SessionID rss flow fail %d",
+			    __func__, ret);
+}
+
 static int ice_init_rss(struct ice_pf *pf)
 {
 	struct ice_hw *hw = ICE_PF_TO_HW(pf);
@@ -2496,72 +2593,12 @@ static int ice_init_rss(struct ice_pf *pf)
 		(1 << VSIQF_HASH_CTL_HASH_SCHEME_S);
 	ICE_WRITE_REG(hw, VSIQF_HASH_CTL(vsi->vsi_id), reg);
 
-	/* configure RSS for IPv4 with input set IPv4 src/dst */
-	ret = ice_add_rss_cfg(hw, vsi->idx, ICE_FLOW_HASH_IPV4,
-			      ICE_FLOW_SEG_HDR_IPV4, 0);
-	if (ret)
-		PMD_DRV_LOG(ERR, "%s IPV4 rss flow fail %d", __func__, ret);
-
-	/* configure RSS for IPv6 with input set IPv6 src/dst */
-	ret = ice_add_rss_cfg(hw, vsi->idx, ICE_FLOW_HASH_IPV6,
-			      ICE_FLOW_SEG_HDR_IPV6, 0);
-	if (ret)
-		PMD_DRV_LOG(ERR, "%s IPV6 rss flow fail %d", __func__, ret);
-
-	/* configure RSS for tcp6 with input set IPv6 src/dst, TCP src/dst */
-	ret = ice_add_rss_cfg(hw, vsi->idx, ICE_HASH_TCP_IPV6,
-			      ICE_FLOW_SEG_HDR_TCP | ICE_FLOW_SEG_HDR_IPV6, 0);
-	if (ret)
-		PMD_DRV_LOG(ERR, "%s TCP_IPV6 rss flow fail %d", __func__, ret);
-
-	/* configure RSS for udp6 with input set IPv6 src/dst, UDP src/dst */
-	ret = ice_add_rss_cfg(hw, vsi->idx, ICE_HASH_UDP_IPV6,
-			      ICE_FLOW_SEG_HDR_UDP | ICE_FLOW_SEG_HDR_IPV6, 0);
-	if (ret)
-		PMD_DRV_LOG(ERR, "%s UDP_IPV6 rss flow fail %d", __func__, ret);
-
-	/* configure RSS for sctp6 with input set IPv6 src/dst */
-	ret = ice_add_rss_cfg(hw, vsi->idx, ICE_FLOW_HASH_IPV6,
-			      ICE_FLOW_SEG_HDR_SCTP | ICE_FLOW_SEG_HDR_IPV6, 0);
-	if (ret)
-		PMD_DRV_LOG(ERR, "%s SCTP_IPV6 rss flow fail %d",
-				__func__, ret);
-
-	/* configure RSS for tcp4 with input set IP src/dst, TCP src/dst */
-	ret = ice_add_rss_cfg(hw, vsi->idx, ICE_HASH_TCP_IPV4,
-			      ICE_FLOW_SEG_HDR_TCP | ICE_FLOW_SEG_HDR_IPV4, 0);
-	if (ret)
-		PMD_DRV_LOG(ERR, "%s TCP_IPV4 rss flow fail %d", __func__, ret);
-
-	/* configure RSS for udp4 with input set IP src/dst, UDP src/dst */
-	ret = ice_add_rss_cfg(hw, vsi->idx, ICE_HASH_UDP_IPV4,
-			      ICE_FLOW_SEG_HDR_UDP | ICE_FLOW_SEG_HDR_IPV4, 0);
-	if (ret)
-		PMD_DRV_LOG(ERR, "%s UDP_IPV4 rss flow fail %d", __func__, ret);
-
-	/* configure RSS for sctp4 with input set IP src/dst */
-	ret = ice_add_rss_cfg(hw, vsi->idx, ICE_FLOW_HASH_IPV4,
-			      ICE_FLOW_SEG_HDR_SCTP | ICE_FLOW_SEG_HDR_IPV4, 0);
-	if (ret)
-		PMD_DRV_LOG(ERR, "%s SCTP_IPV4 rss flow fail %d",
-				__func__, ret);
-
-	/* configure RSS for gtpu with input set TEID */
-	ret = ice_add_rss_cfg(hw, vsi->idx, ICE_FLOW_HASH_GTP_U_IPV4_TEID,
-				ICE_FLOW_SEG_HDR_GTPU_IP, 0);
-	if (ret)
-		PMD_DRV_LOG(ERR, "%s GTPU_TEID rss flow fail %d",
-				__func__, ret);
+	/* Disable RSS */
+	if (rss_conf->rss_hf == 0)
+		return 0;
 
-	/**
-	 * configure RSS for pppoe/pppod with input set
-	 * Source MAC and Session ID
-	 */
-	ret = ice_add_rss_cfg(hw, vsi->idx, ICE_FLOW_HASH_PPPOE_SESS_ID_ETH,
-				ICE_FLOW_SEG_HDR_PPPOE, 0);
-	if (ret)
-		PMD_DRV_LOG(ERR, "%s PPPoE/PPPoD_SessionID rss flow fail %d",
-				__func__, ret);
+	/* RSS hash configuration */
+	ice_rss_hash_set(pf, rss_conf->rss_hf);
 
 	return 0;
 }
@@ -3675,6 +3712,7 @@ ice_rss_hash_update(struct rte_eth_dev *dev,
 {
 	enum ice_status status = ICE_SUCCESS;
 	struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+	struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	struct ice_vsi *vsi = pf->main_vsi;
 
 	/* set hash key */
@@ -3682,7 +3720,18 @@ ice_rss_hash_update(struct rte_eth_dev *dev,
 	if (status)
 		return status;
 
-	/* TODO: hash enable config, ice_add_rss_cfg */
+	if (rss_conf->rss_hf == 0)
+		return -EINVAL;
+
+	status = ice_rem_vsi_rss_cfg(hw, vsi->idx);
+	if (status != ICE_SUCCESS) {
+		PMD_DRV_LOG(ERR, "Failed to remove rss cfg!");
+		return status;
+	}
+
+	/* RSS hash configuration */
+	ice_rss_hash_set(pf, rss_conf->rss_hf);
+
 	return 0;
 }
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-07-03  8:47 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-10  6:33 [dpdk-dev] [PATCH] net/ice: support based RSS configure Junyu Jiang
2020-06-22  5:33 ` [dpdk-dev] [PATCH v2] " Junyu Jiang
2020-06-22 14:36   ` Zhang, Qi Z
2020-06-23  2:47     ` Jiang, JunyuX
2020-07-03  8:16   ` Zhao1, Wei
2020-07-03  8:46     ` Zhao1, Wei
2020-06-23  8:33 ` [dpdk-dev] [PATCH v3] net/ice: initialize and update RSS based on user request Junyu Jiang
2020-06-23  9:40   ` Zhang, Qi Z
2020-06-24  2:09 ` [dpdk-dev] [PATCH v4] " Junyu Jiang
2020-06-24  7:30   ` Zhang, Qi Z

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).