DPDK patches and discussions
 help / color / mirror / Atom feed
From: Junfeng Guo <junfeng.guo@intel.com>
To: qi.z.zhang@intel.com, jingjing.wu@intel.com, beilei.xing@intel.com
Cc: dev@dpdk.org, ferruh.yigit@intel.com, ting.xu@intel.com,
	junfeng.guo@intel.com
Subject: [dpdk-dev] [PATCH v10 1/4] net/ice/base: add method to disable FDIR SWAP option
Date: Wed,  3 Nov 2021 12:40:00 +0800	[thread overview]
Message-ID: <20211103044003.4058866-2-junfeng.guo@intel.com> (raw)
In-Reply-To: <20211103044003.4058866-1-junfeng.guo@intel.com>

In this patch, we introduced a new parameter to enable/disable the
FDIR SWAP option by setting the swap and inset register set with
certain values.

Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/ice/base/ice_flex_pipe.c | 44 ++++++++++++++++++++++++++--
 drivers/net/ice/base/ice_flex_pipe.h |  3 +-
 drivers/net/ice/base/ice_flow.c      |  2 +-
 3 files changed, 45 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ice/base/ice_flex_pipe.c b/drivers/net/ice/base/ice_flex_pipe.c
index f35d59f4f5..06a233990f 100644
--- a/drivers/net/ice/base/ice_flex_pipe.c
+++ b/drivers/net/ice/base/ice_flex_pipe.c
@@ -4952,6 +4952,43 @@ ice_add_prof_attrib(struct ice_prof_map *prof, u8 ptg, u16 ptype,
 	return ICE_SUCCESS;
 }
 
+/**
+ * ice_disable_fd_swap - set register appropriately to disable FD swap
+ * @hw: pointer to the HW struct
+ * @prof_id: profile ID
+ */
+void ice_disable_fd_swap(struct ice_hw *hw, u16 prof_id)
+{
+	u8 swap_val = ICE_SWAP_VALID;
+	u8 i;
+	/* Since the SWAP Flag in the Programming Desc doesn't work,
+	 * here add method to disable the SWAP Option via setting
+	 * certain SWAP and INSET register set.
+	 */
+	for (i = 0; i < hw->blk[ICE_BLK_FD].es.fvw / 4; i++) {
+		u32 raw_swap = 0;
+		u32 raw_in = 0;
+		u8 j;
+
+		for (j = 0; j < 4; j++) {
+			raw_swap |= (swap_val++) << (j * BITS_PER_BYTE);
+			raw_in |= ICE_INSET_DFLT << (j * BITS_PER_BYTE);
+		}
+
+		/* write the FDIR swap register set */
+		wr32(hw, GLQF_FDSWAP(prof_id, i), raw_swap);
+
+		ice_debug(hw, ICE_DBG_INIT, "swap wr(%d, %d): %x = %08x\n",
+				prof_id, i, GLQF_FDSWAP(prof_id, i), raw_swap);
+
+		/* write the FDIR inset register set */
+		wr32(hw, GLQF_FDINSET(prof_id, i), raw_in);
+
+		ice_debug(hw, ICE_DBG_INIT, "inset wr(%d, %d): %x = %08x\n",
+				prof_id, i, GLQF_FDINSET(prof_id, i), raw_in);
+	}
+}
+
 /**
  * ice_add_prof - add profile
  * @hw: pointer to the HW struct
@@ -4962,6 +4999,7 @@ ice_add_prof_attrib(struct ice_prof_map *prof, u8 ptg, u16 ptype,
  * @attr_cnt: number of elements in attrib array
  * @es: extraction sequence (length of array is determined by the block)
  * @masks: mask for extraction sequence
+ * @fd_swap: enable/disable FDIR paired src/dst fields swap option
  *
  * This function registers a profile, which matches a set of PTYPES with a
  * particular extraction sequence. While the hardware profile is allocated
@@ -4971,7 +5009,7 @@ ice_add_prof_attrib(struct ice_prof_map *prof, u8 ptg, u16 ptype,
 enum ice_status
 ice_add_prof(struct ice_hw *hw, enum ice_block blk, u64 id, u8 ptypes[],
 	     const struct ice_ptype_attributes *attr, u16 attr_cnt,
-	     struct ice_fv_word *es, u16 *masks)
+	     struct ice_fv_word *es, u16 *masks, bool fd_swap)
 {
 	u32 bytes = DIVIDE_AND_ROUND_UP(ICE_FLOW_PTYPE_MAX, BITS_PER_BYTE);
 	ice_declare_bitmap(ptgs_used, ICE_XLT1_CNT);
@@ -4991,7 +5029,7 @@ ice_add_prof(struct ice_hw *hw, enum ice_block blk, u64 id, u8 ptypes[],
 		status = ice_alloc_prof_id(hw, blk, &prof_id);
 		if (status)
 			goto err_ice_add_prof;
-		if (blk == ICE_BLK_FD) {
+		if (blk == ICE_BLK_FD && fd_swap) {
 			/* For Flow Director block, the extraction sequence may
 			 * need to be altered in the case where there are paired
 			 * fields that have no match. This is necessary because
@@ -5002,6 +5040,8 @@ ice_add_prof(struct ice_hw *hw, enum ice_block blk, u64 id, u8 ptypes[],
 			status = ice_update_fd_swap(hw, prof_id, es);
 			if (status)
 				goto err_ice_add_prof;
+		} else if (blk == ICE_BLK_FD) {
+			ice_disable_fd_swap(hw, prof_id);
 		}
 		status = ice_update_prof_masking(hw, blk, prof_id, masks);
 		if (status)
diff --git a/drivers/net/ice/base/ice_flex_pipe.h b/drivers/net/ice/base/ice_flex_pipe.h
index 9733c4b214..dd332312dd 100644
--- a/drivers/net/ice/base/ice_flex_pipe.h
+++ b/drivers/net/ice/base/ice_flex_pipe.h
@@ -61,10 +61,11 @@ bool ice_hw_ptype_ena(struct ice_hw *hw, u16 ptype);
 /* XLT2/VSI group functions */
 enum ice_status
 ice_vsig_find_vsi(struct ice_hw *hw, enum ice_block blk, u16 vsi, u16 *vsig);
