[kernel] generic-2.6/2.6.24: refresh patches
[openwrt.git] / target / linux / generic-2.6 / patches-2.6.23 / 630-phy_packets.patch
1 --- a/drivers/net/phy/phy_device.c
2 +++ b/drivers/net/phy/phy_device.c
3 @@ -44,6 +44,18 @@ static struct phy_driver genphy_driver;
4 extern int mdio_bus_init(void);
5 extern void mdio_bus_exit(void);
6
7 +static int generic_receive_skb(struct sk_buff *skb)
8 +{
9 + skb->protocol = eth_type_trans(skb, skb->dev);
10 + return netif_receive_skb(skb);
11 +}
12 +
13 +static int generic_rx(struct sk_buff *skb)
14 +{
15 + skb->protocol = eth_type_trans(skb, skb->dev);
16 + return netif_rx(skb);
17 +}
18 +
19 struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id)
20 {
21 struct phy_device *dev;
22 @@ -67,6 +79,8 @@ struct phy_device* phy_device_create(str
23 dev->bus = bus;
24
25 dev->state = PHY_DOWN;
26 + dev->netif_receive_skb = &generic_receive_skb;
27 + dev->netif_rx = &generic_rx;
28
29 spin_lock_init(&dev->lock);
30
31 --- a/include/linux/phy.h
32 +++ b/include/linux/phy.h
33 @@ -289,6 +289,17 @@ struct phy_device {
34 void (*adjust_link)(struct net_device *dev);
35
36 void (*adjust_state)(struct net_device *dev);
37 +
38 + /*
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
45 + */
46 + int (*netif_receive_skb)(struct sk_buff *skb);
47 + int (*netif_rx)(struct sk_buff *skb);
48 };
49 #define to_phy_device(d) container_of(d, struct phy_device, dev)
50
51 --- a/include/linux/netdevice.h
52 +++ b/include/linux/netdevice.h
53 @@ -426,6 +426,7 @@ struct net_device
54 void *ax25_ptr; /* AX.25 specific data */
55 struct wireless_dev *ieee80211_ptr; /* IEEE 802.11 specific data,
56 assign before registering */
57 + void *phy_ptr; /* PHY device specific data */
58
59 /*
60 * Cache line mostly used on receive path (including eth_type_trans())
This page took 0.04431 seconds and 5 git commands to generate.