Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Michał Mirosław and committed by
David S. Miller
044a890c 350fb32a

+17 -29
+17 -29
drivers/net/8139cp.c
··· 758 758 759 759 entry = cp->tx_head; 760 760 eor = (entry == (CP_TX_RING_SIZE - 1)) ? RingEnd : 0; 761 - if (dev->features & NETIF_F_TSO) 762 - mss = skb_shinfo(skb)->gso_size; 761 + mss = skb_shinfo(skb)->gso_size; 763 762 764 763 if (skb_shinfo(skb)->nr_frags == 0) { 765 764 struct cp_desc *txd = &cp->tx_ring[entry]; ··· 1415 1416 cp->msg_enable = value; 1416 1417 } 1417 1418 1418 - static u32 cp_get_rx_csum(struct net_device *dev) 1419 + static int cp_set_features(struct net_device *dev, u32 features) 1419 1420 { 1420 1421 struct cp_private *cp = netdev_priv(dev); 1421 - return (cpr16(CpCmd) & RxChkSum) ? 1 : 0; 1422 - } 1422 + unsigned long flags; 1423 1423 1424 - static int cp_set_rx_csum(struct net_device *dev, u32 data) 1425 - { 1426 - struct cp_private *cp = netdev_priv(dev); 1427 - u16 cmd = cp->cpcmd, newcmd; 1424 + if (!((dev->features ^ features) & NETIF_F_RXCSUM)) 1425 + return 0; 1428 1426 1429 - newcmd = cmd; 1427 + spin_lock_irqsave(&cp->lock, flags); 1430 1428 1431 - if (data) 1432 - newcmd |= RxChkSum; 1429 + if (features & NETIF_F_RXCSUM) 1430 + cp->cpcmd |= RxChkSum; 1433 1431 else 1434 - newcmd &= ~RxChkSum; 1432 + cp->cpcmd &= ~RxChkSum; 1435 1433 1436 - if (newcmd != cmd) { 1437 - unsigned long flags; 1438 - 1439 - spin_lock_irqsave(&cp->lock, flags); 1440 - cp->cpcmd = newcmd; 1441 - cpw16_f(CpCmd, newcmd); 1442 - spin_unlock_irqrestore(&cp->lock, flags); 1443 - } 1434 + cpw16_f(CpCmd, cp->cpcmd); 1435 + spin_unlock_irqrestore(&cp->lock, flags); 1444 1436 1445 1437 return 0; 1446 1438 } ··· 1544 1554 .get_link = ethtool_op_get_link, 1545 1555 .get_msglevel = cp_get_msglevel, 1546 1556 .set_msglevel = cp_set_msglevel, 1547 - .get_rx_csum = cp_get_rx_csum, 1548 - .set_rx_csum = cp_set_rx_csum, 1549 - .set_tx_csum = ethtool_op_set_tx_csum, /* local! */ 1550 - .set_sg = ethtool_op_set_sg, 1551 - .set_tso = ethtool_op_set_tso, 1552 1557 .get_regs = cp_get_regs, 1553 1558 .get_wol = cp_get_wol, 1554 1559 .set_wol = cp_set_wol, ··· 1816 1831 .ndo_do_ioctl = cp_ioctl, 1817 1832 .ndo_start_xmit = cp_start_xmit, 1818 1833 .ndo_tx_timeout = cp_tx_timeout, 1834 + .ndo_set_features = cp_set_features, 1819 1835 #if CP_VLAN_TAG_USED 1820 1836 .ndo_vlan_rx_register = cp_vlan_rx_register, 1821 1837 #endif ··· 1920 1934 cp->cpcmd = (pci_using_dac ? PCIDAC : 0) | 1921 1935 PCIMulRW | RxChkSum | CpRxOn | CpTxOn; 1922 1936 1937 + dev->features |= NETIF_F_RXCSUM; 1938 + dev->hw_features |= NETIF_F_RXCSUM; 1939 + 1923 1940 regs = ioremap(pciaddr, CP_REGS_SIZE); 1924 1941 if (!regs) { 1925 1942 rc = -EIO; ··· 1955 1966 if (pci_using_dac) 1956 1967 dev->features |= NETIF_F_HIGHDMA; 1957 1968 1958 - #if 0 /* disabled by default until verified */ 1959 - dev->features |= NETIF_F_TSO; 1960 - #endif 1969 + /* disabled by default until verified */ 1970 + dev->hw_features |= NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO; 1961 1971 1962 1972 dev->irq = pdev->irq; 1963 1973