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 EC741A00BE; Tue, 29 Oct 2019 19:51:28 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D0B351BFB8; Tue, 29 Oct 2019 19:51:15 +0100 (CET) Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by dpdk.org (Postfix) with ESMTP id 15E491BFB5 for ; Tue, 29 Oct 2019 19:51:14 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id B049D20D2B; Tue, 29 Oct 2019 14:51:13 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Tue, 29 Oct 2019 14:51: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; s=mesmtp; bh=tT5rfB5Lod IUP3znJmWrUJxUFMWSINKfc2yZApapFDI=; b=Q5tY8Tf2nFSB1ajv0PNGS1+svN 2vGP91ekFrzEUOVm+eLeY7PcjCdQSKCFiurUTNG1M3cEpRtNfZFqueY1liyLih0T IhTFH1tV9UElUXJEcioA+ZVi6/P8H9kU3zH0gE5aReEo8WWynev15OEF+DmprQFj e3RY7ISMDtkmqg6eo= 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=tT5rfB5LodIUP3znJmWrUJxUFMWSINKfc2yZApapFDI=; b=qRFN4ftC aZCI+jjcFSiVbRQwKNQ53GYdwMSKNDQfPpgLldl5wjBRoOewlXLJrDXTVZ87+Xgu j5DvaxVDmw31ZiGmOdPoCpJcCBSB5nPanh7Y6x6gwU7G23RpFO/DPke0LqidHbAB YIeSd7vrHQSil9VR9HnIEZiPpNj4lokiC4mOkwemRDcFc/VqzQIvA2PfJzT34+Jh vR+cc1hW3F8Uf8fCJkZQMx2lMb0dg9Ms3E0CsaHJrQLp/WHcMNw0xcbzF0QK8Q+s D5eUFXARxcFc4GJw2FS6QvIqWIeGERUYJUo7JXO7vrmvjjYEUVsHIYuRoeG63+h+ xtREH54cbzxZDQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedruddtuddgudduiecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhm rghsucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenuc fkphepjeejrddufeegrddvtdefrddukeegnecurfgrrhgrmhepmhgrihhlfhhrohhmpeht hhhomhgrshesmhhonhhjrghlohhnrdhnvghtnecuvehluhhsthgvrhfuihiivgepfe X-ME-Proxy: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id DD7B3D6006B; Tue, 29 Oct 2019 14:51:12 -0400 (EDT) From: Thomas Monjalon To: Matan Azrad , Shahaf Shuler , Viacheslav Ovsiienko Cc: dev@dpdk.org Date: Tue, 29 Oct 2019 19:50:51 +0100 Message-Id: <20191029185051.32203-4-thomas@monjalon.net> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191029185051.32203-1-thomas@monjalon.net> References: <4165509.5enYigmRGf@xps> <20191029185051.32203-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 3/3] net/mlx5: 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. This patch is a stub to demonstrate how to implement a VF operation. The real code is not implemented. Signed-off-by: Thomas Monjalon --- drivers/net/mlx5/mlx5.c | 6 ++++++ drivers/net/mlx5/mlx5.h | 1 + drivers/net/mlx5/mlx5_mac.c | 19 +++++++++++++++++++ 3 files changed, 26 insertions(+) diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index fac510507d..b679b5e299 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -1073,6 +1073,11 @@ const struct eth_dev_ops mlx5_dev_ops_isolate = { .get_module_eeprom = mlx5_get_module_eeprom, }; +/* Available operations for VF connected to a representor. */ +const struct eth_dev_ops mlx5_remote_vf_ops = { + .mac_addr_set = mlx5_vf_mac_addr_set, +}; + /** * Verify and store value for device argument. * @@ -2130,6 +2135,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, eth_dev->rx_pkt_burst = removed_rx_burst; eth_dev->tx_pkt_burst = removed_tx_burst; eth_dev->dev_ops = &mlx5_dev_ops; + eth_dev->vf_ops = &mlx5_remote_vf_ops; /* Register MAC address. */ claim_zero(mlx5_mac_addr_add(eth_dev, &mac, 0, 0)); if (config.vf && config.vf_nl_en) diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index b6a51b2b4d..e34a24ee7c 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -754,6 +754,7 @@ void mlx5_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index); int mlx5_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac, uint32_t index, uint32_t vmdq); int mlx5_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr); +int mlx5_vf_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac); int mlx5_set_mc_addr_list(struct rte_eth_dev *dev, struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr); diff --git a/drivers/net/mlx5/mlx5_mac.c b/drivers/net/mlx5/mlx5_mac.c index 0ffef5c5db..4c4dd55b86 100644 --- a/drivers/net/mlx5/mlx5_mac.c +++ b/drivers/net/mlx5/mlx5_mac.c @@ -202,6 +202,25 @@ mlx5_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) return mlx5_mac_addr_add(dev, mac_addr, 0, 0); } +/** + * DPDK callback to set primary MAC address of the remote VF. + * + * @param dev + * Pointer to Ethernet device structure of a representor. + * @param mac_addr + * MAC address to register in the remote VF. + * + * @return + * 0 on success, a negative errno value otherwise and rte_errno is set. + */ +int mlx5_vf_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac) +{ + DRV_LOG(DEBUG, "VF represented by port %u setting primary MAC address", + dev->data->port_id); + /* TODO: should not be this dev but its VF */ + return mlx5_nl_mac_addr_add(dev, mac, 0); +} + /** * DPDK callback to set multicast addresses list. * -- 2.23.0