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 37624A05D3 for ; Thu, 25 Apr 2019 19:54:17 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E39D67CB0; Thu, 25 Apr 2019 19:54:16 +0200 (CEST) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80054.outbound.protection.outlook.com [40.107.8.54]) by dpdk.org (Postfix) with ESMTP id A416A5F17 for ; Thu, 25 Apr 2019 19:54:15 +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=OWG5lecHAqipszikMDVtxSDEDUKX8YwxpXiGHdfvhEo=; b=e+mpMXQNpWi/QoQEWUOxJu9q2OdfadfSDiBtS5jRaqYiFHtE1kqVXO94NeTiGNcN1J9SRbzDMkQcfusddgLe0s0bTpOB3Yd2JjQ4dK3Tly+Nkz4bQgZ554kuq9Pj8A5zh0puOWjpchTG6FmmCq7zRfrJZz4wuygJjpZKpoBwHv0= 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:54:14 +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:54:14 +0000 From: Yongseok Koh To: Ori Kam CC: Shahaf Shuler , "dev@dpdk.org" Thread-Topic: [PATCH v2] net/mlx5: fix E-Switch flow without port item Thread-Index: AQHU+2F7gvmPe8x5rE+xbBgM2tzyLaZNKQWA Date: Thu, 25 Apr 2019 17:54:14 +0000 Message-ID: References: <1556018356-86706-1-git-send-email-orika@mellanox.com> <1556194855-12679-1-git-send-email-orika@mellanox.com> In-Reply-To: <1556194855-12679-1-git-send-email-orika@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=yskoh@mellanox.com; x-originating-ip: [209.116.155.178] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 828ab1a4-2b5a-4156-d34c-08d6c9a707b8 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)(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: SVbAm60LmYXCdCK8lA2wsKq59O6gPGpuiXanimQRZKBD215vVEZ89TwyrVheXOE1xmalYP4W/rIpeqhfUA0bw3NMfWDk1Ii2Lir/hkPLdRa0UAuanASKVfbKIR5K9fPj18IJEQyvP7hLU+PLF7KBs+/5+4wm1sX/H3371wCyR4bfEOShWFSNmvXOkTWNEivbwMy6k5m6lCHFxAFcQDfGmxAbcvxKxsGrlfi/mJiM1PTh09SAQGmlzKfUtDYDH384V90K5EpZn/y0JUs4O3p02cz7SyZjBCeuyRHA+k7wx6r9e8kT7wbbW4cZmlzhEJzNSD9mBduOi858oE8fW5mOwyG85eWPnhReHxSTFxwdHsyG0hFXeP7e8qVc2PIlNAGMcxS1IhM3exBSG8KUdXPA/67gkdyUF0tL4dbfNeLMHtk= Content-Type: text/plain; charset="UTF-8" Content-ID: <30FAF56702CBFF40AFE7DBC3DE5D65D0@eurprd05.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 828ab1a4-2b5a-4156-d34c-08d6c9a707b8 X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Apr 2019 17:54:14.4767 (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 v2] 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: <20190425175414.uurEtvWiktqmtrHyRjuxRloxfWD_DELwB0-xIl750f8@z> > On Apr 25, 2019, at 5:20 AM, Ori Kam wrote: >=20 > 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 > --- Acked-by: Yongseok Koh > 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..b3f802d 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; > } > + /* > + * In case of ingress traffic when E-Switch mode is enabled, > + * we have two cases where we need to set the source port manually. > + * The first one, is in case of Nic steering rule, and the second is > + * E-Switch rule where no port_id item was found. In both cases > + * the source port is set according the current port in use. > + */ > + if ((attr->ingress && !(item_flags & MLX5_FLOW_ITEM_PORT_ID)) && > + (priv->representor || priv->master)) { > + 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; > --=20 > 1.8.3.1 >=20