All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] wlcore: Add support for get_expected_throughput opcode
@ 2016-06-30 14:49 Maxim Altshul
  2016-06-30 15:03 ` Johannes Berg
  0 siblings, 1 reply; 2+ messages in thread
From: Maxim Altshul @ 2016-06-30 14:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: Maxim Altshul, Kalle Valo, Eliad Peller, Arik Nemtsov,
	Yaniv Machani, linux-wireless

Adding this opcode, allows the TI wireless driver,
to report throughput directly from FW to mac80211.

This is used mainly for mesh metric calculation.

Signed-off-by: Maxim Altshul <maxim.altshul@ti.com>
---
Changed the units of returned value.
drv_get_expected_throughput returns units of Kbps 
by definition, and thus we must comply as well.
Mbps * 1000 = Kbps.

 drivers/net/wireless/ti/wlcore/main.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c
index 39dec7d..cb1103b 100644
--- a/drivers/net/wireless/ti/wlcore/main.c
+++ b/drivers/net/wireless/ti/wlcore/main.c
@@ -5851,6 +5851,20 @@ out:
 	mutex_unlock(&wl->mutex);
 }
 
+static u32 wlcore_op_get_expected_throughput(struct ieee80211_sta *sta)
+{
+	struct wl1271_station *wl_sta = (struct wl1271_station *)sta->drv_priv;
+	struct wl1271 *wl = wl_sta->wl;
+	u8 hlid = wl_sta->hlid;
+	u32 ret = 0;
+
+	/* return in units of Kbps */
+	if (wl)
+		ret = (wl->links[hlid].fw_rate_mbps * 1000);
+
+	return ret;
+}
+
 static bool wl1271_tx_frames_pending(struct ieee80211_hw *hw)
 {
 	struct wl1271 *wl = hw->priv;
@@ -6051,6 +6065,7 @@ static const struct ieee80211_ops wl1271_ops = {
 	.switch_vif_chanctx = wlcore_op_switch_vif_chanctx,
 	.sta_rc_update = wlcore_op_sta_rc_update,
 	.sta_statistics = wlcore_op_sta_statistics,
+	.get_expected_throughput = wlcore_op_get_expected_throughput,
 	CFG80211_TESTMODE_CMD(wl1271_tm_cmd)
 };
 
-- 
2.9.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] wlcore: Add support for get_expected_throughput opcode
  2016-06-30 14:49 [PATCH v2] wlcore: Add support for get_expected_throughput opcode Maxim Altshul
@ 2016-06-30 15:03 ` Johannes Berg
  0 siblings, 0 replies; 2+ messages in thread
From: Johannes Berg @ 2016-06-30 15:03 UTC (permalink / raw)
  To: Maxim Altshul, linux-kernel
  Cc: Kalle Valo, Eliad Peller, Arik Nemtsov, Yaniv Machani, linux-wireless

On Thu, 2016-06-30 at 17:49 +0300, Maxim Altshul wrote:
> Adding this opcode, allows the TI wireless driver,
> to report throughput directly from FW to mac80211.
> 
> This is used mainly for mesh metric calculation.
> 
> Signed-off-by: Maxim Altshul <maxim.altshul@ti.com>
> ---
> Changed the units of returned value.
> drv_get_expected_throughput returns units of Kbps 
> by definition, and thus we must comply as well.
> Mbps * 1000 = Kbps.
> 
>  drivers/net/wireless/ti/wlcore/main.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/drivers/net/wireless/ti/wlcore/main.c
> b/drivers/net/wireless/ti/wlcore/main.c
> index 39dec7d..cb1103b 100644
> --- a/drivers/net/wireless/ti/wlcore/main.c
> +++ b/drivers/net/wireless/ti/wlcore/main.c
> @@ -5851,6 +5851,20 @@ out:
>  	mutex_unlock(&wl->mutex);
>  }
>  
> +static u32 wlcore_op_get_expected_throughput(struct ieee80211_sta
> *sta)
> +{
> +	struct wl1271_station *wl_sta = (struct wl1271_station
> *)sta->drv_priv;
> +	struct wl1271 *wl = wl_sta->wl;
> +	u8 hlid = wl_sta->hlid;
> +	u32 ret = 0;
> +
> +	/* return in units of Kbps */
> +	if (wl)
> +		ret = (wl->links[hlid].fw_rate_mbps * 1000);
> +
I don't see how wl can ever be NULL?

Also, you can certainly remove the 'ret' variable.

johannes

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-06-30 15:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-30 14:49 [PATCH v2] wlcore: Add support for get_expected_throughput opcode Maxim Altshul
2016-06-30 15:03 ` Johannes Berg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.