未验证 提交 94486728 编写于 作者: A AmadeusGhost 提交者: GitHub

kernel: bump to 4.9.219, 4.14.176, 4.19.115 (#4350)

* kernel: bump 4.14 to 4.14.176

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
- 184-USB-serial-option-add-Wistron-Neweb-D19Q1.patch

Fixes:
- CVE-2020-8648 (potentially)
- CVE-2020-8647
- CVE-2020-8649

Compile-tested on: cns3xxx, octeontx
Runtime-tested on: cns3xxx
Signed-off-by: NKoen Vandeputte <koen.vandeputte@ncentric.com>

* kernel: bump 4.19 to 4.19.115

Remove upstreamed:
- 600-ipv6-addrconf-call-ipv6_mc_up-for-non-Ethernet-inter.patch
- 184-USB-serial-option-add-Wistron-Neweb-D19Q1.patch

Fixes:
- CVE-2020-8647
- CVE-2020-8648 (potentially)
- CVE-2020-8649

Compile-tested on: cns3xxx
Runtime-tested on: cns3xxx
Signed-off-by: NKoen Vandeputte <koen.vandeputte@ncentric.com>

* kernel: bump 4.9 to 4.9.219

Refreshed all patches.

Altered patches:
- 0026-NET-multi-phy-support.patch

Fixes:
- CVE-2020-8647
- CVE-2020-8648 (Potentially)
- CVE-2020-8649

Compile-tested on: ar71xx
Runtime-tested on: ar71xx
Signed-off-by: NKoen Vandeputte <koen.vandeputte@ncentric.com>
上级 6b142baa
......@@ -6,13 +6,13 @@ ifdef CONFIG_TESTING_KERNEL
KERNEL_PATCHVER:=$(KERNEL_TESTING_PATCHVER)
endif
LINUX_VERSION-4.9 = .215
LINUX_VERSION-4.14 = .172
LINUX_VERSION-4.19 = .108
LINUX_VERSION-4.9 = .219
LINUX_VERSION-4.14 = .176
LINUX_VERSION-4.19 = .115
LINUX_KERNEL_HASH-4.9.215 = 236f2f47853700f22b9925cb17917d97ff7120fcc8110ec827c5a030a8129f48
LINUX_KERNEL_HASH-4.14.172 = 2318a1ab937580a079351ed20557c336a3d95b664f667b14e3ba49e3271b217a
LINUX_KERNEL_HASH-4.19.108 = 09aeeca5b08efea2f54b977b2999afb60d42f93b9f65b2b0111969f183f750a3
LINUX_KERNEL_HASH-4.9.219 = 6b17238cced3e1c2753d6d5b4f662bd347d4651f07c35506b849eb10aea7bc44
LINUX_KERNEL_HASH-4.14.176 = bcae0956baaeb55dab5bad0401873fbc5baaa7fbe957ea6d27a5ab241cec5ca2
LINUX_KERNEL_HASH-4.19.115 = 11b2d97c8ea5ceb40c5e1d0bb87ad5b2b8c84560181bc60c0d28ec3a3e3801c2
remove_uri_prefix=$(subst git://,,$(subst http://,,$(subst https://,,$(1))))
sanitize_uri=$(call qstrip,$(subst @,_,$(subst :,_,$(subst .,_,$(subst -,_,$(subst /,_,$(1)))))))
......
......@@ -44,7 +44,7 @@ Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
#include "xhci.h"
#include "xhci-trace.h"
@@ -264,6 +266,458 @@ static void xhci_pme_acpi_rtd3_enable(st
@@ -265,6 +267,458 @@ static void xhci_pme_acpi_rtd3_enable(st
static void xhci_pme_acpi_rtd3_enable(struct pci_dev *dev) { }
#endif /* CONFIG_ACPI */
......@@ -503,7 +503,7 @@ Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
/* called during probe() after chip reset completes */
static int xhci_pci_setup(struct usb_hcd *hcd)
{
@@ -305,6 +759,22 @@ static int xhci_pci_probe(struct pci_dev
@@ -306,6 +760,22 @@ static int xhci_pci_probe(struct pci_dev
struct hc_driver *driver;
struct usb_hcd *hcd;
......@@ -526,7 +526,7 @@ Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
driver = (struct hc_driver *)id->driver_data;
/* Prevent runtime suspending between USB-2 and USB-3 initialization */
@@ -363,6 +833,16 @@ static void xhci_pci_remove(struct pci_d
@@ -364,6 +834,16 @@ static void xhci_pci_remove(struct pci_d
{
struct xhci_hcd *xhci;
......
......@@ -13,7 +13,7 @@ produce a noisy warning.
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -217,6 +217,7 @@ static void xhci_pci_quirks(struct devic
@@ -218,6 +218,7 @@ static void xhci_pci_quirks(struct devic
pdev->device == 0x0015) {
xhci->quirks |= XHCI_RESET_ON_RESUME;
xhci->quirks |= XHCI_ZERO_64B_REGS;
......
......@@ -223,7 +223,7 @@
#include <linux/uaccess.h>
#include <linux/ipv6.h>
#include <linux/icmpv6.h>
@@ -820,10 +821,10 @@ static void tcp_v6_send_response(const s
@@ -819,10 +820,10 @@ static void tcp_v6_send_response(const s
topt = (__be32 *)(t1 + 1);
if (tsecr) {
......
......@@ -40,9 +40,9 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
--- a/drivers/tty/serial/ar933x_uart.c
+++ b/drivers/tty/serial/ar933x_uart.c
@@ -286,6 +286,10 @@ static void ar933x_uart_set_termios(stru
@@ -290,6 +290,10 @@ static void ar933x_uart_set_termios(stru
ar933x_uart_rmw_set(up, AR933X_UART_CS_REG,
AR933X_UART_CS_HOST_INT_EN);
AR933X_UART_CS_TX_READY_ORIDE | AR933X_UART_CS_RX_READY_ORIDE);
+ /* enable RX and TX ready overide */
+ ar933x_uart_rmw_set(up, AR933X_UART_CS_REG,
......@@ -51,14 +51,14 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
/* reenable the UART */
ar933x_uart_rmw(up, AR933X_UART_CS_REG,
AR933X_UART_CS_IF_MODE_M << AR933X_UART_CS_IF_MODE_S,
@@ -418,6 +422,10 @@ static int ar933x_uart_startup(struct ua
ar933x_uart_rmw_set(up, AR933X_UART_CS_REG,
AR933X_UART_CS_HOST_INT_EN);
@@ -424,6 +428,10 @@ static int ar933x_uart_startup(struct ua
+ /* enable RX and TX ready overide */
+ ar933x_uart_rmw_set(up, AR933X_UART_CS_REG,
/* enable RX and TX ready overide */
ar933x_uart_rmw_set(up, AR933X_UART_CS_REG,
+ AR933X_UART_CS_TX_READY_ORIDE | AR933X_UART_CS_RX_READY_ORIDE);
+
+ /* enable RX and TX ready overide */
+ ar933x_uart_rmw_set(up, AR933X_UART_CS_REG,
AR933X_UART_CS_TX_READY_ORIDE | AR933X_UART_CS_RX_READY_ORIDE);
/* Enable RX interrupts */
up->ier = AR933X_UART_INT_RX_VALID;
ar933x_uart_write(up, AR933X_UART_INT_EN_REG, up->ier);
......@@ -160,7 +160,7 @@ v2: use bool to indicate ongoing half-duplex send, use it afterwards
}
static void ar933x_uart_break_ctl(struct uart_port *port, int break_state)
@@ -336,11 +393,20 @@ static void ar933x_uart_rx_chars(struct
@@ -340,11 +397,20 @@ static void ar933x_uart_rx_chars(struct
static void ar933x_uart_tx_chars(struct ar933x_uart_port *up)
{
struct circ_buf *xmit = &up->port.state->xmit;
......@@ -181,7 +181,7 @@ v2: use bool to indicate ongoing half-duplex send, use it afterwards
count = up->port.fifosize;
do {
unsigned int rdata;
@@ -368,8 +434,14 @@ static void ar933x_uart_tx_chars(struct
@@ -372,8 +438,14 @@ static void ar933x_uart_tx_chars(struct
if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
uart_write_wakeup(&up->port);
......@@ -197,7 +197,7 @@ v2: use bool to indicate ongoing half-duplex send, use it afterwards
}
static irqreturn_t ar933x_uart_interrupt(int irq, void *dev_id)
@@ -427,8 +499,7 @@ static int ar933x_uart_startup(struct ua
@@ -435,8 +507,7 @@ static int ar933x_uart_startup(struct ua
AR933X_UART_CS_TX_READY_ORIDE | AR933X_UART_CS_RX_READY_ORIDE);
/* Enable RX interrupts */
......@@ -207,7 +207,7 @@ v2: use bool to indicate ongoing half-duplex send, use it afterwards
spin_unlock_irqrestore(&up->port.lock, flags);
@@ -511,6 +582,21 @@ static const struct uart_ops ar933x_uart
@@ -519,6 +590,21 @@ static const struct uart_ops ar933x_uart
.verify_port = ar933x_uart_verify_port,
};
......@@ -229,7 +229,7 @@ v2: use bool to indicate ongoing half-duplex send, use it afterwards
#ifdef CONFIG_SERIAL_AR933X_CONSOLE
static struct ar933x_uart_port *
ar933x_console_ports[CONFIG_SERIAL_AR933X_NR_UARTS];
@@ -680,6 +766,8 @@ static int ar933x_uart_probe(struct plat
@@ -688,6 +774,8 @@ static int ar933x_uart_probe(struct plat
goto err_disable_clk;
}
......@@ -238,7 +238,7 @@ v2: use bool to indicate ongoing half-duplex send, use it afterwards
port->mapbase = mem_res->start;
port->line = id;
port->irq = irq_res->start;
@@ -690,6 +778,7 @@ static int ar933x_uart_probe(struct plat
@@ -698,6 +786,7 @@ static int ar933x_uart_probe(struct plat
port->regshift = 2;
port->fifosize = AR933X_UART_FIFO_SIZE;
port->ops = &ar933x_uart_ops;
......@@ -246,7 +246,7 @@ v2: use bool to indicate ongoing half-duplex send, use it afterwards
baud = ar933x_uart_get_baud(port->uartclk, AR933X_UART_MAX_SCALE, 1);
up->min_baud = max_t(unsigned int, baud, AR933X_UART_MIN_BAUD);
@@ -697,6 +786,18 @@ static int ar933x_uart_probe(struct plat
@@ -705,6 +794,18 @@ static int ar933x_uart_probe(struct plat
baud = ar933x_uart_get_baud(port->uartclk, 0, AR933X_UART_MAX_STEP);
up->max_baud = min_t(unsigned int, baud, AR933X_UART_MAX_BAUD);
......
From 8d8cdb4a6ccee5b62cc0dc64651c3946364514dc Mon Sep 17 00:00:00 2001
From: Luiz Angelo Daros de Luca <luizluca@gmail.com>
Date: Mon, 10 Feb 2020 16:11:27 -0300
Subject: [PATCH] spi: ath79: Implement the spi_mem interface
Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
---
drivers/spi/spi-ath79.c | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
--- a/drivers/spi/spi-ath79.c
+++ b/drivers/spi/spi-ath79.c
@@ -19,6 +19,7 @@
#include <linux/platform_device.h>
#include <linux/io.h>
#include <linux/spi/spi.h>
+#include <linux/spi/spi-mem.h>
#include <linux/spi/spi_bitbang.h>
#include <linux/bitops.h>
#include <linux/gpio.h>
@@ -203,6 +204,39 @@ static u32 ath79_spi_txrx_mode0(struct s
return ath79_spi_rr(sp, AR71XX_SPI_REG_RDS);
}
+static int ath79_exec_mem_op(struct spi_mem *mem,
+ const struct spi_mem_op *op)
+{
+ struct ath79_spi *sp = ath79_spidev_to_sp(mem->spi);
+
+ /* Ensures that reading is performed on device connected
+ to hardware cs0 */
+ if (mem->spi->chip_select || gpio_is_valid(mem->spi->cs_gpio))
+ return -ENOTSUPP;
+
+ /* Only use for fast-read op. */
+ if (op->cmd.opcode != 0x0b || op->data.dir != SPI_MEM_DATA_IN ||
+ op->addr.nbytes != 3 || op->dummy.nbytes != 1)
+ return -ENOTSUPP;
+
+ /* disable GPIO mode */
+ ath79_spi_wr(sp, AR71XX_SPI_REG_FS, 0);
+
+ memcpy_fromio(op->data.buf.in, sp->base + op->addr.val, op->data.nbytes);
+
+ /* enable GPIO mode */
+ ath79_spi_wr(sp, AR71XX_SPI_REG_FS, AR71XX_SPI_FS_GPIO);
+
+ /* restore IOC register */
+ ath79_spi_wr(sp, AR71XX_SPI_REG_IOC, sp->ioc_base);
+
+ return 0;
+}
+
+static const struct spi_controller_mem_ops ath79_mem_ops = {
+ .exec_op = ath79_exec_mem_op,
+};
+
static int ath79_spi_probe(struct platform_device *pdev)
{
struct spi_master *master;
@@ -237,6 +271,7 @@ static int ath79_spi_probe(struct platfo
ret = PTR_ERR(sp->base);
goto err_put_master;
}
+ master->mem_ops = &ath79_mem_ops;
sp->clk = devm_clk_get(&pdev->dev, "ahb");
if (IS_ERR(sp->clk)) {
......@@ -214,7 +214,7 @@
#include <linux/uaccess.h>
#include <linux/ipv6.h>
#include <linux/icmpv6.h>
@@ -837,10 +838,10 @@ static void tcp_v6_send_response(const s
@@ -836,10 +837,10 @@ static void tcp_v6_send_response(const s
topt = (__be32 *)(t1 + 1);
if (tsecr) {
......
......@@ -170,7 +170,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.org>
goto out;
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -2230,7 +2230,8 @@ EXPORT_SYMBOL(mmc_erase);
@@ -2233,7 +2233,8 @@ EXPORT_SYMBOL(mmc_erase);
int mmc_can_erase(struct mmc_card *card)
{
if ((card->host->caps & MMC_CAP_ERASE) &&
......
......@@ -276,7 +276,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.org>
ENDPROC(arm_copy_from_user)
+ENDPROC(__copy_from_user_std)
.pushsection .fixup,"ax"
.pushsection .text.fixup,"ax"
.align 0
--- /dev/null
+++ b/arch/arm/lib/exports_rpi.c
......
......@@ -96,7 +96,7 @@ Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
+whwave,sd3078 I2C bus SERIAL INTERFACE REAL-TIME CLOCK IC
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -625,6 +625,15 @@ config RTC_DRV_EM3027
@@ -626,6 +626,15 @@ config RTC_DRV_EM3027
This driver can also be built as a module. If so, the module
will be called rtc-em3027.
......
......@@ -10,7 +10,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.org>
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -224,6 +224,10 @@ static void xhci_pci_quirks(struct devic
@@ -225,6 +225,10 @@ static void xhci_pci_quirks(struct devic
pdev->device == 0x3432)
xhci->quirks |= XHCI_BROKEN_STREAMS;
......
......@@ -23,7 +23,7 @@ Signed-off-by: Jonathan Bell <jonathan@raspberrypi.org>
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -225,8 +225,10 @@ static void xhci_pci_quirks(struct devic
@@ -226,8 +226,10 @@ static void xhci_pci_quirks(struct devic
xhci->quirks |= XHCI_BROKEN_STREAMS;
if (pdev->vendor == PCI_VENDOR_ID_VIA &&
......
......@@ -33,7 +33,7 @@ Signed-off-by: Jonathan Bell <jonathan@raspberrypi.org>
#define USB_VENDOR_ID_BELKIN 0x050d
#define USB_DEVICE_ID_FLIP_KVM 0x3201
@@ -1196,6 +1199,9 @@
@@ -1197,6 +1200,9 @@
#define USB_VENDOR_ID_XAT 0x2505
#define USB_DEVICE_ID_XAT_CSR 0x0220
......
......@@ -124,7 +124,7 @@ Acked-by: Eric Anholt <eric@anholt.net>
pinctrl-0 = <&uart0_gpio14>;
--- a/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts
+++ b/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts
@@ -129,6 +129,13 @@
@@ -130,6 +130,13 @@
};
};
......
......@@ -18,9 +18,9 @@ Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
--- a/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts
+++ b/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts
@@ -119,6 +119,7 @@
#address-cells = <1>;
@@ -120,6 +120,7 @@
#size-cells = <0>;
pinctrl-names = "default";
pinctrl-0 = <&emmc_gpio34 &gpclk2_gpio43>;
+ bus-width = <4>;
mmc-pwrseq = <&wifi_pwrseq>;
......
......@@ -13,7 +13,7 @@ Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
@@ -1305,6 +1305,18 @@ static const struct flash_info *spi_nor_
@@ -1307,6 +1307,18 @@ static const struct flash_info *spi_nor_
}
dev_err(nor->dev, "unrecognized JEDEC id bytes: %02x, %02x, %02x\n",
id[0], id[1], id[2]);
......
......@@ -55,7 +55,7 @@ Cc: Kir Kolyshkin <kir@openvz.org>
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;
......
......@@ -30,7 +30,7 @@ Signed-off-by: Johan Hovold <johan@kernel.org>
--- 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) },
......
......@@ -27,7 +27,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@ -51,6 +51,7 @@
@@ -52,6 +52,7 @@
#include <linux/workqueue.h>
#include <net/genetlink.h>
#include <net/netlink.h>
......@@ -35,7 +35,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
#include <uapi/linux/batman_adv.h>
#include "bat_algo.h"
@@ -62,7 +63,6 @@
@@ -63,7 +64,6 @@
#include "netlink.h"
#include "network-coding.h"
#include "originator.h"
......@@ -45,7 +45,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
#include "translation-table.h"
--- a/net/batman-adv/bat_v.c
+++ b/net/batman-adv/bat_v.c
@@ -37,6 +37,7 @@
@@ -36,6 +36,7 @@
#include <linux/workqueue.h>
#include <net/genetlink.h>
#include <net/netlink.h>
......@@ -53,7 +53,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
#include <uapi/linux/batman_adv.h>
#include "bat_algo.h"
@@ -49,7 +50,6 @@
@@ -48,7 +49,6 @@
#include "log.h"
#include "netlink.h"
#include "originator.h"
......@@ -80,7 +80,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
--- a/net/batman-adv/bat_v_ogm.c
+++ b/net/batman-adv/bat_v_ogm.c
@@ -38,13 +38,13 @@
@@ -40,13 +40,13 @@
#include <linux/string.h>
#include <linux/types.h>
#include <linux/workqueue.h>
......@@ -174,7 +174,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
/**
--- a/net/batman-adv/hard-interface.c
+++ b/net/batman-adv/hard-interface.c
@@ -36,6 +36,7 @@
@@ -37,6 +37,7 @@
#include <linux/spinlock.h>
#include <net/net_namespace.h>
#include <net/rtnetlink.h>
......@@ -182,7 +182,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
#include "bat_v.h"
#include "bridge_loop_avoidance.h"
@@ -44,7 +45,6 @@
@@ -45,7 +46,6 @@
#include "gateway_client.h"
#include "log.h"
#include "originator.h"
......@@ -1025,7 +1025,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
--- a/net/batman-adv/types.h
+++ b/net/batman-adv/types.h
@@ -34,10 +34,9 @@
@@ -35,10 +35,9 @@
#include <linux/types.h>
#include <linux/wait.h>
#include <linux/workqueue.h>
......
......@@ -47,7 +47,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
};
--- 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);
......@@ -57,7 +57,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
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;
}
......@@ -76,7 +76,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
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++;
......
......@@ -21,7 +21,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
--- 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;
}
......@@ -40,7 +40,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
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++;
......
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;
}
......@@ -19,7 +19,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
--- a/drivers/tty/serial/8250/8250_exar.c
+++ b/drivers/tty/serial/8250/8250_exar.c
@@ -275,8 +275,32 @@ static int xr17v35x_register_gpio(struct
@@ -283,8 +283,32 @@ static int xr17v35x_register_gpio(struct
return 0;
}
......@@ -52,7 +52,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
};
static int iot2040_rs485_config(struct uart_port *port,
@@ -309,19 +333,7 @@ static int iot2040_rs485_config(struct u
@@ -317,19 +341,7 @@ static int iot2040_rs485_config(struct u
value |= mode;
writeb(value, p + UART_EXAR_MPIOLVL_7_0);
......
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
@@ -3291,6 +3291,10 @@ static void addrconf_dev_config(struct n
(dev->type != ARPHRD_NONE) &&
(dev->type != ARPHRD_RAWIP)) {
/* 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;
}
......@@ -17,7 +17,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -1777,6 +1777,19 @@ int phy_set_max_speed(struct phy_device
@@ -1781,6 +1781,19 @@ int phy_set_max_speed(struct phy_device
}
EXPORT_SYMBOL(phy_set_max_speed);
......@@ -39,7 +39,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
struct device_node *node = phydev->mdio.dev.of_node;
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -1049,6 +1049,7 @@ int phy_mii_ioctl(struct phy_device *phy
@@ -1051,6 +1051,7 @@ int phy_mii_ioctl(struct phy_device *phy
int phy_start_interrupts(struct phy_device *phydev);
void phy_print_status(struct phy_device *phydev);
int phy_set_max_speed(struct phy_device *phydev, u32 max_speed);
......
......@@ -17,7 +17,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -1790,6 +1790,36 @@ void phy_support_asym_pause(struct phy_d
@@ -1794,6 +1794,36 @@ void phy_support_asym_pause(struct phy_d
}
EXPORT_SYMBOL(phy_support_asym_pause);
......@@ -56,7 +56,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
struct device_node *node = phydev->mdio.dev.of_node;
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -1050,6 +1050,7 @@ int phy_start_interrupts(struct phy_devi
@@ -1052,6 +1052,7 @@ int phy_start_interrupts(struct phy_devi
void phy_print_status(struct phy_device *phydev);
int phy_set_max_speed(struct phy_device *phydev, u32 max_speed);
void phy_support_asym_pause(struct phy_device *phydev);
......
......@@ -29,7 +29,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -886,8 +886,6 @@ int phy_init_hw(struct phy_device *phyde
@@ -890,8 +890,6 @@ int phy_init_hw(struct phy_device *phyde
if (phydev->drv->soft_reset)
ret = phydev->drv->soft_reset(phydev);
......
......@@ -208,7 +208,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
return phydev->drv->read_page(phydev);
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -695,17 +695,6 @@ size_t phy_speeds(unsigned int *speeds,
@@ -697,17 +697,6 @@ size_t phy_speeds(unsigned int *speeds,
void phy_resolve_aneg_linkmode(struct phy_device *phydev);
/**
......@@ -226,7 +226,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
* phy_read - Convenience function for reading a given PHY register
* @phydev: the phy_device struct
* @regnum: register number to read
@@ -760,9 +749,60 @@ static inline int __phy_write(struct phy
@@ -762,9 +751,60 @@ static inline int __phy_write(struct phy
val);
}
......@@ -287,7 +287,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
/**
* __phy_set_bits - Convenience function for setting bits in a PHY register
* @phydev: the phy_device struct
@@ -813,6 +853,66 @@ static inline int phy_clear_bits(struct
@@ -815,6 +855,66 @@ static inline int phy_clear_bits(struct
}
/**
......@@ -354,7 +354,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
* phy_interrupt_is_valid - Convenience function for testing a given PHY irq
* @phydev: the phy_device struct
*
@@ -888,18 +988,6 @@ static inline bool phy_is_pseudo_fixed_l
@@ -890,18 +990,6 @@ static inline bool phy_is_pseudo_fixed_l
return phydev->is_pseudo_fixed_link;
}
......
......@@ -191,7 +191,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
}
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -795,13 +795,21 @@ int phy_write_mmd(struct phy_device *phy
@@ -797,13 +797,21 @@ int phy_write_mmd(struct phy_device *phy
*/
int __phy_write_mmd(struct phy_device *phydev, int devad, u32 regnum, u16 val);
......
......@@ -54,7 +54,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
*
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -1098,6 +1098,7 @@ int genphy_write_mmd_unsupported(struct
@@ -1100,6 +1100,7 @@ int genphy_write_mmd_unsupported(struct
/* Clause 45 PHY */
int genphy_c45_restart_aneg(struct phy_device *phydev);
......
......@@ -54,7 +54,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
#include <linux/mdio.h>
#include <linux/io.h>
#include <linux/uaccess.h>
@@ -944,6 +945,65 @@ void phy_attached_print(struct phy_devic
@@ -948,6 +949,65 @@ void phy_attached_print(struct phy_devic
EXPORT_SYMBOL(phy_attached_print);
/**
......@@ -120,7 +120,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
* phy_attach_direct - attach a network device to a given PHY device pointer
* @dev: network device to attach
* @phydev: Pointer to phy_device to attach
@@ -1016,6 +1076,9 @@ int phy_attach_direct(struct net_device
@@ -1020,6 +1080,9 @@ int phy_attach_direct(struct net_device
phydev->attached_dev = dev;
dev->phydev = phydev;
......@@ -130,7 +130,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
/* Some Ethernet drivers try to connect to a PHY device before
* calling register_netdevice() -> netdev_register_kobject() and
* does the dev->dev.kobj initialization. Here we only check for
@@ -1950,6 +2013,9 @@ static int phy_remove(struct device *dev
@@ -1954,6 +2017,9 @@ static int phy_remove(struct device *dev
phydev->state = PHY_DOWN;
mutex_unlock(&phydev->lock);
......@@ -151,7 +151,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
struct sk_buff;
/*
@@ -382,6 +384,8 @@ struct phy_c45_device_ids {
@@ -383,6 +385,8 @@ struct phy_c45_device_ids {
* irq: IRQ number of the PHY's interrupt (-1 if none)
* phy_timer: The timer for handling the state machine
* phy_queue: A work_queue for the phy_mac_interrupt
......@@ -160,7 +160,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
* attached_dev: The attached enet driver's device instance ptr
* adjust_link: Callback for the enet controller to respond to
* changes in the link state.
@@ -471,6 +475,9 @@ struct phy_device {
@@ -473,6 +477,9 @@ struct phy_device {
struct mutex lock;
......@@ -170,7 +170,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
struct phylink *phylink;
struct net_device *attached_dev;
@@ -1031,6 +1038,10 @@ int phy_suspend(struct phy_device *phyde
@@ -1033,6 +1040,10 @@ int phy_suspend(struct phy_device *phyde
int phy_resume(struct phy_device *phydev);
int __phy_resume(struct phy_device *phydev);
int phy_loopback(struct phy_device *phydev, bool enable);
......
......@@ -37,7 +37,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -335,7 +335,7 @@ static int phy_bus_match(struct device *
@@ -339,7 +339,7 @@ static int phy_bus_match(struct device *
if (phydev->is_c45) {
for (i = 1; i < num_ids; i++) {
......@@ -46,7 +46,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
continue;
if ((phydrv->phy_id & phydrv->phy_id_mask) ==
@@ -623,10 +623,13 @@ static int get_phy_id(struct mii_bus *bu
@@ -627,10 +627,13 @@ static int get_phy_id(struct mii_bus *bu
*/
struct phy_device *get_phy_device(struct mii_bus *bus, int addr, bool is_c45)
{
......
......@@ -803,7 +803,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -2702,11 +2702,9 @@ static int mvneta_poll(struct napi_struc
@@ -2701,11 +2701,9 @@ static int mvneta_poll(struct napi_struc
rx_done = mvneta_rx_swbm(pp, budget, &pp->rxqs[rx_queue]);
}
......
--- 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);
......@@ -15,7 +15,7 @@
--- 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;
......
......@@ -96,7 +96,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
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"
......
......@@ -232,7 +232,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
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)
{
......@@ -327,7 +327,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
--- 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)
{
......@@ -338,7 +338,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
--- 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)
{
......@@ -353,7 +353,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
&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:
......
......@@ -52,7 +52,7 @@
/* For layer 4 checksum field offset. */
#include <linux/tcp.h>
#include <linux/udp.h>
@@ -267,6 +268,7 @@ nf_flow_offload_ip_hook(void *priv, stru
@@ -268,6 +269,7 @@ nf_flow_offload_ip_hook(void *priv, stru
skb->dev = outdev;
nexthop = rt_nexthop(rt, flow->tuplehash[!dir].tuple.src_v4.s_addr);
skb_dst_set_noref(skb, &rt->dst);
......@@ -60,7 +60,7 @@
neigh_xmit(NEIGH_ARP_TABLE, outdev, &nexthop, skb);
return NF_STOLEN;
@@ -487,6 +489,7 @@ nf_flow_offload_ipv6_hook(void *priv, st
@@ -489,6 +491,7 @@ nf_flow_offload_ipv6_hook(void *priv, st
skb->dev = outdev;
nexthop = rt6_nexthop(rt, &flow->tuplehash[!dir].tuple.src_v6);
skb_dst_set_noref(skb, &rt->dst);
......
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -555,6 +555,12 @@ struct phy_driver {
@@ -557,6 +557,12 @@ struct phy_driver {
/* Determines the negotiated speed and duplex */
int (*read_status)(struct phy_device *phydev);
......@@ -15,7 +15,7 @@
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -1577,6 +1577,9 @@ int genphy_update_link(struct phy_device
@@ -1581,6 +1581,9 @@ int genphy_update_link(struct phy_device
{
int status;
......
......@@ -101,7 +101,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
help
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3253,10 +3253,20 @@ static int xmit_one(struct sk_buff *skb,
@@ -3255,10 +3255,20 @@ static int xmit_one(struct sk_buff *skb,
if (!list_empty(&ptype_all) || !list_empty(&dev->ptype_all))
dev_queue_xmit_nit(skb, dev);
......
......@@ -96,7 +96,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
u64 res;
--- a/net/ipv4/Kconfig
+++ b/net/ipv4/Kconfig
@@ -425,6 +425,7 @@ config INET_XFRM_MODE_BEET
@@ -426,6 +426,7 @@ config INET_XFRM_MODE_BEET
config INET_DIAG
tristate "INET: socket monitoring interface"
......
......@@ -232,7 +232,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
if (!pe)
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -2749,6 +2749,8 @@ static const struct seq_operations vmall
@@ -2752,6 +2752,8 @@ static const struct seq_operations vmall
static int __init proc_vmalloc_init(void)
{
......@@ -327,7 +327,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -3486,6 +3486,8 @@ static __net_initdata struct pernet_oper
@@ -3489,6 +3489,8 @@ static __net_initdata struct pernet_oper
static int __init proto_init(void)
{
......@@ -338,7 +338,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -2717,11 +2717,13 @@ static const struct seq_operations fib_r
@@ -2720,11 +2720,13 @@ static const struct seq_operations fib_r
int __net_init fib_proc_init(struct net *net)
{
......@@ -354,7 +354,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
fib_triestat_seq_show, NULL))
goto out2;
@@ -2732,17 +2734,21 @@ int __net_init fib_proc_init(struct net
@@ -2735,17 +2737,21 @@ int __net_init fib_proc_init(struct net
return 0;
out3:
......
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -495,6 +495,12 @@ struct phy_driver {
@@ -497,6 +497,12 @@ struct phy_driver {
/* Determines the negotiated speed and duplex */
int (*read_status)(struct phy_device *phydev);
......@@ -15,7 +15,7 @@
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -1316,6 +1316,9 @@ int genphy_update_link(struct phy_device
@@ -1320,6 +1320,9 @@ int genphy_update_link(struct phy_device
{
int status;
......
......@@ -50,7 +50,7 @@
phy_device_free(phydev);
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -870,6 +870,23 @@ void mdio_bus_exit(void);
@@ -872,6 +872,23 @@ void mdio_bus_exit(void);
extern struct bus_type mdio_bus_type;
......
......@@ -55,7 +55,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
--- a/net/ipv4/Kconfig
+++ b/net/ipv4/Kconfig
@@ -408,6 +408,7 @@ config INET_XFRM_MODE_BEET
@@ -409,6 +409,7 @@ config INET_XFRM_MODE_BEET
config INET_DIAG
tristate "INET: socket monitoring interface"
......
......@@ -233,7 +233,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
return -ENOMEM;
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -2727,6 +2727,8 @@ static const struct file_operations proc
@@ -2730,6 +2730,8 @@ static const struct file_operations proc
static int __init proc_vmalloc_init(void)
{
......@@ -339,7 +339,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -2677,10 +2677,12 @@ static const struct file_operations fib_
@@ -2680,10 +2680,12 @@ static const struct file_operations fib_
int __net_init fib_proc_init(struct net *net)
{
......@@ -354,7 +354,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
&fib_triestat_fops))
goto out2;
@@ -2690,17 +2692,21 @@ int __net_init fib_proc_init(struct net
@@ -2693,17 +2695,21 @@ int __net_init fib_proc_init(struct net
return 0;
out3:
......
......@@ -71,7 +71,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
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);
......@@ -87,7 +87,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
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;
......@@ -95,7 +95,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
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;
}
......@@ -112,7 +112,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
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;
......@@ -128,7 +128,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
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;
......
......@@ -66,7 +66,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
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",
......@@ -181,7 +181,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
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;
......@@ -191,7 +191,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
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);
......@@ -200,7 +200,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
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);
......@@ -208,7 +208,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
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);
......@@ -226,7 +226,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
#endif
net->ipv6.sysctl.flush_delay = 0;
@@ -4077,6 +4128,8 @@ out:
@@ -4078,6 +4129,8 @@ out:
return ret;
#ifdef CONFIG_IPV6_MULTIPLE_TABLES
......@@ -235,7 +235,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
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);
......@@ -243,7 +243,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
#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);
......
......@@ -11,7 +11,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
--- 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;
......@@ -23,7 +23,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
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);
......
......@@ -71,7 +71,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
if (!net_eq(dev_net(dev), sock_net(sk)))
goto drop;
@@ -2174,12 +2176,12 @@ static int tpacket_rcv(struct sk_buff *s
@@ -2175,12 +2177,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);
......@@ -87,7 +87,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
if (!net_eq(dev_net(dev), sock_net(sk)))
goto drop;
@@ -3265,6 +3267,7 @@ static int packet_create(struct net *net
@@ -3277,6 +3279,7 @@ static int packet_create(struct net *net
mutex_init(&po->pg_vec_lock);
po->rollover = NULL;
po->prot_hook.func = packet_rcv;
......@@ -95,7 +95,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
if (sock->type == SOCK_PACKET)
po->prot_hook.func = packet_rcv_spkt;
@@ -3885,6 +3888,16 @@ packet_setsockopt(struct socket *sock, i
@@ -3897,6 +3900,16 @@ packet_setsockopt(struct socket *sock, i
po->xmit = val ? packet_direct_xmit : dev_queue_xmit;
return 0;
}
......@@ -112,7 +112,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
default:
return -ENOPROTOOPT;
}
@@ -3937,6 +3950,13 @@ static int packet_getsockopt(struct sock
@@ -3949,6 +3962,13 @@ static int packet_getsockopt(struct sock
case PACKET_VNET_HDR:
val = po->has_vnet_hdr;
break;
......@@ -128,7 +128,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
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;
......
......@@ -66,7 +66,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
static void rt_fibinfo_free(struct rtable __rcu **rtp)
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -2474,6 +2474,7 @@ static const char *const rtn_type_names[
@@ -2477,6 +2477,7 @@ static const char *const rtn_type_names[
[RTN_THROW] = "THROW",
[RTN_NAT] = "NAT",
[RTN_XRESOLVE] = "XRESOLVE",
......
......@@ -32,7 +32,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
__u16 tc_index; /* traffic control index */
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -5454,6 +5454,9 @@ static enum gro_result dev_gro_receive(s
@@ -5456,6 +5456,9 @@ static enum gro_result dev_gro_receive(s
int same_flow;
int grow;
......@@ -42,7 +42,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
if (netif_elide_gro(skb->dev))
goto normal;
@@ -7112,6 +7115,48 @@ static void __netdev_adjacent_dev_unlink
@@ -7114,6 +7117,48 @@ static void __netdev_adjacent_dev_unlink
&upper_dev->adj_list.lower);
}
......@@ -91,7 +91,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
static int __netdev_upper_dev_link(struct net_device *dev,
struct net_device *upper_dev, bool master,
void *upper_priv, void *upper_info,
@@ -7162,6 +7207,7 @@ static int __netdev_upper_dev_link(struc
@@ -7164,6 +7209,7 @@ static int __netdev_upper_dev_link(struc
if (ret)
return ret;
......@@ -99,7 +99,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
ret = call_netdevice_notifiers_info(NETDEV_CHANGEUPPER,
&changeupper_info.info);
ret = notifier_to_errno(ret);
@@ -7254,6 +7300,7 @@ void netdev_upper_dev_unlink(struct net_
@@ -7256,6 +7302,7 @@ void netdev_upper_dev_unlink(struct net_
__netdev_adjacent_dev_unlink_neighbour(dev, upper_dev);
......@@ -107,7 +107,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
call_netdevice_notifiers_info(NETDEV_CHANGEUPPER,
&changeupper_info.info);
@@ -7893,6 +7940,7 @@ int dev_set_mac_address(struct net_devic
@@ -7895,6 +7942,7 @@ int dev_set_mac_address(struct net_devic
if (err)
return err;
dev->addr_assign_type = NET_ADDR_SET;
......
......@@ -11,7 +11,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -1201,6 +1201,9 @@ void phy_detach(struct phy_device *phyde
@@ -1205,6 +1205,9 @@ void phy_detach(struct phy_device *phyde
struct module *ndev_owner = dev->dev.parent->driver->owner;
struct mii_bus *bus;
......@@ -23,7 +23,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
sysfs_remove_link(&phydev->mdio.dev.kobj, "attached_dev");
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -567,6 +567,12 @@ struct phy_driver {
@@ -569,6 +569,12 @@ struct phy_driver {
*/
int (*did_interrupt)(struct phy_device *phydev);
......
......@@ -66,7 +66,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
static void rt_fibinfo_free(struct rtable __rcu **rtp)
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -2406,6 +2406,7 @@ static const char *const rtn_type_names[
@@ -2409,6 +2409,7 @@ static const char *const rtn_type_names[
[RTN_THROW] = "THROW",
[RTN_NAT] = "NAT",
[RTN_XRESOLVE] = "XRESOLVE",
......@@ -181,7 +181,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
cfg->fc_flags |= RTF_REJECT;
if (rtm->rtm_type == RTN_LOCAL)
@@ -3222,6 +3256,9 @@ static int rt6_fill_node(struct net *net
@@ -3223,6 +3257,9 @@ static int rt6_fill_node(struct net *net
case -EACCES:
rtm->rtm_type = RTN_PROHIBIT;
break;
......@@ -191,7 +191,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
case -EAGAIN:
rtm->rtm_type = RTN_THROW;
break;
@@ -3498,6 +3535,8 @@ static int ip6_route_dev_notify(struct n
@@ -3499,6 +3536,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);
......@@ -200,7 +200,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
net->ipv6.ip6_blk_hole_entry->dst.dev = dev;
net->ipv6.ip6_blk_hole_entry->rt6i_idev = in6_dev_get(dev);
#endif
@@ -3509,6 +3548,7 @@ static int ip6_route_dev_notify(struct n
@@ -3510,6 +3549,7 @@ static int ip6_route_dev_notify(struct n
in6_dev_put(net->ipv6.ip6_null_entry->rt6i_idev);
#ifdef CONFIG_IPV6_MULTIPLE_TABLES
in6_dev_put(net->ipv6.ip6_prohibit_entry->rt6i_idev);
......@@ -208,7 +208,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
in6_dev_put(net->ipv6.ip6_blk_hole_entry->rt6i_idev);
#endif
}
@@ -3724,6 +3764,17 @@ static int __net_init ip6_route_net_init
@@ -3725,6 +3765,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);
......@@ -226,7 +226,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
#endif
net->ipv6.sysctl.flush_delay = 0;
@@ -3742,6 +3793,8 @@ out:
@@ -3743,6 +3794,8 @@ out:
return ret;
#ifdef CONFIG_IPV6_MULTIPLE_TABLES
......@@ -235,7 +235,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
out_ip6_prohibit_entry:
kfree(net->ipv6.ip6_prohibit_entry);
out_ip6_null_entry:
@@ -3759,6 +3812,7 @@ static void __net_exit ip6_route_net_exi
@@ -3760,6 +3813,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);
......@@ -243,7 +243,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
#endif
dst_entries_destroy(&net->ipv6.ip6_dst_ops);
}
@@ -3832,6 +3886,9 @@ void __init ip6_route_init_special_entri
@@ -3833,6 +3887,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);
......
......@@ -62,7 +62,7 @@ Signed-off-by: John Crispin <john@phrozen.org>
* @phydev: the phy_device struct
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -827,6 +827,7 @@ int phy_ethtool_ksettings_get(struct phy
@@ -829,6 +829,7 @@ int phy_ethtool_ksettings_get(struct phy
struct ethtool_link_ksettings *cmd);
int phy_ethtool_ksettings_set(struct phy_device *phydev,
const struct ethtool_link_ksettings *cmd);
......
......@@ -11,7 +11,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -1005,6 +1005,9 @@ void phy_detach(struct phy_device *phyde
@@ -1009,6 +1009,9 @@ void phy_detach(struct phy_device *phyde
struct mii_bus *bus;
int i;
......@@ -23,7 +23,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
phy_suspend(phydev);
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -507,6 +507,12 @@ struct phy_driver {
@@ -509,6 +509,12 @@ struct phy_driver {
*/
int (*did_interrupt)(struct phy_device *phydev);
......
CONFIG_AHCI_IPQ=y
CONFIG_ALIGNMENT_TRAP=y
# CONFIG_APQ_GCC_8084 is not set
# CONFIG_APQ_MMCC_8084 is not set
......
From c5ea64dcf7b5d45e402e78b9f291d521669b7b80 Mon Sep 17 00:00:00 2001
From: Kumar Gala <galak@codeaurora.org>
Date: Fri, 30 May 2014 15:35:40 -0500
Subject: [PATCH] ata: Add Qualcomm ARM SoC AHCI SATA host controller driver
Add support for the Qualcomm AHCI SATA controller that exists on several
SoC and specifically the IPQ806x family of chips. The IPQ806x SATA support
requires the associated IPQ806x SATA PHY Driver to be enabled as well.
Signed-off-by: Kumar Gala <galak@codeaurora.org>
Signed-off-by: Gokul Sriram Palanisamy <gpalan@codeaurora.org>
---
drivers/ata/ahci.h | 2 +-
drivers/ata/ahci_ipq.c | 248 ++++++++++++++++++++++++++++++++++++++
drivers/ata/Kconfig | 8 ++++++++
drivers/ata/Makefile | 1 +
4 files changed, 258 insertions(+), 1 deletions(-)
create mode 100644 drivers/ata/ahci_ipq.c
--- a/drivers/ata/ahci.h
+++ b/drivers/ata/ahci.h
@@ -54,7 +54,7 @@
enum {
AHCI_MAX_PORTS = 32,
- AHCI_MAX_CLKS = 5,
+ AHCI_MAX_CLKS = 6,
AHCI_MAX_SG = 168, /* hardware max is 64K */
AHCI_DMA_BOUNDARY = 0xffffffff,
AHCI_MAX_CMDS = 32,
--- a/dev/null
+++ b/drivers/ata/ahci_ipq.c
@@ -0,0 +1,248 @@
+/* Copyright (c) 2015 - 2017, The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/pm.h>
+#include <linux/device.h>
+#include <linux/of_device.h>
+#include <linux/platform_device.h>
+#include <linux/libata.h>
+#include <linux/ahci_platform.h>
+#include <linux/acpi.h>
+#include <linux/pci_ids.h>
+#include "libata.h"
+#include "ahci.h"
+
+#define IPQ_DRV_NAME "ahci-ipq"
+
+struct ipq_ahci_priv {
+ struct platform_device *ahci_pdev;
+ struct ahci_host_priv *hpriv;
+ void *preg_reset;
+ int pstate;
+};
+
+struct ipq_ahci_priv *ipqpriv;
+
+static const struct ata_port_info ipq_ahci_port_info = {
+ .flags = AHCI_FLAG_COMMON,
+ .pio_mask = ATA_PIO4,
+ .udma_mask = ATA_UDMA6,
+ .port_ops = &ahci_platform_ops,
+};
+
+static struct scsi_host_template ahci_platform_sht = {
+ AHCI_SHT(IPQ_DRV_NAME),
+};
+
+#define SATA_PWR_STATE_DOWN 0x1
+#define SATA_PWR_STATE_UP 0x2
+#define SATA_RESET 0x00902c1c
+
+static void ipq_ahci_hard_reset(struct device *dev)
+{
+ u32 reg;
+
+ reg = readl_relaxed(ipqpriv->preg_reset);
+ writel_relaxed(reg | BIT(0), ipqpriv->preg_reset);
+ /* To make sure the write is complete before we move on */
+ mb();
+
+ reg = readl_relaxed(ipqpriv->preg_reset);
+ writel_relaxed(reg & (~BIT(0)), ipqpriv->preg_reset);
+ /* To make sure the write is complete before we move on */
+ mb();
+}
+
+static int ipq_ahci_suspend(struct device *dev)
+{
+ struct ata_host *host = dev_get_drvdata(dev);
+ struct device_type *apt = &ata_port_type;
+ const struct dev_pm_ops *pm = apt->pm;
+ struct ata_port *ap;
+ int ret = 0, i;
+
+ if (ipqpriv->pstate == SATA_PWR_STATE_UP) {
+ for (i = 0; i < host->n_ports; i++) {
+ ap = host->ports[i];
+ /* Issue Port PM Suspend */
+ ret = pm->runtime_suspend(&ap->tdev);
+ if (ret) {
+ dev_err(dev, "SATA controller port suspend failed\n");
+ return ret;
+ }
+ }
+
+ /* Issue Contoller PM Suspend */
+ ret = ahci_platform_suspend_host(dev);
+ if (ret) {
+ dev_err(dev, "SATA controller host suspend failed\n");
+ return ret;
+ }
+
+ for (i = 0; i < ipqpriv->hpriv->nports; i++) {
+ if (!ipqpriv->hpriv->phys[i])
+ continue;
+
+ phy_power_off(ipqpriv->hpriv->phys[i]);
+ phy_exit(ipqpriv->hpriv->phys[i]);
+ }
+
+ ahci_platform_disable_clks(ipqpriv->hpriv);
+ ipqpriv->pstate = SATA_PWR_STATE_DOWN;
+ } else {
+ dev_warn(dev, "SATA device already in suspended state");
+ }
+
+ return ret;
+}
+
+static int ipq_ahci_resume(struct device *dev)
+{
+ struct ata_host *host = dev_get_drvdata(dev);
+ struct device_type *apt = &ata_port_type;
+ const struct dev_pm_ops *pm = apt->pm;
+ struct ata_port *ap;
+ int ret = 0, i;
+
+ if (ipqpriv->pstate == SATA_PWR_STATE_DOWN) {
+
+ ahci_platform_enable_clks(ipqpriv->hpriv);
+
+ /* Issue SATA clock hard reset */
+ ipq_ahci_hard_reset(dev);
+
+ for (i = 0; i < ipqpriv->hpriv->nports; i++) {
+ if (!ipqpriv->hpriv->phys[i])
+ continue;
+
+ phy_init(ipqpriv->hpriv->phys[i]);
+ phy_power_on(ipqpriv->hpriv->phys[i]);
+ }
+
+ /* Issue Contoller PM Resume */
+ ret = ahci_platform_resume_host(dev);
+ if (ret) {
+ dev_err(dev, "SATA controller resume failed\n");
+ return ret;
+ }
+
+ for (i = 0; i < host->n_ports; i++) {
+ /* Issue Port PM Resume */
+ ap = host->ports[i];
+ ret = pm->runtime_resume(&ap->tdev);
+ if (ret) {
+ dev_err(dev, "SATA controller port resume failed\n");
+ return ret;
+ }
+ }
+ ipqpriv->pstate = SATA_PWR_STATE_UP;
+ } else {
+ dev_warn(dev, "SATA device already in resume state");
+ }
+
+ return ret;
+}
+
+static int ipq_ahci_probe(struct platform_device *pdev)
+{
+ struct device *dev = &pdev->dev;
+ struct ahci_host_priv *hpriv;
+ int rc;
+
+ hpriv = ahci_platform_get_resources(pdev);
+ if (IS_ERR(hpriv))
+ return PTR_ERR(hpriv);
+
+ rc = ahci_platform_enable_resources(hpriv);
+ if (rc)
+ return rc;
+
+ of_property_read_u32(dev->of_node,
+ "ports-implemented", &hpriv->force_port_map);
+
+ rc = ahci_platform_init_host(pdev, hpriv, &ipq_ahci_port_info,
+ &ahci_platform_sht);
+
+ if (rc)
+ goto disable_resources;
+
+ ipqpriv = devm_kzalloc(dev, sizeof(*ipqpriv), GFP_KERNEL);
+ if (!ipqpriv) {
+ dev_err(dev, "can't alloc ahci_host_priv\n");
+ rc = -ENOMEM;
+ goto disable_resources;
+ }
+
+ ipqpriv->ahci_pdev = pdev;
+ ipqpriv->hpriv = hpriv;
+ ipqpriv->pstate = SATA_PWR_STATE_UP;
+
+ ipqpriv->preg_reset = devm_ioremap(dev, SATA_RESET,
+ sizeof(*(ipqpriv->preg_reset)));
+
+ if (IS_ERR(ipqpriv->preg_reset)) {
+ dev_err(dev, "can't ioremap for preg_reset\n");
+ rc = -ENOMEM;
+ goto disable_resources;
+ }
+
+ return 0;
+
+ disable_resources:
+ ahci_platform_disable_resources(hpriv);
+ return rc;
+}
+
+int ipq_ahci_remove(struct platform_device *pdev)
+{
+ ata_platform_remove_one(pdev);
+ return 0;
+}
+
+static SIMPLE_DEV_PM_OPS(ipq_ahci_pm_ops, ahci_platform_suspend,
+ ahci_platform_resume);
+
+static const struct of_device_id ipq_ahci_of_match[] = {
+ { .compatible = "qcom,ipq806x-ahci", },
+ {},
+};
+
+MODULE_DEVICE_TABLE(of, ipq_ahci_of_match);
+
+static const struct acpi_device_id ahci_acpi_match[] = {
+ { ACPI_DEVICE_CLASS(PCI_CLASS_STORAGE_SATA_AHCI, 0xffffff) },
+ {},
+};
+
+MODULE_DEVICE_TABLE(acpi, ahci_acpi_match);
+
+static struct platform_driver ipq_ahci_driver = {
+ .probe = ipq_ahci_probe,
+ .remove = ipq_ahci_remove,
+ .driver = {
+ .name = IPQ_DRV_NAME,
+ .of_match_table = ipq_ahci_of_match,
+ .acpi_match_table = ahci_acpi_match,
+ .pm = &ipq_ahci_pm_ops,
+ },
+};
+
+module_platform_driver(ipq_ahci_driver);
+
+MODULE_DESCRIPTION("IPQ806x AHCI SATA platform driver");
+MODULE_ALIAS("platform:ahci-ipq");
+MODULE_LICENSE("Dual BSD/GPL");
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -162,6 +162,14 @@ config AHCI_IMX
If unsure, say N.
+config AHCI_IPQ
+ tristate "Qualcomm Atheros IPQ806X AHCI SATA support"
+ help
+ This option enables support for the IPQ806X SoC's
+ onboard AHCI SATA.
+
+ If unsure, say N.
+
config AHCI_CEVA
tristate "CEVA AHCI SATA support"
depends on OF
--- a/drivers/ata/Makefile
+++ b/drivers/ata/Makefile
@@ -18,6 +18,7 @@
obj-$(CONFIG_AHCI_DA850) += ahci_da850.o libahci.o libahci_platform.o
obj-$(CONFIG_AHCI_DM816) += ahci_dm816.o libahci.o libahci_platform.o
obj-$(CONFIG_AHCI_IMX) += ahci_imx.o libahci.o libahci_platform.o
+obj-$(CONFIG_AHCI_IPQ) += ahci_ipq.o libahci.o libahci_platform.o
obj-$(CONFIG_AHCI_MTK) += ahci_mtk.o libahci.o libahci_platform.o
obj-$(CONFIG_AHCI_MVEBU) += ahci_mvebu.o libahci.o libahci_platform.o
obj-$(CONFIG_AHCI_OCTEON) += ahci_octeon.o
--- a/drivers/tty/serial/8250/8250_core.c
+++ b/drivers/tty/serial/8250/8250_core.c
@@ -833,6 +833,7 @@ static int serial8250_probe(struct platf
@@ -832,6 +832,7 @@ static int serial8250_probe(struct platf
uart.port.get_mctrl = p->get_mctrl;
uart.port.pm = p->pm;
uart.port.dev = &dev->dev;
......@@ -8,7 +8,7 @@
uart.port.irqflags |= irqflag;
ret = serial8250_register_8250_port(&uart);
if (ret < 0) {
@@ -989,6 +990,7 @@ int serial8250_register_8250_port(struct
@@ -988,6 +989,7 @@ int serial8250_register_8250_port(struct
uart->bugs = up->bugs;
uart->port.mapbase = up->port.mapbase;
uart->port.mapsize = up->port.mapsize;
......@@ -105,7 +105,7 @@
case UPIO_AU:
p->serial_out(p, offset, value);
p->serial_in(p, UART_LCR); /* safe, no side-effects */
@@ -2759,6 +2779,7 @@ static int serial8250_request_std_resour
@@ -2763,6 +2783,7 @@ static int serial8250_request_std_resour
case UPIO_MEM32BE:
case UPIO_MEM16:
case UPIO_MEM:
......@@ -113,7 +113,7 @@
if (!port->mapbase)
break;
@@ -2797,6 +2818,7 @@ static void serial8250_release_std_resou
@@ -2801,6 +2822,7 @@ static void serial8250_release_std_resou
case UPIO_MEM32BE:
case UPIO_MEM16:
case UPIO_MEM:
......
......@@ -1304,7 +1304,7 @@ Signed-off-by: Zhao Qiang <qiang.zhao@nxp.com>
}
static const struct net_device_ops dpaa_ops = {
@@ -2654,7 +2936,6 @@ static inline u16 dpaa_get_headroom(stru
@@ -2652,7 +2934,6 @@ static inline u16 dpaa_get_headroom(stru
static int dpaa_eth_probe(struct platform_device *pdev)
{
struct dpaa_bp *dpaa_bps[DPAA_BPS_NUM] = {NULL};
......@@ -1312,7 +1312,7 @@ Signed-off-by: Zhao Qiang <qiang.zhao@nxp.com>
struct net_device *net_dev = NULL;
struct dpaa_fq *dpaa_fq, *tmp;
struct dpaa_priv *priv = NULL;
@@ -2663,7 +2944,51 @@ static int dpaa_eth_probe(struct platfor
@@ -2661,7 +2942,51 @@ static int dpaa_eth_probe(struct platfor
int err = 0, i, channel;
struct device *dev;
......@@ -1365,7 +1365,7 @@ Signed-off-by: Zhao Qiang <qiang.zhao@nxp.com>
/* Allocate this early, so we can store relevant information in
* the private area
@@ -2671,7 +2996,7 @@ static int dpaa_eth_probe(struct platfor
@@ -2669,7 +2994,7 @@ static int dpaa_eth_probe(struct platfor
net_dev = alloc_etherdev_mq(sizeof(*priv), DPAA_ETH_TXQ_NUM);
if (!net_dev) {
dev_err(dev, "alloc_etherdev_mq() failed\n");
......@@ -1374,7 +1374,7 @@ Signed-off-by: Zhao Qiang <qiang.zhao@nxp.com>
}
/* Do this here, so we can be verbose early */
@@ -2683,13 +3008,6 @@ static int dpaa_eth_probe(struct platfor
@@ -2681,13 +3006,6 @@ static int dpaa_eth_probe(struct platfor
priv->msg_enable = netif_msg_init(debug, DPAA_MSG_DEFAULT);
......@@ -1388,7 +1388,7 @@ Signed-off-by: Zhao Qiang <qiang.zhao@nxp.com>
/* If fsl_fm_max_frm is set to a higher value than the all-common 1500,
* we choose conservatively and let the user explicitly set a higher
* MTU via ifconfig. Otherwise, the user may end up with different MTUs
@@ -2705,21 +3023,13 @@ static int dpaa_eth_probe(struct platfor
@@ -2703,21 +3021,13 @@ static int dpaa_eth_probe(struct platfor
priv->buf_layout[RX].priv_data_size = DPAA_RX_PRIV_DATA_SIZE; /* Rx */
priv->buf_layout[TX].priv_data_size = DPAA_TX_PRIV_DATA_SIZE; /* Tx */
......@@ -1414,7 +1414,7 @@ Signed-off-by: Zhao Qiang <qiang.zhao@nxp.com>
/* the raw size of the buffers used for reception */
dpaa_bps[i]->raw_size = bpool_buffer_raw_size(i, DPAA_BPS_NUM);
/* avoid runtime computations by keeping the usable size here */
@@ -2727,11 +3037,8 @@ static int dpaa_eth_probe(struct platfor
@@ -2725,11 +3035,8 @@ static int dpaa_eth_probe(struct platfor
dpaa_bps[i]->dev = dev;
err = dpaa_bp_alloc_pool(dpaa_bps[i]);
......@@ -1428,7 +1428,7 @@ Signed-off-by: Zhao Qiang <qiang.zhao@nxp.com>
priv->dpaa_bps[i] = dpaa_bps[i];
}
@@ -2742,7 +3049,7 @@ static int dpaa_eth_probe(struct platfor
@@ -2740,7 +3047,7 @@ static int dpaa_eth_probe(struct platfor
err = dpaa_alloc_all_fqs(dev, &priv->dpaa_fq_list, &port_fqs);
if (err < 0) {
dev_err(dev, "dpaa_alloc_all_fqs() failed\n");
......@@ -1437,7 +1437,7 @@ Signed-off-by: Zhao Qiang <qiang.zhao@nxp.com>
}
priv->mac_dev = mac_dev;
@@ -2751,12 +3058,12 @@ static int dpaa_eth_probe(struct platfor
@@ -2749,12 +3056,12 @@ static int dpaa_eth_probe(struct platfor
if (channel < 0) {
dev_err(dev, "dpaa_get_channel() failed\n");
err = channel;
......@@ -1452,7 +1452,7 @@ Signed-off-by: Zhao Qiang <qiang.zhao@nxp.com>
* and add this pool channel to each's dequeue mask.
*/
dpaa_eth_add_channel(priv->channel);
@@ -2771,20 +3078,20 @@ static int dpaa_eth_probe(struct platfor
@@ -2769,20 +3076,20 @@ static int dpaa_eth_probe(struct platfor
err = dpaa_eth_cgr_init(priv);
if (err < 0) {
dev_err(dev, "Error initializing CGR\n");
......@@ -1476,7 +1476,7 @@ Signed-off-by: Zhao Qiang <qiang.zhao@nxp.com>
}
priv->tx_headroom = dpaa_get_headroom(&priv->buf_layout[TX]);
@@ -2794,7 +3101,7 @@ static int dpaa_eth_probe(struct platfor
@@ -2792,7 +3099,7 @@ static int dpaa_eth_probe(struct platfor
err = dpaa_eth_init_ports(mac_dev, dpaa_bps, DPAA_BPS_NUM, &port_fqs,
&priv->buf_layout[0], dev);
if (err)
......@@ -1485,7 +1485,7 @@ Signed-off-by: Zhao Qiang <qiang.zhao@nxp.com>
/* Rx traffic distribution based on keygen hashing defaults to on */
priv->keygen_in_use = true;
@@ -2803,11 +3110,7 @@ static int dpaa_eth_probe(struct platfor
@@ -2801,11 +3108,7 @@ static int dpaa_eth_probe(struct platfor
if (!priv->percpu_priv) {
dev_err(dev, "devm_alloc_percpu() failed\n");
err = -ENOMEM;
......@@ -1498,7 +1498,7 @@ Signed-off-by: Zhao Qiang <qiang.zhao@nxp.com>
}
priv->num_tc = 1;
@@ -2816,11 +3119,11 @@ static int dpaa_eth_probe(struct platfor
@@ -2814,11 +3117,11 @@ static int dpaa_eth_probe(struct platfor
/* Initialize NAPI */
err = dpaa_napi_add(net_dev);
if (err < 0)
......@@ -1512,7 +1512,7 @@ Signed-off-by: Zhao Qiang <qiang.zhao@nxp.com>
dpaa_eth_sysfs_init(&net_dev->dev);
@@ -2829,32 +3132,21 @@ static int dpaa_eth_probe(struct platfor
@@ -2827,32 +3130,21 @@ static int dpaa_eth_probe(struct platfor
return 0;
......@@ -1551,7 +1551,7 @@ Signed-off-by: Zhao Qiang <qiang.zhao@nxp.com>
return err;
}
@@ -2891,6 +3183,23 @@ static int dpaa_remove(struct platform_d
@@ -2889,6 +3181,23 @@ static int dpaa_remove(struct platform_d
return err;
}
......@@ -1575,7 +1575,7 @@ Signed-off-by: Zhao Qiang <qiang.zhao@nxp.com>
static const struct platform_device_id dpaa_devtype[] = {
{
.name = "dpaa-ethernet",
@@ -2915,6 +3224,10 @@ static int __init dpaa_load(void)
@@ -2913,6 +3222,10 @@ static int __init dpaa_load(void)
pr_debug("FSL DPAA Ethernet driver\n");
......@@ -1698,7 +1698,7 @@ Signed-off-by: Zhao Qiang <qiang.zhao@nxp.com>
+fsl_dpaa_mac-objs:= mac.o fman_dtsec.o fman_memac.o fman_tgec.o
--- a/drivers/net/ethernet/freescale/fman/fman.c
+++ b/drivers/net/ethernet/freescale/fman/fman.c
@@ -629,6 +629,7 @@ static void set_port_order_restoration(s
@@ -634,6 +634,7 @@ static void set_port_order_restoration(s
iowrite32be(tmp, &fpm_rg->fmfp_prc);
}
......@@ -1706,7 +1706,7 @@ Signed-off-by: Zhao Qiang <qiang.zhao@nxp.com>
static void set_port_liodn(struct fman *fman, u8 port_id,
u32 liodn_base, u32 liodn_ofst)
{
@@ -646,6 +647,27 @@ static void set_port_liodn(struct fman *
@@ -651,6 +652,27 @@ static void set_port_liodn(struct fman *
iowrite32be(tmp, &fman->dma_regs->fmdmplr[port_id / 2]);
iowrite32be(liodn_ofst, &fman->bmi_regs->fmbm_spliodn[port_id - 1]);
}
......@@ -1734,7 +1734,7 @@ Signed-off-by: Zhao Qiang <qiang.zhao@nxp.com>
static void enable_rams_ecc(struct fman_fpm_regs __iomem *fpm_rg)
{
@@ -1914,7 +1936,10 @@ _return:
@@ -1919,7 +1941,10 @@ _return:
static int fman_init(struct fman *fman)
{
struct fman_cfg *cfg = NULL;
......@@ -1746,7 +1746,7 @@ Signed-off-by: Zhao Qiang <qiang.zhao@nxp.com>
if (is_init_done(fman->cfg))
return -EINVAL;
@@ -1934,6 +1959,7 @@ static int fman_init(struct fman *fman)
@@ -1939,6 +1964,7 @@ static int fman_init(struct fman *fman)
memset_io((void __iomem *)(fman->base_addr + CGP_OFFSET), 0,
fman->state->fm_port_num_of_cg);
......@@ -1754,7 +1754,7 @@ Signed-off-by: Zhao Qiang <qiang.zhao@nxp.com>
/* Save LIODN info before FMan reset
* Skipping non-existent port 0 (i = 1)
*/
@@ -1953,6 +1979,9 @@ static int fman_init(struct fman *fman)
@@ -1958,6 +1984,9 @@ static int fman_init(struct fman *fman)
}
fman->liodn_base[i] = liodn_base;
}
......@@ -1764,7 +1764,7 @@ Signed-off-by: Zhao Qiang <qiang.zhao@nxp.com>
err = fman_reset(fman);
if (err)
@@ -2181,8 +2210,12 @@ int fman_set_port_params(struct fman *fm
@@ -2186,8 +2215,12 @@ int fman_set_port_params(struct fman *fm
if (err)
goto return_err;
......@@ -1777,7 +1777,7 @@ Signed-off-by: Zhao Qiang <qiang.zhao@nxp.com>
if (fman->state->rev_info.major < 6)
set_port_order_restoration(fman->fpm_regs, port_id);
@@ -2800,7 +2833,8 @@ static struct fman *read_dts_node(struct
@@ -2813,7 +2846,8 @@ static struct fman *read_dts_node(struct
of_node_put(muram_node);
......@@ -1789,7 +1789,7 @@ Signed-off-by: Zhao Qiang <qiang.zhao@nxp.com>
__func__, irq, err);
--- a/drivers/net/ethernet/freescale/fman/fman.h
+++ b/drivers/net/ethernet/freescale/fman/fman.h
@@ -41,6 +41,7 @@
@@ -42,6 +42,7 @@
/* Frame queue Context Override */
#define FM_FD_CMD_FCO 0x80000000
#define FM_FD_CMD_RPD 0x40000000 /* Read Prepended Data */
......@@ -1797,7 +1797,7 @@ Signed-off-by: Zhao Qiang <qiang.zhao@nxp.com>
#define FM_FD_CMD_DTC 0x10000000 /* Do L4 Checksum */
/* TX-Port: Unsupported Format */
@@ -345,8 +346,12 @@ struct fman {
@@ -346,8 +347,12 @@ struct fman {
unsigned long fifo_offset;
size_t fifo_size;
......@@ -65,7 +65,7 @@ Signed-off-by: Biwen Li <biwen.li@nxp.com>
+};
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -433,6 +433,14 @@ config RTC_DRV_PCF85063
@@ -434,6 +434,14 @@ config RTC_DRV_PCF85063
This driver can also be built as a module. If so, the module
will be called rtc-pcf85063.
......
......@@ -536,7 +536,7 @@ Signed-off-by: Zhao Chenhui <chenhui.zhao@freescale.com>
irq = dwc3_gadget_get_irq(dwc);
if (irq < 0) {
@@ -3299,6 +3300,12 @@ int dwc3_gadget_init(struct dwc3 *dwc)
@@ -3298,6 +3299,12 @@ int dwc3_gadget_init(struct dwc3 *dwc)
dwc3_gadget_set_speed(&dwc->gadget, dwc->maximum_speed);
......@@ -1289,7 +1289,7 @@ Signed-off-by: Zhao Chenhui <chenhui.zhao@freescale.com>
xhci->quirks |= XHCI_BROKEN_PORT_PED;
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -1972,10 +1972,12 @@ static int finish_td(struct xhci_hcd *xh
@@ -1978,10 +1978,12 @@ static int finish_td(struct xhci_hcd *xh
union xhci_trb *ep_trb, struct xhci_transfer_event *event,
struct xhci_virt_ep *ep, int *status)
{
......@@ -1302,7 +1302,7 @@ Signed-off-by: Zhao Chenhui <chenhui.zhao@freescale.com>
u32 trb_comp_code;
int ep_index;
@@ -1998,14 +2000,30 @@ static int finish_td(struct xhci_hcd *xh
@@ -2004,14 +2006,30 @@ static int finish_td(struct xhci_hcd *xh
if (trb_comp_code == COMP_STALL_ERROR ||
xhci_requires_manual_halt_cleanup(xhci, ep_ctx,
trb_comp_code)) {
......
......@@ -610,7 +610,7 @@ Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
int err;
- int irq = 0;
int id;
char name[20];
char name[24];
enum pci_barno bar;
@@ -486,12 +665,15 @@ static int pci_endpoint_test_probe(struc
test->alignment = 0;
......
......@@ -9,7 +9,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -4272,6 +4272,15 @@ static int mvneta_ethtool_set_eee(struct
@@ -4271,6 +4271,15 @@ static int mvneta_ethtool_set_eee(struct
return phylink_ethtool_set_eee(pp->phylink, eee);
}
......@@ -25,7 +25,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
static const struct net_device_ops mvneta_netdev_ops = {
.ndo_open = mvneta_open,
.ndo_stop = mvneta_stop,
@@ -4282,6 +4291,7 @@ static const struct net_device_ops mvnet
@@ -4281,6 +4290,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,
......
......@@ -32,7 +32,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
#define MVNETA_MIB_COUNTERS_BASE 0x3000
#define MVNETA_MIB_LATE_COLLISION 0x7c
#define MVNETA_DA_FILT_SPEC_MCAST 0x3400
@@ -3359,6 +3361,7 @@ static void mvneta_validate(struct net_d
@@ -3358,6 +3360,7 @@ static void mvneta_validate(struct net_d
if (state->interface != PHY_INTERFACE_MODE_NA &&
state->interface != PHY_INTERFACE_MODE_QSGMII &&
state->interface != PHY_INTERFACE_MODE_SGMII &&
......@@ -40,7 +40,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
!phy_interface_mode_is_8023z(state->interface) &&
!phy_interface_mode_is_rgmii(state->interface)) {
bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
@@ -3371,9 +3374,15 @@ static void mvneta_validate(struct net_d
@@ -3370,9 +3373,15 @@ static void mvneta_validate(struct net_d
/* Asymmetric pause is unsupported */
phylink_set(mask, Pause);
......@@ -59,7 +59,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
if (!phy_interface_mode_is_8023z(state->interface)) {
/* 10M and 100M are only supported in non-802.3z mode */
@@ -3434,12 +3443,14 @@ static void mvneta_mac_config(struct net
@@ -3433,12 +3442,14 @@ static void mvneta_mac_config(struct net
struct mvneta_port *pp = netdev_priv(ndev);
u32 new_ctrl0, gmac_ctrl0 = mvreg_read(pp, MVNETA_GMAC_CTRL_0);
u32 new_ctrl2, gmac_ctrl2 = mvreg_read(pp, MVNETA_GMAC_CTRL_2);
......@@ -74,7 +74,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
new_clk = gmac_clk & ~MVNETA_GMAC_1MS_CLOCK_ENABLE;
new_an = gmac_an & ~(MVNETA_GMAC_INBAND_AN_ENABLE |
MVNETA_GMAC_INBAND_RESTART_AN |
@@ -3472,7 +3483,7 @@ static void mvneta_mac_config(struct net
@@ -3471,7 +3482,7 @@ static void mvneta_mac_config(struct net
if (state->duplex)
new_an |= MVNETA_GMAC_CONFIG_FULL_DUPLEX;
......@@ -83,7 +83,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
new_an |= MVNETA_GMAC_CONFIG_GMII_SPEED;
else if (state->speed == SPEED_100)
new_an |= MVNETA_GMAC_CONFIG_MII_SPEED;
@@ -3511,10 +3522,18 @@ static void mvneta_mac_config(struct net
@@ -3510,10 +3521,18 @@ static void mvneta_mac_config(struct net
MVNETA_GMAC_FORCE_LINK_DOWN);
}
......
......@@ -27,7 +27,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -3361,7 +3361,6 @@ static void mvneta_validate(struct net_d
@@ -3360,7 +3360,6 @@ static void mvneta_validate(struct net_d
if (state->interface != PHY_INTERFACE_MODE_NA &&
state->interface != PHY_INTERFACE_MODE_QSGMII &&
state->interface != PHY_INTERFACE_MODE_SGMII &&
......@@ -35,7 +35,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
!phy_interface_mode_is_8023z(state->interface) &&
!phy_interface_mode_is_rgmii(state->interface)) {
bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
@@ -3375,14 +3374,9 @@ static void mvneta_validate(struct net_d
@@ -3374,14 +3373,9 @@ static void mvneta_validate(struct net_d
/* Asymmetric pause is unsupported */
phylink_set(mask, Pause);
......
......@@ -18,7 +18,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -4268,8 +4268,7 @@ static int mvneta_ethtool_set_eee(struct
@@ -4267,8 +4267,7 @@ static int mvneta_ethtool_set_eee(struct
/* The Armada 37x documents do not give limits for this other than
* it being an 8-bit register. */
......
......@@ -31,7 +31,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
struct mvneta_bm *bm_priv;
struct mvneta_bm_pool *pool_long;
@@ -3168,6 +3170,8 @@ static void mvneta_start_dev(struct mvne
@@ -3167,6 +3169,8 @@ static void mvneta_start_dev(struct mvne
{
int cpu;
......@@ -40,7 +40,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
mvneta_max_rx_size_set(pp, pp->pkt_size);
mvneta_txq_max_tx_size_set(pp, pp->pkt_size);
@@ -3230,6 +3234,8 @@ static void mvneta_stop_dev(struct mvnet
@@ -3229,6 +3233,8 @@ static void mvneta_stop_dev(struct mvnet
mvneta_tx_reset(pp);
mvneta_rx_reset(pp);
......@@ -49,7 +49,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
}
static void mvneta_percpu_enable(void *arg)
@@ -3355,6 +3361,7 @@ static int mvneta_set_mac_addr(struct ne
@@ -3354,6 +3360,7 @@ static int mvneta_set_mac_addr(struct ne
static void mvneta_validate(struct net_device *ndev, unsigned long *supported,
struct phylink_link_state *state)
{
......@@ -57,7 +57,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
__ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, };
/* We only support QSGMII, SGMII, 802.3z and RGMII modes */
@@ -3375,8 +3382,13 @@ static void mvneta_validate(struct net_d
@@ -3374,8 +3381,13 @@ static void mvneta_validate(struct net_d
phylink_set(mask, Pause);
/* Half-duplex at speeds higher than 100Mbit is unsupported */
......@@ -73,7 +73,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
if (!phy_interface_mode_is_8023z(state->interface)) {
/* 10M and 100M are only supported in non-802.3z mode */
@@ -3390,6 +3402,11 @@ static void mvneta_validate(struct net_d
@@ -3389,6 +3401,11 @@ static void mvneta_validate(struct net_d
__ETHTOOL_LINK_MODE_MASK_NBITS);
bitmap_and(state->advertising, state->advertising, mask,
__ETHTOOL_LINK_MODE_MASK_NBITS);
......@@ -85,7 +85,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
}
static int mvneta_mac_link_state(struct net_device *ndev,
@@ -3401,7 +3418,9 @@ static int mvneta_mac_link_state(struct
@@ -3400,7 +3417,9 @@ static int mvneta_mac_link_state(struct
gmac_stat = mvreg_read(pp, MVNETA_GMAC_STATUS);
if (gmac_stat & MVNETA_GMAC_SPEED_1000)
......@@ -96,7 +96,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
else if (gmac_stat & MVNETA_GMAC_SPEED_100)
state->speed = SPEED_100;
else
@@ -3516,12 +3535,20 @@ static void mvneta_mac_config(struct net
@@ -3515,12 +3534,20 @@ static void mvneta_mac_config(struct net
MVNETA_GMAC_FORCE_LINK_DOWN);
}
......@@ -117,7 +117,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
if (new_ctrl0 != gmac_ctrl0)
mvreg_write(pp, MVNETA_GMAC_CTRL_0, new_ctrl0);
if (new_ctrl2 != gmac_ctrl2)
@@ -4434,7 +4461,7 @@ static int mvneta_port_power_up(struct m
@@ -4433,7 +4460,7 @@ static int mvneta_port_power_up(struct m
if (phy_mode == PHY_INTERFACE_MODE_QSGMII)
mvreg_write(pp, MVNETA_SERDES_CFG, MVNETA_QSGMII_SERDES_PROTO);
else if (phy_mode == PHY_INTERFACE_MODE_SGMII ||
......@@ -126,7 +126,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
mvreg_write(pp, MVNETA_SERDES_CFG, MVNETA_SGMII_SERDES_PROTO);
else if (!phy_interface_mode_is_rgmii(phy_mode))
return -EINVAL;
@@ -4451,6 +4478,7 @@ static int mvneta_probe(struct platform_
@@ -4450,6 +4477,7 @@ static int mvneta_probe(struct platform_
struct mvneta_port *pp;
struct net_device *dev;
struct phylink *phylink;
......@@ -134,7 +134,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
const char *dt_mac_addr;
char hw_mac_addr[ETH_ALEN];
const char *mac_from;
@@ -4476,6 +4504,14 @@ static int mvneta_probe(struct platform_
@@ -4475,6 +4503,14 @@ static int mvneta_probe(struct platform_
goto err_free_irq;
}
......@@ -149,7 +149,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
phylink = phylink_create(dev, pdev->dev.fwnode, phy_mode,
&mvneta_phylink_ops);
if (IS_ERR(phylink)) {
@@ -4492,6 +4528,7 @@ static int mvneta_probe(struct platform_
@@ -4491,6 +4527,7 @@ static int mvneta_probe(struct platform_
pp = netdev_priv(dev);
spin_lock_init(&pp->lock);
pp->phylink = phylink;
......
......@@ -28,7 +28,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -3166,11 +3166,26 @@ static int mvneta_setup_txqs(struct mvne
@@ -3165,11 +3165,26 @@ static int mvneta_setup_txqs(struct mvne
return 0;
}
......@@ -56,7 +56,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
mvneta_max_rx_size_set(pp, pp->pkt_size);
mvneta_txq_max_tx_size_set(pp, pp->pkt_size);
@@ -3542,12 +3557,15 @@ static void mvneta_mac_config(struct net
@@ -3541,12 +3556,15 @@ static void mvneta_mac_config(struct net
if (state->speed == SPEED_2500)
new_ctrl4 |= MVNETA_GMAC4_SHORT_PREAMBLE_ENABLE;
......
......@@ -24,7 +24,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -3402,6 +3402,7 @@ static void mvneta_validate(struct net_d
@@ -3401,6 +3401,7 @@ static void mvneta_validate(struct net_d
phylink_set(mask, 1000baseX_Full);
}
if (pp->comphy || state->interface == PHY_INTERFACE_MODE_2500BASEX) {
......
......@@ -27,7 +27,7 @@ Signed-off-by: Tim Harvey <tharvey@gateworks.com>
};
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);
}
......@@ -42,7 +42,7 @@ Signed-off-by: Tim Harvey <tharvey@gateworks.com>
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,
......@@ -52,7 +52,7 @@ Signed-off-by: Tim Harvey <tharvey@gateworks.com>
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);
......@@ -61,7 +61,7 @@ Signed-off-by: Tim Harvey <tharvey@gateworks.com>
/* 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;
......@@ -69,7 +69,7 @@ Signed-off-by: Tim Harvey <tharvey@gateworks.com>
}
/* 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;
......@@ -77,10 +77,10 @@ Signed-off-by: Tim Harvey <tharvey@gateworks.com>
+ 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);
......
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
......@@ -49,8 +49,8 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册