aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wan
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/net/wan
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/net/wan')
-rw-r--r--drivers/net/wan/ixp4xx_hss.c54
1 files changed, 11 insertions, 43 deletions
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;