From patchwork Fri Nov 1 00:18:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 62294 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 793C8A00BE; Fri, 1 Nov 2019 01:19:21 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B24BF1D413; Fri, 1 Nov 2019 01:19:20 +0100 (CET) Received: from wnew3-smtp.messagingengine.com (wnew3-smtp.messagingengine.com [64.147.123.17]) by dpdk.org (Postfix) with ESMTP id 238AA1D410 for ; Fri, 1 Nov 2019 01:19:19 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailnew.west.internal (Postfix) with ESMTP id 3B7DE5D8; Thu, 31 Oct 2019 20:19:17 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Thu, 31 Oct 2019 20:19:18 -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; s=mesmtp; bh=GgzsEcexbA LqCvAVlSYeffnlid7Wv4U6w90eaIrZJLA=; b=rVvzVSReu+XGt2no4zAARbiYgW 5dX+ri37AO8qTo4lc+x+heq5JL4TemeHOFn96fWSSBmPcU8f5szHnJfnfsskqeuD aBF24wLRAsapME6W3YeNQmf7apSEuoU5kJgeHYYLcXVeyolAqTfdw8tpe1nmzsVf 7X/XO+uPy6/HLcPsU= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding: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= fm1; bh=GgzsEcexbALqCvAVlSYeffnlid7Wv4U6w90eaIrZJLA=; b=qKKyOAJt n0YySNxMPHufvR+kuL75z7a7DSbTgE4HhBDIqkuN4BBogXj4fdRyISutUZC8zU4y p0TKjY1tf0HRQKzEoygdtX7fI3shOCIJMpPqc9OAtMrJmay1a/gmCmPzeBKNrjoh 0MXnb0bAzgALbxs9zup1gw/I9/GqDtsuWg2stFE3biOwTQoDJCmXNWz9EuanTgaS M7df6tOMovGjijDYoebLmPCFi4SM19UvnE27Oi5/7evhva9ufT77tmNJvHYA4nvC cvJqg6OoWJjZVM3UVf7rdCe9ZKIC0Gj0hnnwaO3m9JwDiXH20adWKsFXMrDDUIvx /tQEps5UyqQz8Q== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedruddtiedgvddtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecukf hppeelfedrvdefrddvhedurddvvdejnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhho mhgrshesmhhonhhjrghlohhnrdhnvghtnecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from xps.monjalon.net (227.251.23.93.rev.sfr.net [93.23.251.227]) by mail.messagingengine.com (Postfix) with ESMTPA id 46EA28005A; Thu, 31 Oct 2019 20:19:13 -0400 (EDT) From: Thomas Monjalon To: Beilei Xing , Qi Zhang , Wenzhuo Lu , Konstantin Ananyev Cc: dev@dpdk.org, ferruh.yigit@intel.com, bernard.iremonger@intel.com, daniels@research.att.com, alexz@att.com, declan.doherty@intel.com, john.mcnamara@intel.com Date: Fri, 1 Nov 2019 01:18:24 +0100 Message-Id: <20191101001824.17534-1-thomas@monjalon.net> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191029185051.32203-3-thomas@monjalon.net> References: <20191029185051.32203-3-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [RFC PATCH] net/i[xgb|40]e: set VF MAC address 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" Allow to configure the default MAC address of a VF via its representor port in the host, when the VF is explicitly targeted with RTE_ETH_PORT_VF_FLAG. In the long term, the representor behaviour should be changed to configure itself when the VF is not targeted. This RFC patch will be split for ixgbe and i40e. If we can agree on implementing this VF API, OVS will be have a generic solution. Signed-off-by: Thomas Monjalon --- drivers/net/i40e/i40e_vf_representor.c | 19 ++++++++++++++++++- drivers/net/ixgbe/ixgbe_vf_representor.c | 19 ++++++++++++++++++- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/drivers/net/i40e/i40e_vf_representor.c b/drivers/net/i40e/i40e_vf_representor.c index b07b35c03f..e944288959 100644 --- a/drivers/net/i40e/i40e_vf_representor.c +++ b/drivers/net/i40e/i40e_vf_representor.c @@ -325,7 +325,7 @@ i40e_vf_representor_mac_addr_remove(struct rte_eth_dev *ethdev, uint32_t index) } static int -i40e_vf_representor_mac_addr_set(struct rte_eth_dev *ethdev, +i40e_remote_vf_mac_addr_set(struct rte_eth_dev *ethdev, struct rte_ether_addr *mac_addr) { struct i40e_vf_representor *representor = ethdev->data->dev_private; @@ -335,6 +335,17 @@ i40e_vf_representor_mac_addr_set(struct rte_eth_dev *ethdev, representor->vf_id, mac_addr); } +static int +i40e_vf_representor_mac_addr_set(struct rte_eth_dev *ethdev, + struct rte_ether_addr *mac_addr) +{ + /* Should configure the representor port + * but configure the VF port instead, + * for compatibility purpose. + */ + return i40e_remote_vf_mac_addr_set(ethdev, mac_addr); +} + static int i40e_vf_representor_vlan_filter_set(struct rte_eth_dev *ethdev, uint16_t vlan_id, int on) @@ -453,6 +464,11 @@ static const struct eth_dev_ops i40e_representor_dev_ops = { }; +/* operations on VF from representor */ +const struct eth_dev_ops i40e_remote_vf_ops = { + .mac_addr_set = i40e_remote_vf_mac_addr_set, +}; + static uint16_t i40e_vf_representor_rx_burst(__rte_unused void *rx_queue, __rte_unused struct rte_mbuf **rx_pkts, __rte_unused uint16_t nb_pkts) @@ -491,6 +507,7 @@ i40e_vf_representor_init(struct rte_eth_dev *ethdev, void *init_params) /* Set representor device ops */ ethdev->dev_ops = &i40e_representor_dev_ops; + ethdev->vf_ops = &i40e_remote_vf_ops; /* No data-path, but need stub Rx/Tx functions to avoid crash * when testing with the likes of testpmd. diff --git a/drivers/net/ixgbe/ixgbe_vf_representor.c b/drivers/net/ixgbe/ixgbe_vf_representor.c index dbbef294ae..17fccaf4f3 100644 --- a/drivers/net/ixgbe/ixgbe_vf_representor.c +++ b/drivers/net/ixgbe/ixgbe_vf_representor.c @@ -24,7 +24,7 @@ ixgbe_vf_representor_link_update(struct rte_eth_dev *ethdev, } static int -ixgbe_vf_representor_mac_addr_set(struct rte_eth_dev *ethdev, +ixgbe_remote_vf_mac_addr_set(struct rte_eth_dev *ethdev, struct rte_ether_addr *mac_addr) { struct ixgbe_vf_representor *representor = ethdev->data->dev_private; @@ -34,6 +34,17 @@ ixgbe_vf_representor_mac_addr_set(struct rte_eth_dev *ethdev, representor->vf_id, mac_addr); } +static int +ixgbe_vf_representor_mac_addr_set(struct rte_eth_dev *ethdev, + struct rte_ether_addr *mac_addr) +{ + /* Should configure the representor port + * but configure the VF port instead, + * for compatibility purpose. + */ + return ixgbe_remote_vf_mac_addr_set(ethdev, mac_addr); +} + static int ixgbe_vf_representor_dev_infos_get(struct rte_eth_dev *ethdev, struct rte_eth_dev_info *dev_info) @@ -155,6 +166,11 @@ static const struct eth_dev_ops ixgbe_vf_representor_dev_ops = { .mac_addr_set = ixgbe_vf_representor_mac_addr_set, }; +/* operations on VF from representor */ +const struct eth_dev_ops ixgbe_remote_vf_ops = { + .mac_addr_set = ixgbe_remote_vf_mac_addr_set, +}; + static uint16_t ixgbe_vf_representor_rx_burst(__rte_unused void *rx_queue, __rte_unused struct rte_mbuf **rx_pkts, __rte_unused uint16_t nb_pkts) @@ -198,6 +214,7 @@ ixgbe_vf_representor_init(struct rte_eth_dev *ethdev, void *init_params) /* Set representor device ops */ ethdev->dev_ops = &ixgbe_vf_representor_dev_ops; + ethdev->vf_ops = &ixgbe_remote_vf_ops; /* No data-path, but need stub Rx/Tx functions to avoid crash * when testing with the likes of testpmd.