nl80211/mac80211 Add support for per-rate rx statistics
Subsystems (2)
v2 cover nl80211/mac80211 Add support for per-rate rx statistics
This patchset adds support for the collection and propagating of per-rate, per-station rx statistics when subscribed by userspace applications.
These statistics can be useful in understanding the quality of communication with our peers and in evaluating how different peers
are communicating in different MCS/BW/NSS during different time periods and environment.
This patchset is based on the below implementation by Johannes, to publish the stats when user space clients have subscribed and dump and clear when a certain threshold of stats is reached.
http://thread.gmane.org/gmane.linux.kernel.wireless.general/133172
Few changes are made to the above implementation,
1. Dynamic memory allocation of stats data structures
2. Rate is encoded and used as key of hash table for scalablility.
Johannes Berg(1):
nl80211: support per-rate/per-station statistics
Sriram R (1):
mac80211: Add support for per-rate rx statistics
include/net/cfg80211.h | 51 +++++++++++ include/uapi/linux/nl80211.h | 76 ++++++++++++++++ net/mac80211/cfg.c | 36 ++++++++ net/mac80211/ieee80211_i.h | 2 + net/mac80211/main.c | 2 + net/mac80211/rx.c | 10 +- net/mac80211/sta_info.c | 212 +++++++++++++++++++++++++++++++++++++++++++ net/mac80211/sta_info.h | 20 ++++ net/wireless/core.c | 18 ++++ net/wireless/nl80211.c | 175 ++++++++++++++++++++++++++++++++--- net/wireless/nl80211.h | 14 +++ net/wireless/rdev-ops.h | 10 ++ net/wireless/trace.h | 15 +++ 13 files changed, 626 insertions(+), 15 deletions(-)
Signature · 1 line
2.7.4
RFC v2 1/2 nl80211: support per-rate/per-station statistics
Per-rate/per-station statistics can be desirable to have but they're quite expensive (keeping the four counters for each rate would take close to 4k of memory per station only for VHT MCSes for a moderately capable VHT chip (with 2 spatial streams and 80MHz support) so it's not a good idea to keep all of this in the kernel.
Instead, this API provides a way for interested clients in userspace to subscribe to such statistics. When supported by a driver, it can then start collecting the data only when subscribers exist. To avoid the kernel's data collection becoming too big, it can send out the data at any point in time, for example to limit the counters to u16 internally and send it out when they're close to reaching the limit, or to keep a hash table and sending it out when too many collisions occur. Userspace can then keep track of the full state.
Based on below implementation by Johannes Berg <[email protected]>
http://thread.gmane.org/gmane.linux.kernel.wireless.general/133172
with following changes,
1. Allow rx bytes stats to be collected
2. Rate info sent to userspace is encoded into 32bit value
--- include/net/cfg80211.h | 51 +++++++++++++ include/uapi/linux/nl80211.h | 76 +++++++++++++++++++ net/wireless/core.c | 18 +++++ net/wireless/nl80211.c | 175 +++++++++++++++++++++++++++++++++++++++---- net/wireless/nl80211.h | 14 ++++ net/wireless/rdev-ops.h | 10 +++ net/wireless/trace.h | 15 ++++ 7 files changed, 346 insertions(+), 13 deletions(-)
include/net/cfg80211.h +51 -0
@@ -1236,6 +1236,37 @@ struct station_info {s8 avg_ack_signal; }; +/** +* struct cfg80211_rate_stats - per rate statistics of station +* +* @rate: encoded rate value +* @bytes: Total number of bytes received at this @rate +* @packets: Packet count received at this @rate +*/ +struct cfg80211_rate_stats { +u32 rate; +u32 bytes; +u16 packets; +}; + +/** +* cfg80211_report_rate_stats - report rate statistics for a station +* @wiphy: the wiphy that's reporting the data +* @wdev: the virtual interface the data is reported for +* @mac_addr: the station MAC address +* @rate_table_len: length of rate table +* @rate_stats_buf: per-rate,per-station statistics buffer +* @gfp: allocation flags +* +* Note that it is valid to call this function multiple times even for the +* same station, if the data isn't actually stored in an array. +*/ +void cfg80211_report_rate_stats (struct wiphy *wiphy,struct wireless_dev *wdev, +const u8 *mac_addr,unsigned int rate_table_len, +struct cfg80211_rate_stats *rate_stats_buf, +gfp_t gfp); + +#if IS_ENABLED (CONFIG_CFG80211 )/** * cfg80211_get_station - retrieve information about a given station
@@ -2693,6 +2724,20 @@ struct cfg80211_external_auth_params { };/** +* enum cfg80211_rate_stats_ops - rate statistics operations +* +* @CFG80211_RATE_STATS_START: start data collection +* @CFG80211_RATE_STATS_DUMP: dump and clear the data +* (using cfg80211_report_rate_stats() to report it) +* @CFG80211_RATE_STATS_STOP: stop data collection +*/ +enum cfg80211_rate_stats_ops { +CFG80211_RATE_STATS_START , +CFG80211_RATE_STATS_DUMP , +CFG80211_RATE_STATS_STOP , +}; + +/** * struct cfg80211_ops - backend description for wireless configuration * * This struct is registered by fullmac card drivers and/or wireless stacks
@@ -3024,6 +3069,9 @@ struct cfg80211_external_auth_params {* * @tx_control_port: TX a control port frame (EAPoL). The noencrypt parameter * tells the driver that the frame should not be encrypted. +* +* @rate_stats: rate statistics operation - if supported all operations must be +* supported, see &enum cfg80211_rate_stats_ops. */ struct cfg80211_ops {int (*suspend)(struct wiphy *wiphy,struct cfg80211_wowlan *wow);
@@ -3329,6 +3377,9 @@ struct cfg80211_ops { const u8 *buf, size_t len, const u8 *dest, const __be16 proto, const bool noencrypt); + +void (*rate_stats)(struct wiphy *wiphy, +enum cfg80211_rate_stats_ops op); };/*
include/uapi/linux/nl80211.h +76 -0
124 lines not on this page · raw message
net/wireless/core.c +18 -0
@@ -664,6 +664,12 @@ int wiphy_register(struct wiphy *wiphy)return -EINVAL ;#endif +if (WARN_ON (wiphy_ext_feature_isset (wiphy, +NL80211_EXT_FEATURE_RATE_STATS ) && + !rdev->ops->rate_stats)) +return -EINVAL ; + +/* * if a wiphy has unsupported modes for regulatory channel enforcement, * opt-out of enforcement checking
@@ -872,6 +878,12 @@ int wiphy_register(struct wiphy *wiphy)break ; } } + +if (wiphy_ext_feature_isset (&rdev->wiphy, +NL80211_EXT_FEATURE_RATE_STATS ) && +genl_has_listeners (&nl80211_fam,wiphy_net (wiphy), +NL80211_MCGRP_RATE_STATS )) +rdev_rate_stats (rdev,CFG80211_RATE_STATS_START ); rdev->wiphy.registered = true;rtnl_unlock ();
@@ -922,6 +934,12 @@ void wiphy_unregister(struct wiphy *wiphy)rfkill_unregister (rdev->rfkill);rtnl_lock (); +if (wiphy_ext_feature_isset (&rdev->wiphy, +NL80211_EXT_FEATURE_RATE_STATS ) && +genl_has_listeners (&nl80211_fam,wiphy_net (wiphy), +NL80211_MCGRP_RATE_STATS )) +rdev_rate_stats (rdev,CFG80211_RATE_STATS_STOP ); +nl80211_notify_wiphy (rdev,NL80211_CMD_DEL_WIPHY ); rdev->wiphy.registered = false;
net/wireless/nl80211.c +162 -13
219 lines not on this page · raw message
net/wireless/nl80211.h +14 -0
@@ -4,6 +4,20 @@#include "core.h" +/* netlink family */ +extern struct genl_family nl80211_fam; + +/* multicast groups */ +enum nl80211_multicast_groups { +NL80211_MCGRP_CONFIG , +NL80211_MCGRP_SCAN , +NL80211_MCGRP_REGULATORY , +NL80211_MCGRP_MLME , +NL80211_MCGRP_VENDOR , +NL80211_MCGRP_NAN , +NL80211_MCGRP_RATE_STATS , +NL80211_MCGRP_TESTMODE /* keep last - ifdef! */ +};int nl80211_init (void );void nl80211_exit (void ); void nl80211_notify_wiphy(struct cfg80211_registered_device *rdev,
net/wireless/rdev-ops.h +10 -0
@@ -222,6 +222,16 @@ static inline int rdev_dump_station(struct cfg80211_registered_device *rdev,return ret; } +static inline void +rdev_rate_stats (struct cfg80211_registered_device *rdev, +enum cfg80211_rate_stats_ops op) +{ +trace_rdev_rate_stats (&rdev->wiphy, op); +if (rdev->ops->rate_stats) + rdev->ops->rate_stats (&rdev->wiphy, op); +trace_rdev_return_void (&rdev->wiphy); +} +static inline int rdev_add_mpath (struct cfg80211_registered_device *rdev,struct net_device *dev,u8 *dst,u8 *next_hop) {
net/wireless/trace.h +15 -0
@@ -2368,6 +2368,21 @@ TRACE_EVENT(rdev_external_auth, __entry->bssid, __entry->ssid, __entry->status) ); +TRACE_EVENT (rdev_rate_stats, + TP_PROTO(struct wiphy *wiphy, enum cfg80211_rate_stats_ops op), +TP_ARGS (wiphy, op), +TP_STRUCT__entry ( + WIPHY_ENTRY +__field (u32, op) + ), +TP_fast_assign ( + WIPHY_ASSIGN; + __entry->op = op; + ), +TP_printk (WIPHY_PR_FMT ", op=%d" ,WIPHY_PR_ARG , __entry->op) +); + +/************************************************************* * cfg80211 exported functions traces * *************************************************************/
Signature · 1 line
2.7.4
Johannes Berg
maintainerRe: [RFCv2 1/2] nl80211: support per-rate/per-station statistics
Quoted 15 lines · Sriram R
Per-rate/per-station statistics can be desirable to have but they're quite expensive (keeping the four counters for each rate would take close to 4k of memory per station only for VHT MCSes for a moderately capable VHT chip (with 2 spatial streams and 80MHz support) so it's not a good idea to keep all of this in the kernel.
Instead, this API provides a way for interested clients in userspace to subscribe to such statistics. When supported by a driver, it can then start collecting the data only when subscribers exist. To avoid the kernel's data collection becoming too big, it can send out the data at any point in time, for example to limit the counters to u16 internally and send it out when they're close to reaching the limit, or to keep a hash table and sending it out when too many collisions occur. Userspace can then keep track of the full state.
Quoted 3 lines
Based on below implementation by Johannes Berg <[email protected]>
http://thread.gmane.org/gmane.linux.kernel.wireless.general/133172
with following changes,
Err, that's pretty much an exact copy of my patch ...
You should keep the author attribution and signed-off-by, and if you want your work to be separately attributed then just put the changes you made into (a) separate patch(es).
Quoted 1 line
1. Allow rx bytes stats to be collected
This seems OK.
Quoted 1 line
2. Rate info sent to userspace is encoded into 32bit value
This I don't like at all. It's fine for the internal representation, and I know I did something like that in mac80211 (though I guess at the time it was only 16 bit), but it's not OK for the userspace representation.
I just merged patches to support HE in the userspace representation, and that's properly taken into account in struct rate_info which I had here in my version of the patch.
johannes
Re: [RFCv2 1/2] nl80211: support per-rate/per-station statistics
Quoted 20 lines · Johannes Berg
Quoted 15 lines · Sriram R
Per-rate/per-station statistics can be desirable to have but they're quite expensive (keeping the four counters for each rate would take close to 4k of memory per station only for VHT MCSes for a moderately capable VHT chip (with 2 spatial streams and 80MHz support) so it's not a good idea to keep all of this in the kernel.
Instead, this API provides a way for interested clients in userspace to subscribe to such statistics. When supported by a driver, it can then start collecting the data only when subscribers exist. To avoid the kernel's data collection becoming too big, it can send out the data at any point in time, for example to limit the counters to u16 internally and send it out when they're close to reaching the limit, or to keep a hash table and sending it out when too many collisions occur. Userspace can then keep track of the full state.
Quoted 3 lines
Based on below implementation by Johannes Berg <[email protected]>
http://thread.gmane.org/gmane.linux.kernel.wireless.general/133172
with following changes,
Quoted 5 lines
Err, that's pretty much an exact copy of my patch ...
You should keep the author attribution and signed-off-by, and if you want your work to be separately attributed then just put the changes you made into (a) separate patch(es).
Sure! I'll correct this in my next revision.
Quoted 7 lines
Quoted 2 lines
1. Allow rx bytes stats to be collected
This seems OK.
Quoted 1 line
2. Rate info sent to userspace is encoded into 32bit value
Quoted 7 lines
This I don't like at all. It's fine for the internal representation, and I know I did something like that in mac80211 (though I guess at the time it was only 16 bit), but it's not OK for the userspace representation.
I just merged patches to support HE in the userspace representation, and that's properly taken into account in struct
rate_infowhich I had here in my version of the patch.
Okay Johannes. I'll revert this in my next revision.
Quoted 2 lines
johannes
RFC v2 2/2 mac80211: Add support for per-rate rx statistics
In reply to Sriram RThis patch adds support for the mac80211 to collect rx statistics (Packet count and total bytes received) per-rate, per-station when subscribed by user space clients.
Note that the rate field passed on to the userspace from mac80211 is an encoded value where different rate attributes such as type(VHT/HT/Legacy), MCS, BW, NSS, GI are collectively used to encode to this rate and the userspace has to take care of decoding it.This is done so as to allow scalability in future.
Once subscribers to the rate stats exist, each packet received is recorded per rate and stored as an entry(per rate) in a hashtable with the encoded rate being the key for the hashtable. As the rate changes, new entries gets added into this table and this information will be populated and sent back to userspace whenever a certain limit is hit , Say when Packet count is greater than 65000 or the number of rate entries exceed say a count of 10,after which these entries are cleared and new stats gets collected.
--- net/mac80211/cfg.c | 36 ++++++++ net/mac80211/ieee80211_i.h | 2 + net/mac80211/main.c | 2 + net/mac80211/rx.c | 10 ++- net/mac80211/sta_info.c | 212 +++++++++++++++++++++++++++++++++++++++++++++ net/mac80211/sta_info.h | 20 +++++ 6 files changed, 280 insertions(+), 2 deletions(-)
net/mac80211/cfg.c +36 -0
@@ -3803,6 +3803,41 @@ static int ieee80211_get_txq_stats(struct wiphy *wiphy,return ret; } +static void +ieee80211_rate_stats (struct wiphy *wiphy,enum cfg80211_rate_stats_ops ops) +{ +struct ieee80211_local *local =wiphy_priv (wiphy); +struct sta_info *sta; + +mutex_lock (&local->sta_mtx); + +switch (ops) { +case CFG80211_RATE_STATS_START : + local->rate_stats_active = true; +list_for_each_entry (sta, &local->sta_list, list) { +ieee80211_sta_rate_table_init (sta); + } +break ; + +case CFG80211_RATE_STATS_STOP : + local->rate_stats_active = false; +list_for_each_entry (sta, &local->sta_list, list) { +ieee80211_sta_rate_table_free (sta->rate_table); +RCU_INIT_POINTER (sta->rate_table,NULL ); + } +break ; + +case CFG80211_RATE_STATS_DUMP : +list_for_each_entry (sta, &local->sta_list, list) { +ieee80211_queue_work (&local->hw, + &sta->rate_stats_dump_wk); + } +break ; + } + +mutex_unlock (&local->sta_mtx); +} +const struct cfg80211_ops mac80211_config_ops = { .add_virtual_intf = ieee80211_add_iface, .del_virtual_intf = ieee80211_del_iface,
@@ -3897,4 +3932,5 @@ const struct cfg80211_ops mac80211_config_ops = { .set_multicast_to_unicast = ieee80211_set_multicast_to_unicast, .tx_control_port = ieee80211_tx_control_port, .get_txq_stats = ieee80211_get_txq_stats, + .rate_stats = ieee80211_rate_stats, };
net/mac80211/ieee80211_i.h +2 -0
@@ -1384,6 +1384,8 @@ struct ieee80211_local {/* TDLS channel switch */ struct work_struct tdls_chsw_work;struct sk_buff_head skb_queue_tdls_chsw; + +bool rate_stats_active; }; static inline struct ieee80211_sub_if_data *
net/mac80211/main.c +2 -0
@@ -570,6 +570,8 @@ struct ieee80211_hw *ieee80211_alloc_hw_nm(size_t priv_data_len,wiphy_ext_feature_set (wiphy,NL80211_EXT_FEATURE_RRM ); +wiphy_ext_feature_set (wiphy,NL80211_EXT_FEATURE_RATE_STATS ); + wiphy->bss_priv_size =sizeof (struct ieee80211_bss ); local =wiphy_priv (wiphy);
net/mac80211/rx.c +8 -2
@@ -1561,9 +1561,11 @@ ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx) test_sta_flag(sta, WLAN_STA_AUTHORIZED)) { sta->rx_stats.last_rx = jiffies;if (ieee80211_is_data (hdr->frame_control) && - !is_multicast_ether_addr (hdr->addr1)) + !is_multicast_ether_addr (hdr->addr1)) { sta->rx_stats.last_rate =sta_stats_encode_rate (status); +ieee80211_sta_update_rate_stats (&sta); + } } }else if (rx->sdata->vif.type ==NL80211_IFTYPE_OCB ) { sta->rx_stats.last_rx = jiffies;
@@ -1573,8 +1575,10 @@ ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx)* match the current local configuration when processed. */ sta->rx_stats.last_rx = jiffies; -if (ieee80211_is_data (hdr->frame_control)) +if (ieee80211_is_data (hdr->frame_control)) { sta->rx_stats.last_rate =sta_stats_encode_rate (status); +ieee80211_sta_update_rate_stats (&sta); + } }if (rx->sdata->vif.type ==NL80211_IFTYPE_STATION )
@@ -4067,6 +4071,8 @@ static bool ieee80211_invoke_fast_rx(struct ieee80211_rx_data *rx, stats->last_rx = jiffies; stats->last_rate =sta_stats_encode_rate (status); +ieee80211_sta_update_rate_stats (&sta); + stats->fragments++; stats->packets++;
net/mac80211/sta_info.c +212 -0
239 lines not on this page · raw message
net/mac80211/sta_info.h +20 -0
@@ -583,10 +583,25 @@ struct sta_info {struct cfg80211_chan_def tdls_chandef; +struct rhashtable *rate_table; +struct work_struct rate_stats_dump_wk; +/* keep last! */ struct ieee80211_sta sta; }; +#define IEEE80211_ENCODED_RATE_LEN 4 +#define MAX_RATE_TABLE_ELEMS 10 +#define MAX_RATE_TABLE_PACKETS 65000 + +struct ieee80211_sta_rate_entry { +u32 rate; +u32 bytes; +struct rcu_head rcu; +struct rhash_head rhash; +u16 packets; +}; +static inline enum nl80211_plink_state sta_plink_state (struct sta_info *sta) {#ifdef CONFIG_MAC80211_MESH
@@ -759,6 +774,11 @@ void ieee80211_sta_ps_deliver_uapsd(struct sta_info *sta);unsigned long ieee80211_sta_last_active (struct sta_info *sta); +void ieee80211_sta_rate_table_free (struct rhashtable *rate_table); +int ieee80211_sta_rate_table_init (struct sta_info *sta); +void ieee80211_rate_stats_dump (struct work_struct *wk); +void ieee80211_sta_update_rate_stats (struct sta_info **sta_ptr); +enum sta_stats_type {STA_STATS_RATE_TYPE_INVALID =0 ,STA_STATS_RATE_TYPE_LEGACY ,
Signature · 1 line
2.7.4
Johannes Berg
maintainerRe: [RFCv2 2/2] mac80211: Add support for per-rate rx statistics
Why did you change to rhashtable?
That seems very strange, since we explicitly want to limit the number of entries, but rhashtable will grow/shrink as required.
I think I liked my approach better since it allowed us to clearly limit the memory consumption for this.
johannes
Re: [RFCv2 2/2] mac80211: Add support for per-rate rx statistics
Quoted 1 line · Johannes Berg
Why did you change to rhashtable?
Hi Johannes,
I wanted to give a try with rhashtable and get your thoughts, since it gave below flexibility to original patch,
1. avoids creating static memory when userspace starts accumulating stats. 36 rate entries were used in original patch based on 10 (MCS count) * 3 (entries per mcs)+ 6 escape entries, which would also increase with HE supported now.
2. avoids restricting to only 3 entries per MCS in the table. Using hashtable gave flexibility to add/read the table dynamically based on encoded rate key.
Quoted 3 lines
That seems very strange, since we explicitly want to limit the number of entries, but rhashtable will grow/shrink as required.
Yes you're right ,it might grow but, as per this patch when Packet count is greater
than 65000 in an exntry or when the number of rate table/hashtable entries exceed a count of MAX_RATE_TABLE_ELEMS (10 was used in this patch), the complete table is dumped to userspace and new stats starts getting collected in a new table after we flush the old one. Hence with this approach also the memory consumption is limited similar to the original patch.
Quoted 3 lines
I think I liked my approach better since it allowed us to clearly limit the memory consumption for this.
Sure Johannes, Could you please let me know if i can rebase your patch and send it(with corresponding additional entries for HE MCS). Also as mentioned above this patch also limits the memory consumption when the rate table size exceeds MAX_RATE_TABLE_ELEMS.
Quoted 2 lines
johannes
Johannes Berg
maintainerRe: [RFCv2 2/2] mac80211: Add support for per-rate rx statistics
Hi,
Sorry for the late reply, my work hours are limited right now.
Quoted 6 lines
I wanted to give a try with rhashtable and get your thoughts, since it gave below flexibility to original patch,
1. avoids creating static memory when userspace starts accumulating stats. 36 rate entries were used in original patch based on 10 (MCS count) * 3 (entries per mcs)+ 6 escape entries, which would also increase with HE supported now.
True, but rhashtable also has very significant overhead. I suspect it's around the same order of magnitude as the allocation you need to keep all the 36 entries?
struct rhashtable is probably already ~120 bytes on 64-bit systems (very rough counting), and a single bucket table is >64, so you already have close to 200 bytes for just the basic structures, without *any* entries. And a significant amount of code too.
36 rate entries could probably be kept - I don't think you really need to go more than that since you're not going to switch HT/VHT/HE all the time, so that's only about 360 bytes total. You haven't gained much, but made it much more complex, doing much more allocations (create new/destroy old entries) etc.
I don't really see much value in that.
Quoted 3 lines
2. avoids restricting to only 3 entries per MCS in the table. Using hashtable gave flexibility to add/read the table dynamically based on encoded rate key.
Yes but if you don't limit, you end up with run-away memory consumption again.
Quoted 8 lines
Yes you're right ,it might grow but, as per this patch when Packet count is greater
than 65000 in an exntry or when the number of rate table/hashtable entries exceed a count ofMAX_RATE_TABLE_ELEMS(10 was used in this patch), the complete table is dumped to userspace and new stats starts getting collected in a new table after we flush the old one. Hence with this approach also the memory consumption is limited similar to the original patch.
Right, so you limit to 10 entries, which is a total of
~120 + ~72 + 10 x (10 /* data */ + 3*8) = 524
in 12 different allocations. I don't think that's going to be much better, and you seemed to think that the 10 would be commonly hit (otherwise having a relatively small limit of 36 shouldn't be an issue)
So - I don't really see any advantage here, do you?
johannes
Re: [RFCv2 2/2] mac80211: Add support for per-rate rx statistics
Quoted 20 lines · Johannes Berg
Hi,
Sorry for the late reply, my work hours are limited right now.
Quoted 6 lines
I wanted to give a try with rhashtable and get your thoughts, since it gave below flexibility to original patch,
1. avoids creating static memory when userspace starts accumulating stats. 36 rate entries were used in original patch based on 10 (MCS count) * 3 (entries per mcs)+ 6 escape entries, which would also increase with HE supported now.True, but rhashtable also has very significant overhead. I suspect it's around the same order of magnitude as the allocation you need to keep all the 36 entries?
struct rhashtable is probably already ~120 bytes on 64-bit systems (very rough counting), and a single bucket table is >64, so you already have close to 200 bytes for just the basic structures, without *any* entries. And a significant amount of code too.
Quoted 8 lines
36 rate entries could probably be kept - I don't think you really need to go more than that since you're not going to switch HT/VHT/HE all the time, so that's only about 360 bytes total. You haven't gained much, but made it much more complex, doing much more allocations (create new/destroy old entries) etc.
I don't really see much value in that.
Okay Johannes. I'll revive this patch based on your approach and submit for review.
Thanks,
Sriram.R
Quoted 27 lines
Quoted 3 lines
2. avoids restricting to only 3 entries per MCS in the table. Using hashtable gave flexibility to add/read the table dynamically based on encoded rate key.
Yes but if you don't limit, you end up with run-away memory consumption again.
Quoted 8 lines
Yes you're right ,it might grow but, as per this patch when Packet count is greater
than 65000 in an exntry or when the number of rate table/hashtable entries exceed a count ofMAX_RATE_TABLE_ELEMS(10 was used in this patch), the complete table is dumped to userspace and new stats starts getting collected in a new table after we flush the old one. Hence with this approach also the memory consumption is limited similar to the original patch.Right, so you limit to 10 entries, which is a total of
~120 + ~72 + 10 x (10 /* data */ + 3*8) = 524
in 12 different allocations. I don't think that's going to be much better, and you seemed to think that the 10 would be commonly hit (otherwise having a relatively small limit of 36 shouldn't be an issue)
So - I don't really see any advantage here, do you?
johannes