netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch net-next v4 0/9] devlink: introduce notifications filtering
@ 2023-11-23 18:15 Jiri Pirko
  2023-11-23 18:15 ` [patch net-next v4 1/9] devlink: use devl_is_registered() helper instead xa_get_mark() Jiri Pirko
                   ` (8 more replies)
  0 siblings, 9 replies; 40+ messages in thread
From: Jiri Pirko @ 2023-11-23 18:15 UTC (permalink / raw)
  To: netdev
  Cc: kuba, pabeni, davem, edumazet, jacob.e.keller, jhs, johannes,
	andriy.shevchenko, amritha.nambiar, sdf, horms

From: Jiri Pirko <jiri@nvidia.com>

Currently the user listening on a socket for devlink notifications
gets always all messages for all existing devlink instances and objects,
even if he is interested only in one of those. That may cause
unnecessary overhead on setups with thousands of instances present.

User is currently able to narrow down the devlink objects replies
to dump commands by specifying select attributes.

Allow similar approach for notifications providing user a new
notify-filter-set command to select attributes with values
the notification message has to match. In that case, it is delivered
to the socket.

Note that the filtering is done per-socket, so multiple users may
specify different selection of attributes with values.

This patchset initially introduces support for following attributes:
DEVLINK_ATTR_BUS_NAME
DEVLINK_ATTR_DEV_NAME
DEVLINK_ATTR_PORT_INDEX

Patches #1 - #4 are preparations in devlink code, patch #3 is
                an optimization done on the way.
Patches #5 - #7 are preparations in netlink and generic netlink code.
Patch #8 is the main one in this set implementing of
         the notify-filter-set command and the actual
         per-socket filtering.
Patch #9 extends the infrastructure allowing to filter according
         to a port index.

Example:
$ devlink mon port pci/0000:08:00.0/32768
[port,new] pci/0000:08:00.0/32768: type notset flavour pcisf controller 0 pfnum 0 sfnum 107 splittable false
  function:
    hw_addr 00:00:00:00:00:00 state inactive opstate detached roce enable
[port,new] pci/0000:08:00.0/32768: type eth flavour pcisf controller 0 pfnum 0 sfnum 107 splittable false
  function:
    hw_addr 00:00:00:00:00:00 state inactive opstate detached roce enable
[port,new] pci/0000:08:00.0/32768: type eth netdev eth3 flavour pcisf controller 0 pfnum 0 sfnum 107 splittable false
  function:
    hw_addr 00:00:00:00:00:00 state inactive opstate detached roce enable
[port,new] pci/0000:08:00.0/32768: type eth netdev eth3 flavour pcisf controller 0 pfnum 0 sfnum 107 splittable false
  function:
    hw_addr 00:00:00:00:00:00 state inactive opstate detached roce enable
[port,new] pci/0000:08:00.0/32768: type eth flavour pcisf controller 0 pfnum 0 sfnum 107 splittable false
  function:
    hw_addr 00:00:00:00:00:00 state inactive opstate detached roce enable
[port,new] pci/0000:08:00.0/32768: type notset flavour pcisf controller 0 pfnum 0 sfnum 107 splittable false
  function:
    hw_addr 00:00:00:00:00:00 state inactive opstate detached roce enable
[port,del] pci/0000:08:00.0/32768: type notset flavour pcisf controller 0 pfnum 0 sfnum 107 splittable false
  function:
    hw_addr 00:00:00:00:00:00 state inactive opstate detached roce enable

---
v3->v4:
- converted from sk_user_data pointer use to nlk(sk)->priv pointer and
  allow priv to be stored for multiple generic netlink families, see
  patch #5 for more details
v2->v3:
- small cosmetical fixes in patch #6
v1->v2:
- added patch #6, fixed generated docs
- see individual patches for details

