mesh.c (e7d9facf0bab6d919342fea17c8cc0f65f8a0fe9) mesh.c (55de908ab292c03f1eb280f51170ddb9c6b57e31)
1/*
2 * Copyright (c) 2008, 2009 open80211s Ltd.
3 * Authors: Luis Carlos Cobo <luisca@cozybit.com>
4 * Javier Cardona <javier@cozybit.com>
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.

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

92 memcmp(ifmsh->mesh_id, ie->mesh_id, ie->mesh_id_len) == 0 &&
93 (ifmsh->mesh_pp_id == ie->mesh_config->meshconf_psel) &&
94 (ifmsh->mesh_pm_id == ie->mesh_config->meshconf_pmetric) &&
95 (ifmsh->mesh_cc_id == ie->mesh_config->meshconf_congest) &&
96 (ifmsh->mesh_sp_id == ie->mesh_config->meshconf_synch) &&
97 (ifmsh->mesh_auth_id == ie->mesh_config->meshconf_auth)))
98 goto mismatch;
99
1/*
2 * Copyright (c) 2008, 2009 open80211s Ltd.
3 * Authors: Luis Carlos Cobo <luisca@cozybit.com>
4 * Javier Cardona <javier@cozybit.com>
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.

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

92 memcmp(ifmsh->mesh_id, ie->mesh_id, ie->mesh_id_len) == 0 &&
93 (ifmsh->mesh_pp_id == ie->mesh_config->meshconf_psel) &&
94 (ifmsh->mesh_pm_id == ie->mesh_config->meshconf_pmetric) &&
95 (ifmsh->mesh_cc_id == ie->mesh_config->meshconf_congest) &&
96 (ifmsh->mesh_sp_id == ie->mesh_config->meshconf_synch) &&
97 (ifmsh->mesh_auth_id == ie->mesh_config->meshconf_auth)))
98 goto mismatch;
99
100 ieee80211_sta_get_rates(local, ie, local->oper_channel->band,
100 ieee80211_sta_get_rates(local, ie, ieee80211_get_sdata_band(sdata),
101 &basic_rates);
102
103 if (sdata->vif.bss_conf.basic_rates != basic_rates)
104 goto mismatch;
105
106 if (ie->ht_operation)
107 sta_channel_type =
108 ieee80211_ht_oper_to_channel_type(ie->ht_operation);

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

350 return 0;
351}
352
353int mesh_add_ds_params_ie(struct sk_buff *skb,
354 struct ieee80211_sub_if_data *sdata)
355{
356 struct ieee80211_local *local = sdata->local;
357 struct ieee80211_supported_band *sband;
101 &basic_rates);
102
103 if (sdata->vif.bss_conf.basic_rates != basic_rates)
104 goto mismatch;
105
106 if (ie->ht_operation)
107 sta_channel_type =
108 ieee80211_ht_oper_to_channel_type(ie->ht_operation);

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

350 return 0;
351}
352
353int mesh_add_ds_params_ie(struct sk_buff *skb,
354 struct ieee80211_sub_if_data *sdata)
355{
356 struct ieee80211_local *local = sdata->local;
357 struct ieee80211_supported_band *sband;
358 struct ieee80211_channel *chan = local->oper_channel;
358 struct ieee80211_chanctx_conf *chanctx_conf;
359 struct ieee80211_channel *chan;
359 u8 *pos;
360
361 if (skb_tailroom(skb) < 3)
362 return -ENOMEM;
363
360 u8 *pos;
361
362 if (skb_tailroom(skb) < 3)
363 return -ENOMEM;
364
365 rcu_read_lock();
366 chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
367 if (WARN_ON(!chanctx_conf)) {
368 rcu_read_unlock();
369 return -EINVAL;
370 }
371 chan = chanctx_conf->channel;
372 rcu_read_unlock();
373
364 sband = local->hw.wiphy->bands[chan->band];
365 if (sband->band == IEEE80211_BAND_2GHZ) {
366 pos = skb_put(skb, 2 + 1);
367 *pos++ = WLAN_EID_DS_PARAMS;
368 *pos++ = 1;
369 *pos++ = ieee80211_frequency_to_channel(chan->center_freq);
370 }
371
372 return 0;
373}
374
375int mesh_add_ht_cap_ie(struct sk_buff *skb,
376 struct ieee80211_sub_if_data *sdata)
377{
378 struct ieee80211_local *local = sdata->local;
374 sband = local->hw.wiphy->bands[chan->band];
375 if (sband->band == IEEE80211_BAND_2GHZ) {
376 pos = skb_put(skb, 2 + 1);
377 *pos++ = WLAN_EID_DS_PARAMS;
378 *pos++ = 1;
379 *pos++ = ieee80211_frequency_to_channel(chan->center_freq);
380 }
381
382 return 0;
383}
384
385int mesh_add_ht_cap_ie(struct sk_buff *skb,
386 struct ieee80211_sub_if_data *sdata)
387{
388 struct ieee80211_local *local = sdata->local;
389 enum ieee80211_band band = ieee80211_get_sdata_band(sdata);
379 struct ieee80211_supported_band *sband;
380 u8 *pos;
381
390 struct ieee80211_supported_band *sband;
391 u8 *pos;
392
382 sband = local->hw.wiphy->bands[local->oper_channel->band];
393 sband = local->hw.wiphy->bands[band];
383 if (!sband->ht_cap.ht_supported ||
384 sdata->vif.bss_conf.channel_type == NL80211_CHAN_NO_HT)
385 return 0;
386
387 if (skb_tailroom(skb) < 2 + sizeof(struct ieee80211_ht_cap))
388 return -ENOMEM;
389
390 pos = skb_put(skb, 2 + sizeof(struct ieee80211_ht_cap));
391 ieee80211_ie_build_ht_cap(pos, &sband->ht_cap, sband->ht_cap.cap);
392
393 return 0;
394}
395
396int mesh_add_ht_oper_ie(struct sk_buff *skb,
397 struct ieee80211_sub_if_data *sdata)
398{
399 struct ieee80211_local *local = sdata->local;
394 if (!sband->ht_cap.ht_supported ||
395 sdata->vif.bss_conf.channel_type == NL80211_CHAN_NO_HT)
396 return 0;
397
398 if (skb_tailroom(skb) < 2 + sizeof(struct ieee80211_ht_cap))
399 return -ENOMEM;
400
401 pos = skb_put(skb, 2 + sizeof(struct ieee80211_ht_cap));
402 ieee80211_ie_build_ht_cap(pos, &sband->ht_cap, sband->ht_cap.cap);
403
404 return 0;
405}
406
407int mesh_add_ht_oper_ie(struct sk_buff *skb,
408 struct ieee80211_sub_if_data *sdata)
409{
410 struct ieee80211_local *local = sdata->local;
400 struct ieee80211_channel *channel = local->oper_channel;
411 struct ieee80211_chanctx_conf *chanctx_conf;
412 struct ieee80211_channel *channel;
401 enum nl80211_channel_type channel_type =
413 enum nl80211_channel_type channel_type =
402 sdata->vif.bss_conf.channel_type;
403 struct ieee80211_supported_band *sband =
404 local->hw.wiphy->bands[channel->band];
405 struct ieee80211_sta_ht_cap *ht_cap = &sband->ht_cap;
414 sdata->vif.bss_conf.channel_type;
415 struct ieee80211_supported_band *sband;
416 struct ieee80211_sta_ht_cap *ht_cap;
406 u8 *pos;
407
417 u8 *pos;
418
419 rcu_read_lock();
420 chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
421 if (WARN_ON(!chanctx_conf)) {
422 rcu_read_unlock();
423 return -EINVAL;
424 }
425 channel = chanctx_conf->channel;
426 rcu_read_unlock();
427
428 sband = local->hw.wiphy->bands[channel->band];
429 ht_cap = &sband->ht_cap;
430
408 if (!ht_cap->ht_supported || channel_type == NL80211_CHAN_NO_HT)
409 return 0;
410
411 if (skb_tailroom(skb) < 2 + sizeof(struct ieee80211_ht_operation))
412 return -ENOMEM;
413
414 pos = skb_put(skb, 2 + sizeof(struct ieee80211_ht_operation));
415 ieee80211_ie_build_ht_oper(pos, ht_cap, channel, channel_type,

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

605 set_bit(MESH_WORK_HOUSEKEEPING, &ifmsh->wrkq_flags);
606 ieee80211_mesh_root_setup(ifmsh);
607 ieee80211_queue_work(&local->hw, &sdata->work);
608 sdata->vif.bss_conf.ht_operation_mode =
609 ifmsh->mshcfg.ht_opmode;
610 sdata->vif.bss_conf.beacon_int = MESH_DEFAULT_BEACON_INTERVAL;
611 sdata->vif.bss_conf.basic_rates =
612 ieee80211_mandatory_rates(sdata->local,
431 if (!ht_cap->ht_supported || channel_type == NL80211_CHAN_NO_HT)
432 return 0;
433
434 if (skb_tailroom(skb) < 2 + sizeof(struct ieee80211_ht_operation))
435 return -ENOMEM;
436
437 pos = skb_put(skb, 2 + sizeof(struct ieee80211_ht_operation));
438 ieee80211_ie_build_ht_oper(pos, ht_cap, channel, channel_type,

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

628 set_bit(MESH_WORK_HOUSEKEEPING, &ifmsh->wrkq_flags);
629 ieee80211_mesh_root_setup(ifmsh);
630 ieee80211_queue_work(&local->hw, &sdata->work);
631 sdata->vif.bss_conf.ht_operation_mode =
632 ifmsh->mshcfg.ht_opmode;
633 sdata->vif.bss_conf.beacon_int = MESH_DEFAULT_BEACON_INTERVAL;
634 sdata->vif.bss_conf.basic_rates =
635 ieee80211_mandatory_rates(sdata->local,
613 sdata->local->oper_channel->band);
636 ieee80211_get_sdata_band(sdata));
614 ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON |
615 BSS_CHANGED_BEACON_ENABLED |
616 BSS_CHANGED_HT |
617 BSS_CHANGED_BASIC_RATES |
618 BSS_CHANGED_BEACON_INT);
619
620 netif_carrier_on(sdata->dev);
621}

--- 194 unchanged lines hidden ---
637 ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON |
638 BSS_CHANGED_BEACON_ENABLED |
639 BSS_CHANGED_HT |
640 BSS_CHANGED_BASIC_RATES |
641 BSS_CHANGED_BEACON_INT);
642
643 netif_carrier_on(sdata->dev);
644}

--- 194 unchanged lines hidden ---