From: Davide Caratti <dcaratti@redhat.com>
To: Tariq Toukan <tariqt@mellanox.com>, netdev@vger.kernel.org
Cc: "David S . Miller" <davem@davemloft.net>
Subject: Re: [PATCH net-next] net/mlx4_en: don't set CHECKSUM_COMPLETE on SCTP packets
Date: Mon, 19 Jun 2017 19:04:10 +0200 [thread overview]
Message-ID: <1497891850.2600.9.camel@redhat.com> (raw)
In-Reply-To: <bc64924a-a9cd-737e-b63d-27011445d230@mellanox.com>
hello Tariq,
On Sun, 2017-06-18 at 14:10 +0300, Tariq Toukan wrote:
> > @@ -624,12 +632,13 @@ static int check_csum(struct mlx4_cqe *cqe, struct sk_buff *skb, void *va,
> > hdr += sizeof(struct vlan_hdr);
> > }
> >
> > - if (cqe->status & cpu_to_be16(MLX4_CQE_STATUS_IPV4))
> > - get_fixed_ipv4_csum(hw_checksum, skb, hdr);
> > + if ((cqe->status & cpu_to_be16(MLX4_CQE_STATUS_IPV4)) &&
> > + (unlikely(get_fixed_ipv4_csum(hw_checksum, skb, hdr))))
>
> No! The lazy evaluation trick is wrong here.
> This way you'll end up going almost always to the else (ipv6) for the
> wrong reason.
you are right! thanks for spotting this.
> > + return -1;
> > #if IS_ENABLED(CONFIG_IPV6)
> > - else if (cqe->status & cpu_to_be16(MLX4_CQE_STATUS_IPV6))
> > - if (unlikely(get_fixed_ipv6_csum(hw_checksum, skb, hdr)))
> > - return -1;
> > + else if ((cqe->status & cpu_to_be16(MLX4_CQE_STATUS_IPV6)) &&
> > + (unlikely(get_fixed_ipv6_csum(hw_checksum, skb, hdr))))
> > + return -1;
>
> Let's not change this, might cause future bugs, similarly to the one above.
> > #endif
> > return 0;
> > }
maybe we can avoid adding braces, remove that 'else' keyword and the nested 'if',
thus saving one line, given that check_csum() returns the same set of values as
get_fixed_ipv{4,6}_checksum(), with the same meaning (-1 => go with CHECKSUM_NONE,
0 => go with CHECKSUM_COMPLETE).
---- >8 ----
@@ -625,11 +633,10 @@ static int check_csum(struct mlx4_cqe *cqe, struct sk_buff *skb, void *va,
}
if (cqe->status & cpu_to_be16(MLX4_CQE_STATUS_IPV4))
- get_fixed_ipv4_csum(hw_checksum, skb, hdr);
+ return get_fixed_ipv4_csum(hw_checksum, skb, hdr);
#if IS_ENABLED(CONFIG_IPV6)
- else if (cqe->status & cpu_to_be16(MLX4_CQE_STATUS_IPV6))
- if (unlikely(get_fixed_ipv6_csum(hw_checksum, skb, hdr)))
- return -1;
+ if (cqe->status & cpu_to_be16(MLX4_CQE_STATUS_IPV6))
+ return get_fixed_ipv6_csum(hw_checksum, skb, hdr);
#endif
return 0;
}
---- 8< ----
I will test and repost a v2 with this modification, unless you have any
objections. Thank you in advance!
regards
next prev parent reply other threads:[~2017-06-19 17:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-16 14:01 [PATCH net-next] net/mlx4_en: don't set CHECKSUM_COMPLETE on SCTP packets Davide Caratti
2017-06-18 11:10 ` Tariq Toukan
2017-06-19 17:04 ` Davide Caratti [this message]
2017-06-20 7:52 ` Tariq Toukan
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=1497891850.2600.9.camel@redhat.com \
--to=dcaratti@redhat.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=tariqt@mellanox.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.