From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id BBE40A0584; Thu, 19 Mar 2020 10:02:54 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A222E1C026; Thu, 19 Mar 2020 10:02:54 +0100 (CET) Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20067.outbound.protection.outlook.com [40.107.2.67]) by dpdk.org (Postfix) with ESMTP id 3B6102B9E; Thu, 19 Mar 2020 10:02:53 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lJ20iMhNI+dd9OB4vQxGgTimlNyG8to0e6E7LSryC/ZOIG34eaS8eh4t9SIsLr8HY/k9hZmSpiAYqTfmV8iXpFStbLFXUxnMiVhw2IoUbN8hDnRQ2vvqsDlTiSEi+yBKjgo08y3wUtMDAWqNEfFnNQ4pWPpdVcYVlghf5CrExDdM6LqfefZ0sdZsS2tzQK7CONQrUOSuDFJfBZLSsRtdAbEw9+bHeiQ3LryoBVPMncJ7kJs+OZGmRF27notgJqxT34kMtCYp90UrkbzWlcUFqgTETSBDuh7nu4sevNXxZi0Vdi+XU54HmzE9u6mOzOx9dqodM22+d1y34bgnTUAdag== 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=DzRjRYt+75e2SrQefG0ZIojUYA+mzxT831U6DQe6JAY=; b=DzWtZZneojNBp0NOnnnDDl3RbG6YIqbfOw/T597k4jca9UlT0SMMxYORX1CYnYwreADtEMN8GVv/q3kP6ynxKt+6Oo4SbqsSmB9PpZ3MB+PZtoe7qY6WE3lGX9XgAESgufT3Ezp8Extnr3yRpCJWSdDrJ2luyKGKWmKjpBxi5zbSWXi0T0SIkFXclUL/v/hhZ1KXdYy89VJHDdx4CWepvMiPFvsF1I6J6ywrdTE8asztF+Vi1l3vqRio3w89VAcpeQPXmyQ9JZWDxRinW92asOXutEwM8STcU7YN+BtZ9bNRNSPP/LP8KH2Wn52WGKNTS8gjHahupWof9s8sCRudiw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DzRjRYt+75e2SrQefG0ZIojUYA+mzxT831U6DQe6JAY=; b=cNV5Y8eXQvoQDOvtWx47aP6/BBYt/VOz5559cq+zZ2gFCW7idIUEIb3Uga9HuLyCigfgSW5sC2Jag5o862yci8O2bkMBsQCoBIpiG2njBfQqZ8IcCD+qfvXAVweVlGLDAjGBhwzPUFfoxTZJml1d71FoKwWw+SnAbkCyLF4alL0= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=wisamm@mellanox.com; Received: from AM0PR05MB6610.eurprd05.prod.outlook.com (20.178.202.18) by AM0PR05MB4834.eurprd05.prod.outlook.com (20.177.40.204) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2835.19; Thu, 19 Mar 2020 09:02:51 +0000 Received: from AM0PR05MB6610.eurprd05.prod.outlook.com ([fe80::f9b0:5b27:21a3:c758]) by AM0PR05MB6610.eurprd05.prod.outlook.com ([fe80::f9b0:5b27:21a3:c758%3]) with mapi id 15.20.2835.017; Thu, 19 Mar 2020 09:02:51 +0000 From: Wisam Jaddo To: dev@dpdk.org, orika@mellanox.com, matan@mellanox.com Cc: rasland@mellanox.com, viacheslavo@mellanox.com, stable@dpdk.org Date: Thu, 19 Mar 2020 09:02:37 +0000 Message-Id: <20200319090237.15639-1-wisamm@mellanox.com> X-Mailer: git-send-email 2.17.1 Content-Type: text/plain X-ClientProxiedBy: PR2P264CA0002.FRAP264.PROD.OUTLOOK.COM (2603:10a6:101::14) To AM0PR05MB6610.eurprd05.prod.outlook.com (2603:10a6:208:12f::18) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from mellanox.com (37.142.13.130) by PR2P264CA0002.FRAP264.PROD.OUTLOOK.COM (2603:10a6:101::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2835.18 via Frontend Transport; Thu, 19 Mar 2020 09:02:50 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [37.142.13.130] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: e15570fe-1745-42e3-be8f-08d7cbe44dd7 X-MS-TrafficTypeDiagnostic: AM0PR05MB4834:|AM0PR05MB4834: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtFwd X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-Forefront-PRVS: 0347410860 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4636009)(366004)(199004)(5660300002)(81166006)(81156014)(6636002)(956004)(52116002)(498600001)(7696005)(86362001)(6666004)(1076003)(26005)(8936002)(2616005)(2906002)(450100002)(8676002)(16526019)(186003)(66476007)(66556008)(4326008)(36756003)(55016002)(66946007)(8886007); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR05MB4834; H:AM0PR05MB6610.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bN741wU/g4zwyqxubTUQjDk4r8XT/VJ5dKFeCItogOyDZyguF+tuZ3SuJ5RnGT28mrhhft5T+rvQhHWPz0uKKlYSdAgm3mfAtcQV9ZEuKv51y0Hafcd8gcU0U/qq5Xo4SDX8tL/35pH+G00TIKxQ2mKPVV0u9/R+eO8oCuNzp5ZBFzzRVslE+gxSjbBFb2VZy5FzP516q7V3B0Q0Rr5tlefE2Kgg7w/FWuHrtpG6mbUKC2/9WjE0sCyc25Rd6OjKcM5h0/F4b2k7tk58ijSlbIyMFKYDiYQUH3UQrWtvODG3jHeO6++TpN1ytACBO93hAEk4jzgrrJ9JLFH91tuRyRgxrt4Oz+xGMep4bbMMbAIxaFYnnHgJGj3zjGEbnzcT/pWz1cIAMrtQxN6HpbVB+DdcjHe9fQlZU+EmfOSNAkDHmo2hId0caxZq067cI/hq X-MS-Exchange-AntiSpam-MessageData: WemvxXmlVSpHLAT8VovAKuxo94OWnEXopI85OLKQGrPgu+aZDn99pO2+MzRGuMwD7ZkSu/CEXJAR2uUnsdJHceH2zixdFaRJDA2doop/HFljuOCZAsUsmYaiSYmV+IcgmKay41RVtv14jW++tA2Q7w== X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: e15570fe-1745-42e3-be8f-08d7cbe44dd7 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Mar 2020 09:02:51.7040 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Ut457wchQ1wpMizrURgbPBBVysPJGGFZyj4Sd4A12W3d5NsfelPszeAQ5tVMJnPpUsQz/XzP3tbxo+jLSILa9w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB4834 Subject: [dpdk-dev] [PATCH] net/mlx5: fix zero value validation for metadata 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" MARK and META come and go to data path, so zero value has special meaning to metadata actions/items. The special meaning is to say that this packet don't have META/MARK anymore - clear it. Thus, metadata actions/items now allowed to set/match on zero value as long as mask is not zero Fixes: fcc8d2f716fd ("net/mlx5: extend flow metadata support") Fixes: e554b672aa05 ("net/mlx5: support flow tag") Fixes: 55deee1715f0 ("net/mlx5: extend flow mark support") Cc: viacheslavo@mellanox.com Cc: stable@dpdk.org Signed-off-by: Wisam Jaddo --- doc/guides/nics/mlx5.rst | 10 ++++++++++ drivers/net/mlx5/mlx5_flow_dv.c | 20 ++++++++++++++++---- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst index afd11cd..e1e2fa4 100644 --- a/doc/guides/nics/mlx5.rst +++ b/doc/guides/nics/mlx5.rst @@ -1267,6 +1267,16 @@ Supported hardware offloads | | | ConnectX-5 | | ConnectX-5 | +-----------------------+-----------------+-----------------+ +Notes for metadata +------------------ +MARK and META come and go to data path, so zero value has special meaning to +metadata actions/items. The special meaning is to say that this packet don't +have META/MARK anymore - clear it. + +Summery: +1. Metadata actions allows setting meta, tag & mark to zero value. +2. Match on metadata items is allowed, as long as mask is not zero. + Notes for testpmd ----------------- diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 2090631..09865f6 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -1406,6 +1406,11 @@ flow_dv_validate_item_mark(struct rte_eth_dev *dev, "mark id exceeds the limit"); if (!mask) mask = &nic_mask; + else if (!mask->id) + return rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ITEM_SPEC, NULL, + "mask cannot be zero"); + ret = mlx5_flow_item_acceptable(item, (const uint8_t *)mask, (const uint8_t *)&nic_mask, sizeof(struct rte_flow_item_mark), @@ -1451,10 +1456,7 @@ flow_dv_validate_item_meta(struct rte_eth_dev *dev __rte_unused, RTE_FLOW_ERROR_TYPE_ITEM_SPEC, item->spec, "data cannot be empty"); - if (!spec->data) - return rte_flow_error_set(error, EINVAL, - RTE_FLOW_ERROR_TYPE_ITEM_SPEC, NULL, - "data cannot be zero"); + if (config->dv_xmeta_en != MLX5_XMETA_MODE_LEGACY) { if (!mlx5_flow_ext_mreg_supported(dev)) return rte_flow_error_set(error, ENOTSUP, @@ -1474,6 +1476,11 @@ flow_dv_validate_item_meta(struct rte_eth_dev *dev __rte_unused, } if (!mask) mask = &rte_flow_item_meta_mask; + else if (!mask->data) + return rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ITEM_SPEC, NULL, + "mask cannot be zero"); + ret = mlx5_flow_item_acceptable(item, (const uint8_t *)mask, (const uint8_t *)&nic_mask, sizeof(struct rte_flow_item_meta), @@ -1522,6 +1529,11 @@ flow_dv_validate_item_tag(struct rte_eth_dev *dev, "data cannot be empty"); if (!mask) mask = &rte_flow_item_tag_mask; + else if (!mask->data) + return rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ITEM_SPEC, NULL, + "mask cannot be zero"); + ret = mlx5_flow_item_acceptable(item, (const uint8_t *)mask, (const uint8_t *)&nic_mask, sizeof(struct rte_flow_item_tag), -- 2.7.4