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