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 468A8A04F1; Fri, 13 Dec 2019 18:39:16 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6E2F01C0B4; Fri, 13 Dec 2019 18:39:15 +0100 (CET) Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by dpdk.org (Postfix) with ESMTP id B4A0C1C0B2 for ; Fri, 13 Dec 2019 18:39:13 +0100 (CET) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20191213173912euoutp01c89afc609549226d0b82e0d2130fa95d~f-vwAHoLL1073210732euoutp01f for ; Fri, 13 Dec 2019 17:39:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20191213173912euoutp01c89afc609549226d0b82e0d2130fa95d~f-vwAHoLL1073210732euoutp01f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1576258752; bh=HUiop+jzU9HPFGI9K3xvO1qoOyKSs7eX0W9Rh9zS3qU=; h=Subject:To:From:Date:In-Reply-To:References:From; b=Sws8hrtWhedSsL9MLGvYhI3oMY5YBUUOo//x61UcsStwD+JCxM+hvjwjCKsZxxPHK mQ5SvFzU4x/sIvUYzDX/KXfX+Xbju0/5dTEiyI+RggIUCVzvRb3hT+fv/2gf0437x6 okssOk2mCw5sURWLhfES3wag9WR+ICrRICu64k9I= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20191213173912eucas1p214964de0324be97652f67b5521cccbd2~f-vv3kTVl0906809068eucas1p2g; Fri, 13 Dec 2019 17:39:12 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id E1.61.61286.0CCC3FD5; Fri, 13 Dec 2019 17:39:12 +0000 (GMT) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20191213173912eucas1p1c40d2a91f3ace6f52a2ab2b9ff6297a3~f-vvdIPt_0190801908eucas1p1g; Fri, 13 Dec 2019 17:39:12 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20191213173912eusmtrp2b76b7f5f56bb9a1092649ef54ce62c01~f-vvclpCB0884208842eusmtrp2B; Fri, 13 Dec 2019 17:39:12 +0000 (GMT) X-AuditID: cbfec7f2-f0bff7000001ef66-d2-5df3ccc094b3 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id F8.6B.07950.0CCC3FD5; Fri, 13 Dec 2019 17:39:12 +0000 (GMT) Received: from [106.109.129.29] (unknown [106.109.129.29]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20191213173911eusmtip17fc64464ce8c8cd38814f2e1558a9e9f~f-vvIFdYI2670426704eusmtip1K; Fri, 13 Dec 2019 17:39:11 +0000 (GMT) To: Maxime Coquelin , dev@dpdk.org, tiwei.bie@intel.com From: Ivan Dyukov Message-ID: <6afbfe48-52fd-c66f-9ac2-dfb89fb55832@samsung.com> Date: Fri, 13 Dec 2019 20:39:11 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <46436ac3-5e45-cba2-45eb-82f5f7e24f71@redhat.com> Content-Transfer-Encoding: 8bit Content-Language: ru-RU X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupgleLIzCtJLcpLzFFi42LZduznOd0DZz7HGmy5rmbx7tN2JotjnXtY LLY2/GdyYPb4tWApq8fiPS+ZPN7vu8oWwBzFZZOSmpNZllqkb5fAlfH44Xb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6D1QgLWEo0nRUCqRERCJVY u/UMI0TNQUaJS0ePs4Mk2AQ0JE53zGMCsXkF7CQu3m1hA+llEVCVmHkhFCQsKhAh8fb3TVaI EkGJkzOfsIDYnEDl068tBGtlFjCTmLf5ITOELS/RvHU2lC0u8WH7QbYJjIKzkLTPQtIyC0nL LCQtCxhZVjGKpJYW56bnFhvpFSfmFpfmpesl5+duYgTGx7ZjP7fsYOx6F3yIUYCDUYmHV2Pz 51gh1sSy4srcQ4wSHMxKIryp2kAh3pTEyqrUovz4otKc1OJDjKZAv01klhJNzgfGbl5JvKGp obmFpaG5sbmxmYWSOG+HwMEYIYH0xJLU7NTUgtQimD4mDk6pBsbM0vdxlg0T5s7afmJB/CQL 87r3wnk3WeseSjNNfLf25zKXiQKthZsZG6P8b5xeE8a1q18roEPBUeLWgqyiHbfv3fOfk2zV 4On4batA0drKhNXOi/Je+wlUzntemcf5+93EyJ7QWc+vXZ87762oH/vriPT/mb08l1Rmi3a+ Y9lZEK6tyn4pq12JpTgj0VCLuag4EQD8qc71pQIAAA== X-CMS-MailID: 20191213173912eucas1p1c40d2a91f3ace6f52a2ab2b9ff6297a3 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20191213144450eucas1p189850559438d6f9d5ead48b645e27a79 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20191213144450eucas1p189850559438d6f9d5ead48b645e27a79 References: <20191213144442.32048-1-i.dyukov@samsung.com> <46436ac3-5e45-cba2-45eb-82f5f7e24f71@redhat.com> Subject: Re: [dpdk-dev] [PATCH v2] net/virtio: add link speed tuning 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" Hi Maxime, Thank you for comments. 13.12.2019 17:59, Maxime Coquelin пишет: > Hi Ivan, > > On 12/13/19 3:44 PM, Ivan Dyukov wrote: >> Some applications like pktgen use link_speed to calculate transmit >> rate. It limits outcome traffic to hardcoded 10G. >> >> This patch makes link_speed configurable at compile time. >> >> Signed-off-by: Ivan Dyukov >> --- >> config/common_base | 1 + >> config/meson.build | 1 + >> drivers/net/vhost/rte_eth_vhost.c | 2 +- >> drivers/net/virtio/virtio_ethdev.c | 20 ++++++++++++++++---- >> 4 files changed, 19 insertions(+), 5 deletions(-) >> >> diff --git a/config/common_base b/config/common_base >> index 7dec7ed45..8589ca4ec 100644 >> --- a/config/common_base >> +++ b/config/common_base >> @@ -433,6 +433,7 @@ CONFIG_RTE_LIBRTE_AVP_DEBUG_BUFFERS=n >> # Compile burst-oriented VIRTIO PMD driver >> # >> CONFIG_RTE_LIBRTE_VIRTIO_PMD=y >> +CONFIG_RTE_LIBRTE_VIRTIO_LINK_SPEED=10000 >> CONFIG_RTE_LIBRTE_VIRTIO_DEBUG_RX=n >> CONFIG_RTE_LIBRTE_VIRTIO_DEBUG_TX=n >> CONFIG_RTE_LIBRTE_VIRTIO_DEBUG_DUMP=n >> diff --git a/config/meson.build b/config/meson.build >> index 364a8d739..78c30f334 100644 >> --- a/config/meson.build >> +++ b/config/meson.build >> @@ -202,6 +202,7 @@ dpdk_conf.set('RTE_LIBEAL_USE_HPET', get_option('use_hpet')) >> dpdk_conf.set('RTE_MAX_VFIO_GROUPS', 64) >> dpdk_conf.set('RTE_DRIVER_MEMPOOL_BUCKET_SIZE_KB', 64) >> dpdk_conf.set('RTE_LIBRTE_DPAA2_USE_PHYS_IOVA', true) >> +dpdk_conf.set('RTE_LIBRTE_VIRTIO_LINK_SPEED', 10000) >> >> >> compile_time_cpuflags = [] >> diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c >> index 46f01a7f4..38eaa5955 100644 >> --- a/drivers/net/vhost/rte_eth_vhost.c >> +++ b/drivers/net/vhost/rte_eth_vhost.c >> @@ -115,7 +115,7 @@ static struct internal_list_head internal_list = >> static pthread_mutex_t internal_list_lock = PTHREAD_MUTEX_INITIALIZER; >> >> static struct rte_eth_link pmd_link = { >> - .link_speed = 10000, >> + .link_speed = RTE_LIBRTE_VIRTIO_LINK_SPEED, >> .link_duplex = ETH_LINK_FULL_DUPLEX, >> .link_status = ETH_LINK_DOWN >> }; >> diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c >> index 044eb10a7..948091cc2 100644 >> --- a/drivers/net/virtio/virtio_ethdev.c >> +++ b/drivers/net/virtio/virtio_ethdev.c >> @@ -2371,7 +2371,7 @@ virtio_dev_link_update(struct rte_eth_dev *dev, __rte_unused int wait_to_complet >> >> memset(&link, 0, sizeof(link)); >> link.link_duplex = ETH_LINK_FULL_DUPLEX; >> - link.link_speed = ETH_SPEED_NUM_10G; >> + link.link_speed = RTE_LIBRTE_VIRTIO_LINK_SPEED; >> link.link_autoneg = ETH_LINK_FIXED; >> >> if (!hw->started) { >> @@ -2426,9 +2426,21 @@ virtio_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) >> { >> uint64_t tso_mask, host_features; >> struct virtio_hw *hw = dev->data->dev_private; >> - >> - dev_info->speed_capa = ETH_LINK_SPEED_10G; /* fake value */ >> - >> +#if RTE_LIBRTE_VIRTIO_LINK_SPEED == ETH_LINK_SPEED_20G >> + dev_info->speed_capa = ETH_LINK_SPEED_20G; >> +#elif RTE_LIBRTE_VIRTIO_LINK_SPEED == ETH_SPEED_NUM_25G >> + dev_info->speed_capa = ETH_LINK_SPEED_25G; >> +#elif RTE_LIBRTE_VIRTIO_LINK_SPEED == ETH_SPEED_NUM_40G >> + dev_info->speed_capa = ETH_LINK_SPEED_40G; >> +#elif RTE_LIBRTE_VIRTIO_LINK_SPEED == ETH_SPEED_NUM_50G >> + dev_info->speed_capa = ETH_LINK_SPEED_50G; >> +#elif RTE_LIBRTE_VIRTIO_LINK_SPEED == ETH_SPEED_NUM_56G >> + dev_info->speed_capa = ETH_LINK_SPEED_56G; >> +#elif RTE_LIBRTE_VIRTIO_LINK_SPEED == ETH_SPEED_NUM_100G >> + dev_info->speed_capa = ETH_LINK_SPEED_100G; >> +#else >> + dev_info->speed_capa = ETH_LINK_SPEED_10G; >> +#endif >> dev_info->max_rx_queues = >> RTE_MIN(hw->max_queue_pairs, VIRTIO_MAX_RX_QUEUES); >> dev_info->max_tx_queues = >> > I think we may need toi extend the Virtio specification so that the > device can advertise the link speed. I agree. It will be more flexible solution, but it will require another effort. I'll evalutate virtio spec and check if it's suitable for such changes. > Problem with your proposal is that it is build time only, so: > 1. It won't be configurable when using distros DPDK package. > 2. All the Virtio devices on a system will have the same value Current implementation is same. Nothing is broken here. :) > While any Virtio spec update introduce link speed support, wouldn't it > be preferable to have this as a devarg? For my case, compile time configuration is ok. Let me prepare solution with devarg then we can choose the better one. > Thanks, > Maxime Best regards, Ivan.