public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Ben Hutchings <bhutchings@solarflare.com>
To: Mark Lord <kernel@teksavvy.com>
Cc: David Miller <davem@davemloft.net>, <netdev@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] drivers/net/usb/asix:  resync from vendor's copy
Date: Tue, 6 Dec 2011 17:45:37 +0000	[thread overview]
Message-ID: <1323193537.2772.9.camel@bwh-desktop> (raw)
In-Reply-To: <4EDE0E29.9070809@teksavvy.com>

On Tue, 2011-12-06 at 07:44 -0500, Mark Lord wrote:
> On 11-12-05 10:18 AM, Ben Hutchings wrote:
> > On Mon, 2011-12-05 at 09:41 -0500, Mark Lord wrote:
> > [...]
> >> static int ax88772b_bind(struct usbnet *dev, struct usb_interface *intf)
> >> {
> >> ...
> >>         /* register support for hardware checksums */
> >>         dev->net->hw_features |= NETIF_F_HW_CSUM | NETIF_F_RXCSUM;
> >>
> >>         /* enable hardware checksums */
> >>         dev->net->features |= NETIF_F_HW_CSUM | NETIF_F_RXCSUM;
> >>         ax88772b_set_features(dev->net, dev->net->features);
> >> ...
> >> }
> >> -------------------------------snip-----------------------------------
> >>
> >> Does this look correct -- any improvements/fixes to suggest?
> > [...]
> > 
> > NETIF_F_HW_CSUM means the hardware implements generic IP-style
> > checksumming: the stack specifies the offset at which to start
> > checksumming and the offset at which to store the checksum, and the
> > hardware does not attempt to parse the headers.
> > 
> > If this hardware recognises specific protocols and works out the offsets
> > itself, then you must claim NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM instead.
> 
> Yeah, the hardware seems to understand quite a few protocol formats.
> Okay, so I'll claim the protocol-specific flags in net->hw_features.
> 
> But what do I use in net->features?
> The exact same protocol flags,
> or the generic NETIF_F_HW_CSUM | NETIF_F_RXCSUM ones?

You set the flags for features that are actually being implemented!

But do set NETIF_F_RXCSUM in both places.  The network stack doesn't
know or care exactly what protocols you can do RX checksum validation
for, so there is only one flag for this.  Only the TX checksum
generation features have to be distinguished.

> The set_features() function also has to test for flags
> to know what to do.  Should it test specific protocol flags,
> or just the generic two ?

Think it through.

Ben.

-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

  reply	other threads:[~2011-12-06 17:45 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-26 23:36 asix usb network driver: nfg Mark Lord
2011-10-26 23:40 ` David Miller
2011-10-27  1:23   ` Mark Lord
2011-10-27  2:17     ` David Miller
2011-10-27 18:48       ` Mark Lord
2011-11-02 19:36       ` [PATCH] drivers/net/usb/asix: resync from vendor's copy Mark Lord
2011-11-02 19:48         ` Mark Lord
2011-11-02 20:42         ` Ben Hutchings
2011-11-02 22:44           ` Mark Lord
2011-11-09 16:25           ` Mark Lord
2011-11-09 16:34             ` Ben Hutchings
2011-11-09 16:47               ` Mark Lord
2011-11-09 16:57                 ` Mark Lord
2011-11-09 17:20                   ` Mark Lord
2011-11-09 17:31                     ` Ben Hutchings
2011-11-09 17:40                       ` Mark Lord
2011-11-09 17:48                         ` Ben Hutchings
2011-11-09 18:22                           ` Mark Lord
2011-12-05 14:41                           ` Mark Lord
2011-12-05 15:18                             ` Ben Hutchings
2011-12-06 12:44                               ` Mark Lord
2011-12-06 17:45                                 ` Ben Hutchings [this message]
2011-12-07 16:21                                   ` Mark Lord
2011-12-07 16:27                                     ` Ben Hutchings
2011-12-07 16:59                                       ` Mark Lord
2011-12-07 17:03                                         ` Ben Hutchings
2011-11-07 16:09         ` Michal Marek
2011-11-09 17:31         ` [PATCH v2] " Mark Lord
2011-11-09 17:41           ` Mark Lord
2011-11-09 17:43           ` Mark Lord
2011-11-09 17:47           ` Ben Hutchings
2011-11-09 18:27             ` Mark Lord
2011-11-09 17:49           ` [PATCH v3] " Mark Lord
2011-11-10 14:01           ` [PATCH v2] " Mark Lord
2011-11-10 16:54             ` Grant Grundler
2011-11-10 20:17               ` Mark Lord

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=1323193537.2772.9.camel@bwh-desktop \
    --to=bhutchings@solarflare.com \
    --cc=davem@davemloft.net \
    --cc=kernel@teksavvy.com \
    --cc=linux-kernel@vger.kernel.org \
    --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