Skip to contentSkip to conversation

orinoco: Remove useless CIS validation

PATCH In review Pavel Roskin 3 participants 31 messages Apr 7, 2006 – Apr 8, 2006 9 messages not in the archive

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

PATCH 1/21 orinoco: Remove useless CIS validation

From: Pavel Roskin <proski-mXXj517/[email protected]>

The PCMCIA drivers would never be loaded if the CIS were wrong. No other PCMCIA drivers validate CIS.

---

 drivers/net/wireless/orinoco_cs.c  |    3 ---
 drivers/net/wireless/spectrum_cs.c |    3 ---
 2 files changed, 0 insertions(+), 6 deletions(-)
drivers/net/wireless/orinoco_cs.c +0 -3
index ec6f2a4..05f1762 100644
@@ -191,12 +191,9 @@ orinoco_cs_config(dev_link_t *link)
 	int last_fn, last_ret;
 	u_char buf[64];
 	config_info_t conf;
-	cisinfo_t info;
 	tuple_t tuple;
 	cisparse_t parse;
 	void __iomem *mem;
-
-	CS_CHECK(ValidateCIS, pcmcia_validate_cis(handle, &info));
 
 	/*
 	 * This reads the card's CONFIG tuple to find its
drivers/net/wireless/spectrum_cs.c +0 -3
index 5fa6fbe..87178a3 100644
@@ -664,12 +664,9 @@ spectrum_cs_config(dev_link_t *link)
 	int last_fn, last_ret;
 	u_char buf[64];
 	config_info_t conf;
-	cisinfo_t info;
 	tuple_t tuple;
 	cisparse_t parse;
 	void __iomem *mem;
-
-	CS_CHECK(ValidateCIS, pcmcia_validate_cis(handle, &info));
 
 	/*
 	 * This reads the card's CONFIG tuple to find its

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642

A message that is not in the archive (sent off-list or not yet received): 20060407081019.16107.67672.stgit-fdEtzkpK75rby3iVrkZq2A@public.gmane.org

#2 lore raw

PATCH 2/21 orinoco: remove PCMCIA audio support, it's useless for wireless cards

From: Pavel Roskin <proski-mXXj517/[email protected]>

---

 drivers/net/wireless/orinoco_cs.c  |    6 ------
 drivers/net/wireless/spectrum_cs.c |    6 ------
 2 files changed, 0 insertions(+), 12 deletions(-)
drivers/net/wireless/orinoco_cs.c +0 -6
index 05f1762..eda01a7 100644
@@ -248,12 +248,6 @@ orinoco_cs_config(dev_link_t *link)
 			goto next_entry;
 		link->conf.ConfigIndex = cfg->index;
 
-		/* Does this card need audio output? */
-		if (cfg->flags & CISTPL_CFTABLE_AUDIO) {
-			link->conf.Attributes |= CONF_ENABLE_SPKR;
-			link->conf.Status = CCSR_AUDIO_ENA;
-		}
-
 		/* Use power settings for Vcc and Vpp if present */
 		/* Note that the CIS values need to be rescaled */
 		if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) {
drivers/net/wireless/spectrum_cs.c +0 -6
index 87178a3..0b0bce7 100644
@@ -721,12 +721,6 @@ spectrum_cs_config(dev_link_t *link)
 			goto next_entry;
 		link->conf.ConfigIndex = cfg->index;
 
-		/* Does this card need audio output? */
-		if (cfg->flags & CISTPL_CFTABLE_AUDIO) {
-			link->conf.Attributes |= CONF_ENABLE_SPKR;
-			link->conf.Status = CCSR_AUDIO_ENA;
-		}
-
 		/* Use power settings for Vcc and Vpp if present */
 		/* Note that the CIS values need to be rescaled */
 		if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) {

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642

#3 lore raw

PATCH 3/21 orinoco: remove underscores from little-endian field names

In reply to a message not in the archive

From: Pavel Roskin <proski-mXXj517/[email protected]>

Sparse is much better at finding endianess issues than such visual cues.

---

 drivers/net/wireless/spectrum_cs.c |   28 ++++++++++++++--------------
 1 files changed, 14 insertions(+), 14 deletions(-)
drivers/net/wireless/spectrum_cs.c +14 -14
index 0b0bce7..58c153a 100644
@@ -120,8 +120,8 @@ #define TEXT_END	0x1A		/* End of text he
  * Each block has the following structure.
  */
 struct dblock {
-	__le32 _addr;		/* adapter address where to write the block */
-	__le16 _len;		/* length of the data only, in bytes */
+	__le32 addr;		/* adapter address where to write the block */
+	__le16 len;		/* length of the data only, in bytes */
 	char data[0];		/* data to be written */
 } __attribute__ ((packed));
 
@@ -131,9 +131,9 @@ struct dblock {
  * items with matching ID should be written.
  */
 struct pdr {
-	__le32 _id;		/* record ID */
-	__le32 _addr;		/* adapter address where to write the data */
-	__le32 _len;		/* expected length of the data, in bytes */
+	__le32 id;		/* record ID */
+	__le32 addr;		/* adapter address where to write the data */
+	__le32 len;		/* expected length of the data, in bytes */
 	char next[0];		/* next PDR starts here */
 } __attribute__ ((packed));
 
@@ -144,8 +144,8 @@ struct pdr {
  * be plugged into the secondary firmware.
  */
 struct pdi {
-	__le16 _len;		/* length of ID and data, in words */
-	__le16 _id;		/* record ID */
+	__le16 len;		/* length of ID and data, in words */
+	__le16 id;		/* record ID */
 	char data[0];		/* plug data */
 } __attribute__ ((packed));
 
@@ -154,44 +154,44 @@ struct pdi {
 static inline u32
 dblock_addr(const struct dblock *blk)
 {
-	return le32_to_cpu(blk->_addr);
+	return le32_to_cpu(blk->addr);
 }
 
 static inline u32
 dblock_len(const struct dblock *blk)
 {
-	return le16_to_cpu(blk->_len);
+	return le16_to_cpu(blk->len);
 }
 
 static inline u32
 pdr_id(const struct pdr *pdr)
 {
-	return le32_to_cpu(pdr->_id);
+	return le32_to_cpu(pdr->id);
 }
 
 static inline u32
 pdr_addr(const struct pdr *pdr)
 {
-	return le32_to_cpu(pdr->_addr);
+	return le32_to_cpu(pdr->addr);
 }
 
 static inline u32
 pdr_len(const struct pdr *pdr)
 {
-	return le32_to_cpu(pdr->_len);
+	return le32_to_cpu(pdr->len);
 }
 
 static inline u32
 pdi_id(const struct pdi *pdi)
 {
-	return le16_to_cpu(pdi->_id);
+	return le16_to_cpu(pdi->id);
 }
 
 /* Return length of the data only, in bytes */
 static inline u32
 pdi_len(const struct pdi *pdi)
 {
-	return 2 * (le16_to_cpu(pdi->_len) - 1);
+	return 2 * (le16_to_cpu(pdi->len) - 1);
 }
 
 

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642

#4 lore raw

PATCH 4/21 orinoco: fix truncating commsquality RID with the latest Symbol firmware

In reply to a message not in the archive

From: Pavel Roskin <proski-mXXj517/[email protected]>

Symbol firmware F3.91-71 has an additional word in the commsquality RID. Extend the receiving buffer by one word to accomodate it.

---

 drivers/net/wireless/orinoco.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/wireless/orinoco.c +1 -1
index 8dfdfbd..06523e2 100644
@@ -390,7 +390,7 @@ static struct iw_statistics *orinoco_get
 		}
 	} else {
 		struct {
-			__le16 qual, signal, noise;
+			__le16 qual, signal, noise, unused;
 		} __attribute__ ((packed)) cq;
 
 		err = HERMES_READ_RECORD(hw, USER_BAP,

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642

#5 lore raw

PATCH 5/21 orinoco: remove tracing code, it's unused

In reply to a message not in the archive

From: Pavel Roskin <proski-mXXj517/[email protected]>

---

 drivers/net/wireless/orinoco.c |   83 ----------------------------------------
 drivers/net/wireless/orinoco.h |    3 -
 2 files changed, 0 insertions(+), 86 deletions(-)
drivers/net/wireless/orinoco.c +0 -83
index 06523e2..9550bf3 100644
@@ -456,26 +456,21 @@ static int orinoco_xmit(struct sk_buff *
 	struct hermes_tx_descriptor desc;
 	unsigned long flags;
 
-	TRACE_ENTER(dev->name);
-
 	if (! netif_running(dev)) {
 		printk(KERN_ERR "%s: Tx on stopped device!\n",
 		       dev->name);
-		TRACE_EXIT(dev->name);
 		return 1;
 	}
 	
 	if (netif_queue_stopped(dev)) {
 		printk(KERN_DEBUG "%s: Tx while transmitter busy!\n", 
 		       dev->name);
-		TRACE_EXIT(dev->name);
 		return 1;
 	}
 	
 	if (orinoco_lock(priv, &flags) != 0) {
 		printk(KERN_ERR "%s: orinoco_xmit() called while hw_unavailable\n",
 		       dev->name);
-		TRACE_EXIT(dev->name);
 		return 1;
 	}
 
@@ -486,7 +481,6 @@ static int orinoco_xmit(struct sk_buff *
 		stats->tx_errors++;
 		orinoco_unlock(priv, &flags);
 		dev_kfree_skb(skb);
-		TRACE_EXIT(dev->name);
 		return 0;
 	}
 
@@ -585,12 +579,9 @@ static int orinoco_xmit(struct sk_buff *
 	orinoco_unlock(priv, &flags);
 
 	dev_kfree_skb(skb);
-
-	TRACE_EXIT(dev->name);
 
 	return 0;
  fail:
-	TRACE_EXIT(dev->name);
 
 	orinoco_unlock(priv, &flags);
 	return err;
@@ -2274,8 +2265,6 @@ static int orinoco_init(struct net_devic
 	u16 reclen;
 	int len;
 
-	TRACE_ENTER(dev->name);
-
 	/* No need to lock, the hw_unavailable flag is already set in
 	 * alloc_orinocodev() */
 	priv->nicbuf_size = IEEE80211_FRAME_LEN + ETH_HLEN;
@@ -2429,7 +2418,6 @@ static int orinoco_init(struct net_devic
 	printk(KERN_DEBUG "%s: ready\n", dev->name);
 
  out:
-	TRACE_EXIT(dev->name);
 	return err;
 }
 
@@ -2796,8 +2784,6 @@ static int orinoco_ioctl_getiwrange(stru
 	struct iw_range *range = (struct iw_range *) extra;
 	int numrates;
 	int i, k;
-
-	TRACE_ENTER(dev->name);
 
 	rrq->length = sizeof(struct iw_range);
 	memset(range, 0, sizeof(struct iw_range));
@@ -2888,8 +2874,6 @@ static int orinoco_ioctl_getiwrange(stru
 	IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWSCAN);
 	IW_EVENT_CAPA_SET(range->event_capa, IWEVTXDROP);
 
-	TRACE_EXIT(dev->name);
-
 	return 0;
 }
 
@@ -3070,8 +3054,6 @@ static int orinoco_ioctl_getessid(struct
 	int active;
 	int err = 0;
 	unsigned long flags;
-
-	TRACE_ENTER(dev->name);
 
 	if (netif_running(dev)) {
 		err = orinoco_hw_get_essid(priv, &active, essidbuf);
@@ -3087,8 +3069,6 @@ static int orinoco_ioctl_getessid(struct
 	erq->flags = 1;
 	erq->length = strlen(essidbuf) + 1;
 
-	TRACE_EXIT(dev->name);
-	
 	return 0;
 }
 
@@ -4347,69 +4327,6 @@ static struct ethtool_ops orinoco_ethtoo
 	.get_drvinfo = orinoco_get_drvinfo,
 	.get_link = ethtool_op_get_link,
 };
-
-/********************************************************************/
-/* Debugging                                                        */
-/********************************************************************/
-
-#if 0
-static void show_rx_frame(struct orinoco_rxframe_hdr *frame)
-{
-	printk(KERN_DEBUG "RX descriptor:\n");
-	printk(KERN_DEBUG "  status      = 0x%04x\n", frame->desc.status);
-	printk(KERN_DEBUG "  time        = 0x%08x\n", frame->desc.time);
-	printk(KERN_DEBUG "  silence     = 0x%02x\n", frame->desc.silence);
-	printk(KERN_DEBUG "  signal      = 0x%02x\n", frame->desc.signal);
-	printk(KERN_DEBUG "  rate        = 0x%02x\n", frame->desc.rate);
-	printk(KERN_DEBUG "  rxflow      = 0x%02x\n", frame->desc.rxflow);
-	printk(KERN_DEBUG "  reserved    = 0x%08x\n", frame->desc.reserved);
-
-	printk(KERN_DEBUG "IEEE 802.11 header:\n");
-	printk(KERN_DEBUG "  frame_ctl   = 0x%04x\n",
-	       frame->p80211.frame_ctl);
-	printk(KERN_DEBUG "  duration_id = 0x%04x\n",
-	       frame->p80211.duration_id);
-	printk(KERN_DEBUG "  addr1       = %02x:%02x:%02x:%02x:%02x:%02x\n",
-	       frame->p80211.addr1[0], frame->p80211.addr1[1],
-	       frame->p80211.addr1[2], frame->p80211.addr1[3],
-	       frame->p80211.addr1[4], frame->p80211.addr1[5]);
-	printk(KERN_DEBUG "  addr2       = %02x:%02x:%02x:%02x:%02x:%02x\n",
-	       frame->p80211.addr2[0], frame->p80211.addr2[1],
-	       frame->p80211.addr2[2], frame->p80211.addr2[3],
-	       frame->p80211.addr2[4], frame->p80211.addr2[5]);
-	printk(KERN_DEBUG "  addr3       = %02x:%02x:%02x:%02x:%02x:%02x\n",
-	       frame->p80211.addr3[0], frame->p80211.addr3[1],
-	       frame->p80211.addr3[2], frame->p80211.addr3[3],
-	       frame->p80211.addr3[4], frame->p80211.addr3[5]);
-	printk(KERN_DEBUG "  seq_ctl     = 0x%04x\n",
-	       frame->p80211.seq_ctl);
-	printk(KERN_DEBUG "  addr4       = %02x:%02x:%02x:%02x:%02x:%02x\n",
-	       frame->p80211.addr4[0], frame->p80211.addr4[1],
-	       frame->p80211.addr4[2], frame->p80211.addr4[3],
-	       frame->p80211.addr4[4], frame->p80211.addr4[5]);
-	printk(KERN_DEBUG "  data_len    = 0x%04x\n",
-	       frame->p80211.data_len);
-
-	printk(KERN_DEBUG "IEEE 802.3 header:\n");
-	printk(KERN_DEBUG "  dest        = %02x:%02x:%02x:%02x:%02x:%02x\n",
-	       frame->p8023.h_dest[0], frame->p8023.h_dest[1],
-	       frame->p8023.h_dest[2], frame->p8023.h_dest[3],
-	       frame->p8023.h_dest[4], frame->p8023.h_dest[5]);
-	printk(KERN_DEBUG "  src         = %02x:%02x:%02x:%02x:%02x:%02x\n",
-	       frame->p8023.h_source[0], frame->p8023.h_source[1],
-	       frame->p8023.h_source[2], frame->p8023.h_source[3],
-	       frame->p8023.h_source[4], frame->p8023.h_source[5]);
-	printk(KERN_DEBUG "  len         = 0x%04x\n", frame->p8023.h_proto);
-
-	printk(KERN_DEBUG "IEEE 802.2 LLC/SNAP header:\n");
-	printk(KERN_DEBUG "  DSAP        = 0x%02x\n", frame->p8022.dsap);
-	printk(KERN_DEBUG "  SSAP        = 0x%02x\n", frame->p8022.ssap);
-	printk(KERN_DEBUG "  ctrl        = 0x%02x\n", frame->p8022.ctrl);
-	printk(KERN_DEBUG "  OUI         = %02x:%02x:%02x\n",
-	       frame->p8022.oui[0], frame->p8022.oui[1], frame->p8022.oui[2]);
-	printk(KERN_DEBUG "  ethertype  = 0x%04x\n", frame->ethertype);
-}
-#endif /* 0 */
 
 /********************************************************************/
 /* Module initialization                                            */
drivers/net/wireless/orinoco.h +0 -3
index f5d856d..c6922a7 100644
@@ -132,9 +132,6 @@ #else
 #define DEBUG(n, args...) do { } while (0)
 #endif	/* ORINOCO_DEBUG */
 
-#define TRACE_ENTER(devname) DEBUG(2, "%s: -> %s()\n", devname, __FUNCTION__);
-#define TRACE_EXIT(devname)  DEBUG(2, "%s: <- %s()\n", devname, __FUNCTION__);
-
 /********************************************************************/
 /* Exported prototypes                                              */
 /********************************************************************/

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642

#6 lore raw

PATCH 6/21 orinoco: remove debug buffer code and userspace include support

In reply to a message not in the archive

From: Pavel Roskin <proski-mXXj517/[email protected]>

---

 drivers/net/wireless/hermes.c |   19 -------------------
 drivers/net/wireless/hermes.h |   34 ----------------------------------
 2 files changed, 0 insertions(+), 53 deletions(-)
drivers/net/wireless/hermes.c +0 -19
index 346c6fe..456d934 100644
@@ -121,12 +121,6 @@ void hermes_struct_init(hermes_t *hw, vo
 	hw->iobase = address;
 	hw->reg_spacing = reg_spacing;
 	hw->inten = 0x0;
-
-#ifdef HERMES_DEBUG_BUFFER
-	hw->dbufp = 0;
-	memset(&hw->dbuf, 0xff, sizeof(hw->dbuf));
-	memset(&hw->profile, 0, sizeof(hw->profile));
-#endif
 }
 
 int hermes_init(hermes_t *hw)
@@ -345,20 +339,7 @@ static int hermes_bap_seek(hermes_t *hw,
 		k--;
 		udelay(1);
 		reg = hermes_read_reg(hw, oreg);
-	}
-
-#ifdef HERMES_DEBUG_BUFFER
-	hw->profile[HERMES_BAP_BUSY_TIMEOUT - k]++;
-
-	if (k < HERMES_BAP_BUSY_TIMEOUT) {
-		struct hermes_debug_entry *e = 
-			&hw->dbuf[(hw->dbufp++) % HERMES_DEBUG_BUFSIZE];
-		e->bap = bap;
-		e->id = id;
-		e->offset = offset;
-		e->cycles = HERMES_BAP_BUSY_TIMEOUT - k;
 	}
-#endif
 
 	if (reg & HERMES_OFFSET_BUSY)
 		return -ETIMEDOUT;
drivers/net/wireless/hermes.h +0 -34
index 7644f72..34ccba2 100644
@@ -328,16 +328,6 @@ struct hermes_multicast {
 	u8 addr[HERMES_MAX_MULTICAST][ETH_ALEN];
 } __attribute__ ((packed));
 
-// #define HERMES_DEBUG_BUFFER 1
-#define HERMES_DEBUG_BUFSIZE 4096
-struct hermes_debug_entry {
-	int bap;
-	u16 id, offset;
-	int cycles;
-};
-
-#ifdef __KERNEL__
-
 /* Timeouts */
 #define HERMES_BAP_BUSY_TIMEOUT (10000) /* In iterations of ~1us */
 
@@ -347,14 +337,7 @@ typedef struct hermes {
 	int reg_spacing;
 #define HERMES_16BIT_REGSPACING	0
 #define HERMES_32BIT_REGSPACING	1
-
 	u16 inten; /* Which interrupts should be enabled? */
-
-#ifdef HERMES_DEBUG_BUFFER
-	struct hermes_debug_entry dbuf[HERMES_DEBUG_BUFSIZE];
-	unsigned long dbufp;
-	unsigned long profile[HERMES_BAP_BUSY_TIMEOUT+1];
-#endif
 } hermes_t;
 
 /* Register access convenience macros */
@@ -461,22 +444,5 @@ static inline int hermes_write_wordrec(h
 	__le16 rec = cpu_to_le16(word);
 	return HERMES_WRITE_RECORD(hw, bap, rid, &rec);
 }
-
-#else /* ! __KERNEL__ */
-
-/* These are provided for the benefit of userspace drivers and testing programs
-   which use ioperm() or iopl() */
-
-#define hermes_read_reg(base, off) (inw((base) + (off)))
-#define hermes_write_reg(base, off, val) (outw((val), (base) + (off)))
-
-#define hermes_read_regn(base, name) (hermes_read_reg((base), HERMES_##name))
-#define hermes_write_regn(base, name, val) (hermes_write_reg((base), HERMES_##name, (val)))
-
-/* Note that for the next two, the count is in 16-bit words, not bytes */
-#define hermes_read_data(base, off, buf, count) (insw((base) + (off), (buf), (count)))
-#define hermes_write_data(base, off, buf, count) (outsw((base) + (off), (buf), (count)))
-
-#endif /* ! __KERNEL__ */
 
 #endif  /* _HERMES_H */

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642

#7 lore raw

PATCH 7/21 orinoco: Symbol card supported by spectrum_cs is LA4137, not LA4100

In reply to a message not in the archive

From: Pavel Roskin <proski-mXXj517/[email protected]>

---

 drivers/net/wireless/spectrum_cs.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/spectrum_cs.c +2 -2
index 58c153a..14f4daa 100644
@@ -1,6 +1,6 @@
 /*
  * Driver for 802.11b cards using RAM-loadable Symbol firmware, such as
- * Symbol Wireless Networker LA4100, CompactFlash cards by Socket
+ * Symbol Wireless Networker LA4137, CompactFlash cards by Socket
  * Communications and Intel PRO/Wireless 2011B.
  *
  * The driver implements Symbol firmware download.  The rest is handled
@@ -958,7 +958,7 @@ static char version[] __initdata = DRIVE
 	" David Gibson <[email protected]>, et al)";
 
 static struct pcmcia_device_id spectrum_cs_ids[] = {
-	PCMCIA_DEVICE_MANF_CARD(0x026c, 0x0001), /* Symbol Spectrum24 LA4100 */
+	PCMCIA_DEVICE_MANF_CARD(0x026c, 0x0001), /* Symbol Spectrum24 LA4137 */
 	PCMCIA_DEVICE_MANF_CARD(0x0104, 0x0001), /* Socket Communications CF */
 	PCMCIA_DEVICE_PROD_ID12("Intel", "PRO/Wireless LAN PC Card", 0x816cc815, 0x6fbf459a), /* 2011B, not 2011 */
 	PCMCIA_DEVICE_NULL,

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642

#8 lore raw

PATCH 8/21 orinoco: optimize Tx exception handling in orinoco

In reply to a message not in the archive

From: Pavel Roskin <proski-mXXj517/[email protected]>

When processing Tx exception, only read data until addr1. Rename hermes_tx_descriptor_802_11 to hermes_txexc_data since it's only used to Tx exceptions. Reuse existing hermes_tx_descriptor structure. Remove fields after addr1 - they are not read from the card.

---

 drivers/net/wireless/orinoco.c |   42 ++++++----------------------------------
 1 files changed, 6 insertions(+), 36 deletions(-)
drivers/net/wireless/orinoco.c +6 -36
index 9550bf3..ceea494 100644
@@ -201,41 +201,12 @@ #define BITRATE_TABLE_SIZE ARRAY_SIZE(bi
 /* Data types                                                       */
 /********************************************************************/
 
-/* Used in Event handling.
- * We avoid nested structures as they break on ARM -- Moustafa */
-struct hermes_tx_descriptor_802_11 {
-	/* hermes_tx_descriptor */
-	__le16 status;
-	__le16 reserved1;
-	__le16 reserved2;
-	__le32 sw_support;
-	u8 retry_count;
-	u8 tx_rate;
-	__le16 tx_control;
-
-	/* ieee80211_hdr */
+/* Beginning of the Tx descriptor, used in TxExc handling */
+struct hermes_txexc_data {
+	struct hermes_tx_descriptor desc;
 	__le16 frame_ctl;
 	__le16 duration_id;
 	u8 addr1[ETH_ALEN];
-	u8 addr2[ETH_ALEN];
-	u8 addr3[ETH_ALEN];
-	__le16 seq_ctl;
-	u8 addr4[ETH_ALEN];
-
-	__le16 data_len;
-
-	/* ethhdr */
-	u8 h_dest[ETH_ALEN];	/* destination eth addr */
-	u8 h_source[ETH_ALEN];	/* source ether addr    */
-	__be16 h_proto;		/* packet type ID field */
-
-	/* p8022_hdr */
-	u8 dsap;
-	u8 ssap;
-	u8 ctrl;
-	u8 oui[3];
-
-	__be16 ethertype;
 } __attribute__ ((packed));
 
 /* Rx frame header except compatibility 802.3 header */
@@ -620,7 +591,7 @@ static void __orinoco_ev_txexc(struct ne
 	struct net_device_stats *stats = &priv->stats;
 	u16 fid = hermes_read_regn(hw, TXCOMPLFID);
 	u16 status;
-	struct hermes_tx_descriptor_802_11 hdr;
+	struct hermes_txexc_data hdr;
 	int err = 0;
 
 	if (fid == DUMMY_FID)
@@ -628,8 +599,7 @@ static void __orinoco_ev_txexc(struct ne
 
 	/* Read part of the frame header - we need status and addr1 */
 	err = hermes_bap_pread(hw, IRQ_BAP, &hdr,
-			       offsetof(struct hermes_tx_descriptor_802_11,
-					addr2),
+			       sizeof(struct hermes_txexc_data),
 			       fid, 0);
 
 	hermes_write_regn(hw, TXCOMPLFID, DUMMY_FID);
@@ -649,7 +619,7 @@ static void __orinoco_ev_txexc(struct ne
 	 * exceeded, because that's the only status that really mean
 	 * that this particular node went away.
 	 * Other errors means that *we* screwed up. - Jean II */
-	status = le16_to_cpu(hdr.status);
+	status = le16_to_cpu(hdr.desc.status);
 	if (status & (HERMES_TXSTAT_RETRYERR | HERMES_TXSTAT_AGEDERR)) {
 		union iwreq_data	wrqu;
 

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642

#9 lore raw

PATCH 9/21 orinoco: orinoco_xmit() should only return valid symbolic constants

In reply to a message not in the archive

From: Pavel Roskin <proski-mXXj517/[email protected]>

Don't ever return -errno from orinoco_xmit() - the network layer doesn't expect it.

---

 drivers/net/wireless/orinoco.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
drivers/net/wireless/orinoco.c +6 -6
index ceea494..173e9e4 100644
@@ -430,19 +430,19 @@ static int orinoco_xmit(struct sk_buff *
 	if (! netif_running(dev)) {
 		printk(KERN_ERR "%s: Tx on stopped device!\n",
 		       dev->name);
-		return 1;
+		return NETDEV_TX_BUSY;
 	}
 	
 	if (netif_queue_stopped(dev)) {
 		printk(KERN_DEBUG "%s: Tx while transmitter busy!\n", 
 		       dev->name);
-		return 1;
+		return NETDEV_TX_BUSY;
 	}
 	
 	if (orinoco_lock(priv, &flags) != 0) {
 		printk(KERN_ERR "%s: orinoco_xmit() called while hw_unavailable\n",
 		       dev->name);
-		return 1;
+		return NETDEV_TX_BUSY;
 	}
 
 	if (! netif_carrier_ok(dev) || (priv->iw_mode == IW_MODE_MONITOR)) {
@@ -452,7 +452,7 @@ static int orinoco_xmit(struct sk_buff *
 		stats->tx_errors++;
 		orinoco_unlock(priv, &flags);
 		dev_kfree_skb(skb);
-		return 0;
+		return NETDEV_TX_OK;
 	}
 
 	/* Length of the packet body */
@@ -551,11 +551,11 @@ static int orinoco_xmit(struct sk_buff *
 
 	dev_kfree_skb(skb);
 
-	return 0;
+	return NETDEV_TX_OK;
  fail:
 
 	orinoco_unlock(priv, &flags);
-	return err;
+	return NETDEV_TX_BUSY;
 }
 
 static void __orinoco_ev_alloc(struct net_device *dev, hermes_t *hw)

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642

#10 lore raw

PATCH 10/21 orinoco replace hermes_write_words() with hermes_write_bytes()

In reply to a message not in the archive

From: Pavel Roskin <proski-mXXj517/[email protected]>

The new function can write an odd number of bytes, thus making padding unnecessary.

---

 drivers/net/wireless/hermes.c      |   17 ++++++++---------
 drivers/net/wireless/hermes.h      |    7 +++++--
 drivers/net/wireless/spectrum_cs.c |    7 +++----
 3 files changed, 16 insertions(+), 15 deletions(-)
drivers/net/wireless/hermes.c +8 -9
index 456d934..be24f01 100644
@@ -400,8 +400,7 @@ int hermes_bap_pread(hermes_t *hw, int b
 }
 
 /* Write a block of data to the chip's buffer, via the
- * BAP. Synchronization/serialization is the caller's problem. len
- * must be even.
+ * BAP. Synchronization/serialization is the caller's problem.
  *
  * Returns: < 0 on internal failure (errno), 0 on success, > 0 on error from firmware
  */
@@ -411,7 +410,7 @@ int hermes_bap_pwrite(hermes_t *hw, int 
 	int dreg = bap ? HERMES_DATA1 : HERMES_DATA0;
 	int err = 0;
 
-	if ( (len < 0) || (len % 2) )
+	if (len < 0)
 		return -EINVAL;
 
 	err = hermes_bap_seek(hw, bap, id, offset);
@@ -419,7 +418,7 @@ int hermes_bap_pwrite(hermes_t *hw, int 
 		goto out;
 	
 	/* Actually do the transfer */
-	hermes_write_words(hw, dreg, buf, len/2);
+	hermes_write_bytes(hw, dreg, buf, len);
 
  out:	
 	return err;
@@ -427,7 +426,7 @@ int hermes_bap_pwrite(hermes_t *hw, int 
 
 /* Write a block of data to the chip's buffer with padding if
  * neccessary, via the BAP. Synchronization/serialization is the
- * caller's problem. len must be even.
+ * caller's problem.
  *
  * Returns: < 0 on internal failure (errno), 0 on success, > 0 on error from firmware
  */
@@ -437,7 +436,7 @@ int hermes_bap_pwrite_pad(hermes_t *hw, 
 	int dreg = bap ? HERMES_DATA1 : HERMES_DATA0;
 	int err = 0;
 
-	if (len < 0 || len % 2 || data_len > len)
+	if (len < 0 || data_len > len)
 		return -EINVAL;
 
 	err = hermes_bap_seek(hw, bap, id, offset);
@@ -445,13 +444,13 @@ int hermes_bap_pwrite_pad(hermes_t *hw, 
 		goto out;
 
 	/* Transfer all the complete words of data */
-	hermes_write_words(hw, dreg, buf, data_len/2);
+	hermes_write_bytes(hw, dreg, buf, data_len);
 	/* If there is an odd byte left over pad and transfer it */
 	if (data_len & 1) {
 		u8 end[2];
 		end[1] = 0;
 		end[0] = ((unsigned char *)buf)[data_len - 1];
-		hermes_write_words(hw, dreg, end, 1);
+		hermes_write_bytes(hw, dreg, end, 2);
 		data_len ++;
 	}
 	/* Now send zeros for the padding */
@@ -534,7 +533,7 @@ int hermes_write_ltv(hermes_t *hw, int b
 
 	count = length - 1;
 
-	hermes_write_words(hw, dreg, value, count);
+	hermes_write_bytes(hw, dreg, value, count << 1);
 
 	err = hermes_docmd_wait(hw, HERMES_CMD_ACCESS | HERMES_CMD_WRITE, 
 				rid, NULL);
drivers/net/wireless/hermes.h +5 -2
index 34ccba2..e1b279e 100644
@@ -408,10 +408,13 @@ static inline void hermes_read_words(str
 	ioread16_rep(hw->iobase + off, buf, count);
 }
 
-static inline void hermes_write_words(struct hermes *hw, int off, const void *buf, unsigned count)
+static inline void hermes_write_bytes(struct hermes *hw, int off,
+				      const char *buf, unsigned count)
 {
 	off = off << hw->reg_spacing;
-	iowrite16_rep(hw->iobase + off, buf, count);
+	iowrite16_rep(hw->iobase + off, buf, count >> 1);
+	if (unlikely(count & 1))
+		iowrite8(buf[count - 1], hw->iobase + off);
 }
 
 static inline void hermes_clear_words(struct hermes *hw, int off, unsigned count)
drivers/net/wireless/spectrum_cs.c +3 -4
index 14f4daa..c13a5b6 100644
@@ -343,8 +343,7 @@ spectrum_plug_pdi(hermes_t *hw, struct p
 
 	/* do the actual plugging */
 	spectrum_aux_setaddr(hw, pdr_addr(pdr));
-	hermes_write_words(hw, HERMES_AUXDATA, pdi->data,
-			   pdi_len(pdi) / 2);
+	hermes_write_bytes(hw, HERMES_AUXDATA, pdi->data, pdi_len(pdi));
 
 	return 0;
 }
@@ -424,8 +423,8 @@ spectrum_load_blocks(hermes_t *hw, const
 
 	while (dblock_addr(blk) != BLOCK_END) {
 		spectrum_aux_setaddr(hw, blkaddr);
-		hermes_write_words(hw, HERMES_AUXDATA, blk->data,
-				   blklen / 2);
+		hermes_write_bytes(hw, HERMES_AUXDATA, blk->data,
+				   blklen);
 
 		blk = (struct dblock *) &blk->data[blklen];
 		blkaddr = dblock_addr(blk);

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642

#11 lore raw

PATCH 11/21 orinoco: don't use any padding for Tx frames

In reply to a message not in the archive

From: Pavel Roskin <proski-mXXj517/[email protected]>

hermes_bap_pwrite() supports odd-sized packets now. There is no
minimal packet size for 802.11. Also, hermes_bap_pwrite() supports odd-sized packets now. This removes all reasons to pad the Tx data.

---

 drivers/net/wireless/hermes.c  |   38 --------------------------------------
 drivers/net/wireless/hermes.h  |    2 --
 drivers/net/wireless/orinoco.c |   25 +++++++------------------
 3 files changed, 7 insertions(+), 58 deletions(-)
drivers/net/wireless/hermes.c +0 -38
index be24f01..2aa2f38 100644
@@ -424,43 +424,6 @@ int hermes_bap_pwrite(hermes_t *hw, int 
 	return err;
 }
 
-/* Write a block of data to the chip's buffer with padding if
- * neccessary, via the BAP. Synchronization/serialization is the
- * caller's problem.
- *
- * Returns: < 0 on internal failure (errno), 0 on success, > 0 on error from firmware
- */
-int hermes_bap_pwrite_pad(hermes_t *hw, int bap, const void *buf, unsigned data_len, int len,
-		      u16 id, u16 offset)
-{
-	int dreg = bap ? HERMES_DATA1 : HERMES_DATA0;
-	int err = 0;
-
-	if (len < 0 || data_len > len)
-		return -EINVAL;
-
-	err = hermes_bap_seek(hw, bap, id, offset);
-	if (err)
-		goto out;
-
-	/* Transfer all the complete words of data */
-	hermes_write_bytes(hw, dreg, buf, data_len);
-	/* If there is an odd byte left over pad and transfer it */
-	if (data_len & 1) {
-		u8 end[2];
-		end[1] = 0;
-		end[0] = ((unsigned char *)buf)[data_len - 1];
-		hermes_write_bytes(hw, dreg, end, 2);
-		data_len ++;
-	}
-	/* Now send zeros for the padding */
-	if (data_len < len)
-		hermes_clear_words(hw, dreg, (len - data_len) / 2);
-	/* Complete */
- out:
-	return err;
-}
-
 /* Read a Length-Type-Value record from the card.
  *
  * If length is NULL, we ignore the length read from the card, and
@@ -548,7 +511,6 @@ EXPORT_SYMBOL(hermes_allocate);
 
 EXPORT_SYMBOL(hermes_bap_pread);
 EXPORT_SYMBOL(hermes_bap_pwrite);
-EXPORT_SYMBOL(hermes_bap_pwrite_pad);
 EXPORT_SYMBOL(hermes_read_ltv);
 EXPORT_SYMBOL(hermes_write_ltv);
 
drivers/net/wireless/hermes.h +0 -2
index e1b279e..8e3f0e3 100644
@@ -359,8 +359,6 @@ int hermes_bap_pread(hermes_t *hw, int b
 		       u16 id, u16 offset);
 int hermes_bap_pwrite(hermes_t *hw, int bap, const void *buf, int len,
 			u16 id, u16 offset);
-int hermes_bap_pwrite_pad(hermes_t *hw, int bap, const void *buf,
-			unsigned data_len, int len, u16 id, u16 offset);
 int hermes_read_ltv(hermes_t *hw, int bap, u16 rid, unsigned buflen,
 		    u16 *length, void *buf);
 int hermes_write_ltv(hermes_t *hw, int bap, u16 rid,
drivers/net/wireless/orinoco.c +7 -18
index 173e9e4..9fde17b 100644
@@ -423,7 +423,7 @@ static int orinoco_xmit(struct sk_buff *
 	u16 txfid = priv->txfid;
 	char *p;
 	struct ethhdr *eh;
-	int len, data_len, data_off;
+	int data_len, data_off;
 	struct hermes_tx_descriptor desc;
 	unsigned long flags;
 
@@ -455,13 +455,10 @@ static int orinoco_xmit(struct sk_buff *
 		return NETDEV_TX_OK;
 	}
 
-	/* Length of the packet body */
-	/* FIXME: what if the skb is smaller than this? */
-	len = max_t(int, ALIGN(skb->len, 2), ETH_ZLEN);
-	skb = skb_padto(skb, len);
-	if (skb == NULL)
+	/* Check packet length */
+	data_len = skb->len;
+	if (data_len < ETH_HLEN)
 		goto fail;
-	len -= ETH_HLEN;
 
 	eh = (struct ethhdr *)skb->data;
 
@@ -485,7 +482,7 @@ static int orinoco_xmit(struct sk_buff *
 	/* Encapsulate Ethernet-II frames */
 	if (ntohs(eh->h_proto) > ETH_DATA_LEN) { /* Ethernet-II frame */
 		struct header_struct hdr;
-		data_len = len;
+		data_len = skb->len - ETH_HLEN;
 		data_off = HERMES_802_3_OFFSET + sizeof(hdr);
 		p = skb->data + ETH_HLEN;
 
@@ -507,21 +504,13 @@ static int orinoco_xmit(struct sk_buff *
 			stats->tx_errors++;
 			goto fail;
 		}
-		/* Actual xfer length - allow for padding */
-		len = ALIGN(data_len, 2);
-		if (len < ETH_ZLEN - ETH_HLEN)
-			len = ETH_ZLEN - ETH_HLEN;
 	} else { /* IEEE 802.3 frame */
-		data_len = len + ETH_HLEN;
+		data_len = skb->len;
 		data_off = HERMES_802_3_OFFSET;
 		p = skb->data;
-		/* Actual xfer length - round up for odd length packets */
-		len = ALIGN(data_len, 2);
-		if (len < ETH_ZLEN)
-			len = ETH_ZLEN;
 	}
 
-	err = hermes_bap_pwrite_pad(hw, USER_BAP, p, data_len, len,
+	err = hermes_bap_pwrite(hw, USER_BAP, p, data_len,
 				txfid, data_off);
 	if (err) {
 		printk(KERN_ERR "%s: Error %d writing packet to BAP\n",

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642

#12 lore raw

PATCH 12/21 orinoco: refactor and clean up Tx error handling

In reply to a message not in the archive

From: Pavel Roskin <proski-mXXj517/[email protected]>

The result of orinoco_xmit() can be OK, dropped packet and busy transmitter. Rename labels accordingly. Increment stats->tx_errors in one place. Increment stats->tx_dropped - nobody is doing it for us.

---

 drivers/net/wireless/orinoco.c |   29 +++++++++++++----------------
 1 files changed, 13 insertions(+), 16 deletions(-)
drivers/net/wireless/orinoco.c +13 -16
index 9fde17b..e7d06b9 100644
@@ -449,16 +449,13 @@ static int orinoco_xmit(struct sk_buff *
 		/* Oops, the firmware hasn't established a connection,
                    silently drop the packet (this seems to be the
                    safest approach). */
-		stats->tx_errors++;
-		orinoco_unlock(priv, &flags);
-		dev_kfree_skb(skb);
-		return NETDEV_TX_OK;
+		goto drop;
 	}
 
 	/* Check packet length */
 	data_len = skb->len;
 	if (data_len < ETH_HLEN)
-		goto fail;
+		goto drop;
 
 	eh = (struct ethhdr *)skb->data;
 
@@ -469,8 +466,7 @@ static int orinoco_xmit(struct sk_buff *
 		if (net_ratelimit())
 			printk(KERN_ERR "%s: Error %d writing Tx descriptor "
 			       "to BAP\n", dev->name, err);
-		stats->tx_errors++;
-		goto fail;
+		goto busy;
 	}
 
 	/* Clear the 802.11 header and data length fields - some
@@ -501,8 +497,7 @@ static int orinoco_xmit(struct sk_buff *
 			if (net_ratelimit())
 				printk(KERN_ERR "%s: Error %d writing packet "
 				       "header to BAP\n", dev->name, err);
-			stats->tx_errors++;
-			goto fail;
+			goto busy;
 		}
 	} else { /* IEEE 802.3 frame */
 		data_len = skb->len;
@@ -515,8 +510,7 @@ static int orinoco_xmit(struct sk_buff *
 	if (err) {
 		printk(KERN_ERR "%s: Error %d writing packet to BAP\n",
 		       dev->name, err);
-		stats->tx_errors++;
-		goto fail;
+		goto busy;
 	}
 
 	/* Finally, we actually initiate the send */
@@ -529,20 +523,23 @@ static int orinoco_xmit(struct sk_buff *
 		if (net_ratelimit())
 			printk(KERN_ERR "%s: Error %d transmitting packet\n",
 				dev->name, err);
-		stats->tx_errors++;
-		goto fail;
+		goto busy;
 	}
 
 	dev->trans_start = jiffies;
 	stats->tx_bytes += data_off + data_len;
+	goto ok;
 
-	orinoco_unlock(priv, &flags);
+ drop:
+	stats->tx_errors++;
+	stats->tx_dropped++;
 
+ ok:
+	orinoco_unlock(priv, &flags);
 	dev_kfree_skb(skb);
-
 	return NETDEV_TX_OK;
- fail:
 
+ busy:
 	orinoco_unlock(priv, &flags);
 	return NETDEV_TX_BUSY;
 }

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642

#13 lore raw

PATCH 13/21 orinoco: simplify 802.3 encapsulation code

In reply to a message not in the archive

From: Pavel Roskin <proski-mXXj517/[email protected]>

Use skb_pull() to strip the addresses from the original packet. Don't strip protocol bytes.

---

 drivers/net/wireless/orinoco.c |   44 ++++++++++++++++++----------------------
 drivers/net/wireless/orinoco.h |   14 -------------
 2 files changed, 20 insertions(+), 38 deletions(-)
drivers/net/wireless/orinoco.c +20 -24
index e7d06b9..4d63738 100644
@@ -421,9 +421,8 @@ static int orinoco_xmit(struct sk_buff *
 	hermes_t *hw = &priv->hw;
 	int err = 0;
 	u16 txfid = priv->txfid;
-	char *p;
 	struct ethhdr *eh;
-	int data_len, data_off;
+	int data_off;
 	struct hermes_tx_descriptor desc;
 	unsigned long flags;
 
@@ -453,8 +452,7 @@ static int orinoco_xmit(struct sk_buff *
 	}
 
 	/* Check packet length */
-	data_len = skb->len;
-	if (data_len < ETH_HLEN)
+	if (skb->len < ETH_HLEN)
 		goto drop;
 
 	eh = (struct ethhdr *)skb->data;
@@ -477,22 +475,22 @@ static int orinoco_xmit(struct sk_buff *
 
 	/* Encapsulate Ethernet-II frames */
 	if (ntohs(eh->h_proto) > ETH_DATA_LEN) { /* Ethernet-II frame */
-		struct header_struct hdr;
-		data_len = skb->len - ETH_HLEN;
-		data_off = HERMES_802_3_OFFSET + sizeof(hdr);
-		p = skb->data + ETH_HLEN;
-
-		/* 802.3 header */
-		memcpy(hdr.dest, eh->h_dest, ETH_ALEN);
-		memcpy(hdr.src, eh->h_source, ETH_ALEN);
-		hdr.len = htons(data_len + ENCAPS_OVERHEAD);
-		
-		/* 802.2 header */
-		memcpy(&hdr.dsap, &encaps_hdr, sizeof(encaps_hdr));
-			
-		hdr.ethertype = eh->h_proto;
-		err  = hermes_bap_pwrite(hw, USER_BAP, &hdr, sizeof(hdr),
-					 txfid, HERMES_802_3_OFFSET);
+		struct header_struct {
+			struct ethhdr eth;	/* 802.3 header */
+			u8 encap[6];		/* 802.2 header */
+		} __attribute__ ((packed)) hdr;
+
+		/* Strip destination and source from the data */
+		skb_pull(skb, 2 * ETH_ALEN);
+		data_off = HERMES_802_2_OFFSET + sizeof(encaps_hdr);
+
+		/* And move them to a separate header */
+		memcpy(&hdr.eth, eh, 2 * ETH_ALEN);
+		hdr.eth.h_proto = htons(sizeof(encaps_hdr) + skb->len);
+		memcpy(hdr.encap, encaps_hdr, sizeof(encaps_hdr));
+
+		err = hermes_bap_pwrite(hw, USER_BAP, &hdr, sizeof(hdr),
+					txfid, HERMES_802_3_OFFSET);
 		if (err) {
 			if (net_ratelimit())
 				printk(KERN_ERR "%s: Error %d writing packet "
@@ -500,12 +498,10 @@ static int orinoco_xmit(struct sk_buff *
 			goto busy;
 		}
 	} else { /* IEEE 802.3 frame */
-		data_len = skb->len;
 		data_off = HERMES_802_3_OFFSET;
-		p = skb->data;
 	}
 
-	err = hermes_bap_pwrite(hw, USER_BAP, p, data_len,
+	err = hermes_bap_pwrite(hw, USER_BAP, skb->data, skb->len,
 				txfid, data_off);
 	if (err) {
 		printk(KERN_ERR "%s: Error %d writing packet to BAP\n",
@@ -527,7 +523,7 @@ static int orinoco_xmit(struct sk_buff *
 	}
 
 	dev->trans_start = jiffies;
-	stats->tx_bytes += data_off + data_len;
+	stats->tx_bytes += data_off + skb->len;
 	goto ok;
 
  drop:
drivers/net/wireless/orinoco.h +0 -14
index c6922a7..ca01e45 100644
@@ -30,20 +30,6 @@ struct orinoco_key {
 	char data[ORINOCO_MAX_KEY_SIZE];
 } __attribute__ ((packed));
 
-struct header_struct {
-	/* 802.3 */
-	u8 dest[ETH_ALEN];
-	u8 src[ETH_ALEN];
-	__be16 len;
-	/* 802.2 */
-	u8 dsap;
-	u8 ssap;
-	u8 ctrl;
-	/* SNAP */
-	u8 oui[3];
-	unsigned short ethertype;
-} __attribute__ ((packed));
-
 typedef enum {
 	FIRMWARE_TYPE_AGERE,
 	FIRMWARE_TYPE_INTERSIL,

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642

#14 lore raw

PATCH 14/21 orinoco: fix BAP0 offset error after several days of operation

In reply to a message not in the archive

From: Jiri Benc <[email protected]>

After several days of operation of Netgear MA311 card, the card becomes to seek improperly and needs reset. This patch tries to reset the card when this situation occurs.

Mar  9 06:45:16 berkeley kernel: wlan0: Error -5 writing packet to BAP
Mar  9 06:45:16 berkeley kernel: hermes @ f992a000: BAP0 offset error: reg=0x4044 id=0x128 offset=0x44
Mar  9 06:45:16 berkeley kernel: wlan0: Error -5 writing packet to BAP
Mar  9 06:45:16 berkeley kernel: hermes @ f992a000: BAP0 offset error: reg=0x4044 id=0x128 offset=0x44

(etc.)

A more detailed description of the problem can be found at
https://bugzilla.novell.com/show_bug.cgi?id=154773
The same problem with different card is reported at
http://sourceforge.net/mailarchive/message.php?msg_id=14597046

---

 drivers/net/wireless/orinoco.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/net/wireless/orinoco.c +2 -0
index 4d63738..80cf6fb 100644
@@ -536,6 +536,8 @@ static int orinoco_xmit(struct sk_buff *
 	return NETDEV_TX_OK;
 
  busy:
+	if (err == -EIO)
+		schedule_work(&priv->reset_work);
 	orinoco_unlock(priv, &flags);
 	return NETDEV_TX_BUSY;
 }

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642

#15 lore raw

PATCH 15/21 orinoco: delay FID allocation after firmware initialization

In reply to a message not in the archive

From: Pavel Roskin <proski-mXXj517/[email protected]>

This is needed to identify the card before possible allocation problems, so that the user at least can report the firmware version that fails.

---

 drivers/net/wireless/orinoco.c |   28 ++++++++++++++++++++++------
 1 files changed, 22 insertions(+), 6 deletions(-)
drivers/net/wireless/orinoco.c +22 -6
index 80cf6fb..d4c13ff 100644
@@ -1345,15 +1345,11 @@ int __orinoco_down(struct net_device *de
 	return 0;
 }
 
-int orinoco_reinit_firmware(struct net_device *dev)
+static int orinoco_allocate_fid(struct net_device *dev)
 {
 	struct orinoco_private *priv = netdev_priv(dev);
 	struct hermes *hw = &priv->hw;
 	int err;
-
-	err = hermes_init(hw);
-	if (err)
-		return err;
 
 	err = hermes_allocate(hw, priv->nicbuf_size, &priv->txfid);
 	if (err == -EIO && priv->nicbuf_size > TX_NICBUF_SIZE_BUG) {
@@ -1372,7 +1368,20 @@ int orinoco_reinit_firmware(struct net_d
 
 	return err;
 }
+
+int orinoco_reinit_firmware(struct net_device *dev)
+{
+	struct orinoco_private *priv = netdev_priv(dev);
+	struct hermes *hw = &priv->hw;
+	int err;
 
+	err = hermes_init(hw);
+	if (!err)
+		err = orinoco_allocate_fid(dev);
+
+	return err;
+}
+
 static int __orinoco_hw_set_bitrate(struct orinoco_private *priv)
 {
 	hermes_t *hw = &priv->hw;
@@ -2224,7 +2233,7 @@ static int orinoco_init(struct net_devic
 	priv->nicbuf_size = IEEE80211_FRAME_LEN + ETH_HLEN;
 
 	/* Initialize the firmware */
-	err = orinoco_reinit_firmware(dev);
+	err = hermes_init(hw);
 	if (err != 0) {
 		printk(KERN_ERR "%s: failed to initialize firmware (err = %d)\n",
 		       dev->name, err);
@@ -2281,6 +2290,13 @@ static int orinoco_init(struct net_devic
 	priv->nick[len] = '\0';
 
 	printk(KERN_DEBUG "%s: Station name \"%s\"\n", dev->name, priv->nick);
+
+	err = orinoco_allocate_fid(dev);
+	if (err) {
+		printk(KERN_ERR "%s: failed to allocate NIC buffer!\n",
+		       dev->name);
+		goto out;
+	}
 
 	/* Get allowed channels */
 	err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_CHANNELLIST,

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642

#16 lore raw

PATCH 16/21 orinoco_pci: disable device and free IRQ when suspending

In reply to a message not in the archive

From: Pavel Roskin <proski-mXXj517/[email protected]>

---

 drivers/net/wireless/orinoco_pci.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
drivers/net/wireless/orinoco_pci.c +11 -0
index 5362c21..e57e92b 100644
@@ -304,7 +304,9 @@ static int orinoco_pci_suspend(struct pc
 	
 	orinoco_unlock(priv, &flags);
 
+	free_irq(pdev->irq, dev);
 	pci_save_state(pdev);
+	pci_disable_device(pdev);
 	pci_set_power_state(pdev, PCI_D3hot);
 
 	return 0;
@@ -320,7 +322,16 @@ static int orinoco_pci_resume(struct pci
 	printk(KERN_DEBUG "%s: Orinoco-PCI waking up\n", dev->name);
 
 	pci_set_power_state(pdev, 0);
+	pci_enable_device(pdev);
 	pci_restore_state(pdev);
+
+	err = request_irq(pdev->irq, orinoco_interrupt, SA_SHIRQ,
+			  dev->name, dev);
+	if (err) {
+		printk(KERN_ERR "%s: Cannot re-allocate IRQ\n", dev->name);
+		pci_disable_device(pdev);
+		return -EBUSY;
+	}
 
 	err = orinoco_reinit_firmware(dev);
 	if (err) {

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642

A message that is not in the archive (sent off-list or not yet received): 20060407081051.16107.87289.stgit-fdEtzkpK75rby3iVrkZq2A@public.gmane.org

#18 lore raw

Re: [PATCH 16/21] orinoco_pci: disable device and free IRQ when suspending

Pavel Roskin <proski-mXXj517/[email protected]> :
[...]

Quoted 5 lines
drivers/net/wireless/orinoco_pci.c +0 -0
index 5362c21..e57e92b 100644

drivers/net/wireless/orinoco_pci.c static int orinoco_pci_suspend(struct pc · line 312

Quoted 9 lines
drivers/net/wireless/orinoco_pci.c +2 -0
@@ -304,7 +304,9 @@ static int orinoco_pci_suspend(struct pc
 
 	orinoco_unlock(priv, &flags);
 
+	free_irq(pdev->irq, dev);
 	pci_save_state(pdev);
+	pci_disable_device(pdev);
 	pci_set_power_state(pdev, PCI_D3hot);
 
 	return 0;

/me stares at the thread behind http://lkml.org/lkml/2005/7/30/143

Imho {free/request}_irq during suspend/resume deserves some explanation.

Signature · 8 lines
Ueimor


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642

A message that is not in the archive (sent off-list or not yet received): 20060407212429.GA15720-lmTtMILVy1jWQcoT9B9Ug5SCg42XY1Uw0E9HWUfgJXw@public.gmane.org

#20 lore raw

Re: [PATCH 16/21] orinoco_pci: disable device and free IRQ when suspending

Hello!

Quoted 15 lines · Francois Romieu

Pavel Roskin <proski-mXXj517/[email protected]> :
[...]

Quoted 13 lines
drivers/net/wireless/orinoco_pci.c +2 -0
index 5362c21..e57e92b 100644
@@ -304,7 +304,9 @@ static int orinoco_pci_suspend(struct pc
 
 	orinoco_unlock(priv, &flags);
 
+	free_irq(pdev->irq, dev);
 	pci_save_state(pdev);
+	pci_disable_device(pdev);
 	pci_set_power_state(pdev, PCI_D3hot);
 
Quoted 6 lines

drivers/net/wireless/orinoco_pci.c static int orinoco_pci_suspend(struct pc · line 312

Quoted 1 line
drivers/net/wireless/orinoco_pci.c +0 -0
 	return 0;

/me stares at the thread behind http://lkml.org/lkml/2005/7/30/143

Imho {free/request}_irq during suspend/resume deserves some explanation.

I followed examples from other drivers. The thread in question deals with the patch where pci_disable_device() precedes free_irq(). Besides, bridges may need special care because they pass interrupts from other devices.

I also followed the kernel documentation (Documentation/power/pci.txt), which says that the driver should free the IRQ on suspend.

If you can suggest an alternative approach, please do so. I don't see what I can do differently.

Signature · 10 lines
Regards,
Pavel Roskin



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
#21 lore raw

Re: [PATCH 16/21] orinoco_pci: disable device and free IRQ when suspending

Pavel Roskin <proski-mXXj517/[email protected]> :

Quoted 16 lines · Francois Romieu
Quoted 15 lines

Pavel Roskin <proski-mXXj517/[email protected]> :
[...]

Quoted 13 lines
drivers/net/wireless/orinoco_pci.c +2 -0
index 5362c21..e57e92b 100644
@@ -304,7 +304,9 @@ static int orinoco_pci_suspend(struct pc
 
 	orinoco_unlock(priv, &flags);
 
+	free_irq(pdev->irq, dev);
 	pci_save_state(pdev);
+	pci_disable_device(pdev);
 	pci_set_power_state(pdev, PCI_D3hot);
 
Quoted 8 lines
Quoted 6 lines

drivers/net/wireless/orinoco_pci.c static int orinoco_pci_suspend(struct pc · line 312

Quoted 1 line
drivers/net/wireless/orinoco_pci.c +0 -0
 	return 0;

/me stares at the thread behind http://lkml.org/lkml/2005/7/30/143

Imho {free/request}_irq during suspend/resume deserves some explanation.

I followed examples from other drivers.

Yep, that's what I do too.

tg3/sky2/skge do not free_irq() in the suspend path. They disable the device.

Quoted 8 lines

The thread in question deals with the patch where pci_disable_device() precedes free_irq(). Besides, bridges may need special care because they pass interrupts from other devices.
I also followed the kernel documentation (Documentation/power/pci.txt), which says that the driver should free the IRQ on suspend.

If you can suggest an alternative approach, please do so. I don't see what I can do differently.

Disable the device and avoid free_irq/request_irq altogether ?

The documentation does not require more:
[...]
A driver uses this function to actually transition the device into a low power state. This should include disabling I/O, IRQs, and bus-mastering, as well as

                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

physically transitioning the device to a lower power state; it may also include calls to pci_enable_wake().

-> free_irq() looks like the heavyweight option.

request_irq() can fail. The reference implementation does not care (who does ?). Imho it hints that the driver writer should not take the documentation _too_ literally when it suggests that "disabling irq == free_irq".

Signature · 8 lines
Ueimor


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
#22 lore raw

PATCH 17/21 orinoco_pci: use pci_iomap() for resources

In reply to a message not in the archive

From: Pavel Roskin <proski-mXXj517/[email protected]>

---

 drivers/net/wireless/orinoco_pci.c |   15 ++++++---------
 1 files changed, 6 insertions(+), 9 deletions(-)
drivers/net/wireless/orinoco_pci.c +6 -9
index e57e92b..75df90f 100644
@@ -170,9 +170,7 @@ static int orinoco_pci_init_one(struct p
 				const struct pci_device_id *ent)
 {
 	int err = 0;
-	unsigned long pci_iorange;
-	u16 __iomem *pci_ioaddr = NULL;
-	unsigned long pci_iolen;
+	void __iomem *pci_ioaddr = NULL;
 	struct orinoco_private *priv = NULL;
 	struct orinoco_pci_card *card;
 	struct net_device *dev = NULL;
@@ -190,10 +188,9 @@ static int orinoco_pci_init_one(struct p
 	}
 
 	/* Resource 0 is mapped to the hermes registers */
-	pci_iorange = pci_resource_start(pdev, 0);
-	pci_iolen = pci_resource_len(pdev, 0);
-	pci_ioaddr = ioremap(pci_iorange, pci_iolen);
-	if (!pci_iorange) {
+	pci_ioaddr = pci_iomap(pdev, 0, 0);
+	if (!pci_ioaddr) {
+		err = -EIO;
 		printk(KERN_ERR PFX "Cannot remap hardware registers\n");
 		goto fail_map;
 	}
@@ -208,8 +205,8 @@ static int orinoco_pci_init_one(struct p
 	priv = netdev_priv(dev);
 	card = priv->card;
 	card->pci_ioaddr = pci_ioaddr;
-	dev->mem_start = pci_iorange;
-	dev->mem_end = pci_iorange + pci_iolen - 1;
+	dev->mem_start = pci_resource_start(pdev, 0);
+	dev->mem_end = dev->mem_start + pci_resource_len(pdev, 0) - 1;
 	SET_MODULE_OWNER(dev);
 	SET_NETDEV_DEV(dev, &pdev->dev);
 

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642

A message that is not in the archive (sent off-list or not yet received): 20060407081053.16107.19347.stgit-fdEtzkpK75rby3iVrkZq2A@public.gmane.org

#24 lore raw

Re: [PATCH 17/21] orinoco_pci: use pci_iomap() for resources

Pavel Roskin <proski-mXXj517/[email protected]> :
[...]

Quoted 5 lines
drivers/net/wireless/orinoco_pci.c +0 -0
index e57e92b..75df90f 100644

drivers/net/wireless/orinoco_pci.c static int orinoco_pci_init_one(struct p · line 176

Quoted 10 lines
drivers/net/wireless/orinoco_pci.c +1 -3
@@ -170,9 +170,7 @@ static int orinoco_pci_init_one(struct p
 				const struct pci_device_id *ent)
 {
 	int err = 0;
-	unsigned long pci_iorange;
-	u16 __iomem *pci_ioaddr = NULL;
-	unsigned long pci_iolen;
+	void __iomem *pci_ioaddr = NULL;
 	struct orinoco_private *priv = NULL;
 	struct orinoco_pci_card *card;
 	struct net_device *dev = NULL;

(ok, the useless initializers disappear later in the serie)

[...]

drivers/net/wireless/orinoco_pci.c static int orinoco_pci_init_one(struct p · line 209

Quoted 8 lines
drivers/net/wireless/orinoco_pci.c +2 -2
@@ -208,8 +205,8 @@ static int orinoco_pci_init_one(struct p
 	priv = netdev_priv(dev);
 	card = priv->card;
 	card->pci_ioaddr = pci_ioaddr;
-	dev->mem_start = pci_iorange;
-	dev->mem_end = pci_iorange + pci_iolen - 1;
+	dev->mem_start = pci_resource_start(pdev, 0);
+	dev->mem_end = dev->mem_start + pci_resource_len(pdev, 0) - 1;

Is there a reason why dev->mem_{start/end} should not be removed ?

Signature · 8 lines
Ueimor


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642

A message that is not in the archive (sent off-list or not yet received): 20060407213619.GB15720-lmTtMILVy1jWQcoT9B9Ug5SCg42XY1Uw0E9HWUfgJXw@public.gmane.org

#26 lore raw

Re: [PATCH 17/21] orinoco_pci: use pci_iomap() for resources

Quoted 10 lines · Francois Romieu

drivers/net/wireless/orinoco_pci.c static int orinoco_pci_init_one(struct p · line 209

Quoted 8 lines
drivers/net/wireless/orinoco_pci.c +2 -2
@@ -208,8 +205,8 @@ static int orinoco_pci_init_one(struct p
 	priv = netdev_priv(dev);
 	card = priv->card;
 	card->pci_ioaddr = pci_ioaddr;
-	dev->mem_start = pci_iorange;
-	dev->mem_end = pci_iorange + pci_iolen - 1;
+	dev->mem_start = pci_resource_start(pdev, 0);
+	dev->mem_end = dev->mem_start + pci_resource_len(pdev, 0) - 1;

Is there a reason why dev->mem_{start/end} should not be removed ?

Is there a reason why it should? Is it going to be obsolete?

Signature · 10 lines
Regards,
Pavel Roskin



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
#27 lore raw

Re: [PATCH 17/21] orinoco_pci: use pci_iomap() for resources

Pavel Roskin <proski-mXXj517/[email protected]> :

Quoted 13 lines · Francois Romieu
Quoted 11 lines

drivers/net/wireless/orinoco_pci.c static int orinoco_pci_init_one(struct p · line 209

Quoted 9 lines
drivers/net/wireless/orinoco_pci.c +2 -2
@@ -208,8 +205,8 @@ static int orinoco_pci_init_one(struct p
 	priv = netdev_priv(dev);
 	card = priv->card;
 	card->pci_ioaddr = pci_ioaddr;
-	dev->mem_start = pci_iorange;
-	dev->mem_end = pci_iorange + pci_iolen - 1;
+	dev->mem_start = pci_resource_start(pdev, 0);
+	dev->mem_end = dev->mem_start + pci_resource_len(pdev, 0) - 1;

Is there a reason why dev->mem_{start/end} should not be removed ?

Quoted 1 line

Is there a reason why it should? Is it going to be obsolete?

It is slowly obsoleting for a few years (don't laugh...). It is preferred to store the relevant address in the private part of the (pci) device.

Moderately recent drivers do not use it at all. However it's fairly common in the setup code of the (legacy) isa devices.

Signature · 8 lines
Ueimor


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642

A message that is not in the archive (sent off-list or not yet received): 20060407233819.GB15667-lmTtMILVy1jWQcoT9B9Ug5SCg42XY1Uw0E9HWUfgJXw@public.gmane.org

#29 lore raw

Re: [PATCH 17/21] orinoco_pci: use pci_iomap() for resources

Quoting Francois Romieu <[email protected]>:

Quoted 9 lines
Quoted 3 lines
Quoted 1 line

Is there a reason why dev->mem_{start/end} should not be removed ?

Is there a reason why it should? Is it going to be obsolete?

It is slowly obsoleting for a few years (don't laugh...). It is preferred to store the relevant address in the private part of the (pci) device.

Moderately recent drivers do not use it at all. However it's fairly common in the setup code of the (legacy) isa devices.

I agree that many drivers don't use it. But it would be nice to have a document describing what is going on. On one hand we are adding new information elements (such as the bus in "ethtool -i"), on the other hand we are removing addresses from the ifconfig output. Who is deciding which information is useful and which is not?

How about netdev->irq? Is it going to be obsolete too? Then I can easily remove orinoco_pci_setup_netdev() with very minimal adjustments.

--
Regards,
Pavel Roskin

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642

A message that is not in the archive (sent off-list or not yet received): 20060407200731.mqskowo8808gccs8-2RFepEojUI3Rd1RZctBqVdHuzzzSOjJt@public.gmane.org

#31 lore raw

Re: [PATCH 17/21] orinoco_pci: use pci_iomap() for resources

Quoted 6 lines · Pavel Roskin

Quoting Francois Romieu <[email protected]>:

Quoted 5 lines
Quoted 2 lines
Quoted 1 line

Is there a reason why dev->mem_{start/end} should not be removed ?

Is there a reason why it should? Is it going to be obsolete?

It is slowly obsoleting for a few years (don't laugh...). It is preferred to store the relevant address in the private part of the (pci) device.

Quoted 7 lines
Quoted 2 lines

Moderately recent drivers do not use it at all. However it's fairly common in the setup code of the (legacy) isa devices.

I agree that many drivers don't use it. But it would be nice to have a document describing what is going on. On one hand we are adding new information elements (such as the bus in "ethtool -i"), on the other hand we are removing addresses from the ifconfig output. Who is deciding which information is useful and which is not?

Most of the ifconfig-exported stuff is obsolete, simply because most of it is quite inappropriate for hardware more modern than ISA. dev->mem_start has been a hacky way to pass options for over 10 years now, since only few, rare drivers use it to specify the ISA memory region for probing.

Quoted 2 lines

How about netdev->irq? Is it going to be obsolete too? Then I can easily remove orinoco_pci_setup_netdev() with very minimal adjustments.

netdev->irq is obsolete as well. Some newer drivers don't even bother to set it. With PCI, it became write-only, because modern drivers autoprobe their irq, ignoring whatever the user requests. With PCI MSI[-X] and even more modern hardware, dev->irq is just a cookie, not something to program PCI_INTERRUPT_LINE with. So setting netdev->irq is even less useful.

Programs which need to discover hardware information when given a network interface name should do ETHTOOL_GDRVINFO, get the bus info, and then obtain the information needed in a bus-specific way.

Jeff

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642

#32 lore raw

PATCH 18/21 orinoco: support PCI suspend/resume for Nortel, PLX and TMD adaptors

In reply to a message not in the archive

From: Pavel Roskin <proski-mXXj517/[email protected]>

Copy PCI suspend/resume functions from orinoco_pci.c.

---

 drivers/net/wireless/orinoco_nortel.c |   87 +++++++++++++++++++++++++++++++--
 drivers/net/wireless/orinoco_plx.c    |   79 ++++++++++++++++++++++++++++++
 drivers/net/wireless/orinoco_tmd.c    |   79 ++++++++++++++++++++++++++++++
 3 files changed, 241 insertions(+), 4 deletions(-)
drivers/net/wireless/orinoco_nortel.c +83 -4
index d1a670b..3fff013 100644
@@ -263,6 +263,83 @@ static void __devexit nortel_pci_remove_
 	pci_disable_device(pdev);
 }
 
+static int orinoco_nortel_suspend(struct pci_dev *pdev, pm_message_t state)
+{
+	struct net_device *dev = pci_get_drvdata(pdev);
+	struct orinoco_private *priv = netdev_priv(dev);
+	unsigned long flags;
+	int err;
+
+	err = orinoco_lock(priv, &flags);
+	if (err) {
+		printk(KERN_ERR "%s: cannot lock hardware for suspend\n",
+		       dev->name);
+		return err;
+	}
+
+	err = __orinoco_down(dev);
+	if (err)
+		printk(KERN_WARNING "%s: error %d bringing interface down "
+		       "for suspend\n", dev->name, err);
+	
+	netif_device_detach(dev);
+
+	priv->hw_unavailable++;
+	
+	orinoco_unlock(priv, &flags);
+
+	free_irq(pdev->irq, dev);
+	pci_save_state(pdev);
+	pci_disable_device(pdev);
+	pci_set_power_state(pdev, PCI_D3hot);
+
+	return 0;
+}
+
+static int orinoco_nortel_resume(struct pci_dev *pdev)
+{
+	struct net_device *dev = pci_get_drvdata(pdev);
+	struct orinoco_private *priv = netdev_priv(dev);
+	unsigned long flags;
+	int err;
+
+	pci_set_power_state(pdev, 0);
+	pci_enable_device(pdev);
+	pci_restore_state(pdev);
+
+	err = request_irq(pdev->irq, orinoco_interrupt, SA_SHIRQ,
+			  dev->name, dev);
+	if (err) {
+		printk(KERN_ERR "%s: cannot re-allocate IRQ on resume\n",
+		       dev->name);
+		pci_disable_device(pdev);
+		return -EBUSY;
+	}
+
+	err = orinoco_reinit_firmware(dev);
+	if (err) {
+		printk(KERN_ERR "%s: error %d re-initializing firmware "
+		       "on resume\n", dev->name, err);
+		return err;
+	}
+
+	spin_lock_irqsave(&priv->lock, flags);
+
+	netif_device_attach(dev);
+
+	priv->hw_unavailable--;
+
+	if (priv->open && (! priv->hw_unavailable)) {
+		err = __orinoco_up(dev);
+		if (err)
+			printk(KERN_ERR "%s: Error %d restarting card on resume\n",
+			       dev->name, err);
+	}
+	
+	spin_unlock_irqrestore(&priv->lock, flags);
+
+	return 0;
+}
 
 static struct pci_device_id nortel_pci_id_table[] = {
 	/* Nortel emobility PCI */
@@ -275,10 +352,12 @@ static struct pci_device_id nortel_pci_i
 MODULE_DEVICE_TABLE(pci, nortel_pci_id_table);
 
 static struct pci_driver nortel_pci_driver = {
-	.name = DRIVER_NAME,
-	.id_table = nortel_pci_id_table,
-	.probe = nortel_pci_init_one,
-	.remove = __devexit_p(nortel_pci_remove_one),
+	.name		= DRIVER_NAME,
+	.id_table	= nortel_pci_id_table,
+	.probe		= nortel_pci_init_one,
+	.remove		= __devexit_p(nortel_pci_remove_one),
+	.suspend	= orinoco_nortel_suspend,
+	.resume		= orinoco_nortel_resume,
 };
 
 static char version[] __initdata = DRIVER_NAME " " DRIVER_VERSION
drivers/net/wireless/orinoco_plx.c +79 -0

91 lines not on this page · raw message

drivers/net/wireless/orinoco_tmd.c +79 -0

91 lines not on this page · raw message

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642

#33 lore raw

PATCH 19/21 orinoco: reduce differences between PCI drivers, create orinoco_pci.h

In reply to a message not in the archive

From: Pavel Roskin <proski-mXXj517/[email protected]>

Make all Orinoco PCI drivers (orinoco_pci, orinoco_plx, orinoco_tmd and orinoco_nortel) as similar as possible. Use the best implementation of error handling, the best error messages, the best comments.

Put common code to orinoco_pci.h. For now, it's suspend and resume functions and function for registering the network device.

---

 drivers/net/wireless/orinoco_nortel.c |  240 +++++++++++--------------------
 drivers/net/wireless/orinoco_pci.c    |  144 +++---------------
 drivers/net/wireless/orinoco_pci.h    |  125 ++++++++++++++++
 drivers/net/wireless/orinoco_plx.c    |  259 +++++++++++----------------------
 drivers/net/wireless/orinoco_tmd.c    |  165 +++++----------------
 5 files changed, 368 insertions(+), 565 deletions(-)
drivers/net/wireless/orinoco_nortel.c +87 -153
index 3fff013..deb22fb 100644
@@ -1,5 +1,5 @@
 /* orinoco_nortel.c
- * 
+ *
  * Driver for Prism II devices which would usually be driven by orinoco_cs,
  * but are connected to the PCI bus by a PCI-to-PCMCIA adapter used in
  * Nortel emobility, Symbol LA-4113 and Symbol LA-4123.
@@ -50,16 +50,11 @@ #include <linux/pci.h>
 #include <pcmcia/cisreg.h>
 
 #include "orinoco.h"
+#include "orinoco_pci.h"
 
 #define COR_OFFSET    (0xe0)	/* COR attribute offset of Prism2 PC card */
 #define COR_VALUE     (COR_LEVEL_REQ | COR_FUNC_ENA)	/* Enable PC card with interrupt in level trigger */
 
-
-/* Nortel specific data */
-struct nortel_pci_card {
-	unsigned long iobase1;
-	unsigned long iobase2;
-};
 
 /*
  * Do a soft reset of the PCI card using the Configuration Option Register
@@ -69,48 +64,48 @@ struct nortel_pci_card {
  * Note bis : Don't try to access HERMES_CMD during the reset phase.
  * It just won't work !
  */
-static int nortel_pci_cor_reset(struct orinoco_private *priv)
+static int orinoco_nortel_cor_reset(struct orinoco_private *priv)
 {
-	struct nortel_pci_card *card = priv->card;
+	struct orinoco_pci_card *card = priv->card;
 
 	/* Assert the reset until the card notice */
-	outw_p(8, card->iobase1 + 2);
-	inw(card->iobase2 + COR_OFFSET);
-	outw_p(0x80, card->iobase2 + COR_OFFSET);
+	iowrite16(8, card->bridge_io + 2);
+	ioread16(card->attr_io + COR_OFFSET);
+	iowrite16(0x80, card->attr_io + COR_OFFSET);
 	mdelay(1);
 
 	/* Give time for the card to recover from this hard effort */
-	outw_p(0, card->iobase2 + COR_OFFSET);
-	outw_p(0, card->iobase2 + COR_OFFSET);
+	iowrite16(0, card->attr_io + COR_OFFSET);
+	iowrite16(0, card->attr_io + COR_OFFSET);
 	mdelay(1);
 
-	/* set COR as usual */
-	outw_p(COR_VALUE, card->iobase2 + COR_OFFSET);
-	outw_p(COR_VALUE, card->iobase2 + COR_OFFSET);
+	/* Set COR as usual */
+	iowrite16(COR_VALUE, card->attr_io + COR_OFFSET);
+	iowrite16(COR_VALUE, card->attr_io + COR_OFFSET);
 	mdelay(1);
 
-	outw_p(0x228, card->iobase1 + 2);
+	iowrite16(0x228, card->bridge_io + 2);
 
 	return 0;
 }
 
-static int nortel_pci_hw_init(struct nortel_pci_card *card)
+static int orinoco_nortel_hw_init(struct orinoco_pci_card *card)
 {
 	int i;
 	u32 reg;
 
-	/* setup bridge */
-	if (inw(card->iobase1) & 1) {
+	/* Setup bridge */
+	if (ioread16(card->bridge_io) & 1) {
 		printk(KERN_ERR PFX "brg1 answer1 wrong\n");
 		return -EBUSY;
 	}
-	outw_p(0x118, card->iobase1 + 2);
-	outw_p(0x108, card->iobase1 + 2);
+	iowrite16(0x118, card->bridge_io + 2);
+	iowrite16(0x108, card->bridge_io + 2);
 	mdelay(30);
-	outw_p(0x8, card->iobase1 + 2);
+	iowrite16(0x8, card->bridge_io + 2);
 	for (i = 0; i < 30; i++) {
 		mdelay(30);
-		if (inw(card->iobase1) & 0x10) {
+		if (ioread16(card->bridge_io) & 0x10) {
 			break;
 		}
 	}
@@ -118,42 +113,42 @@ static int nortel_pci_hw_init(struct nor
 		printk(KERN_ERR PFX "brg1 timed out\n");
 		return -EBUSY;
 	}
-	if (inw(card->iobase2 + 0xe0) & 1) {
+	if (ioread16(card->attr_io + COR_OFFSET) & 1) {
 		printk(KERN_ERR PFX "brg2 answer1 wrong\n");
 		return -EBUSY;
 	}
-	if (inw(card->iobase2 + 0xe2) & 1) {
+	if (ioread16(card->attr_io + COR_OFFSET + 2) & 1) {
 		printk(KERN_ERR PFX "brg2 answer2 wrong\n");
 		return -EBUSY;
 	}
-	if (inw(card->iobase2 + 0xe4) & 1) {
+	if (ioread16(card->attr_io + COR_OFFSET + 4) & 1) {
 		printk(KERN_ERR PFX "brg2 answer3 wrong\n");
 		return -EBUSY;
 	}
 
-	/* set the PCMCIA COR-Register */
-	outw_p(COR_VALUE, card->iobase2 + COR_OFFSET);
+	/* Set the PCMCIA COR-Register */
+	iowrite16(COR_VALUE, card->attr_io + COR_OFFSET);
 	mdelay(1);
-	reg = inw(card->iobase2 + COR_OFFSET);
+	reg = ioread16(card->attr_io + COR_OFFSET);
 	if (reg != COR_VALUE) {
 		printk(KERN_ERR PFX "Error setting COR value (reg=%x)\n",
 		       reg);
 		return -EBUSY;
 	}
 
-	/* set leds */
-	outw_p(1, card->iobase1 + 10);
+	/* Set LEDs */
+	iowrite16(1, card->bridge_io + 10);
 	return 0;
 }
 
-static int nortel_pci_init_one(struct pci_dev *pdev,
-			       const struct pci_device_id *ent)
+static int orinoco_nortel_init_one(struct pci_dev *pdev,
+				   const struct pci_device_id *ent)
 {
 	int err;
 	struct orinoco_private *priv;
-	struct nortel_pci_card *card;
+	struct orinoco_pci_card *card;
 	struct net_device *dev;
-	void __iomem *iomem;
+	void __iomem *hermes_io, *bridge_io, *attr_io;
 
 	err = pci_enable_device(pdev);
 	if (err) {
@@ -162,19 +157,34 @@ static int nortel_pci_init_one(struct pc
 	}
 
 	err = pci_request_regions(pdev, DRIVER_NAME);
-	if (err != 0) {
+	if (err) {
 		printk(KERN_ERR PFX "Cannot obtain PCI resources\n");
 		goto fail_resources;
 	}
 
-	iomem = pci_iomap(pdev, 2, 0);
-	if (!iomem) {
-		err = -ENOMEM;
-		goto fail_map_io;
+	bridge_io = pci_iomap(pdev, 0, 0);
+	if (!bridge_io) {
+		printk(KERN_ERR PFX "Cannot map bridge registers\n");
+		err = -EIO;
+		goto fail_map_bridge;
+	}
+
+	attr_io = pci_iomap(pdev, 1, 0);
+	if (!attr_io) {
+		printk(KERN_ERR PFX "Cannot map PCMCIA attributes\n");
+		err = -EIO;
+		goto fail_map_attr;
+	}
+
+	hermes_io = pci_iomap(pdev, 2, 0);
+	if (!hermes_io) {
+		printk(KERN_ERR PFX "Cannot map chipset registers\n");
+		err = -EIO;
+		goto fail_map_hermes;
 	}
 
 	/* Allocate network device */
-	dev = alloc_orinocodev(sizeof(*card), nortel_pci_cor_reset);
+	dev = alloc_orinocodev(sizeof(*card), orinoco_nortel_cor_reset);
 	if (!dev) {
 		printk(KERN_ERR PFX "Cannot allocate network device\n");
 		err = -ENOMEM;
@@ -183,16 +193,12 @@ static int nortel_pci_init_one(struct pc
 
 	priv = netdev_priv(dev);
 	card = priv->card;
-	card->iobase1 = pci_resource_start(pdev, 0);
-	card->iobase2 = pci_resource_start(pdev, 1);
-	dev->base_addr = pci_resource_start(pdev, 2);
+	card->bridge_io = bridge_io;
+	card->attr_io = attr_io;
 	SET_MODULE_OWNER(dev);
 	SET_NETDEV_DEV(dev, &pdev->dev);
-
-	hermes_struct_init(&priv->hw, iomem, HERMES_16BIT_REGSPACING);
 
-	printk(KERN_DEBUG PFX "Detected Nortel PCI device at %s irq:%d, "
-	       "io addr:0x%lx\n", pci_name(pdev), pdev->irq, dev->base_addr);
+	hermes_struct_init(&priv->hw, hermes_io, HERMES_16BIT_REGSPACING);
 
 	err = request_irq(pdev->irq, orinoco_interrupt, SA_SHIRQ,
 			  dev->name, dev);
@@ -201,21 +207,20 @@ static int nortel_pci_init_one(struct pc
 		err = -EBUSY;
 		goto fail_irq;
 	}
-	dev->irq = pdev->irq;
+	orinoco_pci_setup_netdev(dev, pdev, 2);
 
-	err = nortel_pci_hw_init(card);
+	err = orinoco_nortel_hw_init(card);
 	if (err) {
 		printk(KERN_ERR PFX "Hardware initialization failed\n");
 		goto fail;
 	}
 
-	err = nortel_pci_cor_reset(priv);
+	err = orinoco_nortel_cor_reset(priv);
 	if (err) {
 		printk(KERN_ERR PFX "Initial reset failed\n");
 		goto fail;
 	}
 
-
 	err = register_netdev(dev);
 	if (err) {
 		printk(KERN_ERR PFX "Cannot register network device\n");
@@ -234,9 +239,15 @@ static int nortel_pci_init_one(struct pc
 	free_orinocodev(dev);
 
  fail_alloc:
-	pci_iounmap(pdev, iomem);
+	pci_iounmap(pdev, hermes_io);
+
+ fail_map_hermes:
+	pci_iounmap(pdev, attr_io);
+
+ fail_map_attr:
+	pci_iounmap(pdev, bridge_io);
 
- fail_map_io:
+ fail_map_bridge:
 	pci_release_regions(pdev);
 
  fail_resources:
@@ -245,103 +256,27 @@ static int nortel_pci_init_one(struct pc
 	return err;
 }
 
-static void __devexit nortel_pci_remove_one(struct pci_dev *pdev)
+static void __devexit orinoco_nortel_remove_one(struct pci_dev *pdev)
 {
 	struct net_device *dev = pci_get_drvdata(pdev);
 	struct orinoco_private *priv = netdev_priv(dev);
-	struct nortel_pci_card *card = priv->card;
+	struct orinoco_pci_card *card = priv->card;
 
-	/* clear leds */
-	outw_p(0, card->iobase1 + 10);
+	/* Clear LEDs */
+	iowrite16(0, card->bridge_io + 10);
 
 	unregister_netdev(dev);
 	free_irq(dev->irq, dev);
 	pci_set_drvdata(pdev, NULL);
 	free_orinocodev(dev);
 	pci_iounmap(pdev, priv->hw.iobase);
+	pci_iounmap(pdev, card->attr_io);
+	pci_iounmap(pdev, card->bridge_io);
 	pci_release_regions(pdev);
 	pci_disable_device(pdev);
-}
-
-static int orinoco_nortel_suspend(struct pci_dev *pdev, pm_message_t state)
-{
-	struct net_device *dev = pci_get_drvdata(pdev);
-	struct orinoco_private *priv = netdev_priv(dev);
-	unsigned long flags;
-	int err;
-
-	err = orinoco_lock(priv, &flags);
-	if (err) {
-		printk(KERN_ERR "%s: cannot lock hardware for suspend\n",
-		       dev->name);
-		return err;
-	}
-
-	err = __orinoco_down(dev);
-	if (err)
-		printk(KERN_WARNING "%s: error %d bringing interface down "
-		       "for suspend\n", dev->name, err);
-	
-	netif_device_detach(dev);
-
-	priv->hw_unavailable++;
-	
-	orinoco_unlock(priv, &flags);
-
-	free_irq(pdev->irq, dev);
-	pci_save_state(pdev);
-	pci_disable_device(pdev);
-	pci_set_power_state(pdev, PCI_D3hot);
-
-	return 0;
-}
-
-static int orinoco_nortel_resume(struct pci_dev *pdev)
-{
-	struct net_device *dev = pci_get_drvdata(pdev);
-	struct orinoco_private *priv = netdev_priv(dev);
-	unsigned long flags;
-	int err;
-
-	pci_set_power_state(pdev, 0);
-	pci_enable_device(pdev);
-	pci_restore_state(pdev);
-
-	err = request_irq(pdev->irq, orinoco_interrupt, SA_SHIRQ,
-			  dev->name, dev);
-	if (err) {
-		printk(KERN_ERR "%s: cannot re-allocate IRQ on resume\n",
-		       dev->name);
-		pci_disable_device(pdev);
-		return -EBUSY;
-	}
-
-	err = orinoco_reinit_firmware(dev);
-	if (err) {
-		printk(KERN_ERR "%s: error %d re-initializing firmware "
-		       "on resume\n", dev->name, err);
-		return err;
-	}
-
-	spin_lock_irqsave(&priv->lock, flags);
-
-	netif_device_attach(dev);
-
-	priv->hw_unavailable--;
-
-	if (priv->open && (! priv->hw_unavailable)) {
-		err = __orinoco_up(dev);
-		if (err)
-			printk(KERN_ERR "%s: Error %d restarting card on resume\n",
-			       dev->name, err);
-	}
-	
-	spin_unlock_irqrestore(&priv->lock, flags);
-
-	return 0;
 }
 
-static struct pci_device_id nortel_pci_id_table[] = {
+static struct pci_device_id orinoco_nortel_id_table[] = {
 	/* Nortel emobility PCI */
 	{0x126c, 0x8030, PCI_ANY_ID, PCI_ANY_ID,},
 	/* Symbol LA-4123 PCI */
@@ -349,15 +284,15 @@ static struct pci_device_id nortel_pci_i
 	{0,},
 };
 
-MODULE_DEVICE_TABLE(pci, nortel_pci_id_table);
+MODULE_DEVICE_TABLE(pci, orinoco_nortel_id_table);
 
-static struct pci_driver nortel_pci_driver = {
+static struct pci_driver orinoco_nortel_driver = {
 	.name		= DRIVER_NAME,
-	.id_table	= nortel_pci_id_table,
-	.probe		= nortel_pci_init_one,
-	.remove		= __devexit_p(nortel_pci_remove_one),
-	.suspend	= orinoco_nortel_suspend,
-	.resume		= orinoco_nortel_resume,
+	.id_table	= orinoco_nortel_id_table,
+	.probe		= orinoco_nortel_init_one,
+	.remove		= __devexit_p(orinoco_nortel_remove_one),
+	.suspend	= orinoco_pci_suspend,
+	.resume		= orinoco_pci_resume,
 };
 
 static char version[] __initdata = DRIVER_NAME " " DRIVER_VERSION
@@ -367,20 +302,19 @@ MODULE_DESCRIPTION
     ("Driver for wireless LAN cards using the Nortel PCI bridge");
 MODULE_LICENSE("Dual MPL/GPL");
 
-static int __init nortel_pci_init(void)
+static int __init orinoco_nortel_init(void)
 {
 	printk(KERN_DEBUG "%s\n", version);
-	return pci_module_init(&nortel_pci_driver);
+	return pci_module_init(&orinoco_nortel_driver);
 }
 
-static void __exit nortel_pci_exit(void)
+static void __exit orinoco_nortel_exit(void)
 {
-	pci_unregister_driver(&nortel_pci_driver);
-	ssleep(1);
+	pci_unregister_driver(&orinoco_nortel_driver);
 }
 
-module_init(nortel_pci_init);
-module_exit(nortel_pci_exit);
+module_init(orinoco_nortel_init);
+module_exit(orinoco_nortel_exit);
 
 /*
  * Local variables:
drivers/net/wireless/orinoco_pci.c +24 -120

243 lines not on this page · raw message

drivers/net/wireless/orinoco_pci.h new file +125 -0

125 lines not on this page · raw message

drivers/net/wireless/orinoco_plx.c +89 -170

385 lines not on this page · raw message

drivers/net/wireless/orinoco_tmd.c +43 -122

280 lines not on this page · raw message

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642

A message that is not in the archive (sent off-list or not yet received): 20060407081057.16107.82106.stgit-fdEtzkpK75rby3iVrkZq2A@public.gmane.org

#35 lore raw

Re: [PATCH 19/21] orinoco: reduce differences between PCI drivers, create orinoco_pci.h

Pavel Roskin <proski-mXXj517/[email protected]> :

Quoted 3 lines

index 0000000..b05a9a5

drivers/net/wireless/orinoco_pci.h new file +0 -0

[...]

Quoted 18 lines
drivers/net/wireless/orinoco_pci.h new file +18 -0
+static int orinoco_pci_resume(struct pci_dev *pdev)
+{
+	struct net_device *dev = pci_get_drvdata(pdev);
+	struct orinoco_private *priv = netdev_priv(dev);
+	unsigned long flags;
+	int err;
+
+	pci_set_power_state(pdev, 0);
+	pci_enable_device(pdev);
+	pci_restore_state(pdev);
+
+	err = request_irq(pdev->irq, orinoco_interrupt, SA_SHIRQ,
+			  dev->name, dev);
+	if (err) {
+		printk(KERN_ERR "%s: cannot re-allocate IRQ on resume\n",
+		       dev->name);
+		pci_disable_device(pdev);
+		return -EBUSY;

drivers/net/wireless/orinoco_pci.h line 107

Quoted 10 lines
drivers/net/wireless/orinoco_pci.h new file +10 -0
+	}
+
+	err = orinoco_reinit_firmware(dev);
+	if (err) {
+		printk(KERN_ERR "%s: error %d re-initializing firmware "
+		       "on resume\n", dev->name, err);
+		return err;
+	}
+
+	spin_lock_irqsave(&priv->lock, flags);

Interruptions are enabled. No need to save/restore.

drivers/net/wireless/orinoco_pci.h line 114

Quoted 7 lines
drivers/net/wireless/orinoco_pci.h new file +7 -0
+
+	netif_device_attach(dev);
+
+	priv->hw_unavailable--;
+
+	if (priv->open && (! priv->hw_unavailable)) {
+		err = __orinoco_up(dev);

I wonder if it would be enough to issue hermes_set_irqmask() later in __orinoco_up() to release this irq disabled section.

Signature · 8 lines
Ueimor


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642

A message that is not in the archive (sent off-list or not yet received): 20060407221041.GC15720-lmTtMILVy1jWQcoT9B9Ug5SCg42XY1Uw0E9HWUfgJXw@public.gmane.org

#37 lore raw

Re: [PATCH 19/21] orinoco: reduce differences between PCI drivers, create orinoco_pci.h

Quoted 3 lines · Francois Romieu

drivers/net/wireless/orinoco_pci.h line 107

Quoted 1 line
drivers/net/wireless/orinoco_pci.h new file +1 -0
+	spin_lock_irqsave(&priv->lock, flags);

Interruptions are enabled. No need to save/restore.

Agreed. I have found a few other places where it's also true. I'll fix it. Actually, I'm going to change the locking to accommodate some USB devices, so changes will be more widespread.

Quoted 9 lines

drivers/net/wireless/orinoco_pci.h line 114

Quoted 6 lines
drivers/net/wireless/orinoco_pci.h new file +6 -0
+	netif_device_attach(dev);
+
+	priv->hw_unavailable--;
+
+	if (priv->open && (! priv->hw_unavailable)) {
+		err = __orinoco_up(dev);

I wonder if it would be enough to issue hermes_set_irqmask() later in __orinoco_up() to release this irq disabled section.

Maybe, but I prefer not to touch this code, since it's about to undergo a much more radical rework.

Signature · 10 lines
Regards,
Pavel Roskin



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
#38 lore raw

PATCH 20/21 orinoco: further comment cleanup in the PCI drivers

In reply to a message not in the archive

From: Pavel Roskin <proski-mXXj517/[email protected]>

---

 drivers/net/wireless/orinoco_nortel.c |    7 +--
 drivers/net/wireless/orinoco_pci.c    |   69 +++++----------------------------
 drivers/net/wireless/orinoco_plx.c    |   42 +++-----------------
 drivers/net/wireless/orinoco_tmd.c    |   16 +-------
 4 files changed, 22 insertions(+), 112 deletions(-)
drivers/net/wireless/orinoco_nortel.c +3 -4
index deb22fb..1596182 100644
@@ -3,7 +3,6 @@
  * Driver for Prism II devices which would usually be driven by orinoco_cs,
  * but are connected to the PCI bus by a PCI-to-PCMCIA adapter used in
  * Nortel emobility, Symbol LA-4113 and Symbol LA-4123.
- * but are connected to the PCI bus by a Nortel PCI-PCMCIA-Adapter. 
  *
  * Copyright (C) 2002 Tobias Hoffmann
  *           (C) 2003 Christoph Jungegger <[email protected]>
@@ -57,7 +56,7 @@ #define COR_VALUE     (COR_LEVEL_REQ | C
 
 
 /*
- * Do a soft reset of the PCI card using the Configuration Option Register
+ * Do a soft reset of the card using the Configuration Option Register
  * We need this to get going...
  * This is the part of the code that is strongly inspired from wlan-ng
  *
@@ -68,7 +67,7 @@ static int orinoco_nortel_cor_reset(stru
 {
 	struct orinoco_pci_card *card = priv->card;
 
-	/* Assert the reset until the card notice */
+	/* Assert the reset until the card notices */
 	iowrite16(8, card->bridge_io + 2);
 	ioread16(card->attr_io + COR_OFFSET);
 	iowrite16(0x80, card->attr_io + COR_OFFSET);
@@ -126,7 +125,7 @@ static int orinoco_nortel_hw_init(struct
 		return -EBUSY;
 	}
 
-	/* Set the PCMCIA COR-Register */
+	/* Set the PCMCIA COR register */
 	iowrite16(COR_VALUE, card->attr_io + COR_OFFSET);
 	mdelay(1);
 	reg = ioread16(card->attr_io + COR_OFFSET);
drivers/net/wireless/orinoco_pci.c +11 -58

101 lines not on this page · raw message

drivers/net/wireless/orinoco_plx.c +6 -36

74 lines not on this page · raw message

drivers/net/wireless/orinoco_tmd.c +2 -14
index 438fe54..0496663 100644
@@ -26,25 +26,13 @@
  * other provisions required by the GPL.  If you do not delete the
  * provisions above, a recipient may use your version of this file
  * under either the MPL or the GPL.
-
- * Caution: this is experimental and probably buggy.  For success and
- * failure reports for different cards and adaptors, see
- * orinoco_tmd_id_table near the end of the file.  If you have a
- * card we don't have the PCI id for, and looks like it should work,
- * drop me mail with the id and "it works"/"it doesn't work".
- *
- * Note: if everything gets detected fine but it doesn't actually send
- * or receive packets, your first port of call should probably be to
- * try newer firmware in the card.  Especially if you're doing Ad-Hoc
- * modes.
  *
  * The actual driving is done by orinoco.c, this is just resource
  * allocation stuff.
  *
  * This driver is modeled after the orinoco_plx driver. The main
- * difference is that the TMD chip has only IO port ranges and no
- * memory space, i.e.  no access to the CIS. Compared to the PLX chip,
- * the io range functionalities are exchanged.
+ * difference is that the TMD chip has only IO port ranges and doesn't
+ * provide access to the PCMCIA attribute space.
  *
  * Pheecom sells cards with the TMD chip as "ASIC version"
  */

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642

#39 lore raw

PATCH 21/21 orinoco: bump version to 0.15

In reply to a message not in the archive

From: Pavel Roskin <proski-mXXj517/[email protected]>

---

 drivers/net/wireless/orinoco.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/wireless/orinoco.h +1 -1
index ca01e45..16db3e1 100644
@@ -7,7 +7,7 @@
 #ifndef _ORINOCO_H
 #define _ORINOCO_H
 
-#define DRIVER_VERSION "0.15rc3"
+#define DRIVER_VERSION "0.15"
 
 #include <linux/netdevice.h>
 #include <linux/wireless.h>

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642