netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
To: Amritha Nambiar <amritha.nambiar@intel.com>,
	netdev@vger.kernel.org,  kuba@kernel.org
Cc: sridhar.samudrala@intel.com
Subject: Re: [net-next PATCH v3 04/10] netdev-genl: Add netlink framework functions for queue
Date: Tue, 10 Oct 2023 11:08:24 +0200	[thread overview]
Message-ID: <3b763763b779f95dc478c0b9177c60a97c1881b1.camel@redhat.com> (raw)
In-Reply-To: <169516245672.7377.15243846195860899954.stgit@anambiarhost.jf.intel.com>

On Tue, 2023-09-19 at 15:27 -0700, Amritha Nambiar wrote:
> Implement the netdev netlink framework functions for
> exposing queue information.
> 
> Signed-off-by: Amritha Nambiar <amritha.nambiar@intel.com>
> Reviewed-by: Sridhar Samudrala <sridhar.samudrala@intel.com>
> ---
>  net/core/netdev-genl.c |  207 +++++++++++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 204 insertions(+), 3 deletions(-)
> 
> diff --git a/net/core/netdev-genl.c b/net/core/netdev-genl.c
> index 336c608e6a6b..ceb7d1722f7c 100644
> --- a/net/core/netdev-genl.c
> +++ b/net/core/netdev-genl.c
[...] 
>  int netdev_nl_queue_get_dumpit(struct sk_buff *skb, struct netlink_callback *cb)
>  {
> -	return -EOPNOTSUPP;
> +	struct netdev_nl_dump_ctx *ctx = netdev_dump_ctx(cb);
> +	const struct genl_info *info = genl_info_dump(cb);
> +	struct net *net = sock_net(skb->sk);
> +	unsigned int rxq_idx = ctx->rxq_idx;
> +	unsigned int txq_idx = ctx->txq_idx;
> +	struct net_device *netdev;
> +	u32 ifindex = 0;
> +	int err = 0;
> +
> +	if (info->attrs[NETDEV_A_QUEUE_IFINDEX])
> +		ifindex = nla_get_u32(info->attrs[NETDEV_A_QUEUE_IFINDEX]);
> +
> +	rtnl_lock();
> +	if (ifindex) {
> +		netdev = __dev_get_by_index(net, ifindex);
> +		if (netdev)
> +			err = netdev_nl_queue_dump_one(netdev, skb, info,
> +						       &rxq_idx, &txq_idx);
> +		else
> +			err = -ENODEV;
> +	} else {
> +		for_each_netdev_dump(net, netdev, ctx->ifindex) {
> +			err = netdev_nl_queue_dump_one(netdev, skb, info,
> +						       &rxq_idx, &txq_idx);
> +
> +			if (err < 0)
> +				break;
> +			if (!err) {
> +				rxq_idx = 0;
> +				txq_idx = 0;

AFAICS, above 'err' can be either < 0 or == 0. The second test: '!err'
should be unneeded and is a bit confusing.

Cheers,

Paolo


  reply	other threads:[~2023-10-10  9:08 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-19 22:27 [net-next PATCH v3 00/10] Introduce queue and NAPI support in netdev-genl (Was: Introduce NAPI queues support) Amritha Nambiar
2023-09-19 22:27 ` [net-next PATCH v3 01/10] netdev-genl: spec: Extend netdev netlink spec in YAML for queue Amritha Nambiar
2023-09-28 10:33   ` Paolo Abeni
2023-09-28 23:06     ` Nambiar, Amritha
2023-09-19 22:27 ` [net-next PATCH v3 02/10] net: Add queue and napi association Amritha Nambiar
2023-09-28 10:47   ` Paolo Abeni
2023-09-28 23:12     ` Nambiar, Amritha
2023-09-19 22:27 ` [net-next PATCH v3 03/10] ice: Add support in the driver for associating queue with napi Amritha Nambiar
2023-09-19 22:27 ` [net-next PATCH v3 04/10] netdev-genl: Add netlink framework functions for queue Amritha Nambiar
2023-10-10  9:08   ` Paolo Abeni [this message]
2023-10-10 19:57     ` Nambiar, Amritha
2023-09-19 22:27 ` [net-next PATCH v3 05/10] netdev-genl: spec: Extend netdev netlink spec in YAML for NAPI Amritha Nambiar
2023-09-19 22:27 ` [net-next PATCH v3 06/10] netdev-genl: Add netlink framework functions for napi Amritha Nambiar
2023-09-28 11:19   ` Paolo Abeni
2023-09-28 23:34     ` Nambiar, Amritha
2023-09-19 22:27 ` [net-next PATCH v3 07/10] netdev-genl: spec: Add irq in netdev netlink YAML spec Amritha Nambiar
2023-09-19 22:27 ` [net-next PATCH v3 08/10] net: Add NAPI IRQ support Amritha Nambiar
2023-09-19 22:28 ` [net-next PATCH v3 09/10] netdev-genl: spec: Add PID in netdev netlink YAML spec Amritha Nambiar
2023-09-19 22:28 ` [net-next PATCH v3 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=3b763763b779f95dc478c0b9177c60a97c1881b1.camel@redhat.com \
    --to=pabeni@redhat.com \
    --cc=amritha.nambiar@intel.com \
    --cc=kuba@kernel.org \
    --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).