mirror of
https://github.com/Ysurac/openmptcprouter.git
synced 2025-03-09 15:40:20 +00:00
fix
This commit is contained in:
parent
f45e3ab896
commit
8150b34d5f
121 changed files with 32319 additions and 10136 deletions
6
build.sh
6
build.sh
|
@ -92,9 +92,9 @@ fi
|
|||
if [ "$OMR_OPENWRT" = "default" ]; then
|
||||
if [ "$OMR_KERNEL" = "5.4" ]; then
|
||||
# Use OpenWrt 21.02 for 5.4 kernel
|
||||
_get_repo "$OMR_TARGET/source" https://github.com/openwrt/openwrt "f441be3921c769b732f0148f005d4f1bbace0508"
|
||||
_get_repo feeds/packages https://github.com/openwrt/packages "3aa30ceee4fcf7b131bdc0f98658391069573e12"
|
||||
_get_repo feeds/luci https://github.com/openwrt/luci "f28aaa35cd5c0cbbe59d8cc6a67de88ceeac382e"
|
||||
_get_repo "$OMR_TARGET/source" https://github.com/openwrt/openwrt "4a2cca78245e9291096e7c8c98627426df50ef58"
|
||||
_get_repo feeds/packages https://github.com/openwrt/packages "978e2265968e36c9dc03004225198b85570f60d2"
|
||||
_get_repo feeds/luci https://github.com/openwrt/luci "87bed0547156aca6e31ad6c72e2cd45cf198537f"
|
||||
else
|
||||
_get_repo "$OMR_TARGET/source" https://github.com/openwrt/openwrt "8a6b1a8d29cbd62f005ba20998ca9c8048ff49fc"
|
||||
_get_repo feeds/packages https://github.com/openwrt/packages "b5132de5cf4f7d0562445cf3c65f9f1a4bcb1bbf"
|
||||
|
|
|
@ -6,12 +6,12 @@ ifdef CONFIG_TESTING_KERNEL
|
|||
KERNEL_PATCHVER:=$(KERNEL_TESTING_PATCHVER)
|
||||
endif
|
||||
|
||||
LINUX_VERSION-5.4 = .167
|
||||
LINUX_VERSION-5.4 = .169
|
||||
LINUX_VERSION-5.10 = .64
|
||||
LINUX_VERSION-5.14 = .6
|
||||
LINUX_VERSION-5.15 = .4
|
||||
|
||||
LINUX_KERNEL_HASH-5.4.167 = b4e43116217ee02009aba7eab3081e64560b81ce42bc6096fcd81257f470a5a7
|
||||
LINUX_KERNEL_HASH-5.4.169 = 554382d95f71afd5f9b49292eb5d1cbe3be1a0bad22d21487c9e6d506ee01a19
|
||||
LINUX_KERNEL_HASH-5.10.64 = 3eb84bd24a2de2b4749314e34597c02401c5d6831b055ed5224adb405c35e30a
|
||||
LINUX_KERNEL_HASH-5.14.6 = 54848c1268771ee3515e4c33e29abc3f1fa90d8144894cce6d0ebc3b158bccec
|
||||
LINUX_KERNEL_HASH-5.15.4 = 549d0fb75e65f6158e6f4becc648f249d386843da0e1211460bde8b1ea99cbca
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
From: Johan Almbladh <johan.almbladh@anyfinetworks.com>
|
||||
Date: Tue, 5 Oct 2021 18:54:02 +0200
|
||||
Subject: [PATCH] MIPS: uasm: Enable muhu opcode for MIPS R6
|
||||
|
||||
Enable the 'muhu' instruction, complementing the existing 'mulu', needed
|
||||
to implement a MIPS32 BPF JIT.
|
||||
|
||||
Also fix a typo in the existing definition of 'dmulu'.
|
||||
|
||||
Signed-off-by: Tony Ambardar <Tony.Ambardar@gmail.com>
|
||||
|
||||
This patch is a dependency for my 32-bit MIPS eBPF JIT.
|
||||
|
||||
Signed-off-by: Johan Almbladh <johan.almbladh@anyfinetworks.com>
|
||||
---
|
||||
|
||||
--- a/arch/mips/include/asm/uasm.h
|
||||
+++ b/arch/mips/include/asm/uasm.h
|
||||
@@ -145,6 +145,7 @@ Ip_u1(_mtlo);
|
||||
Ip_u3u1u2(_mul);
|
||||
Ip_u1u2(_multu);
|
||||
Ip_u3u1u2(_mulu);
|
||||
+Ip_u3u1u2(_muhu);
|
||||
Ip_u3u1u2(_nor);
|
||||
Ip_u3u1u2(_or);
|
||||
Ip_u2u1u3(_ori);
|
||||
--- a/arch/mips/mm/uasm-mips.c
|
||||
+++ b/arch/mips/mm/uasm-mips.c
|
||||
@@ -90,7 +90,7 @@ static const struct insn insn_table[insn
|
||||
RS | RT | RD},
|
||||
[insn_dmtc0] = {M(cop0_op, dmtc_op, 0, 0, 0, 0), RT | RD | SET},
|
||||
[insn_dmultu] = {M(spec_op, 0, 0, 0, 0, dmultu_op), RS | RT},
|
||||
- [insn_dmulu] = {M(spec_op, 0, 0, 0, dmult_dmul_op, dmultu_op),
|
||||
+ [insn_dmulu] = {M(spec_op, 0, 0, 0, dmultu_dmulu_op, dmultu_op),
|
||||
RS | RT | RD},
|
||||
[insn_drotr] = {M(spec_op, 1, 0, 0, 0, dsrl_op), RT | RD | RE},
|
||||
[insn_drotr32] = {M(spec_op, 1, 0, 0, 0, dsrl32_op), RT | RD | RE},
|
||||
@@ -150,6 +150,8 @@ static const struct insn insn_table[insn
|
||||
[insn_mtlo] = {M(spec_op, 0, 0, 0, 0, mtlo_op), RS},
|
||||
[insn_mulu] = {M(spec_op, 0, 0, 0, multu_mulu_op, multu_op),
|
||||
RS | RT | RD},
|
||||
+ [insn_muhu] = {M(spec_op, 0, 0, 0, multu_muhu_op, multu_op),
|
||||
+ RS | RT | RD},
|
||||
#ifndef CONFIG_CPU_MIPSR6
|
||||
[insn_mul] = {M(spec2_op, 0, 0, 0, 0, mul_op), RS | RT | RD},
|
||||
#else
|
||||
--- a/arch/mips/mm/uasm.c
|
||||
+++ b/arch/mips/mm/uasm.c
|
||||
@@ -59,7 +59,7 @@ enum opcode {
|
||||
insn_lddir, insn_ldpte, insn_ldx, insn_lh, insn_lhu, insn_ll, insn_lld,
|
||||
insn_lui, insn_lw, insn_lwu, insn_lwx, insn_mfc0, insn_mfhc0, insn_mfhi,
|
||||
insn_mflo, insn_modu, insn_movn, insn_movz, insn_mtc0, insn_mthc0,
|
||||
- insn_mthi, insn_mtlo, insn_mul, insn_multu, insn_mulu, insn_nor,
|
||||
+ insn_mthi, insn_mtlo, insn_mul, insn_multu, insn_mulu, insn_muhu, insn_nor,
|
||||
insn_or, insn_ori, insn_pref, insn_rfe, insn_rotr, insn_sb, insn_sc,
|
||||
insn_scd, insn_seleqz, insn_selnez, insn_sd, insn_sh, insn_sll,
|
||||
insn_sllv, insn_slt, insn_slti, insn_sltiu, insn_sltu, insn_sra,
|
||||
@@ -344,6 +344,7 @@ I_u1(_mtlo)
|
||||
I_u3u1u2(_mul)
|
||||
I_u1u2(_multu)
|
||||
I_u3u1u2(_mulu)
|
||||
+I_u3u1u2(_muhu)
|
||||
I_u3u1u2(_nor)
|
||||
I_u3u1u2(_or)
|
||||
I_u2u1u3(_ori)
|
|
@ -0,0 +1,31 @@
|
|||
From: Johan Almbladh <johan.almbladh@anyfinetworks.com>
|
||||
Date: Tue, 5 Oct 2021 18:54:03 +0200
|
||||
Subject: [PATCH] mips: uasm: Add workaround for Loongson-2F nop CPU errata
|
||||
|
||||
This patch implements a workaround for the Loongson-2F nop in generated,
|
||||
code, if the existing option CONFIG_CPU_NOP_WORKAROUND is set. Before,
|
||||
the binutils option -mfix-loongson2f-nop was enabled, but no workaround
|
||||
was done when emitting MIPS code. Now, the nop pseudo instruction is
|
||||
emitted as "or ax,ax,zero" instead of the default "sll zero,zero,0". This
|
||||
is consistent with the workaround implemented by binutils.
|
||||
|
||||
Link: https://sourceware.org/legacy-ml/binutils/2009-11/msg00387.html
|
||||
|
||||
Signed-off-by: Johan Almbladh <johan.almbladh@anyfinetworks.com>
|
||||
Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
|
||||
---
|
||||
|
||||
--- a/arch/mips/include/asm/uasm.h
|
||||
+++ b/arch/mips/include/asm/uasm.h
|
||||
@@ -249,7 +249,11 @@ static inline void uasm_l##lb(struct uas
|
||||
#define uasm_i_bnezl(buf, rs, off) uasm_i_bnel(buf, rs, 0, off)
|
||||
#define uasm_i_ehb(buf) uasm_i_sll(buf, 0, 0, 3)
|
||||
#define uasm_i_move(buf, a, b) UASM_i_ADDU(buf, a, 0, b)
|
||||
+#ifdef CONFIG_CPU_NOP_WORKAROUNDS
|
||||
+#define uasm_i_nop(buf) uasm_i_or(buf, 1, 1, 0)
|
||||
+#else
|
||||
#define uasm_i_nop(buf) uasm_i_sll(buf, 0, 0, 0)
|
||||
+#endif
|
||||
#define uasm_i_ssnop(buf) uasm_i_sll(buf, 0, 0, 1)
|
||||
|
||||
static inline void uasm_i_drotr_safe(u32 **p, unsigned int a1,
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,120 @@
|
|||
From: Johan Almbladh <johan.almbladh@anyfinetworks.com>
|
||||
Date: Tue, 5 Oct 2021 18:54:06 +0200
|
||||
Subject: [PATCH] mips: bpf: Add JIT workarounds for CPU errata
|
||||
|
||||
This patch adds workarounds for the following CPU errata to the MIPS
|
||||
eBPF JIT, if enabled in the kernel configuration.
|
||||
|
||||
- R10000 ll/sc weak ordering
|
||||
- Loongson-3 ll/sc weak ordering
|
||||
- Loongson-2F jump hang
|
||||
|
||||
The Loongson-2F nop errata is implemented in uasm, which the JIT uses,
|
||||
so no additional mitigations are needed for that.
|
||||
|
||||
Signed-off-by: Johan Almbladh <johan.almbladh@anyfinetworks.com>
|
||||
Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
|
||||
---
|
||||
|
||||
--- a/arch/mips/net/bpf_jit_comp.c
|
||||
+++ b/arch/mips/net/bpf_jit_comp.c
|
||||
@@ -404,6 +404,7 @@ void emit_alu_r(struct jit_context *ctx,
|
||||
/* Atomic read-modify-write (32-bit) */
|
||||
void emit_atomic_r(struct jit_context *ctx, u8 dst, u8 src, s16 off, u8 code)
|
||||
{
|
||||
+ LLSC_sync(ctx);
|
||||
emit(ctx, ll, MIPS_R_T9, off, dst);
|
||||
switch (code) {
|
||||
case BPF_ADD:
|
||||
@@ -420,18 +421,19 @@ void emit_atomic_r(struct jit_context *c
|
||||
break;
|
||||
}
|
||||
emit(ctx, sc, MIPS_R_T8, off, dst);
|
||||
- emit(ctx, beqz, MIPS_R_T8, -16);
|
||||
+ emit(ctx, LLSC_beqz, MIPS_R_T8, -16 - LLSC_offset);
|
||||
emit(ctx, nop); /* Delay slot */
|
||||
}
|
||||
|
||||
/* Atomic compare-and-exchange (32-bit) */
|
||||
void emit_cmpxchg_r(struct jit_context *ctx, u8 dst, u8 src, u8 res, s16 off)
|
||||
{
|
||||
+ LLSC_sync(ctx);
|
||||
emit(ctx, ll, MIPS_R_T9, off, dst);
|
||||
emit(ctx, bne, MIPS_R_T9, res, 12);
|
||||
emit(ctx, move, MIPS_R_T8, src); /* Delay slot */
|
||||
emit(ctx, sc, MIPS_R_T8, off, dst);
|
||||
- emit(ctx, beqz, MIPS_R_T8, -20);
|
||||
+ emit(ctx, LLSC_beqz, MIPS_R_T8, -20 - LLSC_offset);
|
||||
emit(ctx, move, res, MIPS_R_T9); /* Delay slot */
|
||||
clobber_reg(ctx, res);
|
||||
}
|
||||
--- a/arch/mips/net/bpf_jit_comp.h
|
||||
+++ b/arch/mips/net/bpf_jit_comp.h
|
||||
@@ -87,7 +87,7 @@ struct jit_context {
|
||||
};
|
||||
|
||||
/* Emit the instruction if the JIT memory space has been allocated */
|
||||
-#define emit(ctx, func, ...) \
|
||||
+#define __emit(ctx, func, ...) \
|
||||
do { \
|
||||
if ((ctx)->target != NULL) { \
|
||||
u32 *p = &(ctx)->target[ctx->jit_index]; \
|
||||
@@ -95,6 +95,30 @@ do { \
|
||||
} \
|
||||
(ctx)->jit_index++; \
|
||||
} while (0)
|
||||
+#define emit(...) __emit(__VA_ARGS__)
|
||||
+
|
||||
+/* Workaround for R10000 ll/sc errata */
|
||||
+#ifdef CONFIG_WAR_R10000
|
||||
+#define LLSC_beqz beqzl
|
||||
+#else
|
||||
+#define LLSC_beqz beqz
|
||||
+#endif
|
||||
+
|
||||
+/* Workaround for Loongson-3 ll/sc errata */
|
||||
+#ifdef CONFIG_CPU_LOONGSON3_WORKAROUNDS
|
||||
+#define LLSC_sync(ctx) emit(ctx, sync, 0)
|
||||
+#define LLSC_offset 4
|
||||
+#else
|
||||
+#define LLSC_sync(ctx)
|
||||
+#define LLSC_offset 0
|
||||
+#endif
|
||||
+
|
||||
+/* Workaround for Loongson-2F jump errata */
|
||||
+#ifdef CONFIG_CPU_JUMP_WORKAROUNDS
|
||||
+#define JALR_MASK 0xffffffffcfffffffULL
|
||||
+#else
|
||||
+#define JALR_MASK (~0ULL)
|
||||
+#endif
|
||||
|
||||
/*
|
||||
* Mark a BPF register as accessed, it needs to be
|
||||
--- a/arch/mips/net/bpf_jit_comp64.c
|
||||
+++ b/arch/mips/net/bpf_jit_comp64.c
|
||||
@@ -375,6 +375,7 @@ static void emit_atomic_r64(struct jit_c
|
||||
u8 t1 = MIPS_R_T6;
|
||||
u8 t2 = MIPS_R_T7;
|
||||
|
||||
+ LLSC_sync(ctx);
|
||||
emit(ctx, lld, t1, off, dst);
|
||||
switch (code) {
|
||||
case BPF_ADD:
|
||||
@@ -391,7 +392,7 @@ static void emit_atomic_r64(struct jit_c
|
||||
break;
|
||||
}
|
||||
emit(ctx, scd, t2, off, dst);
|
||||
- emit(ctx, beqz, t2, -16);
|
||||
+ emit(ctx, LLSC_beqz, t2, -16 - LLSC_offset);
|
||||
emit(ctx, nop); /* Delay slot */
|
||||
}
|
||||
|
||||
@@ -414,7 +415,7 @@ static int emit_call(struct jit_context
|
||||
push_regs(ctx, ctx->clobbered & JIT_CALLER_REGS, 0, 0);
|
||||
|
||||
/* Emit function call */
|
||||
- emit_mov_i64(ctx, tmp, addr);
|
||||
+ emit_mov_i64(ctx, tmp, addr & JALR_MASK);
|
||||
emit(ctx, jalr, MIPS_R_RA, tmp);
|
||||
emit(ctx, nop); /* Delay slot */
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
From: Johan Almbladh <johan.almbladh@anyfinetworks.com>
|
||||
Date: Tue, 5 Oct 2021 18:54:07 +0200
|
||||
Subject: [PATCH] mips: bpf: Enable eBPF JITs
|
||||
|
||||
This patch enables the new eBPF JITs for 32-bit and 64-bit MIPS. It also
|
||||
disables the old cBPF JIT to so cBPF programs are converted to use the
|
||||
new JIT.
|
||||
|
||||
Workarounds for R4000 CPU errata are not implemented by the JIT, so the
|
||||
JIT is disabled if any of those workarounds are configured.
|
||||
|
||||
Signed-off-by: Johan Almbladh <johan.almbladh@anyfinetworks.com>
|
||||
---
|
||||
|
||||
--- a/MAINTAINERS
|
||||
+++ b/MAINTAINERS
|
||||
@@ -3428,6 +3428,7 @@ S: Supported
|
||||
F: arch/arm64/net/
|
||||
|
||||
BPF JIT for MIPS (32-BIT AND 64-BIT)
|
||||
+M: Johan Almbladh <johan.almbladh@anyfinetworks.com>
|
||||
M: Paul Burton <paulburton@kernel.org>
|
||||
L: netdev@vger.kernel.org
|
||||
L: bpf@vger.kernel.org
|
||||
--- a/arch/mips/Kconfig
|
||||
+++ b/arch/mips/Kconfig
|
||||
@@ -57,7 +57,6 @@ config MIPS
|
||||
select HAVE_ARCH_TRACEHOOK
|
||||
select HAVE_ARCH_TRANSPARENT_HUGEPAGE if CPU_SUPPORTS_HUGEPAGES
|
||||
select HAVE_ASM_MODVERSIONS
|
||||
- select HAVE_CBPF_JIT if !64BIT && !CPU_MICROMIPS
|
||||
select HAVE_CONTEXT_TRACKING
|
||||
select HAVE_TIF_NOHZ
|
||||
select HAVE_C_RECORDMCOUNT
|
||||
@@ -65,7 +64,10 @@ config MIPS
|
||||
select HAVE_DEBUG_STACKOVERFLOW
|
||||
select HAVE_DMA_CONTIGUOUS
|
||||
select HAVE_DYNAMIC_FTRACE
|
||||
- select HAVE_EBPF_JIT if 64BIT && !CPU_MICROMIPS && TARGET_ISA_REV >= 2
|
||||
+ select HAVE_EBPF_JIT if !CPU_MICROMIPS && \
|
||||
+ !CPU_DADDI_WORKAROUNDS && \
|
||||
+ !CPU_R4000_WORKAROUNDS && \
|
||||
+ !CPU_R4400_WORKAROUNDS
|
||||
select HAVE_EXIT_THREAD
|
||||
select HAVE_FAST_GUP
|
||||
select HAVE_FTRACE_MCOUNT_RECORD
|
||||
--- a/arch/mips/net/Makefile
|
||||
+++ b/arch/mips/net/Makefile
|
||||
@@ -2,9 +2,10 @@
|
||||
# MIPS networking code
|
||||
|
||||
obj-$(CONFIG_MIPS_CBPF_JIT) += bpf_jit.o bpf_jit_asm.o
|
||||
+obj-$(CONFIG_MIPS_EBPF_JIT) += bpf_jit_comp.o
|
||||
|
||||
ifeq ($(CONFIG_32BIT),y)
|
||||
- obj-$(CONFIG_MIPS_EBPF_JIT) += bpf_jit_comp.o bpf_jit_comp32.o
|
||||
+ obj-$(CONFIG_MIPS_EBPF_JIT) += bpf_jit_comp32.o
|
||||
else
|
||||
- obj-$(CONFIG_MIPS_EBPF_JIT) += ebpf_jit.o
|
||||
+ obj-$(CONFIG_MIPS_EBPF_JIT) += bpf_jit_comp64.o
|
||||
endif
|
|
@ -0,0 +1,387 @@
|
|||
From: Johan Almbladh <johan.almbladh@anyfinetworks.com>
|
||||
Date: Tue, 5 Oct 2021 18:54:08 +0200
|
||||
Subject: [PATCH] mips: bpf: Remove old BPF JIT implementations
|
||||
|
||||
This patch removes the old 32-bit cBPF and 64-bit eBPF JIT implementations.
|
||||
They are replaced by a new eBPF implementation that supports both 32-bit
|
||||
and 64-bit MIPS CPUs.
|
||||
|
||||
Signed-off-by: Johan Almbladh <johan.almbladh@anyfinetworks.com>
|
||||
---
|
||||
delete mode 100644 arch/mips/net/bpf_jit.c
|
||||
delete mode 100644 arch/mips/net/bpf_jit.h
|
||||
delete mode 100644 arch/mips/net/bpf_jit_asm.S
|
||||
delete mode 100644 arch/mips/net/ebpf_jit.c
|
||||
|
||||
--- a/arch/mips/net/bpf_jit.h
|
||||
+++ /dev/null
|
||||
@@ -1,81 +0,0 @@
|
||||
-/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
-/*
|
||||
- * Just-In-Time compiler for BPF filters on MIPS
|
||||
- *
|
||||
- * Copyright (c) 2014 Imagination Technologies Ltd.
|
||||
- * Author: Markos Chandras <markos.chandras@imgtec.com>
|
||||
- */
|
||||
-
|
||||
-#ifndef BPF_JIT_MIPS_OP_H
|
||||
-#define BPF_JIT_MIPS_OP_H
|
||||
-
|
||||
-/* Registers used by JIT */
|
||||
-#define MIPS_R_ZERO 0
|
||||
-#define MIPS_R_V0 2
|
||||
-#define MIPS_R_A0 4
|
||||
-#define MIPS_R_A1 5
|
||||
-#define MIPS_R_T4 12
|
||||
-#define MIPS_R_T5 13
|
||||
-#define MIPS_R_T6 14
|
||||
-#define MIPS_R_T7 15
|
||||
-#define MIPS_R_S0 16
|
||||
-#define MIPS_R_S1 17
|
||||
-#define MIPS_R_S2 18
|
||||
-#define MIPS_R_S3 19
|
||||
-#define MIPS_R_S4 20
|
||||
-#define MIPS_R_S5 21
|
||||
-#define MIPS_R_S6 22
|
||||
-#define MIPS_R_S7 23
|
||||
-#define MIPS_R_SP 29
|
||||
-#define MIPS_R_RA 31
|
||||
-
|
||||
-/* Conditional codes */
|
||||
-#define MIPS_COND_EQ 0x1
|
||||
-#define MIPS_COND_GE (0x1 << 1)
|
||||
-#define MIPS_COND_GT (0x1 << 2)
|
||||
-#define MIPS_COND_NE (0x1 << 3)
|
||||
-#define MIPS_COND_ALL (0x1 << 4)
|
||||
-/* Conditionals on X register or K immediate */
|
||||
-#define MIPS_COND_X (0x1 << 5)
|
||||
-#define MIPS_COND_K (0x1 << 6)
|
||||
-
|
||||
-#define r_ret MIPS_R_V0
|
||||
-
|
||||
-/*
|
||||
- * Use 2 scratch registers to avoid pipeline interlocks.
|
||||
- * There is no overhead during epilogue and prologue since
|
||||
- * any of the $s0-$s6 registers will only be preserved if
|
||||
- * they are going to actually be used.
|
||||
- */
|
||||
-#define r_skb_hl MIPS_R_S0 /* skb header length */
|
||||
-#define r_skb_data MIPS_R_S1 /* skb actual data */
|
||||
-#define r_off MIPS_R_S2
|
||||
-#define r_A MIPS_R_S3
|
||||
-#define r_X MIPS_R_S4
|
||||
-#define r_skb MIPS_R_S5
|
||||
-#define r_M MIPS_R_S6
|
||||
-#define r_skb_len MIPS_R_S7
|
||||
-#define r_s0 MIPS_R_T4 /* scratch reg 1 */
|
||||
-#define r_s1 MIPS_R_T5 /* scratch reg 2 */
|
||||
-#define r_tmp_imm MIPS_R_T6 /* No need to preserve this */
|
||||
-#define r_tmp MIPS_R_T7 /* No need to preserve this */
|
||||
-#define r_zero MIPS_R_ZERO
|
||||
-#define r_sp MIPS_R_SP
|
||||
-#define r_ra MIPS_R_RA
|
||||
-
|
||||
-#ifndef __ASSEMBLY__
|
||||
-
|
||||
-/* Declare ASM helpers */
|
||||
-
|
||||
-#define DECLARE_LOAD_FUNC(func) \
|
||||
- extern u8 func(unsigned long *skb, int offset); \
|
||||
- extern u8 func##_negative(unsigned long *skb, int offset); \
|
||||
- extern u8 func##_positive(unsigned long *skb, int offset)
|
||||
-
|
||||
-DECLARE_LOAD_FUNC(sk_load_word);
|
||||
-DECLARE_LOAD_FUNC(sk_load_half);
|
||||
-DECLARE_LOAD_FUNC(sk_load_byte);
|
||||
-
|
||||
-#endif
|
||||
-
|
||||
-#endif /* BPF_JIT_MIPS_OP_H */
|
||||
--- a/arch/mips/net/bpf_jit_asm.S
|
||||
+++ /dev/null
|
||||
@@ -1,285 +0,0 @@
|
||||
-/*
|
||||
- * bpf_jib_asm.S: Packet/header access helper functions for MIPS/MIPS64 BPF
|
||||
- * compiler.
|
||||
- *
|
||||
- * Copyright (C) 2015 Imagination Technologies Ltd.
|
||||
- * Author: Markos Chandras <markos.chandras@imgtec.com>
|
||||
- *
|
||||
- * This program is free software; you can redistribute it and/or modify it
|
||||
- * under the terms of the GNU General Public License as published by the
|
||||
- * Free Software Foundation; version 2 of the License.
|
||||
- */
|
||||
-
|
||||
-#include <asm/asm.h>
|
||||
-#include <asm/isa-rev.h>
|
||||
-#include <asm/regdef.h>
|
||||
-#include "bpf_jit.h"
|
||||
-
|
||||
-/* ABI
|
||||
- *
|
||||
- * r_skb_hl skb header length
|
||||
- * r_skb_data skb data
|
||||
- * r_off(a1) offset register
|
||||
- * r_A BPF register A
|
||||
- * r_X PF register X
|
||||
- * r_skb(a0) *skb
|
||||
- * r_M *scratch memory
|
||||
- * r_skb_le skb length
|
||||
- * r_s0 Scratch register 0
|
||||
- * r_s1 Scratch register 1
|
||||
- *
|
||||
- * On entry:
|
||||
- * a0: *skb
|
||||
- * a1: offset (imm or imm + X)
|
||||
- *
|
||||
- * All non-BPF-ABI registers are free for use. On return, we only
|
||||
- * care about r_ret. The BPF-ABI registers are assumed to remain
|
||||
- * unmodified during the entire filter operation.
|
||||
- */
|
||||
-
|
||||
-#define skb a0
|
||||
-#define offset a1
|
||||
-#define SKF_LL_OFF (-0x200000) /* Can't include linux/filter.h in assembly */
|
||||
-
|
||||
- /* We know better :) so prevent assembler reordering etc */
|
||||
- .set noreorder
|
||||
-
|
||||
-#define is_offset_negative(TYPE) \
|
||||
- /* If offset is negative we have more work to do */ \
|
||||
- slti t0, offset, 0; \
|
||||
- bgtz t0, bpf_slow_path_##TYPE##_neg; \
|
||||
- /* Be careful what follows in DS. */
|
||||
-
|
||||
-#define is_offset_in_header(SIZE, TYPE) \
|
||||
- /* Reading from header? */ \
|
||||
- addiu $r_s0, $r_skb_hl, -SIZE; \
|
||||
- slt t0, $r_s0, offset; \
|
||||
- bgtz t0, bpf_slow_path_##TYPE; \
|
||||
-
|
||||
-LEAF(sk_load_word)
|
||||
- is_offset_negative(word)
|
||||
-FEXPORT(sk_load_word_positive)
|
||||
- is_offset_in_header(4, word)
|
||||
- /* Offset within header boundaries */
|
||||
- PTR_ADDU t1, $r_skb_data, offset
|
||||
- .set reorder
|
||||
- lw $r_A, 0(t1)
|
||||
- .set noreorder
|
||||
-#ifdef CONFIG_CPU_LITTLE_ENDIAN
|
||||
-# if MIPS_ISA_REV >= 2
|
||||
- wsbh t0, $r_A
|
||||
- rotr $r_A, t0, 16
|
||||
-# else
|
||||
- sll t0, $r_A, 24
|
||||
- srl t1, $r_A, 24
|
||||
- srl t2, $r_A, 8
|
||||
- or t0, t0, t1
|
||||
- andi t2, t2, 0xff00
|
||||
- andi t1, $r_A, 0xff00
|
||||
- or t0, t0, t2
|
||||
- sll t1, t1, 8
|
||||
- or $r_A, t0, t1
|
||||
-# endif
|
||||
-#endif
|
||||
- jr $r_ra
|
||||
- move $r_ret, zero
|
||||
- END(sk_load_word)
|
||||
-
|
||||
-LEAF(sk_load_half)
|
||||
- is_offset_negative(half)
|
||||
-FEXPORT(sk_load_half_positive)
|
||||
- is_offset_in_header(2, half)
|
||||
- /* Offset within header boundaries */
|
||||
- PTR_ADDU t1, $r_skb_data, offset
|
||||
- lhu $r_A, 0(t1)
|
||||
-#ifdef CONFIG_CPU_LITTLE_ENDIAN
|
||||
-# if MIPS_ISA_REV >= 2
|
||||
- wsbh $r_A, $r_A
|
||||
-# else
|
||||
- sll t0, $r_A, 8
|
||||
- srl t1, $r_A, 8
|
||||
- andi t0, t0, 0xff00
|
||||
- or $r_A, t0, t1
|
||||
-# endif
|
||||
-#endif
|
||||
- jr $r_ra
|
||||
- move $r_ret, zero
|
||||
- END(sk_load_half)
|
||||
-
|
||||
-LEAF(sk_load_byte)
|
||||
- is_offset_negative(byte)
|
||||
-FEXPORT(sk_load_byte_positive)
|
||||
- is_offset_in_header(1, byte)
|
||||
- /* Offset within header boundaries */
|
||||
- PTR_ADDU t1, $r_skb_data, offset
|
||||
- lbu $r_A, 0(t1)
|
||||
- jr $r_ra
|
||||
- move $r_ret, zero
|
||||
- END(sk_load_byte)
|
||||
-
|
||||
-/*
|
||||
- * call skb_copy_bits:
|
||||
- * (prototype in linux/skbuff.h)
|
||||
- *
|
||||
- * int skb_copy_bits(sk_buff *skb, int offset, void *to, int len)
|
||||
- *
|
||||
- * o32 mandates we leave 4 spaces for argument registers in case
|
||||
- * the callee needs to use them. Even though we don't care about
|
||||
- * the argument registers ourselves, we need to allocate that space
|
||||
- * to remain ABI compliant since the callee may want to use that space.
|
||||
- * We also allocate 2 more spaces for $r_ra and our return register (*to).
|
||||
- *
|
||||
- * n64 is a bit different. The *caller* will allocate the space to preserve
|
||||
- * the arguments. So in 64-bit kernels, we allocate the 4-arg space for no
|
||||
- * good reason but it does not matter that much really.
|
||||
- *
|
||||
- * (void *to) is returned in r_s0
|
||||
- *
|
||||
- */
|
||||
-#ifdef CONFIG_CPU_LITTLE_ENDIAN
|
||||
-#define DS_OFFSET(SIZE) (4 * SZREG)
|
||||
-#else
|
||||
-#define DS_OFFSET(SIZE) ((4 * SZREG) + (4 - SIZE))
|
||||
-#endif
|
||||
-#define bpf_slow_path_common(SIZE) \
|
||||
- /* Quick check. Are we within reasonable boundaries? */ \
|
||||
- LONG_ADDIU $r_s1, $r_skb_len, -SIZE; \
|
||||
- sltu $r_s0, offset, $r_s1; \
|
||||
- beqz $r_s0, fault; \
|
||||
- /* Load 4th argument in DS */ \
|
||||
- LONG_ADDIU a3, zero, SIZE; \
|
||||
- PTR_ADDIU $r_sp, $r_sp, -(6 * SZREG); \
|
||||
- PTR_LA t0, skb_copy_bits; \
|
||||
- PTR_S $r_ra, (5 * SZREG)($r_sp); \
|
||||
- /* Assign low slot to a2 */ \
|
||||
- PTR_ADDIU a2, $r_sp, DS_OFFSET(SIZE); \
|
||||
- jalr t0; \
|
||||
- /* Reset our destination slot (DS but it's ok) */ \
|
||||
- INT_S zero, (4 * SZREG)($r_sp); \
|
||||
- /* \
|
||||
- * skb_copy_bits returns 0 on success and -EFAULT \
|
||||
- * on error. Our data live in a2. Do not bother with \
|
||||
- * our data if an error has been returned. \
|
||||
- */ \
|
||||
- /* Restore our frame */ \
|
||||
- PTR_L $r_ra, (5 * SZREG)($r_sp); \
|
||||
- INT_L $r_s0, (4 * SZREG)($r_sp); \
|
||||
- bltz v0, fault; \
|
||||
- PTR_ADDIU $r_sp, $r_sp, 6 * SZREG; \
|
||||
- move $r_ret, zero; \
|
||||
-
|
||||
-NESTED(bpf_slow_path_word, (6 * SZREG), $r_sp)
|
||||
- bpf_slow_path_common(4)
|
||||
-#ifdef CONFIG_CPU_LITTLE_ENDIAN
|
||||
-# if MIPS_ISA_REV >= 2
|
||||
- wsbh t0, $r_s0
|
||||
- jr $r_ra
|
||||
- rotr $r_A, t0, 16
|
||||
-# else
|
||||
- sll t0, $r_s0, 24
|
||||
- srl t1, $r_s0, 24
|
||||
- srl t2, $r_s0, 8
|
||||
- or t0, t0, t1
|
||||
- andi t2, t2, 0xff00
|
||||
- andi t1, $r_s0, 0xff00
|
||||
- or t0, t0, t2
|
||||
- sll t1, t1, 8
|
||||
- jr $r_ra
|
||||
- or $r_A, t0, t1
|
||||
-# endif
|
||||
-#else
|
||||
- jr $r_ra
|
||||
- move $r_A, $r_s0
|
||||
-#endif
|
||||
-
|
||||
- END(bpf_slow_path_word)
|
||||
-
|
||||
-NESTED(bpf_slow_path_half, (6 * SZREG), $r_sp)
|
||||
- bpf_slow_path_common(2)
|
||||
-#ifdef CONFIG_CPU_LITTLE_ENDIAN
|
||||
-# if MIPS_ISA_REV >= 2
|
||||
- jr $r_ra
|
||||
- wsbh $r_A, $r_s0
|
||||
-# else
|
||||
- sll t0, $r_s0, 8
|
||||
- andi t1, $r_s0, 0xff00
|
||||
- andi t0, t0, 0xff00
|
||||
- srl t1, t1, 8
|
||||
- jr $r_ra
|
||||
- or $r_A, t0, t1
|
||||
-# endif
|
||||
-#else
|
||||
- jr $r_ra
|
||||
- move $r_A, $r_s0
|
||||
-#endif
|
||||
-
|
||||
- END(bpf_slow_path_half)
|
||||
-
|
||||
-NESTED(bpf_slow_path_byte, (6 * SZREG), $r_sp)
|
||||
- bpf_slow_path_common(1)
|
||||
- jr $r_ra
|
||||
- move $r_A, $r_s0
|
||||
-
|
||||
- END(bpf_slow_path_byte)
|
||||
-
|
||||
-/*
|
||||
- * Negative entry points
|
||||
- */
|
||||
- .macro bpf_is_end_of_data
|
||||
- li t0, SKF_LL_OFF
|
||||
- /* Reading link layer data? */
|
||||
- slt t1, offset, t0
|
||||
- bgtz t1, fault
|
||||
- /* Be careful what follows in DS. */
|
||||
- .endm
|
||||
-/*
|
||||
- * call skb_copy_bits:
|
||||
- * (prototype in linux/filter.h)
|
||||
- *
|
||||
- * void *bpf_internal_load_pointer_neg_helper(const struct sk_buff *skb,
|
||||
- * int k, unsigned int size)
|
||||
- *
|
||||
- * see above (bpf_slow_path_common) for ABI restrictions
|
||||
- */
|
||||
-#define bpf_negative_common(SIZE) \
|
||||
- PTR_ADDIU $r_sp, $r_sp, -(6 * SZREG); \
|
||||
- PTR_LA t0, bpf_internal_load_pointer_neg_helper; \
|
||||
- PTR_S $r_ra, (5 * SZREG)($r_sp); \
|
||||
- jalr t0; \
|
||||
- li a2, SIZE; \
|
||||
- PTR_L $r_ra, (5 * SZREG)($r_sp); \
|
||||
- /* Check return pointer */ \
|
||||
- beqz v0, fault; \
|
||||
- PTR_ADDIU $r_sp, $r_sp, 6 * SZREG; \
|
||||
- /* Preserve our pointer */ \
|
||||
- move $r_s0, v0; \
|
||||
- /* Set return value */ \
|
||||
- move $r_ret, zero; \
|
||||
-
|
||||
-bpf_slow_path_word_neg:
|
||||
- bpf_is_end_of_data
|
||||
-NESTED(sk_load_word_negative, (6 * SZREG), $r_sp)
|
||||
- bpf_negative_common(4)
|
||||
- jr $r_ra
|
||||
- lw $r_A, 0($r_s0)
|
||||
- END(sk_load_word_negative)
|
||||
-
|
||||
-bpf_slow_path_half_neg:
|
||||
- bpf_is_end_of_data
|
||||
-NESTED(sk_load_half_negative, (6 * SZREG), $r_sp)
|
||||
- bpf_negative_common(2)
|
||||
- jr $r_ra
|
||||
- lhu $r_A, 0($r_s0)
|
||||
- END(sk_load_half_negative)
|
||||
-
|
||||
-bpf_slow_path_byte_neg:
|
||||
- bpf_is_end_of_data
|
||||
-NESTED(sk_load_byte_negative, (6 * SZREG), $r_sp)
|
||||
- bpf_negative_common(1)
|
||||
- jr $r_ra
|
||||
- lbu $r_A, 0($r_s0)
|
||||
- END(sk_load_byte_negative)
|
||||
-
|
||||
-fault:
|
||||
- jr $r_ra
|
||||
- addiu $r_ret, zero, 1
|
|
@ -0,0 +1,84 @@
|
|||
From b5375509184dc23d2b7fa0c5ed8763899ccc9674 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
|
||||
Date: Sat, 2 Oct 2021 19:58:11 +0200
|
||||
Subject: [PATCH] net: bgmac: improve handling PHY
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
1. Use info from DT if available
|
||||
|
||||
It allows describing for example a fixed link. It's more accurate than
|
||||
just guessing there may be one (depending on a chipset).
|
||||
|
||||
2. Verify PHY ID before trying to connect PHY
|
||||
|
||||
PHY addr 0x1e (30) is special in Broadcom routers and means a switch
|
||||
connected as MDIO devices instead of a real PHY. Don't try connecting to
|
||||
it.
|
||||
|
||||
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
---
|
||||
drivers/net/ethernet/broadcom/bgmac-bcma.c | 33 ++++++++++++++--------
|
||||
1 file changed, 21 insertions(+), 12 deletions(-)
|
||||
|
||||
--- a/drivers/net/ethernet/broadcom/bgmac-bcma.c
|
||||
+++ b/drivers/net/ethernet/broadcom/bgmac-bcma.c
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <linux/bcma/bcma.h>
|
||||
#include <linux/brcmphy.h>
|
||||
#include <linux/etherdevice.h>
|
||||
+#include <linux/of_mdio.h>
|
||||
#include <linux/of_net.h>
|
||||
#include "bgmac.h"
|
||||
|
||||
@@ -86,17 +87,28 @@ static int bcma_phy_connect(struct bgmac
|
||||
struct phy_device *phy_dev;
|
||||
char bus_id[MII_BUS_ID_SIZE + 3];
|
||||
|
||||
+ /* DT info should be the most accurate */
|
||||
+ phy_dev = of_phy_get_and_connect(bgmac->net_dev, bgmac->dev->of_node,
|
||||
+ bgmac_adjust_link);
|
||||
+ if (phy_dev)
|
||||
+ return 0;
|
||||
+
|
||||
/* Connect to the PHY */
|
||||
- snprintf(bus_id, sizeof(bus_id), PHY_ID_FMT, bgmac->mii_bus->id,
|
||||
- bgmac->phyaddr);
|
||||
- phy_dev = phy_connect(bgmac->net_dev, bus_id, bgmac_adjust_link,
|
||||
- PHY_INTERFACE_MODE_MII);
|
||||
- if (IS_ERR(phy_dev)) {
|
||||
- dev_err(bgmac->dev, "PHY connection failed\n");
|
||||
- return PTR_ERR(phy_dev);
|
||||
+ if (bgmac->mii_bus && bgmac->phyaddr != BGMAC_PHY_NOREGS) {
|
||||
+ snprintf(bus_id, sizeof(bus_id), PHY_ID_FMT, bgmac->mii_bus->id,
|
||||
+ bgmac->phyaddr);
|
||||
+ phy_dev = phy_connect(bgmac->net_dev, bus_id, bgmac_adjust_link,
|
||||
+ PHY_INTERFACE_MODE_MII);
|
||||
+ if (IS_ERR(phy_dev)) {
|
||||
+ dev_err(bgmac->dev, "PHY connection failed\n");
|
||||
+ return PTR_ERR(phy_dev);
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
- return 0;
|
||||
+ /* Assume a fixed link to the switch port */
|
||||
+ return bgmac_phy_connect_direct(bgmac);
|
||||
}
|
||||
|
||||
static const struct bcma_device_id bgmac_bcma_tbl[] = {
|
||||
@@ -297,10 +309,7 @@ static int bgmac_probe(struct bcma_devic
|
||||
bgmac->cco_ctl_maskset = bcma_bgmac_cco_ctl_maskset;
|
||||
bgmac->get_bus_clock = bcma_bgmac_get_bus_clock;
|
||||
bgmac->cmn_maskset32 = bcma_bgmac_cmn_maskset32;
|
||||
- if (bgmac->mii_bus)
|
||||
- bgmac->phy_connect = bcma_phy_connect;
|
||||
- else
|
||||
- bgmac->phy_connect = bgmac_phy_connect_direct;
|
||||
+ bgmac->phy_connect = bcma_phy_connect;
|
||||
|
||||
err = bgmac_enet_probe(bgmac);
|
||||
if (err)
|
|
@ -0,0 +1,54 @@
|
|||
From 45c9d966688e7fad7f24bfc450547d91e4304d0b Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
|
||||
Date: Sat, 2 Oct 2021 19:58:12 +0200
|
||||
Subject: [PATCH] net: bgmac: support MDIO described in DT
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Check ethernet controller DT node for "mdio" subnode and use it with
|
||||
of_mdiobus_register() when present. That allows specifying MDIO and its
|
||||
PHY devices in a standard DT based way.
|
||||
|
||||
This is required for BCM53573 SoC support. That family is sometimes
|
||||
called Northstar (by marketing?) but is quite different from it. It uses
|
||||
different CPU(s) and many different hw blocks.
|
||||
|
||||
One of shared blocks in BCM53573 is Ethernet controller. Switch however
|
||||
is not SRAB accessible (as it Northstar) but is MDIO attached.
|
||||
|
||||
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
---
|
||||
drivers/net/ethernet/broadcom/bgmac-bcma-mdio.c | 6 +++++-
|
||||
1 file changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/drivers/net/ethernet/broadcom/bgmac-bcma-mdio.c
|
||||
+++ b/drivers/net/ethernet/broadcom/bgmac-bcma-mdio.c
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
#include <linux/bcma/bcma.h>
|
||||
#include <linux/brcmphy.h>
|
||||
+#include <linux/of_mdio.h>
|
||||
#include "bgmac.h"
|
||||
|
||||
static bool bcma_mdio_wait_value(struct bcma_device *core, u16 reg, u32 mask,
|
||||
@@ -211,6 +212,7 @@ struct mii_bus *bcma_mdio_mii_register(s
|
||||
{
|
||||
struct bcma_device *core = bgmac->bcma.core;
|
||||
struct mii_bus *mii_bus;
|
||||
+ struct device_node *np;
|
||||
int err;
|
||||
|
||||
mii_bus = mdiobus_alloc();
|
||||
@@ -229,7 +231,9 @@ struct mii_bus *bcma_mdio_mii_register(s
|
||||
mii_bus->parent = &core->dev;
|
||||
mii_bus->phy_mask = ~(1 << bgmac->phyaddr);
|
||||
|
||||
- err = mdiobus_register(mii_bus);
|
||||
+ np = of_get_child_by_name(core->dev.of_node, "mdio");
|
||||
+
|
||||
+ err = of_mdiobus_register(mii_bus, np);
|
||||
if (err) {
|
||||
dev_err(&core->dev, "Registration of mii bus failed\n");
|
||||
goto err_free_bus;
|
|
@ -0,0 +1,48 @@
|
|||
From 0ccf8511182436183c031e8a2f740ae91a02c625 Mon Sep 17 00:00:00 2001
|
||||
From: Ansuel Smith <ansuelsmth@gmail.com>
|
||||
Date: Tue, 14 Sep 2021 14:33:45 +0200
|
||||
Subject: net: phy: at803x: add support for qca 8327 internal phy
|
||||
|
||||
Add support for qca8327 internal phy needed for correct init of the
|
||||
switch port. It does use the same qca8337 function and reg just with a
|
||||
different id.
|
||||
|
||||
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
|
||||
Tested-by: Rosen Penev <rosenp@gmail.com>
|
||||
Tested-by: Andrew Lunn <andrew@lunn.ch>
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
---
|
||||
drivers/net/phy/at803x.c | 15 +++++++++++++++
|
||||
1 file changed, 15 insertions(+)
|
||||
|
||||
--- a/drivers/net/phy/at803x.c
|
||||
+++ b/drivers/net/phy/at803x.c
|
||||
@@ -1420,6 +1420,19 @@ static struct phy_driver at803x_driver[]
|
||||
.get_sset_count = at803x_get_sset_count,
|
||||
.get_strings = at803x_get_strings,
|
||||
.get_stats = at803x_get_stats,
|
||||
+}, {
|
||||
+ /* QCA8327 */
|
||||
+ .phy_id = QCA8327_PHY_ID,
|
||||
+ .phy_id_mask = QCA8K_PHY_ID_MASK,
|
||||
+ .name = "QCA PHY 8327",
|
||||
+ /* PHY_GBIT_FEATURES */
|
||||
+ .probe = at803x_probe,
|
||||
+ .flags = PHY_IS_INTERNAL,
|
||||
+ .config_init = qca83xx_config_init,
|
||||
+ .soft_reset = genphy_soft_reset,
|
||||
+ .get_sset_count = at803x_get_sset_count,
|
||||
+ .get_strings = at803x_get_strings,
|
||||
+ .get_stats = at803x_get_stats,
|
||||
}, };
|
||||
|
||||
module_phy_driver(at803x_driver);
|
||||
@@ -1430,6 +1443,8 @@ static struct mdio_device_id __maybe_unu
|
||||
{ PHY_ID_MATCH_EXACT(ATH8032_PHY_ID) },
|
||||
{ PHY_ID_MATCH_EXACT(ATH8035_PHY_ID) },
|
||||
{ PHY_ID_MATCH_EXACT(ATH9331_PHY_ID) },
|
||||
+ { PHY_ID_MATCH_EXACT(QCA8337_PHY_ID) },
|
||||
+ { PHY_ID_MATCH_EXACT(QCA8327_PHY_ID) },
|
||||
{ }
|
||||
};
|
||||
|
|
@ -0,0 +1,131 @@
|
|||
From 983d96a9116a328668601555d96736261d33170c Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
|
||||
Date: Thu, 16 Sep 2021 14:03:51 +0200
|
||||
Subject: [PATCH] net: dsa: b53: Include all ports in "enabled_ports"
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Make "enabled_ports" bitfield contain all available switch ports
|
||||
including a CPU port. This way there is no need for fixup during
|
||||
initialization.
|
||||
|
||||
For BCM53010, BCM53018 and BCM53019 include also other available ports.
|
||||
|
||||
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
|
||||
Tested-by: Florian Fainelli <f.fainelli@gmail.com>
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/dsa/b53/b53_common.c | 23 +++++++++++------------
|
||||
1 file changed, 11 insertions(+), 12 deletions(-)
|
||||
|
||||
--- a/drivers/net/dsa/b53/b53_common.c
|
||||
+++ b/drivers/net/dsa/b53/b53_common.c
|
||||
@@ -2302,7 +2302,7 @@ static const struct b53_chip_data b53_sw
|
||||
.chip_id = BCM5325_DEVICE_ID,
|
||||
.dev_name = "BCM5325",
|
||||
.vlans = 16,
|
||||
- .enabled_ports = 0x1f,
|
||||
+ .enabled_ports = 0x3f,
|
||||
.arl_bins = 2,
|
||||
.arl_buckets = 1024,
|
||||
.imp_port = 5,
|
||||
@@ -2313,7 +2313,7 @@ static const struct b53_chip_data b53_sw
|
||||
.chip_id = BCM5365_DEVICE_ID,
|
||||
.dev_name = "BCM5365",
|
||||
.vlans = 256,
|
||||
- .enabled_ports = 0x1f,
|
||||
+ .enabled_ports = 0x3f,
|
||||
.arl_bins = 2,
|
||||
.arl_buckets = 1024,
|
||||
.imp_port = 5,
|
||||
@@ -2324,7 +2324,7 @@ static const struct b53_chip_data b53_sw
|
||||
.chip_id = BCM5389_DEVICE_ID,
|
||||
.dev_name = "BCM5389",
|
||||
.vlans = 4096,
|
||||
- .enabled_ports = 0x1f,
|
||||
+ .enabled_ports = 0x11f,
|
||||
.arl_bins = 4,
|
||||
.arl_buckets = 1024,
|
||||
.imp_port = 8,
|
||||
@@ -2338,7 +2338,7 @@ static const struct b53_chip_data b53_sw
|
||||
.chip_id = BCM5395_DEVICE_ID,
|
||||
.dev_name = "BCM5395",
|
||||
.vlans = 4096,
|
||||
- .enabled_ports = 0x1f,
|
||||
+ .enabled_ports = 0x11f,
|
||||
.arl_bins = 4,
|
||||
.arl_buckets = 1024,
|
||||
.imp_port = 8,
|
||||
@@ -2352,7 +2352,7 @@ static const struct b53_chip_data b53_sw
|
||||
.chip_id = BCM5397_DEVICE_ID,
|
||||
.dev_name = "BCM5397",
|
||||
.vlans = 4096,
|
||||
- .enabled_ports = 0x1f,
|
||||
+ .enabled_ports = 0x11f,
|
||||
.arl_bins = 4,
|
||||
.arl_buckets = 1024,
|
||||
.imp_port = 8,
|
||||
@@ -2366,7 +2366,7 @@ static const struct b53_chip_data b53_sw
|
||||
.chip_id = BCM5398_DEVICE_ID,
|
||||
.dev_name = "BCM5398",
|
||||
.vlans = 4096,
|
||||
- .enabled_ports = 0x7f,
|
||||
+ .enabled_ports = 0x17f,
|
||||
.arl_bins = 4,
|
||||
.arl_buckets = 1024,
|
||||
.imp_port = 8,
|
||||
@@ -2380,7 +2380,7 @@ static const struct b53_chip_data b53_sw
|
||||
.chip_id = BCM53115_DEVICE_ID,
|
||||
.dev_name = "BCM53115",
|
||||
.vlans = 4096,
|
||||
- .enabled_ports = 0x1f,
|
||||
+ .enabled_ports = 0x11f,
|
||||
.arl_bins = 4,
|
||||
.arl_buckets = 1024,
|
||||
.vta_regs = B53_VTA_REGS,
|
||||
@@ -2394,7 +2394,7 @@ static const struct b53_chip_data b53_sw
|
||||
.chip_id = BCM53125_DEVICE_ID,
|
||||
.dev_name = "BCM53125",
|
||||
.vlans = 4096,
|
||||
- .enabled_ports = 0xff,
|
||||
+ .enabled_ports = 0x1ff,
|
||||
.arl_bins = 4,
|
||||
.arl_buckets = 1024,
|
||||
.imp_port = 8,
|
||||
@@ -2436,7 +2436,7 @@ static const struct b53_chip_data b53_sw
|
||||
.chip_id = BCM53010_DEVICE_ID,
|
||||
.dev_name = "BCM53010",
|
||||
.vlans = 4096,
|
||||
- .enabled_ports = 0x1f,
|
||||
+ .enabled_ports = 0x1bf,
|
||||
.arl_bins = 4,
|
||||
.arl_buckets = 1024,
|
||||
.imp_port = 8,
|
||||
@@ -2478,7 +2478,7 @@ static const struct b53_chip_data b53_sw
|
||||
.chip_id = BCM53018_DEVICE_ID,
|
||||
.dev_name = "BCM53018",
|
||||
.vlans = 4096,
|
||||
- .enabled_ports = 0x1f,
|
||||
+ .enabled_ports = 0x1bf,
|
||||
.arl_bins = 4,
|
||||
.arl_buckets = 1024,
|
||||
.imp_port = 8,
|
||||
@@ -2492,7 +2492,7 @@ static const struct b53_chip_data b53_sw
|
||||
.chip_id = BCM53019_DEVICE_ID,
|
||||
.dev_name = "BCM53019",
|
||||
.vlans = 4096,
|
||||
- .enabled_ports = 0x1f,
|
||||
+ .enabled_ports = 0x1bf,
|
||||
.arl_bins = 4,
|
||||
.arl_buckets = 1024,
|
||||
.imp_port = 8,
|
||||
@@ -2634,7 +2634,6 @@ static int b53_switch_init(struct b53_de
|
||||
dev->cpu_port = 5;
|
||||
}
|
||||
|
||||
- dev->enabled_ports |= BIT(dev->cpu_port);
|
||||
dev->num_ports = fls(dev->enabled_ports);
|
||||
|
||||
dev->ds->num_ports = min_t(unsigned int, dev->num_ports, DSA_MAX_PORTS);
|
|
@ -0,0 +1,42 @@
|
|||
From b290c6384afabbca5ae6e2af72fb1b2bc37922be Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
|
||||
Date: Thu, 16 Sep 2021 14:03:52 +0200
|
||||
Subject: [PATCH] net: dsa: b53: Drop BCM5301x workaround for a wrong CPU/IMP
|
||||
port
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
On BCM5301x port 8 requires a fixed link when used.
|
||||
|
||||
Years ago when b53 was an OpenWrt downstream driver (with configuration
|
||||
based on sometimes bugged NVRAM) there was a need for a fixup. In case
|
||||
of forcing fixed link for (incorrectly specified) port 5 the code had to
|
||||
actually setup port 8 link.
|
||||
|
||||
For upstream b53 driver with setup based on DT there is no need for that
|
||||
workaround. In DT we have and require correct ports setup.
|
||||
|
||||
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
|
||||
Tested-by: Florian Fainelli <f.fainelli@gmail.com>
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/dsa/b53/b53_common.c | 6 ------
|
||||
1 file changed, 6 deletions(-)
|
||||
|
||||
--- a/drivers/net/dsa/b53/b53_common.c
|
||||
+++ b/drivers/net/dsa/b53/b53_common.c
|
||||
@@ -1291,12 +1291,6 @@ static void b53_adjust_link(struct dsa_s
|
||||
return;
|
||||
}
|
||||
}
|
||||
- } else if (is5301x(dev)) {
|
||||
- if (port != dev->cpu_port) {
|
||||
- b53_force_port_config(dev, dev->cpu_port, 2000,
|
||||
- DUPLEX_FULL, true, true);
|
||||
- b53_force_link(dev, dev->cpu_port, 1);
|
||||
- }
|
||||
}
|
||||
|
||||
/* Re-negotiate EEE if it was enabled already */
|
|
@ -0,0 +1,32 @@
|
|||
From 3ff26b29230c54fea2353b63124c589b61953e14 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
|
||||
Date: Thu, 16 Sep 2021 14:03:53 +0200
|
||||
Subject: [PATCH] net: dsa: b53: Improve flow control setup on BCM5301x
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
According to the Broadcom's reference driver flow control needs to be
|
||||
enabled for any CPU switch port (5, 7 or 8 - depending on which one is
|
||||
used). Current code makes it work only for the port 5. Use
|
||||
dsa_is_cpu_port() which solved that problem.
|
||||
|
||||
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
|
||||
Tested-by: Florian Fainelli <f.fainelli@gmail.com>
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/dsa/b53/b53_common.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/drivers/net/dsa/b53/b53_common.c
|
||||
+++ b/drivers/net/dsa/b53/b53_common.c
|
||||
@@ -1222,7 +1222,7 @@ static void b53_adjust_link(struct dsa_s
|
||||
return;
|
||||
|
||||
/* Enable flow control on BCM5301x's CPU port */
|
||||
- if (is5301x(dev) && port == dev->cpu_port)
|
||||
+ if (is5301x(dev) && dsa_is_cpu_port(ds, port))
|
||||
tx_pause = rx_pause = true;
|
||||
|
||||
if (phydev->pause) {
|
|
@ -0,0 +1,205 @@
|
|||
From 7d5af56418d7d01e43247a33b6fe6492ea871923 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
|
||||
Date: Thu, 16 Sep 2021 14:03:54 +0200
|
||||
Subject: [PATCH] net: dsa: b53: Drop unused "cpu_port" field
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
It's set but never used anymore.
|
||||
|
||||
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
|
||||
Tested-by: Florian Fainelli <f.fainelli@gmail.com>
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/dsa/b53/b53_common.c | 28 ----------------------------
|
||||
drivers/net/dsa/b53/b53_priv.h | 1 -
|
||||
2 files changed, 29 deletions(-)
|
||||
|
||||
--- a/drivers/net/dsa/b53/b53_common.c
|
||||
+++ b/drivers/net/dsa/b53/b53_common.c
|
||||
@@ -2300,7 +2300,6 @@ static const struct b53_chip_data b53_sw
|
||||
.arl_bins = 2,
|
||||
.arl_buckets = 1024,
|
||||
.imp_port = 5,
|
||||
- .cpu_port = B53_CPU_PORT_25,
|
||||
.duplex_reg = B53_DUPLEX_STAT_FE,
|
||||
},
|
||||
{
|
||||
@@ -2311,7 +2310,6 @@ static const struct b53_chip_data b53_sw
|
||||
.arl_bins = 2,
|
||||
.arl_buckets = 1024,
|
||||
.imp_port = 5,
|
||||
- .cpu_port = B53_CPU_PORT_25,
|
||||
.duplex_reg = B53_DUPLEX_STAT_FE,
|
||||
},
|
||||
{
|
||||
@@ -2322,7 +2320,6 @@ static const struct b53_chip_data b53_sw
|
||||
.arl_bins = 4,
|
||||
.arl_buckets = 1024,
|
||||
.imp_port = 8,
|
||||
- .cpu_port = B53_CPU_PORT,
|
||||
.vta_regs = B53_VTA_REGS,
|
||||
.duplex_reg = B53_DUPLEX_STAT_GE,
|
||||
.jumbo_pm_reg = B53_JUMBO_PORT_MASK,
|
||||
@@ -2336,7 +2333,6 @@ static const struct b53_chip_data b53_sw
|
||||
.arl_bins = 4,
|
||||
.arl_buckets = 1024,
|
||||
.imp_port = 8,
|
||||
- .cpu_port = B53_CPU_PORT,
|
||||
.vta_regs = B53_VTA_REGS,
|
||||
.duplex_reg = B53_DUPLEX_STAT_GE,
|
||||
.jumbo_pm_reg = B53_JUMBO_PORT_MASK,
|
||||
@@ -2350,7 +2346,6 @@ static const struct b53_chip_data b53_sw
|
||||
.arl_bins = 4,
|
||||
.arl_buckets = 1024,
|
||||
.imp_port = 8,
|
||||
- .cpu_port = B53_CPU_PORT,
|
||||
.vta_regs = B53_VTA_REGS_9798,
|
||||
.duplex_reg = B53_DUPLEX_STAT_GE,
|
||||
.jumbo_pm_reg = B53_JUMBO_PORT_MASK,
|
||||
@@ -2364,7 +2359,6 @@ static const struct b53_chip_data b53_sw
|
||||
.arl_bins = 4,
|
||||
.arl_buckets = 1024,
|
||||
.imp_port = 8,
|
||||
- .cpu_port = B53_CPU_PORT,
|
||||
.vta_regs = B53_VTA_REGS_9798,
|
||||
.duplex_reg = B53_DUPLEX_STAT_GE,
|
||||
.jumbo_pm_reg = B53_JUMBO_PORT_MASK,
|
||||
@@ -2379,7 +2373,6 @@ static const struct b53_chip_data b53_sw
|
||||
.arl_buckets = 1024,
|
||||
.vta_regs = B53_VTA_REGS,
|
||||
.imp_port = 8,
|
||||
- .cpu_port = B53_CPU_PORT,
|
||||
.duplex_reg = B53_DUPLEX_STAT_GE,
|
||||
.jumbo_pm_reg = B53_JUMBO_PORT_MASK,
|
||||
.jumbo_size_reg = B53_JUMBO_MAX_SIZE,
|
||||
@@ -2392,7 +2385,6 @@ static const struct b53_chip_data b53_sw
|
||||
.arl_bins = 4,
|
||||
.arl_buckets = 1024,
|
||||
.imp_port = 8,
|
||||
- .cpu_port = B53_CPU_PORT,
|
||||
.vta_regs = B53_VTA_REGS,
|
||||
.duplex_reg = B53_DUPLEX_STAT_GE,
|
||||
.jumbo_pm_reg = B53_JUMBO_PORT_MASK,
|
||||
@@ -2406,7 +2398,6 @@ static const struct b53_chip_data b53_sw
|
||||
.arl_bins = 4,
|
||||
.arl_buckets = 1024,
|
||||
.imp_port = 8,
|
||||
- .cpu_port = B53_CPU_PORT,
|
||||
.vta_regs = B53_VTA_REGS,
|
||||
.duplex_reg = B53_DUPLEX_STAT_GE,
|
||||
.jumbo_pm_reg = B53_JUMBO_PORT_MASK,
|
||||
@@ -2420,7 +2411,6 @@ static const struct b53_chip_data b53_sw
|
||||
.arl_bins = 4,
|
||||
.arl_buckets = 1024,
|
||||
.imp_port = 8,
|
||||
- .cpu_port = B53_CPU_PORT,
|
||||
.vta_regs = B53_VTA_REGS_63XX,
|
||||
.duplex_reg = B53_DUPLEX_STAT_63XX,
|
||||
.jumbo_pm_reg = B53_JUMBO_PORT_MASK_63XX,
|
||||
@@ -2434,7 +2424,6 @@ static const struct b53_chip_data b53_sw
|
||||
.arl_bins = 4,
|
||||
.arl_buckets = 1024,
|
||||
.imp_port = 8,
|
||||
- .cpu_port = B53_CPU_PORT_25, /* TODO: auto detect */
|
||||
.vta_regs = B53_VTA_REGS,
|
||||
.duplex_reg = B53_DUPLEX_STAT_GE,
|
||||
.jumbo_pm_reg = B53_JUMBO_PORT_MASK,
|
||||
@@ -2448,7 +2437,6 @@ static const struct b53_chip_data b53_sw
|
||||
.arl_bins = 4,
|
||||
.arl_buckets = 1024,
|
||||
.imp_port = 8,
|
||||
- .cpu_port = B53_CPU_PORT_25, /* TODO: auto detect */
|
||||
.vta_regs = B53_VTA_REGS,
|
||||
.duplex_reg = B53_DUPLEX_STAT_GE,
|
||||
.jumbo_pm_reg = B53_JUMBO_PORT_MASK,
|
||||
@@ -2462,7 +2450,6 @@ static const struct b53_chip_data b53_sw
|
||||
.arl_bins = 4,
|
||||
.arl_buckets = 1024,
|
||||
.imp_port = 8,
|
||||
- .cpu_port = B53_CPU_PORT_25, /* TODO: auto detect */
|
||||
.vta_regs = B53_VTA_REGS,
|
||||
.duplex_reg = B53_DUPLEX_STAT_GE,
|
||||
.jumbo_pm_reg = B53_JUMBO_PORT_MASK,
|
||||
@@ -2476,7 +2463,6 @@ static const struct b53_chip_data b53_sw
|
||||
.arl_bins = 4,
|
||||
.arl_buckets = 1024,
|
||||
.imp_port = 8,
|
||||
- .cpu_port = B53_CPU_PORT_25, /* TODO: auto detect */
|
||||
.vta_regs = B53_VTA_REGS,
|
||||
.duplex_reg = B53_DUPLEX_STAT_GE,
|
||||
.jumbo_pm_reg = B53_JUMBO_PORT_MASK,
|
||||
@@ -2490,7 +2476,6 @@ static const struct b53_chip_data b53_sw
|
||||
.arl_bins = 4,
|
||||
.arl_buckets = 1024,
|
||||
.imp_port = 8,
|
||||
- .cpu_port = B53_CPU_PORT_25, /* TODO: auto detect */
|
||||
.vta_regs = B53_VTA_REGS,
|
||||
.duplex_reg = B53_DUPLEX_STAT_GE,
|
||||
.jumbo_pm_reg = B53_JUMBO_PORT_MASK,
|
||||
@@ -2504,7 +2489,6 @@ static const struct b53_chip_data b53_sw
|
||||
.arl_bins = 4,
|
||||
.arl_buckets = 1024,
|
||||
.imp_port = 8,
|
||||
- .cpu_port = B53_CPU_PORT,
|
||||
.vta_regs = B53_VTA_REGS,
|
||||
.duplex_reg = B53_DUPLEX_STAT_GE,
|
||||
.jumbo_pm_reg = B53_JUMBO_PORT_MASK,
|
||||
@@ -2518,7 +2502,6 @@ static const struct b53_chip_data b53_sw
|
||||
.arl_bins = 4,
|
||||
.arl_buckets = 1024,
|
||||
.imp_port = 8,
|
||||
- .cpu_port = B53_CPU_PORT,
|
||||
.vta_regs = B53_VTA_REGS,
|
||||
.duplex_reg = B53_DUPLEX_STAT_GE,
|
||||
.jumbo_pm_reg = B53_JUMBO_PORT_MASK,
|
||||
@@ -2547,7 +2530,6 @@ static const struct b53_chip_data b53_sw
|
||||
.arl_bins = 4,
|
||||
.arl_buckets = 1024,
|
||||
.imp_port = 8,
|
||||
- .cpu_port = B53_CPU_PORT,
|
||||
.vta_regs = B53_VTA_REGS,
|
||||
.duplex_reg = B53_DUPLEX_STAT_GE,
|
||||
.jumbo_pm_reg = B53_JUMBO_PORT_MASK,
|
||||
@@ -2561,7 +2543,6 @@ static const struct b53_chip_data b53_sw
|
||||
.arl_bins = 4,
|
||||
.arl_buckets = 256,
|
||||
.imp_port = 8,
|
||||
- .cpu_port = B53_CPU_PORT,
|
||||
.vta_regs = B53_VTA_REGS,
|
||||
.duplex_reg = B53_DUPLEX_STAT_GE,
|
||||
.jumbo_pm_reg = B53_JUMBO_PORT_MASK,
|
||||
@@ -2587,7 +2568,6 @@ static int b53_switch_init(struct b53_de
|
||||
dev->vta_regs[2] = chip->vta_regs[2];
|
||||
dev->jumbo_pm_reg = chip->jumbo_pm_reg;
|
||||
dev->imp_port = chip->imp_port;
|
||||
- dev->cpu_port = chip->cpu_port;
|
||||
dev->num_vlans = chip->vlans;
|
||||
dev->num_arl_bins = chip->arl_bins;
|
||||
dev->num_arl_buckets = chip->arl_buckets;
|
||||
@@ -2619,13 +2599,6 @@ static int b53_switch_init(struct b53_de
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
- } else if (dev->chip_id == BCM53115_DEVICE_ID) {
|
||||
- u64 strap_value;
|
||||
-
|
||||
- b53_read48(dev, B53_STAT_PAGE, B53_STRAP_VALUE, &strap_value);
|
||||
- /* use second IMP port if GMII is enabled */
|
||||
- if (strap_value & SV_GMII_CTRL_115)
|
||||
- dev->cpu_port = 5;
|
||||
}
|
||||
|
||||
dev->num_ports = fls(dev->enabled_ports);
|
||||
--- a/drivers/net/dsa/b53/b53_priv.h
|
||||
+++ b/drivers/net/dsa/b53/b53_priv.h
|
||||
@@ -124,7 +124,6 @@ struct b53_device {
|
||||
/* used ports mask */
|
||||
u16 enabled_ports;
|
||||
unsigned int imp_port;
|
||||
- unsigned int cpu_port;
|
||||
|
||||
/* connect specific data */
|
||||
u8 current_page;
|
|
@ -0,0 +1,65 @@
|
|||
From b4df02b562f4aa14ff6811f30e1b4d2159585c59 Mon Sep 17 00:00:00 2001
|
||||
From: Ansuel Smith <ansuelsmth@gmail.com>
|
||||
Date: Sun, 19 Sep 2021 18:28:15 +0200
|
||||
Subject: net: phy: at803x: add support for qca 8327 A variant internal phy
|
||||
|
||||
For qca8327 internal phy there are 2 different switch variant with 2
|
||||
different phy id. Add this missing variant so the internal phy can be
|
||||
correctly identified and fixed.
|
||||
|
||||
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
|
||||
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
---
|
||||
drivers/net/phy/at803x.c | 25 ++++++++++++++++++++-----
|
||||
1 file changed, 20 insertions(+), 5 deletions(-)
|
||||
|
||||
--- a/drivers/net/phy/at803x.c
|
||||
+++ b/drivers/net/phy/at803x.c
|
||||
@@ -150,7 +150,8 @@
|
||||
#define ATH8035_PHY_ID 0x004dd072
|
||||
#define AT8030_PHY_ID_MASK 0xffffffef
|
||||
|
||||
-#define QCA8327_PHY_ID 0x004dd034
|
||||
+#define QCA8327_A_PHY_ID 0x004dd033
|
||||
+#define QCA8327_B_PHY_ID 0x004dd034
|
||||
#define QCA8337_PHY_ID 0x004dd036
|
||||
#define QCA8K_PHY_ID_MASK 0xffffffff
|
||||
|
||||
@@ -1421,10 +1422,23 @@ static struct phy_driver at803x_driver[]
|
||||
.get_strings = at803x_get_strings,
|
||||
.get_stats = at803x_get_stats,
|
||||
}, {
|
||||
- /* QCA8327 */
|
||||
- .phy_id = QCA8327_PHY_ID,
|
||||
+ /* QCA8327-A from switch QCA8327-AL1A */
|
||||
+ .phy_id = QCA8327_A_PHY_ID,
|
||||
.phy_id_mask = QCA8K_PHY_ID_MASK,
|
||||
- .name = "QCA PHY 8327",
|
||||
+ .name = "QCA PHY 8327-A",
|
||||
+ /* PHY_GBIT_FEATURES */
|
||||
+ .probe = at803x_probe,
|
||||
+ .flags = PHY_IS_INTERNAL,
|
||||
+ .config_init = qca83xx_config_init,
|
||||
+ .soft_reset = genphy_soft_reset,
|
||||
+ .get_sset_count = at803x_get_sset_count,
|
||||
+ .get_strings = at803x_get_strings,
|
||||
+ .get_stats = at803x_get_stats,
|
||||
+}, {
|
||||
+ /* QCA8327-B from switch QCA8327-BL1A */
|
||||
+ .phy_id = QCA8327_B_PHY_ID,
|
||||
+ .phy_id_mask = QCA8K_PHY_ID_MASK,
|
||||
+ .name = "QCA PHY 8327-B",
|
||||
/* PHY_GBIT_FEATURES */
|
||||
.probe = at803x_probe,
|
||||
.flags = PHY_IS_INTERNAL,
|
||||
@@ -1444,7 +1458,8 @@ static struct mdio_device_id __maybe_unu
|
||||
{ PHY_ID_MATCH_EXACT(ATH8035_PHY_ID) },
|
||||
{ PHY_ID_MATCH_EXACT(ATH9331_PHY_ID) },
|
||||
{ PHY_ID_MATCH_EXACT(QCA8337_PHY_ID) },
|
||||
- { PHY_ID_MATCH_EXACT(QCA8327_PHY_ID) },
|
||||
+ { PHY_ID_MATCH_EXACT(QCA8327_A_PHY_ID) },
|
||||
+ { PHY_ID_MATCH_EXACT(QCA8327_B_PHY_ID) },
|
||||
{ }
|
||||
};
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
From 15b9df4ece17d084f14eb0ca1cf05f2ad497e425 Mon Sep 17 00:00:00 2001
|
||||
From: Ansuel Smith <ansuelsmth@gmail.com>
|
||||
Date: Sun, 19 Sep 2021 18:28:16 +0200
|
||||
Subject: net: phy: at803x: add resume/suspend function to qca83xx phy
|
||||
|
||||
Add resume/suspend function to qca83xx internal phy.
|
||||
We can't use the at803x generic function as the documentation lacks of
|
||||
any support for WoL regs.
|
||||
|
||||
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
|
||||
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
---
|
||||
drivers/net/phy/at803x.c | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
--- a/drivers/net/phy/at803x.c
|
||||
+++ b/drivers/net/phy/at803x.c
|
||||
@@ -1421,6 +1421,8 @@ static struct phy_driver at803x_driver[]
|
||||
.get_sset_count = at803x_get_sset_count,
|
||||
.get_strings = at803x_get_strings,
|
||||
.get_stats = at803x_get_stats,
|
||||
+ .suspend = genphy_suspend,
|
||||
+ .resume = genphy_resume,
|
||||
}, {
|
||||
/* QCA8327-A from switch QCA8327-AL1A */
|
||||
.phy_id = QCA8327_A_PHY_ID,
|
||||
@@ -1434,6 +1436,8 @@ static struct phy_driver at803x_driver[]
|
||||
.get_sset_count = at803x_get_sset_count,
|
||||
.get_strings = at803x_get_strings,
|
||||
.get_stats = at803x_get_stats,
|
||||
+ .suspend = genphy_suspend,
|
||||
+ .resume = genphy_resume,
|
||||
}, {
|
||||
/* QCA8327-B from switch QCA8327-BL1A */
|
||||
.phy_id = QCA8327_B_PHY_ID,
|
||||
@@ -1447,6 +1451,8 @@ static struct phy_driver at803x_driver[]
|
||||
.get_sset_count = at803x_get_sset_count,
|
||||
.get_strings = at803x_get_strings,
|
||||
.get_stats = at803x_get_stats,
|
||||
+ .suspend = genphy_suspend,
|
||||
+ .resume = genphy_resume,
|
||||
}, };
|
||||
|
||||
module_phy_driver(at803x_driver);
|
|
@ -0,0 +1,95 @@
|
|||
From d44fd8604a4ab92119adb35f05fd87612af722b5 Mon Sep 17 00:00:00 2001
|
||||
From: Ansuel Smith <ansuelsmth@gmail.com>
|
||||
Date: Sun, 19 Sep 2021 18:28:17 +0200
|
||||
Subject: net: phy: at803x: fix spacing and improve name for 83xx phy
|
||||
|
||||
Fix spacing and improve name for 83xx phy following other phy in the
|
||||
same driver.
|
||||
|
||||
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
|
||||
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
---
|
||||
drivers/net/phy/at803x.c | 60 ++++++++++++++++++++++++------------------------
|
||||
1 file changed, 30 insertions(+), 30 deletions(-)
|
||||
|
||||
--- a/drivers/net/phy/at803x.c
|
||||
+++ b/drivers/net/phy/at803x.c
|
||||
@@ -1410,47 +1410,47 @@ static struct phy_driver at803x_driver[]
|
||||
.config_aneg = at803x_config_aneg,
|
||||
}, {
|
||||
/* QCA8337 */
|
||||
- .phy_id = QCA8337_PHY_ID,
|
||||
- .phy_id_mask = QCA8K_PHY_ID_MASK,
|
||||
- .name = "QCA PHY 8337",
|
||||
+ .phy_id = QCA8337_PHY_ID,
|
||||
+ .phy_id_mask = QCA8K_PHY_ID_MASK,
|
||||
+ .name = "Qualcomm Atheros 8337 internal PHY",
|
||||
/* PHY_GBIT_FEATURES */
|
||||
- .probe = at803x_probe,
|
||||
- .flags = PHY_IS_INTERNAL,
|
||||
- .config_init = qca83xx_config_init,
|
||||
- .soft_reset = genphy_soft_reset,
|
||||
- .get_sset_count = at803x_get_sset_count,
|
||||
- .get_strings = at803x_get_strings,
|
||||
- .get_stats = at803x_get_stats,
|
||||
+ .probe = at803x_probe,
|
||||
+ .flags = PHY_IS_INTERNAL,
|
||||
+ .config_init = qca83xx_config_init,
|
||||
+ .soft_reset = genphy_soft_reset,
|
||||
+ .get_sset_count = at803x_get_sset_count,
|
||||
+ .get_strings = at803x_get_strings,
|
||||
+ .get_stats = at803x_get_stats,
|
||||
.suspend = genphy_suspend,
|
||||
.resume = genphy_resume,
|
||||
}, {
|
||||
/* QCA8327-A from switch QCA8327-AL1A */
|
||||
- .phy_id = QCA8327_A_PHY_ID,
|
||||
- .phy_id_mask = QCA8K_PHY_ID_MASK,
|
||||
- .name = "QCA PHY 8327-A",
|
||||
+ .phy_id = QCA8327_A_PHY_ID,
|
||||
+ .phy_id_mask = QCA8K_PHY_ID_MASK,
|
||||
+ .name = "Qualcomm Atheros 8327-A internal PHY",
|
||||
/* PHY_GBIT_FEATURES */
|
||||
- .probe = at803x_probe,
|
||||
- .flags = PHY_IS_INTERNAL,
|
||||
- .config_init = qca83xx_config_init,
|
||||
- .soft_reset = genphy_soft_reset,
|
||||
- .get_sset_count = at803x_get_sset_count,
|
||||
- .get_strings = at803x_get_strings,
|
||||
- .get_stats = at803x_get_stats,
|
||||
+ .probe = at803x_probe,
|
||||
+ .flags = PHY_IS_INTERNAL,
|
||||
+ .config_init = qca83xx_config_init,
|
||||
+ .soft_reset = genphy_soft_reset,
|
||||
+ .get_sset_count = at803x_get_sset_count,
|
||||
+ .get_strings = at803x_get_strings,
|
||||
+ .get_stats = at803x_get_stats,
|
||||
.suspend = genphy_suspend,
|
||||
.resume = genphy_resume,
|
||||
}, {
|
||||
/* QCA8327-B from switch QCA8327-BL1A */
|
||||
- .phy_id = QCA8327_B_PHY_ID,
|
||||
- .phy_id_mask = QCA8K_PHY_ID_MASK,
|
||||
- .name = "QCA PHY 8327-B",
|
||||
+ .phy_id = QCA8327_B_PHY_ID,
|
||||
+ .phy_id_mask = QCA8K_PHY_ID_MASK,
|
||||
+ .name = "Qualcomm Atheros 8327-B internal PHY",
|
||||
/* PHY_GBIT_FEATURES */
|
||||
- .probe = at803x_probe,
|
||||
- .flags = PHY_IS_INTERNAL,
|
||||
- .config_init = qca83xx_config_init,
|
||||
- .soft_reset = genphy_soft_reset,
|
||||
- .get_sset_count = at803x_get_sset_count,
|
||||
- .get_strings = at803x_get_strings,
|
||||
- .get_stats = at803x_get_stats,
|
||||
+ .probe = at803x_probe,
|
||||
+ .flags = PHY_IS_INTERNAL,
|
||||
+ .config_init = qca83xx_config_init,
|
||||
+ .soft_reset = genphy_soft_reset,
|
||||
+ .get_sset_count = at803x_get_sset_count,
|
||||
+ .get_strings = at803x_get_strings,
|
||||
+ .get_stats = at803x_get_stats,
|
||||
.suspend = genphy_suspend,
|
||||
.resume = genphy_resume,
|
||||
}, };
|
|
@ -0,0 +1,131 @@
|
|||
From ba3c01ee02ed0d821c9f241f179bbc9457542b8f Mon Sep 17 00:00:00 2001
|
||||
From: Ansuel Smith <ansuelsmth@gmail.com>
|
||||
Date: Sun, 10 Oct 2021 00:46:15 +0200
|
||||
Subject: net: phy: at803x: fix resume for QCA8327 phy
|
||||
|
||||
From Documentation phy resume triggers phy reset and restart
|
||||
auto-negotiation. Add a dedicated function to wait reset to finish as
|
||||
it was notice a regression where port sometime are not reliable after a
|
||||
suspend/resume session. The reset wait logic is copied from phy_poll_reset.
|
||||
Add dedicated suspend function to use genphy_suspend only with QCA8337
|
||||
phy and set only additional debug settings for QCA8327. With more test
|
||||
it was reported that QCA8327 doesn't proprely support this mode and
|
||||
using this cause the unreliability of the switch ports, especially the
|
||||
malfunction of the port0.
|
||||
|
||||
Fixes: 15b9df4ece17 ("net: phy: at803x: add resume/suspend function to qca83xx phy")
|
||||
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
---
|
||||
drivers/net/phy/at803x.c | 69 +++++++++++++++++++++++++++++++++++++++++++-----
|
||||
1 file changed, 63 insertions(+), 6 deletions(-)
|
||||
|
||||
--- a/drivers/net/phy/at803x.c
|
||||
+++ b/drivers/net/phy/at803x.c
|
||||
@@ -92,9 +92,14 @@
|
||||
#define AT803X_DEBUG_REG_5 0x05
|
||||
#define AT803X_DEBUG_TX_CLK_DLY_EN BIT(8)
|
||||
|
||||
+#define AT803X_DEBUG_REG_HIB_CTRL 0x0b
|
||||
+#define AT803X_DEBUG_HIB_CTRL_SEL_RST_80U BIT(10)
|
||||
+#define AT803X_DEBUG_HIB_CTRL_EN_ANY_CHANGE BIT(13)
|
||||
+
|
||||
#define AT803X_DEBUG_REG_3C 0x3C
|
||||
|
||||
#define AT803X_DEBUG_REG_3D 0x3D
|
||||
+#define AT803X_DEBUG_GATE_CLK_IN1000 BIT(6)
|
||||
|
||||
#define AT803X_DEBUG_REG_1F 0x1F
|
||||
#define AT803X_DEBUG_PLL_ON BIT(2)
|
||||
@@ -1312,6 +1317,58 @@ static int qca83xx_config_init(struct ph
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static int qca83xx_resume(struct phy_device *phydev)
|
||||
+{
|
||||
+ int ret, val;
|
||||
+
|
||||
+ /* Skip reset if not suspended */
|
||||
+ if (!phydev->suspended)
|
||||
+ return 0;
|
||||
+
|
||||
+ /* Reinit the port, reset values set by suspend */
|
||||
+ qca83xx_config_init(phydev);
|
||||
+
|
||||
+ /* Reset the port on port resume */
|
||||
+ phy_set_bits(phydev, MII_BMCR, BMCR_RESET | BMCR_ANENABLE);
|
||||
+
|
||||
+ /* On resume from suspend the switch execute a reset and
|
||||
+ * restart auto-negotiation. Wait for reset to complete.
|
||||
+ */
|
||||
+ ret = phy_read_poll_timeout(phydev, MII_BMCR, val, !(val & BMCR_RESET),
|
||||
+ 50000, 600000, true);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ msleep(1);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int qca83xx_suspend(struct phy_device *phydev)
|
||||
+{
|
||||
+ u16 mask = 0;
|
||||
+
|
||||
+ /* Only QCA8337 support actual suspend.
|
||||
+ * QCA8327 cause port unreliability when phy suspend
|
||||
+ * is set.
|
||||
+ */
|
||||
+ if (phydev->drv->phy_id == QCA8337_PHY_ID) {
|
||||
+ genphy_suspend(phydev);
|
||||
+ } else {
|
||||
+ mask |= ~(BMCR_SPEED1000 | BMCR_FULLDPLX);
|
||||
+ phy_modify(phydev, MII_BMCR, mask, 0);
|
||||
+ }
|
||||
+
|
||||
+ at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_3D,
|
||||
+ AT803X_DEBUG_GATE_CLK_IN1000, 0);
|
||||
+
|
||||
+ at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_HIB_CTRL,
|
||||
+ AT803X_DEBUG_HIB_CTRL_EN_ANY_CHANGE |
|
||||
+ AT803X_DEBUG_HIB_CTRL_SEL_RST_80U, 0);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static struct phy_driver at803x_driver[] = {
|
||||
{
|
||||
/* Qualcomm Atheros AR8035 */
|
||||
@@ -1421,8 +1478,8 @@ static struct phy_driver at803x_driver[]
|
||||
.get_sset_count = at803x_get_sset_count,
|
||||
.get_strings = at803x_get_strings,
|
||||
.get_stats = at803x_get_stats,
|
||||
- .suspend = genphy_suspend,
|
||||
- .resume = genphy_resume,
|
||||
+ .suspend = qca83xx_suspend,
|
||||
+ .resume = qca83xx_resume,
|
||||
}, {
|
||||
/* QCA8327-A from switch QCA8327-AL1A */
|
||||
.phy_id = QCA8327_A_PHY_ID,
|
||||
@@ -1436,8 +1493,8 @@ static struct phy_driver at803x_driver[]
|
||||
.get_sset_count = at803x_get_sset_count,
|
||||
.get_strings = at803x_get_strings,
|
||||
.get_stats = at803x_get_stats,
|
||||
- .suspend = genphy_suspend,
|
||||
- .resume = genphy_resume,
|
||||
+ .suspend = qca83xx_suspend,
|
||||
+ .resume = qca83xx_resume,
|
||||
}, {
|
||||
/* QCA8327-B from switch QCA8327-BL1A */
|
||||
.phy_id = QCA8327_B_PHY_ID,
|
||||
@@ -1451,8 +1508,8 @@ static struct phy_driver at803x_driver[]
|
||||
.get_sset_count = at803x_get_sset_count,
|
||||
.get_strings = at803x_get_strings,
|
||||
.get_stats = at803x_get_stats,
|
||||
- .suspend = genphy_suspend,
|
||||
- .resume = genphy_resume,
|
||||
+ .suspend = qca83xx_suspend,
|
||||
+ .resume = qca83xx_resume,
|
||||
}, };
|
||||
|
||||
module_phy_driver(at803x_driver);
|
|
@ -0,0 +1,91 @@
|
|||
From 1ca8311949aec5c9447645731ef1c6bc5bd71350 Mon Sep 17 00:00:00 2001
|
||||
From: Ansuel Smith <ansuelsmth@gmail.com>
|
||||
Date: Sun, 10 Oct 2021 00:46:16 +0200
|
||||
Subject: net: phy: at803x: add DAC amplitude fix for 8327 phy
|
||||
|
||||
QCA8327 internal phy require DAC amplitude adjustement set to +6% with
|
||||
100m speed. Also add additional define to report a change of the same
|
||||
reg in QCA8337. (different scope it does set 1000m voltage)
|
||||
Add link_change_notify function to set the proper amplitude adjustement
|
||||
on PHY_RUNNING state and disable on any other state.
|
||||
|
||||
Fixes: b4df02b562f4 ("net: phy: at803x: add support for qca 8327 A variant internal phy")
|
||||
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
---
|
||||
drivers/net/phy/at803x.c | 33 +++++++++++++++++++++++++++++++++
|
||||
1 file changed, 33 insertions(+)
|
||||
|
||||
--- a/drivers/net/phy/at803x.c
|
||||
+++ b/drivers/net/phy/at803x.c
|
||||
@@ -87,6 +87,8 @@
|
||||
#define AT803X_PSSR_MR_AN_COMPLETE 0x0200
|
||||
|
||||
#define AT803X_DEBUG_REG_0 0x00
|
||||
+#define QCA8327_DEBUG_MANU_CTRL_EN BIT(2)
|
||||
+#define QCA8337_DEBUG_MANU_CTRL_EN GENMASK(3, 2)
|
||||
#define AT803X_DEBUG_RX_CLK_DLY_EN BIT(15)
|
||||
|
||||
#define AT803X_DEBUG_REG_5 0x05
|
||||
@@ -1314,9 +1316,37 @@ static int qca83xx_config_init(struct ph
|
||||
break;
|
||||
}
|
||||
|
||||
+ /* QCA8327 require DAC amplitude adjustment for 100m set to +6%.
|
||||
+ * Disable on init and enable only with 100m speed following
|
||||
+ * qca original source code.
|
||||
+ */
|
||||
+ if (phydev->drv->phy_id == QCA8327_A_PHY_ID ||
|
||||
+ phydev->drv->phy_id == QCA8327_B_PHY_ID)
|
||||
+ at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_0,
|
||||
+ QCA8327_DEBUG_MANU_CTRL_EN, 0);
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static void qca83xx_link_change_notify(struct phy_device *phydev)
|
||||
+{
|
||||
+ /* QCA8337 doesn't require DAC Amplitude adjustement */
|
||||
+ if (phydev->drv->phy_id == QCA8337_PHY_ID)
|
||||
+ return;
|
||||
+
|
||||
+ /* Set DAC Amplitude adjustment to +6% for 100m on link running */
|
||||
+ if (phydev->state == PHY_RUNNING) {
|
||||
+ if (phydev->speed == SPEED_100)
|
||||
+ at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_0,
|
||||
+ QCA8327_DEBUG_MANU_CTRL_EN,
|
||||
+ QCA8327_DEBUG_MANU_CTRL_EN);
|
||||
+ } else {
|
||||
+ /* Reset DAC Amplitude adjustment */
|
||||
+ at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_0,
|
||||
+ QCA8327_DEBUG_MANU_CTRL_EN, 0);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static int qca83xx_resume(struct phy_device *phydev)
|
||||
{
|
||||
int ret, val;
|
||||
@@ -1471,6 +1501,7 @@ static struct phy_driver at803x_driver[]
|
||||
.phy_id_mask = QCA8K_PHY_ID_MASK,
|
||||
.name = "Qualcomm Atheros 8337 internal PHY",
|
||||
/* PHY_GBIT_FEATURES */
|
||||
+ .link_change_notify = qca83xx_link_change_notify,
|
||||
.probe = at803x_probe,
|
||||
.flags = PHY_IS_INTERNAL,
|
||||
.config_init = qca83xx_config_init,
|
||||
@@ -1486,6 +1517,7 @@ static struct phy_driver at803x_driver[]
|
||||
.phy_id_mask = QCA8K_PHY_ID_MASK,
|
||||
.name = "Qualcomm Atheros 8327-A internal PHY",
|
||||
/* PHY_GBIT_FEATURES */
|
||||
+ .link_change_notify = qca83xx_link_change_notify,
|
||||
.probe = at803x_probe,
|
||||
.flags = PHY_IS_INTERNAL,
|
||||
.config_init = qca83xx_config_init,
|
||||
@@ -1501,6 +1533,7 @@ static struct phy_driver at803x_driver[]
|
||||
.phy_id_mask = QCA8K_PHY_ID_MASK,
|
||||
.name = "Qualcomm Atheros 8327-B internal PHY",
|
||||
/* PHY_GBIT_FEATURES */
|
||||
+ .link_change_notify = qca83xx_link_change_notify,
|
||||
.probe = at803x_probe,
|
||||
.flags = PHY_IS_INTERNAL,
|
||||
.config_init = qca83xx_config_init,
|
|
@ -0,0 +1,27 @@
|
|||
From 9d1c29b4028557a496be9c5eb2b4b86063700636 Mon Sep 17 00:00:00 2001
|
||||
From: Ansuel Smith <ansuelsmth@gmail.com>
|
||||
Date: Sun, 10 Oct 2021 00:46:17 +0200
|
||||
Subject: net: phy: at803x: enable prefer master for 83xx internal phy
|
||||
|
||||
From original QCA source code the port was set to prefer master as port
|
||||
type in 1000BASE-T mode. Apply the same settings also here.
|
||||
|
||||
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
|
||||
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
---
|
||||
drivers/net/phy/at803x.c | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
--- a/drivers/net/phy/at803x.c
|
||||
+++ b/drivers/net/phy/at803x.c
|
||||
@@ -1325,6 +1325,9 @@ static int qca83xx_config_init(struct ph
|
||||
at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_0,
|
||||
QCA8327_DEBUG_MANU_CTRL_EN, 0);
|
||||
|
||||
+ /* Following original QCA sourcecode set port to prefer master */
|
||||
+ phy_set_bits(phydev, MII_CTRL1000, CTL1000_PREFER_MASTER);
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,127 @@
|
|||
From 67999555ff42e91de7654488d9a7735bd9e84555 Mon Sep 17 00:00:00 2001
|
||||
From: Ansuel Smith <ansuelsmth@gmail.com>
|
||||
Date: Sun, 10 Oct 2021 00:46:18 +0200
|
||||
Subject: net: phy: at803x: better describe debug regs
|
||||
|
||||
Give a name to known debug regs from Documentation instead of using
|
||||
unknown hex values.
|
||||
|
||||
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
|
||||
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
---
|
||||
drivers/net/phy/at803x.c | 30 +++++++++++++++---------------
|
||||
1 file changed, 15 insertions(+), 15 deletions(-)
|
||||
|
||||
--- a/drivers/net/phy/at803x.c
|
||||
+++ b/drivers/net/phy/at803x.c
|
||||
@@ -86,12 +86,12 @@
|
||||
#define AT803X_PSSR 0x11 /*PHY-Specific Status Register*/
|
||||
#define AT803X_PSSR_MR_AN_COMPLETE 0x0200
|
||||
|
||||
-#define AT803X_DEBUG_REG_0 0x00
|
||||
+#define AT803X_DEBUG_ANALOG_TEST_CTRL 0x00
|
||||
#define QCA8327_DEBUG_MANU_CTRL_EN BIT(2)
|
||||
#define QCA8337_DEBUG_MANU_CTRL_EN GENMASK(3, 2)
|
||||
#define AT803X_DEBUG_RX_CLK_DLY_EN BIT(15)
|
||||
|
||||
-#define AT803X_DEBUG_REG_5 0x05
|
||||
+#define AT803X_DEBUG_SYSTEM_CTRL_MODE 0x05
|
||||
#define AT803X_DEBUG_TX_CLK_DLY_EN BIT(8)
|
||||
|
||||
#define AT803X_DEBUG_REG_HIB_CTRL 0x0b
|
||||
@@ -100,7 +100,7 @@
|
||||
|
||||
#define AT803X_DEBUG_REG_3C 0x3C
|
||||
|
||||
-#define AT803X_DEBUG_REG_3D 0x3D
|
||||
+#define AT803X_DEBUG_REG_GREEN 0x3D
|
||||
#define AT803X_DEBUG_GATE_CLK_IN1000 BIT(6)
|
||||
|
||||
#define AT803X_DEBUG_REG_1F 0x1F
|
||||
@@ -284,25 +284,25 @@ static int at803x_read_page(struct phy_d
|
||||
|
||||
static int at803x_enable_rx_delay(struct phy_device *phydev)
|
||||
{
|
||||
- return at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_0, 0,
|
||||
+ return at803x_debug_reg_mask(phydev, AT803X_DEBUG_ANALOG_TEST_CTRL, 0,
|
||||
AT803X_DEBUG_RX_CLK_DLY_EN);
|
||||
}
|
||||
|
||||
static int at803x_enable_tx_delay(struct phy_device *phydev)
|
||||
{
|
||||
- return at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_5, 0,
|
||||
+ return at803x_debug_reg_mask(phydev, AT803X_DEBUG_SYSTEM_CTRL_MODE, 0,
|
||||
AT803X_DEBUG_TX_CLK_DLY_EN);
|
||||
}
|
||||
|
||||
static int at803x_disable_rx_delay(struct phy_device *phydev)
|
||||
{
|
||||
- return at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_0,
|
||||
+ return at803x_debug_reg_mask(phydev, AT803X_DEBUG_ANALOG_TEST_CTRL,
|
||||
AT803X_DEBUG_RX_CLK_DLY_EN, 0);
|
||||
}
|
||||
|
||||
static int at803x_disable_tx_delay(struct phy_device *phydev)
|
||||
{
|
||||
- return at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_5,
|
||||
+ return at803x_debug_reg_mask(phydev, AT803X_DEBUG_SYSTEM_CTRL_MODE,
|
||||
AT803X_DEBUG_TX_CLK_DLY_EN, 0);
|
||||
}
|
||||
|
||||
@@ -1300,9 +1300,9 @@ static int qca83xx_config_init(struct ph
|
||||
switch (switch_revision) {
|
||||
case 1:
|
||||
/* For 100M waveform */
|
||||
- at803x_debug_reg_write(phydev, AT803X_DEBUG_REG_0, 0x02ea);
|
||||
+ at803x_debug_reg_write(phydev, AT803X_DEBUG_ANALOG_TEST_CTRL, 0x02ea);
|
||||
/* Turn on Gigabit clock */
|
||||
- at803x_debug_reg_write(phydev, AT803X_DEBUG_REG_3D, 0x68a0);
|
||||
+ at803x_debug_reg_write(phydev, AT803X_DEBUG_REG_GREEN, 0x68a0);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
@@ -1310,8 +1310,8 @@ static int qca83xx_config_init(struct ph
|
||||
fallthrough;
|
||||
case 4:
|
||||
phy_write_mmd(phydev, MDIO_MMD_PCS, MDIO_AZ_DEBUG, 0x803f);
|
||||
- at803x_debug_reg_write(phydev, AT803X_DEBUG_REG_3D, 0x6860);
|
||||
- at803x_debug_reg_write(phydev, AT803X_DEBUG_REG_5, 0x2c46);
|
||||
+ at803x_debug_reg_write(phydev, AT803X_DEBUG_REG_GREEN, 0x6860);
|
||||
+ at803x_debug_reg_write(phydev, AT803X_DEBUG_SYSTEM_CTRL_MODE, 0x2c46);
|
||||
at803x_debug_reg_write(phydev, AT803X_DEBUG_REG_3C, 0x6000);
|
||||
break;
|
||||
}
|
||||
@@ -1322,7 +1322,7 @@ static int qca83xx_config_init(struct ph
|
||||
*/
|
||||
if (phydev->drv->phy_id == QCA8327_A_PHY_ID ||
|
||||
phydev->drv->phy_id == QCA8327_B_PHY_ID)
|
||||
- at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_0,
|
||||
+ at803x_debug_reg_mask(phydev, AT803X_DEBUG_ANALOG_TEST_CTRL,
|
||||
QCA8327_DEBUG_MANU_CTRL_EN, 0);
|
||||
|
||||
/* Following original QCA sourcecode set port to prefer master */
|
||||
@@ -1340,12 +1340,12 @@ static void qca83xx_link_change_notify(s
|
||||
/* Set DAC Amplitude adjustment to +6% for 100m on link running */
|
||||
if (phydev->state == PHY_RUNNING) {
|
||||
if (phydev->speed == SPEED_100)
|
||||
- at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_0,
|
||||
+ at803x_debug_reg_mask(phydev, AT803X_DEBUG_ANALOG_TEST_CTRL,
|
||||
QCA8327_DEBUG_MANU_CTRL_EN,
|
||||
QCA8327_DEBUG_MANU_CTRL_EN);
|
||||
} else {
|
||||
/* Reset DAC Amplitude adjustment */
|
||||
- at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_0,
|
||||
+ at803x_debug_reg_mask(phydev, AT803X_DEBUG_ANALOG_TEST_CTRL,
|
||||
QCA8327_DEBUG_MANU_CTRL_EN, 0);
|
||||
}
|
||||
}
|
||||
@@ -1392,7 +1392,7 @@ static int qca83xx_suspend(struct phy_de
|
||||
phy_modify(phydev, MII_BMCR, mask, 0);
|
||||
}
|
||||
|
||||
- at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_3D,
|
||||
+ at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_GREEN,
|
||||
AT803X_DEBUG_GATE_CLK_IN1000, 0);
|
||||
|
||||
at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_HIB_CTRL,
|
|
@ -0,0 +1,80 @@
|
|||
From d8b6f5bae6d3b648a67b6958cb98e4e97256d652 Mon Sep 17 00:00:00 2001
|
||||
From: Ansuel Smith <ansuelsmth@gmail.com>
|
||||
Date: Thu, 14 Oct 2021 00:39:06 +0200
|
||||
Subject: dsa: qca8k: add mac_power_sel support
|
||||
|
||||
Add missing mac power sel support needed for ipq8064/5 SoC that require
|
||||
1.8v for the internal regulator port instead of the default 1.5v.
|
||||
If other device needs this, consider adding a dedicated binding to
|
||||
support this.
|
||||
|
||||
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
|
||||
Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
|
||||
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
---
|
||||
drivers/net/dsa/qca8k.c | 31 +++++++++++++++++++++++++++++++
|
||||
drivers/net/dsa/qca8k.h | 5 +++++
|
||||
2 files changed, 36 insertions(+)
|
||||
|
||||
--- a/drivers/net/dsa/qca8k.c
|
||||
+++ b/drivers/net/dsa/qca8k.c
|
||||
@@ -951,6 +951,33 @@ qca8k_setup_of_rgmii_delay(struct qca8k_
|
||||
}
|
||||
|
||||
static int
|
||||
+qca8k_setup_mac_pwr_sel(struct qca8k_priv *priv)
|
||||
+{
|
||||
+ u32 mask = 0;
|
||||
+ int ret = 0;
|
||||
+
|
||||
+ /* SoC specific settings for ipq8064.
|
||||
+ * If more device require this consider adding
|
||||
+ * a dedicated binding.
|
||||
+ */
|
||||
+ if (of_machine_is_compatible("qcom,ipq8064"))
|
||||
+ mask |= QCA8K_MAC_PWR_RGMII0_1_8V;
|
||||
+
|
||||
+ /* SoC specific settings for ipq8065 */
|
||||
+ if (of_machine_is_compatible("qcom,ipq8065"))
|
||||
+ mask |= QCA8K_MAC_PWR_RGMII1_1_8V;
|
||||
+
|
||||
+ if (mask) {
|
||||
+ ret = qca8k_rmw(priv, QCA8K_REG_MAC_PWR_SEL,
|
||||
+ QCA8K_MAC_PWR_RGMII0_1_8V |
|
||||
+ QCA8K_MAC_PWR_RGMII1_1_8V,
|
||||
+ mask);
|
||||
+ }
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
qca8k_setup(struct dsa_switch *ds)
|
||||
{
|
||||
struct qca8k_priv *priv = (struct qca8k_priv *)ds->priv;
|
||||
@@ -979,6 +1006,10 @@ qca8k_setup(struct dsa_switch *ds)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
+ ret = qca8k_setup_mac_pwr_sel(priv);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
/* Enable CPU Port */
|
||||
ret = qca8k_reg_set(priv, QCA8K_REG_GLOBAL_FW_CTRL0,
|
||||
QCA8K_GLOBAL_FW_CTRL0_CPU_PORT_EN);
|
||||
--- a/drivers/net/dsa/qca8k.h
|
||||
+++ b/drivers/net/dsa/qca8k.h
|
||||
@@ -100,6 +100,11 @@
|
||||
#define QCA8K_SGMII_MODE_CTRL_PHY (1 << 22)
|
||||
#define QCA8K_SGMII_MODE_CTRL_MAC (2 << 22)
|
||||
|
||||
+/* MAC_PWR_SEL registers */
|
||||
+#define QCA8K_REG_MAC_PWR_SEL 0x0e4
|
||||
+#define QCA8K_MAC_PWR_RGMII1_1_8V BIT(18)
|
||||
+#define QCA8K_MAC_PWR_RGMII0_1_8V BIT(19)
|
||||
+
|
||||
/* EEE control registers */
|
||||
#define QCA8K_REG_EEE_CTRL 0x100
|
||||
#define QCA8K_REG_EEE_CTRL_LPI_EN(_i) ((_i + 1) * 2)
|
|
@ -0,0 +1,30 @@
|
|||
From fdbf35df9c091db9c46e57e9938e3f7a4f603a7c Mon Sep 17 00:00:00 2001
|
||||
From: Ansuel Smith <ansuelsmth@gmail.com>
|
||||
Date: Thu, 14 Oct 2021 00:39:07 +0200
|
||||
Subject: dt-bindings: net: dsa: qca8k: Add SGMII clock phase properties
|
||||
|
||||
Add names and descriptions of additional PORT0_PAD_CTRL properties.
|
||||
qca,sgmii-(rx|tx)clk-falling-edge are for setting the respective clock
|
||||
phase to failling edge.
|
||||
|
||||
Co-developed-by: Matthew Hagan <mnhagan88@gmail.com>
|
||||
Signed-off-by: Matthew Hagan <mnhagan88@gmail.com>
|
||||
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
---
|
||||
Documentation/devicetree/bindings/net/dsa/qca8k.txt | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
--- a/Documentation/devicetree/bindings/net/dsa/qca8k.txt
|
||||
+++ b/Documentation/devicetree/bindings/net/dsa/qca8k.txt
|
||||
@@ -37,6 +37,10 @@ A CPU port node has the following option
|
||||
managed entity. See
|
||||
Documentation/devicetree/bindings/net/fixed-link.txt
|
||||
for details.
|
||||
+- qca,sgmii-rxclk-falling-edge: Set the receive clock phase to falling edge.
|
||||
+ Mostly used in qca8327 with CPU port 0 set to
|
||||
+ sgmii.
|
||||
+- qca,sgmii-txclk-falling-edge: Set the transmit clock phase to falling edge.
|
||||
|
||||
For QCA8K the 'fixed-link' sub-node supports only the following properties:
|
||||
|
|
@ -0,0 +1,127 @@
|
|||
From 6c43809bf1bee76c434e365a26546a92a5fbec14 Mon Sep 17 00:00:00 2001
|
||||
From: Ansuel Smith <ansuelsmth@gmail.com>
|
||||
Date: Thu, 14 Oct 2021 00:39:08 +0200
|
||||
Subject: net: dsa: qca8k: add support for sgmii falling edge
|
||||
|
||||
Add support for this in the qca8k driver. Also add support for SGMII
|
||||
rx/tx clock falling edge. This is only present for pad0, pad5 and
|
||||
pad6 have these bit reserved from Documentation. Add a comment that this
|
||||
is hardcoded to PAD0 as qca8327/28/34/37 have an unique sgmii line and
|
||||
setting falling in port0 applies to both configuration with sgmii used
|
||||
for port0 or port6.
|
||||
|
||||
Co-developed-by: Matthew Hagan <mnhagan88@gmail.com>
|
||||
Signed-off-by: Matthew Hagan <mnhagan88@gmail.com>
|
||||
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
---
|
||||
drivers/net/dsa/qca8k.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
drivers/net/dsa/qca8k.h | 4 ++++
|
||||
2 files changed, 67 insertions(+)
|
||||
|
||||
--- a/drivers/net/dsa/qca8k.c
|
||||
+++ b/drivers/net/dsa/qca8k.c
|
||||
@@ -978,6 +978,42 @@ qca8k_setup_mac_pwr_sel(struct qca8k_pri
|
||||
}
|
||||
|
||||
static int
|
||||
+qca8k_parse_port_config(struct qca8k_priv *priv)
|
||||
+{
|
||||
+ struct device_node *port_dn;
|
||||
+ phy_interface_t mode;
|
||||
+ struct dsa_port *dp;
|
||||
+ int port, ret;
|
||||
+
|
||||
+ /* We have 2 CPU port. Check them */
|
||||
+ for (port = 0; port < QCA8K_NUM_PORTS; port++) {
|
||||
+ /* Skip every other port */
|
||||
+ if (port != 0 && port != 6)
|
||||
+ continue;
|
||||
+
|
||||
+ dp = dsa_to_port(priv->ds, port);
|
||||
+ port_dn = dp->dn;
|
||||
+
|
||||
+ if (!of_device_is_available(port_dn))
|
||||
+ continue;
|
||||
+
|
||||
+ ret = of_get_phy_mode(port_dn, &mode);
|
||||
+ if (ret)
|
||||
+ continue;
|
||||
+
|
||||
+ if (mode == PHY_INTERFACE_MODE_SGMII) {
|
||||
+ if (of_property_read_bool(port_dn, "qca,sgmii-txclk-falling-edge"))
|
||||
+ priv->sgmii_tx_clk_falling_edge = true;
|
||||
+
|
||||
+ if (of_property_read_bool(port_dn, "qca,sgmii-rxclk-falling-edge"))
|
||||
+ priv->sgmii_rx_clk_falling_edge = true;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
qca8k_setup(struct dsa_switch *ds)
|
||||
{
|
||||
struct qca8k_priv *priv = (struct qca8k_priv *)ds->priv;
|
||||
@@ -990,6 +1026,11 @@ qca8k_setup(struct dsa_switch *ds)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
+ /* Parse CPU port config to be later used in phy_link mac_config */
|
||||
+ ret = qca8k_parse_port_config(priv);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
mutex_init(&priv->reg_mutex);
|
||||
|
||||
/* Start by setting up the register mapping */
|
||||
@@ -1274,6 +1315,28 @@ qca8k_phylink_mac_config(struct dsa_swit
|
||||
}
|
||||
|
||||
qca8k_write(priv, QCA8K_REG_SGMII_CTRL, val);
|
||||
+
|
||||
+ /* For qca8327/qca8328/qca8334/qca8338 sgmii is unique and
|
||||
+ * falling edge is set writing in the PORT0 PAD reg
|
||||
+ */
|
||||
+ if (priv->switch_id == QCA8K_ID_QCA8327 ||
|
||||
+ priv->switch_id == QCA8K_ID_QCA8337)
|
||||
+ reg = QCA8K_REG_PORT0_PAD_CTRL;
|
||||
+
|
||||
+ val = 0;
|
||||
+
|
||||
+ /* SGMII Clock phase configuration */
|
||||
+ if (priv->sgmii_rx_clk_falling_edge)
|
||||
+ val |= QCA8K_PORT0_PAD_SGMII_RXCLK_FALLING_EDGE;
|
||||
+
|
||||
+ if (priv->sgmii_tx_clk_falling_edge)
|
||||
+ val |= QCA8K_PORT0_PAD_SGMII_TXCLK_FALLING_EDGE;
|
||||
+
|
||||
+ if (val)
|
||||
+ ret = qca8k_rmw(priv, reg,
|
||||
+ QCA8K_PORT0_PAD_SGMII_RXCLK_FALLING_EDGE |
|
||||
+ QCA8K_PORT0_PAD_SGMII_TXCLK_FALLING_EDGE,
|
||||
+ val);
|
||||
break;
|
||||
default:
|
||||
dev_err(ds->dev, "xMII mode %s not supported for port %d\n",
|
||||
--- a/drivers/net/dsa/qca8k.h
|
||||
+++ b/drivers/net/dsa/qca8k.h
|
||||
@@ -35,6 +35,8 @@
|
||||
#define QCA8K_MASK_CTRL_DEVICE_ID_MASK GENMASK(15, 8)
|
||||
#define QCA8K_MASK_CTRL_DEVICE_ID(x) ((x) >> 8)
|
||||
#define QCA8K_REG_PORT0_PAD_CTRL 0x004
|
||||
+#define QCA8K_PORT0_PAD_SGMII_RXCLK_FALLING_EDGE BIT(19)
|
||||
+#define QCA8K_PORT0_PAD_SGMII_TXCLK_FALLING_EDGE BIT(18)
|
||||
#define QCA8K_REG_PORT5_PAD_CTRL 0x008
|
||||
#define QCA8K_REG_PORT6_PAD_CTRL 0x00c
|
||||
#define QCA8K_PORT_PAD_RGMII_EN BIT(26)
|
||||
@@ -260,6 +262,8 @@ struct qca8k_priv {
|
||||
u8 switch_revision;
|
||||
u8 rgmii_tx_delay;
|
||||
u8 rgmii_rx_delay;
|
||||
+ bool sgmii_rx_clk_falling_edge;
|
||||
+ bool sgmii_tx_clk_falling_edge;
|
||||
bool legacy_phy_port_mapping;
|
||||
struct regmap *regmap;
|
||||
struct mii_bus *bus;
|
|
@ -0,0 +1,29 @@
|
|||
From 731d613338ec6de482053ffa3f71be2325b0f8eb Mon Sep 17 00:00:00 2001
|
||||
From: Ansuel Smith <ansuelsmth@gmail.com>
|
||||
Date: Thu, 14 Oct 2021 00:39:09 +0200
|
||||
Subject: dt-bindings: net: dsa: qca8k: Document support for CPU port 6
|
||||
|
||||
The switch now support CPU port to be set 6 instead of be hardcoded to
|
||||
0. Document support for it and describe logic selection.
|
||||
|
||||
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
---
|
||||
Documentation/devicetree/bindings/net/dsa/qca8k.txt | 6 +++++-
|
||||
1 file changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/Documentation/devicetree/bindings/net/dsa/qca8k.txt
|
||||
+++ b/Documentation/devicetree/bindings/net/dsa/qca8k.txt
|
||||
@@ -29,7 +29,11 @@ the mdio MASTER is used as communication
|
||||
Don't use mixed external and internal mdio-bus configurations, as this is
|
||||
not supported by the hardware.
|
||||
|
||||
-The CPU port of this switch is always port 0.
|
||||
+This switch support 2 CPU port. Normally and advised configuration is with
|
||||
+CPU port set to port 0. It is also possible to set the CPU port to port 6
|
||||
+if the device requires it. The driver will configure the switch to the defined
|
||||
+port. With both CPU port declared the first CPU port is selected as primary
|
||||
+and the secondary CPU ignored.
|
||||
|
||||
A CPU port node has the following optional node:
|
||||
|
|
@ -0,0 +1,153 @@
|
|||
From 3fcf734aa482487df83cf8f18608438fcf59127f Mon Sep 17 00:00:00 2001
|
||||
From: Ansuel Smith <ansuelsmth@gmail.com>
|
||||
Date: Thu, 14 Oct 2021 00:39:10 +0200
|
||||
Subject: net: dsa: qca8k: add support for cpu port 6
|
||||
|
||||
Currently CPU port is always hardcoded to port 0. This switch have 2 CPU
|
||||
ports. The original intention of this driver seems to be use the
|
||||
mac06_exchange bit to swap MAC0 with MAC6 in the strange configuration
|
||||
where device have connected only the CPU port 6. To skip the
|
||||
introduction of a new binding, rework the driver to address the
|
||||
secondary CPU port as primary and drop any reference of hardcoded port.
|
||||
With configuration of mac06 exchange, just skip the definition of port0
|
||||
and define the CPU port as a secondary. The driver will autoconfigure
|
||||
the switch to use that as the primary CPU port.
|
||||
|
||||
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
---
|
||||
drivers/net/dsa/qca8k.c | 51 ++++++++++++++++++++++++++++++++++---------------
|
||||
drivers/net/dsa/qca8k.h | 2 --
|
||||
2 files changed, 36 insertions(+), 17 deletions(-)
|
||||
|
||||
--- a/drivers/net/dsa/qca8k.c
|
||||
+++ b/drivers/net/dsa/qca8k.c
|
||||
@@ -977,6 +977,22 @@ qca8k_setup_mac_pwr_sel(struct qca8k_pri
|
||||
return ret;
|
||||
}
|
||||
|
||||
+static int qca8k_find_cpu_port(struct dsa_switch *ds)
|
||||
+{
|
||||
+ struct qca8k_priv *priv = ds->priv;
|
||||
+
|
||||
+ /* Find the connected cpu port. Valid port are 0 or 6 */
|
||||
+ if (dsa_is_cpu_port(ds, 0))
|
||||
+ return 0;
|
||||
+
|
||||
+ dev_dbg(priv->dev, "port 0 is not the CPU port. Checking port 6");
|
||||
+
|
||||
+ if (dsa_is_cpu_port(ds, 6))
|
||||
+ return 6;
|
||||
+
|
||||
+ return -EINVAL;
|
||||
+}
|
||||
+
|
||||
static int
|
||||
qca8k_parse_port_config(struct qca8k_priv *priv)
|
||||
{
|
||||
@@ -1017,13 +1033,13 @@ static int
|
||||
qca8k_setup(struct dsa_switch *ds)
|
||||
{
|
||||
struct qca8k_priv *priv = (struct qca8k_priv *)ds->priv;
|
||||
- int ret, i;
|
||||
+ int cpu_port, ret, i;
|
||||
u32 mask;
|
||||
|
||||
- /* Make sure that port 0 is the cpu port */
|
||||
- if (!dsa_is_cpu_port(ds, 0)) {
|
||||
- dev_err(priv->dev, "port 0 is not the CPU port");
|
||||
- return -EINVAL;
|
||||
+ cpu_port = qca8k_find_cpu_port(ds);
|
||||
+ if (cpu_port < 0) {
|
||||
+ dev_err(priv->dev, "No cpu port configured in both cpu port0 and port6");
|
||||
+ return cpu_port;
|
||||
}
|
||||
|
||||
/* Parse CPU port config to be later used in phy_link mac_config */
|
||||
@@ -1065,7 +1081,7 @@ qca8k_setup(struct dsa_switch *ds)
|
||||
dev_warn(priv->dev, "mib init failed");
|
||||
|
||||
/* Enable QCA header mode on the cpu port */
|
||||
- ret = qca8k_write(priv, QCA8K_REG_PORT_HDR_CTRL(QCA8K_CPU_PORT),
|
||||
+ ret = qca8k_write(priv, QCA8K_REG_PORT_HDR_CTRL(cpu_port),
|
||||
QCA8K_PORT_HDR_CTRL_ALL << QCA8K_PORT_HDR_CTRL_TX_S |
|
||||
QCA8K_PORT_HDR_CTRL_ALL << QCA8K_PORT_HDR_CTRL_RX_S);
|
||||
if (ret) {
|
||||
@@ -1087,10 +1103,10 @@ qca8k_setup(struct dsa_switch *ds)
|
||||
|
||||
/* Forward all unknown frames to CPU port for Linux processing */
|
||||
ret = qca8k_write(priv, QCA8K_REG_GLOBAL_FW_CTRL1,
|
||||
- BIT(0) << QCA8K_GLOBAL_FW_CTRL1_IGMP_DP_S |
|
||||
- BIT(0) << QCA8K_GLOBAL_FW_CTRL1_BC_DP_S |
|
||||
- BIT(0) << QCA8K_GLOBAL_FW_CTRL1_MC_DP_S |
|
||||
- BIT(0) << QCA8K_GLOBAL_FW_CTRL1_UC_DP_S);
|
||||
+ BIT(cpu_port) << QCA8K_GLOBAL_FW_CTRL1_IGMP_DP_S |
|
||||
+ BIT(cpu_port) << QCA8K_GLOBAL_FW_CTRL1_BC_DP_S |
|
||||
+ BIT(cpu_port) << QCA8K_GLOBAL_FW_CTRL1_MC_DP_S |
|
||||
+ BIT(cpu_port) << QCA8K_GLOBAL_FW_CTRL1_UC_DP_S);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
@@ -1098,7 +1114,7 @@ qca8k_setup(struct dsa_switch *ds)
|
||||
for (i = 0; i < QCA8K_NUM_PORTS; i++) {
|
||||
/* CPU port gets connected to all user ports of the switch */
|
||||
if (dsa_is_cpu_port(ds, i)) {
|
||||
- ret = qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(QCA8K_CPU_PORT),
|
||||
+ ret = qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(cpu_port),
|
||||
QCA8K_PORT_LOOKUP_MEMBER, dsa_user_ports(ds));
|
||||
if (ret)
|
||||
return ret;
|
||||
@@ -1110,7 +1126,7 @@ qca8k_setup(struct dsa_switch *ds)
|
||||
|
||||
ret = qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(i),
|
||||
QCA8K_PORT_LOOKUP_MEMBER,
|
||||
- BIT(QCA8K_CPU_PORT));
|
||||
+ BIT(cpu_port));
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
@@ -1616,9 +1632,12 @@ static int
|
||||
qca8k_port_bridge_join(struct dsa_switch *ds, int port, struct net_device *br)
|
||||
{
|
||||
struct qca8k_priv *priv = (struct qca8k_priv *)ds->priv;
|
||||
- int port_mask = BIT(QCA8K_CPU_PORT);
|
||||
+ int port_mask, cpu_port;
|
||||
int i, ret;
|
||||
|
||||
+ cpu_port = dsa_to_port(ds, port)->cpu_dp->index;
|
||||
+ port_mask = BIT(cpu_port);
|
||||
+
|
||||
for (i = 1; i < QCA8K_NUM_PORTS; i++) {
|
||||
if (dsa_to_port(ds, i)->bridge_dev != br)
|
||||
continue;
|
||||
@@ -1645,7 +1664,9 @@ static void
|
||||
qca8k_port_bridge_leave(struct dsa_switch *ds, int port, struct net_device *br)
|
||||
{
|
||||
struct qca8k_priv *priv = (struct qca8k_priv *)ds->priv;
|
||||
- int i;
|
||||
+ int cpu_port, i;
|
||||
+
|
||||
+ cpu_port = dsa_to_port(ds, port)->cpu_dp->index;
|
||||
|
||||
for (i = 1; i < QCA8K_NUM_PORTS; i++) {
|
||||
if (dsa_to_port(ds, i)->bridge_dev != br)
|
||||
@@ -1662,7 +1683,7 @@ qca8k_port_bridge_leave(struct dsa_switc
|
||||
* this port
|
||||
*/
|
||||
qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(port),
|
||||
- QCA8K_PORT_LOOKUP_MEMBER, BIT(QCA8K_CPU_PORT));
|
||||
+ QCA8K_PORT_LOOKUP_MEMBER, BIT(cpu_port));
|
||||
}
|
||||
|
||||
static int
|
||||
--- a/drivers/net/dsa/qca8k.h
|
||||
+++ b/drivers/net/dsa/qca8k.h
|
||||
@@ -24,8 +24,6 @@
|
||||
|
||||
#define QCA8K_NUM_FDB_RECORDS 2048
|
||||
|
||||
-#define QCA8K_CPU_PORT 0
|
||||
-
|
||||
#define QCA8K_PORT_VID_DEF 1
|
||||
|
||||
/* Global control registers */
|
|
@ -0,0 +1,295 @@
|
|||
From 5654ec78dd7e64b1e04777b24007344329e6a63b Mon Sep 17 00:00:00 2001
|
||||
From: Ansuel Smith <ansuelsmth@gmail.com>
|
||||
Date: Thu, 14 Oct 2021 00:39:11 +0200
|
||||
Subject: net: dsa: qca8k: rework rgmii delay logic and scan for cpu port 6
|
||||
|
||||
Future proof commit. This switch have 2 CPU ports and one valid
|
||||
configuration is first CPU port set to sgmii and second CPU port set to
|
||||
rgmii-id. The current implementation detects delay only for CPU port
|
||||
zero set to rgmii and doesn't count any delay set in a secondary CPU
|
||||
port. Drop the current delay scan function and move it to the sgmii
|
||||
parser function to generalize and implicitly add support for secondary
|
||||
CPU port set to rgmii-id. Introduce new logic where delay is enabled
|
||||
also with internal delay binding declared and rgmii set as PHY mode.
|
||||
|
||||
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
---
|
||||
drivers/net/dsa/qca8k.c | 165 ++++++++++++++++++++++++------------------------
|
||||
drivers/net/dsa/qca8k.h | 10 ++-
|
||||
2 files changed, 89 insertions(+), 86 deletions(-)
|
||||
|
||||
--- a/drivers/net/dsa/qca8k.c
|
||||
+++ b/drivers/net/dsa/qca8k.c
|
||||
@@ -889,68 +889,6 @@ qca8k_setup_mdio_bus(struct qca8k_priv *
|
||||
}
|
||||
|
||||
static int
|
||||
-qca8k_setup_of_rgmii_delay(struct qca8k_priv *priv)
|
||||
-{
|
||||
- struct device_node *port_dn;
|
||||
- phy_interface_t mode;
|
||||
- struct dsa_port *dp;
|
||||
- u32 val;
|
||||
-
|
||||
- /* CPU port is already checked */
|
||||
- dp = dsa_to_port(priv->ds, 0);
|
||||
-
|
||||
- port_dn = dp->dn;
|
||||
-
|
||||
- /* Check if port 0 is set to the correct type */
|
||||
- of_get_phy_mode(port_dn, &mode);
|
||||
- if (mode != PHY_INTERFACE_MODE_RGMII_ID &&
|
||||
- mode != PHY_INTERFACE_MODE_RGMII_RXID &&
|
||||
- mode != PHY_INTERFACE_MODE_RGMII_TXID) {
|
||||
- return 0;
|
||||
- }
|
||||
-
|
||||
- switch (mode) {
|
||||
- case PHY_INTERFACE_MODE_RGMII_ID:
|
||||
- case PHY_INTERFACE_MODE_RGMII_RXID:
|
||||
- if (of_property_read_u32(port_dn, "rx-internal-delay-ps", &val))
|
||||
- val = 2;
|
||||
- else
|
||||
- /* Switch regs accept value in ns, convert ps to ns */
|
||||
- val = val / 1000;
|
||||
-
|
||||
- if (val > QCA8K_MAX_DELAY) {
|
||||
- dev_err(priv->dev, "rgmii rx delay is limited to a max value of 3ns, setting to the max value");
|
||||
- val = 3;
|
||||
- }
|
||||
-
|
||||
- priv->rgmii_rx_delay = val;
|
||||
- /* Stop here if we need to check only for rx delay */
|
||||
- if (mode != PHY_INTERFACE_MODE_RGMII_ID)
|
||||
- break;
|
||||
-
|
||||
- fallthrough;
|
||||
- case PHY_INTERFACE_MODE_RGMII_TXID:
|
||||
- if (of_property_read_u32(port_dn, "tx-internal-delay-ps", &val))
|
||||
- val = 1;
|
||||
- else
|
||||
- /* Switch regs accept value in ns, convert ps to ns */
|
||||
- val = val / 1000;
|
||||
-
|
||||
- if (val > QCA8K_MAX_DELAY) {
|
||||
- dev_err(priv->dev, "rgmii tx delay is limited to a max value of 3ns, setting to the max value");
|
||||
- val = 3;
|
||||
- }
|
||||
-
|
||||
- priv->rgmii_tx_delay = val;
|
||||
- break;
|
||||
- default:
|
||||
- return 0;
|
||||
- }
|
||||
-
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
-static int
|
||||
qca8k_setup_mac_pwr_sel(struct qca8k_priv *priv)
|
||||
{
|
||||
u32 mask = 0;
|
||||
@@ -996,19 +934,21 @@ static int qca8k_find_cpu_port(struct ds
|
||||
static int
|
||||
qca8k_parse_port_config(struct qca8k_priv *priv)
|
||||
{
|
||||
+ int port, cpu_port_index = 0, ret;
|
||||
struct device_node *port_dn;
|
||||
phy_interface_t mode;
|
||||
struct dsa_port *dp;
|
||||
- int port, ret;
|
||||
+ u32 delay;
|
||||
|
||||
/* We have 2 CPU port. Check them */
|
||||
- for (port = 0; port < QCA8K_NUM_PORTS; port++) {
|
||||
+ for (port = 0; port < QCA8K_NUM_PORTS && cpu_port_index < QCA8K_NUM_CPU_PORTS; port++) {
|
||||
/* Skip every other port */
|
||||
if (port != 0 && port != 6)
|
||||
continue;
|
||||
|
||||
dp = dsa_to_port(priv->ds, port);
|
||||
port_dn = dp->dn;
|
||||
+ cpu_port_index++;
|
||||
|
||||
if (!of_device_is_available(port_dn))
|
||||
continue;
|
||||
@@ -1017,12 +957,54 @@ qca8k_parse_port_config(struct qca8k_pri
|
||||
if (ret)
|
||||
continue;
|
||||
|
||||
- if (mode == PHY_INTERFACE_MODE_SGMII) {
|
||||
+ switch (mode) {
|
||||
+ case PHY_INTERFACE_MODE_RGMII:
|
||||
+ case PHY_INTERFACE_MODE_RGMII_ID:
|
||||
+ case PHY_INTERFACE_MODE_RGMII_TXID:
|
||||
+ case PHY_INTERFACE_MODE_RGMII_RXID:
|
||||
+ delay = 0;
|
||||
+
|
||||
+ if (!of_property_read_u32(port_dn, "tx-internal-delay-ps", &delay))
|
||||
+ /* Switch regs accept value in ns, convert ps to ns */
|
||||
+ delay = delay / 1000;
|
||||
+ else if (mode == PHY_INTERFACE_MODE_RGMII_ID ||
|
||||
+ mode == PHY_INTERFACE_MODE_RGMII_TXID)
|
||||
+ delay = 1;
|
||||
+
|
||||
+ if (delay > QCA8K_MAX_DELAY) {
|
||||
+ dev_err(priv->dev, "rgmii tx delay is limited to a max value of 3ns, setting to the max value");
|
||||
+ delay = 3;
|
||||
+ }
|
||||
+
|
||||
+ priv->rgmii_tx_delay[cpu_port_index] = delay;
|
||||
+
|
||||
+ delay = 0;
|
||||
+
|
||||
+ if (!of_property_read_u32(port_dn, "rx-internal-delay-ps", &delay))
|
||||
+ /* Switch regs accept value in ns, convert ps to ns */
|
||||
+ delay = delay / 1000;
|
||||
+ else if (mode == PHY_INTERFACE_MODE_RGMII_ID ||
|
||||
+ mode == PHY_INTERFACE_MODE_RGMII_RXID)
|
||||
+ delay = 2;
|
||||
+
|
||||
+ if (delay > QCA8K_MAX_DELAY) {
|
||||
+ dev_err(priv->dev, "rgmii rx delay is limited to a max value of 3ns, setting to the max value");
|
||||
+ delay = 3;
|
||||
+ }
|
||||
+
|
||||
+ priv->rgmii_rx_delay[cpu_port_index] = delay;
|
||||
+
|
||||
+ break;
|
||||
+ case PHY_INTERFACE_MODE_SGMII:
|
||||
if (of_property_read_bool(port_dn, "qca,sgmii-txclk-falling-edge"))
|
||||
priv->sgmii_tx_clk_falling_edge = true;
|
||||
|
||||
if (of_property_read_bool(port_dn, "qca,sgmii-rxclk-falling-edge"))
|
||||
priv->sgmii_rx_clk_falling_edge = true;
|
||||
+
|
||||
+ break;
|
||||
+ default:
|
||||
+ continue;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1059,10 +1041,6 @@ qca8k_setup(struct dsa_switch *ds)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
- ret = qca8k_setup_of_rgmii_delay(priv);
|
||||
- if (ret)
|
||||
- return ret;
|
||||
-
|
||||
ret = qca8k_setup_mac_pwr_sel(priv);
|
||||
if (ret)
|
||||
return ret;
|
||||
@@ -1229,8 +1207,8 @@ qca8k_phylink_mac_config(struct dsa_swit
|
||||
const struct phylink_link_state *state)
|
||||
{
|
||||
struct qca8k_priv *priv = ds->priv;
|
||||
- u32 reg, val;
|
||||
- int ret;
|
||||
+ int cpu_port_index, ret;
|
||||
+ u32 reg, val, delay;
|
||||
|
||||
switch (port) {
|
||||
case 0: /* 1st CPU port */
|
||||
@@ -1242,6 +1220,7 @@ qca8k_phylink_mac_config(struct dsa_swit
|
||||
return;
|
||||
|
||||
reg = QCA8K_REG_PORT0_PAD_CTRL;
|
||||
+ cpu_port_index = QCA8K_CPU_PORT0;
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
@@ -1260,6 +1239,7 @@ qca8k_phylink_mac_config(struct dsa_swit
|
||||
return;
|
||||
|
||||
reg = QCA8K_REG_PORT6_PAD_CTRL;
|
||||
+ cpu_port_index = QCA8K_CPU_PORT6;
|
||||
break;
|
||||
default:
|
||||
dev_err(ds->dev, "%s: unsupported port: %i\n", __func__, port);
|
||||
@@ -1274,23 +1254,40 @@ qca8k_phylink_mac_config(struct dsa_swit
|
||||
|
||||
switch (state->interface) {
|
||||
case PHY_INTERFACE_MODE_RGMII:
|
||||
- /* RGMII mode means no delay so don't enable the delay */
|
||||
- qca8k_write(priv, reg, QCA8K_PORT_PAD_RGMII_EN);
|
||||
- break;
|
||||
case PHY_INTERFACE_MODE_RGMII_ID:
|
||||
case PHY_INTERFACE_MODE_RGMII_TXID:
|
||||
case PHY_INTERFACE_MODE_RGMII_RXID:
|
||||
- /* RGMII_ID needs internal delay. This is enabled through
|
||||
- * PORT5_PAD_CTRL for all ports, rather than individual port
|
||||
- * registers
|
||||
+ val = QCA8K_PORT_PAD_RGMII_EN;
|
||||
+
|
||||
+ /* Delay can be declared in 3 different way.
|
||||
+ * Mode to rgmii and internal-delay standard binding defined
|
||||
+ * rgmii-id or rgmii-tx/rx phy mode set.
|
||||
+ * The parse logic set a delay different than 0 only when one
|
||||
+ * of the 3 different way is used. In all other case delay is
|
||||
+ * not enabled. With ID or TX/RXID delay is enabled and set
|
||||
+ * to the default and recommended value.
|
||||
+ */
|
||||
+ if (priv->rgmii_tx_delay[cpu_port_index]) {
|
||||
+ delay = priv->rgmii_tx_delay[cpu_port_index];
|
||||
+
|
||||
+ val |= QCA8K_PORT_PAD_RGMII_TX_DELAY(delay) |
|
||||
+ QCA8K_PORT_PAD_RGMII_TX_DELAY_EN;
|
||||
+ }
|
||||
+
|
||||
+ if (priv->rgmii_rx_delay[cpu_port_index]) {
|
||||
+ delay = priv->rgmii_rx_delay[cpu_port_index];
|
||||
+
|
||||
+ val |= QCA8K_PORT_PAD_RGMII_RX_DELAY(delay) |
|
||||
+ QCA8K_PORT_PAD_RGMII_RX_DELAY_EN;
|
||||
+ }
|
||||
+
|
||||
+ /* Set RGMII delay based on the selected values */
|
||||
+ qca8k_write(priv, reg, val);
|
||||
+
|
||||
+ /* QCA8337 requires to set rgmii rx delay for all ports.
|
||||
+ * This is enabled through PORT5_PAD_CTRL for all ports,
|
||||
+ * rather than individual port registers.
|
||||
*/
|
||||
- qca8k_write(priv, reg,
|
||||
- QCA8K_PORT_PAD_RGMII_EN |
|
||||
- QCA8K_PORT_PAD_RGMII_TX_DELAY(priv->rgmii_tx_delay) |
|
||||
- QCA8K_PORT_PAD_RGMII_RX_DELAY(priv->rgmii_rx_delay) |
|
||||
- QCA8K_PORT_PAD_RGMII_TX_DELAY_EN |
|
||||
- QCA8K_PORT_PAD_RGMII_RX_DELAY_EN);
|
||||
- /* QCA8337 requires to set rgmii rx delay */
|
||||
if (priv->switch_id == QCA8K_ID_QCA8337)
|
||||
qca8k_write(priv, QCA8K_REG_PORT5_PAD_CTRL,
|
||||
QCA8K_PORT_PAD_RGMII_RX_DELAY_EN);
|
||||
--- a/drivers/net/dsa/qca8k.h
|
||||
+++ b/drivers/net/dsa/qca8k.h
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <linux/gpio.h>
|
||||
|
||||
#define QCA8K_NUM_PORTS 7
|
||||
+#define QCA8K_NUM_CPU_PORTS 2
|
||||
#define QCA8K_MAX_MTU 9000
|
||||
|
||||
#define PHY_ID_QCA8327 0x004dd034
|
||||
@@ -255,13 +256,18 @@ struct qca8k_match_data {
|
||||
u8 id;
|
||||
};
|
||||
|
||||
+enum {
|
||||
+ QCA8K_CPU_PORT0,
|
||||
+ QCA8K_CPU_PORT6,
|
||||
+};
|
||||
+
|
||||
struct qca8k_priv {
|
||||
u8 switch_id;
|
||||
u8 switch_revision;
|
||||
- u8 rgmii_tx_delay;
|
||||
- u8 rgmii_rx_delay;
|
||||
bool sgmii_rx_clk_falling_edge;
|
||||
bool sgmii_tx_clk_falling_edge;
|
||||
+ u8 rgmii_rx_delay[QCA8K_NUM_CPU_PORTS]; /* 0: CPU port0, 1: CPU port6 */
|
||||
+ u8 rgmii_tx_delay[QCA8K_NUM_CPU_PORTS]; /* 0: CPU port0, 1: CPU port6 */
|
||||
bool legacy_phy_port_mapping;
|
||||
struct regmap *regmap;
|
||||
struct mii_bus *bus;
|
|
@ -0,0 +1,33 @@
|
|||
From 13ad5ccc093ff448b99ac7e138e91e78796adb48 Mon Sep 17 00:00:00 2001
|
||||
From: Ansuel Smith <ansuelsmth@gmail.com>
|
||||
Date: Thu, 14 Oct 2021 00:39:12 +0200
|
||||
Subject: dt-bindings: net: dsa: qca8k: Document qca,sgmii-enable-pll
|
||||
|
||||
Document qca,sgmii-enable-pll binding used in the CPU nodes to
|
||||
enable SGMII PLL on MAC config.
|
||||
|
||||
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
---
|
||||
Documentation/devicetree/bindings/net/dsa/qca8k.txt | 10 ++++++++++
|
||||
1 file changed, 10 insertions(+)
|
||||
|
||||
--- a/Documentation/devicetree/bindings/net/dsa/qca8k.txt
|
||||
+++ b/Documentation/devicetree/bindings/net/dsa/qca8k.txt
|
||||
@@ -45,6 +45,16 @@ A CPU port node has the following option
|
||||
Mostly used in qca8327 with CPU port 0 set to
|
||||
sgmii.
|
||||
- qca,sgmii-txclk-falling-edge: Set the transmit clock phase to falling edge.
|
||||
+- qca,sgmii-enable-pll : For SGMII CPU port, explicitly enable PLL, TX and RX
|
||||
+ chain along with Signal Detection.
|
||||
+ This should NOT be enabled for qca8327. If enabled with
|
||||
+ qca8327 the sgmii port won't correctly init and an err
|
||||
+ is printed.
|
||||
+ This can be required for qca8337 switch with revision 2.
|
||||
+ A warning is displayed when used with revision greater
|
||||
+ 2.
|
||||
+ With CPU port set to sgmii and qca8337 it is advised
|
||||
+ to set this unless a communication problem is observed.
|
||||
|
||||
For QCA8K the 'fixed-link' sub-node supports only the following properties:
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
From bbc4799e8bb6c397e3b3fec13de68e179f5db9ff Mon Sep 17 00:00:00 2001
|
||||
From: Ansuel Smith <ansuelsmth@gmail.com>
|
||||
Date: Thu, 14 Oct 2021 00:39:13 +0200
|
||||
Subject: net: dsa: qca8k: add explicit SGMII PLL enable
|
||||
|
||||
Support enabling PLL on the SGMII CPU port. Some device require this
|
||||
special configuration or no traffic is transmitted and the switch
|
||||
doesn't work at all. A dedicated binding is added to the CPU node
|
||||
port to apply the correct reg on mac config.
|
||||
Fail to correctly configure sgmii with qca8327 switch and warn if pll is
|
||||
used on qca8337 with a revision greater than 1.
|
||||
|
||||
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
|
||||
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
---
|
||||
drivers/net/dsa/qca8k.c | 19 +++++++++++++++++--
|
||||
drivers/net/dsa/qca8k.h | 1 +
|
||||
2 files changed, 18 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/drivers/net/dsa/qca8k.c
|
||||
+++ b/drivers/net/dsa/qca8k.c
|
||||
@@ -1002,6 +1002,18 @@ qca8k_parse_port_config(struct qca8k_pri
|
||||
if (of_property_read_bool(port_dn, "qca,sgmii-rxclk-falling-edge"))
|
||||
priv->sgmii_rx_clk_falling_edge = true;
|
||||
|
||||
+ if (of_property_read_bool(port_dn, "qca,sgmii-enable-pll")) {
|
||||
+ priv->sgmii_enable_pll = true;
|
||||
+
|
||||
+ if (priv->switch_id == QCA8K_ID_QCA8327) {
|
||||
+ dev_err(priv->dev, "SGMII PLL should NOT be enabled for qca8327. Aborting enabling");
|
||||
+ priv->sgmii_enable_pll = false;
|
||||
+ }
|
||||
+
|
||||
+ if (priv->switch_revision < 2)
|
||||
+ dev_warn(priv->dev, "SGMII PLL should NOT be enabled for qca8337 with revision 2 or more.");
|
||||
+ }
|
||||
+
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
@@ -1312,8 +1324,11 @@ qca8k_phylink_mac_config(struct dsa_swit
|
||||
if (ret)
|
||||
return;
|
||||
|
||||
- val |= QCA8K_SGMII_EN_PLL | QCA8K_SGMII_EN_RX |
|
||||
- QCA8K_SGMII_EN_TX | QCA8K_SGMII_EN_SD;
|
||||
+ val |= QCA8K_SGMII_EN_SD;
|
||||
+
|
||||
+ if (priv->sgmii_enable_pll)
|
||||
+ val |= QCA8K_SGMII_EN_PLL | QCA8K_SGMII_EN_RX |
|
||||
+ QCA8K_SGMII_EN_TX;
|
||||
|
||||
if (dsa_is_cpu_port(ds, port)) {
|
||||
/* CPU port, we're talking to the CPU MAC, be a PHY */
|
||||
--- a/drivers/net/dsa/qca8k.h
|
||||
+++ b/drivers/net/dsa/qca8k.h
|
||||
@@ -266,6 +266,7 @@ struct qca8k_priv {
|
||||
u8 switch_revision;
|
||||
bool sgmii_rx_clk_falling_edge;
|
||||
bool sgmii_tx_clk_falling_edge;
|
||||
+ bool sgmii_enable_pll;
|
||||
u8 rgmii_rx_delay[QCA8K_NUM_CPU_PORTS]; /* 0: CPU port0, 1: CPU port6 */
|
||||
u8 rgmii_tx_delay[QCA8K_NUM_CPU_PORTS]; /* 0: CPU port0, 1: CPU port6 */
|
||||
bool legacy_phy_port_mapping;
|
|
@ -0,0 +1,37 @@
|
|||
From 924087c5c3d41553700b0eb83ca2a53b91643dca Mon Sep 17 00:00:00 2001
|
||||
From: Ansuel Smith <ansuelsmth@gmail.com>
|
||||
Date: Thu, 14 Oct 2021 00:39:14 +0200
|
||||
Subject: dt-bindings: net: dsa: qca8k: Document qca,led-open-drain binding
|
||||
|
||||
Document new binding qca,ignore-power-on-sel used to ignore
|
||||
power on strapping and use sw regs instead.
|
||||
Document qca,led-open.drain to set led to open drain mode, the
|
||||
qca,ignore-power-on-sel is mandatory with this enabled or an error will
|
||||
be reported.
|
||||
|
||||
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
---
|
||||
Documentation/devicetree/bindings/net/dsa/qca8k.txt | 11 +++++++++++
|
||||
1 file changed, 11 insertions(+)
|
||||
|
||||
--- a/Documentation/devicetree/bindings/net/dsa/qca8k.txt
|
||||
+++ b/Documentation/devicetree/bindings/net/dsa/qca8k.txt
|
||||
@@ -13,6 +13,17 @@ Required properties:
|
||||
Optional properties:
|
||||
|
||||
- reset-gpios: GPIO to be used to reset the whole device
|
||||
+- qca,ignore-power-on-sel: Ignore power on pin strapping to configure led open
|
||||
+ drain or eeprom presence. This is needed for broken
|
||||
+ devices that have wrong configuration or when the oem
|
||||
+ decided to not use pin strapping and fallback to sw
|
||||
+ regs.
|
||||
+- qca,led-open-drain: Set leds to open-drain mode. This requires the
|
||||
+ qca,ignore-power-on-sel to be set or the driver will fail
|
||||
+ to probe. This is needed if the oem doesn't use pin
|
||||
+ strapping to set this mode and prefers to set it using sw
|
||||
+ regs. The pin strapping related to led open drain mode is
|
||||
+ the pin B68 for QCA832x and B49 for QCA833x
|
||||
|
||||
Subnodes:
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
From 362bb238d8bf1470424214a8a5968d9c6cce68fa Mon Sep 17 00:00:00 2001
|
||||
From: Ansuel Smith <ansuelsmth@gmail.com>
|
||||
Date: Thu, 14 Oct 2021 00:39:15 +0200
|
||||
Subject: net: dsa: qca8k: add support for pws config reg
|
||||
|
||||
Some qca8327 switch require to force the ignore of power on sel
|
||||
strapping. Some switch require to set the led open drain mode in regs
|
||||
instead of using strapping. While most of the device implements this
|
||||
using the correct way using pin strapping, there are still some broken
|
||||
device that require to be set using sw regs.
|
||||
Introduce a new binding and support these special configuration.
|
||||
As led open drain require to ignore pin strapping to work, the probe
|
||||
fails with EINVAL error with incorrect configuration.
|
||||
|
||||
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
|
||||
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
---
|
||||
drivers/net/dsa/qca8k.c | 39 +++++++++++++++++++++++++++++++++++++++
|
||||
drivers/net/dsa/qca8k.h | 6 ++++++
|
||||
2 files changed, 45 insertions(+)
|
||||
|
||||
--- a/drivers/net/dsa/qca8k.c
|
||||
+++ b/drivers/net/dsa/qca8k.c
|
||||
@@ -932,6 +932,41 @@ static int qca8k_find_cpu_port(struct ds
|
||||
}
|
||||
|
||||
static int
|
||||
+qca8k_setup_of_pws_reg(struct qca8k_priv *priv)
|
||||
+{
|
||||
+ struct device_node *node = priv->dev->of_node;
|
||||
+ u32 val = 0;
|
||||
+ int ret;
|
||||
+
|
||||
+ /* QCA8327 require to set to the correct mode.
|
||||
+ * His bigger brother QCA8328 have the 172 pin layout.
|
||||
+ * Should be applied by default but we set this just to make sure.
|
||||
+ */
|
||||
+ if (priv->switch_id == QCA8K_ID_QCA8327) {
|
||||
+ ret = qca8k_rmw(priv, QCA8K_REG_PWS, QCA8327_PWS_PACKAGE148_EN,
|
||||
+ QCA8327_PWS_PACKAGE148_EN);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ if (of_property_read_bool(node, "qca,ignore-power-on-sel"))
|
||||
+ val |= QCA8K_PWS_POWER_ON_SEL;
|
||||
+
|
||||
+ if (of_property_read_bool(node, "qca,led-open-drain")) {
|
||||
+ if (!(val & QCA8K_PWS_POWER_ON_SEL)) {
|
||||
+ dev_err(priv->dev, "qca,led-open-drain require qca,ignore-power-on-sel to be set.");
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ val |= QCA8K_PWS_LED_OPEN_EN_CSR;
|
||||
+ }
|
||||
+
|
||||
+ return qca8k_rmw(priv, QCA8K_REG_PWS,
|
||||
+ QCA8K_PWS_LED_OPEN_EN_CSR | QCA8K_PWS_POWER_ON_SEL,
|
||||
+ val);
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
qca8k_parse_port_config(struct qca8k_priv *priv)
|
||||
{
|
||||
int port, cpu_port_index = 0, ret;
|
||||
@@ -1053,6 +1088,10 @@ qca8k_setup(struct dsa_switch *ds)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
+ ret = qca8k_setup_of_pws_reg(priv);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
ret = qca8k_setup_mac_pwr_sel(priv);
|
||||
if (ret)
|
||||
return ret;
|
||||
--- a/drivers/net/dsa/qca8k.h
|
||||
+++ b/drivers/net/dsa/qca8k.h
|
||||
@@ -46,6 +46,12 @@
|
||||
#define QCA8K_MAX_DELAY 3
|
||||
#define QCA8K_PORT_PAD_SGMII_EN BIT(7)
|
||||
#define QCA8K_REG_PWS 0x010
|
||||
+#define QCA8K_PWS_POWER_ON_SEL BIT(31)
|
||||
+/* This reg is only valid for QCA832x and toggle the package
|
||||
+ * type from 176 pin (by default) to 148 pin used on QCA8327
|
||||
+ */
|
||||
+#define QCA8327_PWS_PACKAGE148_EN BIT(30)
|
||||
+#define QCA8K_PWS_LED_OPEN_EN_CSR BIT(24)
|
||||
#define QCA8K_PWS_SERDES_AEN_DIS BIT(7)
|
||||
#define QCA8K_REG_MODULE_EN 0x030
|
||||
#define QCA8K_MODULE_EN_MIB BIT(0)
|
|
@ -0,0 +1,32 @@
|
|||
From ed7988d77fbfb79366b68f9e7fa60a6080da23d4 Mon Sep 17 00:00:00 2001
|
||||
From: Ansuel Smith <ansuelsmth@gmail.com>
|
||||
Date: Thu, 14 Oct 2021 00:39:16 +0200
|
||||
Subject: dt-bindings: net: dsa: qca8k: document support for qca8328
|
||||
|
||||
QCA8328 is the bigger brother of qca8327. Document the new compatible
|
||||
binding and add some information to understand the various switch
|
||||
compatible.
|
||||
|
||||
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
|
||||
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
---
|
||||
Documentation/devicetree/bindings/net/dsa/qca8k.txt | 7 ++++---
|
||||
1 file changed, 4 insertions(+), 3 deletions(-)
|
||||
|
||||
--- a/Documentation/devicetree/bindings/net/dsa/qca8k.txt
|
||||
+++ b/Documentation/devicetree/bindings/net/dsa/qca8k.txt
|
||||
@@ -3,9 +3,10 @@
|
||||
Required properties:
|
||||
|
||||
- compatible: should be one of:
|
||||
- "qca,qca8327"
|
||||
- "qca,qca8334"
|
||||
- "qca,qca8337"
|
||||
+ "qca,qca8328": referenced as AR8328(N)-AK1(A/B) QFN 176 pin package
|
||||
+ "qca,qca8327": referenced as AR8327(N)-AL1A DR-QFN 148 pin package
|
||||
+ "qca,qca8334": referenced as QCA8334-AL3C QFN 88 pin package
|
||||
+ "qca,qca8337": referenced as QCA8337N-AL3(B/C) DR-QFN 148 pin package
|
||||
|
||||
- #size-cells: must be 0
|
||||
- #address-cells: must be 1
|
|
@ -0,0 +1,78 @@
|
|||
From f477d1c8bdbef4f400718238e350f16f521d2a3e Mon Sep 17 00:00:00 2001
|
||||
From: Ansuel Smith <ansuelsmth@gmail.com>
|
||||
Date: Thu, 14 Oct 2021 00:39:17 +0200
|
||||
Subject: net: dsa: qca8k: add support for QCA8328
|
||||
|
||||
QCA8328 switch is the bigger brother of the qca8327. Same regs different
|
||||
chip. Change the function to set the correct pin layout and introduce a
|
||||
new match_data to differentiate the 2 switch as they have the same ID
|
||||
and their internal PHY have the same ID.
|
||||
|
||||
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
|
||||
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
---
|
||||
drivers/net/dsa/qca8k.c | 19 ++++++++++++++++---
|
||||
drivers/net/dsa/qca8k.h | 1 +
|
||||
2 files changed, 17 insertions(+), 3 deletions(-)
|
||||
|
||||
--- a/drivers/net/dsa/qca8k.c
|
||||
+++ b/drivers/net/dsa/qca8k.c
|
||||
@@ -935,6 +935,7 @@ static int
|
||||
qca8k_setup_of_pws_reg(struct qca8k_priv *priv)
|
||||
{
|
||||
struct device_node *node = priv->dev->of_node;
|
||||
+ const struct qca8k_match_data *data;
|
||||
u32 val = 0;
|
||||
int ret;
|
||||
|
||||
@@ -943,8 +944,14 @@ qca8k_setup_of_pws_reg(struct qca8k_priv
|
||||
* Should be applied by default but we set this just to make sure.
|
||||
*/
|
||||
if (priv->switch_id == QCA8K_ID_QCA8327) {
|
||||
+ data = of_device_get_match_data(priv->dev);
|
||||
+
|
||||
+ /* Set the correct package of 148 pin for QCA8327 */
|
||||
+ if (data->reduced_package)
|
||||
+ val |= QCA8327_PWS_PACKAGE148_EN;
|
||||
+
|
||||
ret = qca8k_rmw(priv, QCA8K_REG_PWS, QCA8327_PWS_PACKAGE148_EN,
|
||||
- QCA8327_PWS_PACKAGE148_EN);
|
||||
+ val);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
@@ -2105,7 +2112,12 @@ static int qca8k_resume(struct device *d
|
||||
static SIMPLE_DEV_PM_OPS(qca8k_pm_ops,
|
||||
qca8k_suspend, qca8k_resume);
|
||||
|
||||
-static const struct qca8k_match_data qca832x = {
|
||||
+static const struct qca8k_match_data qca8327 = {
|
||||
+ .id = QCA8K_ID_QCA8327,
|
||||
+ .reduced_package = true,
|
||||
+};
|
||||
+
|
||||
+static const struct qca8k_match_data qca8328 = {
|
||||
.id = QCA8K_ID_QCA8327,
|
||||
};
|
||||
|
||||
@@ -2114,7 +2126,8 @@ static const struct qca8k_match_data qca
|
||||
};
|
||||
|
||||
static const struct of_device_id qca8k_of_match[] = {
|
||||
- { .compatible = "qca,qca8327", .data = &qca832x },
|
||||
+ { .compatible = "qca,qca8327", .data = &qca8327 },
|
||||
+ { .compatible = "qca,qca8328", .data = &qca8328 },
|
||||
{ .compatible = "qca,qca8334", .data = &qca833x },
|
||||
{ .compatible = "qca,qca8337", .data = &qca833x },
|
||||
{ /* sentinel */ },
|
||||
--- a/drivers/net/dsa/qca8k.h
|
||||
+++ b/drivers/net/dsa/qca8k.h
|
||||
@@ -260,6 +260,7 @@ struct ar8xxx_port_status {
|
||||
|
||||
struct qca8k_match_data {
|
||||
u8 id;
|
||||
+ bool reduced_package;
|
||||
};
|
||||
|
||||
enum {
|
|
@ -0,0 +1,159 @@
|
|||
From cef08115846e581f80ff99abf7bf218da1840616 Mon Sep 17 00:00:00 2001
|
||||
From: Ansuel Smith <ansuelsmth@gmail.com>
|
||||
Date: Thu, 14 Oct 2021 00:39:18 +0200
|
||||
Subject: net: dsa: qca8k: set internal delay also for sgmii
|
||||
|
||||
QCA original code report port instability and sa that SGMII also require
|
||||
to set internal delay. Generalize the rgmii delay function and apply the
|
||||
advised value if they are not defined in DT.
|
||||
|
||||
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
---
|
||||
drivers/net/dsa/qca8k.c | 88 +++++++++++++++++++++++++++++++++----------------
|
||||
drivers/net/dsa/qca8k.h | 2 ++
|
||||
2 files changed, 62 insertions(+), 28 deletions(-)
|
||||
|
||||
--- a/drivers/net/dsa/qca8k.c
|
||||
+++ b/drivers/net/dsa/qca8k.c
|
||||
@@ -1004,6 +1004,7 @@ qca8k_parse_port_config(struct qca8k_pri
|
||||
case PHY_INTERFACE_MODE_RGMII_ID:
|
||||
case PHY_INTERFACE_MODE_RGMII_TXID:
|
||||
case PHY_INTERFACE_MODE_RGMII_RXID:
|
||||
+ case PHY_INTERFACE_MODE_SGMII:
|
||||
delay = 0;
|
||||
|
||||
if (!of_property_read_u32(port_dn, "tx-internal-delay-ps", &delay))
|
||||
@@ -1036,8 +1037,13 @@ qca8k_parse_port_config(struct qca8k_pri
|
||||
|
||||
priv->rgmii_rx_delay[cpu_port_index] = delay;
|
||||
|
||||
- break;
|
||||
- case PHY_INTERFACE_MODE_SGMII:
|
||||
+ /* Skip sgmii parsing for rgmii* mode */
|
||||
+ if (mode == PHY_INTERFACE_MODE_RGMII ||
|
||||
+ mode == PHY_INTERFACE_MODE_RGMII_ID ||
|
||||
+ mode == PHY_INTERFACE_MODE_RGMII_TXID ||
|
||||
+ mode == PHY_INTERFACE_MODE_RGMII_RXID)
|
||||
+ break;
|
||||
+
|
||||
if (of_property_read_bool(port_dn, "qca,sgmii-txclk-falling-edge"))
|
||||
priv->sgmii_tx_clk_falling_edge = true;
|
||||
|
||||
@@ -1261,12 +1267,53 @@ qca8k_setup(struct dsa_switch *ds)
|
||||
}
|
||||
|
||||
static void
|
||||
+qca8k_mac_config_setup_internal_delay(struct qca8k_priv *priv, int cpu_port_index,
|
||||
+ u32 reg)
|
||||
+{
|
||||
+ u32 delay, val = 0;
|
||||
+ int ret;
|
||||
+
|
||||
+ /* Delay can be declared in 3 different way.
|
||||
+ * Mode to rgmii and internal-delay standard binding defined
|
||||
+ * rgmii-id or rgmii-tx/rx phy mode set.
|
||||
+ * The parse logic set a delay different than 0 only when one
|
||||
+ * of the 3 different way is used. In all other case delay is
|
||||
+ * not enabled. With ID or TX/RXID delay is enabled and set
|
||||
+ * to the default and recommended value.
|
||||
+ */
|
||||
+ if (priv->rgmii_tx_delay[cpu_port_index]) {
|
||||
+ delay = priv->rgmii_tx_delay[cpu_port_index];
|
||||
+
|
||||
+ val |= QCA8K_PORT_PAD_RGMII_TX_DELAY(delay) |
|
||||
+ QCA8K_PORT_PAD_RGMII_TX_DELAY_EN;
|
||||
+ }
|
||||
+
|
||||
+ if (priv->rgmii_rx_delay[cpu_port_index]) {
|
||||
+ delay = priv->rgmii_rx_delay[cpu_port_index];
|
||||
+
|
||||
+ val |= QCA8K_PORT_PAD_RGMII_RX_DELAY(delay) |
|
||||
+ QCA8K_PORT_PAD_RGMII_RX_DELAY_EN;
|
||||
+ }
|
||||
+
|
||||
+ /* Set RGMII delay based on the selected values */
|
||||
+ ret = qca8k_rmw(priv, reg,
|
||||
+ QCA8K_PORT_PAD_RGMII_TX_DELAY_MASK |
|
||||
+ QCA8K_PORT_PAD_RGMII_RX_DELAY_MASK |
|
||||
+ QCA8K_PORT_PAD_RGMII_TX_DELAY_EN |
|
||||
+ QCA8K_PORT_PAD_RGMII_RX_DELAY_EN,
|
||||
+ val);
|
||||
+ if (ret)
|
||||
+ dev_err(priv->dev, "Failed to set internal delay for CPU port%d",
|
||||
+ cpu_port_index == QCA8K_CPU_PORT0 ? 0 : 6);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
qca8k_phylink_mac_config(struct dsa_switch *ds, int port, unsigned int mode,
|
||||
const struct phylink_link_state *state)
|
||||
{
|
||||
struct qca8k_priv *priv = ds->priv;
|
||||
int cpu_port_index, ret;
|
||||
- u32 reg, val, delay;
|
||||
+ u32 reg, val;
|
||||
|
||||
switch (port) {
|
||||
case 0: /* 1st CPU port */
|
||||
@@ -1315,32 +1362,10 @@ qca8k_phylink_mac_config(struct dsa_swit
|
||||
case PHY_INTERFACE_MODE_RGMII_ID:
|
||||
case PHY_INTERFACE_MODE_RGMII_TXID:
|
||||
case PHY_INTERFACE_MODE_RGMII_RXID:
|
||||
- val = QCA8K_PORT_PAD_RGMII_EN;
|
||||
-
|
||||
- /* Delay can be declared in 3 different way.
|
||||
- * Mode to rgmii and internal-delay standard binding defined
|
||||
- * rgmii-id or rgmii-tx/rx phy mode set.
|
||||
- * The parse logic set a delay different than 0 only when one
|
||||
- * of the 3 different way is used. In all other case delay is
|
||||
- * not enabled. With ID or TX/RXID delay is enabled and set
|
||||
- * to the default and recommended value.
|
||||
- */
|
||||
- if (priv->rgmii_tx_delay[cpu_port_index]) {
|
||||
- delay = priv->rgmii_tx_delay[cpu_port_index];
|
||||
-
|
||||
- val |= QCA8K_PORT_PAD_RGMII_TX_DELAY(delay) |
|
||||
- QCA8K_PORT_PAD_RGMII_TX_DELAY_EN;
|
||||
- }
|
||||
-
|
||||
- if (priv->rgmii_rx_delay[cpu_port_index]) {
|
||||
- delay = priv->rgmii_rx_delay[cpu_port_index];
|
||||
-
|
||||
- val |= QCA8K_PORT_PAD_RGMII_RX_DELAY(delay) |
|
||||
- QCA8K_PORT_PAD_RGMII_RX_DELAY_EN;
|
||||
- }
|
||||
+ qca8k_write(priv, reg, QCA8K_PORT_PAD_RGMII_EN);
|
||||
|
||||
- /* Set RGMII delay based on the selected values */
|
||||
- qca8k_write(priv, reg, val);
|
||||
+ /* Configure rgmii delay */
|
||||
+ qca8k_mac_config_setup_internal_delay(priv, cpu_port_index, reg);
|
||||
|
||||
/* QCA8337 requires to set rgmii rx delay for all ports.
|
||||
* This is enabled through PORT5_PAD_CTRL for all ports,
|
||||
@@ -1411,6 +1436,13 @@ qca8k_phylink_mac_config(struct dsa_swit
|
||||
QCA8K_PORT0_PAD_SGMII_RXCLK_FALLING_EDGE |
|
||||
QCA8K_PORT0_PAD_SGMII_TXCLK_FALLING_EDGE,
|
||||
val);
|
||||
+
|
||||
+ /* From original code is reported port instability as SGMII also
|
||||
+ * require delay set. Apply advised values here or take them from DT.
|
||||
+ */
|
||||
+ if (state->interface == PHY_INTERFACE_MODE_SGMII)
|
||||
+ qca8k_mac_config_setup_internal_delay(priv, cpu_port_index, reg);
|
||||
+
|
||||
break;
|
||||
default:
|
||||
dev_err(ds->dev, "xMII mode %s not supported for port %d\n",
|
||||
--- a/drivers/net/dsa/qca8k.h
|
||||
+++ b/drivers/net/dsa/qca8k.h
|
||||
@@ -39,7 +39,9 @@
|
||||
#define QCA8K_REG_PORT5_PAD_CTRL 0x008
|
||||
#define QCA8K_REG_PORT6_PAD_CTRL 0x00c
|
||||
#define QCA8K_PORT_PAD_RGMII_EN BIT(26)
|
||||
+#define QCA8K_PORT_PAD_RGMII_TX_DELAY_MASK GENMASK(23, 22)
|
||||
#define QCA8K_PORT_PAD_RGMII_TX_DELAY(x) ((x) << 22)
|
||||
+#define QCA8K_PORT_PAD_RGMII_RX_DELAY_MASK GENMASK(21, 20)
|
||||
#define QCA8K_PORT_PAD_RGMII_RX_DELAY(x) ((x) << 20)
|
||||
#define QCA8K_PORT_PAD_RGMII_TX_DELAY_EN BIT(25)
|
||||
#define QCA8K_PORT_PAD_RGMII_RX_DELAY_EN BIT(24)
|
|
@ -0,0 +1,124 @@
|
|||
From fd0bb28c547f7c8affb1691128cece38f5b626a1 Mon Sep 17 00:00:00 2001
|
||||
From: Ansuel Smith <ansuelsmth@gmail.com>
|
||||
Date: Thu, 14 Oct 2021 00:39:19 +0200
|
||||
Subject: net: dsa: qca8k: move port config to dedicated struct
|
||||
|
||||
Move ports related config to dedicated struct to keep things organized.
|
||||
|
||||
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
|
||||
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
---
|
||||
drivers/net/dsa/qca8k.c | 26 +++++++++++++-------------
|
||||
drivers/net/dsa/qca8k.h | 10 +++++++---
|
||||
2 files changed, 20 insertions(+), 16 deletions(-)
|
||||
|
||||
--- a/drivers/net/dsa/qca8k.c
|
||||
+++ b/drivers/net/dsa/qca8k.c
|
||||
@@ -1019,7 +1019,7 @@ qca8k_parse_port_config(struct qca8k_pri
|
||||
delay = 3;
|
||||
}
|
||||
|
||||
- priv->rgmii_tx_delay[cpu_port_index] = delay;
|
||||
+ priv->ports_config.rgmii_tx_delay[cpu_port_index] = delay;
|
||||
|
||||
delay = 0;
|
||||
|
||||
@@ -1035,7 +1035,7 @@ qca8k_parse_port_config(struct qca8k_pri
|
||||
delay = 3;
|
||||
}
|
||||
|
||||
- priv->rgmii_rx_delay[cpu_port_index] = delay;
|
||||
+ priv->ports_config.rgmii_rx_delay[cpu_port_index] = delay;
|
||||
|
||||
/* Skip sgmii parsing for rgmii* mode */
|
||||
if (mode == PHY_INTERFACE_MODE_RGMII ||
|
||||
@@ -1045,17 +1045,17 @@ qca8k_parse_port_config(struct qca8k_pri
|
||||
break;
|
||||
|
||||
if (of_property_read_bool(port_dn, "qca,sgmii-txclk-falling-edge"))
|
||||
- priv->sgmii_tx_clk_falling_edge = true;
|
||||
+ priv->ports_config.sgmii_tx_clk_falling_edge = true;
|
||||
|
||||
if (of_property_read_bool(port_dn, "qca,sgmii-rxclk-falling-edge"))
|
||||
- priv->sgmii_rx_clk_falling_edge = true;
|
||||
+ priv->ports_config.sgmii_rx_clk_falling_edge = true;
|
||||
|
||||
if (of_property_read_bool(port_dn, "qca,sgmii-enable-pll")) {
|
||||
- priv->sgmii_enable_pll = true;
|
||||
+ priv->ports_config.sgmii_enable_pll = true;
|
||||
|
||||
if (priv->switch_id == QCA8K_ID_QCA8327) {
|
||||
dev_err(priv->dev, "SGMII PLL should NOT be enabled for qca8327. Aborting enabling");
|
||||
- priv->sgmii_enable_pll = false;
|
||||
+ priv->ports_config.sgmii_enable_pll = false;
|
||||
}
|
||||
|
||||
if (priv->switch_revision < 2)
|
||||
@@ -1281,15 +1281,15 @@ qca8k_mac_config_setup_internal_delay(st
|
||||
* not enabled. With ID or TX/RXID delay is enabled and set
|
||||
* to the default and recommended value.
|
||||
*/
|
||||
- if (priv->rgmii_tx_delay[cpu_port_index]) {
|
||||
- delay = priv->rgmii_tx_delay[cpu_port_index];
|
||||
+ if (priv->ports_config.rgmii_tx_delay[cpu_port_index]) {
|
||||
+ delay = priv->ports_config.rgmii_tx_delay[cpu_port_index];
|
||||
|
||||
val |= QCA8K_PORT_PAD_RGMII_TX_DELAY(delay) |
|
||||
QCA8K_PORT_PAD_RGMII_TX_DELAY_EN;
|
||||
}
|
||||
|
||||
- if (priv->rgmii_rx_delay[cpu_port_index]) {
|
||||
- delay = priv->rgmii_rx_delay[cpu_port_index];
|
||||
+ if (priv->ports_config.rgmii_rx_delay[cpu_port_index]) {
|
||||
+ delay = priv->ports_config.rgmii_rx_delay[cpu_port_index];
|
||||
|
||||
val |= QCA8K_PORT_PAD_RGMII_RX_DELAY(delay) |
|
||||
QCA8K_PORT_PAD_RGMII_RX_DELAY_EN;
|
||||
@@ -1397,7 +1397,7 @@ qca8k_phylink_mac_config(struct dsa_swit
|
||||
|
||||
val |= QCA8K_SGMII_EN_SD;
|
||||
|
||||
- if (priv->sgmii_enable_pll)
|
||||
+ if (priv->ports_config.sgmii_enable_pll)
|
||||
val |= QCA8K_SGMII_EN_PLL | QCA8K_SGMII_EN_RX |
|
||||
QCA8K_SGMII_EN_TX;
|
||||
|
||||
@@ -1425,10 +1425,10 @@ qca8k_phylink_mac_config(struct dsa_swit
|
||||
val = 0;
|
||||
|
||||
/* SGMII Clock phase configuration */
|
||||
- if (priv->sgmii_rx_clk_falling_edge)
|
||||
+ if (priv->ports_config.sgmii_rx_clk_falling_edge)
|
||||
val |= QCA8K_PORT0_PAD_SGMII_RXCLK_FALLING_EDGE;
|
||||
|
||||
- if (priv->sgmii_tx_clk_falling_edge)
|
||||
+ if (priv->ports_config.sgmii_tx_clk_falling_edge)
|
||||
val |= QCA8K_PORT0_PAD_SGMII_TXCLK_FALLING_EDGE;
|
||||
|
||||
if (val)
|
||||
--- a/drivers/net/dsa/qca8k.h
|
||||
+++ b/drivers/net/dsa/qca8k.h
|
||||
@@ -270,15 +270,19 @@ enum {
|
||||
QCA8K_CPU_PORT6,
|
||||
};
|
||||
|
||||
-struct qca8k_priv {
|
||||
- u8 switch_id;
|
||||
- u8 switch_revision;
|
||||
+struct qca8k_ports_config {
|
||||
bool sgmii_rx_clk_falling_edge;
|
||||
bool sgmii_tx_clk_falling_edge;
|
||||
bool sgmii_enable_pll;
|
||||
u8 rgmii_rx_delay[QCA8K_NUM_CPU_PORTS]; /* 0: CPU port0, 1: CPU port6 */
|
||||
u8 rgmii_tx_delay[QCA8K_NUM_CPU_PORTS]; /* 0: CPU port0, 1: CPU port6 */
|
||||
+};
|
||||
+
|
||||
+struct qca8k_priv {
|
||||
+ u8 switch_id;
|
||||
+ u8 switch_revision;
|
||||
bool legacy_phy_port_mapping;
|
||||
+ struct qca8k_ports_config ports_config;
|
||||
struct regmap *regmap;
|
||||
struct mii_bus *bus;
|
||||
struct ar8xxx_port_status port_sts[QCA8K_NUM_PORTS];
|
|
@ -0,0 +1,26 @@
|
|||
From e52073a8e3086046a098b8a7cbeb282ff0cdb424 Mon Sep 17 00:00:00 2001
|
||||
From: Ansuel Smith <ansuelsmth@gmail.com>
|
||||
Date: Thu, 14 Oct 2021 00:39:20 +0200
|
||||
Subject: dt-bindings: net: ipq8064-mdio: fix warning with new qca8k switch
|
||||
|
||||
Fix warning now that we have qca8k switch Documentation using yaml.
|
||||
|
||||
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
---
|
||||
Documentation/devicetree/bindings/net/qcom,ipq8064-mdio.yaml | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/Documentation/devicetree/bindings/net/qcom,ipq8064-mdio.yaml
|
||||
+++ b/Documentation/devicetree/bindings/net/qcom,ipq8064-mdio.yaml
|
||||
@@ -51,6 +51,9 @@ examples:
|
||||
switch@10 {
|
||||
compatible = "qca,qca8337";
|
||||
reg = <0x10>;
|
||||
- /* ... */
|
||||
+
|
||||
+ ports {
|
||||
+ /* ... */
|
||||
+ };
|
||||
};
|
||||
};
|
|
@ -0,0 +1,631 @@
|
|||
From d291fbb8245d5ba04979fed85575860a5cea7196 Mon Sep 17 00:00:00 2001
|
||||
From: Matthew Hagan <mnhagan88@gmail.com>
|
||||
Date: Thu, 14 Oct 2021 00:39:21 +0200
|
||||
Subject: dt-bindings: net: dsa: qca8k: convert to YAML schema
|
||||
|
||||
Convert the qca8k bindings to YAML format.
|
||||
|
||||
Signed-off-by: Matthew Hagan <mnhagan88@gmail.com>
|
||||
Co-developed-by: Ansuel Smith <ansuelsmth@gmail.com>
|
||||
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
---
|
||||
.../devicetree/bindings/net/dsa/qca8k.txt | 245 --------------
|
||||
.../devicetree/bindings/net/dsa/qca8k.yaml | 362 +++++++++++++++++++++
|
||||
2 files changed, 362 insertions(+), 245 deletions(-)
|
||||
delete mode 100644 Documentation/devicetree/bindings/net/dsa/qca8k.txt
|
||||
create mode 100644 Documentation/devicetree/bindings/net/dsa/qca8k.yaml
|
||||
|
||||
--- a/Documentation/devicetree/bindings/net/dsa/qca8k.txt
|
||||
+++ /dev/null
|
||||
@@ -1,245 +0,0 @@
|
||||
-* Qualcomm Atheros QCA8xxx switch family
|
||||
-
|
||||
-Required properties:
|
||||
-
|
||||
-- compatible: should be one of:
|
||||
- "qca,qca8328": referenced as AR8328(N)-AK1(A/B) QFN 176 pin package
|
||||
- "qca,qca8327": referenced as AR8327(N)-AL1A DR-QFN 148 pin package
|
||||
- "qca,qca8334": referenced as QCA8334-AL3C QFN 88 pin package
|
||||
- "qca,qca8337": referenced as QCA8337N-AL3(B/C) DR-QFN 148 pin package
|
||||
-
|
||||
-- #size-cells: must be 0
|
||||
-- #address-cells: must be 1
|
||||
-
|
||||
-Optional properties:
|
||||
-
|
||||
-- reset-gpios: GPIO to be used to reset the whole device
|
||||
-- qca,ignore-power-on-sel: Ignore power on pin strapping to configure led open
|
||||
- drain or eeprom presence. This is needed for broken
|
||||
- devices that have wrong configuration or when the oem
|
||||
- decided to not use pin strapping and fallback to sw
|
||||
- regs.
|
||||
-- qca,led-open-drain: Set leds to open-drain mode. This requires the
|
||||
- qca,ignore-power-on-sel to be set or the driver will fail
|
||||
- to probe. This is needed if the oem doesn't use pin
|
||||
- strapping to set this mode and prefers to set it using sw
|
||||
- regs. The pin strapping related to led open drain mode is
|
||||
- the pin B68 for QCA832x and B49 for QCA833x
|
||||
-
|
||||
-Subnodes:
|
||||
-
|
||||
-The integrated switch subnode should be specified according to the binding
|
||||
-described in dsa/dsa.txt. If the QCA8K switch is connect to a SoC's external
|
||||
-mdio-bus each subnode describing a port needs to have a valid phandle
|
||||
-referencing the internal PHY it is connected to. This is because there's no
|
||||
-N:N mapping of port and PHY id.
|
||||
-To declare the internal mdio-bus configuration, declare a mdio node in the
|
||||
-switch node and declare the phandle for the port referencing the internal
|
||||
-PHY is connected to. In this config a internal mdio-bus is registered and
|
||||
-the mdio MASTER is used as communication.
|
||||
-
|
||||
-Don't use mixed external and internal mdio-bus configurations, as this is
|
||||
-not supported by the hardware.
|
||||
-
|
||||
-This switch support 2 CPU port. Normally and advised configuration is with
|
||||
-CPU port set to port 0. It is also possible to set the CPU port to port 6
|
||||
-if the device requires it. The driver will configure the switch to the defined
|
||||
-port. With both CPU port declared the first CPU port is selected as primary
|
||||
-and the secondary CPU ignored.
|
||||
-
|
||||
-A CPU port node has the following optional node:
|
||||
-
|
||||
-- fixed-link : Fixed-link subnode describing a link to a non-MDIO
|
||||
- managed entity. See
|
||||
- Documentation/devicetree/bindings/net/fixed-link.txt
|
||||
- for details.
|
||||
-- qca,sgmii-rxclk-falling-edge: Set the receive clock phase to falling edge.
|
||||
- Mostly used in qca8327 with CPU port 0 set to
|
||||
- sgmii.
|
||||
-- qca,sgmii-txclk-falling-edge: Set the transmit clock phase to falling edge.
|
||||
-- qca,sgmii-enable-pll : For SGMII CPU port, explicitly enable PLL, TX and RX
|
||||
- chain along with Signal Detection.
|
||||
- This should NOT be enabled for qca8327. If enabled with
|
||||
- qca8327 the sgmii port won't correctly init and an err
|
||||
- is printed.
|
||||
- This can be required for qca8337 switch with revision 2.
|
||||
- A warning is displayed when used with revision greater
|
||||
- 2.
|
||||
- With CPU port set to sgmii and qca8337 it is advised
|
||||
- to set this unless a communication problem is observed.
|
||||
-
|
||||
-For QCA8K the 'fixed-link' sub-node supports only the following properties:
|
||||
-
|
||||
-- 'speed' (integer, mandatory), to indicate the link speed. Accepted
|
||||
- values are 10, 100 and 1000
|
||||
-- 'full-duplex' (boolean, optional), to indicate that full duplex is
|
||||
- used. When absent, half duplex is assumed.
|
||||
-
|
||||
-Examples:
|
||||
-
|
||||
-for the external mdio-bus configuration:
|
||||
-
|
||||
- &mdio0 {
|
||||
- phy_port1: phy@0 {
|
||||
- reg = <0>;
|
||||
- };
|
||||
-
|
||||
- phy_port2: phy@1 {
|
||||
- reg = <1>;
|
||||
- };
|
||||
-
|
||||
- phy_port3: phy@2 {
|
||||
- reg = <2>;
|
||||
- };
|
||||
-
|
||||
- phy_port4: phy@3 {
|
||||
- reg = <3>;
|
||||
- };
|
||||
-
|
||||
- phy_port5: phy@4 {
|
||||
- reg = <4>;
|
||||
- };
|
||||
-
|
||||
- switch@10 {
|
||||
- compatible = "qca,qca8337";
|
||||
- #address-cells = <1>;
|
||||
- #size-cells = <0>;
|
||||
-
|
||||
- reset-gpios = <&gpio 42 GPIO_ACTIVE_LOW>;
|
||||
- reg = <0x10>;
|
||||
-
|
||||
- ports {
|
||||
- #address-cells = <1>;
|
||||
- #size-cells = <0>;
|
||||
- port@0 {
|
||||
- reg = <0>;
|
||||
- label = "cpu";
|
||||
- ethernet = <&gmac1>;
|
||||
- phy-mode = "rgmii";
|
||||
- fixed-link {
|
||||
- speed = 1000;
|
||||
- full-duplex;
|
||||
- };
|
||||
- };
|
||||
-
|
||||
- port@1 {
|
||||
- reg = <1>;
|
||||
- label = "lan1";
|
||||
- phy-handle = <&phy_port1>;
|
||||
- };
|
||||
-
|
||||
- port@2 {
|
||||
- reg = <2>;
|
||||
- label = "lan2";
|
||||
- phy-handle = <&phy_port2>;
|
||||
- };
|
||||
-
|
||||
- port@3 {
|
||||
- reg = <3>;
|
||||
- label = "lan3";
|
||||
- phy-handle = <&phy_port3>;
|
||||
- };
|
||||
-
|
||||
- port@4 {
|
||||
- reg = <4>;
|
||||
- label = "lan4";
|
||||
- phy-handle = <&phy_port4>;
|
||||
- };
|
||||
-
|
||||
- port@5 {
|
||||
- reg = <5>;
|
||||
- label = "wan";
|
||||
- phy-handle = <&phy_port5>;
|
||||
- };
|
||||
- };
|
||||
- };
|
||||
- };
|
||||
-
|
||||
-for the internal master mdio-bus configuration:
|
||||
-
|
||||
- &mdio0 {
|
||||
- switch@10 {
|
||||
- compatible = "qca,qca8337";
|
||||
- #address-cells = <1>;
|
||||
- #size-cells = <0>;
|
||||
-
|
||||
- reset-gpios = <&gpio 42 GPIO_ACTIVE_LOW>;
|
||||
- reg = <0x10>;
|
||||
-
|
||||
- ports {
|
||||
- #address-cells = <1>;
|
||||
- #size-cells = <0>;
|
||||
-
|
||||
- port@0 {
|
||||
- reg = <0>;
|
||||
- label = "cpu";
|
||||
- ethernet = <&gmac1>;
|
||||
- phy-mode = "rgmii";
|
||||
- fixed-link {
|
||||
- speed = 1000;
|
||||
- full-duplex;
|
||||
- };
|
||||
- };
|
||||
-
|
||||
- port@1 {
|
||||
- reg = <1>;
|
||||
- label = "lan1";
|
||||
- phy-mode = "internal";
|
||||
- phy-handle = <&phy_port1>;
|
||||
- };
|
||||
-
|
||||
- port@2 {
|
||||
- reg = <2>;
|
||||
- label = "lan2";
|
||||
- phy-mode = "internal";
|
||||
- phy-handle = <&phy_port2>;
|
||||
- };
|
||||
-
|
||||
- port@3 {
|
||||
- reg = <3>;
|
||||
- label = "lan3";
|
||||
- phy-mode = "internal";
|
||||
- phy-handle = <&phy_port3>;
|
||||
- };
|
||||
-
|
||||
- port@4 {
|
||||
- reg = <4>;
|
||||
- label = "lan4";
|
||||
- phy-mode = "internal";
|
||||
- phy-handle = <&phy_port4>;
|
||||
- };
|
||||
-
|
||||
- port@5 {
|
||||
- reg = <5>;
|
||||
- label = "wan";
|
||||
- phy-mode = "internal";
|
||||
- phy-handle = <&phy_port5>;
|
||||
- };
|
||||
- };
|
||||
-
|
||||
- mdio {
|
||||
- #address-cells = <1>;
|
||||
- #size-cells = <0>;
|
||||
-
|
||||
- phy_port1: phy@0 {
|
||||
- reg = <0>;
|
||||
- };
|
||||
-
|
||||
- phy_port2: phy@1 {
|
||||
- reg = <1>;
|
||||
- };
|
||||
-
|
||||
- phy_port3: phy@2 {
|
||||
- reg = <2>;
|
||||
- };
|
||||
-
|
||||
- phy_port4: phy@3 {
|
||||
- reg = <3>;
|
||||
- };
|
||||
-
|
||||
- phy_port5: phy@4 {
|
||||
- reg = <4>;
|
||||
- };
|
||||
- };
|
||||
- };
|
||||
- };
|
||||
--- /dev/null
|
||||
+++ b/Documentation/devicetree/bindings/net/dsa/qca8k.yaml
|
||||
@@ -0,0 +1,362 @@
|
||||
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
|
||||
+%YAML 1.2
|
||||
+---
|
||||
+$id: http://devicetree.org/schemas/net/dsa/qca8k.yaml#
|
||||
+$schema: http://devicetree.org/meta-schemas/core.yaml#
|
||||
+
|
||||
+title: Qualcomm Atheros QCA83xx switch family
|
||||
+
|
||||
+maintainers:
|
||||
+ - John Crispin <john@phrozen.org>
|
||||
+
|
||||
+description:
|
||||
+ If the QCA8K switch is connect to an SoC's external mdio-bus, each subnode
|
||||
+ describing a port needs to have a valid phandle referencing the internal PHY
|
||||
+ it is connected to. This is because there is no N:N mapping of port and PHY
|
||||
+ ID. To declare the internal mdio-bus configuration, declare an MDIO node in
|
||||
+ the switch node and declare the phandle for the port, referencing the internal
|
||||
+ PHY it is connected to. In this config, an internal mdio-bus is registered and
|
||||
+ the MDIO master is used for communication. Mixed external and internal
|
||||
+ mdio-bus configurations are not supported by the hardware.
|
||||
+
|
||||
+properties:
|
||||
+ compatible:
|
||||
+ oneOf:
|
||||
+ - enum:
|
||||
+ - qca,qca8327
|
||||
+ - qca,qca8328
|
||||
+ - qca,qca8334
|
||||
+ - qca,qca8337
|
||||
+ description: |
|
||||
+ qca,qca8328: referenced as AR8328(N)-AK1(A/B) QFN 176 pin package
|
||||
+ qca,qca8327: referenced as AR8327(N)-AL1A DR-QFN 148 pin package
|
||||
+ qca,qca8334: referenced as QCA8334-AL3C QFN 88 pin package
|
||||
+ qca,qca8337: referenced as QCA8337N-AL3(B/C) DR-QFN 148 pin package
|
||||
+
|
||||
+ reg:
|
||||
+ maxItems: 1
|
||||
+
|
||||
+ reset-gpios:
|
||||
+ description:
|
||||
+ GPIO to be used to reset the whole device
|
||||
+ maxItems: 1
|
||||
+
|
||||
+ qca,ignore-power-on-sel:
|
||||
+ $ref: /schemas/types.yaml#/definitions/flag
|
||||
+ description:
|
||||
+ Ignore power-on pin strapping to configure LED open-drain or EEPROM
|
||||
+ presence. This is needed for devices with incorrect configuration or when
|
||||
+ the OEM has decided not to use pin strapping and falls back to SW regs.
|
||||
+
|
||||
+ qca,led-open-drain:
|
||||
+ $ref: /schemas/types.yaml#/definitions/flag
|
||||
+ description:
|
||||
+ Set LEDs to open-drain mode. This requires the qca,ignore-power-on-sel to
|
||||
+ be set, otherwise the driver will fail at probe. This is required if the
|
||||
+ OEM does not use pin strapping to set this mode and prefers to set it
|
||||
+ using SW regs. The pin strappings related to LED open-drain mode are
|
||||
+ B68 on the QCA832x and B49 on the QCA833x.
|
||||
+
|
||||
+ mdio:
|
||||
+ type: object
|
||||
+ description: Qca8k switch have an internal mdio to access switch port.
|
||||
+ If this is not present, the legacy mapping is used and the
|
||||
+ internal mdio access is used.
|
||||
+ With the legacy mapping the reg corresponding to the internal
|
||||
+ mdio is the switch reg with an offset of -1.
|
||||
+
|
||||
+ properties:
|
||||
+ '#address-cells':
|
||||
+ const: 1
|
||||
+ '#size-cells':
|
||||
+ const: 0
|
||||
+
|
||||
+ patternProperties:
|
||||
+ "^(ethernet-)?phy@[0-4]$":
|
||||
+ type: object
|
||||
+
|
||||
+ allOf:
|
||||
+ - $ref: "http://devicetree.org/schemas/net/mdio.yaml#"
|
||||
+
|
||||
+ properties:
|
||||
+ reg:
|
||||
+ maxItems: 1
|
||||
+
|
||||
+ required:
|
||||
+ - reg
|
||||
+
|
||||
+patternProperties:
|
||||
+ "^(ethernet-)?ports$":
|
||||
+ type: object
|
||||
+ properties:
|
||||
+ '#address-cells':
|
||||
+ const: 1
|
||||
+ '#size-cells':
|
||||
+ const: 0
|
||||
+
|
||||
+ patternProperties:
|
||||
+ "^(ethernet-)?port@[0-6]$":
|
||||
+ type: object
|
||||
+ description: Ethernet switch ports
|
||||
+
|
||||
+ properties:
|
||||
+ reg:
|
||||
+ description: Port number
|
||||
+
|
||||
+ label:
|
||||
+ description:
|
||||
+ Describes the label associated with this port, which will become
|
||||
+ the netdev name
|
||||
+ $ref: /schemas/types.yaml#/definitions/string
|
||||
+
|
||||
+ link:
|
||||
+ description:
|
||||
+ Should be a list of phandles to other switch's DSA port. This
|
||||
+ port is used as the outgoing port towards the phandle ports. The
|
||||
+ full routing information must be given, not just the one hop
|
||||
+ routes to neighbouring switches
|
||||
+ $ref: /schemas/types.yaml#/definitions/phandle-array
|
||||
+
|
||||
+ ethernet:
|
||||
+ description:
|
||||
+ Should be a phandle to a valid Ethernet device node. This host
|
||||
+ device is what the switch port is connected to
|
||||
+ $ref: /schemas/types.yaml#/definitions/phandle
|
||||
+
|
||||
+ phy-handle: true
|
||||
+
|
||||
+ phy-mode: true
|
||||
+
|
||||
+ fixed-link: true
|
||||
+
|
||||
+ mac-address: true
|
||||
+
|
||||
+ sfp: true
|
||||
+
|
||||
+ qca,sgmii-rxclk-falling-edge:
|
||||
+ $ref: /schemas/types.yaml#/definitions/flag
|
||||
+ description:
|
||||
+ Set the receive clock phase to falling edge. Mostly commonly used on
|
||||
+ the QCA8327 with CPU port 0 set to SGMII.
|
||||
+
|
||||
+ qca,sgmii-txclk-falling-edge:
|
||||
+ $ref: /schemas/types.yaml#/definitions/flag
|
||||
+ description:
|
||||
+ Set the transmit clock phase to falling edge.
|
||||
+
|
||||
+ qca,sgmii-enable-pll:
|
||||
+ $ref: /schemas/types.yaml#/definitions/flag
|
||||
+ description:
|
||||
+ For SGMII CPU port, explicitly enable PLL, TX and RX chain along with
|
||||
+ Signal Detection. On the QCA8327 this should not be enabled, otherwise
|
||||
+ the SGMII port will not initialize. When used on the QCA8337, revision 3
|
||||
+ or greater, a warning will be displayed. When the CPU port is set to
|
||||
+ SGMII on the QCA8337, it is advised to set this unless a communication
|
||||
+ issue is observed.
|
||||
+
|
||||
+ required:
|
||||
+ - reg
|
||||
+
|
||||
+ additionalProperties: false
|
||||
+
|
||||
+oneOf:
|
||||
+ - required:
|
||||
+ - ports
|
||||
+ - required:
|
||||
+ - ethernet-ports
|
||||
+
|
||||
+required:
|
||||
+ - compatible
|
||||
+ - reg
|
||||
+
|
||||
+additionalProperties: true
|
||||
+
|
||||
+examples:
|
||||
+ - |
|
||||
+ #include <dt-bindings/gpio/gpio.h>
|
||||
+
|
||||
+ mdio {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+
|
||||
+ external_phy_port1: ethernet-phy@0 {
|
||||
+ reg = <0>;
|
||||
+ };
|
||||
+
|
||||
+ external_phy_port2: ethernet-phy@1 {
|
||||
+ reg = <1>;
|
||||
+ };
|
||||
+
|
||||
+ external_phy_port3: ethernet-phy@2 {
|
||||
+ reg = <2>;
|
||||
+ };
|
||||
+
|
||||
+ external_phy_port4: ethernet-phy@3 {
|
||||
+ reg = <3>;
|
||||
+ };
|
||||
+
|
||||
+ external_phy_port5: ethernet-phy@4 {
|
||||
+ reg = <4>;
|
||||
+ };
|
||||
+
|
||||
+ switch@10 {
|
||||
+ compatible = "qca,qca8337";
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+ reset-gpios = <&gpio 42 GPIO_ACTIVE_LOW>;
|
||||
+ reg = <0x10>;
|
||||
+
|
||||
+ ports {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+
|
||||
+ port@0 {
|
||||
+ reg = <0>;
|
||||
+ label = "cpu";
|
||||
+ ethernet = <&gmac1>;
|
||||
+ phy-mode = "rgmii";
|
||||
+
|
||||
+ fixed-link {
|
||||
+ speed = <1000>;
|
||||
+ full-duplex;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ port@1 {
|
||||
+ reg = <1>;
|
||||
+ label = "lan1";
|
||||
+ phy-handle = <&external_phy_port1>;
|
||||
+ };
|
||||
+
|
||||
+ port@2 {
|
||||
+ reg = <2>;
|
||||
+ label = "lan2";
|
||||
+ phy-handle = <&external_phy_port2>;
|
||||
+ };
|
||||
+
|
||||
+ port@3 {
|
||||
+ reg = <3>;
|
||||
+ label = "lan3";
|
||||
+ phy-handle = <&external_phy_port3>;
|
||||
+ };
|
||||
+
|
||||
+ port@4 {
|
||||
+ reg = <4>;
|
||||
+ label = "lan4";
|
||||
+ phy-handle = <&external_phy_port4>;
|
||||
+ };
|
||||
+
|
||||
+ port@5 {
|
||||
+ reg = <5>;
|
||||
+ label = "wan";
|
||||
+ phy-handle = <&external_phy_port5>;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+ - |
|
||||
+ #include <dt-bindings/gpio/gpio.h>
|
||||
+
|
||||
+ mdio {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+
|
||||
+ switch@10 {
|
||||
+ compatible = "qca,qca8337";
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+ reset-gpios = <&gpio 42 GPIO_ACTIVE_LOW>;
|
||||
+ reg = <0x10>;
|
||||
+
|
||||
+ ports {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+
|
||||
+ port@0 {
|
||||
+ reg = <0>;
|
||||
+ label = "cpu";
|
||||
+ ethernet = <&gmac1>;
|
||||
+ phy-mode = "rgmii";
|
||||
+
|
||||
+ fixed-link {
|
||||
+ speed = <1000>;
|
||||
+ full-duplex;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ port@1 {
|
||||
+ reg = <1>;
|
||||
+ label = "lan1";
|
||||
+ phy-mode = "internal";
|
||||
+ phy-handle = <&internal_phy_port1>;
|
||||
+ };
|
||||
+
|
||||
+ port@2 {
|
||||
+ reg = <2>;
|
||||
+ label = "lan2";
|
||||
+ phy-mode = "internal";
|
||||
+ phy-handle = <&internal_phy_port2>;
|
||||
+ };
|
||||
+
|
||||
+ port@3 {
|
||||
+ reg = <3>;
|
||||
+ label = "lan3";
|
||||
+ phy-mode = "internal";
|
||||
+ phy-handle = <&internal_phy_port3>;
|
||||
+ };
|
||||
+
|
||||
+ port@4 {
|
||||
+ reg = <4>;
|
||||
+ label = "lan4";
|
||||
+ phy-mode = "internal";
|
||||
+ phy-handle = <&internal_phy_port4>;
|
||||
+ };
|
||||
+
|
||||
+ port@5 {
|
||||
+ reg = <5>;
|
||||
+ label = "wan";
|
||||
+ phy-mode = "internal";
|
||||
+ phy-handle = <&internal_phy_port5>;
|
||||
+ };
|
||||
+
|
||||
+ port@6 {
|
||||
+ reg = <0>;
|
||||
+ label = "cpu";
|
||||
+ ethernet = <&gmac1>;
|
||||
+ phy-mode = "sgmii";
|
||||
+
|
||||
+ qca,sgmii-rxclk-falling-edge;
|
||||
+
|
||||
+ fixed-link {
|
||||
+ speed = <1000>;
|
||||
+ full-duplex;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ mdio {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+
|
||||
+ internal_phy_port1: ethernet-phy@0 {
|
||||
+ reg = <0>;
|
||||
+ };
|
||||
+
|
||||
+ internal_phy_port2: ethernet-phy@1 {
|
||||
+ reg = <1>;
|
||||
+ };
|
||||
+
|
||||
+ internal_phy_port3: ethernet-phy@2 {
|
||||
+ reg = <2>;
|
||||
+ };
|
||||
+
|
||||
+ internal_phy_port4: ethernet-phy@3 {
|
||||
+ reg = <3>;
|
||||
+ };
|
||||
+
|
||||
+ internal_phy_port5: ethernet-phy@4 {
|
||||
+ reg = <4>;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
|
@ -0,0 +1,28 @@
|
|||
From 06dd34a628ae5b6a839b757e746de165d6789ca8 Mon Sep 17 00:00:00 2001
|
||||
From: Ansuel Smith <ansuelsmth@gmail.com>
|
||||
Date: Sun, 17 Oct 2021 16:56:46 +0200
|
||||
Subject: net: dsa: qca8k: fix delay applied to wrong cpu in parse_port_config
|
||||
|
||||
Fix delay settings applied to wrong cpu in parse_port_config. The delay
|
||||
values is set to the wrong index as the cpu_port_index is incremented
|
||||
too early. Start the cpu_port_index to -1 so the correct value is
|
||||
applied to address also the case with invalid phy mode and not available
|
||||
port.
|
||||
|
||||
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
---
|
||||
drivers/net/dsa/qca8k.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/drivers/net/dsa/qca8k.c
|
||||
+++ b/drivers/net/dsa/qca8k.c
|
||||
@@ -976,7 +976,7 @@ qca8k_setup_of_pws_reg(struct qca8k_priv
|
||||
static int
|
||||
qca8k_parse_port_config(struct qca8k_priv *priv)
|
||||
{
|
||||
- int port, cpu_port_index = 0, ret;
|
||||
+ int port, cpu_port_index = -1, ret;
|
||||
struct device_node *port_dn;
|
||||
phy_interface_t mode;
|
||||
struct dsa_port *dp;
|
|
@ -0,0 +1,151 @@
|
|||
From 040e926f5813a5f4cc18dbff7c942d1e52f368f2 Mon Sep 17 00:00:00 2001
|
||||
From: Ansuel Smith <ansuelsmth@gmail.com>
|
||||
Date: Tue, 19 Oct 2021 02:08:50 +0200
|
||||
Subject: net: dsa: qca8k: tidy for loop in setup and add cpu port check
|
||||
|
||||
Tidy and organize qca8k setup function from multiple for loop.
|
||||
Change for loop in bridge leave/join to scan all port and skip cpu port.
|
||||
No functional change intended.
|
||||
|
||||
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
---
|
||||
drivers/net/dsa/qca8k.c | 74 +++++++++++++++++++++++++++++--------------------
|
||||
1 file changed, 44 insertions(+), 30 deletions(-)
|
||||
|
||||
--- a/drivers/net/dsa/qca8k.c
|
||||
+++ b/drivers/net/dsa/qca8k.c
|
||||
@@ -1122,28 +1122,34 @@ qca8k_setup(struct dsa_switch *ds)
|
||||
if (ret)
|
||||
dev_warn(priv->dev, "mib init failed");
|
||||
|
||||
- /* Enable QCA header mode on the cpu port */
|
||||
- ret = qca8k_write(priv, QCA8K_REG_PORT_HDR_CTRL(cpu_port),
|
||||
- QCA8K_PORT_HDR_CTRL_ALL << QCA8K_PORT_HDR_CTRL_TX_S |
|
||||
- QCA8K_PORT_HDR_CTRL_ALL << QCA8K_PORT_HDR_CTRL_RX_S);
|
||||
- if (ret) {
|
||||
- dev_err(priv->dev, "failed enabling QCA header mode");
|
||||
- return ret;
|
||||
- }
|
||||
-
|
||||
- /* Disable forwarding by default on all ports */
|
||||
+ /* Initial setup of all ports */
|
||||
for (i = 0; i < QCA8K_NUM_PORTS; i++) {
|
||||
+ /* Disable forwarding by default on all ports */
|
||||
ret = qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(i),
|
||||
QCA8K_PORT_LOOKUP_MEMBER, 0);
|
||||
if (ret)
|
||||
return ret;
|
||||
- }
|
||||
|
||||
- /* Disable MAC by default on all ports */
|
||||
- for (i = 1; i < QCA8K_NUM_PORTS; i++)
|
||||
- qca8k_port_set_status(priv, i, 0);
|
||||
+ /* Enable QCA header mode on all cpu ports */
|
||||
+ if (dsa_is_cpu_port(ds, i)) {
|
||||
+ ret = qca8k_write(priv, QCA8K_REG_PORT_HDR_CTRL(i),
|
||||
+ QCA8K_PORT_HDR_CTRL_ALL << QCA8K_PORT_HDR_CTRL_TX_S |
|
||||
+ QCA8K_PORT_HDR_CTRL_ALL << QCA8K_PORT_HDR_CTRL_RX_S);
|
||||
+ if (ret) {
|
||||
+ dev_err(priv->dev, "failed enabling QCA header mode");
|
||||
+ return ret;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /* Disable MAC by default on all user ports */
|
||||
+ if (dsa_is_user_port(ds, i))
|
||||
+ qca8k_port_set_status(priv, i, 0);
|
||||
+ }
|
||||
|
||||
- /* Forward all unknown frames to CPU port for Linux processing */
|
||||
+ /* Forward all unknown frames to CPU port for Linux processing
|
||||
+ * Notice that in multi-cpu config only one port should be set
|
||||
+ * for igmp, unknown, multicast and broadcast packet
|
||||
+ */
|
||||
ret = qca8k_write(priv, QCA8K_REG_GLOBAL_FW_CTRL1,
|
||||
BIT(cpu_port) << QCA8K_GLOBAL_FW_CTRL1_IGMP_DP_S |
|
||||
BIT(cpu_port) << QCA8K_GLOBAL_FW_CTRL1_BC_DP_S |
|
||||
@@ -1152,11 +1158,13 @@ qca8k_setup(struct dsa_switch *ds)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
- /* Setup connection between CPU port & user ports */
|
||||
+ /* Setup connection between CPU port & user ports
|
||||
+ * Configure specific switch configuration for ports
|
||||
+ */
|
||||
for (i = 0; i < QCA8K_NUM_PORTS; i++) {
|
||||
/* CPU port gets connected to all user ports of the switch */
|
||||
if (dsa_is_cpu_port(ds, i)) {
|
||||
- ret = qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(cpu_port),
|
||||
+ ret = qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(i),
|
||||
QCA8K_PORT_LOOKUP_MEMBER, dsa_user_ports(ds));
|
||||
if (ret)
|
||||
return ret;
|
||||
@@ -1193,16 +1201,14 @@ qca8k_setup(struct dsa_switch *ds)
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
- }
|
||||
|
||||
- /* The port 5 of the qca8337 have some problem in flood condition. The
|
||||
- * original legacy driver had some specific buffer and priority settings
|
||||
- * for the different port suggested by the QCA switch team. Add this
|
||||
- * missing settings to improve switch stability under load condition.
|
||||
- * This problem is limited to qca8337 and other qca8k switch are not affected.
|
||||
- */
|
||||
- if (priv->switch_id == QCA8K_ID_QCA8337) {
|
||||
- for (i = 0; i < QCA8K_NUM_PORTS; i++) {
|
||||
+ /* The port 5 of the qca8337 have some problem in flood condition. The
|
||||
+ * original legacy driver had some specific buffer and priority settings
|
||||
+ * for the different port suggested by the QCA switch team. Add this
|
||||
+ * missing settings to improve switch stability under load condition.
|
||||
+ * This problem is limited to qca8337 and other qca8k switch are not affected.
|
||||
+ */
|
||||
+ if (priv->switch_id == QCA8K_ID_QCA8337) {
|
||||
switch (i) {
|
||||
/* The 2 CPU port and port 5 requires some different
|
||||
* priority than any other ports.
|
||||
@@ -1238,6 +1244,12 @@ qca8k_setup(struct dsa_switch *ds)
|
||||
QCA8K_PORT_HOL_CTRL1_WRED_EN,
|
||||
mask);
|
||||
}
|
||||
+
|
||||
+ /* Set initial MTU for every port.
|
||||
+ * We have only have a general MTU setting. So track
|
||||
+ * every port and set the max across all port.
|
||||
+ */
|
||||
+ priv->port_mtu[i] = ETH_FRAME_LEN + ETH_FCS_LEN;
|
||||
}
|
||||
|
||||
/* Special GLOBAL_FC_THRESH value are needed for ar8327 switch */
|
||||
@@ -1251,8 +1263,6 @@ qca8k_setup(struct dsa_switch *ds)
|
||||
}
|
||||
|
||||
/* Setup our port MTUs to match power on defaults */
|
||||
- for (i = 0; i < QCA8K_NUM_PORTS; i++)
|
||||
- priv->port_mtu[i] = ETH_FRAME_LEN + ETH_FCS_LEN;
|
||||
ret = qca8k_write(priv, QCA8K_MAX_FRAME_SIZE, ETH_FRAME_LEN + ETH_FCS_LEN);
|
||||
if (ret)
|
||||
dev_warn(priv->dev, "failed setting MTU settings");
|
||||
@@ -1728,7 +1738,9 @@ qca8k_port_bridge_join(struct dsa_switch
|
||||
cpu_port = dsa_to_port(ds, port)->cpu_dp->index;
|
||||
port_mask = BIT(cpu_port);
|
||||
|
||||
- for (i = 1; i < QCA8K_NUM_PORTS; i++) {
|
||||
+ for (i = 0; i < QCA8K_NUM_PORTS; i++) {
|
||||
+ if (dsa_is_cpu_port(ds, i))
|
||||
+ continue;
|
||||
if (dsa_to_port(ds, i)->bridge_dev != br)
|
||||
continue;
|
||||
/* Add this port to the portvlan mask of the other ports
|
||||
@@ -1758,7 +1770,9 @@ qca8k_port_bridge_leave(struct dsa_switc
|
||||
|
||||
cpu_port = dsa_to_port(ds, port)->cpu_dp->index;
|
||||
|
||||
- for (i = 1; i < QCA8K_NUM_PORTS; i++) {
|
||||
+ for (i = 0; i < QCA8K_NUM_PORTS; i++) {
|
||||
+ if (dsa_is_cpu_port(ds, i))
|
||||
+ continue;
|
||||
if (dsa_to_port(ds, i)->bridge_dev != br)
|
||||
continue;
|
||||
/* Remove this port to the portvlan mask of the other ports
|
|
@ -0,0 +1,47 @@
|
|||
From 5f15d392dcb4aa250a63d6f2c5adfc26c0aedc78 Mon Sep 17 00:00:00 2001
|
||||
From: Ansuel Smith <ansuelsmth@gmail.com>
|
||||
Date: Tue, 2 Nov 2021 19:30:41 +0100
|
||||
Subject: net: dsa: qca8k: make sure PAD0 MAC06 exchange is disabled
|
||||
|
||||
Some device set MAC06 exchange in the bootloader. This cause some
|
||||
problem as we don't support this strange mode and we just set the port6
|
||||
as the primary CPU port. With MAC06 exchange, PAD0 reg configure port6
|
||||
instead of port0. Add an extra check and explicitly disable MAC06 exchange
|
||||
to correctly configure the port PAD config.
|
||||
|
||||
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
|
||||
Fixes: 3fcf734aa482 ("net: dsa: qca8k: add support for cpu port 6")
|
||||
Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
---
|
||||
drivers/net/dsa/qca8k.c | 8 ++++++++
|
||||
drivers/net/dsa/qca8k.h | 1 +
|
||||
2 files changed, 9 insertions(+)
|
||||
|
||||
--- a/drivers/net/dsa/qca8k.c
|
||||
+++ b/drivers/net/dsa/qca8k.c
|
||||
@@ -1109,6 +1109,14 @@ qca8k_setup(struct dsa_switch *ds)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
+ /* Make sure MAC06 is disabled */
|
||||
+ ret = qca8k_reg_clear(priv, QCA8K_REG_PORT0_PAD_CTRL,
|
||||
+ QCA8K_PORT0_PAD_MAC06_EXCHANGE_EN);
|
||||
+ if (ret) {
|
||||
+ dev_err(priv->dev, "failed disabling MAC06 exchange");
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
/* Enable CPU Port */
|
||||
ret = qca8k_reg_set(priv, QCA8K_REG_GLOBAL_FW_CTRL0,
|
||||
QCA8K_GLOBAL_FW_CTRL0_CPU_PORT_EN);
|
||||
--- a/drivers/net/dsa/qca8k.h
|
||||
+++ b/drivers/net/dsa/qca8k.h
|
||||
@@ -34,6 +34,7 @@
|
||||
#define QCA8K_MASK_CTRL_DEVICE_ID_MASK GENMASK(15, 8)
|
||||
#define QCA8K_MASK_CTRL_DEVICE_ID(x) ((x) >> 8)
|
||||
#define QCA8K_REG_PORT0_PAD_CTRL 0x004
|
||||
+#define QCA8K_PORT0_PAD_MAC06_EXCHANGE_EN BIT(31)
|
||||
#define QCA8K_PORT0_PAD_SGMII_RXCLK_FALLING_EDGE BIT(19)
|
||||
#define QCA8K_PORT0_PAD_SGMII_TXCLK_FALLING_EDGE BIT(18)
|
||||
#define QCA8K_REG_PORT5_PAD_CTRL 0x008
|
|
@ -88,7 +88,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||
|
||||
--- a/init/Kconfig
|
||||
+++ b/init/Kconfig
|
||||
@@ -2347,6 +2347,13 @@ config UNUSED_KSYMS_WHITELIST
|
||||
@@ -2324,6 +2324,13 @@ config UNUSED_KSYMS_WHITELIST
|
||||
one per line. The path can be absolute, or relative to the kernel
|
||||
source tree.
|
||||
|
||||
|
@ -104,23 +104,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||
config MODULES_TREE_LOOKUP
|
||||
--- a/kernel/module.c
|
||||
+++ b/kernel/module.c
|
||||
@@ -1218,6 +1218,7 @@ static struct module_attribute *modinfo_
|
||||
|
||||
static const char vermagic[] = VERMAGIC_STRING;
|
||||
|
||||
+#if defined(CONFIG_MODVERSIONS) || !defined(CONFIG_MODULE_STRIPPED)
|
||||
static int try_to_force_load(struct module *mod, const char *reason)
|
||||
{
|
||||
#ifdef CONFIG_MODULE_FORCE_LOAD
|
||||
@@ -1229,6 +1230,7 @@ static int try_to_force_load(struct modu
|
||||
return -ENOEXEC;
|
||||
#endif
|
||||
}
|
||||
+#endif
|
||||
|
||||
#ifdef CONFIG_MODVERSIONS
|
||||
|
||||
@@ -3227,9 +3229,11 @@ static int setup_load_info(struct load_i
|
||||
@@ -3227,9 +3227,11 @@ static int setup_load_info(struct load_i
|
||||
|
||||
static int check_modinfo(struct module *mod, struct load_info *info, int flags)
|
||||
{
|
||||
|
@ -133,7 +117,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||
if (flags & MODULE_INIT_IGNORE_VERMAGIC)
|
||||
modmagic = NULL;
|
||||
|
||||
@@ -3250,6 +3254,7 @@ static int check_modinfo(struct module *
|
||||
@@ -3250,6 +3252,7 @@ static int check_modinfo(struct module *
|
||||
mod->name);
|
||||
add_taint_module(mod, TAINT_OOT_MODULE, LOCKDEP_STILL_OK);
|
||||
}
|
||||
|
@ -143,7 +127,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||
|
||||
--- a/scripts/mod/modpost.c
|
||||
+++ b/scripts/mod/modpost.c
|
||||
@@ -2033,7 +2033,9 @@ static void read_symbols(const char *mod
|
||||
@@ -2024,7 +2024,9 @@ static void read_symbols(const char *mod
|
||||
symname = remove_dot(info.strtab + sym->st_name);
|
||||
|
||||
handle_symbol(mod, &info, sym, symname);
|
||||
|
@ -153,7 +137,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||
}
|
||||
|
||||
for (sym = info.symtab_start; sym < info.symtab_stop; sym++) {
|
||||
@@ -2212,8 +2214,10 @@ static void add_header(struct buffer *b,
|
||||
@@ -2203,8 +2205,10 @@ static void add_header(struct buffer *b,
|
||||
buf_printf(b, "BUILD_SALT;\n");
|
||||
buf_printf(b, "BUILD_LTO_INFO;\n");
|
||||
buf_printf(b, "\n");
|
||||
|
@ -164,7 +148,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||
buf_printf(b, "\n");
|
||||
buf_printf(b, "__visible struct module __this_module\n");
|
||||
buf_printf(b, "__section(\".gnu.linkonce.this_module\") = {\n");
|
||||
@@ -2230,8 +2234,10 @@ static void add_header(struct buffer *b,
|
||||
@@ -2221,8 +2225,10 @@ static void add_header(struct buffer *b,
|
||||
|
||||
static void add_intree_flag(struct buffer *b, int is_intree)
|
||||
{
|
||||
|
@ -175,7 +159,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||
}
|
||||
|
||||
/* Cannot check for assembler */
|
||||
@@ -2244,8 +2250,10 @@ static void add_retpoline(struct buffer
|
||||
@@ -2235,8 +2241,10 @@ static void add_retpoline(struct buffer
|
||||
|
||||
static void add_staging_flag(struct buffer *b, const char *name)
|
||||
{
|
||||
|
@ -186,7 +170,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||
}
|
||||
|
||||
/**
|
||||
@@ -2325,11 +2333,13 @@ static void add_depends(struct buffer *b
|
||||
@@ -2316,11 +2324,13 @@ static void add_depends(struct buffer *b
|
||||
|
||||
static void add_srcversion(struct buffer *b, struct module *mod)
|
||||
{
|
||||
|
@ -200,7 +184,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||
}
|
||||
|
||||
static void write_buf(struct buffer *b, const char *fname)
|
||||
@@ -2578,7 +2588,9 @@ int main(int argc, char **argv)
|
||||
@@ -2569,7 +2579,9 @@ int main(int argc, char **argv)
|
||||
add_staging_flag(&buf, mod->name);
|
||||
add_versions(&buf, mod);
|
||||
add_depends(&buf, mod);
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
--- a/scripts/kconfig/conf.c
|
||||
+++ b/scripts/kconfig/conf.c
|
||||
@@ -435,6 +435,8 @@ static int conf_sym(struct menu *menu)
|
||||
break;
|
||||
continue;
|
||||
case 0:
|
||||
+ if (!sym_has_value(sym) && !tty_stdio && getenv("FAIL_ON_UNCONFIGURED"))
|
||||
+ exit(1);
|
||||
newval = oldval;
|
||||
break;
|
||||
case '?':
|
|
@ -3039,7 +3039,7 @@ Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
|
|||
main(int argc, char **argv)
|
||||
--- a/scripts/mod/modpost.h
|
||||
+++ b/scripts/mod/modpost.h
|
||||
@@ -8,7 +8,11 @@
|
||||
@@ -9,7 +9,11 @@
|
||||
#include <sys/mman.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
|
|
@ -68,10 +68,14 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||
+#endif
|
||||
--- a/tools/include/linux/types.h
|
||||
+++ b/tools/include/linux/types.h
|
||||
@@ -10,8 +10,12 @@
|
||||
#define __SANE_USERSPACE_TYPES__ /* For PPC64, to get LL64 types */
|
||||
#endif
|
||||
@@ -6,12 +6,13 @@
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
-#ifndef __SANE_USERSPACE_TYPES__
|
||||
#define __SANE_USERSPACE_TYPES__ /* For PPC64, to get LL64 types */
|
||||
-#endif
|
||||
-
|
||||
+#ifndef __linux__
|
||||
+#include <tools/linux_types.h>
|
||||
+#else
|
||||
|
|
|
@ -1,122 +0,0 @@
|
|||
From e3d8676f5722b7622685581e06e8f53e6138e3ab Mon Sep 17 00:00:00 2001
|
||||
From: Felix Fietkau <nbd@nbd.name>
|
||||
Date: Sat, 15 Jul 2017 23:42:36 +0200
|
||||
Subject: use -ffunction-sections, -fdata-sections and --gc-sections
|
||||
|
||||
In combination with kernel symbol export stripping this significantly reduces
|
||||
the kernel image size. Used on both ARM and MIPS architectures.
|
||||
|
||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
Signed-off-by: Jonas Gorski <jogo@openwrt.org>
|
||||
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
|
||||
---
|
||||
--- a/arch/arm/Kconfig
|
||||
+++ b/arch/arm/Kconfig
|
||||
@@ -117,6 +117,7 @@ config ARM
|
||||
select HAVE_UID16
|
||||
select HAVE_VIRT_CPU_ACCOUNTING_GEN
|
||||
select IRQ_FORCED_THREADING
|
||||
+ select HAVE_LD_DEAD_CODE_DATA_ELIMINATION
|
||||
select MODULES_USE_ELF_REL
|
||||
select NEED_DMA_MAP_STATE
|
||||
select OF_EARLY_FLATTREE if OF
|
||||
--- a/arch/arm/boot/compressed/Makefile
|
||||
+++ b/arch/arm/boot/compressed/Makefile
|
||||
@@ -92,6 +92,7 @@ endif
|
||||
ifeq ($(CONFIG_USE_OF),y)
|
||||
OBJS += $(libfdt_objs) fdt_check_mem_start.o
|
||||
endif
|
||||
+KBUILD_CFLAGS_KERNEL := $(patsubst -f%-sections,,$(KBUILD_CFLAGS_KERNEL))
|
||||
|
||||
# -fstack-protector-strong triggers protection checks in this code,
|
||||
# but it is being used too early to link to meaningful stack_chk logic.
|
||||
--- a/arch/arm/kernel/vmlinux.lds.S
|
||||
+++ b/arch/arm/kernel/vmlinux.lds.S
|
||||
@@ -75,7 +75,7 @@ SECTIONS
|
||||
. = ALIGN(4);
|
||||
__ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) {
|
||||
__start___ex_table = .;
|
||||
- ARM_MMU_KEEP(*(__ex_table))
|
||||
+ KEEP(*(__ex_table))
|
||||
__stop___ex_table = .;
|
||||
}
|
||||
|
||||
@@ -100,24 +100,24 @@ SECTIONS
|
||||
}
|
||||
.init.arch.info : {
|
||||
__arch_info_begin = .;
|
||||
- *(.arch.info.init)
|
||||
+ KEEP(*(.arch.info.init))
|
||||
__arch_info_end = .;
|
||||
}
|
||||
.init.tagtable : {
|
||||
__tagtable_begin = .;
|
||||
- *(.taglist.init)
|
||||
+ KEEP(*(.taglist.init))
|
||||
__tagtable_end = .;
|
||||
}
|
||||
#ifdef CONFIG_SMP_ON_UP
|
||||
.init.smpalt : {
|
||||
__smpalt_begin = .;
|
||||
- *(.alt.smp.init)
|
||||
+ KEEP(*(.alt.smp.init))
|
||||
__smpalt_end = .;
|
||||
}
|
||||
#endif
|
||||
.init.pv_table : {
|
||||
__pv_table_begin = .;
|
||||
- *(.pv_table)
|
||||
+ KEEP(*(.pv_table))
|
||||
__pv_table_end = .;
|
||||
}
|
||||
|
||||
--- a/arch/arm/include/asm/vmlinux.lds.h
|
||||
+++ b/arch/arm/include/asm/vmlinux.lds.h
|
||||
@@ -29,13 +29,13 @@
|
||||
#define PROC_INFO \
|
||||
. = ALIGN(4); \
|
||||
__proc_info_begin = .; \
|
||||
- *(.proc.info.init) \
|
||||
+ KEEP(*(.proc.info.init)) \
|
||||
__proc_info_end = .;
|
||||
|
||||
#define IDMAP_TEXT \
|
||||
ALIGN_FUNCTION(); \
|
||||
__idmap_text_start = .; \
|
||||
- *(.idmap.text) \
|
||||
+ KEEP(*(.idmap.text)) \
|
||||
__idmap_text_end = .; \
|
||||
|
||||
#define ARM_DISCARD \
|
||||
@@ -96,12 +96,12 @@
|
||||
. = ALIGN(8); \
|
||||
.ARM.unwind_idx : { \
|
||||
__start_unwind_idx = .; \
|
||||
- *(.ARM.exidx*) \
|
||||
+ KEEP(*(.ARM.exidx*)) \
|
||||
__stop_unwind_idx = .; \
|
||||
} \
|
||||
.ARM.unwind_tab : { \
|
||||
__start_unwind_tab = .; \
|
||||
- *(.ARM.extab*) \
|
||||
+ KEEP(*(.ARM.extab*)) \
|
||||
__stop_unwind_tab = .; \
|
||||
}
|
||||
|
||||
@@ -112,14 +112,14 @@
|
||||
#define ARM_VECTORS \
|
||||
__vectors_start = .; \
|
||||
.vectors 0xffff0000 : AT(__vectors_start) { \
|
||||
- *(.vectors) \
|
||||
+ KEEP(*(.vectors)) \
|
||||
} \
|
||||
. = __vectors_start + SIZEOF(.vectors); \
|
||||
__vectors_end = .; \
|
||||
\
|
||||
__stubs_start = .; \
|
||||
.stubs ADDR(.vectors) + 0x1000 : AT(__stubs_start) { \
|
||||
- *(.stubs) \
|
||||
+ KEEP(*(.stubs)) \
|
||||
} \
|
||||
. = __stubs_start + SIZEOF(.stubs); \
|
||||
__stubs_end = .; \
|
|
@ -30,7 +30,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||
/* Align . to a 8 byte boundary equals to maximum function alignment. */
|
||||
#define ALIGN_FUNCTION() . = ALIGN(8)
|
||||
|
||||
@@ -484,14 +494,14 @@
|
||||
@@ -486,14 +496,14 @@
|
||||
/* Kernel symbol table: Normal symbols */ \
|
||||
__ksymtab : AT(ADDR(__ksymtab) - LOAD_OFFSET) { \
|
||||
__start___ksymtab = .; \
|
||||
|
@ -47,7 +47,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||
__stop___ksymtab_gpl = .; \
|
||||
} \
|
||||
\
|
||||
@@ -511,7 +521,7 @@
|
||||
@@ -513,7 +523,7 @@
|
||||
\
|
||||
/* Kernel symbol table: strings */ \
|
||||
__ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \
|
||||
|
@ -56,7 +56,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||
} \
|
||||
\
|
||||
/* __*init sections */ \
|
||||
@@ -1018,6 +1028,8 @@
|
||||
@@ -1009,6 +1019,8 @@
|
||||
|
||||
#define COMMON_DISCARDS \
|
||||
SANITIZER_DISCARDS \
|
||||
|
@ -91,7 +91,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||
"__kstrtabns_" #sym ": \n" \
|
||||
--- a/scripts/Makefile.build
|
||||
+++ b/scripts/Makefile.build
|
||||
@@ -385,7 +385,7 @@ targets += $(real-dtb-y) $(lib-y) $(alwa
|
||||
@@ -358,7 +358,7 @@ targets += $(real-dtb-y) $(lib-y) $(alwa
|
||||
# Linker scripts preprocessor (.lds.S -> .lds)
|
||||
# ---------------------------------------------------------------------------
|
||||
quiet_cmd_cpp_lds_S = LDS $@
|
||||
|
|
|
@ -23,7 +23,7 @@ Signed-off-by: Imre Kaloz <kaloz@openwrt.org>
|
|||
{ {0x02, 0x21}, "lz4", unlz4 },
|
||||
--- a/scripts/Makefile.lib
|
||||
+++ b/scripts/Makefile.lib
|
||||
@@ -413,7 +413,7 @@ quiet_cmd_bzip2 = BZIP2 $@
|
||||
@@ -408,7 +408,7 @@ quiet_cmd_bzip2 = BZIP2 $@
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
quiet_cmd_lzma = LZMA $@
|
||||
|
|
|
@ -92,7 +92,7 @@ Signed-off-by: John Crispin <john@phrozen.org>
|
|||
bool
|
||||
--- a/lib/Kconfig
|
||||
+++ b/lib/Kconfig
|
||||
@@ -439,16 +439,16 @@ config BCH_CONST_T
|
||||
@@ -433,16 +433,16 @@ config BCH_CONST_T
|
||||
# Textsearch support is select'ed if needed
|
||||
#
|
||||
config TEXTSEARCH
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
From 8c817e33be829c7249c2cfd59ff48ad5fac6a31d Mon Sep 17 00:00:00 2001
|
||||
From: Sungbo Eo <mans0n@gorani.run>
|
||||
Date: Fri, 7 Jul 2017 17:09:21 +0200
|
||||
Subject: [PATCH] kconfig: solidify SATA_PMP config
|
||||
|
||||
SATA_PMP option in kernel config file disappears for every kernel_oldconfig refresh.
|
||||
To prevent this, SATA_HOST is now selected automatically when SATA_PMP is enabled.
|
||||
This patch can be dropped if SATA_MV is ever re-added into the config.
|
||||
---
|
||||
drivers/ata/Kconfig | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/drivers/ata/Kconfig
|
||||
+++ b/drivers/ata/Kconfig
|
||||
@@ -112,7 +112,7 @@ config SATA_ZPODD
|
||||
|
||||
config SATA_PMP
|
||||
bool "SATA Port Multiplier support"
|
||||
- depends on SATA_HOST
|
||||
+ select SATA_HOST
|
||||
default y
|
||||
help
|
||||
This option adds support for SATA Port Multipliers
|
|
@ -1,144 +0,0 @@
|
|||
From 811d9e2268a62b830cfe93cd8bc929afcb8b198b Mon Sep 17 00:00:00 2001
|
||||
From: Felix Fietkau <nbd@nbd.name>
|
||||
Date: Sat, 15 Jul 2017 21:12:38 +0200
|
||||
Subject: kernel: move regmap bloat out of the kernel image if it is only being used in modules
|
||||
|
||||
lede-commit: 96f39119815028073583e4fca3a9c5fe9141e998
|
||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
---
|
||||
drivers/base/regmap/Kconfig | 15 ++++++++++-----
|
||||
drivers/base/regmap/Makefile | 12 ++++++++----
|
||||
drivers/base/regmap/regmap.c | 3 +++
|
||||
include/linux/regmap.h | 2 +-
|
||||
4 files changed, 22 insertions(+), 10 deletions(-)
|
||||
|
||||
--- a/drivers/base/regmap/Kconfig
|
||||
+++ b/drivers/base/regmap/Kconfig
|
||||
@@ -4,10 +4,9 @@
|
||||
# subsystems should select the appropriate symbols.
|
||||
|
||||
config REGMAP
|
||||
- default y if (REGMAP_I2C || REGMAP_SPI || REGMAP_SPMI || REGMAP_W1 || REGMAP_AC97 || REGMAP_MMIO || REGMAP_IRQ || REGMAP_SOUNDWIRE || REGMAP_SOUNDWIRE_MBQ || REGMAP_SCCB || REGMAP_I3C || REGMAP_SPI_AVMM || REGMAP_MDIO)
|
||||
select IRQ_DOMAIN if REGMAP_IRQ
|
||||
select MDIO_BUS if REGMAP_MDIO
|
||||
- bool
|
||||
+ tristate
|
||||
|
||||
config REGCACHE_COMPRESSED
|
||||
select LZO_COMPRESS
|
||||
@@ -15,53 +14,67 @@ config REGCACHE_COMPRESSED
|
||||
bool
|
||||
|
||||
config REGMAP_AC97
|
||||
+ select REGMAP
|
||||
tristate
|
||||
|
||||
config REGMAP_I2C
|
||||
+ select REGMAP
|
||||
tristate
|
||||
depends on I2C
|
||||
|
||||
config REGMAP_SLIMBUS
|
||||
+ select REGMAP
|
||||
tristate
|
||||
depends on SLIMBUS
|
||||
|
||||
config REGMAP_SPI
|
||||
+ select REGMAP
|
||||
tristate
|
||||
depends on SPI
|
||||
|
||||
config REGMAP_SPMI
|
||||
+ select REGMAP
|
||||
tristate
|
||||
depends on SPMI
|
||||
|
||||
config REGMAP_W1
|
||||
+ select REGMAP
|
||||
tristate
|
||||
depends on W1
|
||||
|
||||
config REGMAP_MDIO
|
||||
+ select REGMAP
|
||||
tristate
|
||||
|
||||
config REGMAP_MMIO
|
||||
+ select REGMAP
|
||||
tristate
|
||||
|
||||
config REGMAP_IRQ
|
||||
+ select REGMAP
|
||||
bool
|
||||
|
||||
config REGMAP_SOUNDWIRE
|
||||
+ select REGMAP
|
||||
tristate
|
||||
depends on SOUNDWIRE
|
||||
|
||||
config REGMAP_SOUNDWIRE_MBQ
|
||||
+ select REGMAP
|
||||
tristate
|
||||
depends on SOUNDWIRE
|
||||
|
||||
config REGMAP_SCCB
|
||||
+ select REGMAP
|
||||
tristate
|
||||
depends on I2C
|
||||
|
||||
config REGMAP_I3C
|
||||
+ select REGMAP
|
||||
tristate
|
||||
depends on I3C
|
||||
|
||||
config REGMAP_SPI_AVMM
|
||||
+ select REGMAP
|
||||
tristate
|
||||
depends on SPI
|
||||
--- a/drivers/base/regmap/Makefile
|
||||
+++ b/drivers/base/regmap/Makefile
|
||||
@@ -2,10 +2,14 @@
|
||||
# For include/trace/define_trace.h to include trace.h
|
||||
CFLAGS_regmap.o := -I$(src)
|
||||
|
||||
-obj-$(CONFIG_REGMAP) += regmap.o regcache.o
|
||||
-obj-$(CONFIG_REGMAP) += regcache-rbtree.o regcache-flat.o
|
||||
-obj-$(CONFIG_REGCACHE_COMPRESSED) += regcache-lzo.o
|
||||
-obj-$(CONFIG_DEBUG_FS) += regmap-debugfs.o
|
||||
+regmap-core-objs = regmap.o regcache.o regcache-rbtree.o regcache-flat.o
|
||||
+ifdef CONFIG_DEBUG_FS
|
||||
+regmap-core-objs += regmap-debugfs.o
|
||||
+endif
|
||||
+ifdef CONFIG_REGCACHE_COMPRESSED
|
||||
+regmap-core-objs += regcache-lzo.o
|
||||
+endif
|
||||
+obj-$(CONFIG_REGMAP) += regmap-core.o
|
||||
obj-$(CONFIG_REGMAP_AC97) += regmap-ac97.o
|
||||
obj-$(CONFIG_REGMAP_I2C) += regmap-i2c.o
|
||||
obj-$(CONFIG_REGMAP_SLIMBUS) += regmap-slimbus.o
|
||||
--- a/drivers/base/regmap/regmap.c
|
||||
+++ b/drivers/base/regmap/regmap.c
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <linux/device.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/export.h>
|
||||
+#include <linux/module.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/property.h>
|
||||
@@ -3339,3 +3340,5 @@ static int __init regmap_initcall(void)
|
||||
return 0;
|
||||
}
|
||||
postcore_initcall(regmap_initcall);
|
||||
+
|
||||
+MODULE_LICENSE("GPL");
|
||||
--- a/include/linux/regmap.h
|
||||
+++ b/include/linux/regmap.h
|
||||
@@ -180,7 +180,7 @@ struct reg_sequence {
|
||||
__ret ?: __tmp; \
|
||||
})
|
||||
|
||||
-#ifdef CONFIG_REGMAP
|
||||
+#if IS_REACHABLE(CONFIG_REGMAP)
|
||||
|
||||
enum regmap_endian {
|
||||
/* Unspecified -> 0 -> Backwards compatible default */
|
|
@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
|
|||
|
||||
--- a/arch/mips/Kconfig
|
||||
+++ b/arch/mips/Kconfig
|
||||
@@ -1180,6 +1180,10 @@ config MIPS_MSC
|
||||
@@ -1202,6 +1202,10 @@ config MIPS_MSC
|
||||
config SYNC_R4K
|
||||
bool
|
||||
|
||||
|
|
|
@ -1,84 +0,0 @@
|
|||
From f9760b158f610b1792a222cc924073724c061bfb Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Golle <daniel@makrotopia.org>
|
||||
Date: Wed, 7 Apr 2021 22:37:57 +0100
|
||||
Subject: [PATCH 1/2] mtd: super: don't reply on mtdblock device minor
|
||||
To: linux-mtd@lists.infradead.org
|
||||
Cc: Vignesh Raghavendra <vigneshr@ti.com>,
|
||||
Richard Weinberger <richard@nod.at>,
|
||||
Miquel Raynal <miquel.raynal@bootlin.com>,
|
||||
David Woodhouse <dwmw2@infradead.org>
|
||||
|
||||
For blktrans devices with partitions (ie. part_bits != 0) the
|
||||
assumption that the minor number of the mtdblock device matches
|
||||
the mtdnum doesn't hold true.
|
||||
Properly resolve mtd device from blktrans layer instead.
|
||||
|
||||
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
---
|
||||
drivers/mtd/mtdsuper.c | 33 ++++++++++++++++++++++++++-------
|
||||
1 file changed, 26 insertions(+), 7 deletions(-)
|
||||
|
||||
--- a/drivers/mtd/mtdsuper.c
|
||||
+++ b/drivers/mtd/mtdsuper.c
|
||||
@@ -9,6 +9,7 @@
|
||||
*/
|
||||
|
||||
#include <linux/mtd/super.h>
|
||||
+#include <linux/mtd/blktrans.h>
|
||||
#include <linux/namei.h>
|
||||
#include <linux/export.h>
|
||||
#include <linux/ctype.h>
|
||||
@@ -120,8 +121,9 @@ int get_tree_mtd(struct fs_context *fc,
|
||||
struct fs_context *fc))
|
||||
{
|
||||
#ifdef CONFIG_BLOCK
|
||||
- dev_t dev;
|
||||
- int ret;
|
||||
+ struct mtd_blktrans_dev *blktrans_dev;
|
||||
+ struct block_device *bdev;
|
||||
+ int ret, part_bits;
|
||||
#endif
|
||||
int mtdnr;
|
||||
|
||||
@@ -169,16 +171,36 @@ int get_tree_mtd(struct fs_context *fc,
|
||||
/* try the old way - the hack where we allowed users to mount
|
||||
* /dev/mtdblock$(n) but didn't actually _use_ the blockdev
|
||||
*/
|
||||
- ret = lookup_bdev(fc->source, &dev);
|
||||
- if (ret) {
|
||||
+ bdev = blkdev_get_by_path(fc->source, FMODE_READ, NULL);
|
||||
+ if (IS_ERR(bdev)) {
|
||||
+ ret = PTR_ERR(bdev);
|
||||
errorf(fc, "MTD: Couldn't look up '%s': %d", fc->source, ret);
|
||||
return ret;
|
||||
}
|
||||
- pr_debug("MTDSB: lookup_bdev() returned 0\n");
|
||||
+ pr_debug("MTDSB: blkdev_get_by_path() returned 0\n");
|
||||
|
||||
- if (MAJOR(dev) == MTD_BLOCK_MAJOR)
|
||||
- return mtd_get_sb_by_nr(fc, MINOR(dev), fill_super);
|
||||
+ if (MAJOR(bdev->bd_dev) == MTD_BLOCK_MAJOR) {
|
||||
+ if (!bdev->bd_disk) {
|
||||
+ blkdev_put(bdev, FMODE_READ);
|
||||
+ BUG();
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
|
||||
+ blktrans_dev = (struct mtd_blktrans_dev *)(bdev->bd_disk->private_data);
|
||||
+ if (!blktrans_dev || !blktrans_dev->tr) {
|
||||
+ blkdev_put(bdev, FMODE_READ);
|
||||
+ BUG();
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+ mtdnr = blktrans_dev->devnum;
|
||||
+ part_bits = blktrans_dev->tr->part_bits;
|
||||
+ blkdev_put(bdev, FMODE_READ);
|
||||
+ if (MINOR(bdev->bd_dev) != (mtdnr << part_bits))
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ return mtd_get_sb_by_nr(fc, mtdnr, fill_super);
|
||||
+ }
|
||||
+ blkdev_put(bdev, FMODE_READ);
|
||||
#endif /* CONFIG_BLOCK */
|
||||
|
||||
if (!(fc->sb_flags & SB_SILENT))
|
|
@ -1,98 +0,0 @@
|
|||
From 0bccc3722bdd88e8ae995e77ef9f7b77ee4cbdee Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Golle <daniel@makrotopia.org>
|
||||
Date: Wed, 7 Apr 2021 22:45:54 +0100
|
||||
Subject: [PATCH 2/2] mtd: blktrans: call add disks after mtd device
|
||||
To: linux-mtd@lists.infradead.org
|
||||
Cc: Vignesh Raghavendra <vigneshr@ti.com>,
|
||||
Richard Weinberger <richard@nod.at>,
|
||||
Miquel Raynal <miquel.raynal@bootlin.com>,
|
||||
David Woodhouse <dwmw2@infradead.org>
|
||||
|
||||
Calling device_add_disk while holding mtd_table_mutex leads
|
||||
to deadlock in case part_bits!=0 as block partition parsers
|
||||
will try to open the newly created disks, trying to acquire
|
||||
mutex once again.
|
||||
Move device_add_disk to additional function called after
|
||||
add partitions of an MTD device have been added and locks
|
||||
have been released.
|
||||
|
||||
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
---
|
||||
drivers/mtd/mtd_blkdevs.c | 33 ++++++++++++++++++++++++++-------
|
||||
drivers/mtd/mtdcore.c | 3 +++
|
||||
include/linux/mtd/blktrans.h | 1 +
|
||||
3 files changed, 30 insertions(+), 7 deletions(-)
|
||||
|
||||
--- a/drivers/mtd/mtd_blkdevs.c
|
||||
+++ b/drivers/mtd/mtd_blkdevs.c
|
||||
@@ -384,13 +384,6 @@ int add_mtd_blktrans_dev(struct mtd_blkt
|
||||
if (new->readonly)
|
||||
set_disk_ro(gd, 1);
|
||||
|
||||
- device_add_disk(&new->mtd->dev, gd, NULL);
|
||||
-
|
||||
- if (new->disk_attributes) {
|
||||
- ret = sysfs_create_group(&disk_to_dev(gd)->kobj,
|
||||
- new->disk_attributes);
|
||||
- WARN_ON(ret);
|
||||
- }
|
||||
return 0;
|
||||
|
||||
out_free_tag_set:
|
||||
@@ -402,6 +395,27 @@ out_list_del:
|
||||
return ret;
|
||||
}
|
||||
|
||||
+void register_mtd_blktrans_devs(void)
|
||||
+{
|
||||
+ struct mtd_blktrans_ops *tr;
|
||||
+ struct mtd_blktrans_dev *dev, *next;
|
||||
+ int ret;
|
||||
+
|
||||
+ list_for_each_entry(tr, &blktrans_majors, list) {
|
||||
+ list_for_each_entry_safe(dev, next, &tr->devs, list) {
|
||||
+ if (disk_live(dev->disk))
|
||||
+ continue;
|
||||
+
|
||||
+ device_add_disk(&dev->mtd->dev, dev->disk, NULL);
|
||||
+ if (dev->disk_attributes) {
|
||||
+ ret = sysfs_create_group(&disk_to_dev(dev->disk)->kobj,
|
||||
+ dev->disk_attributes);
|
||||
+ WARN_ON(ret);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
int del_mtd_blktrans_dev(struct mtd_blktrans_dev *old)
|
||||
{
|
||||
unsigned long flags;
|
||||
--- a/drivers/mtd/mtdcore.c
|
||||
+++ b/drivers/mtd/mtdcore.c
|
||||
@@ -31,6 +31,7 @@
|
||||
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
+#include <linux/mtd/blktrans.h>
|
||||
|
||||
#include "mtdcore.h"
|
||||
|
||||
@@ -1000,6 +1001,8 @@ int mtd_device_parse_register(struct mtd
|
||||
|
||||
ret = mtd_otp_nvmem_add(mtd);
|
||||
|
||||
+ register_mtd_blktrans_devs();
|
||||
+
|
||||
out:
|
||||
if (ret && device_is_registered(&mtd->dev))
|
||||
del_mtd_device(mtd);
|
||||
--- a/include/linux/mtd/blktrans.h
|
||||
+++ b/include/linux/mtd/blktrans.h
|
||||
@@ -76,6 +76,7 @@ extern int deregister_mtd_blktrans(struc
|
||||
extern int add_mtd_blktrans_dev(struct mtd_blktrans_dev *dev);
|
||||
extern int del_mtd_blktrans_dev(struct mtd_blktrans_dev *dev);
|
||||
extern int mtd_blktrans_cease_background(struct mtd_blktrans_dev *dev);
|
||||
+extern void register_mtd_blktrans_devs(void);
|
||||
|
||||
/**
|
||||
* module_mtd_blktrans() - Helper macro for registering a mtd blktrans driver
|
|
@ -1,220 +0,0 @@
|
|||
--- a/block/blk.h
|
||||
+++ b/block/blk.h
|
||||
@@ -354,6 +354,7 @@ void blk_free_ext_minor(unsigned int min
|
||||
#define ADDPART_FLAG_NONE 0
|
||||
#define ADDPART_FLAG_RAID 1
|
||||
#define ADDPART_FLAG_WHOLEDISK 2
|
||||
+#define ADDPART_FLAG_ROOTDEV 4
|
||||
int bdev_add_partition(struct gendisk *disk, int partno, sector_t start,
|
||||
sector_t length);
|
||||
int bdev_del_partition(struct gendisk *disk, int partno);
|
||||
--- a/block/partitions/Kconfig
|
||||
+++ b/block/partitions/Kconfig
|
||||
@@ -101,6 +101,13 @@ config ATARI_PARTITION
|
||||
Say Y here if you would like to use hard disks under Linux which
|
||||
were partitioned under the Atari OS.
|
||||
|
||||
+config FIT_PARTITION
|
||||
+ bool "Flattened-Image-Tree (FIT) partition support" if PARTITION_ADVANCED
|
||||
+ default n
|
||||
+ help
|
||||
+ Say Y here if your system needs to mount the filesystem part of
|
||||
+ a Flattened-Image-Tree (FIT) image commonly used with Das U-Boot.
|
||||
+
|
||||
config IBM_PARTITION
|
||||
bool "IBM disk label and partition support"
|
||||
depends on PARTITION_ADVANCED && S390
|
||||
--- a/block/partitions/Makefile
|
||||
+++ b/block/partitions/Makefile
|
||||
@@ -8,6 +8,7 @@ obj-$(CONFIG_ACORN_PARTITION) += acorn.o
|
||||
obj-$(CONFIG_AMIGA_PARTITION) += amiga.o
|
||||
obj-$(CONFIG_ATARI_PARTITION) += atari.o
|
||||
obj-$(CONFIG_AIX_PARTITION) += aix.o
|
||||
+obj-$(CONFIG_FIT_PARTITION) += fit.o
|
||||
obj-$(CONFIG_CMDLINE_PARTITION) += cmdline.o
|
||||
obj-$(CONFIG_MAC_PARTITION) += mac.o
|
||||
obj-$(CONFIG_LDM_PARTITION) += ldm.o
|
||||
--- a/block/partitions/check.h
|
||||
+++ b/block/partitions/check.h
|
||||
@@ -58,6 +58,7 @@ int amiga_partition(struct parsed_partit
|
||||
int atari_partition(struct parsed_partitions *state);
|
||||
int cmdline_partition(struct parsed_partitions *state);
|
||||
int efi_partition(struct parsed_partitions *state);
|
||||
+int fit_partition(struct parsed_partitions *state);
|
||||
int ibm_partition(struct parsed_partitions *);
|
||||
int karma_partition(struct parsed_partitions *state);
|
||||
int ldm_partition(struct parsed_partitions *state);
|
||||
@@ -68,3 +69,5 @@ int sgi_partition(struct parsed_partitio
|
||||
int sun_partition(struct parsed_partitions *state);
|
||||
int sysv68_partition(struct parsed_partitions *state);
|
||||
int ultrix_partition(struct parsed_partitions *state);
|
||||
+
|
||||
+int parse_fit_partitions(struct parsed_partitions *state, u64 start_sector, u64 nr_sectors, int *slot, int add_remain);
|
||||
--- a/block/partitions/core.c
|
||||
+++ b/block/partitions/core.c
|
||||
@@ -11,6 +11,10 @@
|
||||
#include <linux/vmalloc.h>
|
||||
#include <linux/blktrace_api.h>
|
||||
#include <linux/raid/detect.h>
|
||||
+#ifdef CONFIG_FIT_PARTITION
|
||||
+#include <linux/root_dev.h>
|
||||
+#endif
|
||||
+
|
||||
#include "check.h"
|
||||
|
||||
static int (*check_part[])(struct parsed_partitions *) = {
|
||||
@@ -47,6 +51,9 @@ static int (*check_part[])(struct parsed
|
||||
#ifdef CONFIG_EFI_PARTITION
|
||||
efi_partition, /* this must come before msdos */
|
||||
#endif
|
||||
+#ifdef CONFIG_FIT_PARTITION
|
||||
+ fit_partition,
|
||||
+#endif
|
||||
#ifdef CONFIG_SGI_PARTITION
|
||||
sgi_partition,
|
||||
#endif
|
||||
@@ -597,6 +604,11 @@ static bool blk_add_partition(struct gen
|
||||
(state->parts[p].flags & ADDPART_FLAG_RAID))
|
||||
md_autodetect_dev(part->bd_dev);
|
||||
|
||||
+#ifdef CONFIG_FIT_PARTITION
|
||||
+ if ((state->parts[p].flags & ADDPART_FLAG_ROOTDEV) && ROOT_DEV == 0)
|
||||
+ ROOT_DEV = part_to_dev(part)->devt;
|
||||
+#endif
|
||||
+
|
||||
return true;
|
||||
}
|
||||
|
||||
--- a/drivers/mtd/ubi/block.c
|
||||
+++ b/drivers/mtd/ubi/block.c
|
||||
@@ -419,7 +419,11 @@ int ubiblock_create(struct ubi_volume_in
|
||||
|
||||
gd->fops = &ubiblock_ops;
|
||||
gd->major = ubiblock_major;
|
||||
+#ifdef CONFIG_FIT_PARTITION
|
||||
+ gd->minors = 0;
|
||||
+#else
|
||||
gd->minors = 1;
|
||||
+#endif
|
||||
gd->first_minor = idr_alloc(&ubiblock_minor_idr, dev, 0, 0, GFP_KERNEL);
|
||||
if (gd->first_minor < 0) {
|
||||
dev_err(disk_to_dev(gd),
|
||||
@@ -428,6 +432,9 @@ int ubiblock_create(struct ubi_volume_in
|
||||
goto out_cleanup_disk;
|
||||
}
|
||||
gd->private_data = dev;
|
||||
+#ifdef CONFIG_FIT_PARTITION
|
||||
+ gd->flags |= GENHD_FL_EXT_DEVT;
|
||||
+#endif
|
||||
sprintf(gd->disk_name, "ubiblock%d_%d", dev->ubi_num, dev->vol_id);
|
||||
set_capacity(gd, disk_capacity);
|
||||
dev->gd = gd;
|
||||
--- a/block/partitions/efi.c
|
||||
+++ b/block/partitions/efi.c
|
||||
@@ -716,6 +716,9 @@ int efi_partition(struct parsed_partitio
|
||||
gpt_entry *ptes = NULL;
|
||||
u32 i;
|
||||
unsigned ssz = queue_logical_block_size(state->disk->queue) / 512;
|
||||
+#ifdef CONFIG_FIT_PARTITION
|
||||
+ u32 extra_slot = 64;
|
||||
+#endif
|
||||
|
||||
if (!find_valid_gpt(state, &gpt, &ptes) || !gpt || !ptes) {
|
||||
kfree(gpt);
|
||||
@@ -749,6 +752,11 @@ int efi_partition(struct parsed_partitio
|
||||
ARRAY_SIZE(ptes[i].partition_name));
|
||||
utf16_le_to_7bit(ptes[i].partition_name, label_max, info->volname);
|
||||
state->parts[i + 1].has_info = true;
|
||||
+#ifdef CONFIG_FIT_PARTITION
|
||||
+ /* If this is a U-Boot FIT volume it may have subpartitions */
|
||||
+ if (!efi_guidcmp(ptes[i].partition_type_guid, PARTITION_LINUX_FIT_GUID))
|
||||
+ (void) parse_fit_partitions(state, start * ssz, size * ssz, &extra_slot, 1);
|
||||
+#endif
|
||||
}
|
||||
kfree(ptes);
|
||||
kfree(gpt);
|
||||
--- a/block/partitions/efi.h
|
||||
+++ b/block/partitions/efi.h
|
||||
@@ -52,6 +52,9 @@
|
||||
#define PARTITION_LINUX_LVM_GUID \
|
||||
EFI_GUID( 0xe6d6d379, 0xf507, 0x44c2, \
|
||||
0xa2, 0x3c, 0x23, 0x8f, 0x2a, 0x3d, 0xf9, 0x28)
|
||||
+#define PARTITION_LINUX_FIT_GUID \
|
||||
+ EFI_GUID( 0xcae9be83, 0xb15f, 0x49cc, \
|
||||
+ 0x86, 0x3f, 0x08, 0x1b, 0x74, 0x4a, 0x2d, 0x93)
|
||||
|
||||
typedef struct _gpt_header {
|
||||
__le64 signature;
|
||||
--- a/drivers/mtd/mtdblock.c
|
||||
+++ b/drivers/mtd/mtdblock.c
|
||||
@@ -338,7 +338,11 @@ static void mtdblock_remove_dev(struct m
|
||||
static struct mtd_blktrans_ops mtdblock_tr = {
|
||||
.name = "mtdblock",
|
||||
.major = MTD_BLOCK_MAJOR,
|
||||
+#ifdef CONFIG_FIT_PARTITION
|
||||
+ .part_bits = 1,
|
||||
+#else
|
||||
.part_bits = 0,
|
||||
+#endif
|
||||
.blksize = 512,
|
||||
.open = mtdblock_open,
|
||||
.flush = mtdblock_flush,
|
||||
--- a/drivers/mtd/mtd_blkdevs.c
|
||||
+++ b/drivers/mtd/mtd_blkdevs.c
|
||||
@@ -346,18 +346,8 @@ int add_mtd_blktrans_dev(struct mtd_blkt
|
||||
gd->minors = 1 << tr->part_bits;
|
||||
gd->fops = &mtd_block_ops;
|
||||
|
||||
- if (tr->part_bits)
|
||||
- if (new->devnum < 26)
|
||||
- snprintf(gd->disk_name, sizeof(gd->disk_name),
|
||||
- "%s%c", tr->name, 'a' + new->devnum);
|
||||
- else
|
||||
- snprintf(gd->disk_name, sizeof(gd->disk_name),
|
||||
- "%s%c%c", tr->name,
|
||||
- 'a' - 1 + new->devnum / 26,
|
||||
- 'a' + new->devnum % 26);
|
||||
- else
|
||||
- snprintf(gd->disk_name, sizeof(gd->disk_name),
|
||||
- "%s%d", tr->name, new->devnum);
|
||||
+ snprintf(gd->disk_name, sizeof(gd->disk_name),
|
||||
+ "%s%d", tr->name, new->devnum);
|
||||
|
||||
set_capacity(gd, ((u64)new->size * tr->blksize) >> 9);
|
||||
|
||||
--- a/block/partitions/msdos.c
|
||||
+++ b/block/partitions/msdos.c
|
||||
@@ -564,6 +564,15 @@ static void parse_minix(struct parsed_pa
|
||||
#endif /* CONFIG_MINIX_SUBPARTITION */
|
||||
}
|
||||
|
||||
+static void parse_fit_mbr(struct parsed_partitions *state,
|
||||
+ sector_t offset, sector_t size, int origin)
|
||||
+{
|
||||
+#ifdef CONFIG_FIT_PARTITION
|
||||
+ u32 extra_slot = 64;
|
||||
+ (void) parse_fit_partitions(state, offset, size, &extra_slot, 1);
|
||||
+#endif /* CONFIG_FIT_PARTITION */
|
||||
+}
|
||||
+
|
||||
static struct {
|
||||
unsigned char id;
|
||||
void (*parse)(struct parsed_partitions *, sector_t, sector_t, int);
|
||||
@@ -575,6 +584,7 @@ static struct {
|
||||
{UNIXWARE_PARTITION, parse_unixware},
|
||||
{SOLARIS_X86_PARTITION, parse_solaris_x86},
|
||||
{NEW_SOLARIS_X86_PARTITION, parse_solaris_x86},
|
||||
+ {FIT_PARTITION, parse_fit_mbr},
|
||||
{0, NULL},
|
||||
};
|
||||
|
||||
--- a/include/linux/msdos_partition.h
|
||||
+++ b/include/linux/msdos_partition.h
|
||||
@@ -31,6 +31,7 @@ enum msdos_sys_ind {
|
||||
LINUX_LVM_PARTITION = 0x8e,
|
||||
LINUX_RAID_PARTITION = 0xfd, /* autodetect RAID partition */
|
||||
|
||||
+ FIT_PARTITION = 0x2e, /* U-Boot uImage.FIT */
|
||||
SOLARIS_X86_PARTITION = 0x82, /* also Linux swap partitions */
|
||||
NEW_SOLARIS_X86_PARTITION = 0xbf,
|
||||
|
|
@ -20,7 +20,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
|
|||
#include <linux/nvmem-provider.h>
|
||||
|
||||
#include <linux/mtd/mtd.h>
|
||||
@@ -696,6 +697,19 @@ int add_mtd_device(struct mtd_info *mtd)
|
||||
@@ -694,6 +695,19 @@ int add_mtd_device(struct mtd_info *mtd)
|
||||
of this try_ nonsense, and no bitching about it
|
||||
either. :) */
|
||||
__module_get(THIS_MODULE);
|
||||
|
|
|
@ -12,7 +12,7 @@ Signed-off-by: Etienne Champetier <champetier.etienne@gmail.com>
|
|||
|
||||
--- a/net/bridge/br_input.c
|
||||
+++ b/net/bridge/br_input.c
|
||||
@@ -108,10 +108,14 @@ int br_handle_frame_finish(struct net *n
|
||||
@@ -103,10 +103,14 @@ int br_handle_frame_finish(struct net *n
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ Signed-off-by: Etienne Champetier <champetier.etienne@gmail.com>
|
|||
if (IS_ENABLED(CONFIG_INET) &&
|
||||
--- a/net/bridge/br_private.h
|
||||
+++ b/net/bridge/br_private.h
|
||||
@@ -468,6 +468,8 @@ struct net_bridge {
|
||||
@@ -402,6 +402,8 @@ struct net_bridge {
|
||||
u16 group_fwd_mask;
|
||||
u16 group_fwd_mask_required;
|
||||
|
||||
|
@ -39,45 +39,3 @@ Signed-off-by: Etienne Champetier <champetier.etienne@gmail.com>
|
|||
/* STP */
|
||||
bridge_id designated_root;
|
||||
bridge_id bridge_id;
|
||||
--- a/net/bridge/br_sysfs_br.c
|
||||
+++ b/net/bridge/br_sysfs_br.c
|
||||
@@ -197,6 +197,31 @@ static ssize_t group_fwd_mask_store(stru
|
||||
}
|
||||
static DEVICE_ATTR_RW(group_fwd_mask);
|
||||
|
||||
+static ssize_t disable_eap_hack_show(struct device *d,
|
||||
+ struct device_attribute *attr,
|
||||
+ char *buf)
|
||||
+{
|
||||
+ struct net_bridge *br = to_bridge(d);
|
||||
+ return sprintf(buf, "%u\n", br->disable_eap_hack);
|
||||
+}
|
||||
+
|
||||
+static int set_disable_eap_hack(struct net_bridge *br, unsigned long val,
|
||||
+ struct netlink_ext_ack *extack)
|
||||
+{
|
||||
+ br->disable_eap_hack = !!val;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static ssize_t disable_eap_hack_store(struct device *d,
|
||||
+ struct device_attribute *attr,
|
||||
+ const char *buf,
|
||||
+ size_t len)
|
||||
+{
|
||||
+ return store_bridge_parm(d, buf, len, set_disable_eap_hack);
|
||||
+}
|
||||
+static DEVICE_ATTR_RW(disable_eap_hack);
|
||||
+
|
||||
static ssize_t priority_show(struct device *d, struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
@@ -937,6 +962,7 @@ static struct attribute *bridge_attrs[]
|
||||
&dev_attr_ageing_time.attr,
|
||||
&dev_attr_stp_state.attr,
|
||||
&dev_attr_group_fwd_mask.attr,
|
||||
+ &dev_attr_disable_eap_hack.attr,
|
||||
&dev_attr_priority.attr,
|
||||
&dev_attr_bridge_id.attr,
|
||||
&dev_attr_root_id.attr,
|
||||
|
|
|
@ -98,7 +98,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||
obj-$(CONFIG_NETFILTER_XT_TARGET_LED) += xt_LED.o
|
||||
--- /dev/null
|
||||
+++ b/net/netfilter/xt_FLOWOFFLOAD.c
|
||||
@@ -0,0 +1,656 @@
|
||||
@@ -0,0 +1,658 @@
|
||||
+/*
|
||||
+ * Copyright (C) 2018-2021 Felix Fietkau <nbd@nbd.name>
|
||||
+ *
|
||||
|
@ -278,6 +278,8 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||
+ hook->used = true;
|
||||
+ }
|
||||
+ spin_unlock_bh(&hooks_lock);
|
||||
+
|
||||
+ cond_resched();
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
|
@ -765,7 +767,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||
#include <net/netfilter/nf_flow_table.h>
|
||||
#include <net/netfilter/nf_conntrack.h>
|
||||
#include <net/netfilter/nf_conntrack_core.h>
|
||||
@@ -397,8 +396,7 @@ flow_offload_lookup(struct nf_flowtable
|
||||
@@ -407,8 +406,7 @@ flow_offload_lookup(struct nf_flowtable
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(flow_offload_lookup);
|
||||
|
||||
|
@ -775,7 +777,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||
void (*iter)(struct flow_offload *flow, void *data),
|
||||
void *data)
|
||||
{
|
||||
@@ -430,6 +428,7 @@ nf_flow_table_iterate(struct nf_flowtabl
|
||||
@@ -440,6 +438,7 @@ nf_flow_table_iterate(struct nf_flowtabl
|
||||
|
||||
return err;
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ Signed-off-by: Imre Kaloz <kaloz@openwrt.org>
|
|||
|
||||
--- a/include/linux/netdevice.h
|
||||
+++ b/include/linux/netdevice.h
|
||||
@@ -145,8 +145,8 @@ static inline bool dev_xmit_complete(int
|
||||
@@ -144,8 +144,8 @@ static inline bool dev_xmit_complete(int
|
||||
|
||||
#if defined(CONFIG_HYPERV_NET)
|
||||
# define LL_MAX_HEADER 128
|
||||
|
|
|
@ -14,7 +14,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||
|
||||
--- a/include/net/sch_generic.h
|
||||
+++ b/include/net/sch_generic.h
|
||||
@@ -626,12 +626,13 @@ extern struct Qdisc_ops noop_qdisc_ops;
|
||||
@@ -624,12 +624,13 @@ extern struct Qdisc_ops noop_qdisc_ops;
|
||||
extern struct Qdisc_ops pfifo_fast_ops;
|
||||
extern struct Qdisc_ops mq_qdisc_ops;
|
||||
extern struct Qdisc_ops noqueue_qdisc_ops;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/drivers/net/dsa/mv88e6xxx/chip.c
|
||||
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
|
||||
@@ -2317,6 +2317,7 @@ static int mv88e6xxx_port_fdb_add(struct
|
||||
@@ -2225,6 +2225,7 @@ static int mv88e6xxx_port_fdb_add(struct
|
||||
struct mv88e6xxx_chip *chip = ds->priv;
|
||||
int err;
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
|||
mv88e6xxx_reg_lock(chip);
|
||||
err = mv88e6xxx_port_db_load_purge(chip, port, addr, vid,
|
||||
MV88E6XXX_G1_ATU_DATA_STATE_UC_STATIC);
|
||||
@@ -2331,6 +2332,7 @@ static int mv88e6xxx_port_fdb_del(struct
|
||||
@@ -2239,6 +2240,7 @@ static int mv88e6xxx_port_fdb_del(struct
|
||||
struct mv88e6xxx_chip *chip = ds->priv;
|
||||
int err;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/drivers/net/dsa/mv88e6xxx/chip.c
|
||||
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
|
||||
@@ -2979,6 +2979,9 @@ static int mv88e6xxx_setup_port(struct m
|
||||
@@ -2817,6 +2817,9 @@ static int mv88e6xxx_setup_port(struct m
|
||||
else
|
||||
reg = 1 << port;
|
||||
|
||||
|
|
|
@ -1,142 +0,0 @@
|
|||
From: Birger Koblitz <git@birger-koblitz.de>
|
||||
Date: Sun, 5 Sep 2021 15:13:10 +0200
|
||||
Subject: [PATCH] kernel: Add AQR113C and AQR813 support
|
||||
|
||||
This hack adds support for the Aquantia 4th generation, 10GBit
|
||||
PHYs AQR113C and AQR813.
|
||||
|
||||
Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
|
||||
|
||||
--- a/drivers/net/phy/aquantia_main.c
|
||||
+++ b/drivers/net/phy/aquantia_main.c
|
||||
@@ -20,8 +20,10 @@
|
||||
#define PHY_ID_AQR105 0x03a1b4a2
|
||||
#define PHY_ID_AQR106 0x03a1b4d0
|
||||
#define PHY_ID_AQR107 0x03a1b4e0
|
||||
+#define PHY_ID_AQR113C 0x31c31c12
|
||||
#define PHY_ID_AQCS109 0x03a1b5c2
|
||||
#define PHY_ID_AQR405 0x03a1b4b0
|
||||
+#define PHY_ID_AQR813 0x31c31cb2
|
||||
|
||||
#define MDIO_PHYXS_VEND_IF_STATUS 0xe812
|
||||
#define MDIO_PHYXS_VEND_IF_STATUS_TYPE_MASK GENMASK(7, 3)
|
||||
@@ -359,6 +361,49 @@ static int aqr107_read_rate(struct phy_d
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static int aqr113c_read_status(struct phy_device *phydev)
|
||||
+{
|
||||
+ int val, ret;
|
||||
+
|
||||
+ ret = aqr_read_status(phydev);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ if (!phydev->link || phydev->autoneg == AUTONEG_DISABLE)
|
||||
+ return 0;
|
||||
+
|
||||
+ // On AQR113C, the speed returned by aqr_read_status is wrong
|
||||
+ aqr107_read_rate(phydev);
|
||||
+
|
||||
+ val = phy_read_mmd(phydev, MDIO_MMD_PHYXS, MDIO_PHYXS_VEND_IF_STATUS);
|
||||
+ if (val < 0)
|
||||
+ return val;
|
||||
+
|
||||
+ switch (FIELD_GET(MDIO_PHYXS_VEND_IF_STATUS_TYPE_MASK, val)) {
|
||||
+ case MDIO_PHYXS_VEND_IF_STATUS_TYPE_KR:
|
||||
+ phydev->interface = PHY_INTERFACE_MODE_10GKR;
|
||||
+ break;
|
||||
+ case MDIO_PHYXS_VEND_IF_STATUS_TYPE_XFI:
|
||||
+ phydev->interface = PHY_INTERFACE_MODE_10GBASER;
|
||||
+ break;
|
||||
+ case MDIO_PHYXS_VEND_IF_STATUS_TYPE_USXGMII:
|
||||
+ phydev->interface = PHY_INTERFACE_MODE_USXGMII;
|
||||
+ break;
|
||||
+ case MDIO_PHYXS_VEND_IF_STATUS_TYPE_SGMII:
|
||||
+ phydev->interface = PHY_INTERFACE_MODE_SGMII;
|
||||
+ break;
|
||||
+ case MDIO_PHYXS_VEND_IF_STATUS_TYPE_OCSGMII:
|
||||
+ phydev->interface = PHY_INTERFACE_MODE_2500BASEX;
|
||||
+ break;
|
||||
+ default:
|
||||
+ phydev->interface = PHY_INTERFACE_MODE_NA;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ /* Read downshifted rate from vendor register */
|
||||
+ return aqr107_read_rate(phydev);
|
||||
+}
|
||||
+
|
||||
static int aqr107_read_status(struct phy_device *phydev)
|
||||
{
|
||||
int val, ret;
|
||||
@@ -489,7 +534,7 @@ static void aqr107_chip_info(struct phy_
|
||||
build_id = FIELD_GET(VEND1_GLOBAL_RSVD_STAT1_FW_BUILD_ID, val);
|
||||
prov_id = FIELD_GET(VEND1_GLOBAL_RSVD_STAT1_PROV_ID, val);
|
||||
|
||||
- phydev_dbg(phydev, "FW %u.%u, Build %u, Provisioning %u\n",
|
||||
+ phydev_info(phydev, "FW %u.%u, Build %u, Provisioning %u\n",
|
||||
fw_major, fw_minor, build_id, prov_id);
|
||||
}
|
||||
|
||||
@@ -661,6 +706,24 @@ static struct phy_driver aqr_driver[] =
|
||||
.link_change_notify = aqr107_link_change_notify,
|
||||
},
|
||||
{
|
||||
+ PHY_ID_MATCH_MODEL(PHY_ID_AQR113C),
|
||||
+ .name = "Aquantia AQR113C",
|
||||
+ .probe = aqr107_probe,
|
||||
+ .config_init = aqr107_config_init,
|
||||
+ .config_aneg = aqr_config_aneg,
|
||||
+ .config_intr = aqr_config_intr,
|
||||
+ .handle_interrupt = aqr_handle_interrupt,
|
||||
+ .read_status = aqr113c_read_status,
|
||||
+ .get_tunable = aqr107_get_tunable,
|
||||
+ .set_tunable = aqr107_set_tunable,
|
||||
+ .suspend = aqr107_suspend,
|
||||
+ .resume = aqr107_resume,
|
||||
+ .get_sset_count = aqr107_get_sset_count,
|
||||
+ .get_strings = aqr107_get_strings,
|
||||
+ .get_stats = aqr107_get_stats,
|
||||
+ .link_change_notify = aqr107_link_change_notify,
|
||||
+},
|
||||
+{
|
||||
PHY_ID_MATCH_MODEL(PHY_ID_AQCS109),
|
||||
.name = "Aquantia AQCS109",
|
||||
.probe = aqr107_probe,
|
||||
@@ -686,6 +749,24 @@ static struct phy_driver aqr_driver[] =
|
||||
.handle_interrupt = aqr_handle_interrupt,
|
||||
.read_status = aqr_read_status,
|
||||
},
|
||||
+{
|
||||
+ PHY_ID_MATCH_MODEL(PHY_ID_AQR813),
|
||||
+ .name = "Aquantia AQR813",
|
||||
+ .probe = aqr107_probe,
|
||||
+ .config_init = aqr107_config_init,
|
||||
+ .config_aneg = aqr_config_aneg,
|
||||
+ .config_intr = aqr_config_intr,
|
||||
+ .handle_interrupt = aqr_handle_interrupt,
|
||||
+ .read_status = aqr113c_read_status,
|
||||
+ .get_tunable = aqr107_get_tunable,
|
||||
+ .set_tunable = aqr107_set_tunable,
|
||||
+ .suspend = aqr107_suspend,
|
||||
+ .resume = aqr107_resume,
|
||||
+ .get_sset_count = aqr107_get_sset_count,
|
||||
+ .get_strings = aqr107_get_strings,
|
||||
+ .get_stats = aqr107_get_stats,
|
||||
+ .link_change_notify = aqr107_link_change_notify,
|
||||
+},
|
||||
};
|
||||
|
||||
module_phy_driver(aqr_driver);
|
||||
@@ -696,8 +777,10 @@ static struct mdio_device_id __maybe_unu
|
||||
{ PHY_ID_MATCH_MODEL(PHY_ID_AQR105) },
|
||||
{ PHY_ID_MATCH_MODEL(PHY_ID_AQR106) },
|
||||
{ PHY_ID_MATCH_MODEL(PHY_ID_AQR107) },
|
||||
+ { PHY_ID_MATCH_MODEL(PHY_ID_AQR113C) },
|
||||
{ PHY_ID_MATCH_MODEL(PHY_ID_AQCS109) },
|
||||
{ PHY_ID_MATCH_MODEL(PHY_ID_AQR405) },
|
||||
+ { PHY_ID_MATCH_MODEL(PHY_ID_AQR813) },
|
||||
{ }
|
||||
};
|
||||
|
|
@ -1,178 +0,0 @@
|
|||
From ffe387740bbe88dd88bbe04d6375902708003d6e Mon Sep 17 00:00:00 2001
|
||||
From: Felix Fietkau <nbd@nbd.name>
|
||||
Date: Fri, 7 Jul 2017 17:25:00 +0200
|
||||
Subject: net: add packet mangeling
|
||||
|
||||
ar8216 switches have a hardware bug, which renders normal 802.1q support
|
||||
unusable. Packet mangling is required to fix up the vlan for incoming
|
||||
packets.
|
||||
|
||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
---
|
||||
include/linux/netdevice.h | 11 +++++++++++
|
||||
include/linux/skbuff.h | 14 ++++----------
|
||||
net/Kconfig | 6 ++++++
|
||||
net/core/dev.c | 20 +++++++++++++++-----
|
||||
net/core/skbuff.c | 17 +++++++++++++++++
|
||||
net/ethernet/eth.c | 6 ++++++
|
||||
6 files changed, 59 insertions(+), 15 deletions(-)
|
||||
|
||||
--- a/include/linux/netdevice.h
|
||||
+++ b/include/linux/netdevice.h
|
||||
@@ -1648,6 +1648,10 @@ enum netdev_priv_flags {
|
||||
IFF_TX_SKB_NO_LINEAR = 1<<31,
|
||||
};
|
||||
|
||||
+enum netdev_extra_priv_flags {
|
||||
+ IFF_NO_IP_ALIGN = 1<<0,
|
||||
+};
|
||||
+
|
||||
#define IFF_802_1Q_VLAN IFF_802_1Q_VLAN
|
||||
#define IFF_EBRIDGE IFF_EBRIDGE
|
||||
#define IFF_BONDING IFF_BONDING
|
||||
@@ -1680,6 +1684,7 @@ enum netdev_priv_flags {
|
||||
#define IFF_L3MDEV_RX_HANDLER IFF_L3MDEV_RX_HANDLER
|
||||
#define IFF_LIVE_RENAME_OK IFF_LIVE_RENAME_OK
|
||||
#define IFF_TX_SKB_NO_LINEAR IFF_TX_SKB_NO_LINEAR
|
||||
+#define IFF_NO_IP_ALIGN IFF_NO_IP_ALIGN
|
||||
|
||||
/* Specifies the type of the struct net_device::ml_priv pointer */
|
||||
enum netdev_ml_priv_type {
|
||||
@@ -1981,6 +1986,7 @@ struct net_device {
|
||||
/* Read-mostly cache-line for fast-path access */
|
||||
unsigned int flags;
|
||||
unsigned int priv_flags;
|
||||
+ unsigned int extra_priv_flags;
|
||||
const struct net_device_ops *netdev_ops;
|
||||
int ifindex;
|
||||
unsigned short gflags;
|
||||
@@ -2041,6 +2047,11 @@ struct net_device {
|
||||
const struct tlsdev_ops *tlsdev_ops;
|
||||
#endif
|
||||
|
||||
+#ifdef CONFIG_ETHERNET_PACKET_MANGLE
|
||||
+ void (*eth_mangle_rx)(struct net_device *dev, struct sk_buff *skb);
|
||||
+ struct sk_buff *(*eth_mangle_tx)(struct net_device *dev, struct sk_buff *skb);
|
||||
+#endif
|
||||
+
|
||||
const struct header_ops *header_ops;
|
||||
|
||||
unsigned char operstate;
|
||||
@@ -2115,6 +2126,10 @@ struct net_device {
|
||||
struct mctp_dev __rcu *mctp_ptr;
|
||||
#endif
|
||||
|
||||
+#ifdef CONFIG_ETHERNET_PACKET_MANGLE
|
||||
+ void *phy_ptr; /* PHY device specific data */
|
||||
+#endif
|
||||
+
|
||||
/*
|
||||
* Cache lines mostly used on receive path (including eth_type_trans())
|
||||
*/
|
||||
--- a/include/linux/skbuff.h
|
||||
+++ b/include/linux/skbuff.h
|
||||
@@ -2758,6 +2758,10 @@ static inline int pskb_trim(struct sk_bu
|
||||
return (len < skb->len) ? __pskb_trim(skb, len) : 0;
|
||||
}
|
||||
|
||||
+extern struct sk_buff *__netdev_alloc_skb_ip_align(struct net_device *dev,
|
||||
+ unsigned int length, gfp_t gfp);
|
||||
+
|
||||
+
|
||||
/**
|
||||
* pskb_trim_unique - remove end from a paged unique (not cloned) buffer
|
||||
* @skb: buffer to alter
|
||||
@@ -2908,16 +2912,6 @@ static inline struct sk_buff *dev_alloc_
|
||||
}
|
||||
|
||||
|
||||
-static inline struct sk_buff *__netdev_alloc_skb_ip_align(struct net_device *dev,
|
||||
- unsigned int length, gfp_t gfp)
|
||||
-{
|
||||
- struct sk_buff *skb = __netdev_alloc_skb(dev, length + NET_IP_ALIGN, gfp);
|
||||
-
|
||||
- if (NET_IP_ALIGN && skb)
|
||||
- skb_reserve(skb, NET_IP_ALIGN);
|
||||
- return skb;
|
||||
-}
|
||||
-
|
||||
static inline struct sk_buff *netdev_alloc_skb_ip_align(struct net_device *dev,
|
||||
unsigned int length)
|
||||
{
|
||||
--- a/net/Kconfig
|
||||
+++ b/net/Kconfig
|
||||
@@ -26,6 +26,12 @@ menuconfig NET
|
||||
|
||||
if NET
|
||||
|
||||
+config ETHERNET_PACKET_MANGLE
|
||||
+ bool
|
||||
+ help
|
||||
+ This option can be selected by phy drivers that need to mangle
|
||||
+ packets going in or out of an ethernet device.
|
||||
+
|
||||
config WANT_COMPAT_NETLINK_MESSAGES
|
||||
bool
|
||||
help
|
||||
--- a/net/core/dev.c
|
||||
+++ b/net/core/dev.c
|
||||
@@ -3578,6 +3578,11 @@ static int xmit_one(struct sk_buff *skb,
|
||||
if (dev_nit_active(dev))
|
||||
dev_queue_xmit_nit(skb, dev);
|
||||
|
||||
+#ifdef CONFIG_ETHERNET_PACKET_MANGLE
|
||||
+ if (dev->eth_mangle_tx && !(skb = dev->eth_mangle_tx(dev, skb)))
|
||||
+ return NETDEV_TX_OK;
|
||||
+#endif
|
||||
+
|
||||
len = skb->len;
|
||||
PRANDOM_ADD_NOISE(skb, dev, txq, len + jiffies);
|
||||
trace_net_dev_start_xmit(skb, dev);
|
||||
--- a/net/core/skbuff.c
|
||||
+++ b/net/core/skbuff.c
|
||||
@@ -61,6 +61,7 @@
|
||||
#include <linux/if_vlan.h>
|
||||
#include <linux/mpls.h>
|
||||
#include <linux/kcov.h>
|
||||
+#include <linux/if.h>
|
||||
|
||||
#include <net/protocol.h>
|
||||
#include <net/dst.h>
|
||||
@@ -602,6 +603,22 @@ skb_fail:
|
||||
}
|
||||
EXPORT_SYMBOL(__napi_alloc_skb);
|
||||
|
||||
+struct sk_buff *__netdev_alloc_skb_ip_align(struct net_device *dev,
|
||||
+ unsigned int length, gfp_t gfp)
|
||||
+{
|
||||
+ struct sk_buff *skb = __netdev_alloc_skb(dev, length + NET_IP_ALIGN, gfp);
|
||||
+
|
||||
+#ifdef CONFIG_ETHERNET_PACKET_MANGLE
|
||||
+ if (dev && (dev->extra_priv_flags & IFF_NO_IP_ALIGN))
|
||||
+ return skb;
|
||||
+#endif
|
||||
+
|
||||
+ if (NET_IP_ALIGN && skb)
|
||||
+ skb_reserve(skb, NET_IP_ALIGN);
|
||||
+ return skb;
|
||||
+}
|
||||
+EXPORT_SYMBOL(__netdev_alloc_skb_ip_align);
|
||||
+
|
||||
void skb_add_rx_frag(struct sk_buff *skb, int i, struct page *page, int off,
|
||||
int size, unsigned int truesize)
|
||||
{
|
||||
--- a/net/ethernet/eth.c
|
||||
+++ b/net/ethernet/eth.c
|
||||
@@ -170,6 +170,12 @@ __be16 eth_type_trans(struct sk_buff *sk
|
||||
const struct ethhdr *eth;
|
||||
|
||||
skb->dev = dev;
|
||||
+
|
||||
+#ifdef CONFIG_ETHERNET_PACKET_MANGLE
|
||||
+ if (dev->eth_mangle_rx)
|
||||
+ dev->eth_mangle_rx(dev, skb);
|
||||
+#endif
|
||||
+
|
||||
skb_reset_mac_header(skb);
|
||||
|
||||
eth = (struct ethhdr *)skb->data;
|
|
@ -1,74 +0,0 @@
|
|||
From 82985725e071f2a5735052f18e109a32aeac3a0b Mon Sep 17 00:00:00 2001
|
||||
From: David Bauer <mail@david-bauer.net>
|
||||
Date: Sun, 26 Jul 2020 02:38:31 +0200
|
||||
Subject: [PATCH] net: usb: r8152: add LED configuration from OF
|
||||
|
||||
This adds the ability to configure the LED configuration register using
|
||||
OF. This way, the correct value for board specific LED configuration can
|
||||
be determined.
|
||||
|
||||
Signed-off-by: David Bauer <mail@david-bauer.net>
|
||||
---
|
||||
drivers/net/usb/r8152.c | 23 +++++++++++++++++++++++
|
||||
1 file changed, 23 insertions(+)
|
||||
|
||||
--- a/drivers/net/usb/r8152.c
|
||||
+++ b/drivers/net/usb/r8152.c
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <linux/mii.h>
|
||||
#include <linux/ethtool.h>
|
||||
#include <linux/usb.h>
|
||||
+#include <linux/of.h>
|
||||
#include <linux/crc32.h>
|
||||
#include <linux/if_vlan.h>
|
||||
#include <linux/uaccess.h>
|
||||
@@ -6822,6 +6823,22 @@ static void rtl_tally_reset(struct r8152
|
||||
ocp_write_word(tp, MCU_TYPE_PLA, PLA_RSTTALLY, ocp_data);
|
||||
}
|
||||
|
||||
+static int r8152_led_configuration(struct r8152 *tp)
|
||||
+{
|
||||
+ u32 led_data;
|
||||
+ int ret;
|
||||
+
|
||||
+ ret = of_property_read_u32(tp->udev->dev.of_node, "realtek,led-data",
|
||||
+ &led_data);
|
||||
+
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ ocp_write_word(tp, MCU_TYPE_PLA, PLA_LEDSEL, led_data);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static void r8152b_init(struct r8152 *tp)
|
||||
{
|
||||
u32 ocp_data;
|
||||
@@ -6863,6 +6880,8 @@ static void r8152b_init(struct r8152 *tp
|
||||
ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_USB_CTRL);
|
||||
ocp_data &= ~(RX_AGG_DISABLE | RX_ZERO_EN);
|
||||
ocp_write_word(tp, MCU_TYPE_USB, USB_USB_CTRL, ocp_data);
|
||||
+
|
||||
+ r8152_led_configuration(tp);
|
||||
}
|
||||
|
||||
static void r8153_init(struct r8152 *tp)
|
||||
@@ -7003,6 +7022,8 @@ static void r8153_init(struct r8152 *tp)
|
||||
tp->coalesce = COALESCE_SLOW;
|
||||
break;
|
||||
}
|
||||
+
|
||||
+ r8152_led_configuration(tp);
|
||||
}
|
||||
|
||||
static void r8153b_init(struct r8152 *tp)
|
||||
@@ -7085,6 +7106,8 @@ static void r8153b_init(struct r8152 *tp
|
||||
rtl_tally_reset(tp);
|
||||
|
||||
tp->coalesce = 15000; /* 15 us */
|
||||
+
|
||||
+ r8152_led_configuration(tp);
|
||||
}
|
||||
|
||||
static void r8153c_init(struct r8152 *tp)
|
|
@ -1,54 +0,0 @@
|
|||
From 3ee05f4aa64fc86af3be5bc176ba5808de9260a7 Mon Sep 17 00:00:00 2001
|
||||
From: David Bauer <mail@david-bauer.net>
|
||||
Date: Sun, 26 Jul 2020 15:30:33 +0200
|
||||
Subject: [PATCH] dt-bindings: net: add RTL8152 binding documentation
|
||||
|
||||
Add binding documentation for the Realtek RTL8152 / RTL8153 USB ethernet
|
||||
adapters.
|
||||
|
||||
Signed-off-by: David Bauer <mail@david-bauer.net>
|
||||
---
|
||||
.../bindings/net/realtek,rtl8152.yaml | 36 +++++++++++++++++++
|
||||
1 file changed, 36 insertions(+)
|
||||
create mode 100644 Documentation/devicetree/bindings/net/realtek,rtl8152.yaml
|
||||
|
||||
--- /dev/null
|
||||
+++ b/Documentation/devicetree/bindings/net/realtek,rtl8152.yaml
|
||||
@@ -0,0 +1,36 @@
|
||||
+# SPDX-License-Identifier: GPL-2.0
|
||||
+%YAML 1.2
|
||||
+---
|
||||
+$id: http://devicetree.org/schemas/net/realtek,rtl8152.yaml#
|
||||
+$schema: http://devicetree.org/meta-schemas/core.yaml#
|
||||
+
|
||||
+title: Realtek RTL8152/RTL8153 series USB ethernet
|
||||
+
|
||||
+maintainers:
|
||||
+ - David Bauer <mail@david-bauer.net>
|
||||
+
|
||||
+properties:
|
||||
+ compatible:
|
||||
+ oneOf:
|
||||
+ - items:
|
||||
+ - enum:
|
||||
+ - realtek,rtl8152
|
||||
+ - realtek,rtl8153
|
||||
+
|
||||
+ reg:
|
||||
+ description: The device number on the USB bus
|
||||
+
|
||||
+ realtek,led-data:
|
||||
+ description: Value to be written to the LED configuration register.
|
||||
+
|
||||
+required:
|
||||
+ - compatible
|
||||
+ - reg
|
||||
+
|
||||
+examples:
|
||||
+ - |
|
||||
+ usb-eth@2 {
|
||||
+ compatible = "realtek,rtl8153";
|
||||
+ reg = <2>;
|
||||
+ realtek,led-data = <0x87>;
|
||||
+ };
|
||||
\ No newline at end of file
|
|
@ -14,7 +14,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
|
|||
|
||||
--- a/drivers/net/ethernet/broadcom/bgmac-bcma.c
|
||||
+++ b/drivers/net/ethernet/broadcom/bgmac-bcma.c
|
||||
@@ -280,6 +280,7 @@ static int bgmac_probe(struct bcma_devic
|
||||
@@ -268,6 +268,7 @@ static int bgmac_probe(struct bcma_devic
|
||||
bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;
|
||||
bgmac->feature_flags |= BGMAC_FEAT_NO_RESET;
|
||||
bgmac->feature_flags |= BGMAC_FEAT_FORCE_SPEED_2500;
|
||||
|
@ -55,7 +55,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
|
|||
net_dev->max_mtu = BGMAC_RX_MAX_FRAME_SIZE - ETH_FCS_LEN;
|
||||
|
||||
+ if ((bgmac->feature_flags & BGMAC_FEAT_SRAB) && !bgmac_b53_pdata.regs) {
|
||||
+ bgmac_b53_pdata.regs = ioremap(0x18007000, 0x1000);
|
||||
+ bgmac_b53_pdata.regs = ioremap_nocache(0x18007000, 0x1000);
|
||||
+
|
||||
+ err = platform_device_register(&bgmac_b53_dev);
|
||||
+ if (!err)
|
||||
|
|
|
@ -15,9 +15,9 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
|
|||
|
||||
#include "gpiolib.h"
|
||||
#include "gpiolib-of.h"
|
||||
@@ -1052,3 +1054,72 @@ void of_gpio_dev_init(struct gpio_chip *
|
||||
else
|
||||
gc->of_node = gdev->dev.of_node;
|
||||
@@ -1039,3 +1041,72 @@ void of_gpiochip_remove(struct gpio_chip
|
||||
{
|
||||
of_node_put(chip->of_node);
|
||||
}
|
||||
+
|
||||
+#ifdef CONFIG_GPIO_SYSFS
|
||||
|
@ -129,7 +129,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
|
|||
{
|
||||
--- a/drivers/gpio/gpiolib-sysfs.c
|
||||
+++ b/drivers/gpio/gpiolib-sysfs.c
|
||||
@@ -564,7 +564,7 @@ static struct class gpio_class = {
|
||||
@@ -572,7 +572,7 @@ static struct class gpio_class = {
|
||||
*
|
||||
* Returns zero on success, else an error.
|
||||
*/
|
||||
|
@ -138,7 +138,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
|
|||
{
|
||||
struct gpio_chip *chip;
|
||||
struct gpio_device *gdev;
|
||||
@@ -626,6 +626,8 @@ int gpiod_export(struct gpio_desc *desc,
|
||||
@@ -634,6 +634,8 @@ int gpiod_export(struct gpio_desc *desc,
|
||||
offset = gpio_chip_hwgpio(desc);
|
||||
if (chip->names && chip->names[offset])
|
||||
ioname = chip->names[offset];
|
||||
|
@ -147,7 +147,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
|
|||
|
||||
dev = device_create_with_groups(&gpio_class, &gdev->dev,
|
||||
MKDEV(0, 0), data, gpio_groups,
|
||||
@@ -647,6 +649,12 @@ err_unlock:
|
||||
@@ -655,6 +657,12 @@ err_unlock:
|
||||
gpiod_dbg(desc, "%s: status %d\n", __func__, status);
|
||||
return status;
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||
|
||||
--- a/net/Kconfig
|
||||
+++ b/net/Kconfig
|
||||
@@ -104,6 +104,9 @@ source "net/mptcp/Kconfig"
|
||||
@@ -98,6 +98,9 @@ source "net/mptcp/Kconfig"
|
||||
|
||||
endif # if INET
|
||||
|
||||
|
@ -58,7 +58,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||
|
||||
static void sock_inuse_add(struct net *net, int val);
|
||||
|
||||
@@ -545,6 +547,18 @@ discard_and_relse:
|
||||
@@ -544,6 +546,18 @@ discard_and_relse:
|
||||
}
|
||||
EXPORT_SYMBOL(__sk_receive_skb);
|
||||
|
||||
|
@ -77,7 +77,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||
INDIRECT_CALLABLE_DECLARE(struct dst_entry *ip6_dst_check(struct dst_entry *,
|
||||
u32));
|
||||
INDIRECT_CALLABLE_DECLARE(struct dst_entry *ipv4_dst_check(struct dst_entry *,
|
||||
@@ -1981,9 +1995,11 @@ static void __sk_free(struct sock *sk)
|
||||
@@ -1967,9 +1981,11 @@ static void __sk_free(struct sock *sk)
|
||||
if (likely(sk->sk_net_refcnt))
|
||||
sock_inuse_add(sock_net(sk), -1);
|
||||
|
||||
|
@ -152,7 +152,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||
Support for PF_PACKET sockets monitoring interface used by the ss tool.
|
||||
--- a/net/unix/Kconfig
|
||||
+++ b/net/unix/Kconfig
|
||||
@@ -33,6 +33,7 @@ config AF_UNIX_OOB
|
||||
@@ -28,6 +28,7 @@ config UNIX_SCM
|
||||
config UNIX_DIAG
|
||||
tristate "UNIX: socket monitoring interface"
|
||||
depends on UNIX
|
||||
|
|
|
@ -29,7 +29,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||
|
||||
--- a/fs/locks.c
|
||||
+++ b/fs/locks.c
|
||||
@@ -2929,6 +2929,8 @@ static const struct seq_operations locks
|
||||
@@ -3044,6 +3044,8 @@ static const struct seq_operations locks
|
||||
|
||||
static int __init proc_locks_init(void)
|
||||
{
|
||||
|
@ -158,7 +158,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||
IPC_SEM_IDS, sysvipc_sem_proc_show);
|
||||
--- a/ipc/shm.c
|
||||
+++ b/ipc/shm.c
|
||||
@@ -154,6 +154,8 @@ pure_initcall(ipc_ns_init);
|
||||
@@ -144,6 +144,8 @@ pure_initcall(ipc_ns_init);
|
||||
|
||||
void __init shm_init(void)
|
||||
{
|
||||
|
@ -235,7 +235,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||
if (!pe)
|
||||
--- a/mm/vmalloc.c
|
||||
+++ b/mm/vmalloc.c
|
||||
@@ -3961,6 +3961,8 @@ static const struct seq_operations vmall
|
||||
@@ -3899,6 +3899,8 @@ static const struct seq_operations vmall
|
||||
|
||||
static int __init proc_vmalloc_init(void)
|
||||
{
|
||||
|
@ -246,7 +246,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||
&vmalloc_op,
|
||||
--- a/mm/vmstat.c
|
||||
+++ b/mm/vmstat.c
|
||||
@@ -2083,10 +2083,12 @@ void __init init_mm_internals(void)
|
||||
@@ -2044,10 +2044,12 @@ void __init init_mm_internals(void)
|
||||
start_shepherd_timer();
|
||||
#endif
|
||||
#ifdef CONFIG_PROC_FS
|
||||
|
@ -330,7 +330,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||
|
||||
--- a/net/core/sock.c
|
||||
+++ b/net/core/sock.c
|
||||
@@ -3853,6 +3853,8 @@ static __net_initdata struct pernet_oper
|
||||
@@ -3839,6 +3839,8 @@ static __net_initdata struct pernet_oper
|
||||
|
||||
static int __init proto_init(void)
|
||||
{
|
||||
|
@ -396,7 +396,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|||
}
|
||||
--- a/net/ipv4/route.c
|
||||
+++ b/net/ipv4/route.c
|
||||
@@ -387,6 +387,9 @@ static struct pernet_operations ip_rt_pr
|
||||
@@ -386,6 +386,9 @@ static struct pernet_operations ip_rt_pr
|
||||
|
||||
static int __init ip_rt_proc_init(void)
|
||||
{
|
||||
|
|
|
@ -1,92 +0,0 @@
|
|||
From e3692cb2fcd5ba1244512a0f43b8118f65f1c375 Mon Sep 17 00:00:00 2001
|
||||
From: Felix Fietkau <nbd@nbd.name>
|
||||
Date: Sat, 8 Jul 2017 08:20:43 +0200
|
||||
Subject: debloat: dmabuf
|
||||
|
||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
---
|
||||
drivers/base/Kconfig | 2 +-
|
||||
drivers/dma-buf/Makefile | 10 +++++++---
|
||||
drivers/dma-buf/dma-buf.c | 4 +++-
|
||||
kernel/sched/core.c | 1 +
|
||||
4 files changed, 12 insertions(+), 5 deletions(-)
|
||||
|
||||
--- a/drivers/base/Kconfig
|
||||
+++ b/drivers/base/Kconfig
|
||||
@@ -187,7 +187,7 @@ config SOC_BUS
|
||||
source "drivers/base/regmap/Kconfig"
|
||||
|
||||
config DMA_SHARED_BUFFER
|
||||
- bool
|
||||
+ tristate
|
||||
default n
|
||||
select IRQ_WORK
|
||||
help
|
||||
--- a/drivers/dma-buf/heaps/Makefile
|
||||
+++ b/drivers/dma-buf/heaps/Makefile
|
||||
@@ -1,3 +1,3 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
-obj-$(CONFIG_DMABUF_HEAPS_SYSTEM) += system_heap.o
|
||||
-obj-$(CONFIG_DMABUF_HEAPS_CMA) += cma_heap.o
|
||||
+dma-buf-objs-$(CONFIG_DMABUF_HEAPS_SYSTEM) += system_heap.o
|
||||
+dma-buf-objs-$(CONFIG_DMABUF_HEAPS_CMA) += cma_heap.o
|
||||
--- a/drivers/dma-buf/Makefile
|
||||
+++ b/drivers/dma-buf/Makefile
|
||||
@@ -1,16 +1,20 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
-obj-y := dma-buf.o dma-fence.o dma-fence-array.o dma-fence-chain.o \
|
||||
+obj-$(CONFIG_DMA_SHARED_BUFFER) := dma-shared-buffer.o
|
||||
+
|
||||
+dma-buf-objs-y := dma-buf.o dma-fence.o dma-fence-array.o dma-fence-chain.o \
|
||||
dma-resv.o seqno-fence.o
|
||||
-obj-$(CONFIG_DMABUF_HEAPS) += dma-heap.o
|
||||
-obj-$(CONFIG_DMABUF_HEAPS) += heaps/
|
||||
-obj-$(CONFIG_SYNC_FILE) += sync_file.o
|
||||
-obj-$(CONFIG_SW_SYNC) += sw_sync.o sync_debug.o
|
||||
-obj-$(CONFIG_UDMABUF) += udmabuf.o
|
||||
-obj-$(CONFIG_DMABUF_SYSFS_STATS) += dma-buf-sysfs-stats.o
|
||||
+dma-buf-objs-$(CONFIG_DMABUF_HEAPS) += dma-heap.o
|
||||
+obj-$(CONFIG_DMABUF_HEAPS) += heaps/
|
||||
+dma-buf-objs-$(CONFIG_SYNC_FILE) += sync_file.o
|
||||
+dma-buf-objs-$(CONFIG_SW_SYNC) += sw_sync.o sync_debug.o
|
||||
+dma-buf-objs-$(CONFIG_UDMABUF) += udmabuf.o
|
||||
+dma-buf-objs-$(CONFIG_DMABUF_SYSFS_STATS) += udmabuf.o
|
||||
|
||||
dmabuf_selftests-y := \
|
||||
selftest.o \
|
||||
st-dma-fence.o \
|
||||
st-dma-fence-chain.o
|
||||
|
||||
-obj-$(CONFIG_DMABUF_SELFTESTS) += dmabuf_selftests.o
|
||||
+dma-buf-objs-$(CONFIG_DMABUF_SELFTESTS) += dmabuf_selftests.o
|
||||
+
|
||||
+dma-shared-buffer-objs := $(dma-buf-objs-y)
|
||||
--- a/drivers/dma-buf/dma-buf.c
|
||||
+++ b/drivers/dma-buf/dma-buf.c
|
||||
@@ -1498,4 +1498,5 @@ static void __exit dma_buf_deinit(void)
|
||||
kern_unmount(dma_buf_mnt);
|
||||
dma_buf_uninit_sysfs_statistics();
|
||||
}
|
||||
-__exitcall(dma_buf_deinit);
|
||||
+module_exit(dma_buf_deinit);
|
||||
+MODULE_LICENSE("GPL");
|
||||
--- a/kernel/sched/core.c
|
||||
+++ b/kernel/sched/core.c
|
||||
@@ -4174,6 +4174,7 @@ int wake_up_state(struct task_struct *p,
|
||||
{
|
||||
return try_to_wake_up(p, state, 0);
|
||||
}
|
||||
+EXPORT_SYMBOL_GPL(wake_up_state);
|
||||
|
||||
/*
|
||||
* Perform scheduler related setup for a newly forked process p.
|
||||
--- a/fs/d_path.c
|
||||
+++ b/fs/d_path.c
|
||||
@@ -316,6 +316,7 @@ char *dynamic_dname(struct dentry *dentr
|
||||
buffer += buflen - sz;
|
||||
return memcpy(buffer, temp, sz);
|
||||
}
|
||||
+EXPORT_SYMBOL_GPL(dynamic_dname);
|
||||
|
||||
char *simple_dname(struct dentry *dentry, char *buffer, int buflen)
|
||||
{
|
|
@ -1,220 +0,0 @@
|
|||
From a779a482fb9b9f8fcdf8b2519c789b4b9bb5dd05 Mon Sep 17 00:00:00 2001
|
||||
From: Felix Fietkau <nbd@nbd.name>
|
||||
Date: Fri, 7 Jul 2017 16:56:48 +0200
|
||||
Subject: build: add a hack for removing non-essential module info
|
||||
|
||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
---
|
||||
include/linux/module.h | 13 ++++++++-----
|
||||
include/linux/moduleparam.h | 15 ++++++++++++---
|
||||
init/Kconfig | 7 +++++++
|
||||
kernel/module.c | 5 ++++-
|
||||
scripts/mod/modpost.c | 12 ++++++++++++
|
||||
5 files changed, 43 insertions(+), 9 deletions(-)
|
||||
|
||||
--- a/include/linux/module.h
|
||||
+++ b/include/linux/module.h
|
||||
@@ -157,6 +157,7 @@ extern void cleanup_module(void);
|
||||
|
||||
/* Generic info of form tag = "info" */
|
||||
#define MODULE_INFO(tag, info) __MODULE_INFO(tag, tag, info)
|
||||
+#define MODULE_INFO_STRIP(tag, info) __MODULE_INFO_STRIP(tag, tag, info)
|
||||
|
||||
/* For userspace: you can also call me... */
|
||||
#define MODULE_ALIAS(_alias) MODULE_INFO(alias, _alias)
|
||||
@@ -216,12 +217,12 @@ extern void cleanup_module(void);
|
||||
* Author(s), use "Name <email>" or just "Name", for multiple
|
||||
* authors use multiple MODULE_AUTHOR() statements/lines.
|
||||
*/
|
||||
-#define MODULE_AUTHOR(_author) MODULE_INFO(author, _author)
|
||||
+#define MODULE_AUTHOR(_author) MODULE_INFO_STRIP(author, _author)
|
||||
|
||||
/* What your module does. */
|
||||
-#define MODULE_DESCRIPTION(_description) MODULE_INFO(description, _description)
|
||||
+#define MODULE_DESCRIPTION(_description) MODULE_INFO_STRIP(description, _description)
|
||||
|
||||
-#ifdef MODULE
|
||||
+#if defined(MODULE) && !defined(CONFIG_MODULE_STRIPPED)
|
||||
/* Creates an alias so file2alias.c can find device table. */
|
||||
#define MODULE_DEVICE_TABLE(type, name) \
|
||||
extern typeof(name) __mod_##type##__##name##_device_table \
|
||||
@@ -248,7 +249,9 @@ extern typeof(name) __mod_##type##__##na
|
||||
*/
|
||||
|
||||
#if defined(MODULE) || !defined(CONFIG_SYSFS)
|
||||
-#define MODULE_VERSION(_version) MODULE_INFO(version, _version)
|
||||
+#define MODULE_VERSION(_version) MODULE_INFO_STRIP(version, _version)
|
||||
+#elif defined(CONFIG_MODULE_STRIPPED)
|
||||
+#define MODULE_VERSION(_version) __MODULE_INFO_DISABLED(version)
|
||||
#else
|
||||
#define MODULE_VERSION(_version) \
|
||||
MODULE_INFO(version, _version); \
|
||||
@@ -271,7 +274,7 @@ extern typeof(name) __mod_##type##__##na
|
||||
/* Optional firmware file (or files) needed by the module
|
||||
* format is simply firmware file name. Multiple firmware
|
||||
* files require multiple MODULE_FIRMWARE() specifiers */
|
||||
-#define MODULE_FIRMWARE(_firmware) MODULE_INFO(firmware, _firmware)
|
||||
+#define MODULE_FIRMWARE(_firmware) MODULE_INFO_STRIP(firmware, _firmware)
|
||||
|
||||
#define MODULE_IMPORT_NS(ns) MODULE_INFO(import_ns, #ns)
|
||||
|
||||
--- a/include/linux/moduleparam.h
|
||||
+++ b/include/linux/moduleparam.h
|
||||
@@ -20,10 +20,24 @@
|
||||
/* Chosen so that structs with an unsigned long line up. */
|
||||
#define MAX_PARAM_PREFIX_LEN (64 - sizeof(unsigned long))
|
||||
|
||||
+/* This struct is here for syntactic coherency, it is not used */
|
||||
+#define __MODULE_INFO_DISABLED(name) \
|
||||
+ struct __UNIQUE_ID(name) {}
|
||||
+
|
||||
+#ifdef CONFIG_MODULE_STRIPPED
|
||||
+#define __MODULE_INFO_STRIP(tag, name, info) __MODULE_INFO_DISABLED(name)
|
||||
+#else
|
||||
+#define __MODULE_INFO_STRIP(tag, name, info) __MODULE_INFO(tag, name, info)
|
||||
+#endif
|
||||
+
|
||||
+#ifdef MODULE
|
||||
#define __MODULE_INFO(tag, name, info) \
|
||||
static const char __UNIQUE_ID(name)[] \
|
||||
__used __attribute__((section(".modinfo"), unused, aligned(1))) \
|
||||
= __MODULE_INFO_PREFIX __stringify(tag) "=" info
|
||||
+#else
|
||||
+#define __MODULE_INFO(tag, name, info) __MODULE_INFO_DISABLED(name)
|
||||
+#endif
|
||||
|
||||
#define __MODULE_PARM_TYPE(name, _type) \
|
||||
__MODULE_INFO(parmtype, name##type, #name ":" _type)
|
||||
@@ -31,7 +45,7 @@ static const char __UNIQUE_ID(name)[]
|
||||
/* One for each parameter, describing how to use it. Some files do
|
||||
multiple of these per line, so can't just use MODULE_INFO. */
|
||||
#define MODULE_PARM_DESC(_parm, desc) \
|
||||
- __MODULE_INFO(parm, _parm, #_parm ":" desc)
|
||||
+ __MODULE_INFO_STRIP(parm, _parm, #_parm ":" desc)
|
||||
|
||||
struct kernel_param;
|
||||
|
||||
--- a/init/Kconfig
|
||||
+++ b/init/Kconfig
|
||||
@@ -2198,6 +2198,13 @@ config TRIM_UNUSED_KSYMS
|
||||
|
||||
If unsure, or if you need to build out-of-tree modules, say N.
|
||||
|
||||
+config MODULE_STRIPPED
|
||||
+ bool "Reduce module size"
|
||||
+ depends on MODULES
|
||||
+ help
|
||||
+ Remove module parameter descriptions, author info, version, aliases,
|
||||
+ device tables, etc.
|
||||
+
|
||||
endif # MODULES
|
||||
|
||||
config MODULES_TREE_LOOKUP
|
||||
--- a/kernel/module.c
|
||||
+++ b/kernel/module.c
|
||||
@@ -1281,6 +1281,7 @@ static struct module_attribute *modinfo_
|
||||
|
||||
static const char vermagic[] = VERMAGIC_STRING;
|
||||
|
||||
+#if defined(CONFIG_MODVERSIONS) || !defined(CONFIG_MODULE_STRIPPED)
|
||||
static int try_to_force_load(struct module *mod, const char *reason)
|
||||
{
|
||||
#ifdef CONFIG_MODULE_FORCE_LOAD
|
||||
@@ -1292,6 +1293,7 @@ static int try_to_force_load(struct modu
|
||||
return -ENOEXEC;
|
||||
#endif
|
||||
}
|
||||
+#endif
|
||||
|
||||
#ifdef CONFIG_MODVERSIONS
|
||||
|
||||
@@ -3256,9 +3258,11 @@ static int setup_load_info(struct load_i
|
||||
|
||||
static int check_modinfo(struct module *mod, struct load_info *info, int flags)
|
||||
{
|
||||
- const char *modmagic = get_modinfo(info, "vermagic");
|
||||
int err;
|
||||
|
||||
+#ifndef CONFIG_MODULE_STRIPPED
|
||||
+ const char *modmagic = get_modinfo(info, "vermagic");
|
||||
+
|
||||
if (flags & MODULE_INIT_IGNORE_VERMAGIC)
|
||||
modmagic = NULL;
|
||||
|
||||
@@ -3279,6 +3283,7 @@ static int check_modinfo(struct module *
|
||||
mod->name);
|
||||
add_taint_module(mod, TAINT_OOT_MODULE, LOCKDEP_STILL_OK);
|
||||
}
|
||||
+#endif
|
||||
|
||||
check_modinfo_retpoline(mod, info);
|
||||
|
||||
--- a/scripts/mod/modpost.c
|
||||
+++ b/scripts/mod/modpost.c
|
||||
@@ -2056,7 +2056,9 @@ static void read_symbols(const char *mod
|
||||
symname = remove_dot(info.strtab + sym->st_name);
|
||||
|
||||
handle_modversions(mod, &info, sym, symname);
|
||||
+#ifndef CONFIG_MODULE_STRIPPED
|
||||
handle_moddevtable(mod, &info, sym, symname);
|
||||
+#endif
|
||||
}
|
||||
|
||||
/* Apply symbol namespaces from __kstrtabns_<symbol> entries. */
|
||||
@@ -2270,8 +2272,10 @@ static void add_header(struct buffer *b,
|
||||
buf_printf(b, "\n");
|
||||
buf_printf(b, "BUILD_SALT;\n");
|
||||
buf_printf(b, "\n");
|
||||
+#ifndef CONFIG_MODULE_STRIPPED
|
||||
buf_printf(b, "MODULE_INFO(vermagic, VERMAGIC_STRING);\n");
|
||||
buf_printf(b, "MODULE_INFO(name, KBUILD_MODNAME);\n");
|
||||
+#endif
|
||||
buf_printf(b, "\n");
|
||||
buf_printf(b, "__visible struct module __this_module\n");
|
||||
buf_printf(b, "__section(.gnu.linkonce.this_module) = {\n");
|
||||
@@ -2288,8 +2292,10 @@ static void add_header(struct buffer *b,
|
||||
|
||||
static void add_intree_flag(struct buffer *b, int is_intree)
|
||||
{
|
||||
+#ifndef CONFIG_MODULE_STRIPPED
|
||||
if (is_intree)
|
||||
buf_printf(b, "\nMODULE_INFO(intree, \"Y\");\n");
|
||||
+#endif
|
||||
}
|
||||
|
||||
/* Cannot check for assembler */
|
||||
@@ -2302,8 +2308,10 @@ static void add_retpoline(struct buffer
|
||||
|
||||
static void add_staging_flag(struct buffer *b, const char *name)
|
||||
{
|
||||
+#ifndef CONFIG_MODULE_STRIPPED
|
||||
if (strstarts(name, "drivers/staging"))
|
||||
buf_printf(b, "\nMODULE_INFO(staging, \"Y\");\n");
|
||||
+#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2387,11 +2395,13 @@ static void add_depends(struct buffer *b
|
||||
|
||||
static void add_srcversion(struct buffer *b, struct module *mod)
|
||||
{
|
||||
+#ifndef CONFIG_MODULE_STRIPPED
|
||||
if (mod->srcversion[0]) {
|
||||
buf_printf(b, "\n");
|
||||
buf_printf(b, "MODULE_INFO(srcversion, \"%s\");\n",
|
||||
mod->srcversion);
|
||||
}
|
||||
+#endif
|
||||
}
|
||||
|
||||
static void write_if_changed(struct buffer *b, const char *fname)
|
||||
@@ -2661,7 +2671,9 @@ int main(int argc, char **argv)
|
||||
add_staging_flag(&buf, mod->name);
|
||||
err |= add_versions(&buf, mod);
|
||||
add_depends(&buf, mod);
|
||||
+#ifndef CONFIG_MODULE_STRIPPED
|
||||
add_moddevtable(&buf, mod);
|
||||
+#endif
|
||||
add_srcversion(&buf, mod);
|
||||
|
||||
sprintf(fname, "%s.mod.c", mod->name);
|
|
@ -1,11 +0,0 @@
|
|||
--- a/scripts/kconfig/conf.c
|
||||
+++ b/scripts/kconfig/conf.c
|
||||
@@ -212,6 +212,8 @@ static int conf_sym(struct menu *menu)
|
||||
break;
|
||||
continue;
|
||||
case 0:
|
||||
+ if (!sym_has_value(sym) && !tty_stdio && getenv("FAIL_ON_UNCONFIGURED"))
|
||||
+ exit(1);
|
||||
newval = oldval;
|
||||
break;
|
||||
case '?':
|
File diff suppressed because it is too large
Load diff
|
@ -1,22 +0,0 @@
|
|||
From e44fc2af1ddc452b6659d08c16973d65c73b7d0a Mon Sep 17 00:00:00 2001
|
||||
From: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
|
||||
Date: Wed, 5 Feb 2020 18:36:43 +0000
|
||||
Subject: [PATCH] file2alias: build on macos
|
||||
|
||||
Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
|
||||
---
|
||||
scripts/mod/file2alias.c | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
--- a/scripts/mod/file2alias.c
|
||||
+++ b/scripts/mod/file2alias.c
|
||||
@@ -38,6 +38,9 @@ typedef struct {
|
||||
__u8 b[16];
|
||||
} guid_t;
|
||||
|
||||
+#ifdef __APPLE__
|
||||
+#define uuid_t compat_uuid_t
|
||||
+#endif
|
||||
/* backwards compatibility, don't use in new code */
|
||||
typedef struct {
|
||||
__u8 b[16];
|
|
@ -1,110 +0,0 @@
|
|||
From 48232d3d931c95953ce2ddfe7da7bb164aef6a73 Mon Sep 17 00:00:00 2001
|
||||
From: Felix Fietkau <nbd@nbd.name>
|
||||
Date: Fri, 7 Jul 2017 17:03:16 +0200
|
||||
Subject: fix portability of some includes files in tools/ used on the host
|
||||
|
||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
---
|
||||
tools/include/tools/be_byteshift.h | 4 ++++
|
||||
tools/include/tools/le_byteshift.h | 4 ++++
|
||||
tools/include/tools/linux_types.h | 22 ++++++++++++++++++++++
|
||||
3 files changed, 30 insertions(+)
|
||||
create mode 100644 tools/include/tools/linux_types.h
|
||||
|
||||
--- a/tools/include/tools/be_byteshift.h
|
||||
+++ b/tools/include/tools/be_byteshift.h
|
||||
@@ -2,6 +2,10 @@
|
||||
#ifndef _TOOLS_BE_BYTESHIFT_H
|
||||
#define _TOOLS_BE_BYTESHIFT_H
|
||||
|
||||
+#ifndef __linux__
|
||||
+#include "linux_types.h"
|
||||
+#endif
|
||||
+
|
||||
#include <stdint.h>
|
||||
|
||||
static inline uint16_t __get_unaligned_be16(const uint8_t *p)
|
||||
--- a/tools/include/tools/le_byteshift.h
|
||||
+++ b/tools/include/tools/le_byteshift.h
|
||||
@@ -2,6 +2,10 @@
|
||||
#ifndef _TOOLS_LE_BYTESHIFT_H
|
||||
#define _TOOLS_LE_BYTESHIFT_H
|
||||
|
||||
+#ifndef __linux__
|
||||
+#include "linux_types.h"
|
||||
+#endif
|
||||
+
|
||||
#include <stdint.h>
|
||||
|
||||
static inline uint16_t __get_unaligned_le16(const uint8_t *p)
|
||||
--- /dev/null
|
||||
+++ b/tools/include/tools/linux_types.h
|
||||
@@ -0,0 +1,26 @@
|
||||
+#ifndef __LINUX_TYPES_H
|
||||
+#define __LINUX_TYPES_H
|
||||
+
|
||||
+#include <stdint.h>
|
||||
+
|
||||
+typedef int8_t __s8;
|
||||
+typedef uint8_t __u8;
|
||||
+typedef uint8_t __be8;
|
||||
+typedef uint8_t __le8;
|
||||
+
|
||||
+typedef int16_t __s16;
|
||||
+typedef uint16_t __u16;
|
||||
+typedef uint16_t __be16;
|
||||
+typedef uint16_t __le16;
|
||||
+
|
||||
+typedef int32_t __s32;
|
||||
+typedef uint32_t __u32;
|
||||
+typedef uint32_t __be32;
|
||||
+typedef uint32_t __le32;
|
||||
+
|
||||
+typedef int64_t __s64;
|
||||
+typedef uint64_t __u64;
|
||||
+typedef uint64_t __be64;
|
||||
+typedef uint64_t __le64;
|
||||
+
|
||||
+#endif
|
||||
--- a/tools/include/linux/types.h
|
||||
+++ b/tools/include/linux/types.h
|
||||
@@ -7,8 +7,12 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#define __SANE_USERSPACE_TYPES__ /* For PPC64, to get LL64 types */
|
||||
+#ifndef __linux__
|
||||
+#include <tools/linux_types.h>
|
||||
+#else
|
||||
#include <asm/types.h>
|
||||
#include <asm/posix_types.h>
|
||||
+#endif
|
||||
|
||||
struct page;
|
||||
struct kmem_cache;
|
||||
--- a/tools/perf/pmu-events/jevents.c
|
||||
+++ b/tools/perf/pmu-events/jevents.c
|
||||
@@ -1,4 +1,6 @@
|
||||
+#ifdef __linux__
|
||||
#define _XOPEN_SOURCE 500 /* needed for nftw() */
|
||||
+#endif
|
||||
#define _GNU_SOURCE /* needed for asprintf() */
|
||||
|
||||
/* Parse event JSON files */
|
||||
@@ -35,6 +37,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
+#include <strings.h>
|
||||
#include <ctype.h>
|
||||
#include <unistd.h>
|
||||
#include <stdarg.h>
|
||||
--- a/tools/perf/pmu-events/json.c
|
||||
+++ b/tools/perf/pmu-events/json.c
|
||||
@@ -38,7 +38,6 @@
|
||||
#include <unistd.h>
|
||||
#include "jsmn.h"
|
||||
#include "json.h"
|
||||
-#include <linux/kernel.h>
|
||||
|
||||
|
||||
static char *mapfile(const char *fn, size_t *size)
|
|
@ -1,24 +0,0 @@
|
|||
From be9be95ff10e16a5b4ad36f903978d0cc5747024 Mon Sep 17 00:00:00 2001
|
||||
From: Felix Fietkau <nbd@nbd.name>
|
||||
Date: Fri, 7 Jul 2017 17:04:08 +0200
|
||||
Subject: kernel: fix linux/spi/spidev.h portability issues with musl
|
||||
|
||||
Felix will try to get this define included into musl
|
||||
|
||||
lede-commit: 795e7cf60de19e7a076a46874fab7bb88b43bbff
|
||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
---
|
||||
include/uapi/linux/spi/spidev.h | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/include/uapi/linux/spi/spidev.h
|
||||
+++ b/include/uapi/linux/spi/spidev.h
|
||||
@@ -117,7 +117,7 @@ struct spi_ioc_transfer {
|
||||
|
||||
/* not all platforms use <asm-generic/ioctl.h> or _IOC_TYPECHECK() ... */
|
||||
#define SPI_MSGSIZE(N) \
|
||||
- ((((N)*(sizeof (struct spi_ioc_transfer))) < (1 << _IOC_SIZEBITS)) \
|
||||
+ ((((N)*(sizeof (struct spi_ioc_transfer))) < (1 << 13)) \
|
||||
? ((N)*(sizeof (struct spi_ioc_transfer))) : 0)
|
||||
#define SPI_IOC_MESSAGE(N) _IOW(SPI_IOC_MAGIC, 0, char[SPI_MSGSIZE(N)])
|
||||
|
|
@ -1,138 +0,0 @@
|
|||
From e3d8676f5722b7622685581e06e8f53e6138e3ab Mon Sep 17 00:00:00 2001
|
||||
From: Felix Fietkau <nbd@nbd.name>
|
||||
Date: Sat, 15 Jul 2017 23:42:36 +0200
|
||||
Subject: use -ffunction-sections, -fdata-sections and --gc-sections
|
||||
|
||||
In combination with kernel symbol export stripping this significantly reduces
|
||||
the kernel image size. Used on both ARM and MIPS architectures.
|
||||
|
||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
Signed-off-by: Jonas Gorski <jogo@openwrt.org>
|
||||
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
|
||||
---
|
||||
Makefile | 10 +++----
|
||||
arch/arm/Kconfig | 1 +
|
||||
arch/arm/boot/compressed/Makefile | 1 +
|
||||
arch/arm/kernel/vmlinux.lds.S | 26 ++++++++--------
|
||||
arch/mips/Kconfig | 1 +
|
||||
arch/mips/kernel/vmlinux.lds.S | 4 +--
|
||||
include/asm-generic/vmlinux.lds.h | 63 ++++++++++++++++++++-------------------
|
||||
7 files changed, 55 insertions(+), 51 deletions(-)
|
||||
|
||||
--- a/arch/arm/Kconfig
|
||||
+++ b/arch/arm/Kconfig
|
||||
@@ -112,6 +112,7 @@ config ARM
|
||||
select HAVE_UID16
|
||||
select HAVE_VIRT_CPU_ACCOUNTING_GEN
|
||||
select IRQ_FORCED_THREADING
|
||||
+ select HAVE_LD_DEAD_CODE_DATA_ELIMINATION
|
||||
select MODULES_USE_ELF_REL
|
||||
select NEED_DMA_MAP_STATE
|
||||
select OF_EARLY_FLATTREE if OF
|
||||
--- a/arch/arm/boot/compressed/Makefile
|
||||
+++ b/arch/arm/boot/compressed/Makefile
|
||||
@@ -108,6 +108,7 @@ ifeq ($(CONFIG_FUNCTION_TRACER),y)
|
||||
ORIG_CFLAGS := $(KBUILD_CFLAGS)
|
||||
KBUILD_CFLAGS = $(subst -pg, , $(ORIG_CFLAGS))
|
||||
endif
|
||||
+KBUILD_CFLAGS_KERNEL := $(patsubst -f%-sections,,$(KBUILD_CFLAGS_KERNEL))
|
||||
|
||||
# -fstack-protector-strong triggers protection checks in this code,
|
||||
# but it is being used too early to link to meaningful stack_chk logic.
|
||||
--- a/arch/arm/kernel/vmlinux.lds.S
|
||||
+++ b/arch/arm/kernel/vmlinux.lds.S
|
||||
@@ -73,7 +73,7 @@ SECTIONS
|
||||
. = ALIGN(4);
|
||||
__ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) {
|
||||
__start___ex_table = .;
|
||||
- ARM_MMU_KEEP(*(__ex_table))
|
||||
+ KEEP(*(__ex_table))
|
||||
__stop___ex_table = .;
|
||||
}
|
||||
|
||||
@@ -100,24 +100,24 @@ SECTIONS
|
||||
}
|
||||
.init.arch.info : {
|
||||
__arch_info_begin = .;
|
||||
- *(.arch.info.init)
|
||||
+ KEEP(*(.arch.info.init))
|
||||
__arch_info_end = .;
|
||||
}
|
||||
.init.tagtable : {
|
||||
__tagtable_begin = .;
|
||||
- *(.taglist.init)
|
||||
+ KEEP(*(.taglist.init))
|
||||
__tagtable_end = .;
|
||||
}
|
||||
#ifdef CONFIG_SMP_ON_UP
|
||||
.init.smpalt : {
|
||||
__smpalt_begin = .;
|
||||
- *(.alt.smp.init)
|
||||
+ KEEP(*(.alt.smp.init))
|
||||
__smpalt_end = .;
|
||||
}
|
||||
#endif
|
||||
.init.pv_table : {
|
||||
__pv_table_begin = .;
|
||||
- *(.pv_table)
|
||||
+ KEEP(*(.pv_table))
|
||||
__pv_table_end = .;
|
||||
}
|
||||
|
||||
--- a/arch/arm/kernel/vmlinux.lds.h
|
||||
+++ b/arch/arm/kernel/vmlinux.lds.h
|
||||
@@ -28,7 +28,7 @@
|
||||
#define PROC_INFO \
|
||||
. = ALIGN(4); \
|
||||
__proc_info_begin = .; \
|
||||
- *(.proc.info.init) \
|
||||
+ KEEP(*(.proc.info.init)) \
|
||||
__proc_info_end = .;
|
||||
|
||||
#define HYPERVISOR_TEXT \
|
||||
@@ -39,11 +39,11 @@
|
||||
#define IDMAP_TEXT \
|
||||
ALIGN_FUNCTION(); \
|
||||
__idmap_text_start = .; \
|
||||
- *(.idmap.text) \
|
||||
+ KEEP(*(.idmap.text)) \
|
||||
__idmap_text_end = .; \
|
||||
. = ALIGN(PAGE_SIZE); \
|
||||
__hyp_idmap_text_start = .; \
|
||||
- *(.hyp.idmap.text) \
|
||||
+ KEEP(*(.hyp.idmap.text)) \
|
||||
__hyp_idmap_text_end = .;
|
||||
|
||||
#define ARM_DISCARD \
|
||||
@@ -86,12 +86,12 @@
|
||||
. = ALIGN(8); \
|
||||
.ARM.unwind_idx : { \
|
||||
__start_unwind_idx = .; \
|
||||
- *(.ARM.exidx*) \
|
||||
+ KEEP(*(.ARM.exidx*)) \
|
||||
__stop_unwind_idx = .; \
|
||||
} \
|
||||
.ARM.unwind_tab : { \
|
||||
__start_unwind_tab = .; \
|
||||
- *(.ARM.extab*) \
|
||||
+ KEEP(*(.ARM.extab*)) \
|
||||
__stop_unwind_tab = .; \
|
||||
}
|
||||
|
||||
@@ -102,14 +102,14 @@
|
||||
#define ARM_VECTORS \
|
||||
__vectors_start = .; \
|
||||
.vectors 0xffff0000 : AT(__vectors_start) { \
|
||||
- *(.vectors) \
|
||||
+ KEEP(*(.vectors)) \
|
||||
} \
|
||||
. = __vectors_start + SIZEOF(.vectors); \
|
||||
__vectors_end = .; \
|
||||
\
|
||||
__stubs_start = .; \
|
||||
.stubs ADDR(.vectors) + 0x1000 : AT(__stubs_start) { \
|
||||
- *(.stubs) \
|
||||
+ KEEP(*(.stubs)) \
|
||||
} \
|
||||
. = __stubs_start + SIZEOF(.stubs); \
|
||||
__stubs_end = .; \
|
|
@ -1,109 +0,0 @@
|
|||
From b14784e7883390c20ed3ff904892255404a5914b Mon Sep 17 00:00:00 2001
|
||||
From: Felix Fietkau <nbd@nbd.name>
|
||||
Date: Fri, 7 Jul 2017 17:05:53 +0200
|
||||
Subject: add an optional config option for stripping all unnecessary symbol exports from the kernel image
|
||||
|
||||
lede-commit: bb5a40c64b7c4f4848509fa0a6625055fc9e66cc
|
||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
---
|
||||
include/asm-generic/vmlinux.lds.h | 18 +++++++++++++++---
|
||||
include/linux/export.h | 9 ++++++++-
|
||||
scripts/Makefile.build | 2 +-
|
||||
3 files changed, 24 insertions(+), 5 deletions(-)
|
||||
|
||||
--- a/include/asm-generic/vmlinux.lds.h
|
||||
+++ b/include/asm-generic/vmlinux.lds.h
|
||||
@@ -54,6 +54,16 @@
|
||||
#define LOAD_OFFSET 0
|
||||
#endif
|
||||
|
||||
+#ifndef SYMTAB_KEEP
|
||||
+#define SYMTAB_KEEP KEEP(*(SORT(___ksymtab+*)))
|
||||
+#define SYMTAB_KEEP_GPL KEEP(*(SORT(___ksymtab_gpl+*)))
|
||||
+#endif
|
||||
+
|
||||
+#ifndef SYMTAB_DISCARD
|
||||
+#define SYMTAB_DISCARD
|
||||
+#define SYMTAB_DISCARD_GPL
|
||||
+#endif
|
||||
+
|
||||
/* Align . to a 8 byte boundary equals to maximum function alignment. */
|
||||
#define ALIGN_FUNCTION() . = ALIGN(8)
|
||||
|
||||
@@ -407,14 +417,14 @@
|
||||
/* Kernel symbol table: Normal symbols */ \
|
||||
__ksymtab : AT(ADDR(__ksymtab) - LOAD_OFFSET) { \
|
||||
__start___ksymtab = .; \
|
||||
- KEEP(*(SORT(___ksymtab+*))) \
|
||||
+ SYMTAB_KEEP \
|
||||
__stop___ksymtab = .; \
|
||||
} \
|
||||
\
|
||||
/* Kernel symbol table: GPL-only symbols */ \
|
||||
__ksymtab_gpl : AT(ADDR(__ksymtab_gpl) - LOAD_OFFSET) { \
|
||||
__start___ksymtab_gpl = .; \
|
||||
- KEEP(*(SORT(___ksymtab_gpl+*))) \
|
||||
+ SYMTAB_KEEP_GPL \
|
||||
__stop___ksymtab_gpl = .; \
|
||||
} \
|
||||
\
|
||||
@@ -476,7 +486,7 @@
|
||||
\
|
||||
/* Kernel symbol table: strings */ \
|
||||
__ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \
|
||||
- *(__ksymtab_strings) \
|
||||
+ *(__ksymtab_strings+*) \
|
||||
} \
|
||||
\
|
||||
/* __*init sections */ \
|
||||
@@ -905,6 +915,8 @@
|
||||
EXIT_TEXT \
|
||||
EXIT_DATA \
|
||||
EXIT_CALL \
|
||||
+ SYMTAB_DISCARD \
|
||||
+ SYMTAB_DISCARD_GPL \
|
||||
*(.discard) \
|
||||
*(.discard.*) \
|
||||
*(.modinfo) \
|
||||
--- a/include/linux/export.h
|
||||
+++ b/include/linux/export.h
|
||||
@@ -98,18 +98,26 @@ struct kernel_symbol {
|
||||
|
||||
#else
|
||||
|
||||
+#ifdef MODULE
|
||||
+#define __EXPORT_SUFFIX(sym)
|
||||
+#else
|
||||
+#define __EXPORT_SUFFIX(sym) "+" #sym
|
||||
+#endif
|
||||
+
|
||||
#define ___export_symbol_common(sym, sec) \
|
||||
extern typeof(sym) sym; \
|
||||
__CRC_SYMBOL(sym, sec); \
|
||||
static const char __kstrtab_##sym[] \
|
||||
- __attribute__((section("__ksymtab_strings"), used, aligned(1))) \
|
||||
+ __attribute__((section("__ksymtab_strings" \
|
||||
+ __EXPORT_SUFFIX(sym)), used, aligned(1))) \
|
||||
= #sym \
|
||||
|
||||
/* For every exported symbol, place a struct in the __ksymtab section */
|
||||
#define ___EXPORT_SYMBOL_NS(sym, sec, ns) \
|
||||
___export_symbol_common(sym, sec); \
|
||||
static const char __kstrtabns_##sym[] \
|
||||
- __attribute__((section("__ksymtab_strings"), used, aligned(1))) \
|
||||
+ __attribute__((section("__ksymtab_strings" \
|
||||
+ __EXPORT_SUFFIX(sym)), used, aligned(1))) \
|
||||
= #ns; \
|
||||
__KSYMTAB_ENTRY_NS(sym, sec)
|
||||
|
||||
--- a/scripts/Makefile.build
|
||||
+++ b/scripts/Makefile.build
|
||||
@@ -350,7 +350,7 @@ targets += $(extra-y) $(MAKECMDGOALS) $(
|
||||
# Linker scripts preprocessor (.lds.S -> .lds)
|
||||
# ---------------------------------------------------------------------------
|
||||
quiet_cmd_cpp_lds_S = LDS $@
|
||||
- cmd_cpp_lds_S = $(CPP) $(cpp_flags) -P -U$(ARCH) \
|
||||
+ cmd_cpp_lds_S = $(CPP) $(EXTRA_LDSFLAGS) $(cpp_flags) -P -U$(ARCH) \
|
||||
-D__ASSEMBLY__ -DLINKER_SCRIPT -o $@ $<
|
||||
|
||||
$(obj)/%.lds: $(src)/%.lds.S FORCE
|
|
@ -1,71 +0,0 @@
|
|||
From b3d00b452467f621317953d9e4c6f9ae8dcfd271 Mon Sep 17 00:00:00 2001
|
||||
From: Imre Kaloz <kaloz@openwrt.org>
|
||||
Date: Fri, 7 Jul 2017 17:06:55 +0200
|
||||
Subject: use the openwrt lzma options for now
|
||||
|
||||
lede-commit: 548de949f392049420a6a1feeef118b30ab8ea8c
|
||||
Signed-off-by: Imre Kaloz <kaloz@openwrt.org>
|
||||
---
|
||||
lib/decompress.c | 1 +
|
||||
scripts/Makefile.lib | 2 +-
|
||||
usr/gen_initramfs_list.sh | 10 +++++-----
|
||||
3 files changed, 7 insertions(+), 6 deletions(-)
|
||||
|
||||
--- a/lib/decompress.c
|
||||
+++ b/lib/decompress.c
|
||||
@@ -49,6 +49,7 @@ static const struct compress_format comp
|
||||
{ {0x1f, 0x9e}, "gzip", gunzip },
|
||||
{ {0x42, 0x5a}, "bzip2", bunzip2 },
|
||||
{ {0x5d, 0x00}, "lzma", unlzma },
|
||||
+ { {0x6d, 0x00}, "lzma-openwrt", unlzma },
|
||||
{ {0xfd, 0x37}, "xz", unxz },
|
||||
{ {0x89, 0x4c}, "lzo", unlzo },
|
||||
{ {0x02, 0x21}, "lz4", unlz4 },
|
||||
--- a/scripts/Makefile.lib
|
||||
+++ b/scripts/Makefile.lib
|
||||
@@ -328,7 +328,7 @@ quiet_cmd_bzip2 = BZIP2 $@
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
quiet_cmd_lzma = LZMA $@
|
||||
- cmd_lzma = { cat $(real-prereqs) | $(LZMA) -9; $(size_append); } > $@
|
||||
+ cmd_lzma = { cat $(real-prereqs) | $(LZMA) e -d20 -lc1 -lp2 -pb2 -eos -si -so; $(size_append); } > $@
|
||||
|
||||
quiet_cmd_lzo = LZO $@
|
||||
cmd_lzo = { cat $(real-prereqs) | $(KLZOP) -9; $(size_append); } > $@
|
||||
--- a/usr/gen_initramfs_list.sh
|
||||
+++ b/usr/gen_initramfs_list.sh
|
||||
@@ -229,7 +229,7 @@ cpio_list=
|
||||
output="/dev/stdout"
|
||||
output_file=""
|
||||
is_cpio_compressed=
|
||||
-compr="gzip -n -9 -f"
|
||||
+compr="gzip -n -9 -f -"
|
||||
|
||||
arg="$1"
|
||||
case "$arg" in
|
||||
@@ -245,13 +245,13 @@ case "$arg" in
|
||||
output=${cpio_list}
|
||||
echo "$output_file" | grep -q "\.gz$" \
|
||||
&& [ -x "`which gzip 2> /dev/null`" ] \
|
||||
- && compr="gzip -n -9 -f"
|
||||
+ && compr="gzip -n -9 -f -"
|
||||
echo "$output_file" | grep -q "\.bz2$" \
|
||||
&& [ -x "`which bzip2 2> /dev/null`" ] \
|
||||
- && compr="bzip2 -9 -f"
|
||||
+ && compr="bzip2 -9 -f -"
|
||||
echo "$output_file" | grep -q "\.lzma$" \
|
||||
&& [ -x "`which lzma 2> /dev/null`" ] \
|
||||
- && compr="lzma -9 -f"
|
||||
+ && compr="lzma e -d20 -lc1 -lp2 -pb2 -eos -si -so"
|
||||
echo "$output_file" | grep -q "\.xz$" \
|
||||
&& [ -x "`which xz 2> /dev/null`" ] \
|
||||
&& compr="xz --check=crc32 --lzma2=dict=1MiB"
|
||||
@@ -320,7 +320,7 @@ if [ ! -z ${output_file} ]; then
|
||||
if [ "${is_cpio_compressed}" = "compressed" ]; then
|
||||
cat ${cpio_tfile} > ${output_file}
|
||||
else
|
||||
- (cat ${cpio_tfile} | ${compr} - > ${output_file}) \
|
||||
+ (cat ${cpio_tfile} | ${compr} > ${output_file}) \
|
||||
|| (rm -f ${output_file} ; false)
|
||||
fi
|
||||
[ -z ${cpio_file} ] && rm ${cpio_tfile}
|
|
@ -1,11 +0,0 @@
|
|||
--- a/net/ipv4/Kconfig
|
||||
+++ b/net/ipv4/Kconfig
|
||||
@@ -315,7 +315,7 @@ config NET_IPVTI
|
||||
on top.
|
||||
|
||||
config NET_UDP_TUNNEL
|
||||
- tristate
|
||||
+ tristate "IP: UDP tunneling support"
|
||||
select NET_IP_TUNNEL
|
||||
default n
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
From: Felix Fietkau <nbd@nbd.name>
|
||||
Subject: hack: net: remove bogus netfilter dependencies
|
||||
|
||||
lede-commit: 589d2a377dee27d206fc3725325309cf649e4df6
|
||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
---
|
||||
net/netfilter/Kconfig | 2 --
|
||||
1 file changed, 2 deletions(-)
|
||||
|
||||
--- a/net/netfilter/Kconfig
|
||||
+++ b/net/netfilter/Kconfig
|
||||
@@ -228,7 +228,6 @@ config NF_CONNTRACK_FTP
|
||||
|
||||
config NF_CONNTRACK_H323
|
||||
tristate "H.323 protocol support"
|
||||
- depends on IPV6 || IPV6=n
|
||||
depends on NETFILTER_ADVANCED
|
||||
help
|
||||
H.323 is a VoIP signalling protocol from ITU-T. As one of the most
|
||||
@@ -1088,7 +1087,6 @@ config NETFILTER_XT_TARGET_SECMARK
|
||||
|
||||
config NETFILTER_XT_TARGET_TCPMSS
|
||||
tristate '"TCPMSS" target support'
|
||||
- depends on IPV6 || IPV6=n
|
||||
default m if NETFILTER_ADVANCED=n
|
||||
---help---
|
||||
This option adds a `TCPMSS' target, which allows you to alter the
|
|
@ -1,199 +0,0 @@
|
|||
From da3c50704f14132f4adf80d48e9a4cd5d46e54c9 Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <john@phrozen.org>
|
||||
Date: Fri, 7 Jul 2017 17:09:21 +0200
|
||||
Subject: kconfig: owrt specifc dependencies
|
||||
|
||||
Signed-off-by: John Crispin <john@phrozen.org>
|
||||
---
|
||||
crypto/Kconfig | 10 +++++-----
|
||||
drivers/bcma/Kconfig | 1 +
|
||||
drivers/ssb/Kconfig | 3 ++-
|
||||
lib/Kconfig | 8 ++++----
|
||||
net/netfilter/Kconfig | 2 +-
|
||||
net/wireless/Kconfig | 17 ++++++++++-------
|
||||
sound/core/Kconfig | 4 ++--
|
||||
7 files changed, 25 insertions(+), 20 deletions(-)
|
||||
|
||||
--- a/crypto/Kconfig
|
||||
+++ b/crypto/Kconfig
|
||||
@@ -33,7 +33,7 @@ config CRYPTO_FIPS
|
||||
this is.
|
||||
|
||||
config CRYPTO_ALGAPI
|
||||
- tristate
|
||||
+ tristate "ALGAPI"
|
||||
select CRYPTO_ALGAPI2
|
||||
help
|
||||
This option provides the API for cryptographic algorithms.
|
||||
@@ -42,7 +42,7 @@ config CRYPTO_ALGAPI2
|
||||
tristate
|
||||
|
||||
config CRYPTO_AEAD
|
||||
- tristate
|
||||
+ tristate "AEAD"
|
||||
select CRYPTO_AEAD2
|
||||
select CRYPTO_ALGAPI
|
||||
|
||||
@@ -53,7 +53,7 @@ config CRYPTO_AEAD2
|
||||
select CRYPTO_RNG2
|
||||
|
||||
config CRYPTO_BLKCIPHER
|
||||
- tristate
|
||||
+ tristate "BLKCIPHER"
|
||||
select CRYPTO_BLKCIPHER2
|
||||
select CRYPTO_ALGAPI
|
||||
|
||||
@@ -63,7 +63,7 @@ config CRYPTO_BLKCIPHER2
|
||||
select CRYPTO_RNG2
|
||||
|
||||
config CRYPTO_HASH
|
||||
- tristate
|
||||
+ tristate "HASH"
|
||||
select CRYPTO_HASH2
|
||||
select CRYPTO_ALGAPI
|
||||
|
||||
@@ -72,7 +72,7 @@ config CRYPTO_HASH2
|
||||
select CRYPTO_ALGAPI2
|
||||
|
||||
config CRYPTO_RNG
|
||||
- tristate
|
||||
+ tristate "RNG"
|
||||
select CRYPTO_RNG2
|
||||
select CRYPTO_ALGAPI
|
||||
|
||||
--- a/drivers/bcma/Kconfig
|
||||
+++ b/drivers/bcma/Kconfig
|
||||
@@ -16,6 +16,7 @@ if BCMA
|
||||
# Support for Block-I/O. SELECT this from the driver that needs it.
|
||||
config BCMA_BLOCKIO
|
||||
bool
|
||||
+ default y
|
||||
|
||||
config BCMA_HOST_PCI_POSSIBLE
|
||||
bool
|
||||
--- a/drivers/ssb/Kconfig
|
||||
+++ b/drivers/ssb/Kconfig
|
||||
@@ -29,6 +29,7 @@ config SSB_SPROM
|
||||
config SSB_BLOCKIO
|
||||
bool
|
||||
depends on SSB
|
||||
+ default y
|
||||
|
||||
config SSB_PCIHOST_POSSIBLE
|
||||
bool
|
||||
@@ -49,7 +50,7 @@ config SSB_PCIHOST
|
||||
config SSB_B43_PCI_BRIDGE
|
||||
bool
|
||||
depends on SSB_PCIHOST
|
||||
- default n
|
||||
+ default y
|
||||
|
||||
config SSB_PCMCIAHOST_POSSIBLE
|
||||
bool
|
||||
--- a/lib/Kconfig
|
||||
+++ b/lib/Kconfig
|
||||
@@ -402,16 +402,16 @@ config BCH_CONST_T
|
||||
# Textsearch support is select'ed if needed
|
||||
#
|
||||
config TEXTSEARCH
|
||||
- bool
|
||||
+ bool "Textsearch support"
|
||||
|
||||
config TEXTSEARCH_KMP
|
||||
- tristate
|
||||
+ tristate "Textsearch KMP"
|
||||
|
||||
config TEXTSEARCH_BM
|
||||
- tristate
|
||||
+ tristate "Textsearch BM"
|
||||
|
||||
config TEXTSEARCH_FSM
|
||||
- tristate
|
||||
+ tristate "Textsearch FSM"
|
||||
|
||||
config BTREE
|
||||
bool
|
||||
--- a/net/netfilter/Kconfig
|
||||
+++ b/net/netfilter/Kconfig
|
||||
@@ -11,7 +11,7 @@ config NETFILTER_INGRESS
|
||||
infrastructure.
|
||||
|
||||
config NETFILTER_NETLINK
|
||||
- tristate
|
||||
+ tristate "Netfilter NFNETLINK interface"
|
||||
|
||||
config NETFILTER_FAMILY_BRIDGE
|
||||
bool
|
||||
--- a/net/wireless/Kconfig
|
||||
+++ b/net/wireless/Kconfig
|
||||
@@ -1,6 +1,6 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
config WIRELESS_EXT
|
||||
- bool
|
||||
+ bool "Wireless extensions"
|
||||
|
||||
config WEXT_CORE
|
||||
def_bool y
|
||||
@@ -12,10 +12,10 @@ config WEXT_PROC
|
||||
depends on WEXT_CORE
|
||||
|
||||
config WEXT_SPY
|
||||
- bool
|
||||
+ bool "WEXT_SPY"
|
||||
|
||||
config WEXT_PRIV
|
||||
- bool
|
||||
+ bool "WEXT_PRIV"
|
||||
|
||||
config CFG80211
|
||||
tristate "cfg80211 - wireless configuration API"
|
||||
@@ -203,7 +203,7 @@ config CFG80211_WEXT_EXPORT
|
||||
endif # CFG80211
|
||||
|
||||
config LIB80211
|
||||
- tristate
|
||||
+ tristate "LIB80211"
|
||||
default n
|
||||
help
|
||||
This options enables a library of common routines used
|
||||
@@ -212,17 +212,17 @@ config LIB80211
|
||||
Drivers should select this themselves if needed.
|
||||
|
||||
config LIB80211_CRYPT_WEP
|
||||
- tristate
|
||||
+ tristate "LIB80211_CRYPT_WEP"
|
||||
select CRYPTO_LIB_ARC4
|
||||
|
||||
config LIB80211_CRYPT_CCMP
|
||||
- tristate
|
||||
+ tristate "LIB80211_CRYPT_CCMP"
|
||||
select CRYPTO
|
||||
select CRYPTO_AES
|
||||
select CRYPTO_CCM
|
||||
|
||||
config LIB80211_CRYPT_TKIP
|
||||
- tristate
|
||||
+ tristate "LIB80211_CRYPT_TKIP"
|
||||
select CRYPTO_LIB_ARC4
|
||||
|
||||
config LIB80211_DEBUG
|
||||
--- a/sound/core/Kconfig
|
||||
+++ b/sound/core/Kconfig
|
||||
@@ -17,7 +17,7 @@ config SND_DMAENGINE_PCM
|
||||
tristate
|
||||
|
||||
config SND_HWDEP
|
||||
- tristate
|
||||
+ tristate "Sound hardware support"
|
||||
|
||||
config SND_SEQ_DEVICE
|
||||
tristate
|
||||
@@ -27,7 +27,7 @@ config SND_RAWMIDI
|
||||
select SND_SEQ_DEVICE if SND_SEQUENCER != n
|
||||
|
||||
config SND_COMPRESS_OFFLOAD
|
||||
- tristate
|
||||
+ tristate "Compression offloading support"
|
||||
|
||||
config SND_JACK
|
||||
bool
|
|
@ -1,125 +0,0 @@
|
|||
From 811d9e2268a62b830cfe93cd8bc929afcb8b198b Mon Sep 17 00:00:00 2001
|
||||
From: Felix Fietkau <nbd@nbd.name>
|
||||
Date: Sat, 15 Jul 2017 21:12:38 +0200
|
||||
Subject: kernel: move regmap bloat out of the kernel image if it is only being used in modules
|
||||
|
||||
lede-commit: 96f39119815028073583e4fca3a9c5fe9141e998
|
||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
---
|
||||
drivers/base/regmap/Kconfig | 15 ++++++++++-----
|
||||
drivers/base/regmap/Makefile | 12 ++++++++----
|
||||
drivers/base/regmap/regmap.c | 3 +++
|
||||
include/linux/regmap.h | 2 +-
|
||||
4 files changed, 22 insertions(+), 10 deletions(-)
|
||||
|
||||
--- a/drivers/base/regmap/Kconfig
|
||||
+++ b/drivers/base/regmap/Kconfig
|
||||
@@ -4,9 +4,8 @@
|
||||
# subsystems should select the appropriate symbols.
|
||||
|
||||
config REGMAP
|
||||
- default y if (REGMAP_I2C || REGMAP_SPI || REGMAP_SPMI || REGMAP_W1 || REGMAP_AC97 || REGMAP_MMIO || REGMAP_IRQ || REGMAP_SCCB || REGMAP_I3C)
|
||||
select IRQ_DOMAIN if REGMAP_IRQ
|
||||
- bool
|
||||
+ tristate
|
||||
|
||||
config REGCACHE_COMPRESSED
|
||||
select LZO_COMPRESS
|
||||
@@ -18,38 +17,49 @@ config REGMAP_AC97
|
||||
|
||||
config REGMAP_I2C
|
||||
tristate
|
||||
+ select REGMAP
|
||||
depends on I2C
|
||||
|
||||
config REGMAP_SLIMBUS
|
||||
tristate
|
||||
+ select REGMAP
|
||||
depends on SLIMBUS
|
||||
|
||||
config REGMAP_SPI
|
||||
tristate
|
||||
+ select REGMAP
|
||||
+ depends on SPI_MASTER
|
||||
depends on SPI
|
||||
|
||||
config REGMAP_SPMI
|
||||
tristate
|
||||
+ select REGMAP
|
||||
depends on SPMI
|
||||
|
||||
config REGMAP_W1
|
||||
tristate
|
||||
+ select REGMAP
|
||||
depends on W1
|
||||
|
||||
config REGMAP_MMIO
|
||||
tristate
|
||||
+ select REGMAP
|
||||
|
||||
config REGMAP_IRQ
|
||||
bool
|
||||
+ select REGMAP
|
||||
|
||||
config REGMAP_SOUNDWIRE
|
||||
tristate
|
||||
+ select REGMAP
|
||||
depends on SOUNDWIRE
|
||||
|
||||
config REGMAP_SCCB
|
||||
tristate
|
||||
+ select REGMAP
|
||||
depends on I2C
|
||||
|
||||
config REGMAP_I3C
|
||||
tristate
|
||||
+ select REGMAP
|
||||
depends on I3C
|
||||
--- a/drivers/base/regmap/Makefile
|
||||
+++ b/drivers/base/regmap/Makefile
|
||||
@@ -2,10 +2,14 @@
|
||||
# For include/trace/define_trace.h to include trace.h
|
||||
CFLAGS_regmap.o := -I$(src)
|
||||
|
||||
-obj-$(CONFIG_REGMAP) += regmap.o regcache.o
|
||||
-obj-$(CONFIG_REGMAP) += regcache-rbtree.o regcache-flat.o
|
||||
-obj-$(CONFIG_REGCACHE_COMPRESSED) += regcache-lzo.o
|
||||
-obj-$(CONFIG_DEBUG_FS) += regmap-debugfs.o
|
||||
+regmap-core-objs = regmap.o regcache.o regcache-rbtree.o regcache-flat.o
|
||||
+ifdef CONFIG_DEBUG_FS
|
||||
+regmap-core-objs += regmap-debugfs.o
|
||||
+endif
|
||||
+ifdef CONFIG_REGCACHE_COMPRESSED
|
||||
+regmap-core-objs += regcache-lzo.o
|
||||
+endif
|
||||
+obj-$(CONFIG_REGMAP) += regmap-core.o
|
||||
obj-$(CONFIG_REGMAP_AC97) += regmap-ac97.o
|
||||
obj-$(CONFIG_REGMAP_I2C) += regmap-i2c.o
|
||||
obj-$(CONFIG_REGMAP_SLIMBUS) += regmap-slimbus.o
|
||||
--- a/drivers/base/regmap/regmap.c
|
||||
+++ b/drivers/base/regmap/regmap.c
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <linux/device.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/export.h>
|
||||
+#include <linux/module.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/of.h>
|
||||
@@ -3118,3 +3119,5 @@ static int __init regmap_initcall(void)
|
||||
return 0;
|
||||
}
|
||||
postcore_initcall(regmap_initcall);
|
||||
+
|
||||
+MODULE_LICENSE("GPL");
|
||||
--- a/include/linux/regmap.h
|
||||
+++ b/include/linux/regmap.h
|
||||
@@ -185,7 +185,7 @@ struct reg_sequence {
|
||||
pollret ?: ((cond) ? 0 : -ETIMEDOUT); \
|
||||
})
|
||||
|
||||
-#ifdef CONFIG_REGMAP
|
||||
+#if IS_REACHABLE(CONFIG_REGMAP)
|
||||
|
||||
enum regmap_endian {
|
||||
/* Unspecified -> 0 -> Backwards compatible default */
|
|
@ -1,52 +0,0 @@
|
|||
From fd1799b0bf5efa46dd3e6dfbbf3955564807e508 Mon Sep 17 00:00:00 2001
|
||||
From: Felix Fietkau <nbd@nbd.name>
|
||||
Date: Fri, 7 Jul 2017 17:12:51 +0200
|
||||
Subject: kernel: prevent cryptomgr from pulling in useless extra dependencies for tests that are not run
|
||||
|
||||
Reduces kernel size after LZMA by about 5k on MIPS
|
||||
|
||||
lede-commit: 044c316167e076479a344c59905e5b435b84a77f
|
||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
---
|
||||
crypto/Kconfig | 13 ++++++-------
|
||||
crypto/algboss.c | 4 ++++
|
||||
2 files changed, 10 insertions(+), 7 deletions(-)
|
||||
|
||||
--- a/crypto/Kconfig
|
||||
+++ b/crypto/Kconfig
|
||||
@@ -120,13 +120,13 @@ config CRYPTO_MANAGER
|
||||
cbc(aes).
|
||||
|
||||
config CRYPTO_MANAGER2
|
||||
- def_tristate CRYPTO_MANAGER || (CRYPTO_MANAGER!=n && CRYPTO_ALGAPI=y)
|
||||
- select CRYPTO_AEAD2
|
||||
- select CRYPTO_HASH2
|
||||
- select CRYPTO_BLKCIPHER2
|
||||
- select CRYPTO_AKCIPHER2
|
||||
- select CRYPTO_KPP2
|
||||
- select CRYPTO_ACOMP2
|
||||
+ def_tristate CRYPTO_MANAGER || (CRYPTO_MANAGER!=n && CRYPTO_ALGAPI=y && !CRYPTO_MANAGER_DISABLE_TESTS)
|
||||
+ select CRYPTO_AEAD2 if !CRYPTO_MANAGER_DISABLE_TESTS
|
||||
+ select CRYPTO_HASH2 if !CRYPTO_MANAGER_DISABLE_TESTS
|
||||
+ select CRYPTO_BLKCIPHER2 if !CRYPTO_MANAGER_DISABLE_TESTS
|
||||
+ select CRYPTO_AKCIPHER2 if !CRYPTO_MANAGER_DISABLE_TESTS
|
||||
+ select CRYPTO_KPP2 if !CRYPTO_MANAGER_DISABLE_TESTS
|
||||
+ select CRYPTO_ACOMP2 if !CRYPTO_MANAGER_DISABLE_TESTS
|
||||
|
||||
config CRYPTO_USER
|
||||
tristate "Userspace cryptographic algorithm configuration"
|
||||
--- a/crypto/algboss.c
|
||||
+++ b/crypto/algboss.c
|
||||
@@ -240,8 +240,12 @@ static int cryptomgr_schedule_test(struc
|
||||
type = alg->cra_flags;
|
||||
|
||||
/* Do not test internal algorithms. */
|
||||
+#ifdef CONFIG_CRYPTO_MANAGER_DISABLE_TESTS
|
||||
+ type |= CRYPTO_ALG_TESTED;
|
||||
+#else
|
||||
if (type & CRYPTO_ALG_INTERNAL)
|
||||
type |= CRYPTO_ALG_TESTED;
|
||||
+#endif
|
||||
|
||||
param->type = type;
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
This makes it possible to select CONFIG_CRYPTO_LIB_ARC4 directly. We
|
||||
need this to be able to compile this into the kernel and make use of it
|
||||
from backports.
|
||||
|
||||
--- a/lib/crypto/Kconfig
|
||||
+++ b/lib/crypto/Kconfig
|
||||
@@ -6,7 +6,7 @@ config CRYPTO_LIB_AES
|
||||
tristate
|
||||
|
||||
config CRYPTO_LIB_ARC4
|
||||
- tristate
|
||||
+ tristate "ARC4 cipher library"
|
||||
|
||||
config CRYPTO_ARCH_HAVE_LIB_BLAKE2S
|
||||
tristate
|
|
@ -1,84 +0,0 @@
|
|||
From 236c1acdfef5958010ac9814a9872e0a46fd78ee Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <john@phrozen.org>
|
||||
Date: Fri, 7 Jul 2017 17:13:44 +0200
|
||||
Subject: rfkill: add fake rfkill support
|
||||
|
||||
allow building of modules depending on RFKILL even if RFKILL is not enabled.
|
||||
|
||||
Signed-off-by: John Crispin <john@phrozen.org>
|
||||
---
|
||||
include/linux/rfkill.h | 2 +-
|
||||
net/Makefile | 2 +-
|
||||
net/rfkill/Kconfig | 14 +++++++++-----
|
||||
net/rfkill/Makefile | 2 +-
|
||||
4 files changed, 12 insertions(+), 8 deletions(-)
|
||||
|
||||
--- a/include/linux/rfkill.h
|
||||
+++ b/include/linux/rfkill.h
|
||||
@@ -64,7 +64,7 @@ struct rfkill_ops {
|
||||
int (*set_block)(void *data, bool blocked);
|
||||
};
|
||||
|
||||
-#if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE)
|
||||
+#if defined(CONFIG_RFKILL_FULL) || defined(CONFIG_RFKILL_FULL_MODULE)
|
||||
/**
|
||||
* rfkill_alloc - Allocate rfkill structure
|
||||
* @name: name of the struct -- the string is not copied internally
|
||||
--- a/net/Makefile
|
||||
+++ b/net/Makefile
|
||||
@@ -53,7 +53,7 @@ obj-$(CONFIG_TIPC) += tipc/
|
||||
obj-$(CONFIG_NETLABEL) += netlabel/
|
||||
obj-$(CONFIG_IUCV) += iucv/
|
||||
obj-$(CONFIG_SMC) += smc/
|
||||
-obj-$(CONFIG_RFKILL) += rfkill/
|
||||
+obj-$(CONFIG_RFKILL_FULL) += rfkill/
|
||||
obj-$(CONFIG_NET_9P) += 9p/
|
||||
obj-$(CONFIG_CAIF) += caif/
|
||||
ifneq ($(CONFIG_DCB),)
|
||||
--- a/net/rfkill/Kconfig
|
||||
+++ b/net/rfkill/Kconfig
|
||||
@@ -2,7 +2,11 @@
|
||||
#
|
||||
# RF switch subsystem configuration
|
||||
#
|
||||
-menuconfig RFKILL
|
||||
+config RFKILL
|
||||
+ bool
|
||||
+ default y
|
||||
+
|
||||
+menuconfig RFKILL_FULL
|
||||
tristate "RF switch subsystem support"
|
||||
help
|
||||
Say Y here if you want to have control over RF switches
|
||||
@@ -14,19 +18,19 @@ menuconfig RFKILL
|
||||
# LED trigger support
|
||||
config RFKILL_LEDS
|
||||
bool
|
||||
- depends on RFKILL
|
||||
+ depends on RFKILL_FULL
|
||||
depends on LEDS_TRIGGERS = y || RFKILL = LEDS_TRIGGERS
|
||||
default y
|
||||
|
||||
config RFKILL_INPUT
|
||||
bool "RF switch input support" if EXPERT
|
||||
- depends on RFKILL
|
||||
+ depends on RFKILL_FULL
|
||||
depends on INPUT = y || RFKILL = INPUT
|
||||
default y if !EXPERT
|
||||
|
||||
config RFKILL_GPIO
|
||||
tristate "GPIO RFKILL driver"
|
||||
- depends on RFKILL
|
||||
+ depends on RFKILL_FULL
|
||||
depends on GPIOLIB || COMPILE_TEST
|
||||
default n
|
||||
help
|
||||
--- a/net/rfkill/Makefile
|
||||
+++ b/net/rfkill/Makefile
|
||||
@@ -5,5 +5,5 @@
|
||||
|
||||
rfkill-y += core.o
|
||||
rfkill-$(CONFIG_RFKILL_INPUT) += input.o
|
||||
-obj-$(CONFIG_RFKILL) += rfkill.o
|
||||
+obj-$(CONFIG_RFKILL_FULL) += rfkill.o
|
||||
obj-$(CONFIG_RFKILL_GPIO) += rfkill-gpio.o
|
|
@ -1,64 +0,0 @@
|
|||
From: Ben Menchaca <ben.menchaca@qca.qualcomm.com>
|
||||
Date: Fri, 7 Jun 2013 18:35:22 -0500
|
||||
Subject: MIPS: r4k_cache: use more efficient cache blast
|
||||
|
||||
Optimize the compiler output for larger cache blast cases that are
|
||||
common for DMA-based networking.
|
||||
|
||||
Signed-off-by: Ben Menchaca <ben.menchaca@qca.qualcomm.com>
|
||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
---
|
||||
--- a/arch/mips/include/asm/r4kcache.h
|
||||
+++ b/arch/mips/include/asm/r4kcache.h
|
||||
@@ -617,14 +617,46 @@ static inline void prot##extra##blast_##
|
||||
unsigned long end) \
|
||||
{ \
|
||||
unsigned long lsize = cpu_##desc##_line_size(); \
|
||||
+ unsigned long lsize_2 = lsize * 2; \
|
||||
+ unsigned long lsize_3 = lsize * 3; \
|
||||
+ unsigned long lsize_4 = lsize * 4; \
|
||||
+ unsigned long lsize_5 = lsize * 5; \
|
||||
+ unsigned long lsize_6 = lsize * 6; \
|
||||
+ unsigned long lsize_7 = lsize * 7; \
|
||||
+ unsigned long lsize_8 = lsize * 8; \
|
||||
unsigned long addr = start & ~(lsize - 1); \
|
||||
- unsigned long aend = (end - 1) & ~(lsize - 1); \
|
||||
+ unsigned long aend = (end + lsize - 1) & ~(lsize - 1); \
|
||||
+ int lines = (aend - addr) / lsize; \
|
||||
\
|
||||
- while (1) { \
|
||||
+ while (lines >= 8) { \
|
||||
+ prot##cache_op(hitop, addr); \
|
||||
+ prot##cache_op(hitop, addr + lsize); \
|
||||
+ prot##cache_op(hitop, addr + lsize_2); \
|
||||
+ prot##cache_op(hitop, addr + lsize_3); \
|
||||
+ prot##cache_op(hitop, addr + lsize_4); \
|
||||
+ prot##cache_op(hitop, addr + lsize_5); \
|
||||
+ prot##cache_op(hitop, addr + lsize_6); \
|
||||
+ prot##cache_op(hitop, addr + lsize_7); \
|
||||
+ addr += lsize_8; \
|
||||
+ lines -= 8; \
|
||||
+ } \
|
||||
+ \
|
||||
+ if (lines & 0x4) { \
|
||||
+ prot##cache_op(hitop, addr); \
|
||||
+ prot##cache_op(hitop, addr + lsize); \
|
||||
+ prot##cache_op(hitop, addr + lsize_2); \
|
||||
+ prot##cache_op(hitop, addr + lsize_3); \
|
||||
+ addr += lsize_4; \
|
||||
+ } \
|
||||
+ \
|
||||
+ if (lines & 0x2) { \
|
||||
+ prot##cache_op(hitop, addr); \
|
||||
+ prot##cache_op(hitop, addr + lsize); \
|
||||
+ addr += lsize_2; \
|
||||
+ } \
|
||||
+ \
|
||||
+ if (lines & 0x1) { \
|
||||
prot##cache_op(hitop, addr); \
|
||||
- if (addr == aend) \
|
||||
- break; \
|
||||
- addr += lsize; \
|
||||
} \
|
||||
}
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
From: John Crispin <john@phrozen.org>
|
||||
Subject: hack: kernel: add generic image_cmdline hack to MIPS targets
|
||||
|
||||
lede-commit: d59f5b3a987a48508257a0ddbaeadc7909f9f976
|
||||
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
|
||||
---
|
||||
arch/mips/Kconfig | 4 ++++
|
||||
arch/mips/kernel/head.S | 6 ++++++
|
||||
2 files changed, 10 insertions(+)
|
||||
|
||||
--- a/arch/mips/Kconfig
|
||||
+++ b/arch/mips/Kconfig
|
||||
@@ -1164,6 +1164,10 @@ config SYNC_R4K
|
||||
config MIPS_MACHINE
|
||||
def_bool n
|
||||
|
||||
+config IMAGE_CMDLINE_HACK
|
||||
+ bool "OpenWrt specific image command line hack"
|
||||
+ default n
|
||||
+
|
||||
config NO_IOPORT_MAP
|
||||
def_bool n
|
||||
|
||||
--- a/arch/mips/kernel/head.S
|
||||
+++ b/arch/mips/kernel/head.S
|
||||
@@ -79,6 +79,12 @@ FEXPORT(__kernel_entry)
|
||||
j kernel_entry
|
||||
#endif /* CONFIG_BOOT_RAW */
|
||||
|
||||
+#ifdef CONFIG_IMAGE_CMDLINE_HACK
|
||||
+ .ascii "CMDLINE:"
|
||||
+EXPORT(__image_cmdline)
|
||||
+ .fill 0x400
|
||||
+#endif /* CONFIG_IMAGE_CMDLINE_HACK */
|
||||
+
|
||||
__REF
|
||||
|
||||
NESTED(kernel_entry, 16, sp) # kernel entry point
|
|
@ -1,39 +0,0 @@
|
|||
From 107c0964cb8db7ca28ac5199426414fdab3c274d Mon Sep 17 00:00:00 2001
|
||||
From: "Alexandros C. Couloumbis" <alex@ozo.com>
|
||||
Date: Fri, 7 Jul 2017 17:14:51 +0200
|
||||
Subject: hack: arch: powerpc: drop register save/restore library from modules
|
||||
|
||||
Upstream GCC uses a libgcc function for saving/restoring registers. This
|
||||
makes the code bigger, and upstream kernels need to carry that function
|
||||
for every single kernel module. Our GCC is patched to avoid those
|
||||
references, so we can drop the extra bloat for modules.
|
||||
|
||||
lede-commit: e8e1084654f50904e6bf77b70b2de3f137d7b3ec
|
||||
Signed-off-by: Alexandros C. Couloumbis <alex@ozo.com>
|
||||
---
|
||||
arch/powerpc/Makefile | 1 -
|
||||
1 file changed, 1 deletion(-)
|
||||
|
||||
--- a/arch/powerpc/Makefile
|
||||
+++ b/arch/powerpc/Makefile
|
||||
@@ -61,20 +61,6 @@ machine-$(CONFIG_PPC64) += 64
|
||||
machine-$(CONFIG_CPU_LITTLE_ENDIAN) += le
|
||||
UTS_MACHINE := $(subst $(space),,$(machine-y))
|
||||
|
||||
-# XXX This needs to be before we override LD below
|
||||
-ifdef CONFIG_PPC32
|
||||
-KBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o
|
||||
-else
|
||||
-KBUILD_LDS_MODULE += $(srctree)/arch/powerpc/kernel/module.lds
|
||||
-ifeq ($(call ld-ifversion, -ge, 225000000, y),y)
|
||||
-# Have the linker provide sfpr if possible.
|
||||
-# There is a corresponding test in arch/powerpc/lib/Makefile
|
||||
-KBUILD_LDFLAGS_MODULE += --save-restore-funcs
|
||||
-else
|
||||
-KBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o
|
||||
-endif
|
||||
-endif
|
||||
-
|
||||
ifdef CONFIG_CPU_LITTLE_ENDIAN
|
||||
KBUILD_CFLAGS += -mlittle-endian
|
||||
KBUILD_LDFLAGS += -EL
|
|
@ -1,176 +0,0 @@
|
|||
--- a/block/partitions/Kconfig
|
||||
+++ b/block/partitions/Kconfig
|
||||
@@ -101,6 +101,13 @@ config ATARI_PARTITION
|
||||
Say Y here if you would like to use hard disks under Linux which
|
||||
were partitioned under the Atari OS.
|
||||
|
||||
+config FIT_PARTITION
|
||||
+ bool "Flattened-Image-Tree (FIT) partition support" if PARTITION_ADVANCED
|
||||
+ default n
|
||||
+ help
|
||||
+ Say Y here if your system needs to mount the filesystem part of
|
||||
+ a Flattened-Image-Tree (FIT) image commonly used with Das U-Boot.
|
||||
+
|
||||
config IBM_PARTITION
|
||||
bool "IBM disk label and partition support"
|
||||
depends on PARTITION_ADVANCED && S390
|
||||
--- a/block/partitions/Makefile
|
||||
+++ b/block/partitions/Makefile
|
||||
@@ -9,6 +9,7 @@ obj-$(CONFIG_ACORN_PARTITION) += acorn.o
|
||||
obj-$(CONFIG_AMIGA_PARTITION) += amiga.o
|
||||
obj-$(CONFIG_ATARI_PARTITION) += atari.o
|
||||
obj-$(CONFIG_AIX_PARTITION) += aix.o
|
||||
+obj-$(CONFIG_FIT_PARTITION) += fit.o
|
||||
obj-$(CONFIG_CMDLINE_PARTITION) += cmdline.o
|
||||
obj-$(CONFIG_MAC_PARTITION) += mac.o
|
||||
obj-$(CONFIG_LDM_PARTITION) += ldm.o
|
||||
--- a/drivers/mtd/ubi/block.c
|
||||
+++ b/drivers/mtd/ubi/block.c
|
||||
@@ -396,7 +396,7 @@ int ubiblock_create(struct ubi_volume_in
|
||||
dev->leb_size = vi->usable_leb_size;
|
||||
|
||||
/* Initialize the gendisk of this ubiblock device */
|
||||
- gd = alloc_disk(1);
|
||||
+ gd = alloc_disk(0);
|
||||
if (!gd) {
|
||||
pr_err("UBI: block: alloc_disk failed\n");
|
||||
ret = -ENODEV;
|
||||
@@ -413,6 +413,7 @@ int ubiblock_create(struct ubi_volume_in
|
||||
goto out_put_disk;
|
||||
}
|
||||
gd->private_data = dev;
|
||||
+ gd->flags |= GENHD_FL_EXT_DEVT;
|
||||
sprintf(gd->disk_name, "ubiblock%d_%d", dev->ubi_num, dev->vol_id);
|
||||
set_capacity(gd, disk_capacity);
|
||||
dev->gd = gd;
|
||||
--- a/block/partition-generic.c
|
||||
+++ b/block/partition-generic.c
|
||||
@@ -18,6 +18,10 @@
|
||||
#include <linux/ctype.h>
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/blktrace_api.h>
|
||||
+#ifdef CONFIG_FIT_PARTITION
|
||||
+#include <linux/root_dev.h>
|
||||
+#endif
|
||||
+
|
||||
|
||||
#include "partitions/check.h"
|
||||
|
||||
@@ -180,6 +184,18 @@ ssize_t part_fail_store(struct device *d
|
||||
}
|
||||
#endif
|
||||
|
||||
+static ssize_t part_name_show(struct device *dev,
|
||||
+ struct device_attribute *attr, char *buf)
|
||||
+{
|
||||
+ struct hd_struct *p = dev_to_part(dev);
|
||||
+
|
||||
+ if (p->info && p->info->volname)
|
||||
+ return sprintf(buf, "%s\n", p->info->volname);
|
||||
+
|
||||
+ buf[0] = '\0';
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static DEVICE_ATTR(partition, 0444, part_partition_show, NULL);
|
||||
static DEVICE_ATTR(start, 0444, part_start_show, NULL);
|
||||
static DEVICE_ATTR(size, 0444, part_size_show, NULL);
|
||||
@@ -188,6 +204,7 @@ static DEVICE_ATTR(alignment_offset, 044
|
||||
static DEVICE_ATTR(discard_alignment, 0444, part_discard_alignment_show, NULL);
|
||||
static DEVICE_ATTR(stat, 0444, part_stat_show, NULL);
|
||||
static DEVICE_ATTR(inflight, 0444, part_inflight_show, NULL);
|
||||
+static DEVICE_ATTR(name, 0444, part_name_show, NULL);
|
||||
#ifdef CONFIG_FAIL_MAKE_REQUEST
|
||||
static struct device_attribute dev_attr_fail =
|
||||
__ATTR(make-it-fail, 0644, part_fail_show, part_fail_store);
|
||||
@@ -202,6 +219,7 @@ static struct attribute *part_attrs[] =
|
||||
&dev_attr_discard_alignment.attr,
|
||||
&dev_attr_stat.attr,
|
||||
&dev_attr_inflight.attr,
|
||||
+ &dev_attr_name.attr,
|
||||
#ifdef CONFIG_FAIL_MAKE_REQUEST
|
||||
&dev_attr_fail.attr,
|
||||
#endif
|
||||
@@ -634,6 +652,10 @@ rescan:
|
||||
if (state->parts[p].flags & ADDPART_FLAG_RAID)
|
||||
md_autodetect_dev(part_to_dev(part)->devt);
|
||||
#endif
|
||||
+#ifdef CONFIG_FIT_PARTITION
|
||||
+ if ((state->parts[p].flags & ADDPART_FLAG_ROOTDEV) && ROOT_DEV == 0)
|
||||
+ ROOT_DEV = part_to_dev(part)->devt;
|
||||
+#endif
|
||||
}
|
||||
free_partitions(state);
|
||||
return 0;
|
||||
--- a/block/partitions/check.c
|
||||
+++ b/block/partitions/check.c
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "ibm.h"
|
||||
#include "ultrix.h"
|
||||
#include "efi.h"
|
||||
+#include "fit.h"
|
||||
#include "karma.h"
|
||||
#include "sysv68.h"
|
||||
#include "cmdline.h"
|
||||
@@ -73,6 +74,9 @@ static int (*check_part[])(struct parsed
|
||||
#ifdef CONFIG_EFI_PARTITION
|
||||
efi_partition, /* this must come before msdos */
|
||||
#endif
|
||||
+#ifdef CONFIG_FIT_PARTITION
|
||||
+ fit_partition,
|
||||
+#endif
|
||||
#ifdef CONFIG_SGI_PARTITION
|
||||
sgi_partition,
|
||||
#endif
|
||||
--- a/include/linux/genhd.h
|
||||
+++ b/include/linux/genhd.h
|
||||
@@ -614,6 +614,7 @@ struct unixware_disklabel {
|
||||
#define ADDPART_FLAG_NONE 0
|
||||
#define ADDPART_FLAG_RAID 1
|
||||
#define ADDPART_FLAG_WHOLEDISK 2
|
||||
+#define ADDPART_FLAG_ROOTDEV 4
|
||||
|
||||
extern int blk_alloc_devt(struct hd_struct *part, dev_t *devt);
|
||||
extern void blk_free_devt(dev_t devt);
|
||||
--- /dev/null
|
||||
+++ b/block/partitions/fit.h
|
||||
@@ -0,0 +1,3 @@
|
||||
+/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
+int fit_partition(struct parsed_partitions *);
|
||||
+int parse_fit_partitions(struct parsed_partitions *state, u64 start_sector, u64 nr_sectors, int *slot, int add_remain);
|
||||
--- a/block/partitions/efi.c
|
||||
+++ b/block/partitions/efi.c
|
||||
@@ -681,6 +681,9 @@ int efi_partition(struct parsed_partitio
|
||||
gpt_entry *ptes = NULL;
|
||||
u32 i;
|
||||
unsigned ssz = bdev_logical_block_size(state->bdev) / 512;
|
||||
+#ifdef CONFIG_FIT_PARTITION
|
||||
+ u32 extra_slot = 64;
|
||||
+#endif
|
||||
|
||||
if (!find_valid_gpt(state, &gpt, &ptes) || !gpt || !ptes) {
|
||||
kfree(gpt);
|
||||
@@ -722,6 +725,11 @@ int efi_partition(struct parsed_partitio
|
||||
label_count++;
|
||||
}
|
||||
state->parts[i + 1].has_info = true;
|
||||
+#ifdef CONFIG_FIT_PARTITION
|
||||
+ /* If this is a U-Boot FIT volume it may have subpartitions */
|
||||
+ if (!efi_guidcmp(ptes[i].partition_type_guid, PARTITION_LINUX_FIT_GUID))
|
||||
+ (void) parse_fit_partitions(state, start * ssz, size * ssz, &extra_slot, 1);
|
||||
+#endif
|
||||
}
|
||||
kfree(ptes);
|
||||
kfree(gpt);
|
||||
--- a/block/partitions/efi.h
|
||||
+++ b/block/partitions/efi.h
|
||||
@@ -52,6 +52,9 @@
|
||||
#define PARTITION_LINUX_LVM_GUID \
|
||||
EFI_GUID( 0xe6d6d379, 0xf507, 0x44c2, \
|
||||
0xa2, 0x3c, 0x23, 0x8f, 0x2a, 0x3d, 0xf9, 0x28)
|
||||
+#define PARTITION_LINUX_FIT_GUID \
|
||||
+ EFI_GUID( 0xcae9be83, 0xb15f, 0x49cc, \
|
||||
+ 0x86, 0x3f, 0x08, 0x1b, 0x74, 0x4a, 0x2d, 0x93)
|
||||
|
||||
typedef struct _gpt_header {
|
||||
__le64 signature;
|
|
@ -1,69 +0,0 @@
|
|||
--- a/drivers/mtd/spi-nor/spi-nor.c
|
||||
+++ b/drivers/mtd/spi-nor/spi-nor.c
|
||||
@@ -196,7 +196,7 @@ struct flash_info {
|
||||
u16 page_size;
|
||||
u16 addr_width;
|
||||
|
||||
- u16 flags;
|
||||
+ u32 flags;
|
||||
#define SECT_4K BIT(0) /* SPINOR_OP_BE_4K works uniformly */
|
||||
#define SPI_NOR_NO_ERASE BIT(1) /* No erase command needed */
|
||||
#define SST_WRITE BIT(2) /* use SST byte programming */
|
||||
@@ -233,6 +233,10 @@ struct flash_info {
|
||||
#define SPI_NOR_SKIP_SFDP BIT(13) /* Skip parsing of SFDP tables */
|
||||
#define USE_CLSR BIT(14) /* use CLSR command */
|
||||
#define SPI_NOR_OCTAL_READ BIT(15) /* Flash supports Octal Read */
|
||||
+#define SPI_NOR_4BIT_BP BIT(17) /*
|
||||
+ * Flash SR has 4 bit fields (BP0-3)
|
||||
+ * for block protection.
|
||||
+ */
|
||||
|
||||
/* Part specific fixup hooks. */
|
||||
const struct spi_nor_fixups *fixups;
|
||||
@@ -1985,6 +1989,9 @@ static int spi_nor_clear_sr_bp(struct sp
|
||||
int ret;
|
||||
u8 mask = SR_BP2 | SR_BP1 | SR_BP0;
|
||||
|
||||
+ if (nor->flags & SNOR_F_HAS_4BIT_BP)
|
||||
+ mask |= SR_BP3;
|
||||
+
|
||||
ret = read_sr(nor);
|
||||
if (ret < 0) {
|
||||
dev_err(nor->dev, "error while reading status register\n");
|
||||
@@ -2338,7 +2345,7 @@ static const struct flash_info spi_nor_i
|
||||
{ "mx25l1606e", INFO(0xc22015, 0, 64 * 1024, 32, SECT_4K) },
|
||||
{ "mx25l3205d", INFO(0xc22016, 0, 64 * 1024, 64, SECT_4K) },
|
||||
{ "mx25l3255e", INFO(0xc29e16, 0, 64 * 1024, 64, SECT_4K) },
|
||||
- { "mx25l6405d", INFO(0xc22017, 0, 64 * 1024, 128, SECT_4K) },
|
||||
+ { "mx25l6405d", INFO(0xc22017, 0, 64 * 1024, 128, SECT_4K | SPI_NOR_4BIT_BP) },
|
||||
{ "mx25u2033e", INFO(0xc22532, 0, 64 * 1024, 4, SECT_4K) },
|
||||
{ "mx25u3235f", INFO(0xc22536, 0, 64 * 1024, 64,
|
||||
SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
|
||||
@@ -5026,6 +5033,9 @@ int spi_nor_scan(struct spi_nor *nor, co
|
||||
if (info->flags & USE_CLSR)
|
||||
nor->flags |= SNOR_F_USE_CLSR;
|
||||
|
||||
+ if (info->flags & SPI_NOR_4BIT_BP)
|
||||
+ nor->flags |= SNOR_F_HAS_4BIT_BP;
|
||||
+
|
||||
if (info->flags & SPI_NOR_NO_ERASE)
|
||||
mtd->flags |= MTD_NO_ERASE;
|
||||
|
||||
--- a/include/linux/mtd/spi-nor.h
|
||||
+++ b/include/linux/mtd/spi-nor.h
|
||||
@@ -127,6 +127,7 @@
|
||||
#define SR_BP0 BIT(2) /* Block protect 0 */
|
||||
#define SR_BP1 BIT(3) /* Block protect 1 */
|
||||
#define SR_BP2 BIT(4) /* Block protect 2 */
|
||||
+#define SR_BP3 BIT(5) /* Block protect 3 */
|
||||
#define SR_TB BIT(5) /* Top/Bottom protect */
|
||||
#define SR_SRWD BIT(7) /* SR write protect */
|
||||
/* Spansion/Cypress specific status bits */
|
||||
@@ -243,6 +244,7 @@ enum spi_nor_option_flags {
|
||||
SNOR_F_4B_OPCODES = BIT(6),
|
||||
SNOR_F_HAS_4BAIT = BIT(7),
|
||||
SNOR_F_HAS_LOCK = BIT(8),
|
||||
+ SNOR_F_HAS_4BIT_BP = BIT(12),
|
||||
};
|
||||
|
||||
/**
|
File diff suppressed because it is too large
Load diff
|
@ -1,41 +0,0 @@
|
|||
From 2e864386e62e702a343be2507062ee08d5dfc810 Mon Sep 17 00:00:00 2001
|
||||
From: Evan Green <evgreen@chromium.org>
|
||||
Date: Thu, 14 Nov 2019 15:50:07 -0800
|
||||
Subject: loop: Report EOPNOTSUPP properly
|
||||
|
||||
Properly plumb out EOPNOTSUPP from loop driver operations, which may
|
||||
get returned when for instance a discard operation is attempted but not
|
||||
supported by the underlying block device. Before this change, everything
|
||||
was reported in the log as an I/O error, which is scary and not
|
||||
helpful in debugging.
|
||||
|
||||
Signed-off-by: Evan Green <evgreen@chromium.org>
|
||||
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
|
||||
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
|
||||
---
|
||||
drivers/block/loop.c | 7 +++++--
|
||||
1 file changed, 5 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/drivers/block/loop.c
|
||||
+++ b/drivers/block/loop.c
|
||||
@@ -462,7 +462,7 @@ static void lo_complete_rq(struct reques
|
||||
if (!cmd->use_aio || cmd->ret < 0 || cmd->ret == blk_rq_bytes(rq) ||
|
||||
req_op(rq) != REQ_OP_READ) {
|
||||
if (cmd->ret < 0)
|
||||
- ret = BLK_STS_IOERR;
|
||||
+ ret = errno_to_blk_status(cmd->ret);
|
||||
goto end_io;
|
||||
}
|
||||
|
||||
@@ -1973,7 +1973,10 @@ static void loop_handle_cmd(struct loop_
|
||||
failed:
|
||||
/* complete non-aio request */
|
||||
if (!cmd->use_aio || ret) {
|
||||
- cmd->ret = ret ? -EIO : 0;
|
||||
+ if (ret == -EOPNOTSUPP)
|
||||
+ cmd->ret = ret;
|
||||
+ else
|
||||
+ cmd->ret = ret ? -EIO : 0;
|
||||
blk_mq_complete_request(rq);
|
||||
}
|
||||
}
|
|
@ -1,82 +0,0 @@
|
|||
From: Felix Fietkau <nbd@nbd.name>
|
||||
Date: Fri, 7 Jul 2017 17:18:54 +0200
|
||||
Subject: bridge: only accept EAP locally
|
||||
|
||||
When bridging, do not forward EAP frames to other ports, only deliver
|
||||
them locally, regardless of the state.
|
||||
|
||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
[add disable_eap_hack sysfs attribute]
|
||||
Signed-off-by: Etienne Champetier <champetier.etienne@gmail.com>
|
||||
---
|
||||
|
||||
--- a/net/bridge/br_input.c
|
||||
+++ b/net/bridge/br_input.c
|
||||
@@ -103,10 +103,14 @@ int br_handle_frame_finish(struct net *n
|
||||
}
|
||||
}
|
||||
|
||||
+ BR_INPUT_SKB_CB(skb)->brdev = br->dev;
|
||||
+
|
||||
+ if (skb->protocol == htons(ETH_P_PAE) && !br->disable_eap_hack)
|
||||
+ return br_pass_frame_up(skb);
|
||||
+
|
||||
if (p->state == BR_STATE_LEARNING)
|
||||
goto drop;
|
||||
|
||||
- BR_INPUT_SKB_CB(skb)->brdev = br->dev;
|
||||
BR_INPUT_SKB_CB(skb)->src_port_isolated = !!(p->flags & BR_ISOLATED);
|
||||
|
||||
if (IS_ENABLED(CONFIG_INET) &&
|
||||
--- a/net/bridge/br_private.h
|
||||
+++ b/net/bridge/br_private.h
|
||||
@@ -345,6 +345,8 @@ struct net_bridge {
|
||||
u16 group_fwd_mask;
|
||||
u16 group_fwd_mask_required;
|
||||
|
||||
+ bool disable_eap_hack;
|
||||
+
|
||||
/* STP */
|
||||
bridge_id designated_root;
|
||||
bridge_id bridge_id;
|
||||
--- a/net/bridge/br_sysfs_br.c
|
||||
+++ b/net/bridge/br_sysfs_br.c
|
||||
@@ -166,6 +166,30 @@ static ssize_t group_fwd_mask_store(stru
|
||||
}
|
||||
static DEVICE_ATTR_RW(group_fwd_mask);
|
||||
|
||||
+static ssize_t disable_eap_hack_show(struct device *d,
|
||||
+ struct device_attribute *attr,
|
||||
+ char *buf)
|
||||
+{
|
||||
+ struct net_bridge *br = to_bridge(d);
|
||||
+ return sprintf(buf, "%u\n", br->disable_eap_hack);
|
||||
+}
|
||||
+
|
||||
+static int set_disable_eap_hack(struct net_bridge *br, unsigned long val)
|
||||
+{
|
||||
+ br->disable_eap_hack = !!val;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static ssize_t disable_eap_hack_store(struct device *d,
|
||||
+ struct device_attribute *attr,
|
||||
+ const char *buf,
|
||||
+ size_t len)
|
||||
+{
|
||||
+ return store_bridge_parm(d, buf, len, set_disable_eap_hack);
|
||||
+}
|
||||
+static DEVICE_ATTR_RW(disable_eap_hack);
|
||||
+
|
||||
static ssize_t priority_show(struct device *d, struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
@@ -851,6 +875,7 @@ static struct attribute *bridge_attrs[]
|
||||
&dev_attr_ageing_time.attr,
|
||||
&dev_attr_stp_state.attr,
|
||||
&dev_attr_group_fwd_mask.attr,
|
||||
+ &dev_attr_disable_eap_hack.attr,
|
||||
&dev_attr_priority.attr,
|
||||
&dev_attr_bridge_id.attr,
|
||||
&dev_attr_root_id.attr,
|
|
@ -1,212 +0,0 @@
|
|||
From eda40b8c8c82e0f2789d6bc8bf63846dce2e8f32 Mon Sep 17 00:00:00 2001
|
||||
From: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
|
||||
Date: Sat, 23 Mar 2019 09:29:49 +0000
|
||||
Subject: [PATCH] netfilter: connmark: introduce set-dscpmark
|
||||
|
||||
set-dscpmark is a method of storing the DSCP of an ip packet into
|
||||
conntrack mark. In combination with a suitable tc filter action
|
||||
(act_ctinfo) DSCP values are able to be stored in the mark on egress and
|
||||
restored on ingress across links that otherwise alter or bleach DSCP.
|
||||
|
||||
This is useful for qdiscs such as CAKE which are able to shape according
|
||||
to policies based on DSCP.
|
||||
|
||||
Ingress classification is traditionally a challenging task since
|
||||
iptables rules haven't yet run and tc filter/eBPF programs are pre-NAT
|
||||
lookups, hence are unable to see internal IPv4 addresses as used on the
|
||||
typical home masquerading gateway.
|
||||
|
||||
x_tables CONNMARK set-dscpmark target solves the problem of storing the
|
||||
DSCP to the conntrack mark in a way suitable for the new act_ctinfo tc
|
||||
action to restore.
|
||||
|
||||
The set-dscpmark option accepts 2 parameters, a 32bit 'dscpmask' and a
|
||||
32bit 'statemask'. The dscp mask must be 6 contiguous bits and
|
||||
represents the area where the DSCP will be stored in the connmark. The
|
||||
state mask is a minimum 1 bit length mask that must not overlap with the
|
||||
dscpmask. It represents a flag which is set when the DSCP has been
|
||||
stored in the conntrack mark. This is useful to implement a 'one shot'
|
||||
iptables based classification where the 'complicated' iptables rules are
|
||||
only run once to classify the connection on initial (egress) packet and
|
||||
subsequent packets are all marked/restored with the same DSCP. A state
|
||||
mask of zero disables the setting of a status bit/s.
|
||||
|
||||
example syntax with a suitably modified iptables user space application:
|
||||
|
||||
iptables -A QOS_MARK_eth0 -t mangle -j CONNMARK --set-dscpmark 0xfc000000/0x01000000
|
||||
|
||||
Would store the DSCP in the top 6 bits of the 32bit mark field, and use
|
||||
the LSB of the top byte as the 'DSCP has been stored' marker.
|
||||
|
||||
|----0xFC----conntrack mark----000000---|
|
||||
| Bits 31-26 | bit 25 | bit24 |~~~ Bit 0|
|
||||
| DSCP | unused | flag |unused |
|
||||
|-----------------------0x01---000000---|
|
||||
^ ^
|
||||
| |
|
||||
---| Conditional flag
|
||||
| set this when dscp
|
||||
|-ip diffserv-| stored in mark
|
||||
| 6 bits |
|
||||
|-------------|
|
||||
|
||||
an identically configured tc action to restore looks like:
|
||||
|
||||
tc filter show dev eth0 ingress
|
||||
filter parent ffff: protocol all pref 10 u32 chain 0
|
||||
filter parent ffff: protocol all pref 10 u32 chain 0 fh 800: ht divisor 1
|
||||
filter parent ffff: protocol all pref 10 u32 chain 0 fh 800::800 order 2048 key ht 800 bkt 0 flowid 1: not_in_hw
|
||||
match 00000000/00000000 at 0
|
||||
action order 1: ctinfo zone 0 pipe
|
||||
index 2 ref 1 bind 1 dscp 0xfc000000/0x1000000
|
||||
|
||||
action order 2: mirred (Egress Redirect to device ifb4eth0) stolen
|
||||
index 1 ref 1 bind 1
|
||||
|
||||
|----0xFC----conntrack mark----000000---|
|
||||
| Bits 31-26 | bit 25 | bit24 |~~~ Bit 0|
|
||||
| DSCP | unused | flag |unused |
|
||||
|-----------------------0x01---000000---|
|
||||
| |
|
||||
| |
|
||||
---| Conditional flag
|
||||
v only restore if set
|
||||
|-ip diffserv-|
|
||||
| 6 bits |
|
||||
|-------------|
|
||||
|
||||
Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
|
||||
---
|
||||
include/uapi/linux/netfilter/xt_connmark.h | 10 ++++
|
||||
net/netfilter/xt_connmark.c | 55 ++++++++++++++++++----
|
||||
2 files changed, 57 insertions(+), 8 deletions(-)
|
||||
|
||||
--- a/include/uapi/linux/netfilter/xt_connmark.h
|
||||
+++ b/include/uapi/linux/netfilter/xt_connmark.h
|
||||
@@ -20,6 +20,11 @@ enum {
|
||||
};
|
||||
|
||||
enum {
|
||||
+ XT_CONNMARK_VALUE = (1 << 0),
|
||||
+ XT_CONNMARK_DSCP = (1 << 1)
|
||||
+};
|
||||
+
|
||||
+enum {
|
||||
D_SHIFT_LEFT = 0,
|
||||
D_SHIFT_RIGHT,
|
||||
};
|
||||
@@ -34,6 +39,11 @@ struct xt_connmark_tginfo2 {
|
||||
__u8 shift_dir, shift_bits, mode;
|
||||
};
|
||||
|
||||
+struct xt_connmark_tginfo3 {
|
||||
+ __u32 ctmark, ctmask, nfmask;
|
||||
+ __u8 shift_dir, shift_bits, mode, func;
|
||||
+};
|
||||
+
|
||||
struct xt_connmark_mtinfo1 {
|
||||
__u32 mark, mask;
|
||||
__u8 invert;
|
||||
--- a/net/netfilter/xt_connmark.c
|
||||
+++ b/net/netfilter/xt_connmark.c
|
||||
@@ -24,12 +24,13 @@ MODULE_ALIAS("ipt_connmark");
|
||||
MODULE_ALIAS("ip6t_connmark");
|
||||
|
||||
static unsigned int
|
||||
-connmark_tg_shift(struct sk_buff *skb, const struct xt_connmark_tginfo2 *info)
|
||||
+connmark_tg_shift(struct sk_buff *skb, const struct xt_connmark_tginfo3 *info)
|
||||
{
|
||||
enum ip_conntrack_info ctinfo;
|
||||
u_int32_t new_targetmark;
|
||||
struct nf_conn *ct;
|
||||
u_int32_t newmark;
|
||||
+ u_int8_t dscp;
|
||||
|
||||
ct = nf_ct_get(skb, &ctinfo);
|
||||
if (ct == NULL)
|
||||
@@ -37,12 +38,24 @@ connmark_tg_shift(struct sk_buff *skb, c
|
||||
|
||||
switch (info->mode) {
|
||||
case XT_CONNMARK_SET:
|
||||
- newmark = (ct->mark & ~info->ctmask) ^ info->ctmark;
|
||||
- if (info->shift_dir == D_SHIFT_RIGHT)
|
||||
- newmark >>= info->shift_bits;
|
||||
- else
|
||||
- newmark <<= info->shift_bits;
|
||||
+ newmark = ct->mark;
|
||||
+ if (info->func & XT_CONNMARK_VALUE) {
|
||||
+ newmark = (newmark & ~info->ctmask) ^ info->ctmark;
|
||||
+ if (info->shift_dir == D_SHIFT_RIGHT)
|
||||
+ newmark >>= info->shift_bits;
|
||||
+ else
|
||||
+ newmark <<= info->shift_bits;
|
||||
+ } else if (info->func & XT_CONNMARK_DSCP) {
|
||||
+ if (skb->protocol == htons(ETH_P_IP))
|
||||
+ dscp = ipv4_get_dsfield(ip_hdr(skb)) >> 2;
|
||||
+ else if (skb->protocol == htons(ETH_P_IPV6))
|
||||
+ dscp = ipv6_get_dsfield(ipv6_hdr(skb)) >> 2;
|
||||
+ else /* protocol doesn't have diffserv */
|
||||
+ break;
|
||||
|
||||
+ newmark = (newmark & ~info->ctmark) |
|
||||
+ (info->ctmask | (dscp << info->shift_bits));
|
||||
+ }
|
||||
if (ct->mark != newmark) {
|
||||
ct->mark = newmark;
|
||||
nf_conntrack_event_cache(IPCT_MARK, ct);
|
||||
@@ -81,20 +94,36 @@ static unsigned int
|
||||
connmark_tg(struct sk_buff *skb, const struct xt_action_param *par)
|
||||
{
|
||||
const struct xt_connmark_tginfo1 *info = par->targinfo;
|
||||
- const struct xt_connmark_tginfo2 info2 = {
|
||||
+ const struct xt_connmark_tginfo3 info3 = {
|
||||
.ctmark = info->ctmark,
|
||||
.ctmask = info->ctmask,
|
||||
.nfmask = info->nfmask,
|
||||
.mode = info->mode,
|
||||
+ .func = XT_CONNMARK_VALUE
|
||||
};
|
||||
|
||||
- return connmark_tg_shift(skb, &info2);
|
||||
+ return connmark_tg_shift(skb, &info3);
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
connmark_tg_v2(struct sk_buff *skb, const struct xt_action_param *par)
|
||||
{
|
||||
const struct xt_connmark_tginfo2 *info = par->targinfo;
|
||||
+ const struct xt_connmark_tginfo3 info3 = {
|
||||
+ .ctmark = info->ctmark,
|
||||
+ .ctmask = info->ctmask,
|
||||
+ .nfmask = info->nfmask,
|
||||
+ .mode = info->mode,
|
||||
+ .func = XT_CONNMARK_VALUE
|
||||
+ };
|
||||
+
|
||||
+ return connmark_tg_shift(skb, &info3);
|
||||
+}
|
||||
+
|
||||
+static unsigned int
|
||||
+connmark_tg_v3(struct sk_buff *skb, const struct xt_action_param *par)
|
||||
+{
|
||||
+ const struct xt_connmark_tginfo3 *info = par->targinfo;
|
||||
|
||||
return connmark_tg_shift(skb, info);
|
||||
}
|
||||
@@ -165,6 +194,16 @@ static struct xt_target connmark_tg_reg[
|
||||
.targetsize = sizeof(struct xt_connmark_tginfo2),
|
||||
.destroy = connmark_tg_destroy,
|
||||
.me = THIS_MODULE,
|
||||
+ },
|
||||
+ {
|
||||
+ .name = "CONNMARK",
|
||||
+ .revision = 3,
|
||||
+ .family = NFPROTO_UNSPEC,
|
||||
+ .checkentry = connmark_tg_check,
|
||||
+ .target = connmark_tg_v3,
|
||||
+ .targetsize = sizeof(struct xt_connmark_tginfo3),
|
||||
+ .destroy = connmark_tg_destroy,
|
||||
+ .me = THIS_MODULE,
|
||||
}
|
||||
};
|
||||
|
|
@ -1,70 +0,0 @@
|
|||
--- a/include/net/netfilter/nf_flow_table.h
|
||||
+++ b/include/net/netfilter/nf_flow_table.h
|
||||
@@ -160,6 +160,8 @@ struct nf_flow_table_hw {
|
||||
int nf_flow_table_hw_register(const struct nf_flow_table_hw *offload);
|
||||
void nf_flow_table_hw_unregister(const struct nf_flow_table_hw *offload);
|
||||
|
||||
+void nf_flow_table_acct(struct flow_offload *flow, struct sk_buff *skb, int dir);
|
||||
+
|
||||
extern struct work_struct nf_flow_offload_hw_work;
|
||||
|
||||
#define MODULE_ALIAS_NF_FLOWTABLE(family) \
|
||||
--- a/net/netfilter/nf_flow_table_core.c
|
||||
+++ b/net/netfilter/nf_flow_table_core.c
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <net/netfilter/nf_conntrack_core.h>
|
||||
#include <net/netfilter/nf_conntrack_l4proto.h>
|
||||
#include <net/netfilter/nf_conntrack_tuple.h>
|
||||
+#include <net/netfilter/nf_conntrack_acct.h>
|
||||
|
||||
struct flow_offload_entry {
|
||||
struct flow_offload flow;
|
||||
@@ -164,6 +165,22 @@ void flow_offload_free(struct flow_offlo
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(flow_offload_free);
|
||||
|
||||
+void nf_flow_table_acct(struct flow_offload *flow, struct sk_buff *skb, int dir)
|
||||
+{
|
||||
+ struct flow_offload_entry *entry;
|
||||
+ struct nf_conn_acct *acct;
|
||||
+
|
||||
+ entry = container_of(flow, struct flow_offload_entry, flow);
|
||||
+ acct = nf_conn_acct_find(entry->ct);
|
||||
+ if (acct) {
|
||||
+ struct nf_conn_counter *counter = acct->counter;
|
||||
+
|
||||
+ atomic64_inc(&counter[dir].packets);
|
||||
+ atomic64_add(skb->len, &counter[dir].bytes);
|
||||
+ }
|
||||
+}
|
||||
+EXPORT_SYMBOL_GPL(nf_flow_table_acct);
|
||||
+
|
||||
static u32 flow_offload_hash(const void *data, u32 len, u32 seed)
|
||||
{
|
||||
const struct flow_offload_tuple *tuple = data;
|
||||
--- a/net/netfilter/nf_flow_table_ip.c
|
||||
+++ b/net/netfilter/nf_flow_table_ip.c
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <net/ip6_route.h>
|
||||
#include <net/neighbour.h>
|
||||
#include <net/netfilter/nf_flow_table.h>
|
||||
+
|
||||
/* For layer 4 checksum field offset. */
|
||||
#include <linux/tcp.h>
|
||||
#include <linux/udp.h>
|
||||
@@ -296,6 +297,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);
|
||||
+ nf_flow_table_acct(flow, skb, dir);
|
||||
neigh_xmit(NEIGH_ARP_TABLE, outdev, &nexthop, skb);
|
||||
|
||||
return NF_STOLEN;
|
||||
@@ -526,6 +528,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);
|
||||
+ nf_flow_table_acct(flow, skb, dir);
|
||||
neigh_xmit(NEIGH_ND_TABLE, outdev, nexthop, skb);
|
||||
|
||||
return NF_STOLEN;
|
|
@ -1,589 +0,0 @@
|
|||
From: Felix Fietkau <nbd@nbd.name>
|
||||
Date: Tue, 20 Feb 2018 15:56:02 +0100
|
||||
Subject: [PATCH] netfilter: add xt_OFFLOAD target
|
||||
|
||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
---
|
||||
create mode 100644 net/netfilter/xt_OFFLOAD.c
|
||||
|
||||
--- a/net/ipv4/netfilter/Kconfig
|
||||
+++ b/net/ipv4/netfilter/Kconfig
|
||||
@@ -56,8 +56,6 @@ config NF_TABLES_ARP
|
||||
help
|
||||
This option enables the ARP support for nf_tables.
|
||||
|
||||
-endif # NF_TABLES
|
||||
-
|
||||
config NF_FLOW_TABLE_IPV4
|
||||
tristate "Netfilter flow table IPv4 module"
|
||||
depends on NF_FLOW_TABLE
|
||||
@@ -66,6 +64,8 @@ config NF_FLOW_TABLE_IPV4
|
||||
|
||||
To compile it as a module, choose M here.
|
||||
|
||||
+endif # NF_TABLES
|
||||
+
|
||||
config NF_DUP_IPV4
|
||||
tristate "Netfilter IPv4 packet duplication to alternate destination"
|
||||
depends on !NF_CONNTRACK || NF_CONNTRACK
|
||||
--- a/net/ipv6/netfilter/Kconfig
|
||||
+++ b/net/ipv6/netfilter/Kconfig
|
||||
@@ -45,7 +45,6 @@ config NFT_FIB_IPV6
|
||||
multicast or blackhole.
|
||||
|
||||
endif # NF_TABLES_IPV6
|
||||
-endif # NF_TABLES
|
||||
|
||||
config NF_FLOW_TABLE_IPV6
|
||||
tristate "Netfilter flow table IPv6 module"
|
||||
@@ -55,6 +54,8 @@ config NF_FLOW_TABLE_IPV6
|
||||
|
||||
To compile it as a module, choose M here.
|
||||
|
||||
+endif # NF_TABLES
|
||||
+
|
||||
config NF_DUP_IPV6
|
||||
tristate "Netfilter IPv6 packet duplication to alternate destination"
|
||||
depends on !NF_CONNTRACK || NF_CONNTRACK
|
||||
--- a/net/netfilter/Kconfig
|
||||
+++ b/net/netfilter/Kconfig
|
||||
@@ -690,8 +690,6 @@ config NFT_FIB_NETDEV
|
||||
|
||||
endif # NF_TABLES_NETDEV
|
||||
|
||||
-endif # NF_TABLES
|
||||
-
|
||||
config NF_FLOW_TABLE_INET
|
||||
tristate "Netfilter flow table mixed IPv4/IPv6 module"
|
||||
depends on NF_FLOW_TABLE
|
||||
@@ -700,11 +698,12 @@ config NF_FLOW_TABLE_INET
|
||||
|
||||
To compile it as a module, choose M here.
|
||||
|
||||
+endif # NF_TABLES
|
||||
+
|
||||
config NF_FLOW_TABLE
|
||||
tristate "Netfilter flow table module"
|
||||
depends on NETFILTER_INGRESS
|
||||
depends on NF_CONNTRACK
|
||||
- depends on NF_TABLES
|
||||
help
|
||||
This option adds the flow table core infrastructure.
|
||||
|
||||
@@ -993,6 +992,15 @@ config NETFILTER_XT_TARGET_NOTRACK
|
||||
depends on NETFILTER_ADVANCED
|
||||
select NETFILTER_XT_TARGET_CT
|
||||
|
||||
+config NETFILTER_XT_TARGET_FLOWOFFLOAD
|
||||
+ tristate '"FLOWOFFLOAD" target support'
|
||||
+ depends on NF_FLOW_TABLE
|
||||
+ depends on NETFILTER_INGRESS
|
||||
+ help
|
||||
+ This option adds a `FLOWOFFLOAD' target, which uses the nf_flow_offload
|
||||
+ module to speed up processing of packets by bypassing the usual
|
||||
+ netfilter chains
|
||||
+
|
||||
config NETFILTER_XT_TARGET_RATEEST
|
||||
tristate '"RATEEST" target support'
|
||||
depends on NETFILTER_ADVANCED
|
||||
--- a/net/netfilter/Makefile
|
||||
+++ b/net/netfilter/Makefile
|
||||
@@ -141,6 +141,7 @@ obj-$(CONFIG_NETFILTER_XT_TARGET_CLASSIF
|
||||
obj-$(CONFIG_NETFILTER_XT_TARGET_CONNSECMARK) += xt_CONNSECMARK.o
|
||||
obj-$(CONFIG_NETFILTER_XT_TARGET_CT) += xt_CT.o
|
||||
obj-$(CONFIG_NETFILTER_XT_TARGET_DSCP) += xt_DSCP.o
|
||||
+obj-$(CONFIG_NETFILTER_XT_TARGET_FLOWOFFLOAD) += xt_FLOWOFFLOAD.o
|
||||
obj-$(CONFIG_NETFILTER_XT_TARGET_HL) += xt_HL.o
|
||||
obj-$(CONFIG_NETFILTER_XT_TARGET_HMARK) += xt_HMARK.o
|
||||
obj-$(CONFIG_NETFILTER_XT_TARGET_LED) += xt_LED.o
|
||||
--- /dev/null
|
||||
+++ b/net/netfilter/xt_FLOWOFFLOAD.c
|
||||
@@ -0,0 +1,427 @@
|
||||
+/*
|
||||
+ * Copyright (C) 2018 Felix Fietkau <nbd@nbd.name>
|
||||
+ *
|
||||
+ * This program is free software; you can redistribute it and/or modify
|
||||
+ * it under the terms of the GNU General Public License version 2 as
|
||||
+ * published by the Free Software Foundation.
|
||||
+ */
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/init.h>
|
||||
+#include <linux/netfilter.h>
|
||||
+#include <linux/netfilter/xt_FLOWOFFLOAD.h>
|
||||
+#include <net/ip.h>
|
||||
+#include <net/netfilter/nf_conntrack.h>
|
||||
+#include <net/netfilter/nf_conntrack_extend.h>
|
||||
+#include <net/netfilter/nf_conntrack_helper.h>
|
||||
+#include <net/netfilter/nf_flow_table.h>
|
||||
+
|
||||
+static struct nf_flowtable nf_flowtable;
|
||||
+static HLIST_HEAD(hooks);
|
||||
+static DEFINE_SPINLOCK(hooks_lock);
|
||||
+static struct delayed_work hook_work;
|
||||
+
|
||||
+struct xt_flowoffload_hook {
|
||||
+ struct hlist_node list;
|
||||
+ struct nf_hook_ops ops;
|
||||
+ struct net *net;
|
||||
+ bool registered;
|
||||
+ bool used;
|
||||
+};
|
||||
+
|
||||
+static unsigned int
|
||||
+xt_flowoffload_net_hook(void *priv, struct sk_buff *skb,
|
||||
+ const struct nf_hook_state *state)
|
||||
+{
|
||||
+ switch (skb->protocol) {
|
||||
+ case htons(ETH_P_IP):
|
||||
+ return nf_flow_offload_ip_hook(priv, skb, state);
|
||||
+ case htons(ETH_P_IPV6):
|
||||
+ return nf_flow_offload_ipv6_hook(priv, skb, state);
|
||||
+ }
|
||||
+
|
||||
+ return NF_ACCEPT;
|
||||
+}
|
||||
+
|
||||
+int nf_flow_table_iterate(struct nf_flowtable *flow_table,
|
||||
+ void (*iter)(struct flow_offload *flow, void *data),
|
||||
+ void *data);
|
||||
+
|
||||
+static int
|
||||
+xt_flowoffload_create_hook(struct net_device *dev)
|
||||
+{
|
||||
+ struct xt_flowoffload_hook *hook;
|
||||
+ struct nf_hook_ops *ops;
|
||||
+
|
||||
+ hook = kzalloc(sizeof(*hook), GFP_ATOMIC);
|
||||
+ if (!hook)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ ops = &hook->ops;
|
||||
+ ops->pf = NFPROTO_NETDEV;
|
||||
+ ops->hooknum = NF_NETDEV_INGRESS;
|
||||
+ ops->priority = 10;
|
||||
+ ops->priv = &nf_flowtable;
|
||||
+ ops->hook = xt_flowoffload_net_hook;
|
||||
+ ops->dev = dev;
|
||||
+
|
||||
+ hlist_add_head(&hook->list, &hooks);
|
||||
+ mod_delayed_work(system_power_efficient_wq, &hook_work, 0);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static struct xt_flowoffload_hook *
|
||||
+flow_offload_lookup_hook(struct net_device *dev)
|
||||
+{
|
||||
+ struct xt_flowoffload_hook *hook;
|
||||
+
|
||||
+ hlist_for_each_entry(hook, &hooks, list) {
|
||||
+ if (hook->ops.dev == dev)
|
||||
+ return hook;
|
||||
+ }
|
||||
+
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+xt_flowoffload_check_device(struct net_device *dev)
|
||||
+{
|
||||
+ struct xt_flowoffload_hook *hook;
|
||||
+
|
||||
+ spin_lock_bh(&hooks_lock);
|
||||
+ hook = flow_offload_lookup_hook(dev);
|
||||
+ if (hook)
|
||||
+ hook->used = true;
|
||||
+ else
|
||||
+ xt_flowoffload_create_hook(dev);
|
||||
+ spin_unlock_bh(&hooks_lock);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+xt_flowoffload_register_hooks(void)
|
||||
+{
|
||||
+ struct xt_flowoffload_hook *hook;
|
||||
+
|
||||
+restart:
|
||||
+ hlist_for_each_entry(hook, &hooks, list) {
|
||||
+ if (hook->registered)
|
||||
+ continue;
|
||||
+
|
||||
+ hook->registered = true;
|
||||
+ hook->net = dev_net(hook->ops.dev);
|
||||
+ spin_unlock_bh(&hooks_lock);
|
||||
+ nf_register_net_hook(hook->net, &hook->ops);
|
||||
+ spin_lock_bh(&hooks_lock);
|
||||
+ goto restart;
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+xt_flowoffload_cleanup_hooks(void)
|
||||
+{
|
||||
+ struct xt_flowoffload_hook *hook;
|
||||
+
|
||||
+restart:
|
||||
+ hlist_for_each_entry(hook, &hooks, list) {
|
||||
+ if (hook->used || !hook->registered)
|
||||
+ continue;
|
||||
+
|
||||
+ hlist_del(&hook->list);
|
||||
+ spin_unlock_bh(&hooks_lock);
|
||||
+ nf_unregister_net_hook(hook->net, &hook->ops);
|
||||
+ kfree(hook);
|
||||
+ spin_lock_bh(&hooks_lock);
|
||||
+ goto restart;
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+xt_flowoffload_check_hook(struct flow_offload *flow, void *data)
|
||||
+{
|
||||
+ struct flow_offload_tuple *tuple = &flow->tuplehash[0].tuple;
|
||||
+ struct xt_flowoffload_hook *hook;
|
||||
+ bool *found = data;
|
||||
+ struct rtable *rt = (struct rtable *)tuple->dst_cache;
|
||||
+
|
||||
+ spin_lock_bh(&hooks_lock);
|
||||
+ hlist_for_each_entry(hook, &hooks, list) {
|
||||
+ if (hook->ops.dev->ifindex != tuple->iifidx &&
|
||||
+ hook->ops.dev->ifindex != rt->dst.dev->ifindex)
|
||||
+ continue;
|
||||
+
|
||||
+ hook->used = true;
|
||||
+ *found = true;
|
||||
+ }
|
||||
+ spin_unlock_bh(&hooks_lock);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+xt_flowoffload_hook_work(struct work_struct *work)
|
||||
+{
|
||||
+ struct xt_flowoffload_hook *hook;
|
||||
+ bool found = false;
|
||||
+ int err;
|
||||
+
|
||||
+ spin_lock_bh(&hooks_lock);
|
||||
+ xt_flowoffload_register_hooks();
|
||||
+ hlist_for_each_entry(hook, &hooks, list)
|
||||
+ hook->used = false;
|
||||
+ spin_unlock_bh(&hooks_lock);
|
||||
+
|
||||
+ err = nf_flow_table_iterate(&nf_flowtable, xt_flowoffload_check_hook,
|
||||
+ &found);
|
||||
+ if (err && err != -EAGAIN)
|
||||
+ goto out;
|
||||
+
|
||||
+ spin_lock_bh(&hooks_lock);
|
||||
+ xt_flowoffload_cleanup_hooks();
|
||||
+ spin_unlock_bh(&hooks_lock);
|
||||
+
|
||||
+out:
|
||||
+ if (found)
|
||||
+ queue_delayed_work(system_power_efficient_wq, &hook_work, HZ);
|
||||
+}
|
||||
+
|
||||
+static bool
|
||||
+xt_flowoffload_skip(struct sk_buff *skb, int family)
|
||||
+{
|
||||
+ if (skb_sec_path(skb))
|
||||
+ return true;
|
||||
+
|
||||
+ if (family == NFPROTO_IPV4) {
|
||||
+ const struct ip_options *opt = &(IPCB(skb)->opt);
|
||||
+
|
||||
+ if (unlikely(opt->optlen))
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
+static struct dst_entry *
|
||||
+xt_flowoffload_dst(const struct nf_conn *ct, enum ip_conntrack_dir dir,
|
||||
+ const struct xt_action_param *par, int ifindex)
|
||||
+{
|
||||
+ struct dst_entry *dst = NULL;
|
||||
+ struct flowi fl;
|
||||
+
|
||||
+ memset(&fl, 0, sizeof(fl));
|
||||
+ switch (xt_family(par)) {
|
||||
+ case NFPROTO_IPV4:
|
||||
+ fl.u.ip4.daddr = ct->tuplehash[dir].tuple.src.u3.ip;
|
||||
+ fl.u.ip4.flowi4_oif = ifindex;
|
||||
+ break;
|
||||
+ case NFPROTO_IPV6:
|
||||
+ fl.u.ip6.saddr = ct->tuplehash[dir].tuple.dst.u3.in6;
|
||||
+ fl.u.ip6.daddr = ct->tuplehash[dir].tuple.src.u3.in6;
|
||||
+ fl.u.ip6.flowi6_oif = ifindex;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ nf_route(xt_net(par), &dst, &fl, false, xt_family(par));
|
||||
+
|
||||
+ return dst;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+xt_flowoffload_route(struct sk_buff *skb, const struct nf_conn *ct,
|
||||
+ const struct xt_action_param *par,
|
||||
+ struct nf_flow_route *route, enum ip_conntrack_dir dir)
|
||||
+{
|
||||
+ struct dst_entry *this_dst, *other_dst;
|
||||
+
|
||||
+ this_dst = xt_flowoffload_dst(ct, !dir, par, xt_out(par)->ifindex);
|
||||
+ other_dst = xt_flowoffload_dst(ct, dir, par, xt_in(par)->ifindex);
|
||||
+
|
||||
+ route->tuple[dir].dst = this_dst;
|
||||
+ route->tuple[!dir].dst = other_dst;
|
||||
+
|
||||
+ if (!this_dst || !other_dst)
|
||||
+ return -ENOENT;
|
||||
+
|
||||
+ if (dst_xfrm(this_dst) || dst_xfrm(other_dst))
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static unsigned int
|
||||
+flowoffload_tg(struct sk_buff *skb, const struct xt_action_param *par)
|
||||
+{
|
||||
+ const struct xt_flowoffload_target_info *info = par->targinfo;
|
||||
+ struct tcphdr _tcph, *tcph = NULL;
|
||||
+ enum ip_conntrack_info ctinfo;
|
||||
+ enum ip_conntrack_dir dir;
|
||||
+ struct nf_flow_route route;
|
||||
+ struct flow_offload *flow = NULL;
|
||||
+ struct nf_conn *ct;
|
||||
+ struct net *net;
|
||||
+
|
||||
+ if (xt_flowoffload_skip(skb, xt_family(par)))
|
||||
+ return XT_CONTINUE;
|
||||
+
|
||||
+ ct = nf_ct_get(skb, &ctinfo);
|
||||
+ if (ct == NULL)
|
||||
+ return XT_CONTINUE;
|
||||
+
|
||||
+ switch (ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.protonum) {
|
||||
+ case IPPROTO_TCP:
|
||||
+ if (ct->proto.tcp.state != TCP_CONNTRACK_ESTABLISHED)
|
||||
+ return XT_CONTINUE;
|
||||
+
|
||||
+ tcph = skb_header_pointer(skb, par->thoff,
|
||||
+ sizeof(_tcph), &_tcph);
|
||||
+ if (unlikely(!tcph || tcph->fin || tcph->rst))
|
||||
+ return XT_CONTINUE;
|
||||
+ break;
|
||||
+ case IPPROTO_UDP:
|
||||
+ break;
|
||||
+ default:
|
||||
+ return XT_CONTINUE;
|
||||
+ }
|
||||
+
|
||||
+ if (nf_ct_ext_exist(ct, NF_CT_EXT_HELPER) ||
|
||||
+ ct->status & IPS_SEQ_ADJUST)
|
||||
+ return XT_CONTINUE;
|
||||
+
|
||||
+ if (!nf_ct_is_confirmed(ct))
|
||||
+ return XT_CONTINUE;
|
||||
+
|
||||
+ if (!xt_in(par) || !xt_out(par))
|
||||
+ return XT_CONTINUE;
|
||||
+
|
||||
+ if (test_and_set_bit(IPS_OFFLOAD_BIT, &ct->status))
|
||||
+ return XT_CONTINUE;
|
||||
+
|
||||
+ dir = CTINFO2DIR(ctinfo);
|
||||
+
|
||||
+ if (xt_flowoffload_route(skb, ct, par, &route, dir) == 0)
|
||||
+ flow = flow_offload_alloc(ct, &route);
|
||||
+
|
||||
+ dst_release(route.tuple[dir].dst);
|
||||
+ dst_release(route.tuple[!dir].dst);
|
||||
+
|
||||
+ if (!flow)
|
||||
+ goto err_flow_route;
|
||||
+
|
||||
+ if (tcph) {
|
||||
+ ct->proto.tcp.seen[0].flags |= IP_CT_TCP_FLAG_BE_LIBERAL;
|
||||
+ ct->proto.tcp.seen[1].flags |= IP_CT_TCP_FLAG_BE_LIBERAL;
|
||||
+ }
|
||||
+
|
||||
+ if (flow_offload_add(&nf_flowtable, flow) < 0)
|
||||
+ goto err_flow_add;
|
||||
+
|
||||
+ xt_flowoffload_check_device(xt_in(par));
|
||||
+ xt_flowoffload_check_device(xt_out(par));
|
||||
+
|
||||
+ net = read_pnet(&nf_flowtable.ft_net);
|
||||
+ if (!net)
|
||||
+ write_pnet(&nf_flowtable.ft_net, xt_net(par));
|
||||
+
|
||||
+ if (info->flags & XT_FLOWOFFLOAD_HW)
|
||||
+ nf_flow_offload_hw_add(xt_net(par), flow, ct);
|
||||
+
|
||||
+ return XT_CONTINUE;
|
||||
+
|
||||
+err_flow_add:
|
||||
+ flow_offload_free(flow);
|
||||
+err_flow_route:
|
||||
+ clear_bit(IPS_OFFLOAD_BIT, &ct->status);
|
||||
+ return XT_CONTINUE;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static int flowoffload_chk(const struct xt_tgchk_param *par)
|
||||
+{
|
||||
+ struct xt_flowoffload_target_info *info = par->targinfo;
|
||||
+
|
||||
+ if (info->flags & ~XT_FLOWOFFLOAD_MASK)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static struct xt_target offload_tg_reg __read_mostly = {
|
||||
+ .family = NFPROTO_UNSPEC,
|
||||
+ .name = "FLOWOFFLOAD",
|
||||
+ .revision = 0,
|
||||
+ .targetsize = sizeof(struct xt_flowoffload_target_info),
|
||||
+ .usersize = sizeof(struct xt_flowoffload_target_info),
|
||||
+ .checkentry = flowoffload_chk,
|
||||
+ .target = flowoffload_tg,
|
||||
+ .me = THIS_MODULE,
|
||||
+};
|
||||
+
|
||||
+static int xt_flowoffload_table_init(struct nf_flowtable *table)
|
||||
+{
|
||||
+ table->flags = NF_FLOWTABLE_F_HW;
|
||||
+ nf_flow_table_init(table);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void xt_flowoffload_table_cleanup(struct nf_flowtable *table)
|
||||
+{
|
||||
+ nf_flow_table_free(table);
|
||||
+}
|
||||
+
|
||||
+static int flow_offload_netdev_event(struct notifier_block *this,
|
||||
+ unsigned long event, void *ptr)
|
||||
+{
|
||||
+ struct xt_flowoffload_hook *hook = NULL;
|
||||
+ struct net_device *dev = netdev_notifier_info_to_dev(ptr);
|
||||
+
|
||||
+ if (event != NETDEV_UNREGISTER)
|
||||
+ return NOTIFY_DONE;
|
||||
+
|
||||
+ spin_lock_bh(&hooks_lock);
|
||||
+ hook = flow_offload_lookup_hook(dev);
|
||||
+ if (hook) {
|
||||
+ hlist_del(&hook->list);
|
||||
+ }
|
||||
+ spin_unlock_bh(&hooks_lock);
|
||||
+ if (hook) {
|
||||
+ nf_unregister_net_hook(hook->net, &hook->ops);
|
||||
+ kfree(hook);
|
||||
+ }
|
||||
+
|
||||
+ nf_flow_table_cleanup(dev);
|
||||
+
|
||||
+ return NOTIFY_DONE;
|
||||
+}
|
||||
+
|
||||
+static struct notifier_block flow_offload_netdev_notifier = {
|
||||
+ .notifier_call = flow_offload_netdev_event,
|
||||
+};
|
||||
+
|
||||
+static int __init xt_flowoffload_tg_init(void)
|
||||
+{
|
||||
+ int ret;
|
||||
+
|
||||
+ register_netdevice_notifier(&flow_offload_netdev_notifier);
|
||||
+
|
||||
+ INIT_DELAYED_WORK(&hook_work, xt_flowoffload_hook_work);
|
||||
+
|
||||
+ ret = xt_flowoffload_table_init(&nf_flowtable);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ ret = xt_register_target(&offload_tg_reg);
|
||||
+ if (ret)
|
||||
+ xt_flowoffload_table_cleanup(&nf_flowtable);
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static void __exit xt_flowoffload_tg_exit(void)
|
||||
+{
|
||||
+ xt_unregister_target(&offload_tg_reg);
|
||||
+ xt_flowoffload_table_cleanup(&nf_flowtable);
|
||||
+ unregister_netdevice_notifier(&flow_offload_netdev_notifier);
|
||||
+}
|
||||
+
|
||||
+MODULE_LICENSE("GPL");
|
||||
+module_init(xt_flowoffload_tg_init);
|
||||
+module_exit(xt_flowoffload_tg_exit);
|
||||
--- a/net/netfilter/nf_flow_table_core.c
|
||||
+++ b/net/netfilter/nf_flow_table_core.c
|
||||
@@ -7,7 +7,6 @@
|
||||
#include <linux/netdevice.h>
|
||||
#include <net/ip.h>
|
||||
#include <net/ip6_route.h>
|
||||
-#include <net/netfilter/nf_tables.h>
|
||||
#include <net/netfilter/nf_flow_table.h>
|
||||
#include <net/netfilter/nf_conntrack.h>
|
||||
#include <net/netfilter/nf_conntrack_core.h>
|
||||
@@ -338,8 +337,7 @@ flow_offload_lookup(struct nf_flowtable
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(flow_offload_lookup);
|
||||
|
||||
-static int
|
||||
-nf_flow_table_iterate(struct nf_flowtable *flow_table,
|
||||
+int nf_flow_table_iterate(struct nf_flowtable *flow_table,
|
||||
void (*iter)(struct flow_offload *flow, void *data),
|
||||
void *data)
|
||||
{
|
||||
@@ -372,6 +370,7 @@ nf_flow_table_iterate(struct nf_flowtabl
|
||||
|
||||
return err;
|
||||
}
|
||||
+EXPORT_SYMBOL_GPL(nf_flow_table_iterate);
|
||||
|
||||
static void nf_flow_offload_gc_step(struct flow_offload *flow, void *data)
|
||||
{
|
||||
--- /dev/null
|
||||
+++ b/include/uapi/linux/netfilter/xt_FLOWOFFLOAD.h
|
||||
@@ -0,0 +1,17 @@
|
||||
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
||||
+#ifndef _XT_FLOWOFFLOAD_H
|
||||
+#define _XT_FLOWOFFLOAD_H
|
||||
+
|
||||
+#include <linux/types.h>
|
||||
+
|
||||
+enum {
|
||||
+ XT_FLOWOFFLOAD_HW = 1 << 0,
|
||||
+
|
||||
+ XT_FLOWOFFLOAD_MASK = XT_FLOWOFFLOAD_HW
|
||||
+};
|
||||
+
|
||||
+struct xt_flowoffload_target_info {
|
||||
+ __u32 flags;
|
||||
+};
|
||||
+
|
||||
+#endif /* _XT_FLOWOFFLOAD_H */
|
||||
--- a/include/net/netfilter/nf_flow_table.h
|
||||
+++ b/include/net/netfilter/nf_flow_table.h
|
||||
@@ -130,6 +130,10 @@ static inline void flow_offload_dead(str
|
||||
flow->flags |= FLOW_OFFLOAD_DYING;
|
||||
}
|
||||
|
||||
+int nf_flow_table_iterate(struct nf_flowtable *flow_table,
|
||||
+ void (*iter)(struct flow_offload *flow, void *data),
|
||||
+ void *data);
|
||||
+
|
||||
int nf_flow_snat_port(const struct flow_offload *flow,
|
||||
struct sk_buff *skb, unsigned int thoff,
|
||||
u8 protocol, enum flow_offload_tuple_dir dir);
|
|
@ -1,24 +0,0 @@
|
|||
From 6d3bc769657b0ee7c7506dad9911111c4226a7ea Mon Sep 17 00:00:00 2001
|
||||
From: Imre Kaloz <kaloz@openwrt.org>
|
||||
Date: Fri, 7 Jul 2017 17:21:05 +0200
|
||||
Subject: mac80211: increase wireless mesh header size
|
||||
|
||||
lede-commit 3d4466cfd8f75f717efdb1f96fdde3c70d865fc1
|
||||
Signed-off-by: Imre Kaloz <kaloz@openwrt.org>
|
||||
---
|
||||
include/linux/netdevice.h | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/include/linux/netdevice.h
|
||||
+++ b/include/linux/netdevice.h
|
||||
@@ -138,8 +138,8 @@ static inline bool dev_xmit_complete(int
|
||||
|
||||
#if defined(CONFIG_HYPERV_NET)
|
||||
# define LL_MAX_HEADER 128
|
||||
-#elif defined(CONFIG_WLAN) || IS_ENABLED(CONFIG_AX25)
|
||||
-# if defined(CONFIG_MAC80211_MESH)
|
||||
+#elif defined(CONFIG_WLAN) || IS_ENABLED(CONFIG_AX25) || 1
|
||||
+# if defined(CONFIG_MAC80211_MESH) || 1
|
||||
# define LL_MAX_HEADER 128
|
||||
# else
|
||||
# define LL_MAX_HEADER 96
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue