From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id CA01BA0093; Fri, 11 Mar 2022 00:40:58 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A121740E78; Fri, 11 Mar 2022 00:40:58 +0100 (CET) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2070.outbound.protection.outlook.com [40.107.223.70]) by mails.dpdk.org (Postfix) with ESMTP id 5D0E540042 for ; Fri, 11 Mar 2022 00:40:57 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iglrkORRy747YGm7E6Y7RQmXj/yD3oGX2QKT5VfmlOnLzLw2mDr5gC8dJX+2k68M1dL2z8moGtSOeEm0smwK9XREld1/ARsdF+8RKUeM1aLu+a8gtK4TtNt0sLbZRE7+P8bVMqJrahaM9Bdnpy348lxPcV6Tgp3wK+pVthU3T6WMqblNwEcFdARgJbAzphNJC1/78YQUDuRXSF6p5IHYviRjg20qgId40Dl5lvu6X7dV/mytic+OxMlHJEHu9PT2d7ztTpLb5bbvFr6EhaearR7ebBsNY+DvPpQ8ztQJRVIT43Rs7UO8t/Ma599hPnzR/D9/WFi08yOz6XQrUfZJHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=gj0qBbWba8JuTEsNOy4zWAtufFP11ON5ylzwhjsMaWw=; b=XS95Ta6t9xMPJ/dhOQovr3jfMsqrX6zwdYegLIkP1KtmFiYR2o/hFshv7ES0aP5iuy73uEKLY39WldeOI38b2D1rrayYao1bNwBnuictyeJJHcL8AfFOoEFW+NERSq4I6S6R7GmPv/yN35oe76KA6RRiIjPm/aMcgutB7KeAd3E+8lbbGHKS3k2xOhb8FrAZZ8FTjTYxOTpqR+T5mXJr/Ssd6p8totosrwce13WxfR/J8NDmEcQ3nGTTA0yjYLdcgl3AdmzXF+lLAXr3hMCdVS/JlpLCh5sEGsVteaNui1M8f/++7S1OgfkDW/G2rIruKCaC/z86kID3sWGA2ygEhQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.236) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gj0qBbWba8JuTEsNOy4zWAtufFP11ON5ylzwhjsMaWw=; b=lCPkKqlVd9Ecjl2N34vXdCre8kPatS2YNOKQ2G89o+oqG3pYaAZgtFsL04YzWcqQURdDlbP6234olM7r/IzoOK0bHIYoVbDnIdJf1FQLA2N+i2+IDM+SYR5QJeyCBWL4yJvi6Sism3gH+SaocMDxz3I4WOhgRfb3cnkVegEwSsFXU71ryRQi9pzfhVk9sVm1KBaYp7VLm8yQEwrE5tXlRwPMjYAgzBYfmReSgBEsCgyM4FEILR2mMFCh4oMV4v0c3ibB2fnEWSkat0CkAf3hGXogAgJ1my28e/aO/KfNmraT1znjUAlyfQSodISYCPEMASUhtU7r7UPq2dmla56qbA== Received: from MW4P220CA0024.NAMP220.PROD.OUTLOOK.COM (2603:10b6:303:115::29) by BN6PR12MB1587.namprd12.prod.outlook.com (2603:10b6:405:5::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5061.22; Thu, 10 Mar 2022 23:40:55 +0000 Received: from CO1NAM11FT060.eop-nam11.prod.protection.outlook.com (2603:10b6:303:115:cafe::3d) by MW4P220CA0024.outlook.office365.com (2603:10b6:303:115::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5061.20 via Frontend Transport; Thu, 10 Mar 2022 23:40:54 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.236) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.236 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.236; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.236) by CO1NAM11FT060.mail.protection.outlook.com (10.13.175.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5061.22 via Frontend Transport; Thu, 10 Mar 2022 23:40:54 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL109.nvidia.com (10.27.9.19) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Thu, 10 Mar 2022 23:40:49 +0000 Received: from pegasus01.mtr.labs.mlnx (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Thu, 10 Mar 2022 15:40:47 -0800 From: Alexander Kozyrev To: CC: , , Subject: [PATCH] net/mlx5: handle MPRQ incompatibility with external buffers Date: Fri, 11 Mar 2022 01:40:23 +0200 Message-ID: <20220310234023.3822928-1-akozyrev@nvidia.com> X-Mailer: git-send-email 2.18.2 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4cd947d4-3894-4090-b753-08da02ef6b63 X-MS-TrafficTypeDiagnostic: BN6PR12MB1587:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JP+dn1OcbTdkGhL5cEzTL5Oayaet83AvjD6x1lLs/A4IyGdYpxw37ze5DHHIwMCKReJlE04r3QiaqJGW9eoHeW9oU5wnmTEsh8/rojRhUC6rs9I9FKqo9RpWfg6V17ZSUBC5IAkv91FJrLgVHDKymrxNFjPyzCog/PKE6P3fjcrr+R/UtFnYi7IxsE30kxclt+mEU5UMXB3qKaNOkVk0vIGmexePfiQ2Ar8dyl7Gyu39yFrADDOMiwRMy6ccY7Y2e0k4L9DljS6kD1gXG25Durne9GLSbTB+p2Y++P4lpVXoMfmAirzif6sHWMPykxpLbWwat2PEi9bgn4FRAUI+T7FKtQ8le+Z9HHvzBBsv+HH2+WddWEND/P+BwKDHbOn6F59zp+ABin4Ix62QFsDd2Z8HsCCrG1zM1kNPQ3Sw9YD7oy1ARD9ofimh1qLAE7ObXUPV7MDazJH8ePDvG7e/WrAlnVHi6wvZ9o8kEN2ZI7fOmFokmMXuNWTiGrFmzT2eN8IiPNXjLuV2ncWzLdJwB9nKH5QuQfaZNeEY7Mx2VQeJbxszRxCQdtvKBXRdolFNQu9b4j1ccxoYz73xrBADJUgl2UQPrToiKGI3KimSvEeAhx4hgVKSzTl/NwSmPtFxB/7DPse7dwjYB4ExI86qFEaCrRAVOj59Nq0zPFkNJyJje7cmk2BfiGNsEsCOW5wXUJNS+129uOau3N9F/Mll7g== X-Forefront-Antispam-Report: CIP:12.22.5.236; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230001)(4636009)(36840700001)(40470700004)(46966006)(82310400004)(316002)(8936002)(6916009)(70206006)(70586007)(86362001)(8676002)(83380400001)(4326008)(336012)(16526019)(426003)(54906003)(2616005)(186003)(26005)(1076003)(107886003)(36860700001)(81166007)(508600001)(6666004)(356005)(40460700003)(5660300002)(47076005)(2906002)(36756003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Mar 2022 23:40:54.7857 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4cd947d4-3894-4090-b753-08da02ef6b63 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.236]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT060.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR12MB1587 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 Multi-Packet Rx queue uses PMD-managed buffers to store packets. These buffers are externally attached to user mbufs. This conflicts with the feature that allows using user-managed externally attached buffers in an application. Fall back to SPRQ in case external buffers mempool is configured. Add the corresponding limitation to MLX5 documentation that MPRQ and external data buffers cannot be used together. Signed-off-by: Alexander Kozyrev --- doc/guides/nics/mlx5.rst | 4 +++- drivers/net/mlx5/mlx5_rx.h | 2 +- drivers/net/mlx5/mlx5_rxq.c | 22 ++++++++++++++-------- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst index 679481bed5..4799875263 100644 --- a/doc/guides/nics/mlx5.rst +++ b/doc/guides/nics/mlx5.rst @@ -260,7 +260,9 @@ Limitations ol_flags. As the mempool for the external buffer is managed by PMD, all the Rx mbufs must be freed before the device is closed. Otherwise, the mempool of the external buffers will be freed by PMD and the application which still - holds the external buffers may be corrupted. + holds the external buffers may be corrupted. User-managed mempools with + external pinned data buffers cannot be used in conjunction with MPRQ + since packets may be already attached to PMD-managed external buffers. - If Multi-Packet Rx queue is configured (``mprq_en``) and Rx CQE compression is enabled (``rxq_cqe_comp_en``) at the same time, RSS hash result is not fully diff --git a/drivers/net/mlx5/mlx5_rx.h b/drivers/net/mlx5/mlx5_rx.h index acebe3348c..5bf88b6181 100644 --- a/drivers/net/mlx5/mlx5_rx.h +++ b/drivers/net/mlx5/mlx5_rx.h @@ -209,7 +209,7 @@ struct mlx5_rxq_ctrl *mlx5_rxq_new(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, unsigned int socket, const struct rte_eth_rxconf *conf, const struct rte_eth_rxseg_split *rx_seg, - uint16_t n_seg); + uint16_t n_seg, bool is_extmem); struct mlx5_rxq_ctrl *mlx5_rxq_hairpin_new (struct rte_eth_dev *dev, struct mlx5_rxq_priv *rxq, uint16_t desc, const struct rte_eth_hairpin_conf *hairpin_conf); diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index f16795bac3..4f58b90cfe 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -840,6 +840,8 @@ mlx5_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, int res; uint64_t offloads = conf->offloads | dev->data->dev_conf.rxmode.offloads; + bool is_extmem = rte_pktmbuf_priv_flags(mp) & + RTE_PKTMBUF_POOL_F_PINNED_EXT_BUF; if (mp) { /* @@ -912,7 +914,7 @@ mlx5_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, } if (rxq_ctrl == NULL) { rxq_ctrl = mlx5_rxq_new(dev, idx, desc, socket, conf, rx_seg, - n_seg); + n_seg, is_extmem); if (rxq_ctrl == NULL) { DRV_LOG(ERR, "port %u unable to allocate rx queue index %u", dev->data->port_id, idx); @@ -1548,7 +1550,8 @@ mlx5_max_lro_msg_size_adjust(struct rte_eth_dev *dev, uint16_t idx, * Log number of strides to configure for this queue. * @param actual_log_stride_size * Log stride size to configure for this queue. - * + * @param is_extmem + * Is external pinned memory pool used. * @return * 0 if Multi-Packet RQ is supported, otherwise -1. */ @@ -1556,7 +1559,8 @@ static int mlx5_mprq_prepare(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, bool rx_seg_en, uint32_t min_mbuf_size, uint32_t *actual_log_stride_num, - uint32_t *actual_log_stride_size) + uint32_t *actual_log_stride_size, + bool is_extmem) { struct mlx5_priv *priv = dev->data->dev_private; struct mlx5_port_config *config = &priv->config; @@ -1575,7 +1579,7 @@ mlx5_mprq_prepare(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, log_max_stride_size); uint32_t log_stride_wqe_size; - if (mlx5_check_mprq_support(dev) != 1 || rx_seg_en) + if (mlx5_check_mprq_support(dev) != 1 || rx_seg_en || is_extmem) goto unsupport; /* Checks if chosen number of strides is in supported range. */ if (config->mprq.log_stride_num > log_max_stride_num || @@ -1641,7 +1645,7 @@ mlx5_mprq_prepare(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, " rxq_num = %u, stride_sz = %u, stride_num = %u\n" " supported: min_rxqs_num = %u, min_buf_wqe_sz = %u" " min_stride_sz = %u, max_stride_sz = %u).\n" - "Rx segment is %senable.", + "Rx segment is %senabled. Extenal mempool is %sused.", dev->data->port_id, min_mbuf_size, desc, priv->rxqs_n, RTE_BIT32(config->mprq.log_stride_size), RTE_BIT32(config->mprq.log_stride_num), @@ -1649,7 +1653,7 @@ mlx5_mprq_prepare(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, RTE_BIT32(dev_cap->mprq.log_min_stride_wqe_size), RTE_BIT32(dev_cap->mprq.log_min_stride_size), RTE_BIT32(dev_cap->mprq.log_max_stride_size), - rx_seg_en ? "" : "not "); + rx_seg_en ? "" : "not ", is_extmem ? "" : "not "); return -1; } @@ -1671,7 +1675,8 @@ mlx5_mprq_prepare(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, struct mlx5_rxq_ctrl * mlx5_rxq_new(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, unsigned int socket, const struct rte_eth_rxconf *conf, - const struct rte_eth_rxseg_split *rx_seg, uint16_t n_seg) + const struct rte_eth_rxseg_split *rx_seg, uint16_t n_seg, + bool is_extmem) { struct mlx5_priv *priv = dev->data->dev_private; struct mlx5_rxq_ctrl *tmpl; @@ -1694,7 +1699,8 @@ mlx5_rxq_new(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, const int mprq_en = !mlx5_mprq_prepare(dev, idx, desc, rx_seg_en, non_scatter_min_mbuf_size, &mprq_log_actual_stride_num, - &mprq_log_actual_stride_size); + &mprq_log_actual_stride_size, + is_extmem); /* * Always allocate extra slots, even if eventually * the vector Rx will not be used. -- 2.18.2