[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <97d430d5-f139-468c-b9e2-ef60e5d5cd34@redhat.com>
Date: Tue, 7 Jan 2025 12:06:35 +0100
From: Paolo Abeni <pabeni@...hat.com>
To: Jakub Kicinski <kuba@...nel.org>, davem@...emloft.net
Cc: netdev@...r.kernel.org, edumazet@...gle.com, dw@...idwei.uk,
almasrymina@...gle.com, jdamato@...tly.com
Subject: Re: [PATCH net-next 7/8] netdevsim: add debugfs-triggered queue reset
On 1/3/25 7:59 PM, Jakub Kicinski wrote:
> @@ -723,6 +726,54 @@ static const struct netdev_queue_mgmt_ops nsim_queue_mgmt_ops = {
> .ndo_queue_stop = nsim_queue_stop,
> };
>
> +static ssize_t
> +nsim_qreset_write(struct file *file, const char __user *data,
> + size_t count, loff_t *ppos)
> +{
> + struct netdevsim *ns = file->private_data;
> + unsigned int queue, mode;
> + char buf[32];
> + ssize_t ret;
> +
> + if (count >= sizeof(buf))
> + return -EINVAL;
> + if (copy_from_user(buf, data, count))
> + return -EFAULT;
> + buf[count] = '\0';
> +
> + ret = sscanf(buf, "%u %u", &queue, &mode);
> + if (ret != 2)
> + return -EINVAL;
> +
> + rtnl_lock();
> + if (!netif_running(ns->netdev)) {
> + ret = -ENETDOWN;
> + goto exit_unlock;
> + }
> +
> + if (queue >= ns->netdev->real_num_rx_queues) {
> + ret = -EINVAL;
> + goto exit_unlock;
> + }
> +
> + ns->rq_reset_mode = mode;
> + ret = netdev_rx_queue_restart(ns->netdev, queue);
> + ns->rq_reset_mode = 0;
> + if (ret)
> + goto exit_unlock;
> +
> + ret = count;
> +exit_unlock:
> + rtnl_unlock();
> + return ret;
> +}
> +
> +static const struct file_operations nsim_qreset_fops = {
> + .open = simple_open,
> + .write = nsim_qreset_write,
> + .owner = THIS_MODULE,
> +};
> +
> static ssize_t
> nsim_pp_hold_read(struct file *file, char __user *data,
> size_t count, loff_t *ppos)
> @@ -935,6 +986,9 @@ nsim_create(struct nsim_dev *nsim_dev, struct nsim_dev_port *nsim_dev_port)
>
> ns->pp_dfs = debugfs_create_file("pp_hold", 0600, nsim_dev_port->ddir,
> ns, &nsim_pp_hold_fops);
> + ns->qr_dfs = debugfs_create_file("queue_reset", 0600,
> + nsim_dev_port->ddir, ns,
> + &nsim_qreset_fops);
Only the write callback is provided, but flags are RW, this causes a
setup failure in bpf offload selftests - while trying to read the
current status.
Cheers,
Paolo
Powered by blists - more mailing lists