From patchwork Mon May 27 08:35:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sunil Kumar Kori X-Patchwork-Id: 53707 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CFB823237; Mon, 27 May 2019 10:35:44 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id A51932C30 for ; Mon, 27 May 2019 10:35:43 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x4R8ZQNK003374; Mon, 27 May 2019 01:35:42 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0818; bh=gKJnRd5a1PdtsNQ9IgdJSh+uJMxLlJNlhLVmAkzmvzI=; b=rWaIcbPFp1VfN1vBWttUxA1qm5DdP+otydHCCb8jf53NiaY8mKmVJTgocQBlYlqX/KNZ Su9gO6UL/iNPGe/dVyZe2F8O2WcL4nQAT7pchDGnwThFolWXle05PouVO4u8YCNajcPK VZO7eiLF+Q4aE+wMtUDockM+IxnHkNdrbwcyUYauzz6o7ZjXpSBiUnvfyFB2jFN3AUjh OLgD87xTLn4wAjJFWnuoIkzWpsrFXl1M7y2VUbFHFLJuMLqZ9IB1pmBLmOUVBVHXOUei SmwH4quuIEB3fgA6R+ZEJiyoNUDg2uQEl6lsqCcZjalrFIg06q00N9MflG8KR4bA2ZVC Zg== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0a-0016f401.pphosted.com with ESMTP id 2sqwjwarkk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 27 May 2019 01:35:42 -0700 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Mon, 27 May 2019 01:35:42 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Mon, 27 May 2019 01:35:42 -0700 Received: from dc7-eodlnx05.marvell.com (dc7-eodlnx05.marvell.com [10.28.113.55]) by maili.marvell.com (Postfix) with ESMTP id E1DB63F7048; Mon, 27 May 2019 01:35:39 -0700 (PDT) From: Sunil Kumar Kori To: , , , , , CC: , Sunil Kumar Kori Date: Mon, 27 May 2019 14:05:28 +0530 Message-ID: <1558946129-5816-2-git-send-email-skori@marvell.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1558946129-5816-1-git-send-email-skori@marvell.com> References: <1558946129-5816-1-git-send-email-skori@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-05-27_06:, , signatures=0 Subject: [dpdk-dev] [PATCH 1/2] lib/librte_ethdev: add in default value of rte_eth_dev_info 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" rte_eth_dev_info structure exposes, nb_seg_max & nb_mtu_seg_max to provide maximum number of supported segments for a given platform. Defining UINT16_MAX as default value of above mentioned variables to expose support of infinite/maximum segments. Based on above values, application can decide best size for buffers while creating mbuf pool. Signed-off-by: Sunil Kumar Kori Acked-by: Andrew Rybchenko --- lib/librte_ethdev/rte_ethdev.c | 2 ++ lib/librte_ethdev/rte_ethdev.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c index d7cfa3d..6933757 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -2543,6 +2543,8 @@ struct rte_eth_dev * .nb_max = UINT16_MAX, .nb_min = 0, .nb_align = 1, + .nb_seg_max = UINT16_MAX, + .nb_mtu_seg_max = UINT16_MAX, }; RTE_ETH_VALID_PORTID_OR_RET(port_id); diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h index 1f35e1d..6bd30b1 100644 --- a/lib/librte_ethdev/rte_ethdev.h +++ b/lib/librte_ethdev/rte_ethdev.h @@ -2333,6 +2333,8 @@ int rte_eth_dev_set_rx_queue_stats_mapping(uint16_t port_id, * .nb_max = UINT16_MAX, * .nb_min = 0, * .nb_align = 1, + * .nb_seg_max = UINT16_MAX, + * .nb_mtu_seg_max = UINT16_MAX, * }; * * device = dev->device From patchwork Mon May 27 08:35:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sunil Kumar Kori X-Patchwork-Id: 53708 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E3ED41B946; Mon, 27 May 2019 10:35:47 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id AC3291B944 for ; Mon, 27 May 2019 10:35:45 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x4R8ZVbb003400; Mon, 27 May 2019 01:35:44 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0818; bh=nDxmj1ppyFYqE+knpHYyCYjV46XfBrQn48hpeJXH4w4=; b=FZE41z7/8O8RW5GWCIux3mbKhEnwJTAkFglpuA3UjstXoaELnfuSBnxWTRPQuwWclQ3f SMa8oIAMvPgoW2ZivwgZLJJ5/A4EYJhNLd1mgewTQ/VW3gaOdX0IlfKw0cWsO5tUS73M +drkOZi+cskdSckS1L4NrFJMAsNWc/ZBBB5/rSdleFg5dpfxfrpHJXq5UHUzzKyfo9JW mhqlebWiaNmFx92EwOgkPDEcMlWt1JCwvMzMYnNjM+6vxYI1BrjSUnne4c5GZF+NsWsc 33Ia/4VxVPAXoCl5JpYV3jm3k3ypODZ3IUCMntgGZvPThDNCmuKilybpK3fdyKN8oxPW KA== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0a-0016f401.pphosted.com with ESMTP id 2sqwjwarkq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 27 May 2019 01:35:44 -0700 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Mon, 27 May 2019 01:35:44 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Mon, 27 May 2019 01:35:44 -0700 Received: from dc7-eodlnx05.marvell.com (dc7-eodlnx05.marvell.com [10.28.113.55]) by maili.marvell.com (Postfix) with ESMTP id 455BA3F7043; Mon, 27 May 2019 01:35:42 -0700 (PDT) From: Sunil Kumar Kori To: , , , , , CC: , Sunil Kumar Kori Date: Mon, 27 May 2019 14:05:29 +0530 Message-ID: <1558946129-5816-3-git-send-email-skori@marvell.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1558946129-5816-1-git-send-email-skori@marvell.com> References: <1558946129-5816-1-git-send-email-skori@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-05-27_06:, , signatures=0 Subject: [dpdk-dev] [PATCH 2/2] app/testpmd: creating mbuf pool based on maximum supported segments 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" Configuring buffer size based following parameters: - max-pkt-len - max supported segments per MTU Buffer size are configured as given below: - If platform supports infinite segments per packet then default buffer size is used. - If platform supports nb_mtu_seg_max segments then buffer size is configured as (max-pkt-len / nb_mtu_seg_max) + headroom Signed-off-by: Sunil Kumar Kori Reviewed-by: Ferruh Yigit --- app/test-pmd/testpmd.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index f0061d9..b8c006b 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -1100,6 +1100,8 @@ struct extmem_param { uint8_t port_per_socket[RTE_MAX_NUMA_NODES]; struct rte_gro_param gro_param; uint32_t gso_types; + uint16_t data_size; + bool warning = 0; int k; memset(port_per_socket,0,RTE_MAX_NUMA_NODES); @@ -1167,8 +1169,27 @@ struct extmem_param { port->need_reconfig = 1; port->need_reconfig_queues = 1; port->tx_metadata = 0; + + /* Check for maximum number of segments per MTU. Accordingly + * update the mbuf data size. + */ + if (port->dev_info.rx_desc_lim.nb_mtu_seg_max != UINT16_MAX) { + data_size = rx_mode.max_rx_pkt_len / + port->dev_info.rx_desc_lim.nb_mtu_seg_max; + + if ((data_size + RTE_PKTMBUF_HEADROOM) > + mbuf_data_size) { + mbuf_data_size = data_size + + RTE_PKTMBUF_HEADROOM; + warning = 1; + } + } } + if (warning) + TESTPMD_LOG(WARNING, "Configured mbuf size %hu\n", + mbuf_data_size); + /* * Create pools of mbuf. * If NUMA support is disabled, create a single pool of mbuf in