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 C9A2FA0524; Thu, 30 Jan 2020 08:13:17 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 785D01BFE6; Thu, 30 Jan 2020 08:13:16 +0100 (CET) Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by dpdk.org (Postfix) with ESMTP id AF1DF1BFE5 for ; Thu, 30 Jan 2020 08:13:14 +0100 (CET) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20200130071313euoutp0277b0ce8b733aca9920d8fda426760ef6~umK5EqVF41746917469euoutp02s for ; Thu, 30 Jan 2020 07:13:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20200130071313euoutp0277b0ce8b733aca9920d8fda426760ef6~umK5EqVF41746917469euoutp02s DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1580368393; bh=jB7TPib5e8dCTJz0pDxawjE4Rn/YPl78f2wSBggkmfs=; h=Subject:To:Cc:From:Date:In-Reply-To:References:From; b=CCNOtKs1v68sn1LweDATWQRWcY02oS0FDhbLynuTPCY0gZFyHhotChDp/byD6y4LR E+u7LKfUzMZYZObPH9xjp3CJmMDuIPfA9GuzWYiCf3JPYln5fp8NV6uwcmSM47ZPIG ofxUwK2BDny29s8nNXgvg1YNIkCyJI2zH7x0IJj8= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20200130071313eucas1p2e3551c376ba3735b1a43b51e8abb41cd~umK49KQ5_2356023560eucas1p2L; Thu, 30 Jan 2020 07:13:13 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id FE.7A.60679.902823E5; Thu, 30 Jan 2020 07:13:13 +0000 (GMT) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20200130071312eucas1p209152b86f9980365d0086daa2b9b7828~umK4j33xV1744917449eucas1p2t; Thu, 30 Jan 2020 07:13:12 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200130071312eusmtrp13b559cab09f738db8d43a47a35e1112a~umK4jTLdN2973129731eusmtrp1d; Thu, 30 Jan 2020 07:13:12 +0000 (GMT) X-AuditID: cbfec7f4-0e5ff7000001ed07-19-5e32820939f0 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 64.4F.08375.802823E5; Thu, 30 Jan 2020 07:13:12 +0000 (GMT) Received: from [106.109.129.29] (unknown [106.109.129.29]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20200130071312eusmtip203dccadec65c69f6bf9c97a621a2f154~umK4Rud-72896128961eusmtip2o; Thu, 30 Jan 2020 07:13:12 +0000 (GMT) To: Maxime Coquelin , Tiwei Bie Cc: dev@dpdk.org From: Ivan Dyukov Message-ID: <25a8182d-63b5-5845-dac7-73f97787c4e7@samsung.com> Date: Thu, 30 Jan 2020 10:13:12 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: Content-Transfer-Encoding: 8bit Content-Language: ru-RU X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupgleLIzCtJLcpLzFFi42LZduzneV3OJqM4g955ghbvPm1nsjjWuYfF YmvDfyYHZo9fC5ayeize85LJ4/2+q2wBzFFcNimpOZllqUX6dglcGd+3LWAt+G1RsXNyF2sD 4xT9LkYODgkBE4l9fz27GDk5hARWMEpc213excgFZH9hlNhx7B8zhPOZUeLLgz4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R gQiJxxPbGSFKBCVOznzCAmJzApV/3bEYar6ZxLzND5khbHmJ5q2zoWxxiQ/bD7JNYBSahaR9 FpKWWUhaZiFpWcDIsopRJLW0ODc9t9hQrzgxt7g0L10vOT93EyMwbrYd+7l5B+OljcGHGAU4 GJV4eCXKDOOEWBPLiitzDzFKcDArifCKugKFeFMSK6tSi/Lji0pzUosPMZoC/TaRWUo0OR8Y 03kl8YamhuYWlobmxubGZhZK4rwdAgdjhATSE0tSs1NTC1KLYPqYODilGhg15WqLhB+13m5f +VvvO8c3JXZ+ZoFome3tO0x2tygqHW1ijntRObf93RVlhrYl5zm7hNoulP7g+5n0I1ss89b7 /9qzGNwfHdMWmJuiVbc8+3jfRLc3LoHvOpmd+gMU7eviJATu1e2etXdZo1jl9K+vrcw8Pttx R3qnF5789PKPftL+e0UTI5VYijMSDbWYi4oTAW5aTSqxAgAA X-CMS-MailID: 20200130071312eucas1p209152b86f9980365d0086daa2b9b7828 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> <6afbfe48-52fd-c66f-9ac2-dfb89fb55832@samsung.com> <20191216060656.GA189589@___> <8ab7ee73-73ed-4c2f-a226-3f9be587729b@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, 14.01.2020 12:47, Maxime Coquelin пишет: > Hi Ivan, > > On 12/16/19 10:44 AM, Maxime Coquelin wrote: >> >> On 12/16/19 7:06 AM, Tiwei Bie wrote: >>> On Fri, Dec 13, 2019 at 08:39:11PM +0300, Ivan Dyukov wrote: >>>> 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. >>> FYI: https://protect2.fireeye.com/url?k=6b9e2079-365021cd-6b9fab36-000babdfecba-2c7f1ed6043989c5&u=https://lists.oasis-open.org/archives/virtio-comment/201911/msg00058.html >> Great, thanks Tiwei for the pointer! > The above spec patch is implemented in Qemu since v2.12: > > commit 9473939ed7addcaaeb8fde5c093918fb7fa0919c > Author: Jason Baron > Date: Wed Mar 7 22:25:41 2018 -0500 > > virtio-net: add linkspeed and duplex settings to virtio-net > > Although linkspeed and duplex can be set in a linux guest via > 'ethtool -s', > this requires custom ethtool commands for virtio-net by default. > > Introduce a new feature flag, VIRTIO_NET_F_SPEED_DUPLEX, which allows > the hypervisor to export a linkspeed and duplex setting. The user can > subsequently overwrite it later if desired via: 'ethtool -s'. > > Linkspeed and duplex settings can be set as: > '-device virtio-net,speed=10000,duplex=full' > > where speed is [0...INT_MAX], and duplex is ["half"|"full"]. > > Signed-off-by: Jason Baron > Cc: "Michael S. Tsirkin" > Cc: Jason Wang > Cc: virtio-dev@lists.oasis-open.org > Reviewed-by: Michael S. Tsirkin > Signed-off-by: Michael S. Tsirkin > > I think the right way would be to implement it directly in Virtio-net > PMD. > > Are you willing to do it? Sorry for delay, I missed this email.  I need to reconfigure my emails filters. Ok I'll take care about it, but I can't promise any dates for it. May be this winter or spring. Best regards, Ivan. > > Thanks, > Maxime > >>>>> 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. >>>> >