sctp: Use software checksum under certain
Subsystems (3)
v4 cover sctp: Use software checksum under certain
There are some cards that support SCTP checksum offloading. When using these cards with IPSec or forcing IP fragmentation of SCTP traffic, the checksum is computed incorrectly due to the fact that xfrm and IP/IPv6 fragmentation code do not know that this is SCTP traffic and do not know that checksum has to be computed differently.
To fix this, we let SCTP detect these conditions and perform software checksum calculation.
Fan Du (1):
sctp: Use software crc32 checksum when xfrm transform will happen.
Vlad Yasevich (2):
net: dst: provide accessor function to dst->xfrm
sctp: Perform software checksum if packet has to be fragmented.
include/net/dst.h | 12 ++++++++++++ net/sctp/output.c | 3 ++- 2 files changed, 14 insertions(+), 1 deletion(-)
Signature · 1 line
1.8.3.1
PATCH v4 1/3 net: dst: provide accessor function to dst->xfrm
dst->xfrm is conditionally defined. Provide accessor funtion that is always available.
--- include/net/dst.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)
include/net/dst.h +12 -0
@@ -479,10 +479,22 @@ static inline struct dst_entry *xfrm_lookup(struct net *net, {return dst_orig; } + +static inline struct xfrm_state *dst_xfrm (const struct dst_entry *dst) +{ +return NULL ; +} +#else extern struct dst_entry *xfrm_lookup (struct net *net,struct dst_entry *dst_orig,const struct flowi *fl,struct sock *sk,int flags); + +/* skb attached with this dst needs transformation if dst->xfrm is valid */ +static inline struct xfrm_state *dst_xfrm (const struct dst_entry *dst) +{ +return dst->xfrm; +}#endif #endif /* _NET_DST_H */
Signature · 1 line
1.8.3.1
Re: [PATCH v4 net 1/3] net: dst: provide accessor function to dst->xfrm
Quoted 43 lines · Vlad Yasevich
dst->xfrmis conditionally defined. Provide accessor funtion that is always available.Signed-off-by Vlad Yasevich <[email protected]>--- include/net/dst.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)include/net/dst.h +12
-0@@ -479,10 +479,22 @@ static inline struct dst_entry *xfrm_lookup(struct net *net, {return dst_orig; } + +static inline struct xfrm_state *dst_xfrm (const struct dst_entry *dst) +{ +return NULL ; +} +#else extern struct dst_entry *xfrm_lookup (struct net *net,struct dst_entry *dst_orig,const struct flowi *fl,struct sock *sk,int flags); + +/* skb attached with this dst needs transformation if dst->xfrm is valid */ +static inline struct xfrm_state *dst_xfrm (const struct dst_entry *dst) +{ +return dst->xfrm; +}#endif #endif /* _NET_DST_H */ Signature · 6 lines
1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-sctp" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v4 2/3 sctp: Use software crc32 checksum when xfrm transform will happen.
In reply to Vlad YasevichFrom: Fan Du <[email protected]>
igb/ixgbe have hardware sctp checksum support, when this feature is enabled and also IPsec is armed to protect sctp traffic, ugly things happened as xfrm_output checks CHECKSUM_PARTIAL to do checksum operation(sum every thing up and pack the 16bits result in the checksum field). The result is fail establishment of sctp communication.
--- net/sctp/output.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/sctp/output.c +2 -1
@@ -536,7 +536,8 @@ int sctp_packet_transmit(struct sctp_packet *packet)* by CRC32-C as described in <draft-ietf-tsvwg-sctpcsum-02.txt>. */ if (!sctp_checksum_disable) { -if (!(dst->dev->features &NETIF_F_SCTP_CSUM )) { +if (!(dst->dev->features &NETIF_F_SCTP_CSUM ) || + (dst_xfrm (dst) !=NULL )) {__u32 crc32 =sctp_start_cksum ((__u8 *)sh, cksum_buf_len);/* 3) Put the resultant value into the checksum field in the
Signature · 1 line
1.8.3.1
Re: [PATCH v4 net 2/3] sctp: Use software crc32 checksum when xfrm transform will happen.
Quoted 38 lines · Vlad Yasevich
From: Fan Du <[email protected]>
igb/ixgbe have hardware sctp checksum support, when this feature is enabled and also IPsec is armed to protect sctp traffic, ugly things happened as
xfrm_outputchecksCHECKSUM_PARTIALto do checksum operation(sum every thing up and pack the 16bits result in the checksum field). The result is fail establishment of sctp communication.Cc Neil Horman <[email protected]>Cc Steffen Klassert <[email protected]>Signed-off-by Fan Du <[email protected]>Signed-off-by Vlad Yasevich <[email protected]>--- net/sctp/output.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)net/sctp/output.c +2
-1@@ -536,7 +536,8 @@ int sctp_packet_transmit(struct sctp_packet *packet)* by CRC32-C as described in <draft-ietf-tsvwg-sctpcsum-02.txt>. */ if (!sctp_checksum_disable) { -if (!(dst->dev->features &NETIF_F_SCTP_CSUM )) { +if (!(dst->dev->features &NETIF_F_SCTP_CSUM ) || + (dst_xfrm (dst) !=NULL )) {__u32 crc32 =sctp_start_cksum ((__u8 *)sh, cksum_buf_len);/* 3) Put the resultant value into the checksum field in the Signature · 6 lines
1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-sctp" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v4 3/3 sctp: Perform software checksum if packet has to be fragmented.
In reply to Vlad YasevichIP/IPv6 fragmentation knows how to compute only TCP/UDP checksum. This causes problems if SCTP packets has to be fragmented and ipsummed has been set to PARTIAL due to checksum offload support. This condition can happen when retransmitting after MTU discover, or when INIT or other control chunks are larger then MTU. Check for the rare fragmentation condition in SCTP and use software checksum calculation in this case.
--- net/sctp/output.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sctp/output.c +1 -1
@@ -537,7 +537,7 @@ int sctp_packet_transmit(struct sctp_packet *packet)*/ if (!sctp_checksum_disable) {if (!(dst->dev->features &NETIF_F_SCTP_CSUM ) || - (dst_xfrm (dst) !=NULL )) { + (dst_xfrm (dst) !=NULL ) || packet->ipfragok) {__u32 crc32 =sctp_start_cksum ((__u8 *)sh, cksum_buf_len);/* 3) Put the resultant value into the checksum field in the
Signature · 1 line
1.8.3.1
Re: [PATCH v4 net 3/3] sctp: Perform software checksum if packet has to be fragmented.
Quoted 35 lines · Vlad Yasevich
IP/IPv6 fragmentation knows how to compute only TCP/UDP checksum. This causes problems if SCTP packets has to be fragmented and ipsummed has been set to PARTIAL due to checksum offload support. This condition can happen when retransmitting after MTU discover, or when INIT or other control chunks are larger then MTU. Check for the rare fragmentation condition in SCTP and use software checksum calculation in this case.
CC Fan Du <[email protected]>Signed-off-by Vlad Yasevich <[email protected]>--- net/sctp/output.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)net/sctp/output.c +1
-1@@ -537,7 +537,7 @@ int sctp_packet_transmit(struct sctp_packet *packet)*/ if (!sctp_checksum_disable) {if (!(dst->dev->features &NETIF_F_SCTP_CSUM ) || - (dst_xfrm (dst) !=NULL )) { + (dst_xfrm (dst) !=NULL ) || packet->ipfragok) {__u32 crc32 =sctp_start_cksum ((__u8 *)sh, cksum_buf_len);/* 3) Put the resultant value into the checksum field in the Signature · 6 lines
1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-sctp" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 12 lines · Vlad Yasevich
There are some cards that support SCTP checksum offloading. When using these cards with IPSec or forcing IP fragmentation of SCTP traffic, the checksum is computed incorrectly due to the fact that xfrm and IP/IPv6 fragmentation code do not know that this is SCTP traffic and do not know that checksum has to be computed differently.
To fix this, we let SCTP detect these conditions and perform software checksum calculation.
Fan Du (1):
sctp: Use software crc32 checksum when xfrm transform will happen.
Quoted 8 lines
Vlad Yasevich (2):
net: dst: provide accessor function todst->xfrm
sctp: Perform software checksum if packet has to be fragmented.include/net/dst.h | 12 ++++++++++++ net/sctp/output.c | 3 ++- 2 files changed, 14 insertions(+), 1 deletion(-)
David Miller
maintainerFrom: Vlad Yasevich <[email protected]>
Date: Tue, 15 Oct 2013 22:01:28 -0400
Quoted 8 lines
There are some cards that support SCTP checksum offloading. When using these cards with IPSec or forcing IP fragmentation of SCTP traffic, the checksum is computed incorrectly due to the fact that xfrm and IP/IPv6 fragmentation code do not know that this is SCTP traffic and do not know that checksum has to be computed differently.
To fix this, we let SCTP detect these conditions and perform software checksum calculation.
Series applied, thanks Vlad.
Quoted 9 lines · David Miller
From: Vlad Yasevich <[email protected]>
Date: Tue, 15 Oct 2013 22:01:28 -0400Quoted 6 lines
There are some cards that support SCTP checksum offloading. When using these cards with IPSec or forcing IP fragmentation of SCTP traffic, the checksum is computed incorrectly due to the fact that xfrm and IP/IPv6 fragmentation code do not know that this is SCTP traffic and do not know that checksum has to be computed differently.
Quoted 5 lines
Quoted 2 lines
To fix this, we let SCTP detect these conditions and perform software checksum calculation.
Series applied, thanks Vlad.
Hi David
Could you please queue this to stable as well.
Thanks
-vlad
David Miller
maintainerFrom: Vlad Yasevich <[email protected]>
Date: Thu, 17 Oct 2013 16:21:31 -0400
Quoted 1 line
Could you please queue this to stable as well.
Done.