Skip to content

Commit 8828f81

Browse files
Rajkumar Manoharanjmberg-intel
authored andcommitted
mac80211: probe unexercised mesh links
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. 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>
1 parent 0601677 commit 8828f81

File tree

5 files changed

+45
-0
lines changed

5 files changed

+45
-0
lines changed

include/net/mac80211.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -807,6 +807,7 @@ enum mac80211_tx_info_flags {
807807
* @IEEE80211_TX_CTRL_RATE_INJECT: This frame is injected with rate information
808808
* @IEEE80211_TX_CTRL_AMSDU: This frame is an A-MSDU frame
809809
* @IEEE80211_TX_CTRL_FAST_XMIT: This frame is going through the fast_xmit path
810+
* @IEEE80211_TX_CTRL_SKIP_MPATH_LOOKUP: This frame skips mesh path lookup
810811
*
811812
* These flags are used in tx_info->control.flags.
812813
*/
@@ -816,6 +817,7 @@ enum mac80211_tx_control_flags {
816817
IEEE80211_TX_CTRL_RATE_INJECT = BIT(2),
817818
IEEE80211_TX_CTRL_AMSDU = BIT(3),
818819
IEEE80211_TX_CTRL_FAST_XMIT = BIT(4),
820+
IEEE80211_TX_CTRL_SKIP_MPATH_LOOKUP = BIT(5),
819821
};
820822

821823
/*

net/mac80211/cfg.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4035,4 +4035,5 @@ const struct cfg80211_ops mac80211_config_ops = {
40354035
.get_ftm_responder_stats = ieee80211_get_ftm_responder_stats,
40364036
.start_pmsr = ieee80211_start_pmsr,
40374037
.abort_pmsr = ieee80211_abort_pmsr,
4038+
.probe_mesh_link = ieee80211_probe_mesh_link,
40384039
};

net/mac80211/ieee80211_i.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1779,6 +1779,8 @@ void ieee80211_clear_fast_xmit(struct sta_info *sta);
17791779
int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev,
17801780
const u8 *buf, size_t len,
17811781
const u8 *dest, __be16 proto, bool unencrypted);
1782+
int ieee80211_probe_mesh_link(struct wiphy *wiphy, struct net_device *dev,
1783+
const u8 *buf, size_t len);
17821784

17831785
/* HT */
17841786
void ieee80211_apply_htcap_overrides(struct ieee80211_sub_if_data *sdata,

net/mac80211/mesh_hwmp.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,6 +1135,10 @@ int mesh_nexthop_resolve(struct ieee80211_sub_if_data *sdata,
11351135
if (ieee80211_is_qos_nullfunc(hdr->frame_control))
11361136
return 0;
11371137

1138+
/* Allow injected packets to bypass mesh routing */
1139+
if (info->control.flags & IEEE80211_TX_CTRL_SKIP_MPATH_LOOKUP)
1140+
return 0;
1141+
11381142
if (!mesh_nexthop_lookup(sdata, skb))
11391143
return 0;
11401144

net/mac80211/tx.c

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2607,6 +2607,13 @@ static struct sk_buff *ieee80211_build_hdr(struct ieee80211_sub_if_data *sdata,
26072607
goto free;
26082608
}
26092609
band = chanctx_conf->def.chan->band;
2610+
2611+
/* For injected frames, fill RA right away as nexthop lookup
2612+
* will be skipped.
2613+
*/
2614+
if ((ctrl_flags & IEEE80211_TX_CTRL_SKIP_MPATH_LOOKUP) &&
2615+
is_zero_ether_addr(hdr.addr1))
2616+
memcpy(hdr.addr1, skb->data, ETH_ALEN);
26102617
break;
26112618
#endif
26122619
case NL80211_IFTYPE_STATION:
@@ -5091,3 +5098,32 @@ int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev,
50915098

50925099
return 0;
50935100
}
5101+
5102+
int ieee80211_probe_mesh_link(struct wiphy *wiphy, struct net_device *dev,
5103+
const u8 *buf, size_t len)
5104+
{
5105+
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
5106+
struct ieee80211_local *local = sdata->local;
5107+
struct sk_buff *skb;
5108+
5109+
skb = dev_alloc_skb(local->hw.extra_tx_headroom + len +
5110+
30 + /* header size */
5111+
18); /* 11s header size */
5112+
if (!skb)
5113+
return -ENOMEM;
5114+
5115+
skb_reserve(skb, local->hw.extra_tx_headroom);
5116+
skb_put_data(skb, buf, len);
5117+
5118+
skb->dev = dev;
5119+
skb->protocol = htons(ETH_P_802_3);
5120+
skb_reset_network_header(skb);
5121+
skb_reset_mac_header(skb);
5122+
5123+
local_bh_disable();
5124+
__ieee80211_subif_start_xmit(skb, skb->dev, 0,
5125+
IEEE80211_TX_CTRL_SKIP_MPATH_LOOKUP);
5126+
local_bh_enable();
5127+
5128+
return 0;
5129+
}

0 commit comments

Comments
 (0)