[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231010192926.6d938d4e@kernel.org>
Date: Tue, 10 Oct 2023 19:29:26 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Amritha Nambiar <amritha.nambiar@...el.com>
Cc: netdev@...r.kernel.org, sridhar.samudrala@...el.com
Subject: Re: [net-next PATCH v4 06/10] netdev-genl: Add netlink framework
functions for napi
On Fri, 06 Oct 2023 02:15:10 -0700 Amritha Nambiar wrote:
> Implement the netdev netlink framework functions for
> napi support. The netdev structure tracks all the napi
> instances and napi fields. The napi instances and associated
> parameters can be retrieved this way.
>
> Signed-off-by: Amritha Nambiar <amritha.nambiar@...el.com>
> Reviewed-by: Sridhar Samudrala <sridhar.samudrala@...el.com>
> ---
> include/linux/netdevice.h | 2 +
> net/core/dev.c | 4 +-
> net/core/netdev-genl.c | 117 ++++++++++++++++++++++++++++++++++++++++++++-
> 3 files changed, 119 insertions(+), 4 deletions(-)
>
> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
> index 264ae0bdabe8..da211f4d81db 100644
> --- a/include/linux/netdevice.h
> +++ b/include/linux/netdevice.h
> @@ -536,6 +536,8 @@ static inline bool napi_complete(struct napi_struct *n)
> return napi_complete_done(n, 0);
> }
>
> +struct napi_struct *napi_by_id(unsigned int napi_id);
this can go into net/core/dev.h ?
> int dev_set_threaded(struct net_device *dev, bool threaded);
>
> /**
> @@ -6144,6 +6143,7 @@ static struct napi_struct *napi_by_id(unsigned int napi_id)
>
> return NULL;
> }
> +EXPORT_SYMBOL(napi_by_id);
Why is it exported? Exports are for use in modules.
> int netdev_nl_napi_get_doit(struct sk_buff *skb, struct genl_info *info)
> {
> - return -EOPNOTSUPP;
> + struct napi_struct *napi;
> + struct sk_buff *rsp;
> + u32 napi_id;
> + int err;
> +
> + if (GENL_REQ_ATTR_CHECK(info, NETDEV_A_NAPI_NAPI_ID))
> + return -EINVAL;
> +
> + napi_id = nla_get_u32(info->attrs[NETDEV_A_NAPI_NAPI_ID]);
> +
> + rsp = genlmsg_new(GENLMSG_DEFAULT_SIZE, GFP_KERNEL);
> + if (!rsp)
> + return -ENOMEM;
> +
> + rcu_read_lock();
> +
> + napi = napi_by_id(napi_id);
> + if (napi)
> + err = netdev_nl_napi_fill_one(rsp, napi, info);
double space
> + else
> + err = -EINVAL;
Powered by blists - more mailing lists