3538586f6ff80b5c8c7ffad752a03e7f1dd8059a
[openwrt/staging/wigyori.git] / target / linux / cns3xxx / patches-4.14 / 140-fix-ethernet-irq-imbalance.patch
1 --- a/drivers/net/ethernet/cavium/cns3xxx_eth.c
2 +++ b/drivers/net/ethernet/cavium/cns3xxx_eth.c
3 @@ -712,26 +712,20 @@ static int eth_poll(struct napi_struct *
4 }
5
6 rx_ring->cur_index = i;
7 - if (!received) {
8 - napi_complete(napi);
9 - enable_irq(sw->rx_irq);
10 - budget = 0;
11 -
12 - /* If 1 or more frames came in during IRQ enable, re-schedule */
13 - if (rx_ring->desc[i].cown)
14 - eth_schedule_poll(sw);
15 - }
16 -
17 - spin_lock_bh(&tx_lock);
18 - eth_complete_tx(sw);
19 - spin_unlock_bh(&tx_lock);
20
21 cns3xxx_alloc_rx_buf(sw, received);
22 -
23 wmb();
24 enable_rx_dma(sw);
25
26 - return budget;
27 + if (received < budget && napi_complete_done(napi, received)) {
28 + enable_irq(sw->rx_irq);
29 + }
30 +
31 + spin_lock_bh(&tx_lock);
32 + eth_complete_tx(sw);
33 + spin_unlock_bh(&tx_lock);
34 +
35 + return received;
36 }
37
38 static void eth_set_desc(struct sw *sw, struct _tx_ring *tx_ring, int index,
39 @@ -856,18 +850,6 @@ static void cns3xxx_get_drvinfo(struct n
40 strcpy(info->bus_info, "internal");
41 }
42
43 -static int cns3xxx_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
44 -{
45 - struct port *port = netdev_priv(dev);
46 - return phy_ethtool_gset(port->phydev, cmd);
47 -}
48 -
49 -static int cns3xxx_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
50 -{
51 - struct port *port = netdev_priv(dev);
52 - return phy_ethtool_sset(port->phydev, cmd);
53 -}
54 -
55 static int cns3xxx_nway_reset(struct net_device *dev)
56 {
57 struct port *port = netdev_priv(dev);
58 @@ -876,8 +858,8 @@ static int cns3xxx_nway_reset(struct net
59
60 static struct ethtool_ops cns3xxx_ethtool_ops = {
61 .get_drvinfo = cns3xxx_get_drvinfo,
62 - .get_settings = cns3xxx_get_settings,
63 - .set_settings = cns3xxx_set_settings,
64 + .get_link_ksettings = phy_ethtool_get_link_ksettings,
65 + .set_link_ksettings = phy_ethtool_set_link_ksettings,
66 .nway_reset = cns3xxx_nway_reset,
67 .get_link = ethtool_op_get_link,
68 };
69 @@ -1177,7 +1159,7 @@ static int eth_init_one(struct platform_
70 goto err_remove_mdio;
71 }
72
73 - strcpy(napi_dev->name, "switch%d");
74 + strcpy(napi_dev->name, "cns3xxx_eth");
75 napi_dev->features = NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_FRAGLIST;
76
77 SET_NETDEV_DEV(napi_dev, &pdev->dev);