smsc95xx.c (6b7781b42dc9bc9bcd1523b6c24b876cdda0bef3) smsc95xx.c (fe0cd8ca1b82983db24b173bb8518ea646c02d25)
1 /***************************************************************************
2 *
3 * Copyright (C) 2007-2008 SMSC
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.

--- 667 unchanged lines hidden (view full) ---

676 struct usbnet *dev = netdev_priv(netdev);
677 u32 read_buf;
678 int ret;
679
680 ret = smsc95xx_read_reg(dev, COE_CR, &read_buf);
681 if (ret < 0)
682 return ret;
683
1 /***************************************************************************
2 *
3 * Copyright (C) 2007-2008 SMSC
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.

--- 667 unchanged lines hidden (view full) ---

676 struct usbnet *dev = netdev_priv(netdev);
677 u32 read_buf;
678 int ret;
679
680 ret = smsc95xx_read_reg(dev, COE_CR, &read_buf);
681 if (ret < 0)
682 return ret;
683
684 if (features & NETIF_F_HW_CSUM)
684 if (features & NETIF_F_IP_CSUM)
685 read_buf |= Tx_COE_EN_;
686 else
687 read_buf &= ~Tx_COE_EN_;
688
689 if (features & NETIF_F_RXCSUM)
690 read_buf |= Rx_COE_EN_;
691 else
692 read_buf &= ~Rx_COE_EN_;

--- 581 unchanged lines hidden (view full) ---

1274 GFP_KERNEL);
1275
1276 pdata = (struct smsc95xx_priv *)(dev->data[0]);
1277 if (!pdata)
1278 return -ENOMEM;
1279
1280 spin_lock_init(&pdata->mac_cr_lock);
1281
685 read_buf |= Tx_COE_EN_;
686 else
687 read_buf &= ~Tx_COE_EN_;
688
689 if (features & NETIF_F_RXCSUM)
690 read_buf |= Rx_COE_EN_;
691 else
692 read_buf &= ~Rx_COE_EN_;

--- 581 unchanged lines hidden (view full) ---

1274 GFP_KERNEL);
1275
1276 pdata = (struct smsc95xx_priv *)(dev->data[0]);
1277 if (!pdata)
1278 return -ENOMEM;
1279
1280 spin_lock_init(&pdata->mac_cr_lock);
1281
1282 /* LAN95xx devices do not alter the computed checksum of 0 to 0xffff.
1283 * RFC 2460, ipv6 UDP calculated checksum yields a result of zero must
1284 * be changed to 0xffff. RFC 768, ipv4 UDP computed checksum is zero,
1285 * it is transmitted as all ones. The zero transmitted checksum means
1286 * transmitter generated no checksum. Hence, enable csum offload only
1287 * for ipv4 packets.
1288 */
1282 if (DEFAULT_TX_CSUM_ENABLE)
1289 if (DEFAULT_TX_CSUM_ENABLE)
1283 dev->net->features |= NETIF_F_HW_CSUM;
1290 dev->net->features |= NETIF_F_IP_CSUM;
1284 if (DEFAULT_RX_CSUM_ENABLE)
1285 dev->net->features |= NETIF_F_RXCSUM;
1286
1291 if (DEFAULT_RX_CSUM_ENABLE)
1292 dev->net->features |= NETIF_F_RXCSUM;
1293
1287 dev->net->hw_features = NETIF_F_HW_CSUM | NETIF_F_RXCSUM;
1294 dev->net->hw_features = NETIF_F_IP_CSUM | NETIF_F_RXCSUM;
1288
1289 smsc95xx_init_mac_address(dev);
1290
1291 /* Init all registers */
1292 ret = smsc95xx_reset(dev);
1293
1294 /* detect device revision as different features may be available */
1295 ret = smsc95xx_read_reg(dev, ID_REV, &val);

--- 899 unchanged lines hidden ---
1295
1296 smsc95xx_init_mac_address(dev);
1297
1298 /* Init all registers */
1299 ret = smsc95xx_reset(dev);
1300
1301 /* detect device revision as different features may be available */
1302 ret = smsc95xx_read_reg(dev, ID_REV, &val);

--- 899 unchanged lines hidden ---