[Intel-wired-lan] [PATCH net-next v6] i40e: Add ability to change VFs default MAC address

Szlosek, Marek marek.szlosek at intel.com
Fri Mar 3 09:39:48 UTC 2023



> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces at osuosl.org> On Behalf Of
> Jan Sokolowski
> Sent: środa, 15 lutego 2023 14:33
> To: intel-wired-lan at lists.osuosl.org
> Cc: Sylwester Dziedziuch <sylwesterx.dziedziuch at intel.com>; Maziarz, Kamil
> <kamil.maziarz at intel.com>
> Subject: [Intel-wired-lan] [PATCH net-next v6] i40e: Add ability to change VFs
> default MAC address
> 
> From: Sylwester Dziedziuch <sylwesterx.dziedziuch at intel.com>
> 
> Currently there is no way for a VF driver to specify if it wants to change it's
> hardware address. Although new bits were added to virtchnl.h in struct
> virtchnl_ether_addr to allow the VF to correctly communicate this
> information, legacy VF drivers that don't support the new virtchnl.h bits still
> need to be supported.
> This patch makes a best effort attempt at saving the VF's primary/device
> address in the legacy case and depends on the
> VIRTCHNL_ETHER_ADDR_PRIMARY type for the new case.
> 
> Legacy case - If a unicast MAC is being added and the default_lan_addr.addr
> is empty, then populate it, otherwise save and timestamp itin case it is
> followed by a delete request.
> This assumes that the address is the VF's hardware address.
> If unicast MAC is being deleted, then mark the time it happened, if the legacy
> umac was not expired, and copy as last MAC addr on the filter list, and if it
> matches default_lan_addr.addr, mark that as deleted unimac addr.
> 
> This is done because we cannot guarantee the order of
> VIRTCHNL_OP_ADD_ETH_ADDR and VIRTCHNL_OP_DEL_ETH_ADDR.
> 
> New case - If a unicast MAC is being added and it's specified as
> VIRTCHNL_ETHER_ADDR_PRIMARY, then replace the current
> default_lan_addr.addr. If a unicast MAC is being deleted and it's type is
> specified as VIRTCHNL_ETHER_ADDR_PRIMARY, then zero the
> hw_lan_addr.addr.
> 
> Untrusted VFs - Only allow above legacy/new changes to their hardware
> address if the PF has not set it administratively via iproute2.
> 
> Trusted VFs - Always allow above legacy/new changes to their hardware
> address even if the PF has administratively set it via iproute2.
> 
> In case of VF reset/reload, only MACs assigned from host must be preserved.
> 
> Add a vm MAC list to filter MAC addresses to be restored after reset.
> 
> Signed-off-by: Sylwester Dziedziuch <sylwesterx.dziedziuch at intel.com>
> Co-developed-by: Kamil Maziarz <kamil.maziarz at intel.com>
> Signed-off-by: Kamil Maziarz <kamil.maziarz at intel.com>
> Signed-off-by: Jan Sokolowski <jan.sokolowski at intel.com>
> ---
> v2: previous version had been reported to not build under some kernel
> configuration.
> v3: fixed minor kerneldoc misspelling
> v4: Rebased to newest head. Fixed compilation errors due to some methods
> being defined in a wrong patch.
> v5: Squashed two patches into one, as they were too intertwined in
> functionality. Reworded commit msg to better match the patch
> v6: rebase to current head
> ---
>  .../ethernet/intel/i40e/i40e_virtchnl_pf.c    | 318 +++++++++++++++---
>  .../ethernet/intel/i40e/i40e_virtchnl_pf.h    |  18 +
>  2 files changed, 286 insertions(+), 50 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
> b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
> index 8a4587585acd..9f45628719aa 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c

Tested-by: Marek Szlosek <marek.szlosek at intel.com>


More information about the Intel-wired-lan mailing list