[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH RFC 1/2] vdpa: Restore packet receive filtering state relativ
From: |
Eugenio Perez Martin |
Subject: |
Re: [PATCH RFC 1/2] vdpa: Restore packet receive filtering state relative with _F_CTRL_RX_EXTRA feature |
Date: |
Sun, 25 Jun 2023 12:54:44 +0200 |
On Fri, Jun 23, 2023 at 3:26 PM Hawkins Jiawei <yin31149@gmail.com> wrote:
>
> 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 <yin31149@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;
> + }
> + }
> +
Can we skip the load if the state matches the virtio defaults? by
virtio_net_reset the defaults are:
n->promisc = 1;
n->allmulti = 0;
n->alluni = 0;
n->nomulti = 0;
n->nouni = 0;
n->nobcast = 0;
Thanks!
> return 0;
> }
>
> --
> 2.25.1
>