cfg80211: add flags to cfg80211_rx_mgmt()
authorVladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Thu, 15 Aug 2013 11:51:28 +0000 (14:51 +0300)
committerJohannes Berg <johannes.berg@intel.com>
Fri, 23 Aug 2013 14:06:03 +0000 (16:06 +0200)
Add flags intended to report various auxiliary information
and introduce the NL80211_RXMGMT_FLAG_ANSWERED flag to report
that the frame was already answered by the device.

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
[REPLIED->ANSWERED, reword commit message]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/ath/ath6kl/wmi.c
drivers/net/wireless/ath/wil6210/wmi.c
drivers/net/wireless/brcm80211/brcmfmac/p2p.c
drivers/net/wireless/mwifiex/util.c
include/net/cfg80211.h
include/uapi/linux/nl80211.h
net/mac80211/rx.c
net/wireless/mlme.c
net/wireless/nl80211.c
net/wireless/nl80211.h

index 87aefb4c4c23c5d8355df9e3c30ba08a6855278e..546d5da0b8947a2f8522c5f7b8893ee0a6f537d5 100644 (file)
@@ -568,8 +568,8 @@ static int ath6kl_wmi_rx_probe_req_event_rx(struct wmi *wmi, u8 *datap, int len,
                   dlen, freq, vif->probe_req_report);
 
        if (vif->probe_req_report || vif->nw_type == AP_NETWORK)
-               cfg80211_rx_mgmt(&vif->wdev, freq, 0,
-                                ev->data, dlen, GFP_ATOMIC);
+               cfg80211_rx_mgmt(&vif->wdev, freq, 0, ev->data, dlen, 0,
+                                GFP_ATOMIC);
 
        return 0;
 }
@@ -608,8 +608,7 @@ static int ath6kl_wmi_rx_action_event_rx(struct wmi *wmi, u8 *datap, int len,
                return -EINVAL;
        }
        ath6kl_dbg(ATH6KL_DBG_WMI, "rx_action: len=%u freq=%u\n", dlen, freq);
-       cfg80211_rx_mgmt(&vif->wdev, freq, 0,
-                        ev->data, dlen, GFP_ATOMIC);
+       cfg80211_rx_mgmt(&vif->wdev, freq, 0, ev->data, dlen, 0, GFP_ATOMIC);
 
        return 0;
 }
index dc8059ad4bab0d6d979d298d22d3bbf913211e85..21c791ee817878e2ae06713871d592dd47d9551b 100644 (file)
@@ -339,7 +339,7 @@ static void wmi_evt_rx_mgmt(struct wil6210_priv *wil, int id, void *d, int len)
                }
        } else {
                cfg80211_rx_mgmt(wil->wdev, freq, signal,
-                                (void *)rx_mgmt_frame, d_len, GFP_KERNEL);
+                                (void *)rx_mgmt_frame, d_len, 0, GFP_KERNEL);
        }
 }
 
index 79555f006d53d170e6186a76f3111b6d16b299ee..d7a974532909136c44eec23520e50d209db5df4b 100644 (file)
@@ -1430,7 +1430,7 @@ int brcmf_p2p_notify_action_frame_rx(struct brcmf_if *ifp,
                                              IEEE80211_BAND_5GHZ);
 
        wdev = &ifp->vif->wdev;
-       cfg80211_rx_mgmt(wdev, freq, 0, (u8 *)mgmt_frame, mgmt_frame_len,
+       cfg80211_rx_mgmt(wdev, freq, 0, (u8 *)mgmt_frame, mgmt_frame_len, 0,
                         GFP_ATOMIC);
 
        kfree(mgmt_frame);
@@ -1895,7 +1895,7 @@ s32 brcmf_p2p_notify_rx_mgmt_p2p_probereq(struct brcmf_if *ifp,
                                              IEEE80211_BAND_2GHZ :
                                              IEEE80211_BAND_5GHZ);
 
-       cfg80211_rx_mgmt(&vif->wdev, freq, 0, mgmt_frame, mgmt_frame_len,
+       cfg80211_rx_mgmt(&vif->wdev, freq, 0, mgmt_frame, mgmt_frame_len, 0,
                         GFP_ATOMIC);
 
        brcmf_dbg(INFO, "mgmt_frame_len (%d) , e->datalen (%d), chanspec (%04x), freq (%d)\n",
index e57ac0dd3ab55177512aeac08482e54e926696cd..5d9e150f411147f572541cf5b06d913a873fb413 100644 (file)
@@ -171,8 +171,8 @@ mwifiex_process_mgmt_packet(struct mwifiex_private *priv,
        rx_pd->rx_pkt_length = cpu_to_le16(pkt_len);
 
        cfg80211_rx_mgmt(priv->wdev, priv->roc_cfg.chan.center_freq,
-                        CAL_RSSI(rx_pd->snr, rx_pd->nf),
-                        skb->data, pkt_len, GFP_ATOMIC);
+                        CAL_RSSI(rx_pd->snr, rx_pd->nf), skb->data, pkt_len,
+                        0, GFP_ATOMIC);
 
        return 0;
 }
index 9ab7a0690d934ea6b8e78129e3a912b5e92a1c82..d530c54a366286f2baccab70be91e68985ebebbb 100644 (file)
@@ -4056,6 +4056,7 @@ void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr,
  * @sig_dbm: signal strength in mBm, or 0 if unknown
  * @buf: Management frame (header + body)
  * @len: length of the frame data
+ * @flags: flags, as defined in enum nl80211_rxmgmt_flags
  * @gfp: context flags
  *
  * This function is called whenever an Action frame is received for a station
@@ -4067,7 +4068,7 @@ void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr,
  * driver is responsible for rejecting the frame.
  */
 bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int sig_dbm,
-                     const u8 *buf, size_t len, gfp_t gfp);
+                     const u8 *buf, size_t len, u32 flags, gfp_t gfp);
 
 /**
  * cfg80211_mgmt_tx_status - notification of TX status for management frame
index 1f42bc3dcb9c544407eeb32968b41089c4a5917e..fde2c021b26dbe3be5e00a9c47de5dbdb7d60b80 100644 (file)
@@ -1493,6 +1493,9 @@ enum nl80211_commands {
  * @NL80211_ATTR_CSA_C_OFF_PRESP: Offset of the channel switch counter
  *     field in the probe response (%NL80211_ATTR_PROBE_RESP).
  *
+ * @NL80211_ATTR_RXMGMT_FLAGS: flags for nl80211_send_mgmt(), u32.
+ *     As specified in the &enum nl80211_rxmgmt_flags.
+ *
  * @NL80211_ATTR_MAX: highest attribute number currently defined
  * @__NL80211_ATTR_AFTER_LAST: internal use
  */
