Commit d1231721 authored by Igor Mitsyanko's avatar Igor Mitsyanko Committed by Kalle Valo

qtnfmac: make regulatory notifier work on per-phy basis

Wireless core calls regulatory notifier for each wiphy and it only
guarantees that bands info is updated for this particular wiphy prior
to calling a notifier. Hence updating all wiphy which belong to driver
in a single notifier callback is redundant and incorrect.
Signed-off-by: default avatarIgor Mitsyanko <igor.mitsyanko.os@quantenna.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 8db32fa4
...@@ -993,20 +993,17 @@ static struct cfg80211_ops qtn_cfg80211_ops = { ...@@ -993,20 +993,17 @@ static struct cfg80211_ops qtn_cfg80211_ops = {
#endif #endif
}; };
static void qtnf_cfg80211_reg_notifier(struct wiphy *wiphy_in, static void qtnf_cfg80211_reg_notifier(struct wiphy *wiphy,
struct regulatory_request *req) struct regulatory_request *req)
{ {
struct qtnf_wmac *mac = wiphy_priv(wiphy_in); struct qtnf_wmac *mac = wiphy_priv(wiphy);
struct qtnf_bus *bus = mac->bus;
struct wiphy *wiphy;
unsigned int mac_idx;
enum nl80211_band band; enum nl80211_band band;
int ret; int ret;
pr_debug("MAC%u: initiator=%d alpha=%c%c\n", mac->macid, req->initiator, pr_debug("MAC%u: initiator=%d alpha=%c%c\n", mac->macid, req->initiator,
req->alpha2[0], req->alpha2[1]); req->alpha2[0], req->alpha2[1]);
ret = qtnf_cmd_reg_notify(bus, req); ret = qtnf_cmd_reg_notify(mac, req);
if (ret) { if (ret) {
if (ret == -EOPNOTSUPP) { if (ret == -EOPNOTSUPP) {
pr_warn("reg update not supported\n"); pr_warn("reg update not supported\n");
...@@ -1021,25 +1018,14 @@ static void qtnf_cfg80211_reg_notifier(struct wiphy *wiphy_in, ...@@ -1021,25 +1018,14 @@ static void qtnf_cfg80211_reg_notifier(struct wiphy *wiphy_in,
return; return;
} }
for (mac_idx = 0; mac_idx < QTNF_MAX_MAC; ++mac_idx) { for (band = 0; band < NUM_NL80211_BANDS; ++band) {
if (!(bus->hw_info.mac_bitmap & (1 << mac_idx))) if (!wiphy->bands[band])
continue;
mac = bus->mac[mac_idx];
if (!mac)
continue; continue;
wiphy = priv_to_wiphy(mac); ret = qtnf_cmd_band_info_get(mac, wiphy->bands[band]);
if (ret)
for (band = 0; band < NUM_NL80211_BANDS; ++band) { pr_err("MAC%u: failed to update band %u\n",
if (!wiphy->bands[band]) mac->macid, band);
continue;
ret = qtnf_cmd_band_info_get(mac, wiphy->bands[band]);
if (ret)
pr_err("failed to get chan info for mac %u band %u\n",
mac_idx, band);
}
} }
} }
......
...@@ -2404,13 +2404,14 @@ int qtnf_cmd_send_updown_intf(struct qtnf_vif *vif, bool up) ...@@ -2404,13 +2404,14 @@ int qtnf_cmd_send_updown_intf(struct qtnf_vif *vif, bool up)
return ret; return ret;
} }
int qtnf_cmd_reg_notify(struct qtnf_bus *bus, struct regulatory_request *req) int qtnf_cmd_reg_notify(struct qtnf_wmac *mac, struct regulatory_request *req)
{ {
struct qtnf_bus *bus = mac->bus;
struct sk_buff *cmd_skb; struct sk_buff *cmd_skb;
int ret; int ret;
struct qlink_cmd_reg_notify *cmd; struct qlink_cmd_reg_notify *cmd;
cmd_skb = qtnf_cmd_alloc_new_cmdskb(QLINK_MACID_RSVD, QLINK_VIFID_RSVD, cmd_skb = qtnf_cmd_alloc_new_cmdskb(mac->macid, QLINK_VIFID_RSVD,
QLINK_CMD_REG_NOTIFY, QLINK_CMD_REG_NOTIFY,
sizeof(*cmd)); sizeof(*cmd));
if (!cmd_skb) if (!cmd_skb)
...@@ -2449,10 +2450,6 @@ int qtnf_cmd_reg_notify(struct qtnf_bus *bus, struct regulatory_request *req) ...@@ -2449,10 +2450,6 @@ int qtnf_cmd_reg_notify(struct qtnf_bus *bus, struct regulatory_request *req)
qtnf_bus_lock(bus); qtnf_bus_lock(bus);
ret = qtnf_cmd_send(bus, cmd_skb); ret = qtnf_cmd_send(bus, cmd_skb);
if (ret)
goto out;
out:
qtnf_bus_unlock(bus); qtnf_bus_unlock(bus);
return ret; return ret;
......
...@@ -57,7 +57,7 @@ int qtnf_cmd_send_disconnect(struct qtnf_vif *vif, ...@@ -57,7 +57,7 @@ int qtnf_cmd_send_disconnect(struct qtnf_vif *vif,
u16 reason_code); u16 reason_code);
int qtnf_cmd_send_updown_intf(struct qtnf_vif *vif, int qtnf_cmd_send_updown_intf(struct qtnf_vif *vif,
bool up); bool up);
int qtnf_cmd_reg_notify(struct qtnf_bus *bus, struct regulatory_request *req); int qtnf_cmd_reg_notify(struct qtnf_wmac *mac, struct regulatory_request *req);
int qtnf_cmd_get_chan_stats(struct qtnf_wmac *mac, u16 channel, int qtnf_cmd_get_chan_stats(struct qtnf_wmac *mac, u16 channel,
struct qtnf_chan_stats *stats); struct qtnf_chan_stats *stats);
int qtnf_cmd_send_chan_switch(struct qtnf_vif *vif, int qtnf_cmd_send_chan_switch(struct qtnf_vif *vif,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment