[v4,2/4] net/ice/base: add function to set HW profile for raw flow

Message ID 20211026120056.1442501-3-junfeng.guo@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Qi Zhang
Headers
Series enable protocol agnostic flow offloading in FDIR |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Junfeng Guo Oct. 26, 2021, noon UTC
  Based on the parser library, we can directly set HW profile and
associate the main/ctrl vsi.

Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>
---
 drivers/net/ice/base/ice_flex_pipe.c | 55 ++++++++++++++++++
 drivers/net/ice/base/ice_flex_pipe.h |  4 ++
 drivers/net/ice/base/ice_flow.c      | 85 ++++++++++++++++++++++++++++
 drivers/net/ice/base/ice_flow.h      |  4 ++
 4 files changed, 148 insertions(+)
  

Comments

Qi Zhang Oct. 27, 2021, 12:58 a.m. UTC | #1
> -----Original Message-----
> From: Guo, Junfeng <junfeng.guo@intel.com>
> Sent: Tuesday, October 26, 2021 8:01 PM
> To: Zhang, Qi Z <qi.z.zhang@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>;
> Xing, Beilei <beilei.xing@intel.com>
> Cc: dev@dpdk.org; Yigit, Ferruh <ferruh.yigit@intel.com>; Wang, Haiyue
> <haiyue.wang@intel.com>; Yan, Zhirun <zhirun.yan@intel.com>; Guo, Junfeng
> <junfeng.guo@intel.com>
> Subject: [PATCH v4 2/4] net/ice/base: add function to set HW profile for raw
> flow
> 
> Based on the parser library, we can directly set HW profile and associate the
> main/ctrl vsi.
> 
> Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>
> ---
>  drivers/net/ice/base/ice_flex_pipe.c | 55 ++++++++++++++++++
> drivers/net/ice/base/ice_flex_pipe.h |  4 ++
>  drivers/net/ice/base/ice_flow.c      | 85 ++++++++++++++++++++++++++++
>  drivers/net/ice/base/ice_flow.h      |  4 ++
>  4 files changed, 148 insertions(+)
> 
> diff --git a/drivers/net/ice/base/ice_flex_pipe.c
> b/drivers/net/ice/base/ice_flex_pipe.c
> index 06a233990f..030655f3f0 100644
> --- a/drivers/net/ice/base/ice_flex_pipe.c
> +++ b/drivers/net/ice/base/ice_flex_pipe.c
> @@ -6365,3 +6365,58 @@ ice_rem_prof_id_flow(struct ice_hw *hw, enum
> ice_block blk, u16 vsi, u64 hdl)
> 
>  	return status;
>  }
> +
> +/**
> + * ice_flow_assoc_hw_prof - add profile id flow for main/ctrl VSI flow
> +entry
> + * @hw: pointer to the HW struct
> + * @blk: HW block
> + * @dest_vsi_handle: dest VSI handle
> + * @fdir_vsi_handle: fdir programming VSI handle
> + * @id: profile id (handle)
> + * @fv_found: found fv in fdir fv list
> + *
> + * Calling this function will update the hardware tables to enable the
> + * profile indicated by the ID parameter for the VSIs specified in the
> +VSI
> + * array. Once successfully called, the flow will be enabled.
> + */
> +enum ice_status
> +ice_flow_assoc_hw_prof(struct ice_hw *hw, enum ice_block blk,
> +		       u16 dest_vsi_handle, u16 fdir_vsi_handle, int id,
> +		       bool fv_found)

Do we really need this fv_found parameter?

If fv_found is true, seems nothing has been done in this function, why not just check the flag outside the function?
  
