diff options
author | Michał Mirosław <mirq-linux@rere.qmqm.pl> | 2011-04-16 20:15:47 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-04-17 20:47:36 -0400 |
commit | 131ae329702755d897c6072c7839086b0702fb10 (patch) | |
tree | 0183b6116a1e8ddf66c19d88ff6590bc2b4c898e /drivers/net/greth.c | |
parent | 3cd8ef4b6071834fd432bbccbec0611591908643 (diff) |
net: greth: convert to hw_features
Note: Driver modifies its struct net_device_ops. This will break if used for
multiple devices that are not all the same (if that HW config is possible).
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/greth.c')
-rw-r--r-- | drivers/net/greth.c | 46 |
1 files changed, 4 insertions, 42 deletions
diff --git a/drivers/net/greth.c b/drivers/net/greth.c index 396ff7d785d1..f181304a7ab6 100644 --- a/drivers/net/greth.c +++ b/drivers/net/greth.c | |||
@@ -901,7 +901,7 @@ static int greth_rx_gbit(struct net_device *dev, int limit) | |||
901 | 901 | ||
902 | skb_put(skb, pkt_len); | 902 | skb_put(skb, pkt_len); |
903 | 903 | ||
904 | if (greth->flags & GRETH_FLAG_RX_CSUM && hw_checksummed(status)) | 904 | if (dev->features & NETIF_F_RXCSUM && hw_checksummed(status)) |
905 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 905 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
906 | else | 906 | else |
907 | skb_checksum_none_assert(skb); | 907 | skb_checksum_none_assert(skb); |
@@ -1142,41 +1142,6 @@ static void greth_get_regs(struct net_device *dev, struct ethtool_regs *regs, vo | |||
1142 | buff[i] = greth_read_bd(&greth_regs[i]); | 1142 | buff[i] = greth_read_bd(&greth_regs[i]); |
1143 | } | 1143 | } |
1144 | 1144 | ||
1145 | static u32 greth_get_rx_csum(struct net_device *dev) | ||
1146 | { | ||
1147 | struct greth_private *greth = netdev_priv(dev); | ||
1148 | return (greth->flags & GRETH_FLAG_RX_CSUM) != 0; | ||
1149 | } | ||
1150 | |||
1151 | static int greth_set_rx_csum(struct net_device *dev, u32 data) | ||
1152 | { | ||
1153 | struct greth_private *greth = netdev_priv(dev); | ||
1154 | |||
1155 | spin_lock_bh(&greth->devlock); | ||
1156 | |||
1157 | if (data) | ||
1158 | greth->flags |= GRETH_FLAG_RX_CSUM; | ||
1159 | else | ||
1160 | greth->flags &= ~GRETH_FLAG_RX_CSUM; | ||
1161 | |||
1162 | spin_unlock_bh(&greth->devlock); | ||
1163 | |||
1164 | return 0; | ||
1165 | } | ||
1166 | |||
1167 | static u32 greth_get_tx_csum(struct net_device *dev) | ||
1168 | { | ||
1169 | return (dev->features & NETIF_F_IP_CSUM) != 0; | ||
1170 | } | ||
1171 | |||
1172 | static int greth_set_tx_csum(struct net_device *dev, u32 data) | ||
1173 | { | ||
1174 | netif_tx_lock_bh(dev); | ||
1175 | ethtool_op_set_tx_csum(dev, data); | ||
1176 | netif_tx_unlock_bh(dev); | ||
1177 | return 0; | ||
1178 | } | ||
1179 | |||
1180 | static const struct ethtool_ops greth_ethtool_ops = { | 1145 | static const struct ethtool_ops greth_ethtool_ops = { |
1181 | .get_msglevel = greth_get_msglevel, | 1146 | .get_msglevel = greth_get_msglevel, |
1182 | .set_msglevel = greth_set_msglevel, | 1147 | .set_msglevel = greth_set_msglevel, |
@@ -1185,10 +1150,6 @@ static const struct ethtool_ops greth_ethtool_ops = { | |||
1185 | .get_drvinfo = greth_get_drvinfo, | 1150 | .get_drvinfo = greth_get_drvinfo, |
1186 | .get_regs_len = greth_get_regs_len, | 1151 | .get_regs_len = greth_get_regs_len, |
1187 | .get_regs = greth_get_regs, | 1152 | .get_regs = greth_get_regs, |
1188 | .get_rx_csum = greth_get_rx_csum, | ||
1189 | .set_rx_csum = greth_set_rx_csum, | ||
1190 | .get_tx_csum = greth_get_tx_csum, | ||
1191 | .set_tx_csum = greth_set_tx_csum, | ||
1192 | .get_link = ethtool_op_get_link, | 1153 | .get_link = ethtool_op_get_link, |
1193 | }; | 1154 | }; |
1194 | 1155 | ||
@@ -1570,9 +1531,10 @@ static int __devinit greth_of_probe(struct platform_device *ofdev) | |||
1570 | GRETH_REGSAVE(regs->status, 0xFF); | 1531 | GRETH_REGSAVE(regs->status, 0xFF); |
1571 | 1532 | ||
1572 | if (greth->gbit_mac) { | 1533 | if (greth->gbit_mac) { |
1573 | dev->features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_HIGHDMA; | 1534 | dev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | |
1535 | NETIF_F_RXCSUM; | ||
1536 | dev->features = dev->hw_features | NETIF_F_HIGHDMA; | ||
1574 | greth_netdev_ops.ndo_start_xmit = greth_start_xmit_gbit; | 1537 | greth_netdev_ops.ndo_start_xmit = greth_start_xmit_gbit; |
1575 | greth->flags = GRETH_FLAG_RX_CSUM; | ||
1576 | } | 1538 | } |
1577 | 1539 | ||
1578 | if (greth->multicast) { | 1540 | if (greth->multicast) { |