All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH net-next 1/2] netdev-genl: Add ifname for queue and NAPI APIs
@ 2024-02-23 10:47 kernel test robot
  0 siblings, 0 replies; 8+ messages in thread
From: kernel test robot @ 2024-02-23 10:47 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp, Dan Carpenter

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <1708531057-67392-2-git-send-email-jdamato@fastly.com>
References: <1708531057-67392-2-git-send-email-jdamato@fastly.com>
TO: Joe Damato <jdamato@fastly.com>
TO: netdev@vger.kernel.org
TO: linux-kernel@vger.kernel.org
CC: Joe Damato <jdamato@fastly.com>
CC: Eric Dumazet <edumazet@google.com>
CC: Jakub Kicinski <kuba@kernel.org>
CC: Paolo Abeni <pabeni@redhat.com>
CC: Jesper Dangaard Brouer <hawk@kernel.org>
CC: Stanislav Fomichev <sdf@google.com>
CC: Amritha Nambiar <amritha.nambiar@intel.com>
CC: Larysa Zaremba <larysa.zaremba@intel.com>
CC: Lorenzo Bianconi <lorenzo@kernel.org>
CC: Tariq Toukan <tariqt@nvidia.com>
CC: Sridhar Samudrala <sridhar.samudrala@intel.com>
CC: Alexei Starovoitov <ast@kernel.org>
CC: Maciej Fijalkowski <maciej.fijalkowski@intel.com>

Hi Joe,

kernel test robot noticed the following build warnings:

[auto build test WARNING on net-next/main]

