diff options
author | Jakub Kicinski <kuba@kernel.org> | 2024-04-03 23:22:59 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2024-04-06 20:20:14 +0300 |
commit | 8e69b3459ca1ed4f6f7bd0b0a11962ddb3e7d34a (patch) | |
tree | aa765a5811a11f51979fdb87c0e70a8a2079e156 /include | |
parent | 9f06f87fef689d28588cde8c7ebb00a67da34026 (diff) | |
download | linux-8e69b3459ca1ed4f6f7bd0b0a11962ddb3e7d34a.tar.xz |
netlink: add nlmsg_consume() and use it in devlink compat
devlink_compat_running_version() sticks out when running
netdevsim tests and watching dropped skbs. Add nlmsg_consume()
for cases were we want to free a netlink skb but it is expected,
rather than a drop. af_netlink code uses consume_skb() directly,
which is fine, but some may prefer the symmetry of nlmsg_new() /
nlmsg_consume().
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r-- | include/net/netlink.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/include/net/netlink.h b/include/net/netlink.h index 1d2bbcc50212..61cef3bd2d31 100644 --- a/include/net/netlink.h +++ b/include/net/netlink.h @@ -41,7 +41,8 @@ * nlmsg_get_pos() return current position in message * nlmsg_trim() trim part of message * nlmsg_cancel() cancel message construction - * nlmsg_free() free a netlink message + * nlmsg_consume() free a netlink message (expected) + * nlmsg_free() free a netlink message (drop) * * Message Sending: * nlmsg_multicast() multicast message to several groups @@ -1082,7 +1083,7 @@ static inline void nlmsg_cancel(struct sk_buff *skb, struct nlmsghdr *nlh) } /** - * nlmsg_free - free a netlink message + * nlmsg_free - drop a netlink message * @skb: socket buffer of netlink message */ static inline void nlmsg_free(struct sk_buff *skb) @@ -1091,6 +1092,15 @@ static inline void nlmsg_free(struct sk_buff *skb) } /** + * nlmsg_consume - free a netlink message + * @skb: socket buffer of netlink message + */ +static inline void nlmsg_consume(struct sk_buff *skb) +{ + consume_skb(skb); +} + +/** * nlmsg_multicast_filtered - multicast a netlink message with filter function * @sk: netlink socket to spread messages to * @skb: netlink message as socket buffer |