Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 225341
b: refs/heads/master
c: c80d545
h: refs/heads/master
i:
  225339: 2cd5025
v: v3
  • Loading branch information
Javier Cardona authored and John W. Linville committed Dec 20, 2010
1 parent d1f9d79 commit c553f78
Show file tree
Hide file tree
Showing 13 changed files with 215 additions and 37 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: 24bdd9f4c9af75b33b438d60381a67626de0128d
refs/heads/master: c80d545da3f7c0e534ccd4a780f322f80a92cff1
25 changes: 25 additions & 0 deletions trunk/include/linux/ieee80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -1291,6 +1291,31 @@ enum ieee80211_key_len {
WLAN_KEY_LEN_AES_CMAC = 16,
};

/**
* enum - mesh path selection protocol identifier
*
* @IEEE80211_PATH_PROTOCOL_HWMP: the default path selection protocol
* @IEEE80211_PATH_PROTOCOL_VENDOR: a vendor specific protocol that will
* be specified in a vendor specific information element
*/
enum {
IEEE80211_PATH_PROTOCOL_HWMP = 0,
IEEE80211_PATH_PROTOCOL_VENDOR = 255,
};

/**
* enum - mesh path selection metric identifier
*
* @IEEE80211_PATH_METRIC_AIRTIME: the default path selection metric
* @IEEE80211_PATH_METRIC_VENDOR: a vendor specific metric that will be
* specified in a vendor specific information element
*/
enum {
IEEE80211_PATH_METRIC_AIRTIME = 0,
IEEE80211_PATH_METRIC_VENDOR = 255,
};


