diff options
author | Michał Mirosław <mirq-linux@rere.qmqm.pl> | 2011-04-16 09:05:08 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-04-17 20:51:32 -0400 |
commit | 2ed28baa7076083b56c1e70ccd927b7870117c59 (patch) | |
tree | ced1c729cb6c7fee217e3a58989cbb8d93d07c83 /drivers/net/cxgb4vf | |
parent | c582a950b1d7488750831cb4499de071781c7f45 (diff) |
net: cxgb4{,vf}: convert to hw_features
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Acked-by: Dimitris Michailidis <dm@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/cxgb4vf')
-rw-r--r-- | drivers/net/cxgb4vf/adapter.h | 6 | ||||
-rw-r--r-- | drivers/net/cxgb4vf/cxgb4vf_main.c | 57 | ||||
-rw-r--r-- | drivers/net/cxgb4vf/sge.c | 4 |
3 files changed, 10 insertions, 57 deletions
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 */ | ||
107 | enum { | ||
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 | */ | ||
1331 | static 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 | */ | ||
1341 | static 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 | */ |
1355 | static int cxgb4vf_phys_id(struct net_device *dev, | 1331 | static 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 | */ | ||
1575 | static 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 | |||
1584 | static struct ethtool_ops cxgb4vf_ethtool_ops = { | 1548 | static 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 { |