Thread (36 messages) 36 messages, 5 authors, 2011-12-07

Re: [PATCH] drivers/net/usb/asix: resync from vendor's copy

From: Ben Hutchings <hidden>
Date: 2011-12-06 17:45:42
Also in: lkml

On Tue, 2011-12-06 at 07:44 -0500, Mark Lord wrote:
On 11-12-05 10:18 AM, Ben Hutchings wrote:
quoted
On Mon, 2011-12-05 at 09:41 -0500, Mark Lord wrote:
[...]
quoted
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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help