wireless: Add support to probe unexercised mesh link
Subsystems (2)
cover wireless: Add support to probe unexercised mesh link
Consider below mesh topology.
MP1
/ \
/ \
MP2 --- MP3Assume that even though MP1 & MP3 have direct mesh links, the path was established via MP2. (MP1 <-> MP2 <-> MP3). The 1-hop mesh link MP1 <-> MP3 never be excercised till the current path is terminated. As of now, there is no option to send data frame to pick other than primary path. So mesh link metric between MP1 & MP3 never be updated. This series allows user to send data to 1-hop mesh peers through unexercised mesh path.
-Rajkumar
Rajkumar Manoharan (2):
cfg80211: add support to probe unexercised mesh link
mac80211: probe unexercised mesh links
include/net/cfg80211.h | 6 ++++ include/net/mac80211.h | 2 ++ include/uapi/linux/nl80211.h | 15 ++++++++++ net/mac80211/cfg.c | 1 + net/mac80211/ieee80211_i.h | 6 ++-- net/mac80211/mesh_hwmp.c | 4 +++ net/mac80211/tdls.c | 2 +- net/mac80211/tx.c | 66 +++++++++++++++++++++++++++++++++++++++----- net/wireless/nl80211.c | 45 ++++++++++++++++++++++++++++++ net/wireless/rdev-ops.h | 12 ++++++++ net/wireless/trace.h | 19 +++++++++++++ 11 files changed, 168 insertions(+), 10 deletions(-)
Signature · 1 line
1.9.1
PATCH 1/2 cfg80211: add support to probe unexercised mesh link
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.
--- include/net/cfg80211.h | 6 ++++++ include/uapi/linux/nl80211.h | 15 +++++++++++++++ net/wireless/nl80211.c | 45 ++++++++++++++++++++++++++++++++++++++++++++ net/wireless/rdev-ops.h | 13 +++++++++++++ net/wireless/trace.h | 19 +++++++++++++++++++ 5 files changed, 98 insertions(+)
include/net/cfg80211.h +6 -0
@@ -3379,6 +3379,9 @@ struct cfg80211_pmsr_request {* Statistics should be cumulative, currently no way to reset is provided. * @start_pmsr: start peer measurement (e.g. FTM) * @abort_pmsr: abort peer measurement +* +* @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);
@@ -3693,6 +3696,9 @@ struct cfg80211_ops { struct cfg80211_pmsr_request *request);void (*abort_pmsr)(struct wiphy *wiphy,struct wireless_dev *wdev,struct cfg80211_pmsr_request *request); + +int (*probe_mesh_link)(struct wiphy *wiphy,struct net_device *dev, +const u8 *dest,const u8 *buf,size_t len); };/*
include/uapi/linux/nl80211.h +15 -0
@@ -1065,6 +1065,20 @@* indicated by %NL80211_ATTR_WIPHY_FREQ and other attributes * determining the width and type. * +* @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. +* +* Uses %NL80211_ATTR_MAC and %NL80211_ATTR_FRAME attributes. The frame +* content here is ethernet data. +* * @NL80211_CMD_MAX: highest used command number * @__NL80211_CMD_AFTER_LAST: internal use */
@@ -1284,6 +1298,7 @@ enum nl80211_commands {NL80211_CMD_PEER_MEASUREMENT_COMPLETE ,NL80211_CMD_NOTIFY_RADAR , + NL80211_CMD_PROBE_MESH_LINK,/* add new commands above here */
net/wireless/nl80211.c +45 -0
57 lines not on this page · raw message
net/wireless/rdev-ops.h +13 -0
@@ -1272,4 +1272,17 @@ static inline int rdev_del_pmk(struct cfg80211_registered_device *rdev, trace_rdev_return_void(&rdev->wiphy); } +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, dest, buf, len); +trace_rdev_return_int (&rdev->wiphy, ret); +return ret; +} +#endif /* __CFG80211_RDEV_OPS */
net/wireless/trace.h +19 -0
@@ -3362,6 +3362,25 @@WIPHY_PR_ARG ,WDEV_PR_ARG , (unsigned long long)__entry->cookie) ); + +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
Signature · 1 line
1.9.1
Johannes Berg
maintainerRe: [PATCH 1/2] cfg80211: add support to probe unexercised mesh link
Quoted 14 lines
+ * @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.
+ *
+ * Uses %NL80211_ATTR_MAC and %NL80211_ATTR_FRAME attributes. The frame
+ * content here is ethernet data.
Please document the address requirements as well.
johannes
PATCH 2/2 mac80211: probe unexercised mesh links
In reply to Rajkumar ManoharanThe 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.
--- include/net/mac80211.h | 2 ++ net/mac80211/cfg.c | 1 + net/mac80211/ieee80211_i.h | 5 +++- net/mac80211/mesh_hwmp.c | 4 +++ net/mac80211/tdls.c | 2 +- net/mac80211/tx.c | 66 +++++++++++++++++++++++++++++++++++++++++----- 6 files changed, 71 insertions(+), 9 deletions(-)
include/net/mac80211.h +2 -0
@@ -786,6 +786,7 @@ enum mac80211_tx_info_flags {* @IEEE80211_TX_CTRL_RATE_INJECT: This frame is injected with rate information * @IEEE80211_TX_CTRL_AMSDU: This frame is an A-MSDU frame * @IEEE80211_TX_CTRL_FAST_XMIT: This frame is going through the fast_xmit path +* @IEEE80211_TX_CTRL_SKIP_MPATH_LOOKUP: This frame skips mesh path lookup * * These flags are used in tx_info->control.flags. */
@@ -795,6 +796,7 @@ enum mac80211_tx_control_flags {IEEE80211_TX_CTRL_RATE_INJECT =BIT (2 ),IEEE80211_TX_CTRL_AMSDU =BIT (3 ),IEEE80211_TX_CTRL_FAST_XMIT =BIT (4 ), + IEEE80211_TX_CTRL_SKIP_MPATH_LOOKUP = BIT(5), };/*
net/mac80211/cfg.c +1 -0
@@ -3974,4 +3974,5 @@ static int ieee80211_get_txq_stats(struct wiphy *wiphy, .get_ftm_responder_stats = ieee80211_get_ftm_responder_stats, .start_pmsr = ieee80211_start_pmsr, .abort_pmsr = ieee80211_abort_pmsr, + .probe_mesh_link = ieee80211_probe_mesh_link, };
net/mac80211/ieee80211_i.h +4 -1
@@ -1736,7 +1736,8 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, struct net_device *dev);void __ieee80211_subif_start_xmit (struct sk_buff *skb,struct net_device *dev, -u32 info_flags); +u32 info_flags, +u32 ctrl_flags);void ieee80211_purge_tx_queue (struct ieee80211_hw *hw,struct sk_buff_head *skbs); struct sk_buff *
@@ -1753,6 +1754,8 @@ void ieee80211_tx_monitor(struct ieee80211_local *local, struct sk_buff *skb,int ieee80211_tx_control_port (struct wiphy *wiphy,struct net_device *dev,const u8 *buf,size_t len,const u8 *dest,__be16 proto,bool unencrypted); +int ieee80211_probe_mesh_link (struct wiphy *wiphy,struct net_device *dev, +const u8 *dest,const u8 *buf,size_t len);/* HT */ void ieee80211_apply_htcap_overrides(struct ieee80211_sub_if_data *sdata,
net/mac80211/mesh_hwmp.c +4 -0
@@ -1118,6 +1118,10 @@ int mesh_nexthop_resolve(struct ieee80211_sub_if_data *sdata,if (ieee80211_is_qos_nullfunc (hdr->frame_control))return 0 ; +/* Allow injected packets to bypass mesh routing */ +if (info->control.flags &IEEE80211_TX_CTRL_SKIP_MPATH_LOOKUP ) +return 0 ; +rcu_read_lock (); err =mesh_nexthop_lookup (sdata, skb);if (!err)
net/mac80211/tdls.c +1 -1
@@ -1055,7 +1055,7 @@ static void ieee80211_tdls_add_ies(struct ieee80211_sub_if_data *sdata,/* disable bottom halves when entering the Tx path */ local_bh_disable (); -__ieee80211_subif_start_xmit (skb, dev, flags); +__ieee80211_subif_start_xmit (skb, dev, flags,0 );local_bh_enable ();return ret;
net/mac80211/tx.c +59 -7
115 lines not on this page · raw message
Signature · 1 line
1.9.1
Johannes Berg
maintainerRe: [PATCH 2/2] mac80211: probe unexercised mesh links
net/mac80211/ieee80211_i.h netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, · line 1740
Quoted 6 lines
void __ieee80211_subif_start_xmit(struct
sk_buff*skb,net/mac80211/ieee80211_i.h +2
-1struct net_device *dev, - u32 info_flags); + u32 info_flags, + u32 ctrl_flags);
I'd feel better if we could avoid all this, but if you really can't then I guess we should split this out to a separate patch.
net/mac80211/mesh_hwmp.c int mesh_nexthop_resolve(struct ieee80211_sub_if_data *sdata, · line 1122
Quoted 3 lines
net/mac80211/mesh_hwmp.c +2
-0+/* Allow injected packets to bypass mesh routing */ +if (info->control.flags &IEEE80211_TX_CTRL_SKIP_MPATH_LOOKUP )
unlikely?
Quoted 8 lines
net/mac80211/tx.c +8
-0+int ieee80211_probe_mesh_link (struct wiphy *wiphy,struct net_device *dev, +const u8 *dest,const u8 *buf,size_t len) +{ +struct ieee80211_sub_if_data *sdata =IEEE80211_DEV_TO_SUB_IF (dev); +struct ieee80211_local *local = sdata->local; +struct sta_info *sta; +struct sk_buff *skb; +struct ethhdr *ehdr;
net/mac80211/tx.c int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev, · line 4937
Quoted 10 lines
net/mac80211/tx.c +10
-0+ +if (len <sizeof (*ehdr)) +return -EINVAL ; + +mutex_lock (&local->sta_mtx); + sta =sta_info_get_bss (sdata, dest); +mutex_unlock (&local->sta_mtx); + +if (!sta) +return -ENOENT ;
better add a comment here that the locking is fine because you only check *existence* and don't use the sta pointer for anything else
net/mac80211/tx.c int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev, · line 4940
Quoted 2 lines
net/mac80211/tx.c +2
-0+ ehdr = (struct ethhdr *)buf; + if (!ether_addr_equal(ehdr->h_dest, dest) ||
that check could be in cfg80211, but then why even bother passing the "dest" separately?
net/mac80211/tx.c int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev, · line 4941
Quoted 1 line
net/mac80211/tx.c +1
-0+ !ether_addr_equal(ehdr->h_source, sdata->vif.addr) ||
probably this one too
net/mac80211/tx.c int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev, · line 4942
Quoted 1 line
net/mac80211/tx.c +1
-0+ is_multicast_ether_addr(ehdr->h_dest))
this one too
But also, ehdr isn't packed I think, you might have alignment issues here as you don't know how the netlink message looks like? I think?
net/mac80211/tx.c int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev, · line 4946
Quoted 2 lines
net/mac80211/tx.c +2
-0+if (ehdr->h_proto !=htons (ETH_P_802_3 )) +return -EINVAL ;
same here
net/mac80211/tx.c int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev, · line 4948
Quoted 1 line
net/mac80211/tx.c +1
-0+ skb =dev_alloc_skb (local->hw.extra_tx_headroom + len);
you should make it a bit bigger so header conversion will fit, I guess?
johannes
Re: [PATCH 2/2] mac80211: probe unexercised mesh links
Quoted 9 lines · Johannes Berg
net/mac80211/ieee80211_i.h netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, · line 1740
Quoted 5 lines
void __ieee80211_subif_start_xmit(struct
sk_buff*skb,net/mac80211/ieee80211_i.h +2
-1struct net_device *dev, - u32 info_flags); + u32 info_flags, + u32 ctrl_flags);I'd feel better if we could avoid all this, but if you really can't then I guess we should split this out to a separate patch.
Hmm.. I don't see any options other than this. no free slot in info_flags. Will split this change.
Quoted 35 lines
net/mac80211/mesh_hwmp.c int mesh_nexthop_resolve(struct ieee80211_sub_if_data *sdata, · line 1122
Quoted 3 lines
net/mac80211/mesh_hwmp.c +2
-0+/* Allow injected packets to bypass mesh routing */ +if (info->control.flags &IEEE80211_TX_CTRL_SKIP_MPATH_LOOKUP )unlikely?
Quoted 9 lines
+int ieee80211_probe_mesh_link(struct wiphy *wiphy, struct
net_device*dev,net/mac80211/tx.c +7
-0+ const u8 *dest, const u8 *buf, size_t len) +{ + struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); +struct ieee80211_local *local = sdata->local; +struct sta_info *sta; +struct sk_buff *skb; +struct ethhdr *ehdr;net/mac80211/tx.c int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev, · line 4937
Quoted 10 lines
net/mac80211/tx.c +10
-0+ +if (len <sizeof (*ehdr)) +return -EINVAL ; + +mutex_lock (&local->sta_mtx); + sta =sta_info_get_bss (sdata, dest); +mutex_unlock (&local->sta_mtx); + +if (!sta) +return -ENOENT ;better add a comment here that the locking is fine because you only check *existence* and don't use the sta pointer for anything else
net/mac80211/tx.c int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev, · line 4940
Quoted 2 lines
net/mac80211/tx.c +2
-0+ ehdr = (struct ethhdr *)buf; + if (!ether_addr_equal(ehdr->h_dest, dest) ||that check could be in cfg80211, but then why even bother passing the "dest" separately?
Quoted 8 lines
net/mac80211/tx.c int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev, · line 4941
Quoted 1 line
net/mac80211/tx.c +1
-0+ !ether_addr_equal(ehdr->h_source, sdata->vif.addr) ||probably this one too
net/mac80211/tx.c int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev, · line 4942
Quoted 1 line
net/mac80211/tx.c +1
-0+ is_multicast_ether_addr(ehdr->h_dest))this one too
Will move all the condition checks to cfg80211.
Quoted 12 lines
But also, ehdr isn't packed I think, you might have alignment issues here as you don't know how the netlink message looks like? I think?
net/mac80211/tx.c int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev, · line 4946
Quoted 2 lines
net/mac80211/tx.c +2
-0+if (ehdr->h_proto !=htons (ETH_P_802_3 )) +return -EINVAL ;same here
net/mac80211/tx.c int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev, · line 4948
Quoted 1 line
net/mac80211/tx.c +1
-0+ skb =dev_alloc_skb (local->hw.extra_tx_headroom + len);you should make it a bit bigger so header conversion will fit, I guess?
Hmm. I thought ieee80211_skb_resize in build_hdr will take care of it.
-Rajkumar