git: e75ba4c620ff - stable/13 - LinuxKPI: SKB: implement skb_peek()

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Wed, 18 Jan 2023 16:24:48 UTC
The branch stable/13 has been updated by bz:

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

commit e75ba4c620ff9169c29a89274810cb2c332efecc
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2022-11-28 18:47:08 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2023-01-18 13:24:11 +0000

    LinuxKPI: SKB: implement skb_peek()
    
    Sponsored by:   The FreeBSD Foundation
    
    (cherry picked from commit ce9f36610ea9ff29d42a2bcfed44b020c2e56dcb)
---
 sys/compat/linuxkpi/common/include/linux/skbuff.h | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/sys/compat/linuxkpi/common/include/linux/skbuff.h b/sys/compat/linuxkpi/common/include/linux/skbuff.h
index b54f5a91769f..35d5a1fd9b80 100644
--- a/sys/compat/linuxkpi/common/include/linux/skbuff.h
+++ b/sys/compat/linuxkpi/common/include/linux/skbuff.h
@@ -571,6 +571,18 @@ skb_queue_tail(struct sk_buff_head *q, struct sk_buff *skb)
 	return (__skb_queue_tail(q, skb));
 }
 
+static inline struct sk_buff *
+skb_peek(struct sk_buff_head *q)
+{
+	struct sk_buff *skb;
+
+	skb = q->next;
+	SKB_TRACE2(q, skb);
+	if (skb == (struct sk_buff *)q)
+		return (NULL);
+	return (skb);
+}
+
 static inline struct sk_buff *
 skb_peek_tail(struct sk_buff_head *q)
 {
@@ -930,14 +942,6 @@ skb_reset_mac_header(struct sk_buff *skb)
 	SKB_TODO();
 }
 
-static inline struct sk_buff *
-skb_peek(struct sk_buff_head *q)
-{
-	SKB_TRACE(q);
-	SKB_TODO();
-	return (NULL);
-}
-
 static inline __sum16
 csum_unfold(__sum16 sum)
 {