From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id E30027D30 for ; Thu, 11 Jan 2018 18:02:19 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Jan 2018 09:02:18 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,345,1511856000"; d="scan'208";a="9387196" Received: from fyigit-mobl1.ger.corp.intel.com (HELO [10.237.220.48]) ([10.237.220.48]) by fmsmga002.fm.intel.com with ESMTP; 11 Jan 2018 09:02:17 -0800 To: Stephen Hemminger , dev@dpdk.org References: <20180108174514.14688-1-stephen@networkplumber.org> <20180108174514.14688-4-stephen@networkplumber.org> From: Ferruh Yigit Message-ID: <490f9b50-0001-95b9-9b90-285d1f8131f8@intel.com> Date: Thu, 11 Jan 2018 17:02:16 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <20180108174514.14688-4-stephen@networkplumber.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-dev] [PATCH v3 03/15] net/virtio: use eth_linkstatus_set 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, 11 Jan 2018 17:02:20 -0000 On 1/8/2018 5:45 PM, Stephen Hemminger wrote: > Use the new comon code in ethdev to handle link status update. > > Signed-off-by: Stephen Hemminger <...> > static int > virtio_dev_link_update(struct rte_eth_dev *dev, __rte_unused int wait_to_complete) > { > - struct rte_eth_link link, old; > - uint16_t status; > struct virtio_hw *hw = dev->data->dev_private; > - memset(&link, 0, sizeof(link)); > - virtio_dev_atomic_read_link_status(dev, &link); > - old = link; > - link.link_duplex = ETH_LINK_FULL_DUPLEX; > - link.link_speed = SPEED_10G; > + uint16_t status; > + struct rte_eth_link link = { > + .link_speed = ETH_SPEED_NUM_10G, > + .link_duplex = ETH_LINK_FULL_DUPLEX, > + .link_autoneg = ETH_LINK_SPEED_FIXED, With a new cleanup commit [1] ETH_LINK_FIXED used for autoneg value (instead of ETH_LINK_SPEED_FIXED). And since is ETH_LINK_FIXED is 0, setting autoneg to it can be omitted. [1] 93dd7b328a9b ("ethdev: fix link autonegotiation value") This commit is in next-net. Unlike Linux "net-next" sub-tree which is for next release development tree, dpdk next-net is for current release network drivers which this patch seems fits into. I already rebased this patchset to next-net, I will share it to continue discussion from that point. > + }; > > if (hw->started == 0) { > link.link_status = ETH_LINK_DOWN; > @@ -1957,9 +1916,8 @@ virtio_dev_link_update(struct rte_eth_dev *dev, __rte_unused int wait_to_complet > } else { > link.link_status = ETH_LINK_UP; > } > - virtio_dev_atomic_write_link_status(dev, &link); > > - return (old.link_status == link.link_status) ? -1 : 0; > + return _rte_eth_linkstatus_set(dev, &link); > } > > static int >