aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/chelsio/cxgb2.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/chelsio/cxgb2.c')
-rw-r--r--drivers/net/chelsio/cxgb2.c59
1 files changed, 13 insertions, 46 deletions
diff --git a/drivers/net/chelsio/cxgb2.c b/drivers/net/chelsio/cxgb2.c
index 0f71304e0542..b422d83f5343 100644
--- a/drivers/net/chelsio/cxgb2.c
+++ b/drivers/net/chelsio/cxgb2.c
@@ -192,10 +192,8 @@ static void link_start(struct port_info *p)
192 192
193static void enable_hw_csum(struct adapter *adapter) 193static void enable_hw_csum(struct adapter *adapter)
194{ 194{
195 if (adapter->flags & TSO_CAPABLE) 195 if (adapter->port[0].dev->hw_features & NETIF_F_TSO)
196 t1_tp_set_ip_checksum_offload(adapter->tp, 1); /* for TSO only */ 196 t1_tp_set_ip_checksum_offload(adapter->tp, 1); /* for TSO only */
197 if (adapter->flags & UDP_CSUM_CAPABLE)
198 t1_tp_set_udp_checksum_offload(adapter->tp, 1);
199 t1_tp_set_tcp_checksum_offload(adapter->tp, 1); 197 t1_tp_set_tcp_checksum_offload(adapter->tp, 1);
200} 198}
201 199
@@ -579,10 +577,10 @@ static int get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
579 cmd->advertising = p->link_config.advertising; 577 cmd->advertising = p->link_config.advertising;
580 578
581 if (netif_carrier_ok(dev)) { 579 if (netif_carrier_ok(dev)) {
582 cmd->speed = p->link_config.speed; 580 ethtool_cmd_speed_set(cmd, p->link_config.speed);
583 cmd->duplex = p->link_config.duplex; 581 cmd->duplex = p->link_config.duplex;
584 } else { 582 } else {
585 cmd->speed = -1; 583 ethtool_cmd_speed_set(cmd, -1);
586 cmd->duplex = -1; 584 cmd->duplex = -1;
587 } 585 }
588 586
@@ -640,11 +638,12 @@ static int set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
640 return -EOPNOTSUPP; /* can't change speed/duplex */ 638 return -EOPNOTSUPP; /* can't change speed/duplex */
641 639
642 if (cmd->autoneg == AUTONEG_DISABLE) { 640 if (cmd->autoneg == AUTONEG_DISABLE) {
643 int cap = speed_duplex_to_caps(cmd->speed, cmd->duplex); 641 u32 speed = ethtool_cmd_speed(cmd);
642 int cap = speed_duplex_to_caps(speed, cmd->duplex);
644 643
645 if (!(lc->supported & cap) || cmd->speed == SPEED_1000) 644 if (!(lc->supported & cap) || (speed == SPEED_1000))
646 return -EINVAL; 645 return -EINVAL;
647 lc->requested_speed = cmd->speed; 646 lc->requested_speed = speed;
648 lc->requested_duplex = cmd->duplex; 647 lc->requested_duplex = cmd->duplex;
649 lc->advertising = 0; 648 lc->advertising = 0;
650 } else { 649 } else {
@@ -705,33 +704,6 @@ static int set_pauseparam(struct net_device *dev,
705 return 0; 704 return 0;
706} 705}
707 706
708static u32 get_rx_csum(struct net_device *dev)
709{
710 struct adapter *adapter = dev->ml_priv;
711
712 return (adapter->flags & RX_CSUM_ENABLED) != 0;
713}
714
715static int set_rx_csum(struct net_device *dev, u32 data)
716{
717 struct adapter *adapter = dev->ml_priv;
718
719 if (data)
720 adapter->flags |= RX_CSUM_ENABLED;
721 else
722 adapter->flags &= ~RX_CSUM_ENABLED;
723 return 0;
724}
725
726static int set_tso(struct net_device *dev, u32 value)
727{
728 struct adapter *adapter = dev->ml_priv;
729
730 if (!(adapter->flags & TSO_CAPABLE))
731 return value ? -EOPNOTSUPP : 0;
732 return ethtool_op_set_tso(dev, value);
733}
734
735static void get_sge_param(struct net_device *dev, struct ethtool_ringparam *e) 707static void get_sge_param(struct net_device *dev, struct ethtool_ringparam *e)
736{ 708{
737 struct adapter *adapter = dev->ml_priv; 709 struct adapter *adapter = dev->ml_priv;
@@ -831,17 +803,12 @@ static const struct ethtool_ops t1_ethtool_ops = {
831 .get_eeprom = get_eeprom, 803 .get_eeprom = get_eeprom,
832 .get_pauseparam = get_pauseparam, 804 .get_pauseparam = get_pauseparam,
833 .set_pauseparam = set_pauseparam, 805 .set_pauseparam = set_pauseparam,
834 .get_rx_csum = get_rx_csum,
835 .set_rx_csum = set_rx_csum,
836 .set_tx_csum = ethtool_op_set_tx_csum,
837 .set_sg = ethtool_op_set_sg,
838 .get_link = ethtool_op_get_link, 806 .get_link = ethtool_op_get_link,
839 .get_strings = get_strings, 807 .get_strings = get_strings,
840 .get_sset_count = get_sset_count, 808 .get_sset_count = get_sset_count,
841 .get_ethtool_stats = get_stats, 809 .get_ethtool_stats = get_stats,
842 .get_regs_len = get_regs_len, 810 .get_regs_len = get_regs_len,
843 .get_regs = get_regs, 811 .get_regs = get_regs,
844 .set_tso = set_tso,
845}; 812};
846 813
847static int t1_ioctl(struct net_device *dev, struct ifreq *req, int cmd) 814static int t1_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
@@ -1105,28 +1072,28 @@ static int __devinit init_one(struct pci_dev *pdev,
1105 netdev->mem_start = mmio_start; 1072 netdev->mem_start = mmio_start;
1106 netdev->mem_end = mmio_start + mmio_len - 1; 1073 netdev->mem_end = mmio_start + mmio_len - 1;
1107 netdev->ml_priv = adapter; 1074 netdev->ml_priv = adapter;
1108 netdev->features |= NETIF_F_SG | NETIF_F_IP_CSUM; 1075 netdev->hw_features |= NETIF_F_SG | NETIF_F_IP_CSUM |
1109 netdev->features |= NETIF_F_LLTX; 1076 NETIF_F_RXCSUM;
1077 netdev->features |= NETIF_F_SG | NETIF_F_IP_CSUM |
1078 NETIF_F_RXCSUM | NETIF_F_LLTX;
1110 1079
1111 adapter->flags |= RX_CSUM_ENABLED | TCP_CSUM_CAPABLE;
1112 if (pci_using_dac) 1080 if (pci_using_dac)
1113 netdev->features |= NETIF_F_HIGHDMA; 1081 netdev->features |= NETIF_F_HIGHDMA;
1114 if (vlan_tso_capable(adapter)) { 1082 if (vlan_tso_capable(adapter)) {
1115#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) 1083#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
1116 adapter->flags |= VLAN_ACCEL_CAPABLE;
1117 netdev->features |= 1084 netdev->features |=
1118 NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; 1085 NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
1119#endif 1086#endif
1120 1087
1121 /* T204: disable TSO */ 1088 /* T204: disable TSO */
1122 if (!(is_T2(adapter)) || bi->port_number != 4) { 1089 if (!(is_T2(adapter)) || bi->port_number != 4) {
1123 adapter->flags |= TSO_CAPABLE; 1090 netdev->hw_features |= NETIF_F_TSO;
1124 netdev->features |= NETIF_F_TSO; 1091 netdev->features |= NETIF_F_TSO;
1125 } 1092 }
1126 } 1093 }
1127 1094
1128 netdev->netdev_ops = &cxgb_netdev_ops; 1095 netdev->netdev_ops = &cxgb_netdev_ops;
1129 netdev->hard_header_len += (adapter->flags & TSO_CAPABLE) ? 1096 netdev->hard_header_len += (netdev->hw_features & NETIF_F_TSO) ?
1130 sizeof(struct cpl_tx_pkt_lso) : sizeof(struct cpl_tx_pkt); 1097 sizeof(struct cpl_tx_pkt_lso) : sizeof(struct cpl_tx_pkt);
1131 1098
1132 netif_napi_add(netdev, &adapter->napi, t1_poll, 64); 1099 netif_napi_add(netdev, &adapter->napi, t1_poll, 64);