Prerequisites for Cavium OCTEON-III network driver.
Subsystems (4)
v8 cover Prerequisites for Cavium OCTEON-III network driver.
We want to add 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? These are the prerequisite patches that are needed before the network driver can be merged.
Changes in v8:
o Rebased to v4.16-rc2
Changes in v7:
o Splitting of the patch set only. These 4 mips patches are unchanged from the previous posting.
Changes in v6:
o Added back cleanup patch for previous generation SoC "staging" driver, as Greg K-H acked it.
o Moved FPA driver to drivers/net/ethernet/cavium/octeon as it is currently only used by the octeon3-ethernet driver.
o Many code formatting fixes as noted by davem.
Changes in v5:
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 in v4:
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 in v3:
o Fix PKI (RX path) initialization to work with little endian kernel.
Changes in v2:
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 (2):
MIPS: Octeon: Enable LMTDMA/LMTST operations.
MIPS: Octeon: Add a global resource manager.
David Daney (2):
MIPS: Octeon: Automatically provision CVMSEG space.
staging: octeon: Remove USE_ASYNC_IOBDMA macro.
arch/mips/cavium-octeon/Kconfig | 27 +- arch/mips/cavium-octeon/Makefile | 1 + 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 | 32 +- 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 | 6 - drivers/staging/octeon/ethernet-rx.c | 25 +- drivers/staging/octeon/ethernet-tx.c | 85 ++--- 13 files changed, 472 insertions(+), 132 deletions(-) create mode 100644 arch/mips/cavium-octeon/resource-mgr.c
Signature · 1 line
2.14.3
PATCH v8 1/4 MIPS: Octeon: Enable LMTDMA/LMTST operations.
From: 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 v8 2/4 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
@@ -359,6 +359,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
@@ -29,7 +29,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
Re: [PATCH v8 2/4] MIPS: Octeon: Automatically provision CVMSEG space.
arch/mips/cavium-octeon/Kconfig config CAVIUM_CN63XXP1 · line 15
Quoted 10 lines · David Daney
arch/mips/cavium-octeon/Kconfig +0
-2@@ -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"
This is set to 2 in cavium_octeon_defconfig, which can now be removed (I presume the default of 0 for CAVIUM_OCTEON_EXTRA_CVMSEG is sufficient).
Quoted 5 lines
arch/mips/include/asm/mach-cavium-octeon/kernel-entry-init.h +0
-0
arch/mips/include/asm/mach-cavium-octeon/kernel-entry-init.h line 35
Quoted 10 lines
arch/mips/include/asm/mach-cavium-octeon/kernel-entry-init.h +7
-0@@ -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
It'd be nice to clean up this PRID code one day to use the defines in <asm/mipsregs.h> and <asm/cpu.h>. This is consistent with whats already here though so it can be done later.
Quoted 20 lines
arch/mips/include/asm/mach-cavium-octeon/kernel-entry-init.h +3
-3+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
arch/mips/include/asm/mach-cavium-octeon/kernel-entry-init.h line 132
Quoted 7 lines
arch/mips/include/asm/mach-cavium-octeon/kernel-entry-init.h +0
-4@@ -126,12 +133,7 @@ LONG_L sp, (t0)# Set the SP global variable to zero so the master knows we've startedLONG_S zero, (t0) -#ifdef __OCTEON__ -syncw - syncw -#else
Is this directly related? I don't think I saw it mentioned anywhere.
arch/mips/include/asm/mach-cavium-octeon/kernel-entry-init.h line 154
Quoted 11 lines
arch/mips/include/asm/mach-cavium-octeon/kernel-entry-init.h +2
-1sync -#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)
You would get something equivalent (and slightly more efficient but using $at) with this?
sw t2, octeon_cvmseg_lines
I.e.
lui v0,0x8190 -> lui at,0x8190 daddiu v0,v0,-19688 -> sw t2,0(v0) -> sw t2,-19688(at)
arch/mips/include/asm/mipsregs.h line 1129
Quoted 9 lines
arch/mips/include/asm/mipsregs.h +1
-0@@ -1126,6 +1126,8 @@#define FPU_CSR_RD 0x3/* towards -Infinity */ +#define CAVIUM_OCTEON_SCRATCH_OFFSET (2 * 128 - 16 - 32768)
This feels a bit out of place, since its effectively cavium specific memory mapped scratch register addresses. Would tlbex.h or octeon.h be more appropriate, or even tlbex.c if it isn't used elsewhere?
Otherwise this patch looks reasonable I think.
Cheers
James
PATCH v8 3/4 staging: octeon: Remove USE_ASYNC_IOBDMA macro.
In reply to David DaneyPrevious patch sets USE_ASYNC_IOBDMA to 1 unconditionally. Remove USE_ASYNC_IOBDMA from all if statements. Remove dead code caused by the change.
--- drivers/staging/octeon/ethernet-defines.h | 6 --- drivers/staging/octeon/ethernet-rx.c | 25 ++++----- drivers/staging/octeon/ethernet-tx.c | 85 ++++++++++--------------------- 3 files changed, 37 insertions(+), 79 deletions(-)
drivers/staging/octeon/ethernet-defines.h +0 -6
@@ -7,10 +7,6 @@/* * A few defines are used to control the operation of this driver: -* USE_ASYNC_IOBDMA -* Use asynchronous IO access to hardware. This uses Octeon's asynchronous -* IOBDMAs to issue IO accesses without stalling. Set this to zero -* to disable this. Note that IOBDMAs require CVMSEG. * REUSE_SKBUFFS_WITHOUT_FREE * Allows the TX path to free an skbuff into the FPA hardware pool. This * can significantly improve performance for forwarding and bridging, but
@@ -29,8 +25,6 @@#define REUSE_SKBUFFS_WITHOUT_FREE 1#endif -#define USE_ASYNC_IOBDMA 1 -/* Maximum number of SKBs to try to free per xmit packet. */ #define MAX_OUT_QUEUE_DEPTH 1000
drivers/staging/octeon/ethernet-rx.c +10 -15
@@ -198,11 +198,9 @@ static int cvm_oct_poll(struct oct_rx_group *rx_group, int budget)/* Prefetch cvm_oct_device since we know we need it soon */ prefetch (cvm_oct_device); -if (USE_ASYNC_IOBDMA ) { -/* Save scratch in case userspace is using it */ -CVMX_SYNCIOBDMA ; - old_scratch =cvmx_scratch_read64 (CVMX_SCR_SCRATCH ); - } +/* Save scratch in case userspace is using it */ +CVMX_SYNCIOBDMA ; + old_scratch =cvmx_scratch_read64 (CVMX_SCR_SCRATCH );/* Only allow work for our group (and preserve priorities) */ if (OCTEON_IS_MODEL (OCTEON_CN68XX )) {
@@ -217,10 +215,8 @@ static int cvm_oct_poll(struct oct_rx_group *rx_group, int budget) BIT(rx_group->group)); } -if (USE_ASYNC_IOBDMA ) { -cvmx_pow_work_request_async (CVMX_SCR_SCRATCH ,CVMX_POW_NO_WAIT ); - did_work_request =1 ; - } +cvmx_pow_work_request_async (CVMX_SCR_SCRATCH ,CVMX_POW_NO_WAIT ); + did_work_request =1 ;while (rx_count < budget) {struct sk_buff *skb =NULL ;
@@ -229,7 +225,7 @@ static int cvm_oct_poll(struct oct_rx_group *rx_group, int budget)cvmx_wqe_t *work;int port; -if (USE_ASYNC_IOBDMA && did_work_request) +if (did_work_request) work =cvmx_pow_work_response_async (CVMX_SCR_SCRATCH );else work =cvmx_pow_work_request_sync (CVMX_POW_NO_WAIT );
@@ -257,7 +253,7 @@ static int cvm_oct_poll(struct oct_rx_group *rx_group, int budget) sizeof(void *));prefetch (pskb); -if (USE_ASYNC_IOBDMA && rx_count < (budget -1 )) { +if (rx_count < (budget -1 )) {cvmx_pow_work_request_async_nocheck (CVMX_SCR_SCRATCH ,CVMX_POW_NO_WAIT ); did_work_request =1 ;
@@ -400,10 +396,9 @@ static int cvm_oct_poll(struct oct_rx_group *rx_group, int budget)cvmx_write_csr (CVMX_POW_PP_GRP_MSKX (coreid), old_group_mask); } -if (USE_ASYNC_IOBDMA ) { -/* Restore the scratch area */ -cvmx_scratch_write64 (CVMX_SCR_SCRATCH , old_scratch); - } +/* Restore the scratch area */ +cvmx_scratch_write64 (CVMX_SCR_SCRATCH , old_scratch); +cvm_oct_rx_refill_pool (0 );return rx_count;
drivers/staging/octeon/ethernet-tx.c +27 -58
115 lines not on this page · raw message
Signature · 1 line
2.14.3
PATCH v8 4/4 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
Re: [PATCH v8 4/4] MIPS: Octeon: Add a global resource manager.
Quoted 9 lines · David Daney
From: 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.
Signed-off-by Carlos Munoz <[email protected]>Signed-off-by Steven J. Hill <[email protected]>Signed-off-by David Daney <[email protected]>
Cheers
James