630-phy_packets.patch 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. --- a/drivers/net/phy/phy_device.c
  2. +++ b/drivers/net/phy/phy_device.c
  3. @@ -143,6 +143,18 @@ int phy_scan_fixups(struct phy_device *p
  4. }
  5. EXPORT_SYMBOL(phy_scan_fixups);
  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. @@ -168,6 +180,8 @@ struct phy_device* phy_device_create(str
  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. @@ -309,6 +309,20 @@ struct phy_device {
  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. + /* alignment offset for packets */
  45. + int pkt_align;
  46. };
  47. #define to_phy_device(d) container_of(d, struct phy_device, dev)
  48. --- a/include/linux/netdevice.h
  49. +++ b/include/linux/netdevice.h
  50. @@ -613,6 +613,7 @@ struct net_device
  51. void *ax25_ptr; /* AX.25 specific data */
  52. struct wireless_dev *ieee80211_ptr; /* IEEE 802.11 specific data,
  53. assign before registering */
  54. + void *phy_ptr; /* PHY device specific data */
  55. /*
  56. * Cache line mostly used on receive path (including eth_type_trans())