From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 0CC39F618 for ; Mon, 19 Dec 2016 11:24:17 +0100 (CET) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga105.fm.intel.com with ESMTP; 19 Dec 2016 02:24:16 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,373,1477983600"; d="scan'208";a="204451255" Received: from fyigit-mobl1.ger.corp.intel.com (HELO [10.237.220.29]) ([10.237.220.29]) by fmsmga004.fm.intel.com with ESMTP; 19 Dec 2016 02:24:15 -0800 To: Alejandro Lucero , dev@dpdk.org References: <1481908242-845-1-git-send-email-alejandro.lucero@netronome.com> From: Ferruh Yigit Message-ID: <724e9785-3499-ac5a-bf7a-8093a649780c@intel.com> Date: Mon, 19 Dec 2016 10:24:14 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <1481908242-845-1-git-send-email-alejandro.lucero@netronome.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v4] nfp: report link speed using hardware info 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: Mon, 19 Dec 2016 10:24:18 -0000 On 12/16/2016 5:10 PM, Alejandro Lucero wrote: > Previous reported speed was hardcoded because there was not firmware > support for getting this information. This change needs to support old > firmware versions, keeping with the hardcoded report, and the new > versions, where the firmware makes that information available. > > v4: Make conditional simple and more ellaborated commit comment. > v3: remove unsed macro > v2: use RTE_DIM instead of own macro > > Signed-off-by: Alejandro Lucero > --- > drivers/net/nfp/nfp_net.c | 27 +++++++++++++++++++++++++-- > drivers/net/nfp/nfp_net_ctrl.h | 11 +++++++++++ > 2 files changed, 36 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c <...> > @@ -831,8 +842,20 @@ static void nfp_net_read_mac(struct nfp_net_hw *hw) > link.link_status = ETH_LINK_UP; > > link.link_duplex = ETH_LINK_FULL_DUPLEX; > - /* Other cards can limit the tx and rx rate per VF */ > - link.link_speed = ETH_SPEED_NUM_40G; > + > + nn_link_status = (nn_link_status >> NFP_NET_CFG_STS_LINK_RATE_SHIFT) & > + NFP_NET_CFG_STS_LINK_RATE_MASK; > + > + if ((NFD_CFG_MAJOR_VERSION_of(hw->ver) < 4) || > + ((NFD_CFG_MINOR_VERSION_of(hw->ver) == 4) && > + (NFD_CFG_MINOR_VERSION_of(hw->ver) == 0))) > + link.link_speed = ETH_SPEED_NUM_40G; > + else { > + if (nn_link_status >= RTE_DIM(ls_to_ethtool) This is not compiling fine, missing parenthesis. > + link.link_speed = ETH_SPEED_NUM_NONE; > + else > + link.link_speed = ls_to_ethtool[nn_link_status]; > + } > > if (old.link_status != link.link_status) { > nfp_net_dev_atomic_write_link_status(dev, &link); <...>