2015-05-31 09:35:56

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 1/9] staging: vt6655: implement ieee80211_low_level_stats

Collect low level stats from mib counter for mac80211 call.

Replacing the unused function STAvUpdate802_11Counter.

Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6655/device.h | 2 ++
drivers/staging/vt6655/device_main.c | 24 +++++++++++++++++++++---
2 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/vt6655/device.h b/drivers/staging/vt6655/device.h
index 440537e4..a49c6c6 100644
--- a/drivers/staging/vt6655/device.h
+++ b/drivers/staging/vt6655/device.h
@@ -410,6 +410,8 @@ struct vnt_private {
unsigned char abyEEPROM[EEP_MAX_CONTEXT_SIZE]; /* unsigned long alignment */

unsigned short wBeaconInterval;
+
+ struct ieee80211_low_level_stats low_stats;
};

static inline PDEVICE_RD_INFO alloc_rd_info(void)
diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c
index 8f96cc9..c27f5ef 100644
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -1056,8 +1056,9 @@ static void vnt_check_bb_vga(struct vnt_private *priv)
static irqreturn_t device_intr(int irq, void *dev_instance)
{
struct vnt_private *pDevice = dev_instance;
+ struct ieee80211_low_level_stats *low_stats = &pDevice->low_stats;
int max_count = 0;
- unsigned long dwMIBCounter = 0;
+ u32 mib_counter;
unsigned char byOrgPageSel = 0;
int handled = 0;
unsigned long flags;
@@ -1084,14 +1085,20 @@ static irqreturn_t device_intr(int irq, void *dev_instance)
else
byOrgPageSel = 0;

- MACvReadMIBCounter(pDevice->PortOffset, &dwMIBCounter);
+ /* Read low level stats */
+ MACvReadMIBCounter(pDevice->PortOffset, &mib_counter);
+
+ low_stats->dot11RTSSuccessCount += mib_counter & 0xff;
+ low_stats->dot11RTSFailureCount += (mib_counter >> 8) & 0xff;
+ low_stats->dot11ACKFailureCount += (mib_counter >> 16) & 0xff;
+ low_stats->dot11FCSErrorCount += (mib_counter >> 24) & 0xff;
+
/*
* TBD....
* Must do this after doing rx/tx, cause ISR bit is slow
* than RD/TD write back
* update ISR counter
*/
- STAvUpdate802_11Counter(&pDevice->s802_11Counter, &pDevice->scStatistic, dwMIBCounter);
while (pDevice->dwIsr && pDevice->vif) {
STAvUpdateIsrStatCounter(&pDevice->scStatistic, pDevice->dwIsr);
MACvWriteISR(pDevice->PortOffset, pDevice->dwIsr);
@@ -1604,6 +1611,16 @@ static int vnt_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
return 0;
}

+static int vnt_get_stats(struct ieee80211_hw *hw,
+ struct ieee80211_low_level_stats *stats)
+{
+ struct vnt_private *priv = hw->priv;
+
+ memcpy(stats, &priv->low_stats, sizeof(*stats));
+
+ return 0;
+}
+
static u64 vnt_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
{
struct vnt_private *priv = hw->priv;
@@ -1641,6 +1658,7 @@ static const struct ieee80211_ops vnt_mac_ops = {
.prepare_multicast = vnt_prepare_multicast,
.configure_filter = vnt_configure,
.set_key = vnt_set_key,
+ .get_stats = vnt_get_stats,
.get_tsf = vnt_get_tsf,
.set_tsf = vnt_set_tsf,
.reset_tsf = vnt_reset_tsf,
--
2.1.4



2015-05-31 09:36:10

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 9/9] staging: vt6655: device_rx_srv check sk_buff is NULL

There is a small chance that pRD->pRDInfo->skb could go NULL
while the interrupt is processing.

Put NULL check on loop to break out.

Signed-off-by: Malcolm Priestley <[email protected]>
Cc: <[email protected]>
---
drivers/staging/vt6655/device_main.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c
index aec3cce..8dbde24 100644
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -805,6 +805,10 @@ static int device_rx_srv(struct vnt_private *pDevice, unsigned int uIdx)
pRD = pRD->next) {
if (works++ > 15)
break;
+
+ if (!pRD->pRDInfo->skb)
+ break;
+
if (vnt_receive_frame(pDevice, pRD)) {
if (!device_alloc_rx_buf(pDevice, pRD)) {
dev_err(&pDevice->pcid->dev,
--
2.1.4


2015-05-31 09:35:59

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 3/9] staging: vt6655: Remove call to STAvUpdateIsrStatCounter.

This function does not provide any data to users.

Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6655/device.h | 2 --
drivers/staging/vt6655/device_main.c | 1 -
2 files changed, 3 deletions(-)

diff --git a/drivers/staging/vt6655/device.h b/drivers/staging/vt6655/device.h
index a49c6c6..62e07f5 100644
--- a/drivers/staging/vt6655/device.h
+++ b/drivers/staging/vt6655/device.h
@@ -286,8 +286,6 @@ struct vnt_private {
unsigned char abyCurrentNetAddr[ETH_ALEN]; __aligned(2)
bool bLinkPass; /* link status: OK or fail */

- /* Adapter statistics */
- SStatCounter scStatistic;
/* 802.11 counter */
SDot11Counters s802_11Counter;

diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c
index c27f5ef..31f4ec7 100644
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -1100,7 +1100,6 @@ static irqreturn_t device_intr(int irq, void *dev_instance)
* update ISR counter
*/
while (pDevice->dwIsr && pDevice->vif) {
- STAvUpdateIsrStatCounter(&pDevice->scStatistic, pDevice->dwIsr);
MACvWriteISR(pDevice->PortOffset, pDevice->dwIsr);

if (pDevice->dwIsr & ISR_FETALERR) {
--
2.1.4


2015-05-31 09:36:09

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 8/9] staging: vt6655: replace and resize dwIsr

dwIsr is not used outside vnt_interrupt_process and should
be u32.

Move to function and resize to u32.

Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6655/device.h | 1 -
drivers/staging/vt6655/device_main.c | 33 +++++++++++++++++----------------
2 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/vt6655/device.h b/drivers/staging/vt6655/device.h
index b928c2a..5cf1b33 100644
--- a/drivers/staging/vt6655/device.h
+++ b/drivers/staging/vt6655/device.h
@@ -238,7 +238,6 @@ struct vnt_private {
CHIP_TYPE chip_id;

void __iomem *PortOffset;
- unsigned long dwIsr;
u32 memaddr;
u32 ioaddr;
u32 io_size;
diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c
index 575ba87..aec3cce 100644
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -1056,15 +1056,16 @@ static void vnt_interrupt_process(struct vnt_private *priv)
struct ieee80211_low_level_stats *low_stats = &priv->low_stats;
int max_count = 0;
u32 mib_counter;
+ u32 isr;
unsigned long flags;

- MACvReadISR(priv->PortOffset, &priv->dwIsr);
+ MACvReadISR(priv->PortOffset, &isr);

- if (priv->dwIsr == 0)
+ if (isr == 0)
return;

- if (priv->dwIsr == 0xffffffff) {
- pr_debug("dwIsr = 0xffff\n");
+ if (isr == 0xffffffff) {
+ pr_debug("isr = 0xffff\n");
return;
}

@@ -1086,18 +1087,18 @@ static void vnt_interrupt_process(struct vnt_private *priv)
* than RD/TD write back
* update ISR counter
*/
- while (priv->dwIsr && priv->vif) {
- MACvWriteISR(priv->PortOffset, priv->dwIsr);
+ while (isr && priv->vif) {
+ MACvWriteISR(priv->PortOffset, isr);

- if (priv->dwIsr & ISR_FETALERR) {
+ if (isr & ISR_FETALERR) {
pr_debug(" ISR_FETALERR\n");
VNSvOutPortB(priv->PortOffset + MAC_REG_SOFTPWRCTL, 0);
VNSvOutPortW(priv->PortOffset +
MAC_REG_SOFTPWRCTL, SOFTPWRCTL_SWPECTI);
- device_error(priv, priv->dwIsr);
+ device_error(priv, isr);
}

- if (priv->dwIsr & ISR_TBTT) {
+ if (isr & ISR_TBTT) {
if (priv->op_mode != NL80211_IFTYPE_ADHOC)
vnt_check_bb_vga(priv);

@@ -1116,7 +1117,7 @@ static void vnt_interrupt_process(struct vnt_private *priv)

}

- if (priv->dwIsr & ISR_BNTX) {
+ if (isr & ISR_BNTX) {
if (priv->op_mode == NL80211_IFTYPE_ADHOC) {
priv->bIsBeaconBufReadySet = false;
priv->cbBeaconBufReadySetCnt = 0;
@@ -1125,19 +1126,19 @@ static void vnt_interrupt_process(struct vnt_private *priv)
priv->bBeaconSent = true;
}

- if (priv->dwIsr & ISR_RXDMA0)
+ if (isr & ISR_RXDMA0)
max_count += device_rx_srv(priv, TYPE_RXDMA0);

- if (priv->dwIsr & ISR_RXDMA1)
+ if (isr & ISR_RXDMA1)
max_count += device_rx_srv(priv, TYPE_RXDMA1);

- if (priv->dwIsr & ISR_TXDMA0)
+ if (isr & ISR_TXDMA0)
max_count += device_tx_srv(priv, TYPE_TXDMA0);

- if (priv->dwIsr & ISR_AC0DMA)
+ if (isr & ISR_AC0DMA)
max_count += device_tx_srv(priv, TYPE_AC0DMA);

- if (priv->dwIsr & ISR_SOFTTIMER1) {
+ if (isr & ISR_SOFTTIMER1) {
if (priv->vif->bss_conf.enable_beacon)
vnt_beacon_make(priv, priv->vif);
}
@@ -1148,7 +1149,7 @@ static void vnt_interrupt_process(struct vnt_private *priv)
ieee80211_queue_stopped(priv->hw, 0))
ieee80211_wake_queues(priv->hw);

- MACvReadISR(priv->PortOffset, &priv->dwIsr);
+ MACvReadISR(priv->PortOffset, &isr);

MACvReceive0(priv->PortOffset);
MACvReceive1(priv->PortOffset);
--
2.1.4


2015-05-31 09:36:04

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 5/9] staging: vt6655: use workqueue for interrupt handling

Introduce vnt_interrupt to handle interrupt and use workqueue
to queue and queue on vif.

Convert device_intr to void call vnt_interrupt_process
from vnt_interrupt_work providing vif is valid.

This removes troublesome heavy code from the interupt handler and
allows to remove atomic from other areas of driver.

Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6655/device.h | 2 ++
drivers/staging/vt6655/device_main.c | 36 ++++++++++++++++++++++++++----------
2 files changed, 28 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/vt6655/device.h b/drivers/staging/vt6655/device.h
index e9c4bf3..b928c2a 100644
--- a/drivers/staging/vt6655/device.h
+++ b/drivers/staging/vt6655/device.h
@@ -405,6 +405,8 @@ struct vnt_private {

unsigned short wBeaconInterval;

+ struct work_struct interrupt_work;
+
struct ieee80211_low_level_stats low_stats;
};

diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c
index 31f4ec7..d5f090f 100644
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -32,7 +32,6 @@
* device_free_info - device structure resource free function
* device_get_pci_info - get allocated pci io/mem resource
* device_print_info - print out resource
- * device_intr - interrupt handle function
* device_rx_srv - rx service function
* device_alloc_rx_buf - rx buffer pre-allocated function
* device_free_tx_buf - free tx buffer function
@@ -148,7 +147,6 @@ static void vt6655_init_info(struct pci_dev *pcid,
static void device_free_info(struct vnt_private *pDevice);
static bool device_get_pci_info(struct vnt_private *, struct pci_dev *pcid);
static void device_print_info(struct vnt_private *pDevice);
-static irqreturn_t device_intr(int irq, void *dev_instance);

#ifdef CONFIG_PM
static int device_notify_reboot(struct notifier_block *, unsigned long event, void *ptr);
@@ -1053,27 +1051,24 @@ static void vnt_check_bb_vga(struct vnt_private *priv)
}
}

-static irqreturn_t device_intr(int irq, void *dev_instance)
+static void vnt_interrupt_process(struct vnt_private *pDevice)
{
- struct vnt_private *pDevice = dev_instance;
struct ieee80211_low_level_stats *low_stats = &pDevice->low_stats;
int max_count = 0;
u32 mib_counter;
unsigned char byOrgPageSel = 0;
- int handled = 0;
unsigned long flags;

MACvReadISR(pDevice->PortOffset, &pDevice->dwIsr);

if (pDevice->dwIsr == 0)
- return IRQ_RETVAL(handled);
+ return;

if (pDevice->dwIsr == 0xffffffff) {
pr_debug("dwIsr = 0xffff\n");
- return IRQ_RETVAL(handled);
+ return;
}

- handled = 1;
MACvIntDisable(pDevice->PortOffset);

spin_lock_irqsave(&pDevice->lock, flags);
@@ -1175,8 +1170,25 @@ static irqreturn_t device_intr(int irq, void *dev_instance)
spin_unlock_irqrestore(&pDevice->lock, flags);

MACvIntEnable(pDevice->PortOffset, IMR_MASK_VALUE);
+}
+
+static void vnt_interrupt_work(struct work_struct *work)
+{
+ struct vnt_private *priv =
+ container_of(work, struct vnt_private, interrupt_work);
+
+ if (priv->vif)
+ vnt_interrupt_process(priv);
+}
+
+static irqreturn_t vnt_interrupt(int irq, void *arg)
+{
+ struct vnt_private *priv = arg;

- return IRQ_RETVAL(handled);
+ if (priv->vif)
+ schedule_work(&priv->interrupt_work);
+
+ return IRQ_HANDLED;
}

static int vnt_tx_packet(struct vnt_private *priv, struct sk_buff *skb)
@@ -1268,7 +1280,7 @@ static int vnt_start(struct ieee80211_hw *hw)
if (!device_init_rings(priv))
return -ENOMEM;

- ret = request_irq(priv->pcid->irq, &device_intr,
+ ret = request_irq(priv->pcid->irq, &vnt_interrupt,
IRQF_SHARED, "vt6655", priv);
if (ret) {
dev_dbg(&priv->pcid->dev, "failed to start irq\n");
@@ -1297,6 +1309,8 @@ static void vnt_stop(struct ieee80211_hw *hw)

ieee80211_stop_queues(hw);

+ cancel_work_sync(&priv->interrupt_work);
+
MACbShutdown(priv->PortOffset);
MACbSoftwareReset(priv->PortOffset);
CARDbRadioPowerOff(priv);
@@ -1783,6 +1797,8 @@ vt6655_probe(struct pci_dev *pcid, const struct pci_device_id *ent)
return -ENODEV;
}

+ INIT_WORK(&priv->interrupt_work, vnt_interrupt_work);
+
/* do reset */
if (!MACbSoftwareReset(priv->PortOffset)) {
dev_err(&pcid->dev, ": Failed to access MAC hardware..\n");
--
2.1.4


2015-05-31 09:36:02

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 4/9] staging: vt6655: remove mib.c/h dead code.

Remove from makefile and dead variables

Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6655/Makefile | 1 -
drivers/staging/vt6655/device.h | 4 --
drivers/staging/vt6655/mib.c | 112 ----------------------------------------
drivers/staging/vt6655/mib.h | 76 ---------------------------
4 files changed, 193 deletions(-)
delete mode 100644 drivers/staging/vt6655/mib.c
delete mode 100644 drivers/staging/vt6655/mib.h

diff --git a/drivers/staging/vt6655/Makefile b/drivers/staging/vt6655/Makefile
index 115b951..d55c3ba 100644
--- a/drivers/staging/vt6655/Makefile
+++ b/drivers/staging/vt6655/Makefile
@@ -11,7 +11,6 @@ vt6655_stage-y += device_main.o \
dpc.o \
power.o \
srom.o \
- mib.o \
key.o \
rf.o

diff --git a/drivers/staging/vt6655/device.h b/drivers/staging/vt6655/device.h
index 62e07f5..e9c4bf3 100644
--- a/drivers/staging/vt6655/device.h
+++ b/drivers/staging/vt6655/device.h
@@ -68,7 +68,6 @@

#include "device_cfg.h"
#include "card.h"
-#include "mib.h"
#include "srom.h"
#include "desc.h"
#include "key.h"
@@ -286,9 +285,6 @@ struct vnt_private {
unsigned char abyCurrentNetAddr[ETH_ALEN]; __aligned(2)
bool bLinkPass; /* link status: OK or fail */

- /* 802.11 counter */
- SDot11Counters s802_11Counter;
-
unsigned int uCurrRSSI;
unsigned char byCurrSQ;

diff --git a/drivers/staging/vt6655/mib.c b/drivers/staging/vt6655/mib.c
deleted file mode 100644
index e9d23a7..0000000
--- a/drivers/staging/vt6655/mib.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * File: mib.c
- *
- * Purpose: Implement MIB Data Structure
- *
- * Author: Tevin Chen
- *
- * Date: May 21, 1996
- *
- * Functions:
- * STAvUpdateIstStatCounter - Update ISR statistic counter
- * STAvUpdate802_11Counter - Update 802.11 mib counter
- *
- * Revision History:
- *
- */
-
-#include "mac.h"
-#include "mib.h"
-
-/*--------------------- Static Classes ----------------------------*/
-
-/*--------------------- Static Variables --------------------------*/
-
-/*--------------------- Static Functions --------------------------*/
-
-/*--------------------- Export Variables --------------------------*/
-
-/*--------------------- Export Functions --------------------------*/
-
-/*
- * Description: Update Isr Statistic Counter
- *
- * Parameters:
- * In:
- * pStatistic - Pointer to Statistic Counter Data Structure
- * wisr - Interrupt status
- * Out:
- * none
- *
- * Return Value: none
- *
- */
-void STAvUpdateIsrStatCounter(PSStatCounter pStatistic, unsigned long dwIsr)
-{
- /**********************/
- /* ABNORMAL interrupt */
- /**********************/
- /* not any IMR bit invoke irq */
-
- if (dwIsr == 0) {
- pStatistic->ISRStat.dwIsrUnknown++;
- return;
- }
-
-/* Added by Kyle */
- if (dwIsr & ISR_TXDMA0) /* ISR, bit0 */
- pStatistic->ISRStat.dwIsrTx0OK++; /* TXDMA0 successful */
-
- if (dwIsr & ISR_AC0DMA) /* ISR, bit1 */
- pStatistic->ISRStat.dwIsrAC0TxOK++; /* AC0DMA successful */
-
- if (dwIsr & ISR_BNTX) /* ISR, bit2 */
- pStatistic->ISRStat.dwIsrBeaconTxOK++; /* BeaconTx successful */
-
- if (dwIsr & ISR_RXDMA0) /* ISR, bit3 */
- pStatistic->ISRStat.dwIsrRx0OK++; /* Rx0 successful */
-
- if (dwIsr & ISR_TBTT) /* ISR, bit4 */
- pStatistic->ISRStat.dwIsrTBTTInt++; /* TBTT successful */
-
- if (dwIsr & ISR_SOFTTIMER) /* ISR, bit6 */
- pStatistic->ISRStat.dwIsrSTIMERInt++;
-
- if (dwIsr & ISR_WATCHDOG) /* ISR, bit7 */
- pStatistic->ISRStat.dwIsrWatchDog++;
-
- if (dwIsr & ISR_FETALERR) /* ISR, bit8 */
- pStatistic->ISRStat.dwIsrUnrecoverableError++;
-
- if (dwIsr & ISR_SOFTINT) /* ISR, bit9 */
- pStatistic->ISRStat.dwIsrSoftInterrupt++; /* software interrupt */
-
- if (dwIsr & ISR_MIBNEARFULL) /* ISR, bit10 */
- pStatistic->ISRStat.dwIsrMIBNearfull++;
-
- if (dwIsr & ISR_RXNOBUF) /* ISR, bit11 */
- pStatistic->ISRStat.dwIsrRxNoBuf++; /* Rx No Buff */
-
- if (dwIsr & ISR_RXDMA1) /* ISR, bit12 */
- pStatistic->ISRStat.dwIsrRx1OK++; /* Rx1 successful */
-
- if (dwIsr & ISR_SOFTTIMER1) /* ISR, bit21 */
- pStatistic->ISRStat.dwIsrSTIMER1Int++;
-}
diff --git a/drivers/staging/vt6655/mib.h b/drivers/staging/vt6655/mib.h
deleted file mode 100644
index 64ca360..0000000
--- a/drivers/staging/vt6655/mib.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * File: mib.h
- *
- * Purpose: Implement MIB Data Structure
- *
- * Author: Tevin Chen
- *
- * Date: May 21, 1996
- *
- */
-
-#ifndef __MIB_H__
-#define __MIB_H__
-
-#include "desc.h"
-
-//
-// 802.11 counter
-//
-
-typedef struct tagSDot11Counters {
- unsigned long long RTSSuccessCount;
- unsigned long long RTSFailureCount;
- unsigned long long ACKFailureCount;
- unsigned long long FCSErrorCount;
-} SDot11Counters, *PSDot11Counters;
-
-//
-// Custom counter
-//
-typedef struct tagSISRCounters {
- unsigned long dwIsrTx0OK;
- unsigned long dwIsrAC0TxOK;
- unsigned long dwIsrBeaconTxOK;
- unsigned long dwIsrRx0OK;
- unsigned long dwIsrTBTTInt;
- unsigned long dwIsrSTIMERInt;
- unsigned long dwIsrWatchDog;
- unsigned long dwIsrUnrecoverableError;
- unsigned long dwIsrSoftInterrupt;
- unsigned long dwIsrMIBNearfull;
- unsigned long dwIsrRxNoBuf;
-
- unsigned long dwIsrUnknown;
-
- unsigned long dwIsrRx1OK;
- unsigned long dwIsrSTIMER1Int;
-} SISRCounters, *PSISRCounters;
-
-//
-// statistic counter
-//
-typedef struct tagSStatCounter {
- SISRCounters ISRStat;
-} SStatCounter, *PSStatCounter;
-
-void STAvUpdateIsrStatCounter(PSStatCounter pStatistic, unsigned long dwIsr);
-
-#endif // __MIB_H__
--
2.1.4


2015-05-31 09:36:07

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 7/9] staging: vt6655: vnt_interrupt_process remove camel case.

pDevice -> priv

Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6655/device_main.c | 103 ++++++++++++++++++-----------------
1 file changed, 52 insertions(+), 51 deletions(-)

diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c
index 2262a61..575ba87 100644
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -1051,29 +1051,29 @@ static void vnt_check_bb_vga(struct vnt_private *priv)
}
}

-static void vnt_interrupt_process(struct vnt_private *pDevice)
+static void vnt_interrupt_process(struct vnt_private *priv)
{
- struct ieee80211_low_level_stats *low_stats = &pDevice->low_stats;
+ struct ieee80211_low_level_stats *low_stats = &priv->low_stats;
int max_count = 0;
u32 mib_counter;
unsigned long flags;

- MACvReadISR(pDevice->PortOffset, &pDevice->dwIsr);
+ MACvReadISR(priv->PortOffset, &priv->dwIsr);

- if (pDevice->dwIsr == 0)
+ if (priv->dwIsr == 0)
return;

- if (pDevice->dwIsr == 0xffffffff) {
+ if (priv->dwIsr == 0xffffffff) {
pr_debug("dwIsr = 0xffff\n");
return;
}

- MACvIntDisable(pDevice->PortOffset);
+ MACvIntDisable(priv->PortOffset);

- spin_lock_irqsave(&pDevice->lock, flags);
+ spin_lock_irqsave(&priv->lock, flags);

/* Read low level stats */
- MACvReadMIBCounter(pDevice->PortOffset, &mib_counter);
+ MACvReadMIBCounter(priv->PortOffset, &mib_counter);

low_stats->dot11RTSSuccessCount += mib_counter & 0xff;
low_stats->dot11RTSFailureCount += (mib_counter >> 8) & 0xff;
@@ -1086,79 +1086,80 @@ static void vnt_interrupt_process(struct vnt_private *pDevice)
* than RD/TD write back
* update ISR counter
*/
- while (pDevice->dwIsr && pDevice->vif) {
- MACvWriteISR(pDevice->PortOffset, pDevice->dwIsr);
+ while (priv->dwIsr && priv->vif) {
+ MACvWriteISR(priv->PortOffset, priv->dwIsr);

- if (pDevice->dwIsr & ISR_FETALERR) {
+ if (priv->dwIsr & ISR_FETALERR) {
pr_debug(" ISR_FETALERR\n");
- VNSvOutPortB(pDevice->PortOffset + MAC_REG_SOFTPWRCTL, 0);
- VNSvOutPortW(pDevice->PortOffset + MAC_REG_SOFTPWRCTL, SOFTPWRCTL_SWPECTI);
- device_error(pDevice, pDevice->dwIsr);
+ VNSvOutPortB(priv->PortOffset + MAC_REG_SOFTPWRCTL, 0);
+ VNSvOutPortW(priv->PortOffset +
+ MAC_REG_SOFTPWRCTL, SOFTPWRCTL_SWPECTI);
+ device_error(priv, priv->dwIsr);
}

- if (pDevice->dwIsr & ISR_TBTT) {
- if (pDevice->op_mode != NL80211_IFTYPE_ADHOC)
- vnt_check_bb_vga(pDevice);
+ if (priv->dwIsr & ISR_TBTT) {
+ if (priv->op_mode != NL80211_IFTYPE_ADHOC)
+ vnt_check_bb_vga(priv);

- pDevice->bBeaconSent = false;
- if (pDevice->bEnablePSMode)
- PSbIsNextTBTTWakeUp((void *)pDevice);
+ priv->bBeaconSent = false;
+ if (priv->bEnablePSMode)
+ PSbIsNextTBTTWakeUp((void *)priv);

- if ((pDevice->op_mode == NL80211_IFTYPE_AP ||
- pDevice->op_mode == NL80211_IFTYPE_ADHOC) &&
- pDevice->vif->bss_conf.enable_beacon) {
- MACvOneShotTimer1MicroSec(pDevice->PortOffset,
- (pDevice->vif->bss_conf.beacon_int - MAKE_BEACON_RESERVED) << 10);
+ if ((priv->op_mode == NL80211_IFTYPE_AP ||
+ priv->op_mode == NL80211_IFTYPE_ADHOC) &&
+ priv->vif->bss_conf.enable_beacon) {
+ MACvOneShotTimer1MicroSec(priv->PortOffset,
+ (priv->vif->bss_conf.beacon_int - MAKE_BEACON_RESERVED) << 10);
}

/* TODO: adhoc PS mode */

}

- if (pDevice->dwIsr & ISR_BNTX) {
- if (pDevice->op_mode == NL80211_IFTYPE_ADHOC) {
- pDevice->bIsBeaconBufReadySet = false;
- pDevice->cbBeaconBufReadySetCnt = 0;
+ if (priv->dwIsr & ISR_BNTX) {
+ if (priv->op_mode == NL80211_IFTYPE_ADHOC) {
+ priv->bIsBeaconBufReadySet = false;
+ priv->cbBeaconBufReadySetCnt = 0;
}

- pDevice->bBeaconSent = true;
+ priv->bBeaconSent = true;
}

- if (pDevice->dwIsr & ISR_RXDMA0)
- max_count += device_rx_srv(pDevice, TYPE_RXDMA0);
+ if (priv->dwIsr & ISR_RXDMA0)
+ max_count += device_rx_srv(priv, TYPE_RXDMA0);

- if (pDevice->dwIsr & ISR_RXDMA1)
- max_count += device_rx_srv(pDevice, TYPE_RXDMA1);
+ if (priv->dwIsr & ISR_RXDMA1)
+ max_count += device_rx_srv(priv, TYPE_RXDMA1);

- if (pDevice->dwIsr & ISR_TXDMA0)
- max_count += device_tx_srv(pDevice, TYPE_TXDMA0);
+ if (priv->dwIsr & ISR_TXDMA0)
+ max_count += device_tx_srv(priv, TYPE_TXDMA0);

- if (pDevice->dwIsr & ISR_AC0DMA)
- max_count += device_tx_srv(pDevice, TYPE_AC0DMA);
+ if (priv->dwIsr & ISR_AC0DMA)
+ max_count += device_tx_srv(priv, TYPE_AC0DMA);

- if (pDevice->dwIsr & ISR_SOFTTIMER1) {
- if (pDevice->vif->bss_conf.enable_beacon)
- vnt_beacon_make(pDevice, pDevice->vif);
+ if (priv->dwIsr & ISR_SOFTTIMER1) {
+ if (priv->vif->bss_conf.enable_beacon)
+ vnt_beacon_make(priv, priv->vif);
}

/* If both buffers available wake the queue */
- if (AVAIL_TD(pDevice, TYPE_TXDMA0) &&
- AVAIL_TD(pDevice, TYPE_AC0DMA) &&
- ieee80211_queue_stopped(pDevice->hw, 0))
- ieee80211_wake_queues(pDevice->hw);
+ if (AVAIL_TD(priv, TYPE_TXDMA0) &&
+ AVAIL_TD(priv, TYPE_AC0DMA) &&
+ ieee80211_queue_stopped(priv->hw, 0))
+ ieee80211_wake_queues(priv->hw);

- MACvReadISR(pDevice->PortOffset, &pDevice->dwIsr);
+ MACvReadISR(priv->PortOffset, &priv->dwIsr);

- MACvReceive0(pDevice->PortOffset);
- MACvReceive1(pDevice->PortOffset);
+ MACvReceive0(priv->PortOffset);
+ MACvReceive1(priv->PortOffset);

- if (max_count > pDevice->sOpts.int_works)
+ if (max_count > priv->sOpts.int_works)
break;
}

- spin_unlock_irqrestore(&pDevice->lock, flags);
+ spin_unlock_irqrestore(&priv->lock, flags);

- MACvIntEnable(pDevice->PortOffset, IMR_MASK_VALUE);
+ MACvIntEnable(priv->PortOffset, IMR_MASK_VALUE);
}

static void vnt_interrupt_work(struct work_struct *work)
--
2.1.4


2015-05-31 09:36:05

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 6/9] staging: vt6655: vnt_interrupt_process remove page 0 select

Page 1 is fully proctected by lock there is no need
to check for it. Page 0 is selected at other times.

Remove byOrgPageSel and its calls from function.

Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6655/device_main.c | 11 -----------
1 file changed, 11 deletions(-)

diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c
index d5f090f..2262a61 100644
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -1056,7 +1056,6 @@ static void vnt_interrupt_process(struct vnt_private *pDevice)
struct ieee80211_low_level_stats *low_stats = &pDevice->low_stats;
int max_count = 0;
u32 mib_counter;
- unsigned char byOrgPageSel = 0;
unsigned long flags;

MACvReadISR(pDevice->PortOffset, &pDevice->dwIsr);
@@ -1073,13 +1072,6 @@ static void vnt_interrupt_process(struct vnt_private *pDevice)

spin_lock_irqsave(&pDevice->lock, flags);

- /* Make sure current page is 0 */
- VNSvInPortB(pDevice->PortOffset + MAC_REG_PAGE1SEL, &byOrgPageSel);
- if (byOrgPageSel == 1)
- MACvSelectPage0(pDevice->PortOffset);
- else
- byOrgPageSel = 0;
-
/* Read low level stats */
MACvReadMIBCounter(pDevice->PortOffset, &mib_counter);

@@ -1164,9 +1156,6 @@ static void vnt_interrupt_process(struct vnt_private *pDevice)
break;
}

- if (byOrgPageSel == 1)
- MACvSelectPage1(pDevice->PortOffset);
-
spin_unlock_irqrestore(&pDevice->lock, flags);

MACvIntEnable(pDevice->PortOffset, IMR_MASK_VALUE);
--
2.1.4


2015-05-31 09:35:57

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 2/9] staging: vt6655: dead code remove STAvUpdate802_11Counter

This function is nolonger of any future use.

Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6655/mib.c | 27 ---------------------------
drivers/staging/vt6655/mib.h | 6 ------
2 files changed, 33 deletions(-)

diff --git a/drivers/staging/vt6655/mib.c b/drivers/staging/vt6655/mib.c
index d55c762..e9d23a7 100644
--- a/drivers/staging/vt6655/mib.c
+++ b/drivers/staging/vt6655/mib.c
@@ -110,30 +110,3 @@ void STAvUpdateIsrStatCounter(PSStatCounter pStatistic, unsigned long dwIsr)
if (dwIsr & ISR_SOFTTIMER1) /* ISR, bit21 */
pStatistic->ISRStat.dwIsrSTIMER1Int++;
}
-
-/*
- * Description: Update 802.11 mib counter
- *
- * Parameters:
- * In:
- * p802_11Counter - Pointer to 802.11 mib counter
- * pStatistic - Pointer to Statistic Counter Data Structure
- * dwCounter - hardware counter for 802.11 mib
- * Out:
- * none
- *
- * Return Value: none
- *
- */
-void
-STAvUpdate802_11Counter(
- PSDot11Counters p802_11Counter,
- PSStatCounter pStatistic,
- unsigned long dwCounter
-)
-{
- p802_11Counter->RTSSuccessCount += (unsigned long long) (dwCounter & 0x000000ff);
- p802_11Counter->RTSFailureCount += (unsigned long long) ((dwCounter & 0x0000ff00) >> 8);
- p802_11Counter->ACKFailureCount += (unsigned long long) ((dwCounter & 0x00ff0000) >> 16);
- p802_11Counter->FCSErrorCount += (unsigned long long) ((dwCounter & 0xff000000) >> 24);
-}
diff --git a/drivers/staging/vt6655/mib.h b/drivers/staging/vt6655/mib.h
index 5cb59b8..64ca360 100644
--- a/drivers/staging/vt6655/mib.h
+++ b/drivers/staging/vt6655/mib.h
@@ -73,10 +73,4 @@ typedef struct tagSStatCounter {

void STAvUpdateIsrStatCounter(PSStatCounter pStatistic, unsigned long dwIsr);

-void STAvUpdate802_11Counter(
- PSDot11Counters p802_11Counter,
- PSStatCounter pStatistic,
- unsigned long dwCounter
-);
-
#endif // __MIB_H__
--
2.1.4