main.c (fe57d9f5c0a2c1ef97ba8cdc42cfda5743f287b8) main.c (55de908ab292c03f1eb280f51170ddb9c6b57e31)
1/*
2 * Copyright 2002-2005, Instant802 Networks, Inc.
3 * Copyright 2005-2006, Devicescape Software, Inc.
4 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.

--- 79 unchanged lines hidden (view full) ---

88static void ieee80211_reconfig_filter(struct work_struct *work)
89{
90 struct ieee80211_local *local =
91 container_of(work, struct ieee80211_local, reconfig_filter);
92
93 ieee80211_configure_filter(local);
94}
95
1/*
2 * Copyright 2002-2005, Instant802 Networks, Inc.
3 * Copyright 2005-2006, Devicescape Software, Inc.
4 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.

--- 79 unchanged lines hidden (view full) ---

88static void ieee80211_reconfig_filter(struct work_struct *work)
89{
90 struct ieee80211_local *local =
91 container_of(work, struct ieee80211_local, reconfig_filter);
92
93 ieee80211_configure_filter(local);
94}
95
96int ieee80211_hw_config(struct ieee80211_local *local, u32 changed)
96static u32 ieee80211_hw_conf_chan(struct ieee80211_local *local)
97{
98 struct ieee80211_channel *chan;
97{
98 struct ieee80211_channel *chan;
99 int ret = 0;
99 u32 changed = 0;
100 int power;
101 enum nl80211_channel_type channel_type;
102 u32 offchannel_flag;
103
100 int power;
101 enum nl80211_channel_type channel_type;
102 u32 offchannel_flag;
103
104 might_sleep();
105
106 offchannel_flag = local->hw.conf.flags & IEEE80211_CONF_OFFCHANNEL;
107 if (local->scan_channel) {
108 chan = local->scan_channel;
109 /* If scanning on oper channel, use whatever channel-type
110 * is currently in use.
111 */
104 offchannel_flag = local->hw.conf.flags & IEEE80211_CONF_OFFCHANNEL;
105 if (local->scan_channel) {
106 chan = local->scan_channel;
107 /* If scanning on oper channel, use whatever channel-type
108 * is currently in use.
109 */
112 if (chan == local->oper_channel)
110 if (chan == local->_oper_channel)
113 channel_type = local->_oper_channel_type;
114 else
115 channel_type = NL80211_CHAN_NO_HT;
116 } else if (local->tmp_channel) {
117 chan = local->tmp_channel;
118 channel_type = local->tmp_channel_type;
119 } else {
111 channel_type = local->_oper_channel_type;
112 else
113 channel_type = NL80211_CHAN_NO_HT;
114 } else if (local->tmp_channel) {
115 chan = local->tmp_channel;
116 channel_type = local->tmp_channel_type;
117 } else {
120 chan = local->oper_channel;
118 chan = local->_oper_channel;
121 channel_type = local->_oper_channel_type;
122 }
123
119 channel_type = local->_oper_channel_type;
120 }
121
124 if (chan != local->oper_channel ||
122 if (chan != local->_oper_channel ||
125 channel_type != local->_oper_channel_type)
126 local->hw.conf.flags |= IEEE80211_CONF_OFFCHANNEL;
127 else
128 local->hw.conf.flags &= ~IEEE80211_CONF_OFFCHANNEL;
129
130 offchannel_flag ^= local->hw.conf.flags & IEEE80211_CONF_OFFCHANNEL;
131
132 if (offchannel_flag || chan != local->hw.conf.channel ||

--- 26 unchanged lines hidden (view full) ---

159 if (local->user_power_level >= 0)
160 power = min(power, local->user_power_level);
161
162 if (local->hw.conf.power_level != power) {
163 changed |= IEEE80211_CONF_CHANGE_POWER;
164 local->hw.conf.power_level = power;
165 }
166
123 channel_type != local->_oper_channel_type)
124 local->hw.conf.flags |= IEEE80211_CONF_OFFCHANNEL;
125 else
126 local->hw.conf.flags &= ~IEEE80211_CONF_OFFCHANNEL;
127
128 offchannel_flag ^= local->hw.conf.flags & IEEE80211_CONF_OFFCHANNEL;
129
130 if (offchannel_flag || chan != local->hw.conf.channel ||

--- 26 unchanged lines hidden (view full) ---

157 if (local->user_power_level >= 0)
158 power = min(power, local->user_power_level);
159
160 if (local->hw.conf.power_level != power) {
161 changed |= IEEE80211_CONF_CHANGE_POWER;
162 local->hw.conf.power_level = power;
163 }
164
165 return changed;
166}
167
168int ieee80211_hw_config(struct ieee80211_local *local, u32 changed)
169{
170 int ret = 0;
171
172 might_sleep();
173
174 if (!local->use_chanctx)
175 changed |= ieee80211_hw_conf_chan(local);
176 else
177 changed &= ~(IEEE80211_CONF_CHANGE_CHANNEL |
178 IEEE80211_CONF_CHANGE_POWER);
179
167 if (changed && local->open_count) {
168 ret = drv_config(local, changed);
169 /*
170 * Goal:
171 * HW reconfiguration should never fail, the driver has told
172 * us what it can support so it should live up to that promise.
173 *
174 * Current status:

--- 595 unchanged lines hidden (view full) ---

770 supp_ht = false;
771 supp_vht = false;
772 for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
773 struct ieee80211_supported_band *sband;
774
775 sband = local->hw.wiphy->bands[band];
776 if (!sband)
777 continue;
180 if (changed && local->open_count) {
181 ret = drv_config(local, changed);
182 /*
183 * Goal:
184 * HW reconfiguration should never fail, the driver has told
185 * us what it can support so it should live up to that promise.
186 *
187 * Current status:

--- 595 unchanged lines hidden (view full) ---

783 supp_ht = false;
784 supp_vht = false;
785 for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
786 struct ieee80211_supported_band *sband;
787
788 sband = local->hw.wiphy->bands[band];
789 if (!sband)
790 continue;
778 if (!local->oper_channel) {
791 if (!local->use_chanctx && !local->_oper_channel) {
779 /* init channel we're on */
780 local->hw.conf.channel =
792 /* init channel we're on */
793 local->hw.conf.channel =
781 local->oper_channel = &sband->channels[0];
794 local->_oper_channel = &sband->channels[0];
782 local->hw.conf.channel_type = NL80211_CHAN_NO_HT;
783 }
795 local->hw.conf.channel_type = NL80211_CHAN_NO_HT;
796 }
797 if (!local->monitor_channel) {
798 local->monitor_channel = &sband->channels[0];
799 local->monitor_channel_type = NL80211_CHAN_NO_HT;
800 }
784 channels += sband->n_channels;
785
786 if (max_bitrates < sband->n_bitrates)
787 max_bitrates = sband->n_bitrates;
788 supp_ht = supp_ht || sband->ht_cap.ht_supported;
789 supp_vht = supp_vht || sband->vht_cap.vht_supported;
790 }
791

