netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tom Herbert <tom@herbertland.com>
To: Davide Caratti <dcaratti@redhat.com>
Cc: Alexander Duyck <alexander.duyck@gmail.com>,
	David Laight <David.Laight@aculab.com>,
	"David S . Miller" <davem@davemloft.net>,
	Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>,
	Linux Kernel Network Developers <netdev@vger.kernel.org>,
	"linux-sctp @ vger . kernel . org" <linux-sctp@vger.kernel.org>
Subject: Re: [PATCH RFC net-next v4 3/7] sk_buff: remove support for csum_bad in sk_buff
Date: Sat, 29 Apr 2017 13:21:33 -0700	[thread overview]
Message-ID: <CALx6S37j-Xd4ir2wu-RpNrcnu4aab6FCoEpVu3Q2OhNE58qPWw@mail.gmail.com> (raw)
In-Reply-To: <529dbc49e0124c4632e1c40df457fe33553584ca.1492692976.git.dcaratti@redhat.com>

On Thu, Apr 20, 2017 at 6:38 AM, Davide Caratti <dcaratti@redhat.com> wrote:
> This bit was introduced with 5a21232983aa ("net: Support for csum_bad in
> skbuff") to reduce the stack workload when processing RX packets carrying
> a wrong Internet Checksum. Up to now, only one driver (besides GRO core)
> are setting it.
> The test on NAPI_GRO_CB(skb)->flush in dev_gro_receive() is now done
> before the test on same_flow, to preserve behavior in case of wrong
> checksum.
>
> Suggested-by: Tom Herbert <tom@herbertland.com>
> Signed-off-by: Davide Caratti <dcaratti@redhat.com>
> ---
>  drivers/net/ethernet/aquantia/atlantic/aq_ring.c |  2 +-
>  include/linux/netdevice.h                        |  4 +---
>  include/linux/skbuff.h                           | 23 ++---------------------
>  net/bridge/netfilter/nft_reject_bridge.c         |  5 +----
>  net/core/dev.c                                   |  8 +++-----
>  net/ipv4/netfilter/nf_reject_ipv4.c              |  2 +-
>  net/ipv6/netfilter/nf_reject_ipv6.c              |  3 ---
>  7 files changed, 9 insertions(+), 38 deletions(-)
>
> diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_ring.c b/drivers/net/ethernet/aquantia/atlantic/aq_ring.c
> index 3a8a4aa..9a08179 100644
> --- a/drivers/net/ethernet/aquantia/atlantic/aq_ring.c
> +++ b/drivers/net/ethernet/aquantia/atlantic/aq_ring.c
> @@ -223,7 +223,7 @@ int aq_ring_rx_clean(struct aq_ring_s *self, int *work_done, int budget)
>                 skb->protocol = eth_type_trans(skb, ndev);
>                 if (unlikely(buff->is_cso_err)) {
>                         ++self->stats.rx.errors;
> -                       __skb_mark_checksum_bad(skb);
> +                       skb->ip_summed = CHECKSUM_NONE;
>                 } else {
>                         if (buff->is_ip_cso) {
>                                 __skb_incr_checksum_unnecessary(skb);
> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
> index bf84a67..ab9e3dc 100644
> --- a/include/linux/netdevice.h
> +++ b/include/linux/netdevice.h
> @@ -2546,9 +2546,7 @@ static inline void skb_gro_incr_csum_unnecessary(struct sk_buff *skb)
>         if (__skb_gro_checksum_validate_needed(skb, zero_okay, check))  \
>                 __ret = __skb_gro_checksum_validate_complete(skb,       \
>                                 compute_pseudo(skb, proto));            \
> -       if (__ret)                                                      \
> -               __skb_mark_checksum_bad(skb);                           \
> -       else                                                            \
> +       if (!__ret)                                                     \
>                 skb_gro_incr_csum_unnecessary(skb);                     \
>         __ret;                                                          \
>  })
> diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
> index ec4551b..927309e 100644
> --- a/include/linux/skbuff.h
> +++ b/include/linux/skbuff.h
> @@ -743,7 +743,7 @@ struct sk_buff {
>         __u8                    csum_valid:1;
>         __u8                    csum_complete_sw:1;
>         __u8                    csum_level:2;
> -       __u8                    csum_bad:1;
> +       __u8                    __csum_bad_unused:1; /* one bit hole */
>
>         __u8                    dst_pending_confirm:1;
>  #ifdef CONFIG_IPV6_NDISC_NODETYPE
> @@ -3387,21 +3387,6 @@ static inline void __skb_incr_checksum_unnecessary(struct sk_buff *skb)
>         }
>  }
>
> -static inline void __skb_mark_checksum_bad(struct sk_buff *skb)
> -{
> -       /* Mark current checksum as bad (typically called from GRO
> -        * path). In the case that ip_summed is CHECKSUM_NONE
> -        * this must be the first checksum encountered in the packet.
> -        * When ip_summed is CHECKSUM_UNNECESSARY, this is the first
> -        * checksum after the last one validated. For UDP, a zero
> -        * checksum can not be marked as bad.
> -        */
> -
> -       if (skb->ip_summed == CHECKSUM_NONE ||
> -           skb->ip_summed == CHECKSUM_UNNECESSARY)
> -               skb->csum_bad = 1;
> -}
> -
>  /* Check if we need to perform checksum complete validation.
>   *
>   * Returns true if checksum complete is needed, false otherwise
> @@ -3455,9 +3440,6 @@ static inline __sum16 __skb_checksum_validate_complete(struct sk_buff *skb,
>                         skb->csum_valid = 1;
>                         return 0;
>                 }
> -       } else if (skb->csum_bad) {
> -               /* ip_summed == CHECKSUM_NONE in this case */
> -               return (__force __sum16)1;
>         }
>
>         skb->csum = psum;
> @@ -3517,8 +3499,7 @@ static inline __wsum null_compute_pseudo(struct sk_buff *skb, int proto)
>
>  static inline bool __skb_checksum_convert_check(struct sk_buff *skb)
>  {
> -       return (skb->ip_summed == CHECKSUM_NONE &&
> -               skb->csum_valid && !skb->csum_bad);
> +       return (skb->ip_summed == CHECKSUM_NONE && skb->csum_valid);
>  }
>
>  static inline void __skb_checksum_convert(struct sk_buff *skb,
> diff --git a/net/bridge/netfilter/nft_reject_bridge.c b/net/bridge/netfilter/nft_reject_bridge.c
> index 346ef6b..c16dd3a 100644
> --- a/net/bridge/netfilter/nft_reject_bridge.c
> +++ b/net/bridge/netfilter/nft_reject_bridge.c
> @@ -111,7 +111,7 @@ static void nft_reject_br_send_v4_unreach(struct net *net,
>         __wsum csum;
>         u8 proto;
>
> -       if (oldskb->csum_bad || !nft_bridge_iphdr_validate(oldskb))
> +       if (!nft_bridge_iphdr_validate(oldskb))
>                 return;
>
>         /* IP header checks: fragment. */
> @@ -226,9 +226,6 @@ static bool reject6_br_csum_ok(struct sk_buff *skb, int hook)
>         __be16 fo;
>         u8 proto = ip6h->nexthdr;
>
> -       if (skb->csum_bad)
> -               return false;
> -
>         if (skb_csum_unnecessary(skb))
>                 return true;
>
> diff --git a/net/core/dev.c b/net/core/dev.c
> index c7aec95..77a2d73 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -4533,9 +4533,6 @@ static enum gro_result dev_gro_receive(struct napi_struct *napi, struct sk_buff
>         if (!(skb->dev->features & NETIF_F_GRO))
>                 goto normal;
>
> -       if (skb->csum_bad)
> -               goto normal;
> -
>         gro_list_prepare(napi, skb);
>
>         rcu_read_lock();
> @@ -4595,11 +4592,12 @@ static enum gro_result dev_gro_receive(struct napi_struct *napi, struct sk_buff
>                 napi->gro_count--;
>         }
>
> +       if (NAPI_GRO_CB(skb)->flush)
> +               goto normal;
> +
>         if (same_flow)
>                 goto ok;
>
> -       if (NAPI_GRO_CB(skb)->flush)
> -               goto normal;
>
>         if (unlikely(napi->gro_count >= MAX_GRO_SKBS)) {
>                 struct sk_buff *nskb = napi->gro_list;
> diff --git a/net/ipv4/netfilter/nf_reject_ipv4.c b/net/ipv4/netfilter/nf_reject_ipv4.c
> index 7cd8d0d..6f8d9e5 100644
> --- a/net/ipv4/netfilter/nf_reject_ipv4.c
> +++ b/net/ipv4/netfilter/nf_reject_ipv4.c
> @@ -172,7 +172,7 @@ void nf_send_unreach(struct sk_buff *skb_in, int code, int hook)
>         struct iphdr *iph = ip_hdr(skb_in);
>         u8 proto;
>
> -       if (skb_in->csum_bad || iph->frag_off & htons(IP_OFFSET))
> +       if (iph->frag_off & htons(IP_OFFSET))
>                 return;
>
>         if (skb_csum_unnecessary(skb_in)) {
> diff --git a/net/ipv6/netfilter/nf_reject_ipv6.c b/net/ipv6/netfilter/nf_reject_ipv6.c
> index eedee5d..f63b18e 100644
> --- a/net/ipv6/netfilter/nf_reject_ipv6.c
> +++ b/net/ipv6/netfilter/nf_reject_ipv6.c
> @@ -220,9 +220,6 @@ static bool reject6_csum_ok(struct sk_buff *skb, int hook)
>         __be16 fo;
>         u8 proto;
>
> -       if (skb->csum_bad)
> -               return false;
> -
>         if (skb_csum_unnecessary(skb))
>                 return true;
>
> --
> 2.7.4
>

Acked-by: Tom Herbert <tom@herbertland.com>

  parent reply	other threads:[~2017-04-29 20:21 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-23 16:52 [RFC PATCH net-next 0/5] net: improve support for SCTP checksums Davide Caratti
2017-01-23 16:52 ` [RFC PATCH net-next 1/5] skbuff: add stub to help computing crc32c on SCTP packets Davide Caratti
2017-01-23 16:52 ` [RFC PATCH net-next 2/5] net: split skb_checksum_help Davide Caratti
2017-01-23 20:59   ` Tom Herbert
2017-01-24 16:35     ` David Laight
2017-02-02 15:07       ` Davide Caratti
2017-02-02 16:55         ` David Laight
2017-02-02 18:08         ` Tom Herbert
2017-02-27 13:39           ` Davide Caratti
2017-02-27 15:11             ` Tom Herbert
2017-02-28 10:31               ` Davide Caratti
2017-02-28 10:32             ` [PATCH RFC net-next v2 1/4] skbuff: add stub to help computing crc32c on SCTP packets Davide Caratti
2017-02-28 10:32               ` [PATCH RFC net-next v2 2/4] net: introduce skb_sctp_csum_help Davide Caratti
2017-02-28 10:32               ` [PATCH RFC net-next v2 3/4] net: more accurate checksumming in validate_xmit_skb Davide Caratti
2017-02-28 19:50                 ` Tom Herbert
2017-02-28 10:32               ` [PATCH RFC net-next v2 4/4] Documentation: update notes on checksum offloading Davide Caratti
2017-02-28 22:46               ` [PATCH RFC net-next v2 1/4] skbuff: add stub to help computing crc32c on SCTP packets Alexander Duyck
2017-03-01  3:17                 ` Tom Herbert
2017-03-01 10:53                 ` David Laight
2017-03-06 21:51                 ` Davide Caratti
2017-03-07 18:06                   ` Alexander Duyck
2017-03-18 13:17                     ` Davide Caratti
2017-03-18 22:35                       ` Tom Herbert
2017-04-07 14:16                         ` [PATCH RFC net-next v3 0/7] improve CRC32c in the forwarding path Davide Caratti
2017-04-07 14:16                           ` [PATCH RFC net-next v3 1/7] skbuff: add stub to help computing crc32c on SCTP packets Davide Caratti
2017-04-07 14:16                           ` [PATCH RFC net-next v3 2/7] net: introduce skb_crc32c_csum_help Davide Caratti
2017-04-07 14:16                           ` [PATCH RFC net-next v3 3/7] sk_buff: remove support for csum_bad in sk_buff Davide Caratti
2017-04-07 14:16                           ` [PATCH RFC net-next v3 4/7] net: use skb->csum_algo to identify packets needing crc32c Davide Caratti
2017-04-07 15:43                             ` Tom Herbert
2017-04-07 17:29                               ` Davide Caratti
2017-04-07 18:11                                 ` Tom Herbert
2017-04-13 10:36                                   ` Davide Caratti
2017-04-20 13:38                                   ` [PATCH RFC net-next v4 0/7] net: improve support for SCTP checksums Davide Caratti
2017-04-20 13:38                                     ` [PATCH RFC net-next v4 1/7] skbuff: add stub to help computing crc32c on SCTP packets Davide Caratti
2017-04-20 13:38                                     ` [PATCH RFC net-next v4 2/7] net: introduce skb_crc32c_csum_help Davide Caratti
2017-04-27 12:29                                       ` Marcelo Ricardo Leitner
2017-04-20 13:38                                     ` [PATCH RFC net-next v4 3/7] sk_buff: remove support for csum_bad in sk_buff Davide Caratti
2017-04-27  1:34                                       ` [sk_buff] 95510aef27: BUG:Bad_page_state_in_process kernel test robot
2017-04-29 20:21                                       ` Tom Herbert [this message]
2017-04-20 13:38                                     ` [PATCH RFC net-next v4 4/7] net: use skb->csum_not_inet to identify packets needing crc32c Davide Caratti
2017-04-29 20:18                                       ` Tom Herbert
2017-04-20 13:38                                     ` [PATCH RFC net-next v4 5/7] net: more accurate checksumming in validate_xmit_skb() Davide Caratti
2017-04-20 13:38                                     ` [PATCH RFC net-next v4 6/7] openvswitch: more accurate checksumming in queue_userspace_packet() Davide Caratti
2017-04-20 13:38                                     ` [PATCH RFC net-next v4 7/7] sk_buff.h: improve description of CHECKSUM_{COMPLETE,UNNECESSARY} Davide Caratti
2017-04-29 20:20                                       ` Tom Herbert
2017-04-27 12:41                                     ` [PATCH RFC net-next v4 0/7] net: improve support for SCTP checksums Marcelo Ricardo Leitner
2017-04-07 14:16                           ` [PATCH RFC net-next v3 5/7] net: more accurate checksumming in validate_xmit_skb() Davide Caratti
2017-04-07 14:16                           ` [PATCH RFC net-next v3 6/7] openvswitch: more accurate checksumming in queue_userspace_packet() Davide Caratti
2017-04-07 14:16                           ` [PATCH RFC net-next v3 7/7] sk_buff.h: improve description of CHECKSUM_{COMPLETE,UNNECESSARY} Davide Caratti
2017-01-23 16:52 ` [RFC PATCH net-next 3/5] net: introduce skb_sctp_csum_help Davide Caratti
2017-01-23 16:52 ` [RFC PATCH net-next 4/5] net: more accurate checksumming in validate_xmit_skb Davide Caratti
2017-01-23 16:52 ` [RFC PATCH net-next 5/5] Documentation: add description of skb_sctp_csum_help Davide Caratti

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=CALx6S37j-Xd4ir2wu-RpNrcnu4aab6FCoEpVu3Q2OhNE58qPWw@mail.gmail.com \
    --to=tom@herbertland.com \
    --cc=David.Laight@aculab.com \
    --cc=alexander.duyck@gmail.com \
    --cc=davem@davemloft.net \
    --cc=dcaratti@redhat.com \
    --cc=linux-sctp@vger.kernel.org \
    --cc=marcelo.leitner@gmail.com \
    --cc=netdev@vger.kernel.org \
    /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).