Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
[deliverable/linux.git] / drivers / net / ethernet / renesas / sh_eth.c
index 87b650131774ae74646b80143045226ae3a217d1..cfad09107054de419cd6a8c391200323429e69fa 100644 (file)
@@ -654,13 +654,12 @@ static void sh_eth_ring_format(struct net_device *ndev)
        for (i = 0; i < RX_RING_SIZE; i++) {
                /* skb */
                mdp->rx_skbuff[i] = NULL;
-               skb = dev_alloc_skb(mdp->rx_buf_sz);
+               skb = netdev_alloc_skb(ndev, mdp->rx_buf_sz);
                mdp->rx_skbuff[i] = skb;
                if (skb == NULL)
                        break;
-               dma_map_single(&ndev->dev, skb->tail, mdp->rx_buf_sz,
+               dma_map_single(&ndev->dev, skb->data, mdp->rx_buf_sz,
                                DMA_FROM_DEVICE);
-               skb->dev = ndev; /* Mark as being used by this device. */
                sh_eth_set_receive_align(skb);
 
                /* RX descriptor */
@@ -883,8 +882,8 @@ static int sh_eth_txfree(struct net_device *ndev)
                if (entry >= TX_RING_SIZE - 1)
                        txdesc->status |= cpu_to_edmac(mdp, TD_TDLE);
 
-               mdp->stats.tx_packets++;
-               mdp->stats.tx_bytes += txdesc->buffer_length;
+               ndev->stats.tx_packets++;
+               ndev->stats.tx_bytes += txdesc->buffer_length;
        }
        return freeNum;
 }
@@ -910,23 +909,23 @@ static int sh_eth_rx(struct net_device *ndev)
                        break;
 
                if (!(desc_status & RDFEND))
