aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/mac80211_hwsim.c220
1 files changed, 0 insertions, 220 deletions
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
index 4e9422454fd7..55cdfd6a40e8 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -57,112 +57,6 @@ static bool rctbl = false;
57module_param(rctbl, bool, 0444); 57module_param(rctbl, bool, 0444);
58MODULE_PARM_DESC(rctbl, "Handle rate control table"); 58MODULE_PARM_DESC(rctbl, "Handle rate control table");
59 59
60/**
61 * enum hwsim_regtest - the type of regulatory tests we offer
62 *
63 * These are the different values you can use for the regtest
64 * module parameter. This is useful to help test world roaming
65 * and the driver regulatory_hint() call and combinations of these.
66 * If you want to do specific alpha2 regulatory domain tests simply
67 * use the userspace regulatory request as that will be respected as
68 * well without the need of this module parameter. This is designed
69 * only for testing the driver regulatory request, world roaming
70 * and all possible combinations.
71 *
72 * @HWSIM_REGTEST_DISABLED: No regulatory tests are performed,
73 * this is the default value.
74 * @HWSIM_REGTEST_DRIVER_REG_FOLLOW: Used for testing the driver regulatory
75 * hint, only one driver regulatory hint will be sent as such the
76 * secondary radios are expected to follow.
77 * @HWSIM_REGTEST_DRIVER_REG_ALL: Used for testing the driver regulatory
78 * request with all radios reporting the same regulatory domain.
79 * @HWSIM_REGTEST_DIFF_COUNTRY: Used for testing the drivers calling
80 * different regulatory domains requests. Expected behaviour is for
81 * an intersection to occur but each device will still use their
82 * respective regulatory requested domains. Subsequent radios will
83 * use the resulting intersection.
84 * @HWSIM_REGTEST_WORLD_ROAM: Used for testing the world roaming. We accomplish
85 * this by using a custom beacon-capable regulatory domain for the first
86 * radio. All other device world roam.
87 * @HWSIM_REGTEST_CUSTOM_WORLD: Used for testing the custom world regulatory
88 * domain requests. All radios will adhere to this custom world regulatory
89 * domain.
90 * @HWSIM_REGTEST_CUSTOM_WORLD_2: Used for testing 2 custom world regulatory
91 * domain requests. The first radio will adhere to the first custom world
92 * regulatory domain, the second one to the second custom world regulatory
93 * domain. All other devices will world roam.
94 * @HWSIM_REGTEST_STRICT_FOLLOW_: Used for testing strict regulatory domain
95 * settings, only the first radio will send a regulatory domain request
96 * and use strict settings. The rest of the radios are expected to follow.
97 * @HWSIM_REGTEST_STRICT_ALL: Used for testing strict regulatory domain
98 * settings. All radios will adhere to this.
99 * @HWSIM_REGTEST_STRICT_AND_DRIVER_REG: Used for testing strict regulatory
100 * domain settings, combined with secondary driver regulatory domain
101 * settings. The first radio will get a strict regulatory domain setting
102 * using the first driver regulatory request and the second radio will use
103 * non-strict settings using the second driver regulatory request. All
104 * other devices should follow the intersection created between the
105 * first two.
106 * @HWSIM_REGTEST_ALL: Used for testing every possible mix. You will need
107 * at least 6 radios for a complete test. We will test in this order:
108 * 1 - driver custom world regulatory domain
109 * 2 - second custom world regulatory domain
110 * 3 - first driver regulatory domain request
111 * 4 - second driver regulatory domain request
112 * 5 - strict regulatory domain settings using the third driver regulatory
113 * domain request
114 * 6 and on - should follow the intersection of the 3rd, 4rth and 5th radio
115 * regulatory requests.
116 */
117enum hwsim_regtest {
118 HWSIM_REGTEST_DISABLED = 0,
119 HWSIM_REGTEST_DRIVER_REG_FOLLOW = 1,
120 HWSIM_REGTEST_DRIVER_REG_ALL = 2,
121 HWSIM_REGTEST_DIFF_COUNTRY = 3,
122 HWSIM_REGTEST_WORLD_ROAM = 4,
123 HWSIM_REGTEST_CUSTOM_WORLD = 5,
124 HWSIM_REGTEST_CUSTOM_WORLD_2 = 6,
125 HWSIM_REGTEST_STRICT_FOLLOW = 7,
126 HWSIM_REGTEST_STRICT_ALL = 8,
127 HWSIM_REGTEST_STRICT_AND_DRIVER_REG = 9,
128 HWSIM_REGTEST_ALL = 10,
129};
130
131/* Set to one of the HWSIM_REGTEST_* values above */
132static int regtest = HWSIM_REGTEST_DISABLED;
133module_param(regtest, int, 0444);
134MODULE_PARM_DESC(regtest, "The type of regulatory test we want to run");
135
136static const char *hwsim_alpha2s[] = {
137 "FI",
138 "AL",
139 "US",
140 "DE",
141 "JP",
142 "AL",
143};
144
145static const struct ieee80211_regdomain hwsim_world_regdom_custom_01 = {
146 .n_reg_rules = 4,
147 .alpha2 = "99",
148 .reg_rules = {
149 REG_RULE(2412-10, 2462+10, 40, 0, 20, 0),
150 REG_RULE(2484-10, 2484+10, 40, 0, 20, 0),
151 REG_RULE(5150-10, 5240+10, 40, 0, 30, 0),
152 REG_RULE(5745-10, 5825+10, 40, 0, 30, 0),
153 }
154};
155
156static const struct ieee80211_regdomain hwsim_world_regdom_custom_02 = {
157 .n_reg_rules = 2,
158 .alpha2 = "99",
159 .reg_rules = {
160 REG_RULE(2412-10, 2462+10, 40, 0, 20, 0),
161 REG_RULE(5725-10, 5850+10, 40, 0, 30,
162 NL80211_RRF_NO_IR),
163 }
164};
165
166struct hwsim_vif_priv { 60struct hwsim_vif_priv {
167 u32 magic; 61 u32 magic;
168 u8 bssid[ETH_ALEN]; 62 u8 bssid[ETH_ALEN];
@@ -2448,74 +2342,6 @@ static int __init init_mac80211_hwsim(void)
2448 hw->max_rates = 4; 2342 hw->max_rates = 4;
2449 hw->max_rate_tries = 11; 2343 hw->max_rate_tries = 11;
2450 2344
2451 /* Work to be done prior to ieee80211_register_hw() */
2452 switch (regtest) {
2453 case HWSIM_REGTEST_DISABLED:
2454 case HWSIM_REGTEST_DRIVER_REG_FOLLOW:
2455 case HWSIM_REGTEST_DRIVER_REG_ALL:
2456 case HWSIM_REGTEST_DIFF_COUNTRY:
2457 /*
2458 * Nothing to be done for driver regulatory domain
2459 * hints prior to ieee80211_register_hw()
2460 */
2461 break;
2462 case HWSIM_REGTEST_WORLD_ROAM:
2463 if (i == 0) {
2464 hw->wiphy->regulatory_flags |=
2465 REGULATORY_CUSTOM_REG;
2466 wiphy_apply_custom_regulatory(hw->wiphy,
2467 &hwsim_world_regdom_custom_01);
2468 }
2469 break;
2470 case HWSIM_REGTEST_CUSTOM_WORLD:
2471 hw->wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG;
2472 wiphy_apply_custom_regulatory(hw->wiphy,
2473 &hwsim_world_regdom_custom_01);
2474 break;
2475 case HWSIM_REGTEST_CUSTOM_WORLD_2:
2476 if (i == 0) {
2477 hw->wiphy->regulatory_flags |=
2478 REGULATORY_CUSTOM_REG;
2479 wiphy_apply_custom_regulatory(hw->wiphy,
2480 &hwsim_world_regdom_custom_01);
2481 } else if (i == 1) {
2482 hw->wiphy->regulatory_flags |=
2483 REGULATORY_CUSTOM_REG;
2484 wiphy_apply_custom_regulatory(hw->wiphy,
2485 &hwsim_world_regdom_custom_02);
2486 }
2487 break;
2488 case HWSIM_REGTEST_STRICT_ALL:
2489 hw->wiphy->regulatory_flags |= REGULATORY_STRICT_REG;
2490 break;
2491 case HWSIM_REGTEST_STRICT_FOLLOW:
2492 case HWSIM_REGTEST_STRICT_AND_DRIVER_REG:
2493 if (i == 0)
2494 hw->wiphy->regulatory_flags |=
2495 REGULATORY_STRICT_REG;
2496 break;
2497 case HWSIM_REGTEST_ALL:
2498 if (i == 0) {
2499 hw->wiphy->regulatory_flags |=
2500 REGULATORY_CUSTOM_REG;
2501 wiphy_apply_custom_regulatory(hw->wiphy,
2502 &hwsim_world_regdom_custom_01);
2503 } else if (i == 1) {
2504 hw->wiphy->regulatory_flags |=
2505 REGULATORY_CUSTOM_REG;
2506 wiphy_apply_custom_regulatory(hw->wiphy,
2507 &hwsim_world_regdom_custom_02);
2508 } else if (i == 4)
2509 hw->wiphy->regulatory_flags |=
2510 REGULATORY_STRICT_REG;
2511 break;
2512 default:
2513 break;
2514 }
2515
2516 /* give the regulatory workqueue a chance to run */
2517 if (regtest)
2518 schedule_timeout_interruptible(1);
2519 err = ieee80211_register_hw(hw); 2345 err = ieee80211_register_hw(hw);
2520 if (err < 0) { 2346 if (err < 0) {
2521 printk(KERN_DEBUG "mac80211_hwsim: " 2347 printk(KERN_DEBUG "mac80211_hwsim: "
@@ -2523,52 +2349,6 @@ static int __init init_mac80211_hwsim(void)
2523 goto failed_hw; 2349 goto failed_hw;
2524 } 2350 }
2525 2351
2526 /* Work to be done after to ieee80211_register_hw() */
2527 switch (regtest) {
2528 case HWSIM_REGTEST_WORLD_ROAM:
2529 case HWSIM_REGTEST_DISABLED:
2530 break;
2531 case HWSIM_REGTEST_DRIVER_REG_FOLLOW:
2532 if (!i)
2533 regulatory_hint(hw->wiphy, hwsim_alpha2s[0]);
2534 break;
2535 case HWSIM_REGTEST_DRIVER_REG_ALL:
2536 case HWSIM_REGTEST_STRICT_ALL:
2537 regulatory_hint(hw->wiphy, hwsim_alpha2s[0]);
2538 break;
2539 case HWSIM_REGTEST_DIFF_COUNTRY:
2540 if (i < ARRAY_SIZE(hwsim_alpha2s))
2541 regulatory_hint(hw->wiphy, hwsim_alpha2s[i]);
2542 break;
2543 case HWSIM_REGTEST_CUSTOM_WORLD:
2544 case HWSIM_REGTEST_CUSTOM_WORLD_2:
2545 /*
2546 * Nothing to be done for custom world regulatory
2547 * domains after to ieee80211_register_hw
2548 */
2549 break;
2550 case HWSIM_REGTEST_STRICT_FOLLOW:
2551 if (i == 0)
2552 regulatory_hint(hw->wiphy, hwsim_alpha2s[0]);
2553 break;
2554 case HWSIM_REGTEST_STRICT_AND_DRIVER_REG:
2555 if (i == 0)
2556 regulatory_hint(hw->wiphy, hwsim_alpha2s[0]);
2557 else if (i == 1)
2558 regulatory_hint(hw->wiphy, hwsim_alpha2s[1]);
2559 break;
2560 case HWSIM_REGTEST_ALL:
2561 if (i == 2)
2562 regulatory_hint(hw->wiphy, hwsim_alpha2s[0]);
2563 else if (i == 3)
2564 regulatory_hint(hw->wiphy, hwsim_alpha2s[1]);
2565 else if (i == 4)
2566 regulatory_hint(hw->wiphy, hwsim_alpha2s[2]);
2567 break;
2568 default:
2569 break;
2570 }
2571
2572 wiphy_debug(hw->wiphy, "hwaddr %pm registered\n", 2352 wiphy_debug(hw->wiphy, "hwaddr %pm registered\n",
2573 hw->wiphy->perm_addr); 2353 hw->wiphy->perm_addr);
2574 2354