| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* Applied Micro X-Gene SoC Ethernet Driver |
|---|
| 2 | 3 | * |
|---|
| 3 | 4 | * Copyright (c) 2014, Applied Micro Circuits Corporation |
|---|
| 4 | 5 | * Authors: Iyappan Subramanian <isubramanian@apm.com> |
|---|
| 5 | 6 | * Ravi Patel <rapatel@apm.com> |
|---|
| 6 | 7 | * Keyur Chudgar <kchudgar@apm.com> |
|---|
| 7 | | - * |
|---|
| 8 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 9 | | - * under the terms of the GNU General Public License as published by the |
|---|
| 10 | | - * Free Software Foundation; either version 2 of the License, or (at your |
|---|
| 11 | | - * option) any later version. |
|---|
| 12 | | - * |
|---|
| 13 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 14 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 15 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 16 | | - * GNU General Public License for more details. |
|---|
| 17 | | - * |
|---|
| 18 | | - * You should have received a copy of the GNU General Public License |
|---|
| 19 | | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
|---|
| 20 | 8 | */ |
|---|
| 21 | 9 | |
|---|
| 22 | 10 | #include <linux/gpio.h> |
|---|
| .. | .. |
|---|
| 352 | 340 | nr_frags = skb_shinfo(skb)->nr_frags; |
|---|
| 353 | 341 | |
|---|
| 354 | 342 | for (i = 0; i < 2 && i < nr_frags; i++) |
|---|
| 355 | | - len += skb_shinfo(skb)->frags[i].size; |
|---|
| 343 | + len += skb_frag_size( |
|---|
| 344 | + &skb_shinfo(skb)->frags[i]); |
|---|
| 356 | 345 | |
|---|
| 357 | 346 | /* HW requires header must reside in 3 buffer */ |
|---|
| 358 | 347 | if (unlikely(hdr_len > len)) { |
|---|
| .. | .. |
|---|
| 707 | 696 | buf_pool->rx_skb[skb_index] = NULL; |
|---|
| 708 | 697 | |
|---|
| 709 | 698 | datalen = xgene_enet_get_data_len(le64_to_cpu(raw_desc->m1)); |
|---|
| 699 | + |
|---|
| 700 | + /* strip off CRC as HW isn't doing this */ |
|---|
| 701 | + nv = GET_VAL(NV, le64_to_cpu(raw_desc->m0)); |
|---|
| 702 | + if (!nv) |
|---|
| 703 | + datalen -= 4; |
|---|
| 704 | + |
|---|
| 710 | 705 | skb_put(skb, datalen); |
|---|
| 711 | 706 | prefetch(skb->data - NET_IP_ALIGN); |
|---|
| 712 | 707 | skb->protocol = eth_type_trans(skb, ndev); |
|---|
| .. | .. |
|---|
| 728 | 723 | } |
|---|
| 729 | 724 | } |
|---|
| 730 | 725 | |
|---|
| 731 | | - nv = GET_VAL(NV, le64_to_cpu(raw_desc->m0)); |
|---|
| 732 | | - if (!nv) { |
|---|
| 733 | | - /* strip off CRC as HW isn't doing this */ |
|---|
| 734 | | - datalen -= 4; |
|---|
| 726 | + if (!nv) |
|---|
| 735 | 727 | goto skip_jumbo; |
|---|
| 736 | | - } |
|---|
| 737 | 728 | |
|---|
| 738 | 729 | slots = page_pool->slots - 1; |
|---|
| 739 | 730 | head = page_pool->head; |
|---|
| .. | .. |
|---|
| 870 | 861 | return processed; |
|---|
| 871 | 862 | } |
|---|
| 872 | 863 | |
|---|
| 873 | | -static void xgene_enet_timeout(struct net_device *ndev) |
|---|
| 864 | +static void xgene_enet_timeout(struct net_device *ndev, unsigned int txqueue) |
|---|
| 874 | 865 | { |
|---|
| 875 | 866 | struct xgene_enet_pdata *pdata = netdev_priv(ndev); |
|---|
| 876 | 867 | struct netdev_queue *txq; |
|---|
| .. | .. |
|---|
| 1013 | 1004 | |
|---|
| 1014 | 1005 | xgene_enet_napi_enable(pdata); |
|---|
| 1015 | 1006 | ret = xgene_enet_register_irq(ndev); |
|---|
| 1016 | | - if (ret) |
|---|
| 1007 | + if (ret) { |
|---|
| 1008 | + xgene_enet_napi_disable(pdata); |
|---|
| 1017 | 1009 | return ret; |
|---|
| 1010 | + } |
|---|
| 1018 | 1011 | |
|---|
| 1019 | 1012 | if (ndev->phydev) { |
|---|
| 1020 | 1013 | phy_start(ndev->phydev); |
|---|
| .. | .. |
|---|
| 1628 | 1621 | static int xgene_enet_get_irqs(struct xgene_enet_pdata *pdata) |
|---|
| 1629 | 1622 | { |
|---|
| 1630 | 1623 | struct platform_device *pdev = pdata->pdev; |
|---|
| 1631 | | - struct device *dev = &pdev->dev; |
|---|
| 1632 | 1624 | int i, ret, max_irqs; |
|---|
| 1633 | 1625 | |
|---|
| 1634 | 1626 | if (phy_interface_mode_is_rgmii(pdata->phy_mode)) |
|---|
| .. | .. |
|---|
| 1648 | 1640 | pdata->cq_cnt = max_irqs / 2; |
|---|
| 1649 | 1641 | break; |
|---|
| 1650 | 1642 | } |
|---|
| 1651 | | - dev_err(dev, "Unable to get ENET IRQ\n"); |
|---|
| 1652 | | - ret = ret ? : -ENXIO; |
|---|
| 1653 | | - return ret; |
|---|
| 1643 | + return ret ? : -ENXIO; |
|---|
| 1654 | 1644 | } |
|---|
| 1655 | 1645 | pdata->irqs[i] = ret; |
|---|
| 1656 | 1646 | } |
|---|
| .. | .. |
|---|
| 2193 | 2183 | module_platform_driver(xgene_enet_driver); |
|---|
| 2194 | 2184 | |
|---|
| 2195 | 2185 | MODULE_DESCRIPTION("APM X-Gene SoC Ethernet driver"); |
|---|
| 2196 | | -MODULE_VERSION(XGENE_DRV_VERSION); |
|---|
| 2197 | 2186 | MODULE_AUTHOR("Iyappan Subramanian <isubramanian@apm.com>"); |
|---|
| 2198 | 2187 | MODULE_AUTHOR("Keyur Chudgar <kchudgar@apm.com>"); |
|---|
| 2199 | 2188 | MODULE_LICENSE("GPL"); |
|---|