mirror of
https://github.com/FEX-Emu/linux.git
synced 2025-01-14 13:39:10 +00:00
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 <ben@decadent.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
82aaf4fcbe
commit
a4f9cdb2b4
@ -5,7 +5,7 @@
|
||||
config NET_VENDOR_PASEMI
|
||||
bool "PA Semi devices"
|
||||
default y
|
||||
depends on PPC_PASEMI && PCI && INET
|
||||
depends on PPC_PASEMI && PCI
|
||||
---help---
|
||||
If you have a network (Ethernet) card belonging to this class, say Y.
|
||||
|
||||
@ -18,9 +18,8 @@ if NET_VENDOR_PASEMI
|
||||
|
||||
config PASEMI_MAC
|
||||
tristate "PA Semi 1/10Gbit MAC"
|
||||
depends on PPC_PASEMI && PCI && INET
|
||||
depends on PPC_PASEMI && PCI
|
||||
select PHYLIB
|
||||
select INET_LRO
|
||||
---help---
|
||||
This driver supports the on-chip 1/10Gbit Ethernet controller on
|
||||
PA Semi's PWRficient line of chips.
|
||||
|
@ -30,9 +30,7 @@
|
||||
#include <linux/skbuff.h>
|
||||
|
||||
#include <linux/ip.h>
|
||||
#include <linux/tcp.h>
|
||||
#include <net/checksum.h>
|
||||
#include <linux/inet_lro.h>
|
||||
#include <linux/prefetch.h>
|
||||
|
||||
#include <asm/irq.h>
|
||||
@ -52,12 +50,9 @@
|
||||
*
|
||||
* - Multicast support
|
||||
* - Large MTU support
|
||||
* - SW LRO
|
||||
* - Multiqueue RX/TX
|
||||
*/
|
||||
|
||||
#define LRO_MAX_AGGR 64
|
||||
|
||||
#define PE_MIN_MTU 64
|
||||
#define PE_MAX_MTU 9000
|
||||
#define PE_DEF_MTU ETH_DATA_LEN
|
||||
@ -257,37 +252,6 @@ static int pasemi_mac_set_mac_addr(struct net_device *dev, void *p)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int get_skb_hdr(struct sk_buff *skb, void **iphdr,
|
||||
void **tcph, u64 *hdr_flags, void *data)
|
||||
{
|
||||
u64 macrx = (u64) data;
|
||||
unsigned int ip_len;
|
||||
struct iphdr *iph;
|
||||
|
||||
/* IPv4 header checksum failed */
|
||||
if ((macrx & XCT_MACRX_HTY_M) != XCT_MACRX_HTY_IPV4_OK)
|
||||
return -1;
|
||||
|
||||
/* non tcp packet */
|
||||
skb_reset_network_header(skb);
|
||||
iph = ip_hdr(skb);
|
||||
if (iph->protocol != IPPROTO_TCP)
|
||||
return -1;
|
||||
|
||||
ip_len = ip_hdrlen(skb);
|
||||
skb_set_transport_header(skb, ip_len);
|
||||
*tcph = tcp_hdr(skb);
|
||||
|
||||
/* check if ip header and tcp header are complete */
|
||||
if (ntohs(iph->tot_len) < ip_len + tcp_hdrlen(skb))
|
||||
return -1;
|
||||
|
||||
*hdr_flags = LRO_IPV4 | LRO_TCP;
|
||||
*iphdr = iph;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int pasemi_mac_unmap_tx_skb(struct pasemi_mac *mac,
|
||||
const int nfrags,
|
||||
struct sk_buff *skb,
|
||||
@ -817,7 +781,7 @@ static int pasemi_mac_clean_rx(struct pasemi_mac_rxring *rx,
|
||||
skb_put(skb, len-4);
|
||||
|
||||
skb->protocol = eth_type_trans(skb, mac->netdev);
|
||||
lro_receive_skb(&mac->lro_mgr, skb, (void *)macrx);
|
||||
napi_gro_receive(&mac->napi, skb);
|
||||
|
||||
next:
|
||||
RX_DESC(rx, n) = 0;
|
||||
@ -839,8 +803,6 @@ next:
|
||||
|
||||
rx_ring(mac)->next_to_clean = n;
|
||||
|
||||
lro_flush_all(&mac->lro_mgr);
|
||||
|
||||
/* Increase is in number of 16-byte entries, and since each descriptor
|
||||
* with an 8BRES takes up 3x8 bytes (padded to 4x8), increase with
|
||||
* count*2.
|
||||
@ -1754,16 +1716,6 @@ pasemi_mac_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
dev->features = NETIF_F_IP_CSUM | NETIF_F_LLTX | NETIF_F_SG |
|
||||
NETIF_F_HIGHDMA | NETIF_F_GSO;
|
||||
|
||||
mac->lro_mgr.max_aggr = LRO_MAX_AGGR;
|
||||
mac->lro_mgr.max_desc = MAX_LRO_DESCRIPTORS;
|
||||
mac->lro_mgr.lro_arr = mac->lro_desc;
|
||||
mac->lro_mgr.get_skb_header = get_skb_hdr;
|
||||
mac->lro_mgr.features = LRO_F_NAPI | LRO_F_EXTRACT_VLAN_ID;
|
||||
mac->lro_mgr.dev = mac->netdev;
|
||||
mac->lro_mgr.ip_summed = CHECKSUM_UNNECESSARY;
|
||||
mac->lro_mgr.ip_summed_aggr = CHECKSUM_UNNECESSARY;
|
||||
|
||||
|
||||
mac->dma_pdev = pci_get_device(PCI_VENDOR_ID_PASEMI, 0xa007, NULL);
|
||||
if (!mac->dma_pdev) {
|
||||
dev_err(&mac->pdev->dev, "Can't find DMA Controller\n");
|
||||
|
@ -31,7 +31,6 @@
|
||||
#define CS_RING_SIZE (TX_RING_SIZE*2)
|
||||
|
||||
|
||||
#define MAX_LRO_DESCRIPTORS 8
|
||||
#define MAX_CS 2
|
||||
|
||||
struct pasemi_mac_txring {
|
||||
@ -84,10 +83,7 @@ struct pasemi_mac {
|
||||
|
||||
u8 mac_addr[ETH_ALEN];
|
||||
|
||||
struct net_lro_mgr lro_mgr;
|
||||
struct net_lro_desc lro_desc[MAX_LRO_DESCRIPTORS];
|
||||
struct timer_list rxtimer;
|
||||
unsigned int lro_max_aggr;
|
||||
|
||||
struct pasemi_mac_txring *tx;
|
||||
struct pasemi_mac_rxring *rx;
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/ethtool.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/inet_lro.h>
|
||||
|
||||
#include <asm/pasemi_dma.h>
|
||||
#include "pasemi_mac.h"
|
||||
|
Loading…
x
Reference in New Issue
Block a user