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 E9A63A04F1; Fri, 13 Dec 2019 17:27:43 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2F48D1BFF5; Fri, 13 Dec 2019 17:27:43 +0100 (CET) Received: from mail-pj1-f65.google.com (mail-pj1-f65.google.com [209.85.216.65]) by dpdk.org (Postfix) with ESMTP id 6D1891BFDA for ; Fri, 13 Dec 2019 17:27:41 +0100 (CET) Received: by mail-pj1-f65.google.com with SMTP id l4so1409211pjt.5 for ; Fri, 13 Dec 2019 08:27:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=RmRybrBLmhHxdXGHn3b7/wzRXqs1TP6HAxv2Lxq0/dI=; b=Gtch3gNwDZYGlPt2AJwnvnV9Dm0nIRN3Szw3xW+ApUXcS6UUYAaCrlJgw+iFM1eoI5 Ci6C9YbZHcBSnRtmEhx92/Fwg9dLk8Nv/ty1dfIrMAt6LahOvgeKegXEHC3X//MX4U9K Q3f0k85tFoFFXWway7w9ahDST2JTDKtWlfDLntqWN/6DenCM4UTYE6uBWkeRe445kCb4 Ytanrdl/vYXGKYoLHFqeKRFMA80YuSbl9MDSSfnJpveUCkeVHYECChnecxjPAVugCLk0 MuQVqyybaD2LNa21SJBpcsQ63C7+W3Fa4XgV7LTNGxgO7h3VHvYO1wuhboh6NfnQlZyU 4wQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=RmRybrBLmhHxdXGHn3b7/wzRXqs1TP6HAxv2Lxq0/dI=; b=LcIYhkENBwMMTB6EH/7DJjD4dg3qzr2Sw+2V/B4ZzOCWfxtNL1hyJnD8g9y7gLKZD+ vhQgbfKuJ0TNQ6IgVV4bR1fwjeW63Cbbn2orkiW9RvQrqu05Dfje6eJ7xTn3LS7umkP8 PIc1+YBddI6NwbdHGifqnADASEoTLIUCBqZMnrVXsqcQLgki5xoP6VUUhptZKb9Rt8Rg G7F39B4DrcyEFJVkHLwfXzLOjKDw//wYliFno0pSjv3+RGpAzWQ4qU3wPK+srz3c8E+U 3deZ09WMNXJYrDUa5l4y7WjWKP7p01CrO6S4SP+sZ0hjWFmOtnRrSoidqDbgUgI06MIf k02w== X-Gm-Message-State: APjAAAWp4YlCQ7mmaT9t04mKm1j++bsfZ8tWpM4OMhBDmKVl0lZuiqVU /yR1a630Mw+gwMkzia25iy9JEw== X-Google-Smtp-Source: APXvYqyHT1Gu6BJ96UwUSAx/nDE+DTU/c9LyCYTjzXLijUmb32v7+eGj6yf7O+Pc6g0A7SOqFxyJJw== X-Received: by 2002:a17:902:b614:: with SMTP id b20mr192086pls.20.1576254460307; Fri, 13 Dec 2019 08:27:40 -0800 (PST) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id h5sm12256405pfk.30.2019.12.13.08.27.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Dec 2019 08:27:40 -0800 (PST) Date: Fri, 13 Dec 2019 08:26:25 -0800 From: Stephen Hemminger To: Maxime Coquelin Cc: Ivan Dyukov , dev@dpdk.org, tiwei.bie@intel.com Message-ID: <20191213082625.7b089ffe@hermes.lan> In-Reply-To: <46436ac3-5e45-cba2-45eb-82f5f7e24f71@redhat.com> References: <20191213144442.32048-1-i.dyukov@samsung.com> <46436ac3-5e45-cba2-45eb-82f5f7e24f71@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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" On Fri, 13 Dec 2019 15:59:23 +0100 Maxime Coquelin wrote: > 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. > > 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 > > While any Virtio spec update introduce link speed support, wouldn't it > be preferable to have this as a devarg? > > Thanks, > Maxime > Why does link speed matter at all? If some code is looking at link speed to compute values like QoS then it will be broken based on how virtualized NIC's work (bytes are free). It all seems just like a workaround for broke legacy code or advertising.