cfg80211: Convert del_station() callback to use a param struct
authorJouni Malinen <jouni@qca.qualcomm.com>
Fri, 10 Oct 2014 17:52:40 +0000 (20:52 +0300)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 20 Oct 2014 14:24:21 +0000 (16:24 +0200)
This makes it easier to add new parameters for the del_station calls
without having to modify all drivers that use this.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/ath/ath6kl/cfg80211.c
drivers/net/wireless/ath/wil6210/cfg80211.c
drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
drivers/net/wireless/mwifiex/cfg80211.c
drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
include/net/cfg80211.h
net/mac80211/cfg.c
net/wireless/nl80211.c
net/wireless/rdev-ops.h
net/wireless/trace.h

index ba60e37213eb1d289fa983e8eacbce48c1616b0a..7a5337877a0c507d5c94b2002b2c4e7e9577d3f3 100644 (file)
@@ -2976,11 +2976,11 @@ static int ath6kl_stop_ap(struct wiphy *wiphy, struct net_device *dev)
 static const u8 bcast_addr[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
 
 static int ath6kl_del_station(struct wiphy *wiphy, struct net_device *dev,
-                             const u8 *mac)
+                             struct station_del_parameters *params)
 {
        struct ath6kl *ar = ath6kl_priv(dev);
        struct ath6kl_vif *vif = netdev_priv(dev);
-       const u8 *addr = mac ? mac : bcast_addr;
+       const u8 *addr = params->mac ? params->mac : bcast_addr;
 
        return ath6kl_wmi_ap_set_mlme(ar->wmi, vif->fw_vif_idx, WMI_AP_DEAUTH,
                                      addr, WLAN_REASON_PREV_AUTH_NOT_VALID);
index d9f4b30dd343b01e1d58ac8c9deadbb246a82abd..8fdfa3222a6e72e1f77aabf2b6ee7a8e4311eed9 100644 (file)
@@ -792,12 +792,13 @@ static int wil_cfg80211_stop_ap(struct wiphy *wiphy,
 }
 
 static int wil_cfg80211_del_station(struct wiphy *wiphy,
-                                   struct net_device *dev, const u8 *mac)
+                                   struct net_device *dev,
+                                   struct station_del_parameters *params)
 {
        struct wil6210_priv *wil = wiphy_to_wil(wiphy);
 
        mutex_lock(&wil->mutex);
-       wil6210_disconnect(wil, mac);
+       wil6210_disconnect(wil, params->mac);
        mutex_unlock(&wil->mutex);
 
        return 0;
index 28fa25b509db8c3154d2ff0220d4b05c5f83c99d..1a2e062d3bfd8976d8b6f217e34005dd083d4393 100644 (file)
@@ -3998,24 +3998,24 @@ brcmf_cfg80211_change_beacon(struct wiphy *wiphy, struct net_device *ndev,
 
 static int
 brcmf_cfg80211_del_station(struct wiphy *wiphy, struct net_device *ndev,
-                          const u8 *mac)
+                          struct station_del_parameters *params)
 {
        struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
        struct brcmf_scb_val_le scbval;
        struct brcmf_if *ifp = netdev_priv(ndev);
        s32 err;
 
-       if (!mac)
+       if (!params->mac)
                return -EFAULT;
 
-       brcmf_dbg(TRACE, "Enter %pM\n", mac);
+       brcmf_dbg(TRACE, "Enter %pM\n", params->mac);
 
        if (ifp->vif == cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE].vif)
                ifp = cfg->p2p.bss_idx[P2PAPI_BSSCFG_PRIMARY].vif->ifp;
        if (!check_vif_up(ifp->vif))
                return -EIO;
 
-       memcpy(&scbval.ea, mac, ETH_ALEN);
+       memcpy(&scbval.ea, params->mac, ETH_ALEN);
        scbval.val = cpu_to_le32(WLAN_REASON_DEAUTH_LEAVING);
        err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SCB_DEAUTHENTICATE_FOR_REASON,
                                     &scbval, sizeof(scbval));
