lkml.org 
[lkml]   [2011]   [Nov]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH] drivers/net/usb/asix: resync from vendor's copy
    On 11-11-09 11:57 AM, Mark Lord wrote:
    > On 11-11-09 11:47 AM, Mark Lord wrote:
    > ..
    >> Note: I'm looking at smsc95xx.c and smsc75xx.c for examples,
    >> and they both have the same problem I'll have here:
    >>
    >> How to update the csum settings atomically.
    >> A spinlock is no good, because config register access is over USB.
    >
    > Nevermind.. a slight change in the logic and all is well again.
    ..

    Or even simpler (below). I don't think this method requires any
    extra locking, but I'm still open to persuasion. :)


    static int ax88772b_set_features(struct net_device *netdev, u32 features)
    {
    struct usbnet *dev = netdev_priv(netdev);
    struct ax88772b_data *priv = (struct ax88772b_data *)dev->driver_priv;
    u16 tx_csum = 0, rx_csum = 0;

    priv->features = features & (NETIF_F_HW_CSUM | NETIF_F_RXCSUM);
    if (features & NETIF_F_HW_CSUM)
    tx_csum = AX_TXCOE_DEF_CSUM;
    if (features & NETIF_F_RXCSUM)
    rx_csum = AX_RXCOE_DEF_CSUM;
    ax8817x_write_cmd(dev, AX_CMD_WRITE_RXCOE_CTL, rx_csum, 0, 0, NULL);
    ax8817x_write_cmd(dev, AX_CMD_WRITE_TXCOE_CTL, tx_csum, 0, 0, NULL);
    return 0;
    }



    \
     
     \ /
      Last update: 2011-11-09 18:23    [W:5.306 / U:0.020 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site