[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20240326140822.GU403975@kernel.org>
Date: Tue, 26 Mar 2024 14:08:22 +0000
From: Simon Horman <horms@...nel.org>
To: Karthik Sundaravel <ksundara@...hat.com>
Cc: jesse.brandeburg@...el.com, wojciech.drewek@...el.com,
sumang@...vell.com, jacob.e.keller@...el.com,
anthony.l.nguyen@...el.com, davem@...emloft.net,
edumazet@...gle.com, kuba@...nel.org, pabeni@...hat.com,
intel-wired-lan@...ts.osuosl.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, pmenzel@...gen.mpg.de,
jiri@...nulli.us, michal.swiatkowski@...ux.intel.com,
rjarry@...hat.com, aharivel@...hat.com, vchundur@...hat.com,
cfontain@...hat.com
Subject: Re: [PATCH v6] ice: Add get/set hw address for VFs using devlink
commands
On Thu, Mar 21, 2024 at 01:46:25PM +0530, Karthik Sundaravel wrote:
> Changing the MAC address of the VFs is currently unsupported via devlink.
> Add the function handlers to set and get the HW address for the VFs.
>
> Signed-off-by: Karthik Sundaravel <ksundara@...hat.com>
> ---
> drivers/net/ethernet/intel/ice/ice_devlink.c | 66 +++++++++++++++++++-
> drivers/net/ethernet/intel/ice/ice_sriov.c | 62 ++++++++++++++++++
> drivers/net/ethernet/intel/ice/ice_sriov.h | 8 +++
> 3 files changed, 135 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/intel/ice/ice_devlink.c b/drivers/net/ethernet/intel/ice/ice_devlink.c
> index 80dc5445b50d..35c7cfc8ce9a 100644
> --- a/drivers/net/ethernet/intel/ice/ice_devlink.c
> +++ b/drivers/net/ethernet/intel/ice/ice_devlink.c
> @@ -1576,6 +1576,69 @@ void ice_devlink_destroy_pf_port(struct ice_pf *pf)
> devlink_port_unregister(&pf->devlink_port);
> }
>
> +/**
> + * ice_devlink_port_get_vf_fn_mac - .port_fn_hw_addr_get devlink handler
> + * @port: devlink port structure
> + * @hw_addr: MAC address of the port
> + * @hw_addr_len: length of MAC address
> + * @extack: extended netdev ack structure
> + *
> + * Callback for the devlink .port_fn_hw_addr_get operation
> + * Return: zero on success or an error code on failure.
> + */
> +
> +static int ice_devlink_port_get_vf_fn_mac(struct devlink_port *port,
> + u8 *hw_addr, int *hw_addr_len,
> + struct netlink_ext_ack *extack)
> +{
> + struct ice_vf *vf = container_of(port, struct ice_vf, devlink_port);
nit: blank line here please.
Flagged by checkpatch.
> + if (!vf) {
Given the way that container_of works, I don't think vf can be NULL.
Flagged by Smatch.
> + NL_SET_ERR_MSG_MOD(extack, "Unable to get the vf");
> + return -EINVAL;
> + }
> + ether_addr_copy(hw_addr, vf->dev_lan_addr);
> + *hw_addr_len = ETH_ALEN;
> +
> + return 0;
> +}
..
Powered by blists - more mailing lists