+void ice_disable_fd_swap(struct ice_hw *hw, u16 prof_id);
 enum ice_status
 ice_add_prof(struct ice_hw *hw, enum ice_block blk, u64 id, u8 ptypes[],
 	     const struct ice_ptype_attributes *attr, u16 attr_cnt,
-	     struct ice_fv_word *es, u16 *masks);
+	     struct ice_fv_word *es, u16 *masks, bool fd_swap);
 void ice_init_all_prof_masks(struct ice_hw *hw);
 void ice_shutdown_all_prof_masks(struct ice_hw *hw);
 struct ice_prof_map *
diff --git a/drivers/net/ice/base/ice_flow.c b/drivers/net/ice/base/ice_flow.c
index 96d54b494d..77b6b130c1 100644
--- a/drivers/net/ice/base/ice_flow.c
+++ b/drivers/net/ice/base/ice_flow.c
@@ -2244,7 +2244,7 @@ ice_flow_add_prof_sync(struct ice_hw *hw, enum ice_block blk,
 	/* Add a HW profile for this flow profile */
 	status = ice_add_prof(hw, blk, prof_id, (u8 *)params->ptypes,
 			      params->attr, params->attr_cnt, params->es,
-			      params->mask);
+			      params->mask, true);
 	if (status) {
 		ice_debug(hw, ICE_DBG_FLOW, "Error adding a HW flow profile\n");
 		goto out;
-- 
2.25.1


  reply	other threads:[~2021-11-03  4:41 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-24 16:22 [dpdk-dev] [PATCH 0/3] enable protocol agnostic flow offloading in FDIR Junfeng Guo
2021-09-24 16:22 ` [dpdk-dev] [PATCH 1/3] app/testpmd: update Max RAW pattern size to 512 Junfeng Guo
2021-09-28 10:18   ` [dpdk-dev] [PATCH v2 0/3] enable protocol agnostic flow offloading in FDIR Junfeng Guo
2021-09-28 10:18     ` [dpdk-dev] [PATCH v2 1/3] app/testpmd: update Max RAW pattern size to 512 Junfeng Guo
2021-09-28 10:18     ` [dpdk-dev] [PATCH v2 2/3] net/ice: enable protocol agnostic flow offloading in FDIR Junfeng Guo
2021-09-28 10:18     ` [dpdk-dev] [PATCH v2 3/3] doc: enable protocol agnostic flow " Junfeng Guo
2021-10-14 15:37       ` [dpdk-dev] [PATCH v3 0/5] enable protocol agnostic flow offloading " Junfeng Guo
2021-10-14 15:37         ` [dpdk-dev] [PATCH v3 1/5] net/ice/base: add method to disable FDIR SWAP option Junfeng Guo
2021-10-14 15:37         ` [dpdk-dev] [PATCH v3 2/5] net/ice/base: add function to set HW profile for raw flow Junfeng Guo
2021-10-14 15:37         ` [dpdk-dev] [PATCH v3 3/5] app/testpmd: update Max RAW pattern size to 512 Junfeng Guo
2021-10-14 15:37         ` [dpdk-dev] [PATCH v3 4/5] net/ice: enable protocol agnostic flow offloading in FDIR Junfeng Guo
2021-10-14 15:37         ` [dpdk-dev] [PATCH v3 5/5] doc: enable protocol agnostic flow " Junfeng Guo
2021-10-26 12:00           ` [dpdk-dev] [PATCH v4 0/4] enable protocol agnostic flow offloading " Junfeng Guo
2021-10-26 12:00             ` [dpdk-dev] [PATCH v4 1/4] net/ice/base: add method to disable FDIR SWAP option Junfeng Guo
2021-10-26 12:00             ` [dpdk-dev] [PATCH v4 2/4] net/ice/base: add function to set HW profile for raw flow Junfeng Guo
2021-10-27  0:58               ` Zhang, Qi Z
2021-10-27  1:58                 ` Guo, Junfeng
2021-10-27  2:17                   ` Zhang, Qi Z
2021-10-27  2:51                     ` Guo, Junfeng
2021-10-26 12:00             ` [dpdk-dev] [PATCH v4 3/4] app/testpmd: update Max RAW pattern size to 512 Junfeng Guo
2021-10-27  2:52               ` [dpdk-dev] [PATCH v5 0/4] enable protocol agnostic flow offloading in FDIR Junfeng Guo
2021-10-27  2:52                 ` [dpdk-dev] [PATCH v5 1/4] net/ice/base: add method to disable FDIR SWAP option Junfeng Guo
2021-10-27  2:52                 ` [dpdk-dev] [PATCH v5 2/4] net/ice/base: add function to set HW profile for raw flow Junfeng Guo
2021-10-27  2:52                 ` [dpdk-dev] [PATCH v5 3/4] app/testpmd: update Max RAW pattern size to 512 Junfeng Guo
2021-10-27  2:52                 ` [dpdk-dev] [PATCH v5 4/4] net/ice: enable protocol agnostic flow offloading in FDIR Junfeng Guo
2021-10-28  8:34                   ` [dpdk-dev] [PATCH v6 0/4] " Junfeng Guo
2021-10-28  8:34                     ` [dpdk-dev] [PATCH v6 1/4] net/ice/base: add method to disable FDIR SWAP option Junfeng Guo
2021-10-28  8:34                     ` [dpdk-dev] [PATCH v6 2/4] net/ice/base: add function to set HW profile for raw flow Junfeng Guo
2021-10-28  8:34                     ` [dpdk-dev] [PATCH v6 3/4] app/testpmd: update Max RAW pattern size to 512 Junfeng Guo
2021-10-28  8:34                     ` [dpdk-dev] [PATCH v6 4/4] net/ice: enable protocol agnostic flow offloading in FDIR Junfeng Guo
2021-10-28  9:13                       ` [dpdk-dev] [PATCH v7 0/4] " Junfeng Guo
2021-10-28  9:13                         ` [dpdk-dev] [PATCH v7 1/4] net/ice/base: add method to disable FDIR SWAP option Junfeng Guo
2021-10-28 11:26                           ` Zhang, Qi Z
2021-10-28 15:09                           ` Ferruh Yigit
2021-10-28  9:13                         ` [dpdk-dev] [PATCH v7 2/4] net/ice/base: add function to set HW profile for raw flow Junfeng Guo
2021-10-28 11:28                           ` Zhang, Qi Z
2021-10-28 15:13                           ` Ferruh Yigit
2021-10-28  9:13                         ` [dpdk-dev] [PATCH v7 3/4] app/testpmd: update Max RAW pattern size to 512 Junfeng Guo
2021-10-28 11:46                           ` Zhang, Qi Z
2021-10-28  9:13                         ` [dpdk-dev] [PATCH v7 4/4] net/ice: enable protocol agnostic flow offloading in FDIR Junfeng Guo
2021-10-28 11:10                           ` Zhang, Qi Z
2021-11-01  8:36                           ` [dpdk-dev] [PATCH v8 0/4] " Junfeng Guo
2021-11-01  8:36                             ` [dpdk-dev] [PATCH v8 1/4] net/ice/base: add method to disable FDIR SWAP option Junfeng Guo
2021-11-01  8:36                             ` [dpdk-dev] [PATCH v8 2/4] net/ice/base: add function to set HW profile for raw flow Junfeng Guo
2021-11-01  8:36                             ` [dpdk-dev] [PATCH v8 3/4] app/testpmd: update Max RAW pattern size to 512 Junfeng Guo
2021-11-01  8:36                             ` [dpdk-dev] [PATCH v8 4/4] net/ice: enable protocol agnostic flow offloading in FDIR Junfeng Guo
2021-11-01 23:56                               ` Zhang, Qi Z
2021-11-02  2:44                                 ` Guo, Junfeng
2021-11-02  5:39                               ` [dpdk-dev] [PATCH v9 0/4] " Junfeng Guo
2021-11-02  5:39                                 ` [dpdk-dev] [PATCH v9 1/4] net/ice/base: add method to disable FDIR SWAP option Junfeng Guo
2021-11-02  5:39                                 ` [dpdk-dev] [PATCH v9 2/4] net/ice/base: add function to set HW profile for raw flow Junfeng Guo
2021-11-02  5:39                                 ` [dpdk-dev] [PATCH v9 3/4] app/testpmd: update Max RAW pattern size to 512 Junfeng Guo
2021-11-02  5:39                                 ` [dpdk-dev] [PATCH v9 4/4] net/ice: enable protocol agnostic flow offloading in FDIR Junfeng Guo
2021-11-02 16:22                                   ` Ferruh Yigit
2021-11-03  2:26                                     ` Guo, Junfeng
2021-11-03  4:39                                   ` [dpdk-dev] [PATCH v10 0/4] " Junfeng Guo
2021-11-03  4:40                                     ` Junfeng Guo [this message]
2021-11-03  4:40                                     ` [dpdk-dev] [PATCH v10 2/4] net/ice/base: add function to set HW profile for raw flow Junfeng Guo
2021-11-03  4:40                                     ` [dpdk-dev] [PATCH v10 3/4] app/testpmd: update Max RAW pattern size to 512 Junfeng Guo
2021-11-03  4:40                                     ` [dpdk-dev] [PATCH v10 4/4] net/ice: enable protocol agnostic flow offloading in FDIR Junfeng Guo
2021-11-03 12:34                                     ` [dpdk-dev] [PATCH v10 0/4] " Zhang, Qi Z
2021-11-02  5:58                                 ` [dpdk-dev] [PATCH v9 " Zhang, Qi Z
2021-11-02 16:29                                 ` Ferruh Yigit
2021-11-03  3:16                                   ` Guo, Junfeng
2021-10-26 12:00             ` [dpdk-dev] [PATCH v4 4/4] net/ice: " Junfeng Guo
2021-09-24 16:22 ` [dpdk-dev] [PATCH 2/3] " Junfeng Guo
2021-09-24  8:45   ` Van Haaren, Harry
2021-09-24 16:22 ` [dpdk-dev] [PATCH 3/3] doc: enable protocol agnostic flow " Junfeng Guo

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=20211103044003.4058866-2-junfeng.guo@intel.com \
    --to=junfeng.guo@intel.com \
    --cc=beilei.xing@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=jingjing.wu@intel.com \
    --cc=qi.z.zhang@intel.com \
    --cc=ting.xu@intel.com \
    /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).