diff options
author | David Daney <ddaney@caviumnetworks.com> | 2010-01-07 14:05:01 -0500 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2010-02-27 06:53:06 -0500 |
commit | 6568a234363978e1aebb5b7c9840ed87eed20362 (patch) | |
tree | 266c572fabdf75bd4161195c01771d9ec9be33a0 /drivers | |
parent | dbb103b243e09475c84df2b8ef17615975593761 (diff) |
Staging: Octeon Ethernet: Remove unused code.
Remove unused code, reindent, and join some spilt strings.
Signed-off-by: David Daney <ddaney@caviumnetworks.com>
To: linux-mips@linux-mips.org
To: gregkh@suse.de
Patchwork: http://patchwork.linux-mips.org/patch/842/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/octeon/ethernet-defines.h | 10 | ||||
-rw-r--r-- | drivers/staging/octeon/ethernet-mem.c | 81 | ||||
-rw-r--r-- | drivers/staging/octeon/ethernet-rx.c | 77 | ||||
-rw-r--r-- | drivers/staging/octeon/ethernet-tx.c | 99 | ||||
-rw-r--r-- | drivers/staging/octeon/ethernet.c | 31 | ||||
-rw-r--r-- | drivers/staging/octeon/octeon-ethernet.h | 41 |
6 files changed, 55 insertions, 284 deletions
diff --git a/drivers/staging/octeon/ethernet-defines.h b/drivers/staging/octeon/ethernet-defines.h index f13131b03c33..6b8065f594bf 100644 --- a/drivers/staging/octeon/ethernet-defines.h +++ b/drivers/staging/octeon/ethernet-defines.h | |||
@@ -41,9 +41,6 @@ | |||
41 | * Tells the driver to populate the packet buffers with kernel skbuffs. | 41 | * Tells the driver to populate the packet buffers with kernel skbuffs. |
42 | * This allows the driver to receive packets without copying them. It also | 42 | * This allows the driver to receive packets without copying them. It also |
43 | * means that 32bit userspace can't access the packet buffers. | 43 | * means that 32bit userspace can't access the packet buffers. |
44 | * USE_32BIT_SHARED | ||
45 | * This define tells the driver to allocate memory for buffers from the | ||
46 | * 32bit sahred region instead of the kernel memory space. | ||
47 | * USE_HW_TCPUDP_CHECKSUM | 44 | * USE_HW_TCPUDP_CHECKSUM |
48 | * Controls if the Octeon TCP/UDP checksum engine is used for packet | 45 | * Controls if the Octeon TCP/UDP checksum engine is used for packet |
49 | * output. If this is zero, the kernel will perform the checksum in | 46 | * output. If this is zero, the kernel will perform the checksum in |
@@ -75,19 +72,12 @@ | |||
75 | #define CONFIG_CAVIUM_RESERVE32 0 | 72 | #define CONFIG_CAVIUM_RESERVE32 0 |
76 | #endif | 73 | #endif |
77 | 74 | ||
78 | #if CONFIG_CAVIUM_RESERVE32 | ||
79 | #define USE_32BIT_SHARED 1 | ||
80 | #define USE_SKBUFFS_IN_HW 0 | ||
81 | #define REUSE_SKBUFFS_WITHOUT_FREE 0 | ||
82 | #else | ||
83 | #define USE_32BIT_SHARED 0 | ||
84 | #define USE_SKBUFFS_IN_HW 1 | 75 | #define USE_SKBUFFS_IN_HW 1 |
85 | #ifdef CONFIG_NETFILTER | 76 | #ifdef CONFIG_NETFILTER |
86 | #define REUSE_SKBUFFS_WITHOUT_FREE 0 | 77 | #define REUSE_SKBUFFS_WITHOUT_FREE 0 |
87 | #else | 78 | #else |
88 | #define REUSE_SKBUFFS_WITHOUT_FREE 1 | 79 | #define REUSE_SKBUFFS_WITHOUT_FREE 1 |
89 | #endif | 80 | #endif |
90 | #endif | ||
91 | 81 | ||
92 | /* Max interrupts per second per core */ | 82 | /* Max interrupts per second per core */ |
93 | #define INTERRUPT_LIMIT 10000 | 83 | #define INTERRUPT_LIMIT 10000 |
diff --git a/drivers/staging/octeon/ethernet-mem.c b/drivers/staging/octeon/ethernet-mem.c index b595903e2af1..7090521471b2 100644 --- a/drivers/staging/octeon/ethernet-mem.c +++ b/drivers/staging/octeon/ethernet-mem.c | |||
@@ -26,8 +26,6 @@ | |||
26 | **********************************************************************/ | 26 | **********************************************************************/ |
27 | #include <linux/kernel.h> | 27 | #include <linux/kernel.h> |
28 | #include <linux/netdevice.h> | 28 | #include <linux/netdevice.h> |
29 | #include <linux/mii.h> | ||
30 | #include <net/dst.h> | ||
31 | 29 | ||
32 | #include <asm/octeon/octeon.h> | 30 | #include <asm/octeon/octeon.h> |
33 | 31 | ||
@@ -107,42 +105,17 @@ static int cvm_oct_fill_hw_memory(int pool, int size, int elements) | |||
107 | char *memory; | 105 | char *memory; |
108 | int freed = elements; | 106 | int freed = elements; |
109 | 107 | ||
110 | if (USE_32BIT_SHARED) { | 108 | while (freed) { |
111 | extern uint64_t octeon_reserve32_memory; | 109 | /* We need to force alignment to 128 bytes here */ |
112 | 110 | memory = kmalloc(size + 127, GFP_ATOMIC); | |
113 | memory = | 111 | if (unlikely(memory == NULL)) { |
114 | cvmx_bootmem_alloc_range(elements * size, 128, | 112 | pr_warning("Unable to allocate %u bytes for FPA pool %d\n", |
115 | octeon_reserve32_memory, | 113 | elements * size, pool); |
116 | octeon_reserve32_memory + | 114 | break; |
117 | (CONFIG_CAVIUM_RESERVE32 << 20) - | ||
118 | 1); | ||
119 | if (memory == NULL) | ||
120 | panic("Unable to allocate %u bytes for FPA pool %d\n", | ||
121 | elements * size, pool); | ||
122 | |||
123 | pr_notice("Memory range %p - %p reserved for " | ||
124 | "hardware\n", memory, | ||
125 | memory + elements * size - 1); | ||
126 | |||
127 | while (freed) { | ||
128 | cvmx_fpa_free(memory, pool, 0); | ||
129 | memory += size; | ||
130 | freed--; | ||
131 | } | ||
132 | } else { | ||
133 | while (freed) { | ||
134 | /* We need to force alignment to 128 bytes here */ | ||
135 | memory = kmalloc(size + 127, GFP_ATOMIC); | ||
136 | if (unlikely(memory == NULL)) { | ||
137 | pr_warning("Unable to allocate %u bytes for " | ||
138 | "FPA pool %d\n", | ||
139 | elements * size, pool); | ||
140 | break; | ||
141 | } | ||
142 | memory = (char *)(((unsigned long)memory + 127) & -128); | ||
143 | cvmx_fpa_free(memory, pool, 0); | ||
144 | freed--; | ||
145 | } | 115 | } |
116 | memory = (char *)(((unsigned long)memory + 127) & -128); | ||
117 | cvmx_fpa_free(memory, pool, 0); | ||
118 | freed--; | ||
146 | } | 119 | } |
147 | return elements - freed; | 120 | return elements - freed; |
148 | } | 121 | } |
@@ -156,27 +129,21 @@ static int cvm_oct_fill_hw_memory(int pool, int size, int elements) | |||
156 | */ | 129 | */ |
157 | static void cvm_oct_free_hw_memory(int pool, int size, int elements) | 130 | static void cvm_oct_free_hw_memory(int pool, int size, int elements) |
158 | { | 131 | { |
159 | if (USE_32BIT_SHARED) { | 132 | char *memory; |
160 | pr_warning("Warning: 32 shared memory is not freeable\n"); | 133 | do { |
161 | } else { | 134 | memory = cvmx_fpa_alloc(pool); |
162 | char *memory; | 135 | if (memory) { |
163 | do { | 136 | elements--; |
164 | memory = cvmx_fpa_alloc(pool); | 137 | kfree(phys_to_virt(cvmx_ptr_to_phys(memory))); |
165 | if (memory) { | 138 | } |
166 | elements--; | 139 | } while (memory); |
167 | kfree(phys_to_virt(cvmx_ptr_to_phys(memory))); | ||
168 | } | ||
169 | } while (memory); | ||
170 | 140 | ||
171 | if (elements < 0) | 141 | if (elements < 0) |
172 | pr_warning("Freeing of pool %u had too many " | 142 | pr_warning("Freeing of pool %u had too many buffers (%d)\n", |
173 | "buffers (%d)\n", | 143 | pool, elements); |
174 | pool, elements); | 144 | else if (elements > 0) |
175 | else if (elements > 0) | 145 | pr_warning("Warning: Freeing of pool %u is missing %d buffers\n", |
176 | pr_warning("Warning: Freeing of pool %u is " | 146 | pool, elements); |
177 | "missing %d buffers\n", | ||
178 | pool, elements); | ||
179 | } | ||
180 | } | 147 | } |
181 | 148 | ||
182 | int cvm_oct_mem_fill_fpa(int pool, int size, int elements) | 149 | int cvm_oct_mem_fill_fpa(int pool, int size, int elements) |
diff --git a/drivers/staging/octeon/ethernet-rx.c b/drivers/staging/octeon/ethernet-rx.c index 1b237b7e689d..f63459a96dad 100644 --- a/drivers/staging/octeon/ethernet-rx.c +++ b/drivers/staging/octeon/ethernet-rx.c | |||
@@ -33,10 +33,6 @@ | |||
33 | #include <linux/ip.h> | 33 | #include <linux/ip.h> |
34 | #include <linux/string.h> | 34 | #include <linux/string.h> |
35 | #include <linux/prefetch.h> | 35 | #include <linux/prefetch.h> |
36 | #include <linux/ethtool.h> | ||
37 | #include <linux/mii.h> | ||
38 | #include <linux/seq_file.h> | ||
39 | #include <linux/proc_fs.h> | ||
40 | #include <net/dst.h> | 36 | #include <net/dst.h> |
41 | #ifdef CONFIG_XFRM | 37 | #ifdef CONFIG_XFRM |
42 | #include <linux/xfrm.h> | 38 | #include <linux/xfrm.h> |
@@ -292,39 +288,27 @@ void cvm_oct_tasklet_rx(unsigned long unused) | |||
292 | * buffer. | 288 | * buffer. |
293 | */ | 289 | */ |
294 | if (likely(skb_in_hw)) { | 290 | if (likely(skb_in_hw)) { |
295 | /* | 291 | skb->data = skb->head + work->packet_ptr.s.addr - cvmx_ptr_to_phys(skb->head); |
296 | * This calculation was changed in case the | ||
297 | * skb header is using a different address | ||
298 | * aliasing type than the buffer. It doesn't | ||
299 | * make any differnece now, but the new one is | ||
300 | * more correct. | ||
301 | */ | ||
302 | skb->data = | ||
303 | skb->head + work->packet_ptr.s.addr - | ||
304 | cvmx_ptr_to_phys(skb->head); | ||
305 | prefetch(skb->data); | 292 | prefetch(skb->data); |
306 | skb->len = work->len; | 293 | skb->len = work->len; |
307 | skb_set_tail_pointer(skb, skb->len); | 294 | skb_set_tail_pointer(skb, skb->len); |
308 | packet_not_copied = 1; | 295 | packet_not_copied = 1; |
309 | } else { | 296 | } else { |
310 | |||
311 | /* | 297 | /* |
312 | * We have to copy the packet. First allocate | 298 | * We have to copy the packet. First allocate |
313 | * an skbuff for it. | 299 | * an skbuff for it. |
314 | */ | 300 | */ |
315 | skb = dev_alloc_skb(work->len); | 301 | skb = dev_alloc_skb(work->len); |
316 | if (!skb) { | 302 | if (!skb) { |
317 | DEBUGPRINT("Port %d failed to allocate " | 303 | DEBUGPRINT("Port %d failed to allocate skbuff, packet dropped\n", |
318 | "skbuff, packet dropped\n", | 304 | work->ipprt); |
319 | work->ipprt); | ||
320 | cvm_oct_free_work(work); | 305 | cvm_oct_free_work(work); |
321 | continue; | 306 | continue; |
322 | } | 307 | } |
323 | 308 | ||
324 | /* | 309 | /* |
325 | * Check if we've received a packet that was | 310 | * Check if we've received a packet that was |
326 | * entirely stored in the work entry. This is | 311 | * entirely stored in the work entry. |
327 | * untested. | ||
328 | */ | 312 | */ |
329 | if (unlikely(work->word2.s.bufs == 0)) { | 313 | if (unlikely(work->word2.s.bufs == 0)) { |
330 | uint8_t *ptr = work->packet_data; | 314 | uint8_t *ptr = work->packet_data; |
@@ -343,15 +327,13 @@ void cvm_oct_tasklet_rx(unsigned long unused) | |||
343 | /* No packet buffers to free */ | 327 | /* No packet buffers to free */ |
344 | } else { | 328 | } else { |
345 | int segments = work->word2.s.bufs; | 329 | int segments = work->word2.s.bufs; |
346 | union cvmx_buf_ptr segment_ptr = | 330 | union cvmx_buf_ptr segment_ptr = work->packet_ptr; |
347 | work->packet_ptr; | ||
348 | int len = work->len; | 331 | int len = work->len; |
349 | 332 | ||
350 | while (segments--) { | 333 | while (segments--) { |
351 | union cvmx_buf_ptr next_ptr = | 334 | union cvmx_buf_ptr next_ptr = |
352 | *(union cvmx_buf_ptr *) | 335 | *(union cvmx_buf_ptr *)cvmx_phys_to_ptr(segment_ptr.s.addr - 8); |
353 | cvmx_phys_to_ptr(segment_ptr.s. | 336 | |
354 | addr - 8); | ||
355 | /* | 337 | /* |
356 | * Octeon Errata PKI-100: The segment size is | 338 | * Octeon Errata PKI-100: The segment size is |
357 | * wrong. Until it is fixed, calculate the | 339 | * wrong. Until it is fixed, calculate the |
@@ -361,22 +343,18 @@ void cvm_oct_tasklet_rx(unsigned long unused) | |||
361 | * one: int segment_size = | 343 | * one: int segment_size = |
362 | * segment_ptr.s.size; | 344 | * segment_ptr.s.size; |
363 | */ | 345 | */ |
364 | int segment_size = | 346 | int segment_size = CVMX_FPA_PACKET_POOL_SIZE - |
365 | CVMX_FPA_PACKET_POOL_SIZE - | 347 | (segment_ptr.s.addr - (((segment_ptr.s.addr >> 7) - segment_ptr.s.back) << 7)); |
366 | (segment_ptr.s.addr - | 348 | /* |
367 | (((segment_ptr.s.addr >> 7) - | 349 | * Don't copy more than what |
368 | segment_ptr.s.back) << 7)); | 350 | * is left in the packet. |
369 | /* Don't copy more than what is left | 351 | */ |
370 | in the packet */ | ||
371 | if (segment_size > len) | 352 | if (segment_size > len) |
372 | segment_size = len; | 353 | segment_size = len; |
373 | /* Copy the data into the packet */ | 354 | /* Copy the data into the packet */ |
374 | memcpy(skb_put(skb, segment_size), | 355 | memcpy(skb_put(skb, segment_size), |
375 | cvmx_phys_to_ptr(segment_ptr.s. | 356 | cvmx_phys_to_ptr(segment_ptr.s.addr), |
376 | addr), | ||
377 | segment_size); | 357 | segment_size); |
378 | /* Reduce the amount of bytes left | ||
379 | to copy */ | ||
380 | len -= segment_size; | 358 | len -= segment_size; |
381 | segment_ptr = next_ptr; | 359 | segment_ptr = next_ptr; |
382 | } | 360 | } |
@@ -389,16 +367,15 @@ void cvm_oct_tasklet_rx(unsigned long unused) | |||
389 | struct net_device *dev = cvm_oct_device[work->ipprt]; | 367 | struct net_device *dev = cvm_oct_device[work->ipprt]; |
390 | struct octeon_ethernet *priv = netdev_priv(dev); | 368 | struct octeon_ethernet *priv = netdev_priv(dev); |
391 | 369 | ||
392 | /* Only accept packets for devices | 370 | /* |
393 | that are currently up */ | 371 | * Only accept packets for devices that are |
372 | * currently up. | ||
373 | */ | ||
394 | if (likely(dev->flags & IFF_UP)) { | 374 | if (likely(dev->flags & IFF_UP)) { |
395 | skb->protocol = eth_type_trans(skb, dev); | 375 | skb->protocol = eth_type_trans(skb, dev); |
396 | skb->dev = dev; | 376 | skb->dev = dev; |
397 | 377 | ||
398 | if (unlikely | 378 | if (unlikely(work->word2.s.not_IP || work->word2.s.IP_exc || work->word2.s.L4_error)) |
399 | (work->word2.s.not_IP | ||
400 | || work->word2.s.IP_exc | ||
401 | || work->word2.s.L4_error)) | ||
402 | skb->ip_summed = CHECKSUM_NONE; | 379 | skb->ip_summed = CHECKSUM_NONE; |
403 | else | 380 | else |
404 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 381 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
@@ -415,14 +392,11 @@ void cvm_oct_tasklet_rx(unsigned long unused) | |||
415 | } | 392 | } |
416 | netif_receive_skb(skb); | 393 | netif_receive_skb(skb); |
417 | } else { | 394 | } else { |
395 | /* Drop any packet received for a device that isn't up */ | ||
418 | /* | 396 | /* |
419 | * Drop any packet received for a | 397 | DEBUGPRINT("%s: Device not up, packet dropped\n", |
420 | * device that isn't up. | 398 | dev->name); |
421 | */ | 399 | */ |
422 | /* | ||
423 | DEBUGPRINT("%s: Device not up, packet dropped\n", | ||
424 | dev->name); | ||
425 | */ | ||
426 | #ifdef CONFIG_64BIT | 400 | #ifdef CONFIG_64BIT |
427 | atomic64_add(1, (atomic64_t *)&priv->stats.rx_dropped); | 401 | atomic64_add(1, (atomic64_t *)&priv->stats.rx_dropped); |
428 | #else | 402 | #else |
@@ -435,9 +409,8 @@ void cvm_oct_tasklet_rx(unsigned long unused) | |||
435 | * Drop any packet received for a device that | 409 | * Drop any packet received for a device that |
436 | * doesn't exist. | 410 | * doesn't exist. |
437 | */ | 411 | */ |
438 | DEBUGPRINT("Port %d not controlled by Linux, packet " | 412 | DEBUGPRINT("Port %d not controlled by Linux, packet dropped\n", |
439 | "dropped\n", | 413 | work->ipprt); |
440 | work->ipprt); | ||
441 | dev_kfree_skb_irq(skb); | 414 | dev_kfree_skb_irq(skb); |
442 | } | 415 | } |
443 | /* | 416 | /* |
diff --git a/drivers/staging/octeon/ethernet-tx.c b/drivers/staging/octeon/ethernet-tx.c index 535294105f65..a3594bb0a45d 100644 --- a/drivers/staging/octeon/ethernet-tx.c +++ b/drivers/staging/octeon/ethernet-tx.c | |||
@@ -31,10 +31,6 @@ | |||
31 | #include <linux/etherdevice.h> | 31 | #include <linux/etherdevice.h> |
32 | #include <linux/ip.h> | 32 | #include <linux/ip.h> |
33 | #include <linux/string.h> | 33 | #include <linux/string.h> |
34 | #include <linux/ethtool.h> | ||
35 | #include <linux/mii.h> | ||
36 | #include <linux/seq_file.h> | ||
37 | #include <linux/proc_fs.h> | ||
38 | #include <net/dst.h> | 34 | #include <net/dst.h> |
39 | #ifdef CONFIG_XFRM | 35 | #ifdef CONFIG_XFRM |
40 | #include <linux/xfrm.h> | 36 | #include <linux/xfrm.h> |
@@ -529,101 +525,6 @@ int cvm_oct_xmit_pow(struct sk_buff *skb, struct net_device *dev) | |||
529 | } | 525 | } |
530 | 526 | ||
531 | /** | 527 | /** |
532 | * Transmit a work queue entry out of the ethernet port. Both | ||
533 | * the work queue entry and the packet data can optionally be | ||
534 | * freed. The work will be freed on error as well. | ||
535 | * | ||
536 | * @dev: Device to transmit out. | ||
537 | * @work_queue_entry: | ||
538 | * Work queue entry to send | ||
539 | * @do_free: True if the work queue entry and packet data should be | ||
540 | * freed. If false, neither will be freed. | ||
541 | * @qos: Index into the queues for this port to transmit on. This | ||
542 | * is used to implement QoS if their are multiple queues per | ||
543 | * port. This parameter must be between 0 and the number of | ||
544 | * queues per port minus 1. Values outside of this range will | ||
545 | * be change to zero. | ||
546 | * | ||
547 | * Returns Zero on success, negative on failure. | ||
548 | */ | ||
549 | int cvm_oct_transmit_qos(struct net_device *dev, void *work_queue_entry, | ||
550 | int do_free, int qos) | ||
551 | { | ||
552 | unsigned long flags; | ||
553 | union cvmx_buf_ptr hw_buffer; | ||
554 | cvmx_pko_command_word0_t pko_command; | ||
555 | int dropped; | ||
556 | struct octeon_ethernet *priv = netdev_priv(dev); | ||
557 | cvmx_wqe_t *work = work_queue_entry; | ||
558 | |||
559 | if (!(dev->flags & IFF_UP)) { | ||
560 | DEBUGPRINT("%s: Device not up\n", dev->name); | ||
561 | if (do_free) | ||
562 | cvm_oct_free_work(work); | ||
563 | return -1; | ||
564 | } | ||
565 | |||
566 | /* The check on CVMX_PKO_QUEUES_PER_PORT_* is designed to completely | ||
567 | remove "qos" in the event neither interface supports | ||
568 | multiple queues per port */ | ||
569 | if ((CVMX_PKO_QUEUES_PER_PORT_INTERFACE0 > 1) || | ||
570 | (CVMX_PKO_QUEUES_PER_PORT_INTERFACE1 > 1)) { | ||
571 | if (qos <= 0) | ||
572 | qos = 0; | ||
573 | else if (qos >= cvmx_pko_get_num_queues(priv->port)) | ||
574 | qos = 0; | ||
575 | } else | ||
576 | qos = 0; | ||
577 | |||
578 | /* Start off assuming no drop */ | ||
579 | dropped = 0; | ||
580 | |||
581 | local_irq_save(flags); | ||
582 | cvmx_pko_send_packet_prepare(priv->port, priv->queue + qos, | ||
583 | CVMX_PKO_LOCK_CMD_QUEUE); | ||
584 | |||
585 | /* Build the PKO buffer pointer */ | ||
586 | hw_buffer.u64 = 0; | ||
587 | hw_buffer.s.addr = work->packet_ptr.s.addr; | ||
588 | hw_buffer.s.pool = CVMX_FPA_PACKET_POOL; | ||
589 | hw_buffer.s.size = CVMX_FPA_PACKET_POOL_SIZE; | ||
590 | hw_buffer.s.back = work->packet_ptr.s.back; | ||
591 | |||
592 | /* Build the PKO command */ | ||
593 | pko_command.u64 = 0; | ||
594 | pko_command.s.n2 = 1; /* Don't pollute L2 with the outgoing packet */ | ||
595 | pko_command.s.dontfree = !do_free; | ||
596 | pko_command.s.segs = work->word2.s.bufs; | ||
597 | pko_command.s.total_bytes = work->len; | ||
598 | |||
599 | /* Check if we can use the hardware checksumming */ | ||
600 | if (unlikely(work->word2.s.not_IP || work->word2.s.IP_exc)) | ||
601 | pko_command.s.ipoffp1 = 0; | ||
602 | else | ||
603 | pko_command.s.ipoffp1 = sizeof(struct ethhdr) + 1; | ||
604 | |||
605 | /* Send the packet to the output queue */ | ||
606 | if (unlikely | ||
607 | (cvmx_pko_send_packet_finish | ||
608 | (priv->port, priv->queue + qos, pko_command, hw_buffer, | ||
609 | CVMX_PKO_LOCK_CMD_QUEUE))) { | ||
610 | DEBUGPRINT("%s: Failed to send the packet\n", dev->name); | ||
611 | dropped = -1; | ||
612 | } | ||
613 | local_irq_restore(flags); | ||
614 | |||
615 | if (unlikely(dropped)) { | ||
616 | if (do_free) | ||
617 | cvm_oct_free_work(work); | ||
618 | priv->stats.tx_dropped++; | ||
619 | } else if (do_free) | ||
620 | cvmx_fpa_free(work, CVMX_FPA_WQE_POOL, DONT_WRITEBACK(1)); | ||
621 | |||
622 | return dropped; | ||
623 | } | ||
624 | EXPORT_SYMBOL(cvm_oct_transmit_qos); | ||
625 | |||
626 | /** | ||
627 | * This function frees all skb that are currently queued for TX. | 528 | * This function frees all skb that are currently queued for TX. |
628 | * | 529 | * |
629 | * @dev: Device being shutdown | 530 | * @dev: Device being shutdown |
diff --git a/drivers/staging/octeon/ethernet.c b/drivers/staging/octeon/ethernet.c index 4cfd4b136b32..4e054262a005 100644 --- a/drivers/staging/octeon/ethernet.c +++ b/drivers/staging/octeon/ethernet.c | |||
@@ -104,14 +104,6 @@ MODULE_PARM_DESC(pow_send_list, "\n" | |||
104 | "\t\"eth2,spi3,spi7\" would cause these three devices to transmit\n" | 104 | "\t\"eth2,spi3,spi7\" would cause these three devices to transmit\n" |
105 | "\tusing the pow_send_group."); | 105 | "\tusing the pow_send_group."); |
106 | 106 | ||
107 | static int disable_core_queueing = 1; | ||
108 | module_param(disable_core_queueing, int, 0444); | ||
109 | MODULE_PARM_DESC(disable_core_queueing, "\n" | ||
110 | "\tWhen set the networking core's tx_queue_len is set to zero. This\n" | ||
111 | "\tallows packets to be sent without lock contention in the packet\n" | ||
112 | "\tscheduler resulting in some cases in improved throughput.\n"); | ||
113 | |||
114 | |||
115 | /* | 107 | /* |
116 | * The offset from mac_addr_base that should be used for the next port | 108 | * The offset from mac_addr_base that should be used for the next port |
117 | * that is configured. By convention, if any mgmt ports exist on the | 109 | * that is configured. By convention, if any mgmt ports exist on the |
@@ -205,10 +197,6 @@ static __init void cvm_oct_configure_common_hw(void) | |||
205 | cvmx_helper_setup_red(num_packet_buffers / 4, | 197 | cvmx_helper_setup_red(num_packet_buffers / 4, |
206 | num_packet_buffers / 8); | 198 | num_packet_buffers / 8); |
207 | 199 | ||
208 | /* Enable the MII interface */ | ||
209 | if (!octeon_is_simulation()) | ||
210 | cvmx_write_csr(CVMX_SMIX_EN(0), 1); | ||
211 | |||
212 | /* Register an IRQ hander for to receive POW interrupts */ | 200 | /* Register an IRQ hander for to receive POW interrupts */ |
213 | r = request_irq(OCTEON_IRQ_WORKQ0 + pow_receive_group, | 201 | r = request_irq(OCTEON_IRQ_WORKQ0 + pow_receive_group, |
214 | cvm_oct_do_interrupt, IRQF_SHARED, "Ethernet", | 202 | cvm_oct_do_interrupt, IRQF_SHARED, "Ethernet", |
@@ -689,7 +677,6 @@ static int __init cvm_oct_init_module(void) | |||
689 | if (dev) { | 677 | if (dev) { |
690 | /* Initialize the device private structure. */ | 678 | /* Initialize the device private structure. */ |
691 | struct octeon_ethernet *priv = netdev_priv(dev); | 679 | struct octeon_ethernet *priv = netdev_priv(dev); |
692 | memset(priv, 0, sizeof(struct octeon_ethernet)); | ||
693 | 680 | ||
694 | dev->netdev_ops = &cvm_oct_pow_netdev_ops; | 681 | dev->netdev_ops = &cvm_oct_pow_netdev_ops; |
695 | priv->imode = CVMX_HELPER_INTERFACE_MODE_DISABLED; | 682 | priv->imode = CVMX_HELPER_INTERFACE_MODE_DISABLED; |
@@ -700,19 +687,16 @@ static int __init cvm_oct_init_module(void) | |||
700 | skb_queue_head_init(&priv->tx_free_list[qos]); | 687 | skb_queue_head_init(&priv->tx_free_list[qos]); |
701 | 688 | ||
702 | if (register_netdev(dev) < 0) { | 689 | if (register_netdev(dev) < 0) { |
703 | pr_err("Failed to register ethernet " | 690 | pr_err("Failed to register ethernet device for POW\n"); |
704 | "device for POW\n"); | ||
705 | kfree(dev); | 691 | kfree(dev); |
706 | } else { | 692 | } else { |
707 | cvm_oct_device[CVMX_PIP_NUM_INPUT_PORTS] = dev; | 693 | cvm_oct_device[CVMX_PIP_NUM_INPUT_PORTS] = dev; |
708 | pr_info("%s: POW send group %d, receive " | 694 | pr_info("%s: POW send group %d, receive group %d\n", |
709 | "group %d\n", | 695 | dev->name, pow_send_group, |
710 | dev->name, pow_send_group, | 696 | pow_receive_group); |
711 | pow_receive_group); | ||
712 | } | 697 | } |
713 | } else { | 698 | } else { |
714 | pr_err("Failed to allocate ethernet device " | 699 | pr_err("Failed to allocate ethernet device for POW\n"); |
715 | "for POW\n"); | ||
716 | } | 700 | } |
717 | } | 701 | } |
718 | 702 | ||
@@ -730,12 +714,9 @@ static int __init cvm_oct_init_module(void) | |||
730 | struct net_device *dev = | 714 | struct net_device *dev = |
731 | alloc_etherdev(sizeof(struct octeon_ethernet)); | 715 | alloc_etherdev(sizeof(struct octeon_ethernet)); |
732 | if (!dev) { | 716 | if (!dev) { |
733 | pr_err("Failed to allocate ethernet device " | 717 | pr_err("Failed to allocate ethernet device for port %d\n", port); |
734 | "for port %d\n", port); | ||
735 | continue; | 718 | continue; |
736 | } | 719 | } |
737 | if (disable_core_queueing) | ||
738 | dev->tx_queue_len = 0; | ||
739 | 720 | ||
740 | /* Initialize the device private structure. */ | 721 | /* Initialize the device private structure. */ |
741 | priv = netdev_priv(dev); | 722 | priv = netdev_priv(dev); |
diff --git a/drivers/staging/octeon/octeon-ethernet.h b/drivers/staging/octeon/octeon-ethernet.h index 402a15b9bb0e..208da27bc02d 100644 --- a/drivers/staging/octeon/octeon-ethernet.h +++ b/drivers/staging/octeon/octeon-ethernet.h | |||
@@ -68,47 +68,6 @@ struct octeon_ethernet { | |||
68 | */ | 68 | */ |
69 | int cvm_oct_free_work(void *work_queue_entry); | 69 | int cvm_oct_free_work(void *work_queue_entry); |
70 | 70 | ||
71 | /** | ||
72 | * Transmit a work queue entry out of the ethernet port. Both | ||
73 | * the work queue entry and the packet data can optionally be | ||
74 | * freed. The work will be freed on error as well. | ||
75 | * | ||
76 | * @dev: Device to transmit out. | ||
77 | * @work_queue_entry: | ||
78 | * Work queue entry to send | ||
79 | * @do_free: True if the work queue entry and packet data should be | ||
80 | * freed. If false, neither will be freed. | ||
81 | * @qos: Index into the queues for this port to transmit on. This | ||
82 | * is used to implement QoS if their are multiple queues per | ||
83 | * port. This parameter must be between 0 and the number of | ||
84 | * queues per port minus 1. Values outside of this range will | ||
85 | * be change to zero. | ||
86 | * | ||
87 | * Returns Zero on success, negative on failure. | ||
88 | */ | ||
89 | int cvm_oct_transmit_qos(struct net_device *dev, void *work_queue_entry, | ||
90 | int do_free, int qos); | ||
91 | |||
92 | /** | ||
93 | * Transmit a work queue entry out of the ethernet port. Both | ||
94 | * the work queue entry and the packet data can optionally be | ||
95 | * freed. The work will be freed on error as well. This simply | ||
96 | * wraps cvmx_oct_transmit_qos() for backwards compatability. | ||
97 | * | ||
98 | * @dev: Device to transmit out. | ||
99 | * @work_queue_entry: | ||
100 | * Work queue entry to send | ||
101 | * @do_free: True if the work queue entry and packet data should be | ||
102 | * freed. If false, neither will be freed. | ||
103 | * | ||
104 | * Returns Zero on success, negative on failure. | ||
105 | */ | ||
106 | static inline int cvm_oct_transmit(struct net_device *dev, | ||
107 | void *work_queue_entry, int do_free) | ||
108 | { | ||
109 | return cvm_oct_transmit_qos(dev, work_queue_entry, do_free, 0); | ||
110 | } | ||
111 | |||
112 | extern int cvm_oct_rgmii_init(struct net_device *dev); | 71 | extern int cvm_oct_rgmii_init(struct net_device *dev); |
113 | extern void cvm_oct_rgmii_uninit(struct net_device *dev); | 72 | extern void cvm_oct_rgmii_uninit(struct net_device *dev); |
114 | extern int cvm_oct_rgmii_open(struct net_device *dev); | 73 | extern int cvm_oct_rgmii_open(struct net_device *dev); |