提交 98f03342 编写于 作者: J Johannes Berg

cfg80211: clean up beacon loss CQM event

Having it as a sub-event for RSSI thresholds is very ugly,
but luckily no userspace actually uses the events yet.

Move the event to its own function call internally and to
its own event attribute in nl80211.
Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
上级 5b97f49d
......@@ -259,10 +259,7 @@ void wlcore_event_beacon_loss(struct wl1271 *wl, unsigned long roles_bitmap)
&wlvif->connection_loss_work,
msecs_to_jiffies(delay));
ieee80211_cqm_rssi_notify(
vif,
NL80211_CQM_RSSI_BEACON_LOSS_EVENT,
GFP_KERNEL);
ieee80211_cqm_beacon_loss_notify(vif, GFP_KERNEL);
}
}
EXPORT_SYMBOL_GPL(wlcore_event_beacon_loss);
......
......@@ -4669,6 +4669,15 @@ void cfg80211_cqm_pktloss_notify(struct net_device *dev,
void cfg80211_cqm_txe_notify(struct net_device *dev, const u8 *peer,
u32 num_packets, u32 rate, u32 intvl, gfp_t gfp);
/**
* cfg80211_cqm_beacon_loss_notify - beacon loss event
* @dev: network device
* @gfp: context flags
*
* Notify userspace about beacon loss from the connected AP.
*/
void cfg80211_cqm_beacon_loss_notify(struct net_device *dev, gfp_t gfp);
/**
* cfg80211_radar_event - radar detection event
* @wiphy: the wiphy
......
......@@ -4671,6 +4671,14 @@ void ieee80211_cqm_rssi_notify(struct ieee80211_vif *vif,
enum nl80211_cqm_rssi_threshold_event rssi_event,
gfp_t gfp);
/**
* ieee80211_cqm_beacon_loss_notify - inform CQM of beacon loss
*
* @vif: &struct ieee80211_vif pointer from the add_interface callback.
* @gfp: context flags
*/
void ieee80211_cqm_beacon_loss_notify(struct ieee80211_vif *vif, gfp_t gfp);
/**
* ieee80211_radar_detected - inform that a radar was detected
*
......
......@@ -3451,6 +3451,8 @@ enum nl80211_ps_state {
* interval in which %NL80211_ATTR_CQM_TXE_PKTS and
* %NL80211_ATTR_CQM_TXE_RATE must be satisfied before generating an
* %NL80211_CMD_NOTIFY_CQM. Set to 0 to turn off TX error reporting.
* @NL80211_ATTR_CQM_BEACON_LOSS_EVENT: flag attribute that's set in a beacon
* loss event
* @__NL80211_ATTR_CQM_AFTER_LAST: internal
* @NL80211_ATTR_CQM_MAX: highest key attribute
*/
......@@ -3463,6 +3465,7 @@ enum nl80211_attr_cqm {
NL80211_ATTR_CQM_TXE_RATE,
NL80211_ATTR_CQM_TXE_PKTS,
NL80211_ATTR_CQM_TXE_INTVL,
NL80211_ATTR_CQM_BEACON_LOSS_EVENT,
/* keep last */
__NL80211_ATTR_CQM_AFTER_LAST,
......@@ -3475,9 +3478,7 @@ enum nl80211_attr_cqm {
* configured threshold
* @NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH: The RSSI is higher than the
* configured threshold
* @NL80211_CQM_RSSI_BEACON_LOSS_EVENT: The device experienced beacon loss.
* (Note that deauth/disassoc will still follow if the AP is not
* available. This event might get used as roaming event, etc.)
* @NL80211_CQM_RSSI_BEACON_LOSS_EVENT: (reserved, never sent)
*/
enum nl80211_cqm_rssi_threshold_event {
NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW,
......
......@@ -2266,9 +2266,7 @@ static void ieee80211_mgd_probe_ap(struct ieee80211_sub_if_data *sdata,
"detected beacon loss from AP (missed %d beacons) - probing\n",
beacon_loss_count);
ieee80211_cqm_rssi_notify(&sdata->vif,
NL80211_CQM_RSSI_BEACON_LOSS_EVENT,
GFP_KERNEL);
ieee80211_cqm_beacon_loss_notify(&sdata->vif, GFP_KERNEL);
}
/*
......@@ -4901,3 +4899,13 @@ void ieee80211_cqm_rssi_notify(struct ieee80211_vif *vif,
cfg80211_cqm_rssi_notify(sdata->dev, rssi_event, gfp);
}
EXPORT_SYMBOL(ieee80211_cqm_rssi_notify);
void ieee80211_cqm_beacon_loss_notify(struct ieee80211_vif *vif, gfp_t gfp)
{
struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
trace_api_cqm_beacon_loss_notify(sdata->local, sdata);
cfg80211_cqm_beacon_loss_notify(sdata->dev, gfp);
}
EXPORT_SYMBOL(ieee80211_cqm_beacon_loss_notify);
......@@ -1829,6 +1829,12 @@ TRACE_EVENT(api_cqm_rssi_notify,
)
);
DEFINE_EVENT(local_sdata_evt, api_cqm_beacon_loss_notify,
TP_PROTO(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata),
TP_ARGS(local, sdata)
);
TRACE_EVENT(api_scan_completed,
TP_PROTO(struct ieee80211_local *local, bool aborted),
......
......@@ -11826,6 +11826,10 @@ void cfg80211_cqm_rssi_notify(struct net_device *dev,
trace_cfg80211_cqm_rssi_notify(dev, rssi_event);
if (WARN_ON(rssi_event != NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW &&
rssi_event != NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH))
return;
msg = cfg80211_prepare_cqm(dev, NULL, gfp);
if (!msg)
return;
......@@ -11892,6 +11896,25 @@ void cfg80211_cqm_pktloss_notify(struct net_device *dev,
}
EXPORT_SYMBOL(cfg80211_cqm_pktloss_notify);
void cfg80211_cqm_beacon_loss_notify(struct net_device *dev, gfp_t gfp)
{
struct sk_buff *msg;
msg = cfg80211_prepare_cqm(dev, NULL, gfp);
if (!msg)
return;
if (nla_put_flag(msg, NL80211_ATTR_CQM_BEACON_LOSS_EVENT))
goto nla_put_failure;
cfg80211_send_cqm(msg, gfp);
return;
nla_put_failure:
nlmsg_free(msg);
}
EXPORT_SYMBOL(cfg80211_cqm_beacon_loss_notify);
static void nl80211_gtk_rekey_notify(struct cfg80211_registered_device *rdev,
struct net_device *netdev, const u8 *bssid,
const u8 *replay_ctr, gfp_t gfp)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册