aboutsummaryrefslogtreecommitdiff
path: root/sys/compat/linuxkpi/common/include/linux/skbuff.h
diff options
context:
space:
mode:
authorBjoern A. Zeeb <bz@FreeBSD.org>2023-05-16 21:22:34 +0000
committerBjoern A. Zeeb <bz@FreeBSD.org>2023-05-16 21:26:50 +0000
commit262c5e81937ff1682632f33e92c3e42bc92e5a77 (patch)
tree14c73c169ba9f54fe8248fb170a2ad4b49d54547 /sys/compat/linuxkpi/common/include/linux/skbuff.h
parent972bf40b62f7de0a4c652e4577c551200dfe45a5 (diff)
downloadsrc-262c5e81937ff1682632f33e92c3e42bc92e5a77.tar.gz
src-262c5e81937ff1682632f33e92c3e42bc92e5a77.zip
LinuxKPI: skbuff.h: add skb_hwtstamps(), implement *mac_header()
Add a dummy skb_hwtstamps() function for now, and implement skb_mac_header(), skb_reset_mac_header(), and skb_set_mac_header(). Sponsored by: The FreeBSD Foundation MFC after: 10 days
Diffstat (limited to 'sys/compat/linuxkpi/common/include/linux/skbuff.h')
-rw-r--r--sys/compat/linuxkpi/common/include/linux/skbuff.h34
1 files changed, 28 insertions, 6 deletions
diff --git a/sys/compat/linuxkpi/common/include/linux/skbuff.h b/sys/compat/linuxkpi/common/include/linux/skbuff.h
index fca161537837..cb1e7cef98e0 100644
--- a/sys/compat/linuxkpi/common/include/linux/skbuff.h
+++ b/sys/compat/linuxkpi/common/include/linux/skbuff.h
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2020-2022 The FreeBSD Foundation
+ * Copyright (c) 2020-2023 The FreeBSD Foundation
* Copyright (c) 2021-2022 Bjoern A. Zeeb
*
* This software was developed by Björn Zeeb under sponsorship from
@@ -46,6 +46,7 @@
#include <linux/gfp.h>
#include <linux/compiler.h>
#include <linux/spinlock.h>
+#include <linux/ktime.h>
/* #define SKB_DEBUG */
#ifdef SKB_DEBUG
@@ -85,6 +86,10 @@ enum sk_buff_pkt_type {
PACKET_OTHERHOST,
};
+struct skb_shared_hwtstamps {
+ ktime_t hwtstamp;
+};
+
#define NET_SKB_PAD max(CACHE_LINE_SIZE, 32)
struct sk_buff_head {
@@ -154,6 +159,7 @@ struct sk_buff {
uint16_t _flags; /* Internal flags. */
#define _SKB_FLAGS_SKBEXTFRAG 0x0001
enum sk_buff_pkt_type pkt_type;
+ uint16_t mac_header; /* offset of mac_header */
/* "Scratch" area for layers to store metadata. */
/* ??? I see sizeof() operations so probably an array. */
@@ -928,22 +934,38 @@ skb_header_cloned(struct sk_buff *skb)
}
static inline uint8_t *
-skb_mac_header(struct sk_buff *skb)
+skb_mac_header(const struct sk_buff *skb)
{
SKB_TRACE(skb);
- SKB_TODO();
- return (NULL);
+ /* Make sure the mac_header was set as otherwise we return garbage. */
+ WARN_ON(skb->mac_header == 0);
+ return (skb->head + skb->mac_header);
+}
+static inline void
+skb_reset_mac_header(struct sk_buff *skb)
+{
+ SKB_TRACE(skb);
+ skb->mac_header = skb->data - skb->head;
}
static inline void
-skb_orphan(struct sk_buff *skb)
+skb_set_mac_header(struct sk_buff *skb, const size_t len)
+{
+ SKB_TRACE(skb);
+ skb_reset_mac_header(skb);
+ skb->mac_header += len;
+}
+
+static inline struct skb_shared_hwtstamps *
+skb_hwtstamps(struct sk_buff *skb)
{
SKB_TRACE(skb);
SKB_TODO();
+ return (NULL);
}
static inline void
-skb_reset_mac_header(struct sk_buff *skb)
+skb_orphan(struct sk_buff *skb)
{
SKB_TRACE(skb);
SKB_TODO();