From patchwork Sat Oct 28 01:48:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "lihuisong (C)" X-Patchwork-Id: 133528 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2B8EC4321C; Sat, 28 Oct 2023 03:48:28 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E4BA64029E; Sat, 28 Oct 2023 03:48:27 +0200 (CEST) Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by mails.dpdk.org (Postfix) with ESMTP id CF8B94029E for ; Sat, 28 Oct 2023 03:48:25 +0200 (CEST) Received: from kwepemm000004.china.huawei.com (unknown [172.30.72.55]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4SHMmm47Yqz1L9Dp; Sat, 28 Oct 2023 09:45:28 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by kwepemm000004.china.huawei.com (7.193.23.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Sat, 28 Oct 2023 09:48:23 +0800 From: Huisong Li To: CC: , , , , Subject: [PATCH v3 1/3] ethdev: introduce maximum Rx buffer size Date: Sat, 28 Oct 2023 09:48:45 +0800 Message-ID: <20231028014847.27149-2-lihuisong@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231028014847.27149-1-lihuisong@huawei.com> References: <20230808040234.12947-1-lihuisong@huawei.com> <20231028014847.27149-1-lihuisong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemm000004.china.huawei.com (7.193.23.18) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org The "min_rx_bufsize" in struct rte_eth_dev_info stands for the minimum Rx buffer size supported by hardware. Actually, some engines also have the maximum Rx buffer specification, like, hns3. If mbuf data room size in mempool is greater then the maximum Rx buffer size supported by HW, the data size application used in each mbuf is just as much as the maximum Rx buffer size supported by HW instead of the whole data room size. So introduce maximum Rx buffer size which is not enforced just to report user to avoid memory waste. In addition, fix the comment for the "min_rx_bufsize" to make it be more specific. Signed-off-by: Huisong Li Acked-by: Chengwen Feng Acked-by: Morten Brørup --- lib/ethdev/rte_ethdev.c | 7 +++++++ lib/ethdev/rte_ethdev.h | 10 +++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c index 9dabcb5ae2..eb657a984e 100644 --- a/lib/ethdev/rte_ethdev.c +++ b/lib/ethdev/rte_ethdev.c @@ -2112,6 +2112,7 @@ rte_eth_rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, struct rte_eth_dev *dev; struct rte_eth_dev_info dev_info; struct rte_eth_rxconf local_conf; + uint32_t vld_bufsize; RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); dev = &rte_eth_devices[port_id]; @@ -2158,6 +2159,11 @@ rte_eth_rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, return ret; mbp_buf_size = rte_pktmbuf_data_room_size(mp); + vld_bufsize = mbp_buf_size - RTE_PKTMBUF_HEADROOM; + if (vld_bufsize > dev_info.max_rx_bufsize) + RTE_ETHDEV_LOG(INFO, + "Ethdev port_id=%u, the data size application used in each mbuf is just %u instead of the whole data room(%u).\n", + port_id, dev_info.max_rx_bufsize, vld_bufsize); } else if (rx_conf != NULL && rx_conf->rx_nseg > 0) { const struct rte_eth_rxseg_split *rx_seg; uint16_t n_seg; @@ -3757,6 +3763,7 @@ rte_eth_dev_info_get(uint16_t port_id, struct rte_eth_dev_info *dev_info) dev_info->min_mtu = RTE_ETHER_MIN_LEN - RTE_ETHER_HDR_LEN - RTE_ETHER_CRC_LEN; dev_info->max_mtu = UINT16_MAX; + dev_info->max_rx_bufsize = UINT32_MAX; if (*dev->dev_ops->dev_infos_get == NULL) return -ENOTSUP; diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h index 2fd3cd808d..b8f5dcae00 100644 --- a/lib/ethdev/rte_ethdev.h +++ b/lib/ethdev/rte_ethdev.h @@ -1723,7 +1723,15 @@ struct rte_eth_dev_info { uint16_t min_mtu; /**< Minimum MTU allowed */ uint16_t max_mtu; /**< Maximum MTU allowed */ const uint32_t *dev_flags; /**< Device flags */ - uint32_t min_rx_bufsize; /**< Minimum size of Rx buffer. */ + /** Minimum Rx buffer size per descriptor supported by HW. */ + uint32_t min_rx_bufsize; + /** + * Maximum Rx buffer size per descriptor supported by HW. + * The value is not enforced, information only to application to + * optimize mbuf size. Its value is UINT32_MAX when not specified + * by the driver. + */ + uint32_t max_rx_bufsize; uint32_t max_rx_pktlen; /**< Maximum configurable length of Rx pkt. */ /** Maximum configurable size of LRO aggregated packet. */ uint32_t max_lro_pkt_size; From patchwork Sat Oct 28 01:48:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "lihuisong (C)" X-Patchwork-Id: 133530 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 039EF4321C; Sat, 28 Oct 2023 03:48:40 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4296C4068A; Sat, 28 Oct 2023 03:48:30 +0200 (CEST) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 50F79402B9 for ; Sat, 28 Oct 2023 03:48:26 +0200 (CEST) Received: from kwepemm000004.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4SHMld3dtczVlnN; Sat, 28 Oct 2023 09:44:29 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by kwepemm000004.china.huawei.com (7.193.23.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Sat, 28 Oct 2023 09:48:24 +0800 From: Huisong Li To: CC: , , , , Subject: [PATCH v3 2/3] app/testpmd: add maximum Rx buffer size display Date: Sat, 28 Oct 2023 09:48:46 +0800 Message-ID: <20231028014847.27149-3-lihuisong@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231028014847.27149-1-lihuisong@huawei.com> References: <20230808040234.12947-1-lihuisong@huawei.com> <20231028014847.27149-1-lihuisong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemm000004.china.huawei.com (7.193.23.18) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Add maximum Rx buffer size display. Signed-off-by: Huisong Li Acked-by: Chengwen Feng --- app/test-pmd/config.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index b9fdb7e8f1..2ac6f15773 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -881,6 +881,8 @@ port_infos_display(portid_t port_id) } printf("Minimum size of RX buffer: %u\n", dev_info.min_rx_bufsize); + if (dev_info.max_rx_bufsize != UINT32_MAX) + printf("Maximum size of RX buffer: %u\n", dev_info.max_rx_bufsize); printf("Maximum configurable length of RX packet: %u\n", dev_info.max_rx_pktlen); printf("Maximum configurable size of LRO aggregated packet: %u\n", From patchwork Sat Oct 28 01:48:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "lihuisong (C)" X-Patchwork-Id: 133529 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7D2D44321C; Sat, 28 Oct 2023 03:48:33 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1A314402DF; Sat, 28 Oct 2023 03:48:29 +0200 (CEST) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by mails.dpdk.org (Postfix) with ESMTP id 51195402D4 for ; Sat, 28 Oct 2023 03:48:26 +0200 (CEST) Received: from kwepemm000004.china.huawei.com (unknown [172.30.72.55]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4SHMlD5VvdzMmG8; Sat, 28 Oct 2023 09:44:08 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by kwepemm000004.china.huawei.com (7.193.23.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Sat, 28 Oct 2023 09:48:24 +0800 From: Huisong Li To: CC: , , , , Subject: [PATCH v3 3/3] net/hns3: report maximum buffer size Date: Sat, 28 Oct 2023 09:48:47 +0800 Message-ID: <20231028014847.27149-4-lihuisong@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231028014847.27149-1-lihuisong@huawei.com> References: <20230808040234.12947-1-lihuisong@huawei.com> <20231028014847.27149-1-lihuisong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemm000004.china.huawei.com (7.193.23.18) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org This patch reports the maximum buffer size hardware supported. Signed-off-by: Huisong Li Acked-by: Chengwen Feng --- drivers/net/hns3/hns3_common.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/hns3/hns3_common.c b/drivers/net/hns3/hns3_common.c index c4d47f43fe..cfce9ddd0f 100644 --- a/drivers/net/hns3/hns3_common.c +++ b/drivers/net/hns3/hns3_common.c @@ -59,6 +59,7 @@ hns3_dev_infos_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *info) info->max_tx_queues = hw->tqps_num; info->max_rx_pktlen = HNS3_MAX_FRAME_LEN; /* CRC included */ info->min_rx_bufsize = HNS3_MIN_BD_BUF_SIZE; + info->max_rx_bufsize = HNS3_MAX_BD_BUF_SIZE; info->max_mtu = info->max_rx_pktlen - HNS3_ETH_OVERHEAD; info->max_lro_pkt_size = HNS3_MAX_LRO_SIZE; info->rx_offload_capa = (RTE_ETH_RX_OFFLOAD_IPV4_CKSUM |