From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 550C8A2EDB for ; Sat, 7 Sep 2019 05:15:23 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E31CB1F4E4; Sat, 7 Sep 2019 05:14:23 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 4CCD71F47A for ; Sat, 7 Sep 2019 05:14:05 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Sep 2019 20:14:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,474,1559545200"; d="scan'208";a="191006854" Received: from dpdk51.sh.intel.com ([10.67.110.245]) by FMSMGA003.fm.intel.com with ESMTP; 06 Sep 2019 20:14:03 -0700 From: Qi Zhang To: wenzhuo.lu@intel.com, qiming.yang@intel.com Cc: dev@dpdk.org, xiaolong.ye@intel.com, Qi Zhang , Jesse Brandeburg , Paul M Stillwell Jr Date: Sat, 7 Sep 2019 11:16:17 +0800 Message-Id: <20190907031629.34666-11-qi.z.zhang@intel.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20190907031629.34666-1-qi.z.zhang@intel.com> References: <20190902035551.16852-1-qi.z.zhang@intel.com> <20190907031629.34666-1-qi.z.zhang@intel.com> Subject: [dpdk-dev] [PATCH v3 10/22] net/ice/base: minor structure refactor X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" When declaring the ice_prot_ext, and ice_prot_id_tbl structure, we can use a fixed length array instead of a variable length one which helps us catch future code changes that might desynchronize the enum ice_protocol_type and the structs. This change also necessitates removing the last member of the structs which was just there to be a placeholder. Also reorder the ice_prot_ext struct to match the ordering in the associated enum ice_protocol_type. Signed-off-by: Jesse Brandeburg Signed-off-by: Paul M Stillwell Jr Signed-off-by: Qi Zhang --- drivers/net/ice/base/ice_switch.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c index 477500ce5..aab0ff07f 100644 --- a/drivers/net/ice/base/ice_switch.c +++ b/drivers/net/ice/base/ice_switch.c @@ -4631,17 +4631,17 @@ ice_add_mac_with_counter(struct ice_hw *hw, struct ice_fltr_info *f_info) * matching entry describing its field. This needs to be updated if new * structure is added to that union. */ -static const struct ice_prot_ext_tbl_entry ice_prot_ext[] = { +static const struct ice_prot_ext_tbl_entry ice_prot_ext[ICE_PROTOCOL_LAST] = { { ICE_MAC_OFOS, { 0, 2, 4, 6, 8, 10, 12 } }, { ICE_MAC_IL, { 0, 2, 4, 6, 8, 10, 12 } }, { ICE_ETYPE_OL, { 0 } }, { ICE_VLAN_OFOS, { 0, 2 } }, { ICE_IPV4_OFOS, { 0, 2, 4, 6, 8, 10, 12, 14, 16, 18 } }, { ICE_IPV4_IL, { 0, 2, 4, 6, 8, 10, 12, 14, 16, 18 } }, - { ICE_IPV6_IL, { 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, - 26, 28, 30, 32, 34, 36, 38 } }, { ICE_IPV6_OFOS, { 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38 } }, + { ICE_IPV6_IL, { 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, + 26, 28, 30, 32, 34, 36, 38 } }, { ICE_TCP_IL, { 0, 2 } }, { ICE_UDP_OF, { 0, 2 } }, { ICE_UDP_ILOS, { 0, 2 } }, @@ -4652,7 +4652,6 @@ static const struct ice_prot_ext_tbl_entry ice_prot_ext[] = { { ICE_NVGRE, { 0, 2, 4, 6 } }, { ICE_GTP, { 8, 10, 12, 14, 16, 18, 20 } }, { ICE_PPPOE, { 0, 2, 4, 6 } }, - { ICE_PROTOCOL_LAST, { 0 } } }; /* The following table describes preferred grouping of recipes. @@ -4661,7 +4660,7 @@ static const struct ice_prot_ext_tbl_entry ice_prot_ext[] = { * following policy. */ -static const struct ice_protocol_entry ice_prot_id_tbl[] = { +static const struct ice_protocol_entry ice_prot_id_tbl[ICE_PROTOCOL_LAST] = { { ICE_MAC_OFOS, ICE_MAC_OFOS_HW }, { ICE_MAC_IL, ICE_MAC_IL_HW }, { ICE_ETYPE_OL, ICE_ETYPE_OL_HW }, @@ -4680,7 +4679,6 @@ static const struct ice_protocol_entry ice_prot_id_tbl[] = { { ICE_NVGRE, ICE_GRE_OF_HW }, { ICE_GTP, ICE_UDP_OF_HW }, { ICE_PPPOE, ICE_PPPOE_HW }, - { ICE_PROTOCOL_LAST, 0 } }; /** -- 2.13.6