HomeFreeBSD

netlink: add netlink KPI to the kernel by default

Description

netlink: add netlink KPI to the kernel by default

This change does the following:

Base Netlink KPIs (ability to register the family, parse and/or
write a Netlink message) are always present in the kernel. Specifically,

  • Implementation of genetlink family/group registration/removal, some base accessors (netlink_generic_kpi.c, 260 LoC) are compiled in unconditionally.
  • Basic TLV parser functions (netlink_message_parser.c, 507 LoC) are compiled in unconditionally.
  • Glue functions (netlink<>rtsock), malloc/core sysctl definitions (netlink_glue.c, 259 LoC) are compiled in unconditionally.
  • The rest of the KPI _functions_ are defined in the netlink_glue.c, but their implementation calls a pointer to either the stub function or the actual function, depending on whether the module is loaded or not.

This approach allows to have only 1k LoC out of ~3.7k LoC (current
sys/netlink implementation) in the kernel, which will not grow further.
It also allows for the generic netlink kernel customers to load
successfully without requiring Netlink module and operate correctly
once Netlink module is loaded.

Reviewed by: imp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D39269

Details

Provenance
melifaroAuthored on Mar 27 2023, 11:59 AM
Reviewer
imp
Differential Revision
D39269: netlink: add netlink KPI to the kernel by default.
Parents
rG21af4e09f4e8: nvmecontrol(8): fix resv register -i synopsis
Branches
Unknown
Tags
Unknown