git: b30d9f2e5204 - stable/13 - LinuxKPI: skbuff.h: add more (skeleton) functions used by wireless drivers
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 26 Jun 2023 12:08:45 UTC
The branch stable/13 has been updated by bz:
URL: https://cgit.FreeBSD.org/src/commit/?id=b30d9f2e5204b475cf79150542b758c3dab14e70
commit b30d9f2e5204b475cf79150542b758c3dab14e70
Author: Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2023-05-16 21:22:34 +0000
Commit: Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2023-06-26 09:15:20 +0000
LinuxKPI: skbuff.h: add more (skeleton) functions used by wireless drivers
Add a dummy skb_hwtstamps() function for now, and implement
skb_mac_header(), skb_reset_mac_header(), and skb_set_mac_header().
Add a dummy implementation of skb_get_hash() until we'll hit and
implement it. Add napi_build_skb() and skb_mark_for_recycle().
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 262c5e81937ff1682632f33e92c3e42bc92e5a77)
(cherry picked from commit 369264acf7d2a317383599141ab2f36ee3d2130c)
(cherry picked from commit 1213a6bea8a16dc797efea5a7ed7d6a4d7cb4675)
---
sys/compat/linuxkpi/common/include/linux/skbuff.h | 60 ++++++++++++++++++++---
1 file changed, 53 insertions(+), 7 deletions(-)
diff --git a/sys/compat/linuxkpi/common/include/linux/skbuff.h b/sys/compat/linuxkpi/common/include/linux/skbuff.h
index fca161537837..8d4fefdb1a2b 100644
--- a/sys/compat/linuxkpi/common/include/linux/skbuff.h
+++ b/sys/compat/linuxkpi/common/include/linux/skbuff.h
@@ -1,6 +1,6 @@
/*-
- * Copyright (c) 2020-2022 The FreeBSD Foundation
- * Copyright (c) 2021-2022 Bjoern A. Zeeb
+ * Copyright (c) 2020-2023 The FreeBSD Foundation
+ * Copyright (c) 2021-2023 Bjoern A. Zeeb
*
* This software was developed by Björn Zeeb under sponsorship from
* the FreeBSD Foundation.
@@ -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();
@@ -1024,6 +1046,30 @@ napi_consume_skb(struct sk_buff *skb, int budget)
SKB_TODO();
}
+static inline struct sk_buff *
+napi_build_skb(void *data, size_t len)
+{
+
+ SKB_TRACE(skb);
+ SKB_TODO();
+ return (NULL);
+}
+
+static inline uint32_t
+skb_get_hash(struct sk_buff *skb)
+{
+ SKB_TRACE(skb);
+ SKB_TODO();
+ return (0);
+}
+
+static inline void
+skb_mark_for_recycle(struct sk_buff *skb)
+{
+ SKB_TRACE(skb);
+ SKB_TODO();
+}
+
#define SKB_WITH_OVERHEAD(_s) \
(_s) - ALIGN(sizeof(struct skb_shared_info), CACHE_LINE_SIZE)