/*
* IEEE 802.11-2007 7.3.2.9 Country information element
*
Expand Down
47 changes: 43 additions & 4 deletions trunk/include/linux/nl80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -872,6 +872,9 @@ enum nl80211_commands {
* attributes, specifying what a key should be set as default as.
* See &enum nl80211_key_default_types.
*
* @NL80211_ATTR_MESH_SETUP: Optional mesh setup parameters. These cannot be
* changed once the mesh is active.
*
* @NL80211_ATTR_MAX: highest attribute number currently defined
* @__NL80211_ATTR_AFTER_LAST: internal use
*/
Expand Down Expand Up @@ -1054,6 +1057,8 @@ enum nl80211_attrs {

NL80211_ATTR_MAX_REMAIN_ON_CHANNEL_DURATION,

NL80211_ATTR_MESH_SETUP,

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

__NL80211_ATTR_AFTER_LAST,
Expand Down Expand Up @@ -1564,7 +1569,8 @@ enum nl80211_mntr_flags {
/**
* enum nl80211_meshconf_params - mesh configuration parameters
*
* Mesh configuration parameters
* Mesh configuration parameters. These can be changed while the mesh is
* active.
*
* @__NL80211_MESHCONF_INVALID: internal use
*
Expand All @@ -1587,9 +1593,6 @@ enum nl80211_mntr_flags {
* @NL80211_MESHCONF_TTL: specifies the value of TTL field set at a source mesh
* point.
*
* @NL80211_MESHCONF_ELEMENT_TTL: specifies the value of TTL field set at a
* source mesh point for path selection elements.
*
* @NL80211_MESHCONF_AUTO_OPEN_PLINKS: whether we should automatically
* open peer links when we detect compatible mesh peers.
*
Expand All @@ -1616,6 +1619,9 @@ enum nl80211_mntr_flags {
*
* @NL80211_MESHCONF_ROOTMODE: whether root mode is enabled or not
*
* @NL80211_MESHCONF_ELEMENT_TTL: specifies the value of TTL field set at a
* source mesh point for path selection elements.
*
* @NL80211_MESHCONF_ATTR_MAX: highest possible mesh configuration attribute
*
* @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use
Expand Down Expand Up @@ -1643,6 +1649,39 @@ enum nl80211_meshconf_params {
NL80211_MESHCONF_ATTR_MAX = __NL80211_MESHCONF_ATTR_AFTER_LAST - 1
};

/**
* enum nl80211_mesh_setup_params - mesh setup parameters
*
* Mesh setup parameters. These are used to start/join a mesh and cannot be
* changed while the mesh is active.
*
* @__NL80211_MESH_SETUP_INVALID: Internal use
*
* @NL80211_MESH_SETUP_ENABLE_VENDOR_PATH_SEL: Enable this option to use a
* vendor specific path selection algorithm or disable it to use the default
* HWMP.
*
* @NL80211_MESH_SETUP_ENABLE_VENDOR_METRIC: Enable this option to use a
* vendor specific path metric or disable it to use the default Airtime
* metric.
*
* @NL80211_MESH_SETUP_VENDOR_PATH_SEL_IE: A vendor specific information
* element that vendors will use to identify the path selection methods and
* metrics in use.
*
* @__NL80211_MESH_SETUP_ATTR_AFTER_LAST: Internal use
*/
enum nl80211_mesh_setup_params {
__NL80211_MESH_SETUP_INVALID,
NL80211_MESH_SETUP_ENABLE_VENDOR_PATH_SEL,
NL80211_MESH_SETUP_ENABLE_VENDOR_METRIC,
NL80211_MESH_SETUP_VENDOR_PATH_SEL_IE,

/* keep last */
__NL80211_MESH_SETUP_ATTR_AFTER_LAST,
NL80211_MESH_SETUP_ATTR_MAX = __NL80211_MESH_SETUP_ATTR_AFTER_LAST - 1
};

/**
* enum nl80211_txq_attr - TX queue parameter attributes
* @__NL80211_TXQ_ATTR_INVALID: Attribute number 0 is reserved
Expand Down
8 changes: 8 additions & 0 deletions trunk/include/net/cfg80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -649,12 +649,20 @@ struct mesh_config {
* struct mesh_setup - 802.11s mesh setup configuration
* @mesh_id: the mesh ID
* @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes
* @path_sel_proto: which path selection protocol to use
* @path_metric: which metric to use
* @vendor_ie: vendor information elements (optional)
* @vendor_ie_len: length of vendor information elements
*
* These parameters are fixed when the mesh is created.
*/
struct mesh_setup {
const u8 *mesh_id;
u8 mesh_id_len;
u8 path_sel_proto;
u8 path_metric;
const u8 *vendor_ie;
u8 vendor_ie_len;
};

/**
Expand Down
39 changes: 35 additions & 4 deletions trunk/net/mac80211/cfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -1000,6 +1000,36 @@ static inline bool _chg_mesh_attr(enum nl80211_meshconf_params parm, u32 mask)
return (mask >> (parm-1)) & 0x1;
}

static int copy_mesh_setup(struct ieee80211_if_mesh *ifmsh,
const struct mesh_setup *setup)
{
u8 *new_ie;
const u8 *old_ie;

/* first allocate the new vendor information element */
new_ie = NULL;
old_ie = ifmsh->vendor_ie;

ifmsh->vendor_ie_len = setup->vendor_ie_len;
if (setup->vendor_ie_len) {
new_ie = kmemdup(setup->vendor_ie, setup->vendor_ie_len,
GFP_KERNEL);
if (!new_ie)
return -ENOMEM;
}

/* now copy the rest of the setup parameters */
ifmsh->mesh_id_len = setup->mesh_id_len;
memcpy(ifmsh->mesh_id, setup->mesh_id, ifmsh->mesh_id_len);
ifmsh->mesh_pp_id = setup->path_sel_proto;
ifmsh->mesh_pm_id = setup->path_metric;
ifmsh->vendor_ie = new_ie;

kfree(old_ie);

return 0;
}

static int ieee80211_update_mesh_config(struct wiphy *wiphy,
struct net_device *dev, u32 mask,
const struct mesh_config *nconf)
Expand Down Expand Up @@ -1059,11 +1089,12 @@ static int ieee80211_join_mesh(struct wiphy *wiphy, struct net_device *dev,
{
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
int err;

memcpy(&sdata->u.mesh.mshcfg, conf, sizeof(struct mesh_config));
ifmsh->mesh_id_len = setup->mesh_id_len;
memcpy(ifmsh->mesh_id, setup->mesh_id, ifmsh->mesh_id_len);

memcpy(&ifmsh->mshcfg, conf, sizeof(struct mesh_config));
err = copy_mesh_setup(ifmsh, setup);
if (err)
return err;
ieee80211_start_mesh(sdata);

return 0;
Expand Down
4 changes: 2 additions & 2 deletions trunk/net/mac80211/ieee80211_i.h
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,8 @@ struct ieee80211_if_mesh {
struct mesh_config mshcfg;
u32 mesh_seqnum;
bool accepting_plinks;
const u8 *vendor_ie;
u8 vendor_ie_len;
};

#ifdef CONFIG_MAC80211_MESH
Expand Down Expand Up @@ -585,9 +587,7 @@ struct ieee80211_sub_if_data {
struct ieee80211_if_vlan vlan;
struct ieee80211_if_managed mgd;
struct ieee80211_if_ibss ibss;
#ifdef CONFIG_MAC80211_MESH
struct ieee80211_if_mesh mesh;
#endif
u32 mntr_flags;
} u;

Expand Down
7 changes: 7 additions & 0 deletions trunk/net/mac80211/mesh.c
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,13 @@ void mesh_mgmt_ies_add(struct sk_buff *skb, struct ieee80211_sub_if_data *sdata)
*pos++ |= sdata->u.mesh.accepting_plinks ?
MESHCONF_CAPAB_ACCEPT_PLINKS : 0x00;
*pos++ = 0x00;

if (sdata->u.mesh.vendor_ie) {
int len = sdata->u.mesh.vendor_ie_len;
const u8 *data = sdata->u.mesh.vendor_ie;
if (skb_tailroom(skb) > len)
memcpy(skb_put(skb, len), data, len);
}
}

u32 mesh_table_hash(u8 *addr, struct ieee80211_sub_if_data *sdata, struct mesh_table *tbl)
Expand Down
3 changes: 2 additions & 1 deletion trunk/net/mac80211/mesh_plink.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ static int mesh_plink_frame_tx(struct ieee80211_sub_if_data *sdata,
enum plink_frame_type action, u8 *da, __le16 llid, __le16 plid,
__le16 reason) {
struct ieee80211_local *local = sdata->local;
struct sk_buff *skb = dev_alloc_skb(local->hw.extra_tx_headroom + 400);
struct sk_buff *skb = dev_alloc_skb(local->hw.extra_tx_headroom + 400 +
sdata->u.mesh.vendor_ie_len);
struct ieee80211_mgmt *mgmt;
bool include_plid = false;
static const u8 meshpeeringproto[] = { 0x00, 0x0F, 0xAC, 0x2A };
Expand Down
3 changes: 2 additions & 1 deletion trunk/net/mac80211/tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -2290,7 +2290,8 @@ struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw,
u8 *pos;

/* headroom, head length, tail length and maximum TIM length */
skb = dev_alloc_skb(local->tx_headroom + 400);
skb = dev_alloc_skb(local->tx_headroom + 400 +
sdata->u.mesh.vendor_ie_len);
if (!skb)
goto out;

Expand Down
22 changes: 16 additions & 6 deletions trunk/net/wireless/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -789,13 +789,23 @@ static int cfg80211_netdev_notifier_call(struct notifier_block * nb,
cfg80211_mgd_wext_connect(rdev, wdev);
break;
#endif
#ifdef CONFIG_MAC80211_MESH
case NL80211_IFTYPE_MESH_POINT:
/* backward compat code ... */
if (wdev->mesh_id_up_len)
__cfg80211_join_mesh(rdev, dev, wdev->ssid,
wdev->mesh_id_up_len,
&default_mesh_config);
break;
{
/* backward compat code... */
struct mesh_setup setup;
memcpy(&setup, &default_mesh_setup,
sizeof(setup));
/* back compat only needed for mesh_id */
setup.mesh_id = wdev->ssid;
setup.mesh_id_len = wdev->mesh_id_up_len;
if (wdev->mesh_id_up_len)
__cfg80211_join_mesh(rdev, dev,
&setup,
&default_mesh_config);
break;
}
#endif
default:
break;
}
Expand Down
5 changes: 3 additions & 2 deletions trunk/net/wireless/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -287,13 +287,14 @@ int cfg80211_ibss_wext_join(struct cfg80211_registered_device *rdev,

/* mesh */
extern const struct mesh_config default_mesh_config;
extern const struct mesh_setup default_mesh_setup;
int __cfg80211_join_mesh(struct cfg80211_registered_device *rdev,
struct net_device *dev,
const u8 *mesh_id, u8 mesh_id_len,
const struct mesh_setup *setup,
const struct mesh_config *conf);
int cfg80211_join_mesh(struct cfg80211_registered_device *rdev,
struct net_device *dev,
const u8 *mesh_id, u8 mesh_id_len,
const struct mesh_setup *setup,
const struct mesh_config *conf);
int cfg80211_leave_mesh(struct cfg80211_registered_device *rdev,
struct net_device *dev);
Expand Down
24 changes: 13 additions & 11 deletions trunk/net/wireless/mesh.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,19 @@ const struct mesh_config default_mesh_config = {
.min_discovery_timeout = MESH_MIN_DISCOVERY_TIMEOUT,
};

const struct mesh_setup default_mesh_setup = {
.path_sel_proto = IEEE80211_PATH_PROTOCOL_HWMP,
.path_metric = IEEE80211_PATH_METRIC_AIRTIME,
.vendor_ie = NULL,
.vendor_ie_len = 0,
};

int __cfg80211_join_mesh(struct cfg80211_registered_device *rdev,
struct net_device *dev,
const u8 *mesh_id, u8 mesh_id_len,
const struct mesh_setup *setup,
const struct mesh_config *conf)
{
struct wireless_dev *wdev = dev->ieee80211_ptr;
struct mesh_setup setup = {
.mesh_id = mesh_id,
.mesh_id_len = mesh_id_len,
};
int err;

BUILD_BUG_ON(IEEE80211_MAX_SSID_LEN != IEEE80211_MAX_MESH_ID_LEN);
Expand All @@ -73,31 +75,31 @@ int __cfg80211_join_mesh(struct cfg80211_registered_device *rdev,
if (wdev->mesh_id_len)
return -EALREADY;

if (!mesh_id_len)
if (!setup->mesh_id_len)
return -EINVAL;

if (!rdev->ops->join_mesh)
return -EOPNOTSUPP;

err = rdev->ops->join_mesh(&rdev->wiphy, dev, conf, &setup);
err = rdev->ops->join_mesh(&rdev->wiphy, dev, conf, setup);
if (!err) {
memcpy(wdev->ssid, mesh_id, mesh_id_len);
wdev->mesh_id_len = mesh_id_len;
memcpy(wdev->ssid, setup->mesh_id, setup->mesh_id_len);
wdev->mesh_id_len = setup->mesh_id_len;
}

return err;
}

int cfg80211_join_mesh(struct cfg80211_registered_device *rdev,
struct net_device *dev,
const u8 *mesh_id, u8 mesh_id_len,
const struct mesh_setup *setup,
const struct mesh_config *conf)
{
struct wireless_dev *wdev = dev->ieee80211_ptr;
int err;

wdev_lock(wdev);
err = __cfg80211_join_mesh(rdev, dev, mesh_id, mesh_id_len, conf);
err = __cfg80211_join_mesh(rdev, dev, setup, conf);
wdev_unlock(wdev);

return err;
Expand Down
Loading

0 comments on commit c553f78

Please sign in to comment.