Junfeng Guo Oct. 27, 2021, 1:58 a.m. UTC | #2
> -----Original Message-----
> From: Zhang, Qi Z <qi.z.zhang@intel.com>
> Sent: Wednesday, October 27, 2021 08:58
> To: Guo, Junfeng <junfeng.guo@intel.com>; Wu, Jingjing
> <jingjing.wu@intel.com>; Xing, Beilei <beilei.xing@intel.com>
> Cc: dev@dpdk.org; Yigit, Ferruh <ferruh.yigit@intel.com>; Wang, Haiyue
> <haiyue.wang@intel.com>; Yan, Zhirun <Zhirun.Yan@intel.com>
> Subject: RE: [PATCH v4 2/4] net/ice/base: add function to set HW profile
> for raw flow
> 
> 
> 
> > -----Original Message-----
> > From: Guo, Junfeng <junfeng.guo@intel.com>
> > Sent: Tuesday, October 26, 2021 8:01 PM
> > To: Zhang, Qi Z <qi.z.zhang@intel.com>; Wu, Jingjing
> <jingjing.wu@intel.com>;
> > Xing, Beilei <beilei.xing@intel.com>
> > Cc: dev@dpdk.org; Yigit, Ferruh <ferruh.yigit@intel.com>; Wang,
> Haiyue
> > <haiyue.wang@intel.com>; Yan, Zhirun <zhirun.yan@intel.com>; Guo,
> Junfeng
> > <junfeng.guo@intel.com>
> > Subject: [PATCH v4 2/4] net/ice/base: add function to set HW profile for
> raw
> > flow
> >
> > Based on the parser library, we can directly set HW profile and associate
> the
> > main/ctrl vsi.
> >
> > Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>
> > ---
> >  drivers/net/ice/base/ice_flex_pipe.c | 55 ++++++++++++++++++
> > drivers/net/ice/base/ice_flex_pipe.h |  4 ++
> >  drivers/net/ice/base/ice_flow.c      | 85
> ++++++++++++++++++++++++++++
> >  drivers/net/ice/base/ice_flow.h      |  4 ++
> >  4 files changed, 148 insertions(+)
> >
> > diff --git a/drivers/net/ice/base/ice_flex_pipe.c
> > b/drivers/net/ice/base/ice_flex_pipe.c
> > index 06a233990f..030655f3f0 100644
> > --- a/drivers/net/ice/base/ice_flex_pipe.c
> > +++ b/drivers/net/ice/base/ice_flex_pipe.c
> > @@ -6365,3 +6365,58 @@ ice_rem_prof_id_flow(struct ice_hw *hw,
> enum
> > ice_block blk, u16 vsi, u64 hdl)
> >
> >  return status;
> >  }
> > +
> > +/**
> > + * ice_flow_assoc_hw_prof - add profile id flow for main/ctrl VSI flow
> > +entry
> > + * @hw: pointer to the HW struct
> > + * @blk: HW block
> > + * @dest_vsi_handle: dest VSI handle
> > + * @fdir_vsi_handle: fdir programming VSI handle
> > + * @id: profile id (handle)
> > + * @fv_found: found fv in fdir fv list
> > + *
> > + * Calling this function will update the hardware tables to enable the
> > + * profile indicated by the ID parameter for the VSIs specified in the
> > +VSI
> > + * array. Once successfully called, the flow will be enabled.
> > + */
> > +enum ice_status
> > +ice_flow_assoc_hw_prof(struct ice_hw *hw, enum ice_block blk,
> > +       u16 dest_vsi_handle, u16 fdir_vsi_handle, int id,
> > +       bool fv_found)
> 
> Do we really need this fv_found parameter?

The value of fv_found is set based on the maintained profile info list in the PMD.
So we need this parameter to add profile id flow for FDIR in the shared code.

> 
> If fv_found is true, seems nothing has been done in this function, why not
> just check the flag outside the function?

Yes, ice_add_prof_id_flow should be processed after ice_add_prof.
It's ok if we just move the ice_add_prof_id_flow processing into func ice_flow_set_hw_prof,
and delete the func ice_flow_assoc_hw_prof to reduce the code size.

For RSS, the ice_add_prof_id_flow for adding dest_vsi_handle should always be processed.
So this function has other RSS logic to add soon.

> 
> 
>
  
