From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id C016FA04EF;
	Wed,  3 Jun 2020 04:40:44 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 2EDAD1D15F;
	Wed,  3 Jun 2020 04:37:16 +0200 (CEST)
Received: from mga11.intel.com (mga11.intel.com [192.55.52.93])
 by dpdk.org (Postfix) with ESMTP id 114811D148
 for <dev@dpdk.org>; Wed,  3 Jun 2020 04:37:14 +0200 (CEST)
IronPort-SDR: JaA/yaB3wnMYlLDnat05riPKTdTK+6RboH6C/LcJ7LCxqlNZW8XG4pUdwvNrOM7T8MPIqbpWME
 3xtMPlOec+SA==
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from orsmga001.jf.intel.com ([10.7.209.18])
 by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;
 02 Jun 2020 19:37:14 -0700
IronPort-SDR: 0YkpgaOJ6vMJH2JGHEgqrHB2PsBcLrrrNQoFkMsZ7GNp44ZoNoRykYisMJrh+eCLrKHIwkJMjP
 /i27G63SoZ1A==
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.73,466,1583222400"; d="scan'208";a="347614084"
Received: from dpdk51.sh.intel.com ([10.67.111.82])
 by orsmga001.jf.intel.com with ESMTP; 02 Jun 2020 19:37:12 -0700
From: Qi Zhang <qi.z.zhang@intel.com>
To: qiming.yang@intel.com
Cc: dev@dpdk.org, xiaolong.ye@intel.com, Qi Zhang <qi.z.zhang@intel.com>,
 Jacob Keller <jacob.e.keller@intel.com>,
 "Paul M . Stillwell Jr" <paul.m.stillwell.jr@intel.com>
Date: Wed,  3 Jun 2020 10:39:50 +0800
Message-Id: <20200603024016.30636-27-qi.z.zhang@intel.com>
X-Mailer: git-send-email 2.13.6
In-Reply-To: <20200603024016.30636-1-qi.z.zhang@intel.com>
References: <20200603024016.30636-1-qi.z.zhang@intel.com>
Subject: [dpdk-dev] [PATCH 26/52] net/ice/base: use macro for sizeof
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

The definition of ICE_SW_RULE_RX_TX_ETH_HDR_SIZE open codes the size of
a structure field. Replace this with the use of FIELD_SIZEOF.

Signed-off-by: Jacob Keller <jacob.e.keller@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.h | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ice/base/ice_switch.h b/drivers/net/ice/base/ice_switch.h
index 7317d17ef..8c7e98bfa 100644
--- a/drivers/net/ice/base/ice_switch.h
+++ b/drivers/net/ice/base/ice_switch.h
@@ -32,24 +32,24 @@
 #define DUMMY_ETH_HDR_LEN		16
 #define ICE_SW_RULE_RX_TX_ETH_HDR_SIZE \
 	(sizeof(struct ice_aqc_sw_rules_elem) - \
-	 sizeof(((struct ice_aqc_sw_rules_elem *)0)->pdata) + \
+	 FIELD_SIZEOF(struct ice_aqc_sw_rules_elem, pdata) + \
 	 sizeof(struct ice_sw_rule_lkup_rx_tx) + DUMMY_ETH_HDR_LEN - 1)
 #define ICE_SW_RULE_RX_TX_NO_HDR_SIZE \
 	(sizeof(struct ice_aqc_sw_rules_elem) - \
-	 sizeof(((struct ice_aqc_sw_rules_elem *)0)->pdata) + \
+	 FIELD_SIZEOF(struct ice_aqc_sw_rules_elem, pdata) + \
 	 sizeof(struct ice_sw_rule_lkup_rx_tx) - 1)
 #define ICE_SW_RULE_LG_ACT_SIZE(n) \
 	(sizeof(struct ice_aqc_sw_rules_elem) - \
-	 sizeof(((struct ice_aqc_sw_rules_elem *)0)->pdata) + \
+	 FIELD_SIZEOF(struct ice_aqc_sw_rules_elem, pdata) + \
 	 sizeof(struct ice_sw_rule_lg_act) - \
-	 sizeof(((struct ice_sw_rule_lg_act *)0)->act) + \
-	 ((n) * sizeof(((struct ice_sw_rule_lg_act *)0)->act)))
+	 FIELD_SIZEOF(struct ice_sw_rule_lg_act, act) + \
+	 ((n) * FIELD_SIZEOF(struct ice_sw_rule_lg_act, act)))
 #define ICE_SW_RULE_VSI_LIST_SIZE(n) \
 	(sizeof(struct ice_aqc_sw_rules_elem) - \
-	 sizeof(((struct ice_aqc_sw_rules_elem *)0)->pdata) + \
+	 FIELD_SIZEOF(struct ice_aqc_sw_rules_elem, pdata) + \
 	 sizeof(struct ice_sw_rule_vsi_list) - \
-	 sizeof(((struct ice_sw_rule_vsi_list *)0)->vsi) + \
-	 ((n) * sizeof(((struct ice_sw_rule_vsi_list *)0)->vsi)))
+	 FIELD_SIZEOF(struct ice_sw_rule_vsi_list, vsi) + \
+	 ((n) * FIELD_SIZEOF(struct ice_sw_rule_vsi_list, vsi)))
 
 /* Worst case buffer length for ice_aqc_opc_get_res_alloc */
 #define ICE_MAX_RES_TYPES 0x80
@@ -490,5 +490,4 @@ ice_replay_vsi_all_fltr(struct ice_hw *hw, struct ice_port_info *pi,
 void ice_rm_sw_replay_rule_info(struct ice_hw *hw, struct ice_switch_info *sw);
 void ice_rm_all_sw_replay_rule_info(struct ice_hw *hw);
 bool ice_is_prof_rule(enum ice_sw_tunnel_type type);
-
 #endif /* _ICE_SWITCH_H_ */
-- 
2.13.6