aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorKrzysztof Hałasa <khc@pm.waw.pl>2008-12-21 18:26:38 -0500
committerKrzysztof Hałasa <khc@pm.waw.pl>2008-12-21 18:48:00 -0500
commite6da96ace859dad966fe85cc9552b89f48bbc930 (patch)
treec022b49ee22b355eec92d627fd45160f89406cf0 /drivers
parent9251ce959cab704eb0e4910860b06b18e7083474 (diff)
IXP4xx: move common debugging from network drivers to QMGR module.
Signed-off-by: Krzysztof Hałasa <khc@pm.waw.pl>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/arm/ixp4xx_eth.c55
-rw-r--r--drivers/net/wan/ixp4xx_hss.c54
2 files changed, 23 insertions, 86 deletions
diff --git a/drivers/net/arm/ixp4xx_eth.c b/drivers/net/arm/ixp4xx_eth.c
index 3f72eb66e7f1..64adf6cc1221 100644
--- a/drivers/net/arm/ixp4xx_eth.c
+++ b/drivers/net/arm/ixp4xx_eth.c
@@ -35,7 +35,6 @@
35#include <mach/npe.h> 35#include <mach/npe.h>
36#include <mach/qmgr.h> 36#include <mach/qmgr.h>
37 37
38#define DEBUG_QUEUES 0
39#define DEBUG_DESC 0 38#define DEBUG_DESC 0
40#define DEBUG_RX 0 39#define DEBUG_RX 0
41#define DEBUG_TX 0 40#define DEBUG_TX 0
@@ -423,47 +422,13 @@ static inline void debug_desc(u32 phys, struct desc *desc)
423#endif 422#endif
424} 423}
425 424
426static inline void debug_queue(unsigned int queue, int is_get, u32 phys)
427{
428#if DEBUG_QUEUES
429 static struct {
430 int queue;
431 char *name;
432 } names[] = {
433 { TX_QUEUE(0x10), "TX#0 " },
434 { TX_QUEUE(0x20), "TX#1 " },
435 { TX_QUEUE(0x00), "TX#2 " },
436 { RXFREE_QUEUE(0x10), "RX-free#0 " },
437 { RXFREE_QUEUE(0x20), "RX-free#1 " },
438 { RXFREE_QUEUE(0x00), "RX-free#2 " },
439 { TXDONE_QUEUE, "TX-done " },
440 };
441 int i;
442
443 for (i = 0; i < ARRAY_SIZE(names); i++)
444 if (names[i].queue == queue)
445 break;
446
447 printk(KERN_DEBUG "Queue %i %s%s %X\n", queue,
448 i < ARRAY_SIZE(names) ? names[i].name : "",
449 is_get ? "->" : "<-", phys);
450#endif
451}
452
453static inline u32 queue_get_entry(unsigned int queue)
454{
455 u32 phys = qmgr_get_entry(queue);
456 debug_queue(queue, 1, phys);
457 return phys;
458}
459
460static inline int queue_get_desc(unsigned int queue, struct port *port, 425static inline int queue_get_desc(unsigned int queue, struct port *port,
461 int is_tx) 426 int is_tx)
462{ 427{
463 u32 phys, tab_phys, n_desc; 428 u32 phys, tab_phys, n_desc;
464 struct desc *tab; 429 struct desc *tab;
465 430
466 if (!(phys = queue_get_entry(queue))) 431 if (!(phys = qmgr_get_entry(queue)))
467 return -1; 432 return -1;
468 433
469 phys &= ~0x1F; /* mask out non-address bits */ 434 phys &= ~0x1F; /* mask out non-address bits */
@@ -479,7 +444,6 @@ static inline int queue_get_desc(unsigned int queue, struct port *port,
479static inline void queue_put_desc(unsigned int queue, u32 phys, 444static inline void queue_put_desc(unsigned int queue, u32 phys,
480 struct desc *desc) 445 struct desc *desc)
481{ 446{
482 debug_queue(queue, 0, phys);
483 debug_desc(phys, desc); 447 debug_desc(phys, desc);
484 BUG_ON(phys & 0x1F); 448 BUG_ON(phys & 0x1F);
485 qmgr_put_entry(queue, phys); 449 qmgr_put_entry(queue, phys);
@@ -628,7 +592,7 @@ static void eth_txdone_irq(void *unused)
628#if DEBUG_TX 592#if DEBUG_TX
629 printk(KERN_DEBUG DRV_NAME ": eth_txdone_irq\n"); 593 printk(KERN_DEBUG DRV_NAME ": eth_txdone_irq\n");
630#endif 594#endif
631 while ((phys = queue_get_entry(TXDONE_QUEUE)) != 0) { 595 while ((phys = qmgr_get_entry(TXDONE_QUEUE)) != 0) {
632 u32 npe_id, n_desc; 596 u32 npe_id, n_desc;
633 struct port *port; 597 struct port *port;
634 struct desc *desc; 598 struct desc *desc;
@@ -840,25 +804,30 @@ static int request_queues(struct port *port)
840{ 804{
841 int err; 805 int err;
842 806
843 err = qmgr_request_queue(RXFREE_QUEUE(port->id), RX_DESCS, 0, 0); 807 err = qmgr_request_queue(RXFREE_QUEUE(port->id), RX_DESCS, 0, 0,
808 "%s:RX-free", port->netdev->name);
844 if (err) 809 if (err)
845 return err; 810 return err;
846 811
847 err = qmgr_request_queue(port->plat->rxq, RX_DESCS, 0, 0); 812 err = qmgr_request_queue(port->plat->rxq, RX_DESCS, 0, 0,
813 "%s:RX", port->netdev->name);
848 if (err) 814 if (err)
849 goto rel_rxfree; 815 goto rel_rxfree;
850 816
851 err = qmgr_request_queue(TX_QUEUE(port->id), TX_DESCS, 0, 0); 817 err = qmgr_request_queue(TX_QUEUE(port->id), TX_DESCS, 0, 0,
818 "%s:TX", port->netdev->name);
852 if (err) 819 if (err)
853 goto rel_rx; 820 goto rel_rx;
854 821
855 err = qmgr_request_queue(port->plat->txreadyq, TX_DESCS, 0, 0); 822 err = qmgr_request_queue(port->plat->txreadyq, TX_DESCS, 0, 0,
823 "%s:TX-ready", port->netdev->name);
856 if (err) 824 if (err)
857 goto rel_tx; 825 goto rel_tx;
858 826
859 /* TX-done queue handles skbs sent out by the NPEs */ 827 /* TX-done queue handles skbs sent out by the NPEs */
860 if (!ports_open) { 828 if (!ports_open) {
861 err = qmgr_request_queue(TXDONE_QUEUE, TXDONE_QUEUE_LEN, 0, 0); 829 err = qmgr_request_queue(TXDONE_QUEUE, TXDONE_QUEUE_LEN, 0, 0,
830 "%s:TX-done", DRV_NAME);
862 if (err) 831 if (err)
863 goto rel_txready; 832 goto rel_txready;
864 } 833 }
diff --git a/drivers/net/wan/ixp4xx_hss.c b/drivers/net/wan/ixp4xx_hss.c
index fa3ce81f4cfc..0c6802507a79 100644
--- a/drivers/net/wan/ixp4xx_hss.c
+++ b/drivers/net/wan/ixp4xx_hss.c
@@ -21,7 +21,6 @@
21#include <mach/npe.h> 21#include <mach/npe.h>
22#include <mach/qmgr.h> 22#include <mach/qmgr.h>
23 23
24#define DEBUG_QUEUES 0
25#define DEBUG_DESC 0 24#define DEBUG_DESC 0
26#define DEBUG_RX 0 25#define DEBUG_RX 0
27#define DEBUG_TX 0 26#define DEBUG_TX 0
@@ -555,48 +554,13 @@ static inline void debug_desc(u32 phys, struct desc *desc)
555#endif 554#endif
556} 555}
557 556
558static inline void debug_queue(unsigned int queue, int is_get, u32 phys)
559{
560#if DEBUG_QUEUES
561 static struct {
562 int queue;
563 char *name;
564 } names[] = {
565 { HSS0_PKT_TX0_QUEUE, "TX#0 " },
566 { HSS0_PKT_TXDONE_QUEUE, "TX-done#0 " },
567 { HSS0_PKT_RX_QUEUE, "RX#0 " },
568 { HSS0_PKT_RXFREE0_QUEUE, "RX-free#0 " },
569 { HSS1_PKT_TX0_QUEUE, "TX#1 " },
570 { HSS1_PKT_TXDONE_QUEUE, "TX-done#1 " },
571 { HSS1_PKT_RX_QUEUE, "RX#1 " },
572 { HSS1_PKT_RXFREE0_QUEUE, "RX-free#1 " },
573 };
574 int i;
575
576 for (i = 0; i < ARRAY_SIZE(names); i++)
577 if (names[i].queue == queue)
578 break;
579
580 printk(KERN_DEBUG "Queue %i %s%s %X\n", queue,
581 i < ARRAY_SIZE(names) ? names[i].name : "",
582 is_get ? "->" : "<-", phys);
583#endif
584}
585
586static inline u32 queue_get_entry(unsigned int queue)
587{
588 u32 phys = qmgr_get_entry(queue);
589 debug_queue(queue, 1, phys);
590 return phys;
591}
592
593static inline int queue_get_desc(unsigned int queue, struct port *port, 557static inline int queue_get_desc(unsigned int queue, struct port *port,
594 int is_tx) 558 int is_tx)
595{ 559{
596 u32 phys, tab_phys, n_desc; 560 u32 phys, tab_phys, n_desc;
597 struct desc *tab; 561 struct desc *tab;
598 562
599 if (!(phys = queue_get_entry(queue))) 563 if (!(phys = qmgr_get_entry(queue)))
600 return -1; 564 return -1;
601 565
602 BUG_ON(phys & 0x1F); 566 BUG_ON(phys & 0x1F);
@@ -612,7 +576,6 @@ static inline int queue_get_desc(unsigned int queue, struct port *port,
612static inline void queue_put_desc(unsigned int queue, u32 phys, 576static inline void queue_put_desc(unsigned int queue, u32 phys,
613 struct desc *desc) 577 struct desc *desc)
614{ 578{
615 debug_queue(queue, 0, phys);
616 debug_desc(phys, desc); 579 debug_desc(phys, desc);
617 BUG_ON(phys & 0x1F); 580 BUG_ON(phys & 0x1F);
618 qmgr_put_entry(queue, phys); 581 qmgr_put_entry(queue, phys);
@@ -930,23 +893,28 @@ static int request_hdlc_queues(struct port *port)
930{ 893{
931 int err; 894 int err;
932 895
933 err = qmgr_request_queue(queue_ids[port->id].rxfree, RX_DESCS, 0, 0); 896 err = qmgr_request_queue(queue_ids[port->id].rxfree, RX_DESCS, 0, 0,
897 "%s:RX-free", port->netdev->name);
934 if (err) 898 if (err)
935 return err; 899 return err;
936 900
937 err = qmgr_request_queue(queue_ids[port->id].rx, RX_DESCS, 0, 0); 901 err = qmgr_request_queue(queue_ids[port->id].rx, RX_DESCS, 0, 0,
902 "%s:RX", port->netdev->name);
938 if (err) 903 if (err)
939 goto rel_rxfree; 904 goto rel_rxfree;
940 905
941 err = qmgr_request_queue(queue_ids[port->id].tx, TX_DESCS, 0, 0); 906 err = qmgr_request_queue(queue_ids[port->id].tx, TX_DESCS, 0, 0,
907 "%s:TX", port->netdev->name);
942 if (err) 908 if (err)
943 goto rel_rx; 909 goto rel_rx;
944 910
945 err = qmgr_request_queue(port->plat->txreadyq, TX_DESCS, 0, 0); 911 err = qmgr_request_queue(port->plat->txreadyq, TX_DESCS, 0, 0,
912 "%s:TX-ready", port->netdev->name);
946 if (err) 913 if (err)
947 goto rel_tx; 914 goto rel_tx;
948 915
949 err = qmgr_request_queue(queue_ids[port->id].txdone, TX_DESCS, 0, 0); 916 err = qmgr_request_queue(queue_ids[port->id].txdone, TX_DESCS, 0, 0,
917 "%s:TX-done", port->netdev->name);
950 if (err) 918 if (err)
951 goto rel_txready; 919 goto rel_txready;
952 return 0; 920 return 0;