]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
devlink: introduce devlink_nl_put_u64()
authorPrzemek Kitszel <przemyslaw.kitszel@intel.com>
Wed, 23 Oct 2024 13:09:01 +0000 (15:09 +0200)
committerJakub Kicinski <kuba@kernel.org>
Tue, 29 Oct 2024 23:52:56 +0000 (16:52 -0700)
Add devlink_nl_put_u64() that abstracts padding for u64 values.
All u64 values are passed with the very same padding option.

Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Reviewed-by: Joe Damato <jdamato@fastly.com>
Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Link: https://patch.msgid.link/20241023131248.27192-2-przemyslaw.kitszel@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/devlink/devl_internal.h

index a9f064ab9ed9b9a9d6ae9d150c74e7550ed48af2..14eaad9cfe35718f38c401ad1b01df9595f58c85 100644 (file)
@@ -181,6 +181,11 @@ devlink_nl_put_handle(struct sk_buff *msg, struct devlink *devlink)
        return 0;
 }
 
+static inline int devlink_nl_put_u64(struct sk_buff *msg, int attrtype, u64 val)
+{
+       return nla_put_u64_64bit(msg, attrtype, val, DEVLINK_ATTR_PAD);
+}
+
 int devlink_nl_put_nested_handle(struct sk_buff *msg, struct net *net,
                                 struct devlink *devlink, int attrtype);
 int devlink_nl_msg_reply_and_new(struct sk_buff **msg, struct genl_info *info);