linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Maxim Altshul <maxim.altshul@ti.com>
To: <johannes@sipsolutions.net>, <kvalo@codeaurora.org>
Cc: <eliad@wizery.com>, <yanivma@ti.com>, <guym@ti.com>,
	<arik@wizery.com>, <linux-wireless@vger.kernel.org>,
	<netdev@vger.kernel.org>, <davem@davemloft.net>,
	Maxim Altshul <maxim.altshul@ti.com>
Subject: [PATCH 3/3] mac80211: mesh: Add support for HW RC implementation
Date: Mon, 20 Jun 2016 16:00:22 +0300	[thread overview]
Message-ID: <1466427622-5953-4-git-send-email-maxim.altshul@ti.com> (raw)
In-Reply-To: <1466427622-5953-3-git-send-email-maxim.altshul@ti.com>

Mesh HWMP module will be able to rely on the HW
RC algorithm if it exists, for path metric calculations.

This allows the metric calculation mechanism to calculate
a correct metric, based on PER and last TX rate both via
HW RC algorithm if it exists or via parameters collected
by the SW.

Signed-off-by: Maxim Altshul <maxim.altshul@ti.com>
---
 net/mac80211/mesh_hwmp.c | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c
index c6be0b4..e3ce40d 100644
--- a/net/mac80211/mesh_hwmp.c
+++ b/net/mac80211/mesh_hwmp.c
@@ -12,6 +12,7 @@
 #include <asm/unaligned.h>
 #include "wme.h"
 #include "mesh.h"
+#include "driver-ops.h"
 
 #define TEST_FRAME_LEN	8192
 #define MAX_METRIC	0xffffffff
@@ -322,19 +323,25 @@ static u32 airtime_link_metric_get(struct ieee80211_local *local,
 	int device_constant = 1 << ARITH_SHIFT;
 	int test_frame_len = TEST_FRAME_LEN << ARITH_SHIFT;
 	int s_unit = 1 << ARITH_SHIFT;
-	int rate, err;
+	int rate, err = 0;
 	u32 tx_time, estimated_retx;
 	u64 result;
 
-	if (sta->mesh->fail_avg >= 100)
-		return MAX_METRIC;
+	/* try to get rate based on HW RC algorithm */
+	rate = drv_get_expected_throughput(local, &sta->sta);
 
-	sta_set_rate_info_tx(sta, &sta->tx_stats.last_rate, &rinfo);
-	rate = cfg80211_calculate_bitrate(&rinfo);
-	if (WARN_ON(!rate))
-		return MAX_METRIC;
+	/* if HW does not provide us with a rate */
+	if (!rate) {
+		if (sta->mesh->fail_avg >= 100)
+			return MAX_METRIC;
 
-	err = (sta->mesh->fail_avg << ARITH_SHIFT) / 100;
+		sta_set_rate_info_tx(sta, &sta->tx_stats.last_rate, &rinfo);
+		rate = cfg80211_calculate_bitrate(&rinfo);
+		if (WARN_ON(!rate))
+			return MAX_METRIC;
+
+		err = (sta->mesh->fail_avg << ARITH_SHIFT) / 100;
+	}
 
 	/* bitrate is in units of 100 Kbps, while we need rate in units of
 	 * 1Mbps. This will be corrected on tx_time computation.
-- 
2.7.2


  reply	other threads:[~2016-06-20 13:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-20 13:00 [PATCH 0/3] *** Mesh Path Selection Metric Calculation *** Maxim Altshul
2016-06-20 13:00 ` [PATCH 1/3] wlcore/wl18xx: Add functionality to accept TX rate per link Maxim Altshul
2016-06-20 13:00   ` [PATCH 2/3] wlcore: Add support for get_expected_throughput opcode Maxim Altshul
2016-06-20 13:00     ` Maxim Altshul [this message]
2016-06-21  9:18       ` [PATCH 3/3] mac80211: mesh: Add support for HW RC implementation Johannes Berg
2016-06-21  0:10 ` [PATCH 0/3] *** Mesh Path Selection Metric Calculation *** Peter Oh
2016-06-21  6:18   ` Kalle Valo
2016-06-21 12:19 ` Bob Copeland
2016-06-21 12:23   ` Machani, Yaniv

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1466427622-5953-4-git-send-email-maxim.altshul@ti.com \
    --to=maxim.altshul@ti.com \
    --cc=arik@wizery.com \
    --cc=davem@davemloft.net \
    --cc=eliad@wizery.com \
    --cc=guym@ti.com \
    --cc=johannes@sipsolutions.net \
    --cc=kvalo@codeaurora.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=yanivma@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).