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 EC785A0487 for ; Tue, 30 Jul 2019 07:05:49 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DFE4F1BF62; Tue, 30 Jul 2019 07:05:48 +0200 (CEST) Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00075.outbound.protection.outlook.com [40.107.0.75]) by dpdk.org (Postfix) with ESMTP id EB5121BF07 for ; Tue, 30 Jul 2019 07:05:44 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aKPCJpwDAmPrzeeqAt294iECsVTaB1mrUnyRkWXtEQonpYXrDLLBWVlkWu9YJpl9aByxSErttqAq79IqA3VdkeOczsMq9eylAdjIH6U3mH+pdRG0DIL+SLbbqyYZPLirVKwn0jNY8nmMssnjfGFFfa8YG5Aj9B1Ca0b+aqiFHu+VckVqGoqgztmbzVj8POjFspy9nZY0eE8sZtR2Ih30dthOSPmfqLD2227tAUPupeN0ws+b0HBRvnzqD9u7EqV0gpNXcCrv5P08fNPhBeLLLhKaon4ZbWH3STgrtzU57SjwLU67uIdamFBhm4D7vkraavcXrAaCkXbUVn5KDTPuNg== 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=RnP8LuiIwDQ3kPSbl1M4abZVB+xtaZ6IpCLuwesVw3A=; b=CDU2w95FPBFZUTs9LAIyKZwNrC5Hi0JuUkJYTprxrEv17OSot6HJ5y+MKG6jl+ZspI4fi+omeLmyPoYSljF8/yAvpGEjnxdvn2Flf8MmwtL+rWUwvmpchjSZ8WHXTX2B8z1V2WfJKtP1lFLS5SLMB9zBzbMwgQvuLOl2oYMP7HV28zQWyA2Lv1cqd9mqR4nv0FaK8LucGMHI1Vn2EWLxpi+pdbtpA2rJ4xqSyV69fcrl0oTPrBAMUFpjOepYlG/g332YaOxVljLuwv2+UtS12sXF4x5Fhu9G2lqyJPy+POMFP3SKJAWyVquXRhrN0gi4l0XFO0yX37x1JLRC82w3Bw== 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=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RnP8LuiIwDQ3kPSbl1M4abZVB+xtaZ6IpCLuwesVw3A=; b=kOPANiERlT5zyGbaY+1y0WaMicwCl+wdqUcrJnKbZqmmNGCwTWFL1hzVZ3jvt9Ym41kx28iKQrf6SocWceFqIKQs75feDEinVNGAbOkmyW2Q6rFUSnC8yMrYEV0CZvczSEDjjvFzfa1qsL1SwEyKECCQ0LG76HZ+q3Fnn3osPzc= Received: from AM0PR0502MB3795.eurprd05.prod.outlook.com (52.133.45.150) by AM0PR0502MB3748.eurprd05.prod.outlook.com (52.133.44.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2115.15; Tue, 30 Jul 2019 05:05:43 +0000 Received: from AM0PR0502MB3795.eurprd05.prod.outlook.com ([fe80::5d2f:4ed:6a8d:e7ff]) by AM0PR0502MB3795.eurprd05.prod.outlook.com ([fe80::5d2f:4ed:6a8d:e7ff%3]) with mapi id 15.20.2115.005; Tue, 30 Jul 2019 05:05:43 +0000 From: Shahaf Shuler To: Slava Ovsiienko , "dev@dpdk.org" CC: Yongseok Koh Thread-Topic: [dpdk-dev] [PATCH v2] net/mlx5: fix ESXi VLAN in virtual machine Thread-Index: AQHVRiITDjqK0FB67E6ApudfOLTPdKbimsoA Date: Tue, 30 Jul 2019 05:05:43 +0000 Message-ID: References: <1563198320-29068-1-git-send-email-viacheslavo@mellanox.com> <1564414004-24336-1-git-send-email-viacheslavo@mellanox.com> In-Reply-To: <1564414004-24336-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=shahafs@mellanox.com; x-originating-ip: [31.154.10.105] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: ab844e94-7a54-428a-326a-08d714ab933c x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600148)(711020)(4605104)(1401327)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7193020); SRVR:AM0PR0502MB3748; x-ms-traffictypediagnostic: AM0PR0502MB3748: x-ms-exchange-purlcount: 1 x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-forefront-prvs: 0114FF88F6 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(39860400002)(376002)(366004)(396003)(136003)(346002)(199004)(189003)(2906002)(68736007)(8676002)(316002)(14444005)(33656002)(256004)(6436002)(229853002)(25786009)(4326008)(11346002)(81156014)(81166006)(74316002)(7736002)(476003)(52536014)(2501003)(86362001)(8936002)(446003)(966005)(478600001)(14454004)(305945005)(107886003)(5660300002)(66446008)(3846002)(76116006)(486006)(99286004)(66066001)(6116002)(66476007)(6506007)(186003)(55016002)(66556008)(71190400001)(71200400001)(7696005)(110136005)(6306002)(6246003)(53936002)(76176011)(9686003)(66946007)(102836004)(64756008)(45080400002)(26005); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR0502MB3748; H:AM0PR0502MB3795.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX: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: l/zQJH86cJ5+jllAFnqZEDXe8HyvIDIZ95kGTgR3m8OZ/M6qI+Wygd9oRlqGB4NCE8UcK32+N9yj0W9a878ophSmyqQbVyK+D0eFgEcNXAZWgTlEJcfM+ozIL1yCltIHEksn9fMctWD57wgE3rdJk3iTob1Za1zkOJXooFPBytVEfI14hslXyHlbyEMhX1TIpIBEw5MVYyV7EYuPJQLu5ue4/4a2nzzOXVVz9OijQKfXQGGxH/zvLZeA0MNWKuFX5UPBaA/jkTFcurtnOnvh3t+l3sXNkEY0VY1+YrUUYfoATQmESYX2pin0rvscjE9GBxswSbGD6IfaVcgPSQYGcyo1vvS2GzTG9zawPGH5IF/iGMKtQy/3FPKXmnixTDeDe0MNfIb89cP54fw29F8NkICyKNViYc2cUTcrOB2jCms= 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: ab844e94-7a54-428a-326a-08d714ab933c X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Jul 2019 05:05:43.6811 (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: shahafs@mellanox.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR0502MB3748 Subject: Re: [dpdk-dev] [PATCH v2] net/mlx5: fix ESXi VLAN in virtual machine 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 Slava, Monday, July 29, 2019 6:27 PM, Viacheslav Ovsiienko: > Subject: [dpdk-dev] [PATCH v2] net/mlx5: fix ESXi VLAN in virtual machine >=20 > On ESXi setups when we have SR-IOV and E-Switch enabled there is the > problem to receive VLAN traffic on VF interfaces. The NIC driver in ESXi > hypervisor does not setup E-Switch vport setting correctly and VLAN traff= ic > targeted to VF is dropped. >=20 > The patch provides the temporary workaround - if the rule containing the > VLAN pattern is being installed for VF the VLAN network interface over VF= is > created, like the command does: >=20 > ip link add link vf.if name mlx5.wa.1.100 type vlan id 100 >=20 > The PMD in DPDK maintains the database of created VLAN interfaces for > each existing VF and requested VLAN tags. When all of the RTE Flows using > the given VLAN tag are removed the created VLAN interface with this VLAN > tag is deleted. >=20 > The name of created VLAN interface follows the format: >=20 > evmlx.d1.d2, where d1 is VF interface ifindex, d2 - VLAN ifindex >=20 > Implementation limitations: >=20 > - mask in rules is ignored, rule must specify VLAN tags exactly, > no wildcards (which are implemented by the masks) are allowed >=20 > - virtual environment is detected via rte_hypervisor() call, > currently it checks the RTE_CPUFLAG_HYPERVISOR flag for x86 > platform. For other architectures workaround always > applied for the Flow over PCI VF >=20 > Signed-off-by: Viacheslav Ovsiienko > Acked-by: Matan Azrad > --- > v2: - rebase > v1: - > https://eur03.safelinks.protection.outlook.com/?url=3Dhttp%3A%2F%2Fpatch > es.dpdk.org%2Fpatch%2F56450%2F&data=3D02%7C01%7Cshahafs%40mel > lanox.com%7C3f213439528840d072f308d714393442%7Ca652971c7d2e4d9ba6 > a4d149256f461b%7C0%7C0%7C637000108243298850&sdata=3DsXgknK92ce > Xr7QXrdzQU6iUHzFDZZufEGU8Butqst6I%3D&reserved=3D0 >=20 > drivers/net/mlx5/mlx5.c | 6 + > drivers/net/mlx5/mlx5.h | 30 ++++ > drivers/net/mlx5/mlx5_flow.c | 22 +++ > drivers/net/mlx5/mlx5_flow.h | 5 + > drivers/net/mlx5/mlx5_flow_dv.c | 33 ++++- > drivers/net/mlx5/mlx5_flow_verbs.c | 25 +++- > drivers/net/mlx5/mlx5_nl.c | 279 > +++++++++++++++++++++++++++++++++++++ > 7 files changed, 396 insertions(+), 4 deletions(-) >=20 [...] > + > +/** > + * Acquire VLAN interface with specified tag for ESXi workaround. > + * > + * @param[in] dev > + * Ethernet device object, Netlink context provider. > + * @param[in] vlan > + * Object representing the network device to acquire. > + */ > +void mlx5_vlan_esxi_acquire(struct rte_eth_dev *dev, > + struct mlx5_vf_vlan *vlan) > +{ > + struct mlx5_priv *priv =3D dev->data->dev_private; > + struct mlx5_vlan_esxi_context *esxi =3D priv->esxi_context; > + struct mlx5_vlan_dev *vlan_dev =3D &esxi->vlan_dev[0]; > + > + assert(!vlan->created); > + assert(priv->esxi_context); > + if (vlan->created || !esxi) > + return; > + if (vlan_dev[vlan->tag].refcnt =3D=3D 0) { > + assert(!vlan_dev[vlan->tag].ifindex); > + vlan_dev[vlan->tag].ifindex =3D > + mlx5_vlan_esxi_create(esxi, > + esxi->vf_ifindex, > + vlan->tag); > + } > + if (vlan_dev[vlan->tag].ifindex) { > + vlan_dev[vlan->tag].refcnt++; > + vlan->created =3D 1; > + } > +} > + > +/* > + * Create per ethernet device VLAN ESXi workaround context */ struct > +mlx5_vlan_esxi_context * mlx5_vlan_esxi_init(struct rte_eth_dev *dev, I would rather avoid the esxi word all over this patch.=20 You cannot know whether other HV do it also. Better to make it generic lke = mlx5_vlan_context or what ever other name you prefer.=20 > + uint32_t ifindex) > +{ > + struct mlx5_priv *priv =3D dev->data->dev_private; > + struct mlx5_dev_config *config =3D &priv->config; > + struct mlx5_vlan_esxi_context *esxi; > + > + /* Do not engage workaround over PF. */ > + if (!config->vf) > + return NULL; I think the check should be only for VF. The below can be dropped. Because even if the VF is probed on the HV and use legacy switch, still VLA= N traffic will not reach the target VF.=20 > + /* Check whether there is virtual environment */ > + if (rte_hypervisor_get() =3D=3D RTE_HYPERVISOR_NONE) > + return NULL;