Skip to contentSkip to conversation

net: dump more useful information in netdev_rx_csum_fault()

PATCH Superseded Cong Wang 3 participants 8 messages Nov 10, 2018 – Nov 13, 2018

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Cong Wang

author
#0 lore raw

PATCH 1/1 net: dump more useful information in netdev_rx_csum_fault()

Currently netdev_rx_csum_fault() only shows a device name, we need more information about the skb for debugging.

Sample output:

ens3: hw csum failure
dev features: 0x0000000000014b89
skb len=84 data_len=0 gso_size=0 gso_type=0 ip_summed=0 csum=0, csum_complete_sw=0, csum_valid=0

---
 include/linux/netdevice.h |  5 +++--
 net/core/datagram.c       |  6 +++---
 net/core/dev.c            | 10 ++++++++--
 net/sunrpc/socklib.c      |  2 +-
 4 files changed, 15 insertions(+), 8 deletions(-)
include/linux/netdevice.h +3 -2
index 857f8abf7b91..fabcd9fa6cf7 100644
@@ -4332,9 +4332,10 @@ static inline bool can_checksum_protocol(netdev_features_t features,
 }
 
 #ifdef CONFIG_BUG
-void netdev_rx_csum_fault(struct net_device *dev);
+void netdev_rx_csum_fault(struct net_device *dev, struct sk_buff *skb);
 #else
-static inline void netdev_rx_csum_fault(struct net_device *dev)
+static inline void netdev_rx_csum_fault(struct net_device *dev,
+					struct sk_buff *skb)
 {
 }
 #endif
net/core/datagram.c +3 -3
index 57f3a6fcfc1e..d8f4d55cd6c5 100644
@@ -736,7 +736,7 @@ __sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len)
 	if (likely(!sum)) {
 		if (unlikely(skb->ip_summed == CHECKSUM_COMPLETE) &&
 		    !skb->csum_complete_sw)
-			netdev_rx_csum_fault(skb->dev);
+			netdev_rx_csum_fault(skb->dev, skb);
 	}
 	if (!skb_shared(skb))
 		skb->csum_valid = !sum;
