From patchwork Mon Jun 20 13:00:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Altshul X-Patchwork-Id: 9187355 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9FBFC6075F for ; Mon, 20 Jun 2016 13:01:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8ACFF271FD for ; Mon, 20 Jun 2016 13:01:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7F8A02787D; Mon, 20 Jun 2016 13:01:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 92217271FD for ; Mon, 20 Jun 2016 13:01:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753275AbcFTNAr (ORCPT ); Mon, 20 Jun 2016 09:00:47 -0400 Received: from comal.ext.ti.com ([198.47.26.152]:40483 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752320AbcFTNAD (ORCPT ); Mon, 20 Jun 2016 09:00:03 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id u5KCwXBF003322; Mon, 20 Jun 2016 07:58:33 -0500 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id u5KCxCAq029382; Mon, 20 Jun 2016 07:59:12 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.3.294.0; Mon, 20 Jun 2016 07:59:11 -0500 Received: from wlsrv.emea.dhcp.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id u5KCx3R7013242; Mon, 20 Jun 2016 07:59:10 -0500 From: Maxim Altshul To: , CC: , , , , , , , Maxim Altshul Subject: [PATCH 3/3] mac80211: mesh: Add support for HW RC implementation Date: Mon, 20 Jun 2016 16:00:22 +0300 Message-ID: <1466427622-5953-4-git-send-email-maxim.altshul@ti.com> X-Mailer: git-send-email 2.7.2 In-Reply-To: <1466427622-5953-3-git-send-email-maxim.altshul@ti.com> References: <1466427622-5953-1-git-send-email-maxim.altshul@ti.com> <1466427622-5953-2-git-send-email-maxim.altshul@ti.com> <1466427622-5953-3-git-send-email-maxim.altshul@ti.com> MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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 #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.