mesh.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /**
  2. * Contains all definitions needed for the Libertas' MESH implementation.
  3. */
  4. #ifndef _LBS_MESH_H_
  5. #define _LBS_MESH_H_
  6. #include <net/iw_handler.h>
  7. #include <net/lib80211.h>
  8. #include "host.h"
  9. #ifdef CONFIG_LIBERTAS_MESH
  10. /* Mesh statistics */
  11. struct lbs_mesh_stats {
  12. u32 fwd_bcast_cnt; /* Fwd: Broadcast counter */
  13. u32 fwd_unicast_cnt; /* Fwd: Unicast counter */
  14. u32 fwd_drop_ttl; /* Fwd: TTL zero */
  15. u32 fwd_drop_rbt; /* Fwd: Recently Broadcasted */
  16. u32 fwd_drop_noroute; /* Fwd: No route to Destination */
  17. u32 fwd_drop_nobuf; /* Fwd: Run out of internal buffers */
  18. u32 drop_blind; /* Rx: Dropped by blinding table */
  19. u32 tx_failed_cnt; /* Tx: Failed transmissions */
  20. };
  21. struct net_device;
  22. struct lbs_private;
  23. int lbs_init_mesh(struct lbs_private *priv);
  24. int lbs_deinit_mesh(struct lbs_private *priv);
  25. int lbs_add_mesh(struct lbs_private *priv);
  26. void lbs_remove_mesh(struct lbs_private *priv);
  27. /* Sending / Receiving */
  28. struct rxpd;
  29. struct txpd;
  30. struct net_device *lbs_mesh_set_dev(struct lbs_private *priv,
  31. struct net_device *dev, struct rxpd *rxpd);
  32. void lbs_mesh_set_txpd(struct lbs_private *priv,
  33. struct net_device *dev, struct txpd *txpd);
  34. /* Command handling */
  35. struct cmd_ds_command;
  36. struct cmd_ds_mesh_access;
  37. struct cmd_ds_mesh_config;
  38. int lbs_mesh_bt_add_del(struct lbs_private *priv, bool add, u8 *addr1);
  39. int lbs_mesh_bt_reset(struct lbs_private *priv);
  40. int lbs_mesh_bt_get_inverted(struct lbs_private *priv, bool *inverted);
  41. int lbs_mesh_bt_set_inverted(struct lbs_private *priv, bool inverted);
  42. int lbs_mesh_bt_get_entry(struct lbs_private *priv, u32 id, u8 *addr1);
  43. int lbs_cmd_fwt_access(struct lbs_private *priv, u16 cmd_action,
  44. struct cmd_ds_fwt_access *cmd);
  45. int lbs_mesh_access(struct lbs_private *priv, uint16_t cmd_action,
  46. struct cmd_ds_mesh_access *cmd);
  47. int lbs_mesh_config_send(struct lbs_private *priv,
  48. struct cmd_ds_mesh_config *cmd,
  49. uint16_t action, uint16_t type);
  50. int lbs_mesh_config(struct lbs_private *priv, uint16_t enable, uint16_t chan);
  51. /* Persistent configuration */
  52. void lbs_persist_config_init(struct net_device *net);
  53. void lbs_persist_config_remove(struct net_device *net);
  54. /* Ethtool statistics */
  55. struct ethtool_stats;
  56. void lbs_mesh_ethtool_get_stats(struct net_device *dev,
  57. struct ethtool_stats *stats, uint64_t *data);
  58. int lbs_mesh_ethtool_get_sset_count(struct net_device *dev, int sset);
  59. void lbs_mesh_ethtool_get_strings(struct net_device *dev,
  60. uint32_t stringset, uint8_t *s);
  61. /* Accessors */
  62. #define lbs_mesh_open(priv) (priv->mesh_open)
  63. #define lbs_mesh_connected(priv) (priv->mesh_connect_status == LBS_CONNECTED)
  64. #else
  65. #define lbs_init_mesh(priv)
  66. #define lbs_deinit_mesh(priv)
  67. #define lbs_add_mesh(priv)
  68. #define lbs_remove_mesh(priv)
  69. #define lbs_mesh_set_dev(priv, dev, rxpd) (dev)
  70. #define lbs_mesh_set_txpd(priv, dev, txpd)
  71. #define lbs_mesh_config(priv, enable, chan)
  72. #define lbs_mesh_open(priv) (0)
  73. #define lbs_mesh_connected(priv) (0)
  74. #endif
  75. #endif