@@ -756,7 +756,7 @@ __sum16 __skb_checksum_complete(struct sk_buff *skb)
 	if (likely(!sum)) {
 		if (unlikely(skb->ip_summed == CHECKSUM_COMPLETE) &&
 		    !skb->csum_complete_sw)
-			netdev_rx_csum_fault(skb->dev);
+			netdev_rx_csum_fault(skb->dev, skb);
 	}
 
 	if (!skb_shared(skb)) {
@@ -810,7 +810,7 @@ int skb_copy_and_csum_datagram_msg(struct sk_buff *skb,
 
 		if (unlikely(skb->ip_summed == CHECKSUM_COMPLETE) &&
 		    !skb->csum_complete_sw)
-			netdev_rx_csum_fault(NULL);
+			netdev_rx_csum_fault(NULL, skb);
 	}
 	return 0;
 fault:
net/core/dev.c +8 -2
index 0ffcbdd55fa9..2b337df26117 100644
@@ -3091,10 +3091,16 @@ EXPORT_SYMBOL(__skb_gso_segment);
 
 /* Take action when hardware reception checksum errors are detected. */
 #ifdef CONFIG_BUG
-void netdev_rx_csum_fault(struct net_device *dev)
+void netdev_rx_csum_fault(struct net_device *dev, struct sk_buff *skb)
 {
 	if (net_ratelimit()) {
 		pr_err("%s: hw csum failure\n", dev ? dev->name : "<unknown>");
+		if (dev)
+			pr_err("dev features: %pNF\n", &dev->features);
+		pr_err("skb len=%d data_len=%d gso_size=%d gso_type=%d ip_summed=%d csum=%x, csum_complete_sw=%d, csum_valid=%d\n",
+		       skb->len, skb->data_len, skb_shinfo(skb)->gso_size,
+		       skb_shinfo(skb)->gso_type, skb->ip_summed, skb->csum,
+		       skb->csum_complete_sw, skb->csum_valid);
 		dump_stack();
 	}
 }
@@ -5779,7 +5785,7 @@ __sum16 __skb_gro_checksum_complete(struct sk_buff *skb)
 	if (likely(!sum)) {
 		if (unlikely(skb->ip_summed == CHECKSUM_COMPLETE) &&
 		    !skb->csum_complete_sw)
-			netdev_rx_csum_fault(skb->dev);
+			netdev_rx_csum_fault(skb->dev, skb);
 	}
 
 	NAPI_GRO_CB(skb)->csum = wsum;
net/sunrpc/socklib.c +1 -1
index 9062967575c4..7e55cfc69697 100644
@@ -175,7 +175,7 @@ int csum_partial_copy_to_xdr(struct xdr_buf *xdr, struct sk_buff *skb)
 		return -1;
 	if (unlikely(skb->ip_summed == CHECKSUM_COMPLETE) &&
 	    !skb->csum_complete_sw)
-		netdev_rx_csum_fault(skb->dev);
+		netdev_rx_csum_fault(skb->dev, skb);
 	return 0;
 no_checksum:
 	if (xdr_partial_copy_from_skb(xdr, 0, &desc, xdr_skb_read_bits) < 0)
Signature · 1 line
2.19.1
#1 lore raw
Quoted 74 lines · Cong Wang

Currently netdev_rx_csum_fault() only shows a device name, we need more information about the skb for debugging.

Sample output:

ens3: hw csum failure
dev features: 0x0000000000014b89
skb len=84 data_len=0 gso_size=0 gso_type=0 ip_summed=0 csum=0, csum_complete_sw=0, csum_valid=0

---
 include/linux/netdevice.h |  5 +++--
 net/core/datagram.c       |  6 +++---
 net/core/dev.c            | 10 ++++++++--
 net/sunrpc/socklib.c      |  2 +-
 4 files changed, 15 insertions(+), 8 deletions(-)
include/linux/netdevice.h +3 -2
index 857f8abf7b91..fabcd9fa6cf7 100644
@@ -4332,9 +4332,10 @@ static inline bool can_checksum_protocol(netdev_features_t features,
 }
 
 #ifdef CONFIG_BUG
-void netdev_rx_csum_fault(struct net_device *dev);
+void netdev_rx_csum_fault(struct net_device *dev, struct sk_buff *skb);
 #else
-static inline void netdev_rx_csum_fault(struct net_device *dev)
+static inline void netdev_rx_csum_fault(struct net_device *dev,
+					struct sk_buff *skb)
 {
 }
 #endif
net/core/datagram.c +3 -3
index 57f3a6fcfc1e..d8f4d55cd6c5 100644
@@ -736,7 +736,7 @@ __sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len)
 	if (likely(!sum)) {
 		if (unlikely(skb->ip_summed == CHECKSUM_COMPLETE) &&
 		    !skb->csum_complete_sw)
-			netdev_rx_csum_fault(skb->dev);
+			netdev_rx_csum_fault(skb->dev, skb);
 	}
 	if (!skb_shared(skb))
 		skb->csum_valid = !sum;
