From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 08536A0C4C; Tue, 21 Sep 2021 14:51:48 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 78F4B40683; Tue, 21 Sep 2021 14:51:47 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id 306A14003C for ; Tue, 21 Sep 2021 14:51:43 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10113"; a="221459359" X-IronPort-AV: E=Sophos;i="5.85,311,1624345200"; d="scan'208";a="221459359" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Sep 2021 05:51:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,311,1624345200"; d="scan'208";a="701671071" Received: from fmsmsx605.amr.corp.intel.com ([10.18.126.85]) by fmsmga006.fm.intel.com with ESMTP; 21 Sep 2021 05:51:41 -0700 Received: from shsmsx606.ccr.corp.intel.com (10.109.6.216) by fmsmsx605.amr.corp.intel.com (10.18.126.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Tue, 21 Sep 2021 05:51:41 -0700 Received: from shsmsx601.ccr.corp.intel.com (10.109.6.141) by SHSMSX606.ccr.corp.intel.com (10.109.6.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Tue, 21 Sep 2021 20:51:39 +0800 Received: from shsmsx601.ccr.corp.intel.com ([10.109.6.141]) by SHSMSX601.ccr.corp.intel.com ([10.109.6.141]) with mapi id 15.01.2242.012; Tue, 21 Sep 2021 20:51:39 +0800 From: "Zhang, Qi Z" To: "Yang, Qiming" CC: "Guo, Junfeng" , "dev@dpdk.org" Thread-Topic: [PATCH v2 02/20] net/ice/base: init imem table for parser Thread-Index: AQHXq9HxEKu+qIQGXkGWSsxQ35J736uudebA Date: Tue, 21 Sep 2021 12:51:38 +0000 Message-ID: <62531e2de0324d61a941dfb4da6331ac@intel.com> References: <20210917144322.3141886-1-qi.z.zhang@intel.com> <20210917144322.3141886-3-qi.z.zhang@intel.com> In-Reply-To: <20210917144322.3141886-3-qi.z.zhang@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-reaction: no-action dlp-version: 11.6.200.16 dlp-product: dlpe-windows x-originating-ip: [10.239.127.36] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v2 02/20] net/ice/base: init imem table for parser X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" > -----Original Message----- > From: Zhang, Qi Z > Sent: Friday, September 17, 2021 10:43 PM > To: Yang, Qiming > Cc: Guo, Junfeng ; dev@dpdk.org; Zhang, Qi Z > > Subject: [PATCH v2 02/20] net/ice/base: init imem table for parser >=20 > Parse DDP section ICE_SID_RXPARSER_IMEM into an array of struct > ice_imem_item. >=20 > Signed-off-by: Qi Zhang > --- ..... > +/** > + * ice_parser_sect_item_get - parse a item from a section > + * @sect_type: section type > + * @section: section object > + * @index: index of the item to get > + * @offset: dummy as prototype of ice_pkg_enum_entry's last parameter > +*/ void *ice_parser_sect_item_get(u32 sect_type, void *section, > + u32 index, u32 *offset) > +{ > + struct ice_pkg_sect_hdr *hdr; > + int data_off =3D ICE_SEC_DATA_OFFSET; > + int size; > + > + if (!section) > + return NULL; > + > + switch (sect_type) { > + case ICE_SID_RXPARSER_IMEM: > + size =3D ICE_SID_RXPARSER_IMEM_ENTRY_SIZE; > + break; > + default: > + return NULL; > + } > + > + hdr =3D (struct ice_pkg_sect_hdr *)section; > + if (index >=3D LE16_TO_CPU(hdr->count)) > + return NULL; > + > + return (void *)((u64)section + data_off + index * size); } Compile warning for 32bit, replace u64 with uintptr_t=20 > + > +/** > + * ice_parser_create_table - create a 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 > + * @item_get: the function will be parsed to ice_pkg_enum_entry > + * @parser_item: the function to parse the item */ void > +*ice_parser_create_table(struct ice_hw *hw, u32 sect_type, > + u32 item_size, u32 length, > + void *(*item_get)(u32 sect_type, void *section, > + u32 index, u32 *offset), > + void (*parse_item)(struct ice_hw *hw, u16 idx, > + void *item, void *data, > + int size)) > +{ > + struct ice_seg *seg =3D hw->seg; > + struct ice_pkg_enum state; > + u16 idx =3D 0; > + void *table; > + void *data; > + > + if (!seg) > + return NULL; > + > + table =3D ice_malloc(hw, item_size * length); > + if (!table) { > + ice_debug(hw, ICE_DBG_PARSER, "failed to allocate memory for > table type %d.\n", > + sect_type); > + return NULL; > + } > + > + ice_memset(&state, 0, sizeof(state), ICE_NONDMA_MEM); > + do { > + data =3D ice_pkg_enum_entry(seg, &state, sect_type, NULL, > + item_get); > + seg =3D NULL; > + if (data) { > + struct ice_pkg_sect_hdr *hdr =3D > + (struct ice_pkg_sect_hdr *)state.sect; > + > + idx =3D hdr->offset + state.entry_idx; > + parse_item(hw, idx, > + (void *)((u64)table + idx * item_size), Same issue as above. Will fix during apply.