]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
cfg80211: add support to probe unexercised mesh link
authorRajkumar Manoharan <rmanohar@codeaurora.org>
Thu, 11 Apr 2019 20:47:24 +0000 (13:47 -0700)
committerJohannes Berg <johannes.berg@intel.com>
Fri, 26 Apr 2019 11:02:11 +0000 (13:02 +0200)
Adding support to allow mesh HWMP to measure link metrics on unexercised
direct mesh path by sending some data frames to other mesh points which
are not currently selected as a primary traffic path but only 1 hop away.
The absence of the primary path to the chosen node makes it necessary to
apply some form of marking on a chosen packet stream so that the packets
can be properly steered to the selected node for testing, and not by the
regular mesh path lookup.

Tested-by: Pradeep Kumar Chitrapu <pradeepc@codeaurora.org>
Signed-off-by: Rajkumar Manoharan <rmanohar@codeaurora.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
include/net/cfg80211.h
include/uapi/linux/nl80211.h
net/wireless/nl80211.c
net/wireless/rdev-ops.h
net/wireless/trace.h

index 944de18022106c70b7fb696c315ef1840998ffd7..298301525f9ff4e4ab7100f7af539239eadbb78a 100644 (file)
@@ -3501,6 +3501,9 @@ struct cfg80211_update_owe_info {
  * @update_owe_info: Provide updated OWE info to driver. Driver implementing SME
  *     but offloading OWE processing to the user space will get the updated
  *     DH IE through this interface.
+ *
+ * @probe_mesh_link: Probe direct Mesh peer's link quality by sending data frame
+ *     and overrule HWMP path selection algorithm.
  */
 struct cfg80211_ops {
        int     (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
@@ -3817,6 +3820,8 @@ struct cfg80211_ops {
                              struct cfg80211_pmsr_request *request);
        int     (*update_owe_info)(struct wiphy *wiphy, struct net_device *dev,
                                   struct cfg80211_update_owe_info *owe_info);
+       int     (*probe_mesh_link)(struct wiphy *wiphy, struct net_device *dev,
+                                  const u8 *buf, size_t len);
 };
 
 /*
index 25f70dd2b5836548d172a4b6228a6de600ba9553..6f09d1500960d98eb7cc35bfe9970e25aad728d9 100644 (file)
  *     OWE AKM by the host drivers that implement SME but rely
  *     on the user space for the cryptographic/DH IE processing in AP mode.
  *
+ * @NL80211_CMD_PROBE_MESH_LINK: The requirement for mesh link metric
+ *     refreshing, is that from one mesh point we be able to send some data
+ *     frames to other mesh points which are not currently selected as a
+ *     primary traffic path, but which are only 1 hop away. The absence of
+ *     the primary path to the chosen node makes it necessary to apply some
+ *     form of marking on a chosen packet stream so that the packets can be
+ *     properly steered to the selected node for testing, and not by the
+ *     regular mesh path lookup. Further, the packets must be of type data
+ *     so that the rate control (often embedded in firmware) is used for
+ *     rate selection.
+ *
+ *     Here attribute %NL80211_ATTR_MAC is used to specify connected mesh
+ *     peer MAC address and %NL80211_ATTR_FRAME is used to specify the frame
+ *     content. The frame is ethernet data.
+ *
  * @NL80211_CMD_MAX: highest used command number
  * @__NL80211_CMD_AFTER_LAST: internal use
  */
@@ -1292,6 +1307,8 @@ enum nl80211_commands {
 
        NL80211_CMD_UPDATE_OWE_INFO,
 
+       NL80211_CMD_PROBE_MESH_LINK,
+
        /* add new commands above here */
 
        /* used to define NL80211_CMD_MAX below */
index 5dfc4dba9e56502465b63eabdd2cadf594667677..3aecdd3d5b074613c9bf091f7d847aab743d753a 100644 (file)
@@ -13404,6 +13404,47 @@ static int nl80211_update_owe_info(struct sk_buff *skb, struct genl_info *info)
        return rdev_update_owe_info(rdev, dev, &owe_info);
 }
 
+static int nl80211_probe_mesh_link(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];
+       struct wireless_dev *wdev = dev->ieee80211_ptr;
+       struct station_info sinfo = {};
+       const u8 *buf;
+       size_t len;
+       u8 *dest;
+       int err;
+
+       if (!rdev->ops->probe_mesh_link || !rdev->ops->get_station)
+               return -EOPNOTSUPP;
+
+       if (!info->attrs[NL80211_ATTR_MAC] ||
+           !info->attrs[NL80211_ATTR_FRAME]) {
+               GENL_SET_ERR_MSG(info, "Frame or MAC missing");
+               return -EINVAL;
+       }
+
+       if (wdev->iftype != NL80211_IFTYPE_MESH_POINT)
+               return -EOPNOTSUPP;
+
+       dest = nla_data(info->attrs[NL80211_ATTR_MAC]);
+       buf = nla_data(info->attrs[NL80211_ATTR_FRAME]);
+       len = nla_len(info->attrs[NL80211_ATTR_FRAME]);
+
+       if (len < sizeof(struct ethhdr))
+               return -EINVAL;
+
+       if (!ether_addr_equal(buf, dest) || is_multicast_ether_addr(buf) ||
+           !ether_addr_equal(buf + ETH_ALEN, dev->dev_addr))
+               return -EINVAL;
+
+       err = rdev_get_station(rdev, dev, dest, &sinfo);
+       if (err)
+               return err;
+
+       return rdev_probe_mesh_link(rdev, dev, dest, buf, len);
+}
+
 #define NL80211_FLAG_NEED_WIPHY                0x01
 #define NL80211_FLAG_NEED_NETDEV       0x02
 #define NL80211_FLAG_NEED_RTNL         0x04
@@ -14241,6 +14282,13 @@ static const struct genl_ops nl80211_ops[] = {
                .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
                                  NL80211_FLAG_NEED_RTNL,
        },
+       {
+               .cmd = NL80211_CMD_PROBE_MESH_LINK,
+               .doit = nl80211_probe_mesh_link,
+               .flags = GENL_UNS_ADMIN_PERM,
+               .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
+                                 NL80211_FLAG_NEED_RTNL,
+       },
 };
 
 static struct genl_family nl80211_fam __ro_after_init = {
index 18437a9deb54033622b422842ed0b11868cf4bdf..e853a4fe6f97f2cd716cdd5253a4d47f364b9d8a 100644 (file)
@@ -1286,4 +1286,17 @@ static inline int rdev_update_owe_info(struct cfg80211_registered_device *rdev,
        return ret;
 }
 
+static inline int
+rdev_probe_mesh_link(struct cfg80211_registered_device *rdev,
+                    struct net_device *dev, const u8 *dest,
+                    const void *buf, size_t len)
+{
+       int ret;
+
+       trace_rdev_probe_mesh_link(&rdev->wiphy, dev, dest, buf, len);
+       ret = rdev->ops->probe_mesh_link(&rdev->wiphy, dev, buf, len);
+       trace_rdev_return_int(&rdev->wiphy, ret);
+       return ret;
+}
+
 #endif /* __CFG80211_RDEV_OPS */
index 488ef2ce823183a5b9489ed8a90df3b78c1f9bdb..2abfff925aac82d6705a2ec370026bf371529cef 100644 (file)
@@ -3421,6 +3421,24 @@ TRACE_EVENT(cfg80211_update_owe_info_event,
                      WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(peer))
 );
 
+TRACE_EVENT(rdev_probe_mesh_link,
+       TP_PROTO(struct wiphy *wiphy, struct net_device *netdev,
+                const u8 *dest, const u8 *buf, size_t len),
+       TP_ARGS(wiphy, netdev, dest, buf, len),
+       TP_STRUCT__entry(
+               WIPHY_ENTRY
+               NETDEV_ENTRY
+               MAC_ENTRY(dest)
+       ),
+       TP_fast_assign(
+               WIPHY_ASSIGN;
+               NETDEV_ASSIGN;
+               MAC_ASSIGN(dest, dest);
+       ),
+       TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", " MAC_PR_FMT,
+                 WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(dest))
+);
+
 #endif /* !__RDEV_OPS_TRACE || TRACE_HEADER_MULTI_READ */
 
 #undef TRACE_INCLUDE_PATH