Qi Zhang Oct. 27, 2021, 2:17 a.m. UTC | #3
> -----Original Message-----
> From: Guo, Junfeng <junfeng.guo@intel.com>
> Sent: Wednesday, October 27, 2021 9:58 AM
> To: Zhang, Qi Z <qi.z.zhang@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>;
> Xing, Beilei <beilei.xing@intel.com>
> Cc: dev@dpdk.org; Yigit, Ferruh <ferruh.yigit@intel.com>; Wang, Haiyue
> <haiyue.wang@intel.com>; Yan, Zhirun <zhirun.yan@intel.com>
> Subject: RE: [PATCH v4 2/4] net/ice/base: add function to set HW profile for
> raw flow
> 
> 
> 
> > -----Original Message-----
> > From: Zhang, Qi Z <qi.z.zhang@intel.com>
> > Sent: Wednesday, October 27, 2021 08:58
> > To: Guo, Junfeng <junfeng.guo@intel.com>; Wu, Jingjing
> > <jingjing.wu@intel.com>; Xing, Beilei <beilei.xing@intel.com>
> > Cc: dev@dpdk.org; Yigit, Ferruh <ferruh.yigit@intel.com>; Wang, Haiyue
> > <haiyue.wang@intel.com>; Yan, Zhirun <Zhirun.Yan@intel.com>
> > Subject: RE: [PATCH v4 2/4] net/ice/base: add function to set HW
> > profile for raw flow
> >
> >
> >
> > > -----Original Message-----
> > > From: Guo, Junfeng <junfeng.guo@intel.com>
> > > Sent: Tuesday, October 26, 2021 8:01 PM
> > > To: Zhang, Qi Z <qi.z.zhang@intel.com>; Wu, Jingjing
> > <jingjing.wu@intel.com>;
> > > Xing, Beilei <beilei.xing@intel.com>
> > > Cc: dev@dpdk.org; Yigit, Ferruh <ferruh.yigit@intel.com>; Wang,
> > Haiyue
> > > <haiyue.wang@intel.com>; Yan, Zhirun <zhirun.yan@intel.com>; Guo,
> > Junfeng
> > > <junfeng.guo@intel.com>
> > > Subject: [PATCH v4 2/4] net/ice/base: add function to set HW profile
> > > for
> > raw
> > > flow
> > >
> > > Based on the parser library, we can directly set HW profile and
> > > associate
> > the
> > > main/ctrl vsi.
> > >
> > > Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>
> > > ---
> > >  drivers/net/ice/base/ice_flex_pipe.c | 55 ++++++++++++++++++
> > > drivers/net/ice/base/ice_flex_pipe.h |  4 ++
> > >  drivers/net/ice/base/ice_flow.c      | 85
> > ++++++++++++++++++++++++++++
> > >  drivers/net/ice/base/ice_flow.h      |  4 ++
> > >  4 files changed, 148 insertions(+)
> > >
> > > diff --git a/drivers/net/ice/base/ice_flex_pipe.c
> > > b/drivers/net/ice/base/ice_flex_pipe.c
> > > index 06a233990f..030655f3f0 100644
> > > --- a/drivers/net/ice/base/ice_flex_pipe.c
> > > +++ b/drivers/net/ice/base/ice_flex_pipe.c
> > > @@ -6365,3 +6365,58 @@ ice_rem_prof_id_flow(struct ice_hw *hw,
> > enum
> > > ice_block blk, u16 vsi, u64 hdl)
> > >
> > >  return status;
> > >  }
> > > +
> > > +/**
> > > + * ice_flow_assoc_hw_prof - add profile id flow for main/ctrl VSI
> > > +flow entry
> > > + * @hw: pointer to the HW struct
> > > + * @blk: HW block
> > > + * @dest_vsi_handle: dest VSI handle
> > > + * @fdir_vsi_handle: fdir programming VSI handle
> > > + * @id: profile id (handle)
> > > + * @fv_found: found fv in fdir fv list
> > > + *
> > > + * Calling this function will update the hardware tables to enable
> > > +the
> > > + * profile indicated by the ID parameter for the VSIs specified in
> > > +the VSI
> > > + * array. Once successfully called, the flow will be enabled.
> > > + */
> > > +enum ice_status
> > > +ice_flow_assoc_hw_prof(struct ice_hw *hw, enum ice_block blk,
> > > +       u16 dest_vsi_handle, u16 fdir_vsi_handle, int id,
> > > +       bool fv_found)
> >
> > Do we really need this fv_found parameter?
> 
> The value of fv_found is set based on the maintained profile info list in the PMD.
> So we need this parameter to add profile id flow for FDIR in the shared code.