-                       mdp->stats.rx_length_errors++;
+                       ndev->stats.rx_length_errors++;
 
                if (desc_status & (RD_RFS1 | RD_RFS2 | RD_RFS3 | RD_RFS4 |
                                   RD_RFS5 | RD_RFS6 | RD_RFS10)) {
-                       mdp->stats.rx_errors++;
+                       ndev->stats.rx_errors++;
                        if (desc_status & RD_RFS1)
-                               mdp->stats.rx_crc_errors++;
+                               ndev->stats.rx_crc_errors++;
                        if (desc_status & RD_RFS2)
-                               mdp->stats.rx_frame_errors++;
+                               ndev->stats.rx_frame_errors++;
                        if (desc_status & RD_RFS3)
-                               mdp->stats.rx_length_errors++;
+                               ndev->stats.rx_length_errors++;
                        if (desc_status & RD_RFS4)
-                               mdp->stats.rx_length_errors++;
+                               ndev->stats.rx_length_errors++;
                        if (desc_status & RD_RFS6)
-                               mdp->stats.rx_missed_errors++;
+                               ndev->stats.rx_missed_errors++;
                        if (desc_status & RD_RFS10)
-                               mdp->stats.rx_over_errors++;
+                               ndev->stats.rx_over_errors++;
                } else {
                        if (!mdp->cd->hw_swap)
                                sh_eth_soft_swap(
@@ -939,8 +938,8 @@ static int sh_eth_rx(struct net_device *ndev)
                        skb_put(skb, pkt_len);
                        skb->protocol = eth_type_trans(skb, ndev);
                        netif_rx(skb);
-                       mdp->stats.rx_packets++;
-                       mdp->stats.rx_bytes += pkt_len;
+                       ndev->stats.rx_packets++;
+                       ndev->stats.rx_bytes += pkt_len;
                }
                rxdesc->status |= cpu_to_edmac(mdp, RD_RACT);
                entry = (++mdp->cur_rx) % RX_RING_SIZE;
@@ -955,13 +954,12 @@ static int sh_eth_rx(struct net_device *ndev)
                rxdesc->buffer_length = ALIGN(mdp->rx_buf_sz, 16);
 
                if (mdp->rx_skbuff[entry] == NULL) {
-                       skb = dev_alloc_skb(mdp->rx_buf_sz);
+                       skb = netdev_alloc_skb(ndev, mdp->rx_buf_sz);
                        mdp->rx_skbuff[entry] = skb;
                        if (skb == NULL)
                                break;  /* Better luck next round. */
-                       dma_map_single(&ndev->dev, skb->tail, mdp->rx_buf_sz,
+                       dma_map_single(&ndev->dev, skb->data, mdp->rx_buf_sz,
                                        DMA_FROM_DEVICE);
-                       skb->dev = ndev;
                        sh_eth_set_receive_align(skb);
 
                        skb_checksum_none_assert(skb);
@@ -1009,7 +1007,7 @@ static void sh_eth_error(struct net_device *ndev, int intr_status)
                felic_stat = sh_eth_read(ndev, ECSR);
                sh_eth_write(ndev, felic_stat, ECSR);   /* clear int */
                if (felic_stat & ECSR_ICD)
-                       mdp->stats.tx_carrier_errors++;
+                       ndev->stats.tx_carrier_errors++;
                if (felic_stat & ECSR_LCHNG) {
                        /* Link Changed */
                        if (mdp->cd->no_psr || mdp->no_ether_link) {
@@ -1042,7 +1040,7 @@ static void sh_eth_error(struct net_device *ndev, int intr_status)
        if (intr_status & EESR_TWB) {
                /* Write buck end. unused write back interrupt */
                if (intr_status & EESR_TABT)    /* Transmit Abort int */
-                       mdp->stats.tx_aborted_errors++;
+                       ndev->stats.tx_aborted_errors++;
                        if (netif_msg_tx_err(mdp))
                                dev_err(&ndev->dev, "Transmit Abort\n");
        }
@@ -1051,7 +1049,7 @@ static void sh_eth_error(struct net_device *ndev, int intr_status)
                /* Receive Abort int */
                if (intr_status & EESR_RFRMER) {
                        /* Receive Frame Overflow int */
-                       mdp->stats.rx_frame_errors++;
+                       ndev->stats.rx_frame_errors++;
                        if (netif_msg_rx_err(mdp))
                                dev_err(&ndev->dev, "Receive Abort\n");
                }
@@ -1059,21 +1057,21 @@ static void sh_eth_error(struct net_device *ndev, int intr_status)
 
        if (intr_status & EESR_TDE) {
                /* Transmit Descriptor Empty int */
-               mdp->stats.tx_fifo_errors++;
+               ndev->stats.tx_fifo_errors++;
                if (netif_msg_tx_err(mdp))
                        dev_err(&ndev->dev, "Transmit Descriptor Empty\n");
        }
 
        if (intr_status & EESR_TFE) {
                /* FIFO under flow */
-               mdp->stats.tx_fifo_errors++;
+               ndev->stats.tx_fifo_errors++;
                if (netif_msg_tx_err(mdp))
                        dev_err(&ndev->dev, "Transmit FIFO Under flow\n");
        }
 
        if (intr_status & EESR_RDE) {
                /* Receive Descriptor Empty int */
-               mdp->stats.rx_over_errors++;
+               ndev->stats.rx_over_errors++;
 
                if (sh_eth_read(ndev, EDRRR) ^ EDRRR_R)
                        sh_eth_write(ndev, EDRRR_R, EDRRR);
@@ -1083,14 +1081,14 @@ static void sh_eth_error(struct net_device *ndev, int intr_status)
 
        if (intr_status & EESR_RFE) {
                /* Receive FIFO Overflow int */
-               mdp->stats.rx_fifo_errors++;
+               ndev->stats.rx_fifo_errors++;
                if (netif_msg_rx_err(mdp))
                        dev_err(&ndev->dev, "Receive FIFO Overflow\n");
        }
 
        if (!mdp->cd->no_ade && (intr_status & EESR_ADE)) {
                /* Address Error */
-               mdp->stats.tx_fifo_errors++;
+               ndev->stats.tx_fifo_errors++;
                if (netif_msg_tx_err(mdp))
                        dev_err(&ndev->dev, "Address Error\n");
        }
@@ -1447,7 +1445,7 @@ static void sh_eth_tx_timeout(struct net_device *ndev)
               " resetting...\n", ndev->name, (int)sh_eth_read(ndev, EESR));
 
        /* tx_errors count up */
-       mdp->stats.tx_errors++;
+       ndev->stats.tx_errors++;
 
        /* timer off */
        del_timer_sync(&mdp->timer);
@@ -1569,27 +1567,27 @@ static struct net_device_stats *sh_eth_get_stats(struct net_device *ndev)
 
        pm_runtime_get_sync(&mdp->pdev->dev);
 
-       mdp->stats.tx_dropped += sh_eth_read(ndev, TROCR);
+       ndev->stats.tx_dropped += sh_eth_read(ndev, TROCR);
        sh_eth_write(ndev, 0, TROCR);   /* (write clear) */
-       mdp->stats.collisions += sh_eth_read(ndev, CDCR);
+       ndev->stats.collisions += sh_eth_read(ndev, CDCR);
        sh_eth_write(ndev, 0, CDCR);    /* (write clear) */
-       mdp->stats.tx_carrier_errors += sh_eth_read(ndev, LCCR);
+       ndev->stats.tx_carrier_errors += sh_eth_read(ndev, LCCR);
        sh_eth_write(ndev, 0, LCCR);    /* (write clear) */
        if (sh_eth_is_gether(mdp)) {
-               mdp->stats.tx_carrier_errors += sh_eth_read(ndev, CERCR);
+               ndev->stats.tx_carrier_errors += sh_eth_read(ndev, CERCR);
                sh_eth_write(ndev, 0, CERCR);   /* (write clear) */
-               mdp->stats.tx_carrier_errors += sh_eth_read(ndev, CEECR);
+               ndev->stats.tx_carrier_errors += sh_eth_read(ndev, CEECR);
                sh_eth_write(ndev, 0, CEECR);   /* (write clear) */
        } else {
-               mdp->stats.tx_carrier_errors += sh_eth_read(ndev, CNDCR);
+               ndev->stats.tx_carrier_errors += sh_eth_read(ndev, CNDCR);
                sh_eth_write(ndev, 0, CNDCR);   /* (write clear) */
        }
        pm_runtime_put_sync(&mdp->pdev->dev);
 
-       return &mdp->stats;
+       return &ndev->stats;
 }
 
-/* ioctl to device funciotn*/
+/* ioctl to device function */
 static int sh_eth_do_ioctl(struct net_device *ndev, struct ifreq *rq,
                                int cmd)
 {
@@ -1794,7 +1792,6 @@ static int sh_eth_drv_probe(struct platform_device *pdev)
 
        ndev = alloc_etherdev(sizeof(struct sh_eth_private));
        if (!ndev) {
-               dev_err(&pdev->dev, "Could not allocate device.\n");
                ret = -ENOMEM;
                goto out;
        }
This page took 0.035507 seconds and 5 git commands to generate.