url:    https://github.com/intel-lab-lkp/linux/commits/Joe-Damato/netdev-genl-Add-ifname-for-queue-and-NAPI-APIs/20240222-000134
base:   net-next/main
patch link:    https://lore.kernel.org/r/1708531057-67392-2-git-send-email-jdamato%40fastly.com
patch subject: [PATCH net-next 1/2] netdev-genl: Add ifname for queue and NAPI APIs
:::::: branch date: 2 days ago
:::::: commit date: 2 days ago
config: i386-randconfig-141-20240222 (https://download.01.org/0day-ci/archive/20240223/202402231851.2NeORqwi-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202402231851.2NeORqwi-lkp@intel.com/

New smatch warnings:
net/core/netdev-genl.c:388 netdev_nl_queue_get_doit() error: uninitialized symbol 'ifname'.

Old smatch warnings:
net/core/netdev-genl.c:45 netdev_nl_dev_fill() warn: inconsistent indenting

vim +/ifname +388 net/core/netdev-genl.c

6b6171db7fc8f7 Amritha Nambiar 2023-12-01  370  
bc877956272f05 Amritha Nambiar 2023-12-01  371  int netdev_nl_queue_get_doit(struct sk_buff *skb, struct genl_info *info)
bc877956272f05 Amritha Nambiar 2023-12-01  372  {
6b6171db7fc8f7 Amritha Nambiar 2023-12-01  373  	u32 q_id, q_type, ifindex;
6b6171db7fc8f7 Amritha Nambiar 2023-12-01  374  	struct net_device *netdev;
6b6171db7fc8f7 Amritha Nambiar 2023-12-01  375  	struct sk_buff *rsp;
f340b224321fa6 Joe Damato      2024-02-21  376  	char *ifname;
6b6171db7fc8f7 Amritha Nambiar 2023-12-01  377  	int err;
6b6171db7fc8f7 Amritha Nambiar 2023-12-01  378  
6b6171db7fc8f7 Amritha Nambiar 2023-12-01  379  	if (GENL_REQ_ATTR_CHECK(info, NETDEV_A_QUEUE_ID) ||
6b6171db7fc8f7 Amritha Nambiar 2023-12-01  380  	    GENL_REQ_ATTR_CHECK(info, NETDEV_A_QUEUE_TYPE) ||
f340b224321fa6 Joe Damato      2024-02-21  381  	    GENL_REQ_ATTR_CHECK(info, NETDEV_A_QUEUE_IFINDEX) ||
f340b224321fa6 Joe Damato      2024-02-21  382  	    GENL_REQ_ATTR_CHECK(info, NETDEV_A_QUEUE_IFNAME))
6b6171db7fc8f7 Amritha Nambiar 2023-12-01  383  		return -EINVAL;
6b6171db7fc8f7 Amritha Nambiar 2023-12-01  384  
6b6171db7fc8f7 Amritha Nambiar 2023-12-01  385  	q_id = nla_get_u32(info->attrs[NETDEV_A_QUEUE_ID]);
6b6171db7fc8f7 Amritha Nambiar 2023-12-01  386  	q_type = nla_get_u32(info->attrs[NETDEV_A_QUEUE_TYPE]);
6b6171db7fc8f7 Amritha Nambiar 2023-12-01  387  	ifindex = nla_get_u32(info->attrs[NETDEV_A_QUEUE_IFINDEX]);
f340b224321fa6 Joe Damato      2024-02-21 @388  	nla_strscpy(ifname, info->attrs[NETDEV_A_QUEUE_IFNAME], IFNAMSIZ);
6b6171db7fc8f7 Amritha Nambiar 2023-12-01  389  
6b6171db7fc8f7 Amritha Nambiar 2023-12-01  390  	rsp = genlmsg_new(GENLMSG_DEFAULT_SIZE, GFP_KERNEL);
6b6171db7fc8f7 Amritha Nambiar 2023-12-01  391  	if (!rsp)
6b6171db7fc8f7 Amritha Nambiar 2023-12-01  392  		return -ENOMEM;
6b6171db7fc8f7 Amritha Nambiar 2023-12-01  393  
6b6171db7fc8f7 Amritha Nambiar 2023-12-01  394  	rtnl_lock();
6b6171db7fc8f7 Amritha Nambiar 2023-12-01  395  
6b6171db7fc8f7 Amritha Nambiar 2023-12-01  396  	netdev = __dev_get_by_index(genl_info_net(info), ifindex);
f340b224321fa6 Joe Damato      2024-02-21  397  
f340b224321fa6 Joe Damato      2024-02-21  398  	if (strcmp(netdev->name, ifname)) {
f340b224321fa6 Joe Damato      2024-02-21  399  		err = -ENODEV;
f340b224321fa6 Joe Damato      2024-02-21  400  	} else {
6b6171db7fc8f7 Amritha Nambiar 2023-12-01  401  		if (netdev)
6b6171db7fc8f7 Amritha Nambiar 2023-12-01  402  			err = netdev_nl_queue_fill(rsp, netdev, q_id, q_type, info);
6b6171db7fc8f7 Amritha Nambiar 2023-12-01  403  		else
6b6171db7fc8f7 Amritha Nambiar 2023-12-01  404  			err = -ENODEV;
f340b224321fa6 Joe Damato      2024-02-21  405  	}
6b6171db7fc8f7 Amritha Nambiar 2023-12-01  406  
6b6171db7fc8f7 Amritha Nambiar 2023-12-01  407  	rtnl_unlock();
6b6171db7fc8f7 Amritha Nambiar 2023-12-01  408  
6b6171db7fc8f7 Amritha Nambiar 2023-12-01  409  	if (err)
6b6171db7fc8f7 Amritha Nambiar 2023-12-01  410  		goto err_free_msg;
6b6171db7fc8f7 Amritha Nambiar 2023-12-01  411  
6b6171db7fc8f7 Amritha Nambiar 2023-12-01  412  	return genlmsg_reply(rsp, info);
6b6171db7fc8f7 Amritha Nambiar 2023-12-01  413  
6b6171db7fc8f7 Amritha Nambiar 2023-12-01  414  err_free_msg:
6b6171db7fc8f7 Amritha Nambiar 2023-12-01  415  	nlmsg_free(rsp);
6b6171db7fc8f7 Amritha Nambiar 2023-12-01  416  	return err;
6b6171db7fc8f7 Amritha Nambiar 2023-12-01  417  }
6b6171db7fc8f7 Amritha Nambiar 2023-12-01  418  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 8+ messages in thread
* [PATCH net-next 0/2] Expose netdev name in netdev netlink APIs
@ 2024-02-21 15:57 Joe Damato
  2024-02-21 15:57 ` [PATCH net-next 1/2] netdev-genl: Add ifname for queue and NAPI APIs Joe Damato
  0 siblings, 1 reply; 8+ messages in thread
From: Joe Damato @ 2024-02-21 15:57 UTC (permalink / raw)
  To: netdev, linux-kernel
  Cc: Joe Damato, Alexei Starovoitov, Amritha Nambiar, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Jesper Dangaard Brouer,
	Larysa Zaremba, Maciej Fijalkowski, Paolo Abeni,
	Sridhar Samudrala, Stanislav Fomichev, Tariq Toukan

Greetings:

The netdev netlink APIs currently provide the ifindex of a device
associated with the NIC queue or NAPI when the netlink API is used. In
order for user applications to map this back to a human readable device
name, user applications must issue a subsequent ioctl (SIOCGIFNAME) in
order to map an ifindex back to a device name.

This patch set adds ifname to the API so that when queue or NAPI
information is retrieved, the human readable string is included. The netdev
netlink YAML spec has been updated to include this field, as well.

This saves the subsequent call to ioctl and makes the netlink information
more user friendly. Applications might use this information in conjunction
with SO_INCOMING_NAPI_ID to map NAPI IDs to specific NICs with application
specific configuration (e.g. NUMA zone and CPU layout information).

An example using the netlink cli tool before this change:

$ ./cli.py --spec netdev.yaml --dump queue-get --json='{"ifindex": 7}'
[{'id': 0, 'ifindex': 7, 'type': 'rx'},
 {'id': 1, 'ifindex': 7, 'type': 'rx'},
 {'id': 2, 'ifindex': 7, 'type': 'rx'},
...

$ ./cli.py --spec netdev.yaml --dump napi-get --json='{"ifindex": 7}'
[{'id': 448, 'ifindex': 7},
 {'id': 447, 'ifindex': 7},
 {'id': 446, 'ifindex': 7},
...

An example after this change:

$ ./cli.py --spec netdev.yaml --dump queue-get --json='{"ifindex": 7}'
[{'id': 0, 'ifindex': 7, 'ifname': 'eth1', 'type': 'rx'},
 {'id': 1, 'ifindex': 7, 'ifname': 'eth1', 'type': 'rx'},
 {'id': 2, 'ifindex': 7, 'ifname': 'eth1', 'type': 'rx'},
 ...

$ ./cli.py --spec netdev.yaml --dump napi-get --json='{"ifindex": 7}'
[{'id': 448, 'ifindex': 7, 'ifname': 'eth1'},
 {'id': 447, 'ifindex': 7, 'ifname': 'eth1'},
 {'id': 446, 'ifindex': 7, 'ifname': 'eth1'},
 ...

Thanks,
Joe

Joe Damato (2):
  netdev-genl: Add ifname for queue and NAPI APIs
  netdev-genl: spec: Add ifname to netdev nl YAML spec

 Documentation/netlink/specs/netdev.yaml | 10 ++++++++++
 include/uapi/linux/netdev.h             |  2 ++
 net/core/netdev-genl.c                  | 22 +++++++++++++++++-----
 tools/include/uapi/linux/netdev.h       |  2 ++
 4 files changed, 31 insertions(+), 5 deletions(-)

-- 
2.7.4


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-02-23 11:21 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-23 10:47 [PATCH net-next 1/2] netdev-genl: Add ifname for queue and NAPI APIs kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2024-02-21 15:57 [PATCH net-next 0/2] Expose netdev name in netdev netlink APIs Joe Damato
2024-02-21 15:57 ` [PATCH net-next 1/2] netdev-genl: Add ifname for queue and NAPI APIs Joe Damato
2024-02-21 19:12   ` Jakub Kicinski
2024-02-21 19:17     ` Joe Damato
2024-02-21 19:12   ` Nambiar, Amritha
2024-02-21 19:23     ` Joe Damato
2024-02-22 20:55   ` kernel test robot
2024-02-23 11:21   ` Dan Carpenter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.