aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/gianfar_sysfs.c
diff options
context:
space:
mode:
authorAndy Fleming <afleming@freescale.com>2006-04-20 17:44:29 -0400
committerJeff Garzik <jeff@garzik.org>2006-04-20 17:55:06 -0400
commitfef6108d4556917c45cd9ba397c1c7597f3990e1 (patch)
treef35566dd3ddbda7cc84fc8a03aa3aebeea7dc746 /drivers/net/gianfar_sysfs.c
parentf18b95c3e2ab0f75b23a5aabab0bc8f99bd6bbf3 (diff)
[PATCH] Fix locking in gianfar
This patch fixes several bugs in the gianfar driver, including a major one where spinlocks were horribly broken: * Split gianfar locks into two types: TX and RX * Made it so gfar_start() now clears RHALT * Fixed a bug where calling gfar_start_xmit() with interrupts off would corrupt the interrupt state * Fixed a bug where a frame could potentially arrive, and never be handled (if no more frames arrived * Fixed a bug where the rx_work_limit would never be observed by the rx completion code * Fixed a bug where the interrupt handlers were not actually protected by their spinlocks Signed-off-by: Andy Fleming <afleming@freescale.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/gianfar_sysfs.c')
-rw-r--r--drivers/net/gianfar_sysfs.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/drivers/net/gianfar_sysfs.c b/drivers/net/gianfar_sysfs.c
index 51ef181b1368..a6d5c43199cb 100644
--- a/drivers/net/gianfar_sysfs.c
+++ b/drivers/net/gianfar_sysfs.c
@@ -82,7 +82,7 @@ static ssize_t gfar_set_bd_stash(struct class_device *cdev,
82 else 82 else
83 return count; 83 return count;
84 84
85 spin_lock_irqsave(&priv->lock, flags); 85 spin_lock_irqsave(&priv->rxlock, flags);
86 86
87 /* Set the new stashing value */ 87 /* Set the new stashing value */
88 priv->bd_stash_en = new_setting; 88 priv->bd_stash_en = new_setting;
@@ -96,7 +96,7 @@ static ssize_t gfar_set_bd_stash(struct class_device *cdev,
96 96
97 gfar_write(&priv->regs->attr, temp); 97 gfar_write(&priv->regs->attr, temp);
98 98
99 spin_unlock_irqrestore(&priv->lock, flags); 99 spin_unlock_irqrestore(&priv->rxlock, flags);
100 100
101 return count; 101 return count;
102} 102}
@@ -118,7 +118,7 @@ static ssize_t gfar_set_rx_stash_size(struct class_device *cdev,
118 u32 temp; 118 u32 temp;
119 unsigned long flags; 119 unsigned long flags;
120 120
121 spin_lock_irqsave(&priv->lock, flags); 121 spin_lock_irqsave(&priv->rxlock, flags);
122 if (length > priv->rx_buffer_size) 122 if (length > priv->rx_buffer_size)
123 return count; 123 return count;
124 124
@@ -142,7 +142,7 @@ static ssize_t gfar_set_rx_stash_size(struct class_device *cdev,
142 142
143 gfar_write(&priv->regs->attr, temp); 143 gfar_write(&priv->regs->attr, temp);
144 144
145 spin_unlock_irqrestore(&priv->lock, flags); 145 spin_unlock_irqrestore(&priv->rxlock, flags);
146 146
147 return count; 147 return count;
148} 148}
@@ -166,7 +166,7 @@ static ssize_t gfar_set_rx_stash_index(struct class_device *cdev,
166 u32 temp; 166 u32 temp;
167 unsigned long flags; 167 unsigned long flags;
168 168
169 spin_lock_irqsave(&priv->lock, flags); 169 spin_lock_irqsave(&priv->rxlock, flags);
170 if (index > priv->rx_stash_size) 170 if (index > priv->rx_stash_size)
171 return count; 171 return count;
172 172
@@ -180,7 +180,7 @@ static ssize_t gfar_set_rx_stash_index(struct class_device *cdev,
180 temp |= ATTRELI_EI(index); 180 temp |= ATTRELI_EI(index);
181 gfar_write(&priv->regs->attreli, flags); 181 gfar_write(&priv->regs->attreli, flags);
182 182
183 spin_unlock_irqrestore(&priv->lock, flags); 183 spin_unlock_irqrestore(&priv->rxlock, flags);
184 184
185 return count; 185 return count;
186} 186}
@@ -205,7 +205,7 @@ static ssize_t gfar_set_fifo_threshold(struct class_device *cdev,
205 if (length > GFAR_MAX_FIFO_THRESHOLD) 205 if (length > GFAR_MAX_FIFO_THRESHOLD)
206 return count; 206 return count;
207 207
208 spin_lock_irqsave(&priv->lock, flags); 208 spin_lock_irqsave(&priv->txlock, flags);
209 209
210 priv->fifo_threshold = length; 210 priv->fifo_threshold = length;
211 211
@@ -214,7 +214,7 @@ static ssize_t gfar_set_fifo_threshold(struct class_device *cdev,
214 temp |= length; 214 temp |= length;
215 gfar_write(&priv->regs->fifo_tx_thr, temp); 215 gfar_write(&priv->regs->fifo_tx_thr, temp);
216 216
217 spin_unlock_irqrestore(&priv->lock, flags); 217 spin_unlock_irqrestore(&priv->txlock, flags);
218 218
219 return count; 219 return count;
220} 220}
@@ -240,7 +240,7 @@ static ssize_t gfar_set_fifo_starve(struct class_device *cdev,
240 if (num > GFAR_MAX_FIFO_STARVE) 240 if (num > GFAR_MAX_FIFO_STARVE)
241 return count; 241 return count;
242 242
243 spin_lock_irqsave(&priv->lock, flags); 243 spin_lock_irqsave(&priv->txlock, flags);
244 244
245 priv->fifo_starve = num; 245 priv->fifo_starve = num;
246 246
@@ -249,7 +249,7 @@ static ssize_t gfar_set_fifo_starve(struct class_device *cdev,
249 temp |= num; 249 temp |= num;
250 gfar_write(&priv->regs->fifo_tx_starve, temp); 250 gfar_write(&priv->regs->fifo_tx_starve, temp);
251 251
252 spin_unlock_irqrestore(&priv->lock, flags); 252 spin_unlock_irqrestore(&priv->txlock, flags);
253 253
254 return count; 254 return count;
255} 255}
@@ -274,7 +274,7 @@ static ssize_t gfar_set_fifo_starve_off(struct class_device *cdev,
274 if (num > GFAR_MAX_FIFO_STARVE_OFF) 274 if (num > GFAR_MAX_FIFO_STARVE_OFF)
275 return count; 275 return count;
276 276
277 spin_lock_irqsave(&priv->lock, flags); 277 spin_lock_irqsave(&priv->txlock, flags);
278 278
279 priv->fifo_starve_off = num; 279 priv->fifo_starve_off = num;
280 280
@@ -283,7 +283,7 @@ static ssize_t gfar_set_fifo_starve_off(struct class_device *cdev,
283 temp |= num; 283 temp |= num;
284 gfar_write(&priv->regs->fifo_tx_starve_shutoff, temp); 284 gfar_write(&priv->regs->fifo_tx_starve_shutoff, temp);
285 285
286 spin_unlock_irqrestore(&priv->lock, flags); 286 spin_unlock_irqrestore(&priv->txlock, flags);
287 287
288 return count; 288 return count;
289} 289}