aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/cxgb4/cxgb4.h6
-rw-r--r--drivers/net/cxgb4/cxgb4_main.c72
-rw-r--r--drivers/net/cxgb4/sge.c4
-rw-r--r--drivers/net/cxgb4vf/adapter.h6
-rw-r--r--drivers/net/cxgb4vf/cxgb4vf_main.c57
-rw-r--r--drivers/net/cxgb4vf/sge.c4
6 files changed, 28 insertions, 121 deletions
diff --git a/drivers/net/cxgb4/cxgb4.h b/drivers/net/cxgb4/cxgb4.h
index 01d49eaa44d2..bc9982a4c1f4 100644
--- a/drivers/net/cxgb4/cxgb4.h
+++ b/drivers/net/cxgb4/cxgb4.h
@@ -290,7 +290,6 @@ struct port_info {
290 u8 port_id; 290 u8 port_id;
291 u8 tx_chan; 291 u8 tx_chan;
292 u8 lport; /* associated offload logical port */ 292 u8 lport; /* associated offload logical port */
293 u8 rx_offload; /* CSO, etc */
294 u8 nqsets; /* # of qsets */ 293 u8 nqsets; /* # of qsets */
295 u8 first_qset; /* index of first qset */ 294 u8 first_qset; /* index of first qset */
296 u8 rss_mode; 295 u8 rss_mode;
@@ -298,11 +297,6 @@ struct port_info {
298 u16 *rss; 297 u16 *rss;
299}; 298};
300 299
301/* port_info.rx_offload flags */
302enum {
303 RX_CSO = 1 << 0,
304};
305
306struct dentry; 300struct dentry;
307struct work_struct; 301struct work_struct;
308 302
diff --git a/drivers/net/cxgb4/cxgb4_main.c b/drivers/net/cxgb4/cxgb4_main.c
index 0af9c9f0ca78..bdc868ca47ec 100644
--- a/drivers/net/cxgb4/cxgb4_main.c
+++ b/drivers/net/cxgb4/cxgb4_main.c
@@ -1531,24 +1531,6 @@ static int set_pauseparam(struct net_device *dev,
1531 return 0; 1531 return 0;
1532} 1532}
1533 1533
1534static u32 get_rx_csum(struct net_device *dev)
1535{
1536 struct port_info *p = netdev_priv(dev);
1537
1538 return p->rx_offload & RX_CSO;
1539}
1540
1541static int set_rx_csum(struct net_device *dev, u32 data)
1542{
1543 struct port_info *p = netdev_priv(dev);
1544
1545 if (data)
1546 p->rx_offload |= RX_CSO;
1547 else
1548 p->rx_offload &= ~RX_CSO;
1549 return 0;
1550}
1551
1552static void get_sge_param(struct net_device *dev, struct ethtool_ringparam *e) 1534static void get_sge_param(struct net_device *dev, struct ethtool_ringparam *e)
1553{ 1535{
1554 const struct port_info *pi = netdev_priv(dev); 1536 const struct port_info *pi = netdev_priv(dev);
@@ -1870,36 +1852,20 @@ static int set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
1870 return err; 1852 return err;
1871} 1853}
1872 1854
1873#define TSO_FLAGS (NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_TSO_ECN) 1855static int cxgb_set_features(struct net_device *dev, u32 features)
1874
1875static int set_tso(struct net_device *dev, u32 value)
1876{
1877 if (value)
1878 dev->features |= TSO_FLAGS;
1879 else
1880 dev->features &= ~TSO_FLAGS;
1881 return 0;
1882}
1883
1884static int set_flags(struct net_device *dev, u32 flags)
1885{ 1856{
1857 const struct port_info *pi = netdev_priv(dev);
1858 u32 changed = dev->features ^ features;
1886 int err; 1859 int err;
1887 unsigned long old_feat = dev->features;
1888
1889 err = ethtool_op_set_flags(dev, flags, ETH_FLAG_RXHASH |
1890 ETH_FLAG_RXVLAN | ETH_FLAG_TXVLAN);
1891 if (err)
1892 return err;
1893 1860
1894 if ((old_feat ^ dev->features) & NETIF_F_HW_VLAN_RX) { 1861 if (!(changed & NETIF_F_HW_VLAN_RX))
1895 const struct port_info *pi = netdev_priv(dev); 1862 return 0;
1896 1863
1897 err = t4_set_rxmode(pi->adapter, pi->adapter->fn, pi->viid, -1, 1864 err = t4_set_rxmode(pi->adapter, pi->adapter->fn, pi->viid, -1,
1898 -1, -1, -1, !!(flags & ETH_FLAG_RXVLAN), 1865 -1, -1, -1,
1899 true); 1866 !!(features & NETIF_F_HW_VLAN_RX), true);
1900 if (err) 1867 if (unlikely(err))
1901 dev->features = old_feat; 1868 dev->features = features ^ NETIF_F_HW_VLAN_RX;
1902 }
1903 return err; 1869 return err;
1904} 1870}
1905 1871
@@ -2010,10 +1976,6 @@ static struct ethtool_ops cxgb_ethtool_ops = {
2010 .set_eeprom = set_eeprom, 1976 .set_eeprom = set_eeprom,
2011 .get_pauseparam = get_pauseparam, 1977 .get_pauseparam = get_pauseparam,
2012 .set_pauseparam = set_pauseparam, 1978 .set_pauseparam = set_pauseparam,
2013 .get_rx_csum = get_rx_csum,
2014 .set_rx_csum = set_rx_csum,
2015 .set_tx_csum = ethtool_op_set_tx_ipv6_csum,
2016 .set_sg = ethtool_op_set_sg,
2017 .get_link = ethtool_op_get_link, 1979 .get_link = ethtool_op_get_link,
2018 .get_strings = get_strings, 1980 .get_strings = get_strings,
2019 .set_phys_id = identify_port, 1981 .set_phys_id = identify_port,
@@ -2024,8 +1986,6 @@ static struct ethtool_ops cxgb_ethtool_ops = {
2024 .get_regs = get_regs, 1986 .get_regs = get_regs,
2025 .get_wol = get_wol, 1987 .get_wol = get_wol,
2026 .set_wol = set_wol, 1988 .set_wol = set_wol,
2027 .set_tso = set_tso,
2028 .set_flags = set_flags,
2029 .get_rxnfc = get_rxnfc, 1989 .get_rxnfc = get_rxnfc,
2030 .get_rxfh_indir = get_rss_table, 1990 .get_rxfh_indir = get_rss_table,
2031 .set_rxfh_indir = set_rss_table, 1991 .set_rxfh_indir = set_rss_table,
@@ -2882,6 +2842,7 @@ static const struct net_device_ops cxgb4_netdev_ops = {
2882 .ndo_get_stats64 = cxgb_get_stats, 2842 .ndo_get_stats64 = cxgb_get_stats,
2883 .ndo_set_rx_mode = cxgb_set_rxmode, 2843 .ndo_set_rx_mode = cxgb_set_rxmode,
2884 .ndo_set_mac_address = cxgb_set_mac_addr, 2844 .ndo_set_mac_address = cxgb_set_mac_addr,
2845 .ndo_set_features = cxgb_set_features,
2885 .ndo_validate_addr = eth_validate_addr, 2846 .ndo_validate_addr = eth_validate_addr,
2886 .ndo_do_ioctl = cxgb_ioctl, 2847 .ndo_do_ioctl = cxgb_ioctl,
2887 .ndo_change_mtu = cxgb_change_mtu, 2848 .ndo_change_mtu = cxgb_change_mtu,
@@ -3564,6 +3525,7 @@ static void free_some_resources(struct adapter *adapter)
3564 t4_fw_bye(adapter, adapter->fn); 3525 t4_fw_bye(adapter, adapter->fn);
3565} 3526}
3566 3527
3528#define TSO_FLAGS (NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_TSO_ECN)
3567#define VLAN_FEAT (NETIF_F_SG | NETIF_F_IP_CSUM | TSO_FLAGS | \ 3529#define VLAN_FEAT (NETIF_F_SG | NETIF_F_IP_CSUM | TSO_FLAGS | \
3568 NETIF_F_IPV6_CSUM | NETIF_F_HIGHDMA) 3530 NETIF_F_IPV6_CSUM | NETIF_F_HIGHDMA)
3569 3531
@@ -3665,14 +3627,14 @@ static int __devinit init_one(struct pci_dev *pdev,
3665 pi = netdev_priv(netdev); 3627 pi = netdev_priv(netdev);
3666 pi->adapter = adapter; 3628 pi->adapter = adapter;
3667 pi->xact_addr_filt = -1; 3629 pi->xact_addr_filt = -1;
3668 pi->rx_offload = RX_CSO;
3669 pi->port_id = i; 3630 pi->port_id = i;
3670 netdev->irq = pdev->irq; 3631 netdev->irq = pdev->irq;
3671 3632
3672 netdev->features |= NETIF_F_SG | TSO_FLAGS; 3633 netdev->hw_features = NETIF_F_SG | TSO_FLAGS |
3673 netdev->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; 3634 NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
3674 netdev->features |= NETIF_F_GRO | NETIF_F_RXHASH | highdma; 3635 NETIF_F_RXCSUM | NETIF_F_RXHASH |
3675 netdev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; 3636 NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
3637 netdev->features |= netdev->hw_features | highdma;
3676 netdev->vlan_features = netdev->features & VLAN_FEAT; 3638 netdev->vlan_features = netdev->features & VLAN_FEAT;
3677 3639
3678 netdev->netdev_ops = &cxgb4_netdev_ops; 3640 netdev->netdev_ops = &cxgb4_netdev_ops;
diff --git a/drivers/net/cxgb4/sge.c b/drivers/net/cxgb4/sge.c
index 311471b439a8..75a4b0fa19ee 100644
--- a/drivers/net/cxgb4/sge.c
+++ b/drivers/net/cxgb4/sge.c
@@ -1556,7 +1556,6 @@ int t4_ethrx_handler(struct sge_rspq *q, const __be64 *rsp,
1556{ 1556{
1557 bool csum_ok; 1557 bool csum_ok;
1558 struct sk_buff *skb; 1558 struct sk_buff *skb;
1559 struct port_info *pi;
1560 const struct cpl_rx_pkt *pkt; 1559 const struct cpl_rx_pkt *pkt;
1561 struct sge_eth_rxq *rxq = container_of(q, struct sge_eth_rxq, rspq); 1560 struct sge_eth_rxq *rxq = container_of(q, struct sge_eth_rxq, rspq);
1562 1561
@@ -1584,10 +1583,9 @@ int t4_ethrx_handler(struct sge_rspq *q, const __be64 *rsp,
1584 if (skb->dev->features & NETIF_F_RXHASH) 1583 if (skb->dev->features & NETIF_F_RXHASH)
1585 skb->rxhash = (__force u32)pkt->rsshdr.hash_val; 1584 skb->rxhash = (__force u32)pkt->rsshdr.hash_val;
1586 1585
1587 pi = netdev_priv(skb->dev);
1588 rxq->stats.pkts++; 1586 rxq->stats.pkts++;
1589 1587
1590 if (csum_ok && (pi->rx_offload & RX_CSO) && 1588 if (csum_ok && (q->netdev->features & NETIF_F_RXCSUM) &&
1591 (pkt->l2info & htonl(RXF_UDP | RXF_TCP))) { 1589 (pkt->l2info & htonl(RXF_UDP | RXF_TCP))) {
1592 if (!pkt->ip_frag) { 1590 if (!pkt->ip_frag) {
1593 skb->ip_summed = CHECKSUM_UNNECESSARY; 1591 skb->ip_summed = CHECKSUM_UNNECESSARY;
diff --git a/drivers/net/cxgb4vf/adapter.h b/drivers/net/cxgb4vf/adapter.h
index 4766b4116b41..4fd821aadc8a 100644
--- a/drivers/net/cxgb4vf/adapter.h
+++ b/drivers/net/cxgb4vf/adapter.h
@@ -97,17 +97,11 @@ struct port_info {
97 u16 rss_size; /* size of VI's RSS table slice */ 97 u16 rss_size; /* size of VI's RSS table slice */
98 u8 pidx; /* index into adapter port[] */ 98 u8 pidx; /* index into adapter port[] */
99 u8 port_id; /* physical port ID */ 99 u8 port_id; /* physical port ID */
100 u8 rx_offload; /* CSO, etc. */
101 u8 nqsets; /* # of "Queue Sets" */ 100 u8 nqsets; /* # of "Queue Sets" */
102 u8 first_qset; /* index of first "Queue Set" */ 101 u8 first_qset; /* index of first "Queue Set" */
103 struct link_config link_cfg; /* physical port configuration */ 102 struct link_config link_cfg; /* physical port configuration */
104}; 103};
105 104
106/* port_info.rx_offload flags */
107enum {
108 RX_CSO = 1 << 0,
109};
110
111/* 105/*
112 * Scatter Gather Engine resources for the "adapter". Our ingress and egress 106 * Scatter Gather Engine resources for the "adapter". Our ingress and egress
113 * queues are organized into "Queue Sets" with one ingress and one egress 107 * queues are organized into "Queue Sets" with one ingress and one egress
diff --git a/drivers/net/cxgb4vf/cxgb4vf_main.c b/drivers/net/cxgb4vf/cxgb4vf_main.c
index c662679de4fa..8cf9890cafaf 100644
--- a/drivers/net/cxgb4vf/cxgb4vf_main.c
+++ b/drivers/net/cxgb4vf/cxgb4vf_main.c
@@ -1326,30 +1326,6 @@ static void cxgb4vf_get_pauseparam(struct net_device *dev,
1326} 1326}
1327 1327
1328/* 1328/*
1329 * Return whether RX Checksum Offloading is currently enabled for the device.
1330 */
1331static u32 cxgb4vf_get_rx_csum(struct net_device *dev)
1332{
1333 struct port_info *pi = netdev_priv(dev);
1334
1335 return (pi->rx_offload & RX_CSO) != 0;
1336}
1337
1338/*
1339 * Turn RX Checksum Offloading on or off for the device.
1340 */
1341static int cxgb4vf_set_rx_csum(struct net_device *dev, u32 csum)
1342{
1343 struct port_info *pi = netdev_priv(dev);
1344
1345 if (csum)
1346 pi->rx_offload |= RX_CSO;
1347 else
1348 pi->rx_offload &= ~RX_CSO;
1349 return 0;
1350}
1351
1352/*
1353 * Identify the port by blinking the port's LED. 1329 * Identify the port by blinking the port's LED.
1354 */ 1330 */
1355static int cxgb4vf_phys_id(struct net_device *dev, 1331static int cxgb4vf_phys_id(struct net_device *dev,
@@ -1569,18 +1545,6 @@ static void cxgb4vf_get_wol(struct net_device *dev,
1569 */ 1545 */
1570#define TSO_FLAGS (NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_TSO_ECN) 1546#define TSO_FLAGS (NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_TSO_ECN)
1571 1547
1572/*
1573 * Set TCP Segmentation Offloading feature capabilities.
1574 */
1575static int cxgb4vf_set_tso(struct net_device *dev, u32 tso)
1576{
1577 if (tso)
1578 dev->features |= TSO_FLAGS;
1579 else
1580 dev->features &= ~TSO_FLAGS;
1581 return 0;
1582}
1583
1584static struct ethtool_ops cxgb4vf_ethtool_ops = { 1548static struct ethtool_ops cxgb4vf_ethtool_ops = {
1585 .get_settings = cxgb4vf_get_settings, 1549 .get_settings = cxgb4vf_get_settings,
1586 .get_drvinfo = cxgb4vf_get_drvinfo, 1550 .get_drvinfo = cxgb4vf_get_drvinfo,
@@ -1591,10 +1555,6 @@ static struct ethtool_ops cxgb4vf_ethtool_ops = {
1591 .get_coalesce = cxgb4vf_get_coalesce, 1555 .get_coalesce = cxgb4vf_get_coalesce,
1592 .set_coalesce = cxgb4vf_set_coalesce, 1556 .set_coalesce = cxgb4vf_set_coalesce,
1593 .get_pauseparam = cxgb4vf_get_pauseparam, 1557 .get_pauseparam = cxgb4vf_get_pauseparam,
1594 .get_rx_csum = cxgb4vf_get_rx_csum,
1595 .set_rx_csum = cxgb4vf_set_rx_csum,
1596 .set_tx_csum = ethtool_op_set_tx_ipv6_csum,
1597 .set_sg = ethtool_op_set_sg,
1598 .get_link = ethtool_op_get_link, 1558 .get_link = ethtool_op_get_link,
1599 .get_strings = cxgb4vf_get_strings, 1559 .get_strings = cxgb4vf_get_strings,
1600 .set_phys_id = cxgb4vf_phys_id, 1560 .set_phys_id = cxgb4vf_phys_id,
@@ -1603,7 +1563,6 @@ static struct ethtool_ops cxgb4vf_ethtool_ops = {
1603 .get_regs_len = cxgb4vf_get_regs_len, 1563 .get_regs_len = cxgb4vf_get_regs_len,
1604 .get_regs = cxgb4vf_get_regs, 1564 .get_regs = cxgb4vf_get_regs,
1605 .get_wol = cxgb4vf_get_wol, 1565 .get_wol = cxgb4vf_get_wol,
1606 .set_tso = cxgb4vf_set_tso,
1607}; 1566};
1608 1567
1609/* 1568/*
@@ -2638,19 +2597,19 @@ static int __devinit cxgb4vf_pci_probe(struct pci_dev *pdev,
2638 * it. 2597 * it.
2639 */ 2598 */
2640 pi->xact_addr_filt = -1; 2599 pi->xact_addr_filt = -1;
2641 pi->rx_offload = RX_CSO;
2642 netif_carrier_off(netdev); 2600 netif_carrier_off(netdev);
2643 netdev->irq = pdev->irq; 2601 netdev->irq = pdev->irq;
2644 2602
2645 netdev->features = (NETIF_F_SG | TSO_FLAGS | 2603 netdev->hw_features = NETIF_F_SG | TSO_FLAGS |
2646 NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | 2604 NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
2647 NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX | 2605 NETIF_F_HW_VLAN_TX | NETIF_F_RXCSUM;
2648 NETIF_F_GRO); 2606 netdev->vlan_features = NETIF_F_SG | TSO_FLAGS |
2607 NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
2608 NETIF_F_HIGHDMA;
2609 netdev->features = netdev->hw_features |
2610 NETIF_F_HW_VLAN_RX;
2649 if (pci_using_dac) 2611 if (pci_using_dac)
2650 netdev->features |= NETIF_F_HIGHDMA; 2612 netdev->features |= NETIF_F_HIGHDMA;
2651 netdev->vlan_features =
2652 (netdev->features &
2653 ~(NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX));
2654 2613
2655#ifdef HAVE_NET_DEVICE_OPS 2614#ifdef HAVE_NET_DEVICE_OPS
2656 netdev->netdev_ops = &cxgb4vf_netdev_ops; 2615 netdev->netdev_ops = &cxgb4vf_netdev_ops;
diff --git a/drivers/net/cxgb4vf/sge.c b/drivers/net/cxgb4vf/sge.c
index bb65121f581c..5182960e29fd 100644
--- a/drivers/net/cxgb4vf/sge.c
+++ b/drivers/net/cxgb4vf/sge.c
@@ -1555,8 +1555,8 @@ int t4vf_ethrx_handler(struct sge_rspq *rspq, const __be64 *rsp,
1555 pi = netdev_priv(skb->dev); 1555 pi = netdev_priv(skb->dev);
1556 rxq->stats.pkts++; 1556 rxq->stats.pkts++;
1557 1557
1558 if (csum_ok && (pi->rx_offload & RX_CSO) && !pkt->err_vec && 1558 if (csum_ok && (rspq->netdev->features & NETIF_F_RXCSUM) &&
1559 (be32_to_cpu(pkt->l2info) & (RXF_UDP|RXF_TCP))) { 1559 !pkt->err_vec && (be32_to_cpu(pkt->l2info) & (RXF_UDP|RXF_TCP))) {
1560 if (!pkt->ip_frag) 1560 if (!pkt->ip_frag)
1561 skb->ip_summed = CHECKSUM_UNNECESSARY; 1561 skb->ip_summed = CHECKSUM_UNNECESSARY;
1562 else { 1562 else {