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 874C0A04E0; Wed, 27 Nov 2019 14:45:38 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8F2AB28EE; Wed, 27 Nov 2019 14:45:37 +0100 (CET) Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70042.outbound.protection.outlook.com [40.107.7.42]) by dpdk.org (Postfix) with ESMTP id 13065CF3 for ; Wed, 27 Nov 2019 14:45:36 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=J/h8pp+ty8IfhIQz1ciIEe162lb8/I8Qf0GtZ2l7vmHHBufJfHpHpHcHthbQ+7OX1Zes94Gv6gSSTdVZSe6fpoUPLVjJoDa1uLyrVpzU5mNqY6mLvp5KPGPwBq1SXnF+oxvGZewlvVYI3x8fzQdz1yLm5RD9jEm3HzIArummdge0Z0Ipn/HSSFvfhcQbjAM8FZGuE/d4/DQ3SE22qDyXiacwktUakbgOXH4WexgcAYmlaJ5rVtJnFOSgogjcgLbiEQV4xqIo0iikI+nULfdpfsz9bZRfjpwNCZqfYfVvVCc91mCzsaPyLWtQxSLQtei82a29kLkiYK2Iexd2IXturA== 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=C7hAcSRu2FOnFjhakJBVNaJ6LQXhJUJAM7toRFoXUAI=; b=iE4Ns650UVaclI//73Q35IU941EJkxfgmmqjieqimgtGWGBvFrmhAKzdmmJrgJK/v55LdFnCU0SCr8Bpy/duGmlttYVgmB31B1cjpVv1Ztqy5XNofO64cpFbwDnnqXyNPmjD0M+KSGRpclDbmYMLLy5UQ9xWG2B62WwJKtLMQb5hfu6S61Fex2n2urA5bGmX5MoCpFLAPnGWecmahi9FZ4POu5OR2pyGr5z9Cwhxcu3HAWqB4g5D0tatLu1R67F/2ItbPjBCKyN4wan8yNxgMEo4FjoXjmozyLzuLBBOeHi1vKNndxQLuxJ2qW++1xxrh9KetToo6gqg9imxUeQnbQ== 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=C7hAcSRu2FOnFjhakJBVNaJ6LQXhJUJAM7toRFoXUAI=; b=dT6P2tAXjlV/x4WGSzoZawIY/stFKQ9XXv+wDe1vgxKqXRWmY4MtPNm2pmNBSrfO8wq3QLX1+FUQx/GrEoJ6lCIO9q8LUOYZYFpPdEEikzN00f5L/9AjOrCJxmAo7O7nO3hd1Z4/81FVUAZ8sdN+O7R7WB0r/qcKk5w5Rx/OGj4= Received: from AM4PR05MB3425.eurprd05.prod.outlook.com (10.171.190.15) by AM4PR05MB3124.eurprd05.prod.outlook.com (10.171.186.13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2474.22; Wed, 27 Nov 2019 13:45:34 +0000 Received: from AM4PR05MB3425.eurprd05.prod.outlook.com ([fe80::d877:95ed:5f94:a4a]) by AM4PR05MB3425.eurprd05.prod.outlook.com ([fe80::d877:95ed:5f94:a4a%3]) with mapi id 15.20.2474.023; Wed, 27 Nov 2019 13:45:34 +0000 From: Ori Kam To: Slava Ovsiienko , "dev@dpdk.org" CC: Matan Azrad , Raslan Darawsheh Thread-Topic: [PATCH v2] net/mlx5: fix default mark copy flow Thread-Index: AQHVpSe5OB3pLzTir0msVl3YnO9W9KefB3cg Date: Wed, 27 Nov 2019 13:45:33 +0000 Message-ID: References: <1574861803-13397-1-git-send-email-viacheslavo@mellanox.com> In-Reply-To: <1574861803-13397-1-git-send-email-viacheslavo@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=orika@mellanox.com; x-originating-ip: [193.47.165.251] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 2691b30a-250f-4fb6-9b80-08d773401397 x-ms-traffictypediagnostic: AM4PR05MB3124:|AM4PR05MB3124: 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: 023495660C x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(376002)(346002)(396003)(136003)(366004)(39860400002)(189003)(199004)(13464003)(55016002)(7696005)(76176011)(33656002)(25786009)(446003)(66556008)(66476007)(66946007)(99286004)(64756008)(8676002)(229853002)(5660300002)(14454004)(52536014)(4326008)(11346002)(2501003)(53546011)(102836004)(6506007)(186003)(26005)(316002)(2906002)(71200400001)(6436002)(9686003)(74316002)(3846002)(6116002)(8936002)(76116006)(66446008)(305945005)(6246003)(81166006)(54906003)(256004)(110136005)(81156014)(86362001)(71190400001)(7736002)(66066001)(107886003)(478600001); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR05MB3124; H:AM4PR05MB3425.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; 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: 10rwU5zIhifOwL6EkDXxWewfDe/8SpNvqOseyvhZxKnvT5lB5IWJ67B5uP/1cSJ6Fc71GfmjHJCJolpXEljzpCgxrnWqGwgaBhZ0CkKeEHj4lEzOCUbuYJgVIevZXm9x8sIfqT4cdAcv4EWA1oeJpP2/GkU5A1y0R+TYveTGXgjOg5Fx2mvii6dbCmhlfePInNEGRjWA2ntqAPKG3QVXcDCseiulHu119BfcmGfs0z1A6hZpyzJYXprRdQTmrq0iHqznCTz81k77WUkmYWg227i0BYPlLbKDSJY1+yj/pjuzxQaSSPM6EVVyEKZAC7HnFINx7xGiYrj9k5/tiJZJPc22l5EE9TdEk1vz5qkSUdJE330hTMXAAHN+frt/ZYaST5rrZluxVCpr9MiAaWcURBNGYyaz+l2vsp+ymA93QeNAaqvG/bI6rEpGjLyX+5e1 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2691b30a-250f-4fb6-9b80-08d773401397 X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Nov 2019 13:45:33.8359 (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: AOAfKYyKl4+bNXBNZhGOz2hxbhlnGsluvHaM48hQEm0IxU0JiInQIxHA9rOAsuDrDuh+maD9hgUPqcryBdTzVQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR05MB3124 Subject: Re: [dpdk-dev] [PATCH v2] net/mlx5: fix default mark copy flow 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" > -----Original Message----- > From: Viacheslav Ovsiienko > Sent: Wednesday, November 27, 2019 3:37 PM > To: dev@dpdk.org > Cc: Matan Azrad ; Raslan Darawsheh > ; Ori Kam > Subject: [PATCH v2] net/mlx5: fix default mark copy flow >=20 > In extensive metadata mode the MARK copy table is engaged, > if the application creates the flow with zero MARK ID action: >=20 > flow create 1 ingress pattern eth / ... / end actions mark id 0 / .. end >=20 > And then destroys that, the traffic to the port stops. This happens > due to default flow for the copy table has the zero ID and is removed > with the application rule. The patch extends internal ID variable > to 64 bits and provide the UINT64_MAX ID for the copy table default > rule. >=20 > Fixes: dd3c774f6ffb ("net/mlx5: add metadata register copy table") >=20 > Signed-off-by: Viacheslav Ovsiienko > --- > drivers/net/mlx5/mlx5_defs.h | 1 + > drivers/net/mlx5/mlx5_flow.c | 13 +++++++------ > 2 files changed, 8 insertions(+), 6 deletions(-) >=20 > diff --git a/drivers/net/mlx5/mlx5_defs.h b/drivers/net/mlx5/mlx5_defs.h > index 9e113c5..042e1f3 100644 > --- a/drivers/net/mlx5/mlx5_defs.h > +++ b/drivers/net/mlx5/mlx5_defs.h > @@ -174,6 +174,7 @@ > /* Size of the simple hash table for metadata register table. */ > #define MLX5_FLOW_MREG_HTABLE_SZ 4096 > #define MLX5_FLOW_MREG_HNAME "MARK_COPY_TABLE" > +#define MLX5_DEFAULT_COPY_ID UINT32_MAX >=20 > /* Definition of static_assert found in /usr/include/assert.h */ > #ifndef HAVE_STATIC_ASSERT > diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c > index 5c78ea7..0087163 100644 > --- a/drivers/net/mlx5/mlx5_flow.c > +++ b/drivers/net/mlx5/mlx5_flow.c > @@ -2947,16 +2947,16 @@ uint32_t mlx5_flow_adjust_priority(struct > rte_eth_dev *dev, int32_t priority, > mcp_res =3D (void *)mlx5_hlist_lookup(priv->mreg_cp_tbl, mark_id); > if (mcp_res) { > /* For non-default rule. */ > - if (mark_id) > + if (mark_id !=3D MLX5_DEFAULT_COPY_ID) > mcp_res->refcnt++; > - assert(mark_id || mcp_res->refcnt =3D=3D 1); > + assert(mark_id !=3D MLX5_DEFAULT_COPY_ID || mcp_res- > >refcnt =3D=3D 1); > return mcp_res; > } > /* Provide the full width of FLAG specific value. */ > if (mark_id =3D=3D (priv->sh->dv_regc0_mask & > MLX5_FLOW_MARK_DEFAULT)) > tag_spec.data =3D MLX5_FLOW_MARK_DEFAULT; > /* Build a new flow. */ > - if (mark_id) { > + if (mark_id !=3D MLX5_DEFAULT_COPY_ID) { > items[0] =3D (struct rte_flow_item){ > .type =3D MLX5_RTE_FLOW_ITEM_TYPE_TAG, > .spec =3D &tag_spec, > @@ -3054,7 +3054,7 @@ uint32_t mlx5_flow_adjust_priority(struct > rte_eth_dev *dev, int32_t priority, > } > /* > * We do not check availability of metadata registers here, > - * because copy resources are allocated in this case. > + * because copy resources are not allocated in this case. > */ > if (--mcp_res->refcnt) > return; > @@ -3133,7 +3133,8 @@ uint32_t mlx5_flow_adjust_priority(struct > rte_eth_dev *dev, int32_t priority, > /* Check if default flow is registered. */ > if (!priv->mreg_cp_tbl) > return; > - mcp_res =3D (void *)mlx5_hlist_lookup(priv->mreg_cp_tbl, 0ULL); > + mcp_res =3D (void *)mlx5_hlist_lookup(priv->mreg_cp_tbl, > + MLX5_DEFAULT_COPY_ID); > if (!mcp_res) > return; > assert(mcp_res->flow); > @@ -3166,7 +3167,7 @@ uint32_t mlx5_flow_adjust_priority(struct > rte_eth_dev *dev, int32_t priority, > !mlx5_flow_ext_mreg_supported(dev) || > !priv->sh->dv_regc0_mask) > return 0; > - mcp_res =3D flow_mreg_add_copy_action(dev, 0, error); > + mcp_res =3D flow_mreg_add_copy_action(dev, > MLX5_DEFAULT_COPY_ID, error); > if (!mcp_res) > return -rte_errno; > return 0; > -- > 1.8.3.1 Acked-by: Ori Kam Best, Ori