From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-vk0-f50.google.com (mail-vk0-f50.google.com [209.85.213.50]) by dpdk.org (Postfix) with ESMTP id 4E8D7F63E for ; Mon, 19 Dec 2016 11:32:40 +0100 (CET) Received: by mail-vk0-f50.google.com with SMTP id p9so117679600vkd.3 for ; Mon, 19 Dec 2016 02:32:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netronome-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=QEMH+lp5FAYTJ22mL35macAVyhOzI/KOdDkLWRAWOAc=; b=1AbJrAYYlkqxUH5m2WfyRs7MfTiUr3epQEOHJz2Fz0eSKgGgaHRM+cnQ2VeKXdOTFv QsWWYmgPAw0EF5TpNoNT56IqyHGy9BaqSVuE0kA9HgD+is7RpLDhIzQnnThrvHOXsOLw 7g9ZecS0fxbCZbV58h7qK6CnvPlT9N2lKbor3kLwVidP0D3uoyZSHrLcN7C/UTjd9UT2 uzdMacmfYxAKD2E3MMawX6bDTcnDm6YPXjDgnMGMg0utZc+inBWdE2vTSSU504D0viBv ZRkVwkpEmFMegjp5enyHNl3K3VRI4t+8SGbJEKe96+OcqGAfvNnzB4pBF7l9f0GUMVXF 7EYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=QEMH+lp5FAYTJ22mL35macAVyhOzI/KOdDkLWRAWOAc=; b=dro8zXVIh0DnN5PTUkSA7hGHwojxDQPhUYcRxdOYb4VHcbYc5PaHdEMQwtU6TjUp3F 3JF11jho2Gm49se9Yr1kDRqXq0qk31x/Zf9FEWX/H7rCmdy1pan0cxOaWYzv4qPNeX4q 65+mkF1fo9mZkxoHSZ/ngO6UtidXZWXlvCoMi1Q2nDb7DS2//BvxtZTo7m3PvYf8Ds6q BkJerE63iGXqNfUZlsNeFa2CLG/WzGxmV6510guES5q3WCcuS+MHmLgr8pOPzvgAjmgF BJ5As7hNgETIj1/sODeOsBTTDaZEzQxWBbNJ3Of7xWYrz1UY2ahtQtAfj21BgHyj4gFW 5stA== X-Gm-Message-State: AIkVDXI0tryG2dy0CZ9FbY9Iv5ybW9cuIZljVhMp/BdFFzJiuWxZzc1fHvyjaqs7KbYgINJtT94+hNQgxQmkK2MR X-Received: by 10.31.69.80 with SMTP id s77mr5046115vka.37.1482143559913; Mon, 19 Dec 2016 02:32:39 -0800 (PST) MIME-Version: 1.0 Received: by 10.103.46.3 with HTTP; Mon, 19 Dec 2016 02:32:39 -0800 (PST) In-Reply-To: <724e9785-3499-ac5a-bf7a-8093a649780c@intel.com> References: <1481908242-845-1-git-send-email-alejandro.lucero@netronome.com> <724e9785-3499-ac5a-bf7a-8093a649780c@intel.com> From: Alejandro Lucero Date: Mon, 19 Dec 2016 10:32:39 +0000 Message-ID: To: Ferruh Yigit Cc: dev Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.15 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:32:41 -0000 On Mon, Dec 19, 2016 at 10:24 AM, Ferruh Yigit wrote: > 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. > Sorry about that. It was so simple the change I did not do any test. > > > + 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); > <...> > >