[v5,10/30] net/ice/base: minor structure refactor
diff mbox series

Message ID 20190923074448.7847-11-qi.z.zhang@intel.com
State Accepted, archived
Delegated to: xiaolong ye
Headers show
Series
  • net/ice/base: share code update secend batch.
Related show

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Zhang, Qi Z Sept. 23, 2019, 7:44 a.m. UTC
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 <jesse.brandeburg@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/ice/base/ice_switch.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

Patch
diff mbox series

diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c
index 688584563..250f664b2 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 }
 };
 
 /**