index 0dd672954ad10316bec599a0f2eeb56b70e66c75..71e29c7055de3d29a00559861d391a1700a54536 100644 (file)
@@ -1239,7 +1239,7 @@ static int mwifiex_cfg80211_change_beacon(struct wiphy *wiphy,
  */
 static int
 mwifiex_cfg80211_del_station(struct wiphy *wiphy, struct net_device *dev,
-                            const u8 *mac)
+                            struct station_del_parameters *params)
 {
        struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
        struct mwifiex_sta_node *sta_node;
@@ -1248,7 +1248,7 @@ mwifiex_cfg80211_del_station(struct wiphy *wiphy, struct net_device *dev,
        if (list_empty(&priv->sta_list) || !priv->bss_started)
                return 0;
 
-       if (!mac || is_broadcast_ether_addr(mac)) {
+       if (!params->mac || is_broadcast_ether_addr(params->mac)) {
                wiphy_dbg(wiphy, "%s: NULL/broadcast mac address\n", __func__);
                list_for_each_entry(sta_node, &priv->sta_list, list) {
                        if (mwifiex_send_cmd(priv, HostCmd_CMD_UAP_STA_DEAUTH,
@@ -1258,9 +1258,10 @@ mwifiex_cfg80211_del_station(struct wiphy *wiphy, struct net_device *dev,
                        mwifiex_uap_del_sta_data(priv, sta_node);
                }
        } else {
-               wiphy_dbg(wiphy, "%s: mac address %pM\n", __func__, mac);
+               wiphy_dbg(wiphy, "%s: mac address %pM\n", __func__,
+                         params->mac);
                spin_lock_irqsave(&priv->sta_list_spinlock, flags);
-               sta_node = mwifiex_get_sta_entry(priv, mac);
+               sta_node = mwifiex_get_sta_entry(priv, params->mac);
                spin_unlock_irqrestore(&priv->sta_list_spinlock, flags);
                if (sta_node) {
                        if (mwifiex_send_cmd(priv, HostCmd_CMD_UAP_STA_DEAUTH,
index bd6953af0a0396f715cb2622e5a4e6ca904b5228..3d26955da724bcab0ea5e872076752607a51f79b 100644 (file)
@@ -2856,8 +2856,10 @@ static int cfg80211_rtw_add_station(struct wiphy *wiphy,
 }
 
 static int cfg80211_rtw_del_station(struct wiphy *wiphy,
-                                   struct net_device *ndev, const u8 *mac)
+                                   struct net_device *ndev,
+                                   struct station_del_parameters *params)
 {
+       const u8 *mac = params->mac;
        int ret = 0;
        struct list_head *phead, *plist, *ptmp;
        u8 updated = 0;
index 3f3aaa06adb56663c874611b05439142e3d5e136..ebb69f67197939211e462961feec859fb090e016 100644 (file)
@@ -798,6 +798,17 @@ struct station_parameters {
        bool opmode_notif_used;
 };
 
+/**
+ * struct station_del_parameters - station deletion parameters
+ *
+ * Used to delete a station entry (or all stations).
+ *
+ * @mac: MAC address of the station to remove or NULL to remove all stations
+ */
+struct station_del_parameters {
+       const u8 *mac;
+};
+
 /**
  * enum cfg80211_station_type - the type of station being modified
  * @CFG80211_STA_AP_CLIENT: client of an AP interface
@@ -2132,7 +2143,7 @@ struct cfg80211_qos_map {
  * @stop_ap: Stop being an AP, including stopping beaconing.
  *
  * @add_station: Add a new station.
- * @del_station: Remove a station; @mac may be NULL to remove all stations.
+ * @del_station: Remove a station
  * @change_station: Modify a given station. Note that flags changes are not much
  *     validated in cfg80211, in particular the auth/assoc/authorized flags
  *     might come to the driver in invalid combinations -- make sure to check
@@ -2378,7 +2389,7 @@ struct cfg80211_ops {
                               const u8 *mac,
                               struct station_parameters *params);
        int     (*del_station)(struct wiphy *wiphy, struct net_device *dev,
-                              const u8 *mac);
+                              struct station_del_parameters *params);
        int     (*change_station)(struct wiphy *wiphy, struct net_device *dev,
                                  const u8 *mac,
                                  struct station_parameters *params);
index 4bb2d34b2dd72d2b2874beb7512d485e0c6b59bc..a1498416ad557d006d94c1fa96f7092d0b8212c9 100644 (file)
@@ -1225,14 +1225,14 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev,
 }
 
 static int ieee80211_del_station(struct wiphy *wiphy, struct net_device *dev,
-                                const u8 *mac)
+                                struct station_del_parameters *params)
 {
        struct ieee80211_sub_if_data *sdata;
 
        sdata = IEEE80211_DEV_TO_SUB_IF(dev);
 
-       if (mac)
-               return sta_info_destroy_addr_bss(sdata, mac);
+       if (params->mac)
+               return sta_info_destroy_addr_bss(sdata, params->mac);
 
        sta_info_flush(sdata);
        return 0;
index d527aa0706c1bc3449894589e04a42cc700250fa..40cf7b937926a9b978727d456f2dd99e6167ab84 100644 (file)
@@ -4398,10 +4398,12 @@ static int nl80211_del_station(struct sk_buff *skb, struct genl_info *info)
 {
        struct cfg80211_registered_device *rdev = info->user_ptr[0];
        struct net_device *dev = info->user_ptr[1];
-       u8 *mac_addr = NULL;
+       struct station_del_parameters params;
+
+       memset(&params, 0, sizeof(params));
 
        if (info->attrs[NL80211_ATTR_MAC])
-               mac_addr = nla_data(info->attrs[NL80211_ATTR_MAC]);
+               params.mac = nla_data(info->attrs[NL80211_ATTR_MAC]);
 
        if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP &&
            dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP_VLAN &&
@@ -4412,7 +4414,7 @@ static int nl80211_del_station(struct sk_buff *skb, struct genl_info *info)
        if (!rdev->ops->del_station)
                return -EOPNOTSUPP;
 
-       return rdev_del_station(rdev, dev, mac_addr);
+       return rdev_del_station(rdev, dev, &params);
 }
 
 static int nl80211_send_mpath(struct sk_buff *msg, u32 portid, u32 seq,
index c09e697bcb15b683cd511d2ec972269861b44471..71b1db3cc6458f798922263f3499a691d90b51b4 100644 (file)
@@ -178,11 +178,12 @@ static inline int rdev_add_station(struct cfg80211_registered_device *rdev,
 }
 
 static inline int rdev_del_station(struct cfg80211_registered_device *rdev,
-                                  struct net_device *dev, u8 *mac)
+                                  struct net_device *dev,
+                                  struct station_del_parameters *params)
 {
        int ret;
-       trace_rdev_del_station(&rdev->wiphy, dev, mac);
-       ret = rdev->ops->del_station(&rdev->wiphy, dev, mac);
+       trace_rdev_del_station(&rdev->wiphy, dev, params);
+       ret = rdev->ops->del_station(&rdev->wiphy, dev, params);
        trace_rdev_return_int(&rdev->wiphy, ret);
        return ret;
 }
index 8e4f8f04332dba4cb38f058924abb274c6c8e630..b1339400631d96f46a1d3c68dec5fe2f4b94ea14 100644 (file)
@@ -680,9 +680,28 @@ DECLARE_EVENT_CLASS(wiphy_netdev_mac_evt,
                  WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(sta_mac))
 );
 
-DEFINE_EVENT(wiphy_netdev_mac_evt, rdev_del_station,
-       TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, const u8 *mac),
-       TP_ARGS(wiphy, netdev, mac)
+DECLARE_EVENT_CLASS(station_del,
+       TP_PROTO(struct wiphy *wiphy, struct net_device *netdev,
+                struct station_del_parameters *params),
+       TP_ARGS(wiphy, netdev, params),
+       TP_STRUCT__entry(
+               WIPHY_ENTRY
+               NETDEV_ENTRY
+               MAC_ENTRY(sta_mac)
+       ),
+       TP_fast_assign(
+               WIPHY_ASSIGN;
+               NETDEV_ASSIGN;
+               MAC_ASSIGN(sta_mac, params->mac);
+       ),
+       TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", station mac: " MAC_PR_FMT,
+                 WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(sta_mac))
+);
+
+DEFINE_EVENT(station_del, rdev_del_station,
+       TP_PROTO(struct wiphy *wiphy, struct net_device *netdev,
+                struct station_del_parameters *params),
+       TP_ARGS(wiphy, netdev, params)
 );
 
 DEFINE_EVENT(wiphy_netdev_mac_evt, rdev_get_station,
This page took 0.043205 seconds and 5 git commands to generate.