Skip to content

Commit a4f9cdb

Browse files
bwhacksdavem330
authored andcommitted
pasemi_mac: Replace LRO with GRO
GRO is simpler to use than the old inet_lro library, and is compatible with forwarding and bridging configurations. Compile-tested only. Signed-off-by: Ben Hutchings <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 82aaf4f commit a4f9cdb

File tree

4 files changed

+3
-57
lines changed

4 files changed

+3
-57
lines changed

drivers/net/ethernet/pasemi/Kconfig

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
config NET_VENDOR_PASEMI
66
bool "PA Semi devices"
77
default y
8-
depends on PPC_PASEMI && PCI && INET
8+
depends on PPC_PASEMI && PCI
99
---help---
1010
If you have a network (Ethernet) card belonging to this class, say Y.
1111

@@ -18,9 +18,8 @@ if NET_VENDOR_PASEMI
1818

1919
config PASEMI_MAC
2020
tristate "PA Semi 1/10Gbit MAC"
21-
depends on PPC_PASEMI && PCI && INET
21+
depends on PPC_PASEMI && PCI
2222
select PHYLIB
23-
select INET_LRO
2423
---help---
2524
This driver supports the on-chip 1/10Gbit Ethernet controller on
2625
PA Semi's PWRficient line of chips.

drivers/net/ethernet/pasemi/pasemi_mac.c

Lines changed: 1 addition & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@
3030
#include <linux/skbuff.h>
3131

3232
#include <linux/ip.h>
33-
#include <linux/tcp.h>
3433
#include <net/checksum.h>
35-
#include <linux/inet_lro.h>
3634
#include <linux/prefetch.h>
3735

3836
#include <asm/irq.h>
@@ -52,12 +50,9 @@
5250
*
5351
* - Multicast support
5452
* - Large MTU support
55-
* - SW LRO
5653
* - Multiqueue RX/TX
5754
*/
5855

59-
#define LRO_MAX_AGGR 64
60-
6156
#define PE_MIN_MTU 64
6257
#define PE_MAX_MTU 9000
6358
#define PE_DEF_MTU ETH_DATA_LEN
@@ -257,37 +252,6 @@ static int pasemi_mac_set_mac_addr(struct net_device *dev, void *p)
257252
return 0;
258253
}
259254

260-
static int get_skb_hdr(struct sk_buff *skb, void **iphdr,
261-
void **tcph, u64 *hdr_flags, void *data)
262-
{
263-
u64 macrx = (u64) data;
264-
unsigned int ip_len;
265-
struct iphdr *iph;
266-
267-
/* IPv4 header checksum failed */
268-
if ((macrx & XCT_MACRX_HTY_M) != XCT_MACRX_HTY_IPV4_OK)
269-
return -1;
270-
271-
/* non tcp packet */
272-
skb_reset_network_header(skb);
273-
iph = ip_hdr(skb);
274-
if (iph->protocol != IPPROTO_TCP)
275-
return -1;
276-
277-
ip_len = ip_hdrlen(skb);
278-
skb_set_transport_header(skb, ip_len);
279-
*tcph = tcp_hdr(skb);
280-
281-
/* check if ip header and tcp header are complete */
282-
if (ntohs(iph->tot_len) < ip_len + tcp_hdrlen(skb))
283-
return -1;
284-
285-
*hdr_flags = LRO_IPV4 | LRO_TCP;
286-
*iphdr = iph;
287-
288-
return 0;
289-
}
290-
291255
static int pasemi_mac_unmap_tx_skb(struct pasemi_mac *mac,
292256
const int nfrags,
293257
struct sk_buff *skb,
@@ -817,7 +781,7 @@ static int pasemi_mac_clean_rx(struct pasemi_mac_rxring *rx,
817781
skb_put(skb, len-4);
818782

819783
skb->protocol = eth_type_trans(skb, mac->netdev);
820-
lro_receive_skb(&mac->lro_mgr, skb, (void *)macrx);
784+
napi_gro_receive(&mac->napi, skb);
821785

822786
next:
823787
RX_DESC(rx, n) = 0;
@@ -839,8 +803,6 @@ static int pasemi_mac_clean_rx(struct pasemi_mac_rxring *rx,
839803

840804
rx_ring(mac)->next_to_clean = n;
841805

842-
lro_flush_all(&mac->lro_mgr);
843-
844806
/* Increase is in number of 16-byte entries, and since each descriptor
845807
* with an 8BRES takes up 3x8 bytes (padded to 4x8), increase with
846808
* count*2.
@@ -1754,16 +1716,6 @@ pasemi_mac_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
17541716
dev->features = NETIF_F_IP_CSUM | NETIF_F_LLTX | NETIF_F_SG |
17551717
NETIF_F_HIGHDMA | NETIF_F_GSO;
17561718

1757-
mac->lro_mgr.max_aggr = LRO_MAX_AGGR;
1758-
mac->lro_mgr.max_desc = MAX_LRO_DESCRIPTORS;
1759-
mac->lro_mgr.lro_arr = mac->lro_desc;
1760-
mac->lro_mgr.get_skb_header = get_skb_hdr;
1761-
mac->lro_mgr.features = LRO_F_NAPI | LRO_F_EXTRACT_VLAN_ID;
1762-
mac->lro_mgr.dev = mac->netdev;
1763-
mac->lro_mgr.ip_summed = CHECKSUM_UNNECESSARY;
1764-
mac->lro_mgr.ip_summed_aggr = CHECKSUM_UNNECESSARY;
1765-
1766-
17671719
mac->dma_pdev = pci_get_device(PCI_VENDOR_ID_PASEMI, 0xa007, NULL);
17681720
if (!mac->dma_pdev) {
17691721
dev_err(&mac->pdev->dev, "Can't find DMA Controller\n");

drivers/net/ethernet/pasemi/pasemi_mac.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
#define CS_RING_SIZE (TX_RING_SIZE*2)
3232

3333

34-
#define MAX_LRO_DESCRIPTORS 8
3534
#define MAX_CS 2
3635

3736
struct pasemi_mac_txring {
@@ -84,10 +83,7 @@ struct pasemi_mac {
8483

8584
u8 mac_addr[ETH_ALEN];
8685

87-
struct net_lro_mgr lro_mgr;
88-
struct net_lro_desc lro_desc[MAX_LRO_DESCRIPTORS];
8986
struct timer_list rxtimer;
90-
unsigned int lro_max_aggr;
9187

9288
struct pasemi_mac_txring *tx;
9389
struct pasemi_mac_rxring *rx;

drivers/net/ethernet/pasemi/pasemi_mac_ethtool.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#include <linux/netdevice.h>
2121
#include <linux/ethtool.h>
2222
#include <linux/pci.h>
23-
#include <linux/inet_lro.h>
2423

2524
#include <asm/pasemi_dma.h>
2625
#include "pasemi_mac.h"

0 commit comments

Comments
 (0)