net: skb: introduce skb_data_area_size()
authorRicardo Martinez <ricardo.martinez@linux.intel.com>
Fri, 6 May 2022 18:12:58 +0000 (11:12 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 9 May 2022 09:51:58 +0000 (10:51 +0100)
Helper to calculate the linear data space in the skb.

Signed-off-by: Ricardo Martinez <ricardo.martinez@linux.intel.com>
Reviewed-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/skbuff.h

index 5c2599e3fe7df336f21e8b3d00ec722e8242a202..d58669d6cb91aa30edc70d59a0a7e9d4e2298842 100644 (file)
@@ -1665,6 +1665,11 @@ static inline void skb_set_end_offset(struct sk_buff *skb, unsigned int offset)
 }
 #endif
 
+static inline unsigned int skb_data_area_size(struct sk_buff *skb)
+{
+       return skb_end_pointer(skb) - skb->data;
+}
+
 struct ubuf_info *msg_zerocopy_realloc(struct sock *sk, size_t size,
                                       struct ubuf_info *uarg);