From: Antonio Quartulli <hidden> Date: 2014-03-30 20:34:58
The "Expected throughput" towards a generic wireless peer is
a value that can be used by other kernel components to
achieve different goals.
In particular we have 802.11s and batman-adv which will
iuse this estimation to compute their throughput based
metric. Therefore with this patchset I wanted to export
this result and make it available for future use.
Changes included in this patchset:
- add the new get_expected_throughput() RC API
- export the result of such API via cfg80211::get_station()
- implement the get_expected_throughput() RC API for minstrel(_ht)
For what concerns Minstrel_HT I decided to directly re-use the
throughput value computed by the algorithm itself with
minstrel_ht_calc_tp() for max_tp_rate.
For the legacy Minstrel instead I computed the expected
throughput as the product of the max_tp bitrate multplied
by its probability of success.
I am not entirely sure about passing sband as third parameter
to get_expected_throughput()..maybe somebody can suggest a
better solution.
Cheers,
Antonio Quartulli (6):
cfg80211: export expected throughput through get_station()
mac80211: add new RC API to retrieve expected throughput
mac80211: export expected throughput in set_sta_info()
mac80211: minstrel - implement get_expected_throughput() API
mac80211: minstrel_ht - implement get_expected_throughput() API
cfg80211: implement cfg80211_get_station cfg80211 API
include/net/cfg80211.h | 74 +++++++++++++++++++++++---------------
include/net/mac80211.h | 3 ++
net/mac80211/cfg.c | 17 +++++++++
net/mac80211/rc80211_minstrel.c | 15 ++++++++
net/mac80211/rc80211_minstrel_ht.c | 19 ++++++++++
net/wireless/util.c | 18 ++++++++++
6 files changed, 118 insertions(+), 28 deletions(-)
--
1.8.3.2
From: Antonio Quartulli <hidden> Date: 2014-03-30 20:34:59
From: Antonio Quartulli <redacted>
Users may need information about the expected throughput
towards a given peer computed by the RC algorithm.
Export such value through the get_station() API.
This information is useful to the batman-adv module which
will use it for its new metric computation.
Signed-off-by: Antonio Quartulli <redacted>
---
include/net/cfg80211.h | 63 ++++++++++++++++++++++++++++----------------------
1 file changed, 35 insertions(+), 28 deletions(-)
From: Antonio Quartulli <hidden> Date: 2014-03-30 20:35:00
From: Antonio Quartulli <redacted>
In order to make get_station() export the expected
throughput, we need a new API which extracts such
information from the Rate Control algorithm.
Therefore add the get_expected_throughput() member
to the rate_control_ops structure.
Signed-off-by: Antonio Quartulli <redacted>
---
include/net/mac80211.h | 3 +++
1 file changed, 3 insertions(+)
From: Antonio Quartulli <hidden> Date: 2014-03-30 20:35:01
From: Antonio Quartulli <redacted>
If the RC algorithm implements the get_expected_throughput()
API fill the related member in the station_info object when
dumping a station.
Signed-off-by: Antonio Quartulli <redacted>
---
net/mac80211/cfg.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
From: Antonio Quartulli <hidden> Date: 2014-03-30 20:35:04
From: Antonio Quartulli <redacted>
Implement and export the new cfg80211_get_station() API.
This utility can be used by other kernel modules to obtain
detailed information about a given wireless station.
It will be in particular useful to batman-adv which will
implement a wireless rate based metric.
Signed-off-by: Antonio Quartulli <redacted>
---
include/net/cfg80211.h | 11 +++++++++++
net/wireless/util.c | 18 ++++++++++++++++++
2 files changed, 29 insertions(+)
@@ -1482,6 +1482,24 @@ unsigned int ieee80211_get_num_supported_channels(struct wiphy *wiphy)}EXPORT_SYMBOL(ieee80211_get_num_supported_channels);+intcfg80211_get_station(structnet_device*dev,u8*mac_addr,+structstation_info*sinfo)+{+structcfg80211_registered_device*rdev;+structwireless_dev*wdev;++wdev=dev->ieee80211_ptr;+if(!wdev)+return-EOPNOTSUPP;++rdev=wiphy_to_dev(wdev->wiphy);+if(!rdev->ops->get_station)+return-EOPNOTSUPP;++returnrdev_get_station(rdev,dev,mac_addr,sinfo);+}+EXPORT_SYMBOL(cfg80211_get_station);+/* See IEEE 802.1H for LLC/SNAP encapsulation/decapsulation *//* Ethernet-II snap header (RFC1042 for most EtherTypes) */constunsignedcharrfc1042_header[]__aligned(2)=
From: Andrew Lunn <andrew@lunn.ch> Date: 2014-03-31 08:22:45
On Sun, Mar 30, 2014 at 10:34:59PM +0200, Antonio Quartulli wrote:
quoted hunk
From: Antonio Quartulli <redacted>
Users may need information about the expected throughput
towards a given peer computed by the RC algorithm.
Export such value through the get_station() API.
This information is useful to the batman-adv module which
will use it for its new metric computation.
Signed-off-by: Antonio Quartulli <redacted>
---
include/net/cfg80211.h | 63 ++++++++++++++++++++++++++++----------------------
1 file changed, 35 insertions(+), 28 deletions(-)
@@ -862,36 +862,38 @@ int cfg80211_check_station_change(struct wiphy *wiphy,*@STATION_INFO_NONPEER_PM:@nonpeer_pmfilled*@STATION_INFO_CHAIN_SIGNAL:@chain_signalfilled*@STATION_INFO_CHAIN_SIGNAL_AVG:@chain_signal_avgfilled+*@STATION_INFO_EXPECTED_THROUGHPUT:@expected_throughputfilled*/enumstation_info_flags{-STATION_INFO_INACTIVE_TIME=1<<0,-STATION_INFO_RX_BYTES=1<<1,-STATION_INFO_TX_BYTES=1<<2,-STATION_INFO_LLID=1<<3,-STATION_INFO_PLID=1<<4,-STATION_INFO_PLINK_STATE=1<<5,-STATION_INFO_SIGNAL=1<<6,-STATION_INFO_TX_BITRATE=1<<7,-STATION_INFO_RX_PACKETS=1<<8,-STATION_INFO_TX_PACKETS=1<<9,-STATION_INFO_TX_RETRIES=1<<10,-STATION_INFO_TX_FAILED=1<<11,-STATION_INFO_RX_DROP_MISC=1<<12,-STATION_INFO_SIGNAL_AVG=1<<13,-STATION_INFO_RX_BITRATE=1<<14,-STATION_INFO_BSS_PARAM=1<<15,-STATION_INFO_CONNECTED_TIME=1<<16,-STATION_INFO_ASSOC_REQ_IES=1<<17,-STATION_INFO_STA_FLAGS=1<<18,-STATION_INFO_BEACON_LOSS_COUNT=1<<19,-STATION_INFO_T_OFFSET=1<<20,-STATION_INFO_LOCAL_PM=1<<21,-STATION_INFO_PEER_PM=1<<22,-STATION_INFO_NONPEER_PM=1<<23,-STATION_INFO_RX_BYTES64=1<<24,-STATION_INFO_TX_BYTES64=1<<25,-STATION_INFO_CHAIN_SIGNAL=1<<26,-STATION_INFO_CHAIN_SIGNAL_AVG=1<<27,+STATION_INFO_INACTIVE_TIME=1<<0,+STATION_INFO_RX_BYTES=1<<1,+STATION_INFO_TX_BYTES=1<<2,+STATION_INFO_LLID=1<<3,+STATION_INFO_PLID=1<<4,+STATION_INFO_PLINK_STATE=1<<5,+STATION_INFO_SIGNAL=1<<6,+STATION_INFO_TX_BITRATE=1<<7,+STATION_INFO_RX_PACKETS=1<<8,+STATION_INFO_TX_PACKETS=1<<9,+STATION_INFO_TX_RETRIES=1<<10,+STATION_INFO_TX_FAILED=1<<11,+STATION_INFO_RX_DROP_MISC=1<<12,+STATION_INFO_SIGNAL_AVG=1<<13,+STATION_INFO_RX_BITRATE=1<<14,+STATION_INFO_BSS_PARAM=1<<15,+STATION_INFO_CONNECTED_TIME=1<<16,+STATION_INFO_ASSOC_REQ_IES=1<<17,+STATION_INFO_STA_FLAGS=1<<18,+STATION_INFO_BEACON_LOSS_COUNT=1<<19,+STATION_INFO_T_OFFSET=1<<20,+STATION_INFO_LOCAL_PM=1<<21,+STATION_INFO_PEER_PM=1<<22,+STATION_INFO_NONPEER_PM=1<<23,+STATION_INFO_RX_BYTES64=1<<24,+STATION_INFO_TX_BYTES64=1<<25,+STATION_INFO_CHAIN_SIGNAL=1<<26,+STATION_INFO_CHAIN_SIGNAL_AVG=1<<27,+STATION_INFO_EXPECTED_THROUGHPUT=1<<28,};
Hi Antonio
quoted hunk
/**
@@ -1013,6 +1015,9 @@ struct sta_bss_parameters { * @local_pm: local mesh STA power save mode * @peer_pm: peer mesh STA power save mode * @nonpeer_pm: non-peer mesh STA power save mode+ * @expected_throughput: expected throughput as reported by the RC algorithm+ * about the bitrate having the maximum throughput. This field can be filled+ * only by drivers using Minstrel */ struct station_info { u32 filled;
From: Antonio Quartulli <hidden> Date: 2014-03-31 08:46:21
Hi Andrew,
On 31/03/14 10:22, Andrew Lunn wrote:
quoted
/**
@@ -1013,6 +1015,9 @@ struct sta_bss_parameters { * @local_pm: local mesh STA power save mode * @peer_pm: peer mesh STA power save mode * @nonpeer_pm: non-peer mesh STA power save mode+ * @expected_throughput: expected throughput as reported by the RC algorithm+ * about the bitrate having the maximum throughput. This field can be filled+ * only by drivers using Minstrel */ struct station_info { u32 filled;
It would be nice to comment on what the units are. I known from our
BATMAN V discussions, it is something odd.
Thanks for raising the point.
Actually this is something we could discuss with Felix: at the moment
this value uses the same unit used by the cur_tp member of the
minstrel_ht_sta structure.
It should be Mbps/100 --> expected_throughput = 1 ==> 0.01Mbps
When exposing this value to the user (i.e. iw output) I'd recommend to
convert it to Mbps, but for internal purposes I don't see a clear
problem in exporting a value in this form.
Thoughts? Suggestions?
Cheers,
--
Antonio Quartulli
Thanks to the point raised by Andrew Lunn I just realised that this
value is expressed in Mbps/10 and so should be converted to Mbps/100
before being returned (assuming we agree on using this unit).
Cheers,
--
Antonio Quartulli
From: Johannes Berg <johannes@sipsolutions.net> Date: 2014-04-08 10:03:20
On Sun, 2014-03-30 at 22:34 +0200, Antonio Quartulli wrote:
- STATION_INFO_INACTIVE_TIME = 1<<0,
Since you're touching these all anyway, maybe convert to use BIT().
quoted hunk
@@ -1013,6 +1015,9 @@ struct sta_bss_parameters { * @local_pm: local mesh STA power save mode * @peer_pm: peer mesh STA power save mode * @nonpeer_pm: non-peer mesh STA power save mode+ * @expected_throughput: expected throughput as reported by the RC algorithm+ * about the bitrate having the maximum throughput. This field can be filled+ * only by drivers using Minstrel
This value needs a documented unit ... :)
johannes
From: Johannes Berg <johannes@sipsolutions.net> Date: 2014-04-08 10:03:50
On Sun, 2014-03-30 at 22:35 +0200, Antonio Quartulli wrote:
From: Antonio Quartulli <redacted>
In order to make get_station() export the expected
throughput, we need a new API which extracts such
information from the Rate Control algorithm.
Therefore add the get_expected_throughput() member
to the rate_control_ops structure.
From: Johannes Berg <johannes@sipsolutions.net> Date: 2014-04-08 10:06:22
On Sun, 2014-03-30 at 22:35 +0200, Antonio Quartulli wrote:
quoted hunk
/**+ * cfg80211_get_station - retrieve information about a given station+ * @dev: the device where the station is supposed to be connected to+ * @mac_addr: the mac address of the station of interest+ * @sinfo: pointer to the structure to fill with the information+ *+ * Returns 0 on success or a negative error code otherwise.+ */+int cfg80211_get_station(struct net_device *dev, u8 *mac_addr,+ struct station_info *sinfo);
mac_addr should be const
Any thoughts about clearing/filling/partially filling *sinfo when
returning an error?
johannes
From: Antonio Quartulli <hidden> Date: 2014-04-10 15:46:51
On 08/04/14 12:03, Johannes Berg wrote:
On Sun, 2014-03-30 at 22:35 +0200, Antonio Quartulli wrote:
quoted
From: Antonio Quartulli <redacted>
In order to make get_station() export the expected
throughput, we need a new API which extracts such
information from the Rate Control algorithm.
Therefore add the get_expected_throughput() member
to the rate_control_ops structure.
What about drivers with HW rate control?
True, they do not implement the rate_control_ops API.
Therefore, as discussed on IRC, I need to move this new API at the
mac80211 level, so that each driver can implement it the way it prefer.
Cheers,
--
Antonio Quartulli
I needed this because I saw it is required by some RC algo (only
minstrel) to extract the bitrate starting from the index.
You can check patch 4/6 for this:
+ bitrate = sband->bitrates[mi->r[idx].rix].bitrate;
maybe I can extract it from another structure? I couldn't find any way..
Cheers,
--
Antonio Quartulli
From: Antonio Quartulli <hidden> Date: 2014-04-10 16:02:59
On 08/04/14 12:06, Johannes Berg wrote:
On Sun, 2014-03-30 at 22:35 +0200, Antonio Quartulli wrote:
quoted
/**+ * cfg80211_get_station - retrieve information about a given station+ * @dev: the device where the station is supposed to be connected to+ * @mac_addr: the mac address of the station of interest+ * @sinfo: pointer to the structure to fill with the information+ *+ * Returns 0 on success or a negative error code otherwise.+ */+int cfg80211_get_station(struct net_device *dev, u8 *mac_addr,+ struct station_info *sinfo);
mac_addr should be const
True
Any thoughts about clearing/filling/partially filling *sinfo when
returning an error?
At the moment this function relies on what rdev_get_station() does and I
always assumed that in case of error the content of *sinfo should be
considered "undefined".
An option can be to set the object to 0 in case of error, but is it
really needed?
Any other change should be applied to rdev->ops->get_station(), not
here. I.e. fill the object as much as possible and never return an error
- just flag what was filled.
Cheers,
--
Antonio Quartulli
From: Antonio Quartulli <hidden> Date: 2014-04-10 16:22:24
On 08/04/14 12:03, Johannes Berg wrote:
On Sun, 2014-03-30 at 22:34 +0200, Antonio Quartulli wrote:
quoted
- STATION_INFO_INACTIVE_TIME = 1<<0,
Since you're touching these all anyway, maybe convert to use BIT().
Will do!
quoted
@@ -1013,6 +1015,9 @@ struct sta_bss_parameters { * @local_pm: local mesh STA power save mode * @peer_pm: peer mesh STA power save mode * @nonpeer_pm: non-peer mesh STA power save mode+ * @expected_throughput: expected throughput as reported by the RC algorithm+ * about the bitrate having the maximum throughput. This field can be filled+ * only by drivers using Minstrel
This value needs a documented unit ... :)
Yep. As suggested by Andrew, I will try to be clear about what unit is
returned.
Thanks a lot for your review!!!!
Cheers,
--
Antonio Quartulli
From: Johannes Berg <johannes@sipsolutions.net> Date: 2014-04-10 17:12:40
On Thu, 2014-04-10 at 18:02 +0200, Antonio Quartulli wrote:
quoted
Any thoughts about clearing/filling/partially filling *sinfo when
returning an error?
At the moment this function relies on what rdev_get_station() does and I
always assumed that in case of error the content of *sinfo should be
considered "undefined".
That's fine, maybe add a line of documentation?
johannes
From: Johannes Berg <johannes@sipsolutions.net> Date: 2014-04-10 17:13:07
On Thu, 2014-04-10 at 17:46 +0200, Antonio Quartulli wrote:
quoted
What about drivers with HW rate control?
True, they do not implement the rate_control_ops API.
Therefore, as discussed on IRC, I need to move this new API at the
mac80211 level, so that each driver can implement it the way it prefer.
Well, not *move*, but rather have both. Or you can just say that the
drivers that may need this can worry about it ...
johannes
I needed this because I saw it is required by some RC algo (only
minstrel) to extract the bitrate starting from the index.
You can check patch 4/6 for this:
+ bitrate = sband->bitrates[mi->r[idx].rix].bitrate;
maybe I can extract it from another structure? I couldn't find any way..
Bit strange that the algorithm doesn't have the band, if it has an
index? but I guess I didn't check all the patches...
johannes
From: Antonio Quartulli <hidden> Date: 2014-04-11 07:03:47
On 10/04/14 19:13, Johannes Berg wrote:
On Thu, 2014-04-10 at 17:46 +0200, Antonio Quartulli wrote:
quoted
quoted
What about drivers with HW rate control?
True, they do not implement the rate_control_ops API.
Therefore, as discussed on IRC, I need to move this new API at the
mac80211 level, so that each driver can implement it the way it prefer.
Well, not *move*, but rather have both. Or you can just say that the
drivers that may need this can worry about it ...
You are right, I meant to *add* another API at the mac80211 level and
have both. I think this is the cleanest solution.
Cheers,
--
Antonio Quartulli
From: Antonio Quartulli <hidden> Date: 2014-04-11 07:04:39
On 10/04/14 19:12, Johannes Berg wrote:
On Thu, 2014-04-10 at 18:02 +0200, Antonio Quartulli wrote:
quoted
quoted
Any thoughts about clearing/filling/partially filling *sinfo when
returning an error?
At the moment this function relies on what rdev_get_station() does and I
always assumed that in case of error the content of *sinfo should be
considered "undefined".
I needed this because I saw it is required by some RC algo (only
minstrel) to extract the bitrate starting from the index.
You can check patch 4/6 for this:
+ bitrate = sband->bitrates[mi->r[idx].rix].bitrate;
maybe I can extract it from another structure? I couldn't find any way..
Bit strange that the algorithm doesn't have the band, if it has an
index? but I guess I didn't check all the patches...
I just rechecked, and it looked to me that all the other functions in
Minstreal (non-HT) take the sband as argument.
It is not stored anywhere and therefore it has to be passed as argument
to this new API as well..
A general beautification might be applied to rate_control_ops (and not
only)...but it is out of the scope of this patchset :)
Cheers,
--
Antonio Quartulli