@@ -1801,6 +1804,8 @@ enum nl80211_attrs {
        NL80211_ATTR_CSA_C_OFF_BEACON,
        NL80211_ATTR_CSA_C_OFF_PRESP,
 
+       NL80211_ATTR_RXMGMT_FLAGS,
+
        /* add attributes here, update the policy in nl80211.c */
 
        __NL80211_ATTR_AFTER_LAST,
@@ -3901,4 +3906,15 @@ enum nl80211_crit_proto_id {
 /* maximum duration for critical protocol measures */
 #define NL80211_CRIT_PROTO_MAX_DURATION                5000 /* msec */
 
+/**
+ * enum nl80211_rxmgmt_flags - flags for received management frame.
+ *
+ * Used by cfg80211_rx_mgmt()
+ *
+ * @NL80211_RXMGMT_FLAG_ANSWERED: frame was answered by device/driver.
+ */
+enum nl80211_rxmgmt_flags {
+       NL80211_RXMGMT_FLAG_ANSWERED = 1 << 0,
+};
+
 #endif /* __LINUX_NL80211_H */
index ffad155316a966e0384c561cbc540819818ada60..07901050812f0972f292a8caceed80ed02facd0a 100644 (file)
@@ -2678,8 +2678,7 @@ ieee80211_rx_h_userspace_mgmt(struct ieee80211_rx_data *rx)
                sig = status->signal;
 
        if (cfg80211_rx_mgmt(&rx->sdata->wdev, status->freq, sig,
-                            rx->skb->data, rx->skb->len,
-                            GFP_ATOMIC)) {
+                            rx->skb->data, rx->skb->len, 0, GFP_ATOMIC)) {
                if (rx->sta)
                        rx->sta->rx_packets++;
                dev_kfree_skb(rx->skb);
index bfac5e186f579f8b6d526de5d100a77083e45696..8d49c1ce3deacbbb7ec9fe534e081ef7953607f5 100644 (file)
@@ -621,7 +621,7 @@ int cfg80211_mlme_mgmt_tx(struct cfg80211_registered_device *rdev,
 }
 
 bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int sig_mbm,
-                     const u8 *buf, size_t len, gfp_t gfp)
+                     const u8 *buf, size_t len, u32 flags, gfp_t gfp)
 {
        struct wiphy *wiphy = wdev->wiphy;
        struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
@@ -664,7 +664,7 @@ bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int sig_mbm,
                /* Indicate the received Action frame to user space */
                if (nl80211_send_mgmt(rdev, wdev, reg->nlportid,
                                      freq, sig_mbm,
-                                     buf, len, gfp))
+                                     buf, len, flags, gfp))
                        continue;
 
                result = true;
index 334697de5cc06254ac8e1749803aa39677ec995d..a51269d2d48888834043fd0881e769cb5f623c44 100644 (file)
@@ -10446,7 +10446,7 @@ EXPORT_SYMBOL(cfg80211_rx_unexpected_4addr_frame);
 int nl80211_send_mgmt(struct cfg80211_registered_device *rdev,
                      struct wireless_dev *wdev, u32 nlportid,
                      int freq, int sig_dbm,
-                     const u8 *buf, size_t len, gfp_t gfp)
+                     const u8 *buf, size_t len, u32 flags, gfp_t gfp)
 {
        struct net_device *netdev = wdev->netdev;
        struct sk_buff *msg;
@@ -10469,7 +10469,9 @@ int nl80211_send_mgmt(struct cfg80211_registered_device *rdev,
            nla_put_u32(msg, NL80211_ATTR_WIPHY_FREQ, freq) ||
            (sig_dbm &&
             nla_put_u32(msg, NL80211_ATTR_RX_SIGNAL_DBM, sig_dbm)) ||
-           nla_put(msg, NL80211_ATTR_FRAME, len, buf))
+           nla_put(msg, NL80211_ATTR_FRAME, len, buf) ||
+           (flags &&
+            nla_put_u32(msg, NL80211_ATTR_RXMGMT_FLAGS, flags)))
                goto nla_put_failure;
 
        genlmsg_end(msg, hdr);
index 44341bf53cfc98767f41899dd73479557fdc26aa..2c0f2b3c07cba7e4c2f50b17895d498c79d08dfb 100644 (file)
@@ -66,7 +66,7 @@ void nl80211_send_ibss_bssid(struct cfg80211_registered_device *rdev,
 int nl80211_send_mgmt(struct cfg80211_registered_device *rdev,
                      struct wireless_dev *wdev, u32 nlpid,
                      int freq, int sig_dbm,
-                     const u8 *buf, size_t len, gfp_t gfp);
+                     const u8 *buf, size_t len, u32 flags, gfp_t gfp);
 
 void
 nl80211_radar_notify(struct cfg80211_registered_device *rdev,