diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/chelsio/common.h | 5 | ||||
-rw-r--r-- | drivers/net/chelsio/cxgb2.c | 48 | ||||
-rw-r--r-- | drivers/net/chelsio/sge.c | 13 | ||||
-rw-r--r-- | drivers/net/chelsio/tp.c | 5 | ||||
-rw-r--r-- | drivers/net/chelsio/tp.h | 1 |
5 files changed, 14 insertions, 58 deletions
diff --git a/drivers/net/chelsio/common.h b/drivers/net/chelsio/common.h index 092f31a126e6..c26d863e1697 100644 --- a/drivers/net/chelsio/common.h +++ b/drivers/net/chelsio/common.h | |||
@@ -264,11 +264,6 @@ struct adapter { | |||
264 | 264 | ||
265 | enum { /* adapter flags */ | 265 | enum { /* adapter flags */ |
266 | FULL_INIT_DONE = 1 << 0, | 266 | FULL_INIT_DONE = 1 << 0, |
267 | TSO_CAPABLE = 1 << 2, | ||
268 | TCP_CSUM_CAPABLE = 1 << 3, | ||
269 | UDP_CSUM_CAPABLE = 1 << 4, | ||
270 | VLAN_ACCEL_CAPABLE = 1 << 5, | ||
271 | RX_CSUM_ENABLED = 1 << 6, | ||
272 | }; | 267 | }; |
273 | 268 | ||
274 | struct mdio_ops; | 269 | struct mdio_ops; |
diff --git a/drivers/net/chelsio/cxgb2.c b/drivers/net/chelsio/cxgb2.c index 0f71304e0542..5f82c9c34978 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 | ||
193 | static void enable_hw_csum(struct adapter *adapter) | 193 | static 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 | ||
@@ -705,33 +703,6 @@ static int set_pauseparam(struct net_device *dev, | |||
705 | return 0; | 703 | return 0; |
706 | } | 704 | } |
707 | 705 | ||
708 | static 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 | |||
715 | static 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 | |||
726 | static 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 | |||
735 | static void get_sge_param(struct net_device *dev, struct ethtool_ringparam *e) | 706 | static void get_sge_param(struct net_device *dev, struct ethtool_ringparam *e) |
736 | { | 707 | { |
737 | struct adapter *adapter = dev->ml_priv; | 708 | struct adapter *adapter = dev->ml_priv; |
@@ -831,17 +802,12 @@ static const struct ethtool_ops t1_ethtool_ops = { | |||
831 | .get_eeprom = get_eeprom, | 802 | .get_eeprom = get_eeprom, |
832 | .get_pauseparam = get_pauseparam, | 803 | .get_pauseparam = get_pauseparam, |
833 | .set_pauseparam = set_pauseparam, | 804 | .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, | 805 | .get_link = ethtool_op_get_link, |
839 | .get_strings = get_strings, | 806 | .get_strings = get_strings, |
840 | .get_sset_count = get_sset_count, | 807 | .get_sset_count = get_sset_count, |
841 | .get_ethtool_stats = get_stats, | 808 | .get_ethtool_stats = get_stats, |
842 | .get_regs_len = get_regs_len, | 809 | .get_regs_len = get_regs_len, |
843 | .get_regs = get_regs, | 810 | .get_regs = get_regs, |
844 | .set_tso = set_tso, | ||
845 | }; | 811 | }; |
846 | 812 | ||
847 | static int t1_ioctl(struct net_device *dev, struct ifreq *req, int cmd) | 813 | static int t1_ioctl(struct net_device *dev, struct ifreq *req, int cmd) |
@@ -1105,28 +1071,28 @@ static int __devinit init_one(struct pci_dev *pdev, | |||
1105 | netdev->mem_start = mmio_start; | 1071 | netdev->mem_start = mmio_start; |
1106 | netdev->mem_end = mmio_start + mmio_len - 1; | 1072 | netdev->mem_end = mmio_start + mmio_len - 1; |
1107 | netdev->ml_priv = adapter; | 1073 | netdev->ml_priv = adapter; |
1108 | netdev->features |= NETIF_F_SG | NETIF_F_IP_CSUM; | 1074 | netdev->hw_features |= NETIF_F_SG | NETIF_F_IP_CSUM | |
1109 | netdev->features |= NETIF_F_LLTX; | 1075 | NETIF_F_RXCSUM; |
1076 | netdev->features |= NETIF_F_SG | NETIF_F_IP_CSUM | | ||
1077 | NETIF_F_RXCSUM | NETIF_F_LLTX; | ||
1110 | 1078 | ||
1111 | adapter->flags |= RX_CSUM_ENABLED | TCP_CSUM_CAPABLE; | ||
1112 | if (pci_using_dac) | 1079 | if (pci_using_dac) |
1113 | netdev->features |= NETIF_F_HIGHDMA; | 1080 | netdev->features |= NETIF_F_HIGHDMA; |
1114 | if (vlan_tso_capable(adapter)) { | 1081 | if (vlan_tso_capable(adapter)) { |
1115 | #if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) | 1082 | #if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) |
1116 | adapter->flags |= VLAN_ACCEL_CAPABLE; | ||
1117 | netdev->features |= | 1083 | netdev->features |= |
1118 | NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; | 1084 | NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; |
1119 | #endif | 1085 | #endif |
1120 | 1086 | ||
1121 | /* T204: disable TSO */ | 1087 | /* T204: disable TSO */ |
1122 | if (!(is_T2(adapter)) || bi->port_number != 4) { | 1088 | if (!(is_T2(adapter)) || bi->port_number != 4) { |
1123 | adapter->flags |= TSO_CAPABLE; | 1089 | netdev->hw_features |= NETIF_F_TSO; |
1124 | netdev->features |= NETIF_F_TSO; | 1090 | netdev->features |= NETIF_F_TSO; |
1125 | } | 1091 | } |
1126 | } | 1092 | } |
1127 | 1093 | ||
1128 | netdev->netdev_ops = &cxgb_netdev_ops; | 1094 | netdev->netdev_ops = &cxgb_netdev_ops; |
1129 | netdev->hard_header_len += (adapter->flags & TSO_CAPABLE) ? | 1095 | netdev->hard_header_len += (netdev->hw_features & NETIF_F_TSO) ? |
1130 | sizeof(struct cpl_tx_pkt_lso) : sizeof(struct cpl_tx_pkt); | 1096 | sizeof(struct cpl_tx_pkt_lso) : sizeof(struct cpl_tx_pkt); |
1131 | 1097 | ||
1132 | netif_napi_add(netdev, &adapter->napi, t1_poll, 64); | 1098 | netif_napi_add(netdev, &adapter->napi, t1_poll, 64); |
diff --git a/drivers/net/chelsio/sge.c b/drivers/net/chelsio/sge.c index 8754d4473042..b948ea737550 100644 --- a/drivers/net/chelsio/sge.c +++ b/drivers/net/chelsio/sge.c | |||
@@ -929,7 +929,7 @@ void t1_sge_intr_enable(struct sge *sge) | |||
929 | u32 en = SGE_INT_ENABLE; | 929 | u32 en = SGE_INT_ENABLE; |
930 | u32 val = readl(sge->adapter->regs + A_PL_ENABLE); | 930 | u32 val = readl(sge->adapter->regs + A_PL_ENABLE); |
931 | 931 | ||
932 | if (sge->adapter->flags & TSO_CAPABLE) | 932 | if (sge->adapter->port[0].dev->hw_features & NETIF_F_TSO) |
933 | en &= ~F_PACKET_TOO_BIG; | 933 | en &= ~F_PACKET_TOO_BIG; |
934 | writel(en, sge->adapter->regs + A_SG_INT_ENABLE); | 934 | writel(en, sge->adapter->regs + A_SG_INT_ENABLE); |
935 | writel(val | SGE_PL_INTR_MASK, sge->adapter->regs + A_PL_ENABLE); | 935 | writel(val | SGE_PL_INTR_MASK, sge->adapter->regs + A_PL_ENABLE); |
@@ -952,7 +952,7 @@ int t1_sge_intr_error_handler(struct sge *sge) | |||
952 | struct adapter *adapter = sge->adapter; | 952 | struct adapter *adapter = sge->adapter; |
953 | u32 cause = readl(adapter->regs + A_SG_INT_CAUSE); | 953 | u32 cause = readl(adapter->regs + A_SG_INT_CAUSE); |
954 | 954 | ||
955 | if (adapter->flags & TSO_CAPABLE) | 955 | if (adapter->port[0].dev->hw_features & NETIF_F_TSO) |
956 | cause &= ~F_PACKET_TOO_BIG; | 956 | cause &= ~F_PACKET_TOO_BIG; |
957 | if (cause & F_RESPQ_EXHAUSTED) | 957 | if (cause & F_RESPQ_EXHAUSTED) |
958 | sge->stats.respQ_empty++; | 958 | sge->stats.respQ_empty++; |
@@ -1369,6 +1369,7 @@ static void sge_rx(struct sge *sge, struct freelQ *fl, unsigned int len) | |||
1369 | const struct cpl_rx_pkt *p; | 1369 | const struct cpl_rx_pkt *p; |
1370 | struct adapter *adapter = sge->adapter; | 1370 | struct adapter *adapter = sge->adapter; |
1371 | struct sge_port_stats *st; | 1371 | struct sge_port_stats *st; |
1372 | struct net_device *dev; | ||
1372 | 1373 | ||
1373 | skb = get_packet(adapter->pdev, fl, len - sge->rx_pkt_pad); | 1374 | skb = get_packet(adapter->pdev, fl, len - sge->rx_pkt_pad); |
1374 | if (unlikely(!skb)) { | 1375 | if (unlikely(!skb)) { |
@@ -1384,9 +1385,10 @@ static void sge_rx(struct sge *sge, struct freelQ *fl, unsigned int len) | |||
1384 | __skb_pull(skb, sizeof(*p)); | 1385 | __skb_pull(skb, sizeof(*p)); |
1385 | 1386 | ||
1386 | st = this_cpu_ptr(sge->port_stats[p->iff]); | 1387 | st = this_cpu_ptr(sge->port_stats[p->iff]); |
1388 | dev = adapter->port[p->iff].dev; | ||
1387 | 1389 | ||
1388 | skb->protocol = eth_type_trans(skb, adapter->port[p->iff].dev); | 1390 | skb->protocol = eth_type_trans(skb, dev); |
1389 | if ((adapter->flags & RX_CSUM_ENABLED) && p->csum == 0xffff && | 1391 | if ((dev->features & NETIF_F_RXCSUM) && p->csum == 0xffff && |
1390 | skb->protocol == htons(ETH_P_IP) && | 1392 | skb->protocol == htons(ETH_P_IP) && |
1391 | (skb->data[9] == IPPROTO_TCP || skb->data[9] == IPPROTO_UDP)) { | 1393 | (skb->data[9] == IPPROTO_TCP || skb->data[9] == IPPROTO_UDP)) { |
1392 | ++st->rx_cso_good; | 1394 | ++st->rx_cso_good; |
@@ -1838,8 +1840,7 @@ netdev_tx_t t1_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1838 | return NETDEV_TX_OK; | 1840 | return NETDEV_TX_OK; |
1839 | } | 1841 | } |
1840 | 1842 | ||
1841 | if (!(adapter->flags & UDP_CSUM_CAPABLE) && | 1843 | if (skb->ip_summed == CHECKSUM_PARTIAL && |
1842 | skb->ip_summed == CHECKSUM_PARTIAL && | ||
1843 | ip_hdr(skb)->protocol == IPPROTO_UDP) { | 1844 | ip_hdr(skb)->protocol == IPPROTO_UDP) { |
1844 | if (unlikely(skb_checksum_help(skb))) { | 1845 | if (unlikely(skb_checksum_help(skb))) { |
1845 | pr_debug("%s: unable to do udp checksum\n", dev->name); | 1846 | pr_debug("%s: unable to do udp checksum\n", dev->name); |
diff --git a/drivers/net/chelsio/tp.c b/drivers/net/chelsio/tp.c index 6222d585e447..8bed4a59e65f 100644 --- a/drivers/net/chelsio/tp.c +++ b/drivers/net/chelsio/tp.c | |||
@@ -152,11 +152,6 @@ void t1_tp_set_ip_checksum_offload(struct petp *tp, int enable) | |||
152 | set_csum_offload(tp, F_IP_CSUM, enable); | 152 | set_csum_offload(tp, F_IP_CSUM, enable); |
153 | } | 153 | } |
154 | 154 | ||
155 | void t1_tp_set_udp_checksum_offload(struct petp *tp, int enable) | ||
156 | { | ||
157 | set_csum_offload(tp, F_UDP_CSUM, enable); | ||
158 | } | ||
159 | |||
160 | void t1_tp_set_tcp_checksum_offload(struct petp *tp, int enable) | 155 | void t1_tp_set_tcp_checksum_offload(struct petp *tp, int enable) |
161 | { | 156 | { |
162 | set_csum_offload(tp, F_TCP_CSUM, enable); | 157 | set_csum_offload(tp, F_TCP_CSUM, enable); |
diff --git a/drivers/net/chelsio/tp.h b/drivers/net/chelsio/tp.h index 32fc71e58913..dfd8ce25106a 100644 --- a/drivers/net/chelsio/tp.h +++ b/drivers/net/chelsio/tp.h | |||
@@ -65,7 +65,6 @@ void t1_tp_intr_clear(struct petp *tp); | |||
65 | int t1_tp_intr_handler(struct petp *tp); | 65 | int t1_tp_intr_handler(struct petp *tp); |
66 | 66 | ||
67 | void t1_tp_get_mib_statistics(adapter_t *adap, struct tp_mib_statistics *tps); | 67 | void t1_tp_get_mib_statistics(adapter_t *adap, struct tp_mib_statistics *tps); |
68 | void t1_tp_set_udp_checksum_offload(struct petp *tp, int enable); | ||
69 | void t1_tp_set_tcp_checksum_offload(struct petp *tp, int enable); | 68 | void t1_tp_set_tcp_checksum_offload(struct petp *tp, int enable); |
70 | void t1_tp_set_ip_checksum_offload(struct petp *tp, int enable); | 69 | void t1_tp_set_ip_checksum_offload(struct petp *tp, int enable); |
71 | int t1_tp_set_coalescing_size(struct petp *tp, unsigned int size); | 70 | int t1_tp_set_coalescing_size(struct petp *tp, unsigned int size); |