[Intel-wired-lan] [PATCH net-next v7] i40e: Add ability to change VFs default MAC address
Tony Nguyen
anthony.l.nguyen at intel.com
Thu May 11 16:01:17 UTC 2023
This functionality was already accepted [1]
On 5/10/2023 5:01 AM, Jan Sokolowski wrote:
> 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>
[1]
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ceb29474bbbc377e11be3a70589a0005305e4fc3
More information about the Intel-wired-lan
mailing list