Jiri Pirko (9):
  devlink: use devl_is_registered() helper instead xa_get_mark()
  devlink: introduce __devl_is_registered() helper and use it instead of
    xa_get_mark()
  devlink: send notifications only if there are listeners
  devlink: introduce a helper for netlink multicast send
  genetlink: introduce per-sock family private pointer storage
  netlink: introduce typedef for filter function
  genetlink: introduce helpers to do filtered multicast
  devlink: add a command to set notification filter and use it for
    multicasts
  devlink: extend multicast filtering by port index

 Documentation/netlink/specs/devlink.yaml | 11 +++
 drivers/connector/connector.c            |  5 +-
 include/linux/connector.h                |  3 +-
 include/linux/netlink.h                  |  6 +-
 include/net/genetlink.h                  | 38 ++++++++-
 include/net/netlink.h                    | 31 +++++++-
 include/uapi/linux/devlink.h             |  2 +
 net/devlink/dev.c                        | 13 ++--
 net/devlink/devl_internal.h              | 59 +++++++++++++-
 net/devlink/health.c                     | 10 ++-
 net/devlink/linecard.c                   |  5 +-
 net/devlink/netlink.c                    | 81 ++++++++++++++++++++
 net/devlink/netlink_gen.c                | 16 +++-
 net/devlink/netlink_gen.h                |  4 +-
 net/devlink/param.c                      |  5 +-
 net/devlink/port.c                       |  8 +-
 net/devlink/rate.c                       |  5 +-
 net/devlink/region.c                     |  6 +-
 net/devlink/trap.c                       | 18 ++---
 net/netlink/af_netlink.c                 |  3 +-
 net/netlink/af_netlink.h                 |  1 +
 net/netlink/genetlink.c                  | 98 ++++++++++++++++++++++++
 tools/net/ynl/generated/devlink-user.c   | 33 ++++++++
 tools/net/ynl/generated/devlink-user.h   | 56 ++++++++++++++
 24 files changed, 465 insertions(+), 52 deletions(-)

-- 
2.41.0


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

end of thread, other threads:[~2023-12-05 15:58 UTC | newest]

Thread overview: 40+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-23 18:15 [patch net-next v4 0/9] devlink: introduce notifications filtering Jiri Pirko
2023-11-23 18:15 ` [patch net-next v4 1/9] devlink: use devl_is_registered() helper instead xa_get_mark() Jiri Pirko
2023-11-23 18:15 ` [patch net-next v4 2/9] devlink: introduce __devl_is_registered() helper and use it instead of xa_get_mark() Jiri Pirko
2023-11-23 18:15 ` [patch net-next v4 3/9] devlink: send notifications only if there are listeners Jiri Pirko
2023-11-27 11:01   ` Paolo Abeni
2023-11-27 12:04     ` Jiri Pirko
2023-11-27 15:00       ` Paolo Abeni
2023-11-28  7:39         ` Jiri Pirko
2023-11-23 18:15 ` [patch net-next v4 4/9] devlink: introduce a helper for netlink multicast send Jiri Pirko
2023-11-23 18:15 ` [patch net-next v4 5/9] genetlink: introduce per-sock family private pointer storage Jiri Pirko
2023-11-27 11:13   ` Paolo Abeni
2023-11-27 12:00     ` Jiri Pirko
2023-11-27 22:46   ` Jakub Kicinski
2023-11-28  8:25     ` Jiri Pirko
2023-11-28 15:11       ` Jakub Kicinski
2023-11-28 16:05         ` Jiri Pirko
2023-11-28 16:36           ` Jakub Kicinski
2023-11-29 13:59             ` Jiri Pirko
2023-11-29 15:01               ` Jakub Kicinski
2023-11-29 15:25                 ` Jiri Pirko
2023-11-28 12:30   ` Przemek Kitszel
2023-11-28 15:05     ` Jiri Pirko
2023-11-28 16:18     ` Andy Shevchenko
2023-11-28 19:59       ` Jacob Keller
2023-11-28 20:06         ` Andy Shevchenko
2023-11-29 23:29           ` Jacob Keller
2023-11-23 18:15 ` [patch net-next v4 6/9] netlink: introduce typedef for filter function Jiri Pirko
2023-11-23 18:15 ` [patch net-next v4 7/9] genetlink: introduce helpers to do filtered multicast Jiri Pirko
2023-11-23 18:15 ` [patch net-next v4 8/9] devlink: add a command to set notification filter and use it for multicasts Jiri Pirko
2023-11-27 12:30   ` Przemek Kitszel
2023-11-27 12:51     ` Jiri Pirko
2023-11-27 12:56       ` Jiri Pirko
2023-11-27 15:40   ` Przemek Kitszel
2023-11-28  8:26     ` Jiri Pirko
2023-12-04 16:24     ` Jiri Pirko
2023-12-04 16:47       ` Andy Shevchenko
2023-12-04 19:17       ` Keller, Jacob E
2023-12-05  7:47         ` Jiri Pirko
2023-12-05 15:58           ` andriy.shevchenko
2023-11-23 18:15 ` [patch net-next v4 9/9] devlink: extend multicast filtering by port index Jiri Pirko

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).