dsa_priv.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /*
  2. * net/dsa/dsa_priv.h - Hardware switch handling
  3. * Copyright (c) 2008-2009 Marvell Semiconductor
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. */
  10. #ifndef __DSA_PRIV_H
  11. #define __DSA_PRIV_H
  12. #include <linux/phy.h>
  13. #include <linux/netdevice.h>
  14. #include <linux/netpoll.h>
  15. struct dsa_device_ops {
  16. struct sk_buff *(*xmit)(struct sk_buff *skb, struct net_device *dev);
  17. struct sk_buff *(*rcv)(struct sk_buff *skb, struct net_device *dev,
  18. struct packet_type *pt,
  19. struct net_device *orig_dev);
  20. };
  21. struct dsa_slave_priv {
  22. struct sk_buff * (*xmit)(struct sk_buff *skb,
  23. struct net_device *dev);
  24. /* DSA port data, such as switch, port index, etc. */
  25. struct dsa_port *dp;
  26. /*
  27. * The phylib phy_device pointer for the PHY connected
  28. * to this port.
  29. */
  30. struct phy_device *phy;
  31. phy_interface_t phy_interface;
  32. int old_link;
  33. int old_pause;
  34. int old_duplex;
  35. #ifdef CONFIG_NET_POLL_CONTROLLER
  36. struct netpoll *netpoll;
  37. #endif
  38. /* TC context */
  39. struct list_head mall_tc_list;
  40. };
  41. /* dsa.c */
  42. int dsa_cpu_dsa_setup(struct dsa_switch *ds, struct device *dev,
  43. struct dsa_port *dport, int port);
  44. void dsa_cpu_dsa_destroy(struct dsa_port *dport);
  45. const struct dsa_device_ops *dsa_resolve_tag_protocol(int tag_protocol);
  46. int dsa_cpu_port_ethtool_setup(struct dsa_switch *ds);
  47. void dsa_cpu_port_ethtool_restore(struct dsa_switch *ds);
  48. /* legacy.c */
  49. int dsa_legacy_register(void);
  50. void dsa_legacy_unregister(void);
  51. /* slave.c */
  52. extern const struct dsa_device_ops notag_netdev_ops;
  53. void dsa_slave_mii_bus_init(struct dsa_switch *ds);
  54. void dsa_cpu_port_ethtool_init(struct ethtool_ops *ops);
  55. int dsa_slave_create(struct dsa_switch *ds, struct device *parent,
  56. int port, const char *name);
  57. void dsa_slave_destroy(struct net_device *slave_dev);
  58. int dsa_slave_suspend(struct net_device *slave_dev);
  59. int dsa_slave_resume(struct net_device *slave_dev);
  60. int dsa_slave_register_notifier(void);
  61. void dsa_slave_unregister_notifier(void);
  62. /* switch.c */
  63. int dsa_switch_register_notifier(struct dsa_switch *ds);
  64. void dsa_switch_unregister_notifier(struct dsa_switch *ds);
  65. /* tag_dsa.c */
  66. extern const struct dsa_device_ops dsa_netdev_ops;
  67. /* tag_edsa.c */
  68. extern const struct dsa_device_ops edsa_netdev_ops;
  69. /* tag_trailer.c */
  70. extern const struct dsa_device_ops trailer_netdev_ops;
  71. /* tag_brcm.c */
  72. extern const struct dsa_device_ops brcm_netdev_ops;
  73. /* tag_qca.c */
  74. extern const struct dsa_device_ops qca_netdev_ops;
  75. /* tag_mtk.c */
  76. extern const struct dsa_device_ops mtk_netdev_ops;
  77. #endif