Message ID | 1456306140-78485-2-git-send-email-nbd@openwrt.org (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Johannes Berg |
Headers | show |
On Wed, 2016-02-24 at 10:29 +0100, Felix Fietkau wrote: > + /* > + * If the rate is slower than single-stream MCS4, limit A-MSDU to usual > + * data packet size > + */ > + if (g->duration[rate] > MCS_DURATION(1, 0, 104)) > + return 1500; > + > + /* > + * If the rate is slower than single-stream MCS7, limit A-MSDU to twice > + * the usual data packet size > + */ > + if (g->duration[rate] > MCS_DURATION(1, 0, 260)) > + return 3000; This isn't *quite* right, since you have to take an 802.11 header (vs. an ethernet header) into account, I think? johannes -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 2016-03-03 15:55, Johannes Berg wrote: > On Wed, 2016-02-24 at 10:29 +0100, Felix Fietkau wrote: > >> + /* >> + * If the rate is slower than single-stream MCS4, limit A-MSDU to usual >> + * data packet size >> + */ >> + if (g->duration[rate] > MCS_DURATION(1, 0, 104)) >> + return 1500; >> + >> + /* >> + * If the rate is slower than single-stream MCS7, limit A-MSDU to twice >> + * the usual data packet size >> + */ >> + if (g->duration[rate] > MCS_DURATION(1, 0, 260)) >> + return 3000; > > This isn't *quite* right, since you have to take an 802.11 header (vs. > an ethernet header) into account, I think? It's only a rough approximation anyway to prevent very large A-MSDUs from being created with low rates. - Felix -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Thu, 2016-03-03 at 16:03 +0100, Felix Fietkau wrote: > > > This isn't *quite* right, since you have to take an 802.11 header > > (vs. > > an ethernet header) into account, I think? > It's only a rough approximation anyway to prevent very large A-MSDUs > from being created with low rates. > Right, but it seemed like the intent was to allow two full-MTU sized frames to be combined, which this doesn't. johannes -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 2016-03-03 16:07, Johannes Berg wrote: > On Thu, 2016-03-03 at 16:03 +0100, Felix Fietkau wrote: >> >> > This isn't *quite* right, since you have to take an 802.11 header >> > (vs. >> > an ethernet header) into account, I think? >> It's only a rough approximation anyway to prevent very large A-MSDUs >> from being created with low rates. >> > > Right, but it seemed like the intent was to allow two full-MTU sized > frames to be combined, which this doesn't. I'll look into it some more to see if it's better to change the comment or the code in this case. - Felix -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c index 3928dbd..ad8859c 100644 --- a/net/mac80211/rc80211_minstrel_ht.c +++ b/net/mac80211/rc80211_minstrel_ht.c @@ -882,6 +882,39 @@ minstrel_ht_set_rate(struct minstrel_priv *mp, struct minstrel_ht_sta *mi, ratetbl->rate[offset].flags = flags; } +static int +minstrel_ht_get_max_amsdu_len(struct minstrel_ht_sta *mi) +{ + int group = mi->max_prob_rate / MCS_GROUP_RATES; + const struct mcs_group *g = &minstrel_mcs_groups[group]; + int rate = mi->max_prob_rate % MCS_GROUP_RATES; + + /* Disable A-MSDU if max_prob_rate is bad */ + if (mi->groups[group].rates[rate].prob_ewma < MINSTREL_FRAC(50, 100)) + return 1; + + /* If the rate is slower than single-stream MCS1, make A-MSDU limit small */ + if (g->duration[rate] > MCS_DURATION(1, 0, 52)) + return 500; + + /* + * If the rate is slower than single-stream MCS4, limit A-MSDU to usual + * data packet size + */ + if (g->duration[rate] > MCS_DURATION(1, 0, 104)) + return 1500; + + /* + * If the rate is slower than single-stream MCS7, limit A-MSDU to twice + * the usual data packet size + */ + if (g->duration[rate] > MCS_DURATION(1, 0, 260)) + return 3000; + + /* unlimited */ + return 0; +} + static void minstrel_ht_update_rates(struct minstrel_priv *mp, struct minstrel_ht_sta *mi) { @@ -906,6 +939,7 @@ minstrel_ht_update_rates(struct minstrel_priv *mp, struct minstrel_ht_sta *mi) minstrel_ht_set_rate(mp, mi, rates, i++, mi->max_prob_rate); } + mi->sta->max_rc_amsdu_len = minstrel_ht_get_max_amsdu_len(mi); rates->rate[i].idx = -1; rate_control_set_rates(mp->hw, mi->sta, rates); }
Prevents excessive A-MSDU aggregation at low data rates or bad conditions. Signed-off-by: Felix Fietkau <nbd@openwrt.org> --- net/mac80211/rc80211_minstrel_ht.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)