sungem: Spring cleaning and GRO support

This patch simplifies the logic and locking in sungem significantly:

 - LLTX is gone, all private locks are gone, mutex is gone
 - We don't poll the PHY while the interface is down
 - The above allowed me to get rid of a pile of state flags
   using the proper interface state provided by the networking
   stack when needed and overall simplify the driver a lot
 - Allocate the bulk of RX skbs at init time using GFP_KERNEL
 - Fix a bug where the dev->features were set after register_netdev()
 - Added GRO while at it

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Benjamin Herrenschmidt 2011-06-01 17:17:10 +10:00 committed by David S. Miller
parent 6f92c66f71
commit fe09bb6190
2 changed files with 379 additions and 547 deletions

File diff suppressed because it is too large Load Diff

View File

@ -973,23 +973,14 @@ enum link_state {
};
struct gem {
spinlock_t lock;
spinlock_t tx_lock;
void __iomem *regs;
int rx_new, rx_old;
int tx_new, tx_old;
unsigned int has_wol : 1; /* chip supports wake-on-lan */
unsigned int asleep : 1; /* chip asleep, protected by pm_mutex */
unsigned int asleep_wol : 1; /* was asleep with WOL enabled */
unsigned int opened : 1; /* driver opened, protected by pm_mutex */
unsigned int running : 1; /* chip running, protected by lock */
/* cell enable count, protected by lock */
int cell_enabled;
struct mutex pm_mutex;
u32 msg_enable;
u32 status;
@ -1033,20 +1024,4 @@ struct gem {
#define found_mii_phy(gp) ((gp->phy_type == phy_mii_mdio0 || gp->phy_type == phy_mii_mdio1) && \
gp->phy_mii.def && gp->phy_mii.def->ops)
#define ALIGNED_RX_SKB_ADDR(addr) \
((((unsigned long)(addr) + (64UL - 1UL)) & ~(64UL - 1UL)) - (unsigned long)(addr))
static __inline__ struct sk_buff *gem_alloc_skb(int size,
gfp_t gfp_flags)
{
struct sk_buff *skb = alloc_skb(size + 64, gfp_flags);
if (skb) {
int offset = (int) ALIGNED_RX_SKB_ADDR(skb->data);
if (offset)
skb_reserve(skb, offset);
}
return skb;
}
#endif /* _SUNGEM_H */