History

cfg80211: Pass new RSSI level in CQM RSSI notification

Update the drivers to pass the RSSI level as a cfg80211_cqm_rssi_notify parameter and pass this value to userspace in a new nl80211 attribute. This helps both userspace and also helps in the implementation of the multiple RSSI thresholds CQM mechanism. Note for marvell/mwifiex I pass 0 for the RSSI value because the new RSSI value is not available to the driver at the time of the cfg80211_cqm_rssi_notify call, but the driver queries the new value immediately after that, so it is actually available just a moment later if we wanted to defer caling cfg80211_cqm_rssi_notify until that moment. Without this, the new cfg80211 code (patch 3) will call .get_station which will send a duplicate HostCmd_CMD_RSSI_INFO command to the hardware.

Andrzej Zaborowski committed 9 years ago

Commit bee427b1 parent 769f07d7 files · +23 −11Browse files

Unified · Split

7 files
  1. drivers/net/wireless/marvell/mwifiex/sta_event.c +2 −2
  2. drivers/net/wireless/rndis_wlan.c +1 −1
  3. include/net/cfg80211.h +2 −1
  4. include/uapi/linux/nl80211.h +3 −0
  5. net/mac80211/mlme.c +1 −1
  6. net/wireless/nl80211.c +7 −2
  7. net/wireless/trace.h +7 −4
