Commit 5ec8f9b8e6d87faa9d3a4b079b83e3c0d9c39921

Authored by Michał Mirosław
Committed by David S. Miller
1 parent 6332c8d3a5

net: enic: convert to hw_features

As the driver uses GRO and not LRO, LRO settings are ignored anyway
and are removed here to avoid confusion.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 3 changed files with 10 additions and 69 deletions Side-by-side Diff

drivers/net/enic/enic.h
... ... @@ -84,7 +84,6 @@
84 84 unsigned int flags;
85 85 unsigned int mc_count;
86 86 unsigned int uc_count;
87   - int csum_rx_enabled;
88 87 u32 port_mtu;
89 88 u32 rx_coalesce_usecs;
90 89 u32 tx_coalesce_usecs;
drivers/net/enic/enic_main.c
... ... @@ -251,56 +251,6 @@
251 251 *(data++) = ((u64 *)&vstats->rx)[enic_rx_stats[i].offset];
252 252 }
253 253  
254   -static u32 enic_get_rx_csum(struct net_device *netdev)
255   -{
256   - struct enic *enic = netdev_priv(netdev);
257   - return enic->csum_rx_enabled;
258   -}
259   -
260   -static int enic_set_rx_csum(struct net_device *netdev, u32 data)
261   -{
262   - struct enic *enic = netdev_priv(netdev);
263   -
264   - if (data && !ENIC_SETTING(enic, RXCSUM))
265   - return -EINVAL;
266   -
267   - enic->csum_rx_enabled = !!data;
268   -
269   - return 0;
270   -}
271   -
272   -static int enic_set_tx_csum(struct net_device *netdev, u32 data)
273   -{
274   - struct enic *enic = netdev_priv(netdev);
275   -
276   - if (data && !ENIC_SETTING(enic, TXCSUM))
277   - return -EINVAL;
278   -
279   - if (data)
280   - netdev->features |= NETIF_F_HW_CSUM;
281   - else
282   - netdev->features &= ~NETIF_F_HW_CSUM;
283   -
284   - return 0;
285   -}
286   -
287   -static int enic_set_tso(struct net_device *netdev, u32 data)
288   -{
289   - struct enic *enic = netdev_priv(netdev);
290   -
291   - if (data && !ENIC_SETTING(enic, TSO))
292   - return -EINVAL;
293   -
294   - if (data)
295   - netdev->features |=
296   - NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_TSO_ECN;
297   - else
298   - netdev->features &=
299   - ~(NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_TSO_ECN);
300   -
301   - return 0;
302   -}
303   -
304 254 static u32 enic_get_msglevel(struct net_device *netdev)
305 255 {
306 256 struct enic *enic = netdev_priv(netdev);
307 257  
... ... @@ -388,17 +338,8 @@
388 338 .get_strings = enic_get_strings,
389 339 .get_sset_count = enic_get_sset_count,
390 340 .get_ethtool_stats = enic_get_ethtool_stats,
391   - .get_rx_csum = enic_get_rx_csum,
392   - .set_rx_csum = enic_set_rx_csum,
393   - .get_tx_csum = ethtool_op_get_tx_csum,
394   - .set_tx_csum = enic_set_tx_csum,
395   - .get_sg = ethtool_op_get_sg,
396   - .set_sg = ethtool_op_set_sg,
397   - .get_tso = ethtool_op_get_tso,
398   - .set_tso = enic_set_tso,
399 341 .get_coalesce = enic_get_coalesce,
400 342 .set_coalesce = enic_set_coalesce,
401   - .get_flags = ethtool_op_get_flags,
402 343 };
403 344  
404 345 static void enic_free_wq_buf(struct vnic_wq *wq, struct vnic_wq_buf *buf)
... ... @@ -1309,7 +1250,7 @@
1309 1250 skb_put(skb, bytes_written);
1310 1251 skb->protocol = eth_type_trans(skb, netdev);
1311 1252  
1312   - if (enic->csum_rx_enabled && !csum_not_calc) {
  1253 + if ((netdev->features & NETIF_F_RXCSUM) && !csum_not_calc) {
1313 1254 skb->csum = htons(checksum);
1314 1255 skb->ip_summed = CHECKSUM_COMPLETE;
1315 1256 }
1316 1257  
1317 1258  
1318 1259  
... ... @@ -2438,16 +2379,17 @@
2438 2379 dev_info(dev, "loopback tag=0x%04x\n", enic->loop_tag);
2439 2380 }
2440 2381 if (ENIC_SETTING(enic, TXCSUM))
2441   - netdev->features |= NETIF_F_SG | NETIF_F_HW_CSUM;
  2382 + netdev->hw_features |= NETIF_F_SG | NETIF_F_HW_CSUM;
2442 2383 if (ENIC_SETTING(enic, TSO))
2443   - netdev->features |= NETIF_F_TSO |
  2384 + netdev->hw_features |= NETIF_F_TSO |
2444 2385 NETIF_F_TSO6 | NETIF_F_TSO_ECN;
2445   - if (ENIC_SETTING(enic, LRO))
2446   - netdev->features |= NETIF_F_GRO;
  2386 + if (ENIC_SETTING(enic, RXCSUM))
  2387 + netdev->hw_features |= NETIF_F_RXCSUM;
  2388 +
  2389 + netdev->features |= netdev->hw_features;
  2390 +
2447 2391 if (using_dac)
2448 2392 netdev->features |= NETIF_F_HIGHDMA;
2449   -
2450   - enic->csum_rx_enabled = ENIC_SETTING(enic, RXCSUM);
2451 2393  
2452 2394 err = register_netdev(netdev);
2453 2395 if (err) {
drivers/net/enic/enic_res.c
... ... @@ -98,9 +98,9 @@
98 98 "vNIC MAC addr %pM wq/rq %d/%d mtu %d\n",
99 99 enic->mac_addr, c->wq_desc_count, c->rq_desc_count, c->mtu);
100 100 dev_info(enic_get_dev(enic), "vNIC csum tx/rx %d/%d "
101   - "tso/lro %d/%d intr timer %d usec rss %d\n",
  101 + "tso %d intr timer %d usec rss %d\n",
102 102 ENIC_SETTING(enic, TXCSUM), ENIC_SETTING(enic, RXCSUM),
103   - ENIC_SETTING(enic, TSO), ENIC_SETTING(enic, LRO),
  103 + ENIC_SETTING(enic, TSO),
104 104 c->intr_timer_usec, ENIC_SETTING(enic, RSS));
105 105  
106 106 return 0;