From patchwork Wed Aug 27 15:50:23 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 252 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 6F44BB379 for ; Wed, 27 Aug 2014 17:46:42 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 27 Aug 2014 08:50:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,412,1406617200"; d="scan'208";a="590649274" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga002.fm.intel.com with ESMTP; 27 Aug 2014 08:50:29 -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 s7RFoSfX026035; Wed, 27 Aug 2014 16:50:29 +0100 Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id s7RFoSuh031296; Wed, 27 Aug 2014 16:50:28 +0100 Received: (from bricha3@localhost) by sivswdev02.ir.intel.com with id s7RFoSTJ031292; Wed, 27 Aug 2014 16:50:28 +0100 From: Bruce Richardson To: dev@dpdk.org Date: Wed, 27 Aug 2014 16:50:23 +0100 Message-Id: <1409154628-30825-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 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: Wed, 27 Aug 2014 15:46:42 -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. 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;