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 48BAFA2E1B for ; Wed, 4 Sep 2019 10:23:18 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 88B751ECF1; Wed, 4 Sep 2019 10:23:16 +0200 (CEST) Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by dpdk.org (Postfix) with ESMTP id 1BEF91ECE2 for ; Wed, 4 Sep 2019 10:23:15 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 9B8FE21F7D; Wed, 4 Sep 2019 04:23:13 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Wed, 04 Sep 2019 04:23:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s=mesmtp; bh=oPdrYhv3OwlKup+fHyVmTUMW/Us9dwjYFr6eiO1SaYk=; b=eC+PQd2tZyWk z4RykB3GqPOJYeVfnJy1fYNT/cWf3EjetHRksnRq+2GV52RqkKKUXfQyN2thZZQL Cpjy2JUKVDl8xgezEV3S3W1la3TF0cq5kk/hdpHO24JXzyeGzqESwUGHgJGRkaOU e5QLn/gwYOb3serUOuiLPHJg9sF9ZQU= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=oPdrYhv3OwlKup+fHyVmTUMW/Us9dwjYFr6eiO1Sa Yk=; b=dTmJVq+yEccnN/0x6+QebidDbQ+aFY2B89e4QRsNNmvI/Vda+YntDr0NA E8eQwj5om1XIrP2yDaVk3i6loLdDWU2udiE90RQ5FL2hXsqVU+j3claoszSo6MQ/ HY0M7ULpnIDPkwbEivFs6db7D94qa18TbjrFu72fuja6ygrhtMRsKeKiFnY2hZ+E FQYQBLsLm2ljz2YtHOqbqQLwb9OHassMxUOjlZRFxqpyH5y/euNqmsU+1oVPtM+g rd7mqZ9ZSTcoaC+DyIkA/saH3DZ+hpNsxTiRLnGAblN2ugrCS20tbk+cocjPUc2j VwiwJ+Ri6ld2NRsqzoNDG4gsu3xQg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduvddrudejhedgtddvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkfgjfhgggfgtsehtufertddttddvnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecukf hppeejjedrudefgedrvddtfedrudekgeenucfrrghrrghmpehmrghilhhfrhhomhepthhh ohhmrghssehmohhnjhgrlhhonhdrnhgvthenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id BFE86D6005D; Wed, 4 Sep 2019 04:23:11 -0400 (EDT) From: Thomas Monjalon To: "Iremonger, Bernard" Cc: "Yigit, Ferruh" , Andrew Rybchenko , "dev@dpdk.org" , Shahaf Shuler , "E. Scott Daniels" , "Lu, Wenzhuo" , Alex Zelezniak , Ajit Khaparde , "Doherty, Declan" Date: Wed, 04 Sep 2019 10:23:10 +0200 Message-ID: <2893154.vhdUhTTG4t@xps> In-Reply-To: <8CEF83825BEC744B83065625E567D7C260DE9D47@IRSMSX108.ger.corp.intel.com> References: <4165509.5enYigmRGf@xps> <8CEF83825BEC744B83065625E567D7C260DE9D47@IRSMSX108.ger.corp.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" 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" 29/08/2019 17:02, Iremonger, Bernard: > Hi Thomas, > > From: Thomas Monjalon [mailto:thomas@monjalon.net] > > > > In a virtual environment, the network controller may have to configure some > > SR-IOV VF parameters for security reasons. > > > > 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. > > > > This RFC proposes to use generic DPDK API for VF configuration. > > The impacted functions are (can be extended): > > > > - 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 > > > > In order to target these functions to a VF (which has no port id in the host), > > the higher bit of port id is reserved: > > > > #define RTE_ETH_VF_PORT_FLAG (1 << 15) > > > > 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, instead > > of the representor port itself. > > > > 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 PMD > > does not support it, then -ENOTSUP must be returned. > > > > As an example, this is the change required in rte_eth_dev_is_valid_port: > > > > int > > rte_eth_dev_is_valid_port(uint16_t port_id) { > > + uint32_t dev_flags; > > + uint16_t vf_flag; > > + > > + vf_flag = port_id & RTE_ETH_VF_PORT_FLAG; > > + port_id &= RTE_ETH_VF_PORT_FLAG - 1; /* remove VF flag */ > > + > > if (port_id >= RTE_MAX_ETHPORTS || > > (rte_eth_devices[port_id].state == RTE_ETH_DEV_UNUSED)) > > return 0; > > - else > > - return 1; > > + > > + dev_flags = rte_eth_dev_shared_data->data[port_id].dev_flags; > > + if (vf_flag != 0 && (dev_flags & RTE_ETH_DEV_REPRESENTOR) == 0) > > + return 0; /* VF flag has no meaning if not a representor > > + */ > > + > > + return 1; > > } > > > Some of the functions in the list above for example, rte_eth_dev_promiscuous_enable() use the dev_ops structure, is it intended to add more rte_eth_dev_* functions to the dev_ops structure? I propose to use the same functions for PF and VF. > At present the ixgbe and i40e PMD's have sets of private functions for configuring SRIOV VF's from the DPDK PF, rte_pmd_ixgbe_* and rte_pmd_i40e_* functions (see rte_pmd_ixgbe.h and rte_pmd_i40e.h). > > At the time these functions were not allowed to be added to the dev_ops structure as there were so many of them. There was a proposal to add a dev_ctrl function to the dev_ops structure which would access the private functions. Maybe adding the dev_ctrl function should be considered again. > > Having two ways (through dev_ops and private PMD functions) to configure DPDK VF's from the DPDK PF will be confusing for developers. No, I propose to replace the private API with the representor magic.