net/hns3: support setting VF MAC address by PF driver
Currently, we only support VF device is bound to vfio_pci or igb_uio and
then driven by DPDK driver when PF is driven by kernel mode hns3 ethdev
driver, VF is not supported when PF is driven by hns3 DPDK driver.
This patch adds support setting VF MAC address by hns3 PF kernel ethdev
driver on the host by "ip link set ..." command.
1) If the hns3 PF kernel ethdev driver sets the MAC address for VF
device before the initialization of the related VF device, hns3 VF
PMD driver should get the MAC address from PF driver through mailbox
and configure hardware using this MAC address in the initialization.
The hns3 VF PMD driver get the MAC address form PF driver, if
obtaining a non-zero MAC address from mailbox, VF driver will
configure hardware using it, otherwise using a random MAC address in
the initialization of VF device.
2) If the hns3 PF kernel ethdev driver sets the MAC address for VF
device after the initialization of the related VF device, the PF
driver will notify VF driver to reset VF device to make the new MAC
address effective immediately. The hns3 VF PMD driver should check
whether the MAC address has been changed by the PF kernel netdevice
driver, if changed VF driver should configure hardware using the new
MAC address in the recovering hardware configuration stage of the
reset process.
3) When user has configured a mac address for VF device by "ip link set
..." command based on the PF device, the hns3 PF kernel ethdev driver
does not allow VF driver to request reconfiguring a different default
mac address and return -EPREM to VF driver through mailbox.
Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Signed-off-by: Hongbo Zheng <zhenghongbo3@huawei.com>