diff options
author | Felix Fietkau <nbd@openwrt.org> | 2007-06-04 09:46:30 +0000 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2007-06-04 09:46:30 +0000 |
commit | 4bc7e0ca8a72fd0e2ffc8397393a5792a03cc2d6 (patch) | |
tree | 2ecb5d5eb92a510f0ce4cee497014a7487b558ba /target/linux/ar7-2.6/files/drivers/net/cpmac.c | |
parent | 43a7635fcf7aebf499bca3e6edb05565d611c20d (diff) | |
download | upstream-4bc7e0ca8a72fd0e2ffc8397393a5792a03cc2d6.tar.gz upstream-4bc7e0ca8a72fd0e2ffc8397393a5792a03cc2d6.tar.bz2 upstream-4bc7e0ca8a72fd0e2ffc8397393a5792a03cc2d6.zip |
add ar7-2.6 fixes by Stefan Weil
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@7487 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/ar7-2.6/files/drivers/net/cpmac.c')
-rw-r--r-- | target/linux/ar7-2.6/files/drivers/net/cpmac.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/target/linux/ar7-2.6/files/drivers/net/cpmac.c b/target/linux/ar7-2.6/files/drivers/net/cpmac.c index e0c49b7083..1be7cb8ddd 100644 --- a/target/linux/ar7-2.6/files/drivers/net/cpmac.c +++ b/target/linux/ar7-2.6/files/drivers/net/cpmac.c @@ -223,6 +223,7 @@ static void cpmac_hw_init(struct net_device *dev); static int cpmac_stop(struct net_device *dev); static int cpmac_open(struct net_device *dev); +#undef CPMAC_DEBUG #define CPMAC_LOW_THRESH 32 #define CPMAC_ALLOC_SIZE 64 #define CPMAC_SKB_SIZE 1518 @@ -238,6 +239,18 @@ static void cpmac_dump_regs(u32 *base, int count) } printk("\n"); } + +static const char *cpmac_dump_buf(const uint8_t * buf, unsigned size) +{ + static char buffer[3 * 25 + 1]; + char *p = &buffer[0]; + if (size > 20) + size = 20; + while (size-- > 0) { + p += sprintf(p, " %02x", *buf++); + } + return buffer; +} #endif static int cpmac_mdio_read(struct mii_bus *bus, int phy_id, int regnum) @@ -446,7 +459,11 @@ static void cpmac_rx(struct net_device *dev) desc = priv->rx_head; dma_cache_inv((u32)desc, 16); - +#ifdef CPMAC_DEBUG + printk(KERN_DEBUG "%s: len=%d, %s\n", __func__, pkt->datalen, + cpmac_dump_buf(data, pkt->datalen)); +#endif + while ((desc->dataflags & CPMAC_OWN) == 0) { skb = cpmac_rx_one(dev, priv, desc); if (likely(skb)) { @@ -558,6 +575,9 @@ static int cpmac_start_xmit(struct sk_buff *skb, struct net_device *dev) struct cpmac_priv *priv = netdev_priv(dev); len = skb->len; +#ifdef CPMAC_DEBUG + printk(KERN_DEBUG "%s: len=%d\n", __func__, len); //cpmac_dump_buf(const uint8_t * buf, unsigned size) +#endif if (unlikely(len < ETH_ZLEN)) { if (unlikely(skb_padto(skb, ETH_ZLEN))) { if (printk_ratelimit()) @@ -689,7 +709,9 @@ static irqreturn_t cpmac_irq(int irq, void *dev_id) priv->regs->mac_eoi_vector = 0; if (unlikely(status & (INTST_HOST | INTST_STATUS))) { - printk(KERN_ERR "%s: hw error, resetting...\n", dev->name); + if (printk_ratelimit()) { + printk(KERN_ERR "%s: hw error, resetting...\n", dev->name); + } spin_lock(&priv->lock); phy_stop(priv->phy); cpmac_reset(dev); |