aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/cxgb4
diff options
context:
space:
mode:
authorMichał Mirosław <mirq-linux@rere.qmqm.pl>2011-04-16 09:05:08 -0400
committerDavid S. Miller <davem@davemloft.net>2011-04-17 20:51:32 -0400
commit2ed28baa7076083b56c1e70ccd927b7870117c59 (patch)
treeced1c729cb6c7fee217e3a58989cbb8d93d07c83 /drivers/net/cxgb4
parentc582a950b1d7488750831cb4499de071781c7f45 (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/cxgb4')
-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
3 files changed, 18 insertions, 64 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;