lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4EDCD828.2090904@teksavvy.com>
Date:	Mon, 05 Dec 2011 09:41:44 -0500
From:	Mark Lord <kernel@...savvy.com>
To:	Ben Hutchings <bhutchings@...arflare.com>,
	David Miller <davem@...emloft.net>
CC:	netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] drivers/net/usb/asix:  resync from vendor's copy

David / Ben / anyone..

I'm trying to puzzle out the rx/tx checksum feature flags,
and there does seem to be a lot of variance among drivers
as to how these are used.

The ASIX chips have hardware support for IP and TCP checksumming
for both IPv4 and IPv6.  So I'm thinking this code (below) is the
most appropriate method for use in asix.c:

------------------------------- asix.h -----------------------------------
...
#define AX_RXCOE_IPCE                   0x0001
#define AX_RXCOE_IPVE                   0x0002
#define AX_RXCOE_V6VE                   0x0004
#define AX_RXCOE_TCPE                   0x0008
#define AX_RXCOE_UDPE                   0x0010
#define AX_RXCOE_ICMP                   0x0020
#define AX_RXCOE_IGMP                   0x0040
#define AX_RXCOE_ICV6                   0x0080
#define AX_RXCOE_TCPV6                  0x0100
#define AX_RXCOE_UDPV6                  0x0200
#define AX_RXCOE_ICMV6                  0x0400
#define AX_RXCOE_IGMV6                  0x0800
#define AX_RXCOE_ICV6V6                 0x1000
#define AX_RXCOE_FOPC                   0x8000
#define AX_RXCOE_DEF_CSUM               (AX_RXCOE_IPCE  | AX_RXCOE_IPVE  | \
                                         AX_RXCOE_V6VE  | AX_RXCOE_TCPE  | \
                                         AX_RXCOE_UDPE  | AX_RXCOE_ICV6  | \
                                         AX_RXCOE_TCPV6 | AX_RXCOE_UDPV6)

#define AX_RXCOE_64TE                   0x0100
#define AX_RXCOE_PPPOE                  0x0200
#define AX_RXCOE_RPCE                   0x8000

#define AX_TXCOE_IP                     0x0001
#define AX_TXCOE_TCP                    0x0002
#define AX_TXCOE_UDP                    0x0004
#define AX_TXCOE_ICMP                   0x0008
#define AX_TXCOE_IGMP                   0x0010
#define AX_TXCOE_ICV6                   0x0020
#define AX_TXCOE_TCPV6                  0x0100
#define AX_TXCOE_UDPV6                  0x0200
#define AX_TXCOE_ICMV6                  0x0400
#define AX_TXCOE_IGMV6                  0x0800
#define AX_TXCOE_ICV6V6                 0x1000
#define AX_TXCOE_DEF_CSUM               (AX_TXCOE_TCP   | AX_TXCOE_UDP | \
                                         AX_TXCOE_TCPV6 | AX_TXCOE_UDPV6)
...
------------------------------- asix.c -----------------------------------

static int ax88772b_set_features(struct net_device *netdev, u32 features)
{
        struct usbnet *dev = netdev_priv(netdev);
        u16 tx_csum = (features & NETIF_F_HW_CSUM) ? AX_TXCOE_DEF_CSUM : 0;
        u16 rx_csum = (features & NETIF_F_RXCSUM ) ? AX_RXCOE_DEF_CSUM : 0;

        ax8817x_write_cmd(dev, AX_CMD_WRITE_TXCOE_CTL, tx_csum, 0, 0, NULL);
        ax8817x_write_cmd(dev, AX_CMD_WRITE_RXCOE_CTL, rx_csum, 0, 0, NULL);
        return 0;
}
...

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?
I am still trying to find out about all of the other possible hardware bits,
but the AX_TXCOE_DEF_CSUM and AX_RXCOE_DEF_CSUM patterns are the ones
that Asix themselves were using in the vendor driver.

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