netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vladislav Yasevich <vyasevich@gmail.com>
To: netdev@vger.kernel.org
Cc: linux-sctp@vger.kernel.org,
	virtualization@lists.linux-foundation.org,
	virtio-dev@lists.oasis-open.org, mst@redhat.com,
	jasowang@redhat.com, nhorman@tuxdriver.com,
	marcelo.leitner@gmail.com,
	Vladislav Yasevich <vyasevic@redhat.com>
Subject: [PATCH V2 net-next 2/6] sctp: Handle sctp packets with CHECKSUM_PARTIAL
Date: Tue,  1 May 2018 22:07:35 -0400	[thread overview]
Message-ID: <20180502020739.19239-3-vyasevic@redhat.com> (raw)
In-Reply-To: <20180502020739.19239-1-vyasevic@redhat.com>

With SCTP checksum offload available in virtio, it is now
possible for virtio to receive a sctp packet with CHECKSUM_PARTIAL
set (guest-to-guest traffic).  SCTP doesn't really have a
partial checksum like TCP does, because CRC32c can't do partial
additive checksumming.  It's all or nothing.  So an SCTP packet
with CHECKSUM_PARTIAL will have checksum set to 0.  Let SCTP
treat this as a valid checksum if CHECKSUM_PARTIAL is set.

Signed-off-by: Vladislav Yasevich <vyasevic@redhat.com>
---
 net/sctp/input.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/net/sctp/input.c b/net/sctp/input.c
index ba8a6e6..055b8ffa 100644
--- a/net/sctp/input.c
+++ b/net/sctp/input.c
@@ -80,8 +80,17 @@ static inline int sctp_rcv_checksum(struct net *net, struct sk_buff *skb)
 {
 	struct sctphdr *sh = sctp_hdr(skb);
 	__le32 cmp = sh->checksum;
-	__le32 val = sctp_compute_cksum(skb, 0);
+	__le32 val = 0;
 
+	/* In sctp PARTIAL checksum is always 0.  This is a case of
+	 * a packet received from guest that supports checksum offload.
+	 * Assume it's correct as there is really no way to verify,
+	 * and we want to avaoid computing it unnecesarily.
+	 */
+	if (skb->ip_summed == CHECKSUM_PARTIAL)
+		return 0;
+
+	val = sctp_compute_cksum(skb, 0);
 	if (val != cmp) {
 		/* CRC failure, dump it. */
 		__SCTP_INC_STATS(net, SCTP_MIB_CHECKSUMERRORS);
-- 
2.9.5

  parent reply	other threads:[~2018-05-02  2:07 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-02  2:07 [PATCH V2 net-next 0/6] virtio-net: Add SCTP checksum offload support Vladislav Yasevich
2018-05-02  2:07 ` [PATCH V2 net-next 1/6] virtio: Add support for SCTP checksum offloading Vladislav Yasevich
2018-05-02  3:16   ` Michael S. Tsirkin
2018-05-02 14:14     ` Marcelo Ricardo Leitner
2018-05-02 14:21       ` Michael S. Tsirkin
2018-05-02 14:34         ` Marcelo Ricardo Leitner
2018-05-02  2:07 ` Vladislav Yasevich [this message]
2018-05-02 14:38   ` [PATCH V2 net-next 2/6] sctp: Handle sctp packets with CHECKSUM_PARTIAL Marcelo Ricardo Leitner
2018-08-20 14:54     ` Marcelo Ricardo Leitner
2018-08-20 15:39       ` David Laight
2018-05-02  2:07 ` [PATCH V2 net-next 3/6] sctp: Build sctp offload support into the base kernel Vladislav Yasevich
2018-05-02  2:07 ` [PATCH V2 net-next 4/6] tun: Add support for SCTP checksum offload Vladislav Yasevich
2018-05-02 14:53   ` Marcelo Ricardo Leitner
2018-05-02 14:56     ` Marcelo Ricardo Leitner
2018-05-02 17:17       ` Vlad Yasevich
2018-05-02  2:07 ` [PATCH V2 net-next 5/6] macvlan/macvtap: " Vladislav Yasevich
2018-05-02  3:24   ` Michael S. Tsirkin
2018-05-02 13:27     ` Vlad Yasevich
2018-05-02 13:46       ` Michael S. Tsirkin
2018-05-02 14:00         ` Vlad Yasevich
2018-05-02 14:17           ` Michael S. Tsirkin
2018-05-02 14:25             ` Vlad Yasevich
2018-05-02  2:07 ` [PATCH V2 net-next 6/6] ipvlan: " Vladislav Yasevich
2018-05-02  8:12   ` Davide Caratti
2018-05-02 21:57 ` [PATCH V2 net-next 0/6] virtio-net: Add SCTP checksum offload support Marcelo Ricardo Leitner

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=20180502020739.19239-3-vyasevic@redhat.com \
    --to=vyasevich@gmail.com \
    --cc=jasowang@redhat.com \
    --cc=linux-sctp@vger.kernel.org \
    --cc=marcelo.leitner@gmail.com \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@tuxdriver.com \
    --cc=virtio-dev@lists.oasis-open.org \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=vyasevic@redhat.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).