1 --- a/drivers/net/phy/phy_device.c
2 +++ b/drivers/net/phy/phy_device.c
3 @@ -146,6 +146,18 @@ int phy_scan_fixups(struct phy_device *p
5 EXPORT_SYMBOL(phy_scan_fixups);
7 +static int generic_receive_skb(struct sk_buff *skb)
9 + skb->protocol = eth_type_trans(skb, skb->dev);
10 + return netif_receive_skb(skb);
13 +static int generic_rx(struct sk_buff *skb)
15 + skb->protocol = eth_type_trans(skb, skb->dev);
16 + return netif_rx(skb);
19 struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id)
21 struct phy_device *dev;
22 @@ -175,6 +187,8 @@ struct phy_device* phy_device_create(str
23 dev_set_name(&dev->dev, PHY_ID_FMT, bus->id, addr);
25 dev->state = PHY_DOWN;
26 + dev->netif_receive_skb = &generic_receive_skb;
27 + dev->netif_rx = &generic_rx;
29 mutex_init(&dev->lock);
31 --- a/include/linux/phy.h
32 +++ b/include/linux/phy.h
33 @@ -325,6 +325,20 @@ struct phy_device {
34 void (*adjust_link)(struct net_device *dev);
36 void (*adjust_state)(struct net_device *dev);
39 + * By default these point to the original functions
40 + * with the same name. adding them to the phy_device
41 + * allows the phy driver to override them for packet
42 + * mangling if the ethernet driver supports it
43 + * This is required to support some really horrible
44 + * switches such as the Marvell 88E6060
46 + int (*netif_receive_skb)(struct sk_buff *skb);
47 + int (*netif_rx)(struct sk_buff *skb);
49 + /* alignment offset for packets */
52 #define to_phy_device(d) container_of(d, struct phy_device, dev)
54 --- a/include/linux/netdevice.h
55 +++ b/include/linux/netdevice.h
56 @@ -807,6 +807,7 @@ struct net_device
57 void *ax25_ptr; /* AX.25 specific data */
58 struct wireless_dev *ieee80211_ptr; /* IEEE 802.11 specific data,
59 assign before registering */
60 + void *phy_ptr; /* PHY device specific data */
63 * Cache line mostly used on receive path (including eth_type_trans())