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 661A1A0A0E for ; Mon, 10 May 2021 18:09:35 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5C8804003E; Mon, 10 May 2021 18:09:35 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2053.outbound.protection.outlook.com [40.107.94.53]) by mails.dpdk.org (Postfix) with ESMTP id 156524003E for ; Mon, 10 May 2021 18:09:34 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OHDUYQCkUBXnWd8EeVJcJp9h9QSC3t3OCGnb7firPNyNRTK8VwQzv8nc42MfdbrweaL39lPEnoWWONKFf1SUqYIhrUnRPUpGjdUPlUwzb+ZUgHxLtkhFKp3w8C4zWYJ4G07HJph7Y9rpPprv7ZWb3YUFgMdKxOc705TmrUPsf4bIHDOWLsD7BESfI6JclfukF2wlZHT9bsxTQdvo5qPN+6I59Pj7PZ4XsnllpI1ciiexgibLs27nQWcS/wyJPQcJoGtILVdnSL6YAVAed271ESn3Rj7Rqgqsz4IC1zrjtt2cxcEiwl8ReyjmJYhEwaSNVMZjpor3+dc+37/28pKHBA== 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-SenderADCheck; bh=zuqSZa5j/RtMhq0wFjy82gL4mKF2gufjp+w4oVgWLn4=; b=arKtM+fXoYOVXqky6+Y6EhF8cScmD+u0HrEG3caMrrd/h9sTDsuPplp+hpkpuFEN3hCwo21epgt96oyj1Wm+JFiVDMABXZDZqcBFnAs7vfmsubNsnNAu45o3aX5Wp/TeZsCJoNhOVSp/ylhElPKiUkesWH19BRzJNeXI3rBELAxMKC4Apm2QQ7Bq+IGUkjsOoqaRCqXAv0raZK6NggjabKEpXGqm7ZGCaaNzldI48PKojcg0+Shu1KJGxm0aIp2DLRtkla3lpK/xJSbtPOvGVN8MPGfxmVZ+By93niB/w1wzGZ1F/Vhy5hWoCEj3ZmmAUKfvZkEgf4TscTNiV0tVMA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=none sp=none 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=zuqSZa5j/RtMhq0wFjy82gL4mKF2gufjp+w4oVgWLn4=; b=L6t+Cme6w+DFoq8tVwg8o3CCh84DT7avj6G7RfSzMpz3xgEIQZgE0ClArRfpOWvpsehbzVSFwpPG1JXA2OWYY4mWQTnJs24E5DsaHTjdZuPeiwbksqIfz0bZ+X2nsm05uRKRUxv/i8DUEkYj6yzbWYJNYqyLC3QnVNTmRv/i1PhSpg0O2JbA3CEYFl3mlKqZ3/GgFf2Z9AD4Ob5DRSL3OpKnN5mDTmli5GhTuT60rc0BIjcrCDKWP8aQEWSnnPYZ5Ky6YpWARh9lLXUfiwx3CG5fjaCUuMzsR0mv1zE2q03TnsjnjM/1zabmpPpuiM6G7Oc2Yy+BJhDjevBvmbNRAg== Received: from BN6PR12CA0030.namprd12.prod.outlook.com (2603:10b6:405:70::16) by BYAPR12MB4597.namprd12.prod.outlook.com (2603:10b6:a03:10b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.27; Mon, 10 May 2021 16:09:32 +0000 Received: from BN8NAM11FT021.eop-nam11.prod.protection.outlook.com (2603:10b6:405:70:cafe::35) by BN6PR12CA0030.outlook.office365.com (2603:10b6:405:70::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Mon, 10 May 2021 16:09:31 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by BN8NAM11FT021.mail.protection.outlook.com (10.13.177.114) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4108.25 via Frontend Transport; Mon, 10 May 2021 16:09:31 +0000 Received: from nvidia.com (172.20.145.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 10 May 2021 16:09:27 +0000 From: Xueming Li To: Viacheslav Ovsiienko CC: Luca Boccassi , Matan Azrad , "dpdk stable" Date: Tue, 11 May 2021 00:00:14 +0800 Message-ID: <20210510160258.30982-65-xuemingl@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210510160258.30982-1-xuemingl@nvidia.com> References: <20210510160258.30982-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.145.6] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9e33c5ff-4387-4bb0-03f1-08d913cdff1f X-MS-TrafficTypeDiagnostic: BYAPR12MB4597: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: eLtQ1nbMuDtt8r6jk/nGdT/qcVhVtrcGjmXNZEjWtVQ6wHL49SCNhbo3/VoWd9qSoQzbFiMgPtz0hQgU5nh7i+4jYu5k1hAm+RPflj+3GAEL/TEyxIPStL2UCsJdOXJFg0tdttp+FP1fev6+9II0OXoQYd+TJadhm9wH8LkQ+DZxX26EmQHl9owIPFukPBdFBriH+m5AwkECTCiHGT9TRg79+vSKqHmscex56gRifsf4n9ch4rowLuKxNxD/dBWXIRwTt2GLppvQO5JJtDigd1KkF9R2PJ3XhmV4FQ4Hi+h6oRQEA91MTyKGxcydONOcr60Pr393AxeO0ZzQiSnbVl1FxwKBbf7rYyUrGFjdlDcUmtDGWS8FCy7dZbe2ZsVVAvwRXwVxtoPq8vAx92WuluKlv0ZO4ta2UnTmC2lZz4p2Ty9eNUzPDJxXxcDt9n7wCBgiyHINvRktD2bYP6LAy34LOkTL6F0yj5xbikj3Woh7Qjp/4XeBN8iaU2Jnofx9Jtwoonrodkyioxcp2BYF0feusU9LuZrRKkb/QzcH8GyxlS2gsSklOa3d24iPkebSWyXfJo4YTRLtMaynxTfZPbLLQTmc91Cnw8XAb8X9U5ZQ9YxGq7ViZJjPOeAyt4x9qqx0fYZjwyCwbDLROhdODVVmzdj9lEKuaRpf/QVixfA8EFBgElriULMo1FHVhKOBAERVM7A+IYhzd4B5u11iwtLLW4zTEyocgTzOjJSWWtOezwMVP73CEQTzi40sJVMblsvNwAVuQ5tvT1NNw6zE8g== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(136003)(376002)(39860400002)(396003)(346002)(46966006)(36840700001)(53546011)(356005)(316002)(36906005)(26005)(5660300002)(82310400003)(6862004)(6666004)(36860700001)(86362001)(6286002)(6636002)(2906002)(83380400001)(36756003)(55016002)(4326008)(7696005)(478600001)(8676002)(70206006)(966005)(70586007)(2616005)(336012)(426003)(82740400003)(7636003)(37006003)(54906003)(8936002)(47076005)(186003)(16526019)(1076003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 May 2021 16:09:31.7233 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9e33c5ff-4387-4bb0-03f1-08d913cdff1f X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT021.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB4597 Subject: [dpdk-stable] patch 'net/mlx5: fix Rx metadata leftovers' has been queued to stable release 20.11.2 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to stable release 20.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/12/21. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/steevenlee/dpdk This queued commit can be viewed at: https://github.com/steevenlee/dpdk/commit/cf10220946182bfd96e5670a2a1ba0f20c58a977 Thanks. Xueming Li --- >From cf10220946182bfd96e5670a2a1ba0f20c58a977 Mon Sep 17 00:00:00 2001 From: Viacheslav Ovsiienko Date: Sun, 7 Mar 2021 11:45:47 +0000 Subject: [PATCH] net/mlx5: fix Rx metadata leftovers Cc: Luca Boccassi [ upstream commit 4eefb20faacab6eae03c860c5d622603f7499ff4 ] The Rx metadata might use the metadata register C0 to keep the values. The same register C0 might be used by kernel for source vport value handling, kernel uses upper half of the register, leaving the lower half for application usage. In the extended metadata mode 1 (dv_xmeta_en devarg is assigned with value 1) the metadata width is 16 bits only, the Rx datapath code fetched the entire 32-bit value of the metadata register and presented one to application. The patch provides data masking depending on the chosen metadata mode. Fixes: 6c55b622a956 ("net/mlx5: set dynamic flow metadata in Rx queues") Signed-off-by: Viacheslav Ovsiienko Acked-by: Matan Azrad --- drivers/net/mlx5/mlx5_flow.c | 4 ++++ drivers/net/mlx5/mlx5_rxtx.c | 13 +++++++++---- drivers/net/mlx5/mlx5_rxtx.h | 1 + drivers/net/mlx5/mlx5_rxtx_vec_altivec.h | 11 ++++++----- drivers/net/mlx5/mlx5_rxtx_vec_neon.h | 13 +++++++++---- drivers/net/mlx5/mlx5_rxtx_vec_sse.h | 9 +++++---- 6 files changed, 34 insertions(+), 17 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index 34dd33ba38..39be15bcd4 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -1220,10 +1220,14 @@ mlx5_flow_rxq_dynf_metadata_set(struct rte_eth_dev *dev) data->dynf_meta = 0; data->flow_meta_mask = 0; data->flow_meta_offset = -1; + data->flow_meta_port_mask = 0; } else { data->dynf_meta = 1; data->flow_meta_mask = rte_flow_dynf_metadata_mask; data->flow_meta_offset = rte_flow_dynf_metadata_offs; + data->flow_meta_port_mask = (uint32_t)~0; + if (priv->config.dv_xmeta_en == MLX5_XMETA_MODE_META16) + data->flow_meta_port_mask >>= 16; } } } diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c index fac823ba64..c765314068 100644 --- a/drivers/net/mlx5/mlx5_rxtx.c +++ b/drivers/net/mlx5/mlx5_rxtx.c @@ -1338,10 +1338,15 @@ rxq_cq_to_mbuf(struct mlx5_rxq_data *rxq, struct rte_mbuf *pkt, } } } - if (rxq->dynf_meta && cqe->flow_table_metadata) { - pkt->ol_flags |= rxq->flow_meta_mask; - *RTE_MBUF_DYNFIELD(pkt, rxq->flow_meta_offset, uint32_t *) = - cqe->flow_table_metadata; + if (rxq->dynf_meta) { + uint32_t meta = cqe->flow_table_metadata & + rxq->flow_meta_port_mask; + + if (meta) { + pkt->ol_flags |= rxq->flow_meta_mask; + *RTE_MBUF_DYNFIELD(pkt, rxq->flow_meta_offset, + uint32_t *) = meta; + } } if (rxq->csum) pkt->ol_flags |= rxq_cq_to_ol_flags(cqe); diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h index c57ccc32ed..7c3c4c0099 100644 --- a/drivers/net/mlx5/mlx5_rxtx.h +++ b/drivers/net/mlx5/mlx5_rxtx.h @@ -168,6 +168,7 @@ struct mlx5_rxq_data { uint64_t timestamp_rx_flag; /* Dynamic mbuf flag for timestamp. */ uint64_t flow_meta_mask; int32_t flow_meta_offset; + uint32_t flow_meta_port_mask; uint32_t rxseg_n; /* Number of split segment descriptions. */ struct mlx5_eth_rxseg rxseg[MLX5_MAX_RXQ_NSEG]; /* Buffer split segment descriptions - sizes, offsets, pools. */ diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_altivec.h b/drivers/net/mlx5/mlx5_rxtx_vec_altivec.h index 48b677e40d..2d1154b624 100644 --- a/drivers/net/mlx5/mlx5_rxtx_vec_altivec.h +++ b/drivers/net/mlx5/mlx5_rxtx_vec_altivec.h @@ -1221,22 +1221,23 @@ rxq_cq_process_v(struct mlx5_rxq_data *rxq, volatile struct mlx5_cqe *cq, if (rxq->dynf_meta) { uint64_t flag = rxq->flow_meta_mask; int32_t offs = rxq->flow_meta_offset; - uint32_t metadata; + uint32_t metadata, mask; + mask = rxq->flow_meta_port_mask; /* This code is subject for futher optimization. */ - metadata = cq[pos].flow_table_metadata; + metadata = cq[pos].flow_table_metadata & mask; *RTE_MBUF_DYNFIELD(pkts[pos], offs, uint32_t *) = metadata; pkts[pos]->ol_flags |= metadata ? flag : 0ULL; - metadata = cq[pos + 1].flow_table_metadata; + metadata = cq[pos + 1].flow_table_metadata & mask; *RTE_MBUF_DYNFIELD(pkts[pos + 1], offs, uint32_t *) = metadata; pkts[pos + 1]->ol_flags |= metadata ? flag : 0ULL; - metadata = cq[pos + 2].flow_table_metadata; + metadata = cq[pos + 2].flow_table_metadata & mask; *RTE_MBUF_DYNFIELD(pkts[pos + 2], offs, uint32_t *) = metadata; pkts[pos + 2]->ol_flags |= metadata ? flag : 0ULL; - metadata = cq[pos + 3].flow_table_metadata; + metadata = cq[pos + 3].flow_table_metadata & mask; *RTE_MBUF_DYNFIELD(pkts[pos + 3], offs, uint32_t *) = metadata; pkts[pos + 3]->ol_flags |= metadata ? flag : 0ULL; diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_neon.h b/drivers/net/mlx5/mlx5_rxtx_vec_neon.h index 4c067d8801..2234fbe6b2 100644 --- a/drivers/net/mlx5/mlx5_rxtx_vec_neon.h +++ b/drivers/net/mlx5/mlx5_rxtx_vec_neon.h @@ -832,19 +832,24 @@ rxq_cq_process_v(struct mlx5_rxq_data *rxq, volatile struct mlx5_cqe *cq, if (rxq->dynf_meta) { /* This code is subject for futher optimization. */ int32_t offs = rxq->flow_meta_offset; + uint32_t mask = rxq->flow_meta_port_mask; *RTE_MBUF_DYNFIELD(pkts[pos], offs, uint32_t *) = container_of(p0, struct mlx5_cqe, - pkt_info)->flow_table_metadata; + pkt_info)->flow_table_metadata & + mask; *RTE_MBUF_DYNFIELD(pkts[pos + 1], offs, uint32_t *) = container_of(p1, struct mlx5_cqe, - pkt_info)->flow_table_metadata; + pkt_info)->flow_table_metadata & + mask; *RTE_MBUF_DYNFIELD(pkts[pos + 2], offs, uint32_t *) = container_of(p2, struct mlx5_cqe, - pkt_info)->flow_table_metadata; + pkt_info)->flow_table_metadata & + mask; *RTE_MBUF_DYNFIELD(pkts[pos + 3], offs, uint32_t *) = container_of(p3, struct mlx5_cqe, - pkt_info)->flow_table_metadata; + pkt_info)->flow_table_metadata & + mask; if (*RTE_MBUF_DYNFIELD(pkts[pos], offs, uint32_t *)) elts[pos]->ol_flags |= rxq->flow_meta_mask; if (*RTE_MBUF_DYNFIELD(pkts[pos + 1], offs, uint32_t *)) diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_sse.h b/drivers/net/mlx5/mlx5_rxtx_vec_sse.h index 0b3f240e10..c508a7a4f2 100644 --- a/drivers/net/mlx5/mlx5_rxtx_vec_sse.h +++ b/drivers/net/mlx5/mlx5_rxtx_vec_sse.h @@ -768,15 +768,16 @@ rxq_cq_process_v(struct mlx5_rxq_data *rxq, volatile struct mlx5_cqe *cq, if (rxq->dynf_meta) { /* This code is subject for futher optimization. */ int32_t offs = rxq->flow_meta_offset; + uint32_t mask = rxq->flow_meta_port_mask; *RTE_MBUF_DYNFIELD(pkts[pos], offs, uint32_t *) = - cq[pos].flow_table_metadata; + cq[pos].flow_table_metadata & mask; *RTE_MBUF_DYNFIELD(pkts[pos + 1], offs, uint32_t *) = - cq[pos + p1].flow_table_metadata; + cq[pos + p1].flow_table_metadata & mask; *RTE_MBUF_DYNFIELD(pkts[pos + 2], offs, uint32_t *) = - cq[pos + p2].flow_table_metadata; + cq[pos + p2].flow_table_metadata & mask; *RTE_MBUF_DYNFIELD(pkts[pos + 3], offs, uint32_t *) = - cq[pos + p3].flow_table_metadata; + cq[pos + p3].flow_table_metadata & mask; if (*RTE_MBUF_DYNFIELD(pkts[pos], offs, uint32_t *)) pkts[pos]->ol_flags |= rxq->flow_meta_mask; if (*RTE_MBUF_DYNFIELD(pkts[pos + 1], offs, uint32_t *)) -- 2.25.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-05-10 23:59:28.342106500 +0800 +++ 0066-net-mlx5-fix-Rx-metadata-leftovers.patch 2021-05-10 23:59:26.420000000 +0800 @@ -1 +1 @@ -From 4eefb20faacab6eae03c860c5d622603f7499ff4 Mon Sep 17 00:00:00 2001 +From cf10220946182bfd96e5670a2a1ba0f20c58a977 Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Luca Boccassi + +[ upstream commit 4eefb20faacab6eae03c860c5d622603f7499ff4 ] @@ -18 +20,0 @@ -Cc: stable@dpdk.org @@ -32 +34 @@ -index 773f3e63f4..d46fc333d1 100644 +index 34dd33ba38..39be15bcd4 100644 @@ -35 +37 @@ -@@ -1267,10 +1267,14 @@ mlx5_flow_rxq_dynf_metadata_set(struct rte_eth_dev *dev) +@@ -1220,10 +1220,14 @@ mlx5_flow_rxq_dynf_metadata_set(struct rte_eth_dev *dev) @@ -51 +53 @@ -index e3ce9fd224..c76b9951bc 100644 +index fac823ba64..c765314068 100644 @@ -54 +56 @@ -@@ -1388,10 +1388,15 @@ rxq_cq_to_mbuf(struct mlx5_rxq_data *rxq, struct rte_mbuf *pkt, +@@ -1338,10 +1338,15 @@ rxq_cq_to_mbuf(struct mlx5_rxq_data *rxq, struct rte_mbuf *pkt, @@ -75 +77 @@ -index 0fd98af9d1..4f0fda0dec 100644 +index c57ccc32ed..7c3c4c0099 100644