Skip to contentSkip to conversation

staging: vt6655: implement ieee80211_low_level_stats

PATCH New Malcolm Priestley 1 participant 9 messages May 31, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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.

---
 drivers/staging/vt6655/device.h      |  2 ++
 drivers/staging/vt6655/device_main.c | 24 +++++++++++++++++++++---
 2 files changed, 23 insertions(+), 3 deletions(-)
drivers/staging/vt6655/device.h +2 -0
index 440537e4..a49c6c6 100644
@@ -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)
drivers/staging/vt6655/device_main.c +21 -3
index 8f96cc9..c27f5ef 100644
@@ -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,
Signature · 1 line
2.1.4
#1 lore raw

PATCH 2/9 staging: vt6655: dead code remove STAvUpdate802_11Counter

This function is nolonger of any future use.

---
 drivers/staging/vt6655/mib.c | 27 ---------------------------
 drivers/staging/vt6655/mib.h |  6 ------
 2 files changed, 33 deletions(-)
drivers/staging/vt6655/mib.c +0 -27
index d55c762..e9d23a7 100644
@@ -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);
-}
drivers/staging/vt6655/mib.h +0 -6
index 5cb59b8..64ca360 100644
@@ -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__
Signature · 1 line
2.1.4
#2 lore raw

PATCH 3/9 staging: vt6655: Remove call to STAvUpdateIsrStatCounter.

In reply to Malcolm Priestley

This function does not provide any data to users.

---
 drivers/staging/vt6655/device.h      | 2 --
 drivers/staging/vt6655/device_main.c | 1 -
 2 files changed, 3 deletions(-)
drivers/staging/vt6655/device.h +0 -2
index a49c6c6..62e07f5 100644
@@ -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;
 
drivers/staging/vt6655/device_main.c +0 -1
index c27f5ef..31f4ec7 100644
@@ -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) {
Signature · 1 line
2.1.4
#3 lore raw

PATCH 4/9 staging: vt6655: remove mib.c/h dead code.

In reply to Malcolm Priestley

Remove from makefile and dead variables

---
 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
drivers/staging/vt6655/Makefile +0 -1
index 115b951..d55c3ba 100644
@@ -11,7 +11,6 @@ vt6655_stage-y +=	device_main.o \
 	dpc.o \
 	power.o \
 	srom.o \
-	mib.o \
 	key.o \
 	rf.o
 
drivers/staging/vt6655/device.h +0 -4
index 62e07f5..e9c4bf3 100644
@@ -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;
 
drivers/staging/vt6655/mib.c deleted +0 -112

112 lines not on this page · raw message

drivers/staging/vt6655/mib.h deleted +0 -76

76 lines not on this page · raw message

Signature · 1 line
2.1.4
#4 lore raw

PATCH 5/9 staging: vt6655: use workqueue for interrupt handling

In reply to Malcolm Priestley

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.

---
 drivers/staging/vt6655/device.h      |  2 ++
 drivers/staging/vt6655/device_main.c | 36 ++++++++++++++++++++++++++----------
 2 files changed, 28 insertions(+), 10 deletions(-)
drivers/staging/vt6655/device.h +2 -0
index e9c4bf3..b928c2a 100644
@@ -405,6 +405,8 @@ struct vnt_private {
 
 	unsigned short wBeaconInterval;
 
+	struct work_struct interrupt_work;
+
 	struct ieee80211_low_level_stats low_stats;
 };
 
drivers/staging/vt6655/device_main.c +26 -10
index 31f4ec7..d5f090f 100644
@@ -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");
Signature · 1 line
2.1.4
#5 lore raw

PATCH 6/9 staging: vt6655: vnt_interrupt_process remove page 0 select

In reply to Malcolm Priestley

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.

---
 drivers/staging/vt6655/device_main.c | 11 -----------
 1 file changed, 11 deletions(-)
drivers/staging/vt6655/device_main.c +0 -11
index d5f090f..2262a61 100644
@@ -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);
Signature · 1 line
2.1.4
#6 lore raw

PATCH 7/9 staging: vt6655: vnt_interrupt_process remove camel case.

In reply to Malcolm Priestley

pDevice -> priv

---
 drivers/staging/vt6655/device_main.c | 103 ++++++++++++++++++-----------------
 1 file changed, 52 insertions(+), 51 deletions(-)
drivers/staging/vt6655/device_main.c +52 -51
index 2262a61..575ba87 100644
@@ -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)
Signature · 1 line
2.1.4
#7 lore raw

PATCH 8/9 staging: vt6655: replace and resize dwIsr

In reply to Malcolm Priestley

dwIsr is not used outside vnt_interrupt_process and should be u32.

Move to function and resize to u32.

---
 drivers/staging/vt6655/device.h      |  1 -
 drivers/staging/vt6655/device_main.c | 33 +++++++++++++++++----------------
 2 files changed, 17 insertions(+), 17 deletions(-)
drivers/staging/vt6655/device.h +0 -1
index b928c2a..5cf1b33 100644
@@ -238,7 +238,6 @@ struct vnt_private {
 	CHIP_TYPE                   chip_id;
 
 	void __iomem                *PortOffset;
-	unsigned long dwIsr;
 	u32                         memaddr;
 	u32                         ioaddr;
 	u32                         io_size;
drivers/staging/vt6655/device_main.c +17 -16
index 575ba87..aec3cce 100644
@@ -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);
Signature · 1 line
2.1.4
#8 lore raw

PATCH 9/9 staging: vt6655: device_rx_srv check sk_buff is NULL

In reply to Malcolm Priestley

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.

---
 drivers/staging/vt6655/device_main.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/staging/vt6655/device_main.c +4 -0
index aec3cce..8dbde24 100644
@@ -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,
Signature · 1 line
2.1.4