I mean if we parse fv_found = true into ice_flow_assoc_hw_prof, nothing will happen,
So why not just remove the parameter and we can do below 

	If (!fv_found)
		ice_flow_assoc_hw_prof(...)

its always better to reduce unnecessary context for simple purpose in a function.
	

> 
> >
> > If fv_found is true, seems nothing has been done in this function, why
> > not just check the flag outside the function?
> 
> Yes, ice_add_prof_id_flow should be processed after ice_add_prof.
> It's ok if we just move the ice_add_prof_id_flow processing into func
> ice_flow_set_hw_prof, and delete the func ice_flow_assoc_hw_prof to reduce
> the code size.
> 
> For RSS, the ice_add_prof_id_flow for adding dest_vsi_handle should always be
> processed.
> So this function has other RSS logic to add soon.
> 
> >
> >
> >
>
  
Junfeng Guo Oct. 27, 2021, 2:51 a.m. UTC | #4
> -----Original Message-----
> From: Zhang, Qi Z <qi.z.zhang@intel.com>
> Sent: Wednesday, October 27, 2021 10:18
> To: Guo, Junfeng <junfeng.guo@intel.com>; Wu, Jingjing
> <jingjing.wu@intel.com>; Xing, Beilei <beilei.xing@intel.com>
> Cc: dev@dpdk.org; Yigit, Ferruh <ferruh.yigit@intel.com>; Wang, Haiyue
> <haiyue.wang@intel.com>; Yan, Zhirun <Zhirun.Yan@intel.com>
> Subject: RE: [PATCH v4 2/4] net/ice/base: add function to set HW profile
> for raw flow
> 
> 
> 
> > -----Original Message-----
> > From: Guo, Junfeng <junfeng.guo@intel.com>
> > Sent: Wednesday, October 27, 2021 9:58 AM
> > To: Zhang, Qi Z <qi.z.zhang@intel.com>; Wu, Jingjing
> <jingjing.wu@intel.com>;
> > Xing, Beilei <beilei.xing@intel.com>
> > Cc: dev@dpdk.org; Yigit, Ferruh <ferruh.yigit@intel.com>; Wang,
> Haiyue
> > <haiyue.wang@intel.com>; Yan, Zhirun <zhirun.yan@intel.com>
> > Subject: RE: [PATCH v4 2/4] net/ice/base: add function to set HW
> profile for
> > raw flow
> >
> >
> >
> > > -----Original Message-----
> > > From: Zhang, Qi Z <qi.z.zhang@intel.com>
> > > Sent: Wednesday, October 27, 2021 08:58
> > > To: Guo, Junfeng <junfeng.guo@intel.com>; Wu, Jingjing
> > > <jingjing.wu@intel.com>; Xing, Beilei <beilei.xing@intel.com>
> > > Cc: dev@dpdk.org; Yigit, Ferruh <ferruh.yigit@intel.com>; Wang,
> Haiyue
> > > <haiyue.wang@intel.com>; Yan, Zhirun <Zhirun.Yan@intel.com>
> > > Subject: RE: [PATCH v4 2/4] net/ice/base: add function to set HW
> > > profile for raw flow
> > >
> > >
> > >
> > > > -----Original Message-----
> > > > From: Guo, Junfeng <junfeng.guo@intel.com>
> > > > Sent: Tuesday, October 26, 2021 8:01 PM
> > > > To: Zhang, Qi Z <qi.z.zhang@intel.com>; Wu, Jingjing
> > > <jingjing.wu@intel.com>;
> > > > Xing, Beilei <beilei.xing@intel.com>
> > > > Cc: dev@dpdk.org; Yigit, Ferruh <ferruh.yigit@intel.com>; Wang,
> > > Haiyue
> > > > <haiyue.wang@intel.com>; Yan, Zhirun <zhirun.yan@intel.com>;
> Guo,
> > > Junfeng
> > > > <junfeng.guo@intel.com>
> > > > Subject: [PATCH v4 2/4] net/ice/base: add function to set HW profile
> > > > for
> > > raw
> > > > flow
> > > >
> > > > Based on the parser library, we can directly set HW profile and
> > > > associate
> > > the
> > > > main/ctrl vsi.
> > > >
> > > > Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>
> > > > ---
> > > >  drivers/net/ice/base/ice_flex_pipe.c | 55 ++++++++++++++++++
> > > > drivers/net/ice/base/ice_flex_pipe.h |  4 ++
> > > >  drivers/net/ice/base/ice_flow.c      | 85
> > > ++++++++++++++++++++++++++++
> > > >  drivers/net/ice/base/ice_flow.h      |  4 ++
> > > >  4 files changed, 148 insertions(+)
> > > >
> > > > diff --git a/drivers/net/ice/base/ice_flex_pipe.c
> > > > b/drivers/net/ice/base/ice_flex_pipe.c
> > > > index 06a233990f..030655f3f0 100644
> > > > --- a/drivers/net/ice/base/ice_flex_pipe.c
> > > > +++ b/drivers/net/ice/base/ice_flex_pipe.c
> > > > @@ -6365,3 +6365,58 @@ ice_rem_prof_id_flow(struct ice_hw
> *hw,
> > > enum
> > > > ice_block blk, u16 vsi, u64 hdl)
> > > >
> > > >  return status;
> > > >  }
> > > > +
> > > > +/**
> > > > + * ice_flow_assoc_hw_prof - add profile id flow for main/ctrl VSI
> > > > +flow entry
> > > > + * @hw: pointer to the HW struct
> > > > + * @blk: HW block
> > > > + * @dest_vsi_handle: dest VSI handle
> > > > + * @fdir_vsi_handle: fdir programming VSI handle
> > > > + * @id: profile id (handle)
> > > > + * @fv_found: found fv in fdir fv list
> > > > + *
> > > > + * Calling this function will update the hardware tables to enable
> > > > +the
> > > > + * profile indicated by the ID parameter for the VSIs specified in
> > > > +the VSI
> > > > + * array. Once successfully called, the flow will be enabled.
> > > > + */
> > > > +enum ice_status
> > > > +ice_flow_assoc_hw_prof(struct ice_hw *hw, enum ice_block blk,
> > > > +       u16 dest_vsi_handle, u16 fdir_vsi_handle, int id,
> > > > +       bool fv_found)
> > >
> > > Do we really need this fv_found parameter?
> >
> > The value of fv_found is set based on the maintained profile info list in
> the PMD.
> > So we need this parameter to add profile id flow for FDIR in the shared
> code.
> 
> I mean if we parse fv_found = true into ice_flow_assoc_hw_prof, nothing
> will happen,
> So why not just remove the parameter and we can do below
> 
> If (!fv_found)
> ice_flow_assoc_hw_prof(...)
> 
> its always better to reduce unnecessary context for simple purpose in a
> function.

