diff --git a/package/mac80211/src/mac80211/Makefile b/package/mac80211/src/mac80211/Makefile index 40fe07c037..0a88dd312a 100644 --- a/package/mac80211/src/mac80211/Makefile +++ b/package/mac80211/src/mac80211/Makefile @@ -13,6 +13,7 @@ mac80211-objs := \ ieee80211_iface.o \ ieee80211_rate.o \ michael.o \ + regdomain.o \ tkip.o \ aes_ccm.o \ wme.o \ diff --git a/package/mac80211/src/mac80211/debugfs_netdev.c b/package/mac80211/src/mac80211/debugfs_netdev.c index b9409eeadf..52a32e4f6a 100644 --- a/package/mac80211/src/mac80211/debugfs_netdev.c +++ b/package/mac80211/src/mac80211/debugfs_netdev.c @@ -87,16 +87,6 @@ static const struct file_operations name##_ops = { \ IEEE80211_IF_FMT_##format(name, field) \ __IEEE80211_IF_FILE(name) -static struct ieee80211_elem_tspec _tspec = { - .nominal_msdu_size = 200, - .inactivity_interval = 40, - .mean_data_rate = 40000, - .min_phy_rate = 6000000, - .surplus_band_allow = 8192, - .medium_time = 30, -}; -static u8 _dls_mac[ETH_ALEN]; - #define DEBUGFS_QOS_FILE(name, f) \ static ssize_t qos_ ##name## _write(struct file *file, \ const char __user *userbuf, \ @@ -104,7 +94,7 @@ static ssize_t qos_ ##name## _write(struct file *file, \ { \ struct ieee80211_sub_if_data *sdata = file->private_data; \ \ - f(sdata->dev, &sdata->u.sta, &_tspec); \ + f(sdata->dev, &sdata->u.sta, &sdata->u.sta.tspec); \ \ return count; \ } \ @@ -132,7 +122,8 @@ DEBUGFS_QOS_FILE(delts_wmm, wmm_send_delts); static ssize_t qos_if_dls_mac(const struct ieee80211_sub_if_data *sdata, char *buf, int buflen) { - return scnprintf(buf, buflen, MAC_FMT "\n", MAC_ARG(_dls_mac)); + return scnprintf(buf, buflen, MAC_FMT "\n", + MAC_ARG(sdata->u.sta.dls_mac)); } static ssize_t qos_dls_mac_read(struct file *file, @@ -163,7 +154,7 @@ static ssize_t qos_dls_mac_write(struct file *file, const char __user *userbuf, printk(KERN_ERR "%s: sscanf input error\n", sdata->dev->name); return -EINVAL; } - memcpy(_dls_mac, m, ETH_ALEN); + memcpy(sdata->u.sta.dls_mac, m, ETH_ALEN); return count; } @@ -207,10 +198,12 @@ static ssize_t qos_dls_op_write(struct file *file, const char __user *userbuf, } switch (opt) { case 1: - ieee80211_send_dls_req(sdata->dev, &sdata->u.sta, _dls_mac, 0); + ieee80211_send_dls_req(sdata->dev, &sdata->u.sta, + sdata->u.sta.dls_mac, 0); break; case 2: - ieee80211_send_dls_teardown(sdata->dev, &sdata->u.sta, _dls_mac, + ieee80211_send_dls_teardown(sdata->dev, &sdata->u.sta, + sdata->u.sta.dls_mac, WLAN_REASON_QSTA_NOT_USE); break; default: @@ -232,8 +225,9 @@ static ssize_t tsinfo_ ##_name## _read(struct file *file, \ size_t count, loff_t *ppos) \ { \ char buf[20]; \ + struct ieee80211_sub_if_data *sdata = file->private_data; \ int res = scnprintf(buf, count, "%u\n", \ - IEEE80211_TSINFO_## _name (_tspec.ts_info)); \ + IEEE80211_TSINFO_## _name (sdata->u.sta.tspec.ts_info));\ return simple_read_from_buffer(userbuf, count, ppos, buf, res); \ } \ \ @@ -244,6 +238,7 @@ static ssize_t tsinfo_ ##_name## _write(struct file *file, \ char buf[20]; \ size_t size; \ int val; \ + struct ieee80211_sub_if_data *sdata = file->private_data; \ \ size = min(sizeof(buf) - 1, count); \ buf[size] = '\0'; \ @@ -252,12 +247,11 @@ static ssize_t tsinfo_ ##_name## _write(struct file *file, \ \ val = simple_strtoul(buf, NULL, 0); \ if ((val < min_val) || (val > max_val)) { \ - struct ieee80211_sub_if_data *sdata = file->private_data;\ printk(KERN_ERR "%s: set value (%u) out of range " \ "[%u, %u]\n",sdata->dev->name,val,min_val,max_val);\ return -EINVAL; \ } \ - SET_TSINFO_ ##_name (_tspec.ts_info, val); \ + IEEE80211_SET_TSINFO_ ##_name (sdata->u.sta.tspec.ts_info, val);\ return count; \ } \ \ @@ -292,13 +286,15 @@ DEBUGFS_TSINFO_FILE(TSID, 8, 15); DEBUGFS_TSINFO_FILE(DIR, 0, 3); DEBUGFS_TSINFO_FILE(UP, 0, 7); -#define DEBUGFS_TSPEC_FILE(name) \ +#define DEBUGFS_TSPEC_FILE(name, format_string, endian_f1, endian_f2) \ static ssize_t tspec_ ##name## _read(struct file *file, \ char __user *userbuf, \ size_t count, loff_t *ppos) \ { \ char buf[20]; \ - int res = scnprintf(buf, count, "%u\n", _tspec.name); \ + struct ieee80211_sub_if_data *sdata = file->private_data; \ + int res = scnprintf(buf, count, format_string "\n", \ + endian_f1(sdata->u.sta.tspec.name)); \ return simple_read_from_buffer(userbuf, count, ppos, buf, res); \ } \ \ @@ -308,13 +304,14 @@ static ssize_t tspec_ ##name## _write(struct file *file, \ { \ char buf[20]; \ size_t size; \ + struct ieee80211_sub_if_data *sdata = file->private_data; \ \ size = min(sizeof(buf) - 1, count); \ buf[size] = '\0'; \ if (copy_from_user(buf, userbuf, size)) \ return -EFAULT; \ \ - _tspec.name = simple_strtoul(buf, NULL, 0); \ + sdata->u.sta.tspec.name = endian_f2(simple_strtoul(buf, NULL, 0));\ return count; \ } \ \ @@ -334,21 +331,21 @@ static const struct file_operations tspec_ ##name## _ops = { \ sdata->debugfs.sta.tspec.name = NULL; \ } while (0) -DEBUGFS_TSPEC_FILE(nominal_msdu_size); -DEBUGFS_TSPEC_FILE(max_msdu_size); -DEBUGFS_TSPEC_FILE(min_service_interval); -DEBUGFS_TSPEC_FILE(max_service_interval); -DEBUGFS_TSPEC_FILE(inactivity_interval); -DEBUGFS_TSPEC_FILE(suspension_interval); -DEBUGFS_TSPEC_FILE(service_start_time); -DEBUGFS_TSPEC_FILE(min_data_rate); -DEBUGFS_TSPEC_FILE(mean_data_rate); -DEBUGFS_TSPEC_FILE(peak_data_rate); -DEBUGFS_TSPEC_FILE(burst_size); -DEBUGFS_TSPEC_FILE(delay_bound); -DEBUGFS_TSPEC_FILE(min_phy_rate); -DEBUGFS_TSPEC_FILE(surplus_band_allow); -DEBUGFS_TSPEC_FILE(medium_time); +DEBUGFS_TSPEC_FILE(nominal_msdu_size, "%hu", le16_to_cpu, cpu_to_le16); +DEBUGFS_TSPEC_FILE(max_msdu_size, "%hu", le16_to_cpu, cpu_to_le16); +DEBUGFS_TSPEC_FILE(min_service_interval, "%u", le32_to_cpu, cpu_to_le32); +DEBUGFS_TSPEC_FILE(max_service_interval, "%u", le32_to_cpu, cpu_to_le32); +DEBUGFS_TSPEC_FILE(inactivity_interval, "%u", le32_to_cpu, cpu_to_le32); +DEBUGFS_TSPEC_FILE(suspension_interval, "%u", le32_to_cpu, cpu_to_le32); +DEBUGFS_TSPEC_FILE(service_start_time, "%u", le32_to_cpu, cpu_to_le32); +DEBUGFS_TSPEC_FILE(min_data_rate, "%u", le32_to_cpu, cpu_to_le32); +DEBUGFS_TSPEC_FILE(mean_data_rate, "%u", le32_to_cpu, cpu_to_le32); +DEBUGFS_TSPEC_FILE(peak_data_rate, "%u", le32_to_cpu, cpu_to_le32); +DEBUGFS_TSPEC_FILE(burst_size, "%u", le32_to_cpu, cpu_to_le32); +DEBUGFS_TSPEC_FILE(delay_bound, "%u", le32_to_cpu, cpu_to_le32); +DEBUGFS_TSPEC_FILE(min_phy_rate, "%u", le32_to_cpu, cpu_to_le32); +DEBUGFS_TSPEC_FILE(surplus_band_allow, "%hu", le16_to_cpu, cpu_to_le16); +DEBUGFS_TSPEC_FILE(medium_time, "%hu", le16_to_cpu, cpu_to_le16); /* common attributes */ @@ -737,7 +734,9 @@ static int netdev_notify(struct notifier_block * nb, void *ndev) { struct net_device *dev = ndev; + /* TODO char buf[10+IFNAMSIZ]; + */ if (state != NETDEV_CHANGENAME) return 0; diff --git a/package/mac80211/src/mac80211/debugfs_sta.c b/package/mac80211/src/mac80211/debugfs_sta.c index fc1a024e2d..6cfe35a994 100644 --- a/package/mac80211/src/mac80211/debugfs_sta.c +++ b/package/mac80211/src/mac80211/debugfs_sta.c @@ -158,7 +158,7 @@ static ssize_t sta_last_seq_ctrl_read(struct file *file, char __user *userbuf, struct sta_info *sta = file->private_data; for (i = 0; i < NUM_RX_DATA_QUEUES; i++) p += scnprintf(p, sizeof(buf)+buf-p, "%x ", - sta->last_seq_ctrl[i]); + le16_to_cpu(sta->last_seq_ctrl[i])); p += scnprintf(p, sizeof(buf)+buf-p, "\n"); return simple_read_from_buffer(userbuf, count, ppos, buf, p - buf); } diff --git a/package/mac80211/src/mac80211/ieee80211.c b/package/mac80211/src/mac80211/ieee80211.c index e903197acf..5202c487ac 100644 --- a/package/mac80211/src/mac80211/ieee80211.c +++ b/package/mac80211/src/mac80211/ieee80211.c @@ -1557,7 +1557,7 @@ static int ieee80211_subif_start_xmit(struct sk_buff *skb, memcpy(hdr.addr4, skb->data + ETH_ALEN, ETH_ALEN); hdrlen = 30; } else if (sdata->type == IEEE80211_IF_TYPE_STA) { - if (dls_link_status(local, skb->data) == DLS_STATUS_OK){ + if (dls_link_status(local, skb->data) == DLS_STATUS_OK) { /* DA SA BSSID */ memcpy(hdr.addr1, skb->data, ETH_ALEN); memcpy(hdr.addr2, skb->data + ETH_ALEN, ETH_ALEN); @@ -4962,7 +4962,7 @@ int ieee80211_register_hwmode(struct ieee80211_hw *hw, } if (!(hw->flags & IEEE80211_HW_DEFAULT_REG_DOMAIN_CONFIGURED)) - ieee80211_init_client(local->mdev); + ieee80211_set_default_regdomain(mode); return 0; } @@ -5113,6 +5113,7 @@ static int __init ieee80211_init(void) } ieee80211_debugfs_netdev_init(); + ieee80211_regdomain_init(); return 0; } diff --git a/package/mac80211/src/mac80211/ieee80211_cfg.c b/package/mac80211/src/mac80211/ieee80211_cfg.c index 0069826713..8f85bc273c 100644 --- a/package/mac80211/src/mac80211/ieee80211_cfg.c +++ b/package/mac80211/src/mac80211/ieee80211_cfg.c @@ -13,7 +13,7 @@ #include "ieee80211_cfg.h" static int ieee80211_add_iface(struct wiphy *wiphy, char *name, - unsigned int type) + enum nl80211_iftype type) { struct ieee80211_local *local = wiphy_priv(wiphy); int itype; diff --git a/package/mac80211/src/mac80211/ieee80211_i.h b/package/mac80211/src/mac80211/ieee80211_i.h index 2bb34ffe07..880a73075e 100644 --- a/package/mac80211/src/mac80211/ieee80211_i.h +++ b/package/mac80211/src/mac80211/ieee80211_i.h @@ -296,6 +296,10 @@ struct ieee80211_if_sta { #define STA_TSDIR_NUM 2 /* EDCA: 0~7, HCCA: 8~15 */ struct sta_ts_data ts_data[STA_TSID_NUM][STA_TSDIR_NUM]; +#ifdef CONFIG_MAC80211_DEBUGFS + struct ieee80211_elem_tspec tspec; + u8 dls_mac[ETH_ALEN]; +#endif }; @@ -833,7 +837,6 @@ void ieee80211_update_default_wep_only(struct ieee80211_local *local); /* ieee80211_ioctl.c */ int ieee80211_set_compression(struct ieee80211_local *local, struct net_device *dev, struct sta_info *sta); -int ieee80211_init_client(struct net_device *dev); int ieee80211_set_channel(struct ieee80211_local *local, int channel, int freq); /* ieee80211_sta.c */ void ieee80211_sta_timer(unsigned long data); @@ -873,7 +876,7 @@ void wmm_send_delts(struct net_device *dev, struct ieee80211_elem_tspec *tp); void ieee80211_send_dls_req(struct net_device *dev, struct ieee80211_if_sta *ifsta, - u8 *addr, u32 timeout); + u8 *addr, u16 timeout); void ieee80211_send_dls_teardown(struct net_device *dev, struct ieee80211_if_sta *ifsta, u8 *mac, u16 reason); @@ -895,6 +898,10 @@ void ieee80211_if_sdata_init(struct ieee80211_sub_if_data *sdata); int ieee80211_if_add_mgmt(struct ieee80211_local *local); void ieee80211_if_del_mgmt(struct ieee80211_local *local); +/* regdomain.c */ +void ieee80211_regdomain_init(void); +void ieee80211_set_default_regdomain(struct ieee80211_hw_mode *mode); + /* for wiphy privid */ extern void *mac80211_wiphy_privid; diff --git a/package/mac80211/src/mac80211/ieee80211_iface.c b/package/mac80211/src/mac80211/ieee80211_iface.c index c5c8bab241..683d2751c2 100644 --- a/package/mac80211/src/mac80211/ieee80211_iface.c +++ b/package/mac80211/src/mac80211/ieee80211_iface.c @@ -198,6 +198,14 @@ void ieee80211_if_set_type(struct net_device *dev, int type) /* Initialize non-AP QSTA QoS Params */ ifsta->dot11EDCAAveragingPeriod = 5; ifsta->MPDUExchangeTime = 0; +#ifdef CONFIG_MAC80211_DEBUGFS + ifsta->tspec.nominal_msdu_size = cpu_to_le16(200), + ifsta->tspec.inactivity_interval = cpu_to_le32(40), + ifsta->tspec.mean_data_rate = cpu_to_le32(40000), + ifsta->tspec.min_phy_rate = cpu_to_le32(6000000), + ifsta->tspec.surplus_band_allow = cpu_to_le16(8192), + ifsta->tspec.medium_time = cpu_to_le16(30), +#endif msdata = IEEE80211_DEV_TO_SUB_IF(sdata->local->mdev); sdata->bss = &msdata->u.ap; diff --git a/package/mac80211/src/mac80211/ieee80211_ioctl.c b/package/mac80211/src/mac80211/ieee80211_ioctl.c index 36dc32a61c..fcea8b2883 100644 --- a/package/mac80211/src/mac80211/ieee80211_ioctl.c +++ b/package/mac80211/src/mac80211/ieee80211_ioctl.c @@ -27,20 +27,6 @@ #include "aes_ccm.h" #include "debugfs_key.h" -static int ieee80211_regdom = 0x10; /* FCC */ -module_param(ieee80211_regdom, int, 0444); -MODULE_PARM_DESC(ieee80211_regdom, "IEEE 802.11 regulatory domain; 64=MKK"); - -/* - * If firmware is upgraded by the vendor, additional channels can be used based - * on the new Japanese regulatory rules. This is indicated by setting - * ieee80211_japan_5ghz module parameter to one when loading the 80211 kernel - * module. - */ -static int ieee80211_japan_5ghz /* = 0 */; -module_param(ieee80211_japan_5ghz, int, 0444); -MODULE_PARM_DESC(ieee80211_japan_5ghz, "Vendor-updated firmware for 5 GHz"); - static int ieee80211_ioctl_set_beacon(struct net_device *dev, struct prism2_hostapd_param *param, @@ -1556,125 +1542,6 @@ static int ieee80211_ioctl_giwrange(struct net_device *dev, } -struct ieee80211_channel_range { - short start_freq; - short end_freq; - unsigned char power_level; - unsigned char antenna_max; -}; - -static const struct ieee80211_channel_range ieee80211_fcc_channels[] = { - { 2412, 2462, 27, 6 } /* IEEE 802.11b/g, channels 1..11 */, - { 5180, 5240, 17, 6 } /* IEEE 802.11a, channels 36..48 */, - { 5260, 5320, 23, 6 } /* IEEE 802.11a, channels 52..64 */, - { 5745, 5825, 30, 6 } /* IEEE 802.11a, channels 149..165, outdoor */, - { 0 } -}; - -static const struct ieee80211_channel_range ieee80211_mkk_channels[] = { - { 2412, 2472, 20, 6 } /* IEEE 802.11b/g, channels 1..13 */, - { 5170, 5240, 20, 6 } /* IEEE 802.11a, channels 34..48 */, - { 5260, 5320, 20, 6 } /* IEEE 802.11a, channels 52..64 */, - { 0 } -}; - - -static const struct ieee80211_channel_range *channel_range = - ieee80211_fcc_channels; - - -static void ieee80211_unmask_channel(struct net_device *dev, int mode, - struct ieee80211_channel *chan) -{ - int i; - - chan->flag = 0; - - if (ieee80211_regdom == 64 && - (mode == MODE_ATHEROS_TURBO || mode == MODE_ATHEROS_TURBOG)) { - /* Do not allow Turbo modes in Japan. */ - return; - } - - for (i = 0; channel_range[i].start_freq; i++) { - const struct ieee80211_channel_range *r = &channel_range[i]; - if (r->start_freq <= chan->freq && r->end_freq >= chan->freq) { - if (ieee80211_regdom == 64 && !ieee80211_japan_5ghz && - chan->freq >= 5260 && chan->freq <= 5320) { - /* - * Skip new channels in Japan since the - * firmware was not marked having been upgraded - * by the vendor. - */ - continue; - } - - if (ieee80211_regdom == 0x10 && - (chan->freq == 5190 || chan->freq == 5210 || - chan->freq == 5230)) { - /* Skip MKK channels when in FCC domain. */ - continue; - } - - chan->flag |= IEEE80211_CHAN_W_SCAN | - IEEE80211_CHAN_W_ACTIVE_SCAN | - IEEE80211_CHAN_W_IBSS; - chan->power_level = r->power_level; - chan->antenna_max = r->antenna_max; - - if (ieee80211_regdom == 64 && - (chan->freq == 5170 || chan->freq == 5190 || - chan->freq == 5210 || chan->freq == 5230)) { - /* - * New regulatory rules in Japan have backwards - * compatibility with old channels in 5.15-5.25 - * GHz band, but the station is not allowed to - * use active scan on these old channels. - */ - chan->flag &= ~IEEE80211_CHAN_W_ACTIVE_SCAN; - } - - if (ieee80211_regdom == 64 && - (chan->freq == 5260 || chan->freq == 5280 || - chan->freq == 5300 || chan->freq == 5320)) { - /* - * IBSS is not allowed on 5.25-5.35 GHz band - * due to radar detection requirements. - */ - chan->flag &= ~IEEE80211_CHAN_W_IBSS; - } - - break; - } - } -} - - -static int ieee80211_unmask_channels(struct net_device *dev) -{ - struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); - struct ieee80211_hw_mode *mode; - int c; - - list_for_each_entry(mode, &local->modes_list, list) { - for (c = 0; c < mode->num_channels; c++) { - ieee80211_unmask_channel(dev, mode->mode, - &mode->channels[c]); - } - } - return 0; -} - - -int ieee80211_init_client(struct net_device *dev) -{ - if (ieee80211_regdom == 0x40) - channel_range = ieee80211_mkk_channels; - ieee80211_unmask_channels(dev); - return 0; -} - - static int ieee80211_ioctl_siwmode(struct net_device *dev, struct iw_request_info *info, __u32 *mode, char *extra) diff --git a/package/mac80211/src/mac80211/ieee80211_sta.c b/package/mac80211/src/mac80211/ieee80211_sta.c index 9fdd2659df..0e4501db74 100644 --- a/package/mac80211/src/mac80211/ieee80211_sta.c +++ b/package/mac80211/src/mac80211/ieee80211_sta.c @@ -714,7 +714,7 @@ static void ieee80211_send_disassoc(struct net_device *dev, } -int ieee80211_ts_index(u8 direction) +static int ieee80211_ts_index(u8 direction) { if (direction == WLAN_TSINFO_DOWNLINK || direction == WLAN_TSINFO_DIRECTLINK) @@ -822,11 +822,11 @@ void ieee80211_send_delts(struct net_device *dev, struct sk_buff *skb; u8 tsid = IEEE80211_TSINFO_TSID(tp->ts_info); u8 direction = IEEE80211_TSINFO_DIR(tp->ts_info); - u32 medium_time = tp->medium_time; + u16 medium_time = le16_to_cpu(tp->medium_time); u8 index = ieee80211_ts_index(direction); if (ifsta->ts_data[tsid][index].status == TS_STATUS_UNUSED) { - printk(KERN_DEBUG "%s: Tring to delete an ACM disabled TS " + printk(KERN_DEBUG "%s: Trying to delete an ACM disabled TS " "(%u:%u)\n", dev->name, tsid, direction); return; } @@ -859,11 +859,11 @@ void ieee80211_send_delts(struct net_device *dev, memset(&mgmt->u.action.u.delts.ts_info, 0, sizeof(struct ieee80211_ts_info)); - SET_TSINFO_TSID(tp->ts_info, tsid); - SET_TSINFO_DIR(tp->ts_info, direction); - SET_TSINFO_POLICY(tp->ts_info, WLAN_TSINFO_EDCA); - SET_TSINFO_APSD(tp->ts_info, WLAN_TSINFO_PSB_LEGACY); - SET_TSINFO_UP(tp->ts_info, ifsta->ts_data[tsid][index].up); + IEEE80211_SET_TSINFO_TSID(tp->ts_info, tsid); + IEEE80211_SET_TSINFO_DIR(tp->ts_info, direction); + IEEE80211_SET_TSINFO_POLICY(tp->ts_info, WLAN_TSINFO_EDCA); + IEEE80211_SET_TSINFO_APSD(tp->ts_info, WLAN_TSINFO_PSB_LEGACY); + IEEE80211_SET_TSINFO_UP(tp->ts_info, ifsta->ts_data[tsid][index].up); ieee80211_sta_tx(dev, skb, 0); } @@ -878,7 +878,7 @@ void wmm_send_delts(struct net_device *dev, struct sk_buff *skb; u8 tsid = IEEE80211_TSINFO_TSID(tp->ts_info); u8 direction = IEEE80211_TSINFO_DIR(tp->ts_info); - u32 medium_time = tp->medium_time; + u16 medium_time = le16_to_cpu(tp->medium_time); u8 index = ieee80211_ts_index(direction); u8 *pos; @@ -930,11 +930,11 @@ void wmm_send_delts(struct net_device *dev, tspec = (struct ieee80211_elem_tspec *)pos; memset(tspec, 0, sizeof(*tspec)); - SET_TSINFO_TSID(tspec->ts_info, tsid); - SET_TSINFO_DIR(tspec->ts_info, direction); - SET_TSINFO_POLICY(tspec->ts_info, WLAN_TSINFO_EDCA); - SET_TSINFO_APSD(tspec->ts_info, WLAN_TSINFO_PSB_LEGACY); - SET_TSINFO_UP(tspec->ts_info, ifsta->ts_data[tsid][index].up); + IEEE80211_SET_TSINFO_TSID(tspec->ts_info, tsid); + IEEE80211_SET_TSINFO_DIR(tspec->ts_info, direction); + IEEE80211_SET_TSINFO_POLICY(tspec->ts_info, WLAN_TSINFO_EDCA); + IEEE80211_SET_TSINFO_APSD(tspec->ts_info, WLAN_TSINFO_PSB_LEGACY); + IEEE80211_SET_TSINFO_UP(tspec->ts_info, ifsta->ts_data[tsid][index].up); ieee80211_sta_tx(dev, skb, 0); } @@ -942,7 +942,7 @@ void wmm_send_delts(struct net_device *dev, void ieee80211_send_dls_req(struct net_device *dev, struct ieee80211_if_sta *ifsta, - u8 *addr, u32 timeout) + u8 *addr, u16 timeout) { struct ieee80211_hw_mode *mode; struct sk_buff *skb; @@ -972,7 +972,7 @@ void ieee80211_send_dls_req(struct net_device *dev, memcpy(mgmt->u.action.u.dls_req.dest, addr, ETH_ALEN); memcpy(mgmt->u.action.u.dls_req.src, dev->dev_addr, ETH_ALEN); mgmt->u.action.u.dls_req.capab_info = cpu_to_le16(ifsta->ap_capab); - mgmt->u.action.u.dls_req.timeout = timeout; + mgmt->u.action.u.dls_req.timeout = cpu_to_le16(timeout); /* Add supported rates and extended supported rates */ supp_rates = skb_put(skb, 2); diff --git a/package/mac80211/src/mac80211/rc80211_simple.c b/package/mac80211/src/mac80211/rc80211_simple.c index 8f1f351be7..5ae7fc4546 100644 --- a/package/mac80211/src/mac80211/rc80211_simple.c +++ b/package/mac80211/src/mac80211/rc80211_simple.c @@ -289,9 +289,10 @@ static void rate_control_simple_rate_init(void *priv, void *priv_sta, * as a workaround, */ for (i = 0; i < mode->num_rates; i++) { if ((sta->supp_rates & BIT(i)) && - (mode->rates[i].flags & IEEE80211_RATE_SUPPORTED)) + (mode->rates[i].flags & IEEE80211_RATE_SUPPORTED)) { sta->txrate = i; break; + } } } diff --git a/package/mac80211/src/mac80211/regdomain.c b/package/mac80211/src/mac80211/regdomain.c new file mode 100644 index 0000000000..32e5dca6b6 --- /dev/null +++ b/package/mac80211/src/mac80211/regdomain.c @@ -0,0 +1,157 @@ +/* + * Copyright 2002-2005, Instant802 Networks, Inc. + * Copyright 2005-2006, Devicescape Software, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +/* + * This regulatory domain control implementation is known to be incomplete + * and confusing. mac80211 regulatory domain control will be significantly + * reworked in the not-too-distant future. + * + * For now, drivers wishing to control which channels are and aren't available + * are advised as follows: + * - set the IEEE80211_HW_DEFAULT_REG_DOMAIN_CONFIGURED flag + * - continue to include *ALL* possible channels in the modes registered + * through ieee80211_register_hwmode() + * - for each allowable ieee80211_channel structure registered in the above + * call, set the flag member to some meaningful value such as + * IEEE80211_CHAN_W_SCAN | IEEE80211_CHAN_W_ACTIVE_SCAN | + * IEEE80211_CHAN_W_IBSS. + * - leave flag as 0 for non-allowable channels + * + * The usual implementation is for a driver to read a device EEPROM to + * determine which regulatory domain it should be operating under, then + * looking up the allowable channels in a driver-local table, then performing + * the above. + */ + +#include +#include +#include + +static int ieee80211_regdom = 0x10; /* FCC */ +module_param(ieee80211_regdom, int, 0444); +MODULE_PARM_DESC(ieee80211_regdom, "IEEE 802.11 regulatory domain; 64=MKK"); + +/* + * If firmware is upgraded by the vendor, additional channels can be used based + * on the new Japanese regulatory rules. This is indicated by setting + * ieee80211_japan_5ghz module parameter to one when loading the 80211 kernel + * module. + */ +static int ieee80211_japan_5ghz /* = 0 */; +module_param(ieee80211_japan_5ghz, int, 0444); +MODULE_PARM_DESC(ieee80211_japan_5ghz, "Vendor-updated firmware for 5 GHz"); + + +struct ieee80211_channel_range { + short start_freq; + short end_freq; + unsigned char power_level; + unsigned char antenna_max; +}; + +static const struct ieee80211_channel_range ieee80211_fcc_channels[] = { + { 2412, 2462, 27, 6 } /* IEEE 802.11b/g, channels 1..11 */, + { 5180, 5240, 17, 6 } /* IEEE 802.11a, channels 36..48 */, + { 5260, 5320, 23, 6 } /* IEEE 802.11a, channels 52..64 */, + { 5745, 5825, 30, 6 } /* IEEE 802.11a, channels 149..165, outdoor */, + { 0 } +}; + +static const struct ieee80211_channel_range ieee80211_mkk_channels[] = { + { 2412, 2472, 20, 6 } /* IEEE 802.11b/g, channels 1..13 */, + { 5170, 5240, 20, 6 } /* IEEE 802.11a, channels 34..48 */, + { 5260, 5320, 20, 6 } /* IEEE 802.11a, channels 52..64 */, + { 0 } +}; + + +static const struct ieee80211_channel_range *channel_range = + ieee80211_fcc_channels; + + +static void ieee80211_unmask_channel(int mode, struct ieee80211_channel *chan) +{ + int i; + + chan->flag = 0; + + if (ieee80211_regdom == 64 && + (mode == MODE_ATHEROS_TURBO || mode == MODE_ATHEROS_TURBOG)) { + /* Do not allow Turbo modes in Japan. */ + return; + } + + for (i = 0; channel_range[i].start_freq; i++) { + const struct ieee80211_channel_range *r = &channel_range[i]; + if (r->start_freq <= chan->freq && r->end_freq >= chan->freq) { + if (ieee80211_regdom == 64 && !ieee80211_japan_5ghz && + chan->freq >= 5260 && chan->freq <= 5320) { + /* + * Skip new channels in Japan since the + * firmware was not marked having been upgraded + * by the vendor. + */ + continue; + } + + if (ieee80211_regdom == 0x10 && + (chan->freq == 5190 || chan->freq == 5210 || + chan->freq == 5230)) { + /* Skip MKK channels when in FCC domain. */ + continue; + } + + chan->flag |= IEEE80211_CHAN_W_SCAN | + IEEE80211_CHAN_W_ACTIVE_SCAN | + IEEE80211_CHAN_W_IBSS; + chan->power_level = r->power_level; + chan->antenna_max = r->antenna_max; + + if (ieee80211_regdom == 64 && + (chan->freq == 5170 || chan->freq == 5190 || + chan->freq == 5210 || chan->freq == 5230)) { + /* + * New regulatory rules in Japan have backwards + * compatibility with old channels in 5.15-5.25 + * GHz band, but the station is not allowed to + * use active scan on these old channels. + */ + chan->flag &= ~IEEE80211_CHAN_W_ACTIVE_SCAN; + } + + if (ieee80211_regdom == 64 && + (chan->freq == 5260 || chan->freq == 5280 || + chan->freq == 5300 || chan->freq == 5320)) { + /* + * IBSS is not allowed on 5.25-5.35 GHz band + * due to radar detection requirements. + */ + chan->flag &= ~IEEE80211_CHAN_W_IBSS; + } + + break; + } + } +} + + +void ieee80211_set_default_regdomain(struct ieee80211_hw_mode *mode) +{ + int c; + for (c = 0; c < mode->num_channels; c++) + ieee80211_unmask_channel(mode->mode, &mode->channels[c]); +} + + +void ieee80211_regdomain_init(void) +{ + if (ieee80211_regdom == 0x40) + channel_range = ieee80211_mkk_channels; +} + diff --git a/package/mac80211/src/wireless/nl80211.c b/package/mac80211/src/wireless/nl80211.c index d6a44a386c..ffbe6288a2 100644 --- a/package/mac80211/src/wireless/nl80211.c +++ b/package/mac80211/src/wireless/nl80211.c @@ -293,7 +293,7 @@ static int nl80211_add_virt_intf(struct sk_buff *skb, struct genl_info *info) { struct cfg80211_registered_device *drv; int err; - unsigned int type = NL80211_IFTYPE_UNSPECIFIED; + enum nl80211_iftype type = NL80211_IFTYPE_UNSPECIFIED; if (!info->attrs[NL80211_ATTR_IFNAME]) return -EINVAL; @@ -353,7 +353,7 @@ static int nl80211_change_virt_intf(struct sk_buff *skb, struct genl_info *info) { struct cfg80211_registered_device *drv; int err, ifindex; - unsigned int type; + enum nl80211_iftype type; struct net_device *dev; if (info->attrs[NL80211_ATTR_IFTYPE]) { diff --git a/target/linux/generic-2.6/patches-2.6.22/210-mac80211_include_wireless_dev.patch b/target/linux/generic-2.6/patches-2.6.22/210-mac80211_include_wireless_dev.patch index c7f3fd54d0..ae2ff48ee9 100644 --- a/target/linux/generic-2.6/patches-2.6.22/210-mac80211_include_wireless_dev.patch +++ b/target/linux/generic-2.6/patches-2.6.22/210-mac80211_include_wireless_dev.patch @@ -1,8 +1,8 @@ -Index: linux-2.6.22-rc4/include/linux/ieee80211.h +Index: linux-2.6.22-rc5/include/linux/ieee80211.h =================================================================== ---- linux-2.6.22-rc4.orig/include/linux/ieee80211.h 2007-06-10 21:32:10.000000000 +0100 -+++ linux-2.6.22-rc4/include/linux/ieee80211.h 2007-06-10 21:33:26.000000000 +0100 -@@ -106,6 +106,69 @@ +--- linux-2.6.22-rc5.orig/include/linux/ieee80211.h 2007-06-21 23:26:23.000000000 +0100 ++++ linux-2.6.22-rc5/include/linux/ieee80211.h 2007-06-21 23:35:39.000000000 +0100 +@@ -106,6 +106,75 @@ } __attribute__ ((packed)); @@ -24,28 +24,34 @@ Index: linux-2.6.22-rc4/include/linux/ieee80211.h +}__attribute__ ((packed)); + + -+#define IEEE80211_TSINFO_TYPE(a) ((a.short1 & 0x0001) >> 0) -+#define IEEE80211_TSINFO_TSID(a) ((a.short1 & 0x001E) >> 1) -+#define IEEE80211_TSINFO_DIR(a) ((a.short1 & 0x0060) >> 5) -+#define IEEE80211_TSINFO_POLICY(a) ((a.short1 & 0x0180) >> 7) -+#define IEEE80211_TSINFO_AGG(a) ((a.short1 & 0x0200) >> 9) -+#define IEEE80211_TSINFO_APSD(a) ((a.short1 & 0x0400) >> 10) -+#define IEEE80211_TSINFO_UP(a) ((a.short1 & 0x3800) >> 11) -+#define IEEE80211_TSINFO_ACK(a) ((a.short1 & 0xC000) >> 14) ++#define IEEE80211_TSINFO_TYPE(a) ((a.byte1 & 0x01) >> 0) ++#define IEEE80211_TSINFO_TSID(a) ((a.byte1 & 0x1E) >> 1) ++#define IEEE80211_TSINFO_DIR(a) ((a.byte1 & 0x60) >> 5) ++#define IEEE80211_TSINFO_POLICY(a) ((a.byte1 & 0x80) >> 7 + \ ++ (a.byte2 & 0x01) << 1) ++#define IEEE80211_TSINFO_AGG(a) ((a.byte2 & 0x02) >> 1) ++#define IEEE80211_TSINFO_APSD(a) ((a.byte2 & 0x04) >> 2) ++#define IEEE80211_TSINFO_UP(a) ((a.byte2 & 0x38) >> 3) ++#define IEEE80211_TSINFO_ACK(a) ((a.byte2 & 0xC0) >> 6) +#define IEEE80211_TSINFO_SCHEDULE(a) ((a.byte3 & 0x01) >> 0) + -+#define SET_TSINFO_TYPE(i, d) (i.short1 |= (d << 0) & 0x0001) -+#define SET_TSINFO_TSID(i, d) (i.short1 |= (d << 1) & 0x001E) -+#define SET_TSINFO_DIR(i, d) (i.short1 |= (d << 5) & 0x0060) -+#define SET_TSINFO_POLICY(i, d) (i.short1 |= (d << 7) & 0x0180) -+#define SET_TSINFO_AGG(i, d) (i.short1 |= (d << 9) & 0x0200) -+#define SET_TSINFO_APSD(i, d) (i.short1 |= (d << 10) & 0x0400) -+#define SET_TSINFO_UP(i, d) (i.short1 |= (d << 11) & 0x3800) -+#define SET_TSINFO_ACK(i, d) (i.short1 |= (d << 14) & 0xC000) -+#define SET_TSINFO_SCHEDULE(i, d) (i.byte3 |= (d << 0) & 0x01) ++#define IEEE80211_SET_TSINFO_TYPE(i, d) (i.byte1 |= (d << 0) & 0x01) ++#define IEEE80211_SET_TSINFO_TSID(i, d) (i.byte1 |= (d << 1) & 0x1E) ++#define IEEE80211_SET_TSINFO_DIR(i, d) (i.byte1 |= (d << 5) & 0x60) ++#define IEEE80211_SET_TSINFO_POLICY(i, d) \ ++do { \ ++ i.byte1 |= (d & 0x01) << 7; \ ++ i.byte2 |= (d & 0x02) >> 1; \ ++} while(0) ++#define IEEE80211_SET_TSINFO_AGG(i, d) (i.byte2 |= (d << 1) & 0x02) ++#define IEEE80211_SET_TSINFO_APSD(i, d) (i.byte2 |= (d << 2) & 0x04) ++#define IEEE80211_SET_TSINFO_UP(i, d) (i.byte2 |= (d << 3) & 0x38) ++#define IEEE80211_SET_TSINFO_ACK(i, d) (i.byte2 |= (d << 6) & 0xC0) ++#define IEEE80211_SET_TSINFO_SCHEDULE(i, d) (i.byte3 |= (d << 0) & 0x01) + +struct ieee80211_ts_info { -+ __le16 short1; ++ u8 byte1; ++ u8 byte2; + u8 byte3; +} __attribute__ ((packed)); + @@ -72,7 +78,7 @@ Index: linux-2.6.22-rc4/include/linux/ieee80211.h struct ieee80211_mgmt { __le16 frame_control; __le16 duration; -@@ -173,9 +236,51 @@ +@@ -173,9 +242,51 @@ struct { u8 action_code; u8 dialog_token; @@ -124,7 +130,7 @@ Index: linux-2.6.22-rc4/include/linux/ieee80211.h struct{ u8 action_code; u8 element_id; -@@ -184,6 +289,25 @@ +@@ -184,6 +295,25 @@ u8 new_chan; u8 switch_count; } __attribute__((packed)) chan_switch; @@ -150,7 +156,7 @@ Index: linux-2.6.22-rc4/include/linux/ieee80211.h } u; } __attribute__ ((packed)) action; } u; -@@ -259,6 +383,18 @@ +@@ -259,6 +389,18 @@ WLAN_STATUS_UNSUPP_RSN_VERSION = 44, WLAN_STATUS_INVALID_RSN_IE_CAP = 45, WLAN_STATUS_CIPHER_SUITE_REJECTED = 46, @@ -169,7 +175,7 @@ Index: linux-2.6.22-rc4/include/linux/ieee80211.h }; -@@ -289,9 +425,50 @@ +@@ -289,9 +431,50 @@ WLAN_REASON_INVALID_RSN_IE_CAP = 22, WLAN_REASON_IEEE8021X_FAILED = 23, WLAN_REASON_CIPHER_SUITE_REJECTED = 24, @@ -220,7 +226,7 @@ Index: linux-2.6.22-rc4/include/linux/ieee80211.h /* Information Element IDs */ enum ieee80211_eid { WLAN_EID_SSID = 0, -@@ -307,6 +484,15 @@ +@@ -307,6 +490,15 @@ WLAN_EID_HP_PARAMS = 8, WLAN_EID_HP_TABLE = 9, WLAN_EID_REQUEST = 10, @@ -236,7 +242,7 @@ Index: linux-2.6.22-rc4/include/linux/ieee80211.h /* 802.11h */ WLAN_EID_PWR_CONSTRAINT = 32, WLAN_EID_PWR_CAPABILITY = 33, -@@ -321,6 +507,9 @@ +@@ -321,6 +513,9 @@ /* 802.11g */ WLAN_EID_ERP_INFO = 42, WLAN_EID_EXT_SUPP_RATES = 50, @@ -246,7 +252,7 @@ Index: linux-2.6.22-rc4/include/linux/ieee80211.h /* 802.11i */ WLAN_EID_RSN = 48, WLAN_EID_WPA = 221, -@@ -329,6 +518,9 @@ +@@ -329,6 +524,9 @@ WLAN_EID_QOS_PARAMETER = 222 }; @@ -256,7 +262,7 @@ Index: linux-2.6.22-rc4/include/linux/ieee80211.h /* cipher suite selectors */ #define WLAN_CIPHER_SUITE_USE_GROUP 0x000FAC00 #define WLAN_CIPHER_SUITE_WEP40 0x000FAC01 -@@ -339,4 +531,37 @@ +@@ -339,4 +537,37 @@ #define WLAN_MAX_KEY_LEN 32 @@ -294,10 +300,10 @@ Index: linux-2.6.22-rc4/include/linux/ieee80211.h +}; + #endif /* IEEE80211_H */ -Index: linux-2.6.22-rc4/include/linux/nl80211.h +Index: linux-2.6.22-rc5/include/linux/nl80211.h =================================================================== ---- linux-2.6.22-rc4.orig/include/linux/nl80211.h 2007-06-10 21:32:10.000000000 +0100 -+++ linux-2.6.22-rc4/include/linux/nl80211.h 2007-06-10 21:33:26.000000000 +0100 +--- linux-2.6.22-rc5.orig/include/linux/nl80211.h 2007-06-21 23:26:23.000000000 +0100 ++++ linux-2.6.22-rc5/include/linux/nl80211.h 2007-06-21 23:34:24.000000000 +0100 @@ -7,6 +7,217 @@ */ @@ -573,11 +579,19 @@ Index: linux-2.6.22-rc4/include/linux/nl80211.h +#define NL80211_KEYTYPE_MAX (__NL80211_KEYTYPE_AFTER_LAST - 1) + #endif /* __LINUX_NL80211_H */ -Index: linux-2.6.22-rc4/include/net/cfg80211.h +Index: linux-2.6.22-rc5/include/net/cfg80211.h =================================================================== ---- linux-2.6.22-rc4.orig/include/net/cfg80211.h 2007-06-10 21:32:10.000000000 +0100 -+++ linux-2.6.22-rc4/include/net/cfg80211.h 2007-06-10 21:33:26.000000000 +0100 -@@ -11,6 +11,69 @@ +--- linux-2.6.22-rc5.orig/include/net/cfg80211.h 2007-06-21 23:26:23.000000000 +0100 ++++ linux-2.6.22-rc5/include/net/cfg80211.h 2007-06-21 23:35:53.000000000 +0100 +@@ -3,6 +3,7 @@ + + #include + #include ++#include + #include + + /* +@@ -11,6 +12,69 @@ * Copyright 2006 Johannes Berg */ @@ -588,7 +602,7 @@ Index: linux-2.6.22-rc4/include/net/cfg80211.h + * @active: scan actively or passively on this channel + */ +struct scan_channel { -+ int phymode; ++ enum nl80211_phymode phymode; + u32 channel; + int active; +}; @@ -606,7 +620,7 @@ Index: linux-2.6.22-rc4/include/net/cfg80211.h +struct scan_params { + int n_channels; + int active; -+ int phymode; ++ enum nl80211_phymode phymode; + struct scan_channel *channels; +}; + @@ -647,7 +661,7 @@ Index: linux-2.6.22-rc4/include/net/cfg80211.h /* from net/wireless.h */ struct wiphy; -@@ -30,11 +93,62 @@ +@@ -30,11 +94,62 @@ * @add_virtual_intf: create a new virtual interface with the given name * * @del_virtual_intf: remove the virtual interface determined by ifindex. @@ -674,10 +688,11 @@ Index: linux-2.6.22-rc4/include/net/cfg80211.h */ struct cfg80211_ops { int (*add_virtual_intf)(struct wiphy *wiphy, char *name, - unsigned int type); +- unsigned int type); ++ enum nl80211_iftype type); int (*del_virtual_intf)(struct wiphy *wiphy, int ifindex); + int (*change_virtual_intf)(struct wiphy *wiphy, int ifindex, -+ unsigned int type); ++ enum nl80211_iftype type); + + int (*associate)(struct wiphy *wiphy, struct net_device *dev, + struct association_params *params); @@ -710,10 +725,10 @@ Index: linux-2.6.22-rc4/include/net/cfg80211.h + u32 seq, int flags, u8 cmd); + #endif /* __NET_CFG80211_H */ -Index: linux-2.6.22-rc4/include/net/iw_handler.h +Index: linux-2.6.22-rc5/include/net/iw_handler.h =================================================================== ---- linux-2.6.22-rc4.orig/include/net/iw_handler.h 2007-06-10 21:32:10.000000000 +0100 -+++ linux-2.6.22-rc4/include/net/iw_handler.h 2007-06-10 21:33:26.000000000 +0100 +--- linux-2.6.22-rc5.orig/include/net/iw_handler.h 2007-06-21 23:26:23.000000000 +0100 ++++ linux-2.6.22-rc5/include/net/iw_handler.h 2007-06-21 23:34:24.000000000 +0100 @@ -431,7 +431,13 @@ * Those may be called only within the kernel. */ @@ -729,10 +744,10 @@ Index: linux-2.6.22-rc4/include/net/iw_handler.h /* Send a single event to user space */ extern void wireless_send_event(struct net_device * dev, -Index: linux-2.6.22-rc4/include/net/mac80211.h +Index: linux-2.6.22-rc5/include/net/mac80211.h =================================================================== ---- linux-2.6.22-rc4.orig/include/net/mac80211.h 2007-06-10 21:32:10.000000000 +0100 -+++ linux-2.6.22-rc4/include/net/mac80211.h 2007-06-10 21:33:26.000000000 +0100 +--- linux-2.6.22-rc5.orig/include/net/mac80211.h 2007-06-21 23:26:23.000000000 +0100 ++++ linux-2.6.22-rc5/include/net/mac80211.h 2007-06-21 23:34:24.000000000 +0100 @@ -300,7 +300,6 @@ /* Following five fields are used for IEEE 802.11H */ unsigned int radar_detect;