@@ -756,7 +756,7 @@ __sum16 __skb_checksum_complete(struct sk_buff *skb)
 	if (likely(!sum)) {
 		if (unlikely(skb->ip_summed == CHECKSUM_COMPLETE) &&
 		    !skb->csum_complete_sw)
-			netdev_rx_csum_fault(skb->dev);
+			netdev_rx_csum_fault(skb->dev, skb);
 	}
 
 	if (!skb_shared(skb)) {
@@ -810,7 +810,7 @@ int skb_copy_and_csum_datagram_msg(struct sk_buff *skb,
 
 		if (unlikely(skb->ip_summed == CHECKSUM_COMPLETE) &&
 		    !skb->csum_complete_sw)
-			netdev_rx_csum_fault(NULL);
+			netdev_rx_csum_fault(NULL, skb);
 	}
 	return 0;
 fault:
net/core/dev.c +0 -1
index 0ffcbdd55fa9..2b337df26117 100644
@@ -3091,10 +3091,16 @@ EXPORT_SYMBOL(__skb_gso_segment);
 
 /* Take action when hardware reception checksum errors are detected. */
 #ifdef CONFIG_BUG
-void netdev_rx_csum_fault(struct net_device *dev)

net/core/dev.c EXPORT_SYMBOL(__skb_gso_segment); · line 3103

Quoted 10 lines
net/core/dev.c +7 -0
+void netdev_rx_csum_fault(struct net_device *dev, struct sk_buff *skb)
 {
 	if (net_ratelimit()) {
 		pr_err("%s: hw csum failure\n", dev ? dev->name : "<unknown>");
+		if (dev)
+			pr_err("dev features: %pNF\n", &dev->features);
+		pr_err("skb len=%d data_len=%d gso_size=%d gso_type=%d ip_summed=%d csum=%x, csum_complete_sw=%d, csum_valid=%d\n",
+		       skb->len, skb->data_len, skb_shinfo(skb)->gso_size,
+		       skb_shinfo(skb)->gso_type, skb->ip_summed, skb->csum,
+		       skb->csum_complete_sw, skb->csum_valid);

This function also have the netdev available, use netdev_err to log the error?

Also, dev->features was dumped before this patch, why remove it?

Quoted 26 lines
net/core/dev.c +1 -1
 		dump_stack();
 	}
 }
@@ -5779,7 +5785,7 @@ __sum16 __skb_gro_checksum_complete(struct sk_buff *skb)
 	if (likely(!sum)) {
 		if (unlikely(skb->ip_summed == CHECKSUM_COMPLETE) &&
 		    !skb->csum_complete_sw)
-			netdev_rx_csum_fault(skb->dev);
+			netdev_rx_csum_fault(skb->dev, skb);
 	}
 
 	NAPI_GRO_CB(skb)->csum = wsum;
net/sunrpc/socklib.c +1 -1
index 9062967575c4..7e55cfc69697 100644
@@ -175,7 +175,7 @@ int csum_partial_copy_to_xdr(struct xdr_buf *xdr, struct sk_buff *skb)
 		return -1;
 	if (unlikely(skb->ip_summed == CHECKSUM_COMPLETE) &&
 	    !skb->csum_complete_sw)
-		netdev_rx_csum_fault(skb->dev);
+		netdev_rx_csum_fault(skb->dev, skb);
 	return 0;
 no_checksum:
 	if (xdr_partial_copy_from_skb(xdr, 0, &desc, xdr_skb_read_bits) < 0)
author
#2 lore raw
Quoted 73 lines · Yunsheng Lin
Quoted 71 lines · Cong Wang

Currently netdev_rx_csum_fault() only shows a device name, we need more information about the skb for debugging.

Sample output:

ens3: hw csum failure
dev features: 0x0000000000014b89
skb len=84 data_len=0 gso_size=0 gso_type=0 ip_summed=0 csum=0, csum_complete_sw=0, csum_valid=0

---
 include/linux/netdevice.h |  5 +++--
 net/core/datagram.c       |  6 +++---
 net/core/dev.c            | 10 ++++++++--
 net/sunrpc/socklib.c      |  2 +-
 4 files changed, 15 insertions(+), 8 deletions(-)
include/linux/netdevice.h +3 -2
index 857f8abf7b91..fabcd9fa6cf7 100644
@@ -4332,9 +4332,10 @@ static inline bool can_checksum_protocol(netdev_features_t features,
 }
 
 #ifdef CONFIG_BUG
-void netdev_rx_csum_fault(struct net_device *dev);
+void netdev_rx_csum_fault(struct net_device *dev, struct sk_buff *skb);
 #else
-static inline void netdev_rx_csum_fault(struct net_device *dev)
+static inline void netdev_rx_csum_fault(struct net_device *dev,
+                                     struct sk_buff *skb)
 {
 }
 #endif
net/core/datagram.c +3 -3
index 57f3a6fcfc1e..d8f4d55cd6c5 100644
@@ -736,7 +736,7 @@ __sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len)
      if (likely(!sum)) {
              if (unlikely(skb->ip_summed == CHECKSUM_COMPLETE) &&
                  !skb->csum_complete_sw)
-                     netdev_rx_csum_fault(skb->dev);
+                     netdev_rx_csum_fault(skb->dev, skb);
      }
      if (!skb_shared(skb))
              skb->csum_valid = !sum;
