aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichał Mirosław <mirq-linux@rere.qmqm.pl>2011-04-06 22:43:48 -0400
committerDavid S. Miller <davem@davemloft.net>2011-04-07 23:16:58 -0400
commit5ec8f9b8e6d87faa9d3a4b079b83e3c0d9c39921 (patch)
tree08b7d5634544c79b737edd25a0764709a9b7c242
parent6332c8d3a5e352fae854cbcac764622e083461e5 (diff)
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>
-rw-r--r--drivers/net/enic/enic.h1
-rw-r--r--drivers/net/enic/enic_main.c74
-rw-r--r--drivers/net/enic/enic_res.c4
3 files changed, 10 insertions, 69 deletions
diff --git a/drivers/net/enic/enic.h b/drivers/net/enic/enic.h
index 178b94d7f89b..38b351c7b979 100644
--- a/drivers/net/enic/enic.h
+++ b/drivers/net/enic/enic.h
@@ -84,7 +84,6 @@ struct enic {
84 unsigned int flags; 84 unsigned int flags;
85 unsigned int mc_count; 85 unsigned int mc_count;
86 unsigned int uc_count; 86 unsigned int uc_count;
87 int csum_rx_enabled;
88 u32 port_mtu; 87 u32 port_mtu;
89 u32 rx_coalesce_usecs; 88 u32 rx_coalesce_usecs;
90 u32 tx_coalesce_usecs; 89 u32 tx_coalesce_usecs;
diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
index 9a3a0277bf21..b2245511c51a 100644
--- a/drivers/net/enic/enic_main.c
+++ b/drivers/net/enic/enic_main.c
@@ -251,56 +251,6 @@ static void enic_get_ethtool_stats(struct net_device *netdev,
251 *(data++) = ((u64 *)&vstats->rx)[enic_rx_stats[i].offset]; 251 *(data++) = ((u64 *)&vstats->rx)[enic_rx_stats[i].offset];
252} 252}
253 253
254static 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
260static 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
272static 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
287static 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
304static u32 enic_get_msglevel(struct net_device *netdev) 254static u32 enic_get_msglevel(struct net_device *netdev)
305{ 255{
306 struct enic *enic = netdev_priv(netdev); 256 struct enic *enic = netdev_priv(netdev);
@@ -388,17 +338,8 @@ static const struct ethtool_ops enic_ethtool_ops = {
388 .get_strings = enic_get_strings, 338 .get_strings = enic_get_strings,
389 .get_sset_count = enic_get_sset_count, 339 .get_sset_count = enic_get_sset_count,
390 .get_ethtool_stats = enic_get_ethtool_stats, 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 .get_coalesce = enic_get_coalesce, 341 .get_coalesce = enic_get_coalesce,
400 .set_coalesce = enic_set_coalesce, 342 .set_coalesce = enic_set_coalesce,
401 .get_flags = ethtool_op_get_flags,
402}; 343};
403 344
404static void enic_free_wq_buf(struct vnic_wq *wq, struct vnic_wq_buf *buf) 345static void enic_free_wq_buf(struct vnic_wq *wq, struct vnic_wq_buf *buf)
@@ -1309,7 +1250,7 @@ static void enic_rq_indicate_buf(struct vnic_rq *rq,
1309 skb_put(skb, bytes_written); 1250 skb_put(skb, bytes_written);
1310 skb->protocol = eth_type_trans(skb, netdev); 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 skb->csum = htons(checksum); 1254 skb->csum = htons(checksum);
1314 skb->ip_summed = CHECKSUM_COMPLETE; 1255 skb->ip_summed = CHECKSUM_COMPLETE;
1315 } 1256 }
@@ -2438,17 +2379,18 @@ static int __devinit enic_probe(struct pci_dev *pdev,
2438 dev_info(dev, "loopback tag=0x%04x\n", enic->loop_tag); 2379 dev_info(dev, "loopback tag=0x%04x\n", enic->loop_tag);
2439 } 2380 }
2440 if (ENIC_SETTING(enic, TXCSUM)) 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 if (ENIC_SETTING(enic, TSO)) 2383 if (ENIC_SETTING(enic, TSO))
2443 netdev->features |= NETIF_F_TSO | 2384 netdev->hw_features |= NETIF_F_TSO |
2444 NETIF_F_TSO6 | NETIF_F_TSO_ECN; 2385 NETIF_F_TSO6 | NETIF_F_TSO_ECN;
2445 if (ENIC_SETTING(enic, LRO)) 2386 if (ENIC_SETTING(enic, RXCSUM))
2446 netdev->features |= NETIF_F_GRO; 2387 netdev->hw_features |= NETIF_F_RXCSUM;
2388
2389 netdev->features |= netdev->hw_features;
2390
2447 if (using_dac) 2391 if (using_dac)
2448 netdev->features |= NETIF_F_HIGHDMA; 2392 netdev->features |= NETIF_F_HIGHDMA;
2449 2393
2450 enic->csum_rx_enabled = ENIC_SETTING(enic, RXCSUM);
2451
2452 err = register_netdev(netdev); 2394 err = register_netdev(netdev);
2453 if (err) { 2395 if (err) {
2454 dev_err(dev, "Cannot register net device, aborting\n"); 2396 dev_err(dev, "Cannot register net device, aborting\n");
diff --git a/drivers/net/enic/enic_res.c b/drivers/net/enic/enic_res.c
index f111a37419ce..6e5c6356e7df 100644
--- a/drivers/net/enic/enic_res.c
+++ b/drivers/net/enic/enic_res.c
@@ -98,9 +98,9 @@ int enic_get_vnic_config(struct enic *enic)
98 "vNIC MAC addr %pM wq/rq %d/%d mtu %d\n", 98 "vNIC MAC addr %pM wq/rq %d/%d mtu %d\n",
99 enic->mac_addr, c->wq_desc_count, c->rq_desc_count, c->mtu); 99 enic->mac_addr, c->wq_desc_count, c->rq_desc_count, c->mtu);
100 dev_info(enic_get_dev(enic), "vNIC csum tx/rx %d/%d " 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 ENIC_SETTING(enic, TXCSUM), ENIC_SETTING(enic, RXCSUM), 102 ENIC_SETTING(enic, TXCSUM), ENIC_SETTING(enic, RXCSUM),
103 ENIC_SETTING(enic, TSO), ENIC_SETTING(enic, LRO), 103 ENIC_SETTING(enic, TSO),
104 c->intr_timer_usec, ENIC_SETTING(enic, RSS)); 104 c->intr_timer_usec, ENIC_SETTING(enic, RSS));
105 105
106 return 0; 106 return 0;