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 18E26A04F5; Thu, 12 Dec 2019 09:50:24 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 35621374C; Thu, 12 Dec 2019 09:50:23 +0100 (CET) Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by dpdk.org (Postfix) with ESMTP id 9E04A2BC8 for ; Thu, 12 Dec 2019 09:50:21 +0100 (CET) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20191212085021euoutp029f8799bd04a2538d88199647437adf13~fk4tHHxZn2106721067euoutp02Z for ; Thu, 12 Dec 2019 08:50:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20191212085021euoutp029f8799bd04a2538d88199647437adf13~fk4tHHxZn2106721067euoutp02Z DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1576140621; bh=A5ywAKXtWns+I6LmRii6QMWeYOZAgyphLfNOWT+eYv0=; h=From:To:Cc:Subject:Date:References:From; b=mFReIsC2tlhsn2RZNxWGY0GMNYMgy2mtu82nRuD3vNEDXe2xduGHaZ+ftfXrQL9oP Q+dBM65wDsYKLdVrqR/H+ORQfIg276LcjXdyqDxW/sDOcka29AW7/eQHx7nxhUOE2e b4odnwVwQVtmLhq98dC+BoUz7g9SIP8c3W6YqUbU= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20191212085020eucas1p1445d9a101b34359807bf629dedc46220~fk4s9aIwA0606206062eucas1p1t; Thu, 12 Dec 2019 08:50:20 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id CE.20.61286.C4FF1FD5; Thu, 12 Dec 2019 08:50:20 +0000 (GMT) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20191212085020eucas1p1be6d915a6610edf182d2ab0294c2a903~fk4sqenN_3244432444eucas1p1A; Thu, 12 Dec 2019 08:50:20 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20191212085020eusmtrp26ce9b1c3238c274e4da71fc705e05409~fk4sp_Dtc1049810498eusmtrp2B; Thu, 12 Dec 2019 08:50:20 +0000 (GMT) X-AuditID: cbfec7f2-f0bff7000001ef66-80-5df1ff4cd2e9 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 26.D5.07950.C4FF1FD5; Thu, 12 Dec 2019 08:50:20 +0000 (GMT) Received: from idyukov.rnd.samsung.ru (unknown [106.109.129.29]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20191212085020eusmtip2113a455a3e0cec8e714ab9db31a84fbc~fk4sYyDau1641616416eusmtip2T; Thu, 12 Dec 2019 08:50:20 +0000 (GMT) From: Ivan Dyukov To: dev@dpdk.org Cc: Ivan Dyukov Date: Thu, 12 Dec 2019 11:50:12 +0300 Message-Id: <20191212085012.9170-1-i.dyukov@samsung.com> X-Mailer: git-send-email 2.17.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrKIsWRmVeSWpSXmKPExsWy7djPc7o+/z/GGjQ061u8+7SdyWLWpSZ2 ByaPXwuWsnr0bVnFGMAUxWWTkpqTWZZapG+XwJWxeeJCtoKP4hV7zrexNjDeFuli5OSQEDCR aLrxja2LkYtDSGAFo8SHT+2MIAkhgS+MEpO38kIkPjNK/D5/ihmmo69pE1THckaJt8eOsUI4 Xxkleg8/AmtnE9CQON0xjwnEFhEQkPjcuZgNxGYWUJP40POeBcQWFjCSWPGsCyzOIqAq8W9V OzuI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3MLS0NzY3NjMQkmc t0PgYIyQQHpiSWp2ampBahFMHxMHp1QDo/v76C8Fl3JfPGLjn/Na9Z17ZYGshMZeozjr9wf9 pRfaTvJYc2Rn1zc9/blvivmOTSz59GVyZWOd1tKUynlzjr2d+v1xeeueqRdv7o7vX+2rrdcs +lj5T0/JLoN1J+d0nH/z869RUPdy3qIvFjrntjY39S3aHTQtafWHz7enLLeN/Ln9yl2da5+U WIozEg21mIuKEwHuN7lgMAIAAA== X-CMS-MailID: 20191212085020eucas1p1be6d915a6610edf182d2ab0294c2a903 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20191212085020eucas1p1be6d915a6610edf182d2ab0294c2a903 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20191212085020eucas1p1be6d915a6610edf182d2ab0294c2a903 References: Subject: [dpdk-dev] [PATCH] 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 + drivers/net/vhost/rte_eth_vhost.c | 2 +- drivers/net/virtio/virtio_ethdev.c | 20 ++++++++++++++++---- 3 files changed, 18 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/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