netlink: mmap: introduce mmaped skb helper functions
Subsystems (2)
RFC PATCH 1/5 netlink: mmap: introduce mmaped skb helper functions
It seems that we need helper functions for skb which is allocated at netlink_alloc_skb() since it does not have skb_shared_info.
Signed-off-by Ken-ichirou MATSUZAWA <[email protected]>
--- include/linux/netlink.h | 22 ++++--------- net/netlink/af_netlink.c | 81 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+), 16 deletions(-)
include/linux/netlink.h +6 -16
@@ -68,6 +68,12 @@ extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err);extern int netlink_has_listeners (struct sock *sk,unsigned int group);extern struct sk_buff *netlink_alloc_skb (struct sock *ssk,unsigned int size,u32 dst_portid,gfp_t gfp_mask); +extern struct sk_buff *netlink_skb_copy (const struct sk_buff *skb,gfp_t gfp_mask); +extern struct sk_buff *netlink_skb_clone (struct sk_buff *skb,gfp_t gfp_mask); +extern int netlink_skb_zerocopy (struct sk_buff *to,struct sk_buff *from,int len,int hlen); +extern void netlink_free_skb (struct sk_buff *skb); +void netlink_consume_skb (struct sk_buff *skb); +extern int netlink_unicast (struct sock *ssk,struct sk_buff *skb,__u32 portid,int nonblock);extern int netlink_broadcast (struct sock *ssk,struct sk_buff *skb,__u32 portid,__u32 group,gfp_t allocation);
@@ -86,22 +92,6 @@ int netlink_attachskb(struct sock *sk, struct sk_buff *skb,void netlink_detachskb (struct sock *sk,struct sk_buff *skb);int netlink_sendskb (struct sock *sk,struct sk_buff *skb); -static inline struct sk_buff * -netlink_skb_clone (struct sk_buff *skb,gfp_t gfp_mask) -{ -struct sk_buff *nskb; - - nskb =skb_clone (skb, gfp_mask); -if (!nskb) -return NULL ; - -/* This is a large skb, set destructor callback to release head */ -if (is_vmalloc_addr (skb->head)) - nskb->destructor = skb->destructor; - -return nskb; -} -/* * skb should fit one page. This choice is good for headerless malloc. * But we should limit to 8K so that userspace does not have to
net/netlink/af_netlink.c +81 -0
87 lines not on this page · raw message
Signature · 4 lines
1.7.10.4 ----- End forwarded message -----