This patch refactors vhost_vdpa_net_load_rx() to restore the packet receive filtering state in relation to VIRTIO_NET_F_CTRL_RX_EXTRA feature at device's startup.
Signed-off-by: Hawkins Jiawei <yin31...@gmail.com> --- net/vhost-vdpa.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index ca800f97e2..9b929762c5 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -822,6 +822,36 @@ static int vhost_vdpa_net_load_rx(VhostVDPAState *s, } } + if (virtio_vdev_has_feature(&n->parent_obj, VIRTIO_NET_F_CTRL_RX_EXTRA)) { + /* Load the all-unicast mode */ + on = n->alluni; + r = vhost_vdpa_net_load_rx_mode(s, VIRTIO_NET_CTRL_RX_ALLUNI, on); + if (r < 0) { + return r; + } + + /* Load the non-multicast mode */ + on = n->nomulti; + r = vhost_vdpa_net_load_rx_mode(s, VIRTIO_NET_CTRL_RX_NOMULTI, on); + if (r < 0) { + return r; + } + + /* Load the non-unicast mode */ + on = n->nouni; + r = vhost_vdpa_net_load_rx_mode(s, VIRTIO_NET_CTRL_RX_NOUNI, on); + if (r < 0) { + return r; + } + + /* Load the non-broadcast mode */ + on = n->nobcast; + r = vhost_vdpa_net_load_rx_mode(s, VIRTIO_NET_CTRL_RX_NOBCAST, on); + if (r < 0) { + return r; + } + } + return 0; } -- 2.25.1