Skip to content

Commit f30e38f

Browse files
author
Adrian Chadd
committed
[athp] Flip on the radiocaps method so we can change regulatory domains.
1 parent ec85f1d commit f30e38f

File tree

1 file changed

+57
-47
lines changed

1 file changed

+57
-47
lines changed

otus/freebsd/src/sys/dev/athp/if_athp_main.c

+57-47
Original file line numberDiff line numberDiff line change
@@ -1967,49 +1967,6 @@ athp_send_mgmt(struct ieee80211_node *ni, int type, int arg)
19671967

19681968
}
19691969

1970-
/*
1971-
* TODO: this doesn't yet take the regulatory domain into account.
1972-
*/
1973-
static void
1974-
athp_setup_channels(struct ath10k *ar)
1975-
{
1976-
struct ieee80211com *ic = &ar->sc_ic;
1977-
struct ieee80211_channel *chans = ic->ic_channels;
1978-
uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)];
1979-
int *nchans = &ic->ic_nchans;
1980-
int ht40 = 0;
1981-
1982-
memset(bands, 0, sizeof(bands));
1983-
1984-
if (ar->ht_cap_info & WMI_HT_CAP_ENABLED)
1985-
ht40 = 1;
1986-
1987-
if (ar->phy_capability & WHAL_WLAN_11G_CAPABILITY) {
1988-
setbit(bands, IEEE80211_MODE_11B);
1989-
setbit(bands, IEEE80211_MODE_11G);
1990-
if (ar->ht_cap_info & WMI_HT_CAP_ENABLED)
1991-
setbit(bands, IEEE80211_MODE_11NG);
1992-
ieee80211_add_channel_list_2ghz(chans, IEEE80211_CHAN_MAX,
1993-
nchans, chan_list_2ghz, nitems(chan_list_2ghz),
1994-
bands, ht40);
1995-
}
1996-
1997-
if (ar->phy_capability & WHAL_WLAN_11A_CAPABILITY) {
1998-
setbit(bands, IEEE80211_MODE_11A);
1999-
if (ar->ht_cap_info & WMI_HT_CAP_ENABLED) {
2000-
ath10k_warn(ar, "%s: enabling HT/VHT rates\n", __func__);
2001-
setbit(bands, IEEE80211_MODE_11NA);
2002-
setbit(bands, IEEE80211_MODE_VHT_5GHZ);
2003-
}
2004-
/*
2005-
* XXX TODO: need to pass in VHT80 flag.
2006-
*/
2007-
ieee80211_add_channel_list_5ghz(chans, IEEE80211_CHAN_MAX,
2008-
nchans, chan_list_5ghz, nitems(chan_list_5ghz),
2009-
bands, ht40);
2010-
}
2011-
}
2012-
20131970
static int
20141971
athp_sysctl_reg_read(SYSCTL_HANDLER_ARGS)
20151972
{
@@ -2220,6 +2177,14 @@ athp_set_regdomain(struct ieee80211com *ic, struct ieee80211_regdomain *reg,
22202177
reg->location,
22212178
reg->ecm ? "ecm" : "");
22222179

2180+
/*
2181+
* XXX TODO:
2182+
*
2183+
* Loop over the provided channel list and establish the per-channel
2184+
* limits such as flags and maximum TX power.
2185+
*/
2186+
ath10k_warn(ar, "%s: nchans=%d\n", __func__, nchans);
2187+
22232188
/*
22242189
* Program in the given channel set into the hardware.
22252190
*/
@@ -2234,6 +2199,52 @@ athp_set_regdomain(struct ieee80211com *ic, struct ieee80211_regdomain *reg,
22342199
return (0);
22352200
}
22362201

2202+
static void
2203+
athp_getradiocaps(struct ieee80211com *ic, int maxchans, int *nchans,
2204+
struct ieee80211_channel chans[])
2205+
{
2206+
struct ath10k *ar = ic->ic_softc;
2207+
uint8_t bands[IEEE80211_MODE_BYTES];
2208+
int ht40 = 0;
2209+
2210+
printf("%s: called; maxchans=%d\n", __func__, maxchans);
2211+
2212+
memset(bands, 0, sizeof(bands));
2213+
2214+
if (ar->ht_cap_info & WMI_HT_CAP_ENABLED)
2215+
ht40 = 1;
2216+
2217+
*nchans = 0;
2218+
2219+
if (ar->phy_capability & WHAL_WLAN_11G_CAPABILITY) {
2220+
setbit(bands, IEEE80211_MODE_11B);
2221+
setbit(bands, IEEE80211_MODE_11G);
2222+
if (ar->ht_cap_info & WMI_HT_CAP_ENABLED)
2223+
setbit(bands, IEEE80211_MODE_11NG);
2224+
ieee80211_add_channel_list_2ghz(chans, maxchans,
2225+
nchans, chan_list_2ghz, nitems(chan_list_2ghz),
2226+
bands, ht40);
2227+
}
2228+
2229+
if (ar->phy_capability & WHAL_WLAN_11A_CAPABILITY) {
2230+
setbit(bands, IEEE80211_MODE_11A);
2231+
if (ar->ht_cap_info & WMI_HT_CAP_ENABLED) {
2232+
ath10k_warn(ar, "%s: enabling HT/VHT rates\n", __func__);
2233+
setbit(bands, IEEE80211_MODE_11NA);
2234+
setbit(bands, IEEE80211_MODE_VHT_5GHZ);
2235+
}
2236+
2237+
/*
2238+
* XXX TODO: need to pass in VHT80 flag.
2239+
*/
2240+
ieee80211_add_channel_list_5ghz(chans, maxchans,
2241+
nchans, chan_list_5ghz, nitems(chan_list_5ghz),
2242+
bands, ht40);
2243+
}
2244+
2245+
printf("%s: done; maxchans=%d, nchans=%d\n", __func__, maxchans, *nchans);
2246+
}
2247+
22372248
static void
22382249
athp_attach_11n(struct ath10k *ar)
22392250
{
@@ -2397,7 +2408,8 @@ athp_attach_net80211(struct ath10k *ar)
23972408
/* XXX 11ac bits */
23982409

23992410
/* Channels/regulatory */
2400-
athp_setup_channels(ar);
2411+
athp_getradiocaps(ic, IEEE80211_CHAN_MAX, &ic->ic_nchans,
2412+
ic->ic_channels);
24012413

24022414
IEEE80211_ADDR_COPY(ic->ic_macaddr, ar->mac_addr);
24032415

@@ -2425,9 +2437,7 @@ athp_attach_net80211(struct ath10k *ar)
24252437
ic->ic_node_free = athp_node_free;
24262438

24272439
ic->ic_setregdomain = athp_set_regdomain;
2428-
#if 0
2429-
ic->ic_getradiocaps = athp_get_radiocaps;
2430-
#endif
2440+
ic->ic_getradiocaps = athp_getradiocaps;
24312441

24322442
/* 11n methods */
24332443
ic->ic_update_chw = athp_update_chw;

0 commit comments

Comments
 (0)