diff options
author | Sandeep Gopalpet <Sandeep.Kumar@freescale.com> | 2009-11-02 02:03:15 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-11-03 02:40:57 -0500 |
commit | fba4ed030cfae7efdb6b79a57b0c5a9d72c9de83 (patch) | |
tree | ddee54010c64517a01ea112ca16e5bc1fee0938c /drivers/net/gianfar_sysfs.c | |
parent | f4983704a63b3764418905a77d48105a8cbce97f (diff) |
gianfar: Add Multiple Queue Support
This patch introduces multiple Tx and Rx queues.
The incoming packets can be classified into different queues
based on filer rules (out of scope of this patch). The number
of queues enabled will be based on a DTS entries fsl,num_tx_queues
and fsl,num_rx_queues.
Although we are enabling multiple queues, the interrupt coalescing
is on per device level (etsec-1.7 doesn't support multiple rxics
and txics).
Signed-off-by: Sandeep Gopalpet <Sandeep.Kumar@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/gianfar_sysfs.c')
-rw-r--r-- | drivers/net/gianfar_sysfs.c | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/drivers/net/gianfar_sysfs.c b/drivers/net/gianfar_sysfs.c index adea11ea4038..4b726f61314e 100644 --- a/drivers/net/gianfar_sysfs.c +++ b/drivers/net/gianfar_sysfs.c | |||
@@ -51,7 +51,6 @@ static ssize_t gfar_set_bd_stash(struct device *dev, | |||
51 | { | 51 | { |
52 | struct gfar_private *priv = netdev_priv(to_net_dev(dev)); | 52 | struct gfar_private *priv = netdev_priv(to_net_dev(dev)); |
53 | struct gfar __iomem *regs = priv->gfargrp.regs; | 53 | struct gfar __iomem *regs = priv->gfargrp.regs; |
54 | struct gfar_priv_rx_q *rx_queue = NULL; | ||
55 | int new_setting = 0; | 54 | int new_setting = 0; |
56 | u32 temp; | 55 | u32 temp; |
57 | unsigned long flags; | 56 | unsigned long flags; |
@@ -59,7 +58,6 @@ static ssize_t gfar_set_bd_stash(struct device *dev, | |||
59 | if (!(priv->device_flags & FSL_GIANFAR_DEV_HAS_BD_STASHING)) | 58 | if (!(priv->device_flags & FSL_GIANFAR_DEV_HAS_BD_STASHING)) |
60 | return count; | 59 | return count; |
61 | 60 | ||
62 | rx_queue = priv->rx_queue; | ||
63 | 61 | ||
64 | /* Find out the new setting */ | 62 | /* Find out the new setting */ |
65 | if (!strncmp("on", buf, count - 1) || !strncmp("1", buf, count - 1)) | 63 | if (!strncmp("on", buf, count - 1) || !strncmp("1", buf, count - 1)) |
@@ -70,7 +68,9 @@ static ssize_t gfar_set_bd_stash(struct device *dev, | |||
70 | else | 68 | else |
71 | return count; | 69 | return count; |
72 | 70 | ||
73 | spin_lock_irqsave(&rx_queue->rxlock, flags); | 71 | |
72 | local_irq_save(flags); | ||
73 | lock_rx_qs(priv); | ||
74 | 74 | ||
75 | /* Set the new stashing value */ | 75 | /* Set the new stashing value */ |
76 | priv->bd_stash_en = new_setting; | 76 | priv->bd_stash_en = new_setting; |
@@ -84,7 +84,8 @@ static ssize_t gfar_set_bd_stash(struct device *dev, | |||
84 | 84 | ||
85 | gfar_write(®s->attr, temp); | 85 | gfar_write(®s->attr, temp); |
86 | 86 | ||
87 | spin_unlock_irqrestore(&rx_queue->rxlock, flags); | 87 | unlock_rx_qs(priv); |
88 | local_irq_restore(flags); | ||
88 | 89 | ||
89 | return count; | 90 | return count; |
90 | } | 91 | } |
@@ -105,7 +106,6 @@ static ssize_t gfar_set_rx_stash_size(struct device *dev, | |||
105 | { | 106 | { |
106 | struct gfar_private *priv = netdev_priv(to_net_dev(dev)); | 107 | struct gfar_private *priv = netdev_priv(to_net_dev(dev)); |
107 | struct gfar __iomem *regs = priv->gfargrp.regs; | 108 | struct gfar __iomem *regs = priv->gfargrp.regs; |
108 | struct gfar_priv_rx_q *rx_queue = NULL; | ||
109 | unsigned int length = simple_strtoul(buf, NULL, 0); | 109 | unsigned int length = simple_strtoul(buf, NULL, 0); |
110 | u32 temp; | 110 | u32 temp; |
111 | unsigned long flags; | 111 | unsigned long flags; |
@@ -113,9 +113,9 @@ static ssize_t gfar_set_rx_stash_size(struct device *dev, | |||
113 | if (!(priv->device_flags & FSL_GIANFAR_DEV_HAS_BUF_STASHING)) | 113 | if (!(priv->device_flags & FSL_GIANFAR_DEV_HAS_BUF_STASHING)) |
114 | return count; | 114 | return count; |
115 | 115 | ||
116 | rx_queue = priv->rx_queue; | 116 | local_irq_save(flags); |
117 | lock_rx_qs(priv); | ||
117 | 118 | ||
118 | spin_lock_irqsave(&rx_queue->rxlock, flags); | ||
119 | if (length > priv->rx_buffer_size) | 119 | if (length > priv->rx_buffer_size) |
120 | goto out; | 120 | goto out; |
121 | 121 | ||
@@ -140,7 +140,8 @@ static ssize_t gfar_set_rx_stash_size(struct device *dev, | |||
140 | gfar_write(®s->attr, temp); | 140 | gfar_write(®s->attr, temp); |
141 | 141 | ||
142 | out: | 142 | out: |
143 | spin_unlock_irqrestore(&rx_queue->rxlock, flags); | 143 | unlock_rx_qs(priv); |
144 | local_irq_restore(flags); | ||
144 | 145 | ||
145 | return count; | 146 | return count; |
146 | } | 147 | } |
@@ -164,7 +165,6 @@ static ssize_t gfar_set_rx_stash_index(struct device *dev, | |||
164 | { | 165 | { |
165 | struct gfar_private *priv = netdev_priv(to_net_dev(dev)); | 166 | struct gfar_private *priv = netdev_priv(to_net_dev(dev)); |
166 | struct gfar __iomem *regs = priv->gfargrp.regs; | 167 | struct gfar __iomem *regs = priv->gfargrp.regs; |
167 | struct gfar_priv_rx_q *rx_queue = NULL; | ||
168 | unsigned short index = simple_strtoul(buf, NULL, 0); | 168 | unsigned short index = simple_strtoul(buf, NULL, 0); |
169 | u32 temp; | 169 | u32 temp; |
170 | unsigned long flags; | 170 | unsigned long flags; |
@@ -172,9 +172,9 @@ static ssize_t gfar_set_rx_stash_index(struct device *dev, | |||
172 | if (!(priv->device_flags & FSL_GIANFAR_DEV_HAS_BUF_STASHING)) | 172 | if (!(priv->device_flags & FSL_GIANFAR_DEV_HAS_BUF_STASHING)) |
173 | return count; | 173 | return count; |
174 | 174 | ||
175 | rx_queue = priv->rx_queue; | 175 | local_irq_save(flags); |
176 | lock_rx_qs(priv); | ||
176 | 177 | ||
177 | spin_lock_irqsave(&rx_queue->rxlock, flags); | ||
178 | if (index > priv->rx_stash_size) | 178 | if (index > priv->rx_stash_size) |
179 | goto out; | 179 | goto out; |
180 | 180 | ||
@@ -189,7 +189,8 @@ static ssize_t gfar_set_rx_stash_index(struct device *dev, | |||
189 | gfar_write(®s->attreli, flags); | 189 | gfar_write(®s->attreli, flags); |
190 | 190 | ||
191 | out: | 191 | out: |
192 | spin_unlock_irqrestore(&rx_queue->rxlock, flags); | 192 | unlock_rx_qs(priv); |
193 | local_irq_restore(flags); | ||
193 | 194 | ||
194 | return count; | 195 | return count; |
195 | } | 196 | } |
@@ -212,7 +213,6 @@ static ssize_t gfar_set_fifo_threshold(struct device *dev, | |||
212 | { | 213 | { |
213 | struct gfar_private *priv = netdev_priv(to_net_dev(dev)); | 214 | struct gfar_private *priv = netdev_priv(to_net_dev(dev)); |
214 | struct gfar __iomem *regs = priv->gfargrp.regs; | 215 | struct gfar __iomem *regs = priv->gfargrp.regs; |
215 | struct gfar_priv_tx_q *tx_queue = NULL; | ||
216 | unsigned int length = simple_strtoul(buf, NULL, 0); | 216 | unsigned int length = simple_strtoul(buf, NULL, 0); |
217 | u32 temp; | 217 | u32 temp; |
218 | unsigned long flags; | 218 | unsigned long flags; |
@@ -220,9 +220,8 @@ static ssize_t gfar_set_fifo_threshold(struct device *dev, | |||
220 | if (length > GFAR_MAX_FIFO_THRESHOLD) | 220 | if (length > GFAR_MAX_FIFO_THRESHOLD) |
221 | return count; | 221 | return count; |
222 | 222 | ||
223 | tx_queue = priv->tx_queue; | 223 | local_irq_save(flags); |
224 | 224 | lock_tx_qs(priv); | |
225 | spin_lock_irqsave(&tx_queue->txlock, flags); | ||
226 | 225 | ||
227 | priv->fifo_threshold = length; | 226 | priv->fifo_threshold = length; |
228 | 227 | ||
@@ -231,7 +230,8 @@ static ssize_t gfar_set_fifo_threshold(struct device *dev, | |||
231 | temp |= length; | 230 | temp |= length; |
232 | gfar_write(®s->fifo_tx_thr, temp); | 231 | gfar_write(®s->fifo_tx_thr, temp); |
233 | 232 | ||
234 | spin_unlock_irqrestore(&tx_queue->txlock, flags); | 233 | unlock_tx_qs(priv); |
234 | local_irq_restore(flags); | ||
235 | 235 | ||
236 | return count; | 236 | return count; |
237 | } | 237 | } |
@@ -253,7 +253,6 @@ static ssize_t gfar_set_fifo_starve(struct device *dev, | |||
253 | { | 253 | { |
254 | struct gfar_private *priv = netdev_priv(to_net_dev(dev)); | 254 | struct gfar_private *priv = netdev_priv(to_net_dev(dev)); |
255 | struct gfar __iomem *regs = priv->gfargrp.regs; | 255 | struct gfar __iomem *regs = priv->gfargrp.regs; |
256 | struct gfar_priv_tx_q *tx_queue = NULL; | ||
257 | unsigned int num = simple_strtoul(buf, NULL, 0); | 256 | unsigned int num = simple_strtoul(buf, NULL, 0); |
258 | u32 temp; | 257 | u32 temp; |
259 | unsigned long flags; | 258 | unsigned long flags; |
@@ -261,8 +260,8 @@ static ssize_t gfar_set_fifo_starve(struct device *dev, | |||
261 | if (num > GFAR_MAX_FIFO_STARVE) | 260 | if (num > GFAR_MAX_FIFO_STARVE) |
262 | return count; | 261 | return count; |
263 | 262 | ||
264 | tx_queue = priv->tx_queue; | 263 | local_irq_save(flags); |
265 | spin_lock_irqsave(&tx_queue->txlock, flags); | 264 | lock_tx_qs(priv); |
266 | 265 | ||
267 | priv->fifo_starve = num; | 266 | priv->fifo_starve = num; |
268 | 267 | ||
@@ -271,7 +270,8 @@ static ssize_t gfar_set_fifo_starve(struct device *dev, | |||
271 | temp |= num; | 270 | temp |= num; |
272 | gfar_write(®s->fifo_tx_starve, temp); | 271 | gfar_write(®s->fifo_tx_starve, temp); |
273 | 272 | ||
274 | spin_unlock_irqrestore(&tx_queue->txlock, flags); | 273 | unlock_tx_qs(priv); |
274 | local_irq_restore(flags); | ||
275 | 275 | ||
276 | return count; | 276 | return count; |
277 | } | 277 | } |
@@ -294,7 +294,6 @@ static ssize_t gfar_set_fifo_starve_off(struct device *dev, | |||
294 | { | 294 | { |
295 | struct gfar_private *priv = netdev_priv(to_net_dev(dev)); | 295 | struct gfar_private *priv = netdev_priv(to_net_dev(dev)); |
296 | struct gfar __iomem *regs = priv->gfargrp.regs; | 296 | struct gfar __iomem *regs = priv->gfargrp.regs; |
297 | struct gfar_priv_tx_q *tx_queue = NULL; | ||
298 | unsigned int num = simple_strtoul(buf, NULL, 0); | 297 | unsigned int num = simple_strtoul(buf, NULL, 0); |
299 | u32 temp; | 298 | u32 temp; |
300 | unsigned long flags; | 299 | unsigned long flags; |
@@ -302,8 +301,8 @@ static ssize_t gfar_set_fifo_starve_off(struct device *dev, | |||
302 | if (num > GFAR_MAX_FIFO_STARVE_OFF) | 301 | if (num > GFAR_MAX_FIFO_STARVE_OFF) |
303 | return count; | 302 | return count; |
304 | 303 | ||
305 | tx_queue = priv->tx_queue; | 304 | local_irq_save(flags); |
306 | spin_lock_irqsave(&tx_queue->txlock, flags); | 305 | lock_tx_qs(priv); |
307 | 306 | ||
308 | priv->fifo_starve_off = num; | 307 | priv->fifo_starve_off = num; |
309 | 308 | ||
@@ -312,7 +311,8 @@ static ssize_t gfar_set_fifo_starve_off(struct device *dev, | |||
312 | temp |= num; | 311 | temp |= num; |
313 | gfar_write(®s->fifo_tx_starve_shutoff, temp); | 312 | gfar_write(®s->fifo_tx_starve_shutoff, temp); |
314 | 313 | ||
315 | spin_unlock_irqrestore(&tx_queue->txlock, flags); | 314 | unlock_tx_qs(priv); |
315 | local_irq_restore(flags); | ||
316 | 316 | ||
317 | return count; | 317 | return count; |
318 | } | 318 | } |