linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: cyrille.pitchen@atmel.com (Cyrille Pitchen)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 4/6] net/macb: add RX checksum offload feature
Date: Thu, 24 Jul 2014 13:59:21 +0200	[thread overview]
Message-ID: <53D0F519.1050009@atmel.com> (raw)
In-Reply-To: <1406069908.3363.7.camel@edumazet-glaptop2.roam.corp.google.com>

Le 23/07/2014 00:58, Eric Dumazet a ?crit :
> On Tue, 2014-07-22 at 18:27 +0200, Cyrille Pitchen wrote:
>> Le 18/07/2014 17:36, Eric Dumazet a ?crit :
>>> On Fri, 2014-07-18 at 16:21 +0200, Cyrille Pitchen wrote:
>>>> Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com>
>>>> ---
>>>>  drivers/net/ethernet/cadence/macb.c | 29 ++++++++++++++++++++++++++++-
>>>>  drivers/net/ethernet/cadence/macb.h |  2 ++
>>>>  2 files changed, 30 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c
>>>> index 9bdcd1b..6acd6e2 100644
>>>> --- a/drivers/net/ethernet/cadence/macb.c
>>>> +++ b/drivers/net/ethernet/cadence/macb.c
>>>> @@ -766,6 +766,8 @@ static int gem_rx(struct macb *bp, int budget)
>>>>  
>>>>  		skb->protocol = eth_type_trans(skb, bp->dev);
>>>>  		skb_checksum_none_assert(skb);
>>>> +		if (bp->dev->features & NETIF_F_RXCSUM)
>>>> +			skb->ip_summed = CHECKSUM_UNNECESSARY;
>>>>  
>>>
>>>
>>> Really ?
>>>
>>> If this is what you meant, this deserves a big and fat comment.
>>>
>>>
>>>
>> Hi Eric,
>>
>> Isn't it the proper way to do? According to Cadence documentation
>> about RX checksum offload:
>> "If any of the checksums (IP, TCP or UDP) are verified incorrect by
>> the GEM, the packet is discarded."
>>
>> If I understand, when RX checksum offload is enabled setting bit 24 of
>> the Network Configuration Register, the driver only receives RX frames
>> with correct checksum. Then it tells the kernel that there's no need
>> to verify the checksum again in software. This is done setting
>> skb->ip_summed to CHECKSUM_UNNECESSARY. Intel e1000 driver does the
>> same in e1000_rx_checksum() function.
>>
>> Also bit 24 of the Network Configuration Register is updated by
>> macb_open() and macb_set_features() so it always matches the state of
>> NETIF_F_RXCSUM flag in dev->features, once the network interface is
>> up. That's why I'd rather read from dev->features than read from
>> register.
>>
>> Did I make a mistake? Is it the kind of comment you expect to be
>> added?
>>
>> Regards,
> 
> Usually, frames are not discarded, and a bit is present in rx descriptor
> to tell us if (TCP) checksum was validated by the NIC
> 
> We want tcpdump to get a copy of corrupted TCP frames, even if TCP stack
> drops them later.
> 
> If this NIC drops incorrect frames, I am afraid we cant use this RX
> offload at all.
> 
> 
> 
OK thanks for your comments. In the next series of patches I'll allow RX 
checksum offload only when promiscuous mode is disabled. Also I'll check the
status returned by the GEM through the buffer descriptor.

Regards,

Cyrille

  reply	other threads:[~2014-07-24 11:59 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-18 14:21 [PATCH 0/6] net/macb: add HW features to macb driver Cyrille Pitchen
2014-07-18 14:21 ` [PATCH 1/6] net/macb: configure for FIFO mode and non-gigabit Cyrille Pitchen
2014-07-21  4:12   ` David Miller
2014-07-18 14:21 ` [PATCH 2/6] net/macb: add scatter-gather hw feature Cyrille Pitchen
2014-07-21  4:13   ` David Miller
2014-07-23  7:45     ` Cyrille Pitchen
2014-07-18 14:21 ` [PATCH 3/6] net/macb: add TX checksum offload feature Cyrille Pitchen
2014-07-18 14:21 ` [PATCH 4/6] net/macb: add RX " Cyrille Pitchen
2014-07-18 15:36   ` Eric Dumazet
2014-07-22 16:27     ` Cyrille Pitchen
2014-07-22 16:39       ` Florian Fainelli
2014-07-22 22:58       ` Eric Dumazet
2014-07-24 11:59         ` Cyrille Pitchen [this message]
2014-07-18 14:32 ` [PATCH 5/6] ARM: at91: change compatibility string for sama5d3x gem Cyrille Pitchen
2014-07-18 14:32 ` [PATCH 6/6] net/macb: enable scatter-gather feature and set DMA burst length for sama5d4 gem Cyrille Pitchen

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=53D0F519.1050009@atmel.com \
    --to=cyrille.pitchen@atmel.com \
    --cc=linux-arm-kernel@lists.infradead.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).