OSDN Git Service

mac80211: Add api to support configuring TID specific configuration
authorTamizh chelvam <tamizhr@codeaurora.org>
Mon, 20 Jan 2020 07:51:27 +0000 (13:21 +0530)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 24 Feb 2020 13:07:01 +0000 (14:07 +0100)
Implement drv_set_tid_config api to allow TID specific
configuration and drv_reset_tid_config api to reset peer
specific TID configuration. This per-TID onfiguration
will be applied for all the connected stations when MAC is NULL.

Signed-off-by: Tamizh chelvam <tamizhr@codeaurora.org>
Link: https://lore.kernel.org/r/1579506687-18296-7-git-send-email-tamizhr@codeaurora.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
include/net/mac80211.h
net/mac80211/cfg.c
net/mac80211/driver-ops.h

index ce80773..5ef34a2 100644 (file)
@@ -3776,6 +3776,9 @@ enum ieee80211_reconfig_type {
  *
  * @start_pmsr: start peer measurement (e.g. FTM) (this call can sleep)
  * @abort_pmsr: abort peer measurement (this call can sleep)
+ * @set_tid_config: Apply TID specific configurations. This callback may sleep.
+ * @reset_tid_config: Reset TID specific configuration for the peer.
+ *     This callback may sleep.
  */
 struct ieee80211_ops {
        void (*tx)(struct ieee80211_hw *hw,
@@ -4080,6 +4083,13 @@ struct ieee80211_ops {
                          struct cfg80211_pmsr_request *request);
        void (*abort_pmsr)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
                           struct cfg80211_pmsr_request *request);
+       int (*set_tid_config)(struct ieee80211_hw *hw,
+                             struct ieee80211_vif *vif,
+                             struct ieee80211_sta *sta,
+                             struct cfg80211_tid_config *tid_conf);
+       int (*reset_tid_config)(struct ieee80211_hw *hw,
+                               struct ieee80211_vif *vif,
+                               struct ieee80211_sta *sta, u8 tids);
 };
 
 /**
index a762ba6..7b654d2 100644 (file)
@@ -3886,6 +3886,60 @@ ieee80211_abort_pmsr(struct wiphy *wiphy, struct wireless_dev *dev,
        return drv_abort_pmsr(local, sdata, request);
 }
 
+static int ieee80211_set_tid_config(struct wiphy *wiphy,
+                                   struct net_device *dev,
+                                   struct cfg80211_tid_config *tid_conf)
+{
+       struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+       struct sta_info *sta;
+       int ret;
+
+       if (!sdata->local->ops->set_tid_config)
+               return -EOPNOTSUPP;
+
+       if (!tid_conf->peer)
+               return drv_set_tid_config(sdata->local, sdata, NULL, tid_conf);
+
+       mutex_lock(&sdata->local->sta_mtx);
+       sta = sta_info_get_bss(sdata, tid_conf->peer);
+       if (!sta) {
+               mutex_unlock(&sdata->local->sta_mtx);
+               return -ENOENT;
+       }
+
+       ret = drv_set_tid_config(sdata->local, sdata, &sta->sta, tid_conf);
+       mutex_unlock(&sdata->local->sta_mtx);
+
+       return ret;
+}
+
+static int ieee80211_reset_tid_config(struct wiphy *wiphy,
+                                     struct net_device *dev,
+                                     const u8 *peer, u8 tid)
+{
+       struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+       struct sta_info *sta;
+       int ret;
+
+       if (!sdata->local->ops->reset_tid_config)
+               return -EOPNOTSUPP;
+
+       if (!peer)
+               return drv_reset_tid_config(sdata->local, sdata, NULL, tid);
+
+       mutex_lock(&sdata->local->sta_mtx);
+       sta = sta_info_get_bss(sdata, peer);
+       if (!sta) {
+               mutex_unlock(&sdata->local->sta_mtx);
+               return -ENOENT;
+       }
+
+       ret = drv_reset_tid_config(sdata->local, sdata, &sta->sta, tid);
+       mutex_unlock(&sdata->local->sta_mtx);
+
+       return ret;
+}
+
 const struct cfg80211_ops mac80211_config_ops = {
        .add_virtual_intf = ieee80211_add_iface,
        .del_virtual_intf = ieee80211_del_iface,
@@ -3986,4 +4040,6 @@ const struct cfg80211_ops mac80211_config_ops = {
        .start_pmsr = ieee80211_start_pmsr,
        .abort_pmsr = ieee80211_abort_pmsr,
        .probe_mesh_link = ieee80211_probe_mesh_link,
+       .set_tid_config = ieee80211_set_tid_config,
+       .reset_tid_config = ieee80211_reset_tid_config,
 };
index 2c9b3eb..3877710 100644 (file)
@@ -1358,4 +1358,31 @@ static inline void drv_del_nan_func(struct ieee80211_local *local,
        trace_drv_return_void(local);
 }
 
+static inline int drv_set_tid_config(struct ieee80211_local *local,
+                                    struct ieee80211_sub_if_data *sdata,
+                                    struct ieee80211_sta *sta,
+                                    struct cfg80211_tid_config *tid_conf)
+{
+       int ret;
+
+       might_sleep();
+       ret = local->ops->set_tid_config(&local->hw, &sdata->vif, sta,
+                                        tid_conf);
+       trace_drv_return_int(local, ret);
+
+       return ret;
+}
+
+static inline int drv_reset_tid_config(struct ieee80211_local *local,
+                                      struct ieee80211_sub_if_data *sdata,
+                                      struct ieee80211_sta *sta, u8 tid)
+{
+       int ret;
+
+       might_sleep();
+       ret = local->ops->reset_tid_config(&local->hw, &sdata->vif, sta, tid);
+       trace_drv_return_int(local, ret);
+
+       return ret;
+}
 #endif /* __MAC80211_DRIVER_OPS */