From: Simon Horman <horms@kernel.org>
To: Ahmed Zaki <ahmed.zaki@intel.com>
Cc: netdev@vger.kernel.org, anthony.l.nguyen@intel.com,
Marcin Szycik <marcin.szycik@linux.intel.com>,
intel-wired-lan@lists.osuosl.org,
Junfeng Guo <junfeng.guo@intel.com>
Subject: Re: [Intel-wired-lan] [PATCH iwl-next v3 02/13] ice: parse and init various DDP parser sections
Date: Mon, 22 Jul 2024 15:52:28 +0100 [thread overview]
Message-ID: <20240722145228.GF715661@kernel.org> (raw)
In-Reply-To: <20240710204015.124233-3-ahmed.zaki@intel.com>
On Wed, Jul 10, 2024 at 02:40:04PM -0600, Ahmed Zaki wrote:
> From: Junfeng Guo <junfeng.guo@intel.com>
>
> Parse the following DDP sections:
> - ICE_SID_RXPARSER_IMEM into an array of struct ice_imem_item
> - ICE_SID_RXPARSER_METADATA_INIT into an array of struct ice_metainit_item
> - ICE_SID_RXPARSER_CAM or ICE_SID_RXPARSER_PG_SPILL into an array of
> struct ice_pg_cam_item
> - ICE_SID_RXPARSER_NOMATCH_CAM or ICE_SID_RXPARSER_NOMATCH_SPILL into an
> array of struct ice_pg_nm_cam_item
> - ICE_SID_RXPARSER_CAM into an array of ice_bst_tcam_item
> - ICE_SID_LBL_RXPARSER_TMEM into an array of ice_lbl_item
> - ICE_SID_RXPARSER_MARKER_PTYPE into an array of ice_ptype_mk_tcam_item
> - ICE_SID_RXPARSER_MARKER_GRP into an array of ice_mk_grp_item
> - ICE_SID_RXPARSER_PROTO_GRP into an array of ice_proto_grp_item
> - ICE_SID_RXPARSER_FLAG_REDIR into an array of ice_flg_rd_item
> - ICE_SID_XLT_KEY_BUILDER_SW, ICE_SID_XLT_KEY_BUILDER_ACL,
> ICE_SID_XLT_KEY_BUILDER_FD and ICE_SID_XLT_KEY_BUILDER_RSS into
> struct ice_xlt_kb
>
> Reviewed-by: Marcin Szycik <marcin.szycik@linux.intel.com>
> Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
> Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>
> Co-developed-by: Ahmed Zaki <ahmed.zaki@intel.com>
> Signed-off-by: Ahmed Zaki <ahmed.zaki@intel.com>
Hi Ahmed, Junfeng, all,
Some minor feedback from my side.
...
> diff --git a/drivers/net/ethernet/intel/ice/ice_parser.c b/drivers/net/ethernet/intel/ice/ice_parser.c
...
> +/**
> + * ice_parser_create_table - create an item table from a section
> + * @hw: pointer to the hardware structure
> + * @sect_type: section type
> + * @item_size: item size in byte
> + * @length: number of items in the table to create
> + * @parse_item: the function to parse the item
> + * @no_offset: ignore header offset, calculate index from 0
> + *
> + * Return: a pointer to the allocated table or ERR_PTR.
> + */
> +static
> +void *ice_parser_create_table(struct ice_hw *hw, u32 sect_type,
> + u32 item_size, u32 length,
> + void (*parse_item)(struct ice_hw *hw, u16 idx,
> + void *item, void *data,
> + int size),
> + bool no_offset)
> +{
> + struct ice_pkg_enum state = {};
> + struct ice_seg *seg = hw->seg;
> + void *table, *data, *item;
> + u16 idx = U16_MAX;
> +
> + if (!seg)
> + return ERR_PTR(-EINVAL);
> +
> + table = kzalloc(item_size * length, GFP_KERNEL);
> + if (!table)
> + return ERR_PTR(-ENOMEM);
> +
> + do {
> + data = ice_pkg_enum_entry(seg, &state, sect_type, NULL,
> + ice_parser_sect_item_get);
> + seg = NULL;
> + if (data) {
> + struct ice_pkg_sect_hdr *hdr =
> + (struct ice_pkg_sect_hdr *)state.sect;
nit: As the type of state.sect is void * I don't think there is a
need to explicitly cast it to another type of pointer.
struct ice_pkg_sect_hdr *hdr = state.sect;
> +
> + if (no_offset)
> + idx++;
> + else
> + idx = le16_to_cpu(hdr->offset) +
> + state.entry_idx;
> +
> + item = (void *)((uintptr_t)table + idx * item_size);
> + parse_item(hw, idx, item, data, item_size);
> + }
> + } while (data);
> +
> + return table;
> +}
...
> +/**
> + * ice_imem_parse_item - parse 384 bits of IMEM entry
> + * @hw: pointer to the hardware structure
> + * @idx: index of IMEM entry
> + * @item: item of IMEM entry
> + * @data: IMEM entry data to be parsed
> + * @size: size of IMEM entry
> + */
> +static void ice_imem_parse_item(struct ice_hw *hw, u16 idx, void *item,
> + void *data, int __maybe_unused size)
> +{
> + struct ice_imem_item *ii = item;
> + u8 *buf = (u8 *)data;
Similarly, I don't think there is a need to explicitly cast here:
u8 *buf = data;
> +
> + ii->idx = idx;
> +
> + ice_imem_bm_init(&ii->b_m, *(u8 *)buf);
> + ice_imem_bkb_init(&ii->b_kb,
> + *((u16 *)(&buf[ICE_IMEM_BKB_IDD])) >>
> + ICE_IMEM_BKB_OFF);
> +
> + ii->pg_prio = FIELD_GET(ICE_IMEM_PGP, *(u16 *)buf);
> +
> + ice_imem_npkb_init(&ii->np_kb,
> + *((u32 *)(&buf[ICE_IMEM_NPKB_IDD])) >>
> + ICE_IMEM_NPKB_OFF);
> + ice_imem_pgkb_init(&ii->pg_kb,
> + *((u64 *)(&buf[ICE_IMEM_PGKB_IDD])) >>
> + ICE_IMEM_PGKB_OFF);
> +
> + ice_imem_alu_init(&ii->alu0,
> + &buf[ICE_IMEM_ALU0_IDD],
> + ICE_IMEM_ALU0_OFF);
> + ice_imem_alu_init(&ii->alu1,
> + &buf[ICE_IMEM_ALU1_IDD],
> + ICE_IMEM_ALU1_OFF);
> + ice_imem_alu_init(&ii->alu2,
> + &buf[ICE_IMEM_ALU2_IDD],
> + ICE_IMEM_ALU2_OFF);
> +}
> +
> +/**
> + * ice_imem_table_get - create an imem table
> + * @hw: pointer to the hardware structure
> + *
> + * Return: a pointer to the allocated IMEM table.
> + */
> +static struct ice_imem_item *ice_imem_table_get(struct ice_hw *hw)
> +{
> + return (struct ice_imem_item *)
> + ice_parser_create_table(hw, ICE_SID_RXPARSER_IMEM,
> + sizeof(struct ice_imem_item),
> + ICE_IMEM_TABLE_SIZE,
> + ice_imem_parse_item, false);
> +}
Or here.
And, likewise, for other similar calls to ice_parser_create_table().
...
WARNING: multiple messages have this Message-ID (diff)
From: Simon Horman <horms@kernel.org>
To: Ahmed Zaki <ahmed.zaki@intel.com>
Cc: intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org,
anthony.l.nguyen@intel.com, Junfeng Guo <junfeng.guo@intel.com>,
Marcin Szycik <marcin.szycik@linux.intel.com>
Subject: Re: [PATCH iwl-next v3 02/13] ice: parse and init various DDP parser sections
Date: Mon, 22 Jul 2024 15:52:28 +0100 [thread overview]
Message-ID: <20240722145228.GF715661@kernel.org> (raw)
In-Reply-To: <20240710204015.124233-3-ahmed.zaki@intel.com>
On Wed, Jul 10, 2024 at 02:40:04PM -0600, Ahmed Zaki wrote:
> From: Junfeng Guo <junfeng.guo@intel.com>
>
> Parse the following DDP sections:
> - ICE_SID_RXPARSER_IMEM into an array of struct ice_imem_item
> - ICE_SID_RXPARSER_METADATA_INIT into an array of struct ice_metainit_item
> - ICE_SID_RXPARSER_CAM or ICE_SID_RXPARSER_PG_SPILL into an array of
> struct ice_pg_cam_item
> - ICE_SID_RXPARSER_NOMATCH_CAM or ICE_SID_RXPARSER_NOMATCH_SPILL into an
> array of struct ice_pg_nm_cam_item
> - ICE_SID_RXPARSER_CAM into an array of ice_bst_tcam_item
> - ICE_SID_LBL_RXPARSER_TMEM into an array of ice_lbl_item
> - ICE_SID_RXPARSER_MARKER_PTYPE into an array of ice_ptype_mk_tcam_item
> - ICE_SID_RXPARSER_MARKER_GRP into an array of ice_mk_grp_item
> - ICE_SID_RXPARSER_PROTO_GRP into an array of ice_proto_grp_item
> - ICE_SID_RXPARSER_FLAG_REDIR into an array of ice_flg_rd_item
> - ICE_SID_XLT_KEY_BUILDER_SW, ICE_SID_XLT_KEY_BUILDER_ACL,
> ICE_SID_XLT_KEY_BUILDER_FD and ICE_SID_XLT_KEY_BUILDER_RSS into
> struct ice_xlt_kb
>
> Reviewed-by: Marcin Szycik <marcin.szycik@linux.intel.com>
> Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
> Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>
> Co-developed-by: Ahmed Zaki <ahmed.zaki@intel.com>
> Signed-off-by: Ahmed Zaki <ahmed.zaki@intel.com>
Hi Ahmed, Junfeng, all,
Some minor feedback from my side.
...
> diff --git a/drivers/net/ethernet/intel/ice/ice_parser.c b/drivers/net/ethernet/intel/ice/ice_parser.c
...
> +/**
> + * ice_parser_create_table - create an item table from a section
> + * @hw: pointer to the hardware structure
> + * @sect_type: section type
> + * @item_size: item size in byte
> + * @length: number of items in the table to create
> + * @parse_item: the function to parse the item
> + * @no_offset: ignore header offset, calculate index from 0
> + *
> + * Return: a pointer to the allocated table or ERR_PTR.
> + */
> +static
> +void *ice_parser_create_table(struct ice_hw *hw, u32 sect_type,
> + u32 item_size, u32 length,
> + void (*parse_item)(struct ice_hw *hw, u16 idx,
> + void *item, void *data,
> + int size),
> + bool no_offset)
> +{
> + struct ice_pkg_enum state = {};
> + struct ice_seg *seg = hw->seg;
> + void *table, *data, *item;
> + u16 idx = U16_MAX;
> +
> + if (!seg)
> + return ERR_PTR(-EINVAL);
> +
> + table = kzalloc(item_size * length, GFP_KERNEL);
> + if (!table)
> + return ERR_PTR(-ENOMEM);
> +
> + do {
> + data = ice_pkg_enum_entry(seg, &state, sect_type, NULL,
> + ice_parser_sect_item_get);
> + seg = NULL;
> + if (data) {
> + struct ice_pkg_sect_hdr *hdr =
> + (struct ice_pkg_sect_hdr *)state.sect;
nit: As the type of state.sect is void * I don't think there is a
need to explicitly cast it to another type of pointer.
struct ice_pkg_sect_hdr *hdr = state.sect;
> +
> + if (no_offset)
> + idx++;
> + else
> + idx = le16_to_cpu(hdr->offset) +
> + state.entry_idx;
> +
> + item = (void *)((uintptr_t)table + idx * item_size);
> + parse_item(hw, idx, item, data, item_size);
> + }
> + } while (data);
> +
> + return table;
> +}
...
> +/**
> + * ice_imem_parse_item - parse 384 bits of IMEM entry
> + * @hw: pointer to the hardware structure
> + * @idx: index of IMEM entry
> + * @item: item of IMEM entry
> + * @data: IMEM entry data to be parsed
> + * @size: size of IMEM entry
> + */
> +static void ice_imem_parse_item(struct ice_hw *hw, u16 idx, void *item,
> + void *data, int __maybe_unused size)
> +{
> + struct ice_imem_item *ii = item;
> + u8 *buf = (u8 *)data;
Similarly, I don't think there is a need to explicitly cast here:
u8 *buf = data;
> +
> + ii->idx = idx;
> +
> + ice_imem_bm_init(&ii->b_m, *(u8 *)buf);
> + ice_imem_bkb_init(&ii->b_kb,
> + *((u16 *)(&buf[ICE_IMEM_BKB_IDD])) >>
> + ICE_IMEM_BKB_OFF);
> +
> + ii->pg_prio = FIELD_GET(ICE_IMEM_PGP, *(u16 *)buf);
> +
> + ice_imem_npkb_init(&ii->np_kb,
> + *((u32 *)(&buf[ICE_IMEM_NPKB_IDD])) >>
> + ICE_IMEM_NPKB_OFF);
> + ice_imem_pgkb_init(&ii->pg_kb,
> + *((u64 *)(&buf[ICE_IMEM_PGKB_IDD])) >>
> + ICE_IMEM_PGKB_OFF);
> +
> + ice_imem_alu_init(&ii->alu0,
> + &buf[ICE_IMEM_ALU0_IDD],
> + ICE_IMEM_ALU0_OFF);
> + ice_imem_alu_init(&ii->alu1,
> + &buf[ICE_IMEM_ALU1_IDD],
> + ICE_IMEM_ALU1_OFF);
> + ice_imem_alu_init(&ii->alu2,
> + &buf[ICE_IMEM_ALU2_IDD],
> + ICE_IMEM_ALU2_OFF);
> +}
> +
> +/**
> + * ice_imem_table_get - create an imem table
> + * @hw: pointer to the hardware structure
> + *
> + * Return: a pointer to the allocated IMEM table.
> + */
> +static struct ice_imem_item *ice_imem_table_get(struct ice_hw *hw)
> +{
> + return (struct ice_imem_item *)
> + ice_parser_create_table(hw, ICE_SID_RXPARSER_IMEM,
> + sizeof(struct ice_imem_item),
> + ICE_IMEM_TABLE_SIZE,
> + ice_imem_parse_item, false);
> +}
Or here.
And, likewise, for other similar calls to ice_parser_create_table().
...
next prev parent reply other threads:[~2024-07-22 14:52 UTC|newest]
Thread overview: 76+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-10 20:40 [Intel-wired-lan] [PATCH iwl-next v3 00/13] ice: iavf: add support for TC U32 filters on VFs Ahmed Zaki
2024-07-10 20:40 ` Ahmed Zaki
2024-07-10 20:40 ` [Intel-wired-lan] [PATCH iwl-next v3 01/13] ice: add parser create and destroy skeleton Ahmed Zaki
2024-07-10 20:40 ` Ahmed Zaki
2024-07-22 15:05 ` [Intel-wired-lan] " Simon Horman
2024-07-22 15:05 ` Simon Horman
2024-07-10 20:40 ` [Intel-wired-lan] [PATCH iwl-next v3 02/13] ice: parse and init various DDP parser sections Ahmed Zaki
2024-07-10 20:40 ` Ahmed Zaki
2024-07-11 5:28 ` [Intel-wired-lan] " Paul Menzel
2024-07-11 5:28 ` Paul Menzel
2024-07-15 14:16 ` Ahmed Zaki
2024-07-15 14:16 ` Ahmed Zaki
2024-07-22 14:52 ` Simon Horman [this message]
2024-07-22 14:52 ` Simon Horman
2024-07-10 20:40 ` [Intel-wired-lan] [PATCH iwl-next v3 03/13] ice: add debugging functions for the " Ahmed Zaki
2024-07-10 20:40 ` Ahmed Zaki
2024-07-22 14:53 ` [Intel-wired-lan] " Simon Horman
2024-07-22 14:53 ` Simon Horman
2024-07-24 16:19 ` [Intel-wired-lan] " Ahmed Zaki
2024-07-24 16:19 ` Ahmed Zaki
2024-07-10 20:40 ` [Intel-wired-lan] [PATCH iwl-next v3 04/13] ice: add parser internal helper functions Ahmed Zaki
2024-07-10 20:40 ` Ahmed Zaki
2024-07-22 15:06 ` [Intel-wired-lan] " Simon Horman
2024-07-22 15:06 ` Simon Horman
2024-07-10 20:40 ` [Intel-wired-lan] [PATCH iwl-next v3 05/13] ice: add parser execution main loop Ahmed Zaki
2024-07-10 20:40 ` Ahmed Zaki
2024-07-22 15:01 ` [Intel-wired-lan] " Simon Horman
2024-07-22 15:01 ` Simon Horman
2024-07-10 20:40 ` [Intel-wired-lan] [PATCH iwl-next v3 06/13] ice: support turning on/off the parser's double vlan mode Ahmed Zaki
2024-07-10 20:40 ` Ahmed Zaki
2024-07-22 15:02 ` [Intel-wired-lan] " Simon Horman
2024-07-22 15:02 ` Simon Horman
2024-07-10 20:40 ` [Intel-wired-lan] [PATCH iwl-next v3 07/13] ice: add UDP tunnels support to the parser Ahmed Zaki
2024-07-10 20:40 ` Ahmed Zaki
2024-07-22 15:06 ` [Intel-wired-lan] " Simon Horman
2024-07-22 15:06 ` Simon Horman
2024-07-22 15:10 ` [Intel-wired-lan] " Simon Horman
2024-07-22 15:10 ` Simon Horman
2024-07-10 20:40 ` [Intel-wired-lan] [PATCH iwl-next v3 08/13] ice: add API for parser profile initialization Ahmed Zaki
2024-07-10 20:40 ` Ahmed Zaki
2024-07-10 20:40 ` [Intel-wired-lan] [PATCH iwl-next v3 09/13] virtchnl: support raw packet in protocol header Ahmed Zaki
2024-07-10 20:40 ` Ahmed Zaki
2024-07-22 15:10 ` [Intel-wired-lan] " Simon Horman
2024-07-22 15:10 ` Simon Horman
2024-07-10 20:40 ` [Intel-wired-lan] [PATCH iwl-next v3 10/13] ice: add method to disable FDIR SWAP option Ahmed Zaki
2024-07-10 20:40 ` Ahmed Zaki
2024-07-11 4:59 ` [Intel-wired-lan] " Paul Menzel
2024-07-11 4:59 ` Paul Menzel
2024-07-15 14:23 ` Ahmed Zaki
2024-07-15 14:23 ` Ahmed Zaki
2024-07-17 9:55 ` Paul Menzel
2024-07-17 9:55 ` Paul Menzel
2024-07-18 16:54 ` Ahmed Zaki
2024-07-18 16:54 ` Ahmed Zaki
2024-07-10 20:40 ` [Intel-wired-lan] [PATCH iwl-next v3 11/13] ice: enable FDIR filters from raw binary patterns for VFs Ahmed Zaki
2024-07-10 20:40 ` Ahmed Zaki
2024-07-11 5:42 ` [Intel-wired-lan] " Paul Menzel
2024-07-11 5:42 ` Paul Menzel
2024-07-15 14:33 ` Ahmed Zaki
2024-07-15 14:33 ` Ahmed Zaki
2024-07-22 15:03 ` Simon Horman
2024-07-22 15:03 ` Simon Horman
2024-07-10 20:40 ` [Intel-wired-lan] [PATCH iwl-next v3 12/13] iavf: refactor add/del FDIR filters Ahmed Zaki
2024-07-10 20:40 ` Ahmed Zaki
2024-07-22 15:04 ` [Intel-wired-lan] " Simon Horman
2024-07-22 15:04 ` Simon Horman
2024-07-24 16:14 ` [Intel-wired-lan] " Ahmed Zaki
2024-07-24 16:14 ` Ahmed Zaki
2024-07-24 16:30 ` [Intel-wired-lan] " Simon Horman
2024-07-24 16:30 ` Simon Horman
2024-07-24 19:28 ` [Intel-wired-lan] " Ahmed Zaki
2024-07-24 19:28 ` Ahmed Zaki
2024-07-10 20:40 ` [Intel-wired-lan] [PATCH iwl-next v3 13/13] iavf: add support for offloading tc U32 cls filters Ahmed Zaki
2024-07-10 20:40 ` Ahmed Zaki
2024-07-22 15:05 ` [Intel-wired-lan] " Simon Horman
2024-07-22 15:05 ` Simon Horman
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=20240722145228.GF715661@kernel.org \
--to=horms@kernel.org \
--cc=ahmed.zaki@intel.com \
--cc=anthony.l.nguyen@intel.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=junfeng.guo@intel.com \
--cc=marcin.szycik@linux.intel.com \
--cc=netdev@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.