History

nl80211: add scan width to bss and scan request structs

To allow scanning and working with 5 MHz and 10 MHz BSS, extend the inform bss commands and add wrappers to take 5 and 10 MHz bss into account.

Simon Wunderlich committed 13 years ago

Commit dcd6eac1 parent be29b995 files · +97 −19Browse files

Unified · Split

5 files
  1. include/net/cfg80211.h +51 −3
  2. include/uapi/linux/nl80211.h +18 −0
  3. net/wireless/nl80211.c +1 −0
  4. net/wireless/scan.c +19 −12
  5. net/wireless/trace.h +8 −4
include/net/cfg80211.h+51−3
@@ -1285,6 +1285,7 @@ struct cfg80211_ssid { · 1284 unmodified lines
12851285 * @n_ssids: number of SSIDs
12861286 * @channels: channels to scan on.
12871287 * @n_channels: total number of channels to scan
1288+ * @scan_width: channel width for scanning
12881289 * @ie: optional information element(s) to add into Probe Request or %NULL
12891290 * @ie_len: length of ie in octets
12901291 * @flags: bit field of flags controlling operation
@@ -1300,6 +1301,7 @@ struct cfg80211_scan_request { · 9 unmodified lines
13001301 struct cfg80211_ssid *ssids;
13011302 int n_ssids;
13021303 u32 n_channels;
1304+ enum nl80211_bss_scan_width scan_width;
13031305 const u8 *ie;
13041306 size_t ie_len;
13051307 u32 flags;
@@ -1333,6 +1335,7 @@ struct cfg80211_match_set { · 27 unmodified lines
13331335 * @ssids: SSIDs to scan for (passed in the probe_reqs in active scans)
13341336 * @n_ssids: number of SSIDs
13351337 * @n_channels: total number of channels to scan
1338+ * @scan_width: channel width for scanning
13361339 * @interval: interval between each scheduled scan cycle
13371340 * @ie: optional information element(s) to add into Probe Request or %NULL
13381341 * @ie_len: length of ie in octets
@@ -1352,6 +1355,7 @@ struct cfg80211_sched_scan_request { · 13 unmodified lines
13521355 struct cfg80211_ssid *ssids;
13531356 int n_ssids;
13541357 u32 n_channels;
1358+ enum nl80211_bss_scan_width scan_width;
13551359 u32 interval;
13561360 const u8 *ie;
13571361 size_t ie_len;
@@ -1403,6 +1407,7 @@ struct cfg80211_bss_ies { · 45 unmodified lines
14031407 * for use in scan results and similar.
14041408 *
14051409 * @channel: channel this BSS is on
1410+ * @scan_width: width of the control channel
14061411 * @bssid: BSSID of the BSS
14071412 * @beacon_interval: the beacon interval as from the frame
14081413 * @capability: the capability field in host byte order
@@ -1424,6 +1429,7 @@ struct cfg80211_bss_ies { · 15 unmodified lines
14241429 */
14251430 struct cfg80211_bss {
14261431 struct ieee80211_channel *channel;
1432+ enum nl80211_bss_scan_width scan_width;
14271433
14281434 const struct cfg80211_bss_ies __rcu *ies;
14291435 const struct cfg80211_bss_ies __rcu *beacon_ies;
@@ -3438,10 +3444,11 @@ void cfg80211_sched_scan_results(struct wiphy *wiphy); · 2008 unmodified lines
34383444 void cfg80211_sched_scan_stopped(struct wiphy *wiphy);
34393445
34403446 /**
3441− * cfg80211_inform_bss_frame - inform cfg80211 of a received BSS frame
3447+ * cfg80211_inform_bss_width_frame - inform cfg80211 of a received BSS frame
34423448 *
34433449 * @wiphy: the wiphy reporting the BSS
34443450 * @channel: The channel the frame was received on
3451+ * @scan_width: width of the control channel
34453452 * @mgmt: the management frame (probe response or beacon)
34463453 * @len: length of the management frame
34473454 * @signal: the signal strength, type depends on the wiphy's signal_type
@@ -3454,16 +3461,29 @@ void cfg80211_sched_scan_stopped(struct wiphy *wiphy); · 6 unmodified lines
34543461 * Or %NULL on error.
34553462 */
34563463 struct cfg80211_bss * __must_check
3464+cfg80211_inform_bss_width_frame(struct wiphy *wiphy,
3465+ struct ieee80211_channel *channel,
3466+ enum nl80211_bss_scan_width scan_width,
3467+ struct ieee80211_mgmt *mgmt, size_t len,
3468+ s32 signal, gfp_t gfp);
3469+
3470+static inline struct cfg80211_bss * __must_check
34573471 cfg80211_inform_bss_frame(struct wiphy *wiphy,
34583472 struct ieee80211_channel *channel,
34593473 struct ieee80211_mgmt *mgmt, size_t len,
3460− s32 signal, gfp_t gfp);
3474+ s32 signal, gfp_t gfp)
3475+{
3476+ return cfg80211_inform_bss_width_frame(wiphy, channel,
3477+ NL80211_BSS_CHAN_WIDTH_20,
3478+ mgmt, len, signal, gfp);
3479+}
34613480
34623481 /**
34633482 * cfg80211_inform_bss - inform cfg80211 of a new BSS
34643483 *
34653484 * @wiphy: the wiphy reporting the BSS
34663485 * @channel: The channel the frame was received on
3486+ * @scan_width: width of the control channel
34673487 * @bssid: the BSSID of the BSS
34683488 * @tsf: the TSF sent by the peer in the beacon/probe response (or 0)
34693489 * @capability: the capability field sent by the peer
@@ -3480,11 +3500,26 @@ cfg80211_inform_bss_frame(struct wiphy *wiphy, · 10 unmodified lines
34803500 * Or %NULL on error.
34813501 */
34823502 struct cfg80211_bss * __must_check
3503+cfg80211_inform_bss_width(struct wiphy *wiphy,
3504+ struct ieee80211_channel *channel,
3505+ enum nl80211_bss_scan_width scan_width,
3506+ const u8 *bssid, u64 tsf, u16 capability,
3507+ u16 beacon_interval, const u8 *ie, size_t ielen,
3508+ s32 signal, gfp_t gfp);
3509+
3510+static inline struct cfg80211_bss * __must_check
34833511 cfg80211_inform_bss(struct wiphy *wiphy,
34843512 struct ieee80211_channel *channel,
34853513 const u8 *bssid, u64 tsf, u16 capability,
34863514 u16 beacon_interval, const u8 *ie, size_t ielen,
3487− s32 signal, gfp_t gfp);
3515+ s32 signal, gfp_t gfp)
3516+{
3517+ return cfg80211_inform_bss_width(wiphy, channel,
3518+ NL80211_BSS_CHAN_WIDTH_20,
3519+ bssid, tsf, capability,
3520+ beacon_interval, ie, ielen, signal,
3521+ gfp);
3522+}
34883523
34893524 struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
34903525 struct ieee80211_channel *channel,
@@ -3530,6 +3565,19 @@ void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); · 39 unmodified lines
35303565 */
35313566 void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
35323567
3568+static inline enum nl80211_bss_scan_width
3569+cfg80211_chandef_to_scan_width(const struct cfg80211_chan_def *chandef)
3570+{
3571+ switch (chandef->width) {
3572+ case NL80211_CHAN_WIDTH_5:
3573+ return NL80211_BSS_CHAN_WIDTH_5;
3574+ case NL80211_CHAN_WIDTH_10:
3575+ return NL80211_BSS_CHAN_WIDTH_10;
3576+ default:
3577+ return NL80211_BSS_CHAN_WIDTH_20;
3578+ }
3579+}
3580+
35333581 /**
35343582 * cfg80211_rx_mlme_mgmt - notification of processed MLME management frame
35353583 * @dev: network device
include/uapi/linux/nl80211.h+18−0
@@ -2807,6 +2807,21 @@ enum nl80211_chan_width { · 2806 unmodified lines
28072807 NL80211_CHAN_WIDTH_10,
28082808 };
28092809
2810+/**
2811+ * enum nl80211_bss_scan_width - control channel width for a BSS
2812+ *
2813+ * These values are used with the %NL80211_BSS_CHAN_WIDTH attribute.
2814+ *
2815+ * @NL80211_BSS_CHAN_WIDTH_20: control channel is 20 MHz wide or compatible
2816+ * @NL80211_BSS_CHAN_WIDTH_10: control channel is 10 MHz wide
2817+ * @NL80211_BSS_CHAN_WIDTH_5: control channel is 5 MHz wide
2818+ */
2819+enum nl80211_bss_scan_width {
2820+ NL80211_BSS_CHAN_WIDTH_20,
2821+ NL80211_BSS_CHAN_WIDTH_10,
2822+ NL80211_BSS_CHAN_WIDTH_5,
2823+};
2824+
28102825 /**
28112826 * enum nl80211_bss - netlink attributes for a BSS
28122827 *
@@ -2831,6 +2846,8 @@ enum nl80211_chan_width { · 18 unmodified lines
28312846 * @NL80211_BSS_BEACON_IES: binary attribute containing the raw information
28322847 * elements from a Beacon frame (bin); not present if no Beacon frame has
28332848 * yet been received
2849+ * @NL80211_BSS_CHAN_WIDTH: channel width of the control channel
2850+ * (u32, enum nl80211_bss_scan_width)
28342851 * @__NL80211_BSS_AFTER_LAST: internal
28352852 * @NL80211_BSS_MAX: highest BSS attribute
28362853 */
@@ -2847,6 +2864,7 @@ enum nl80211_bss { · 10 unmodified lines
28472864 NL80211_BSS_STATUS,
28482865 NL80211_BSS_SEEN_MS_AGO,
28492866 NL80211_BSS_BEACON_IES,
2867+ NL80211_BSS_CHAN_WIDTH,
28502868
28512869 /* keep last */
28522870 __NL80211_BSS_AFTER_LAST,
net/wireless/nl80211.c+1−0
@@ -5674,6 +5674,7 @@ static int nl80211_send_bss(struct sk_buff *msg, struct netlink_callback *cb, · 5673 unmodified lines
56745674 goto nla_put_failure;
56755675 if (nla_put_u16(msg, NL80211_BSS_CAPABILITY, res->capability) ||
56765676 nla_put_u32(msg, NL80211_BSS_FREQUENCY, res->channel->center_freq) ||
5677+ nla_put_u32(msg, NL80211_BSS_CHAN_WIDTH, res->scan_width) ||
56775678 nla_put_u32(msg, NL80211_BSS_SEEN_MS_AGO,
56785679 jiffies_to_msecs(jiffies - intbss->ts)))
56795680 goto nla_put_failure;
net/wireless/scan.c+19−12
@@ -651,6 +651,8 @@ static bool cfg80211_combine_bsses(struct cfg80211_registered_device *dev, · 650 unmodified lines
651651 continue;
652652 if (bss->pub.channel != new->pub.channel)
653653 continue;
654+ if (bss->pub.scan_width != new->pub.scan_width)
655+ continue;
654656 if (rcu_access_pointer(bss->pub.beacon_ies))
655657 continue;
656658 ies = rcu_access_pointer(bss->pub.ies);
@@ -870,11 +872,12 @@ cfg80211_get_bss_channel(struct wiphy *wiphy, const u8 *ie, size_t ielen, · 213 unmodified lines
870872
871873 /* Returned bss is reference counted and must be cleaned up appropriately. */
872874 struct cfg80211_bss*
873−cfg80211_inform_bss(struct wiphy *wiphy,
874− struct ieee80211_channel *channel,
875− const u8 *bssid, u64 tsf, u16 capability,
876− u16 beacon_interval, const u8 *ie, size_t ielen,
877− s32 signal, gfp_t gfp)
875+cfg80211_inform_bss_width(struct wiphy *wiphy,
876+ struct ieee80211_channel *channel,
877+ enum nl80211_bss_scan_width scan_width,
878+ const u8 *bssid, u64 tsf, u16 capability,
879+ u16 beacon_interval, const u8 *ie, size_t ielen,
880+ s32 signal, gfp_t gfp)
878881 {
879882 struct cfg80211_bss_ies *ies;
880883 struct cfg80211_internal_bss tmp = {}, *res;
@@ -892,6 +895,7 @@ cfg80211_inform_bss(struct wiphy *wiphy, · 11 unmodified lines
892895
893896 memcpy(tmp.pub.bssid, bssid, ETH_ALEN);
894897 tmp.pub.channel = channel;
898+ tmp.pub.scan_width = scan_width;
895899 tmp.pub.signal = signal;
896900 tmp.pub.beacon_interval = beacon_interval;
897901 tmp.pub.capability = capability;
@@ -924,14 +928,15 @@ cfg80211_inform_bss(struct wiphy *wiphy, · 26 unmodified lines
924928 /* cfg80211_bss_update gives us a referenced result */
925929 return &res->pub;
926930 }
927−EXPORT_SYMBOL(cfg80211_inform_bss);
931+EXPORT_SYMBOL(cfg80211_inform_bss_width);
928932
929933 /* Returned bss is reference counted and must be cleaned up appropriately. */
930934 struct cfg80211_bss *
931−cfg80211_inform_bss_frame(struct wiphy *wiphy,
932− struct ieee80211_channel *channel,
933− struct ieee80211_mgmt *mgmt, size_t len,
934− s32 signal, gfp_t gfp)
935+cfg80211_inform_bss_width_frame(struct wiphy *wiphy,
936+ struct ieee80211_channel *channel,
937+ enum nl80211_bss_scan_width scan_width,
938+ struct ieee80211_mgmt *mgmt, size_t len,
939+ s32 signal, gfp_t gfp)
935940 {
936941 struct cfg80211_internal_bss tmp = {}, *res;
937942 struct cfg80211_bss_ies *ies;
@@ -941,7 +946,8 @@ cfg80211_inform_bss_frame(struct wiphy *wiphy, · 3 unmodified lines
941946 BUILD_BUG_ON(offsetof(struct ieee80211_mgmt, u.probe_resp.variable) !=
942947 offsetof(struct ieee80211_mgmt, u.beacon.variable));
943948
944− trace_cfg80211_inform_bss_frame(wiphy, channel, mgmt, len, signal);
949+ trace_cfg80211_inform_bss_width_frame(wiphy, channel, scan_width, mgmt,
950+ len, signal);
945951
946952 if (WARN_ON(!mgmt))
947953 return NULL;
@@ -976,6 +982,7 @@ cfg80211_inform_bss_frame(struct wiphy *wiphy, · 28 unmodified lines
976982
977983 memcpy(tmp.pub.bssid, mgmt->bssid, ETH_ALEN);
978984 tmp.pub.channel = channel;
985+ tmp.pub.scan_width = scan_width;
979986 tmp.pub.signal = signal;
980987 tmp.pub.beacon_interval = le16_to_cpu(mgmt->u.probe_resp.beacon_int);
981988 tmp.pub.capability = le16_to_cpu(mgmt->u.probe_resp.capab_info);
@@ -991,7 +998,7 @@ cfg80211_inform_bss_frame(struct wiphy *wiphy, · 9 unmodified lines
991998 /* cfg80211_bss_update gives us a referenced result */
992999 return &res->pub;
9931000 }
994−EXPORT_SYMBOL(cfg80211_inform_bss_frame);
1001+EXPORT_SYMBOL(cfg80211_inform_bss_width_frame);
9951002
9961003 void cfg80211_ref_bss(struct wiphy *wiphy, struct cfg80211_bss *pub)
9971004 {
net/wireless/trace.h+8−4
@@ -2391,26 +2391,30 @@ TRACE_EVENT(cfg80211_get_bss, · 2390 unmodified lines
23912391 __entry->capa_mask, __entry->capa_val)
23922392 );
23932393
2394−TRACE_EVENT(cfg80211_inform_bss_frame,
2394+TRACE_EVENT(cfg80211_inform_bss_width_frame,
23952395 TP_PROTO(struct wiphy *wiphy, struct ieee80211_channel *channel,
2396+ enum nl80211_bss_scan_width scan_width,
23962397 struct ieee80211_mgmt *mgmt, size_t len,
23972398 s32 signal),
2398− TP_ARGS(wiphy, channel, mgmt, len, signal),
2399+ TP_ARGS(wiphy, channel, scan_width, mgmt, len, signal),
23992400 TP_STRUCT__entry(
24002401 WIPHY_ENTRY
24012402 CHAN_ENTRY
2403+ __field(enum nl80211_bss_scan_width, scan_width)
24022404 __dynamic_array(u8, mgmt, len)
24032405 __field(s32, signal)
24042406 ),
24052407 TP_fast_assign(
24062408 WIPHY_ASSIGN;
24072409 CHAN_ASSIGN(channel);
2410+ __entry->scan_width = scan_width;
24082411 if (mgmt)
24092412 memcpy(__get_dynamic_array(mgmt), mgmt, len);
24102413 __entry->signal = signal;
24112414 ),
2412− TP_printk(WIPHY_PR_FMT ", " CHAN_PR_FMT "signal: %d",
2413− WIPHY_PR_ARG, CHAN_PR_ARG, __entry->signal)
2415+ TP_printk(WIPHY_PR_FMT ", " CHAN_PR_FMT "(scan_width: %d) signal: %d",
2416+ WIPHY_PR_ARG, CHAN_PR_ARG, __entry->scan_width,
2417+ __entry->signal)
24142418 );
24152419
24162420 DECLARE_EVENT_CLASS(cfg80211_bss_evt,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t