All of lore.kernel.org
 help / color / mirror / Atom feed
From: <ecree@xilinx.com>
To: <davem@davemloft.net>, <kuba@kernel.org>, <pabeni@redhat.com>,
	<linux-net-drivers@amd.com>
Cc: <netdev@vger.kernel.org>, Edward Cree <ecree.xilinx@gmail.com>
Subject: [PATCH net-next 12/14] sfc: set EF100 VF MAC address through representor
Date: Fri, 22 Jul 2022 17:04:21 +0100	[thread overview]
Message-ID: <19ce6189b03c297cbcb481a733712cafebcc0fab.1658497661.git.ecree.xilinx@gmail.com> (raw)
In-Reply-To: <cover.1658497661.git.ecree.xilinx@gmail.com>

From: Edward Cree <ecree.xilinx@gmail.com>

When setting the VF rep's MAC address, set the provisioned MAC address
 for the VF through MC_CMD_SET_CLIENT_MAC_ADDRESSES.

Signed-off-by: Edward Cree <ecree.xilinx@gmail.com>
---
 drivers/net/ethernet/sfc/ef100_rep.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/drivers/net/ethernet/sfc/ef100_rep.c b/drivers/net/ethernet/sfc/ef100_rep.c
index ebab4579e63b..58365a4c7c6a 100644
--- a/drivers/net/ethernet/sfc/ef100_rep.c
+++ b/drivers/net/ethernet/sfc/ef100_rep.c
@@ -107,6 +107,33 @@ static int efx_ef100_rep_get_phys_port_name(struct net_device *dev,
 	return 0;
 }
 
+static int efx_ef100_rep_set_mac_address(struct net_device *net_dev, void *data)
+{
+	MCDI_DECLARE_BUF(inbuf, MC_CMD_SET_CLIENT_MAC_ADDRESSES_IN_LEN(1));
+	struct efx_rep *efv = netdev_priv(net_dev);
+	struct efx_nic *efx = efv->parent;
+	struct sockaddr *addr = data;
+	const u8 *new_addr = addr->sa_data;
+	int rc;
+
+	if (efv->clid == CLIENT_HANDLE_NULL) {
+		netif_info(efx, drv, net_dev, "Unable to set representee MAC address (client ID is null)\n");
+	} else {
+		BUILD_BUG_ON(MC_CMD_SET_CLIENT_MAC_ADDRESSES_OUT_LEN);
+		MCDI_SET_DWORD(inbuf, SET_CLIENT_MAC_ADDRESSES_IN_CLIENT_HANDLE,
+			       efv->clid);
+		ether_addr_copy(MCDI_PTR(inbuf, SET_CLIENT_MAC_ADDRESSES_IN_MAC_ADDRS),
+				new_addr);
+		rc = efx_mcdi_rpc(efx, MC_CMD_SET_CLIENT_MAC_ADDRESSES, inbuf,
+				  sizeof(inbuf), NULL, 0, NULL);
+		if (rc)
+			return rc;
+	}
+
+	eth_hw_addr_set(net_dev, new_addr);
+	return 0;
+}
+
 static void efx_ef100_rep_get_stats64(struct net_device *dev,
 				      struct rtnl_link_stats64 *stats)
 {
@@ -126,6 +153,7 @@ static const struct net_device_ops efx_ef100_rep_netdev_ops = {
 	.ndo_start_xmit		= efx_ef100_rep_xmit,
 	.ndo_get_port_parent_id	= efx_ef100_rep_get_port_parent_id,
 	.ndo_get_phys_port_name	= efx_ef100_rep_get_phys_port_name,
+	.ndo_set_mac_address    = efx_ef100_rep_set_mac_address,
 	.ndo_get_stats64	= efx_ef100_rep_get_stats64,
 };
 

  parent reply	other threads:[~2022-07-22 16:07 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-22 16:04 [PATCH net-next 00/14] sfc: VF representors for EF100 - RX side ecree
2022-07-22 16:04 ` [PATCH net-next 01/14] sfc: plumb ef100 representor stats ecree
2022-07-22 16:04 ` [PATCH net-next 02/14] sfc: ef100 representor RX NAPI poll ecree
2022-07-22 16:04 ` [PATCH net-next 03/14] sfc: ef100 representor RX top half ecree
2022-07-22 16:04 ` [PATCH net-next 04/14] sfc: determine wire m-port at EF100 PF probe time ecree
2022-07-23  3:04   ` kernel test robot
2022-07-23  4:15   ` kernel test robot
2022-07-26 14:21     ` Edward Cree
2022-07-22 16:04 ` [PATCH net-next 05/14] sfc: check ef100 RX packets are from the wire ecree
2022-07-22 16:04 ` [PATCH net-next 06/14] sfc: receive packets from EF100 VFs into representors ecree
2022-07-23  7:18   ` kernel test robot
2022-07-22 16:04 ` [PATCH net-next 07/14] sfc: insert default MAE rules to connect VFs to representors ecree
2022-07-22 16:04 ` [PATCH net-next 08/14] sfc: move table locking into filter_table_{probe,remove} methods ecree
2022-07-22 16:04 ` [PATCH net-next 09/14] sfc: use a dynamic m-port for representor RX and set it promisc ecree
2022-07-22 16:04 ` [PATCH net-next 10/14] sfc: look up VF's client ID when creating representor ecree
2022-07-22 16:04 ` [PATCH net-next 11/14] sfc: fetch existing assigned MAC address from FW when creating VF rep ecree
2022-07-22 16:04 ` ecree [this message]
2022-07-22 16:04 ` [PATCH net-next 13/14] sfc: get provisioned MAC address on EF100 VF probe ecree
2022-07-22 16:04 ` [PATCH net-next 14/14] sfc: implement ethtool get/set RX ring size for EF100 reps ecree

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=19ce6189b03c297cbcb481a733712cafebcc0fab.1658497661.git.ecree.xilinx@gmail.com \
    --to=ecree@xilinx.com \
    --cc=davem@davemloft.net \
    --cc=ecree.xilinx@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-net-drivers@amd.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.