drivers/net/wireless/marvell/mwifiex/sta_event.c+2−2
@@ -824,7 +824,7 @@ int mwifiex_process_sta_event(struct mwifiex_private *priv) · 823 unmodified lines
824824 case EVENT_RSSI_LOW:
825825 cfg80211_cqm_rssi_notify(priv->netdev,
826826 NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW,
827− GFP_KERNEL);
827+ 0, GFP_KERNEL);
828828 mwifiex_send_cmd(priv, HostCmd_CMD_RSSI_INFO,
829829 HostCmd_ACT_GEN_GET, 0, NULL, false);
830830 priv->subsc_evt_rssi_state = RSSI_LOW_RECVD;
@@ -839,7 +839,7 @@ int mwifiex_process_sta_event(struct mwifiex_private *priv) · 8 unmodified lines
839839 case EVENT_RSSI_HIGH:
840840 cfg80211_cqm_rssi_notify(priv->netdev,
841841 NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH,
842− GFP_KERNEL);
842+ 0, GFP_KERNEL);
843843 mwifiex_send_cmd(priv, HostCmd_CMD_RSSI_INFO,
844844 HostCmd_ACT_GEN_GET, 0, NULL, false);
845845 priv->subsc_evt_rssi_state = RSSI_HIGH_RECVD;
drivers/net/wireless/rndis_wlan.c+1−1
@@ -3187,7 +3187,7 @@ static void rndis_do_cqm(struct usbnet *usbdev, s32 rssi) · 3186 unmodified lines
31873187 return;
31883188
31893189 priv->last_cqm_event_rssi = rssi;
3190− cfg80211_cqm_rssi_notify(usbdev->net, event, GFP_KERNEL);
3190+ cfg80211_cqm_rssi_notify(usbdev->net, event, rssi, GFP_KERNEL);
31913191 }
31923192
31933193 #define DEVICE_POLLER_JIFFIES (HZ)
include/net/cfg80211.h+2−1
@@ -5390,6 +5390,7 @@ void cfg80211_mgmt_tx_status(struct wireless_dev *wdev, u64 cookie, · 5389 unmodified lines
53905390 * cfg80211_cqm_rssi_notify - connection quality monitoring rssi event
53915391 * @dev: network device
53925392 * @rssi_event: the triggered RSSI event
5393+ * @rssi_level: new RSSI level value or 0 if not available
53935394 * @gfp: context flags
53945395 *
53955396 * This function is called when a configured connection quality monitoring
@@ -5397,7 +5398,7 @@ void cfg80211_mgmt_tx_status(struct wireless_dev *wdev, u64 cookie, · 1 unmodified line
53975398 */
53985399 void cfg80211_cqm_rssi_notify(struct net_device *dev,
53995400 enum nl80211_cqm_rssi_threshold_event rssi_event,
5400− gfp_t gfp);
5401+ s32 rssi_level, gfp_t gfp);
54015402
54025403 /**
54035404 * cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer
include/uapi/linux/nl80211.h+3−0
@@ -3952,6 +3952,8 @@ enum nl80211_ps_state { · 3951 unmodified lines
39523952 * %NL80211_CMD_NOTIFY_CQM. Set to 0 to turn off TX error reporting.
39533953 * @NL80211_ATTR_CQM_BEACON_LOSS_EVENT: flag attribute that's set in a beacon
39543954 * loss event
3955+ * @NL80211_ATTR_CQM_RSSI_LEVEL: the RSSI value in dBm that triggered the
3956+ * RSSI threshold event.
39553957 * @__NL80211_ATTR_CQM_AFTER_LAST: internal
39563958 * @NL80211_ATTR_CQM_MAX: highest key attribute
39573959 */
@@ -3965,6 +3967,7 @@ enum nl80211_attr_cqm { · 7 unmodified lines
39653967 NL80211_ATTR_CQM_TXE_PKTS,
39663968 NL80211_ATTR_CQM_TXE_INTVL,
39673969 NL80211_ATTR_CQM_BEACON_LOSS_EVENT,
3970+ NL80211_ATTR_CQM_RSSI_LEVEL,
39683971
39693972 /* keep last */
39703973 __NL80211_ATTR_CQM_AFTER_LAST,
net/mac80211/mlme.c+1−1
@@ -5048,7 +5048,7 @@ void ieee80211_cqm_rssi_notify(struct ieee80211_vif *vif, · 5047 unmodified lines
50485048
50495049 trace_api_cqm_rssi_notify(sdata, rssi_event, rssi_level);
50505050
5051− cfg80211_cqm_rssi_notify(sdata->dev, rssi_event, gfp);
5051+ cfg80211_cqm_rssi_notify(sdata->dev, rssi_event, rssi_level, gfp);
50525052 }
50535053 EXPORT_SYMBOL(ieee80211_cqm_rssi_notify);
50545054
net/wireless/nl80211.c+7−2
@@ -9474,6 +9474,7 @@ nl80211_attr_cqm_policy[NL80211_ATTR_CQM_MAX + 1] = { · 9473 unmodified lines
94749474 [NL80211_ATTR_CQM_TXE_RATE] = { .type = NLA_U32 },
94759475 [NL80211_ATTR_CQM_TXE_PKTS] = { .type = NLA_U32 },
94769476 [NL80211_ATTR_CQM_TXE_INTVL] = { .type = NLA_U32 },
9477+ [NL80211_ATTR_CQM_RSSI_LEVEL] = { .type = NLA_S32 },
94779478 };
94789479
94799480 static int nl80211_set_cqm_txe(struct genl_info *info,
@@ -13959,11 +13960,11 @@ static void cfg80211_send_cqm(struct sk_buff *msg, gfp_t gfp) · 4479 unmodified lines
1395913960
1396013961 void cfg80211_cqm_rssi_notify(struct net_device *dev,
1396113962 enum nl80211_cqm_rssi_threshold_event rssi_event,
13962− gfp_t gfp)
13963+ s32 rssi_level, gfp_t gfp)
1396313964 {
1396413965 struct sk_buff *msg;
1396513966
13966− trace_cfg80211_cqm_rssi_notify(dev, rssi_event);
13967+ trace_cfg80211_cqm_rssi_notify(dev, rssi_event, rssi_level);
1396713968
1396813969 if (WARN_ON(rssi_event != NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW &&
1396913970 rssi_event != NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH))
@@ -13977,6 +13978,10 @@ void cfg80211_cqm_rssi_notify(struct net_device *dev, · 7 unmodified lines
1397713978 rssi_event))
1397813979 goto nla_put_failure;
1397913980
13981+ if (rssi_level && nla_put_s32(msg, NL80211_ATTR_CQM_RSSI_LEVEL,
13982+ rssi_level))
13983+ goto nla_put_failure;
13984+
1398013985 cfg80211_send_cqm(msg, gfp);
1398113986
1398213987 return;
net/wireless/trace.h+7−4
@@ -2490,18 +2490,21 @@ TRACE_EVENT(cfg80211_mgmt_tx_status, · 2489 unmodified lines
24902490
24912491 TRACE_EVENT(cfg80211_cqm_rssi_notify,
24922492 TP_PROTO(struct net_device *netdev,
2493− enum nl80211_cqm_rssi_threshold_event rssi_event),
2494− TP_ARGS(netdev, rssi_event),
2493+ enum nl80211_cqm_rssi_threshold_event rssi_event,
2494+ s32 rssi_level),
2495+ TP_ARGS(netdev, rssi_event, rssi_level),
24952496 TP_STRUCT__entry(
24962497 NETDEV_ENTRY
24972498 __field(enum nl80211_cqm_rssi_threshold_event, rssi_event)
2499+ __field(s32, rssi_level)
24982500 ),
24992501 TP_fast_assign(
25002502 NETDEV_ASSIGN;
25012503 __entry->rssi_event = rssi_event;
2504+ __entry->rssi_level = rssi_level;
25022505 ),
2503− TP_printk(NETDEV_PR_FMT ", rssi event: %d",
2504− NETDEV_PR_ARG, __entry->rssi_event)
2506+ TP_printk(NETDEV_PR_FMT ", rssi event: %d, level: %d",
2507+ NETDEV_PR_ARG, __entry->rssi_event, __entry->rssi_level)
25052508 );
25062509
25072510 TRACE_EVENT(cfg80211_reg_can_beacon,