user.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. #ifndef __DSA_USER_H
  3. #define __DSA_USER_H
  4. #include <linux/if_bridge.h>
  5. #include <linux/if_vlan.h>
  6. #include <linux/list.h>
  7. #include <linux/netpoll.h>
  8. #include <linux/types.h>
  9. #include <net/dsa.h>
  10. #include <net/gro_cells.h>
  11. struct net_device;
  12. struct netlink_ext_ack;
  13. extern struct notifier_block dsa_user_switchdev_notifier;
  14. extern struct notifier_block dsa_user_switchdev_blocking_notifier;
  15. struct dsa_user_priv {
  16. /* Copy of CPU port xmit for faster access in user transmit hot path */
  17. struct sk_buff * (*xmit)(struct sk_buff *skb,
  18. struct net_device *dev);
  19. struct gro_cells gcells;
  20. /* DSA port data, such as switch, port index, etc. */
  21. struct dsa_port *dp;
  22. #ifdef CONFIG_NET_POLL_CONTROLLER
  23. struct netpoll *netpoll;
  24. #endif
  25. /* TC context */
  26. struct list_head mall_tc_list;
  27. };
  28. void dsa_user_mii_bus_init(struct dsa_switch *ds);
  29. int dsa_user_create(struct dsa_port *dp);
  30. void dsa_user_destroy(struct net_device *user_dev);
  31. int dsa_user_suspend(struct net_device *user_dev);
  32. int dsa_user_resume(struct net_device *user_dev);
  33. int dsa_user_register_notifier(void);
  34. void dsa_user_unregister_notifier(void);
  35. int dsa_user_host_uc_install(struct net_device *dev, const u8 *addr);
  36. void dsa_user_host_uc_uninstall(struct net_device *dev);
  37. void dsa_user_sync_ha(struct net_device *dev);
  38. void dsa_user_unsync_ha(struct net_device *dev);
  39. void dsa_user_setup_tagger(struct net_device *user);
  40. int dsa_user_change_mtu(struct net_device *dev, int new_mtu);
  41. int dsa_user_change_conduit(struct net_device *dev, struct net_device *conduit,
  42. struct netlink_ext_ack *extack);
  43. int dsa_user_manage_vlan_filtering(struct net_device *dev,
  44. bool vlan_filtering);
  45. static inline struct dsa_port *dsa_user_to_port(const struct net_device *dev)
  46. {
  47. struct dsa_user_priv *p = netdev_priv(dev);
  48. return p->dp;
  49. }
  50. static inline struct net_device *
  51. dsa_user_to_conduit(const struct net_device *dev)
  52. {
  53. struct dsa_port *dp = dsa_user_to_port(dev);
  54. return dsa_port_to_conduit(dp);
  55. }
  56. #endif