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 00CECA04F1; Fri, 13 Dec 2019 15:44:54 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C3CB71BFBB; Fri, 13 Dec 2019 15:44:53 +0100 (CET) Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by dpdk.org (Postfix) with ESMTP id 5A5C11BFBA for ; Fri, 13 Dec 2019 15:44:52 +0100 (CET) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20191213144450euoutp02702097a0ffb21c3516e3cdcb335ac6e6~f9XgmEMTm0284502845euoutp025 for ; Fri, 13 Dec 2019 14:44:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20191213144450euoutp02702097a0ffb21c3516e3cdcb335ac6e6~f9XgmEMTm0284502845euoutp025 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1576248291; bh=uP3bKMMU8t5njgyAMN8c5y9oU836NrtiXt4BIXGsgJ0=; h=From:To:Cc:Subject:Date:References:From; b=byFqLXKMvCWiM++bkK6rJ8UCylo46QCzbn0rP0rQRux78eHo2ANfzgG9m0Q8lOSwC okmMBj8NrzUXZSeQg8CuuNYNyYQK03CBU1oAz+fdQlALd9ZOmAiERpJ8IaZjuKVro6 wia4o7oogQDHwlk1CtdjSyQqB16Hq/aUz2ymZr8w= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20191213144450eucas1p1bea7cf7ae2e25201eae5d1ed4d1d6eef~f9XgcVIz21276612766eucas1p11; Fri, 13 Dec 2019 14:44:50 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id C3.62.60698.2E3A3FD5; Fri, 13 Dec 2019 14:44:50 +0000 (GMT) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20191213144450eucas1p189850559438d6f9d5ead48b645e27a79~f9XgA7Dyf1280612806eucas1p1w; Fri, 13 Dec 2019 14:44:50 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20191213144450eusmtrp1003c9d2928ea0ea171e3b29d06c092e8~f9Xf-8suK1295712957eusmtrp1E; Fri, 13 Dec 2019 14:44:50 +0000 (GMT) X-AuditID: cbfec7f5-a0fff7000001ed1a-85-5df3a3e26764 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id D6.4C.08375.2E3A3FD5; Fri, 13 Dec 2019 14:44:50 +0000 (GMT) Received: from idyukov.rnd.samsung.ru (unknown [106.109.129.29]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20191213144449eusmtip2d937e6f31695467b7effeca3c6902da6~f9XflWCZj2806628066eusmtip2j; Fri, 13 Dec 2019 14:44:49 +0000 (GMT) From: Ivan Dyukov To: dev@dpdk.org, maxime.coquelin@redhat.com, tiwei.bie@intel.com Cc: Ivan Dyukov Date: Fri, 13 Dec 2019 17:44:42 +0300 Message-Id: <20191213144442.32048-1-i.dyukov@samsung.com> X-Mailer: git-send-email 2.17.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrBIsWRmVeSWpSXmKPExsWy7djPc7qPFn+ONXg4Qc/i3aftTBazLjWx Wxzr3MNisbXhP5MDi8evBUtZPRbvecnk8X7fVTaPvi2rGANYorhsUlJzMstSi/TtErgyJn/6 wFjwSbri6LzZzA2MUyW6GDk5JARMJH7Nvc3SxcjFISSwglFi5b/f7BDOF0aJie9nsEI4nxkl 9re+ZYFpaX23mg0isZxRYs6lX1AtXxklD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JERhY24793LyD8dLG4EOM AhyMSjy8DCmfYoVYE8uKK3MPMUpwMCuJ8KZqf44V4k1JrKxKLcqPLyrNSS0+xGgKtHsis5Ro cj4w6PNK4g1NDc0tLA3Njc2NzSyUxHk7BA7GCAmkJ5akZqemFqQWwfQxcXBKNTA2XZcxkeSI yYyonPM98fHJLT/Zn9WtOycvZ1WfUMHsc/BtvYTVRJst++3E5nQozy1Pmif2m7FN1jxv73Y3 /ujCuAqn+TX7TDqt57NxZ5y+9LknSvNiWs6z6RWCc6cuXzVJpOn/0Q2iTk8Wek/76sZ0/8Wp w+/jNzonPTeN/BB71itkVaQJl5ISS3FGoqEWc1FxIgAXYHUVQgIAAA== X-CMS-MailID: 20191213144450eucas1p189850559438d6f9d5ead48b645e27a79 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: Subject: [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" 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 = -- 2.17.1