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 743B3A0471 for ; Thu, 15 Aug 2019 17:34:45 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 408771BED3; Thu, 15 Aug 2019 17:34:44 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id CE2121BECD for ; Thu, 15 Aug 2019 17:34:42 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x7FFL9sM027381; Thu, 15 Aug 2019 08:34:37 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pfpt0818; bh=lljH8UQnejPOpjeFvQGsqdCj2V7+gWF2ScK3YdzaN2A=; b=iOehDYlpCK3h+a25r7534zkfLzxw1m49lJknnaa2twrhhWuHf6Aexwjzv9FfE4l2oHmN nCu8zTfJJq4TCLaJHmMW48SBlfdwK+i4RMqFiGZZ+WXoVvWI+MqZwD4EOQdGuh2g/R4f PzmYD5qaNRmy3yKlkLMYpnuL7Fv7LyXbFuSk4KOIwCgrRd08lJWb5zQKgzGg0tUQP4di 51RA0hoCpqBHgIRVlVDQvTJefubuGuy0hvriF3xaYaXW3ChU54tWjWX102GgKGWtxPP+ HP/XWC0x/QeXPO/JOpnru4mFFeQzV/R3Pvm54tkMESMylt7aAQHt5UTUe8vdO2/+PB2J HQ== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0a-0016f401.pphosted.com with ESMTP id 2ubfad52wj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 15 Aug 2019 08:34:37 -0700 Received: from SC-EXCH02.marvell.com (10.93.176.82) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 15 Aug 2019 08:34:36 -0700 Received: from NAM04-SN1-obe.outbound.protection.outlook.com (104.47.44.56) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Thu, 15 Aug 2019 08:34:36 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=C5JJMu9aRc8acAK56TIiX+JBLs0hczRos1RBCE2EF9M+R6gM2Gpyo5cJfRbSrQYzTaY9jkEh2wQBfb0hTfy3wgly92KJwyBgHIYok1SC2eMyKx/jQ9c5ff7gqkXrJPZDsxNUQJmvkjLkPknShdbguFRlOpRAjg7Igp2ATQX3ZXViCbssddwmRDBezJQG/SwKeOCqKQnq+DGxK0GZVT8GckGxqWr+HFVGE1PMUSq4Py58WzVyrFN2G4MS/02fp0lgLhgw8wMZRnNJRUuxB0oI1ito/CsiC95PnrRvNSxfCEagFHtXS42Nl22/rymEEGYzJDFRx9grjvlPnB1fWIBYjQ== 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=lljH8UQnejPOpjeFvQGsqdCj2V7+gWF2ScK3YdzaN2A=; b=i6OZbzK+8eciTk1+V9a5f8nDcghVKGkRESxdZnBl4JRbu6gMsveieoyrvnexloUWqmlhbVRt7yejiNw1w86Ezxab1EUEKOauXzOjeWFEkdOeyuSQVnYlTEtmM8fKXO33FbiXocraP9aqobZ66U2RlASWTw+3JY+HeTEsY7zeNeEAVwWJF7S50VM6D/MpgmSGX5DprlL4RECCIA84z5taJkURmBzscs0UBYF7FC2MUbJbn97G4G0wiU2kv6jOUjJbHCkMMu05dP25nx5fzTSk6ouUGTfezNLNZZsMJnHGKUrecwwZkL1QJTYQeoisC2T7ltodfL4Od4ZFQAbAiwpoEQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com; dkim=pass header.d=marvell.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector2-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lljH8UQnejPOpjeFvQGsqdCj2V7+gWF2ScK3YdzaN2A=; b=vL0IMRiqjcbNnUNdUZSEjjw6efA/44DvRfIilLc3ASAMCjRUbUvzC1hQXtbouv8PvKsIOM+jwZG9Jk5N5x0TUHqZqRjOabwev41vj60+0UOJ/EHIA9ogKF85QjISJngEpCITxubt2z8xX0p+5QmaaZULVCN+SjjrCUJdYCcRLHc= Received: from BYAPR18MB2424.namprd18.prod.outlook.com (20.179.91.149) by BYAPR18MB2981.namprd18.prod.outlook.com (20.179.60.13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2157.23; Thu, 15 Aug 2019 15:34:33 +0000 Received: from BYAPR18MB2424.namprd18.prod.outlook.com ([fe80::5877:72b7:40cf:2013]) by BYAPR18MB2424.namprd18.prod.outlook.com ([fe80::5877:72b7:40cf:2013%3]) with mapi id 15.20.2157.022; Thu, 15 Aug 2019 15:34:33 +0000 From: Jerin Jacob Kollanukkaran To: Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko CC: "dev@dpdk.org" , Bernard Iremonger , Shahaf Shuler , "E. Scott Daniels" , Wenzhuo Lu , Alex Zelezniak , Ajit Khaparde , Declan Doherty Thread-Topic: [dpdk-dev] [RFC] ethdev: configure SR-IOV VF from host Thread-Index: AQHVU3sFkH2/ejcx5E6I4/eQp/zdNab8VjDQ Date: Thu, 15 Aug 2019 15:34:33 +0000 Message-ID: References: <4165509.5enYigmRGf@xps> In-Reply-To: <4165509.5enYigmRGf@xps> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [223.226.105.92] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 9e99a855-d8a5-4ecb-ca4c-08d72196129f x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328)(7193020); SRVR:BYAPR18MB2981; x-ms-traffictypediagnostic: BYAPR18MB2981: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8882; x-forefront-prvs: 01304918F3 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(39850400004)(136003)(366004)(376002)(346002)(396003)(13464003)(189003)(199004)(229853002)(66066001)(5660300002)(11346002)(76116006)(66446008)(64756008)(52536014)(66946007)(2906002)(66476007)(66556008)(25786009)(53936002)(4326008)(110136005)(99286004)(256004)(14444005)(316002)(486006)(6246003)(476003)(55016002)(7696005)(76176011)(86362001)(7416002)(33656002)(81156014)(446003)(81166006)(8676002)(8936002)(478600001)(9686003)(71200400001)(54906003)(71190400001)(6116002)(53546011)(3846002)(186003)(102836004)(55236004)(305945005)(6506007)(14454004)(74316002)(6436002)(7736002)(26005); DIR:OUT; SFP:1101; SCL:1; SRVR:BYAPR18MB2981; H:BYAPR18MB2424.namprd18.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: marvell.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: k+Dtnnr0Aqoivycgj3McO+Rse3obTViHzf5OluHeGAcw3AAr+Fo3WcNPvjMMNWuxD7zsUYVXV/T6nK/Sd0GhluQWosXrrRdvylcF0YdzyuwGbCSubQ8zW2c88LLMS71BUqKguiNCAKBzc1P4s2vVwRwVJLbmnh3v49cmGnPb5grteZi+uqfC9E36rRQV63TylNWToBsCCOJAAgZY+6+Y7fCAo7TmNqm1MKBcCtUlhv2zo1AMnFRMv6D6psyGHLIIJC1EsztAtTl9n7uU50E0RHU679rPH2lq/CEfq9ocT2/W49JYREnTZdQx6H+FGx6FxPXke8GYO5PGDPG6YFPhbPqWpYLHgvrYddxvrO0WpLPwF1GOegUYnfpQ3IkgzjPHPZ5ghP5x84sdNnhWzZ6QxnOdzKZYF+bIGcCqRcvq6vg= x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 9e99a855-d8a5-4ecb-ca4c-08d72196129f X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Aug 2019 15:34:33.6048 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: rwim8ncpELCH8Qepw8IkntfC2ck0JAg8QWzoMfVMtaEi5utBz/Xj4keiOcd7bAUOnM1ysQMxJA/zZTZdAHMnEA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR18MB2981 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:5.22.84,1.0.8 definitions=2019-08-15_05:2019-08-14,2019-08-15 signatures=0 Subject: Re: [dpdk-dev] [RFC] ethdev: configure SR-IOV VF from host 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: dev On Behalf Of Thomas Monjalon > Sent: Thursday, August 15, 2019 8:36 PM > To: Ferruh Yigit ; Andrew Rybchenko > > Cc: dev@dpdk.org; Bernard Iremonger ; > Shahaf Shuler ; E. Scott Daniels > ; Wenzhuo Lu ; Alex > Zelezniak ; Ajit Khaparde ; > Declan Doherty > Subject: [dpdk-dev] [RFC] ethdev: configure SR-IOV VF from host >=20 > In a virtual environment, the network controller may have to configure so= me > SR-IOV VF parameters for security reasons. >=20 > When the PF (host port) is drived by DPDK (OVS-DPDK case), we face two > different cases: > - driver is bifurcated (Mellanox case), > so the VF can be configured via the kernel. > - driver is on top of UIO or VFIO, so DPDK API is required. >=20 > This RFC proposes to use generic DPDK API for VF configuration. > The impacted functions are (can be extended): >=20 > - rte_eth_dev_is_valid_port > - rte_eth_promiscuous_enable > - rte_eth_promiscuous_disable > - rte_eth_promiscuous_get > - rte_eth_allmulticast_enable > - rte_eth_allmulticast_disable > - rte_eth_allmulticast_get > - rte_eth_dev_set_mc_addr_list > - rte_eth_dev_default_mac_addr_set > - rte_eth_macaddr_get > - rte_eth_dev_mac_addr_add > - rte_eth_dev_mac_addr_remove > - rte_eth_dev_vlan_filter > - rte_eth_dev_get_mtu > - rte_eth_dev_set_mtu >=20 > In order to target these functions to a VF (which has no port id in the h= ost), > the higher bit of port id is reserved: >=20 > #define RTE_ETH_VF_PORT_FLAG (1 << 15) Instead of changing the port number behavior, How about adding a bit field/ I think, There is no ABI breakage as the parent type of bit field is uint8= _t and there is still more room. diff --git a/lib/librte_ethdev/rte_ethdev_core.h b/lib/librte_ethdev/rte_et= hdev_core.h index 2922d5b7c..19a60cab2 100644 --- a/lib/librte_ethdev/rte_ethdev_core.h +++ b/lib/librte_ethdev/rte_ethdev_core.h @@ -621,6 +621,7 @@ struct rte_eth_dev_data { all_multicast : 1, /**< RX all multicast mode ON(1) / OFF(0= ). */ dev_started : 1, /**< Device state: STARTED(1) / STOPPED(= 0). */ lro : 1; /**< RX LRO is ON(1) / OFF(0) */ + vf : 1; /**< SR-IOV VF device */ uint8_t rx_queue_state[RTE_MAX_QUEUES_PER_PORT]; /**< Queues state: STARTED(1) / STOPPED(0). */ uint8_t tx_queue_state[RTE_MAX_QUEUES_PER_PORT]; >=20 > This bit can be combined only with the port id of a representor. > The meaning is to target the VF connected with the representor port, inst= ead > of the representor port itself. >=20 > If a function is not expected to support VF configuration, it will return= - > EINVAL, i.e. there is no code change. > If an API function (listed above) can support VF configuration, but the P= MD > does not support it, then -ENOTSUP must be returned. >=20 > As an example, this is the change required in rte_eth_dev_is_valid_port: >=20 > int > rte_eth_dev_is_valid_port(uint16_t port_id) { > + uint32_t dev_flags; > + uint16_t vf_flag; > + > + vf_flag =3D port_id & RTE_ETH_VF_PORT_FLAG; > + port_id &=3D RTE_ETH_VF_PORT_FLAG - 1; /* remove VF flag */ > + > if (port_id >=3D RTE_MAX_ETHPORTS || > (rte_eth_devices[port_id].state =3D=3D RTE_ETH_DEV_UNUSED)) > return 0; > - else > - return 1; > + > + dev_flags =3D rte_eth_dev_shared_data->data[port_id].dev_flags; > + if (vf_flag !=3D 0 && (dev_flags & RTE_ETH_DEV_REPRESENTOR) =3D= =3D 0) > + return 0; /* VF flag has no meaning if not a representor > + */ > + > + return 1; > } >=20 >=20