From patchwork Thu Jul 18 04:24:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasanthakumar Thiagarajan X-Patchwork-Id: 11048495 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D3EF514F6 for ; Thu, 18 Jul 2019 04:24:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C218328797 for ; Thu, 18 Jul 2019 04:24:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B6275287A4; Thu, 18 Jul 2019 04:24:36 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 518A128797 for ; Thu, 18 Jul 2019 04:24:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date:Subject:To: From:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=ZCMpy+dItmXT/jhrtP/yXyZWRHGZHXIXNI0Ynlc+mk0=; b=OvpbtgSYEzdILW zzCAALWFkTDUYTILsTvY8+yge0wilmdsNXdx3n3UKBwYiGUX+2dX9j9D09rvq1Xn3xhChrbv25ffI BqC2Erw/KEkNRa8r71v/Q2Seytu7cz9l0Fqlr97QX4uAIghKeo91qGddZsmtFDnmUELAtnCXAiUVk HflAfFB+ONhYheFI93QKF4gCoobRfUshK1uNiWBvlm1/6yqQVNWHk7lgwz4+MmfmfF1UiVIMN8Bff z5D5ijpazo07+uW8ebyaWX14bWHEXRKF/3TBv46JRvADZAQq44ga9bcYDv7BL81iVtXXM4sFr+XuI nepzI5PVzJskI4fV3CpA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hnxy5-0006ME-Lf; Thu, 18 Jul 2019 04:24:33 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hnxy2-0006LX-Vf for ath11k@lists.infradead.org; Thu, 18 Jul 2019 04:24:32 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 86FEB60E5C; Thu, 18 Jul 2019 04:24:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1563423869; bh=1dJI8q23AbO1mFS8PwtxpPdNZRLEuNgCBsKkZ5M0D/g=; h=From:To:Subject:Date:From; b=BurTiKKB/r/V1sVg7r0+LXyB6nN0dkJmV9+nYKAVz3QbdSv5AoDrWrNGpqUNuZwMK ll/PqmI2cJx0V+5Dry1o38HC1akG9stKJCwYnYYUNQJDbcjqNLTvq/zKznXdhb9UNE tHtSq8L0htV9RWeKMLKwlN/7rsFly3s5ugMvNFjE= Received: from vasanth-lnx.qca.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: vthiagar@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 79C3A609CD for ; Thu, 18 Jul 2019 04:24:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1563423869; bh=1dJI8q23AbO1mFS8PwtxpPdNZRLEuNgCBsKkZ5M0D/g=; h=From:To:Subject:Date:From; b=BurTiKKB/r/V1sVg7r0+LXyB6nN0dkJmV9+nYKAVz3QbdSv5AoDrWrNGpqUNuZwMK ll/PqmI2cJx0V+5Dry1o38HC1akG9stKJCwYnYYUNQJDbcjqNLTvq/zKznXdhb9UNE tHtSq8L0htV9RWeKMLKwlN/7rsFly3s5ugMvNFjE= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 79C3A609CD Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=vthiagar@codeaurora.org From: Vasanthakumar Thiagarajan To: ath11k@lists.infradead.org Subject: [PATCH 1/2] ath11k/hal: Fix few bugs in ath11k_hal_srng_dst_num_free() Date: Thu, 18 Jul 2019 09:54:14 +0530 Message-Id: <1563423855-32397-1-git-send-email-vthiagar@codeaurora.org> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190717_212431_056716_C2C2482B X-CRM114-Status: GOOD ( 11.76 ) X-BeenThere: ath11k@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "ath11k" Errors-To: ath11k-bounces+patchwork-ath11k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The logic to compute the number of available buffers in destination ring is wrong. It should be just the different between head and tail pointers in terms of the entry size. This functions currently unused, this is fixed to make use of this function in follow-up patches. Also make destination ring head pointer volatile because it is independently updated by HW. Signed-off-by: Vasanthakumar Thiagarajan --- drivers/net/wireless/ath/ath11k/hal.c | 7 +++---- drivers/net/wireless/ath/ath11k/hal.h | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/hal.c b/drivers/net/wireless/ath/ath11k/hal.c index 7da42a1..9eac311 100644 --- a/drivers/net/wireless/ath/ath11k/hal.c +++ b/drivers/net/wireless/ath/ath11k/hal.c @@ -745,9 +745,9 @@ int ath11k_hal_srng_dst_num_free(struct ath11k_base *ab, struct hal_srng *srng, } if (hp >= tp) - return ((hp - tp) / srng->entry_size) - 1; + return (hp - tp) / srng->entry_size; else - return ((srng->ring_size - tp + hp) / srng->entry_size) - 1; + return (srng->ring_size - tp + hp) / srng->entry_size; } /* Returns number of available entries in src ring */ @@ -862,8 +862,7 @@ void ath11k_hal_srng_access_begin(struct ath11k_base *ab, struct hal_srng *srng) srng->u.src_ring.cached_tp = *(volatile u32 *)srng->u.src_ring.tp_addr; else - srng->u.dst_ring.cached_hp = - *(volatile u32 *)srng->u.dst_ring.hp_addr; + srng->u.dst_ring.cached_hp = *srng->u.dst_ring.hp_addr; } /* Update cached ring head/tail pointers to HW. ath11k_hal_srng_access_begin() diff --git a/drivers/net/wireless/ath/ath11k/hal.h b/drivers/net/wireless/ath/ath11k/hal.h index a1e917e..d580acf 100644 --- a/drivers/net/wireless/ath/ath11k/hal.h +++ b/drivers/net/wireless/ath/ath11k/hal.h @@ -538,7 +538,7 @@ struct hal_srng { u32 tp; /* Shadow head pointer location to be updated by HW */ - u32 *hp_addr; + volatile u32 *hp_addr; /* Cached head pointer */ u32 cached_hp;