diff options
Diffstat (limited to 'include/net/netlink.h')
-rw-r--r-- | include/net/netlink.h | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/include/net/netlink.h b/include/net/netlink.h index ce5cba19c393..fd75fd65d59e 100644 --- a/include/net/netlink.h +++ b/include/net/netlink.h | |||
@@ -500,14 +500,15 @@ static inline struct nlmsghdr *nlmsg_put_answer(struct sk_buff *skb, | |||
500 | 500 | ||
501 | /** | 501 | /** |
502 | * nlmsg_new - Allocate a new netlink message | 502 | * nlmsg_new - Allocate a new netlink message |
503 | * @size: maximum size of message | 503 | * @payload: size of the message payload |
504 | * @flags: the type of memory to allocate. | 504 | * @flags: the type of memory to allocate. |
505 | * | 505 | * |
506 | * Use NLMSG_GOODSIZE if size isn't know and you need a good default size. | 506 | * Use NLMSG_DEFAULT_SIZE if the size of the payload isn't known |
507 | * and a good default is needed. | ||
507 | */ | 508 | */ |
508 | static inline struct sk_buff *nlmsg_new(int size, gfp_t flags) | 509 | static inline struct sk_buff *nlmsg_new(size_t payload, gfp_t flags) |
509 | { | 510 | { |
510 | return alloc_skb(size, flags); | 511 | return alloc_skb(nlmsg_total_size(payload), flags); |
511 | } | 512 | } |
512 | 513 | ||
513 | /** | 514 | /** |
@@ -828,6 +829,9 @@ static inline int nla_put_msecs(struct sk_buff *skb, int attrtype, | |||
828 | #define NLA_PUT_U16(skb, attrtype, value) \ | 829 | #define NLA_PUT_U16(skb, attrtype, value) \ |
829 | NLA_PUT_TYPE(skb, u16, attrtype, value) | 830 | NLA_PUT_TYPE(skb, u16, attrtype, value) |
830 | 831 | ||
832 | #define NLA_PUT_LE16(skb, attrtype, value) \ | ||
833 | NLA_PUT_TYPE(skb, __le16, attrtype, value) | ||
834 | |||
831 | #define NLA_PUT_U32(skb, attrtype, value) \ | 835 | #define NLA_PUT_U32(skb, attrtype, value) \ |
832 | NLA_PUT_TYPE(skb, u32, attrtype, value) | 836 | NLA_PUT_TYPE(skb, u32, attrtype, value) |
833 | 837 | ||
@@ -874,6 +878,15 @@ static inline u16 nla_get_u16(struct nlattr *nla) | |||
874 | } | 878 | } |
875 | 879 | ||
876 | /** | 880 | /** |
881 | * nla_get_le16 - return payload of __le16 attribute | ||
882 | * @nla: __le16 netlink attribute | ||
883 | */ | ||
884 | static inline __le16 nla_get_le16(struct nlattr *nla) | ||
885 | { | ||
886 | return *(__le16 *) nla_data(nla); | ||
887 | } | ||
888 | |||
889 | /** | ||
877 | * nla_get_u8 - return payload of u8 attribute | 890 | * nla_get_u8 - return payload of u8 attribute |
878 | * @nla: u8 netlink attribute | 891 | * @nla: u8 netlink attribute |
879 | */ | 892 | */ |