From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 09BB15942 for ; Thu, 28 Aug 2014 18:01:58 +0200 (CEST) Received: from azsmga001.ch.intel.com ([10.2.17.19]) by orsmga102.jf.intel.com with ESMTP; 28 Aug 2014 08:37:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,418,1406617200"; d="scan'208";a="473512672" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by azsmga001.ch.intel.com with ESMTP; 28 Aug 2014 08:42:40 -0700 Received: from sivswdev02.ir.intel.com (sivswdev02.ir.intel.com [10.237.217.46]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id s7SFge0q024767; Thu, 28 Aug 2014 16:42:40 +0100 Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id s7SFgeY9014767; Thu, 28 Aug 2014 16:42:40 +0100 Received: (from bricha3@localhost) by sivswdev02.ir.intel.com with id s7SFgeOD014763; Thu, 28 Aug 2014 16:42:40 +0100 From: Bruce Richardson To: dev@dpdk.org Date: Thu, 28 Aug 2014 16:42:34 +0100 Message-Id: <1409240559-14447-2-git-send-email-bruce.richardson@intel.com> X-Mailer: git-send-email 1.7.0.7 In-Reply-To: <1409154628-30825-1-git-send-email-bruce.richardson@intel.com> References: <1409154628-30825-1-git-send-email-bruce.richardson@intel.com> Subject: [dpdk-dev] [PATCH v2 1/6] ixgbe: put only non-zero initializer in definition X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Aug 2014 16:01:59 -0000 Since all unspecified fields in an initializer are assumed to be zero we can simplify the empty mbuf definition in the vector driver to only use the fields that are non-zero, i.e. just nb_segs = 1. This makes things shorter and means that the structure doesn't need as many updates for other fields being renamed or moved. The variable itself is never modified and only used by a single function so it can be made const and local to the using function. Changes in v2: * None Signed-off-by: Bruce Richardson --- lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c | 29 +++++------------------------ 1 file changed, 5 insertions(+), 24 deletions(-) diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c b/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c index 92e07de..56dce23 100644 --- a/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c +++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c @@ -44,33 +44,14 @@ #pragma GCC diagnostic ignored "-Wcast-qual" #endif -static struct rte_mbuf mb_def = { - - .ol_flags = 0, - { - .pkt = { - .data_len = 0, - .pkt_len = 0, - - .vlan_macip = { - .data = 0, - }, - .hash = { - .rss = 0, - }, - - .nb_segs = 1, - .in_port = 0, - - .next = NULL, - .data = NULL, - }, - }, -}; - static inline void ixgbe_rxq_rearm(struct igb_rx_queue *rxq) { + static const struct rte_mbuf mb_def = { + .pkt = { + .nb_segs = 1, + }, + }; int i; uint16_t rx_id; volatile union ixgbe_adv_rx_desc *rxdp; -- 1.9.3