From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B6F40A0A06 for ; Wed, 20 Jan 2021 06:55:33 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id ACE56140E06; Wed, 20 Jan 2021 06:55:33 +0100 (CET) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id 7F9E6140DEA; Wed, 20 Jan 2021 06:55:30 +0100 (CET) IronPort-SDR: JCkxMA08bczviQSUOltp61OjaKa8a9YpjnaRDMwRgktrnUKgpJYbJUwKv4isr9vUFbpnhLJ3vu qctpYdbiYLMA== X-IronPort-AV: E=McAfee;i="6000,8403,9869"; a="197773368" X-IronPort-AV: E=Sophos;i="5.79,360,1602572400"; d="scan'208";a="197773368" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jan 2021 21:55:29 -0800 IronPort-SDR: 0EeNjw/hOLMoRKd0v7JzA7wB3lDqmbKpqCxaMMjZKN9HRT3F47V8t35yXRLii6/vseBpXpsxe6 UTtym+fr+f3g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,360,1602572400"; d="scan'208";a="354212141" Received: from fmsmsx605.amr.corp.intel.com ([10.18.126.85]) by orsmga006.jf.intel.com with ESMTP; 19 Jan 2021 21:55:28 -0800 Received: from shsmsx606.ccr.corp.intel.com (10.109.6.216) by fmsmsx605.amr.corp.intel.com (10.18.126.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Tue, 19 Jan 2021 21:55:28 -0800 Received: from shsmsx601.ccr.corp.intel.com (10.109.6.141) by SHSMSX606.ccr.corp.intel.com (10.109.6.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Wed, 20 Jan 2021 13:55:26 +0800 Received: from shsmsx601.ccr.corp.intel.com ([10.109.6.141]) by SHSMSX601.ccr.corp.intel.com ([10.109.6.141]) with mapi id 15.01.1713.004; Wed, 20 Jan 2021 13:55:26 +0800 From: "Guo, Jia" To: "Wu, Wenjun1" , "dev@dpdk.org" CC: "stable@dpdk.org" Thread-Topic: [PATCH v1] net/e1000: fix the invalid flow control mode setting Thread-Index: AQHW7urrTVqi40FYaEyTbr5gl1blRKov+tew Date: Wed, 20 Jan 2021 05:55:26 +0000 Message-ID: <1b9beb50baac466083da3bca87cb778c@intel.com> References: <20210120045859.211284-1-wenjun1.wu@intel.com> In-Reply-To: <20210120045859.211284-1-wenjun1.wu@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.5.1.3 x-originating-ip: [10.239.127.36] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-stable] [PATCH v1] net/e1000: fix the invalid flow control mode setting X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, wenjun > -----Original Message----- > From: Wu, Wenjun1 > Sent: Wednesday, January 20, 2021 12:59 PM > To: dev@dpdk.org; Guo, Jia > Cc: Wu, Wenjun1 ; stable@dpdk.org > Subject: [PATCH v1] net/e1000: fix the invalid flow control mode setting >=20 > E1000_CTRL register should be updated according to fc_conf->mode's value. >=20 > Fixes: af75078fece3 ("first public release") > Cc: stable@dpdk.org >=20 > Signed-off-by: Wenjun Wu > --- > drivers/net/e1000/igb_ethdev.c | 32 > ++++++++++++++++++++++++++++++++ > 1 file changed, 32 insertions(+) >=20 > diff --git a/drivers/net/e1000/igb_ethdev.c > b/drivers/net/e1000/igb_ethdev.c index 647aa8d99..8fecd657d 100644 > --- a/drivers/net/e1000/igb_ethdev.c > +++ b/drivers/net/e1000/igb_ethdev.c > @@ -3064,6 +3064,7 @@ eth_igb_flow_ctrl_set(struct rte_eth_dev *dev, > struct rte_eth_fc_conf *fc_conf) > uint32_t rx_buf_size; > uint32_t max_high_water; > uint32_t rctl; > + uint32_t ctrl; >=20 > hw =3D E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private); > if (fc_conf->autoneg !=3D hw->mac.autoneg) @@ -3101,6 +3102,37 > @@ eth_igb_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf > *fc_conf) > rctl &=3D ~E1000_RCTL_PMCF; >=20 > E1000_WRITE_REG(hw, E1000_RCTL, rctl); > + > + /* check if we want to change flow control mode - driver > doesn't have native > + * capability to do that, so we'll write the registers ourselves > */ No need the blank line with the code block which be explain by the doc, and= please considerate the format for multiple line, like that: /* * XXXXX * XXXXX */ > + > + ctrl =3D E1000_READ_REG(hw, E1000_CTRL); > + > + /* set or clear E1000_CTRL_RFCE and E1000_CTRL_TFCE bits > depending > + * on configuration */ > + Ditto. > + switch (fc_conf->mode) { > + case RTE_FC_NONE: > + ctrl &=3D ~E1000_CTRL_RFCE & ~E1000_CTRL_TFCE; > + break; > + case RTE_FC_RX_PAUSE: > + ctrl |=3D E1000_CTRL_RFCE; > + ctrl &=3D ~E1000_CTRL_TFCE; > + break; > + case RTE_FC_TX_PAUSE: > + ctrl |=3D E1000_CTRL_TFCE; > + ctrl &=3D ~E1000_CTRL_RFCE; > + break; > + case RTE_FC_FULL: > + ctrl |=3D E1000_CTRL_RFCE | E1000_CTRL_TFCE; > + break; > + default: > + PMD_INIT_LOG(ERR, "invalid flow control mode"); > + return -EIO; Would be better if use "-EINVAL" for the meaning of invalid configure mode? > + } > + > + E1000_WRITE_REG(hw, E1000_CTRL, ctrl); > + > E1000_WRITE_FLUSH(hw); >=20 > return 0; > -- > 2.25.1