@@ -756,7 +756,7 @@ __sum16 __skb_checksum_complete(struct sk_buff *skb)
      if (likely(!sum)) {
              if (unlikely(skb->ip_summed == CHECKSUM_COMPLETE) &&
                  !skb->csum_complete_sw)
-                     netdev_rx_csum_fault(skb->dev);
+                     netdev_rx_csum_fault(skb->dev, skb);
      }
 
      if (!skb_shared(skb)) {
@@ -810,7 +810,7 @@ int skb_copy_and_csum_datagram_msg(struct sk_buff *skb,
 
              if (unlikely(skb->ip_summed == CHECKSUM_COMPLETE) &&
                  !skb->csum_complete_sw)
-                     netdev_rx_csum_fault(NULL);
+                     netdev_rx_csum_fault(NULL, skb);
      }
      return 0;
 fault:
net/core/dev.c +0 -0
index 0ffcbdd55fa9..2b337df26117 100644
@@ -3091,10 +3091,16 @@ EXPORT_SYMBOL(__skb_gso_segment);
 
Quoted 16 lines

net/core/dev.c EXPORT_SYMBOL(__skb_gso_segment); · line 3103

Quoted 13 lines
net/core/dev.c +7 -1
 /* Take action when hardware reception checksum errors are detected. */
 #ifdef CONFIG_BUG
-void netdev_rx_csum_fault(struct net_device *dev)
+void netdev_rx_csum_fault(struct net_device *dev, struct sk_buff *skb)
 {
      if (net_ratelimit()) {
              pr_err("%s: hw csum failure\n", dev ? dev->name : "<unknown>");
+             if (dev)
+                     pr_err("dev features: %pNF\n", &dev->features);
+             pr_err("skb len=%d data_len=%d gso_size=%d gso_type=%d ip_summed=%d csum=%x, csum_complete_sw=%d, csum_valid=%d\n",
+                    skb->len, skb->data_len, skb_shinfo(skb)->gso_size,
+                    skb_shinfo(skb)->gso_type, skb->ip_summed, skb->csum,
+                    skb->csum_complete_sw, skb->csum_valid);

This function also have the netdev available, use netdev_err to log the error?

It is apparently not me who picked pr_err() from the beginning, I just follow that pr_err(). If you are not happy with it, please send a followup.

Quoted 2 lines

Also, dev->features was dumped before this patch, why remove it?

Seriously? Where do I remove it? Please be specific. :)

#3 lore raw
Quoted 91 lines · Cong Wang
Quoted 73 lines · Yunsheng Lin
Quoted 71 lines · Cong Wang

Currently netdev_rx_csum_fault() only shows a device name, we need more information about the skb for debugging.

Sample output:

ens3: hw csum failure
dev features: 0x0000000000014b89
skb len=84 data_len=0 gso_size=0 gso_type=0 ip_summed=0 csum=0, csum_complete_sw=0, csum_valid=0

---
 include/linux/netdevice.h |  5 +++--
 net/core/datagram.c       |  6 +++---
 net/core/dev.c            | 10 ++++++++--
 net/sunrpc/socklib.c      |  2 +-
 4 files changed, 15 insertions(+), 8 deletions(-)
include/linux/netdevice.h +3 -2
index 857f8abf7b91..fabcd9fa6cf7 100644
@@ -4332,9 +4332,10 @@ static inline bool can_checksum_protocol(netdev_features_t features,
 }
 
 #ifdef CONFIG_BUG
-void netdev_rx_csum_fault(struct net_device *dev);
+void netdev_rx_csum_fault(struct net_device *dev, struct sk_buff *skb);
 #else
-static inline void netdev_rx_csum_fault(struct net_device *dev)
+static inline void netdev_rx_csum_fault(struct net_device *dev,
+                                     struct sk_buff *skb)
 {
 }
 #endif
net/core/datagram.c +3 -3
index 57f3a6fcfc1e..d8f4d55cd6c5 100644
@@ -736,7 +736,7 @@ __sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len)
      if (likely(!sum)) {
              if (unlikely(skb->ip_summed == CHECKSUM_COMPLETE) &&
                  !skb->csum_complete_sw)
-                     netdev_rx_csum_fault(skb->dev);
+                     netdev_rx_csum_fault(skb->dev, skb);
      }
      if (!skb_shared(skb))
              skb->csum_valid = !sum;
@@ -756,7 +756,7 @@ __sum16 __skb_checksum_complete(struct sk_buff *skb)
      if (likely(!sum)) {
              if (unlikely(skb->ip_summed == CHECKSUM_COMPLETE) &&
                  !skb->csum_complete_sw)
-                     netdev_rx_csum_fault(skb->dev);
+                     netdev_rx_csum_fault(skb->dev, skb);
      }
 
      if (!skb_shared(skb)) {
@@ -810,7 +810,7 @@ int skb_copy_and_csum_datagram_msg(struct sk_buff *skb,
 
              if (unlikely(skb->ip_summed == CHECKSUM_COMPLETE) &&
                  !skb->csum_complete_sw)
-                     netdev_rx_csum_fault(NULL);
+                     netdev_rx_csum_fault(NULL, skb);
      }
      return 0;
 fault:
net/core/dev.c +0 -0
index 0ffcbdd55fa9..2b337df26117 100644
@@ -3091,10 +3091,16 @@ EXPORT_SYMBOL(__skb_gso_segment);
 
Quoted 16 lines

net/core/dev.c EXPORT_SYMBOL(__skb_gso_segment); · line 3103

Quoted 13 lines
net/core/dev.c +7 -1
 /* Take action when hardware reception checksum errors are detected. */
 #ifdef CONFIG_BUG
-void netdev_rx_csum_fault(struct net_device *dev)
+void netdev_rx_csum_fault(struct net_device *dev, struct sk_buff *skb)
 {
      if (net_ratelimit()) {
              pr_err("%s: hw csum failure\n", dev ? dev->name : "<unknown>");
+             if (dev)
+                     pr_err("dev features: %pNF\n", &dev->features);
+             pr_err("skb len=%d data_len=%d gso_size=%d gso_type=%d ip_summed=%d csum=%x, csum_complete_sw=%d, csum_valid=%d\n",
+                    skb->len, skb->data_len, skb_shinfo(skb)->gso_size,
+                    skb_shinfo(skb)->gso_type, skb->ip_summed, skb->csum,
+                    skb->csum_complete_sw, skb->csum_valid);

This function also have the netdev available, use netdev_err to log the error?

Quoted 3 lines

It is apparently not me who picked pr_err() from the beginning, I just follow that pr_err(). If you are not happy with it, please send a followup.

Yes, but perhaps it is something to improve.
When using the netdev, then maybe it does not have to check if dev is null, because netdev_err has handled the netdev being NULL case.
Maybe I missed something that netdev can not be used here?
If not, maybe I can send a followup.

Quoted 6 lines
Quoted 4 lines

Also, dev->features was dumped before this patch, why remove it?

Seriously? Where do I remove it? Please be specific. :)

Sorry, I missed that, I thought it was removed when adding the new log.

Quoted 3 lines

.

author
#4 lore raw
Quoted 93 lines · Yunsheng Lin
Quoted 91 lines · Cong Wang
Quoted 89 lines · Yunsheng Lin
Quoted 74 lines · Cong Wang

Currently netdev_rx_csum_fault() only shows a device name, we need more information about the skb for debugging.

Sample output:

ens3: hw csum failure
dev features: 0x0000000000014b89
skb len=84 data_len=0 gso_size=0 gso_type=0 ip_summed=0 csum=0, csum_complete_sw=0, csum_valid=0

---
 include/linux/netdevice.h |  5 +++--
 net/core/datagram.c       |  6 +++---
 net/core/dev.c            | 10 ++++++++--
 net/sunrpc/socklib.c      |  2 +-
 4 files changed, 15 insertions(+), 8 deletions(-)
include/linux/netdevice.h +3 -2
index 857f8abf7b91..fabcd9fa6cf7 100644
@@ -4332,9 +4332,10 @@ static inline bool can_checksum_protocol(netdev_features_t features,
 }
 
 #ifdef CONFIG_BUG
-void netdev_rx_csum_fault(struct net_device *dev);
+void netdev_rx_csum_fault(struct net_device *dev, struct sk_buff *skb);
 #else
-static inline void netdev_rx_csum_fault(struct net_device *dev)
+static inline void netdev_rx_csum_fault(struct net_device *dev,
+                                     struct sk_buff *skb)
 {
 }
 #endif
net/core/datagram.c +3 -3
index 57f3a6fcfc1e..d8f4d55cd6c5 100644
@@ -736,7 +736,7 @@ __sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len)
      if (likely(!sum)) {
              if (unlikely(skb->ip_summed == CHECKSUM_COMPLETE) &&
                  !skb->csum_complete_sw)
-                     netdev_rx_csum_fault(skb->dev);
+                     netdev_rx_csum_fault(skb->dev, skb);
      }
      if (!skb_shared(skb))
              skb->csum_valid = !sum;
@@ -756,7 +756,7 @@ __sum16 __skb_checksum_complete(struct sk_buff *skb)
      if (likely(!sum)) {
              if (unlikely(skb->ip_summed == CHECKSUM_COMPLETE) &&
                  !skb->csum_complete_sw)
-                     netdev_rx_csum_fault(skb->dev);
+                     netdev_rx_csum_fault(skb->dev, skb);
      }
 
      if (!skb_shared(skb)) {
@@ -810,7 +810,7 @@ int skb_copy_and_csum_datagram_msg(struct sk_buff *skb,
 
              if (unlikely(skb->ip_summed == CHECKSUM_COMPLETE) &&
                  !skb->csum_complete_sw)
-                     netdev_rx_csum_fault(NULL);
+                     netdev_rx_csum_fault(NULL, skb);
      }
      return 0;
 fault:
net/core/dev.c +0 -1
index 0ffcbdd55fa9..2b337df26117 100644
@@ -3091,10 +3091,16 @@ EXPORT_SYMBOL(__skb_gso_segment);
 
 /* Take action when hardware reception checksum errors are detected. */
 #ifdef CONFIG_BUG
-void netdev_rx_csum_fault(struct net_device *dev)

net/core/dev.c EXPORT_SYMBOL(__skb_gso_segment); · line 3103

Quoted 10 lines
net/core/dev.c +7 -0
+void netdev_rx_csum_fault(struct net_device *dev, struct sk_buff *skb)
 {
      if (net_ratelimit()) {
              pr_err("%s: hw csum failure\n", dev ? dev->name : "<unknown>");
+             if (dev)
+                     pr_err("dev features: %pNF\n", &dev->features);
+             pr_err("skb len=%d data_len=%d gso_size=%d gso_type=%d ip_summed=%d csum=%x, csum_complete_sw=%d, csum_valid=%d\n",
+                    skb->len, skb->data_len, skb_shinfo(skb)->gso_size,
+                    skb_shinfo(skb)->gso_type, skb->ip_summed, skb->csum,
+                    skb->csum_complete_sw, skb->csum_valid);

This function also have the netdev available, use netdev_err to log the error?

Quoted 5 lines
Quoted 3 lines

It is apparently not me who picked pr_err() from the beginning, I just follow that pr_err(). If you are not happy with it, please send a followup.

Yes, but perhaps it is something to improve.

Sure, no one stops you from improving it in a followup patch. :)

Quoted 5 lines

When using the netdev, then maybe it does not have to check if dev is null, because netdev_err has handled the netdev being NULL case.
Maybe I missed something that netdev can not be used here?
If not, maybe I can send a followup.

Maybe. Again, my patch intends to add a few debugging logs, not to convert pr_err() to whatever else, they are totally different goals. I choose pr_err() only because I follow the existing one, not to say which one is better than the other.

Thanks.

#5 lore raw
Quoted 110 lines · Cong Wang
Quoted 93 lines · Yunsheng Lin
Quoted 91 lines · Cong Wang
Quoted 89 lines · Yunsheng Lin
Quoted 74 lines · Cong Wang

Currently netdev_rx_csum_fault() only shows a device name, we need more information about the skb for debugging.

Sample output:

ens3: hw csum failure
dev features: 0x0000000000014b89
skb len=84 data_len=0 gso_size=0 gso_type=0 ip_summed=0 csum=0, csum_complete_sw=0, csum_valid=0

---
 include/linux/netdevice.h |  5 +++--
 net/core/datagram.c       |  6 +++---
 net/core/dev.c            | 10 ++++++++--
 net/sunrpc/socklib.c      |  2 +-
 4 files changed, 15 insertions(+), 8 deletions(-)
include/linux/netdevice.h +3 -2
index 857f8abf7b91..fabcd9fa6cf7 100644
@@ -4332,9 +4332,10 @@ static inline bool can_checksum_protocol(netdev_features_t features,
 }
 
 #ifdef CONFIG_BUG
-void netdev_rx_csum_fault(struct net_device *dev);
+void netdev_rx_csum_fault(struct net_device *dev, struct sk_buff *skb);
 #else
-static inline void netdev_rx_csum_fault(struct net_device *dev)
+static inline void netdev_rx_csum_fault(struct net_device *dev,
+                                     struct sk_buff *skb)
 {
 }
 #endif
net/core/datagram.c +3 -3
index 57f3a6fcfc1e..d8f4d55cd6c5 100644
@@ -736,7 +736,7 @@ __sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len)
      if (likely(!sum)) {
              if (unlikely(skb->ip_summed == CHECKSUM_COMPLETE) &&
                  !skb->csum_complete_sw)
-                     netdev_rx_csum_fault(skb->dev);
+                     netdev_rx_csum_fault(skb->dev, skb);
      }
      if (!skb_shared(skb))
              skb->csum_valid = !sum;
@@ -756,7 +756,7 @@ __sum16 __skb_checksum_complete(struct sk_buff *skb)
      if (likely(!sum)) {
              if (unlikely(skb->ip_summed == CHECKSUM_COMPLETE) &&
                  !skb->csum_complete_sw)
-                     netdev_rx_csum_fault(skb->dev);
+                     netdev_rx_csum_fault(skb->dev, skb);
      }
 
      if (!skb_shared(skb)) {
@@ -810,7 +810,7 @@ int skb_copy_and_csum_datagram_msg(struct sk_buff *skb,
 
              if (unlikely(skb->ip_summed == CHECKSUM_COMPLETE) &&
                  !skb->csum_complete_sw)
-                     netdev_rx_csum_fault(NULL);
+                     netdev_rx_csum_fault(NULL, skb);
      }
      return 0;
 fault:
net/core/dev.c +0 -1
index 0ffcbdd55fa9..2b337df26117 100644
@@ -3091,10 +3091,16 @@ EXPORT_SYMBOL(__skb_gso_segment);
 
 /* Take action when hardware reception checksum errors are detected. */
 #ifdef CONFIG_BUG
-void netdev_rx_csum_fault(struct net_device *dev)

net/core/dev.c EXPORT_SYMBOL(__skb_gso_segment); · line 3103

Quoted 10 lines
net/core/dev.c +7 -0
+void netdev_rx_csum_fault(struct net_device *dev, struct sk_buff *skb)
 {
      if (net_ratelimit()) {
              pr_err("%s: hw csum failure\n", dev ? dev->name : "<unknown>");
+             if (dev)
+                     pr_err("dev features: %pNF\n", &dev->features);
+             pr_err("skb len=%d data_len=%d gso_size=%d gso_type=%d ip_summed=%d csum=%x, csum_complete_sw=%d, csum_valid=%d\n",
+                    skb->len, skb->data_len, skb_shinfo(skb)->gso_size,
+                    skb_shinfo(skb)->gso_type, skb->ip_summed, skb->csum,
+                    skb->csum_complete_sw, skb->csum_valid);

This function also have the netdev available, use netdev_err to log the error?

Quoted 5 lines
Quoted 3 lines

It is apparently not me who picked pr_err() from the beginning, I just follow that pr_err(). If you are not happy with it, please send a followup.

Yes, but perhaps it is something to improve.

Sure, no one stops you from improving it in a followup patch. :)

Quoted 5 lines

When using the netdev, then maybe it does not have to check if dev is null, because netdev_err has handled the netdev being NULL case.
Maybe I missed something that netdev can not be used here?
If not, maybe I can send a followup.

Quoted 4 lines

Maybe. Again, my patch intends to add a few debugging logs, not to convert pr_err() to whatever else, they are totally different goals. I choose pr_err() only because I follow the existing one, not to say which one is better than the other.

Ok. :)

Quoted 5 lines

Thanks.

.

maintainer
#6 lore raw
In reply to Cong Wang

From: Cong Wang <[email protected]>
Date: Fri, 9 Nov 2018 11:43:33 -0800

net/core/datagram.c __sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len) · line 742

Quoted 13 lines
net/core/datagram.c +1 -1
index 57f3a6fcfc1e..d8f4d55cd6c5 100644
@@ -736,7 +736,7 @@ __sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len)
 	if (likely(!sum)) {
 		if (unlikely(skb->ip_summed == CHECKSUM_COMPLETE) &&
 		    !skb->csum_complete_sw)
-			netdev_rx_csum_fault(skb->dev);
+			netdev_rx_csum_fault(skb->dev, skb);
 	}
 	if (!skb_shared(skb))
 		skb->csum_valid = !sum;

Didn't you move this function into net/core/skbuff.c? :-)

Please respin.

author
#7 lore raw
Quoted 2 lines · David Miller

Didn't you move this function into net/core/skbuff.c? :-)

At the time when I created this patch, that patch didn't hit net-next yet. :)

Quoted 2 lines

Please respin.

Sure. I will send v2, as I need to cleanup the mixed commas and spaces too.

Thanks.