]> git.baikalelectronics.ru Git - kernel.git/commitdiff
wifi: cfg80211: Add link_id to cfg80211_ch_switch_started_notify()
authorVeerendranath Jakkam <quic_vjakkam@quicinc.com>
Fri, 22 Jul 2022 13:11:42 +0000 (18:41 +0530)
committerJohannes Berg <johannes.berg@intel.com>
Thu, 25 Aug 2022 09:07:26 +0000 (11:07 +0200)
Add link_id parameter to cfg80211_ch_switch_started_notify() to allow
driver to indicate on which link channel switch started on MLD.

Send the data to userspace so it knows as well.

Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
Link: https://lore.kernel.org/r/20220722131143.3438042-1-quic_vjakkam@quicinc.com
Link: https://lore.kernel.org/r/20220722131143.3438042-2-quic_vjakkam@quicinc.com
[squash two patches]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
include/net/cfg80211.h
net/mac80211/cfg.c
net/mac80211/mlme.c
net/wireless/nl80211.c
net/wireless/trace.h

index ffbc65a9b00ba8c2147e6ad841ee156848cd9cfb..e09ff87146c1c56522ef7b5188951b94f60420cd 100644 (file)
@@ -8281,6 +8281,7 @@ void cfg80211_ch_switch_notify(struct net_device *dev,
  * cfg80211_ch_switch_started_notify - notify channel switch start
  * @dev: the device on which the channel switch started
  * @chandef: the future channel definition
+ * @link_id: the link ID for MLO, must be 0 for non-MLO
  * @count: the number of TBTTs until the channel switch happens
  * @quiet: whether or not immediate quiet was requested by the AP
  *
@@ -8290,7 +8291,8 @@ void cfg80211_ch_switch_notify(struct net_device *dev,
  */
 void cfg80211_ch_switch_started_notify(struct net_device *dev,
                                       struct cfg80211_chan_def *chandef,
-                                      u8 count, bool quiet);
+                                      unsigned int link_id, u8 count,
+                                      bool quiet);
 
 /**
  * ieee80211_operating_class_to_band - convert operating class to band
index 960d5c4a594039c191ba7b8458d27f5aa5427f0b..b5522edbe05db120e5d180a096219f3ff7439e54 100644 (file)
@@ -3815,7 +3815,7 @@ __ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev,
                                          IEEE80211_QUEUE_STOP_REASON_CSA);
 
        cfg80211_ch_switch_started_notify(sdata->dev,
-                                         &sdata->deflink.csa_chandef,
+                                         &sdata->deflink.csa_chandef, 0,
                                          params->count, params->block_tx);
 
        if (changed) {
index 2dcb7f5c83979a573601677af331e1186f4f30f5..82cf4ad8bf422cb572ab27e1daa4231cb313b4d2 100644 (file)
@@ -1911,7 +1911,7 @@ ieee80211_sta_process_chanswitch(struct ieee80211_link_data *link,
                                          IEEE80211_QUEUE_STOP_REASON_CSA);
        mutex_unlock(&local->mtx);
 
-       cfg80211_ch_switch_started_notify(sdata->dev, &csa_ie.chandef,
+       cfg80211_ch_switch_started_notify(sdata->dev, &csa_ie.chandef, 0,
                                          csa_ie.count, csa_ie.mode);
 
        if (local->ops->channel_switch) {
index 2baa2f2bc1ed243a705f41ac97c79d60d0739f68..dad88d231d56037ff8a956a8d342fe8cbfaaf136 100644 (file)
@@ -18932,11 +18932,13 @@ EXPORT_SYMBOL(cfg80211_pmksa_candidate_notify);
 
 static void nl80211_ch_switch_notify(struct cfg80211_registered_device *rdev,
                                     struct net_device *netdev,
+                                    unsigned int link_id,
                                     struct cfg80211_chan_def *chandef,
                                     gfp_t gfp,
                                     enum nl80211_commands notif,
                                     u8 count, bool quiet)
 {
+       struct wireless_dev *wdev = netdev->ieee80211_ptr;
        struct sk_buff *msg;
        void *hdr;
 
@@ -18953,6 +18955,10 @@ static void nl80211_ch_switch_notify(struct cfg80211_registered_device *rdev,
        if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex))
                goto nla_put_failure;
 
+       if (wdev->valid_links &&
+           nla_put_u8(msg, NL80211_ATTR_MLO_LINK_ID, link_id))
+               goto nla_put_failure;
+
        if (nl80211_send_chandef(msg, chandef))
                goto nla_put_failure;
 
@@ -19012,22 +19018,26 @@ void cfg80211_ch_switch_notify(struct net_device *dev,
 
        cfg80211_sched_dfs_chan_update(rdev);
 
-       nl80211_ch_switch_notify(rdev, dev, chandef, GFP_KERNEL,
+       nl80211_ch_switch_notify(rdev, dev, link_id, chandef, GFP_KERNEL,
                                 NL80211_CMD_CH_SWITCH_NOTIFY, 0, false);
 }
 EXPORT_SYMBOL(cfg80211_ch_switch_notify);
 
 void cfg80211_ch_switch_started_notify(struct net_device *dev,
                                       struct cfg80211_chan_def *chandef,
-                                      u8 count, bool quiet)
+                                      unsigned int link_id, u8 count,
+                                      bool quiet)
 {
        struct wireless_dev *wdev = dev->ieee80211_ptr;
        struct wiphy *wiphy = wdev->wiphy;
        struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy);
 
-       trace_cfg80211_ch_switch_started_notify(dev, chandef);
+       ASSERT_WDEV_LOCK(wdev);
+       WARN_INVALID_LINK_ID(wdev, link_id);
+
+       trace_cfg80211_ch_switch_started_notify(dev, chandef, link_id);
 
-       nl80211_ch_switch_notify(rdev, dev, chandef, GFP_KERNEL,
+       nl80211_ch_switch_notify(rdev, dev, link_id, chandef, GFP_KERNEL,
                                 NL80211_CMD_CH_SWITCH_STARTED_NOTIFY,
                                 count, quiet);
 }
index 001c00d9c5e7f84511b945de46d393d916b9d783..a405c3edbc47ec47f46d10f50c44959cc8ab759b 100644 (file)
@@ -3263,18 +3263,21 @@ TRACE_EVENT(cfg80211_ch_switch_notify,
 
 TRACE_EVENT(cfg80211_ch_switch_started_notify,
        TP_PROTO(struct net_device *netdev,
-                struct cfg80211_chan_def *chandef),
-       TP_ARGS(netdev, chandef),
+                struct cfg80211_chan_def *chandef,
+                unsigned int link_id),
+       TP_ARGS(netdev, chandef, link_id),
        TP_STRUCT__entry(
                NETDEV_ENTRY
                CHAN_DEF_ENTRY
+               __field(unsigned int, link_id)
        ),
        TP_fast_assign(
                NETDEV_ASSIGN;
                CHAN_DEF_ASSIGN(chandef);
+               __entry->link_id = link_id;
        ),
-       TP_printk(NETDEV_PR_FMT ", " CHAN_DEF_PR_FMT,
-                 NETDEV_PR_ARG, CHAN_DEF_PR_ARG)
+       TP_printk(NETDEV_PR_FMT ", " CHAN_DEF_PR_FMT ", link:%d",
+                 NETDEV_PR_ARG, CHAN_DEF_PR_ARG, __entry->link_id)
 );
 
 TRACE_EVENT(cfg80211_radar_event,