aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/marvell
diff options
context:
space:
mode:
authorSebastian Hesselbarth <sebastian.hesselbarth@gmail.com>2013-04-11 19:20:00 -0400
committerDavid S. Miller <davem@davemloft.net>2013-04-12 15:03:51 -0400
commit3619eb8541a6548f6e27b75aaa96cd53c4d9f3ef (patch)
tree90a7821470cbbefd5f1e493d0682c8a5660ad266 /drivers/net/ethernet/marvell
parent6706c82e39a984a02696e816cbcc8b82a21b3f67 (diff)
net: mv643xx_eth: remove deprecated inet_lro support
With recent support for GRO, there is no need to keep both LRO and GRO. This patch therefore removes the deprecated inet_lro support from mv643xx_eth. This is work is based on an experimental patch provided by Eric Dumazet and Willy Tarreau. Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> Based-on-patch-by: Eric Dumazet <eric.dumazet@gmail.com> Based-on-patch-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/marvell')
-rw-r--r--drivers/net/ethernet/marvell/Kconfig1
-rw-r--r--drivers/net/ethernet/marvell/mv643xx_eth.c97
2 files changed, 3 insertions, 95 deletions
diff --git a/drivers/net/ethernet/marvell/Kconfig b/drivers/net/ethernet/marvell/Kconfig
index 5170ecb00acc..0051f0ef3cd0 100644
--- a/drivers/net/ethernet/marvell/Kconfig
+++ b/drivers/net/ethernet/marvell/Kconfig
@@ -21,7 +21,6 @@ if NET_VENDOR_MARVELL
21config MV643XX_ETH 21config MV643XX_ETH
22 tristate "Marvell Discovery (643XX) and Orion ethernet support" 22 tristate "Marvell Discovery (643XX) and Orion ethernet support"
23 depends on (MV64X60 || PPC32 || PLAT_ORION) && INET 23 depends on (MV64X60 || PPC32 || PLAT_ORION) && INET
24 select INET_LRO
25 select PHYLIB 24 select PHYLIB
26 select MVMDIO 25 select MVMDIO
27 ---help--- 26 ---help---
diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
index c850d0475c28..d0afeea181fb 100644
--- a/drivers/net/ethernet/marvell/mv643xx_eth.c
+++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
@@ -56,8 +56,8 @@
56#include <linux/phy.h> 56#include <linux/phy.h>
57#include <linux/mv643xx_eth.h> 57#include <linux/mv643xx_eth.h>
58#include <linux/io.h> 58#include <linux/io.h>
59#include <linux/interrupt.h>
59#include <linux/types.h> 60#include <linux/types.h>
60#include <linux/inet_lro.h>
61#include <linux/slab.h> 61#include <linux/slab.h>
62#include <linux/clk.h> 62#include <linux/clk.h>
63 63
@@ -316,12 +316,6 @@ struct mib_counters {
316 u32 rx_overrun; 316 u32 rx_overrun;
317}; 317};
318 318
319struct lro_counters {
320 u32 lro_aggregated;
321 u32 lro_flushed;
322 u32 lro_no_desc;
323};
324
325struct rx_queue { 319struct rx_queue {
326 int index; 320 int index;
327 321
@@ -335,9 +329,6 @@ struct rx_queue {
335 dma_addr_t rx_desc_dma; 329 dma_addr_t rx_desc_dma;
336 int rx_desc_area_size; 330 int rx_desc_area_size;
337 struct sk_buff **rx_skb; 331 struct sk_buff **rx_skb;
338
339 struct net_lro_mgr lro_mgr;
340 struct net_lro_desc lro_arr[8];
341}; 332};
342 333
343struct tx_queue { 334struct tx_queue {
@@ -373,8 +364,6 @@ struct mv643xx_eth_private {
373 spinlock_t mib_counters_lock; 364 spinlock_t mib_counters_lock;
374 struct mib_counters mib_counters; 365 struct mib_counters mib_counters;
375 366
376 struct lro_counters lro_counters;
377
378 struct work_struct tx_timeout_task; 367 struct work_struct tx_timeout_task;
379 368
380 struct napi_struct napi; 369 struct napi_struct napi;
@@ -503,42 +492,12 @@ static void txq_maybe_wake(struct tx_queue *txq)
503 } 492 }
504} 493}
505 494
506
507/* rx napi ******************************************************************/
508static int
509mv643xx_get_skb_header(struct sk_buff *skb, void **iphdr, void **tcph,
510 u64 *hdr_flags, void *priv)
511{
512 unsigned long cmd_sts = (unsigned long)priv;
513
514 /*
515 * Make sure that this packet is Ethernet II, is not VLAN
516 * tagged, is IPv4, has a valid IP header, and is TCP.
517 */
518 if ((cmd_sts & (RX_IP_HDR_OK | RX_PKT_IS_IPV4 |
519 RX_PKT_IS_ETHERNETV2 | RX_PKT_LAYER4_TYPE_MASK |
520 RX_PKT_IS_VLAN_TAGGED)) !=
521 (RX_IP_HDR_OK | RX_PKT_IS_IPV4 |
522 RX_PKT_IS_ETHERNETV2 | RX_PKT_LAYER4_TYPE_TCP_IPV4))
523 return -1;
524
525 skb_reset_network_header(skb);
526 skb_set_transport_header(skb, ip_hdrlen(skb));
527 *iphdr = ip_hdr(skb);
528 *tcph = tcp_hdr(skb);
529 *hdr_flags = LRO_IPV4 | LRO_TCP;
530
531 return 0;
532}
533
534static int rxq_process(struct rx_queue *rxq, int budget) 495static int rxq_process(struct rx_queue *rxq, int budget)
535{ 496{
536 struct mv643xx_eth_private *mp = rxq_to_mp(rxq); 497 struct mv643xx_eth_private *mp = rxq_to_mp(rxq);
537 struct net_device_stats *stats = &mp->dev->stats; 498 struct net_device_stats *stats = &mp->dev->stats;
538 int lro_flush_needed;
539 int rx; 499 int rx;
540 500
541 lro_flush_needed = 0;
542 rx = 0; 501 rx = 0;
543 while (rx < budget && rxq->rx_desc_count) { 502 while (rx < budget && rxq->rx_desc_count) {
544 struct rx_desc *rx_desc; 503 struct rx_desc *rx_desc;
@@ -599,12 +558,7 @@ static int rxq_process(struct rx_queue *rxq, int budget)
599 skb->ip_summed = CHECKSUM_UNNECESSARY; 558 skb->ip_summed = CHECKSUM_UNNECESSARY;
600 skb->protocol = eth_type_trans(skb, mp->dev); 559 skb->protocol = eth_type_trans(skb, mp->dev);
601 560
602 if (skb->dev->features & NETIF_F_LRO && 561 napi_gro_receive(&mp->napi, skb);
603 skb->ip_summed == CHECKSUM_UNNECESSARY) {
604 lro_receive_skb(&rxq->lro_mgr, skb, (void *)cmd_sts);
605 lro_flush_needed = 1;
606 } else
607 napi_gro_receive(&mp->napi, skb);
608 562
609 continue; 563 continue;
610 564
@@ -624,9 +578,6 @@ err:
624 dev_kfree_skb(skb); 578 dev_kfree_skb(skb);
625 } 579 }
626 580
627 if (lro_flush_needed)
628 lro_flush_all(&rxq->lro_mgr);
629
630 if (rx < budget) 581 if (rx < budget)
631 mp->work_rx &= ~(1 << rxq->index); 582 mp->work_rx &= ~(1 << rxq->index);
632 583
@@ -1118,26 +1069,6 @@ static struct net_device_stats *mv643xx_eth_get_stats(struct net_device *dev)
1118 return stats; 1069 return stats;
1119} 1070}
1120 1071
1121static void mv643xx_eth_grab_lro_stats(struct mv643xx_eth_private *mp)
1122{
1123 u32 lro_aggregated = 0;
1124 u32 lro_flushed = 0;
1125 u32 lro_no_desc = 0;
1126 int i;
1127
1128 for (i = 0; i < mp->rxq_count; i++) {
1129 struct rx_queue *rxq = mp->rxq + i;
1130
1131 lro_aggregated += rxq->lro_mgr.stats.aggregated;
1132 lro_flushed += rxq->lro_mgr.stats.flushed;
1133 lro_no_desc += rxq->lro_mgr.stats.no_desc;
1134 }
1135
1136 mp->lro_counters.lro_aggregated = lro_aggregated;
1137 mp->lro_counters.lro_flushed = lro_flushed;
1138 mp->lro_counters.lro_no_desc = lro_no_desc;
1139}
1140
1141static inline u32 mib_read(struct mv643xx_eth_private *mp, int offset) 1072static inline u32 mib_read(struct mv643xx_eth_private *mp, int offset)
1142{ 1073{
1143 return rdl(mp, MIB_COUNTERS(mp->port_num) + offset); 1074 return rdl(mp, MIB_COUNTERS(mp->port_num) + offset);
@@ -1301,10 +1232,6 @@ struct mv643xx_eth_stats {
1301 { #m, FIELD_SIZEOF(struct mib_counters, m), \ 1232 { #m, FIELD_SIZEOF(struct mib_counters, m), \
1302 -1, offsetof(struct mv643xx_eth_private, mib_counters.m) } 1233 -1, offsetof(struct mv643xx_eth_private, mib_counters.m) }
1303 1234
1304#define LROSTAT(m) \
1305 { #m, FIELD_SIZEOF(struct lro_counters, m), \
1306 -1, offsetof(struct mv643xx_eth_private, lro_counters.m) }
1307
1308static const struct mv643xx_eth_stats mv643xx_eth_stats[] = { 1235static const struct mv643xx_eth_stats mv643xx_eth_stats[] = {
1309 SSTAT(rx_packets), 1236 SSTAT(rx_packets),
1310 SSTAT(tx_packets), 1237 SSTAT(tx_packets),
@@ -1346,9 +1273,6 @@ static const struct mv643xx_eth_stats mv643xx_eth_stats[] = {
1346 MIBSTAT(late_collision), 1273 MIBSTAT(late_collision),
1347 MIBSTAT(rx_discard), 1274 MIBSTAT(rx_discard),
1348 MIBSTAT(rx_overrun), 1275 MIBSTAT(rx_overrun),
1349 LROSTAT(lro_aggregated),
1350 LROSTAT(lro_flushed),
1351 LROSTAT(lro_no_desc),
1352}; 1276};
1353 1277
1354static int 1278static int
@@ -1578,7 +1502,6 @@ static void mv643xx_eth_get_ethtool_stats(struct net_device *dev,
1578 1502
1579 mv643xx_eth_get_stats(dev); 1503 mv643xx_eth_get_stats(dev);
1580 mib_counters_update(mp); 1504 mib_counters_update(mp);
1581 mv643xx_eth_grab_lro_stats(mp);
1582 1505
1583 for (i = 0; i < ARRAY_SIZE(mv643xx_eth_stats); i++) { 1506 for (i = 0; i < ARRAY_SIZE(mv643xx_eth_stats); i++) {
1584 const struct mv643xx_eth_stats *stat; 1507 const struct mv643xx_eth_stats *stat;
@@ -1851,19 +1774,6 @@ static int rxq_init(struct mv643xx_eth_private *mp, int index)
1851 nexti * sizeof(struct rx_desc); 1774 nexti * sizeof(struct rx_desc);
1852 } 1775 }
1853 1776
1854 rxq->lro_mgr.dev = mp->dev;
1855 memset(&rxq->lro_mgr.stats, 0, sizeof(rxq->lro_mgr.stats));
1856 rxq->lro_mgr.features = LRO_F_NAPI;
1857 rxq->lro_mgr.ip_summed = CHECKSUM_UNNECESSARY;
1858 rxq->lro_mgr.ip_summed_aggr = CHECKSUM_UNNECESSARY;
1859 rxq->lro_mgr.max_desc = ARRAY_SIZE(rxq->lro_arr);
1860 rxq->lro_mgr.max_aggr = 32;
1861 rxq->lro_mgr.frag_align_pad = 0;
1862 rxq->lro_mgr.lro_arr = rxq->lro_arr;
1863 rxq->lro_mgr.get_skb_header = mv643xx_get_skb_header;
1864
1865 memset(&rxq->lro_arr, 0, sizeof(rxq->lro_arr));
1866
1867 return 0; 1777 return 0;
1868 1778
1869 1779
@@ -2851,8 +2761,7 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
2851 dev->watchdog_timeo = 2 * HZ; 2761 dev->watchdog_timeo = 2 * HZ;
2852 dev->base_addr = 0; 2762 dev->base_addr = 0;
2853 2763
2854 dev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | 2764 dev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_RXCSUM;
2855 NETIF_F_RXCSUM | NETIF_F_LRO;
2856 dev->features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_RXCSUM; 2765 dev->features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_RXCSUM;
2857 dev->vlan_features = NETIF_F_SG | NETIF_F_IP_CSUM; 2766 dev->vlan_features = NETIF_F_SG | NETIF_F_IP_CSUM;
2858 2767