From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 068AA378E for ; Tue, 27 Oct 2015 18:32:02 +0100 (CET) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 27 Oct 2015 10:32:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,206,1444719600"; d="scan'208";a="836763172" Received: from irsmsx152.ger.corp.intel.com ([163.33.192.66]) by fmsmga002.fm.intel.com with ESMTP; 27 Oct 2015 10:32:01 -0700 Received: from irsmsx156.ger.corp.intel.com (10.108.20.68) by IRSMSX152.ger.corp.intel.com (163.33.192.66) with Microsoft SMTP Server (TLS) id 14.3.248.2; Tue, 27 Oct 2015 17:32:00 +0000 Received: from irsmsx104.ger.corp.intel.com ([169.254.5.150]) by IRSMSX156.ger.corp.intel.com ([169.254.3.245]) with mapi id 14.03.0248.002; Tue, 27 Oct 2015 17:32:00 +0000 From: "Traynor, Kevin" To: "Ananyev, Konstantin" , "Richardson, Bruce" Thread-Topic: [dpdk-dev] [PATCH] ixgbe: change logging for ixgbe tx code path selection Thread-Index: AQHREK24h59Yae8S2kib7yWCyFlPAZ5/QDCAgABLuOA= Date: Tue, 27 Oct 2015 17:31:59 +0000 Message-ID: References: <1445946068-28183-1-git-send-email-kevin.traynor@intel.com> <20151027115003.GA7500@bricha3-MOBL3> <2601191342CEEE43887BDE71AB97725836AB5666@irsmsx105.ger.corp.intel.com> In-Reply-To: <2601191342CEEE43887BDE71AB97725836AB5666@irsmsx105.ger.corp.intel.com> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.182] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] [PATCH] ixgbe: change logging for ixgbe tx code path selection 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: Tue, 27 Oct 2015 17:32:03 -0000 > -----Original Message----- > From: Ananyev, Konstantin > Sent: Tuesday, October 27, 2015 12:13 PM > To: Richardson, Bruce; Traynor, Kevin > Cc: dev@dpdk.org > Subject: RE: [dpdk-dev] [PATCH] ixgbe: change logging for ixgbe tx code p= ath > selection >=20 >=20 >=20 > > -----Original Message----- > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Bruce Richardson > > Sent: Tuesday, October 27, 2015 11:50 AM > > To: Traynor, Kevin > > Cc: dev@dpdk.org > > Subject: Re: [dpdk-dev] [PATCH] ixgbe: change logging for ixgbe tx code > path selection > > > > On Tue, Oct 27, 2015 at 11:41:08AM +0000, Kevin Traynor wrote: > > > Simple and vector are different tx code paths. If vector > > > is selected, change logging from: > > > PMD: ixgbe_set_tx_function(): Using simple tx code path > > > PMD: ixgbe_set_tx_function(): Vector tx enabled. > > > > > > to: > > > PMD: ixgbe_set_tx_function(): Using vector tx code path > > > > > > or, if simple selected: > > > PMD: ixgbe_set_tx_function(): Using simple tx code path > > > > > > The dangling else in the #ifdef makes readability difficult, > > > so resolving in way that seems most readable. > > > > > > Signed-off-by: Kevin Traynor > > > --- > > > drivers/net/ixgbe/ixgbe_rxtx.c | 8 +++++--- > > > 1 files changed, 5 insertions(+), 3 deletions(-) > > > > > > diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c > b/drivers/net/ixgbe/ixgbe_rxtx.c > > > index a598a72..11d7feb 100644 > > > --- a/drivers/net/ixgbe/ixgbe_rxtx.c > > > +++ b/drivers/net/ixgbe/ixgbe_rxtx.c > > > @@ -1963,16 +1963,18 @@ ixgbe_set_tx_function(struct rte_eth_dev *dev= , > struct ixgbe_tx_queue *txq) > > > /* Use a simple Tx queue (no offloads, no multi segs) if possible *= / > > > if (((txq->txq_flags & IXGBE_SIMPLE_FLAGS) =3D=3D IXGBE_SIMPLE_FLAG= S) > > > && (txq->tx_rs_thresh >=3D RTE_PMD_IXGBE_TX_MAX_BURST)) { > > > - PMD_INIT_LOG(DEBUG, "Using simple tx code path"); > > > #ifdef RTE_IXGBE_INC_VECTOR > > > if (txq->tx_rs_thresh <=3D RTE_IXGBE_TX_MAX_FREE_BUF_SZ && > > > (rte_eal_process_type() !=3D RTE_PROC_PRIMARY || > > > ixgbe_txq_vec_setup(txq) =3D=3D 0)) { > > > - PMD_INIT_LOG(DEBUG, "Vector tx enabled."); > > > + PMD_INIT_LOG(DEBUG, "Using vector tx code path"); > > > dev->tx_pkt_burst =3D ixgbe_xmit_pkts_vec; > > > } else > > > #endif > > > - dev->tx_pkt_burst =3D ixgbe_xmit_pkts_simple; > > > + { > > > + PMD_INIT_LOG(DEBUG, "Using simple tx code path"); > > > + dev->tx_pkt_burst =3D ixgbe_xmit_pkts_simple; > > > + } > > > } else { > > > PMD_INIT_LOG(DEBUG, "Using full-featured tx code path"); > > > PMD_INIT_LOG(DEBUG, > > > -- > > > 1.7.4.1 > > > > > Hi Kevin, > > > > can I suggest a slight alternative here that might help make things eas= ier. > > Instead of printing the message as we pick the code path, why not have = a > "logmsg" > > pointer variable that is assigned in the code, and then print out the l= og > path > > at the end. > > > > This would have a number of advantages: > > 1. there are no issues with changing our mind, so we can assign one pat= h > type, > > and then later change it to something different without cluttering up t= he > debug > > output with the history of our code's flow. > > 2. it means that you don't have a problem with smaller else legs as you= can > > easily do multiple assignments in the one line using a comma as: > > dev->tx_pkt_burst =3D ixgbe_xmit_pkts_simple, logmsg =3D "Using simple > ..."; >=20 > While I like approach with logmsg, please avoid commas here. > It will make this peace of code even more hard to read (at least for me). > Konstantin yeah, sure. I agree with changing for 1. I also agree with Konstantin re co= mmas. The code under the dangling else is aligned incorrectly/correctly depending= on whether the #ifdef is true or not, so I think adding multiple statements wi= th {} now will make it obvious for the next person who modifies. >=20 > > > > Regards, > > /Bruce