From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 90087A05D3 for ; Thu, 25 Apr 2019 19:53:34 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2067A5F17; Thu, 25 Apr 2019 19:53:33 +0200 (CEST) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80071.outbound.protection.outlook.com [40.107.8.71]) by dpdk.org (Postfix) with ESMTP id AE6B45B1E for ; Thu, 25 Apr 2019 19:53:31 +0200 (CEST) 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=wJLt1MJUF9I9G0PUynNYlAk8K4YzhTmRHE9ZPbCgcQo=; b=q1e/Msron+DmY9p1uAu86UhTOYk+zsKAD50ajIemI2W/mCz4HJpJKtx8Pv7ZzVCTUZTUJPDKvrtQiulx0USjfiGcan803INsmjxFfhF5McemPYP0EABg4Dcuwol6hhpXoafBuTuVzzVFlfK1foPsTrT/CskGzW8ue5XLybdmCYg= Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com (52.134.72.27) by DB3PR0502MB4074.eurprd05.prod.outlook.com (52.134.72.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1835.12; Thu, 25 Apr 2019 17:53:29 +0000 Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::e8d5:4aff:902d:6e98]) by DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::e8d5:4aff:902d:6e98%5]) with mapi id 15.20.1835.010; Thu, 25 Apr 2019 17:53:29 +0000 From: Yongseok Koh To: Ori Kam CC: Shahaf Shuler , Matan Azrad , "dev@dpdk.org" Thread-Topic: [PATCH] net/mlx5: fix E-Switch flow without port item Thread-Index: AQHU+cZsk2EJtaONpk6xpIRjcG6kJ6ZJxwKAgAKvB4CAALX9AA== Date: Thu, 25 Apr 2019 17:53:29 +0000 Message-ID: <3502BB31-6EF4-45DE-8EC8-4AA20CC08671@mellanox.com> References: <1556018356-86706-1-git-send-email-orika@mellanox.com> <20190423210309.GD16628@mtidpdk.mti.labs.mlnx> In-Reply-To: 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=yskoh@mellanox.com; x-originating-ip: [209.116.155.178] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: e5bf5307-11ee-4d45-8de2-08d6c9a6ecf9 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600141)(711020)(4605104)(4618075)(2017052603328)(7193020); SRVR:DB3PR0502MB4074; x-ms-traffictypediagnostic: DB3PR0502MB4074: x-microsoft-antispam-prvs: x-forefront-prvs: 0018A2705B x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(136003)(39860400002)(376002)(346002)(366004)(189003)(199004)(13464003)(2906002)(186003)(86362001)(68736007)(97736004)(229853002)(8676002)(6486002)(8936002)(14454004)(6436002)(478600001)(6636002)(99286004)(81166006)(6246003)(6862004)(37006003)(4326008)(316002)(25786009)(54906003)(33656002)(7736002)(305945005)(76116006)(53936002)(102836004)(6512007)(66556008)(3846002)(64756008)(73956011)(6506007)(76176011)(81156014)(66476007)(66446008)(91956017)(6116002)(53546011)(66946007)(71190400001)(36756003)(71200400001)(256004)(5660300002)(26005)(476003)(486006)(446003)(11346002)(2616005)(82746002)(83716004)(14444005)(66066001); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR0502MB4074; H:DB3PR0502MB3980.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-message-info: mGVL5gwDTYRUioiSEjN0rYGRC8Nbnq+MHnVy9asWmTlVwM8vi/4iX2+tpbqPlRmF6ZRXW9x5wuN9+gfhT9+vbxqRuyE2Y5Hvcdcs1QktpvbB/bJ4bU8kqS54vluyvEGsDgPrpX/p4ac0c9v1UZdejFkv6/JXjbtILLVIC/b2YIP4o0Vj0QxFeZgB2crM5fxw/iAlg/bscASk5QIoC25RByqLBwjiRfS8LPzP9hsor7fQuVyf/HvKikZHX43Ox3mwMCd6+lTlgdT1oZhFYsAZ+51vApDVx7+pZlyp3mVIxtsXfZahzKlST/ADhgkP5ozypOOnQqpMTP5+9gL/6gZqM7xbTIxLFSZMsF9krZaHg1BP6nVoLg4rA74p9tE0OAJpGKWj498+hwpyho0j5DMUIIU3wA/E64UZuxJoIw1+GKo= Content-Type: text/plain; charset="UTF-8" Content-ID: <112396831FDF5643A0F5955BD12CA479@eurprd05.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: e5bf5307-11ee-4d45-8de2-08d6c9a6ecf9 X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Apr 2019 17:53:29.6315 (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-Transport-CrossTenantHeadersStamped: DB3PR0502MB4074 Subject: Re: [dpdk-dev] [PATCH] net/mlx5: fix E-Switch flow without port item 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" Message-ID: <20190425175329.6m7mMh7-NNVWhc9mWv3psw04U9n-rA2olfIPSl8O0JI@z> > On Apr 25, 2019, at 12:02 AM, Ori Kam wrote: >=20 > Hi Yongseok, > PSB, >=20 > Ori >=20 >> -----Original Message----- >> From: Yongseok Koh >> Sent: Wednesday, April 24, 2019 12:03 AM >> To: Ori Kam >> Cc: Shahaf Shuler ; Matan Azrad >> ; dev@dpdk.org >> Subject: Re: [PATCH] net/mlx5: fix E-Switch flow without port item >>=20 >> On Tue, Apr 23, 2019 at 11:19:16AM +0000, Ori Kam wrote: >>> When creating a flow rule without the port_id pattern item, always the >>> PF was selected. >>>=20 >>> This commit fixes this issue, if no port_id pattern item is available >>> then we use the port that the flow was created on as source port. >>>=20 >>> Fixes: 822fb3195348 ("net/mlx5: add port id item to Direct Verbs") >>>=20 >>> Signed-off-by: Ori Kam >>> --- >>> drivers/net/mlx5/mlx5_flow_dv.c | 30 +++++++++++++++--------------- >>> 1 file changed, 15 insertions(+), 15 deletions(-) >>>=20 >>> diff --git a/drivers/net/mlx5/mlx5_flow_dv.c >> b/drivers/net/mlx5/mlx5_flow_dv.c >>> index c2a2fc6..d17adbe 100644 >>> --- a/drivers/net/mlx5/mlx5_flow_dv.c >>> +++ b/drivers/net/mlx5/mlx5_flow_dv.c >>> @@ -3623,6 +3623,8 @@ struct field_modify_info modify_tcp[] =3D { >>> union flow_dv_attr flow_attr =3D { .attr =3D 0 }; >>> struct mlx5_flow_dv_tag_resource tag_resource; >>> uint32_t modify_action_position =3D UINT32_MAX; >>> + void *match_mask =3D matcher.mask.buf; >>> + void *match_value =3D dev_flow->dv.value.buf; >>>=20 >>> flow->group =3D attr->group; >>> if (attr->transfer) >>> @@ -3895,23 +3897,8 @@ struct field_modify_info modify_tcp[] =3D { >>> } >>> dev_flow->dv.actions_n =3D actions_n; >>> flow->actions =3D action_flags; >>> - if (attr->ingress && !attr->transfer && >>> - (priv->representor || priv->master)) { >>> - /* It was validated - we support unidirection flows only. */ >>> - assert(!attr->egress); >>> - /* >>> - * Add matching on source vport index only >>> - * for ingress rules in E-Switch configurations. >>> - */ >>> - flow_dv_translate_item_source_vport(matcher.mask.buf, >>> - dev_flow->dv.value.buf, >>> - priv->vport_id, >>> - 0xffff); >>> - } >>> for (; items->type !=3D RTE_FLOW_ITEM_TYPE_END; items++) { >>> int tunnel =3D !!(item_flags & MLX5_FLOW_LAYER_TUNNEL); >>> - void *match_mask =3D matcher.mask.buf; >>> - void *match_value =3D dev_flow->dv.value.buf; >>>=20 >>> switch (items->type) { >>> case RTE_FLOW_ITEM_TYPE_PORT_ID: >>> @@ -4018,6 +4005,19 @@ struct field_modify_info modify_tcp[] =3D { >>> } >>> item_flags |=3D last_item; >>> } >>> + if (((attr->ingress && !attr->transfer) || >>> + (attr->transfer && !(item_flags & MLX5_FLOW_ITEM_PORT_ID))) >> && >>> + (priv->representor || priv->master)) { >>=20 >> From the validations, I could figure out >> - Either ingress (I) or egress (E) must be specified >> - Transfer (T) can't be egress > 0> - Port ID (P) is valid only if transfer (T) is specified. >>=20 >> (!T and I) or (T and !P) >> =3D (I - T) + (T - P) >> =3D I - P >>=20 >> So, this condition is equivalent to >> if (attr->ingress && !!(item_flags & MLX5_FLOW_ITEM_PORT_ID) && >> (priv->representor || priv->master)) { >> ... >> } >>=20 >> Right? Right that was my typo. Thanks, Yongseok >>=20 >=20 > You are right that we correnlty only support ingress rules for E-Switch, = I want to keep it open if in future we > will support also egress for E-Switch rules, but I guess we can update it= when it will be relevant. > Regarding the if you wrote there should be only one ! not 2 since this co= de is relevant only if the user > didn't specified port_id. >=20 > Am I right? >=20 >> If agreed, please add comment properly. >>=20 >>> + /* It was validated - we support unidirection flows only. */ >>> + assert(!attr->egress); >>=20 >> This comment and assert are there to mention ingress and egress are >> exclusive. >> Is it still relevant? Did you also test the patch with enabling DEBUG? >>=20 >=20 > I will remove this code. >=20 >>> + /* >>> + * Add matching on source vport index only >>> + * for ingress rules in E-Switch configurations. >>> + */ >>=20 >> Please make this comment appropriate as well. >>=20 >=20 > This comment is correct, due to the second part of the if (E-Switch mode = is enabled, never mind if=20 > it is E-Switch rule or Nic rule), but I will remove this comment and add = it as part of the if updated comment. >=20 >> Thanks, >> Yongseok >>=20 >>> + if (flow_dv_translate_item_port_id(dev, match_mask, >>> + match_value, NULL)) >>> + return -rte_errno; >>> + } >>> assert(!flow_dv_check_valid_spec(matcher.mask.buf, >>> dev_flow->dv.value.buf)); >>> dev_flow->layers =3D item_flags; >>> -- >>> 1.8.3.1