pds_vdpa: always allow offering VIRTIO_NET_F_MAC
authorShannon Nelson <shannon.nelson@amd.com>
Tue, 11 Jul 2023 04:24:34 +0000 (21:24 -0700)
committerMichael S. Tsirkin <mst@redhat.com>
Thu, 10 Aug 2023 19:51:45 +0000 (15:51 -0400)
commitabdf31bd91120035172dc58e2e87064a72e9e087
tree7358bc7f176880e727fa27b22fa6a815f43aaee7
parent0cd2c13b1c15dbbdf1e2ae5b7160537f97df06b5
pds_vdpa: always allow offering VIRTIO_NET_F_MAC

Our driver sets a mac if the HW is 00:..:00 so we need to be sure to
advertise VIRTIO_NET_F_MAC even if the HW doesn't.  We also need to be
sure that virtio_net sees the VIRTIO_NET_F_MAC and doesn't rewrite the
mac address that a user may have set with the vdpa utility.

After reading the hw_feature bits, add the VIRTIO_NET_F_MAC to the driver's
supported_features and use that for reporting what is available.  If the
HW is not advertising it, be sure to strip the VIRTIO_NET_F_MAC before
finishing the feature negotiation.  If the user specifies a device_features
bitpattern in the vdpa utility without the VIRTIO_NET_F_MAC set, then
don't set the mac.

Fixes: 151cc834f3dd ("pds_vdpa: add support for vdpa and vdpamgmt interfaces")
Signed-off-by: Shannon Nelson <shannon.nelson@amd.com>
Message-Id: <20230711042437.69381-3-shannon.nelson@amd.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
drivers/vdpa/pds/debugfs.c
drivers/vdpa/pds/vdpa_dev.c
drivers/vdpa/pds/vdpa_dev.h