630-phy_packets.patch 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. --- a/drivers/net/phy/phy_device.c
  2. +++ b/drivers/net/phy/phy_device.c
  3. @@ -53,6 +53,18 @@
  4. phy_device_free(to_phy_device(dev));
  5. }
  6. +static int generic_receive_skb(struct sk_buff *skb)
  7. +{
  8. + skb->protocol = eth_type_trans(skb, skb->dev);
  9. + return netif_receive_skb(skb);
  10. +}
  11. +
  12. +static int generic_rx(struct sk_buff *skb)
  13. +{
  14. + skb->protocol = eth_type_trans(skb, skb->dev);
  15. + return netif_rx(skb);
  16. +}
  17. +
  18. struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id)
  19. {
  20. struct phy_device *dev;
  21. @@ -78,6 +90,8 @@
  22. dev->bus = bus;
  23. dev->state = PHY_DOWN;
  24. + dev->netif_receive_skb = &generic_receive_skb;
  25. + dev->netif_rx = &generic_rx;
  26. mutex_init(&dev->lock);
  27. --- a/include/linux/phy.h
  28. +++ b/include/linux/phy.h
  29. @@ -295,6 +295,17 @@
  30. void (*adjust_link)(struct net_device *dev);
  31. void (*adjust_state)(struct net_device *dev);
  32. +
  33. + /*
  34. + * By default these point to the original functions
  35. + * with the same name. adding them to the phy_device
  36. + * allows the phy driver to override them for packet
  37. + * mangling if the ethernet driver supports it
  38. + * This is required to support some really horrible
  39. + * switches such as the Marvell 88E6060
  40. + */
  41. + int (*netif_receive_skb)(struct sk_buff *skb);
  42. + int (*netif_rx)(struct sk_buff *skb);
  43. };
  44. #define to_phy_device(d) container_of(d, struct phy_device, dev)
  45. --- a/include/linux/netdevice.h
  46. +++ b/include/linux/netdevice.h
  47. @@ -595,6 +595,7 @@
  48. void *ax25_ptr; /* AX.25 specific data */
  49. struct wireless_dev *ieee80211_ptr; /* IEEE 802.11 specific data,
  50. assign before registering */
  51. + void *phy_ptr; /* PHY device specific data */
  52. /*
  53. * Cache line mostly used on receive path (including eth_type_trans())