Sure, updated in the coming patch set. Thanks!

> 
> >
> > >
> > > If fv_found is true, seems nothing has been done in this function, why
> > > not just check the flag outside the function?
> >
> > Yes, ice_add_prof_id_flow should be processed after ice_add_prof.
> > It's ok if we just move the ice_add_prof_id_flow processing into func
> > ice_flow_set_hw_prof, and delete the func ice_flow_assoc_hw_prof to
> reduce
> > the code size.
> >
> > For RSS, the ice_add_prof_id_flow for adding dest_vsi_handle should
> always be
> > processed.
> > So this function has other RSS logic to add soon.
> >
> > >
> > >
> > >
> >
>
  

Patch

diff --git a/drivers/net/ice/base/ice_flex_pipe.c b/drivers/net/ice/base/ice_flex_pipe.c
index 06a233990f..030655f3f0 100644
--- a/drivers/net/ice/base/ice_flex_pipe.c
+++ b/drivers/net/ice/base/ice_flex_pipe.c
@@ -6365,3 +6365,58 @@  ice_rem_prof_id_flow(struct ice_hw *hw, enum ice_block blk, u16 vsi, u64 hdl)
 
 	return status;
 }
+
+/**
+ * ice_flow_assoc_hw_prof - add profile id flow for main/ctrl VSI flow entry
+ * @hw: pointer to the HW struct
+ * @blk: HW block
+ * @dest_vsi_handle: dest VSI handle
+ * @fdir_vsi_handle: fdir programming VSI handle
+ * @id: profile id (handle)
+ * @fv_found: found fv in fdir fv list
+ *
+ * Calling this function will update the hardware tables to enable the
+ * profile indicated by the ID parameter for the VSIs specified in the VSI
+ * array. Once successfully called, the flow will be enabled.
+ */
+enum ice_status
+ice_flow_assoc_hw_prof(struct ice_hw *hw, enum ice_block blk,
+		       u16 dest_vsi_handle, u16 fdir_vsi_handle, int id,
+		       bool fv_found)
+{
+	enum ice_status status = ICE_SUCCESS;
+	u16 vsi_num;
+
+	vsi_num = ice_get_hw_vsi_num(hw, dest_vsi_handle);
+	if (!fv_found) {
+		status = ice_add_prof_id_flow(hw, blk, vsi_num, id);
+		if (status) {
+			ice_debug(hw, ICE_DBG_FLOW, "HW profile add failed for main VSI flow entry, %d\n",
+				  status);
+			goto err_add_prof;
+		}
+	}
+
+	if (blk != ICE_BLK_FD)
+		return status;
+
+	vsi_num = ice_get_hw_vsi_num(hw, fdir_vsi_handle);
+	if (!fv_found) {
+		status = ice_add_prof_id_flow(hw, blk, vsi_num, id);
+		if (status) {
+			ice_debug(hw, ICE_DBG_FLOW, "HW profile add failed for ctrl VSI flow entry, %d\n",
+				  status);
+			goto err_add_entry;
+		}
+	}
+
+	return status;
+
+err_add_entry:
+	vsi_num = ice_get_hw_vsi_num(hw, dest_vsi_handle);
+	ice_rem_prof_id_flow(hw, blk, vsi_num, id);
+err_add_prof:
+	ice_flow_rem_prof(hw, blk, id);
+
+	return status;
+}
diff --git a/drivers/net/ice/base/ice_flex_pipe.h b/drivers/net/ice/base/ice_flex_pipe.h
index dd332312dd..3621de18dc 100644
--- a/drivers/net/ice/base/ice_flex_pipe.h
+++ b/drivers/net/ice/base/ice_flex_pipe.h
@@ -76,6 +76,10 @@  enum ice_status
 ice_add_prof_id_flow(struct ice_hw *hw, enum ice_block blk, u16 vsi, u64 hdl);
 enum ice_status
 ice_rem_prof_id_flow(struct ice_hw *hw, enum ice_block blk, u16 vsi, u64 hdl);
