Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 May 2023 21:27:18 GMT
From:      "Bjoern A. Zeeb" <bz@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 262c5e81937f - main - LinuxKPI: skbuff.h: add skb_hwtstamps(), implement *mac_header()
Message-ID:  <202305162127.34GLRIjv004603@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=262c5e81937ff1682632f33e92c3e42bc92e5a77

commit 262c5e81937ff1682632f33e92c3e42bc92e5a77
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2023-05-16 21:22:34 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2023-05-16 21:26:50 +0000

    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
---
 sys/compat/linuxkpi/common/include/linux/skbuff.h | 34 +++++++++++++++++++----
 1 file 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();



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202305162127.34GLRIjv004603>