Cavium OCTEON-III network driver.
Subsystems (5)
v5 cover Cavium OCTEON-III network driver.
We are adding the Cavium OCTEON-III network driver. But since interacting with the input and output queues is done via special CPU local memory, we also need to add support to the MIPS/Octeon architecture code. Aren't SoCs nice in this way?
The first five patches add the SoC support needed by the driver, the last two add the driver and an entry in MAINTAINERS.
Since these touch several subsystems (mips, netdev), I would propose merging via netdev, but defer to the maintainers if they think something else would work better.
A separate pull request was recently done by Steven Hill for the firmware required by the driver.
Changes from v4:
o Removed cleanup patch for previous generation SoC "staging" driver, as it will be sent as a follow-on.
o Fixed kernel doc formatting in all patches.
o Removed redundant licensing text boilerplate.
o Reviewed-by: header added to 2/7.
o Rewrote locking code in 3/7 to eliminate inline asm.
Changes from v3:
o Use phy_print_status() instead of open coding the equivalent.
o Print warning on phy mode mismatch.
o Improve dt-bindings and add Acked-by.
Changes from v2:
o Fix PKI (RX path) initialization to work with little endian kernel.
Changes from v1:
o Cleanup and use of standard bindings in the device tree bindings document.
o Added (hopefully) clarifying comments about several OCTEON architectural peculiarities.
o Removed unused testing code from the driver.
o Removed some module parameters that already default to the proper values.
o KConfig cleanup, including testing on x86_64, arm64 and mips.
o Fixed breakage to the driver for previous generation of OCTEON SoCs (in the staging directory still).
o Verified bisectability of the patch set.
Carlos Munoz (5):
dt-bindings: Add Cavium Octeon Common Ethernet Interface.
MIPS: Octeon: Enable LMTDMA/LMTST operations.
MIPS: Octeon: Add a global resource manager.
MIPS: Octeon: Add Free Pointer Unit (FPA) support.
netdev: octeon-ethernet: Add Cavium Octeon III support.
David Daney (2):
MIPS: Octeon: Automatically provision CVMSEG space.
MAINTAINERS: Add entry for
drivers/net/ethernet/cavium/octeon/octeon3-*
.../devicetree/bindings/net/cavium-bgx.txt | 61 + MAINTAINERS | 6 + arch/mips/cavium-octeon/Kconfig | 35 +- arch/mips/cavium-octeon/Makefile | 2 + arch/mips/cavium-octeon/octeon-fpa3.c | 363 ++++ arch/mips/cavium-octeon/resource-mgr.c | 351 ++++ arch/mips/cavium-octeon/setup.c | 22 +- .../asm/mach-cavium-octeon/kernel-entry-init.h | 20 +- arch/mips/include/asm/mipsregs.h | 2 + arch/mips/include/asm/octeon/octeon.h | 45 +- arch/mips/include/asm/processor.h | 2 +- arch/mips/kernel/octeon_switch.S | 2 - arch/mips/mm/tlbex.c | 29 +- drivers/net/ethernet/cavium/Kconfig | 55 +- drivers/net/ethernet/cavium/octeon/Makefile | 6 + .../net/ethernet/cavium/octeon/octeon3-bgx-nexus.c | 701 +++++++ .../net/ethernet/cavium/octeon/octeon3-bgx-port.c | 2015 +++++++++++++++++++ drivers/net/ethernet/cavium/octeon/octeon3-core.c | 2069 ++++++++++++++++++++ drivers/net/ethernet/cavium/octeon/octeon3-pki.c | 824 ++++++++ drivers/net/ethernet/cavium/octeon/octeon3-pko.c | 1688 ++++++++++++++++ drivers/net/ethernet/cavium/octeon/octeon3-sso.c | 301 +++ drivers/net/ethernet/cavium/octeon/octeon3.h | 418 ++++ drivers/staging/octeon/ethernet-defines.h | 2 +- 23 files changed, 8955 insertions(+), 64 deletions(-) create mode 100644 Documentation/devicetree/bindings/net/cavium-bgx.txt create mode 100644 arch/mips/cavium-octeon/octeon-fpa3.c create mode 100644 arch/mips/cavium-octeon/resource-mgr.c create mode 100644 drivers/net/ethernet/cavium/octeon/octeon3-bgx-nexus.c create mode 100644 drivers/net/ethernet/cavium/octeon/octeon3-bgx-port.c create mode 100644 drivers/net/ethernet/cavium/octeon/octeon3-core.c create mode 100644 drivers/net/ethernet/cavium/octeon/octeon3-pki.c create mode 100644 drivers/net/ethernet/cavium/octeon/octeon3-pko.c create mode 100644 drivers/net/ethernet/cavium/octeon/octeon3-sso.c create mode 100644 drivers/net/ethernet/cavium/octeon/octeon3.h
Signature · 1 line
2.14.3
PATCH v5 1/7 dt-bindings: Add Cavium Octeon Common Ethernet Interface.
From: Carlos Munoz <[email protected]>
Add bindings for Common Ethernet Interface (BGX) block.
--- .../devicetree/bindings/net/cavium-bgx.txt | 61 ++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/cavium-bgx.txt
Documentation/devicetree/bindings/net/cavium-bgx.txt new file +61 -0
@@ -0,0 +1,61 @@ +* Common Ethernet Interface (BGX) block + +Properties: + +- compatible: "cavium,octeon-7890-bgx": Compatibility with all cn7xxx SOCs. + +- reg: The base address of the BGX block. + +- #address-cells: Must be <1>. + +- #size-cells: Must be <0>. BGX addresses have no size component. + +A BGX block has several children, each representing an Ethernet +interface. + + +* Ethernet Interface (BGX port) connects to PKI/PKO + +Properties: + +- compatible: "cavium,octeon-7890-bgx-port": Compatibility with all + cn7xxx SOCs. + + "cavium,octeon-7360-xcv": Compatibility with cn73xx SOCs + for RGMII. + +- reg: The index of the interface within the BGX block. + +Optional properties: + +- local-mac-address: Mac address for the interface. + +- phy-handle: phandle to the phy node connected to the interface. + +- phy-mode: described in ethernet.txt. + +- fixed-link: described in fixed-link.txt. + +Example: + + ethernet-mac-nexus@11800e0000000 { + compatible = "cavium,octeon-7890-bgx"; + reg = <0x00011800 0xe0000000 0x00000000 0x01000000>; + #address-cells = <1>; + #size-cells = <0>; + + ethernet@0 { + compatible = "cavium,octeon-7360-xcv"; + reg = <0>; + local-mac-address = [ 00 01 23 45 67 89 ]; + phy-handle = <&phy3>; + phy-mode = "rgmii-rxid" + }; + ethernet@1 { + compatible = "cavium,octeon-7890-bgx-port"; + reg = <1>; + local-mac-address = [ 00 01 23 45 67 8a ]; + phy-handle = <&phy4>; + phy-mode = "sgmii" + }; + };
Signature · 1 line
2.14.3
Re: [PATCH v5 net-next,mips 1/7] dt-bindings: Add Cavium Octeon Common Ethernet Interface.
Quoted 8 lines · David Daney
From: Carlos Munoz <[email protected]>
Add bindings for Common Ethernet Interface (BGX) block.
Acked-by Rob Herring <[email protected]>Signed-off-by Carlos Munoz <[email protected]>Signed-off-by Steven J. Hill <[email protected]>Signed-off-by David Daney <[email protected]>
Signature · 1 line
Florian
PATCH v5 2/7 MIPS: Octeon: Enable LMTDMA/LMTST operations.
In reply to David DaneyFrom: Carlos Munoz <[email protected]>
LMTDMA/LMTST operations move data between cores and I/O devices:
* LMTST operations can send an address and a variable length (up to 128 bytes) of data to an I/O device.
* LMTDMA operations can send an address and a variable length (up to 128) of data to the I/O device and then return a variable length (up to 128 bytes) response from the I/O device.
For both LMTST and LMTDMA, the data sent to the device is first stored in the CVMSEG core local memory cache line indexed by CVMMEMCTL[LMTLINE], the data is then atomically transmitted to the device with a store to the CVMSEG LMTDMA trigger location.
--- arch/mips/cavium-octeon/setup.c | 6 ++++++ arch/mips/include/asm/octeon/octeon.h | 12 ++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-)
arch/mips/cavium-octeon/setup.c +6 -0
@@ -609,6 +609,12 @@ void octeon_user_io_init(void)#else cvmmemctl.s.cvmsegenak =0 ;#endif +if (OCTEON_IS_OCTEON3 ()) { +/* Enable LMTDMA */ + cvmmemctl.s.lmtena =1 ; +/* Scratch line to use for LMT operation */ + cvmmemctl.s.lmtline =2 ; + }/* R/W If set, CVMSEG is available for loads/stores in * supervisor mode. */ cvmmemctl.s.cvmsegenas =0 ;
arch/mips/include/asm/octeon/octeon.h +10 -2
@@ -179,7 +179,15 @@ union octeon_cvmemctl { /* RO 1 = BIST fail, 0 = BIST pass */ __BITFIELD_FIELD(uint64_t wbfbist:1, /* Reserved */ - __BITFIELD_FIELD(uint64_t reserved:17, + __BITFIELD_FIELD(uint64_t reserved_52_57:6, + /* When set, LMTDMA/LMTST operations are permitted */ + __BITFIELD_FIELD(uint64_t lmtena:1, + /* Selects the CVMSEG LM cacheline used by LMTDMA + * LMTST and wide atomic store operations. + */ + __BITFIELD_FIELD(uint64_t lmtline:6, + /* Reserved */ + __BITFIELD_FIELD(uint64_t reserved_41_44:4, /* OCTEON II - TLB replacement policy: 0 = bitmask LRU; 1 = NLU. * This field selects between the TLB replacement policies: * bitmask LRU or NLU. Bitmask LRU maintains a mask of
@@ -275,7 +283,7 @@ union octeon_cvmemctl {/* R/W Size of local memory in cache blocks, 54 (6912 * bytes) is max legal value. */ __BITFIELD_FIELD(uint64_t lmemsz:6, - ;))))))))))))))))))))))))))))))))) + ;)))))))))))))))))))))))))))))))))))) } s; };
Signature · 1 line
2.14.3
PATCH v5 3/7 MIPS: Octeon: Add a global resource manager.
In reply to David DaneyFrom: Carlos Munoz <[email protected]>
Add a global resource manager to manage tagged pointers within bootmem allocated memory. This is used by various functional blocks in the Octeon core like the FPA, Ethernet nexus, etc.
--- arch/mips/cavium-octeon/Makefile | 1 + arch/mips/cavium-octeon/resource-mgr.c | 351 +++++++++++++++++++++++++++++++++ arch/mips/include/asm/octeon/octeon.h | 18 ++ 3 files changed, 370 insertions(+) create mode 100644 arch/mips/cavium-octeon/resource-mgr.c
arch/mips/cavium-octeon/Makefile +1 -0
@@ -10,6 +10,7 @@ # obj-y := cpu.o setup.o octeon-platform.o octeon-irq.o csrc-octeon.o +obj-y += resource-mgr.o obj-y += dma-octeon.o obj-y += octeon-memcpy.o obj-y += executive/
arch/mips/cavium-octeon/resource-mgr.c new file +351 -0
351 lines not on this page · raw message
arch/mips/include/asm/octeon/octeon.h +18 -0
@@ -346,6 +346,24 @@ void octeon_mult_restore3_end(void);void octeon_mult_restore2 (void );void octeon_mult_restore2_end (void ); +/* +* This definition must be kept in sync with the one in +* cvmx-global-resources.c +*/ +struct global_resource_tag { +uint64_t lo; +uint64_t hi; +}; + +void res_mgr_free (struct global_resource_tag tag,int inst); +void res_mgr_free_range (struct global_resource_tag tag,const int *inst, +int req_cnt); +int res_mgr_alloc (struct global_resource_tag tag,int req_inst, +bool use_last_avail); +int res_mgr_alloc_range (struct global_resource_tag tag,int req_inst, +int req_cnt,bool use_last_avail,int *inst); +int res_mgr_create_resource (struct global_resource_tag tag,int inst_cnt); +/** * Read a 32bit value from the Octeon NPI register space *
Signature · 1 line
2.14.3
PATCH v5 4/7 MIPS: Octeon: Add Free Pointer Unit (FPA) support.
In reply to David DaneyFrom: Carlos Munoz <[email protected]>
Quoted 1 line
From the hardware user manual: "The FPA is a unit that maintains
pools of pointers to free L2/DRAM memory. To provide QoS, the pools are referenced indirectly through 1024 auras. Both core software and hardware units allocate and free pointers."
--- arch/mips/cavium-octeon/Kconfig | 8 + arch/mips/cavium-octeon/Makefile | 1 + arch/mips/cavium-octeon/octeon-fpa3.c | 363 ++++++++++++++++++++++++++++++++++ arch/mips/include/asm/octeon/octeon.h | 13 ++ 4 files changed, 385 insertions(+) create mode 100644 arch/mips/cavium-octeon/octeon-fpa3.c
arch/mips/cavium-octeon/Kconfig +8 -0
@@ -87,4 +87,12 @@ config OCTEON_ILM To compile this driver as a module, choose M here. The module will be called octeon-ilm +config OCTEON_FPA3 + tristate "Octeon III fpa driver" + help + This option enables a Octeon III driver for the Free Pool Unit (FPA). + The FPA is a hardware unit that manages pools of pointers to free + L2/DRAM memory. This driver provides an interface to reserve, + initialize, and fill fpa pools. + endif # CAVIUM_OCTEON_SOC
arch/mips/cavium-octeon/Makefile +1 -0
@@ -20,3 +20,4 @@ obj-$(CONFIG_MTD) += flash_setup.o obj-$(CONFIG_SMP) += smp.o obj-$(CONFIG_OCTEON_ILM) += oct_ilm.o obj-$(CONFIG_USB) += octeon-usb.o +obj-$(CONFIG_OCTEON_FPA3) += octeon-fpa3.o
arch/mips/cavium-octeon/octeon-fpa3.c new file +363 -0
363 lines not on this page · raw message
arch/mips/include/asm/octeon/octeon.h +13 -0
@@ -10,6 +10,7 @@#include <asm/octeon/cvmx.h> #include <asm/bitfield.h> +#include <linux/slab.h> extern uint64_t octeon_bootmem_alloc_range_phys(uint64_t size, uint64_t alignment,
@@ -364,6 +365,18 @@ int res_mgr_alloc_range(struct global_resource_tag tag, int req_inst, int req_cnt, bool use_last_avail, int *inst);int res_mgr_create_resource (struct global_resource_tag tag,int inst_cnt); +int octeon_fpa3_init (int node); +int octeon_fpa3_pool_init (int node,int pool_num,int *pool,void **pool_stack, +int num_ptrs); +int octeon_fpa3_aura_init (int node,int pool,int aura_num,int *aura, +int num_bufs,unsigned int limit); +int octeon_fpa3_mem_fill (int node,struct kmem_cache *cache,int aura, +int num_bufs); +void octeon_fpa3_free (u64 node,int aura,const void *buf); +void *octeon_fpa3_alloc (u64 node,int aura); +void octeon_fpa3_release_pool (int node,int pool); +void octeon_fpa3_release_aura (int node,int aura); +/** * Read a 32bit value from the Octeon NPI register space *
Signature · 1 line
2.14.3
PATCH v5 5/7 MIPS: Octeon: Automatically provision CVMSEG space.
In reply to David DaneyRemove CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE and automatically calculate the amount of CVMSEG space needed.
1st 128-bytes: Use by IOBDMA
2nd 128-bytes: Reserved by kernel for scratch/TLS emulation. 3rd 128-bytes: OCTEON-III LMTLINE
New config variable CONFIG_CAVIUM_OCTEON_EXTRA_CVMSEG provisions additional lines, defaults to zero.
--- arch/mips/cavium-octeon/Kconfig | 27 ++++++++++++-------- arch/mips/cavium-octeon/setup.c | 16 ++++++------ .../asm/mach-cavium-octeon/kernel-entry-init.h | 20 +++++++++------ arch/mips/include/asm/mipsregs.h | 2 ++ arch/mips/include/asm/octeon/octeon.h | 2 ++ arch/mips/include/asm/processor.h | 2 +- arch/mips/kernel/octeon_switch.S | 2 -- arch/mips/mm/tlbex.c | 29 ++++++---------------- drivers/staging/octeon/ethernet-defines.h | 2 +- 9 files changed, 50 insertions(+), 52 deletions(-)
arch/mips/cavium-octeon/Kconfig +16 -11
@@ -11,21 +11,26 @@ config CAVIUM_CN63XXP1 non-CN63XXP1 hardware, so it is recommended to select "n" unless it is known the workarounds are needed. -config CAVIUM_OCTEON_CVMSEG_SIZE - int "Number of L1 cache lines reserved for CVMSEG memory" - range 0 54 - default 1 - help - CVMSEG LM is a segment that accesses portions of the dcache as a - local memory; the larger CVMSEG is, the smaller the cache is. - This selects the size of CVMSEG LM, which is in cache blocks. The - legally range is from zero to 54 cache blocks (i.e. CVMSEG LM is - between zero and 6192 bytes). - endif # CPU_CAVIUM_OCTEON if CAVIUM_OCTEON_SOC +config CAVIUM_OCTEON_EXTRA_CVMSEG + int "Number of extra L1 cache lines reserved for CVMSEG memory" + range 0 50 + default 0 + help + CVMSEG LM is a segment that accesses portions of the dcache + as a local memory; the larger CVMSEG is, the smaller the + cache is. The kernel uses two or three blocks (one for TLB + exception handlers, one for driver IOBDMA operations, and on + models that need it, one for LMTDMA operations). This + selects an optional extra number of CVMSEG lines for use by + other software. + + Normally no extra lines are required, and this parameter + should be set to zero. + config CAVIUM_OCTEON_LOCK_L2 bool "Lock often used kernel code in the L2" default "y"
arch/mips/cavium-octeon/setup.c +9 -7
@@ -68,6 +68,12 @@ extern void pci_console_init(const char *arg);static unsigned long long max_memory =ULLONG_MAX ;static unsigned long long reserve_low_mem; +/* +* modified in hernel-entry-init.h, must have an initial value to keep +* it from being clobbered when bss is zeroed. +*/ +u32 octeon_cvmseg_lines =2 ; +DEFINE_SEMAPHORE (octeon_bootbus_sem);EXPORT_SYMBOL (octeon_bootbus_sem);
@@ -604,11 +610,7 @@ void octeon_user_io_init(void)/* R/W If set, CVMSEG is available for loads/stores in * kernel/debug mode. */ -#if CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE >0 cvmmemctl.s.cvmsegenak =1 ; -#else - cvmmemctl.s.cvmsegenak =0 ; -#endif if (OCTEON_IS_OCTEON3 ()) {/* Enable LMTDMA */ cvmmemctl.s.lmtena =1 ;
@@ -626,9 +628,9 @@ void octeon_user_io_init(void)/* Setup of CVMSEG is done in kernel-entry-init.h */ if (smp_processor_id () ==0 ) -pr_notice ("CVMSEG size: %d cache lines (%d bytes)\n" , -CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE , -CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE *128 ); +pr_notice ("CVMSEG size: %u cache lines (%u bytes)\n" , + octeon_cvmseg_lines, + octeon_cvmseg_lines *128 );if (octeon_has_feature (OCTEON_FEATURE_FAU )) {union cvmx_iob_fau_timeout fau_timeout;
arch/mips/include/asm/mach-cavium-octeon/kernel-entry-init.h +12 -8
@@ -26,11 +26,18 @@# a3 = address of boot descriptor block .set push .set arch=octeon + mfc0 v1, CP0_PRID_REG + andi v1, 0xff00 + li v0, 0x9500 # cn78XX or later + subu v1, v1, v0 + li t2, 2 + CONFIG_CAVIUM_OCTEON_EXTRA_CVMSEG + bltz v1, 1f + addiu t2, 1 # t2 has cvmseg_size +1:# Read the cavium mem control register dmfc0 v0, CP0_CVMMEMCTL_REG# Clear the lower 6 bits, the CVMSEG size - dins v0, $0, 0, 6 - ori v0, CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE + dins v0, t2, 0, 6 dmtc0 v0, CP0_CVMMEMCTL_REG # Write the cavium mem control register dmfc0 v0, CP0_CVMCTL_REG # Read the cavium control register# Disable unaligned load/store support but leave HW fixup enabled
@@ -70,7 +77,7 @@# Flush dcache after config change cache 9, 0($0)# Zero all of CVMSEG to make sure parity is correct -dli v0,CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE +move v0, t2 dsll v0, 7 beqz v0, 2f 1: dsubu v0, 8
@@ -126,12 +133,7 @@ LONG_L sp, (t0)# Set the SP global variable to zero so the master knows we've started LONG_S zero, (t0) -#ifdef __OCTEON__ -syncw - syncw -#else sync -#endif # Jump to the normal Linux SMP entry pointj smp_bootstrap nop
@@ -148,6 +150,8 @@#endif /* CONFIG_SMP */ octeon_main_processor: +dla v0, octeon_cvmseg_lines + sw t2, 0(v0) .set pop .endm
arch/mips/include/asm/mipsregs.h +2 -0
@@ -1126,6 +1126,8 @@#define FPU_CSR_RD 0x3/* towards -Infinity */ +#define CAVIUM_OCTEON_SCRATCH_OFFSET (2 * 128 - 16 - 32768) +#ifndef __ASSEMBLY__/*
arch/mips/include/asm/octeon/octeon.h +2 -0
@@ -390,6 +390,8 @@ static inline uint32_t octeon_npi_read32(uint64_t address)extern struct cvmx_bootinfo *octeon_bootinfo; +extern u32 octeon_cvmseg_lines; +extern uint64_t octeon_bootloader_entry_addr;extern void (*octeon_irq_setup_secondary)(void );
arch/mips/include/asm/processor.h +1 -1
@@ -216,7 +216,7 @@ struct octeon_cop2_state { .cp2 = {0,},struct octeon_cvmseg_state { -unsigned long cvmseg[CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE ] +unsigned long cvmseg[CONFIG_CAVIUM_OCTEON_EXTRA_CVMSEG +3 ] [cpu_dcache_line_size () /sizeof (unsigned long )]; };
arch/mips/kernel/octeon_switch.S +0 -2
@@ -29,7 +29,6 @@ cpu_save_nonscratch a0 LONG_S ra, THREAD_REG31(a0) -#if CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE > 0 /* Check if we need to store CVMSEG state */ dmfc0 t0, $11,7 /* CvmMemCtl */ bbit0 t0, 6, 3f /* Is user access enabled? */
@@ -58,7 +57,6 @@ dmfc0 t0, $11,7 /* CvmMemCtl */ xori t0, t0, 0x40 /* Bit 6 is CVMSEG user enable */ dmtc0 t0, $11,7 /* CvmMemCtl */ -#endif 3: #if defined(CONFIG_CC_STACKPROTECTOR) && !defined(CONFIG_SMP)
arch/mips/mm/tlbex.c +7 -22
@@ -115,33 +115,17 @@ static int use_lwx_insns(void)return 0 ; } } -#if defined(CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE ) && \ -CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE >0 -static bool scratchpad_available (void ) -{ -return true; -} -static int scratchpad_offset (int i) -{ -/* -* CVMSEG starts at address -32768 and extends for -* CAVIUM_OCTEON_CVMSEG_SIZE 128 byte cache lines. -*/ - i +=1 ;/* Kernel use starts at the top and works down. */ -return CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE *128 - (8 * i) -32768 ; -} -#else -static bool scratchpad_available (void ) -{ -return false; -} +static int scratchpad_offset (int i) { +if (IS_ENABLED (CONFIG_CPU_CAVIUM_OCTEON )) +return (CAVIUM_OCTEON_SCRATCH_OFFSET - (8 * i)); +BUG ();/* Really unreachable, but evidently some GCC want this. */ return 0 ; } -#endif +/* * Found by experiment: At least some revisions of the 4kc throw under * some circumstances a machine check exception, triggered by invalid
@@ -1302,7 +1286,8 @@ static void build_r4000_tlb_refill_handler(void)memset (relocs,0 ,sizeof (relocs));memset (final_handler,0 ,sizeof (final_handler)); -if (IS_ENABLED (CONFIG_64BIT ) && (scratch_reg >=0 ||scratchpad_available ()) &&use_bbit_insns ()) { +if (IS_ENABLED (CONFIG_64BIT ) &&use_bbit_insns () && + (scratch_reg >=0 ||IS_ENABLED (CONFIG_CPU_CAVIUM_OCTEON ))) { htlb_info =build_fast_tlb_refill_handler (&p, &l, &r,K0 ,K1 , scratch_reg); vmalloc_mode = refill_scratch;
drivers/staging/octeon/ethernet-defines.h +1 -1
@@ -32,7 +32,7 @@#define REUSE_SKBUFFS_WITHOUT_FREE 1#endif -#define USE_ASYNC_IOBDMA (CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE > 0) +#define USE_ASYNC_IOBDMA 1/* Maximum number of SKBs to try to free per xmit packet. */ #define MAX_OUT_QUEUE_DEPTH 1000
Signature · 1 line
2.14.3
PATCH v5 6/7 netdev: octeon-ethernet: Add Cavium Octeon III support.
In reply to David DaneyFrom: Carlos Munoz <[email protected]>
The Cavium OCTEON cn78xx and cn73xx SoCs have network packet I/O hardware that is significantly different from previous generations of the family.
Add a new driver for this hardware. The Ethernet MAC is called BGX on these devices. Common code for the MAC is in octeon3-bgx-port.c. Four of these BGX MACs are grouped together and managed as a group by octeon3-bgx-nexus.c. Ingress packet classification is done by the PKI unit initialized in octeon3-pki.c. Queue management is done in the SSO, initialized by octeon3-sso.c. Egress is handled by the PKO, initialized in octeon3-pko.c.
--- drivers/net/ethernet/cavium/Kconfig | 55 +- drivers/net/ethernet/cavium/octeon/Makefile | 6 + .../net/ethernet/cavium/octeon/octeon3-bgx-nexus.c | 701 +++++++ .../net/ethernet/cavium/octeon/octeon3-bgx-port.c | 2015 +++++++++++++++++++ drivers/net/ethernet/cavium/octeon/octeon3-core.c | 2069 ++++++++++++++++++++ drivers/net/ethernet/cavium/octeon/octeon3-pki.c | 824 ++++++++ drivers/net/ethernet/cavium/octeon/octeon3-pko.c | 1688 ++++++++++++++++ drivers/net/ethernet/cavium/octeon/octeon3-sso.c | 301 +++ drivers/net/ethernet/cavium/octeon/octeon3.h | 418 ++++ 9 files changed, 8067 insertions(+), 10 deletions(-) create mode 100644 drivers/net/ethernet/cavium/octeon/octeon3-bgx-nexus.c create mode 100644 drivers/net/ethernet/cavium/octeon/octeon3-bgx-port.c create mode 100644 drivers/net/ethernet/cavium/octeon/octeon3-core.c create mode 100644 drivers/net/ethernet/cavium/octeon/octeon3-pki.c create mode 100644 drivers/net/ethernet/cavium/octeon/octeon3-pko.c create mode 100644 drivers/net/ethernet/cavium/octeon/octeon3-sso.c create mode 100644 drivers/net/ethernet/cavium/octeon/octeon3.h
drivers/net/ethernet/cavium/Kconfig +45 -10
@@ -4,7 +4,7 @@ config NET_VENDOR_CAVIUM bool "Cavium ethernet drivers" - depends on PCI + depends on PCI || CAVIUM_OCTEON_SOC default y ---help--- Select this option if you want enable Cavium network support.
@@ -13,6 +13,12 @@ config NET_VENDOR_CAVIUM if NET_VENDOR_CAVIUM +# +# The Thunder* and LiquidIO drivers require PCI. +# + +if PCI + config THUNDER_NIC_PF tristate "Thunder Physical function driver" depends on 64BIT
@@ -64,6 +70,20 @@ config LIQUIDIO To compile this driver as a module, choose M here: the module will be called liquidio. This is recommended. +config LIQUIDIO_VF + tristate "Cavium LiquidIO VF support" + depends on 64BIT && PCI_MSI + imply PTP_1588_CLOCK + ---help--- + This driver supports Cavium LiquidIO Intelligent Server Adapter + based on CN23XX chips. + + To compile this driver as a module, choose M here: The module + will be called liquidio_vf. MSI-X interrupt support is required + for this driver to work correctly + +endif # PCI + config OCTEON_MGMT_ETHERNET tristate "Octeon Management port ethernet driver (CN5XXX, CN6XXX)" depends on CAVIUM_OCTEON_SOC
@@ -75,16 +95,31 @@ config OCTEON_MGMT_ETHERNET port on Cavium Networks' Octeon CN57XX, CN56XX, CN55XX, CN54XX, CN52XX, and CN6XXX chips. -config LIQUIDIO_VF - tristate "Cavium LiquidIO VF support" - depends on 64BIT && PCI_MSI - imply PTP_1588_CLOCK +config OCTEON3_BGX_NEXUS + tristate + depends on CAVIUM_OCTEON_SOC + +config OCTEON3_BGX_PORT + tristate "Cavium OCTEON-III BGX port support" + depends on CAVIUM_OCTEON_SOC + select OCTEON3_BGX_NEXUS ---help--- - This driver supports Cavium LiquidIO Intelligent Server Adapter - based on CN23XX chips. + Enable the driver for Cavium Octeon III BGX ports. BGX ports + support sgmii, rgmii, xaui, rxaui, xlaui, xfi, 10KR and 40KR modes. - To compile this driver as a module, choose M here: The module - will be called liquidio_vf. MSI-X interrupt support is required - for this driver to work correctly + Say Y for support of any Octeon III SoC Ethernet port. + +config OCTEON3_ETHERNET + tristate "Cavium OCTEON-III PKI/PKO Ethernet support" + depends on CAVIUM_OCTEON_SOC + select OCTEON_BGX_PORT + select OCTEON_FPA3 + select FW_LOADER + ---help--- + Enable the driver for Cavium Octeon III Ethernet via PKI/PKO + units. No support for cn70xx chips (use OCTEON_ETHERNET for + cn70xx). + + Say Y for support of any Octeon III SoC Ethernet port. endif # NET_VENDOR_CAVIUM
drivers/net/ethernet/cavium/octeon/Makefile +6 -0
@@ -3,3 +3,9 @@ # obj-$(CONFIG_OCTEON_MGMT_ETHERNET) += octeon_mgmt.o +obj-$(CONFIG_OCTEON3_BGX_PORT) += octeon3-bgx-port.o +obj-$(CONFIG_OCTEON3_BGX_NEXUS) += octeon3-bgx-nexus.o +obj-$(CONFIG_OCTEON3_ETHERNET) += octeon3-ethernet.o + +octeon3-ethernet-objs += octeon3-core.o octeon3-pki.o octeon3-sso.o \ + octeon3-pko.o
drivers/net/ethernet/cavium/octeon/octeon3-bgx-nexus.c new file +701 -0
701 lines not on this page · raw message
drivers/net/ethernet/cavium/octeon/octeon3-bgx-port.c new file +2015 -0
2,015 lines not on this page · raw message
drivers/net/ethernet/cavium/octeon/octeon3-core.c new file +2069 -0
195 lines not on this page · raw message
drivers/net/ethernet/cavium/octeon/octeon3-pki.c new file +824 -0
824 lines not on this page · raw message
drivers/net/ethernet/cavium/octeon/octeon3-pko.c new file +1688 -0
1,688 lines not on this page · raw message
drivers/net/ethernet/cavium/octeon/octeon3-sso.c new file +301 -0
301 lines not on this page · raw message
drivers/net/ethernet/cavium/octeon/octeon3.h new file +418 -0
418 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.14.3
Part of the diff is not shown here. View the raw message.
David Miller
maintainerRe: [PATCH v5 net-next,mips 6/7] netdev: octeon-ethernet: Add Cavium Octeon III support.
From: David Daney <david.daney-YGCgFSpz5w/[email protected]>
Date: Fri, 1 Dec 2017 15:18:06 -0800
drivers/net/ethernet/cavium/octeon/octeon3-bgx-nexus.c line 28
Quoted 7 lines
drivers/net/ethernet/cavium/octeon/octeon3-bgx-nexus.c new file +7
-0+static char *mix_port; +module_param (mix_port, charp,0444 ); +MODULE_PARM_DESC (mix_port,"Specifies which ports connect to MIX interfaces." ); + +static char *pki_port; +module_param (pki_port, charp,0444 ); +MODULE_PARM_DESC (pki_port,"Specifies which ports connect to the PKI." );
Please no module parameters.
Please instead find a way to determine or configure these elements at run time with generic configuration interfaces.
Quoted 5 lines
drivers/net/ethernet/cavium/octeon/octeon3-bgx-nexus.c new file +5
-0+ +static int bgx_probe (struct platform_device *pdev) +{ +struct mac_platform_data platform_data; +const __be32 *reg;
drivers/net/ethernet/cavium/octeon/octeon3-bgx-nexus.c line 126
Quoted 10 lines
drivers/net/ethernet/cavium/octeon/octeon3-bgx-nexus.c new file +10
-0+u32 port; +u64 addr; +struct device_node *child; +struct platform_device *new_dev; +struct platform_device *pki_dev; +int numa_node, interface; +int i; +int r =0 ; +char id[64 ]; +u64 data;
Please use reverse-christmas-tree ordering (longest to shortest line) for local variable declarations.
Please fix this in your entire submission.
drivers/net/ethernet/cavium/octeon/octeon3-bgx-nexus.c line 253
Quoted 6 lines
drivers/net/ethernet/cavium/octeon/octeon3-bgx-nexus.c new file +6
-0+static int bgx_mix_init_from_fdt (void ) +{ +struct device_node *node; +struct device_node *parent =NULL ; +int mix =0 ; +
Please do not use tabs like this when declaring local variables. Much worse, some functions use this style whereas others do not, be consistent otherwise your code is very hard to read.
Please fix this for your entire submission not just this specific case I am pointing out.
Thanks.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v5 7/7 MAINTAINERS: Add entry for drivers/net/ethernet/cavium/octeon/octeon3-*
In reply to David Daney--- MAINTAINERS | 6 ++++++ 1 file changed, 6 insertions(+)
MAINTAINERS +6 -0
@@ -3249,6 +3249,12 @@ W: http://www.cavium.com S: Supported F: drivers/mmc/host/cavium* +CAVIUM OCTEON-III NETWORK DRIVER +M: David Daney <[email protected]> +L: [email protected] +S: Supported +F: drivers/net/ethernet/cavium/octeon/octeon3-* + CAVIUM OCTEON-TX CRYPTO DRIVER M: George Cherian <[email protected]> L: [email protected]
Signature · 1 line
2.14.3