Subject: Re: [PATCH net-next 2/3] net/usb/r8152: enable tx checksum

From: Sergei Shtylyov <[email-masked]>
Date: Tue, 13 Aug 2013 18:39:36 +0400

Hello.

On 08/13/2013 11:28 AM, Hayes Wang wrote:

> Enable tx checksum.

> Signed-off-by: Hayes Wang <[email-masked]>
> ---
>   drivers/net/usb/r8152.c | 63 +++++++++++++++++++++++++++++++++++++++++++++----
>   1 file changed, 58 insertions(+), 5 deletions(-)

> diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
> index c6c5aa2..5d9d949 100644
> --- a/drivers/net/usb/r8152.c
> +++ b/drivers/net/usb/r8152.c
[...]
> @@ -964,6 +971,51 @@ err1:
>   	return -ENOMEM;
>   }
>
> +static void
> +r8152_tx_csum(struct r8152 *tp, struct tx_desc *desc, struct sk_buff *skb)
> +{
[...]
> +		if (ip_protocol == IPPROTO_TCP) {
> +			opts2 |= TCP_CS;
> +			opts2 |= (skb_transport_offset(skb) & 0x7fff) << 17;
> +		} else if (ip_protocol == IPPROTO_UDP) {
> +			opts2 |= UDP_CS;
> +		} else
> +			WARN_ON_ONCE(1);

    Stange, why *else if* branch has {} and *else* don't. It should, according 
to Documentation/CodingStyle.

> +
> +		desc->opts2 = cpu_to_le32(opts2);
> +	}
> +}
> +

WBR, Sergei