Re: [PATCH net-next v10 01/14] netdev: add netdev_rx_queue_restart()

Pavel Begunkov
2024-06-03T12:52:40Z

On 5/30/24 21:16, Mina Almasry wrote:
> Add netdev_rx_queue_restart() function to netdev_rx_queue.h
>
> Signed-off-by: David Wei <dw@davidwei.uk>
> Signed-off-by: Mina Almasry <almasrymina@google.com>
>
> ---
...
> diff --git a/net/core/netdev_rx_queue.c b/net/core/netdev_rx_queue.c
> new file mode 100644
> index 0000000000000..b3899358e5a9c
> --- /dev/null
> +++ b/net/core/netdev_rx_queue.c
> @@ -0,0 +1,74 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +
> +#include <linux/netdevice.h>
> +#include <net/netdev_queues.h>
> +#include <net/netdev_rx_queue.h>
> +
> +int netdev_rx_queue_restart(struct net_device *dev, unsigned int rxq_idx)
> +{
> + void *new_mem, *old_mem;
> + int err;

I believe it should also do:

if (!dev->queue_mgmt_ops)
return -EOPNOTSUPP;

> +
> + if (!dev->queue_mgmt_ops->ndo_queue_stop ||
> + !dev->queue_mgmt_ops->ndo_queue_mem_free ||
> + !dev->queue_mgmt_ops->ndo_queue_mem_alloc ||
> + !dev->queue_mgmt_ops->ndo_queue_start)
> + return -EOPNOTSUPP;
> +
> + DEBUG_NET_WARN_ON_ONCE(!rtnl_is_locked());

--
Pavel Begunkov