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 435CBA053D; Wed, 5 Aug 2020 19:09:12 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C52F22C28; Wed, 5 Aug 2020 19:09:10 +0200 (CEST) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80084.outbound.protection.outlook.com [40.107.8.84]) by dpdk.org (Postfix) with ESMTP id AB10729D2; Wed, 5 Aug 2020 19:09:08 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cBMbfHu7tkspXrl+sHKeqi6BLXe9bTUzZrs2kYw1Ta+cMqGuqzrWkXL9MISOiRYE+IUxnCXx9YVTMJC/b+6W914ZEr7Z8niO12Z+jI3wnXnEtND6mFUdfITScgymh2gS5NkCCEpXlNLR04VO6eTmX7B5wFacEUadR0j/jf8XAhRyE8N8uG/rcYNSdDannSRfgKmKqYNwsrzzoc0mg32osKfTudjEHz1W/eIJo6rmbAU2RP2I6zi4FLNMdvy9qe4+ga6eN2D1I4r6qyKP9lT21M4ALc2ImyvEF3jrA0WAgcmdFuE/2Ds00jOK/UfrHuIMU7PaA4TkLTl9EUbP0qxRrw== 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=7YrfGHId4gDe6ECk7f5GB2eilpC3eu/j4+8BsfUmAww=; b=c+6/99uLRfu6/xmgGl4D4caOm8Z7on6TRuYWMQZZb1kPsEmjxolt06c1dcR1dIOGIdZG1fQgFD2SQ3FB1k7aacgGwNGBFvQ0a42Dm8m82wAwzBK6EsP76gdinpRERjFdrVbdeE3/8EAjdoyfhn+f/3K0TMWUz4pwJyvGM+nBKUj7EDBhogg/0MRwR/xhtKXilhtCNTiEviie5vOadfEksu5D6KM9pjUKe8XIvI5bx494WFtENjlal8bNHIJX+szsVEOb75hdqeKDaOdVykKHNx6KNixCDzFMAhdkQtdakYb9bU2JCWp28QboJLqyrtzVHlqHFO86nbssM6HCuV8qvw== 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=7YrfGHId4gDe6ECk7f5GB2eilpC3eu/j4+8BsfUmAww=; b=UT0u8SN/Ip3iLHQEWMvLk2eLqTPcUZjHyEQJK+ScRO0xCWNfbradX3fuVcRV1dTZKLfiaCZI54hF7F7zVgGxJEhIuhC2UxESpQMc/NqRNk9LOjIYKOBNDZU33Q2tYnPaNw/bbpaznXS/VzqdhMYOkzjzCBsJA+DmU4iIIXdDsUQ= Received: from AM4PR05MB3265.eurprd05.prod.outlook.com (2603:10a6:205:8::26) by AM0PR05MB6737.eurprd05.prod.outlook.com (2603:10a6:20b:159::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.15; Wed, 5 Aug 2020 17:09:07 +0000 Received: from AM4PR05MB3265.eurprd05.prod.outlook.com ([fe80::194e:dc46:7543:50ed]) by AM4PR05MB3265.eurprd05.prod.outlook.com ([fe80::194e:dc46:7543:50ed%2]) with mapi id 15.20.3239.022; Wed, 5 Aug 2020 17:09:07 +0000 From: Slava Ovsiienko To: "xiangxia.m.yue@gmail.com" CC: "dev@dpdk.org" , "stable@dpdk.org" Thread-Topic: [PATCH dpdk-dev v2] net/mlx5: check the reg available for metadata action Thread-Index: AQHWMbt76L4UMAhTP02yketHgZVKyqkqMYxg Date: Wed, 5 Aug 2020 17:09:07 +0000 Message-ID: References: <20200520013328.98838-1-xiangxia.m.yue@gmail.com> <20200524110641.72147-1-xiangxia.m.yue@gmail.com> In-Reply-To: <20200524110641.72147-1-xiangxia.m.yue@gmail.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=mellanox.com; x-originating-ip: [95.164.10.10] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 63a8e393-eda8-41e1-688e-08d83962438c x-ms-traffictypediagnostic: AM0PR05MB6737: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 7YQ11vPGoDVAtH42lwcsTMQde0nzARQlYuOHUJ0cXzNueMWS9JKqzZy3X9u0DpyhNUl+fa4U6sUXi37XOUJd3BW/Qv0uwcsUzIujHBKGSF6MiJAmEL6hNzGVTMOHLCJgr3Vi6tly2Xh2EcS++7P+4mljI4vnERQ7kJveemN1LLq09u3S/CQ/HDph5LZddV0UOb9S/b/N3NLrGOa17Mf0wGqQew9C2T9gz+aOwEsZqtwiFUpZRWJkOkI++YdcO4mu1PTCOB0BuJl4Y66GmUuuvLgbr5azpEnjnz1aZO7GVAjDEgQxwO1rs1/RWcx6oebDBXGcckJaPsyRBXW3Url02+qXTnpW0Dnmn2g6i+9vS8o= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM4PR05MB3265.eurprd05.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(39860400002)(376002)(136003)(346002)(366004)(396003)(45080400002)(26005)(66446008)(4326008)(83380400001)(8676002)(64756008)(6916009)(186003)(8936002)(86362001)(6506007)(53546011)(33656002)(55016002)(478600001)(71200400001)(66556008)(66476007)(7696005)(52536014)(66946007)(316002)(2906002)(966005)(54906003)(5660300002)(76116006)(9686003); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: APY7nUh8SmpB0QKwe1dZo5EO8/SA0z9rFdE7tLq0Op1G5YpVB6uVo9rXFLK21cE1jVmWQScyS7dNbtCPZo2R0V6zEdH8wuPlvLTOALyQBfVYJ/ZNlYbqG0BppcuAgDaBmVsWXHrZhYblNbSnbF4HO5znJnb5SlY5MjZMnf1kzlph+vu0nJOhzpy2Ds2sKjTw8UmVzQqUGUzDtyif/6aRk+GZbiyhcP9TzSBhDhfrw0uYn77nuvUt3cAeZ5X914sXyp1/T0gh5ClUDHPRe8trgnawaE8lHcrmwexPNz1LmcB4Ww6D0V1V8yDljpGUTmt2+okZGVSMgXkiSPsDD1BYn+5HwMmQY5LuPmiovvmOsRjHx7wLqOUIx6KqVJKGvYOLX1SGYM/J5+0tb9ZClO/mZSfk3v74+1M/NqG6mXdKE8bHdab4inASuln+i5zDkE1haVNrk3sO6SUMmCq3PqoRMU5DlhW+ANQxQRyDu0g9hLR/hWJPUGozwtNm3i72fJ2vspW7493kmamWDUQOGKq2AJN0Jh/1Ps6uADtX6SyClfS/3zk/zVBLtvlq5eDb6rku/esJFC5JLxXNcre5lTYd91lwcFV4mUGk/lXQkit3GpxZROm0vHJ/4pipKayFZZsROc9a2nXmSLzoEEd0N0YQ6g== x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: AM4PR05MB3265.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 63a8e393-eda8-41e1-688e-08d83962438c X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Aug 2020 17:09:07.4659 (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: 2ZHfLxcPritmIFNlytC9wK8n5rowHcLnDpMP7segwBb0PFWbgDjD+TCTcQksZkz0/4IkgDeco4cTujByV5FlmUtoC5lb/GBbbrL9UDfqQAE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB6737 Subject: Re: [dpdk-dev] [PATCH dpdk-dev v2] net/mlx5: check the reg available for metadata action 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" Hi, Tonghao Thank you for the patch, and a lot of my apologizes - I mixed up your patc= h with other fix and thought we did not need it. Now I reviwed it again - we fixed flow_= dv_validate_item_meta() (in other way - with explicit register check) but flow_dv_validate_action_s= et_meta() still needs the fix. Would you like to rebase your patch and send v3 or prefer to let us do it? With best regards, Slava > -----Original Message----- > From: xiangxia.m.yue@gmail.com > Sent: Sunday, May 24, 2020 14:07 > To: Slava Ovsiienko > Cc: dev@dpdk.org; Tonghao Zhang ; > stable@dpdk.org > Subject: [PATCH dpdk-dev v2] net/mlx5: check the reg available for metada= ta > action >=20 > From: Tonghao Zhang >=20 > If user don't set the dv_xmeta_en to 1 or 2, in the > flow_dv_convert_action_set_meta function: > * flow_dv_get_metadata_reg may return the REG_NONE, > when MLX5_METADATA_FDB enabled for metadata set > action. > * reg_to_field(REG_NONE) return MLX5_MODI_OUT_NONE > which is invalid. >=20 > The rdma-core calltrace: > dr_action_create_modify_action > dr_actions_convert_modify_header > dr_action_modify_sw_to_hw > dr_action_modify_sw_to_hw_set > dr_ste_get_modify_hdr_hw_field >=20 > sw_field [MLX5_MODI_OUT_NONE 4095] > should not > ste_ctx->modify_hdr_field_arr_sz [92] >=20 > As doc[1] says: > | dv_xmeta_en 0, this is default value, defines the legacy mode, the > | MARK and META related actions and items operate only within NIC Tx and > | NIC Rx steering domains, no MARK and META information crosses the > | domain boundaries. >=20 > This patch add check for that case to warn that not supported. >=20 > [1] - > https://eur03.safelinks.protection.outlook.com/?url=3Dhttp%3A%2F%2Fdoc.dp > dk.org%2Fguides- > 20.02%2Fnics%2Fmlx5.html&data=3D02%7C01%7Cviacheslavo%40mellan > ox.com%7Ce55c7bccccd14490af4208d7ffd29c78%7Ca652971c7d2e4d9ba6a > 4d149256f461b%7C0%7C0%7C637259152350270223&sdata=3DPiDsa8dD > 4bJrGL2FGHWUOybIAMD5pxq8p5vxmtlS9lc%3D&reserved=3D0 > Fixes: fcc8d2f716fd ("net/mlx5: extend flow metadata support") > Cc: stable@dpdk.org >=20 > Signed-off-by: Tonghao Zhang > --- > drivers/net/mlx5/mlx5_flow_dv.c | 31 +++++++++++++++++++------------ > 1 file changed, 19 insertions(+), 12 deletions(-) >=20 > diff --git a/drivers/net/mlx5/mlx5_flow_dv.c > b/drivers/net/mlx5/mlx5_flow_dv.c index e4818319507c..c77835270d60 > 100644 > --- a/drivers/net/mlx5/mlx5_flow_dv.c > +++ b/drivers/net/mlx5/mlx5_flow_dv.c > @@ -1251,6 +1251,7 @@ flow_dv_convert_action_set_meta >=20 > if (reg < 0) > return reg; > + MLX5_ASSERT(reg !=3D REG_NONE); > /* > * In datapath code there is no endianness > * coversions for perfromance reasons, all @@ -1449,7 +1450,6 @@ > flow_dv_validate_item_meta(struct rte_eth_dev *dev __rte_unused, > struct rte_flow_error *error) > { > struct mlx5_priv *priv =3D dev->data->dev_private; > - struct mlx5_dev_config *config =3D &priv->config; > const struct rte_flow_item_meta *spec =3D item->spec; > const struct rte_flow_item_meta *mask =3D item->mask; > struct rte_flow_item_meta nic_mask =3D { @@ -1463,23 +1463,25 > @@ flow_dv_validate_item_meta(struct rte_eth_dev *dev __rte_unused, >=20 > RTE_FLOW_ERROR_TYPE_ITEM_SPEC, > item->spec, > "data cannot be empty"); > - if (config->dv_xmeta_en !=3D MLX5_XMETA_MODE_LEGACY) { > - if (!mlx5_flow_ext_mreg_supported(dev)) > - return rte_flow_error_set(error, ENOTSUP, > + if (!mlx5_flow_ext_mreg_supported(dev)) > + return rte_flow_error_set(error, ENOTSUP, > RTE_FLOW_ERROR_TYPE_ITEM, > item, > "extended metadata register" > " isn't supported"); > - reg =3D flow_dv_get_metadata_reg(dev, attr, error); > - if (reg < 0) > - return reg; > - if (reg =3D=3D REG_B) > - return rte_flow_error_set(error, ENOTSUP, > + reg =3D flow_dv_get_metadata_reg(dev, attr, error); > + if (reg < 0) > + return reg; > + if (reg =3D=3D REG_NONE) > + return rte_flow_error_set(error, ENOTSUP, > + RTE_FLOW_ERROR_TYPE_ITEM, > item, > + "unavailable metadata register"); > + if (reg =3D=3D REG_B) > + return rte_flow_error_set(error, ENOTSUP, > RTE_FLOW_ERROR_TYPE_ITEM, > item, > "match on reg_b " > "isn't supported"); > - if (reg !=3D REG_A) > - nic_mask.data =3D priv->sh->dv_meta_mask; > - } > + if (reg !=3D REG_A) > + nic_mask.data =3D priv->sh->dv_meta_mask; > if (!mask) > mask =3D &rte_flow_item_meta_mask; > if (!mask->data) > @@ -2244,6 +2246,11 @@ flow_dv_validate_action_set_meta(struct > rte_eth_dev *dev, > reg =3D flow_dv_get_metadata_reg(dev, attr, error); > if (reg < 0) > return reg; > + if (reg =3D=3D REG_NONE) > + return rte_flow_error_set(error, ENOTSUP, > + RTE_FLOW_ERROR_TYPE_ACTION, > + action, "unavailable " > + "metadata register"); > if (reg !=3D REG_A && reg !=3D REG_B) { > struct mlx5_priv *priv =3D dev->data->dev_private; >=20 > -- > 2.26.1