Skip to contentSkip to conversation

o11s: other changes in mac80211 for mesh interface support

PATCH In review Luis Carlos Cobo 3 participants 8 messages Feb 22, 2008 – Feb 29, 2008 mac80211

lore
Share & tools
lore
#0 lore raw

PATCH v2 8/13 o11s: other changes in mac80211 for mesh interface support

Includes integration in struct sta_info of mesh peer link elements, previously on their own mesh peer link table.

---
 net/mac80211/ieee80211_i.h      |  173 ++++++++++++++++++++++++++++++++++++++-
 net/mac80211/ieee80211_iface.c  |   63 ++++++++++++++-
 net/mac80211/ieee80211_ioctl.c  |    1 +
 net/mac80211/rc80211_pid_algo.c |   14 +++
 net/mac80211/sta_info.c         |   42 +++++++++-
 net/mac80211/sta_info.h         |   30 +++++++
 net/mac80211/util.c             |   52 ++++++++++++
 7 files changed, 369 insertions(+), 6 deletions(-)
net/mac80211/ieee80211_i.h +171 -2
index 1b4a449..2192259 100644
@@ -90,6 +90,12 @@ struct ieee80211_sta_bss {
 	size_t wmm_ie_len;
 	u8 *ht_ie;
 	size_t ht_ie_len;
+#ifdef CONFIG_MAC80211_MESH
+	u8 *mesh_id;
+	size_t mesh_id_len;
+#endif
+	/* mesh_cfg left out the ifdef to reduce clutter on bss handling */
+	u8 *mesh_cfg;
 #define IEEE80211_MAX_SUPP_RATES 32
 	u8 supp_rates[IEEE80211_MAX_SUPP_RATES];
 	size_t supp_rates_len;
@@ -227,6 +233,43 @@ struct ieee80211_if_vlan {
 	struct list_head list;
 };
 
+#ifdef CONFIG_MAC80211_MESH
+struct mesh_stats {
+	__u32 fwded_frames;		/* Mesh forwarded frames */
+	__u32 dropped_frames_ttl;	/* Not transmitted since mesh_ttl == 0*/
+	__u32 dropped_frames_no_route;	/* Not transmitted, no route found */
+	atomic_t estab_plinks;
+};
+
+#define PREQ_Q_F_START		0x1
+#define PREQ_Q_F_REFRESH	0x2
+struct mesh_preq_queue {
+	struct list_head list;
+	u8 dst[ETH_ALEN];
+	u8 flags;
+};
+
+
+struct mesh_config {
+	/* Timeouts in ms */
+	/* Mesh plink management parameters */
+	u16 dot11MeshRetryTimeout;
+	u16 dot11MeshConfirmTimeout;
+	u16 dot11MeshHoldingTimeout;
+	u16 dot11MeshMaxPeerLinks;
+	u8  dot11MeshMaxRetries;
+	u8  dot11MeshTTL;
+	bool auto_open_plinks;
+	/* HWMP parameters */
+	u32 dot11MeshHWMPactivePathTimeout;
+	u16 dot11MeshHWMPpreqMinInterval;
+	u16 dot11MeshHWMPnetDiameterTraversalTime;
+	u8  dot11MeshHWMPmaxPREQretries;
+	u32 path_refresh_time;
+	u16 min_discovery_timeout;
+};
+#endif
+
 /* flags used in struct ieee80211_if_sta.flags */
 #define IEEE80211_STA_SSID_SET		BIT(0)
 #define IEEE80211_STA_BSSID_SET		BIT(1)
@@ -245,7 +288,8 @@ struct ieee80211_if_sta {
 	enum {
 		IEEE80211_DISABLED, IEEE80211_AUTHENTICATE,
 		IEEE80211_ASSOCIATE, IEEE80211_ASSOCIATED,
-		IEEE80211_IBSS_SEARCH, IEEE80211_IBSS_JOINED
+		IEEE80211_IBSS_SEARCH, IEEE80211_IBSS_JOINED,
+		IEEE80211_MESH_UP
 	} state;
 	struct timer_list timer;
 	struct work_struct work;
@@ -254,6 +298,34 @@ struct ieee80211_if_sta {
 	size_t ssid_len;
 	u8 scan_ssid[IEEE80211_MAX_SSID_LEN];
 	size_t scan_ssid_len;
+#ifdef CONFIG_MAC80211_MESH
+	struct timer_list mesh_path_timer;
+	u8 mesh_id[IEEE80211_MAX_MESH_ID_LEN];
+	bool accepting_plinks;
+	size_t mesh_id_len;
+	/* Active Path Selection Protocol Identifier */
+	u8 mesh_pp_id[4];
+	/* Active Path Selection Metric Identifier */
+	u8 mesh_pm_id[4];
+	/* Congestion Control Mode Identifier */
+	u8 mesh_cc_id[4];
+	/* Local mesh Destination Sequence Number */
+	u32 dsn;
+	/* Last used PREQ ID */
+	u32 preq_id;
+	atomic_t mpaths;
+	/* Timestamp of last DSN update */
+	unsigned long last_dsn_update;
+	/* Timestamp of last DSN sent */
+	unsigned long last_preq;
+	struct mesh_rmc *rmc;
+	spinlock_t mesh_preq_queue_lock;
+	struct mesh_preq_queue preq_queue;
+	int preq_queue_len;
+	struct mesh_stats mshstats;
+	struct mesh_config mshcfg;
+	u8 mesh_seqnum[3];
+#endif
 	u16 aid;
 	u16 ap_capab, capab;
 	u8 *extra_ie; /* to be added to the end of AssocReq */
@@ -286,6 +358,7 @@ struct ieee80211_if_sta {
 	u32 supp_rates_bits[IEEE80211_NUM_BANDS];
 
 	int wmm_last_param_set;
+	int num_beacons; /* number of TXed beacon frames by this STA */
 };
 
 
@@ -365,6 +438,7 @@ struct ieee80211_sub_if_data {
 			struct dentry *auth_alg;
 			struct dentry *auth_transaction;
 			struct dentry *flags;
+			struct dentry *num_beacons_sta;
 		} sta;
 		struct {
 			struct dentry *channel_use;
@@ -390,6 +464,35 @@ struct ieee80211_sub_if_data {
 		} monitor;
 		struct dentry *default_key;
 	} debugfs;
+
+#ifdef CONFIG_MAC80211_MESH
+	struct dentry *mesh_stats_dir;
+	struct {
+		struct dentry *fwded_frames;
+		struct dentry *dropped_frames_ttl;
+		struct dentry *dropped_frames_no_route;
+		struct dentry *estab_plinks;
+	struct timer_list mesh_path_timer;
+	} mesh_stats;
+
+	struct dentry *mesh_config_dir;
+	struct {
+		struct dentry *dot11MeshRetryTimeout;
+		struct dentry *dot11MeshConfirmTimeout;
+		struct dentry *dot11MeshHoldingTimeout;
+		struct dentry *dot11MeshMaxRetries;
+		struct dentry *dot11MeshTTL;
+		struct dentry *auto_open_plinks;
+		struct dentry *dot11MeshMaxPeerLinks;
+		struct dentry *dot11MeshHWMPactivePathTimeout;
+		struct dentry *dot11MeshHWMPpreqMinInterval;
+		struct dentry *dot11MeshHWMPnetDiameterTraversalTime;
+		struct dentry *dot11MeshHWMPmaxPREQretries;
+		struct dentry *path_refresh_time;
+		struct dentry *min_discovery_timeout;
+	} mesh_config;
+#endif
+
 #endif
 	/* must be last, dynamically sized area in this! */
 	struct ieee80211_vif vif;
@@ -617,6 +720,57 @@ struct ieee80211_ra_tid {
 	u16 tid;
 };
 
+/* Parsed Information Elements */
+struct ieee802_11_elems {
+	/* pointers to IEs */
+	u8 *ssid;
+	u8 *supp_rates;
+	u8 *fh_params;
+	u8 *ds_params;
+	u8 *cf_params;
+	u8 *tim;
+	u8 *ibss_params;
+	u8 *challenge;
+	u8 *wpa;
+	u8 *rsn;
+	u8 *erp_info;
+	u8 *ext_supp_rates;
+	u8 *wmm_info;
+	u8 *wmm_param;
+	u8 *ht_cap_elem;
+	u8 *ht_info_elem;
+	u8 *mesh_config;
+	u8 *mesh_id;
+	u8 *peer_link;
+	u8 *preq;
+	u8 *prep;
+	u8 *perr;
+
+	/* length of them, respectively */
+	u8 ssid_len;
+	u8 supp_rates_len;
+	u8 fh_params_len;
+	u8 ds_params_len;
+	u8 cf_params_len;
+	u8 tim_len;
+	u8 ibss_params_len;
+	u8 challenge_len;
+	u8 wpa_len;
+	u8 rsn_len;
+	u8 erp_info_len;
+	u8 ext_supp_rates_len;
+	u8 wmm_info_len;
+	u8 wmm_param_len;
+	u8 ht_cap_elem_len;
+	u8 ht_info_elem_len;
+	u8 mesh_config_len;
+	u8 mesh_id_len;
+	u8 peer_link_len;
+	u8 preq_len;
+	u8 prep_len;
+	u8 perr_len;
+};
+
 static inline struct ieee80211_local *hw_to_local(
 	struct ieee80211_hw *hw)
 {
@@ -720,6 +874,7 @@ int ieee80211_set_compression(struct ieee80211_local *local,
 			      struct net_device *dev, struct sta_info *sta);
 int ieee80211_set_freq(struct ieee80211_local *local, int freq);
 /* ieee80211_sta.c */
+#define IEEE80211_FC(type, stype) cpu_to_le16(type | stype)
 void ieee80211_sta_timer(unsigned long data);
 void ieee80211_sta_work(struct work_struct *work);
 void ieee80211_sta_scan_work(struct work_struct *work);
@@ -760,9 +915,23 @@ void ieee80211_sta_stop_rx_ba_session(struct net_device *dev, u8 *da,
 				u16 tid, u16 initiator, u16 reason);
 void sta_rx_agg_session_timer_expired(unsigned long data);
 void sta_addba_resp_timer_expired(unsigned long data);
+u64 ieee80211_sta_get_rates(struct ieee80211_local *local,
+			    struct ieee802_11_elems *elems,
+			    enum ieee80211_band band);
+void ieee80211_start_mesh(struct net_device *dev);
+void ieee80211_sta_tx(struct net_device *dev, struct sk_buff *skb,
+		int encrypt);
+void ieee802_11_parse_elems(u8 *start, size_t len,
+				   struct ieee802_11_elems *elems);
+#ifdef CONFIG_MAC80211_MESH
+void ieee80211_mesh_path_timer(unsigned long data);
+#endif
+
+
 /* ieee80211_iface.c */
 int ieee80211_if_add(struct net_device *dev, const char *name,
-		     struct net_device **new_dev, int type);
+		     struct net_device **new_dev, int type,
+		     struct vif_params *params);
 void ieee80211_if_set_type(struct net_device *dev, int type);
 void ieee80211_if_reinit(struct net_device *dev);
 void __ieee80211_if_del(struct ieee80211_local *local,
net/mac80211/ieee80211_iface.c +62 -1

99 lines not on this page · raw message

net/mac80211/ieee80211_ioctl.c +1 -0
index 54ad07a..1f5d236 100644
@@ -519,6 +519,7 @@ static int ieee80211_ioctl_siwscan(struct net_device *dev,
 
 	if (sdata->vif.type != IEEE80211_IF_TYPE_STA &&
 	    sdata->vif.type != IEEE80211_IF_TYPE_IBSS &&
+	    sdata->vif.type != IEEE80211_IF_TYPE_MESH_POINT &&
 	    sdata->vif.type != IEEE80211_IF_TYPE_AP)
 		return -EOPNOTSUPP;
 
net/mac80211/rc80211_pid_algo.c +14 -0
index da8462b..5322486 100644
@@ -15,6 +15,9 @@
 #include <linux/debugfs.h>
 #include <net/mac80211.h>
 #include "ieee80211_rate.h"
+#ifdef CONFIG_MAC80211_MESH
+#include "mesh.h"
+#endif
 
 #include "rc80211_pid.h"
 
@@ -148,6 +151,9 @@ static void rate_control_pid_sample(struct rc_pid_info *pinfo,
 				    struct ieee80211_local *local,
 				    struct sta_info *sta)
 {
+#ifdef CONFIG_MAC80211_MESH
+	struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(sta->dev);
+#endif
 	struct rc_pid_sta_info *spinfo = sta->rate_ctrl_priv;
 	struct rc_pid_rateinfo *rinfo = pinfo->rinfo;
 	struct ieee80211_supported_band *sband;
@@ -178,7 +184,14 @@ static void rate_control_pid_sample(struct rc_pid_info *pinfo,
 		pf = spinfo->last_pf;
 	else {
 		pf = spinfo->tx_num_failed * 100 / spinfo->tx_num_xmit;
+#ifdef CONFIG_MAC80211_MESH
+		if (pf == 100 &&
+		    sdata->vif.type == IEEE80211_IF_TYPE_MESH_POINT)
+			mesh_plink_broken(sta);
+#endif
 		pf <<= RC_PID_ARITH_SHIFT;
+		sta->fail_avg = ((pf + (spinfo->last_pf << 3)) / 9)
+					>> RC_PID_ARITH_SHIFT;
 	}
 
 	spinfo->tx_num_xmit = 0;
@@ -360,6 +373,7 @@ static void rate_control_pid_rate_init(void *priv, void *priv_sta,
 
 	sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
 	sta->txrate_idx = rate_lowest_index(local, sband, sta);
+	sta->fail_avg = 0;
 }
 
 static void *rate_control_pid_alloc(struct ieee80211_local *local)
net/mac80211/sta_info.c +39 -3

78 lines not on this page · raw message

net/mac80211/sta_info.h +30 -0
index 19f3fb4..2e9ddf9 100644
@@ -103,6 +103,18 @@ struct tid_ampdu_rx {
 	struct timer_list session_timer;
 };
 
+#ifdef CONFIG_MAC80211_MESH
+enum plink_state {
+	LISTEN,
+	OPN_SNT,
+	OPN_RCVD,
+	CNF_RCVD,
+	ESTAB,
+	HOLDING,
+	BLOCKED
+};
+#endif
+
 /**
  * struct sta_ampdu_mlme - STA aggregation information.
  *
@@ -143,6 +155,8 @@ struct sta_info {
 	unsigned long rx_bytes, tx_bytes;
 	unsigned long tx_retry_failed, tx_retry_count;
 	unsigned long tx_filtered_count;
+	/* moving percentage of failed MSDUs */
+	unsigned int fail_avg;
 
 	unsigned int wep_weak_iv_count; /* number of RX frames with weak IV */
 
@@ -193,6 +207,20 @@ struct sta_info {
 	struct sta_ampdu_mlme ampdu_mlme;
 	u8 timer_to_tid[STA_TID_NUM];	/* convert timer id to tid */
 	u8 tid_to_tx_q[STA_TID_NUM];	/* map tid to tx queue */
+#ifdef CONFIG_MAC80211_MESH
+	/* mesh peer link attributes */
+	__le16 llid;		/* Local link ID */
+	__le16 plid;		/* Peer link ID */
+	__le16 reason;		/* Buffer for cancel reason on HOLDING state */
+	enum plink_state plink_state;
+	u32 plink_timeout;
+	struct timer_list plink_timer;
+	u8 plink_retries;	/* Retries in establishment */
+	bool ignore_plink_timer;
+	spinlock_t plink_lock;	/* For peer_state reads / updates and other
+				   updates in the structure. Ensures robust
+				   transitions for the peerlink FSM */
+#endif
 
 #ifdef CONFIG_MAC80211_DEBUGFS
 	struct sta_info_debugfsdentries {
@@ -237,6 +265,8 @@ static inline void __sta_info_get(struct sta_info *sta)
 }
 
 struct sta_info * sta_info_get(struct ieee80211_local *local, u8 *addr);
+struct sta_info *sta_info_get_by_idx(struct ieee80211_local *local, int idx,
+				      struct net_device *dev);
 void sta_info_put(struct sta_info *sta);
 struct sta_info * sta_info_add(struct ieee80211_local *local,
 			       struct net_device *dev, u8 *addr, gfp_t gfp);
net/mac80211/util.c +52 -0

73 lines not on this page · raw message

Signature · 1 line
1.5.2.5
maintainer
#1 lore raw
Quoted 4 lines

int ieee80211_set_freq(struct ieee80211_local *local, int freq); /* ieee80211_sta.c */
+#define IEEE80211_FC(type, stype) cpu_to_le16(type | stype)

That seems... misplaced.

net/mac80211/ieee80211_ioctl.c static int ieee80211_ioctl_siwscan(struct net_device *dev, · line 524

Quoted 5 lines
net/mac80211/ieee80211_ioctl.c +1 -0
 	if (sdata->vif.type != IEEE80211_IF_TYPE_STA &&
 	    sdata->vif.type != IEEE80211_IF_TYPE_IBSS &&
+	    sdata->vif.type != IEEE80211_IF_TYPE_MESH_POINT &&
 	    sdata->vif.type != IEEE80211_IF_TYPE_AP)
 		return -EOPNOTSUPP;

Why no scanning on mesh interfaces?

net/mac80211/sta_info.c struct sta_info *sta_info_get(struct ieee80211_local *local, u8 *addr) · line 90

Quoted 11 lines
net/mac80211/sta_info.c +11 -0
+struct sta_info *sta_info_get_by_idx(struct ieee80211_local *local, int idx,
+				     struct net_device *dev)
+{
+	struct sta_info *sta;
+	int i = 0;
+
+	read_lock_bh(&local->sta_lock);
+	list_for_each_entry(sta, &local->sta_list, list) {
+		if (i < idx) {
+			++i;
+			continue;

I already commented on the raciness of this.

johannes

#2 lore raw
Quoted 7 lines · Johannes Berg

net/mac80211/ieee80211_ioctl.c static int ieee80211_ioctl_siwscan(struct net_device *dev, · line 524

Quoted 5 lines
net/mac80211/ieee80211_ioctl.c +1 -0
 	if (sdata->vif.type != IEEE80211_IF_TYPE_STA &&
 	    sdata->vif.type != IEEE80211_IF_TYPE_IBSS &&
+	    sdata->vif.type != IEEE80211_IF_TYPE_MESH_POINT &&
 	    sdata->vif.type != IEEE80211_IF_TYPE_AP)
 		return -EOPNOTSUPP;

Why no scanning on mesh interfaces?

? That's actually allowing mesh interfaces to scan.

Signature · 2 lines
Luis Carlos Cobo Rus       GnuPG ID: 44019B60
cozybit Inc.
maintainer
#3 lore raw
Quoted 10 lines · Luis Carlos Cobo
Quoted 7 lines · Johannes Berg

net/mac80211/ieee80211_ioctl.c static int ieee80211_ioctl_siwscan(struct net_device *dev, · line 524

Quoted 5 lines
net/mac80211/ieee80211_ioctl.c +1 -0
 	if (sdata->vif.type != IEEE80211_IF_TYPE_STA &&
 	    sdata->vif.type != IEEE80211_IF_TYPE_IBSS &&
+	    sdata->vif.type != IEEE80211_IF_TYPE_MESH_POINT &&
 	    sdata->vif.type != IEEE80211_IF_TYPE_AP)
 		return -EOPNOTSUPP;

Why no scanning on mesh interfaces?

? That's actually allowing mesh interfaces to scan.

D'oh. Yeah I'm confused here, sorry, was probably reading too quickly.

johannes

#4 lore raw
In reply to Luis Carlos Cobo
Quoted 25 lines · On Thu, 21 Feb 2008 20:17:08 -0800 Luis Carlos Cobo <[email protected]> wrote:
net/mac80211/rc80211_pid_algo.c +6 -0
index da8462b..5322486 100644
@@ -15,6 +15,9 @@
 #include <linux/debugfs.h>
 #include <net/mac80211.h>
 #include "ieee80211_rate.h"
+#ifdef CONFIG_MAC80211_MESH
+#include "mesh.h"
+#endif
 
 #include "rc80211_pid.h"
 
@@ -148,6 +151,9 @@ static void rate_control_pid_sample(struct rc_pid_info *pinfo,
 				    struct ieee80211_local *local,
 				    struct sta_info *sta)
 {
+#ifdef CONFIG_MAC80211_MESH
+	struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(sta->dev);
+#endif
 	struct rc_pid_sta_info *spinfo = sta->rate_ctrl_priv;
 	struct rc_pid_rateinfo *rinfo = pinfo->rinfo;
 	struct ieee80211_supported_band *sband;

net/mac80211/rc80211_pid_algo.c static void rate_control_pid_sample(struct rc_pid_info *pinfo, · line 191

Quoted 8 lines
net/mac80211/rc80211_pid_algo.c +5 -0
@@ -178,7 +184,14 @@ static void rate_control_pid_sample(struct rc_pid_info *pinfo,
 		pf = spinfo->last_pf;
 	else {
 		pf = spinfo->tx_num_failed * 100 / spinfo->tx_num_xmit;
+#ifdef CONFIG_MAC80211_MESH
+		if (pf == 100 &&
+		    sdata->vif.type == IEEE80211_IF_TYPE_MESH_POINT)
+			mesh_plink_broken(sta);
+#endif

I'd like to have this moved, maybe right before this:

        /* Compute the controller output. */

net/mac80211/rc80211_pid_algo.c static void rate_control_pid_sample(struct rc_pid_info *pinfo, · line 195

Quoted 4 lines
net/mac80211/rc80211_pid_algo.c +2 -0
 		pf <<= RC_PID_ARITH_SHIFT;
+		sta->fail_avg = ((pf + (spinfo->last_pf << 3)) / 9)
+					>> RC_PID_ARITH_SHIFT;
 	}

What do you need fail_avg for? Please note that we have better estimates of the frame failure trends (e.g., err_avg). What these magic values are?

--
Ciao
Stefano

#5 lore raw
Quoted 3 lines · Stefano Brivio

I'd like to have this moved, maybe right before this:

        /* Compute the controller output. */

Ok.

Quoted 8 lines

net/mac80211/rc80211_pid_algo.c static void rate_control_pid_sample(struct rc_pid_info *pinfo, · line 195

Quoted 5 lines
net/mac80211/rc80211_pid_algo.c +2 -0
 		pf <<= RC_PID_ARITH_SHIFT;
+		sta->fail_avg = ((pf + (spinfo->last_pf << 3)) / 9)
+					>> RC_PID_ARITH_SHIFT;
 	}

What do you need fail_avg for? Please note that we have better estimates of the frame failure trends (e.g., err_avg). What these magic values are?

It's supposed to be an estimation of the probability of a frame transmission failure. The magic numbers just express the formula

fail_avg = (8 * old_fail_avg + 1 * fail_avg) / 9

a simple smoothing, there is nothing special to the exact numbers.

If you think err_avg is a good candidate (is it also 0-100?) I'd be happy to use that instead.

Signature · 2 lines
Luis Carlos Cobo Rus       GnuPG ID: 44019B60
cozybit Inc.
#6 lore raw
Quoted 11 lines · On Mon, 25 Feb 2008 13:15:13 -0800 Luis Carlos Cobo <[email protected]> wrote:
Quoted 7 lines

net/mac80211/rc80211_pid_algo.c static void rate_control_pid_sample(struct rc_pid_info *pinfo, · line 195

Quoted 4 lines
net/mac80211/rc80211_pid_algo.c +2 -0
 		pf <<= RC_PID_ARITH_SHIFT;
+		sta->fail_avg = ((pf + (spinfo->last_pf << 3)) / 9)
+					>> RC_PID_ARITH_SHIFT;
 	}

What do you need fail_avg for? Please note that we have better estimates of the frame failure trends (e.g., err_avg). What these magic values are?

It's supposed to be an estimation of the probability of a frame transmission failure. The magic numbers just express the formula

Quoted 6 lines

fail_avg = (8 * old_fail_avg + 1 * fail_avg) / 9

a simple smoothing, there is nothing special to the exact numbers.

If you think err_avg is a good candidate (is it also 0-100?) I'd be happy to use that instead.

In short: no, it's not 0-100. And probably it's not what you expect it to be. But you may consider to use it.

Boring explanation: in the algorithm, we define the error(T), which is a function of time T (jiffies in the code), as the difference between the failed frames rate f (pf) and a given value we use to call "target", t (target_pf), at some time T.

Currently, t can be set through debugfs only, but it's meant to be tunable by iw (the mac80211-ish replacement for wireless-tools) in a near future. Other parameters will be tunable, such as s (>> smoothing_shift), which stands for "smoothing".

Hence, err_avg is an exponential moving average of error(T), such that:

	err_avg = error(T - 1) / s + ... + error(T - n) / (s * n).

Now, I'm not sure about what you need for mesh networks, but from this algorithm you can quickly and cheaply get a proportional, integral or derivative error ("error" as in difference between the failed frame rate and the allowance for packet loss) or even get them all. The first one is just linearly based upon the current behaviour, the second is about weighed behaviour in the past, and the third emphasizes the current trend. We actually use them all to adjust rates we use in "regular" 802.11 networks, so I think they may suit your needs as well. If they don't, I'm fine with this fail_avg thing you introduced.

--
Ciao
Stefano

#7 lore raw
In reply to Stefano Brivio
Quoted 7 lines · Stefano Brivio

net/mac80211/rc80211_pid_algo.c static void rate_control_pid_sample(struct rc_pid_info *pinfo, · line 191

Quoted 5 lines
net/mac80211/rc80211_pid_algo.c +5 -0
+#ifdef CONFIG_MAC80211_MESH
+		if (pf == 100 &&
+		    sdata->vif.type == IEEE80211_IF_TYPE_MESH_POINT)
+			mesh_plink_broken(sta);
+#endif

I'd like to have this moved, maybe right before this:

Why? pf and tx_num_xmit (which is checked in an if leading to this lines) are modified between this point and where you want to move the code. If it is necessary I can add a 'broken link' flag to execute mesh_plink_broken later.

I think by now I will keep using fail_avg, but if you figure out a better way to compute a meaningful value please feel free to modify it. What we need is the probability (value between 0 and 1, now using integers from 0 to 100 to represent it) that a frame sent in the near future to this station will fail and will have to be retransmitted.

Signature · 2 lines
Luis Carlos Cobo Rus       GnuPG ID: 44019B60
cozybit Inc.