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 48F43A05D3 for ; Thu, 25 Apr 2019 09:02:12 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 45BC91B560; Thu, 25 Apr 2019 09:02:11 +0200 (CEST) Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20070.outbound.protection.outlook.com [40.107.2.70]) by dpdk.org (Postfix) with ESMTP id DE3FC1B551 for ; Thu, 25 Apr 2019 09:02:09 +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=gK2vL8m38exR/oqNhVW1JALCh2Bin7gZbFZnmuFDo1s=; b=QdPvTPDmK5sqXKK+mCJa7zeiP/9gPfOht6D6FFDR1W+mGLolaUcsI74uVbEcvk1QOw+L2bE2LO/ra/e2K7W4ZiFG5niscBps/WZL4o5DXO0jCaovLUUfTavDJ6MOsLXkOZrhAUcxZMf5OXK29uCqA+uiQGwk5Gs6Ue3X05fzBu8= Received: from AM4PR05MB3425.eurprd05.prod.outlook.com (10.171.190.15) by AM4PR05MB3315.eurprd05.prod.outlook.com (10.171.190.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1813.14; Thu, 25 Apr 2019 07:02:08 +0000 Received: from AM4PR05MB3425.eurprd05.prod.outlook.com ([fe80::a4d7:6c70:9829:2cc8]) by AM4PR05MB3425.eurprd05.prod.outlook.com ([fe80::a4d7:6c70:9829:2cc8%6]) with mapi id 15.20.1835.010; Thu, 25 Apr 2019 07:02:08 +0000 From: Ori Kam To: Yongseok Koh CC: Shahaf Shuler , Matan Azrad , "dev@dpdk.org" Thread-Topic: [PATCH] net/mlx5: fix E-Switch flow without port item Thread-Index: AQHU+hf7Xs4grf92CE28QunURSus3KZMclgQ Date: Thu, 25 Apr 2019 07:02:07 +0000 Message-ID: References: <1556018356-86706-1-git-send-email-orika@mellanox.com> <20190423210309.GD16628@mtidpdk.mti.labs.mlnx> In-Reply-To: <20190423210309.GD16628@mtidpdk.mti.labs.mlnx> 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: [185.175.35.255] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 01d99119-ac22-49bf-61e9-08d6c94beeda 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:AM4PR05MB3315; x-ms-traffictypediagnostic: AM4PR05MB3315: x-microsoft-antispam-prvs: x-forefront-prvs: 0018A2705B x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39860400002)(136003)(346002)(396003)(366004)(376002)(189003)(13464003)(199004)(316002)(6246003)(476003)(2906002)(52536014)(478600001)(25786009)(6436002)(55016002)(486006)(81166006)(5660300002)(14454004)(229853002)(6116002)(71190400001)(3846002)(71200400001)(6636002)(33656002)(6862004)(8936002)(81156014)(9686003)(8676002)(53936002)(68736007)(66066001)(4326008)(66446008)(66556008)(11346002)(76116006)(26005)(76176011)(73956011)(186003)(446003)(86362001)(64756008)(66476007)(6506007)(54906003)(97736004)(102836004)(14444005)(7736002)(256004)(74316002)(305945005)(53546011)(66946007)(7696005)(99286004)(7756004); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR05MB3315; 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-message-info: GW4YR2FGqB0IgBbC53hna3Nkqz/9WkHYaCxAYQKqOeRJvEr+uCemVMgo8tNndFqw+rtbpmwnmRp50H3q8DIM8NsR9WaMIb7bUFjuASOAsViK3IwNX4Ve41TGHnB+E5BMY0uMM8UQ+u6Hv4pqNpnbdLPcUoaNmUBUcr6yYVDZg98tjBEghPkSKoS8BZrPtUmUy7OLP1aBdgsEk0a9y64cn1+DwomBulM7LXmXJYMNRiAAer3s4euZYQ3I9nb/DkKo74hYzIORAUMuTR+FO0kemOaQIFdzNRgo6WrHuyo4aAqWewP6Sw6bSJ5Kpb42FXdaKPRFGQq3TL4n2tDSs1xNfPpHcPOT+clx10YIwGiApOL+TcqVJEgc86ur441z6sPGSkOgXJJgKUbw1SufvpMirP3cFb+J7MafN8zRHn5u+WI= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 01d99119-ac22-49bf-61e9-08d6c94beeda X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Apr 2019 07:02:08.4912 (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: AM4PR05MB3315 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: <20190425070207.XwpcZke3ReCwB5StSx4MwB7gR_lHoOKSFD3fu7Ci_GU@z> Hi Yongseok, PSB, Ori > -----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. > > > > 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. > > > > Fixes: 822fb3195348 ("net/mlx5: add port id item to Direct Verbs") > > > > Signed-off-by: Ori Kam > > --- > > drivers/net/mlx5/mlx5_flow_dv.c | 30 +++++++++++++++--------------- > > 1 file changed, 15 insertions(+), 15 deletions(-) > > > > 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; > > > > 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; > > > > 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? >=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 w= hen it will be relevant. Regarding the if you wrote there should be only one ! not 2 since this code= is relevant only if the user didn't specified port_id. Am I right? > 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 I will remove this code. > > + /* > > + * Add matching on source vport index only > > + * for ingress rules in E-Switch configurations. > > + */ >=20 > Please make this comment appropriate as well. >=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. > 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 > >