Refreshed all patches.
Remove upstreamed:
- 0001-net-thunderx-workaround-BGX-TX-Underflow-issue.patch
- 600-ipv6-addrconf-call-ipv6_mc_up-for-non-Ethernet-inter.patch
Fixes:
- CVE-2020-8647
- CVE-2020-8648 (potentially)
- CVE-2020-8649
Compile-tested on: cns3xxx
Runtime-tested on: cns3xxx
Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
LINUX_RELEASE?=1
LINUX_VERSION-4.9 = .219
-LINUX_VERSION-4.14 = .172
+LINUX_VERSION-4.14 = .176
LINUX_KERNEL_HASH-4.9.219 = 6b17238cced3e1c2753d6d5b4f662bd347d4651f07c35506b849eb10aea7bc44
-LINUX_KERNEL_HASH-4.14.172 = 2318a1ab937580a079351ed20557c336a3d95b664f667b14e3ba49e3271b217a
+LINUX_KERNEL_HASH-4.14.176 = bcae0956baaeb55dab5bad0401873fbc5baaa7fbe957ea6d27a5ab241cec5ca2
remove_uri_prefix=$(subst git://,,$(subst http://,,$(subst https://,,$(1))))
sanitize_uri=$(call qstrip,$(subst @,_,$(subst :,_,$(subst .,_,$(subst -,_,$(subst /,_,$(1)))))))
#include "xhci.h"
#include "xhci-trace.h"
-@@ -268,6 +270,458 @@ static void xhci_pme_acpi_rtd3_enable(st
+@@ -269,6 +271,458 @@ static void xhci_pme_acpi_rtd3_enable(st
static void xhci_pme_acpi_rtd3_enable(struct pci_dev *dev) { }
#endif /* CONFIG_ACPI */
/* called during probe() after chip reset completes */
static int xhci_pci_setup(struct usb_hcd *hcd)
{
-@@ -306,6 +760,22 @@ static int xhci_pci_probe(struct pci_dev
+@@ -307,6 +761,22 @@ static int xhci_pci_probe(struct pci_dev
struct hc_driver *driver;
struct usb_hcd *hcd;
driver = (struct hc_driver *)id->driver_data;
/* For some HW implementation, a XHCI reset is just not enough... */
-@@ -367,6 +837,16 @@ static void xhci_pci_remove(struct pci_d
+@@ -368,6 +838,16 @@ static void xhci_pci_remove(struct pci_d
{
struct xhci_hcd *xhci;
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
-@@ -221,7 +221,7 @@ static void xhci_pci_quirks(struct devic
+@@ -222,7 +222,7 @@ static void xhci_pci_quirks(struct devic
xhci->quirks |= XHCI_TRUST_TX_LENGTH;
if (pdev->vendor == PCI_VENDOR_ID_RENESAS &&
pdev->device == 0x0015)
rwlock_t sk_callback_lock;
--- a/net/core/sock.c
+++ b/net/core/sock.c
-@@ -2745,6 +2745,7 @@ void sock_init_data(struct socket *sock,
+@@ -2748,6 +2748,7 @@ void sock_init_data(struct socket *sock,
sk->sk_max_pacing_rate = ~0U;
sk->sk_pacing_rate = ~0U;
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
-@@ -1981,7 +1981,8 @@ static const struct usb_device_id option
+@@ -1983,7 +1983,8 @@ static const struct usb_device_id option
{ USB_DEVICE_INTERFACE_CLASS(0x2001, 0x7d01, 0xff) }, /* D-Link DWM-156 (variant) */
{ USB_DEVICE_INTERFACE_CLASS(0x2001, 0x7d02, 0xff) },
{ USB_DEVICE_INTERFACE_CLASS(0x2001, 0x7d03, 0xff) },
};
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
-@@ -960,6 +960,9 @@ static unsigned int early_drop_list(stru
+@@ -974,6 +974,9 @@ static unsigned int early_drop_list(stru
hlist_nulls_for_each_entry_rcu(h, n, head, hnnode) {
tmp = nf_ct_tuplehash_to_ctrack(h);
if (nf_ct_is_expired(tmp)) {
nf_ct_gc_expired(tmp);
continue;
-@@ -1037,6 +1040,18 @@ static bool gc_worker_can_early_drop(con
+@@ -1051,6 +1054,18 @@ static bool gc_worker_can_early_drop(con
return false;
}
static void gc_worker(struct work_struct *work)
{
unsigned int min_interval = max(HZ / GC_MAX_BUCKETS_DIV, 1u);
-@@ -1073,6 +1088,11 @@ static void gc_worker(struct work_struct
+@@ -1087,6 +1102,11 @@ static void gc_worker(struct work_struct
tmp = nf_ct_tuplehash_to_ctrack(h);
scanned++;
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
-@@ -1040,18 +1040,6 @@ static bool gc_worker_can_early_drop(con
+@@ -1054,18 +1054,6 @@ static bool gc_worker_can_early_drop(con
return false;
}
static void gc_worker(struct work_struct *work)
{
unsigned int min_interval = max(HZ / GC_MAX_BUCKETS_DIV, 1u);
-@@ -1088,10 +1076,8 @@ static void gc_worker(struct work_struct
+@@ -1102,10 +1090,8 @@ static void gc_worker(struct work_struct
tmp = nf_ct_tuplehash_to_ctrack(h);
scanned++;
+++ /dev/null
-From 82afdcd4ec3c8ca6551cbf7c43c09e2fd240487a Mon Sep 17 00:00:00 2001
-From: Hangbin Liu <liuhangbin@gmail.com>
-Date: Tue, 10 Mar 2020 15:27:37 +0800
-Subject: [PATCH] ipv6/addrconf: call ipv6_mc_up() for non-Ethernet interface
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-RafaĆ found an issue that for non-Ethernet interface, if we down and up
-frequently, the memory will be consumed slowly.
-
-The reason is we add allnodes/allrouters addressed in multicast list in
-ipv6_add_dev(). When link down, we call ipv6_mc_down(), store all multicast
-addresses via mld_add_delrec(). But when link up, we don't call ipv6_mc_up()
-for non-Ethernet interface to remove the addresses. This makes idev->mc_tomb
-getting bigger and bigger. The call stack looks like:
-
-addrconf_notify(NETDEV_REGISTER)
- ipv6_add_dev
- ipv6_dev_mc_inc(ff01::1)
- ipv6_dev_mc_inc(ff02::1)
- ipv6_dev_mc_inc(ff02::2)
-
-addrconf_notify(NETDEV_UP)
- addrconf_dev_config
- /* Alas, we support only Ethernet autoconfiguration. */
- return;
-
-addrconf_notify(NETDEV_DOWN)
- addrconf_ifdown
- ipv6_mc_down
- igmp6_group_dropped(ff02::2)
- mld_add_delrec(ff02::2)
- igmp6_group_dropped(ff02::1)
- igmp6_group_dropped(ff01::1)
-
-After investigating, I can't found a rule to disable multicast on
-non-Ethernet interface. In RFC2460, the link could be Ethernet, PPP, ATM,
-tunnels, etc. In IPv4, it doesn't check the dev type when calls ip_mc_up()
-in inetdev_event(). Even for IPv6, we don't check the dev type and call
-ipv6_add_dev(), ipv6_dev_mc_inc() after register device.
-
-So I think it's OK to fix this memory consumer by calling ipv6_mc_up() for
-non-Ethernet interface.
-
-v2: Also check IFF_MULTICAST flag to make sure the interface supports
- multicast
-
-Reported-by: RafaĆ MiĆecki <zajec5@gmail.com>
-Tested-by: RafaĆ MiĆecki <zajec5@gmail.com>
-Fixes: 74235a25c673 ("[IPV6] addrconf: Fix IPv6 on tuntap tunnels")
-Fixes: 1666d49e1d41 ("mld: do not remove mld souce list info when set link down")
-Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
-Signed-off-by: David S. Miller <davem@davemloft.net>
----
- net/ipv6/addrconf.c | 4 ++++
- 1 file changed, 4 insertions(+)
-
---- a/net/ipv6/addrconf.c
-+++ b/net/ipv6/addrconf.c
-@@ -3223,6 +3223,10 @@ static void addrconf_dev_config(struct n
- (dev->type != ARPHRD_TUNNEL) &&
- (dev->type != ARPHRD_NONE)) {
- /* Alas, we support only Ethernet autoconfiguration. */
-+ idev = __in6_dev_get(dev);
-+ if (!IS_ERR_OR_NULL(idev) && dev->flags & IFF_UP &&
-+ dev->flags & IFF_MULTICAST)
-+ ipv6_mc_up(idev);
- return;
- }
-
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
-@@ -547,6 +547,12 @@ struct phy_driver {
+@@ -549,6 +549,12 @@ struct phy_driver {
/* Determines the negotiated speed and duplex */
int (*read_status)(struct phy_device *phydev);
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
-@@ -1462,6 +1462,9 @@ int genphy_update_link(struct phy_device
+@@ -1466,6 +1466,9 @@ int genphy_update_link(struct phy_device
{
int status;
u64 res;
--- a/net/ipv4/Kconfig
+++ b/net/ipv4/Kconfig
-@@ -420,6 +420,7 @@ config INET_XFRM_MODE_BEET
+@@ -421,6 +421,7 @@ config INET_XFRM_MODE_BEET
config INET_DIAG
tristate "INET: socket monitoring interface"
return -ENOMEM;
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
-@@ -2783,6 +2783,8 @@ static const struct file_operations proc
+@@ -2786,6 +2786,8 @@ static const struct file_operations proc
static int __init proc_vmalloc_init(void)
{
--- a/net/core/sock.c
+++ b/net/core/sock.c
-@@ -3384,6 +3384,8 @@ static __net_initdata struct pernet_oper
+@@ -3387,6 +3387,8 @@ static __net_initdata struct pernet_oper
static int __init proto_init(void)
{
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
-@@ -2740,10 +2740,12 @@ static const struct file_operations fib_
+@@ -2743,10 +2743,12 @@ static const struct file_operations fib_
int __net_init fib_proc_init(struct net *net)
{
&fib_triestat_fops))
goto out2;
-@@ -2753,17 +2755,21 @@ int __net_init fib_proc_init(struct net
+@@ -2756,17 +2758,21 @@ int __net_init fib_proc_init(struct net
return 0;
out3:
if (!net_eq(dev_net(dev), sock_net(sk)))
goto drop;
-@@ -2213,12 +2215,12 @@ static int tpacket_rcv(struct sk_buff *s
+@@ -2214,12 +2216,12 @@ static int tpacket_rcv(struct sk_buff *s
BUILD_BUG_ON(TPACKET_ALIGN(sizeof(*h.h2)) != 32);
BUILD_BUG_ON(TPACKET_ALIGN(sizeof(*h.h3)) != 48);
if (!net_eq(dev_net(dev), sock_net(sk)))
goto drop;
-@@ -3301,6 +3303,7 @@ static int packet_create(struct net *net
+@@ -3313,6 +3315,7 @@ static int packet_create(struct net *net
mutex_init(&po->pg_vec_lock);
po->rollover = NULL;
po->prot_hook.func = packet_rcv;
if (sock->type == SOCK_PACKET)
po->prot_hook.func = packet_rcv_spkt;
-@@ -3923,6 +3926,16 @@ packet_setsockopt(struct socket *sock, i
+@@ -3935,6 +3938,16 @@ packet_setsockopt(struct socket *sock, i
po->xmit = val ? packet_direct_xmit : dev_queue_xmit;
return 0;
}
default:
return -ENOPROTOOPT;
}
-@@ -3975,6 +3988,13 @@ static int packet_getsockopt(struct sock
+@@ -3987,6 +4000,13 @@ static int packet_getsockopt(struct sock
case PACKET_VNET_HDR:
val = po->has_vnet_hdr;
break;
break;
--- a/net/packet/internal.h
+++ b/net/packet/internal.h
-@@ -132,6 +132,7 @@ struct packet_sock {
+@@ -135,6 +135,7 @@ struct packet_sock {
struct net_device __rcu *cached_dev;
int (*xmit)(struct sk_buff *skb);
struct packet_type prot_hook ____cacheline_aligned_in_smp;
static void rt_fibinfo_free(struct rtable __rcu **rtp)
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
-@@ -2469,6 +2469,7 @@ static const char *const rtn_type_names[
+@@ -2472,6 +2472,7 @@ static const char *const rtn_type_names[
[RTN_THROW] = "THROW",
[RTN_NAT] = "NAT",
[RTN_XRESOLVE] = "XRESOLVE",
cfg->fc_flags |= RTF_REJECT;
if (rtm->rtm_type == RTN_LOCAL)
-@@ -3514,6 +3548,9 @@ static int rt6_fill_node(struct net *net
+@@ -3515,6 +3549,9 @@ static int rt6_fill_node(struct net *net
case -EACCES:
rtm->rtm_type = RTN_PROHIBIT;
break;
case -EAGAIN:
rtm->rtm_type = RTN_THROW;
break;
-@@ -3832,6 +3869,8 @@ static int ip6_route_dev_notify(struct n
+@@ -3833,6 +3870,8 @@ static int ip6_route_dev_notify(struct n
#ifdef CONFIG_IPV6_MULTIPLE_TABLES
net->ipv6.ip6_prohibit_entry->dst.dev = dev;
net->ipv6.ip6_prohibit_entry->rt6i_idev = in6_dev_get(dev);
net->ipv6.ip6_blk_hole_entry->dst.dev = dev;
net->ipv6.ip6_blk_hole_entry->rt6i_idev = in6_dev_get(dev);
#endif
-@@ -3843,6 +3882,7 @@ static int ip6_route_dev_notify(struct n
+@@ -3844,6 +3883,7 @@ static int ip6_route_dev_notify(struct n
in6_dev_put_clear(&net->ipv6.ip6_null_entry->rt6i_idev);
#ifdef CONFIG_IPV6_MULTIPLE_TABLES
in6_dev_put_clear(&net->ipv6.ip6_prohibit_entry->rt6i_idev);
in6_dev_put_clear(&net->ipv6.ip6_blk_hole_entry->rt6i_idev);
#endif
}
-@@ -4059,6 +4099,17 @@ static int __net_init ip6_route_net_init
+@@ -4060,6 +4100,17 @@ static int __net_init ip6_route_net_init
net->ipv6.ip6_blk_hole_entry->dst.ops = &net->ipv6.ip6_dst_ops;
dst_init_metrics(&net->ipv6.ip6_blk_hole_entry->dst,
ip6_template_metrics, true);
#endif
net->ipv6.sysctl.flush_delay = 0;
-@@ -4077,6 +4128,8 @@ out:
+@@ -4078,6 +4129,8 @@ out:
return ret;
#ifdef CONFIG_IPV6_MULTIPLE_TABLES
out_ip6_prohibit_entry:
kfree(net->ipv6.ip6_prohibit_entry);
out_ip6_null_entry:
-@@ -4094,6 +4147,7 @@ static void __net_exit ip6_route_net_exi
+@@ -4095,6 +4148,7 @@ static void __net_exit ip6_route_net_exi
#ifdef CONFIG_IPV6_MULTIPLE_TABLES
kfree(net->ipv6.ip6_prohibit_entry);
kfree(net->ipv6.ip6_blk_hole_entry);
#endif
dst_entries_destroy(&net->ipv6.ip6_dst_ops);
}
-@@ -4167,6 +4221,9 @@ void __init ip6_route_init_special_entri
+@@ -4168,6 +4222,9 @@ void __init ip6_route_init_special_entri
init_net.ipv6.ip6_prohibit_entry->rt6i_idev = in6_dev_get(init_net.loopback_dev);
init_net.ipv6.ip6_blk_hole_entry->dst.dev = init_net.loopback_dev;
init_net.ipv6.ip6_blk_hole_entry->rt6i_idev = in6_dev_get(init_net.loopback_dev);
* @phydev: the phy_device struct
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
-@@ -909,6 +909,7 @@ void phy_ethtool_ksettings_get(struct ph
+@@ -911,6 +911,7 @@ void phy_ethtool_ksettings_get(struct ph
struct ethtool_link_ksettings *cmd);
int phy_ethtool_ksettings_set(struct phy_device *phydev,
const struct ethtool_link_ksettings *cmd);
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
-@@ -1106,6 +1106,9 @@ void phy_detach(struct phy_device *phyde
+@@ -1110,6 +1110,9 @@ void phy_detach(struct phy_device *phyde
struct module *ndev_owner = dev->dev.parent->driver->owner;
struct mii_bus *bus;
sysfs_remove_link(&phydev->mdio.dev.kobj, "attached_dev");
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
-@@ -559,6 +559,12 @@ struct phy_driver {
+@@ -561,6 +561,12 @@ struct phy_driver {
*/
int (*did_interrupt)(struct phy_device *phydev);
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
-@@ -1944,7 +1944,7 @@ static struct phy_driver genphy_driver =
+@@ -1948,7 +1948,7 @@ static struct phy_driver genphy_driver =
.config_init = genphy_config_init,
.features = PHY_GBIT_FEATURES | SUPPORTED_MII |
SUPPORTED_AUI | SUPPORTED_FIBRE |
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
-@@ -1715,6 +1715,16 @@ config RTC_DRV_MT6397
+@@ -1716,6 +1716,16 @@ config RTC_DRV_MT6397
If you want to use Mediatek(R) RTC interface, select Y or M here.
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
-@@ -1706,14 +1706,14 @@ config RTC_DRV_MOXART
+@@ -1707,14 +1707,14 @@ config RTC_DRV_MOXART
will be called rtc-moxart
config RTC_DRV_MT6397
if (!xhci->shared_hcd) {
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
-@@ -279,6 +279,9 @@ static int xhci_pci_setup(struct usb_hcd
+@@ -280,6 +280,9 @@ static int xhci_pci_setup(struct usb_hcd
if (!xhci->sbrn)
pci_read_config_byte(pdev, XHCI_SBRN_OFFSET, &xhci->sbrn);
---
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
-@@ -3961,6 +3961,15 @@ static int mvneta_ethtool_set_wol(struct
+@@ -3960,6 +3960,15 @@ static int mvneta_ethtool_set_wol(struct
return ret;
}
static const struct net_device_ops mvneta_netdev_ops = {
.ndo_open = mvneta_open,
.ndo_stop = mvneta_stop,
-@@ -3971,6 +3980,7 @@ static const struct net_device_ops mvnet
+@@ -3970,6 +3979,7 @@ static const struct net_device_ops mvnet
.ndo_fix_features = mvneta_fix_features,
.ndo_get_stats64 = mvneta_get_stats64,
.ndo_do_ioctl = mvneta_ioctl,
}
/* Release Tx descriptors */
-@@ -3061,7 +3020,6 @@ static int mvneta_setup_txqs(struct mvne
+@@ -3060,7 +3019,6 @@ static int mvneta_setup_txqs(struct mvne
static void mvneta_start_dev(struct mvneta_port *pp)
{
int cpu;
mvneta_max_rx_size_set(pp, pp->pkt_size);
mvneta_txq_max_tx_size_set(pp, pp->pkt_size);
-@@ -3089,16 +3047,15 @@ static void mvneta_start_dev(struct mvne
+@@ -3088,16 +3046,15 @@ static void mvneta_start_dev(struct mvne
MVNETA_CAUSE_LINK_CHANGE |
MVNETA_CAUSE_PSC_SYNC_CHANGE);
if (!pp->neta_armada3700) {
for_each_online_cpu(cpu) {
-@@ -3251,103 +3208,232 @@ static int mvneta_set_mac_addr(struct ne
+@@ -3250,103 +3207,232 @@ static int mvneta_set_mac_addr(struct ne
return 0;
}
}
/* Electing a CPU must be done in an atomic way: it should be done
-@@ -3626,10 +3712,9 @@ static int mvneta_stop(struct net_device
+@@ -3625,10 +3711,9 @@ static int mvneta_stop(struct net_device
static int mvneta_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
{
}
/* Ethtool methods */
-@@ -3640,44 +3725,25 @@ mvneta_ethtool_set_link_ksettings(struct
+@@ -3639,44 +3724,25 @@ mvneta_ethtool_set_link_ksettings(struct
const struct ethtool_link_ksettings *cmd)
{
struct mvneta_port *pp = netdev_priv(ndev);
}
/* Set interrupt coalescing for ethtools */
-@@ -3769,6 +3835,22 @@ static int mvneta_ethtool_set_ringparam(
+@@ -3768,6 +3834,22 @@ static int mvneta_ethtool_set_ringparam(
return 0;
}
static void mvneta_ethtool_get_strings(struct net_device *netdev, u32 sset,
u8 *data)
{
-@@ -3785,26 +3867,35 @@ static void mvneta_ethtool_update_stats(
+@@ -3784,26 +3866,35 @@ static void mvneta_ethtool_update_stats(
{
const struct mvneta_statistic *s;
void __iomem *base = pp->base;
}
}
-@@ -3939,28 +4030,65 @@ static int mvneta_ethtool_get_rxfh(struc
+@@ -3938,28 +4029,65 @@ static int mvneta_ethtool_get_rxfh(struc
static void mvneta_ethtool_get_wol(struct net_device *dev,
struct ethtool_wolinfo *wol)
{
static u16 mvneta_select_queue(struct net_device *dev, struct sk_buff *skb,
void *accel_priv,
select_queue_fallback_t fallback)
-@@ -3984,13 +4112,15 @@ static const struct net_device_ops mvnet
+@@ -3983,13 +4111,15 @@ static const struct net_device_ops mvnet
};
static const struct ethtool_ops mvneta_eth_tool_ops = {
.get_strings = mvneta_ethtool_get_strings,
.get_ethtool_stats = mvneta_ethtool_get_stats,
.get_sset_count = mvneta_ethtool_get_sset_count,
-@@ -3998,10 +4128,12 @@ static const struct ethtool_ops mvneta_e
+@@ -3997,10 +4127,12 @@ static const struct ethtool_ops mvneta_e
.get_rxnfc = mvneta_ethtool_get_rxnfc,
.get_rxfh = mvneta_ethtool_get_rxfh,
.set_rxfh = mvneta_ethtool_set_rxfh,
};
/* Initialize hw */
-@@ -4146,14 +4278,13 @@ static int mvneta_probe(struct platform_
+@@ -4145,14 +4277,13 @@ static int mvneta_probe(struct platform_
{
struct resource *res;
struct device_node *dn = pdev->dev.of_node;
int tx_csum_limit;
int phy_mode;
int err;
-@@ -4169,31 +4300,11 @@ static int mvneta_probe(struct platform_
+@@ -4168,31 +4299,11 @@ static int mvneta_probe(struct platform_
goto err_free_netdev;
}
}
dev->tx_queue_len = MVNETA_MAX_TXD;
-@@ -4204,12 +4315,7 @@ static int mvneta_probe(struct platform_
+@@ -4203,12 +4314,7 @@ static int mvneta_probe(struct platform_
pp = netdev_priv(dev);
spin_lock_init(&pp->lock);
pp->rxq_def = rxq_def;
-@@ -4231,7 +4337,7 @@ static int mvneta_probe(struct platform_
+@@ -4230,7 +4336,7 @@ static int mvneta_probe(struct platform_
pp->clk = devm_clk_get(&pdev->dev, NULL);
if (IS_ERR(pp->clk)) {
err = PTR_ERR(pp->clk);
}
clk_prepare_enable(pp->clk);
-@@ -4357,6 +4463,14 @@ static int mvneta_probe(struct platform_
+@@ -4356,6 +4462,14 @@ static int mvneta_probe(struct platform_
/* 9676 == 9700 - 20 and rounding to 8 */
dev->max_mtu = 9676;
err = register_netdev(dev);
if (err < 0) {
dev_err(&pdev->dev, "failed to register\n");
-@@ -4368,14 +4482,6 @@ static int mvneta_probe(struct platform_
+@@ -4367,14 +4481,6 @@ static int mvneta_probe(struct platform_
platform_set_drvdata(pdev, pp->dev);
return 0;
err_netdev:
-@@ -4384,16 +4490,14 @@ err_netdev:
+@@ -4383,16 +4489,14 @@ err_netdev:
mvneta_bm_pool_destroy(pp->bm_priv, pp->pool_short,
1 << pp->id);
}
err_free_irq:
irq_dispose_mapping(dev->irq);
err_free_netdev:
-@@ -4405,7 +4509,6 @@ err_free_netdev:
+@@ -4404,7 +4508,6 @@ err_free_netdev:
static int mvneta_remove(struct platform_device *pdev)
{
struct net_device *dev = platform_get_drvdata(pdev);
struct mvneta_port *pp = netdev_priv(dev);
unregister_netdev(dev);
-@@ -4413,10 +4516,8 @@ static int mvneta_remove(struct platform
+@@ -4412,10 +4515,8 @@ static int mvneta_remove(struct platform
clk_disable_unprepare(pp->clk);
free_percpu(pp->ports);
free_percpu(pp->stats);
free_netdev(dev);
if (pp->bm_priv) {
-@@ -4468,9 +4569,6 @@ static int mvneta_resume(struct device *
+@@ -4467,9 +4568,6 @@ static int mvneta_resume(struct device *
return err;
}
struct device_node *dn;
unsigned int tx_csum_limit;
struct phylink *phylink;
-@@ -4315,6 +4316,7 @@ static int mvneta_probe(struct platform_
+@@ -4314,6 +4315,7 @@ static int mvneta_probe(struct platform_
pp = netdev_priv(dev);
spin_lock_init(&pp->lock);
mvneta_link_change(pp);
}
-@@ -3045,8 +3044,7 @@ static void mvneta_start_dev(struct mvne
+@@ -3044,8 +3043,7 @@ static void mvneta_start_dev(struct mvne
mvreg_write(pp, MVNETA_INTR_MISC_MASK,
MVNETA_CAUSE_PHY_STATUS_CHANGE |
phylink_start(pp->phylink);
netif_tx_start_all_queues(pp->dev);
-@@ -3542,8 +3540,7 @@ static int mvneta_cpu_online(unsigned in
+@@ -3541,8 +3539,7 @@ static int mvneta_cpu_online(unsigned in
on_each_cpu(mvneta_percpu_unmask_interrupt, pp, true);
mvreg_write(pp, MVNETA_INTR_MISC_MASK,
MVNETA_CAUSE_PHY_STATUS_CHANGE |
netif_tx_start_all_queues(pp->dev);
spin_unlock(&pp->lock);
return 0;
-@@ -3584,8 +3581,7 @@ static int mvneta_cpu_dead(unsigned int
+@@ -3583,8 +3580,7 @@ static int mvneta_cpu_dead(unsigned int
on_each_cpu(mvneta_percpu_unmask_interrupt, pp, true);
mvreg_write(pp, MVNETA_INTR_MISC_MASK,
MVNETA_CAUSE_PHY_STATUS_CHANGE |
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
-@@ -4045,6 +4045,22 @@ static int mvneta_ethtool_set_wol(struct
+@@ -4044,6 +4044,22 @@ static int mvneta_ethtool_set_wol(struct
return ret;
}
static int mvneta_ethtool_get_eee(struct net_device *dev,
struct ethtool_eee *eee)
{
-@@ -4129,6 +4145,8 @@ static const struct ethtool_ops mvneta_e
+@@ -4128,6 +4144,8 @@ static const struct ethtool_ops mvneta_e
.set_link_ksettings = mvneta_ethtool_set_link_ksettings,
.get_wol = mvneta_ethtool_get_wol,
.set_wol = mvneta_ethtool_set_wol,
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
-@@ -4045,22 +4045,6 @@ static int mvneta_ethtool_set_wol(struct
+@@ -4044,22 +4044,6 @@ static int mvneta_ethtool_set_wol(struct
return ret;
}
static int mvneta_ethtool_get_eee(struct net_device *dev,
struct ethtool_eee *eee)
{
-@@ -4145,8 +4129,6 @@ static const struct ethtool_ops mvneta_e
+@@ -4144,8 +4128,6 @@ static const struct ethtool_ops mvneta_e
.set_link_ksettings = mvneta_ethtool_set_link_ksettings,
.get_wol = mvneta_ethtool_get_wol,
.set_wol = mvneta_ethtool_set_wol,
};
static struct bgx *bgx_vnic[MAX_BGX_THUNDER];
-@@ -841,12 +842,12 @@ static void bgx_poll_for_link(struct wor
+@@ -850,12 +851,12 @@ static void bgx_poll_for_link(struct wor
queue_delayed_work(lmac->check_link, &lmac->dwork, HZ * 2);
}
return PHY_INTERFACE_MODE_SGMII;
}
-@@ -912,7 +913,8 @@ static int bgx_lmac_enable(struct bgx *b
+@@ -921,7 +922,8 @@ static int bgx_lmac_enable(struct bgx *b
if (phy_connect_direct(&lmac->netdev, lmac->phydev,
bgx_lmac_handler,
return -ENODEV;
phy_start(lmac->phydev);
-@@ -1287,6 +1289,8 @@ static int bgx_init_of_phy(struct bgx *b
+@@ -1296,6 +1298,8 @@ static int bgx_init_of_phy(struct bgx *b
bgx->lmac[lmac].lmacid = lmac;
phy_np = of_parse_phandle(node, "phy-handle", 0);
/* If there is no phy or defective firmware presents
* this cortina phy, for which there is no driver
* support, ignore it.
-@@ -1390,7 +1394,6 @@ static int bgx_probe(struct pci_dev *pde
+@@ -1441,7 +1445,6 @@ static int bgx_probe(struct pci_dev *pde
bgx->max_lmac = 1;
bgx->bgx_id = MAX_BGX_PER_CN81XX - 1;
bgx_vnic[bgx->bgx_id] = bgx;
}
/* On 81xx all are DLMs and on 83xx there are 3 BGX QLMs and one
-@@ -1407,6 +1410,8 @@ static int bgx_probe(struct pci_dev *pde
+@@ -1458,6 +1461,8 @@ static int bgx_probe(struct pci_dev *pde
if (err)
goto err_enable;
+ xcv_init_hw(bgx->phy_mode);
bgx_init_hw(bgx);
- /* Enable all LMACs */
+ bgx_register_intr(pdev);
--- a/drivers/net/ethernet/cavium/thunder/thunder_bgx.h
+++ b/drivers/net/ethernet/cavium/thunder/thunder_bgx.h
-@@ -226,7 +226,7 @@ void bgx_lmac_internal_loopback(int node
+@@ -235,7 +235,7 @@ void bgx_lmac_internal_loopback(int node
void bgx_lmac_get_pfc(int node, int bgx_idx, int lmacid, void *pause);
void bgx_lmac_set_pfc(int node, int bgx_idx, int lmacid, void *pause);
+++ /dev/null
-From b1e7791e688620c9bb8476ac2d0bc99abeb7f825 Mon Sep 17 00:00:00 2001
-From: Tim Harvey <tharvey@gateworks.com>
-Date: Fri, 29 Dec 2017 16:48:04 -0800
-Subject: [PATCH] net: thunderx: workaround BGX TX Underflow issue
-
-While it is not yet understood why a TX underflow can easily occur
-for SGMII interfaces resulting in a TX wedge. It has been found that
-disabling/re-enabling the LMAC resolves the issue.
-
-Signed-off-by: Tim Harvey <tharvey@gateworks.com>
----
- drivers/net/ethernet/cavium/thunder/thunder_bgx.c | 54 +++++++++++++++++++++++
- drivers/net/ethernet/cavium/thunder/thunder_bgx.h | 9 ++++
- 2 files changed, 63 insertions(+)
-
---- a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
-+++ b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
-@@ -1344,6 +1344,54 @@ static int bgx_init_phy(struct bgx *bgx)
- return bgx_init_of_phy(bgx);
- }
-
-+static irqreturn_t bgx_intr_handler(int irq, void *data)
-+{
-+ struct bgx *bgx = (struct bgx *)data;
-+ struct device *dev = &bgx->pdev->dev;
-+ u64 status, val;
-+ int lmac;
-+
-+ for (lmac = 0; lmac < bgx->lmac_count; lmac++) {
-+ status = bgx_reg_read(bgx, lmac, BGX_GMP_GMI_TXX_INT);
-+ if (status & GMI_TXX_INT_UNDFLW) {
-+ dev_err(dev, "BGX%d lmac%d UNDFLW\n", bgx->bgx_id,
-+ lmac);
-+ val = bgx_reg_read(bgx, lmac, BGX_CMRX_CFG);
-+ val &= ~CMR_EN;
-+ bgx_reg_write(bgx, lmac, BGX_CMRX_CFG, val);
-+ val |= CMR_EN;
-+ bgx_reg_write(bgx, lmac, BGX_CMRX_CFG, val);
-+ }
-+ /* clear interrupts */
-+ bgx_reg_write(bgx, lmac, BGX_GMP_GMI_TXX_INT, status);
-+ }
-+
-+ return IRQ_HANDLED;
-+}
-+
-+static int bgx_register_intr(struct pci_dev *pdev)
-+{
-+ struct bgx *bgx = pci_get_drvdata(pdev);
-+ struct device *dev = &pdev->dev;
-+ int num_vec, ret;
-+ char irq_name[32];
-+
-+ /* Enable MSI-X */
-+ num_vec = pci_msix_vec_count(pdev);
-+ ret = pci_alloc_irq_vectors(pdev, num_vec, num_vec, PCI_IRQ_MSIX);
-+ if (ret < 0) {
-+ dev_err(dev, "Req for #%d msix vectors failed\n", num_vec);
-+ return 1;
-+ }
-+ sprintf(irq_name, "BGX%d", bgx->bgx_id);
-+ ret = request_irq(pci_irq_vector(pdev, GMPX_GMI_TX_INT),
-+ bgx_intr_handler, 0, irq_name, bgx);
-+ if (ret)
-+ return 1;
-+
-+ return 0;
-+}
-+
- static int bgx_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
- {
- int err;
-@@ -1414,6 +1462,8 @@ static int bgx_probe(struct pci_dev *pde
- xcv_init_hw(bgx->phy_mode);
- bgx_init_hw(bgx);
-
-+ bgx_register_intr(pdev);
-+
- /* Enable all LMACs */
- for (lmac = 0; lmac < bgx->lmac_count; lmac++) {
- err = bgx_lmac_enable(bgx, lmac);
-@@ -1424,6 +1474,10 @@ static int bgx_probe(struct pci_dev *pde
- bgx_lmac_disable(bgx, --lmac);
- goto err_enable;
- }
-+
-+ /* enable TX FIFO Underflow interrupt */
-+ bgx_reg_modify(bgx, lmac, BGX_GMP_GMI_TXX_INT_ENA_W1S,
-+ GMI_TXX_INT_UNDFLW);
- }
-
- return 0;
---- a/drivers/net/ethernet/cavium/thunder/thunder_bgx.h
-+++ b/drivers/net/ethernet/cavium/thunder/thunder_bgx.h
-@@ -179,6 +179,15 @@
- #define BGX_GMP_GMI_TXX_BURST 0x38228
- #define BGX_GMP_GMI_TXX_MIN_PKT 0x38240
- #define BGX_GMP_GMI_TXX_SGMII_CTL 0x38300
-+#define BGX_GMP_GMI_TXX_INT 0x38500
-+#define BGX_GMP_GMI_TXX_INT_W1S 0x38508
-+#define BGX_GMP_GMI_TXX_INT_ENA_W1C 0x38510
-+#define BGX_GMP_GMI_TXX_INT_ENA_W1S 0x38518
-+#define GMI_TXX_INT_PTP_LOST BIT_ULL(4)
-+#define GMI_TXX_INT_LATE_COL BIT_ULL(3)
-+#define GMI_TXX_INT_XSDEF BIT_ULL(2)
-+#define GMI_TXX_INT_XSCOL BIT_ULL(1)
-+#define GMI_TXX_INT_UNDFLW BIT_ULL(0)
-
- #define BGX_MSIX_VEC_0_29_ADDR 0x400000 /* +(0..29) << 4 */
- #define BGX_MSIX_VEC_0_29_CTL 0x400008
break;
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
-@@ -412,6 +412,7 @@ struct phy_device {
- bool suspended;
+@@ -414,6 +414,7 @@ struct phy_device {
+ bool suspended_by_mdio_bus;
bool sysfs_links;
bool loopback_enabled;
+ bool no_auto_carrier_off;