Skip to content
Permalink
Browse files

Added code to report noise floor.

Signed-off-by: David Lin <dlin@marvell.com>
  • Loading branch information
yuhhaurlin committed Jul 7, 2017
1 parent cf6a8e8 commit 5599a72a5eda8fbdc4188ed3d18c7dd5fb54b4cb
Showing with 31 additions and 2 deletions.
  1. +13 −2 hif/pcie/dev.h
  2. +18 −0 hif/pcie/pcie.c
@@ -434,6 +434,14 @@ enum { /* Type of Key */
#define RXINFO_HT_SIG2_MASK 0x3FFFF
#define RXINFO_RATE_SHIFT 24
#define RXINFO_RATE_MASK 0xFF
#define RXINFO_NF_A_SHIFT 12
#define RXINFO_NF_A_MASK 0xFFF
#define RXINFO_NF_B_SHIFT 0
#define RXINFO_NF_B_MASK 0xFFF
#define RXINFO_NF_C_SHIFT 12
#define RXINFO_NF_C_MASK 0xFFF
#define RXINFO_NF_D_SHIFT 0
#define RXINFO_NF_D_MASK 0xFFF
#define RXINFO_PARAM_SHIFT 0
#define RXINFO_PARAM_MASK 0xFFFFFF

@@ -443,9 +451,12 @@ struct rx_info { /* HW Rx buffer */
__le32 reserved1[2];
__le32 ht_sig1;
__le32 ht_sig2_rate;
__le32 reserved2[14];
__le32 reserved2[6];
__le32 nf_a_b;
__le32 nf_c_d;
__le32 reserved3[6];
__le32 param;
__le32 reserved3[2];
__le32 reserved4[2];
__le32 hdr[0]; /* Len from HW includes rx_info w/ hdr */
} __packed;

@@ -998,6 +998,7 @@ static void pcie_process_account(struct ieee80211_hw *hw)
struct acnt_rx_s *acnt_rx;
struct pcie_dma_data *dma_data;
struct mwl_sta *sta_info;
u16 nf_a, nf_b, nf_c, nf_d;

acnt_head = readl(pcie_priv->iobase1 + MACREG_REG_ACNTHEAD);
acnt_tail = readl(pcie_priv->iobase1 + MACREG_REG_ACNTTAIL);
@@ -1033,6 +1034,23 @@ static void pcie_process_account(struct ieee80211_hw *hw)
break;
case ACNT_CODE_RX_PPDU:
acnt_rx = (struct acnt_rx_s *)pstart;
nf_a = (le32_to_cpu(acnt_rx->rx_info.nf_a_b) >>
RXINFO_NF_A_SHIFT) & RXINFO_NF_A_MASK;
nf_b = (le32_to_cpu(acnt_rx->rx_info.nf_a_b) >>
RXINFO_NF_B_SHIFT) & RXINFO_NF_B_MASK;
nf_c = (le32_to_cpu(acnt_rx->rx_info.nf_c_d) >>
RXINFO_NF_C_SHIFT) & RXINFO_NF_C_MASK;
nf_d = (le32_to_cpu(acnt_rx->rx_info.nf_c_d) >>
RXINFO_NF_D_SHIFT) & RXINFO_NF_D_MASK;
if ((nf_a >= 2048) && (nf_b >= 2048) &&
(nf_c >= 2048) && (nf_d >= 2048)) {
nf_a = ((4096 - nf_a) >> 4);
nf_b = ((4096 - nf_b) >> 4);
nf_c = ((4096 - nf_c) >> 4);
nf_d = ((4096 - nf_d) >> 4);
priv->noise =
-((nf_a + nf_b + nf_c + nf_d) / 4);
}
dma_data = (struct pcie_dma_data *)
&acnt_rx->rx_info.hdr[0];
sta_info = utils_find_sta(priv, dma_data->wh.addr2);

0 comments on commit 5599a72

Please sign in to comment.
You can’t perform that action at this time.