All of lore.kernel.org
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: netdev@vger.kernel.org, nfs@lists.sourceforge.net,
	linux-kernel@vger.kernel.org
Subject: [PATCH 002 of 3] knfsd: Avoid checksum checks when collecting metadata for a UDP packet.
Date: Fri, 2 Mar 2007 15:28:30 +1100	[thread overview]
Message-ID: <1070302042830.5777@suse.de> (raw)
In-Reply-To: 20070302151748.5226.patches@notabene


When recv_msg is called with a size of 0 and MSG_PEEK (and
sunrpc/svcsock.c does), it is clear that we only interested in
metadata (from/to addresses) and not the data, so don't do any
checksum checking at this point.  Leave that until the data is
requested.

Signed-off-by: Neil Brown <neilb@suse.de>

### Diffstat output
 ./net/ipv4/udp.c |    3 +++
 ./net/ipv6/udp.c |    4 ++++
 2 files changed, 7 insertions(+)

diff .prev/net/ipv4/udp.c ./net/ipv4/udp.c
--- .prev/net/ipv4/udp.c	2007-03-02 14:20:13.000000000 +1100
+++ ./net/ipv4/udp.c	2007-03-02 15:13:50.000000000 +1100
@@ -846,6 +846,9 @@ try_again:
 			goto csum_copy_err;
 		copy_only = 1;
 	}
+	if (len == 0 &&  (flags & MSG_PEEK))
+		/* avoid checksum concerns when just getting metadata */
+		copy_only = 1;
 
 	if (copy_only)
 		err = skb_copy_datagram_iovec(skb, sizeof(struct udphdr),

diff .prev/net/ipv6/udp.c ./net/ipv6/udp.c
--- .prev/net/ipv6/udp.c	2007-03-02 14:20:13.000000000 +1100
+++ ./net/ipv6/udp.c	2007-03-02 15:13:50.000000000 +1100
@@ -151,6 +151,10 @@ try_again:
 		copy_only = 1;
 	}
 
+	if (len == 0 &&  (flags & MSG_PEEK))
+		/* avoid checksum concerns when just getting metadata */
+		copy_only = 1;
+
 	if (copy_only)
 		err = skb_copy_datagram_iovec(skb, sizeof(struct udphdr),
 					      msg->msg_iov, copied       );

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NFS maillist  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

WARNING: multiple messages have this Message-ID (diff)
From: NeilBrown <neilb@suse.de>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: nfs@lists.sourceforge.net, linux-kernel@vger.kernel.org
Cc: netdev@vger.kernel.org
Subject: [PATCH 002 of 3] knfsd: Avoid checksum checks when collecting metadata for a UDP packet.
Date: Fri, 2 Mar 2007 15:28:30 +1100	[thread overview]
Message-ID: <1070302042830.5777@suse.de> (raw)
In-Reply-To: 20070302151748.5226.patches@notabene


When recv_msg is called with a size of 0 and MSG_PEEK (and
sunrpc/svcsock.c does), it is clear that we only interested in
metadata (from/to addresses) and not the data, so don't do any
checksum checking at this point.  Leave that until the data is
requested.

Signed-off-by: Neil Brown <neilb@suse.de>

### Diffstat output
 ./net/ipv4/udp.c |    3 +++
 ./net/ipv6/udp.c |    4 ++++
 2 files changed, 7 insertions(+)

diff .prev/net/ipv4/udp.c ./net/ipv4/udp.c
--- .prev/net/ipv4/udp.c	2007-03-02 14:20:13.000000000 +1100
+++ ./net/ipv4/udp.c	2007-03-02 15:13:50.000000000 +1100
@@ -846,6 +846,9 @@ try_again:
 			goto csum_copy_err;
 		copy_only = 1;
 	}
+	if (len == 0 &&  (flags & MSG_PEEK))
+		/* avoid checksum concerns when just getting metadata */
+		copy_only = 1;
 
 	if (copy_only)
 		err = skb_copy_datagram_iovec(skb, sizeof(struct udphdr),

diff .prev/net/ipv6/udp.c ./net/ipv6/udp.c
--- .prev/net/ipv6/udp.c	2007-03-02 14:20:13.000000000 +1100
+++ ./net/ipv6/udp.c	2007-03-02 15:13:50.000000000 +1100
@@ -151,6 +151,10 @@ try_again:
 		copy_only = 1;
 	}
 
+	if (len == 0 &&  (flags & MSG_PEEK))
+		/* avoid checksum concerns when just getting metadata */
+		copy_only = 1;
+
 	if (copy_only)
 		err = skb_copy_datagram_iovec(skb, sizeof(struct udphdr),
 					      msg->msg_iov, copied       );

  parent reply	other threads:[~2007-03-02  4:29 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-02  4:28 [PATCH 000 of 3] knfsd: Resolve IPv6 related link error NeilBrown
2007-03-02  4:28 ` [PATCH 001 of 3] knfsd: Use recv_msg to get peer address for NFSD instead of code-copying NeilBrown
2007-03-02  4:28   ` NeilBrown
2007-03-05 18:53   ` Olaf Kirch
2007-03-05 18:53     ` [NFS] " Olaf Kirch
2007-03-05 23:47     ` Neil Brown
2007-03-05 18:59   ` Olaf Kirch
2007-03-05 21:09     ` Neil Brown
2007-03-05 21:09       ` [NFS] " Neil Brown
2007-03-02  4:28 ` NeilBrown [this message]
2007-03-02  4:28   ` [PATCH 002 of 3] knfsd: Avoid checksum checks when collecting metadata for a UDP packet NeilBrown
2007-03-02  4:28 ` [PATCH 003 of 3] knfsd: Remove CONFIG_IPV6 ifdefs from sunrpc server code NeilBrown
2007-03-02  4:28   ` NeilBrown

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=1070302042830.5777@suse.de \
    --to=neilb@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nfs@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.