Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 121618
b: refs/heads/master
c: 93da9cc
h: refs/heads/master
v: v3
  • Loading branch information
colin@cozybit.com authored and John W. Linville committed Oct 31, 2008
1 parent de751a3 commit 5fa62fd
Show file tree
Hide file tree
Showing 6 changed files with 378 additions and 22 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4a68ec535ef1043319928f601d633f78e650a16f
refs/heads/master: 93da9cc17c5ae8a751886fd4732db89ad5e9bdb9
86 changes: 86 additions & 0 deletions trunk/include/linux/nl80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@
* to the the specified ISO/IEC 3166-1 alpha2 country code. The core will
* store this as a valid request and then query userspace for it.
*
* @NL80211_CMD_GET_MESH_PARAMS: Get mesh networking properties for the
* interface identified by %NL80211_ATTR_IFINDEX
*
* @NL80211_CMD_SET_MESH_PARAMS: Set mesh networking properties for the
* interface identified by %NL80211_ATTR_IFINDEX
*
* @NL80211_CMD_MAX: highest used command number
* @__NL80211_CMD_AFTER_LAST: internal use
*/
Expand Down Expand Up @@ -148,6 +154,9 @@ enum nl80211_commands {
NL80211_CMD_SET_REG,
NL80211_CMD_REQ_SET_REG,

NL80211_CMD_GET_MESH_PARAMS,
NL80211_CMD_SET_MESH_PARAMS,

/* add new commands above here */

/* used to define NL80211_CMD_MAX below */
Expand Down Expand Up @@ -296,6 +305,8 @@ enum nl80211_attrs {
NL80211_ATTR_REG_ALPHA2,
NL80211_ATTR_REG_RULES,

NL80211_ATTR_MESH_PARAMS,

/* add attributes here, update the policy in nl80211.c */

__NL80211_ATTR_AFTER_LAST,
Expand Down Expand Up @@ -606,4 +617,79 @@ enum nl80211_mntr_flags {
NL80211_MNTR_FLAG_MAX = __NL80211_MNTR_FLAG_AFTER_LAST - 1
};

/**
* enum nl80211_meshconf_params - mesh configuration parameters
*
* Mesh configuration parameters
*
* @__NL80211_MESHCONF_INVALID: internal use
*
* @NL80211_MESHCONF_RETRY_TIMEOUT: specifies the initial retry timeout in
* millisecond units, used by the Peer Link Open message
*
* @NL80211_MESHCONF_CONFIRM_TIMEOUT: specifies the inital confirm timeout, in
* millisecond units, used by the peer link management to close a peer link
*
* @NL80211_MESHCONF_HOLDING_TIMEOUT: specifies the holding timeout, in
* millisecond units
*
* @NL80211_MESHCONF_MAX_PEER_LINKS: maximum number of peer links allowed
* on this mesh interface
*
* @NL80211_MESHCONF_MAX_RETRIES: specifies the maximum number of peer link
* open retries that can be sent to establish a new peer link instance in a
* mesh
*
* @NL80211_MESHCONF_TTL: specifies the value of TTL field set at a source mesh
* point.
*
* @NL80211_MESHCONF_AUTO_OPEN_PLINKS: whether we should automatically
* open peer links when we detect compatible mesh peers.
*
* @NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES: the number of action frames
* containing a PREQ that an MP can send to a particular destination (path
* target)
*
* @NL80211_MESHCONF_PATH_REFRESH_TIME: how frequently to refresh mesh paths
* (in milliseconds)
*
* @NL80211_MESHCONF_MIN_DISCOVERY_TIMEOUT: minimum length of time to wait
* until giving up on a path discovery (in milliseconds)
*
* @NL80211_MESHCONF_HWMP_ACTIVE_PATH_TIMEOUT: The time (in TUs) for which mesh
* points receiving a PREQ shall consider the forwarding information from the
* root to be valid. (TU = time unit)
*
* @NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL: The minimum interval of time (in
* TUs) during which an MP can send only one action frame containing a PREQ
* reference element
*
* @NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME: The interval of time (in TUs)
* that it takes for an HWMP information element to propagate across the mesh
*
* @NL80211_MESHCONF_ATTR_MAX: highest possible mesh configuration attribute
*
* @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use
*/
enum nl80211_meshconf_params {
__NL80211_MESHCONF_INVALID,
NL80211_MESHCONF_RETRY_TIMEOUT,
NL80211_MESHCONF_CONFIRM_TIMEOUT,
NL80211_MESHCONF_HOLDING_TIMEOUT,
NL80211_MESHCONF_MAX_PEER_LINKS,
NL80211_MESHCONF_MAX_RETRIES,
NL80211_MESHCONF_TTL,
NL80211_MESHCONF_AUTO_OPEN_PLINKS,
NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES,
NL80211_MESHCONF_PATH_REFRESH_TIME,
NL80211_MESHCONF_MIN_DISCOVERY_TIMEOUT,
NL80211_MESHCONF_HWMP_ACTIVE_PATH_TIMEOUT,
NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL,
NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME,

/* keep last */
__NL80211_MESHCONF_ATTR_AFTER_LAST,
NL80211_MESHCONF_ATTR_MAX = __NL80211_MESHCONF_ATTR_AFTER_LAST - 1
};

#endif /* __LINUX_NL80211_H */
32 changes: 31 additions & 1 deletion trunk/include/net/cfg80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,25 @@ struct ieee80211_regdomain {
.flags = reg_flags, \
}

struct mesh_config {
/* Timeouts in ms */
/* Mesh plink management parameters */
u16 dot11MeshRetryTimeout;
u16 dot11MeshConfirmTimeout;
u16 dot11MeshHoldingTimeout;
u16 dot11MeshMaxPeerLinks;
u8 dot11MeshMaxRetries;
u8 dot11MeshTTL;
bool auto_open_plinks;
/* HWMP parameters */
u8 dot11MeshHWMPmaxPREQretries;
u32 path_refresh_time;
u16 min_discovery_timeout;
u32 dot11MeshHWMPactivePathTimeout;
u16 dot11MeshHWMPpreqMinInterval;
u16 dot11MeshHWMPnetDiameterTraversalTime;
};

/* from net/wireless.h */
struct wiphy;

Expand Down Expand Up @@ -397,6 +416,12 @@ struct wiphy;
*
* @change_station: Modify a given station.
*
* @get_mesh_params: Put the current mesh parameters into *params
*
* @set_mesh_params: Set mesh parameters.
* The mask is a bitfield which tells us which parameters to
* set, and which to leave alone.
*
* @set_mesh_cfg: set mesh parameters (by now, just mesh id)
*
* @change_bss: Modify parameters for a given BSS.
Expand Down Expand Up @@ -452,7 +477,12 @@ struct cfg80211_ops {
int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev,
int idx, u8 *dst, u8 *next_hop,
struct mpath_info *pinfo);

int (*get_mesh_params)(struct wiphy *wiphy,
struct net_device *dev,
struct mesh_config *conf);
int (*set_mesh_params)(struct wiphy *wiphy,
struct net_device *dev,
const struct mesh_config *nconf, u32 mask);
int (*change_bss)(struct wiphy *wiphy, struct net_device *dev,
struct bss_parameters *params);
};
Expand Down
68 changes: 68 additions & 0 deletions trunk/net/mac80211/cfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -951,6 +951,72 @@ static int ieee80211_dump_mpath(struct wiphy *wiphy, struct net_device *dev,
rcu_read_unlock();
return 0;
}

static int ieee80211_get_mesh_params(struct wiphy *wiphy,
struct net_device *dev,
struct mesh_config *conf)
{
struct ieee80211_sub_if_data *sdata;
sdata = IEEE80211_DEV_TO_SUB_IF(dev);

if (sdata->vif.type != NL80211_IFTYPE_MESH_POINT)
return -ENOTSUPP;
memcpy(conf, &(sdata->u.mesh.mshcfg), sizeof(struct mesh_config));
return 0;
}

static inline bool _chg_mesh_attr(enum nl80211_meshconf_params parm, u32 mask)
{
return (mask >> (parm-1)) & 0x1;
}

static int ieee80211_set_mesh_params(struct wiphy *wiphy,
struct net_device *dev,
const struct mesh_config *nconf, u32 mask)
{
struct mesh_config *conf;
struct ieee80211_sub_if_data *sdata;
sdata = IEEE80211_DEV_TO_SUB_IF(dev);

if (sdata->vif.type != NL80211_IFTYPE_MESH_POINT)
return -ENOTSUPP;

/* Set the config options which we are interested in setting */
conf = &(sdata->u.mesh.mshcfg);
if (_chg_mesh_attr(NL80211_MESHCONF_RETRY_TIMEOUT, mask))
conf->dot11MeshRetryTimeout = nconf->dot11MeshRetryTimeout;
if (_chg_mesh_attr(NL80211_MESHCONF_CONFIRM_TIMEOUT, mask))
conf->dot11MeshConfirmTimeout = nconf->dot11MeshConfirmTimeout;
if (_chg_mesh_attr(NL80211_MESHCONF_HOLDING_TIMEOUT, mask))
conf->dot11MeshHoldingTimeout = nconf->dot11MeshHoldingTimeout;
if (_chg_mesh_attr(NL80211_MESHCONF_MAX_PEER_LINKS, mask))
conf->dot11MeshMaxPeerLinks = nconf->dot11MeshMaxPeerLinks;
if (_chg_mesh_attr(NL80211_MESHCONF_MAX_RETRIES, mask))
conf->dot11MeshMaxRetries = nconf->dot11MeshMaxRetries;
if (_chg_mesh_attr(NL80211_MESHCONF_TTL, mask))
conf->dot11MeshTTL = nconf->dot11MeshTTL;
if (_chg_mesh_attr(NL80211_MESHCONF_AUTO_OPEN_PLINKS, mask))
conf->auto_open_plinks = nconf->auto_open_plinks;
if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES, mask))
conf->dot11MeshHWMPmaxPREQretries =
nconf->dot11MeshHWMPmaxPREQretries;
if (_chg_mesh_attr(NL80211_MESHCONF_PATH_REFRESH_TIME, mask))
conf->path_refresh_time = nconf->path_refresh_time;
if (_chg_mesh_attr(NL80211_MESHCONF_MIN_DISCOVERY_TIMEOUT, mask))
conf->min_discovery_timeout = nconf->min_discovery_timeout;
if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_ACTIVE_PATH_TIMEOUT, mask))
conf->dot11MeshHWMPactivePathTimeout =
nconf->dot11MeshHWMPactivePathTimeout;
if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL, mask))
conf->dot11MeshHWMPpreqMinInterval =
nconf->dot11MeshHWMPpreqMinInterval;
if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME,
mask))
conf->dot11MeshHWMPnetDiameterTraversalTime =
nconf->dot11MeshHWMPnetDiameterTraversalTime;
return 0;
}

