Message ID | 1370442893-1687-3-git-send-email-ordex@autistici.org (mailing list archive) |
---|---|
State | Not Applicable, archived |
Headers | show |
Antonio Quartulli <ordex@autistici.org> writes: > From: Antonio Quartulli <antonio@open-mesh.com> > > cfg80211 passes a NULL channel to mgmt_tx if the frame has > to be sent on the one currently in use by the device. > Make the implementation of mgmt_tx correctly handle this > case > > Cc: Kalle Valo <kvalo@qca.qualcomm.com> > Cc: Nicolas Cavallari <Nicolas.Cavallari@lri.fr> > Signed-off-by: Antonio Quartulli <antonio@open-mesh.com> [...] > @@ -3175,10 +3175,17 @@ static int ath6kl_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, > { > struct ath6kl_vif *vif = ath6kl_vif_from_wdev(wdev); > struct ath6kl *ar = ath6kl_priv(vif->ndev); > - u32 id; > + u32 id, freq; > const struct ieee80211_mgmt *mgmt; > bool more_data, queued; > > + /* default to the current channel, but use the one specified as argument > + * if any > + */ > + freq = vif->ch_hint; > + if (chan) > + freq = chan->center_freq; Can you please add a check here: if (WARN_ON(chan == 0)) return -EINVAL; Just like Arend, I want to be sure that we don't submit value 0 to the firmware.
On Wed, Jun 05, 2013 at 07:48:15AM -0700, Kalle Valo wrote: > Antonio Quartulli <ordex@autistici.org> writes: > > > From: Antonio Quartulli <antonio@open-mesh.com> > > > > cfg80211 passes a NULL channel to mgmt_tx if the frame has > > to be sent on the one currently in use by the device. > > Make the implementation of mgmt_tx correctly handle this > > case > > > > Cc: Kalle Valo <kvalo@qca.qualcomm.com> > > Cc: Nicolas Cavallari <Nicolas.Cavallari@lri.fr> > > Signed-off-by: Antonio Quartulli <antonio@open-mesh.com> > > [...] > > > @@ -3175,10 +3175,17 @@ static int ath6kl_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, > > { > > struct ath6kl_vif *vif = ath6kl_vif_from_wdev(wdev); > > struct ath6kl *ar = ath6kl_priv(vif->ndev); > > - u32 id; > > + u32 id, freq; > > const struct ieee80211_mgmt *mgmt; > > bool more_data, queued; > > > > + /* default to the current channel, but use the one specified as argument > > + * if any > > + */ > > + freq = vif->ch_hint; > > + if (chan) > > + freq = chan->center_freq; > > Can you please add a check here: > > if (WARN_ON(chan == 0)) > return -EINVAL; I think you meant (freq == 0) ? > > Just like Arend, I want to be sure that we don't submit value 0 to the > firmware. Yeah ok. In ath6kl, are you aware of any "firmware command" to get the channel from the device like I did for brcmfmac ? I couldn't find any define matching *GET*CHAN* Regards,
Antonio Quartulli <antonio@open-mesh.com> writes: > On Wed, Jun 05, 2013 at 07:48:15AM -0700, Kalle Valo wrote: >> Antonio Quartulli <ordex@autistici.org> writes: >> >> > From: Antonio Quartulli <antonio@open-mesh.com> >> > >> > cfg80211 passes a NULL channel to mgmt_tx if the frame has >> > to be sent on the one currently in use by the device. >> > Make the implementation of mgmt_tx correctly handle this >> > case >> > >> > Cc: Kalle Valo <kvalo@qca.qualcomm.com> >> > Cc: Nicolas Cavallari <Nicolas.Cavallari@lri.fr> >> > Signed-off-by: Antonio Quartulli <antonio@open-mesh.com> >> >> [...] >> >> > @@ -3175,10 +3175,17 @@ static int ath6kl_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, >> > { >> > struct ath6kl_vif *vif = ath6kl_vif_from_wdev(wdev); >> > struct ath6kl *ar = ath6kl_priv(vif->ndev); >> > - u32 id; >> > + u32 id, freq; >> > const struct ieee80211_mgmt *mgmt; >> > bool more_data, queued; >> > >> > + /* default to the current channel, but use the one specified as argument >> > + * if any >> > + */ >> > + freq = vif->ch_hint; >> > + if (chan) >> > + freq = chan->center_freq; >> >> Can you please add a check here: >> >> if (WARN_ON(chan == 0)) >> return -EINVAL; > > I think you meant (freq == 0) ? Yes, thanks for catching that :) >> Just like Arend, I want to be sure that we don't submit value 0 to the >> firmware. > > Yeah ok. In ath6kl, are you aware of any "firmware command" to get the channel > from the device like I did for brcmfmac ? > > I couldn't find any define matching *GET*CHAN* I don't recall seeing anything like that.
diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.c b/drivers/net/wireless/ath/ath6kl/cfg80211.c index f7995b2..b542203 100644 --- a/drivers/net/wireless/ath/ath6kl/cfg80211.c +++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c @@ -3175,10 +3175,17 @@ static int ath6kl_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, { struct ath6kl_vif *vif = ath6kl_vif_from_wdev(wdev); struct ath6kl *ar = ath6kl_priv(vif->ndev); - u32 id; + u32 id, freq; const struct ieee80211_mgmt *mgmt; bool more_data, queued; + /* default to the current channel, but use the one specified as argument + * if any + */ + freq = vif->ch_hint; + if (chan) + freq = chan->center_freq; + mgmt = (const struct ieee80211_mgmt *) buf; if (vif->nw_type == AP_NETWORK && test_bit(CONNECTED, &vif->flags) && ieee80211_is_probe_resp(mgmt->frame_control) && @@ -3188,8 +3195,7 @@ static int ath6kl_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, * command to allow the target to fill in the generic IEs. */ *cookie = 0; /* TX status not supported */ - return ath6kl_send_go_probe_resp(vif, buf, len, - chan->center_freq); + return ath6kl_send_go_probe_resp(vif, buf, len, freq); } id = vif->send_action_id++; @@ -3205,17 +3211,14 @@ static int ath6kl_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, /* AP mode Power saving processing */ if (vif->nw_type == AP_NETWORK) { - queued = ath6kl_mgmt_powersave_ap(vif, - id, chan->center_freq, - wait, buf, - len, &more_data, no_cck); + queued = ath6kl_mgmt_powersave_ap(vif, id, freq, wait, buf, len, + &more_data, no_cck); if (queued) return 0; } - return ath6kl_wmi_send_mgmt_cmd(ar->wmi, vif->fw_vif_idx, id, - chan->center_freq, wait, - buf, len, no_cck); + return ath6kl_wmi_send_mgmt_cmd(ar->wmi, vif->fw_vif_idx, id, freq, + wait, buf, len, no_cck); } static void ath6kl_mgmt_frame_register(struct wiphy *wiphy,