prism54: couple of cleanup patches
Subsystems (3)
cover prism54: couple of cleanup patches
Hi,
Here are couple of patches for prism54 driver, they are against tonight pull from Linus. Please consider applying.
Thanks!
--
Dmitry
PATCH 1/2 prism54: fix potential race in reset scheduling
NET: prism54 - fix potential race in reset scheduling
There appears to be a race in reset scheduling logic - thread responsible for reseting the interface should clear "reset pending" flag before restarting the queue, otherwise timeout handler might not schedule another reset even if it is needed.
This race is mostly theoretical as far as I can see but a race nonetheless.
Signed-off-by Dmitry Torokhov <[email protected]>
---
drivers/net/wireless/prism54/islpci_eth.c | 23 +++++++++++++---------- 1 files changed, 13 insertions(+), 10 deletions(-)
drivers/net/wireless/prism54/islpci_eth.c +13 -10
@@ -253,6 +253,7 @@ islpci_monitor_rx(islpci_private *priv,* header and without the FCS. But there a is a bit that * indicates if the packet is corrupted :-) */ struct rfmon_header *hdr = (struct rfmon_header *) (*skb)->data; +if (hdr->flags &0x01 )/* This one is bad. Drop it ! */ return -1 ;
@@ -464,10 +465,8 @@ islpci_eth_receive(islpci_private *priv)break ; }/* update the fragment address */ - control_block->rx_data_low[index].address =cpu_to_le32 ((u32 ) - priv-> - pci_map_rx_address - [index]); + control_block->rx_data_low[index].address = +cpu_to_le32 ((u32 )priv->pci_map_rx_address[index]);wmb ();/* increment the driver read pointer */
@@ -484,10 +483,12 @@ islpci_eth_receive(islpci_private *priv)void islpci_do_reset_and_wake (void *data) { -islpci_private *priv = (islpci_private *) data; +islpci_private *priv = data; +islpci_reset (priv,1 ); -netif_wake_queue (priv->ndev); priv->reset_task_pending =0 ; +smp_wmb (); +netif_wake_queue (priv->ndev); }void
@@ -499,12 +500,14 @@ islpci_eth_tx_timeout(struct net_device/* increment the transmit error counter */ statistics->tx_errors++; -printk (KERN_WARNING "%s: tx_timeout" , ndev->name);if (!priv->reset_task_pending) { - priv->reset_task_pending =1 ; -printk (", scheduling a reset" ); +printk (KERN_WARNING +"%s: tx_timeout, scheduling reset" , ndev->name);netif_stop_queue (ndev); + priv->reset_task_pending =1 ;schedule_work (&priv->reset_task); + }else { +printk (KERN_WARNING +"%s: tx_timeout, waiting for reset" , ndev->name); } -printk ("\n" ); }
PATCH 2/2 prism54: whitespace cleanup
In reply to Dmitry TorokhovNET: prism54 - whitespace cleanup
Signed-off-by Dmitry Torokhov <[email protected]>
---
drivers/net/wireless/prism54/isl_38xx.c | 17 +++---- drivers/net/wireless/prism54/isl_38xx.h | 7 +- drivers/net/wireless/prism54/isl_ioctl.c | 61 ++++++++++++-------------- drivers/net/wireless/prism54/isl_ioctl.h | 1 drivers/net/wireless/prism54/isl_oid.h | 32 ++++++------- drivers/net/wireless/prism54/islpci_dev.c | 13 ++--- drivers/net/wireless/prism54/islpci_dev.h | 11 ++-- drivers/net/wireless/prism54/islpci_eth.c | 7 +- drivers/net/wireless/prism54/islpci_eth.h | 1 drivers/net/wireless/prism54/islpci_hotplug.c | 23 ++++----- drivers/net/wireless/prism54/islpci_mgt.c | 3 - drivers/net/wireless/prism54/islpci_mgt.h | 5 -- drivers/net/wireless/prism54/oid_mgt.c | 6 +- drivers/net/wireless/prism54/prismcompat.h | 4 - 14 files changed, 89 insertions(+), 102 deletions(-)
drivers/net/wireless/prism54/isl_38xx.c +8 -9
@@ -1,5 +1,4 @@/* -* * Copyright (C) 2002 Intersil Americas Inc. * Copyright (C) 2003-2004 Luis R. Rodriguez <[email protected]>_ *
@@ -38,7 +37,7 @@* isl38xx_disable_interrupts - disable all interrupts * @device: pci memory base address * -* Instructs the device to disable all interrupt reporting by asserting +* Instructs the device to disable all interrupt reporting by asserting * the IRQ line. New events may still show up in the interrupt identification * register located at offset %ISL38XX_INT_IDENT_REG. */
@@ -204,17 +203,19 @@ isl38xx_interface_reset(void __iomem *de/* enable the interrupt for detecting initialization */ /* Note: Do not enable other interrupts here. We want the -* device to have come up first 100% before allowing any other +* device to have come up first 100% before allowing any other * interrupts. */ isl38xx_w32_flush (device_base,ISL38XX_INT_IDENT_INIT ,ISL38XX_INT_EN_REG );udelay (ISL38XX_WRITEIO_DELAY );/* allow complete full reset */ }void -isl38xx_enable_common_interrupts (void __iomem *device_base) { +isl38xx_enable_common_interrupts (void __iomem *device_base) +{u32 reg; - reg = (ISL38XX_INT_IDENT_UPDATE | -ISL38XX_INT_IDENT_SLEEP |ISL38XX_INT_IDENT_WAKEUP ); + + reg =ISL38XX_INT_IDENT_UPDATE |ISL38XX_INT_IDENT_SLEEP | +ISL38XX_INT_IDENT_WAKEUP ;isl38xx_w32_flush (device_base, reg,ISL38XX_INT_EN_REG );udelay (ISL38XX_WRITEIO_DELAY ); }
@@ -234,23 +235,21 @@ isl38xx_in_queue(isl38xx_control_block */* send queues */ case ISL38XX_CB_TX_MGMTQ :BUG_ON (delta >ISL38XX_CB_MGMT_QSIZE ); +case ISL38XX_CB_TX_DATA_LQ :case ISL38XX_CB_TX_DATA_HQ :BUG_ON (delta >ISL38XX_CB_TX_QSIZE );return delta; -break ;/* receive queues */ case ISL38XX_CB_RX_MGMTQ :BUG_ON (delta >ISL38XX_CB_MGMT_QSIZE );return ISL38XX_CB_MGMT_QSIZE - delta; -break ;case ISL38XX_CB_RX_DATA_LQ :case ISL38XX_CB_RX_DATA_HQ :BUG_ON (delta >ISL38XX_CB_RX_QSIZE );return ISL38XX_CB_RX_QSIZE - delta; -break ; }BUG ();return 0 ;
drivers/net/wireless/prism54/isl_38xx.h +3 -4
@@ -1,5 +1,4 @@/* -* * Copyright (C) 2002 Intersil Americas Inc. * * This program is free software; you can redistribute it and/or modify
@@ -67,10 +66,10 @@* @base: (host) memory base address of the device * @val: 32bit value (host order) to write * @offset: byte offset into @base to write value to -* +* * This helper takes care of writing a 32bit datum to the -* specified offset into the device's pci memory space, and making sure -* the pci memory buffers get flushed by performing one harmless read +* specified offset into the device's pci memory space, and making sure +* the pci memory buffers get flushed by performing one harmless read * from the %ISL38XX_PCI_POSTING_FLUSH offset. */ static inline void
drivers/net/wireless/prism54/isl_ioctl.c +30 -31
209 lines not on this page · raw message
drivers/net/wireless/prism54/isl_ioctl.h +0 -1
@@ -1,5 +1,4 @@/* -* * Copyright (C) 2002 Intersil Americas Inc. * (C) 2003 Aurelien Alleaume <[email protected]> * (C) 2003 Luis R. Rodriguez <[email protected]>
drivers/net/wireless/prism54/isl_oid.h +15 -17
@@ -1,6 +1,4 @@/* -* -* * Copyright (C) 2003 Herbert Valerio Riedel <[email protected]> * Copyright (C) 2004 Luis R. Rodriguez <[email protected]> * Copyright (C) 2004 Aurelien Alleaume <[email protected]>
@@ -23,7 +21,7 @@#if !defined(_ISL_OID_H)#define _ISL_OID_H -/* +/* * MIB related constant and structure definitions for communicating * with the device firmware */
@@ -99,7 +97,7 @@ struct obj_attachment {char data[0 ]; } __attribute__((packed)); -/* +/* * in case everything's ok, the inlined function below will be * optimized away by the compiler... */
@@ -154,13 +152,13 @@ enum dot11_priv_t {/* Prism "Nitro" / Frameburst / "Packet Frame Grouping" * Value is in microseconds. Represents the # microseconds -* the firmware will take to group frames before sending out then out +* the firmware will take to group frames before sending out then out * together with a CSMA contention. Without this all frames are -* sent with a CSMA contention. -* Bibliography: +* sent with a CSMA contention. +* Bibliography: * http://www.hpl.hp.com/personal/Jean_Tourrilhes/Papers/Packet.Frame.Grouping.html */ -enum dot11_maxframeburst_t { +enum dot11_maxframeburst_t {/* Values for DOT11_OID_MAXFRAMEBURST */ DOT11_MAXFRAMEBURST_OFF =0 ,/* Card firmware default */ DOT11_MAXFRAMEBURST_MIXED_SAFE =650 ,/* 802.11 a,b,g safe */
@@ -176,9 +174,9 @@ enum dot11_maxframeburst_t {/* Support for 802.11 long and short frame preambles. * Long preamble uses 128-bit sync field, 8-bit CRC * Short preamble uses 56-bit sync field, 16-bit CRC -* +* * 802.11a -- not sure, both optionally ? -* 802.11b supports long and optionally short +* 802.11b supports long and optionally short * 802.11g supports both */ enum dot11_preamblesettings_t {DOT11_PREAMBLESETTING_LONG =0 ,
@@ -194,7 +192,7 @@ enum dot11_preamblesettings_t {* Long uses 802.11a slot timing (9 usec ?) * Short uses 802.11b slot timing (20 use ?) */ enum dot11_slotsettings_t { -DOT11_SLOTSETTINGS_LONG =0 , +DOT11_SLOTSETTINGS_LONG =0 ,/* Allows *only* long 802.11b slot timing */ DOT11_SLOTSETTINGS_SHORT =1 ,/* Allows *only* long 802.11a slot timing */
@@ -203,7 +201,7 @@ enum dot11_slotsettings_t { };/* All you need to know, ERP is "Extended Rate PHY". -* An Extended Rate PHY (ERP) STA or AP shall support three different +* An Extended Rate PHY (ERP) STA or AP shall support three different * preamble and header formats: * Long preamble (refer to above) * Short preamble (refer to above)
@@ -221,7 +219,7 @@ enum do11_nonerpstatus_t {/* (ERP is "Extended Rate PHY") Way to read NONERP is NON-ERP-* * The key here is DOT11 NON ERP NEVER protects against * NON ERP STA's. You *don't* want this unless -* you know what you are doing. It means you will only +* you know what you are doing. It means you will only * get Extended Rate capabilities */ enum dot11_nonerpprotection_t {DOT11_NONERP_NEVER =0 ,
@@ -229,13 +227,13 @@ enum dot11_nonerpprotection_t {DOT11_NONERP_DYNAMIC =2 }; -/* Preset OID configuration for 802.11 modes -* Note: DOT11_OID_CW[MIN|MAX] hold the values of the +/* Preset OID configuration for 802.11 modes +* Note: DOT11_OID_CW[MIN|MAX] hold the values of the * DCS MIN|MAX backoff used */ enum dot11_profile_t {/* And set/allowed values */ /* Allowed values for DOT11_OID_PROFILES */ DOT11_PROFILE_B_ONLY =0 , -/* DOT11_OID_RATES: 1, 2, 5.5, 11Mbps +/* DOT11_OID_RATES: 1, 2, 5.5, 11Mbps * DOT11_OID_PREAMBLESETTINGS: DOT11_PREAMBLESETTING_DYNAMIC * DOT11_OID_CWMIN: 31 * DOT11_OID_NONEPROTECTION: DOT11_NOERP_DYNAMIC
@@ -275,7 +273,7 @@ enum oid_inl_conformance_t {OID_INL_CONFORMANCE_NONE =0 ,/* Perform active scanning */ OID_INL_CONFORMANCE_STRICT =1 ,/* Strictly adhere to 802.11d */ OID_INL_CONFORMANCE_FLEXIBLE = 2, /* Use passed 802.11d info to - * determine channel AND/OR just make assumption that active + * determine channel AND/OR just make assumption that active * channels are valid channels */ };
drivers/net/wireless/prism54/islpci_dev.c +6 -7
@@ -1,5 +1,4 @@/* -* * Copyright (C) 2002 Intersil Americas Inc. * Copyright (C) 2003 Herbert Valerio Riedel <[email protected]> * Copyright (C) 2003 Luis R. Rodriguez <[email protected]>
@@ -413,7 +412,7 @@ prism54_bring_down(islpci_private *priv)islpci_set_state (priv,PRV_STATE_PREBOOT );/* disable all device interrupts in case they weren't */ -isl38xx_disable_interrupts (priv->device_base); +isl38xx_disable_interrupts (priv->device_base);/* For safety reasons, we may want to ensure that no DMA transfer is * currently in progress by emptying the TX and RX queues. */
@@ -480,7 +479,7 @@ islpci_reset_if(islpci_private *priv)DEFINE_WAIT (wait);prepare_to_wait (&priv->reset_done, &wait,TASK_UNINTERRUPTIBLE ); - +/* now the last step is to reset the interface */ isl38xx_interface_reset (priv->device_base, priv->device_host_address);islpci_set_state (priv,PRV_STATE_PREINIT );
@@ -488,7 +487,7 @@ islpci_reset_if(islpci_private *priv)for (count =0 ; count <2 && result; count++) {/* The software reset acknowledge needs about 220 msec here. * Be conservative and wait for up to one second. */ - + remaining =schedule_timeout_uninterruptible (HZ );if (remaining >0 ) {
@@ -496,7 +495,7 @@ islpci_reset_if(islpci_private *priv)break ; } -/* If we're here it's because our IRQ hasn't yet gone through. +/* If we're here it's because our IRQ hasn't yet gone through. * Retry a bit more... */ printk(KERN_ERR "%s: no 'reset complete' IRQ seen - retrying\n",
@@ -514,7 +513,7 @@ islpci_reset_if(islpci_private *priv)/* Now that the device is 100% up, let's allow * for the other interrupts -- -* NOTE: this is not *yet* true since we've only allowed the +* NOTE: this is not *yet* true since we've only allowed the * INIT interrupt on the IRQ line. We can perhaps poll * the IRQ line until we know for sure the reset went through */ isl38xx_enable_common_interrupts (priv->device_base);
@@ -716,7 +715,7 @@ islpci_alloc_memory(islpci_private *privprism54_acl_init (&priv->acl);prism54_wpa_bss_ie_init (priv); -if (mgt_init (priv)) +if (mgt_init (priv)) goto out_free;return 0 ;
drivers/net/wireless/prism54/islpci_dev.h +5 -6
@@ -1,6 +1,5 @@/* -* -* Copyright (C) 2002 Intersil Americas Inc. +* Copyright (C) 2002 Intersil Americas Inc. * Copyright (C) 2003 Herbert Valerio Riedel <[email protected]> * Copyright (C) 2003 Luis R. Rodriguez <[email protected]> * Copyright (C) 2003 Aurelien Alleaume <[email protected]>
@@ -72,12 +71,12 @@ struct islpci_bss_wpa_ie {u8 bssid[ETH_ALEN ];u8 wpa_ie[MAX_WPA_IE_LEN ];size_t wpa_ie_len; - + }; typedef struct { spinlock_t slock; /* generic spinlock; */ - + u32 priv_oid; /* our mib cache */
@@ -85,7 +84,7 @@ typedef struct {struct rw_semaphore mib_sem;void **mib;char nickname[IW_ESSID_MAX_SIZE +1 ]; - +/* Take care of the wireless stats */ struct work_struct stats_work;struct semaphore stats_sem;
@@ -120,7 +119,7 @@ typedef struct {struct net_device *ndev;/* device queue interface members */ -struct isl38xx_cb *control_block;/* device control block +struct isl38xx_cb *control_block;/* device control block (== driver_mem_address!) */ /* Each queue has three indexes:
drivers/net/wireless/prism54/islpci_eth.c +3 -4
@@ -1,5 +1,4 @@/* -* * Copyright (C) 2002 Intersil Americas Inc. * Copyright (C) 2004 Aurelien Alleaume <[email protected]> * This program is free software; you can redistribute it and/or modify
@@ -48,7 +47,7 @@ islpci_eth_cleanup_transmit(islpci_priva/* read the index of the first fragment to be freed */ index = priv->free_data_tx %ISL38XX_CB_TX_QSIZE ; -/* check for holes in the arrays caused by multi fragment frames +/* check for holes in the arrays caused by multi fragment frames * searching for the last fragment of a frame */ if (priv->pci_map_tx_address[index] != (dma_addr_t )NULL ) {/* entry is the last fragment of a frame
@@ -285,7 +284,7 @@ islpci_monitor_rx(islpci_private *priv, (struct avs_80211_1_header *)skb_push (*skb,sizeof (struct avs_80211_1_header )); - + avs->version =cpu_to_be32 (P80211CAPTURE_VERSION ); avs->length =cpu_to_be32 (sizeof (struct avs_80211_1_header )); avs->mactime =cpu_to_be64 (le64_to_cpu (clock));
@@ -391,7 +390,7 @@ islpci_eth_receive(islpci_private *priv)struct rx_annex_header *annex = (struct rx_annex_header *) skb->data; wstats.level = annex->rfmon.rssi; -/* The noise value can be a bit outdated if nobody's +/* The noise value can be a bit outdated if nobody's * reading wireless stats... */ wstats.noise = priv->local_iwstatistics.qual.noise; wstats.qual = wstats.level - wstats.noise;
drivers/net/wireless/prism54/islpci_eth.h +0 -1
@@ -1,5 +1,4 @@/* -* * Copyright (C) 2002 Intersil Americas Inc. * * This program is free software; you can redistribute it and/or modify
drivers/net/wireless/prism54/islpci_hotplug.c +11 -12
@@ -1,5 +1,4 @@/* -* * Copyright (C) 2002 Intersil Americas Inc. * Copyright (C) 2003 Herbert Valerio Riedel <[email protected]> *
@@ -40,8 +39,8 @@ static int init_pcitm = 0;module_param (init_pcitm, int,0 );/* In this order: vendor, device, subvendor, subdevice, class, class_mask, -* driver_data -* If you have an update for this please contact [email protected] +* driver_data +* If you have an update for this please contact [email protected] * The latest list can be found at http://prism54.org/supported_cards.php */ static const struct pci_device_id prism54_id_tbl[] = {/* Intersil PRISM Duette/Prism GT Wireless LAN adapter */
@@ -132,15 +131,15 @@ prism54_probe(struct pci_dev *pdev, cons/* 0x40 is the programmable timer to configure the response timeout (TRDY_TIMEOUT) * 0x41 is the programmable timer to configure the retry timeout (RETRY_TIMEOUT) -* The RETRY_TIMEOUT is used to set the number of retries that the core, as a -* Master, will perform before abandoning a cycle. The default value for -* RETRY_TIMEOUT is 0x80, which far exceeds the PCI 2.1 requirement for new -* devices. A write of zero to the RETRY_TIMEOUT register disables this -* function to allow use with any non-compliant legacy devices that may -* execute more retries. +* The RETRY_TIMEOUT is used to set the number of retries that the core, as a +* Master, will perform before abandoning a cycle. The default value for +* RETRY_TIMEOUT is 0x80, which far exceeds the PCI 2.1 requirement for new +* devices. A write of zero to the RETRY_TIMEOUT register disables this +* function to allow use with any non-compliant legacy devices that may +* execute more retries. * -* Writing zero to both these two registers will disable both timeouts and -* *can* solve problems caused by devices that are slow to respond. +* Writing zero to both these two registers will disable both timeouts and +* *can* solve problems caused by devices that are slow to respond. * Make this configurable - MSW */ if ( init_pcitm >=0 ) {
@@ -241,7 +240,7 @@ prism54_remove(struct pci_dev *pdev)isl38xx_disable_interrupts (priv->device_base);islpci_set_state (priv,PRV_STATE_OFF );/* This bellow causes a lockup at rmmod time. It might be -* because some interrupts still linger after rmmod time, +* because some interrupts still linger after rmmod time, * see bug #17 */ /* pci_set_power_state(pdev, 3);*/ /* try to power-off */ }
drivers/net/wireless/prism54/islpci_mgt.c +1 -2
@@ -1,5 +1,4 @@/* -* * Copyright (C) 2002 Intersil Americas Inc. * Copyright 2004 Jens Maurer <[email protected]> *
@@ -502,7 +501,7 @@ islpci_mgt_transaction(struct net_deviceprintk (KERN_WARNING "%s: timeout waiting for mgmt response\n" , ndev->name); -/* TODO: we should reset the device here */ +/* TODO: we should reset the device here */ out:finish_wait (&priv->mgmt_wqueue, &wait);up (&priv->mgmt_sem);
drivers/net/wireless/prism54/islpci_mgt.h +2 -3
@@ -1,5 +1,4 @@/* -* * Copyright (C) 2002 Intersil Americas Inc. * Copyright (C) 2003 Luis R. Rodriguez <[email protected]> *
@@ -36,8 +35,8 @@ extern int pc_debug;/* General driver definitions */ -#define PCIDEVICE_LATENCY_TIMER_MIN 0x40 -#define PCIDEVICE_LATENCY_TIMER_VAL 0x50 +#define PCIDEVICE_LATENCY_TIMER_MIN 0x40 +#define PCIDEVICE_LATENCY_TIMER_VAL 0x50/* Debugging verbose definitions */ #define SHOW_NOTHING 0x00/* overrules everything */
drivers/net/wireless/prism54/oid_mgt.c +3 -3
@@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2003,2004 Aurelien Alleaume <[email protected]> * * This program is free software; you can redistribute it and/or modify
@@ -503,7 +503,7 @@ mgt_set_varlen(islpci_private *priv, enu }if (ret || response_op ==PIMFOR_OP_ERROR ) ret = -EIO ; - }else + }else ret = -EIO ;/* re-set given data to what it was */
@@ -727,7 +727,7 @@ mgt_commit(islpci_private *priv)* MEDIUMLIMIT,BEACONPERIOD,DTIMPERIOD,ATIMWINDOW,LISTENINTERVAL * FREQUENCY,EXTENDEDRATES. * -* The way to do this is to set ESSID. Note though that they may get +* The way to do this is to set ESSID. Note though that they may get * unlatch before though by setting another OID. */ #if 0 void
drivers/net/wireless/prism54/prismcompat.h +2 -2
@@ -1,4 +1,4 @@ -/* +/* * (C) 2004 Margit Schubert-While <[email protected]> * * This program is free software; you can redistribute it and/or modify
@@ -16,7 +16,7 @@* */ -/* +/* * Compatibility header file to aid support of different kernel versions */