netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* SCTP over GRE (w csum)
@ 2019-12-23 17:45 Lorenzo Bianconi
  2019-12-23 17:49 ` Marcelo Ricardo Leitner
  0 siblings, 1 reply; 2+ messages in thread
From: Lorenzo Bianconi @ 2019-12-23 17:45 UTC (permalink / raw)
  To: netdev; +Cc: dcaratti, lucien.xin, marcelo.leitner

[-- Attachment #1: Type: text/plain, Size: 1055 bytes --]

Hi all,

I am currently working on the following scenario:

sctp --> ipv4 --> gretap --> ipv6 --> eth

If NETIF_F_SCTP_CRC is not supported by the network device (it is the
case for gre), sctp will fallback computing the crc32 in sw with
sctp_gso_make_checksum(), where SKB_GSO_CB(skb)->csum is set to ~0 by
gso_reset_checksum(). After the gso segmentation, gre_gso_segment()
will try to compute gre csum with gso_make_checksum() even if skb->ip_summed
is set to CHECKSUM_NONE (and so using ~0 as partial).
One possible (trivial and not tested) solution would be to recompute the
gre checksum, doing in gre_gso_segment() something like:

	if (skb->ip_summed == CHECKSUM_NONE) {
		...
		err = skb_checksum_help(skb);
		if (err < 0)
			return return ERR_PTR(err);
	} else {
		*pcsum = gso_make_checksum(skb, 0);
	}

One possible improvement would be offload the GRE checksum computation if the
hw exports this capability in netdev_features and fall back to the sw
implementation if not.
Am I missing something? Is there a better approach?

Regards,
Lorenzo

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: SCTP over GRE (w csum)
  2019-12-23 17:45 SCTP over GRE (w csum) Lorenzo Bianconi
@ 2019-12-23 17:49 ` Marcelo Ricardo Leitner
  0 siblings, 0 replies; 2+ messages in thread
From: Marcelo Ricardo Leitner @ 2019-12-23 17:49 UTC (permalink / raw)
  To: Lorenzo Bianconi; +Cc: netdev, dcaratti, lucien.xin, linux-sctp

[ Just Cc-ing linux-sctp@ ]

On Mon, Dec 23, 2019 at 06:45:35PM +0100, Lorenzo Bianconi wrote:
> Hi all,
> 
> I am currently working on the following scenario:
> 
> sctp --> ipv4 --> gretap --> ipv6 --> eth
> 
> If NETIF_F_SCTP_CRC is not supported by the network device (it is the
> case for gre), sctp will fallback computing the crc32 in sw with
> sctp_gso_make_checksum(), where SKB_GSO_CB(skb)->csum is set to ~0 by
> gso_reset_checksum(). After the gso segmentation, gre_gso_segment()
> will try to compute gre csum with gso_make_checksum() even if skb->ip_summed
> is set to CHECKSUM_NONE (and so using ~0 as partial).
> One possible (trivial and not tested) solution would be to recompute the
> gre checksum, doing in gre_gso_segment() something like:
> 
> 	if (skb->ip_summed == CHECKSUM_NONE) {
> 		...
> 		err = skb_checksum_help(skb);
> 		if (err < 0)
> 			return return ERR_PTR(err);
> 	} else {
> 		*pcsum = gso_make_checksum(skb, 0);
> 	}
> 
> One possible improvement would be offload the GRE checksum computation if the
> hw exports this capability in netdev_features and fall back to the sw
> implementation if not.
> Am I missing something? Is there a better approach?
> 
> Regards,
> Lorenzo



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-12-23 17:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-23 17:45 SCTP over GRE (w csum) Lorenzo Bianconi
2019-12-23 17:49 ` Marcelo Ricardo Leitner

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).