netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Amritha Nambiar <amritha.nambiar@intel.com>
Cc: netdev@vger.kernel.org, sridhar.samudrala@intel.com
Subject: Re: [net-next PATCH v4 06/10] netdev-genl: Add netlink framework functions for napi
Date: Tue, 10 Oct 2023 19:29:26 -0700	[thread overview]
Message-ID: <20231010192926.6d938d4e@kernel.org> (raw)
In-Reply-To: <169658371009.3683.2263972635869263084.stgit@anambiarhost.jf.intel.com>

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@intel.com>
> Reviewed-by: Sridhar Samudrala <sridhar.samudrala@intel.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;


  reply	other threads:[~2023-10-11  2:29 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-06  9:14 [net-next PATCH v4 00/10] Introduce queue and NAPI support in netdev-genl (Was: Introduce NAPI queues support) Amritha Nambiar
2023-10-06  9:14 ` [net-next PATCH v4 01/10] netdev-genl: spec: Extend netdev netlink spec in YAML for queue Amritha Nambiar
2023-10-11  2:12   ` Jakub Kicinski
2023-10-11 23:28     ` Nambiar, Amritha
2023-10-06  9:14 ` [net-next PATCH v4 02/10] net: Add queue and napi association Amritha Nambiar
2023-10-11  2:17   ` Jakub Kicinski
2023-10-11 23:36     ` Nambiar, Amritha
2023-10-06  9:14 ` [net-next PATCH v4 03/10] ice: Add support in the driver for associating queue with napi Amritha Nambiar
2023-10-06  9:14 ` [net-next PATCH v4 04/10] netdev-genl: Add netlink framework functions for queue Amritha Nambiar
2023-10-11  2:25   ` Jakub Kicinski
2023-10-11 23:54     ` Nambiar, Amritha
2023-10-12 23:48       ` Jakub Kicinski
2023-10-13  0:24         ` Nambiar, Amritha
2023-10-13  0:36           ` Jakub Kicinski
2023-10-13  0:40             ` Nambiar, Amritha
2023-10-13  0:44             ` Jakub Kicinski
2023-10-06  9:15 ` [net-next PATCH v4 05/10] netdev-genl: spec: Extend netdev netlink spec in YAML for NAPI Amritha Nambiar
2023-10-06  9:15 ` [net-next PATCH v4 06/10] netdev-genl: Add netlink framework functions for napi Amritha Nambiar
2023-10-11  2:29   ` Jakub Kicinski [this message]
2023-10-11 23:55     ` Nambiar, Amritha
2023-10-06  9:15 ` [net-next PATCH v4 07/10] netdev-genl: spec: Add irq in netdev netlink YAML spec Amritha Nambiar
2023-10-06  9:15 ` [net-next PATCH v4 08/10] net: Add NAPI IRQ support Amritha Nambiar
2023-10-06  9:15 ` [net-next PATCH v4 09/10] netdev-genl: spec: Add PID in netdev netlink YAML spec Amritha Nambiar
2023-10-06  9:15 ` [net-next PATCH v4 10/10] netdev-genl: Add PID for the NAPI thread Amritha Nambiar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231010192926.6d938d4e@kernel.org \
    --to=kuba@kernel.org \
    --cc=amritha.nambiar@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=sridhar.samudrala@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).