From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id E6E0BA04B5; Tue, 22 Sep 2020 23:18:35 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 67EC51DAF8; Tue, 22 Sep 2020 23:18:32 +0200 (CEST) Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by dpdk.org (Postfix) with ESMTP id 99E2E1DAF4 for ; Tue, 22 Sep 2020 23:18:31 +0200 (CEST) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20200922211831euoutp01f1f5045c8ab8b02b5f8baaac1ac5d585~3N8ToL1JP2080220802euoutp01E for ; Tue, 22 Sep 2020 21:18:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20200922211831euoutp01f1f5045c8ab8b02b5f8baaac1ac5d585~3N8ToL1JP2080220802euoutp01E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1600809511; bh=SfFBfFSY8txq6obL3LRDpQaaCY4aFobH5muPine36Xs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tCNGjRMqAve+whOFtohQJo7edHfIw0M2TaQFXlxddUSwxdINyCHcbaM42RIBWX8vk DrMk1QS0nAEA8XmSXUSiR13vKFYq9X15tu7xin+1pG8vUTbu3lin4VrZdl6OBxeQcA E4VuIeohpqH9D2Mnb69pR7zb0ASWHA1NdOTJBG50= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20200922211830eucas1p17c2de9f0674969645b6937da1f37787c~3N8Sml9tO0124601246eucas1p1Z; Tue, 22 Sep 2020 21:18:30 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 76.8B.06456.62A6A6F5; Tue, 22 Sep 2020 22:18:30 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20200922211829eucas1p19a49c965d453a99fd4bb6f79673413fd~3N8RiNWXv3168231682eucas1p1e; Tue, 22 Sep 2020 21:18:29 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200922211829eusmtrp18cb5565cd123ff921990b09d0aa9d989~3N8RhqOQ61591815918eusmtrp1h; Tue, 22 Sep 2020 21:18:29 +0000 (GMT) X-AuditID: cbfec7f2-809ff70000001938-98-5f6a6a26260e Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 77.49.06314.52A6A6F5; Tue, 22 Sep 2020 22:18:29 +0100 (BST) Received: from idyukov.rnd.samsung.ru (unknown [106.109.129.29]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20200922211828eusmtip285c5b0e2b92a3b4298bccc2838c7061d~3N8Q_rN_z3026730267eusmtip22; Tue, 22 Sep 2020 21:18:28 +0000 (GMT) From: Ivan Dyukov To: maxime.coquelin@redhat.com, chenbo.xia@intel.com, zhihong.wang@intel.com, john.mcnamara@intel.com, marko.kovacevic@intel.com Cc: dev@dpdk.org, Ivan Dyukov Date: Wed, 23 Sep 2020 00:18:01 +0300 Message-Id: <20200922211806.21938-2-i.dyukov@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200922211806.21938-1-i.dyukov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrJIsWRmVeSWpSXmKPExsWy7djPc7pqWVnxBu+OCFh09Bxnt3j3aTuT xaxLTewW5+dtZbU4v7GX1eJY5x4Wi80XJzE5sHv8WrCU1WPxnpdMHu/3XWXz6NuyijGAJYrL JiU1J7MstUjfLoErY13Tf/aCH1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MEmoCFxumMeE0hCRKCDUWLqnl4WkASzgJnE7YnnWEFsYQFbia5578EaWARU JaasW8kGYvMKWEpMnDePFWKDvMTqDQfAtnEKWEns6JvEAnKEEFDNrOvqExj5FjAyrGIUSS0t zk3PLTbUK07MLS7NS9dLzs/dxAgM1W3Hfm7ewXhpY/AhRgEORiUe3hdPMuOFWBPLiitzDzFK cDArifA6nT0dJ8SbklhZlVqUH19UmpNafIjRFOimicxSosn5wDjKK4k3NDU0t7A0NDc2Nzaz UBLn7RA4GCMkkJ5YkpqdmlqQWgTTx8TBKdXAOIshZKLSW/m0lG+sG4pF7K4zhE7UYXwzl8fG vM85yGvOsZDloVF5InEc51dxmTMq7CqqvnbrFYtOclTnihz1H+f/v49KCf3y6ZH9Ye5/dco8 V3/3CjzWfJtn1fHH1+yM+Dpfjgj5tbuFbIqfawZpLPt29OlWP9Pof5eff87bqlp24PwM7eRW JZbijERDLeai4kQAySI22WsCAAA= X-CMS-MailID: 20200922211829eucas1p19a49c965d453a99fd4bb6f79673413fd X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20200922211829eucas1p19a49c965d453a99fd4bb6f79673413fd X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200922211829eucas1p19a49c965d453a99fd4bb6f79673413fd References: <20200922211806.21938-1-i.dyukov@samsung.com> Subject: [dpdk-dev] [PATCH 1/2] net/virtio: set UNKNOWN as default speed 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" rte_ethdev states new rule for NICs: they should return UNKNOWN speed if speed is unknown and interface is up, in case of down interface, NONE speed should be returned. Signed-off-by: Ivan Dyukov --- doc/guides/nics/virtio.rst | 4 ++-- drivers/net/virtio/virtio_ethdev.c | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/doc/guides/nics/virtio.rst b/doc/guides/nics/virtio.rst index 0daf25b22..33ce0c247 100644 --- a/doc/guides/nics/virtio.rst +++ b/doc/guides/nics/virtio.rst @@ -361,7 +361,7 @@ Below devargs are supported by the PCI virtio driver: It is used to specify link speed of virtio device. Link speed is a part of link status structure. It could be requested by application using rte_eth_link_get_nowait function. - (Default: 10000 (10G)) + (Default: 0xffffffff (Unknown)) #. ``vectorized``: @@ -422,7 +422,7 @@ Below devargs are supported by the virtio-user vdev: It is used to specify link speed of virtio device. Link speed is a part of link status structure. It could be requested by application using rte_eth_link_get_nowait function. - (Default: 10000 (10G)) + (Default: 0xffffffff (Unknown)) #. ``vectorized``: diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index dc0093bdf..0ef88feda 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -1666,7 +1666,6 @@ virtio_configure_intr(struct rte_eth_dev *dev) return 0; } -#define SPEED_UNKNOWN 0xffffffff #define DUPLEX_UNKNOWN 0xff /* reset device and renegotiate features if needed */ static int @@ -1723,7 +1722,7 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features) hw->mac_addr[0], hw->mac_addr[1], hw->mac_addr[2], hw->mac_addr[3], hw->mac_addr[4], hw->mac_addr[5]); - if (hw->speed == SPEED_UNKNOWN) { + if (hw->speed == ETH_SPEED_NUM_UNKNOWN) { if (vtpci_with_feature(hw, VIRTIO_NET_F_SPEED_DUPLEX)) { config = &local_config; vtpci_read_dev_config(hw, @@ -1736,8 +1735,6 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features) hw->duplex = config->duplex; } } - if (hw->speed == SPEED_UNKNOWN) - hw->speed = ETH_SPEED_NUM_10G; if (hw->duplex == DUPLEX_UNKNOWN) hw->duplex = ETH_LINK_FULL_DUPLEX; PMD_INIT_LOG(DEBUG, "link speed = %d, duplex = %d", @@ -1889,7 +1886,7 @@ int eth_virtio_dev_init(struct rte_eth_dev *eth_dev) { struct virtio_hw *hw = eth_dev->data->dev_private; - uint32_t speed = SPEED_UNKNOWN; + uint32_t speed = ETH_SPEED_NUM_UNKNOWN; int vectorized = 0; int ret; @@ -2552,6 +2549,7 @@ virtio_dev_link_update(struct rte_eth_dev *dev, __rte_unused int wait_to_complet if (!hw->started) { link.link_status = ETH_LINK_DOWN; + link.link_speed = ETH_SPEED_NUM_NONE; } else if (vtpci_with_feature(hw, VIRTIO_NET_F_STATUS)) { PMD_INIT_LOG(DEBUG, "Get link status from hw"); vtpci_read_dev_config(hw, @@ -2559,6 +2557,7 @@ virtio_dev_link_update(struct rte_eth_dev *dev, __rte_unused int wait_to_complet &status, sizeof(status)); if ((status & VIRTIO_NET_S_LINK_UP) == 0) { link.link_status = ETH_LINK_DOWN; + link.link_speed = ETH_SPEED_NUM_NONE; PMD_INIT_LOG(DEBUG, "Port %d is down", dev->data->port_id); } else { -- 2.17.1