[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y+YGCN59uCVWaH4m@gmail.com>
Date: Fri, 10 Feb 2023 08:53:28 +0000
From: Martin Habets <habetsm.xilinx@...il.com>
To: alejandro.lucero-palau@....com
Cc: netdev@...r.kernel.org, linux-net-drivers@....com,
davem@...emloft.net, kuba@...nel.org, pabeni@...hat.com,
edumazet@...gle.com, ecree.xilinx@...il.com,
linux-doc@...r.kernel.org, corbet@....net, jiri@...dia.com
Subject: Re: [PATCH v6 net-next 8/8] sfc: add support for devlink
port_function_hw_addr_set in ef100
On Wed, Feb 08, 2023 at 02:25:19PM +0000, alejandro.lucero-palau@....com wrote:
> From: Alejandro Lucero <alejandro.lucero-palau@....com>
>
> Using the builtin client handle id infrastructure, add support for
> setting the mac address linked to mports in ef100. This implies to
> execute an MCDI command for giving the address to the firmware for
> the specific devlink port.
>
> Signed-off-by: Alejandro Lucero <alejandro.lucero-palau@....com>
Acked-by: Martin Habets <habetsm.xilinx@...il.com>
> ---
> drivers/net/ethernet/sfc/efx_devlink.c | 42 ++++++++++++++++++++++++++
> 1 file changed, 42 insertions(+)
>
> diff --git a/drivers/net/ethernet/sfc/efx_devlink.c b/drivers/net/ethernet/sfc/efx_devlink.c
> index 68d04c2176d3..9fc2fe862303 100644
> --- a/drivers/net/ethernet/sfc/efx_devlink.c
> +++ b/drivers/net/ethernet/sfc/efx_devlink.c
> @@ -103,6 +103,47 @@ static int efx_devlink_port_addr_get(struct devlink_port *port, u8 *hw_addr,
> return rc;
> }
>
> +static int efx_devlink_port_addr_set(struct devlink_port *port,
> + const u8 *hw_addr, int hw_addr_len,
> + struct netlink_ext_ack *extack)
> +{
> + MCDI_DECLARE_BUF(inbuf, MC_CMD_SET_CLIENT_MAC_ADDRESSES_IN_LEN(1));
> + struct efx_devlink *devlink = devlink_priv(port->devlink);
> + struct mae_mport_desc *mport_desc;
> + efx_qword_t pciefn;
> + u32 client_id;
> + int rc;
> +
> + mport_desc = container_of(port, struct mae_mport_desc, dl_port);
> +
> + if (!ef100_mport_is_vf(mport_desc)) {
> + NL_SET_ERR_MSG_MOD(extack, "Port MAC change not allowed");
> + return -EPERM;
> + }
> +
> + EFX_POPULATE_QWORD_3(pciefn,
> + PCIE_FUNCTION_PF, PCIE_FUNCTION_PF_NULL,
> + PCIE_FUNCTION_VF, mport_desc->vf_idx,
> + PCIE_FUNCTION_INTF, PCIE_INTERFACE_CALLER);
> +
> + rc = efx_ef100_lookup_client_id(devlink->efx, pciefn, &client_id);
> + if (rc) {
> + NL_SET_ERR_MSG_MOD(extack, "No internal client_ID");
> + return rc;
> + }
> +
> + MCDI_SET_DWORD(inbuf, SET_CLIENT_MAC_ADDRESSES_IN_CLIENT_HANDLE,
> + client_id);
> +
> + ether_addr_copy(MCDI_PTR(inbuf, SET_CLIENT_MAC_ADDRESSES_IN_MAC_ADDRS),
> + hw_addr);
> +
> + rc = efx_mcdi_rpc(devlink->efx, MC_CMD_SET_CLIENT_MAC_ADDRESSES, inbuf,
> + sizeof(inbuf), NULL, 0, NULL);
> +
> + return rc;
> +}
> +
> static int efx_devlink_info_nvram_partition(struct efx_nic *efx,
> struct devlink_info_req *req,
> unsigned int partition_type,
> @@ -557,6 +598,7 @@ static const struct devlink_ops sfc_devlink_ops = {
> #ifdef CONFIG_SFC_SRIOV
> .info_get = efx_devlink_info_get,
> .port_function_hw_addr_get = efx_devlink_port_addr_get,
> + .port_function_hw_addr_set = efx_devlink_port_addr_set,
> #endif
> };
>
> --
> 2.17.1
Powered by blists - more mailing lists