Message ID | 20230821023833.2700902-2-junfeng.guo@intel.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | Introduce the Parser Library | expand |
On Mon, Aug 21, 2023 at 10:38:19AM +0800, Junfeng Guo wrote: > Add new parser module which can parse a packet in binary > and generate information like ptype, protocol/offset pairs > and flags which can be used to feed the FXP profile creation > directly. > > The patch added skeleton of the create and destroy APIs: > ice_parser_create > ice_parser_destroy > > Signed-off-by: Junfeng Guo <junfeng.guo@intel.com> Hi Junfeng Guo, some minor feedback from my side. > --- > drivers/net/ethernet/intel/ice/ice_common.h | 4 +++ > drivers/net/ethernet/intel/ice/ice_ddp.c | 10 +++--- > drivers/net/ethernet/intel/ice/ice_ddp.h | 13 ++++++++ > drivers/net/ethernet/intel/ice/ice_parser.c | 34 +++++++++++++++++++++ Perhaps I am missing something, but it seems that although ice_parser.c is added by this patch-set, it is not added to the build by this patch-set. This seems a little odd to me. > drivers/net/ethernet/intel/ice/ice_parser.h | 13 ++++++++ > 5 files changed, 69 insertions(+), 5 deletions(-) > create mode 100644 drivers/net/ethernet/intel/ice/ice_parser.c > create mode 100644 drivers/net/ethernet/intel/ice/ice_parser.h ... > diff --git a/drivers/net/ethernet/intel/ice/ice_parser.c b/drivers/net/ethernet/intel/ice/ice_parser.c > new file mode 100644 > index 000000000000..42602cac7e45 > --- /dev/null > +++ b/drivers/net/ethernet/intel/ice/ice_parser.c > @@ -0,0 +1,34 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* Copyright (C) 2023 Intel Corporation */ > + > +#include "ice_common.h" > + > +/** > + * ice_parser_create - create a parser instance > + * @hw: pointer to the hardware structure > + * @psr: output parameter for a new parser instance be created > + */ > +int ice_parser_create(struct ice_hw *hw, struct ice_parser **psr) > +{ > + struct ice_parser *p; > + > + p = devm_kzalloc(ice_hw_to_dev(hw), sizeof(struct ice_parser), > + GFP_KERNEL); > + if (!p) > + return -ENOMEM; > + > + p->hw = hw; > + p->rt.psr = p; It is, perhaps academic if this file isn't compiled, but the rt field of struct ice_parser doesn't exist at this point of the patch-set: it is added by the last patch of the patch-set. > + > + *psr = p; > + return 0; > +} > + > +/** > + * ice_parser_destroy - destroy a parser instance > + * @psr: pointer to a parser instance > + */ > +void ice_parser_destroy(struct ice_parser *psr) > +{ > + devm_kfree(ice_hw_to_dev(psr->hw), psr); > +}
On Mon, Aug 21, 2023 at 09:20:37AM +0200, Simon Horman wrote: > On Mon, Aug 21, 2023 at 10:38:19AM +0800, Junfeng Guo wrote: > > Add new parser module which can parse a packet in binary > > and generate information like ptype, protocol/offset pairs > > and flags which can be used to feed the FXP profile creation > > directly. > > > > The patch added skeleton of the create and destroy APIs: > > ice_parser_create > > ice_parser_destroy > > > > Signed-off-by: Junfeng Guo <junfeng.guo@intel.com> > > Hi Junfeng Guo, > > some minor feedback from my side. > > > --- > > drivers/net/ethernet/intel/ice/ice_common.h | 4 +++ > > drivers/net/ethernet/intel/ice/ice_ddp.c | 10 +++--- > > drivers/net/ethernet/intel/ice/ice_ddp.h | 13 ++++++++ > > drivers/net/ethernet/intel/ice/ice_parser.c | 34 +++++++++++++++++++++ > > Perhaps I am missing something, but it seems that although > ice_parser.c is added by this patch-set, it is not added to > the build by this patch-set. This seems a little odd to me. Sorry, somehow I wasn't looking at the entire series. I now see that ice_parser.c is compiled as of patch 12/15 of this series. > > > drivers/net/ethernet/intel/ice/ice_parser.h | 13 ++++++++ > > 5 files changed, 69 insertions(+), 5 deletions(-) > > create mode 100644 drivers/net/ethernet/intel/ice/ice_parser.c > > create mode 100644 drivers/net/ethernet/intel/ice/ice_parser.h > > ... > > > diff --git a/drivers/net/ethernet/intel/ice/ice_parser.c b/drivers/net/ethernet/intel/ice/ice_parser.c > > new file mode 100644 > > index 000000000000..42602cac7e45 > > --- /dev/null > > +++ b/drivers/net/ethernet/intel/ice/ice_parser.c > > @@ -0,0 +1,34 @@ > > +// SPDX-License-Identifier: GPL-2.0 > > +/* Copyright (C) 2023 Intel Corporation */ > > + > > +#include "ice_common.h" > > + > > +/** > > + * ice_parser_create - create a parser instance > > + * @hw: pointer to the hardware structure > > + * @psr: output parameter for a new parser instance be created > > + */ > > +int ice_parser_create(struct ice_hw *hw, struct ice_parser **psr) > > +{ > > + struct ice_parser *p; > > + > > + p = devm_kzalloc(ice_hw_to_dev(hw), sizeof(struct ice_parser), > > + GFP_KERNEL); > > + if (!p) > > + return -ENOMEM; > > + > > + p->hw = hw; > > + p->rt.psr = p; > > It is, perhaps academic if this file isn't compiled, but the rt field of > struct ice_parser doesn't exist at this point of the patch-set: it is added > by the last patch of the patch-set. And I see this field is added in patch 10/15, rather than the last patch (15/15) as I previously stated. > > > + > > + *psr = p; > > + return 0; > > +} > > + > > +/** > > + * ice_parser_destroy - destroy a parser instance > > + * @psr: pointer to a parser instance > > + */ > > +void ice_parser_destroy(struct ice_parser *psr) > > +{ > > + devm_kfree(ice_hw_to_dev(psr->hw), psr); > > +} >
> -----Original Message----- > From: Simon Horman <horms@kernel.org> > Sent: Monday, August 21, 2023 15:30 > To: Guo, Junfeng <junfeng.guo@intel.com> > Cc: intel-wired-lan@lists.osuosl.org; netdev@vger.kernel.org; Nguyen, > Anthony L <anthony.l.nguyen@intel.com>; Brandeburg, Jesse > <jesse.brandeburg@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>; > ivecera <ivecera@redhat.com>; Samudrala, Sridhar > <sridhar.samudrala@intel.com> > Subject: Re: [PATCH iwl-next v5 01/15] ice: add parser create and > destroy skeleton > > On Mon, Aug 21, 2023 at 09:20:37AM +0200, Simon Horman wrote: > > On Mon, Aug 21, 2023 at 10:38:19AM +0800, Junfeng Guo wrote: > > > Add new parser module which can parse a packet in binary > > > and generate information like ptype, protocol/offset pairs > > > and flags which can be used to feed the FXP profile creation > > > directly. > > > > > > The patch added skeleton of the create and destroy APIs: > > > ice_parser_create > > > ice_parser_destroy > > > > > > Signed-off-by: Junfeng Guo <junfeng.guo@intel.com> > > > > Hi Junfeng Guo, > > > > some minor feedback from my side. > > > > > --- > > > drivers/net/ethernet/intel/ice/ice_common.h | 4 +++ > > > drivers/net/ethernet/intel/ice/ice_ddp.c | 10 +++--- > > > drivers/net/ethernet/intel/ice/ice_ddp.h | 13 ++++++++ > > > drivers/net/ethernet/intel/ice/ice_parser.c | 34 > +++++++++++++++++++++ > > > > Perhaps I am missing something, but it seems that although > > ice_parser.c is added by this patch-set, it is not added to > > the build by this patch-set. This seems a little odd to me. > > Sorry, somehow I wasn't looking at the entire series. > I now see that ice_parser.c is compiled as of patch 12/15 of this series. Yes, thanks for the carefully review! > > > > > > drivers/net/ethernet/intel/ice/ice_parser.h | 13 ++++++++ > > > 5 files changed, 69 insertions(+), 5 deletions(-) > > > create mode 100644 drivers/net/ethernet/intel/ice/ice_parser.c > > > create mode 100644 drivers/net/ethernet/intel/ice/ice_parser.h > > > > ... > > > > > diff --git a/drivers/net/ethernet/intel/ice/ice_parser.c > b/drivers/net/ethernet/intel/ice/ice_parser.c > > > new file mode 100644 > > > index 000000000000..42602cac7e45 > > > --- /dev/null > > > +++ b/drivers/net/ethernet/intel/ice/ice_parser.c > > > @@ -0,0 +1,34 @@ > > > +// SPDX-License-Identifier: GPL-2.0 > > > +/* Copyright (C) 2023 Intel Corporation */ > > > + > > > +#include "ice_common.h" > > > + > > > +/** > > > + * ice_parser_create - create a parser instance > > > + * @hw: pointer to the hardware structure > > > + * @psr: output parameter for a new parser instance be created > > > + */ > > > +int ice_parser_create(struct ice_hw *hw, struct ice_parser **psr) > > > +{ > > > + struct ice_parser *p; > > > + > > > + p = devm_kzalloc(ice_hw_to_dev(hw), sizeof(struct ice_parser), > > > + GFP_KERNEL); > > > + if (!p) > > > + return -ENOMEM; > > > + > > > + p->hw = hw; > > > + p->rt.psr = p; > > > > It is, perhaps academic if this file isn't compiled, but the rt field of > > struct ice_parser doesn't exist at this point of the patch-set: it is > added > > by the last patch of the patch-set. > > And I see this field is added in patch 10/15, rather than the last patch > (15/15) as I previously stated. Thanks for the comments! Yes, the setting for rt field should be moved to patch 10/15. Will update in the new version patch set. Thanks! > > > > > > + > > > + *psr = p; > > > + return 0; > > > +} > > > + > > > +/** > > > + * ice_parser_destroy - destroy a parser instance > > > + * @psr: pointer to a parser instance > > > + */ > > > +void ice_parser_destroy(struct ice_parser *psr) > > > +{ > > > + devm_kfree(ice_hw_to_dev(psr->hw), psr); > > > +} > >
On Mon, Aug 21, 2023 at 07:34:38AM +0000, Guo, Junfeng wrote: > > > > -----Original Message----- > > From: Simon Horman <horms@kernel.org> > > Sent: Monday, August 21, 2023 15:30 > > To: Guo, Junfeng <junfeng.guo@intel.com> > > Cc: intel-wired-lan@lists.osuosl.org; netdev@vger.kernel.org; Nguyen, > > Anthony L <anthony.l.nguyen@intel.com>; Brandeburg, Jesse > > <jesse.brandeburg@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>; > > ivecera <ivecera@redhat.com>; Samudrala, Sridhar > > <sridhar.samudrala@intel.com> > > Subject: Re: [PATCH iwl-next v5 01/15] ice: add parser create and > > destroy skeleton > > > > On Mon, Aug 21, 2023 at 09:20:37AM +0200, Simon Horman wrote: > > > On Mon, Aug 21, 2023 at 10:38:19AM +0800, Junfeng Guo wrote: > > > > Add new parser module which can parse a packet in binary > > > > and generate information like ptype, protocol/offset pairs > > > > and flags which can be used to feed the FXP profile creation > > > > directly. > > > > > > > > The patch added skeleton of the create and destroy APIs: > > > > ice_parser_create > > > > ice_parser_destroy > > > > > > > > Signed-off-by: Junfeng Guo <junfeng.guo@intel.com> > > > > > > Hi Junfeng Guo, > > > > > > some minor feedback from my side. > > > > > > > --- > > > > drivers/net/ethernet/intel/ice/ice_common.h | 4 +++ > > > > drivers/net/ethernet/intel/ice/ice_ddp.c | 10 +++--- > > > > drivers/net/ethernet/intel/ice/ice_ddp.h | 13 ++++++++ > > > > drivers/net/ethernet/intel/ice/ice_parser.c | 34 > > +++++++++++++++++++++ > > > > > > Perhaps I am missing something, but it seems that although > > > ice_parser.c is added by this patch-set, it is not added to > > > the build by this patch-set. This seems a little odd to me. > > > > Sorry, somehow I wasn't looking at the entire series. > > I now see that ice_parser.c is compiled as of patch 12/15 of this series. > > Yes, thanks for the carefully review! > > > > > > > > > > drivers/net/ethernet/intel/ice/ice_parser.h | 13 ++++++++ > > > > 5 files changed, 69 insertions(+), 5 deletions(-) > > > > create mode 100644 drivers/net/ethernet/intel/ice/ice_parser.c > > > > create mode 100644 drivers/net/ethernet/intel/ice/ice_parser.h > > > > > > ... > > > > > > > diff --git a/drivers/net/ethernet/intel/ice/ice_parser.c > > b/drivers/net/ethernet/intel/ice/ice_parser.c > > > > new file mode 100644 > > > > index 000000000000..42602cac7e45 > > > > --- /dev/null > > > > +++ b/drivers/net/ethernet/intel/ice/ice_parser.c > > > > @@ -0,0 +1,34 @@ > > > > +// SPDX-License-Identifier: GPL-2.0 > > > > +/* Copyright (C) 2023 Intel Corporation */ > > > > + > > > > +#include "ice_common.h" > > > > + > > > > +/** > > > > + * ice_parser_create - create a parser instance > > > > + * @hw: pointer to the hardware structure > > > > + * @psr: output parameter for a new parser instance be created > > > > + */ > > > > +int ice_parser_create(struct ice_hw *hw, struct ice_parser **psr) > > > > +{ > > > > + struct ice_parser *p; > > > > + > > > > + p = devm_kzalloc(ice_hw_to_dev(hw), sizeof(struct ice_parser), > > > > + GFP_KERNEL); > > > > + if (!p) > > > > + return -ENOMEM; > > > > + > > > > + p->hw = hw; > > > > + p->rt.psr = p; > > > > > > It is, perhaps academic if this file isn't compiled, but the rt field of > > > struct ice_parser doesn't exist at this point of the patch-set: it is > > added > > > by the last patch of the patch-set. > > > > And I see this field is added in patch 10/15, rather than the last patch > > (15/15) as I previously stated. > > Thanks for the comments! > Yes, the setting for rt field should be moved to patch 10/15. > Will update in the new version patch set. Thanks! Likewise, thanks. If you are going to address this you may also want to look at what seems to be similar problem with both ICE_PARSER_FLG_NUM and ICE_ERR_NOT_IMPL appearing in code before they are defined. ...
> -----Original Message----- > From: Simon Horman <horms@kernel.org> > Sent: Monday, August 21, 2023 22:48 > To: Guo, Junfeng <junfeng.guo@intel.com> > Cc: intel-wired-lan@lists.osuosl.org; netdev@vger.kernel.org; Nguyen, > Anthony L <anthony.l.nguyen@intel.com>; Brandeburg, Jesse > <jesse.brandeburg@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>; > ivecera <ivecera@redhat.com>; Samudrala, Sridhar > <sridhar.samudrala@intel.com> > Subject: Re: [PATCH iwl-next v5 01/15] ice: add parser create and > destroy skeleton > > On Mon, Aug 21, 2023 at 07:34:38AM +0000, Guo, Junfeng wrote: > > > > > > > -----Original Message----- > > > From: Simon Horman <horms@kernel.org> > > > Sent: Monday, August 21, 2023 15:30 > > > To: Guo, Junfeng <junfeng.guo@intel.com> > > > Cc: intel-wired-lan@lists.osuosl.org; netdev@vger.kernel.org; > Nguyen, > > > Anthony L <anthony.l.nguyen@intel.com>; Brandeburg, Jesse > > > <jesse.brandeburg@intel.com>; Zhang, Qi Z > <qi.z.zhang@intel.com>; > > > ivecera <ivecera@redhat.com>; Samudrala, Sridhar > > > <sridhar.samudrala@intel.com> > > > Subject: Re: [PATCH iwl-next v5 01/15] ice: add parser create and > > > destroy skeleton > > > > > > On Mon, Aug 21, 2023 at 09:20:37AM +0200, Simon Horman wrote: > > > > On Mon, Aug 21, 2023 at 10:38:19AM +0800, Junfeng Guo wrote: > > > > > Add new parser module which can parse a packet in binary > > > > > and generate information like ptype, protocol/offset pairs > > > > > and flags which can be used to feed the FXP profile creation > > > > > directly. > > > > > > > > > > The patch added skeleton of the create and destroy APIs: > > > > > ice_parser_create > > > > > ice_parser_destroy > > > > > > > > > > Signed-off-by: Junfeng Guo <junfeng.guo@intel.com> > > > > > > > > Hi Junfeng Guo, > > > > > > > > some minor feedback from my side. > > > > > > > > > --- > > > > > drivers/net/ethernet/intel/ice/ice_common.h | 4 +++ > > > > > drivers/net/ethernet/intel/ice/ice_ddp.c | 10 +++--- > > > > > drivers/net/ethernet/intel/ice/ice_ddp.h | 13 ++++++++ > > > > > drivers/net/ethernet/intel/ice/ice_parser.c | 34 > > > +++++++++++++++++++++ > > > > > > > > Perhaps I am missing something, but it seems that although > > > > ice_parser.c is added by this patch-set, it is not added to > > > > the build by this patch-set. This seems a little odd to me. > > > > > > Sorry, somehow I wasn't looking at the entire series. > > > I now see that ice_parser.c is compiled as of patch 12/15 of this > series. > > > > Yes, thanks for the carefully review! > > > > > > > > > > > > > > drivers/net/ethernet/intel/ice/ice_parser.h | 13 ++++++++ > > > > > 5 files changed, 69 insertions(+), 5 deletions(-) > > > > > create mode 100644 > drivers/net/ethernet/intel/ice/ice_parser.c > > > > > create mode 100644 > drivers/net/ethernet/intel/ice/ice_parser.h > > > > > > > > ... > > > > > > > > > diff --git a/drivers/net/ethernet/intel/ice/ice_parser.c > > > b/drivers/net/ethernet/intel/ice/ice_parser.c > > > > > new file mode 100644 > > > > > index 000000000000..42602cac7e45 > > > > > --- /dev/null > > > > > +++ b/drivers/net/ethernet/intel/ice/ice_parser.c > > > > > @@ -0,0 +1,34 @@ > > > > > +// SPDX-License-Identifier: GPL-2.0 > > > > > +/* Copyright (C) 2023 Intel Corporation */ > > > > > + > > > > > +#include "ice_common.h" > > > > > + > > > > > +/** > > > > > + * ice_parser_create - create a parser instance > > > > > + * @hw: pointer to the hardware structure > > > > > + * @psr: output parameter for a new parser instance be > created > > > > > + */ > > > > > +int ice_parser_create(struct ice_hw *hw, struct ice_parser > **psr) > > > > > +{ > > > > > + struct ice_parser *p; > > > > > + > > > > > + p = devm_kzalloc(ice_hw_to_dev(hw), sizeof(struct > ice_parser), > > > > > + GFP_KERNEL); > > > > > + if (!p) > > > > > + return -ENOMEM; > > > > > + > > > > > + p->hw = hw; > > > > > + p->rt.psr = p; > > > > > > > > It is, perhaps academic if this file isn't compiled, but the rt field > of > > > > struct ice_parser doesn't exist at this point of the patch-set: it is > > > added > > > > by the last patch of the patch-set. > > > > > > And I see this field is added in patch 10/15, rather than the last > patch > > > (15/15) as I previously stated. > > > > Thanks for the comments! > > Yes, the setting for rt field should be moved to patch 10/15. > > Will update in the new version patch set. Thanks! > > Likewise, thanks. > > If you are going to address this you may also > want to look at what seems to be similar problem with > both ICE_PARSER_FLG_NUM and ICE_ERR_NOT_IMPL appearing > in code before they are defined. Oh, thanks for pointing out this! Will also check the rest code for similar problem. Thanks for the carefully review! > > ...
diff --git a/drivers/net/ethernet/intel/ice/ice_common.h b/drivers/net/ethernet/intel/ice/ice_common.h index 8ba5f935a092..528dde976373 100644 --- a/drivers/net/ethernet/intel/ice/ice_common.h +++ b/drivers/net/ethernet/intel/ice/ice_common.h @@ -9,10 +9,14 @@ #include "ice_type.h" #include "ice_nvm.h" #include "ice_flex_pipe.h" +#include "ice_parser.h" #include <linux/avf/virtchnl.h> #include "ice_switch.h" #include "ice_fdir.h" +#define BITS_PER_WORD 16 +#define BITMAP_MASK(n) GENMASK(((n) - 1), 0) + #define ICE_SQ_SEND_DELAY_TIME_MS 10 #define ICE_SQ_SEND_MAX_EXECUTE 3 diff --git a/drivers/net/ethernet/intel/ice/ice_ddp.c b/drivers/net/ethernet/intel/ice/ice_ddp.c index d71ed210f9c4..3bdf03b9ee71 100644 --- a/drivers/net/ethernet/intel/ice/ice_ddp.c +++ b/drivers/net/ethernet/intel/ice/ice_ddp.c @@ -288,11 +288,11 @@ void *ice_pkg_enum_section(struct ice_seg *ice_seg, struct ice_pkg_enum *state, * indicates a base offset of 10, and the index for the entry is 2, then * section handler function should set the offset to 10 + 2 = 12. */ -static void *ice_pkg_enum_entry(struct ice_seg *ice_seg, - struct ice_pkg_enum *state, u32 sect_type, - u32 *offset, - void *(*handler)(u32 sect_type, void *section, - u32 index, u32 *offset)) +void *ice_pkg_enum_entry(struct ice_seg *ice_seg, + struct ice_pkg_enum *state, u32 sect_type, + u32 *offset, + void *(*handler)(u32 sect_type, void *section, + u32 index, u32 *offset)) { void *entry; diff --git a/drivers/net/ethernet/intel/ice/ice_ddp.h b/drivers/net/ethernet/intel/ice/ice_ddp.h index 37eadb3d27a8..da5dfeed3b1f 100644 --- a/drivers/net/ethernet/intel/ice/ice_ddp.h +++ b/drivers/net/ethernet/intel/ice/ice_ddp.h @@ -238,10 +238,18 @@ struct ice_meta_sect { #define ICE_SID_CDID_KEY_BUILDER_RSS 47 #define ICE_SID_CDID_REDIR_RSS 48 +#define ICE_SID_RXPARSER_CAM 50 +#define ICE_SID_RXPARSER_NOMATCH_CAM 51 +#define ICE_SID_RXPARSER_IMEM 52 #define ICE_SID_RXPARSER_MARKER_PTYPE 55 #define ICE_SID_RXPARSER_BOOST_TCAM 56 +#define ICE_SID_RXPARSER_PROTO_GRP 57 #define ICE_SID_RXPARSER_METADATA_INIT 58 +#define ICE_SID_TXPARSER_NOMATCH_CAM 61 #define ICE_SID_TXPARSER_BOOST_TCAM 66 +#define ICE_SID_RXPARSER_MARKER_GRP 72 +#define ICE_SID_RXPARSER_PG_SPILL 76 +#define ICE_SID_RXPARSER_NOMATCH_SPILL 78 #define ICE_SID_XLT0_PE 80 #define ICE_SID_XLT_KEY_BUILDER_PE 81 @@ -437,6 +445,11 @@ int ice_update_pkg(struct ice_hw *hw, struct ice_buf *bufs, u32 count); int ice_pkg_buf_reserve_section(struct ice_buf_build *bld, u16 count); u16 ice_pkg_buf_get_active_sections(struct ice_buf_build *bld); +void * +ice_pkg_enum_entry(struct ice_seg *ice_seg, struct ice_pkg_enum *state, + u32 sect_type, u32 *offset, + void *(*handler)(u32 sect_type, void *section, + u32 index, u32 *offset)); void *ice_pkg_enum_section(struct ice_seg *ice_seg, struct ice_pkg_enum *state, u32 sect_type); diff --git a/drivers/net/ethernet/intel/ice/ice_parser.c b/drivers/net/ethernet/intel/ice/ice_parser.c new file mode 100644 index 000000000000..42602cac7e45 --- /dev/null +++ b/drivers/net/ethernet/intel/ice/ice_parser.c @@ -0,0 +1,34 @@ +// SPDX-License-Identifier: GPL-2.0 +/* Copyright (C) 2023 Intel Corporation */ + +#include "ice_common.h" + +/** + * ice_parser_create - create a parser instance + * @hw: pointer to the hardware structure + * @psr: output parameter for a new parser instance be created + */ +int ice_parser_create(struct ice_hw *hw, struct ice_parser **psr) +{ + struct ice_parser *p; + + p = devm_kzalloc(ice_hw_to_dev(hw), sizeof(struct ice_parser), + GFP_KERNEL); + if (!p) + return -ENOMEM; + + p->hw = hw; + p->rt.psr = p; + + *psr = p; + return 0; +} + +/** + * ice_parser_destroy - destroy a parser instance + * @psr: pointer to a parser instance + */ +void ice_parser_destroy(struct ice_parser *psr) +{ + devm_kfree(ice_hw_to_dev(psr->hw), psr); +} diff --git a/drivers/net/ethernet/intel/ice/ice_parser.h b/drivers/net/ethernet/intel/ice/ice_parser.h new file mode 100644 index 000000000000..85c470235e67 --- /dev/null +++ b/drivers/net/ethernet/intel/ice/ice_parser.h @@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Copyright (C) 2023 Intel Corporation */ + +#ifndef _ICE_PARSER_H_ +#define _ICE_PARSER_H_ + +struct ice_parser { + struct ice_hw *hw; /* pointer to the hardware structure */ +}; + +int ice_parser_create(struct ice_hw *hw, struct ice_parser **psr); +void ice_parser_destroy(struct ice_parser *psr); +#endif /* _ICE_PARSER_H_ */
Add new parser module which can parse a packet in binary and generate information like ptype, protocol/offset pairs and flags which can be used to feed the FXP profile creation directly. The patch added skeleton of the create and destroy APIs: ice_parser_create ice_parser_destroy Signed-off-by: Junfeng Guo <junfeng.guo@intel.com> --- drivers/net/ethernet/intel/ice/ice_common.h | 4 +++ drivers/net/ethernet/intel/ice/ice_ddp.c | 10 +++--- drivers/net/ethernet/intel/ice/ice_ddp.h | 13 ++++++++ drivers/net/ethernet/intel/ice/ice_parser.c | 34 +++++++++++++++++++++ drivers/net/ethernet/intel/ice/ice_parser.h | 13 ++++++++ 5 files changed, 69 insertions(+), 5 deletions(-) create mode 100644 drivers/net/ethernet/intel/ice/ice_parser.c create mode 100644 drivers/net/ethernet/intel/ice/ice_parser.h