From: Antonio Quartulli antonio@open-mesh.com
Users may need information about the expected throughput towards a given peer computed by the RC algorithm. Export such value in Mbps/100 through the get_station() API. This unit has been chosen because it is the same of the throughput returned by MinstrelHT.
This information will be useful to the batman-adv module which will use it for its new metric computation.
Signed-off-by: Antonio Quartulli antonio@open-mesh.com ---
Changes since the RFC: - Change all the station_info_flags to use BIT() - Properly comment about the unit used by the throughput value - added new ieee80211_ops.get_expected_throughput() API (to support drivers having HW RC) - improved doc about new cfg80211_get_station() function - minor cleanups
include/net/cfg80211.h | 63 ++++++++++++++++++++++++++++---------------------- 1 file changed, 35 insertions(+), 28 deletions(-)
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 9496fe5..d4b85f7 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -862,36 +862,38 @@ int cfg80211_check_station_change(struct wiphy *wiphy, * @STATION_INFO_NONPEER_PM: @nonpeer_pm filled * @STATION_INFO_CHAIN_SIGNAL: @chain_signal filled * @STATION_INFO_CHAIN_SIGNAL_AVG: @chain_signal_avg filled + * @STATION_INFO_EXPECTED_THROUGHPUT: @expected_throughput filled */ enum station_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 = BIT(0), + STATION_INFO_RX_BYTES = BIT(1), + STATION_INFO_TX_BYTES = BIT(2), + STATION_INFO_LLID = BIT(3), + STATION_INFO_PLID = BIT(4), + STATION_INFO_PLINK_STATE = BIT(5), + STATION_INFO_SIGNAL = BIT(6), + STATION_INFO_TX_BITRATE = BIT(7), + STATION_INFO_RX_PACKETS = BIT(8), + STATION_INFO_TX_PACKETS = BIT(9), + STATION_INFO_TX_RETRIES = BIT(10), + STATION_INFO_TX_FAILED = BIT(11), + STATION_INFO_RX_DROP_MISC = BIT(12), + STATION_INFO_SIGNAL_AVG = BIT(13), + STATION_INFO_RX_BITRATE = BIT(14), + STATION_INFO_BSS_PARAM = BIT(15), + STATION_INFO_CONNECTED_TIME = BIT(16), + STATION_INFO_ASSOC_REQ_IES = BIT(17), + STATION_INFO_STA_FLAGS = BIT(18), + STATION_INFO_BEACON_LOSS_COUNT = BIT(19), + STATION_INFO_T_OFFSET = BIT(20), + STATION_INFO_LOCAL_PM = BIT(21), + STATION_INFO_PEER_PM = BIT(22), + STATION_INFO_NONPEER_PM = BIT(23), + STATION_INFO_RX_BYTES64 = BIT(24), + STATION_INFO_TX_BYTES64 = BIT(25), + STATION_INFO_CHAIN_SIGNAL = BIT(26), + STATION_INFO_CHAIN_SIGNAL_AVG = BIT(27), + STATION_INFO_EXPECTED_THROUGHPUT = BIT(28), };
/** @@ -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 in Mbps/100 reported by the RC + * algorithm towards this station. The unit of this value has been chosen + * because it is the same of the throughput returned by MinstrelHT */ struct station_info { u32 filled; @@ -1051,6 +1056,8 @@ struct station_info { enum nl80211_mesh_power_mode peer_pm; enum nl80211_mesh_power_mode nonpeer_pm;
+ u32 expected_throughput; + /* * Note: Add a new enum station_info_flags value for each new field and * use it to check which fields are initialized.
From: Antonio Quartulli antonio@open-mesh.com
Add get_expected_throughput() API to mac80211 so that each driver can implement its own version based on the RC algorithm they are using (might be using an HW RC algo). The API returns a value expressed in Mbps/100. This unit has been chosen because it is the same of the throughput returned by MinstrelHT.
Signed-off-by: Antonio Quartulli antonio@open-mesh.com --- include/net/mac80211.h | 4 ++++ net/mac80211/driver-ops.h | 13 +++++++++++++ net/mac80211/trace.h | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+)
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index a3044e1..0efe37c 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -2761,6 +2761,9 @@ enum ieee80211_roc_type { * information in bss_conf is set up and the beacon can be retrieved. A * channel context is bound before this is called. * @leave_ibss: Leave the IBSS again. + * + * @get_expected_throughput: extract the expected throughput towards the + * specified station. The returned value is expressed in Mbps/100. */ struct ieee80211_ops { void (*tx)(struct ieee80211_hw *hw, @@ -2954,6 +2957,7 @@ struct ieee80211_ops {
int (*join_ibss)(struct ieee80211_hw *hw, struct ieee80211_vif *vif); void (*leave_ibss)(struct ieee80211_hw *hw, struct ieee80211_vif *vif); + u32 (*get_expected_throughput)(struct ieee80211_sta *sta); };
/** diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h index 5331582..84ee6c2 100644 --- a/net/mac80211/driver-ops.h +++ b/net/mac80211/driver-ops.h @@ -1122,4 +1122,17 @@ static inline void drv_leave_ibss(struct ieee80211_local *local, trace_drv_return_void(local); }
+static inline u32 drv_get_expected_throughput(struct ieee80211_local *local, + struct ieee80211_sta *sta) +{ + u32 ret = 0; + + trace_drv_get_expected_throughput(sta); + if (local->ops->get_expected_throughput) + ret = local->ops->get_expected_throughput(sta); + trace_drv_return_u32(local, ret); + + return ret; +} + #endif /* __MAC80211_DRIVER_OPS */ diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h index a0b0aea..942f64b 100644 --- a/net/mac80211/trace.h +++ b/net/mac80211/trace.h @@ -184,6 +184,20 @@ TRACE_EVENT(drv_return_bool, "true" : "false") );
+TRACE_EVENT(drv_return_u32, + TP_PROTO(struct ieee80211_local *local, u32 ret), + TP_ARGS(local, ret), + TP_STRUCT__entry( + LOCAL_ENTRY + __field(u32, ret) + ), + TP_fast_assign( + LOCAL_ASSIGN; + __entry->ret = ret; + ), + TP_printk(LOCAL_PR_FMT " - %u", LOCAL_PR_ARG, __entry->ret) +); + TRACE_EVENT(drv_return_u64, TP_PROTO(struct ieee80211_local *local, u64 ret), TP_ARGS(local, ret), @@ -1499,6 +1513,24 @@ DEFINE_EVENT(local_sdata_evt, drv_leave_ibss, TP_ARGS(local, sdata) );
+TRACE_EVENT(drv_get_expected_throughput, + TP_PROTO(struct ieee80211_sta *sta), + + TP_ARGS(sta), + + TP_STRUCT__entry( + STA_ENTRY + ), + + TP_fast_assign( + STA_ASSIGN; + ), + + TP_printk( + STA_PR_FMT, STA_PR_ARG + ) +); + /* * Tracing for API calls that drivers call. */
* Antonio Quartulli antonio@meshcoding.com [14.04.2014 16:53]:
From: Antonio Quartulli antonio@open-mesh.com
Add get_expected_throughput() API to mac80211 so that each driver can implement its own version based on the RC
Without understanding this fully: thank you.
What is not clear to me: the function returns Mbps/100. Why not simply kilobit/second?
Also: does it return expected_goodput or "only" throughput? Because we want to use this value not internally only it should reflect the real usecase (and should also be human-readable).
For a meshnet it is important to know, that a 10mbit ethernet line is faster than a 60 mbit wireless link with a low tx-probability.
bye, Bastian Bittorf
Hi, Antonio
Do you know whether the calculation of expected throughput in minstrel and minstrel_ht are both the same?
Any explanation on how the expected throughput is calculated?
--- Chun-Yeow
On Mon, Apr 14, 2014 at 10:03 PM, Antonio Quartulli antonio@meshcoding.com wrote:
From: Antonio Quartulli antonio@open-mesh.com
Add get_expected_throughput() API to mac80211 so that each driver can implement its own version based on the RC algorithm they are using (might be using an HW RC algo). The API returns a value expressed in Mbps/100. This unit has been chosen because it is the same of the throughput returned by MinstrelHT.
Signed-off-by: Antonio Quartulli antonio@open-mesh.com
include/net/mac80211.h | 4 ++++ net/mac80211/driver-ops.h | 13 +++++++++++++ net/mac80211/trace.h | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+)
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index a3044e1..0efe37c 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -2761,6 +2761,9 @@ enum ieee80211_roc_type {
information in bss_conf is set up and the beacon can be retrieved. A
channel context is bound before this is called.
- @leave_ibss: Leave the IBSS again.
- @get_expected_throughput: extract the expected throughput towards the
*/
specified station. The returned value is expressed in Mbps/100.
struct ieee80211_ops { void (*tx)(struct ieee80211_hw *hw, @@ -2954,6 +2957,7 @@ struct ieee80211_ops {
int (*join_ibss)(struct ieee80211_hw *hw, struct ieee80211_vif *vif); void (*leave_ibss)(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
u32 (*get_expected_throughput)(struct ieee80211_sta *sta);
};
/** diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h index 5331582..84ee6c2 100644 --- a/net/mac80211/driver-ops.h +++ b/net/mac80211/driver-ops.h @@ -1122,4 +1122,17 @@ static inline void drv_leave_ibss(struct ieee80211_local *local, trace_drv_return_void(local); }
+static inline u32 drv_get_expected_throughput(struct ieee80211_local *local,
struct ieee80211_sta *sta)
+{
u32 ret = 0;
trace_drv_get_expected_throughput(sta);
if (local->ops->get_expected_throughput)
ret = local->ops->get_expected_throughput(sta);
trace_drv_return_u32(local, ret);
return ret;
+}
#endif /* __MAC80211_DRIVER_OPS */ diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h index a0b0aea..942f64b 100644 --- a/net/mac80211/trace.h +++ b/net/mac80211/trace.h @@ -184,6 +184,20 @@ TRACE_EVENT(drv_return_bool, "true" : "false") );
+TRACE_EVENT(drv_return_u32,
TP_PROTO(struct ieee80211_local *local, u32 ret),
TP_ARGS(local, ret),
TP_STRUCT__entry(
LOCAL_ENTRY
__field(u32, ret)
),
TP_fast_assign(
LOCAL_ASSIGN;
__entry->ret = ret;
),
TP_printk(LOCAL_PR_FMT " - %u", LOCAL_PR_ARG, __entry->ret)
+);
TRACE_EVENT(drv_return_u64, TP_PROTO(struct ieee80211_local *local, u64 ret), TP_ARGS(local, ret), @@ -1499,6 +1513,24 @@ DEFINE_EVENT(local_sdata_evt, drv_leave_ibss, TP_ARGS(local, sdata) );
+TRACE_EVENT(drv_get_expected_throughput,
TP_PROTO(struct ieee80211_sta *sta),
TP_ARGS(sta),
TP_STRUCT__entry(
STA_ENTRY
),
TP_fast_assign(
STA_ASSIGN;
),
TP_printk(
STA_PR_FMT, STA_PR_ARG
)
+);
/*
- Tracing for API calls that drivers call.
*/
1.8.3.2
On 18/04/14 02:56, Yeoh Chun-Yeow wrote:
Hi, Antonio
Do you know whether the calculation of expected throughput in minstrel and minstrel_ht are both the same?
not really the same, but they are similar.
Any explanation on how the expected throughput is calculated?
Just check patch 5 and 6 :)
Cheers,
On Mon, 2014-04-14 at 16:03 +0200, Antonio Quartulli wrote:
- u32 (*get_expected_throughput)(struct ieee80211_sta *sta);
This isn't nice - it forces drivers to conjure up a value.
You should probably at least allow returning 0 for "no idea" or something.
johannes
On 25/04/14 17:44, Johannes Berg wrote:
On Mon, 2014-04-14 at 16:03 +0200, Antonio Quartulli wrote:
- u32 (*get_expected_throughput)(struct ieee80211_sta *sta);
This isn't nice - it forces drivers to conjure up a value.
You should probably at least allow returning 0 for "no idea" or something.
Yeah, I think so too. Returning 0 as "I don't know what to provide" should be fine. I will specify this in the doc.
Cheers,
From: Antonio Quartulli antonio@open-mesh.com
In order to make mac80211 export the expected throughput, a new API which extracts such information from any mac80211 SW RC algorithm is needed. Therefore add the new get_expected_throughput() member to the rate_control_ops structure.
The exported value is expressed in Mbps/100. Such unit has been chosen because it is the highest precision that MinstrelHT can return.
Signed-off-by: Antonio Quartulli antonio@open-mesh.com --- include/net/mac80211.h | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 0efe37c..47b891a 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -4480,6 +4480,9 @@ struct rate_control_ops { void (*add_sta_debugfs)(void *priv, void *priv_sta, struct dentry *dir); void (*remove_sta_debugfs)(void *priv, void *priv_sta); + + u32 (*get_expected_throughput)(void *priv, void *priv_sta, + struct ieee80211_supported_band *sband); };
static inline int rate_supported(struct ieee80211_sta *sta,
On Mon, 2014-04-14 at 16:03 +0200, Antonio Quartulli wrote:
From: Antonio Quartulli antonio@open-mesh.com
In order to make mac80211 export the expected throughput, a new API which extracts such information from any mac80211 SW RC algorithm is needed. Therefore add the new get_expected_throughput() member to the rate_control_ops structure.
The exported value is expressed in Mbps/100. Such unit has been chosen because it is the highest precision that MinstrelHT can return.
Same as in patch 2 - and realistically 2/3/4 could just be squashed.
johannes
On 25/04/14 17:45, Johannes Berg wrote:
On Mon, 2014-04-14 at 16:03 +0200, Antonio Quartulli wrote:
From: Antonio Quartulli antonio@open-mesh.com
In order to make mac80211 export the expected throughput, a new API which extracts such information from any mac80211 SW RC algorithm is needed. Therefore add the new get_expected_throughput() member to the rate_control_ops structure.
The exported value is expressed in Mbps/100. Such unit has been chosen because it is the highest precision that MinstrelHT can return.
Same as in patch 2 - and realistically 2/3/4 could just be squashed.
Yeah, I will specify the 0 value as "I don't know what to provide" and I think it is fine to have just one patch.
From: Antonio Quartulli antonio@open-mesh.com
If either the driver or the SW 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 antonio@open-mesh.com --- net/mac80211/cfg.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index aa39381..31d1955 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -472,8 +472,12 @@ static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo) { struct ieee80211_sub_if_data *sdata = sta->sdata; struct ieee80211_local *local = sdata->local; + struct rate_control_ref *ref = local->rate_ctrl; + struct ieee80211_supported_band *sband; + enum ieee80211_band band; struct timespec uptime; u64 packets = 0; + u32 thr = 0; int i, ac;
sinfo->generation = sdata->local->sta_generation; @@ -587,6 +591,23 @@ static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo) sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_ASSOCIATED); if (test_sta_flag(sta, WLAN_STA_TDLS_PEER)) sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_TDLS_PEER); + + /* check if the driver has a SW RC implementation */ + if (ref && ref->ops->get_expected_throughput) { + band = ieee80211_get_sdata_band(sta->sdata); + sband = sta->local->hw.wiphy->bands[band]; + + thr = ref->ops->get_expected_throughput(ref->priv, + sta->rate_ctrl_priv, + sband); + } else { + thr = drv_get_expected_throughput(local, &sta->sta); + } + + if (thr != 0) { + sinfo->filled |= STATION_INFO_EXPECTED_THROUGHPUT; + sinfo->expected_throughput = thr; + } }
static const char ieee80211_gstrings_sta_stats[][ETH_GSTRING_LEN] = {
From: Antonio Quartulli antonio@open-mesh.com
Cc: Felix Fietkau nbd@openwrt.org Signed-off-by: Antonio Quartulli antonio@open-mesh.com --- net/mac80211/rc80211_minstrel.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
diff --git a/net/mac80211/rc80211_minstrel.c b/net/mac80211/rc80211_minstrel.c index 26fd94f..cd40bc0 100644 --- a/net/mac80211/rc80211_minstrel.c +++ b/net/mac80211/rc80211_minstrel.c @@ -657,6 +657,18 @@ minstrel_free(void *priv) kfree(priv); }
+static u32 +minstrel_get_expected_throughput(void *priv, void *priv_sta, + struct ieee80211_supported_band *sband) +{ + struct minstrel_sta_info *mi = priv_sta; + int idx = mi->max_tp_rate[0]; + u32 bitrate, ret; + + bitrate = sband->bitrates[mi->r[idx].rix].bitrate; + return bitrate * MINSTREL_TRUNC(mi->r[idx].probability * 1000) / 100; +} + const struct rate_control_ops mac80211_minstrel = { .name = "minstrel", .tx_status = minstrel_tx_status, @@ -670,6 +682,7 @@ const struct rate_control_ops mac80211_minstrel = { .add_sta_debugfs = minstrel_add_sta_debugfs, .remove_sta_debugfs = minstrel_remove_sta_debugfs, #endif + .get_expected_throughput = minstrel_get_expected_throughput, };
int __init
On Mon, 2014-04-14 at 16:03 +0200, Antonio Quartulli wrote:
From: Antonio Quartulli antonio@open-mesh.com
Cc: Felix Fietkau nbd@openwrt.org Signed-off-by: Antonio Quartulli antonio@open-mesh.com
net/mac80211/rc80211_minstrel.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
diff --git a/net/mac80211/rc80211_minstrel.c b/net/mac80211/rc80211_minstrel.c index 26fd94f..cd40bc0 100644 --- a/net/mac80211/rc80211_minstrel.c +++ b/net/mac80211/rc80211_minstrel.c @@ -657,6 +657,18 @@ minstrel_free(void *priv) kfree(priv); }
+static u32 +minstrel_get_expected_throughput(void *priv, void *priv_sta,
struct ieee80211_supported_band *sband)
+{
- struct minstrel_sta_info *mi = priv_sta;
- int idx = mi->max_tp_rate[0];
- u32 bitrate, ret;
- bitrate = sband->bitrates[mi->r[idx].rix].bitrate;
- return bitrate * MINSTREL_TRUNC(mi->r[idx].probability * 1000) / 100;
/100? didn't you say minstrel already used your units?
johannes
On 25/04/14 17:46, Johannes Berg wrote:
On Mon, 2014-04-14 at 16:03 +0200, Antonio Quartulli wrote:
From: Antonio Quartulli antonio@open-mesh.com
Cc: Felix Fietkau nbd@openwrt.org Signed-off-by: Antonio Quartulli antonio@open-mesh.com
net/mac80211/rc80211_minstrel.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
diff --git a/net/mac80211/rc80211_minstrel.c b/net/mac80211/rc80211_minstrel.c index 26fd94f..cd40bc0 100644 --- a/net/mac80211/rc80211_minstrel.c +++ b/net/mac80211/rc80211_minstrel.c @@ -657,6 +657,18 @@ minstrel_free(void *priv) kfree(priv); }
+static u32 +minstrel_get_expected_throughput(void *priv, void *priv_sta,
struct ieee80211_supported_band *sband)
+{
- struct minstrel_sta_info *mi = priv_sta;
- int idx = mi->max_tp_rate[0];
- u32 bitrate, ret;
- bitrate = sband->bitrates[mi->r[idx].rix].bitrate;
- return bitrate * MINSTREL_TRUNC(mi->r[idx].probability * 1000) / 100;
/100? didn't you say minstrel already used your units?
MinstrelHT does, Minstrel does not...
Cheers,
From: Antonio Quartulli antonio@open-mesh.com
Cc: Felix Fietkau nbd@openwrt.org Signed-off-by: Antonio Quartulli antonio@open-mesh.com --- net/mac80211/rc80211_minstrel_ht.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c index bccaf85..480f657 100644 --- a/net/mac80211/rc80211_minstrel_ht.c +++ b/net/mac80211/rc80211_minstrel_ht.c @@ -1031,6 +1031,24 @@ minstrel_ht_free(void *priv) mac80211_minstrel.free(priv); }
+static u32 +minstrel_ht_get_expected_throughput(void *priv, void *priv_sta, + struct ieee80211_supported_band *sband) +{ + struct minstrel_ht_sta_priv *msp = priv_sta; + struct minstrel_ht_sta *mi = &msp->ht; + int i, j; + + if (!msp->is_ht) + return mac80211_minstrel.get_expected_throughput(priv, priv_sta, + sband); + + i = mi->max_tp_rate / MCS_GROUP_RATES; + j = mi->max_tp_rate % MCS_GROUP_RATES; + + return mi->groups[i].rates[j].cur_tp; +} + static const struct rate_control_ops mac80211_minstrel_ht = { .name = "minstrel_ht", .tx_status = minstrel_ht_tx_status, @@ -1045,6 +1063,7 @@ static const struct rate_control_ops mac80211_minstrel_ht = { .add_sta_debugfs = minstrel_ht_add_sta_debugfs, .remove_sta_debugfs = minstrel_ht_remove_sta_debugfs, #endif + .get_expected_throughput = minstrel_ht_get_expected_throughput, };
From: Antonio Quartulli antonio@open-mesh.com
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 antonio@open-mesh.com --- include/net/cfg80211.h | 13 +++++++++++++ net/wireless/util.c | 18 ++++++++++++++++++ 2 files changed, 31 insertions(+)
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index d4b85f7..c890244 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -1065,6 +1065,19 @@ struct station_info { };
/** + * 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 and sinfo is filled with the available information + * otherwise returns a negative error code and the content of sinfo has to be + * considered undefined. + */ +int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr, + struct station_info *sinfo); + +/** * enum monitor_flags - monitor flags * * Monitor interface configuration flags. Note that these must be the bits diff --git a/net/wireless/util.c b/net/wireless/util.c index d032a31..d84d61a 100644 --- a/net/wireless/util.c +++ b/net/wireless/util.c @@ -1498,6 +1498,24 @@ unsigned int ieee80211_get_num_supported_channels(struct wiphy *wiphy) } EXPORT_SYMBOL(ieee80211_get_num_supported_channels);
+int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr, + struct station_info *sinfo) +{ + struct cfg80211_registered_device *rdev; + struct wireless_dev *wdev; + + wdev = dev->ieee80211_ptr; + if (!wdev) + return -EOPNOTSUPP; + + rdev = wiphy_to_dev(wdev->wiphy); + if (!rdev->ops->get_station) + return -EOPNOTSUPP; + + return rdev_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) */ const unsigned char rfc1042_header[] __aligned(2) =
On Mon, 2014-04-14 at 16:03 +0200, Antonio Quartulli wrote:
From: Antonio Quartulli antonio@open-mesh.com
Users may need information about the expected throughput
I think this "expected throughput" should be a bit clarified.
Are you talking about "expected PHY rate" or rather "expected (payload) throughput"?
towards a given peer computed by the RC algorithm. Export such value in Mbps/100 through the get_station() API.
"units of 10Kbps" might be a better description :-)
This unit has been chosen because it is the same of the throughput returned by MinstrelHT.
Since it's unlikely we'll ever reach the limit of a u32, maybe just multiply by 10 to get the nicer Kbps?
- @expected_throughput: expected throughput in Mbps/100 reported by the RC
- algorithm towards this station. The unit of this value has been chosen
- because it is the same of the throughput returned by MinstrelHT
I think the rationale shouldn't be here now.
johannes
On 25/04/14 17:44, Johannes Berg wrote:
On Mon, 2014-04-14 at 16:03 +0200, Antonio Quartulli wrote:
From: Antonio Quartulli antonio@open-mesh.com
Users may need information about the expected throughput
I think this "expected throughput" should be a bit clarified.
Are you talking about "expected PHY rate" or rather "expected (payload) throughput"?
It is not payload throughput because in this "number" we also consider the bytes being part of the 802.11 Header. Maybe we can call it "expected MAC throughput" ?
towards a given peer computed by the RC algorithm. Export such value in Mbps/100 through the get_station() API.
"units of 10Kbps" might be a better description :-)
This unit has been chosen because it is the same of the throughput returned by MinstrelHT.
Since it's unlikely we'll ever reach the limit of a u32, maybe just multiply by 10 to get the nicer Kbps?
At least we are safe in the near future :) Ok, I can change it to Kbps because it seems that a lot of people will be happier :)
- @expected_throughput: expected throughput in Mbps/100 reported by the RC
- algorithm towards this station. The unit of this value has been chosen
- because it is the same of the throughput returned by MinstrelHT
I think the rationale shouldn't be here now.
I think I will just remove the last sentence.
Thanks a lot!
b.a.t.m.a.n@lists.open-mesh.org