From: Koki Sanagi <sanagi.koki@jp•fujitsu.com>
To: netdev@vger•kernel.org
Cc: davem@davemloft•net
Subject: [PATCH] skb: add a comment to skb_csum_unnecessary to avoid miuse
Date: Wed, 23 Jan 2013 09:30:16 +0900 [thread overview]
Message-ID: <50FF2F18.1050408@jp.fujitsu.com> (raw)
Due to its name and appearance, someone thinks this only checks if ip_summed is
CHECKSUM_UNNECESARRY. But actually, this returns true even if ip_summed is
CHECKSUM_PARTIAL. To avoid misuse, this patch a comment which specifies that
CHECKSUM_PARTIAL is OK.
Signed-off-by: Koki Sanagi <sanagi.koki@jp•fujitsu.com>
---
include/linux/skbuff.h | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 8b2256e..bc41f64 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -2522,6 +2522,16 @@ void skb_complete_wifi_ack(struct sk_buff *skb, bool acked);
extern __sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len);
extern __sum16 __skb_checksum_complete(struct sk_buff *skb);
+/**
+ * skb_csum_unnecessary - check if the checksum needs to be verified
+ * @skb: skb to check
+ *
+ * check if the checksum of this skb needs to be verified. This function is
+ * effective only against skbs on inbound path.
+ *
+ * NB: This returns true if ip_summed is CHECKSUM_UNNECESSARY or
+ * CHECKSUM_PARTIAL.
+ **/
static inline int skb_csum_unnecessary(const struct sk_buff *skb)
{
return skb->ip_summed & CHECKSUM_UNNECESSARY;
next reply other threads:[~2013-01-23 0:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-23 0:30 Koki Sanagi [this message]
2013-01-23 1:53 ` [PATCH] skb: add a comment to skb_csum_unnecessary to avoid miuse David Miller
2013-01-23 2:32 ` Sanagi, Koki
2013-01-23 4:13 ` David Miller
2013-01-23 5:11 ` Sanagi, Koki
2013-01-23 5:21 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=50FF2F18.1050408@jp.fujitsu.com \
--to=sanagi.koki@jp$(echo .)fujitsu.com \
--cc=davem@davemloft$(echo .)net \
--cc=netdev@vger$(echo .)kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox