Commit 131ae329702755d897c6072c7839086b0702fb10

Authored by Michał Mirosław
Committed by David S. Miller
1 parent 3cd8ef4b60

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>

Showing 2 changed files with 4 additions and 46 deletions Side-by-side Diff

... ... @@ -901,7 +901,7 @@
901 901  
902 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 905 skb->ip_summed = CHECKSUM_UNNECESSARY;
906 906 else
907 907 skb_checksum_none_assert(skb);
... ... @@ -1142,41 +1142,6 @@
1142 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 1145 static const struct ethtool_ops greth_ethtool_ops = {
1181 1146 .get_msglevel = greth_get_msglevel,
1182 1147 .set_msglevel = greth_set_msglevel,
... ... @@ -1185,10 +1150,6 @@
1185 1150 .get_drvinfo = greth_get_drvinfo,
1186 1151 .get_regs_len = greth_get_regs_len,
1187 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 1153 .get_link = ethtool_op_get_link,
1193 1154 };
1194 1155  
1195 1156  
... ... @@ -1570,9 +1531,10 @@
1570 1531 GRETH_REGSAVE(regs->status, 0xFF);
1571 1532  
1572 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 1537 greth_netdev_ops.ndo_start_xmit = greth_start_xmit_gbit;
1575   - greth->flags = GRETH_FLAG_RX_CSUM;
1576 1538 }
1577 1539  
1578 1540 if (greth->multicast) {
... ... @@ -77,9 +77,6 @@
77 77 */
78 78 #define MAX_FRAME_SIZE 1520
79 79  
80   -/* Flags */
81   -#define GRETH_FLAG_RX_CSUM 0x1
82   -
83 80 /* GRETH APB registers */
84 81 struct greth_regs {
85 82 u32 control;
... ... @@ -133,7 +130,6 @@
133 130 unsigned int duplex;
134 131  
135 132 u32 msg_enable;
136   - u32 flags;
137 133  
138 134 u8 phyaddr;
139 135 u8 multicast;