* [PATCH net-next 0/6] net: support SCTP CRC csum offload for tunneling packets in some drivers @ 2021-01-16 6:13 Xin Long 2021-01-16 6:13 ` [PATCH net-next 1/6] net: add inline function skb_csum_is_sctp Xin Long 2021-01-19 23:40 ` [PATCH net-next 0/6] net: support SCTP CRC csum offload for tunneling packets in some drivers patchwork-bot+netdevbpf 0 siblings, 2 replies; 15+ messages in thread From: Xin Long @ 2021-01-16 6:13 UTC (permalink / raw) To: network dev, linux-sctp Cc: Marcelo Ricardo Leitner, Neil Horman, davem, Jakub Kicinski, Alexander Duyck, Jesse Brandeburg, Tony Nguyen, intel-wired-lan 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(-) -- 2.1.0 ^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH net-next 1/6] net: add inline function skb_csum_is_sctp 2021-01-16 6:13 [PATCH net-next 0/6] net: support SCTP CRC csum offload for tunneling packets in some drivers Xin Long @ 2021-01-16 6:13 ` Xin Long 2021-01-16 6:13 ` [PATCH net-next 2/6] net: igb: use skb_csum_is_sctp instead of protocol check Xin Long 2021-01-19 22:23 ` [PATCH net-next 1/6] net: add inline function skb_csum_is_sctp Alexander Duyck 2021-01-19 23:40 ` [PATCH net-next 0/6] net: support SCTP CRC csum offload for tunneling packets in some drivers patchwork-bot+netdevbpf 1 sibling, 2 replies; 15+ messages in thread From: Xin Long @ 2021-01-16 6:13 UTC (permalink / raw) To: network dev, linux-sctp Cc: Marcelo Ricardo Leitner, Neil Horman, davem, Jakub Kicinski, Alexander Duyck, Jesse Brandeburg, Tony Nguyen, intel-wired-lan 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 <alexander.duyck@gmail.com> Signed-off-by: Xin Long <lucien.xin@gmail.com> --- 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(-) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_txrx.c b/drivers/net/ethernet/pensando/ionic/ionic_txrx.c index ac4cd5d..162a1ff 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_txrx.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_txrx.c @@ -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++; diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index c9568cf..46f901a 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -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) { diff --git a/net/core/dev.c b/net/core/dev.c index 0a31d4e..bbd306f 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -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 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH net-next 2/6] net: igb: use skb_csum_is_sctp instead of protocol check 2021-01-16 6:13 ` [PATCH net-next 1/6] net: add inline function skb_csum_is_sctp Xin Long @ 2021-01-16 6:13 ` Xin Long 2021-01-16 6:13 ` [PATCH net-next 3/6] net: igbvf: " Xin Long 2021-01-19 22:24 ` [PATCH net-next 2/6] net: igb: " Alexander Duyck 2021-01-19 22:23 ` [PATCH net-next 1/6] net: add inline function skb_csum_is_sctp Alexander Duyck 1 sibling, 2 replies; 15+ messages in thread From: Xin Long @ 2021-01-16 6:13 UTC (permalink / raw) To: network dev, linux-sctp Cc: Marcelo Ricardo Leitner, Neil Horman, davem, Jakub Kicinski, Alexander Duyck, Jesse Brandeburg, Tony Nguyen, intel-wired-lan 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. Signed-off-by: Xin Long <lucien.xin@gmail.com> --- drivers/net/ethernet/intel/igb/igb_main.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index 03f78fd..8757ad0 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c @@ -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; } -- 2.1.0 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH net-next 3/6] net: igbvf: use skb_csum_is_sctp instead of protocol check 2021-01-16 6:13 ` [PATCH net-next 2/6] net: igb: use skb_csum_is_sctp instead of protocol check Xin Long @ 2021-01-16 6:13 ` Xin Long 2021-01-16 6:13 ` [PATCH net-next 4/6] net: igc: " Xin Long 2021-01-19 22:24 ` [PATCH net-next 3/6] net: igbvf: " Alexander Duyck 2021-01-19 22:24 ` [PATCH net-next 2/6] net: igb: " Alexander Duyck 1 sibling, 2 replies; 15+ messages in thread From: Xin Long @ 2021-01-16 6:13 UTC (permalink / raw) To: network dev, linux-sctp Cc: Marcelo Ricardo Leitner, Neil Horman, davem, Jakub Kicinski, Alexander Duyck, Jesse Brandeburg, Tony Nguyen, intel-wired-lan 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. Signed-off-by: Xin Long <lucien.xin@gmail.com> --- drivers/net/ethernet/intel/igbvf/netdev.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/drivers/net/ethernet/intel/igbvf/netdev.c b/drivers/net/ethernet/intel/igbvf/netdev.c index 30fdea2..fb3fbcb 100644 --- a/drivers/net/ethernet/intel/igbvf/netdev.c +++ b/drivers/net/ethernet/intel/igbvf/netdev.c @@ -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; } -- 2.1.0 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH net-next 4/6] net: igc: use skb_csum_is_sctp instead of protocol check 2021-01-16 6:13 ` [PATCH net-next 3/6] net: igbvf: " Xin Long @ 2021-01-16 6:13 ` Xin Long 2021-01-16 6:13 ` [PATCH net-next 5/6] net: ixgbe: " Xin Long 2021-01-19 22:24 ` [PATCH net-next 4/6] net: igc: " Alexander Duyck 2021-01-19 22:24 ` [PATCH net-next 3/6] net: igbvf: " Alexander Duyck 1 sibling, 2 replies; 15+ messages in thread From: Xin Long @ 2021-01-16 6:13 UTC (permalink / raw) To: network dev, linux-sctp Cc: Marcelo Ricardo Leitner, Neil Horman, davem, Jakub Kicinski, Alexander Duyck, Jesse Brandeburg, Tony Nguyen, intel-wired-lan 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. Signed-off-by: Xin Long <lucien.xin@gmail.com> --- drivers/net/ethernet/intel/igc/igc_main.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c index afd6a62..43aec42 100644 --- a/drivers/net/ethernet/intel/igc/igc_main.c +++ b/drivers/net/ethernet/intel/igc/igc_main.c @@ -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; } -- 2.1.0 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH net-next 5/6] net: ixgbe: use skb_csum_is_sctp instead of protocol check 2021-01-16 6:13 ` [PATCH net-next 4/6] net: igc: " Xin Long @ 2021-01-16 6:13 ` Xin Long 2021-01-16 6:13 ` [PATCH net-next 6/6] net: ixgbevf: " Xin Long 2021-01-19 22:25 ` [PATCH net-next 5/6] net: ixgbe: " Alexander Duyck 2021-01-19 22:24 ` [PATCH net-next 4/6] net: igc: " Alexander Duyck 1 sibling, 2 replies; 15+ messages in thread From: Xin Long @ 2021-01-16 6:13 UTC (permalink / raw) To: network dev, linux-sctp Cc: Marcelo Ricardo Leitner, Neil Horman, davem, Jakub Kicinski, Alexander Duyck, Jesse Brandeburg, Tony Nguyen, intel-wired-lan 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. Signed-off-by: Xin Long <lucien.xin@gmail.com> --- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index 6cbbe09..2973c54 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c @@ -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; } -- 2.1.0 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH net-next 6/6] net: ixgbevf: use skb_csum_is_sctp instead of protocol check 2021-01-16 6:13 ` [PATCH net-next 5/6] net: ixgbe: " Xin Long @ 2021-01-16 6:13 ` Xin Long 2021-01-19 22:25 ` Alexander Duyck 2021-01-19 22:25 ` [PATCH net-next 5/6] net: ixgbe: " Alexander Duyck 1 sibling, 1 reply; 15+ messages in thread From: Xin Long @ 2021-01-16 6:13 UTC (permalink / raw) To: network dev, linux-sctp Cc: Marcelo Ricardo Leitner, Neil Horman, davem, Jakub Kicinski, Alexander Duyck, Jesse Brandeburg, Tony Nguyen, intel-wired-lan 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. Signed-off-by: Xin Long <lucien.xin@gmail.com> --- drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c index 4061cd7..cd9d79f 100644 --- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c +++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c @@ -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; } -- 2.1.0 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH net-next 6/6] net: ixgbevf: use skb_csum_is_sctp instead of protocol check 2021-01-16 6:13 ` [PATCH net-next 6/6] net: ixgbevf: " Xin Long @ 2021-01-19 22:25 ` Alexander Duyck 0 siblings, 0 replies; 15+ messages in thread From: Alexander Duyck @ 2021-01-19 22:25 UTC (permalink / raw) To: Xin Long Cc: network dev, linux-sctp @ vger . kernel . org, Marcelo Ricardo Leitner, Neil Horman, David Miller, Jakub Kicinski, Jesse Brandeburg, Tony Nguyen, intel-wired-lan On Fri, Jan 15, 2021 at 10:14 PM Xin Long <lucien.xin@gmail.com> wrote: > > 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. > > Signed-off-by: Xin Long <lucien.xin@gmail.com> Reviewed-by: Alexander Duyck <alexanderduyck@fb.com> ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH net-next 5/6] net: ixgbe: use skb_csum_is_sctp instead of protocol check 2021-01-16 6:13 ` [PATCH net-next 5/6] net: ixgbe: " Xin Long 2021-01-16 6:13 ` [PATCH net-next 6/6] net: ixgbevf: " Xin Long @ 2021-01-19 22:25 ` Alexander Duyck 1 sibling, 0 replies; 15+ messages in thread From: Alexander Duyck @ 2021-01-19 22:25 UTC (permalink / raw) To: Xin Long Cc: network dev, linux-sctp @ vger . kernel . org, Marcelo Ricardo Leitner, Neil Horman, David Miller, Jakub Kicinski, Jesse Brandeburg, Tony Nguyen, intel-wired-lan On Fri, Jan 15, 2021 at 10:14 PM Xin Long <lucien.xin@gmail.com> wrote: > > 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. > > Signed-off-by: Xin Long <lucien.xin@gmail.com> Reviewed-by: Alexander Duyck <alexanderduyck@fb.com> ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH net-next 4/6] net: igc: use skb_csum_is_sctp instead of protocol check 2021-01-16 6:13 ` [PATCH net-next 4/6] net: igc: " Xin Long 2021-01-16 6:13 ` [PATCH net-next 5/6] net: ixgbe: " Xin Long @ 2021-01-19 22:24 ` Alexander Duyck 1 sibling, 0 replies; 15+ messages in thread From: Alexander Duyck @ 2021-01-19 22:24 UTC (permalink / raw) To: Xin Long Cc: network dev, linux-sctp @ vger . kernel . org, Marcelo Ricardo Leitner, Neil Horman, David Miller, Jakub Kicinski, Jesse Brandeburg, Tony Nguyen, intel-wired-lan On Fri, Jan 15, 2021 at 10:14 PM Xin Long <lucien.xin@gmail.com> wrote: > > 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. > > Signed-off-by: Xin Long <lucien.xin@gmail.com> Reviewed-by: Alexander Duyck <alexanderduyck@fb.com> ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH net-next 3/6] net: igbvf: use skb_csum_is_sctp instead of protocol check 2021-01-16 6:13 ` [PATCH net-next 3/6] net: igbvf: " Xin Long 2021-01-16 6:13 ` [PATCH net-next 4/6] net: igc: " Xin Long @ 2021-01-19 22:24 ` Alexander Duyck 1 sibling, 0 replies; 15+ messages in thread From: Alexander Duyck @ 2021-01-19 22:24 UTC (permalink / raw) To: Xin Long Cc: network dev, linux-sctp @ vger . kernel . org, Marcelo Ricardo Leitner, Neil Horman, David Miller, Jakub Kicinski, Jesse Brandeburg, Tony Nguyen, intel-wired-lan On Fri, Jan 15, 2021 at 10:14 PM Xin Long <lucien.xin@gmail.com> wrote: > > 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. > > Signed-off-by: Xin Long <lucien.xin@gmail.com> Reviewed-by: Alexander Duyck <alexanderduyck@fb.com> ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH net-next 2/6] net: igb: use skb_csum_is_sctp instead of protocol check 2021-01-16 6:13 ` [PATCH net-next 2/6] net: igb: use skb_csum_is_sctp instead of protocol check Xin Long 2021-01-16 6:13 ` [PATCH net-next 3/6] net: igbvf: " Xin Long @ 2021-01-19 22:24 ` Alexander Duyck 1 sibling, 0 replies; 15+ messages in thread From: Alexander Duyck @ 2021-01-19 22:24 UTC (permalink / raw) To: Xin Long Cc: network dev, linux-sctp @ vger . kernel . org, Marcelo Ricardo Leitner, Neil Horman, David Miller, Jakub Kicinski, Jesse Brandeburg, Tony Nguyen, intel-wired-lan On Fri, Jan 15, 2021 at 10:14 PM Xin Long <lucien.xin@gmail.com> wrote: > > 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. > > Signed-off-by: Xin Long <lucien.xin@gmail.com> Reviewed-by: Alexander Duyck <alexanderduyck@fb.com> ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH net-next 1/6] net: add inline function skb_csum_is_sctp 2021-01-16 6:13 ` [PATCH net-next 1/6] net: add inline function skb_csum_is_sctp Xin Long 2021-01-16 6:13 ` [PATCH net-next 2/6] net: igb: use skb_csum_is_sctp instead of protocol check Xin Long @ 2021-01-19 22:23 ` Alexander Duyck 2021-01-19 23:35 ` Shannon Nelson 1 sibling, 1 reply; 15+ messages in thread From: Alexander Duyck @ 2021-01-19 22:23 UTC (permalink / raw) To: Xin Long Cc: network dev, linux-sctp @ vger . kernel . org, Marcelo Ricardo Leitner, Neil Horman, David Miller, Jakub Kicinski, Jesse Brandeburg, Tony Nguyen, intel-wired-lan On Fri, Jan 15, 2021 at 10:13 PM Xin Long <lucien.xin@gmail.com> wrote: > > 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 <alexander.duyck@gmail.com> > Signed-off-by: Xin Long <lucien.xin@gmail.com> 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 <alexanderduyck@fb.com> > --- > 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(-) > > diff --git a/drivers/net/ethernet/pensando/ionic/ionic_txrx.c b/drivers/net/ethernet/pensando/ionic/ionic_txrx.c > index ac4cd5d..162a1ff 100644 > --- a/drivers/net/ethernet/pensando/ionic/ionic_txrx.c > +++ b/drivers/net/ethernet/pensando/ionic/ionic_txrx.c > @@ -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++; > diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h > index c9568cf..46f901a 100644 > --- a/include/linux/skbuff.h > +++ b/include/linux/skbuff.h > @@ -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) > { > diff --git a/net/core/dev.c b/net/core/dev.c > index 0a31d4e..bbd306f 100644 > --- a/net/core/dev.c > +++ b/net/core/dev.c > @@ -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 > ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH net-next 1/6] net: add inline function skb_csum_is_sctp 2021-01-19 22:23 ` [PATCH net-next 1/6] net: add inline function skb_csum_is_sctp Alexander Duyck @ 2021-01-19 23:35 ` Shannon Nelson 0 siblings, 0 replies; 15+ messages in thread From: Shannon Nelson @ 2021-01-19 23:35 UTC (permalink / raw) To: Alexander Duyck, Xin Long Cc: network dev, linux-sctp @ vger . kernel . org, Marcelo Ricardo Leitner, Neil Horman, David Miller, Jakub Kicinski, Jesse Brandeburg, Tony Nguyen, intel-wired-lan On 1/19/21 2:23 PM, Alexander Duyck wrote: > On Fri, Jan 15, 2021 at 10:13 PM Xin Long <lucien.xin@gmail.com> wrote: >> 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 <alexander.duyck@gmail.com> >> Signed-off-by: Xin Long <lucien.xin@gmail.com> > 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 <alexanderduyck@fb.com> Alex has a good point - if you repost, please split out the ionic bits to a separate patch. Either way, for ionic: Acked-by: Shannon Nelson <snelson@pensando.io> >> --- >> 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(-) >> >> diff --git a/drivers/net/ethernet/pensando/ionic/ionic_txrx.c b/drivers/net/ethernet/pensando/ionic/ionic_txrx.c >> index ac4cd5d..162a1ff 100644 >> --- a/drivers/net/ethernet/pensando/ionic/ionic_txrx.c >> +++ b/drivers/net/ethernet/pensando/ionic/ionic_txrx.c >> @@ -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++; >> diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h >> index c9568cf..46f901a 100644 >> --- a/include/linux/skbuff.h >> +++ b/include/linux/skbuff.h >> @@ -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) >> { >> diff --git a/net/core/dev.c b/net/core/dev.c >> index 0a31d4e..bbd306f 100644 >> --- a/net/core/dev.c >> +++ b/net/core/dev.c >> @@ -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 >> ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH net-next 0/6] net: support SCTP CRC csum offload for tunneling packets in some drivers 2021-01-16 6:13 [PATCH net-next 0/6] net: support SCTP CRC csum offload for tunneling packets in some drivers Xin Long 2021-01-16 6:13 ` [PATCH net-next 1/6] net: add inline function skb_csum_is_sctp Xin Long @ 2021-01-19 23:40 ` patchwork-bot+netdevbpf 1 sibling, 0 replies; 15+ messages in thread From: patchwork-bot+netdevbpf @ 2021-01-19 23:40 UTC (permalink / raw) To: Xin Long Cc: netdev, linux-sctp, marcelo.leitner, nhorman, davem, kuba, alexander.duyck, jesse.brandeburg, anthony.l.nguyen, intel-wired-lan Hello: This series was applied to netdev/net-next.git (refs/heads/master): 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 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 > > [...] 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 ^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2021-01-19 23:41 UTC | newest] Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-01-16 6:13 [PATCH net-next 0/6] net: support SCTP CRC csum offload for tunneling packets in some drivers Xin Long 2021-01-16 6:13 ` [PATCH net-next 1/6] net: add inline function skb_csum_is_sctp Xin Long 2021-01-16 6:13 ` [PATCH net-next 2/6] net: igb: use skb_csum_is_sctp instead of protocol check Xin Long 2021-01-16 6:13 ` [PATCH net-next 3/6] net: igbvf: " Xin Long 2021-01-16 6:13 ` [PATCH net-next 4/6] net: igc: " Xin Long 2021-01-16 6:13 ` [PATCH net-next 5/6] net: ixgbe: " Xin Long 2021-01-16 6:13 ` [PATCH net-next 6/6] net: ixgbevf: " Xin Long 2021-01-19 22:25 ` Alexander Duyck 2021-01-19 22:25 ` [PATCH net-next 5/6] net: ixgbe: " Alexander Duyck 2021-01-19 22:24 ` [PATCH net-next 4/6] net: igc: " Alexander Duyck 2021-01-19 22:24 ` [PATCH net-next 3/6] net: igbvf: " Alexander Duyck 2021-01-19 22:24 ` [PATCH net-next 2/6] net: igb: " Alexander Duyck 2021-01-19 22:23 ` [PATCH net-next 1/6] net: add inline function skb_csum_is_sctp Alexander Duyck 2021-01-19 23:35 ` Shannon Nelson 2021-01-19 23:40 ` [PATCH net-next 0/6] net: support SCTP CRC csum offload for tunneling packets in some drivers patchwork-bot+netdevbpf
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).