diff options
Diffstat (limited to 'drivers/net/gianfar.c')
-rw-r--r-- | drivers/net/gianfar.c | 213 |
1 files changed, 164 insertions, 49 deletions
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index 5d3763fb3472..c6791cd4ee05 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c | |||
@@ -82,6 +82,7 @@ | |||
82 | #include <linux/tcp.h> | 82 | #include <linux/tcp.h> |
83 | #include <linux/udp.h> | 83 | #include <linux/udp.h> |
84 | #include <linux/in.h> | 84 | #include <linux/in.h> |
85 | #include <linux/net_tstamp.h> | ||
85 | 86 | ||
86 | #include <asm/io.h> | 87 | #include <asm/io.h> |
87 | #include <asm/irq.h> | 88 | #include <asm/irq.h> |
@@ -377,6 +378,13 @@ static void gfar_init_mac(struct net_device *ndev) | |||
377 | rctrl |= RCTRL_PADDING(priv->padding); | 378 | rctrl |= RCTRL_PADDING(priv->padding); |
378 | } | 379 | } |
379 | 380 | ||
381 | /* Insert receive time stamps into padding alignment bytes */ | ||
382 | if (priv->device_flags & FSL_GIANFAR_DEV_HAS_TIMER) { | ||
383 | rctrl &= ~RCTRL_PAL_MASK; | ||
384 | rctrl |= RCTRL_PRSDEP_INIT | RCTRL_TS_ENABLE | RCTRL_PADDING(8); | ||
385 | priv->padding = 8; | ||
386 | } | ||
387 | |||
380 | /* keep vlan related bits if it's enabled */ | 388 | /* keep vlan related bits if it's enabled */ |
381 | if (priv->vlgrp) { | 389 | if (priv->vlgrp) { |
382 | rctrl |= RCTRL_VLEX | RCTRL_PRSDEP_INIT; | 390 | rctrl |= RCTRL_VLEX | RCTRL_PRSDEP_INIT; |
@@ -501,7 +509,8 @@ void unlock_tx_qs(struct gfar_private *priv) | |||
501 | /* Returns 1 if incoming frames use an FCB */ | 509 | /* Returns 1 if incoming frames use an FCB */ |
502 | static inline int gfar_uses_fcb(struct gfar_private *priv) | 510 | static inline int gfar_uses_fcb(struct gfar_private *priv) |
503 | { | 511 | { |
504 | return priv->vlgrp || priv->rx_csum_enable; | 512 | return priv->vlgrp || priv->rx_csum_enable || |
513 | (priv->device_flags & FSL_GIANFAR_DEV_HAS_TIMER); | ||
505 | } | 514 | } |
506 | 515 | ||
507 | static void free_tx_pointers(struct gfar_private *priv) | 516 | static void free_tx_pointers(struct gfar_private *priv) |
@@ -738,7 +747,8 @@ static int gfar_of_init(struct of_device *ofdev, struct net_device **pdev) | |||
738 | FSL_GIANFAR_DEV_HAS_CSUM | | 747 | FSL_GIANFAR_DEV_HAS_CSUM | |
739 | FSL_GIANFAR_DEV_HAS_VLAN | | 748 | FSL_GIANFAR_DEV_HAS_VLAN | |
740 | FSL_GIANFAR_DEV_HAS_MAGIC_PACKET | | 749 | FSL_GIANFAR_DEV_HAS_MAGIC_PACKET | |
741 | FSL_GIANFAR_DEV_HAS_EXTENDED_HASH; | 750 | FSL_GIANFAR_DEV_HAS_EXTENDED_HASH | |
751 | FSL_GIANFAR_DEV_HAS_TIMER; | ||
742 | 752 | ||
743 | ctype = of_get_property(np, "phy-connection-type", NULL); | 753 | ctype = of_get_property(np, "phy-connection-type", NULL); |
744 | 754 | ||
@@ -768,6 +778,48 @@ err_grp_init: | |||
768 | return err; | 778 | return err; |
769 | } | 779 | } |
770 | 780 | ||
781 | static int gfar_hwtstamp_ioctl(struct net_device *netdev, | ||
782 | struct ifreq *ifr, int cmd) | ||
783 | { | ||
784 | struct hwtstamp_config config; | ||
785 | struct gfar_private *priv = netdev_priv(netdev); | ||
786 | |||
787 | if (copy_from_user(&config, ifr->ifr_data, sizeof(config))) | ||
788 | return -EFAULT; | ||
789 | |||
790 | /* reserved for future extensions */ | ||
791 | if (config.flags) | ||
792 | return -EINVAL; | ||
793 | |||
794 | switch (config.tx_type) { | ||
795 | case HWTSTAMP_TX_OFF: | ||
796 | priv->hwts_tx_en = 0; | ||
797 | break; | ||
798 | case HWTSTAMP_TX_ON: | ||
799 | if (!(priv->device_flags & FSL_GIANFAR_DEV_HAS_TIMER)) | ||
800 | return -ERANGE; | ||
801 | priv->hwts_tx_en = 1; | ||
802 | break; | ||
803 | default: | ||
804 | return -ERANGE; | ||
805 | } | ||
806 | |||
807 | switch (config.rx_filter) { | ||
808 | case HWTSTAMP_FILTER_NONE: | ||
809 | priv->hwts_rx_en = 0; | ||
810 | break; | ||
811 | default: | ||
812 | if (!(priv->device_flags & FSL_GIANFAR_DEV_HAS_TIMER)) | ||
813 | return -ERANGE; | ||
814 | priv->hwts_rx_en = 1; | ||
815 | config.rx_filter = HWTSTAMP_FILTER_ALL; | ||
816 | break; | ||
817 | } | ||
818 | |||
819 | return copy_to_user(ifr->ifr_data, &config, sizeof(config)) ? | ||
820 | -EFAULT : 0; | ||
821 | } | ||
822 | |||
771 | /* Ioctl MII Interface */ | 823 | /* Ioctl MII Interface */ |
772 | static int gfar_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | 824 | static int gfar_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) |
773 | { | 825 | { |
@@ -776,6 +828,9 @@ static int gfar_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | |||
776 | if (!netif_running(dev)) | 828 | if (!netif_running(dev)) |
777 | return -EINVAL; | 829 | return -EINVAL; |
778 | 830 | ||
831 | if (cmd == SIOCSHWTSTAMP) | ||
832 | return gfar_hwtstamp_ioctl(dev, rq, cmd); | ||
833 | |||
779 | if (!priv->phydev) | 834 | if (!priv->phydev) |
780 | return -ENODEV; | 835 | return -ENODEV; |
781 | 836 | ||
@@ -978,7 +1033,8 @@ static int gfar_probe(struct of_device *ofdev, | |||
978 | else | 1033 | else |
979 | priv->padding = 0; | 1034 | priv->padding = 0; |
980 | 1035 | ||
981 | if (dev->features & NETIF_F_IP_CSUM) | 1036 | if (dev->features & NETIF_F_IP_CSUM || |
1037 | priv->device_flags & FSL_GIANFAR_DEV_HAS_TIMER) | ||
982 | dev->hard_header_len += GMAC_FCB_LEN; | 1038 | dev->hard_header_len += GMAC_FCB_LEN; |
983 | 1039 | ||
984 | /* Program the isrg regs only if number of grps > 1 */ | 1040 | /* Program the isrg regs only if number of grps > 1 */ |
@@ -1288,21 +1344,9 @@ static struct dev_pm_ops gfar_pm_ops = { | |||
1288 | 1344 | ||
1289 | #define GFAR_PM_OPS (&gfar_pm_ops) | 1345 | #define GFAR_PM_OPS (&gfar_pm_ops) |
1290 | 1346 | ||
1291 | static int gfar_legacy_suspend(struct of_device *ofdev, pm_message_t state) | ||
1292 | { | ||
1293 | return gfar_suspend(&ofdev->dev); | ||
1294 | } | ||
1295 | |||
1296 | static int gfar_legacy_resume(struct of_device *ofdev) | ||
1297 | { | ||
1298 | return gfar_resume(&ofdev->dev); | ||
1299 | } | ||
1300 | |||
1301 | #else | 1347 | #else |
1302 | 1348 | ||
1303 | #define GFAR_PM_OPS NULL | 1349 | #define GFAR_PM_OPS NULL |
1304 | #define gfar_legacy_suspend NULL | ||
1305 | #define gfar_legacy_resume NULL | ||
1306 | 1350 | ||
1307 | #endif | 1351 | #endif |
1308 | 1352 | ||
@@ -1683,7 +1727,7 @@ void gfar_start(struct net_device *dev) | |||
1683 | gfar_write(®s->imask, IMASK_DEFAULT); | 1727 | gfar_write(®s->imask, IMASK_DEFAULT); |
1684 | } | 1728 | } |
1685 | 1729 | ||
1686 | dev->trans_start = jiffies; | 1730 | dev->trans_start = jiffies; /* prevent tx timeout */ |
1687 | } | 1731 | } |
1688 | 1732 | ||
1689 | void gfar_configure_coalescing(struct gfar_private *priv, | 1733 | void gfar_configure_coalescing(struct gfar_private *priv, |
@@ -1923,23 +1967,29 @@ static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1923 | struct netdev_queue *txq; | 1967 | struct netdev_queue *txq; |
1924 | struct gfar __iomem *regs = NULL; | 1968 | struct gfar __iomem *regs = NULL; |
1925 | struct txfcb *fcb = NULL; | 1969 | struct txfcb *fcb = NULL; |
1926 | struct txbd8 *txbdp, *txbdp_start, *base; | 1970 | struct txbd8 *txbdp, *txbdp_start, *base, *txbdp_tstamp = NULL; |
1927 | u32 lstatus; | 1971 | u32 lstatus; |
1928 | int i, rq = 0; | 1972 | int i, rq = 0, do_tstamp = 0; |
1929 | u32 bufaddr; | 1973 | u32 bufaddr; |
1930 | unsigned long flags; | 1974 | unsigned long flags; |
1931 | unsigned int nr_frags, length; | 1975 | unsigned int nr_frags, nr_txbds, length; |
1932 | 1976 | union skb_shared_tx *shtx; | |
1933 | 1977 | ||
1934 | rq = skb->queue_mapping; | 1978 | rq = skb->queue_mapping; |
1935 | tx_queue = priv->tx_queue[rq]; | 1979 | tx_queue = priv->tx_queue[rq]; |
1936 | txq = netdev_get_tx_queue(dev, rq); | 1980 | txq = netdev_get_tx_queue(dev, rq); |
1937 | base = tx_queue->tx_bd_base; | 1981 | base = tx_queue->tx_bd_base; |
1938 | regs = tx_queue->grp->regs; | 1982 | regs = tx_queue->grp->regs; |
1983 | shtx = skb_tx(skb); | ||
1984 | |||
1985 | /* check if time stamp should be generated */ | ||
1986 | if (unlikely(shtx->hardware && priv->hwts_tx_en)) | ||
1987 | do_tstamp = 1; | ||
1939 | 1988 | ||
1940 | /* make space for additional header when fcb is needed */ | 1989 | /* make space for additional header when fcb is needed */ |
1941 | if (((skb->ip_summed == CHECKSUM_PARTIAL) || | 1990 | if (((skb->ip_summed == CHECKSUM_PARTIAL) || |
1942 | (priv->vlgrp && vlan_tx_tag_present(skb))) && | 1991 | (priv->vlgrp && vlan_tx_tag_present(skb)) || |
1992 | unlikely(do_tstamp)) && | ||
1943 | (skb_headroom(skb) < GMAC_FCB_LEN)) { | 1993 | (skb_headroom(skb) < GMAC_FCB_LEN)) { |
1944 | struct sk_buff *skb_new; | 1994 | struct sk_buff *skb_new; |
1945 | 1995 | ||
@@ -1956,8 +2006,14 @@ static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1956 | /* total number of fragments in the SKB */ | 2006 | /* total number of fragments in the SKB */ |
1957 | nr_frags = skb_shinfo(skb)->nr_frags; | 2007 | nr_frags = skb_shinfo(skb)->nr_frags; |
1958 | 2008 | ||
2009 | /* calculate the required number of TxBDs for this skb */ | ||
2010 | if (unlikely(do_tstamp)) | ||
2011 | nr_txbds = nr_frags + 2; | ||
2012 | else | ||
2013 | nr_txbds = nr_frags + 1; | ||
2014 | |||
1959 | /* check if there is space to queue this packet */ | 2015 | /* check if there is space to queue this packet */ |
1960 | if ((nr_frags+1) > tx_queue->num_txbdfree) { | 2016 | if (nr_txbds > tx_queue->num_txbdfree) { |
1961 | /* no space, stop the queue */ | 2017 | /* no space, stop the queue */ |
1962 | netif_tx_stop_queue(txq); | 2018 | netif_tx_stop_queue(txq); |
1963 | dev->stats.tx_fifo_errors++; | 2019 | dev->stats.tx_fifo_errors++; |
@@ -1969,9 +2025,19 @@ static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1969 | txq->tx_packets ++; | 2025 | txq->tx_packets ++; |
1970 | 2026 | ||
1971 | txbdp = txbdp_start = tx_queue->cur_tx; | 2027 | txbdp = txbdp_start = tx_queue->cur_tx; |
2028 | lstatus = txbdp->lstatus; | ||
2029 | |||
2030 | /* Time stamp insertion requires one additional TxBD */ | ||
2031 | if (unlikely(do_tstamp)) | ||
2032 | txbdp_tstamp = txbdp = next_txbd(txbdp, base, | ||
2033 | tx_queue->tx_ring_size); | ||
1972 | 2034 | ||
1973 | if (nr_frags == 0) { | 2035 | if (nr_frags == 0) { |
1974 | lstatus = txbdp->lstatus | BD_LFLAG(TXBD_LAST | TXBD_INTERRUPT); | 2036 | if (unlikely(do_tstamp)) |
2037 | txbdp_tstamp->lstatus |= BD_LFLAG(TXBD_LAST | | ||
2038 | TXBD_INTERRUPT); | ||
2039 | else | ||
2040 | lstatus |= BD_LFLAG(TXBD_LAST | TXBD_INTERRUPT); | ||
1975 | } else { | 2041 | } else { |
1976 | /* Place the fragment addresses and lengths into the TxBDs */ | 2042 | /* Place the fragment addresses and lengths into the TxBDs */ |
1977 | for (i = 0; i < nr_frags; i++) { | 2043 | for (i = 0; i < nr_frags; i++) { |
@@ -2017,11 +2083,32 @@ static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2017 | gfar_tx_vlan(skb, fcb); | 2083 | gfar_tx_vlan(skb, fcb); |
2018 | } | 2084 | } |
2019 | 2085 | ||
2020 | /* setup the TxBD length and buffer pointer for the first BD */ | 2086 | /* Setup tx hardware time stamping if requested */ |
2087 | if (unlikely(do_tstamp)) { | ||
2088 | shtx->in_progress = 1; | ||
2089 | if (fcb == NULL) | ||
2090 | fcb = gfar_add_fcb(skb); | ||
2091 | fcb->ptp = 1; | ||
2092 | lstatus |= BD_LFLAG(TXBD_TOE); | ||
2093 | } | ||
2094 | |||
2021 | txbdp_start->bufPtr = dma_map_single(&priv->ofdev->dev, skb->data, | 2095 | txbdp_start->bufPtr = dma_map_single(&priv->ofdev->dev, skb->data, |
2022 | skb_headlen(skb), DMA_TO_DEVICE); | 2096 | skb_headlen(skb), DMA_TO_DEVICE); |
2023 | 2097 | ||
2024 | lstatus |= BD_LFLAG(TXBD_CRC | TXBD_READY) | skb_headlen(skb); | 2098 | /* |
2099 | * If time stamping is requested one additional TxBD must be set up. The | ||
2100 | * first TxBD points to the FCB and must have a data length of | ||
2101 | * GMAC_FCB_LEN. The second TxBD points to the actual frame data with | ||
2102 | * the full frame length. | ||
2103 | */ | ||
2104 | if (unlikely(do_tstamp)) { | ||
2105 | txbdp_tstamp->bufPtr = txbdp_start->bufPtr + GMAC_FCB_LEN; | ||
2106 | txbdp_tstamp->lstatus |= BD_LFLAG(TXBD_READY) | | ||
2107 | (skb_headlen(skb) - GMAC_FCB_LEN); | ||
2108 | lstatus |= BD_LFLAG(TXBD_CRC | TXBD_READY) | GMAC_FCB_LEN; | ||
2109 | } else { | ||
2110 | lstatus |= BD_LFLAG(TXBD_CRC | TXBD_READY) | skb_headlen(skb); | ||
2111 | } | ||
2025 | 2112 | ||
2026 | /* | 2113 | /* |
2027 | * We can work in parallel with gfar_clean_tx_ring(), except | 2114 | * We can work in parallel with gfar_clean_tx_ring(), except |
@@ -2061,9 +2148,7 @@ static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2061 | tx_queue->cur_tx = next_txbd(txbdp, base, tx_queue->tx_ring_size); | 2148 | tx_queue->cur_tx = next_txbd(txbdp, base, tx_queue->tx_ring_size); |
2062 | 2149 | ||
2063 | /* reduce TxBD free count */ | 2150 | /* reduce TxBD free count */ |
2064 | tx_queue->num_txbdfree -= (nr_frags + 1); | 2151 | tx_queue->num_txbdfree -= (nr_txbds); |
2065 | |||
2066 | dev->trans_start = jiffies; | ||
2067 | 2152 | ||
2068 | /* If the next BD still needs to be cleaned up, then the bds | 2153 | /* If the next BD still needs to be cleaned up, then the bds |
2069 | are full. We need to tell the kernel to stop sending us stuff. */ | 2154 | are full. We need to tell the kernel to stop sending us stuff. */ |
@@ -2251,16 +2336,18 @@ static int gfar_clean_tx_ring(struct gfar_priv_tx_q *tx_queue) | |||
2251 | struct net_device *dev = tx_queue->dev; | 2336 | struct net_device *dev = tx_queue->dev; |
2252 | struct gfar_private *priv = netdev_priv(dev); | 2337 | struct gfar_private *priv = netdev_priv(dev); |
2253 | struct gfar_priv_rx_q *rx_queue = NULL; | 2338 | struct gfar_priv_rx_q *rx_queue = NULL; |
2254 | struct txbd8 *bdp; | 2339 | struct txbd8 *bdp, *next = NULL; |
2255 | struct txbd8 *lbdp = NULL; | 2340 | struct txbd8 *lbdp = NULL; |
2256 | struct txbd8 *base = tx_queue->tx_bd_base; | 2341 | struct txbd8 *base = tx_queue->tx_bd_base; |
2257 | struct sk_buff *skb; | 2342 | struct sk_buff *skb; |
2258 | int skb_dirtytx; | 2343 | int skb_dirtytx; |
2259 | int tx_ring_size = tx_queue->tx_ring_size; | 2344 | int tx_ring_size = tx_queue->tx_ring_size; |
2260 | int frags = 0; | 2345 | int frags = 0, nr_txbds = 0; |
2261 | int i; | 2346 | int i; |
2262 | int howmany = 0; | 2347 | int howmany = 0; |
2263 | u32 lstatus; | 2348 | u32 lstatus; |
2349 | size_t buflen; | ||
2350 | union skb_shared_tx *shtx; | ||
2264 | 2351 | ||
2265 | rx_queue = priv->rx_queue[tx_queue->qindex]; | 2352 | rx_queue = priv->rx_queue[tx_queue->qindex]; |
2266 | bdp = tx_queue->dirty_tx; | 2353 | bdp = tx_queue->dirty_tx; |
@@ -2270,7 +2357,18 @@ static int gfar_clean_tx_ring(struct gfar_priv_tx_q *tx_queue) | |||
2270 | unsigned long flags; | 2357 | unsigned long flags; |
2271 | 2358 | ||
2272 | frags = skb_shinfo(skb)->nr_frags; | 2359 | frags = skb_shinfo(skb)->nr_frags; |
2273 | lbdp = skip_txbd(bdp, frags, base, tx_ring_size); | 2360 | |
2361 | /* | ||
2362 | * When time stamping, one additional TxBD must be freed. | ||
2363 | * Also, we need to dma_unmap_single() the TxPAL. | ||
2364 | */ | ||
2365 | shtx = skb_tx(skb); | ||
2366 | if (unlikely(shtx->in_progress)) | ||
2367 | nr_txbds = frags + 2; | ||
2368 | else | ||
2369 | nr_txbds = frags + 1; | ||
2370 | |||
2371 | lbdp = skip_txbd(bdp, nr_txbds - 1, base, tx_ring_size); | ||
2274 | 2372 | ||
2275 | lstatus = lbdp->lstatus; | 2373 | lstatus = lbdp->lstatus; |
2276 | 2374 | ||
@@ -2279,10 +2377,24 @@ static int gfar_clean_tx_ring(struct gfar_priv_tx_q *tx_queue) | |||
2279 | (lstatus & BD_LENGTH_MASK)) | 2377 | (lstatus & BD_LENGTH_MASK)) |
2280 | break; | 2378 | break; |
2281 | 2379 | ||
2282 | dma_unmap_single(&priv->ofdev->dev, | 2380 | if (unlikely(shtx->in_progress)) { |
2283 | bdp->bufPtr, | 2381 | next = next_txbd(bdp, base, tx_ring_size); |
2284 | bdp->length, | 2382 | buflen = next->length + GMAC_FCB_LEN; |
2285 | DMA_TO_DEVICE); | 2383 | } else |
2384 | buflen = bdp->length; | ||
2385 | |||
2386 | dma_unmap_single(&priv->ofdev->dev, bdp->bufPtr, | ||
2387 | buflen, DMA_TO_DEVICE); | ||
2388 | |||
2389 | if (unlikely(shtx->in_progress)) { | ||
2390 | struct skb_shared_hwtstamps shhwtstamps; | ||
2391 | u64 *ns = (u64*) (((u32)skb->data + 0x10) & ~0x7); | ||
2392 | memset(&shhwtstamps, 0, sizeof(shhwtstamps)); | ||
2393 | shhwtstamps.hwtstamp = ns_to_ktime(*ns); | ||
2394 | skb_tstamp_tx(skb, &shhwtstamps); | ||
2395 | bdp->lstatus &= BD_LFLAG(TXBD_WRAP); | ||
2396 | bdp = next; | ||
2397 | } | ||
2286 | 2398 | ||
2287 | bdp->lstatus &= BD_LFLAG(TXBD_WRAP); | 2399 | bdp->lstatus &= BD_LFLAG(TXBD_WRAP); |
2288 | bdp = next_txbd(bdp, base, tx_ring_size); | 2400 | bdp = next_txbd(bdp, base, tx_ring_size); |
@@ -2314,7 +2426,7 @@ static int gfar_clean_tx_ring(struct gfar_priv_tx_q *tx_queue) | |||
2314 | 2426 | ||
2315 | howmany++; | 2427 | howmany++; |
2316 | spin_lock_irqsave(&tx_queue->txlock, flags); | 2428 | spin_lock_irqsave(&tx_queue->txlock, flags); |
2317 | tx_queue->num_txbdfree += frags + 1; | 2429 | tx_queue->num_txbdfree += nr_txbds; |
2318 | spin_unlock_irqrestore(&tx_queue->txlock, flags); | 2430 | spin_unlock_irqrestore(&tx_queue->txlock, flags); |
2319 | } | 2431 | } |
2320 | 2432 | ||
@@ -2470,6 +2582,17 @@ static int gfar_process_frame(struct net_device *dev, struct sk_buff *skb, | |||
2470 | skb_pull(skb, amount_pull); | 2582 | skb_pull(skb, amount_pull); |
2471 | } | 2583 | } |
2472 | 2584 | ||
2585 | /* Get receive timestamp from the skb */ | ||
2586 | if (priv->hwts_rx_en) { | ||
2587 | struct skb_shared_hwtstamps *shhwtstamps = skb_hwtstamps(skb); | ||
2588 | u64 *ns = (u64 *) skb->data; | ||
2589 | memset(shhwtstamps, 0, sizeof(*shhwtstamps)); | ||
2590 | shhwtstamps->hwtstamp = ns_to_ktime(*ns); | ||
2591 | } | ||
2592 | |||
2593 | if (priv->padding) | ||
2594 | skb_pull(skb, priv->padding); | ||
2595 | |||
2473 | if (priv->rx_csum_enable) | 2596 | if (priv->rx_csum_enable) |
2474 | gfar_rx_checksum(skb, fcb); | 2597 | gfar_rx_checksum(skb, fcb); |
2475 | 2598 | ||
@@ -2506,8 +2629,7 @@ int gfar_clean_rx_ring(struct gfar_priv_rx_q *rx_queue, int rx_work_limit) | |||
2506 | bdp = rx_queue->cur_rx; | 2629 | bdp = rx_queue->cur_rx; |
2507 | base = rx_queue->rx_bd_base; | 2630 | base = rx_queue->rx_bd_base; |
2508 | 2631 | ||
2509 | amount_pull = (gfar_uses_fcb(priv) ? GMAC_FCB_LEN : 0) + | 2632 | amount_pull = (gfar_uses_fcb(priv) ? GMAC_FCB_LEN : 0); |
2510 | priv->padding; | ||
2511 | 2633 | ||
2512 | while (!((bdp->status & RXBD_EMPTY) || (--rx_work_limit < 0))) { | 2634 | while (!((bdp->status & RXBD_EMPTY) || (--rx_work_limit < 0))) { |
2513 | struct sk_buff *newskb; | 2635 | struct sk_buff *newskb; |
@@ -2794,7 +2916,7 @@ static void adjust_link(struct net_device *dev) | |||
2794 | * whenever dev->flags is changed */ | 2916 | * whenever dev->flags is changed */ |
2795 | static void gfar_set_multi(struct net_device *dev) | 2917 | static void gfar_set_multi(struct net_device *dev) |
2796 | { | 2918 | { |
2797 | struct dev_mc_list *mc_ptr; | 2919 | struct netdev_hw_addr *ha; |
2798 | struct gfar_private *priv = netdev_priv(dev); | 2920 | struct gfar_private *priv = netdev_priv(dev); |
2799 | struct gfar __iomem *regs = priv->gfargrp[0].regs; | 2921 | struct gfar __iomem *regs = priv->gfargrp[0].regs; |
2800 | u32 tempval; | 2922 | u32 tempval; |
@@ -2867,17 +2989,14 @@ static void gfar_set_multi(struct net_device *dev) | |||
2867 | return; | 2989 | return; |
2868 | 2990 | ||
2869 | /* Parse the list, and set the appropriate bits */ | 2991 | /* Parse the list, and set the appropriate bits */ |
2870 | netdev_for_each_mc_addr(mc_ptr, dev) { | 2992 | netdev_for_each_mc_addr(ha, dev) { |
2871 | if (idx < em_num) { | 2993 | if (idx < em_num) { |
2872 | gfar_set_mac_for_addr(dev, idx, | 2994 | gfar_set_mac_for_addr(dev, idx, ha->addr); |
2873 | mc_ptr->dmi_addr); | ||
2874 | idx++; | 2995 | idx++; |
2875 | } else | 2996 | } else |
2876 | gfar_set_hash_for_addr(dev, mc_ptr->dmi_addr); | 2997 | gfar_set_hash_for_addr(dev, ha->addr); |
2877 | } | 2998 | } |
2878 | } | 2999 | } |
2879 | |||
2880 | return; | ||
2881 | } | 3000 | } |
2882 | 3001 | ||
2883 | 3002 | ||
@@ -2918,8 +3037,6 @@ static void gfar_set_hash_for_addr(struct net_device *dev, u8 *addr) | |||
2918 | tempval = gfar_read(priv->hash_regs[whichreg]); | 3037 | tempval = gfar_read(priv->hash_regs[whichreg]); |
2919 | tempval |= value; | 3038 | tempval |= value; |
2920 | gfar_write(priv->hash_regs[whichreg], tempval); | 3039 | gfar_write(priv->hash_regs[whichreg], tempval); |
2921 | |||
2922 | return; | ||
2923 | } | 3040 | } |
2924 | 3041 | ||
2925 | 3042 | ||
@@ -3055,8 +3172,6 @@ static struct of_platform_driver gfar_driver = { | |||
3055 | 3172 | ||
3056 | .probe = gfar_probe, | 3173 | .probe = gfar_probe, |
3057 | .remove = gfar_remove, | 3174 | .remove = gfar_remove, |
3058 | .suspend = gfar_legacy_suspend, | ||
3059 | .resume = gfar_legacy_resume, | ||
3060 | .driver.pm = GFAR_PM_OPS, | 3175 | .driver.pm = GFAR_PM_OPS, |
3061 | }; | 3176 | }; |
3062 | 3177 | ||