aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/8139cp.c
diff options
context:
space:
mode:
authorMichał Mirosław <mirq-linux@rere.qmqm.pl>2011-04-08 20:58:18 -0400
committerDavid S. Miller <davem@davemloft.net>2011-04-10 21:55:19 -0400
commit044a890c5a0fb7ac60c70bbb4e1b79e59272e504 (patch)
tree66feaa3c8790c6205d62179e32a45f32bbb0d10b /drivers/net/8139cp.c
parent350fb32ae45ec74ea9cc117c728c48b8e840f0f9 (diff)
net: 8139cp: convert to hw_features
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/8139cp.c')
-rw-r--r--drivers/net/8139cp.c46
1 files changed, 17 insertions, 29 deletions
diff --git a/drivers/net/8139cp.c b/drivers/net/8139cp.c
index dd16e83933a2..10c45051caea 100644
--- a/drivers/net/8139cp.c
+++ b/drivers/net/8139cp.c
@@ -758,8 +758,7 @@ static netdev_tx_t cp_start_xmit (struct sk_buff *skb,
758 758
759 entry = cp->tx_head; 759 entry = cp->tx_head;
760 eor = (entry == (CP_TX_RING_SIZE - 1)) ? RingEnd : 0; 760 eor = (entry == (CP_TX_RING_SIZE - 1)) ? RingEnd : 0;
761 if (dev->features & NETIF_F_TSO) 761 mss = skb_shinfo(skb)->gso_size;
762 mss = skb_shinfo(skb)->gso_size;
763 762
764 if (skb_shinfo(skb)->nr_frags == 0) { 763 if (skb_shinfo(skb)->nr_frags == 0) {
765 struct cp_desc *txd = &cp->tx_ring[entry]; 764 struct cp_desc *txd = &cp->tx_ring[entry];
@@ -1416,32 +1415,23 @@ static void cp_set_msglevel(struct net_device *dev, u32 value)
1416 cp->msg_enable = value; 1415 cp->msg_enable = value;
1417} 1416}
1418 1417
1419static u32 cp_get_rx_csum(struct net_device *dev) 1418static int cp_set_features(struct net_device *dev, u32 features)
1420{ 1419{
1421 struct cp_private *cp = netdev_priv(dev); 1420 struct cp_private *cp = netdev_priv(dev);
1422 return (cpr16(CpCmd) & RxChkSum) ? 1 : 0; 1421 unsigned long flags;
1423}
1424 1422
1425static int cp_set_rx_csum(struct net_device *dev, u32 data) 1423 if (!((dev->features ^ features) & NETIF_F_RXCSUM))
1426{ 1424 return 0;
1427 struct cp_private *cp = netdev_priv(dev);
1428 u16 cmd = cp->cpcmd, newcmd;
1429 1425
1430 newcmd = cmd; 1426 spin_lock_irqsave(&cp->lock, flags);
1431 1427
1432 if (data) 1428 if (features & NETIF_F_RXCSUM)
1433 newcmd |= RxChkSum; 1429 cp->cpcmd |= RxChkSum;
1434 else 1430 else
1435 newcmd &= ~RxChkSum; 1431 cp->cpcmd &= ~RxChkSum;
1436
1437 if (newcmd != cmd) {
1438 unsigned long flags;
1439 1432
1440 spin_lock_irqsave(&cp->lock, flags); 1433 cpw16_f(CpCmd, cp->cpcmd);
1441 cp->cpcmd = newcmd; 1434 spin_unlock_irqrestore(&cp->lock, flags);
1442 cpw16_f(CpCmd, newcmd);
1443 spin_unlock_irqrestore(&cp->lock, flags);
1444 }
1445 1435
1446 return 0; 1436 return 0;
1447} 1437}
@@ -1554,11 +1544,6 @@ static const struct ethtool_ops cp_ethtool_ops = {
1554 .get_link = ethtool_op_get_link, 1544 .get_link = ethtool_op_get_link,
1555 .get_msglevel = cp_get_msglevel, 1545 .get_msglevel = cp_get_msglevel,
1556 .set_msglevel = cp_set_msglevel, 1546 .set_msglevel = cp_set_msglevel,
1557 .get_rx_csum = cp_get_rx_csum,
1558 .set_rx_csum = cp_set_rx_csum,
1559 .set_tx_csum = ethtool_op_set_tx_csum, /* local! */
1560 .set_sg = ethtool_op_set_sg,
1561 .set_tso = ethtool_op_set_tso,
1562 .get_regs = cp_get_regs, 1547 .get_regs = cp_get_regs,
1563 .get_wol = cp_get_wol, 1548 .get_wol = cp_get_wol,
1564 .set_wol = cp_set_wol, 1549 .set_wol = cp_set_wol,
@@ -1831,6 +1816,7 @@ static const struct net_device_ops cp_netdev_ops = {
1831 .ndo_do_ioctl = cp_ioctl, 1816 .ndo_do_ioctl = cp_ioctl,
1832 .ndo_start_xmit = cp_start_xmit, 1817 .ndo_start_xmit = cp_start_xmit,
1833 .ndo_tx_timeout = cp_tx_timeout, 1818 .ndo_tx_timeout = cp_tx_timeout,
1819 .ndo_set_features = cp_set_features,
1834#if CP_VLAN_TAG_USED 1820#if CP_VLAN_TAG_USED
1835 .ndo_vlan_rx_register = cp_vlan_rx_register, 1821 .ndo_vlan_rx_register = cp_vlan_rx_register,
1836#endif 1822#endif
@@ -1934,6 +1920,9 @@ static int cp_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
1934 cp->cpcmd = (pci_using_dac ? PCIDAC : 0) | 1920 cp->cpcmd = (pci_using_dac ? PCIDAC : 0) |
1935 PCIMulRW | RxChkSum | CpRxOn | CpTxOn; 1921 PCIMulRW | RxChkSum | CpRxOn | CpTxOn;
1936 1922
1923 dev->features |= NETIF_F_RXCSUM;
1924 dev->hw_features |= NETIF_F_RXCSUM;
1925
1937 regs = ioremap(pciaddr, CP_REGS_SIZE); 1926 regs = ioremap(pciaddr, CP_REGS_SIZE);
1938 if (!regs) { 1927 if (!regs) {
1939 rc = -EIO; 1928 rc = -EIO;
@@ -1966,9 +1955,8 @@ static int cp_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
1966 if (pci_using_dac) 1955 if (pci_using_dac)
1967 dev->features |= NETIF_F_HIGHDMA; 1956 dev->features |= NETIF_F_HIGHDMA;
1968 1957
1969#if 0 /* disabled by default until verified */ 1958 /* disabled by default until verified */
1970 dev->features |= NETIF_F_TSO; 1959 dev->hw_features |= NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO;
1971#endif
1972 1960
1973 dev->irq = pdev->irq; 1961 dev->irq = pdev->irq;
1974 1962