Message ID | 68581fa847cf51a25d9df106dee373d66e7628be.1631091272.git.ryder.lee@mediatek.com |
---|---|
State | Changes Requested |
Headers | show |
Series | [1/6] bss coloring: add support for handling collision events and triggering CCA | expand |
On Wed, Sep 08, 2021 at 05:18:51PM +0800, Ryder Lee wrote: > Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> > diff --git a/src/ap/beacon.c b/src/ap/beacon.c > @@ -578,11 +578,17 @@ static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd, > #ifdef CONFIG_IEEE80211AX > if (hapd->iconf->ieee80211ax && !hapd->conf->disable_11ax) { > + u8 *cca_pos; > + > pos = hostapd_eid_he_capab(hapd, pos, IEEE80211_MODE_AP); > pos = hostapd_eid_he_operation(hapd, pos); > pos = hostapd_eid_spatial_reuse(hapd, pos); > pos = hostapd_eid_he_mu_edca_parameter_set(hapd, pos); > pos = hostapd_eid_he_6ghz_band_cap(hapd, pos); > + cca_pos = hostapd_eid_cca(hapd, pos); The BSS Color Change Announcement element is supposed to be between the HE Operation and the Spatial Reuse Parameter Set elements, i.e., a couple of lines above here.. > @@ -1567,12 +1573,18 @@ int ieee802_11_build_ap_params(struct hostapd_data *hapd, > #ifdef CONFIG_IEEE80211AX > if (hapd->iconf->ieee80211ax && !hapd->conf->disable_11ax) { > + u8 *cca_pos; > + > tailpos = hostapd_eid_he_capab(hapd, tailpos, > IEEE80211_MODE_AP); > tailpos = hostapd_eid_he_operation(hapd, tailpos); > tailpos = hostapd_eid_spatial_reuse(hapd, tailpos); > tailpos = hostapd_eid_he_mu_edca_parameter_set(hapd, tailpos); > tailpos = hostapd_eid_he_6ghz_band_cap(hapd, tailpos); > + cca_pos = hostapd_eid_cca(hapd, tailpos); Same here. What about the (Re)Association Response frames? Should we add the BSS Color Change Announcement element to them as well?
On Wed, 2021-11-03 at 21:08 +0200, Jouni Malinen wrote: > On Wed, Sep 08, 2021 at 05:18:51PM +0800, Ryder Lee wrote: > > Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> > > diff --git a/src/ap/beacon.c b/src/ap/beacon.c > > @@ -578,11 +578,17 @@ static u8 * hostapd_gen_probe_resp(struct > > hostapd_data *hapd, > > #ifdef CONFIG_IEEE80211AX > > if (hapd->iconf->ieee80211ax && !hapd->conf->disable_11ax) { > > + u8 *cca_pos; > > + > > pos = hostapd_eid_he_capab(hapd, pos, > > IEEE80211_MODE_AP); > > pos = hostapd_eid_he_operation(hapd, pos); > > pos = hostapd_eid_spatial_reuse(hapd, pos); > > pos = hostapd_eid_he_mu_edca_parameter_set(hapd, pos); > > pos = hostapd_eid_he_6ghz_band_cap(hapd, pos); > > + cca_pos = hostapd_eid_cca(hapd, pos); > > The BSS Color Change Announcement element is supposed to be between > the > HE Operation and the Spatial Reuse Parameter Set elements, i.e., a > couple of lines above here.. > > > @@ -1567,12 +1573,18 @@ int ieee802_11_build_ap_params(struct > > hostapd_data *hapd, > > #ifdef CONFIG_IEEE80211AX > > if (hapd->iconf->ieee80211ax && !hapd->conf->disable_11ax) { > > + u8 *cca_pos; > > + > > tailpos = hostapd_eid_he_capab(hapd, tailpos, > > IEEE80211_MODE_AP); > > tailpos = hostapd_eid_he_operation(hapd, tailpos); > > tailpos = hostapd_eid_spatial_reuse(hapd, tailpos); > > tailpos = hostapd_eid_he_mu_edca_parameter_set(hapd, > > tailpos); > > tailpos = hostapd_eid_he_6ghz_band_cap(hapd, tailpos); > > + cca_pos = hostapd_eid_cca(hapd, tailpos); > > Same here. > > What about the (Re)Association Response frames? Should we add the BSS > Color Change Announcement element to them as well? Yes, we need to add it into assoc frames to prevent corner cases regarding color missmatching during connection. So far, we only reuse CSA counter attributes to implement the CCA part in kernel side, but we plan to add an assoc attribute. It will take some time to do it, so I think we can get the basic part accepted by hostap first and an incremental patch afterwards. What do you think>
On Wed, 2021-11-03 at 21:08 +0200, Jouni Malinen wrote: > On Wed, Sep 08, 2021 at 05:18:51PM +0800, Ryder Lee wrote: > > Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> > > diff --git a/src/ap/beacon.c b/src/ap/beacon.c > > @@ -578,11 +578,17 @@ static u8 * hostapd_gen_probe_resp(struct > > hostapd_data *hapd, > > #ifdef CONFIG_IEEE80211AX > > if (hapd->iconf->ieee80211ax && !hapd->conf->disable_11ax) { > > + u8 *cca_pos; > > + > > pos = hostapd_eid_he_capab(hapd, pos, > > IEEE80211_MODE_AP); > > pos = hostapd_eid_he_operation(hapd, pos); > > pos = hostapd_eid_spatial_reuse(hapd, pos); > > pos = hostapd_eid_he_mu_edca_parameter_set(hapd, pos); > > pos = hostapd_eid_he_6ghz_band_cap(hapd, pos); > > + cca_pos = hostapd_eid_cca(hapd, pos); > > The BSS Color Change Announcement element is supposed to be between > the > HE Operation and the Spatial Reuse Parameter Set elements, i.e., a > couple of lines above here.. > > > @@ -1567,12 +1573,18 @@ int ieee802_11_build_ap_params(struct > > hostapd_data *hapd, > > #ifdef CONFIG_IEEE80211AX > > if (hapd->iconf->ieee80211ax && !hapd->conf->disable_11ax) { > > + u8 *cca_pos; > > + > > tailpos = hostapd_eid_he_capab(hapd, tailpos, > > IEEE80211_MODE_AP); > > tailpos = hostapd_eid_he_operation(hapd, tailpos); > > tailpos = hostapd_eid_spatial_reuse(hapd, tailpos); > > tailpos = hostapd_eid_he_mu_edca_parameter_set(hapd, > > tailpos); > > tailpos = hostapd_eid_he_6ghz_band_cap(hapd, tailpos); > > + cca_pos = hostapd_eid_cca(hapd, tailpos); > > Same here. > > What about the (Re)Association Response frames? Should we add the BSS > Color Change Announcement element to them as well? Yes, we need to add it into assoc frames to prevent corner cases regarding color missmatching during connection. So far, we only reuse CSA counter attributes to implement the CCA part in kernel side, but we plan to add an assoc attribute. It will take some time to do it, so I think we can get the basic part accepted by hostap first and an incremental patch afterwards. What do you think?
diff --git a/src/ap/beacon.c b/src/ap/beacon.c index 15fc2b3db..76c029823 100644 --- a/src/ap/beacon.c +++ b/src/ap/beacon.c @@ -578,11 +578,17 @@ static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd, #ifdef CONFIG_IEEE80211AX if (hapd->iconf->ieee80211ax && !hapd->conf->disable_11ax) { + u8 *cca_pos; + pos = hostapd_eid_he_capab(hapd, pos, IEEE80211_MODE_AP); pos = hostapd_eid_he_operation(hapd, pos); pos = hostapd_eid_spatial_reuse(hapd, pos); pos = hostapd_eid_he_mu_edca_parameter_set(hapd, pos); pos = hostapd_eid_he_6ghz_band_cap(hapd, pos); + cca_pos = hostapd_eid_cca(hapd, pos); + if (cca_pos != pos) + hapd->cca_c_off_proberesp = cca_pos - (u8 *) resp - 2; + pos = cca_pos; } #endif /* CONFIG_IEEE80211AX */ @@ -1567,12 +1573,18 @@ int ieee802_11_build_ap_params(struct hostapd_data *hapd, #ifdef CONFIG_IEEE80211AX if (hapd->iconf->ieee80211ax && !hapd->conf->disable_11ax) { + u8 *cca_pos; + tailpos = hostapd_eid_he_capab(hapd, tailpos, IEEE80211_MODE_AP); tailpos = hostapd_eid_he_operation(hapd, tailpos); tailpos = hostapd_eid_spatial_reuse(hapd, tailpos); tailpos = hostapd_eid_he_mu_edca_parameter_set(hapd, tailpos); tailpos = hostapd_eid_he_6ghz_band_cap(hapd, tailpos); + cca_pos = hostapd_eid_cca(hapd, tailpos); + if (cca_pos != tailpos) + hapd->cca_c_off_beacon = cca_pos - tail - 2; + tailpos = cca_pos; } #endif /* CONFIG_IEEE80211AX */ diff --git a/src/ap/ieee802_11.h b/src/ap/ieee802_11.h index ea8c60846..65308ff34 100644 --- a/src/ap/ieee802_11.h +++ b/src/ap/ieee802_11.h @@ -100,6 +100,7 @@ u16 copy_sta_he_6ghz_capab(struct hostapd_data *hapd, struct sta_info *sta, const u8 *he_6ghz_capab); int hostapd_get_he_twt_responder(struct hostapd_data *hapd, enum ieee80211_op_mode mode); +u8 * hostapd_eid_cca(struct hostapd_data *hapd, u8 *eid); void hostapd_tx_status(struct hostapd_data *hapd, const u8 *addr, const u8 *buf, size_t len, int ack); void hostapd_eapol_tx_status(struct hostapd_data *hapd, const u8 *dst, diff --git a/src/ap/ieee802_11_he.c b/src/ap/ieee802_11_he.c index 6cd6c90dc..756ca3804 100644 --- a/src/ap/ieee802_11_he.c +++ b/src/ap/ieee802_11_he.c @@ -520,3 +520,16 @@ int hostapd_get_he_twt_responder(struct hostapd_data *hapd, return !!(mac_cap[HE_MAC_CAPAB_0] & HE_MACCAP_TWT_RESPONDER) && hapd->iface->conf->he_op.he_twt_responder; } + +u8 * hostapd_eid_cca(struct hostapd_data *hapd, u8 *eid) +{ + if (!hapd->cca_in_progress) + return eid; + *eid++ = WLAN_EID_EXTENSION; + *eid++ = 3; + *eid++ = WLAN_EID_EXT_COLOR_CHANGE_ANNOUNCEMENT; + *eid++ = hapd->cca_count; + *eid++ = hapd->cca_color; + + return eid; +} diff --git a/src/common/ieee802_11_defs.h b/src/common/ieee802_11_defs.h index 73d2dad03..9b39cb387 100644 --- a/src/common/ieee802_11_defs.h +++ b/src/common/ieee802_11_defs.h @@ -479,6 +479,7 @@ #define WLAN_EID_EXT_HE_OPERATION 36 #define WLAN_EID_EXT_HE_MU_EDCA_PARAMS 38 #define WLAN_EID_EXT_SPATIAL_REUSE 39 +#define WLAN_EID_EXT_COLOR_CHANGE_ANNOUNCEMENT 42 #define WLAN_EID_EXT_OCV_OCI 54 #define WLAN_EID_EXT_SHORT_SSID_LIST 58 #define WLAN_EID_EXT_HE_6GHZ_BAND_CAP 59