--- 13 unchanged lines hidden (view full) ---

805 hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_AP_VLAN);
806 hw->wiphy->software_iftypes |= BIT(NL80211_IFTYPE_AP_VLAN);
807 }
808
809 /* mac80211 always supports monitor */
810 hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_MONITOR);
811 hw->wiphy->software_iftypes |= BIT(NL80211_IFTYPE_MONITOR);
812
801 channels += sband->n_channels;
802
803 if (max_bitrates < sband->n_bitrates)
804 max_bitrates = sband->n_bitrates;
805 supp_ht = supp_ht || sband->ht_cap.ht_supported;
806 supp_vht = supp_vht || sband->vht_cap.vht_supported;
807 }
808

--- 13 unchanged lines hidden (view full) ---

822 hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_AP_VLAN);
823 hw->wiphy->software_iftypes |= BIT(NL80211_IFTYPE_AP_VLAN);
824 }
825
826 /* mac80211 always supports monitor */
827 hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_MONITOR);
828 hw->wiphy->software_iftypes |= BIT(NL80211_IFTYPE_MONITOR);
829
813 /*
814 * mac80211 doesn't support more than 1 channel, and also not more
815 * than one IBSS interface
816 */
830 /* mac80211 doesn't support more than one IBSS interface right now */
817 for (i = 0; i < hw->wiphy->n_iface_combinations; i++) {
818 const struct ieee80211_iface_combination *c;
819 int j;
820
821 c = &hw->wiphy->iface_combinations[i];
822
831 for (i = 0; i < hw->wiphy->n_iface_combinations; i++) {
832 const struct ieee80211_iface_combination *c;
833 int j;
834
835 c = &hw->wiphy->iface_combinations[i];
836
823 if (c->num_different_channels > 1)
824 return -EINVAL;
825
826 for (j = 0; j < c->n_limits; j++)
827 if ((c->limits[j].types & BIT(NL80211_IFTYPE_ADHOC)) &&
828 c->limits[j].max > 1)
829 return -EINVAL;
830 }
831
832#ifndef CONFIG_MAC80211_MESH
833 /* mesh depends on Kconfig, but drivers should set it if they want */

--- 336 unchanged lines hidden ---
837 for (j = 0; j < c->n_limits; j++)
838 if ((c->limits[j].types & BIT(NL80211_IFTYPE_ADHOC)) &&
839 c->limits[j].max > 1)
840 return -EINVAL;
841 }
842
843#ifndef CONFIG_MAC80211_MESH
844 /* mesh depends on Kconfig, but drivers should set it if they want */

--- 336 unchanged lines hidden ---