git: bfa2e8f84086 - stable/13 - LinuxKPI: skbuff: dev_kfree_skb_irq() and improvements

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Mon, 18 Apr 2022 09:33:49 UTC
The branch stable/13 has been updated by bz:

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

commit bfa2e8f84086071187c975e71024346d50d89654
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2022-04-15 12:25:39 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2022-04-18 09:32:57 +0000

    LinuxKPI: skbuff: dev_kfree_skb_irq() and improvements
    
    While it is currently unclear if we will have to defer work in
    dev_kfree_skb_irq() to call dev_kfree_skb().
    We only have one caller which seems to be fine on FreeBSD by calling
    it directly for now.
    
    While here shortcut skb_put()/skb_put_data() saving us work if there
    are no adjustments to do.
    Also adjust the logging in skb_is_gso() to avoid getting spammed by it.
    
    Sponsored by:   The FreeBSD Foundation
    
    (cherry picked from commit 952643ea452655a8e80d1b5e1cc2cae35cb73870)
---
 sys/compat/linuxkpi/common/include/linux/skbuff.h | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/sys/compat/linuxkpi/common/include/linux/skbuff.h b/sys/compat/linuxkpi/common/include/linux/skbuff.h
index 79d65c0169b3..2b1b66844640 100644
--- a/sys/compat/linuxkpi/common/include/linux/skbuff.h
+++ b/sys/compat/linuxkpi/common/include/linux/skbuff.h
@@ -231,7 +231,8 @@ static inline void
 dev_kfree_skb_irq(struct sk_buff *skb)
 {
 	SKB_TRACE(skb);
-	SKB_TODO();
+	SKB_IMPROVE("Do we have to defer this?");
+	dev_kfree_skb(skb);
 }
 
 /* -------------------------------------------------------------------------- */
@@ -331,6 +332,8 @@ skb_put(struct sk_buff *skb, size_t len)
 	    skb, skb->tail, len, skb->end, skb->head, skb->data, skb->len));
 
 	s = skb_tail_pointer(skb);
+	if (len == 0)
+		return (s);
 	skb->tail += len;
 	skb->len += len;
 #ifdef SKB_DEBUG
@@ -350,6 +353,8 @@ skb_put_data(struct sk_buff *skb, const void *buf, size_t len)
 
 	SKB_TRACE2(skb, buf);
 	s = skb_put(skb, len);
+	if (len == 0)
+		return (s);
 	memcpy(s, buf, len);
 	return (s);
 }
@@ -752,7 +757,7 @@ static inline bool
 skb_is_gso(struct sk_buff *skb)
 {
 	SKB_TRACE(skb);
-	SKB_TODO();
+	SKB_IMPROVE("Really a TODO but get it away from logging");
 	return (false);
 }