#endif

static int ieee80211_change_bss(struct wiphy *wiphy,
Expand Down Expand Up @@ -1007,6 +1073,8 @@ struct cfg80211_ops mac80211_config_ops = {
.change_mpath = ieee80211_change_mpath,
.get_mpath = ieee80211_get_mpath,
.dump_mpath = ieee80211_dump_mpath,
.set_mesh_params = ieee80211_set_mesh_params,
.get_mesh_params = ieee80211_get_mesh_params,
#endif
.change_bss = ieee80211_change_bss,
};
21 changes: 1 addition & 20 deletions trunk/net/mac80211/ieee80211_i.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <linux/types.h>
#include <linux/spinlock.h>
#include <linux/etherdevice.h>
#include <net/cfg80211.h>
#include <net/wireless.h>
#include <net/iw_handler.h>
#include <net/mac80211.h>
Expand Down Expand Up @@ -247,26 +248,6 @@ struct mesh_preq_queue {
u8 flags;
};

struct mesh_config {
/* Timeouts in ms */
/* Mesh plink management parameters */
u16 dot11MeshRetryTimeout;
u16 dot11MeshConfirmTimeout;
u16 dot11MeshHoldingTimeout;
u16 dot11MeshMaxPeerLinks;
u8 dot11MeshMaxRetries;
u8 dot11MeshTTL;
bool auto_open_plinks;
/* HWMP parameters */
u8 dot11MeshHWMPmaxPREQretries;
u32 path_refresh_time;
u16 min_discovery_timeout;
u32 dot11MeshHWMPactivePathTimeout;
u16 dot11MeshHWMPpreqMinInterval;
u16 dot11MeshHWMPnetDiameterTraversalTime;
};


/* flags used in struct ieee80211_if_sta.flags */
#define IEEE80211_STA_SSID_SET BIT(0)
#define IEEE80211_STA_BSSID_SET BIT(1)
Expand Down
Loading

0 comments on commit 5fa62fd

Please sign in to comment.