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 A8F5DA0C4C; Mon, 9 Aug 2021 16:27:05 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6252F4068A; Mon, 9 Aug 2021 16:27:05 +0200 (CEST) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2052.outbound.protection.outlook.com [40.107.93.52]) by mails.dpdk.org (Postfix) with ESMTP id E3ED94003C; Mon, 9 Aug 2021 16:27:03 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aOpLUKLCvGDIva/QxPZej6Ojf5RLY8w1u5ZIOEpg4OgXZ5wA8uy03R3LnM0iUHTkuh6Igugk5OFexB8pfElbN44Pr9ho0rLb3Uwx6tBtynm8FAsP7zfrSuMRZ2zV6W2pEUhOkRipxfq9TqREznGLguoRXQ8f4M5HWuniqMcAYRFxQmKyvErbz3reyLUVHWBVdtt8/wypLWt9uNfsOZ39W6CmX96pU8CLr+OCYIioCzWB95tUL1uZhTYS8j2T5PnEDLyYnT1QWDfGlVTexPKU6ERwM8iKrxsCu42svYOA9M3NelgDWSIbHBeI5lHXafr0aObyjwchubGugn2ZzJm0dQ== 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=3F6VYGKAPZIdLEyTv/j81MZ1efDgQBaxBsqDeZmverk=; b=DGHl3aObCpAdUR8TUUJNGIgomsI7BVTVnduZjBbfhtK3UDu4/ZvQrlHSHYHtNYSvc2DmrRvAzFQJ0LdOX/WS+aL7gfs0wmEN+zpyQsA7mjORYWs+P081eh7yS9CdHx4k9E6eGJDZHtolVdNOqgO0dhIXeO/lyQyUv8LYagecyz+swJ+7bRkrczAo+aT2TEF6yzX55xkp+9zSHUuqUGu048E8EVAbV8DpCfm4kG43FJblguxzg6nCsl/uq3+vn4JmIMriVyKB7fewh5n4Gy0tXqd5qlo6u9b+hVouWgvru51s/W54PSNaSYDWKH1AW91jNSHh6Vn2XX5XPaW9HjvBrw== 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=quarantine 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=3F6VYGKAPZIdLEyTv/j81MZ1efDgQBaxBsqDeZmverk=; b=dHQ9qFkVeqSkKcYsn8VjkfIYNH4r/gxfbCOkXB8bH9NdEXnEfQszsS+PT6t0CoCgGjXZ2JcuYFF8WglR+MQJpYrgKJgbR+18vPOgfIr18DpvabTJcOm8V2jgb6jVlrgbyY4cybkHsYSsQx/lNZ7/2lbO0n9/FziJQYio9yjLV2KK3WjXc5yMSjbpTPUruSgr/tnWnagVFa/PpWYJiBS697f57XBld6C+y+MP1CZo0v1yAxoWZtO4ize1or0WwC1rhhmrwv/9uyE+oEzPa945rhWngQOGzu1eiXqTDfeVl8RwSIPPVGJl1+yeVWcUpQcJCsbzPJVL49oJffTUpQaThw== Received: from BN9PR03CA0972.namprd03.prod.outlook.com (2603:10b6:408:109::17) by DM6PR12MB4732.namprd12.prod.outlook.com (2603:10b6:5:32::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4394.21; Mon, 9 Aug 2021 14:27:02 +0000 Received: from BN8NAM11FT056.eop-nam11.prod.protection.outlook.com (2603:10b6:408:109:cafe::21) by BN9PR03CA0972.outlook.office365.com (2603:10b6:408:109::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4394.15 via Frontend Transport; Mon, 9 Aug 2021 14:27:02 +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 BN8NAM11FT056.mail.protection.outlook.com (10.13.177.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4394.16 via Frontend Transport; Mon, 9 Aug 2021 14:27:02 +0000 Received: from nvidia.com (172.20.187.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 9 Aug 2021 14:27:00 +0000 From: Dmitry Kozlyuk To: CC: , , Matan Azrad , Shahaf Shuler , Viacheslav Ovsiienko Date: Mon, 9 Aug 2021 17:26:46 +0300 Message-ID: <20210809142646.1918339-1-dkozlyuk@nvidia.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.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: 171d5934-7b5a-4501-b959-08d95b41c16e X-MS-TrafficTypeDiagnostic: DM6PR12MB4732: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4502; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7KJP6xnAkMWmx8RVCU3JCp13hR/mhMkmr3VZnpJh5qaSWrmy1y82YXwTK1u2QZCcvg4lYSg3sDSpUAUfBjtBInOKpvJPeGpSJL5aFHM7/0OGMp7oyxxFQdYdJ/c9kiT8hvxc2NkiDs68qnqg0s1qp2NdCjiJX2XkoLfZewrtgHkVQTKcmfSCmdPKo+b7O01hGSLloA/FUY/az+7w+n4crY3DlMkHXacOvn2RSXVY847fnYMrFAV8n+ydejRtC3PvzXhwLrWWwCHA1ToRyF1ZUhwaRnFB3FXsPmv316QLeWbfyQ8lRIX07zV2wkN3DM1K88HWbLtM192ukkWY8YD0xJK6iUiv3WMxmW94OgugcD1JHQHplswYje7S2gyb5SFLUgvgRhjfMVLcDkp7XiLudKrjTHriivvIV8w9QeTru2g5pzD4ziSF3vQW8SZPc1CeCH620zrrWjbPEeDr1ftOFp4uU8Tx1YOHUllBumhdpyuVTRLKZyH+Mp8Xqlt2mWjyRMQl2WjnoVDn5fW+QMy3ai9PIdVBSrGbSPMHknmAwzOxTJyScDJLqwKscTR8JjAmTj0T46Kp1SUZBHEAF5wyT7PnrKxjJOhcw8CCyh5wWuhha2P/lTQ+9HgUaFeZU3x+Ttq0IIEoVTi/+izKYPQ4Ov3ybYt9efzuNJK7hSHOAoX7QXQ4c5eQTXLLUmIJywPmFZ68UehKbq9iFercnagv0A== 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)(396003)(39860400002)(346002)(36840700001)(46966006)(47076005)(82740400003)(2906002)(107886003)(356005)(26005)(6666004)(478600001)(6286002)(83380400001)(1076003)(5660300002)(8936002)(8676002)(55016002)(4326008)(86362001)(82310400003)(450100002)(54906003)(6916009)(316002)(2616005)(426003)(336012)(186003)(16526019)(7696005)(36906005)(36860700001)(7636003)(70586007)(36756003)(70206006); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Aug 2021 14:27:02.4187 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 171d5934-7b5a-4501-b959-08d95b41c16e 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: BN8NAM11FT056.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4732 Subject: [dpdk-dev] [PATCH] net/mlx5: fix matching on eCPRI 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 Sender: "dev" When an ETH or VLAN flow item directly preceding ECPRI (i. e. a pattern for eCPRI over Ethernet) did not specify the eCPRI protocol, matches were not restricted to eCPRI traffic. For example, "eth / ecpri / end" pattern behaved as "eth / end". Implicitly add Ethernet type condition, so that "eth / ecpri / end" behaves as "eth type is 0xAEFE / end". Fixes: daa38a8924a0 ("net/mlx5: add flow translation of eCPRI header") Cc: bingz@nvidia.com Cc: stable@dpdk.org Signed-off-by: Dmitry Kozlyuk --- drivers/net/mlx5/mlx5_flow_dv.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 31d857030f..5bb6d89a3f 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -9976,12 +9976,13 @@ flow_dv_translate_item_gtp_psc(void *matcher, void *key, * Flow matcher value. * @param[in] item * Flow pattern to translate. - * @param[in] samples - * Sample IDs to be used in the matching. + * @param[in] last_item + * Last item flags. */ static void flow_dv_translate_item_ecpri(struct rte_eth_dev *dev, void *matcher, - void *key, const struct rte_flow_item *item) + void *key, const struct rte_flow_item *item, + uint64_t last_item) { struct mlx5_priv *priv = dev->data->dev_private; const struct rte_flow_item_ecpri *ecpri_m = item->mask; @@ -9994,6 +9995,22 @@ flow_dv_translate_item_ecpri(struct rte_eth_dev *dev, void *matcher, void *dw_m; void *dw_v; + /* + * In case of eCPRI over Ethernet, if EtherType is not specified, + * match on eCPRI EtherType implicitly. + */ + if (last_item & MLX5_FLOW_LAYER_OUTER_L2) { + void *hdrs_m, *hdrs_v, *l2m, *l2v; + + hdrs_m = MLX5_ADDR_OF(fte_match_param, matcher, outer_headers); + hdrs_v = MLX5_ADDR_OF(fte_match_param, key, outer_headers); + l2m = MLX5_ADDR_OF(fte_match_set_lyr_2_4, hdrs_m, ethertype); + l2v = MLX5_ADDR_OF(fte_match_set_lyr_2_4, hdrs_v, ethertype); + if (*(uint16_t *)l2m == 0 && *(uint16_t *)l2v == 0) { + *(uint16_t *)l2m = UINT16_MAX; + *(uint16_t *)l2v = RTE_BE16(RTE_ETHER_TYPE_ECPRI); + } + } if (!ecpri_v) return; if (!ecpri_m) @@ -13474,7 +13491,8 @@ flow_dv_translate(struct rte_eth_dev *dev, "cannot create eCPRI parser"); } flow_dv_translate_item_ecpri(dev, match_mask, - match_value, items); + match_value, items, + last_item); /* No other protocol should follow eCPRI layer. */ last_item = MLX5_FLOW_LAYER_ECPRI; break; -- 2.25.1