From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 1F363376C; Thu, 10 Aug 2017 17:15:35 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5B3402C96CF; Thu, 10 Aug 2017 15:15:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 5B3402C96CF Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=ktraynor@redhat.com Received: from ktraynor.remote.csb (ovpn-116-201.ams2.redhat.com [10.36.116.201]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2CC047E2E9; Thu, 10 Aug 2017 15:15:32 +0000 (UTC) To: Qi Zhang , jingjing.wu@intel.com References: <20170810104807.59436-1-qi.z.zhang@intel.com> Cc: dev@dpdk.org, stable@dpdk.org From: Kevin Traynor Organization: Red Hat Message-ID: Date: Thu, 10 Aug 2017 16:15:32 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20170810104807.59436-1-qi.z.zhang@intel.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 10 Aug 2017 15:15:34 +0000 (UTC) Subject: Re: [dpdk-dev] [PATCH] net/i40e: fix flow control watermark mismatch 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: , X-List-Received-Date: Thu, 10 Aug 2017 15:15:36 -0000 On 08/10/2017 11:48 AM, Qi Zhang wrote: > Flow control watermark is not read out correctly, > that may cause an application who not intend to change > watermark but does change it with a rte_eth_dev_flow_ctrl_set > call right after rte_eth_dev_flow_ctrl_get. > > Fixes: f53577f06925 ("i40e: support flow control") > Cc: stable@dpdk.org > > Signed-off-by: Qi Zhang > --- > drivers/net/i40e/i40e_ethdev.c | 19 +++++++++++++------ > 1 file changed, 13 insertions(+), 6 deletions(-) > > diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c > index 71cb7d3..8b008c4 100644 > --- a/drivers/net/i40e/i40e_ethdev.c > +++ b/drivers/net/i40e/i40e_ethdev.c > @@ -86,12 +86,6 @@ > /* Flow control default timer */ > #define I40E_DEFAULT_PAUSE_TIME 0xFFFFU > > -/* Flow control default high water */ > -#define I40E_DEFAULT_HIGH_WATER (0x1C40/1024) > - > -/* Flow control default low water */ > -#define I40E_DEFAULT_LOW_WATER (0x1A40/1024) > - > /* Flow control enable fwd bit */ > #define I40E_PRTMAC_FWD_CTRL 0x00000001 > > @@ -101,6 +95,12 @@ > /* Kilobytes shift */ > #define I40E_KILOSHIFT 10 > > +/* Flow control default high water */ > +#define I40E_DEFAULT_HIGH_WATER (0xF2000 >> I40E_KILOSHIFT) > + > +/* Flow control default low water */ > +#define I40E_DEFAULT_LOW_WATER (0xF2000 >> I40E_KILOSHIFT) > + I'm not sure these are needed anymore. Would seem if you want a correct value prior to flow_ctl_get() being called, the registers should also be read during init. Is there a need for the PMD to have the correct value prior to flow_ctrl_get() ? I didn't see one. > /* Receive Average Packet Size in Byte*/ > #define I40E_PACKET_AVERAGE_SIZE 128 > > @@ -3199,6 +3199,13 @@ i40e_flow_ctrl_get(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) > struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); > > fc_conf->pause_time = pf->fc_conf.pause_time; > + > + /* read out from register, in case they are modified by other port */ > + pf->fc_conf.high_water[I40E_MAX_TRAFFIC_CLASS] = > + I40E_READ_REG(hw, I40E_GLRPB_GHW) >> I40E_KILOSHIFT; > + pf->fc_conf.low_water[I40E_MAX_TRAFFIC_CLASS] = > + I40E_READ_REG(hw, I40E_GLRPB_GLW) >> I40E_KILOSHIFT; > + > fc_conf->high_water = pf->fc_conf.high_water[I40E_MAX_TRAFFIC_CLASS]; > fc_conf->low_water = pf->fc_conf.low_water[I40E_MAX_TRAFFIC_CLASS]; > >