]> Pileus Git - ~andy/linux/blobdiff - drivers/net/ethernet/cadence/macb.c
net/macb: tx status is more than 8 bits now
[~andy/linux] / drivers / net / ethernet / cadence / macb.c
index 0931cb7469dc2b0be99a0e56b99602803cf3a829..cd6d431ff2b47441a810c431ecab6b1682dc37d5 100644 (file)
@@ -314,7 +314,7 @@ static void macb_tx(struct macb *bp)
        status = macb_readl(bp, TSR);
        macb_writel(bp, TSR, status);
 
-       netdev_dbg(bp->dev, "macb_tx status = %02lx\n", (unsigned long)status);
+       netdev_vdbg(bp->dev, "macb_tx status = 0x%03lx\n", (unsigned long)status);
 
        if (status & (MACB_BIT(UND) | MACB_BIT(TSR_RLE))) {
                int i;
@@ -373,13 +373,15 @@ static void macb_tx(struct macb *bp)
 
                BUG_ON(skb == NULL);
 
+               /* Make hw descriptor updates visible to CPU */
                rmb();
+
                bufstat = bp->tx_ring[tail].ctrl;
 
                if (!(bufstat & MACB_BIT(TX_USED)))
                        break;
 
-               netdev_dbg(bp->dev, "skb %u (data %p) TX complete\n",
+               netdev_vdbg(bp->dev, "skb %u (data %p) TX complete\n",
                           tail, skb->data);
                dma_unmap_single(&bp->pdev->dev, rp->mapping, skb->len,
                                 DMA_TO_DEVICE);
@@ -405,7 +407,7 @@ static int macb_rx_frame(struct macb *bp, unsigned int first_frag,
 
        len = MACB_BFEXT(RX_FRMLEN, bp->rx_ring[last_frag].ctrl);
 
-       netdev_dbg(bp->dev, "macb_rx_frame frags %u - %u (len %u)\n",
+       netdev_vdbg(bp->dev, "macb_rx_frame frags %u - %u (len %u)\n",
                   first_frag, last_frag, len);
 
        skb = netdev_alloc_skb(bp->dev, len + RX_OFFSET);
@@ -416,7 +418,10 @@ static int macb_rx_frame(struct macb *bp, unsigned int first_frag,
                        if (frag == last_frag)
                                break;
                }
+
+               /* Make descriptor updates visible to hardware */
                wmb();
+
                return 1;
        }
 
@@ -437,17 +442,19 @@ static int macb_rx_frame(struct macb *bp, unsigned int first_frag,
                                               frag_len);
                offset += RX_BUFFER_SIZE;
                bp->rx_ring[frag].addr &= ~MACB_BIT(RX_USED);
-               wmb();
 
                if (frag == last_frag)
                        break;
        }
 
+       /* Make descriptor updates visible to hardware */
+       wmb();
+
        skb->protocol = eth_type_trans(skb, bp->dev);
 
        bp->stats.rx_packets++;
        bp->stats.rx_bytes += len;
-       netdev_dbg(bp->dev, "received skb of length %u, csum: %08x\n",
+       netdev_vdbg(bp->dev, "received skb of length %u, csum: %08x\n",
                   skb->len, skb->csum);
        netif_receive_skb(skb);
 
@@ -462,6 +469,8 @@ static void discard_partial_frame(struct macb *bp, unsigned int begin,
 
        for (frag = begin; frag != end; frag = NEXT_RX(frag))
                bp->rx_ring[frag].addr &= ~MACB_BIT(RX_USED);
+
+       /* Make descriptor updates visible to hardware */
        wmb();
 
        /*
@@ -480,7 +489,9 @@ static int macb_rx(struct macb *bp, int budget)
        for (; budget > 0; tail = NEXT_RX(tail)) {
                u32 addr, ctrl;
 
+               /* Make hw descriptor updates visible to CPU */
                rmb();
+
                addr = bp->rx_ring[tail].addr;
                ctrl = bp->rx_ring[tail].ctrl;
 
@@ -525,7 +536,7 @@ static int macb_poll(struct napi_struct *napi, int budget)
 
        work_done = 0;
 
-       netdev_dbg(bp->dev, "poll: status = %08lx, budget = %d\n",
+       netdev_vdbg(bp->dev, "poll: status = %08lx, budget = %d\n",
                   (unsigned long)status, budget);
 
        work_done = macb_rx(bp, budget);
@@ -564,6 +575,8 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id)
                        break;
                }
 
+               netdev_vdbg(bp->dev, "isr = 0x%08lx\n", (unsigned long)status);
+
                if (status & MACB_RX_INT_FLAGS) {
                        /*
                         * There's no point taking any more interrupts
@@ -575,7 +588,7 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id)
                        macb_writel(bp, IDR, MACB_RX_INT_FLAGS);
 
                        if (napi_schedule_prep(&bp->napi)) {
-                               netdev_dbg(bp->dev, "scheduling RX softirq\n");
+                               netdev_vdbg(bp->dev, "scheduling RX softirq\n");
                                __napi_schedule(&bp->napi);
                        }
                }
@@ -637,8 +650,8 @@ static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev)
        u32 ctrl;
        unsigned long flags;
 
-#ifdef DEBUG
-       netdev_dbg(bp->dev,
+#if defined(DEBUG) && defined(VERBOSE_DEBUG)
+       netdev_vdbg(bp->dev,
                   "start_xmit: len %u head %p data %p tail %p end %p\n",
                   skb->len, skb->head, skb->data,
                   skb_tail_pointer(skb), skb_end_pointer(skb));
@@ -660,12 +673,12 @@ static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev)
        }
 
        entry = bp->tx_head;
-       netdev_dbg(bp->dev, "Allocated ring entry %u\n", entry);
+       netdev_vdbg(bp->dev, "Allocated ring entry %u\n", entry);
        mapping = dma_map_single(&bp->pdev->dev, skb->data,
                                 len, DMA_TO_DEVICE);
        bp->tx_skb[entry].skb = skb;
        bp->tx_skb[entry].mapping = mapping;
-       netdev_dbg(bp->dev, "Mapped skb data %p to DMA addr %08lx\n",
+       netdev_vdbg(bp->dev, "Mapped skb data %p to DMA addr %08lx\n",
                   skb->data, (unsigned long)mapping);
 
        ctrl = MACB_BF(TX_FRMLEN, len);
@@ -675,6 +688,8 @@ static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev)
 
        bp->tx_ring[entry].addr = mapping;
        bp->tx_ring[entry].ctrl = ctrl;
+
+       /* Make newly initialized descriptor visible to hardware */
        wmb();
 
        entry = NEXT_TX(entry);
@@ -783,9 +798,6 @@ static void macb_init_rings(struct macb *bp)
 
 static void macb_reset_hw(struct macb *bp)
 {
-       /* Make sure we have the write buffer for ourselves */
-       wmb();
-
        /*
         * Disable RX and TX (XXX: Should we halt the transmission
         * more gracefully?)
@@ -1213,20 +1225,9 @@ static int macb_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
        return phy_ethtool_sset(phydev, cmd);
 }
 
-static void macb_get_drvinfo(struct net_device *dev,
-                            struct ethtool_drvinfo *info)
-{
-       struct macb *bp = netdev_priv(dev);
-
-       strcpy(info->driver, bp->pdev->dev.driver->name);
-       strcpy(info->version, "$Revision: 1.14 $");
-       strcpy(info->bus_info, dev_name(&bp->pdev->dev));
-}
-
 const struct ethtool_ops macb_ethtool_ops = {
        .get_settings           = macb_get_settings,
        .set_settings           = macb_set_settings,
-       .get_drvinfo            = macb_get_drvinfo,
        .get_link               = ethtool_op_get_link,
        .get_ts_info            = ethtool_op_get_ts_info,
 };