Re: [PATCH net] net/mlx5e: fix csum adjustments caused by RXFCS

2018-10-31 Thread David Miller
From: Eric Dumazet Date: Tue, 30 Oct 2018 00:57:25 -0700 > As shown by Dmitris, we need to use csum_block_add() instead of csum_add() > when adding the FCS contribution to skb csum. > > Before 4.18 (more exactly commit 88078d98d1bb "net: pskb_trim_rcsum() > and CHECKSUM_COMPLETE are friends"),

Re: [PATCH net] net/mlx5e: fix csum adjustments caused by RXFCS

2018-10-31 Thread Eran Ben Elisha
On 10/30/2018 9:57 AM, Eric Dumazet wrote: > As shown by Dmitris, we need to use csum_block_add() instead of csum_add() > when adding the FCS contribution to skb csum. > > Before 4.18 (more exactly commit 88078d98d1bb "net: pskb_trim_rcsum() > and CHECKSUM_COMPLETE are friends"), the whole skb

Re: [PATCH net] net/mlx5e: fix csum adjustments caused by RXFCS

2018-10-30 Thread Eric Dumazet
On Tue, Oct 30, 2018 at 11:59 AM Cong Wang wrote: > I wonder how compiler recognizes it as "never fail" when marked with > __must_check. __must_check means that you can not ignore the return value of a function. Here we do use the return value. Also prior code was not checking skb->length so

Re: [PATCH net] net/mlx5e: fix csum adjustments caused by RXFCS

2018-10-30 Thread Cong Wang
On Tue, Oct 30, 2018 at 11:42 AM Eric Dumazet wrote: > > On Tue, Oct 30, 2018 at 11:09 AM Cong Wang wrote: > > > At least skb_header_pointer() is marked as __must_check, I don't see > > you check its return value here. > > This can not fail here. > > skb->length must be above 14+4 at this point.

Re: [PATCH net] net/mlx5e: fix csum adjustments caused by RXFCS

2018-10-30 Thread David Miller
From: Cong Wang Date: Tue, 30 Oct 2018 11:09:21 -0700 > On Tue, Oct 30, 2018 at 12:57 AM Eric Dumazet wrote: >> -static __be32 mlx5e_get_fcs(struct sk_buff *skb) >> +static u32 mlx5e_get_fcs(const struct sk_buff *skb) >> { >> - int last_frag_sz, bytes_in_prev, nr_frags; >> - u8

Re: [PATCH net] net/mlx5e: fix csum adjustments caused by RXFCS

2018-10-30 Thread Eric Dumazet
On Tue, Oct 30, 2018 at 11:09 AM Cong Wang wrote: > At least skb_header_pointer() is marked as __must_check, I don't see > you check its return value here. This can not fail here. skb->length must be above 14+4 at this point. My compiler seems to be okay with that.

Re: [PATCH net] net/mlx5e: fix csum adjustments caused by RXFCS

2018-10-30 Thread Cong Wang
On Tue, Oct 30, 2018 at 12:57 AM Eric Dumazet wrote: > -static __be32 mlx5e_get_fcs(struct sk_buff *skb) > +static u32 mlx5e_get_fcs(const struct sk_buff *skb) > { > - int last_frag_sz, bytes_in_prev, nr_frags; > - u8 *fcs_p1, *fcs_p2; > - skb_frag_t *last_frag; > -

[PATCH net] net/mlx5e: fix csum adjustments caused by RXFCS

2018-10-30 Thread Eric Dumazet
As shown by Dmitris, we need to use csum_block_add() instead of csum_add() when adding the FCS contribution to skb csum. Before 4.18 (more exactly commit 88078d98d1bb "net: pskb_trim_rcsum() and CHECKSUM_COMPLETE are friends"), the whole skb csum was thrown away, so RXFCS changes were ignored.