+enum ice_status
+ice_flow_assoc_hw_prof(struct ice_hw *hw, enum ice_block blk,
+		       u16 dest_vsi_handle, u16 fdir_vsi_handle, int id,
+		       bool fv_found);
 enum ice_status ice_init_pkg(struct ice_hw *hw, u8 *buff, u32 len);
 enum ice_status
 ice_copy_and_init_pkg(struct ice_hw *hw, const u8 *buf, u32 len);
diff --git a/drivers/net/ice/base/ice_flow.c b/drivers/net/ice/base/ice_flow.c
index 77b6b130c1..43a72b0882 100644
--- a/drivers/net/ice/base/ice_flow.c
+++ b/drivers/net/ice/base/ice_flow.c
@@ -2524,6 +2524,91 @@  ice_flow_disassoc_prof(struct ice_hw *hw, enum ice_block blk,
 	return status;
 }
 
+#define FLAG_GTP_EH_PDU_LINK	BIT_ULL(13)
+#define FLAG_GTP_EH_PDU		BIT_ULL(14)
+
+#define FLAG_GTPU_MSK	\
+	(FLAG_GTP_EH_PDU | FLAG_GTP_EH_PDU_LINK)
+#define FLAG_GTPU_DW	\
+	(FLAG_GTP_EH_PDU | FLAG_GTP_EH_PDU_LINK)
+#define FLAG_GTPU_UP	\
+	(FLAG_GTP_EH_PDU)
+/**
+ * ice_flow_set_hw_prof - Set HW flow profile based on the parsed profile info
+ * @hw: pointer to the HW struct
+ * @dest_vsi_handle: dest VSI handle
+ * @fdir_vsi_handle: fdir programming VSI handle
+ * @prof: stores parsed profile info from raw flow
+ * @blk: classification stage
+ * @fv_found: found fv in fdir fv list
+ */
+enum ice_status
+ice_flow_set_hw_prof(struct ice_hw *hw, u16 dest_vsi_handle,
+		     u16 fdir_vsi_handle, struct ice_parser_profile *prof,
+		     enum ice_block blk, bool fv_found)
+{
+	int id = ice_find_first_bit(prof->ptypes, UINT16_MAX);
+	struct ice_flow_prof_params *params;
+	u8 fv_words = hw->blk[blk].es.fvw;
+	enum ice_status status;
+	u16 vsi_num;
+	int i, idx;
+
+	params = (struct ice_flow_prof_params *)ice_malloc(hw, sizeof(*params));
+	if (!params)
+		return ICE_ERR_NO_MEMORY;
+
+	for (i = 0; i < ICE_MAX_FV_WORDS; i++) {
+		params->es[i].prot_id = ICE_PROT_INVALID;
+		params->es[i].off = ICE_FV_OFFSET_INVAL;
+	}
+
+	for (i = 0; i < prof->fv_num; i++) {
+		if (hw->blk[blk].es.reverse)
+			idx = fv_words - i - 1;
+		else
+			idx = i;
+		params->es[idx].prot_id = prof->fv[i].proto_id;
+		params->es[idx].off = prof->fv[i].offset;
+		params->mask[idx] = CPU_TO_BE16(prof->fv[i].msk);
+	}
+
+	switch (prof->flags) {
+	case FLAG_GTPU_DW:
+		params->attr = ice_attr_gtpu_down;
+		params->attr_cnt = ARRAY_SIZE(ice_attr_gtpu_down);
+		break;
+	case FLAG_GTPU_UP:
+		params->attr = ice_attr_gtpu_up;
+		params->attr_cnt = ARRAY_SIZE(ice_attr_gtpu_up);
+		break;
+	default:
+		if (prof->flags_msk & FLAG_GTPU_MSK) {
+			params->attr = ice_attr_gtpu_session;
+			params->attr_cnt = ARRAY_SIZE(ice_attr_gtpu_session);
+		}
+		break;
+	}
+
+	status = ice_add_prof(hw, blk, id, (u8 *)prof->ptypes,
+			      params->attr, params->attr_cnt,
+			      params->es, params->mask, false);
+	if (status)
+		goto free_params;
+
+	status = ice_flow_assoc_hw_prof(hw, blk, dest_vsi_handle,
+					fdir_vsi_handle, id, fv_found);
+	if (status)
+		goto free_params;
+
+	return ICE_SUCCESS;
+
+free_params:
+	ice_free(hw, params);
+
+	return status;
+}
+
 /**
  * ice_flow_add_prof - Add a flow profile for packet segments and matched fields
  * @hw: pointer to the HW struct
diff --git a/drivers/net/ice/base/ice_flow.h b/drivers/net/ice/base/ice_flow.h
index 371d960066..ec1fd1dcfc 100644
--- a/drivers/net/ice/base/ice_flow.h
+++ b/drivers/net/ice/base/ice_flow.h
@@ -548,6 +548,10 @@  enum ice_status
 ice_flow_assoc_vsig_vsi(struct ice_hw *hw, enum ice_block blk, u16 vsi_handle,
 			u16 vsig);
 enum ice_status
+ice_flow_set_hw_prof(struct ice_hw *hw, u16 dest_vsi_handle,
+		     u16 fdir_vsi_handle, struct ice_parser_profile *prof,
+		     enum ice_block blk, bool fv_found);
+enum ice_status
 ice_flow_get_hw_prof(struct ice_hw *hw, enum ice_block blk, u64 prof_id,
 		     u8 *hw_prof);