net: support SCTP CRC csum offload for tunneling packets in some drivers
Subsystems (5)
Xin Long
maintainercover net: support SCTP CRC csum offload for tunneling packets in some drivers
This patchset introduces inline function skb_csum_is_sctp(), and uses it to validate it's a sctp CRC csum offload packet, to make SCTP CRC csum offload for tunneling packets supported in some HW drivers.
Xin Long (6):
net: add inline function skb_csum_is_sctp
net: igb: use skb_csum_is_sctp instead of protocol check
net: igbvf: use skb_csum_is_sctp instead of protocol check
net: igc: use skb_csum_is_sctp instead of protocol check
net: ixgbe: use skb_csum_is_sctp instead of protocol check
net: ixgbevf: use skb_csum_is_sctp instead of protocol check
drivers/net/ethernet/intel/igb/igb_main.c | 14 +------------- drivers/net/ethernet/intel/igbvf/netdev.c | 14 +------------- drivers/net/ethernet/intel/igc/igc_main.c | 14 +------------- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 14 +------------- drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 14 +------------- drivers/net/ethernet/pensando/ionic/ionic_txrx.c | 2 +- include/linux/skbuff.h | 5 +++++ net/core/dev.c | 2 +- 8 files changed, 12 insertions(+), 67 deletions(-)
Signature · 1 line
2.1.0
Xin Long
maintainerPATCH 1/6 net: add inline function skb_csum_is_sctp
This patch is to define a inline function skb_csum_is_sctp(), and also replace all places where it checks if it's a SCTP CSUM skb. This function would be used later in many networking drivers in the following patches.
--- drivers/net/ethernet/pensando/ionic/ionic_txrx.c | 2 +- include/linux/skbuff.h | 5 +++++ net/core/dev.c | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-)
drivers/net/ethernet/pensando/ionic/ionic_txrx.c +1 -1
@@ -979,7 +979,7 @@ static int ionic_tx_calc_csum(struct ionic_queue *q, struct sk_buff *skb) stats->vlan_inserted++; } -if (skb->csum_not_inet) +if (skb_csum_is_sctp (skb)) stats->crc32_csum++;else stats->csum++;
include/linux/skbuff.h +5 -0
@@ -4621,6 +4621,11 @@ static inline void skb_reset_redirect(struct sk_buff *skb)#endif } +static inline bool skb_csum_is_sctp (struct sk_buff *skb) +{ +return skb->csum_not_inet; +} +static inline void skb_set_kcov_handle (struct sk_buff *skb,const u64 kcov_handle) {
net/core/dev.c +1 -1
@@ -3617,7 +3617,7 @@ static struct sk_buff *validate_xmit_vlan(struct sk_buff *skb,int skb_csum_hwoffload_help (struct sk_buff *skb,const netdev_features_t features) { -if (unlikely (skb->csum_not_inet)) +if (unlikely (skb_csum_is_sctp (skb)))return !!(features &NETIF_F_SCTP_CRC ) ?0 :skb_crc32c_csum_help (skb);
Signature · 1 line
2.1.0
Xin Long
maintainerPATCH 2/6 net: igb: use skb_csum_is_sctp instead of protocol check
Using skb_csum_is_sctp is a easier way to validate it's a SCTP CRC checksum offload packet, and there is no need to parse the packet to check its proto field, especially when it's a UDP or GRE encapped packet.
So this patch also makes igb support SCTP CRC checksum offload for UDP and GRE encapped packets.
--- drivers/net/ethernet/intel/igb/igb_main.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-)
drivers/net/ethernet/intel/igb/igb_main.c +1 -13
@@ -5959,15 +5959,6 @@ static int igb_tso(struct igb_ring *tx_ring,return 1 ; } -static inline bool igb_ipv6_csum_is_sctp (struct sk_buff *skb) -{ -unsigned int offset =0 ; - -ipv6_find_hdr (skb, &offset,IPPROTO_SCTP ,NULL ,NULL ); - -return offset ==skb_checksum_start_offset (skb); -} -static void igb_tx_csum (struct igb_ring *tx_ring,struct igb_tx_buffer *first) {struct sk_buff *skb = first->skb;
@@ -5990,10 +5981,7 @@ static void igb_tx_csum(struct igb_ring *tx_ring, struct igb_tx_buffer *first)break ;case offsetof(struct sctphdr , checksum):/* validate that this is actually an SCTP request */ -if (((first->protocol ==htons (ETH_P_IP )) && - (ip_hdr (skb)->protocol ==IPPROTO_SCTP )) || - ((first->protocol ==htons (ETH_P_IPV6 )) && -igb_ipv6_csum_is_sctp (skb))) { +if (skb_csum_is_sctp (skb)) { type_tucmd =E1000_ADVTXD_TUCMD_L4T_SCTP ;break ; }
Signature · 1 line
2.1.0
Xin Long
maintainerPATCH 3/6 net: igbvf: use skb_csum_is_sctp instead of protocol check
Using skb_csum_is_sctp is a easier way to validate it's a SCTP CRC checksum offload packet, and yet it also makes igbvf support SCTP CRC checksum offload for UDP and GRE encapped packets, just as it does in igb driver.
--- drivers/net/ethernet/intel/igbvf/netdev.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-)
drivers/net/ethernet/intel/igbvf/netdev.c +1 -13
@@ -2072,15 +2072,6 @@ static int igbvf_tso(struct igbvf_ring *tx_ring,return 1 ; } -static inline bool igbvf_ipv6_csum_is_sctp (struct sk_buff *skb) -{ -unsigned int offset =0 ; - -ipv6_find_hdr (skb, &offset,IPPROTO_SCTP ,NULL ,NULL ); - -return offset ==skb_checksum_start_offset (skb); -} -static bool igbvf_tx_csum (struct igbvf_ring *tx_ring,struct sk_buff *skb,u32 tx_flags,__be16 protocol) {
@@ -2102,10 +2093,7 @@ static bool igbvf_tx_csum(struct igbvf_ring *tx_ring, struct sk_buff *skb,break ;case offsetof(struct sctphdr , checksum):/* validate that this is actually an SCTP request */ -if (((protocol ==htons (ETH_P_IP )) && - (ip_hdr (skb)->protocol ==IPPROTO_SCTP )) || - ((protocol ==htons (ETH_P_IPV6 )) && -igbvf_ipv6_csum_is_sctp (skb))) { +if (skb_csum_is_sctp (skb)) { type_tucmd =E1000_ADVTXD_TUCMD_L4T_SCTP ;break ; }
Signature · 1 line
2.1.0
Xin Long
maintainerPATCH 4/6 net: igc: use skb_csum_is_sctp instead of protocol check
Using skb_csum_is_sctp is a easier way to validate it's a SCTP CRC checksum offload packet, and yet it also makes igc support SCTP CRC checksum offload for UDP and GRE encapped packets, just as it does in igb driver.
--- drivers/net/ethernet/intel/igc/igc_main.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-)
drivers/net/ethernet/intel/igc/igc_main.c +1 -13
@@ -949,15 +949,6 @@ static void igc_tx_ctxtdesc(struct igc_ring *tx_ring, } } -static inline bool igc_ipv6_csum_is_sctp (struct sk_buff *skb) -{ -unsigned int offset =0 ; - -ipv6_find_hdr (skb, &offset,IPPROTO_SCTP ,NULL ,NULL ); - -return offset ==skb_checksum_start_offset (skb); -} -static void igc_tx_csum (struct igc_ring *tx_ring,struct igc_tx_buffer *first) {struct sk_buff *skb = first->skb;
@@ -980,10 +971,7 @@ static void igc_tx_csum(struct igc_ring *tx_ring, struct igc_tx_buffer *first)break ;case offsetof(struct sctphdr , checksum):/* validate that this is actually an SCTP request */ -if ((first->protocol ==htons (ETH_P_IP ) && - (ip_hdr (skb)->protocol ==IPPROTO_SCTP )) || - (first->protocol ==htons (ETH_P_IPV6 ) && -igc_ipv6_csum_is_sctp (skb))) { +if (skb_csum_is_sctp (skb)) { type_tucmd =IGC_ADVTXD_TUCMD_L4T_SCTP ;break ; }
Signature · 1 line
2.1.0
Xin Long
maintainerPATCH 5/6 net: ixgbe: use skb_csum_is_sctp instead of protocol check
Using skb_csum_is_sctp is a easier way to validate it's a SCTP CRC checksum offload packet, and yet it also makes ixgbe support SCTP CRC checksum offload for UDP and GRE encapped packets, just as it does in igb driver.
--- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +1 -13
@@ -8040,15 +8040,6 @@ static int ixgbe_tso(struct ixgbe_ring *tx_ring,return 1 ; } -static inline bool ixgbe_ipv6_csum_is_sctp (struct sk_buff *skb) -{ -unsigned int offset =0 ; - -ipv6_find_hdr (skb, &offset,IPPROTO_SCTP ,NULL ,NULL ); - -return offset ==skb_checksum_start_offset (skb); -} -static void ixgbe_tx_csum (struct ixgbe_ring *tx_ring,struct ixgbe_tx_buffer *first,struct ixgbe_ipsec_tx_data *itd)
@@ -8074,10 +8065,7 @@ static void ixgbe_tx_csum(struct ixgbe_ring *tx_ring,break ;case offsetof(struct sctphdr , checksum):/* validate that this is actually an SCTP request */ -if (((first->protocol ==htons (ETH_P_IP )) && - (ip_hdr (skb)->protocol ==IPPROTO_SCTP )) || - ((first->protocol ==htons (ETH_P_IPV6 )) && -ixgbe_ipv6_csum_is_sctp (skb))) { +if (skb_csum_is_sctp (skb)) { type_tucmd =IXGBE_ADVTXD_TUCMD_L4T_SCTP ;break ; }
Signature · 1 line
2.1.0
Xin Long
maintainerPATCH 6/6 net: ixgbevf: use skb_csum_is_sctp instead of protocol check
Using skb_csum_is_sctp is a easier way to validate it's a SCTP CRC checksum offload packet, and yet it also makes ixgbevf support SCTP CRC checksum offload for UDP and GRE encapped packets, just as it does in igb driver.
--- drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-)
drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c +1 -13
@@ -3844,15 +3844,6 @@ static int ixgbevf_tso(struct ixgbevf_ring *tx_ring,return 1 ; } -static inline bool ixgbevf_ipv6_csum_is_sctp (struct sk_buff *skb) -{ -unsigned int offset =0 ; - -ipv6_find_hdr (skb, &offset,IPPROTO_SCTP ,NULL ,NULL ); - -return offset ==skb_checksum_start_offset (skb); -} -static void ixgbevf_tx_csum (struct ixgbevf_ring *tx_ring,struct ixgbevf_tx_buffer *first,struct ixgbevf_ipsec_tx_data *itd)
@@ -3873,10 +3864,7 @@ static void ixgbevf_tx_csum(struct ixgbevf_ring *tx_ring,break ;case offsetof(struct sctphdr , checksum):/* validate that this is actually an SCTP request */ -if (((first->protocol ==htons (ETH_P_IP )) && - (ip_hdr (skb)->protocol ==IPPROTO_SCTP )) || - ((first->protocol ==htons (ETH_P_IPV6 )) && -ixgbevf_ipv6_csum_is_sctp (skb))) { +if (skb_csum_is_sctp (skb)) { type_tucmd =IXGBE_ADVTXD_TUCMD_L4T_SCTP ;break ; }
Signature · 1 line
2.1.0
Re: [PATCH net-next 1/6] net: add inline function skb_csum_is_sctp
In reply to Xin LongQuoted 8 lines · Xin Long
This patch is to define a inline function
skb_csum_is_sctp(), and also replace all places where it checks if it's a SCTP CSUM skb. This function would be used later in many networking drivers in the following patches.Suggested-by Alexander Duyck <[email protected]>Signed-off-by Xin Long <[email protected]>
One minor nit. If you had to resubmit this I might move the ionic driver code into a separate patch. However It can probably be accepted as is.
Quoted 51 lines
--- drivers/net/ethernet/pensando/ionic/ionic_txrx.c | 2 +- include/linux/skbuff.h | 5 +++++ net/core/dev.c | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-)drivers/net/ethernet/pensando/ionic/ionic_txrx.c +1
-1@@ -979,7 +979,7 @@ static int ionic_tx_calc_csum(struct ionic_queue *q, struct sk_buff *skb) stats->vlan_inserted++; } -if (skb->csum_not_inet) +if (skb_csum_is_sctp (skb)) stats->crc32_csum++;else stats->csum++;include/linux/skbuff.h +5
-0@@ -4621,6 +4621,11 @@ static inline void skb_reset_redirect(struct sk_buff *skb)#endif } +static inline bool skb_csum_is_sctp (struct sk_buff *skb) +{ +return skb->csum_not_inet; +} +static inline void skb_set_kcov_handle (struct sk_buff *skb,const u64 kcov_handle) {net/core/dev.c +1
-2@@ -3617,7 +3617,7 @@ static struct sk_buff *validate_xmit_vlan(struct sk_buff *skb,int skb_csum_hwoffload_help (struct sk_buff *skb,const netdev_features_t features) { -if (unlikely (skb->csum_not_inet)) +if (unlikely (skb_csum_is_sctp (skb)))return !!(features &NETIF_F_SCTP_CRC ) ?0 :skb_crc32c_csum_help (skb); --2.1.0
Re: [PATCH net-next 2/6] net: igb: use skb_csum_is_sctp instead of protocol check
In reply to Xin LongQuoted 10 lines · Xin Long
Using
skb_csum_is_sctpis a easier way to validate it's a SCTP CRC checksum offload packet, and there is no need to parse the packet to check its proto field, especially when it's a UDP or GRE encapped packet.So this patch also makes igb support SCTP CRC checksum offload for UDP and GRE encapped packets.
Signed-off-by Xin Long <[email protected]>
Re: [PATCH net-next 3/6] net: igbvf: use skb_csum_is_sctp instead of protocol check
In reply to Xin LongQuoted 7 lines · Xin Long
Using
skb_csum_is_sctpis a easier way to validate it's a SCTP CRC checksum offload packet, and yet it also makes igbvf support SCTP CRC checksum offload for UDP and GRE encapped packets, just as it does in igb driver.Signed-off-by Xin Long <[email protected]>
Re: [PATCH net-next 4/6] net: igc: use skb_csum_is_sctp instead of protocol check
In reply to Xin LongQuoted 7 lines · Xin Long
Using
skb_csum_is_sctpis a easier way to validate it's a SCTP CRC checksum offload packet, and yet it also makes igc support SCTP CRC checksum offload for UDP and GRE encapped packets, just as it does in igb driver.Signed-off-by Xin Long <[email protected]>
Re: [PATCH net-next 5/6] net: ixgbe: use skb_csum_is_sctp instead of protocol check
In reply to Xin LongQuoted 7 lines · Xin Long
Using
skb_csum_is_sctpis a easier way to validate it's a SCTP CRC checksum offload packet, and yet it also makes ixgbe support SCTP CRC checksum offload for UDP and GRE encapped packets, just as it does in igb driver.Signed-off-by Xin Long <[email protected]>
Re: [PATCH net-next 6/6] net: ixgbevf: use skb_csum_is_sctp instead of protocol check
In reply to Xin LongQuoted 7 lines · Xin Long
Using
skb_csum_is_sctpis a easier way to validate it's a SCTP CRC checksum offload packet, and yet it also makes ixgbevf support SCTP CRC checksum offload for UDP and GRE encapped packets, just as it does in igb driver.Signed-off-by Xin Long <[email protected]>
Shannon Nelson
Acked-byRe: [PATCH net-next 1/6] net: add inline function skb_csum_is_sctp
In reply to Alexander DuyckQuoted 6 lines · Alexander Duyck
Quoted 5 lines · Xin Long
This patch is to define a inline function
skb_csum_is_sctp(), and also replace all places where it checks if it's a SCTP CSUM skb. This function would be used later in many networking drivers in the following patches.
Quoted 7 lines
Quoted 2 lines
Suggested-by Alexander Duyck <[email protected]>Signed-off-by Xin Long <[email protected]>One minor nit. If you had to resubmit this I might move the ionic driver code into a separate patch. However It can probably be accepted as is.
Reviewed-by Alexander Duyck <[email protected]>
Alex has a good point - if you repost, please split out the ionic bits to a separate patch.
Either way, for ionic:
Quoted 51 lines
Quoted 51 lines
--- drivers/net/ethernet/pensando/ionic/ionic_txrx.c | 2 +- include/linux/skbuff.h | 5 +++++ net/core/dev.c | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-)drivers/net/ethernet/pensando/ionic/ionic_txrx.c +1
-1@@ -979,7 +979,7 @@ static int ionic_tx_calc_csum(struct ionic_queue *q, struct sk_buff *skb) stats->vlan_inserted++; } -if (skb->csum_not_inet) +if (skb_csum_is_sctp (skb)) stats->crc32_csum++;else stats->csum++;include/linux/skbuff.h +5
-0@@ -4621,6 +4621,11 @@ static inline void skb_reset_redirect(struct sk_buff *skb)#endif } +static inline bool skb_csum_is_sctp (struct sk_buff *skb) +{ +return skb->csum_not_inet; +} +static inline void skb_set_kcov_handle (struct sk_buff *skb,const u64 kcov_handle) {net/core/dev.c +1
-2@@ -3617,7 +3617,7 @@ static struct sk_buff *validate_xmit_vlan(struct sk_buff *skb,int skb_csum_hwoffload_help (struct sk_buff *skb,const netdev_features_t features) { -if (unlikely (skb->csum_not_inet)) +if (unlikely (skb_csum_is_sctp (skb)))return !!(features &NETIF_F_SCTP_CRC ) ?0 :skb_crc32c_csum_help (skb); --2.1.0
This series was applied to netdev/net-next.git (refs/heads/master):
Hello:
This series was applied to netdev/net-next.git (refs/heads/master):
Quoted 12 lines · On Sat, 16 Jan 2021 14:13:36 +0800 you wrote:
This patchset introduces inline function
skb_csum_is_sctp(), and uses it to validate it's a sctp CRC csum offload packet, to make SCTP CRC csum offload for tunneling packets supported in some HW drivers.Xin Long (6):
net: add inline functionskb_csum_is_sctp
net: igb: useskb_csum_is_sctpinstead of protocol check
net: igbvf: useskb_csum_is_sctpinstead of protocol check
net: igc: useskb_csum_is_sctpinstead of protocol check
net: ixgbe: useskb_csum_is_sctpinstead of protocol check
net: ixgbevf: useskb_csum_is_sctpinstead of protocol check
Quoted 1 line
[...]
Here is the summary with links:
- [net-next,1/6] net: add inline function skb_csum_is_sctp
https://git.kernel.org/netdev/net-next/c/fa8211701043 - [net-next,2/6] net: igb: use skb_csum_is_sctp instead of protocol check https://git.kernel.org/netdev/net-next/c/8bcf02035bd5 - [net-next,3/6] net: igbvf: use skb_csum_is_sctp instead of protocol check https://git.kernel.org/netdev/net-next/c/d2de44443caf - [net-next,4/6] net: igc: use skb_csum_is_sctp instead of protocol check https://git.kernel.org/netdev/net-next/c/609d29a9d242 - [net-next,5/6] net: ixgbe: use skb_csum_is_sctp instead of protocol check https://git.kernel.org/netdev/net-next/c/f8c4b01d3a68 - [net-next,6/6] net: ixgbevf: use skb_csum_is_sctp instead of protocol check https://git.kernel.org/netdev/net-next/c/fc186d0a4ef8
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html