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 1C22DA0093; Mon, 15 Jun 2020 04:05:56 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D06921BFB2; Mon, 15 Jun 2020 04:02:23 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 4A2EB1BF7B for ; Mon, 15 Jun 2020 04:02:14 +0200 (CEST) IronPort-SDR: N6BKyIQAaSO02qorLziPN3MjUzLwTi6d450rWFoqb+PS00jKu/uPmO/lCEwwI+sHvJ2bOLAx/I TLTpTFyPBRpA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jun 2020 19:02:13 -0700 IronPort-SDR: tp58036Mn8qAzfEBedCQ8KdfYhrLtLtSu5HdEDtgq5rXi3CbRt4oXDeo1Mca0kdSKqfzja+pVj 4TEsY7GDtewQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,513,1583222400"; d="scan'208";a="298319060" Received: from dpdk51.sh.intel.com ([10.67.111.82]) by fmsmga004.fm.intel.com with ESMTP; 14 Jun 2020 19:02:12 -0700 From: Qi Zhang To: ferruh.yigit@intel.com Cc: xiaolong.ye@intel.com, qiming.yang@intel.com, dev@dpdk.org, Qi Zhang , Jacob Keller , "Paul M . Stillwell Jr" Date: Mon, 15 Jun 2020 10:04:48 +0800 Message-Id: <20200615020515.1359-27-qi.z.zhang@intel.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20200615020515.1359-1-qi.z.zhang@intel.com> References: <20200603024016.30636-1-qi.z.zhang@intel.com> <20200615020515.1359-1-qi.z.zhang@intel.com> Subject: [dpdk-dev] [PATCH v3 26/53] 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 Signed-off-by: Paul M. Stillwell Jr Signed-off-by: Qi Zhang --- 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