linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/14] MIPS/staging: OCTEON: enable ethernet/xaui on CN68XX
@ 2015-08-13 13:21 Aaro Koskinen
  2015-08-13 13:21 ` [PATCH 01/14] MIPS: OCTEON: fix CN6880 hang on XAUI init Aaro Koskinen
                   ` (14 more replies)
  0 siblings, 15 replies; 21+ messages in thread
From: Aaro Koskinen @ 2015-08-13 13:21 UTC (permalink / raw)
  To: Ralf Baechle, David Daney, linux-mips
  Cc: Janne Huttunen, Aaro Koskinen, Greg Kroah-Hartman, devel

Hi,

Currently mainline Linux is unusable on OCTEON II CN68XX SOCs due to
issues in Ethernet driver initialization. Some boards are hanging during
init, and all the needed register differences compared to the older SOCs
are not taken into account to make interrupts and packet delivery to work.

This patch set provides a minimal support to get octeon-ethernet going
on CN68XX. Tested on top of 4.2-rc6 with Cavium EBB6800 and Kontron
S1901 boards by sending traffic over XAUI interface with busybox.

A.

Aaro Koskinen (2):
  MIPS/staging: OCTEON: properly enable/disable SSO WQE interrupts
  MIPS/staging: OCTEON: set SSO group mask properly on CN68XX

Janne Huttunen (12):
  MIPS: OCTEON: fix CN6880 hang on XAUI init
  MIPS: OCTEON: support additional interfaces on CN68XX
  MIPS: OCTEON: support all PIP input ports on CN68XX
  MIPS: OCTEON: configure XAUI pkinds
  MIPS: OCTEON: configure minimum PKO packet sizes on CN68XX
  MIPS: OCTEON: add definitions for setting up SSO
  MIPS/staging: OCTEON: increase output command buffers
  MIPS/staging: OCTEON: support CN68XX style WQE
  MIPS: OCTEON: initialize CN68XX PKO
  MIPS: OCTEON: set up 1:1 mapping between CN68XX PKO queues and ports
  MIPS: OCTEON: support interfaces 4 and 5
  MIPS/staging: OCTEON: use common helpers for determining interface and
    port

 .../cavium-octeon/executive/cvmx-helper-util.c     |  20 +-
 .../cavium-octeon/executive/cvmx-helper-xaui.c     |  14 +-
 arch/mips/cavium-octeon/executive/cvmx-helper.c    |  17 ++
 arch/mips/cavium-octeon/executive/cvmx-pko.c       | 149 +++++++++-
 arch/mips/include/asm/octeon/cvmx-pip.h            |   2 +-
 arch/mips/include/asm/octeon/cvmx-pko.h            |   3 +
 arch/mips/include/asm/octeon/cvmx-pow-defs.h       |  29 ++
 arch/mips/include/asm/octeon/cvmx-pow.h            |   9 +-
 arch/mips/include/asm/octeon/cvmx-wqe.h            | 308 +++++++++++++++++----
 drivers/staging/octeon/ethernet-rx.c               | 133 ++++++---
 drivers/staging/octeon/ethernet-tx.c               |  19 +-
 drivers/staging/octeon/ethernet-util.h             |  22 +-
 drivers/staging/octeon/ethernet.c                  |   7 +-
 13 files changed, 595 insertions(+), 137 deletions(-)

-- 
2.4.3

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 01/14] MIPS: OCTEON: fix CN6880 hang on XAUI init
  2015-08-13 13:21 [PATCH 00/14] MIPS/staging: OCTEON: enable ethernet/xaui on CN68XX Aaro Koskinen
@ 2015-08-13 13:21 ` Aaro Koskinen
  2015-08-13 13:21 ` [PATCH 02/14] MIPS: OCTEON: support additional interfaces on CN68XX Aaro Koskinen
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 21+ messages in thread
From: Aaro Koskinen @ 2015-08-13 13:21 UTC (permalink / raw)
  To: Ralf Baechle, David Daney, linux-mips
  Cc: Janne Huttunen, Aaro Koskinen, Greg Kroah-Hartman, devel

From: Janne Huttunen <janne.huttunen@nokia.com>

Some CN68XX series Octeon II chips seem to hang if a reset is issued on
XAUI initialization. Avoid the hang by disabling the reset on affected
models. Tested on Cavium EBB6800 evaluation board and Kontron S1901 board.

Signed-off-by: Janne Huttunen <janne.huttunen@nokia.com>
Signed-off-by: Aaro Koskinen <aaro.koskinen@nokia.com>
---
 arch/mips/cavium-octeon/executive/cvmx-helper-xaui.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/arch/mips/cavium-octeon/executive/cvmx-helper-xaui.c b/arch/mips/cavium-octeon/executive/cvmx-helper-xaui.c
index 7653b7e..323a784 100644
--- a/arch/mips/cavium-octeon/executive/cvmx-helper-xaui.c
+++ b/arch/mips/cavium-octeon/executive/cvmx-helper-xaui.c
@@ -151,7 +151,12 @@ int __cvmx_helper_xaui_enable(int interface)
 	/* (4)c Aply reset sequence */
 	xauiCtl.u64 = cvmx_read_csr(CVMX_PCSXX_CONTROL1_REG(interface));
 	xauiCtl.s.lo_pwr = 0;
-	xauiCtl.s.reset = 1;
+
+	/* Issuing a reset here seems to hang some CN68XX chips. */
+	if (!OCTEON_IS_MODEL(OCTEON_CN68XX_PASS1_X) &&
+	    !OCTEON_IS_MODEL(OCTEON_CN68XX_PASS2_X))
+		xauiCtl.s.reset = 1;
+
 	cvmx_write_csr(CVMX_PCSXX_CONTROL1_REG(interface), xauiCtl.u64);
 
 	/* Wait for PCS to come out of reset */
-- 
2.4.3

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 02/14] MIPS: OCTEON: support additional interfaces on CN68XX
  2015-08-13 13:21 [PATCH 00/14] MIPS/staging: OCTEON: enable ethernet/xaui on CN68XX Aaro Koskinen
  2015-08-13 13:21 ` [PATCH 01/14] MIPS: OCTEON: fix CN6880 hang on XAUI init Aaro Koskinen
@ 2015-08-13 13:21 ` Aaro Koskinen
  2015-08-13 13:21 ` [PATCH 03/14] MIPS: OCTEON: support all PIP input ports " Aaro Koskinen
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 21+ messages in thread
From: Aaro Koskinen @ 2015-08-13 13:21 UTC (permalink / raw)
  To: Ralf Baechle, David Daney, linux-mips
  Cc: Janne Huttunen, Aaro Koskinen, Greg Kroah-Hartman, devel

From: Janne Huttunen <janne.huttunen@nokia.com>

CN68XX has 9 interfaces.

Signed-off-by: Janne Huttunen <janne.huttunen@nokia.com>
Signed-off-by: Aaro Koskinen <aaro.koskinen@nokia.com>
---
 arch/mips/cavium-octeon/executive/cvmx-helper.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/mips/cavium-octeon/executive/cvmx-helper.c b/arch/mips/cavium-octeon/executive/cvmx-helper.c
index 7e5cf7a..ed4816c2 100644
--- a/arch/mips/cavium-octeon/executive/cvmx-helper.c
+++ b/arch/mips/cavium-octeon/executive/cvmx-helper.c
@@ -83,6 +83,8 @@ static cvmx_helper_link_info_t
  */
 int cvmx_helper_get_number_of_interfaces(void)
 {
+	if (OCTEON_IS_MODEL(OCTEON_CN68XX))
+		return 9;
 	if (OCTEON_IS_MODEL(OCTEON_CN56XX) || OCTEON_IS_MODEL(OCTEON_CN52XX))
 		return 4;
 	else
-- 
2.4.3

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 03/14] MIPS: OCTEON: support all PIP input ports on CN68XX
  2015-08-13 13:21 [PATCH 00/14] MIPS/staging: OCTEON: enable ethernet/xaui on CN68XX Aaro Koskinen
  2015-08-13 13:21 ` [PATCH 01/14] MIPS: OCTEON: fix CN6880 hang on XAUI init Aaro Koskinen
  2015-08-13 13:21 ` [PATCH 02/14] MIPS: OCTEON: support additional interfaces on CN68XX Aaro Koskinen
@ 2015-08-13 13:21 ` Aaro Koskinen
  2015-08-13 13:21 ` [PATCH 04/14] MIPS: OCTEON: configure XAUI pkinds Aaro Koskinen
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 21+ messages in thread
From: Aaro Koskinen @ 2015-08-13 13:21 UTC (permalink / raw)
  To: Ralf Baechle, David Daney, linux-mips
  Cc: Janne Huttunen, Aaro Koskinen, Greg Kroah-Hartman, devel

From: Janne Huttunen <janne.huttunen@nokia.com>

CN68XX has 48 PIP input ports.

Signed-off-by: Janne Huttunen <janne.huttunen@nokia.com>
Signed-off-by: Aaro Koskinen <aaro.koskinen@nokia.com>
---
 arch/mips/include/asm/octeon/cvmx-pip.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/include/asm/octeon/cvmx-pip.h b/arch/mips/include/asm/octeon/cvmx-pip.h
index df69bfd..c210154 100644
--- a/arch/mips/include/asm/octeon/cvmx-pip.h
+++ b/arch/mips/include/asm/octeon/cvmx-pip.h
@@ -37,7 +37,7 @@
 #include <asm/octeon/cvmx-fpa.h>
 #include <asm/octeon/cvmx-pip-defs.h>
 
-#define CVMX_PIP_NUM_INPUT_PORTS		40
+#define CVMX_PIP_NUM_INPUT_PORTS		48
 #define CVMX_PIP_NUM_WATCHERS			4
 
 /*
-- 
2.4.3

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 04/14] MIPS: OCTEON: configure XAUI pkinds
  2015-08-13 13:21 [PATCH 00/14] MIPS/staging: OCTEON: enable ethernet/xaui on CN68XX Aaro Koskinen
                   ` (2 preceding siblings ...)
  2015-08-13 13:21 ` [PATCH 03/14] MIPS: OCTEON: support all PIP input ports " Aaro Koskinen
@ 2015-08-13 13:21 ` Aaro Koskinen
  2015-08-13 13:21 ` [PATCH 05/14] MIPS: OCTEON: configure minimum PKO packet sizes on CN68XX Aaro Koskinen
                   ` (10 subsequent siblings)
  14 siblings, 0 replies; 21+ messages in thread
From: Aaro Koskinen @ 2015-08-13 13:21 UTC (permalink / raw)
  To: Ralf Baechle, David Daney, linux-mips
  Cc: Janne Huttunen, Aaro Koskinen, Greg Kroah-Hartman, devel

From: Janne Huttunen <janne.huttunen@nokia.com>

Configure the pkinds of XAUI interfaces on Octeon models that have
them. This simple configuration uses 1:1 mapping between the PIP input
port number and the selected pkind.

Signed-off-by: Janne Huttunen <janne.huttunen@nokia.com>
Signed-off-by: Aaro Koskinen <aaro.koskinen@nokia.com>
---
 arch/mips/cavium-octeon/executive/cvmx-helper-xaui.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/mips/cavium-octeon/executive/cvmx-helper-xaui.c b/arch/mips/cavium-octeon/executive/cvmx-helper-xaui.c
index 323a784..a56ee59 100644
--- a/arch/mips/cavium-octeon/executive/cvmx-helper-xaui.c
+++ b/arch/mips/cavium-octeon/executive/cvmx-helper-xaui.c
@@ -124,6 +124,13 @@ int __cvmx_helper_xaui_enable(int interface)
 	union cvmx_gmxx_tx_int_en gmx_tx_int_en;
 	union cvmx_pcsxx_int_en_reg pcsx_int_en_reg;
 
+	/* Setup PKND */
+	if (octeon_has_feature(OCTEON_FEATURE_PKND)) {
+		gmx_cfg.u64 = cvmx_read_csr(CVMX_GMXX_PRTX_CFG(0, interface));
+		gmx_cfg.s.pknd = cvmx_helper_get_ipd_port(interface, 0);
+		cvmx_write_csr(CVMX_GMXX_PRTX_CFG(0, interface), gmx_cfg.u64);
+	}
+
 	/* (1) Interface has already been enabled. */
 
 	/* (2) Disable GMX. */
-- 
2.4.3

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 05/14] MIPS: OCTEON: configure minimum PKO packet sizes on CN68XX
  2015-08-13 13:21 [PATCH 00/14] MIPS/staging: OCTEON: enable ethernet/xaui on CN68XX Aaro Koskinen
                   ` (3 preceding siblings ...)
  2015-08-13 13:21 ` [PATCH 04/14] MIPS: OCTEON: configure XAUI pkinds Aaro Koskinen
@ 2015-08-13 13:21 ` Aaro Koskinen
  2015-08-13 13:21 ` [PATCH 06/14] MIPS: OCTEON: add definitions for setting up SSO Aaro Koskinen
                   ` (9 subsequent siblings)
  14 siblings, 0 replies; 21+ messages in thread
From: Aaro Koskinen @ 2015-08-13 13:21 UTC (permalink / raw)
  To: Ralf Baechle, David Daney, linux-mips
  Cc: Janne Huttunen, Aaro Koskinen, Greg Kroah-Hartman, devel

From: Janne Huttunen <janne.huttunen@nokia.com>

CN68XX has common minimum packet size filters that need to be configured
for the traffic to work. Just set them to a default value.

Signed-off-by: Janne Huttunen <janne.huttunen@nokia.com>
Signed-off-by: Aaro Koskinen <aaro.koskinen@nokia.com>
---
 arch/mips/cavium-octeon/executive/cvmx-helper.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/arch/mips/cavium-octeon/executive/cvmx-helper.c b/arch/mips/cavium-octeon/executive/cvmx-helper.c
index ed4816c2..376701f 100644
--- a/arch/mips/cavium-octeon/executive/cvmx-helper.c
+++ b/arch/mips/cavium-octeon/executive/cvmx-helper.c
@@ -658,6 +658,21 @@ static int __cvmx_helper_global_setup_pko(void)
 	fau_to.s.tout_val = 0xfff;
 	fau_to.s.tout_enb = 0;
 	cvmx_write_csr(CVMX_IOB_FAU_TIMEOUT, fau_to.u64);
+
+	if (OCTEON_IS_MODEL(OCTEON_CN68XX)) {
+		union cvmx_pko_reg_min_pkt min_pkt;
+
+		min_pkt.u64 = 0;
+		min_pkt.s.size1 = 59;
+		min_pkt.s.size2 = 59;
+		min_pkt.s.size3 = 59;
+		min_pkt.s.size4 = 59;
+		min_pkt.s.size5 = 59;
+		min_pkt.s.size6 = 59;
+		min_pkt.s.size7 = 59;
+		cvmx_write_csr(CVMX_PKO_REG_MIN_PKT, min_pkt.u64);
+	}
+
 	return 0;
 }
 
-- 
2.4.3

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 06/14] MIPS: OCTEON: add definitions for setting up SSO
  2015-08-13 13:21 [PATCH 00/14] MIPS/staging: OCTEON: enable ethernet/xaui on CN68XX Aaro Koskinen
                   ` (4 preceding siblings ...)
  2015-08-13 13:21 ` [PATCH 05/14] MIPS: OCTEON: configure minimum PKO packet sizes on CN68XX Aaro Koskinen
@ 2015-08-13 13:21 ` Aaro Koskinen
  2015-08-13 13:21 ` [PATCH 07/14] MIPS/staging: OCTEON: properly enable/disable SSO WQE interrupts Aaro Koskinen
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 21+ messages in thread
From: Aaro Koskinen @ 2015-08-13 13:21 UTC (permalink / raw)
  To: Ralf Baechle, David Daney, linux-mips
  Cc: Janne Huttunen, Aaro Koskinen, Greg Kroah-Hartman, devel

From: Janne Huttunen <janne.huttunen@nokia.com>

Some Octeon II models have SSO instead of POW and use a different register
for setting the interrupt thresholds. Add the necessary definitions for
configuring the interrupts also on those models.

Signed-off-by: Janne Huttunen <janne.huttunen@nokia.com>
Signed-off-by: Aaro Koskinen <aaro.koskinen@nokia.com>
---
 arch/mips/include/asm/octeon/cvmx-pow-defs.h | 29 ++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/arch/mips/include/asm/octeon/cvmx-pow-defs.h b/arch/mips/include/asm/octeon/cvmx-pow-defs.h
index 9020ef4..6a3db4b 100644
--- a/arch/mips/include/asm/octeon/cvmx-pow-defs.h
+++ b/arch/mips/include/asm/octeon/cvmx-pow-defs.h
@@ -52,6 +52,12 @@
 #define CVMX_POW_WQ_INT_THRX(offset) (CVMX_ADD_IO_SEG(0x0001670000000080ull) + ((offset) & 15) * 8)
 #define CVMX_POW_WS_PCX(offset) (CVMX_ADD_IO_SEG(0x0001670000000280ull) + ((offset) & 15) * 8)
 
+#define CVMX_SSO_WQ_INT (CVMX_ADD_IO_SEG(0x0001670000001000ull))
+#define CVMX_SSO_WQ_IQ_DIS (CVMX_ADD_IO_SEG(0x0001670000001010ull))
+#define CVMX_SSO_WQ_INT_PC (CVMX_ADD_IO_SEG(0x0001670000001020ull))
+#define CVMX_SSO_PPX_GRP_MSK(offset) (CVMX_ADD_IO_SEG(0x0001670000006000ull) + ((offset) & 31) * 8)
+#define CVMX_SSO_WQ_INT_THRX(offset) (CVMX_ADD_IO_SEG(0x0001670000007000ull) + ((offset) & 63) * 8)
+
 union cvmx_pow_bist_stat {
 	uint64_t u64;
 	struct cvmx_pow_bist_stat_s {
@@ -1286,4 +1292,27 @@ union cvmx_pow_ws_pcx {
 	struct cvmx_pow_ws_pcx_s cnf71xx;
 };
 
+union cvmx_sso_wq_int_thrx {
+	uint64_t u64;
+	struct {
+#ifdef __BIG_ENDIAN_BITFIELD
+		uint64_t reserved_33_63:31;
+		uint64_t tc_en:1;
+		uint64_t tc_thr:4;
+		uint64_t reserved_26_27:2;
+		uint64_t ds_thr:12;
+		uint64_t reserved_12_13:2;
+		uint64_t iq_thr:12;
+#else
+		uint64_t iq_thr:12;
+		uint64_t reserved_12_13:2;
+		uint64_t ds_thr:12;
+		uint64_t reserved_26_27:2;
+		uint64_t tc_thr:4;
+		uint64_t tc_en:1;
+		uint64_t reserved_33_63:31;
+#endif
+	} s;
+};
+
 #endif
-- 
2.4.3

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 07/14] MIPS/staging: OCTEON: properly enable/disable SSO WQE interrupts
  2015-08-13 13:21 [PATCH 00/14] MIPS/staging: OCTEON: enable ethernet/xaui on CN68XX Aaro Koskinen
                   ` (5 preceding siblings ...)
  2015-08-13 13:21 ` [PATCH 06/14] MIPS: OCTEON: add definitions for setting up SSO Aaro Koskinen
@ 2015-08-13 13:21 ` Aaro Koskinen
  2015-08-13 13:21 ` [PATCH 08/14] MIPS/staging: OCTEON: set SSO group mask properly on CN68XX Aaro Koskinen
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 21+ messages in thread
From: Aaro Koskinen @ 2015-08-13 13:21 UTC (permalink / raw)
  To: Ralf Baechle, David Daney, linux-mips
  Cc: Janne Huttunen, Aaro Koskinen, Greg Kroah-Hartman, devel

The Octeon models with SSO instead of POW need to use a different register
for configuring the WQE interrupt thresholds.

Signed-off-by: Aaro Koskinen <aaro.koskinen@nokia.com>
---
 drivers/staging/octeon/ethernet-rx.c | 54 ++++++++++++++++++++++++++----------
 drivers/staging/octeon/ethernet.c    |  5 +++-
 2 files changed, 43 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/octeon/ethernet-rx.c b/drivers/staging/octeon/ethernet-rx.c
index 22853d3..1636bd9 100644
--- a/drivers/staging/octeon/ethernet-rx.c
+++ b/drivers/staging/octeon/ethernet-rx.c
@@ -195,12 +195,19 @@ static int cvm_oct_napi_poll(struct napi_struct *napi, int budget)
 		prefetch(work);
 		did_work_request = 0;
 		if (work == NULL) {
-			union cvmx_pow_wq_int wq_int;
+			if (OCTEON_IS_MODEL(OCTEON_CN68XX)) {
+				cvmx_write_csr(CVMX_SSO_WQ_IQ_DIS,
+					       1ull << pow_receive_group);
+				cvmx_write_csr(CVMX_SSO_WQ_INT,
+					       1ull << pow_receive_group);
+			} else {
+				union cvmx_pow_wq_int wq_int;
 
-			wq_int.u64 = 0;
-			wq_int.s.iq_dis = 1 << pow_receive_group;
-			wq_int.s.wq_int = 1 << pow_receive_group;
-			cvmx_write_csr(CVMX_POW_WQ_INT, wq_int.u64);
+				wq_int.u64 = 0;
+				wq_int.s.iq_dis = 1 << pow_receive_group;
+				wq_int.s.wq_int = 1 << pow_receive_group;
+				cvmx_write_csr(CVMX_POW_WQ_INT, wq_int.u64);
+			}
 			break;
 		}
 		pskb = (struct sk_buff **)(cvm_oct_get_buffer_ptr(work->packet_ptr) -
@@ -422,8 +429,6 @@ void cvm_oct_rx_initialize(void)
 {
 	int i;
 	struct net_device *dev_for_napi = NULL;
-	union cvmx_pow_wq_int_thrx int_thr;
-	union cvmx_pow_wq_int_pc int_pc;
 
 	for (i = 0; i < TOTAL_NUMBER_OF_PORTS; i++) {
 		if (cvm_oct_device[i]) {
@@ -449,15 +454,34 @@ void cvm_oct_rx_initialize(void)
 
 	disable_irq_nosync(OCTEON_IRQ_WORKQ0 + pow_receive_group);
 
-	int_thr.u64 = 0;
-	int_thr.s.tc_en = 1;
-	int_thr.s.tc_thr = 1;
 	/* Enable POW interrupt when our port has at least one packet */
-	cvmx_write_csr(CVMX_POW_WQ_INT_THRX(pow_receive_group), int_thr.u64);
-
-	int_pc.u64 = 0;
-	int_pc.s.pc_thr = 5;
-	cvmx_write_csr(CVMX_POW_WQ_INT_PC, int_pc.u64);
+	if (OCTEON_IS_MODEL(OCTEON_CN68XX)) {
+		union cvmx_sso_wq_int_thrx int_thr;
+		union cvmx_pow_wq_int_pc int_pc;
+
+		int_thr.u64 = 0;
+		int_thr.s.tc_en = 1;
+		int_thr.s.tc_thr = 1;
+		cvmx_write_csr(CVMX_SSO_WQ_INT_THRX(pow_receive_group),
+			       int_thr.u64);
+
+		int_pc.u64 = 0;
+		int_pc.s.pc_thr = 5;
+		cvmx_write_csr(CVMX_SSO_WQ_INT_PC, int_pc.u64);
+	} else {
+		union cvmx_pow_wq_int_thrx int_thr;
+		union cvmx_pow_wq_int_pc int_pc;
+
+		int_thr.u64 = 0;
+		int_thr.s.tc_en = 1;
+		int_thr.s.tc_thr = 1;
+		cvmx_write_csr(CVMX_POW_WQ_INT_THRX(pow_receive_group),
+			       int_thr.u64);
+
+		int_pc.u64 = 0;
+		int_pc.s.pc_thr = 5;
+		cvmx_write_csr(CVMX_POW_WQ_INT_PC, int_pc.u64);
+	}
 
 	/* Schedule NAPI now. This will indirectly enable the interrupt. */
 	napi_schedule(&cvm_oct_napi);
diff --git a/drivers/staging/octeon/ethernet.c b/drivers/staging/octeon/ethernet.c
index f9dba23..363742a 100644
--- a/drivers/staging/octeon/ethernet.c
+++ b/drivers/staging/octeon/ethernet.c
@@ -859,7 +859,10 @@ static int cvm_oct_remove(struct platform_device *pdev)
 	int port;
 
 	/* Disable POW interrupt */
-	cvmx_write_csr(CVMX_POW_WQ_INT_THRX(pow_receive_group), 0);
+	if (OCTEON_IS_MODEL(OCTEON_CN68XX))
+		cvmx_write_csr(CVMX_SSO_WQ_INT_THRX(pow_receive_group), 0);
+	else
+		cvmx_write_csr(CVMX_POW_WQ_INT_THRX(pow_receive_group), 0);
 
 	cvmx_ipd_disable();
 
-- 
2.4.3

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 08/14] MIPS/staging: OCTEON: set SSO group mask properly on CN68XX
  2015-08-13 13:21 [PATCH 00/14] MIPS/staging: OCTEON: enable ethernet/xaui on CN68XX Aaro Koskinen
                   ` (6 preceding siblings ...)
  2015-08-13 13:21 ` [PATCH 07/14] MIPS/staging: OCTEON: properly enable/disable SSO WQE interrupts Aaro Koskinen
@ 2015-08-13 13:21 ` Aaro Koskinen
  2015-08-13 13:21 ` [PATCH 09/14] MIPS/staging: OCTEON: increase output command buffers Aaro Koskinen
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 21+ messages in thread
From: Aaro Koskinen @ 2015-08-13 13:21 UTC (permalink / raw)
  To: Ralf Baechle, David Daney, linux-mips
  Cc: Janne Huttunen, Aaro Koskinen, Greg Kroah-Hartman, devel

CN68XX uses SSO instead of POW.

Signed-off-by: Aaro Koskinen <aaro.koskinen@nokia.com>
---
 drivers/staging/octeon/ethernet-rx.c | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/octeon/ethernet-rx.c b/drivers/staging/octeon/ethernet-rx.c
index 1636bd9..abfe934 100644
--- a/drivers/staging/octeon/ethernet-rx.c
+++ b/drivers/staging/octeon/ethernet-rx.c
@@ -172,9 +172,16 @@ static int cvm_oct_napi_poll(struct napi_struct *napi, int budget)
 	}
 
 	/* Only allow work for our group (and preserve priorities) */
-	old_group_mask = cvmx_read_csr(CVMX_POW_PP_GRP_MSKX(coreid));
-	cvmx_write_csr(CVMX_POW_PP_GRP_MSKX(coreid),
-		       (old_group_mask & ~0xFFFFull) | 1 << pow_receive_group);
+	if (OCTEON_IS_MODEL(OCTEON_CN68XX)) {
+		old_group_mask = cvmx_read_csr(CVMX_SSO_PPX_GRP_MSK(coreid));
+		cvmx_write_csr(CVMX_SSO_PPX_GRP_MSK(coreid),
+				1ull << pow_receive_group);
+		cvmx_read_csr(CVMX_SSO_PPX_GRP_MSK(coreid)); /* Flush */
+	} else {
+		old_group_mask = cvmx_read_csr(CVMX_POW_PP_GRP_MSKX(coreid));
+		cvmx_write_csr(CVMX_POW_PP_GRP_MSKX(coreid),
+			(old_group_mask & ~0xFFFFull) | 1 << pow_receive_group);
+	}
 
 	if (USE_ASYNC_IOBDMA) {
 		cvmx_pow_work_request_async(CVMX_SCR_SCRATCH, CVMX_POW_NO_WAIT);
@@ -397,7 +404,13 @@ static int cvm_oct_napi_poll(struct napi_struct *napi, int budget)
 		}
 	}
 	/* Restore the original POW group mask */
-	cvmx_write_csr(CVMX_POW_PP_GRP_MSKX(coreid), old_group_mask);
+	if (OCTEON_IS_MODEL(OCTEON_CN68XX)) {
+		cvmx_write_csr(CVMX_SSO_PPX_GRP_MSK(coreid), old_group_mask);
+		cvmx_read_csr(CVMX_SSO_PPX_GRP_MSK(coreid)); /* Flush */
+	} else {
+		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);
-- 
2.4.3

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 09/14] MIPS/staging: OCTEON: increase output command buffers
  2015-08-13 13:21 [PATCH 00/14] MIPS/staging: OCTEON: enable ethernet/xaui on CN68XX Aaro Koskinen
                   ` (7 preceding siblings ...)
  2015-08-13 13:21 ` [PATCH 08/14] MIPS/staging: OCTEON: set SSO group mask properly on CN68XX Aaro Koskinen
@ 2015-08-13 13:21 ` Aaro Koskinen
  2015-08-13 13:21 ` [PATCH 10/14] MIPS/staging: OCTEON: support CN68XX style WQE Aaro Koskinen
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 21+ messages in thread
From: Aaro Koskinen @ 2015-08-13 13:21 UTC (permalink / raw)
  To: Ralf Baechle, David Daney, linux-mips
  Cc: Janne Huttunen, Aaro Koskinen, Greg Kroah-Hartman, devel

From: Janne Huttunen <janne.huttunen@nokia.com>

The Octeon II models have more interfaces and thus require more output
command buffers. Increase the allocation to support these models.

Signed-off-by: Janne Huttunen <janne.huttunen@nokia.com>
Signed-off-by: Aaro Koskinen <aaro.koskinen@nokia.com>
---
 drivers/staging/octeon/ethernet.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/octeon/ethernet.c b/drivers/staging/octeon/ethernet.c
index 363742a..fbde419 100644
--- a/drivers/staging/octeon/ethernet.c
+++ b/drivers/staging/octeon/ethernet.c
@@ -152,7 +152,7 @@ static void cvm_oct_configure_common_hw(void)
 			     num_packet_buffers);
 	if (CVMX_FPA_OUTPUT_BUFFER_POOL != CVMX_FPA_PACKET_POOL)
 		cvm_oct_mem_fill_fpa(CVMX_FPA_OUTPUT_BUFFER_POOL,
-				     CVMX_FPA_OUTPUT_BUFFER_POOL_SIZE, 128);
+				     CVMX_FPA_OUTPUT_BUFFER_POOL_SIZE, 1024);
 
 #ifdef __LITTLE_ENDIAN
 	{
-- 
2.4.3

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 10/14] MIPS/staging: OCTEON: support CN68XX style WQE
  2015-08-13 13:21 [PATCH 00/14] MIPS/staging: OCTEON: enable ethernet/xaui on CN68XX Aaro Koskinen
                   ` (8 preceding siblings ...)
  2015-08-13 13:21 ` [PATCH 09/14] MIPS/staging: OCTEON: increase output command buffers Aaro Koskinen
@ 2015-08-13 13:21 ` Aaro Koskinen
  2015-08-13 13:21 ` [PATCH 11/14] MIPS: OCTEON: initialize CN68XX PKO Aaro Koskinen
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 21+ messages in thread
From: Aaro Koskinen @ 2015-08-13 13:21 UTC (permalink / raw)
  To: Ralf Baechle, David Daney, linux-mips
  Cc: Janne Huttunen, Aaro Koskinen, Greg Kroah-Hartman, devel

From: Janne Huttunen <janne.huttunen@nokia.com>

CN68XX has a bit different WQE structure. This patch provides the new
definitions and converts the code to use the proper variant based on
the actual model.

Signed-off-by: Janne Huttunen <janne.huttunen@nokia.com>
Signed-off-by: Aaro Koskinen <aaro.koskinen@nokia.com>
---
 .../cavium-octeon/executive/cvmx-helper-util.c     |   8 +-
 arch/mips/include/asm/octeon/cvmx-pow.h            |   9 +-
 arch/mips/include/asm/octeon/cvmx-wqe.h            | 308 +++++++++++++++++----
 drivers/staging/octeon/ethernet-rx.c               |  58 ++--
 drivers/staging/octeon/ethernet-tx.c               |  19 +-
 5 files changed, 304 insertions(+), 98 deletions(-)

diff --git a/arch/mips/cavium-octeon/executive/cvmx-helper-util.c b/arch/mips/cavium-octeon/executive/cvmx-helper-util.c
index 453d7f6..4029596 100644
--- a/arch/mips/cavium-octeon/executive/cvmx-helper-util.c
+++ b/arch/mips/cavium-octeon/executive/cvmx-helper-util.c
@@ -95,9 +95,9 @@ int cvmx_helper_dump_packet(cvmx_wqe_t *work)
 	uint8_t *data_address;
 	uint8_t *end_of_data;
 
-	cvmx_dprintf("Packet Length:   %u\n", work->len);
-	cvmx_dprintf("	  Input Port:  %u\n", work->ipprt);
-	cvmx_dprintf("	  QoS:	       %u\n", work->qos);
+	cvmx_dprintf("Packet Length:   %u\n", work->word1.len);
+	cvmx_dprintf("	  Input Port:  %u\n", cvmx_wqe_get_port(work));
+	cvmx_dprintf("	  QoS:	       %u\n", cvmx_wqe_get_qos(work));
 	cvmx_dprintf("	  Buffers:     %u\n", work->word2.s.bufs);
 
 	if (work->word2.s.bufs == 0) {
@@ -127,7 +127,7 @@ int cvmx_helper_dump_packet(cvmx_wqe_t *work)
 		}
 	} else
 		buffer_ptr = work->packet_ptr;
-	remaining_bytes = work->len;
+	remaining_bytes = work->word1.len;
 
 	while (remaining_bytes) {
 		start_of_buffer =
diff --git a/arch/mips/include/asm/octeon/cvmx-pow.h b/arch/mips/include/asm/octeon/cvmx-pow.h
index d5565d7..5153156 100644
--- a/arch/mips/include/asm/octeon/cvmx-pow.h
+++ b/arch/mips/include/asm/octeon/cvmx-pow.h
@@ -1810,10 +1810,11 @@ static inline void cvmx_pow_work_submit(cvmx_wqe_t *wqp, uint32_t tag,
 	cvmx_addr_t ptr;
 	cvmx_pow_tag_req_t tag_req;
 
-	wqp->qos = qos;
-	wqp->tag = tag;
-	wqp->tag_type = tag_type;
-	wqp->grp = grp;
+	wqp->word1.tag = tag;
+	wqp->word1.tag_type = tag_type;
+
+	cvmx_wqe_set_qos(wqp, qos);
+	cvmx_wqe_set_grp(wqp, grp);
 
 	tag_req.u64 = 0;
 	tag_req.s.op = CVMX_POW_TAG_OP_ADDWQ;
diff --git a/arch/mips/include/asm/octeon/cvmx-wqe.h b/arch/mips/include/asm/octeon/cvmx-wqe.h
index 2d6d0c7..0d697aa 100644
--- a/arch/mips/include/asm/octeon/cvmx-wqe.h
+++ b/arch/mips/include/asm/octeon/cvmx-wqe.h
@@ -193,6 +193,53 @@ typedef union {
 	        uint64_t bufs:8;
 #endif
 	} s;
+	struct {
+#ifdef __BIG_ENDIAN_BITFIELD
+		uint64_t bufs:8;
+		uint64_t ip_offset:8;
+		uint64_t vlan_valid:1;
+		uint64_t vlan_stacked:1;
+		uint64_t unassigned:1;
+		uint64_t vlan_cfi:1;
+		uint64_t vlan_id:12;
+		uint64_t port:12;		/* MAC/PIP port number. */
+		uint64_t dec_ipcomp:1;
+		uint64_t tcp_or_udp:1;
+		uint64_t dec_ipsec:1;
+		uint64_t is_v6:1;
+		uint64_t software:1;
+		uint64_t L4_error:1;
+		uint64_t is_frag:1;
+		uint64_t IP_exc:1;
+		uint64_t is_bcast:1;
+		uint64_t is_mcast:1;
+		uint64_t not_IP:1;
+		uint64_t rcv_error:1;
+		uint64_t err_code:8;
+#else
+		uint64_t err_code:8;
+		uint64_t rcv_error:1;
+		uint64_t not_IP:1;
+		uint64_t is_mcast:1;
+		uint64_t is_bcast:1;
+		uint64_t IP_exc:1;
+		uint64_t is_frag:1;
+		uint64_t L4_error:1;
+		uint64_t software:1;
+		uint64_t is_v6:1;
+		uint64_t dec_ipsec:1;
+		uint64_t tcp_or_udp:1;
+		uint64_t dec_ipcomp:1;
+		uint64_t port:12;
+		uint64_t vlan_id:12;
+		uint64_t vlan_cfi:1;
+		uint64_t unassigned:1;
+		uint64_t vlan_stacked:1;
+		uint64_t vlan_valid:1;
+		uint64_t ip_offset:8;
+		uint64_t bufs:8;
+#endif
+	} s_cn68xx;
 
 	/* use this to get at the 16 vlan bits */
 	struct {
@@ -355,6 +402,146 @@ typedef union {
 
 } cvmx_pip_wqe_word2;
 
+union cvmx_pip_wqe_word0 {
+	struct {
+#ifdef __BIG_ENDIAN_BITFIELD
+		/**
+		 * raw chksum result generated by the HW
+		 */
+		uint16_t hw_chksum;
+		/**
+		 * Field unused by hardware - available for software
+		 */
+		uint8_t unused;
+		/**
+		 * Next pointer used by hardware for list maintenance.
+		 * May be written/read by HW before the work queue
+		 * entry is scheduled to a PP (Only 36 bits used in
+		 * Octeon 1)
+		 */
+		uint64_t next_ptr:40;
+#else
+		uint64_t next_ptr:40;
+		uint8_t unused;
+		uint16_t hw_chksum;
+#endif
+	} cn38xx;
+	struct {
+#ifdef __BIG_ENDIAN_BITFIELD
+		uint64_t l4ptr:8;       /* 56..63 */
+		uint64_t unused0:8;     /* 48..55 */
+		uint64_t l3ptr:8;       /* 40..47 */
+		uint64_t l2ptr:8;       /* 32..39 */
+		uint64_t unused1:18;    /* 14..31 */
+		uint64_t bpid:6;        /* 8..13 */
+		uint64_t unused2:2;     /* 6..7 */
+		uint64_t pknd:6;        /* 0..5 */
+#else
+		uint64_t pknd:6;        /* 0..5 */
+		uint64_t unused2:2;     /* 6..7 */
+		uint64_t bpid:6;        /* 8..13 */
+		uint64_t unused1:18;    /* 14..31 */
+		uint64_t l2ptr:8;       /* 32..39 */
+		uint64_t l3ptr:8;       /* 40..47 */
+		uint64_t unused0:8;     /* 48..55 */
+		uint64_t l4ptr:8;       /* 56..63 */
+#endif
+	} cn68xx;
+};
+
+union cvmx_wqe_word0 {
+	uint64_t u64;
+	union cvmx_pip_wqe_word0 pip;
+};
+
+union cvmx_wqe_word1 {
+	uint64_t u64;
+	struct {
+#ifdef __BIG_ENDIAN_BITFIELD
+		uint64_t len:16;
+		uint64_t varies:14;
+		/**
+		 * the type of the tag (ORDERED, ATOMIC, NULL)
+		 */
+		uint64_t tag_type:2;
+		uint64_t tag:32;
+#else
+		uint64_t tag:32;
+		uint64_t tag_type:2;
+		uint64_t varies:14;
+		uint64_t len:16;
+#endif
+	};
+	struct {
+#ifdef __BIG_ENDIAN_BITFIELD
+		uint64_t len:16;
+		uint64_t zero_0:1;
+		/**
+		 * HW sets this to what it thought the priority of
+		 * the input packet was
+		 */
+		uint64_t qos:3;
+
+		uint64_t zero_1:1;
+		/**
+		 * the group that the work queue entry will be scheduled to
+		 */
+		uint64_t grp:6;
+		uint64_t zero_2:3;
+		uint64_t tag_type:2;
+		uint64_t tag:32;
+#else
+		uint64_t tag:32;
+		uint64_t tag_type:2;
+		uint64_t zero_2:3;
+		uint64_t grp:6;
+		uint64_t zero_1:1;
+		uint64_t qos:3;
+		uint64_t zero_0:1;
+		uint64_t len:16;
+#endif
+	} cn68xx;
+	struct {
+#ifdef __BIG_ENDIAN_BITFIELD
+		/**
+		 * HW sets to the total number of bytes in the packet
+		 */
+		uint64_t len:16;
+		/**
+		 * HW sets this to input physical port
+		 */
+		uint64_t ipprt:6;
+
+		/**
+		 * HW sets this to what it thought the priority of
+		 * the input packet was
+		 */
+		uint64_t qos:3;
+
+		/**
+		 * the group that the work queue entry will be scheduled to
+		 */
+		uint64_t grp:4;
+		/**
+		 * the type of the tag (ORDERED, ATOMIC, NULL)
+		 */
+		uint64_t tag_type:3;
+		/**
+		 * the synchronization/ordering tag
+		 */
+		uint64_t tag:32;
+#else
+		uint64_t tag:32;
+		uint64_t tag_type:2;
+		uint64_t zero_2:1;
+		uint64_t grp:4;
+		uint64_t qos:3;
+		uint64_t ipprt:6;
+		uint64_t len:16;
+#endif
+	} cn38xx;
+};
+
 /**
  * Work queue entry format
  *
@@ -366,70 +553,13 @@ typedef struct {
      * WORD 0
      *	HW WRITE: the following 64 bits are filled by HW when a packet arrives
      */
-
-#ifdef __BIG_ENDIAN_BITFIELD
-    /**
-     * raw chksum result generated by the HW
-     */
-	uint16_t hw_chksum;
-    /**
-     * Field unused by hardware - available for software
-     */
-	uint8_t unused;
-    /**
-     * Next pointer used by hardware for list maintenance.
-     * May be written/read by HW before the work queue
-     *		 entry is scheduled to a PP
-     * (Only 36 bits used in Octeon 1)
-     */
-	uint64_t next_ptr:40;
-#else
-	uint64_t next_ptr:40;
-	uint8_t unused;
-	uint16_t hw_chksum;
-#endif
+	union cvmx_wqe_word0 word0;
 
     /*****************************************************************
      * WORD 1
      *	HW WRITE: the following 64 bits are filled by HW when a packet arrives
      */
-
-#ifdef __BIG_ENDIAN_BITFIELD
-    /**
-     * HW sets to the total number of bytes in the packet
-     */
-	uint64_t len:16;
-    /**
-     * HW sets this to input physical port
-     */
-	uint64_t ipprt:6;
-
-    /**
-     * HW sets this to what it thought the priority of the input packet was
-     */
-	uint64_t qos:3;
-
-    /**
-     * the group that the work queue entry will be scheduled to
-     */
-	uint64_t grp:4;
-    /**
-     * the type of the tag (ORDERED, ATOMIC, NULL)
-     */
-	uint64_t tag_type:3;
-    /**
-     * the synchronization/ordering tag
-     */
-	uint64_t tag:32;
-#else
-	uint64_t tag:32;
-	uint64_t tag_type:2;
-	uint64_t zero_2:1;
-	uint64_t grp:4;
-	uint64_t qos:3;
-	uint64_t ipprt:6;
-	uint64_t len:16;
-#endif
+	union cvmx_wqe_word1 word1;
 
     /**
      * WORD 2 HW WRITE: the following 64-bits are filled in by
@@ -465,4 +595,64 @@ typedef struct {
 
 } CVMX_CACHE_LINE_ALIGNED cvmx_wqe_t;
 
+static inline int cvmx_wqe_get_port(cvmx_wqe_t *work)
+{
+	int port;
+
+	if (octeon_has_feature(OCTEON_FEATURE_CN68XX_WQE))
+		port = work->word2.s_cn68xx.port;
+	else
+		port = work->word1.cn38xx.ipprt;
+
+	return port;
+}
+
+static inline void cvmx_wqe_set_port(cvmx_wqe_t *work, int port)
+{
+	if (octeon_has_feature(OCTEON_FEATURE_CN68XX_WQE))
+		work->word2.s_cn68xx.port = port;
+	else
+		work->word1.cn38xx.ipprt = port;
+}
+
+static inline int cvmx_wqe_get_grp(cvmx_wqe_t *work)
+{
+	int grp;
+
+	if (octeon_has_feature(OCTEON_FEATURE_CN68XX_WQE))
+		grp = work->word1.cn68xx.grp;
+	else
+		grp = work->word1.cn38xx.grp;
+
+	return grp;
+}
+
+static inline void cvmx_wqe_set_grp(cvmx_wqe_t *work, int grp)
+{
+	if (octeon_has_feature(OCTEON_FEATURE_CN68XX_WQE))
+		work->word1.cn68xx.grp = grp;
+	else
+		work->word1.cn38xx.grp = grp;
+}
+
+static inline int cvmx_wqe_get_qos(cvmx_wqe_t *work)
+{
+	int qos;
+
+	if (octeon_has_feature(OCTEON_FEATURE_CN68XX_WQE))
+		qos = work->word1.cn68xx.qos;
+	else
+		qos = work->word1.cn38xx.qos;
+
+	return qos;
+}
+
+static inline void cvmx_wqe_set_qos(cvmx_wqe_t *work, int qos)
+{
+	if (octeon_has_feature(OCTEON_FEATURE_CN68XX_WQE))
+		work->word1.cn68xx.qos = qos;
+	else
+		work->word1.cn38xx.qos = qos;
+}
+
 #endif /* __CVMX_WQE_H__ */
diff --git a/drivers/staging/octeon/ethernet-rx.c b/drivers/staging/octeon/ethernet-rx.c
index abfe934..d1a33a9 100644
--- a/drivers/staging/octeon/ethernet-rx.c
+++ b/drivers/staging/octeon/ethernet-rx.c
@@ -70,7 +70,14 @@ static irqreturn_t cvm_oct_do_interrupt(int cpl, void *dev_id)
  */
 static inline int cvm_oct_check_rcv_error(cvmx_wqe_t *work)
 {
-	if ((work->word2.snoip.err_code == 10) && (work->len <= 64)) {
+	int port;
+
+	if (octeon_has_feature(OCTEON_FEATURE_PKND))
+		port = work->word0.pip.cn68xx.pknd;
+	else
+		port = work->word1.cn38xx.ipprt;
+
+	if ((work->word2.snoip.err_code == 10) && (work->word1.len <= 64)) {
 		/*
 		 * Ignore length errors on min size packets. Some
 		 * equipment incorrectly pads packets to 64+4FCS
@@ -87,8 +94,8 @@ static inline int cvm_oct_check_rcv_error(cvmx_wqe_t *work)
 		 * packet to determine if we can remove a non spec
 		 * preamble and generate a correct packet.
 		 */
-		int interface = cvmx_helper_get_interface_num(work->ipprt);
-		int index = cvmx_helper_get_interface_index_num(work->ipprt);
+		int interface = cvmx_helper_get_interface_num(port);
+		int index = cvmx_helper_get_interface_index_num(port);
 		union cvmx_gmxx_rxx_frm_ctl gmxx_rxx_frm_ctl;
 
 		gmxx_rxx_frm_ctl.u64 =
@@ -99,7 +106,7 @@ static inline int cvm_oct_check_rcv_error(cvmx_wqe_t *work)
 			    cvmx_phys_to_ptr(work->packet_ptr.s.addr);
 			int i = 0;
 
-			while (i < work->len - 1) {
+			while (i < work->word1.len - 1) {
 				if (*ptr != 0x55)
 					break;
 				ptr++;
@@ -109,18 +116,18 @@ static inline int cvm_oct_check_rcv_error(cvmx_wqe_t *work)
 			if (*ptr == 0xd5) {
 				/*
 				  printk_ratelimited("Port %d received 0xd5 preamble\n",
-					  work->ipprt);
+					  port);
 				 */
 				work->packet_ptr.s.addr += i + 1;
-				work->len -= i + 5;
+				work->word1.len -= i + 5;
 			} else if ((*ptr & 0xf) == 0xd) {
 				/*
 				  printk_ratelimited("Port %d received 0x?d preamble\n",
-					  work->ipprt);
+					  port);
 				 */
 				work->packet_ptr.s.addr += i;
-				work->len -= i + 4;
-				for (i = 0; i < work->len; i++) {
+				work->word1.len -= i + 4;
+				for (i = 0; i < work->word1.len; i++) {
 					*ptr =
 					    ((*ptr & 0xf0) >> 4) |
 					    ((*(ptr + 1) & 0xf) << 4);
@@ -128,7 +135,7 @@ static inline int cvm_oct_check_rcv_error(cvmx_wqe_t *work)
 				}
 			} else {
 				printk_ratelimited("Port %d unknown preamble, packet dropped\n",
-						   work->ipprt);
+						   port);
 				/*
 				   cvmx_helper_dump_packet(work);
 				 */
@@ -138,7 +145,7 @@ static inline int cvm_oct_check_rcv_error(cvmx_wqe_t *work)
 		}
 	} else {
 		printk_ratelimited("Port %d receive error code %d, packet dropped\n",
-				   work->ipprt, work->word2.snoip.err_code);
+				   port, work->word2.snoip.err_code);
 		cvm_oct_free_work(work);
 		return 1;
 	}
@@ -193,6 +200,7 @@ static int cvm_oct_napi_poll(struct napi_struct *napi, int budget)
 		struct sk_buff **pskb = NULL;
 		int skb_in_hw;
 		cvmx_wqe_t *work;
+		int port;
 
 		if (USE_ASYNC_IOBDMA && did_work_request)
 			work = cvmx_pow_work_response_async(CVMX_SCR_SCRATCH);
@@ -234,7 +242,13 @@ static int cvm_oct_napi_poll(struct napi_struct *napi, int budget)
 			prefetch(&skb->head);
 			prefetch(&skb->len);
 		}
-		prefetch(cvm_oct_device[work->ipprt]);
+
+		if (octeon_has_feature(OCTEON_FEATURE_PKND))
+			port = work->word0.pip.cn68xx.pknd;
+		else
+			port = work->word1.cn38xx.ipprt;
+
+		prefetch(cvm_oct_device[port]);
 
 		/* Immediately throw away all packets with receive errors */
 		if (unlikely(work->word2.snoip.rcv_error)) {
@@ -251,7 +265,7 @@ static int cvm_oct_napi_poll(struct napi_struct *napi, int budget)
 			skb->data = skb->head + work->packet_ptr.s.addr -
 				cvmx_ptr_to_phys(skb->head);
 			prefetch(skb->data);
-			skb->len = work->len;
+			skb->len = work->word1.len;
 			skb_set_tail_pointer(skb, skb->len);
 			packet_not_copied = 1;
 		} else {
@@ -259,7 +273,7 @@ static int cvm_oct_napi_poll(struct napi_struct *napi, int budget)
 			 * We have to copy the packet. First allocate
 			 * an skbuff for it.
 			 */
-			skb = dev_alloc_skb(work->len);
+			skb = dev_alloc_skb(work->word1.len);
 			if (!skb) {
 				cvm_oct_free_work(work);
 				continue;
@@ -282,13 +296,14 @@ static int cvm_oct_napi_poll(struct napi_struct *napi, int budget)
 					else
 						ptr += 6;
 				}
-				memcpy(skb_put(skb, work->len), ptr, work->len);
+				memcpy(skb_put(skb, work->word1.len), ptr,
+				       work->word1.len);
 				/* No packet buffers to free */
 			} else {
 				int segments = work->word2.s.bufs;
 				union cvmx_buf_ptr segment_ptr =
 				    work->packet_ptr;
-				int len = work->len;
+				int len = work->word1.len;
 
 				while (segments--) {
 					union cvmx_buf_ptr next_ptr =
@@ -324,10 +339,9 @@ static int cvm_oct_napi_poll(struct napi_struct *napi, int budget)
 			}
 			packet_not_copied = 0;
 		}
-
-		if (likely((work->ipprt < TOTAL_NUMBER_OF_PORTS) &&
-			   cvm_oct_device[work->ipprt])) {
-			struct net_device *dev = cvm_oct_device[work->ipprt];
+		if (likely((port < TOTAL_NUMBER_OF_PORTS) &&
+			   cvm_oct_device[port])) {
+			struct net_device *dev = cvm_oct_device[port];
 			struct octeon_ethernet *priv = netdev_priv(dev);
 
 			/*
@@ -347,7 +361,7 @@ static int cvm_oct_napi_poll(struct napi_struct *napi, int budget)
 					skb->ip_summed = CHECKSUM_UNNECESSARY;
 
 				/* Increment RX stats for virtual ports */
-				if (work->ipprt >= CVMX_PIP_NUM_INPUT_PORTS) {
+				if (port >= CVMX_PIP_NUM_INPUT_PORTS) {
 #ifdef CONFIG_64BIT
 					atomic64_add(1,
 						     (atomic64_t *)&priv->stats.rx_packets);
@@ -382,7 +396,7 @@ static int cvm_oct_napi_poll(struct napi_struct *napi, int budget)
 			 * doesn't exist.
 			 */
 			printk_ratelimited("Port %d not controlled by Linux, packet dropped\n",
-				   work->ipprt);
+				   port);
 			dev_kfree_skb_irq(skb);
 		}
 		/*
diff --git a/drivers/staging/octeon/ethernet-tx.c b/drivers/staging/octeon/ethernet-tx.c
index 7c1c1b0..5883547 100644
--- a/drivers/staging/octeon/ethernet-tx.c
+++ b/drivers/staging/octeon/ethernet-tx.c
@@ -589,13 +589,14 @@ int cvm_oct_xmit_pow(struct sk_buff *skb, struct net_device *dev)
 	 * Fill in some of the work queue fields. We may need to add
 	 * more if the software at the other end needs them.
 	 */
-	work->hw_chksum = skb->csum;
-	work->len = skb->len;
-	work->ipprt = priv->port;
-	work->qos = priv->port & 0x7;
-	work->grp = pow_send_group;
-	work->tag_type = CVMX_HELPER_INPUT_TAG_TYPE;
-	work->tag = pow_send_group;	/* FIXME */
+	if (!OCTEON_IS_MODEL(OCTEON_CN68XX))
+		work->word0.pip.cn38xx.hw_chksum = skb->csum;
+	work->word1.len = skb->len;
+	cvmx_wqe_set_port(work, priv->port);
+	cvmx_wqe_set_qos(work, priv->port & 0x7);
+	cvmx_wqe_set_grp(work, pow_send_group);
+	work->word1.tag_type = CVMX_HELPER_INPUT_TAG_TYPE;
+	work->word1.tag = pow_send_group;	/* FIXME */
 	/* Default to zero. Sets of zero later are commented out */
 	work->word2.u64 = 0;
 	work->word2.s.bufs = 1;
@@ -675,8 +676,8 @@ int cvm_oct_xmit_pow(struct sk_buff *skb, struct net_device *dev)
 	}
 
 	/* Submit the packet to the POW */
-	cvmx_pow_work_submit(work, work->tag, work->tag_type, work->qos,
-			     work->grp);
+	cvmx_pow_work_submit(work, work->word1.tag, work->word1.tag_type,
+			     cvmx_wqe_get_qos(work), cvmx_wqe_get_grp(work));
 	priv->stats.tx_packets++;
 	priv->stats.tx_bytes += skb->len;
 	dev_consume_skb_any(skb);
-- 
2.4.3

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 11/14] MIPS: OCTEON: initialize CN68XX PKO
  2015-08-13 13:21 [PATCH 00/14] MIPS/staging: OCTEON: enable ethernet/xaui on CN68XX Aaro Koskinen
                   ` (9 preceding siblings ...)
  2015-08-13 13:21 ` [PATCH 10/14] MIPS/staging: OCTEON: support CN68XX style WQE Aaro Koskinen
@ 2015-08-13 13:21 ` Aaro Koskinen
  2015-08-13 13:21 ` [PATCH 12/14] MIPS: OCTEON: set up 1:1 mapping between CN68XX PKO queues and ports Aaro Koskinen
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 21+ messages in thread
From: Aaro Koskinen @ 2015-08-13 13:21 UTC (permalink / raw)
  To: Ralf Baechle, David Daney, linux-mips
  Cc: Janne Huttunen, Aaro Koskinen, Greg Kroah-Hartman, devel

From: Janne Huttunen <janne.huttunen@nokia.com>

CN68XX requires a different PKO configuration. This patch provides
just enough setup to get the XAUI interfaces on CN6880 working with
default parameters.

Signed-off-by: Janne Huttunen <janne.huttunen@nsn.com>
Signed-off-by: Aaro Koskinen <aaro.koskinen@nokia.com>
---
 arch/mips/cavium-octeon/executive/cvmx-pko.c | 149 ++++++++++++++++++++++++++-
 1 file changed, 144 insertions(+), 5 deletions(-)

diff --git a/arch/mips/cavium-octeon/executive/cvmx-pko.c b/arch/mips/cavium-octeon/executive/cvmx-pko.c
index 008b881..87be167 100644
--- a/arch/mips/cavium-octeon/executive/cvmx-pko.c
+++ b/arch/mips/cavium-octeon/executive/cvmx-pko.c
@@ -39,6 +39,143 @@
  * Internal state of packet output
  */
 
+static int __cvmx_pko_int(int interface, int index)
+{
+	switch (interface) {
+	case 0:
+		return index;
+	case 1:
+		return 4;
+	case 2:
+		return index + 0x08;
+	case 3:
+		return index + 0x0c;
+	case 4:
+		return index + 0x10;
+	case 5:
+		return 0x1c;
+	case 6:
+		return 0x1d;
+	case 7:
+		return 0x1e;
+	case 8:
+		return 0x1f;
+	default:
+		return -1;
+	}
+}
+
+static void __cvmx_pko_iport_config(int pko_port)
+{
+	int queue;
+	const int num_queues = 1;
+	const int base_queue = pko_port;
+	const int static_priority_end = 1;
+	const int static_priority_base = 1;
+
+	for (queue = 0; queue < num_queues; queue++) {
+		union cvmx_pko_mem_iqueue_ptrs config;
+		cvmx_cmd_queue_result_t cmd_res;
+		uint64_t *buf_ptr;
+
+		config.u64		= 0;
+		config.s.index		= queue;
+		config.s.qid		= base_queue + queue;
+		config.s.ipid		= pko_port;
+		config.s.tail		= (queue == (num_queues - 1));
+		config.s.s_tail		= (queue == static_priority_end);
+		config.s.static_p	= (static_priority_base >= 0);
+		config.s.static_q	= (queue <= static_priority_end);
+		config.s.qos_mask	= 0xff;
+
+		cmd_res = cvmx_cmd_queue_initialize(
+				CVMX_CMD_QUEUE_PKO(base_queue + queue),
+				CVMX_PKO_MAX_QUEUE_DEPTH,
+				CVMX_FPA_OUTPUT_BUFFER_POOL,
+				(CVMX_FPA_OUTPUT_BUFFER_POOL_SIZE -
+				 CVMX_PKO_COMMAND_BUFFER_SIZE_ADJUST * 8));
+
+		WARN(cmd_res,
+		     "%s: cmd_res=%d pko_port=%d base_queue=%d num_queues=%d queue=%d\n",
+			__func__, (int)cmd_res, pko_port, base_queue,
+			num_queues, queue);
+
+		buf_ptr = (uint64_t *)cvmx_cmd_queue_buffer(
+				CVMX_CMD_QUEUE_PKO(base_queue + queue));
+		config.s.buf_ptr = cvmx_ptr_to_phys(buf_ptr) >> 7;
+		CVMX_SYNCWS;
+		cvmx_write_csr(CVMX_PKO_MEM_IQUEUE_PTRS, config.u64);
+	}
+}
+
+static void __cvmx_pko_queue_alloc_o68(void)
+{
+	int port;
+
+	for (port = 0; port < 48; port++)
+		__cvmx_pko_iport_config(port);
+}
+
+static void __cvmx_pko_port_map_o68(void)
+{
+	int port;
+	int interface, index;
+	cvmx_helper_interface_mode_t mode;
+	union cvmx_pko_mem_iport_ptrs config;
+
+	/*
+	 * Initialize every iport with the invalid eid.
+	 */
+	config.u64 = 0;
+	config.s.eid = 31; /* Invalid */
+	for (port = 0; port < 128; port++) {
+		config.s.ipid = port;
+		cvmx_write_csr(CVMX_PKO_MEM_IPORT_PTRS, config.u64);
+	}
+
+	/*
+	 * Set up PKO_MEM_IPORT_PTRS
+	 */
+	for (port = 0; port < 48; port++) {
+		interface = cvmx_helper_get_interface_num(port);
+		index = cvmx_helper_get_interface_index_num(port);
+		mode = cvmx_helper_interface_get_mode(interface);
+		if (mode == CVMX_HELPER_INTERFACE_MODE_DISABLED)
+			continue;
+
+		config.s.ipid = port;
+		config.s.qos_mask = 0xff;
+		config.s.crc = 1;
+		config.s.min_pkt = 1;
+		config.s.intr = __cvmx_pko_int(interface, index);
+		config.s.eid = config.s.intr;
+		config.s.pipe = (mode == CVMX_HELPER_INTERFACE_MODE_LOOP) ?
+			index : port;
+		cvmx_write_csr(CVMX_PKO_MEM_IPORT_PTRS, config.u64);
+	}
+}
+
+static void __cvmx_pko_chip_init(void)
+{
+	int i;
+
+	if (OCTEON_IS_MODEL(OCTEON_CN68XX)) {
+		__cvmx_pko_port_map_o68();
+		__cvmx_pko_queue_alloc_o68();
+		return;
+	}
+
+	/*
+	 * Initialize queues
+	 */
+	for (i = 0; i < CVMX_PKO_MAX_OUTPUT_QUEUES; i++) {
+		const uint64_t priority = 8;
+
+		cvmx_pko_config_port(CVMX_PKO_MEM_QUEUE_PTRS_ILLEGAL_PID, i, 1,
+				     &priority);
+	}
+}
+
 /**
  * Call before any other calls to initialize the packet
  * output system.  This does chip global config, and should only be
@@ -47,8 +184,6 @@
 
 void cvmx_pko_initialize_global(void)
 {
-	int i;
-	uint64_t priority = 8;
 	union cvmx_pko_reg_cmd_buf config;
 
 	/*
@@ -62,9 +197,10 @@ void cvmx_pko_initialize_global(void)
 
 	cvmx_write_csr(CVMX_PKO_REG_CMD_BUF, config.u64);
 
-	for (i = 0; i < CVMX_PKO_MAX_OUTPUT_QUEUES; i++)
-		cvmx_pko_config_port(CVMX_PKO_MEM_QUEUE_PTRS_ILLEGAL_PID, i, 1,
-				     &priority);
+	/*
+	 * Chip-specific setup.
+	 */
+	__cvmx_pko_chip_init();
 
 	/*
 	 * If we aren't using all of the queues optimize PKO's
@@ -212,6 +348,9 @@ cvmx_pko_status_t cvmx_pko_config_port(uint64_t port, uint64_t base_queue,
 	int static_priority_base = -1;
 	int static_priority_end = -1;
 
+	if (OCTEON_IS_MODEL(OCTEON_CN68XX))
+		return CVMX_PKO_SUCCESS;
+
 	if ((port >= CVMX_PKO_NUM_OUTPUT_PORTS)
 	    && (port != CVMX_PKO_MEM_QUEUE_PTRS_ILLEGAL_PID)) {
 		cvmx_dprintf("ERROR: cvmx_pko_config_port: Invalid port %llu\n",
-- 
2.4.3

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 12/14] MIPS: OCTEON: set up 1:1 mapping between CN68XX PKO queues and ports
  2015-08-13 13:21 [PATCH 00/14] MIPS/staging: OCTEON: enable ethernet/xaui on CN68XX Aaro Koskinen
                   ` (10 preceding siblings ...)
  2015-08-13 13:21 ` [PATCH 11/14] MIPS: OCTEON: initialize CN68XX PKO Aaro Koskinen
@ 2015-08-13 13:21 ` Aaro Koskinen
  2015-08-13 13:21 ` [PATCH 13/14] MIPS: OCTEON: support interfaces 4 and 5 Aaro Koskinen
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 21+ messages in thread
From: Aaro Koskinen @ 2015-08-13 13:21 UTC (permalink / raw)
  To: Ralf Baechle, David Daney, linux-mips
  Cc: Janne Huttunen, Aaro Koskinen, Greg Kroah-Hartman, devel

From: Janne Huttunen <janne.huttunen@nokia.com>

Use the internal port number also as the queue number on CN68XX.

Signed-off-by: Janne Huttunen <janne.huttunen@nokia.com>
Signed-off-by: Aaro Koskinen <aaro.koskinen@nokia.com>
---
 arch/mips/include/asm/octeon/cvmx-pko.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/mips/include/asm/octeon/cvmx-pko.h b/arch/mips/include/asm/octeon/cvmx-pko.h
index 3da59bb..5f47f76 100644
--- a/arch/mips/include/asm/octeon/cvmx-pko.h
+++ b/arch/mips/include/asm/octeon/cvmx-pko.h
@@ -542,6 +542,9 @@ static inline int cvmx_pko_get_base_queue_per_core(int port, int core)
  */
 static inline int cvmx_pko_get_base_queue(int port)
 {
+	if (OCTEON_IS_MODEL(OCTEON_CN68XX))
+		return port;
+
 	return cvmx_pko_get_base_queue_per_core(port, 0);
 }
 
-- 
2.4.3

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 13/14] MIPS: OCTEON: support interfaces 4 and 5
  2015-08-13 13:21 [PATCH 00/14] MIPS/staging: OCTEON: enable ethernet/xaui on CN68XX Aaro Koskinen
                   ` (11 preceding siblings ...)
  2015-08-13 13:21 ` [PATCH 12/14] MIPS: OCTEON: set up 1:1 mapping between CN68XX PKO queues and ports Aaro Koskinen
@ 2015-08-13 13:21 ` Aaro Koskinen
  2015-08-13 13:21 ` [PATCH 14/14] MIPS/staging: OCTEON: use common helpers for determining interface and port Aaro Koskinen
  2015-08-13 19:16 ` [PATCH 00/14] MIPS/staging: OCTEON: enable ethernet/xaui on CN68XX David Daney
  14 siblings, 0 replies; 21+ messages in thread
From: Aaro Koskinen @ 2015-08-13 13:21 UTC (permalink / raw)
  To: Ralf Baechle, David Daney, linux-mips
  Cc: Janne Huttunen, Aaro Koskinen, Greg Kroah-Hartman, devel

From: Janne Huttunen <janne.huttunen@nokia.com>

Add the support for mapping between interface/port numbers and IPD port
numbers also for the additional interfaces some Octeon II models have.

Signed-off-by: Janne Huttunen <janne.huttunen@nokia.com>
Signed-off-by: Aaro Koskinen <aaro.koskinen@nokia.com>
---
 arch/mips/cavium-octeon/executive/cvmx-helper-util.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/arch/mips/cavium-octeon/executive/cvmx-helper-util.c b/arch/mips/cavium-octeon/executive/cvmx-helper-util.c
index 4029596..b45b297 100644
--- a/arch/mips/cavium-octeon/executive/cvmx-helper-util.c
+++ b/arch/mips/cavium-octeon/executive/cvmx-helper-util.c
@@ -382,6 +382,10 @@ int cvmx_helper_get_ipd_port(int interface, int port)
 		return port + 32;
 	case 3:
 		return port + 36;
+	case 4:
+		return port + 40;
+	case 5:
+		return port + 44;
 	}
 	return -1;
 }
@@ -404,6 +408,10 @@ int cvmx_helper_get_interface_num(int ipd_port)
 		return 2;
 	else if (ipd_port < 40)
 		return 3;
+	else if (ipd_port < 44)
+		return 4;
+	else if (ipd_port < 48)
+		return 5;
 	else
 		cvmx_dprintf("cvmx_helper_get_interface_num: Illegal IPD "
 			     "port number\n");
@@ -428,6 +436,10 @@ int cvmx_helper_get_interface_index_num(int ipd_port)
 		return ipd_port & 3;
 	else if (ipd_port < 40)
 		return ipd_port & 3;
+	else if (ipd_port < 44)
+		return ipd_port & 3;
+	else if (ipd_port < 48)
+		return ipd_port & 3;
 	else
 		cvmx_dprintf("cvmx_helper_get_interface_index_num: "
 			     "Illegal IPD port number\n");
-- 
2.4.3

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 14/14] MIPS/staging: OCTEON: use common helpers for determining interface and port
  2015-08-13 13:21 [PATCH 00/14] MIPS/staging: OCTEON: enable ethernet/xaui on CN68XX Aaro Koskinen
                   ` (12 preceding siblings ...)
  2015-08-13 13:21 ` [PATCH 13/14] MIPS: OCTEON: support interfaces 4 and 5 Aaro Koskinen
@ 2015-08-13 13:21 ` Aaro Koskinen
  2015-08-13 19:16 ` [PATCH 00/14] MIPS/staging: OCTEON: enable ethernet/xaui on CN68XX David Daney
  14 siblings, 0 replies; 21+ messages in thread
From: Aaro Koskinen @ 2015-08-13 13:21 UTC (permalink / raw)
  To: Ralf Baechle, David Daney, linux-mips
  Cc: Janne Huttunen, Aaro Koskinen, Greg Kroah-Hartman, devel

From: Janne Huttunen <janne.huttunen@nokia.com>

Currently the Octeon Ethernet driver hardcodes the mapping between
interface/port and IPD port number. Since we have generic helpers for
the very same purpose, we might as well use them instead. This prevents
having the same information in multiple places.

Signed-off-by: Janne Huttunen <janne.huttunen@nokia.com>
Signed-off-by: Aaro Koskinen <aaro.koskinen@nokia.com>
---
 drivers/staging/octeon/ethernet-util.h | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/octeon/ethernet-util.h b/drivers/staging/octeon/ethernet-util.h
index 1ba789a..45f024b 100644
--- a/drivers/staging/octeon/ethernet-util.h
+++ b/drivers/staging/octeon/ethernet-util.h
@@ -8,6 +8,10 @@
  * published by the Free Software Foundation.
  */
 
+#include <asm/octeon/cvmx-pip.h>
+#include <asm/octeon/cvmx-helper.h>
+#include <asm/octeon/cvmx-helper-util.h>
+
 /**
  * cvm_oct_get_buffer_ptr - convert packet data address to pointer
  * @packet_ptr: Packet data hardware address
@@ -28,14 +32,12 @@ static inline void *cvm_oct_get_buffer_ptr(union cvmx_buf_ptr packet_ptr)
  */
 static inline int INTERFACE(int ipd_port)
 {
-	if (ipd_port < 32)	/* Interface 0 or 1 for RGMII,GMII,SPI, etc */
-		return ipd_port >> 4;
-	else if (ipd_port < 36)	/* Interface 2 for NPI */
-		return 2;
-	else if (ipd_port < 40)	/* Interface 3 for loopback */
-		return 3;
-	else if (ipd_port == 40)	/* Non existent interface for POW0 */
-		return 4;
+	int interface = cvmx_helper_get_interface_num(ipd_port);
+
+	if (interface >= 0)
+		return interface;
+	else if (ipd_port == CVMX_PIP_NUM_INPUT_PORTS)
+		return 10;
 	panic("Illegal ipd_port %d passed to INTERFACE\n", ipd_port);
 }
 
@@ -47,7 +49,5 @@ static inline int INTERFACE(int ipd_port)
  */
 static inline int INDEX(int ipd_port)
 {
-	if (ipd_port < 32)
-		return ipd_port & 15;
-	return ipd_port & 3;
+	return cvmx_helper_get_interface_index_num(ipd_port);
 }
-- 
2.4.3

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [PATCH 00/14] MIPS/staging: OCTEON: enable ethernet/xaui on CN68XX
  2015-08-13 13:21 [PATCH 00/14] MIPS/staging: OCTEON: enable ethernet/xaui on CN68XX Aaro Koskinen
                   ` (13 preceding siblings ...)
  2015-08-13 13:21 ` [PATCH 14/14] MIPS/staging: OCTEON: use common helpers for determining interface and port Aaro Koskinen
@ 2015-08-13 19:16 ` David Daney
  2015-08-13 19:16   ` David Daney
  2015-08-14 13:09   ` Aaro Koskinen
  14 siblings, 2 replies; 21+ messages in thread
From: David Daney @ 2015-08-13 19:16 UTC (permalink / raw)
  To: Aaro Koskinen
  Cc: Ralf Baechle, linux-mips, Janne Huttunen, Greg Kroah-Hartman, devel

On 08/13/2015 06:21 AM, Aaro Koskinen wrote:
> Hi,
>
> Currently mainline Linux is unusable on OCTEON II CN68XX SOCs due to
> issues in Ethernet driver initialization. Some boards are hanging during
> init, and all the needed register differences compared to the older SOCs
> are not taken into account to make interrupts and packet delivery to work.
>
> This patch set provides a minimal support to get octeon-ethernet going
> on CN68XX. Tested on top of 4.2-rc6 with Cavium EBB6800 and Kontron
> S1901 boards by sending traffic over XAUI interface with busybox.

You don't say how it was tested.

Does OCTEON and OCTEON II networking continue to function?

There is no SSO provisioning, so there will be limited buffering on 
packet ingress.  For low packet rates, it should be fine though.

David Daney


>
> A.
>
> Aaro Koskinen (2):
>    MIPS/staging: OCTEON: properly enable/disable SSO WQE interrupts
>    MIPS/staging: OCTEON: set SSO group mask properly on CN68XX
>
> Janne Huttunen (12):
>    MIPS: OCTEON: fix CN6880 hang on XAUI init
>    MIPS: OCTEON: support additional interfaces on CN68XX
>    MIPS: OCTEON: support all PIP input ports on CN68XX
>    MIPS: OCTEON: configure XAUI pkinds
>    MIPS: OCTEON: configure minimum PKO packet sizes on CN68XX
>    MIPS: OCTEON: add definitions for setting up SSO
>    MIPS/staging: OCTEON: increase output command buffers
>    MIPS/staging: OCTEON: support CN68XX style WQE
>    MIPS: OCTEON: initialize CN68XX PKO
>    MIPS: OCTEON: set up 1:1 mapping between CN68XX PKO queues and ports
>    MIPS: OCTEON: support interfaces 4 and 5
>    MIPS/staging: OCTEON: use common helpers for determining interface and
>      port
>
>   .../cavium-octeon/executive/cvmx-helper-util.c     |  20 +-
>   .../cavium-octeon/executive/cvmx-helper-xaui.c     |  14 +-
>   arch/mips/cavium-octeon/executive/cvmx-helper.c    |  17 ++
>   arch/mips/cavium-octeon/executive/cvmx-pko.c       | 149 +++++++++-
>   arch/mips/include/asm/octeon/cvmx-pip.h            |   2 +-
>   arch/mips/include/asm/octeon/cvmx-pko.h            |   3 +
>   arch/mips/include/asm/octeon/cvmx-pow-defs.h       |  29 ++
>   arch/mips/include/asm/octeon/cvmx-pow.h            |   9 +-
>   arch/mips/include/asm/octeon/cvmx-wqe.h            | 308 +++++++++++++++++----
>   drivers/staging/octeon/ethernet-rx.c               | 133 ++++++---
>   drivers/staging/octeon/ethernet-tx.c               |  19 +-
>   drivers/staging/octeon/ethernet-util.h             |  22 +-
>   drivers/staging/octeon/ethernet.c                  |   7 +-
>   13 files changed, 595 insertions(+), 137 deletions(-)
>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 00/14] MIPS/staging: OCTEON: enable ethernet/xaui on CN68XX
  2015-08-13 19:16 ` [PATCH 00/14] MIPS/staging: OCTEON: enable ethernet/xaui on CN68XX David Daney
@ 2015-08-13 19:16   ` David Daney
  2015-08-14 13:09   ` Aaro Koskinen
  1 sibling, 0 replies; 21+ messages in thread
From: David Daney @ 2015-08-13 19:16 UTC (permalink / raw)
  To: Aaro Koskinen
  Cc: Ralf Baechle, linux-mips, Janne Huttunen, Greg Kroah-Hartman, devel

On 08/13/2015 06:21 AM, Aaro Koskinen wrote:
> Hi,
>
> Currently mainline Linux is unusable on OCTEON II CN68XX SOCs due to
> issues in Ethernet driver initialization. Some boards are hanging during
> init, and all the needed register differences compared to the older SOCs
> are not taken into account to make interrupts and packet delivery to work.
>
> This patch set provides a minimal support to get octeon-ethernet going
> on CN68XX. Tested on top of 4.2-rc6 with Cavium EBB6800 and Kontron
> S1901 boards by sending traffic over XAUI interface with busybox.

You don't say how it was tested.

Does OCTEON and OCTEON II networking continue to function?

There is no SSO provisioning, so there will be limited buffering on 
packet ingress.  For low packet rates, it should be fine though.

David Daney


>
> A.
>
> Aaro Koskinen (2):
>    MIPS/staging: OCTEON: properly enable/disable SSO WQE interrupts
>    MIPS/staging: OCTEON: set SSO group mask properly on CN68XX
>
> Janne Huttunen (12):
>    MIPS: OCTEON: fix CN6880 hang on XAUI init
>    MIPS: OCTEON: support additional interfaces on CN68XX
>    MIPS: OCTEON: support all PIP input ports on CN68XX
>    MIPS: OCTEON: configure XAUI pkinds
>    MIPS: OCTEON: configure minimum PKO packet sizes on CN68XX
>    MIPS: OCTEON: add definitions for setting up SSO
>    MIPS/staging: OCTEON: increase output command buffers
>    MIPS/staging: OCTEON: support CN68XX style WQE
>    MIPS: OCTEON: initialize CN68XX PKO
>    MIPS: OCTEON: set up 1:1 mapping between CN68XX PKO queues and ports
>    MIPS: OCTEON: support interfaces 4 and 5
>    MIPS/staging: OCTEON: use common helpers for determining interface and
>      port
>
>   .../cavium-octeon/executive/cvmx-helper-util.c     |  20 +-
>   .../cavium-octeon/executive/cvmx-helper-xaui.c     |  14 +-
>   arch/mips/cavium-octeon/executive/cvmx-helper.c    |  17 ++
>   arch/mips/cavium-octeon/executive/cvmx-pko.c       | 149 +++++++++-
>   arch/mips/include/asm/octeon/cvmx-pip.h            |   2 +-
>   arch/mips/include/asm/octeon/cvmx-pko.h            |   3 +
>   arch/mips/include/asm/octeon/cvmx-pow-defs.h       |  29 ++
>   arch/mips/include/asm/octeon/cvmx-pow.h            |   9 +-
>   arch/mips/include/asm/octeon/cvmx-wqe.h            | 308 +++++++++++++++++----
>   drivers/staging/octeon/ethernet-rx.c               | 133 ++++++---
>   drivers/staging/octeon/ethernet-tx.c               |  19 +-
>   drivers/staging/octeon/ethernet-util.h             |  22 +-
>   drivers/staging/octeon/ethernet.c                  |   7 +-
>   13 files changed, 595 insertions(+), 137 deletions(-)
>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 00/14] MIPS/staging: OCTEON: enable ethernet/xaui on CN68XX
  2015-08-13 19:16 ` [PATCH 00/14] MIPS/staging: OCTEON: enable ethernet/xaui on CN68XX David Daney
  2015-08-13 19:16   ` David Daney
@ 2015-08-14 13:09   ` Aaro Koskinen
  2015-08-14 19:49     ` David Daney
  1 sibling, 1 reply; 21+ messages in thread
From: Aaro Koskinen @ 2015-08-14 13:09 UTC (permalink / raw)
  To: David Daney
  Cc: Ralf Baechle, linux-mips, Janne Huttunen, Greg Kroah-Hartman, devel

Hi,

On Thu, Aug 13, 2015 at 12:16:43PM -0700, David Daney wrote:
> On 08/13/2015 06:21 AM, Aaro Koskinen wrote:
> >Currently mainline Linux is unusable on OCTEON II CN68XX SOCs due to
> >issues in Ethernet driver initialization. Some boards are hanging during
> >init, and all the needed register differences compared to the older SOCs
> >are not taken into account to make interrupts and packet delivery to work.
> >
> >This patch set provides a minimal support to get octeon-ethernet going
> >on CN68XX. Tested on top of 4.2-rc6 with Cavium EBB6800 and Kontron
> >S1901 boards by sending traffic over XAUI interface with busybox.
> 
> You don't say how it was tested.
> 
> Does OCTEON and OCTEON II networking continue to function?

I tested today with EBH5600 (OCTEON+) as well and networking works
as before.

> There is no SSO provisioning, so there will be limited buffering on packet
> ingress.  For low packet rates, it should be fine though.

We are aware of limitations. However, I guess this should be added...
I will take a look.

Thanks,

A.

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 00/14] MIPS/staging: OCTEON: enable ethernet/xaui on CN68XX
  2015-08-14 13:09   ` Aaro Koskinen
@ 2015-08-14 19:49     ` David Daney
  2015-08-14 19:49       ` David Daney
  2015-08-19 19:40       ` Ralf Baechle
  0 siblings, 2 replies; 21+ messages in thread
From: David Daney @ 2015-08-14 19:49 UTC (permalink / raw)
  To: Aaro Koskinen
  Cc: Ralf Baechle, linux-mips, Janne Huttunen, Greg Kroah-Hartman, devel

On 08/14/2015 06:09 AM, Aaro Koskinen wrote:
> Hi,
>
> On Thu, Aug 13, 2015 at 12:16:43PM -0700, David Daney wrote:
>> On 08/13/2015 06:21 AM, Aaro Koskinen wrote:
>>> Currently mainline Linux is unusable on OCTEON II CN68XX SOCs due to
>>> issues in Ethernet driver initialization. Some boards are hanging during
>>> init, and all the needed register differences compared to the older SOCs
>>> are not taken into account to make interrupts and packet delivery to work.
>>>
>>> This patch set provides a minimal support to get octeon-ethernet going
>>> on CN68XX. Tested on top of 4.2-rc6 with Cavium EBB6800 and Kontron
>>> S1901 boards by sending traffic over XAUI interface with busybox.
>>
>> You don't say how it was tested.
>>
>> Does OCTEON and OCTEON II networking continue to function?
>
> I tested today with EBH5600 (OCTEON+) as well and networking works
> as before.

Good, that is the main thing I was worried about.

>
>> There is no SSO provisioning, so there will be limited buffering on packet
>> ingress.  For low packet rates, it should be fine though.
>
> We are aware of limitations. However, I guess this should be added...
> I will take a look.
>

If what you have now works, I would merge this patch set, so:

Acked-by: David Daney <david.daney@cavium.com>


Follow-on improvements can be made with additional patches.

David Daney

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 00/14] MIPS/staging: OCTEON: enable ethernet/xaui on CN68XX
  2015-08-14 19:49     ` David Daney
@ 2015-08-14 19:49       ` David Daney
  2015-08-19 19:40       ` Ralf Baechle
  1 sibling, 0 replies; 21+ messages in thread
From: David Daney @ 2015-08-14 19:49 UTC (permalink / raw)
  To: Aaro Koskinen
  Cc: Ralf Baechle, linux-mips, Janne Huttunen, Greg Kroah-Hartman, devel

On 08/14/2015 06:09 AM, Aaro Koskinen wrote:
> Hi,
>
> On Thu, Aug 13, 2015 at 12:16:43PM -0700, David Daney wrote:
>> On 08/13/2015 06:21 AM, Aaro Koskinen wrote:
>>> Currently mainline Linux is unusable on OCTEON II CN68XX SOCs due to
>>> issues in Ethernet driver initialization. Some boards are hanging during
>>> init, and all the needed register differences compared to the older SOCs
>>> are not taken into account to make interrupts and packet delivery to work.
>>>
>>> This patch set provides a minimal support to get octeon-ethernet going
>>> on CN68XX. Tested on top of 4.2-rc6 with Cavium EBB6800 and Kontron
>>> S1901 boards by sending traffic over XAUI interface with busybox.
>>
>> You don't say how it was tested.
>>
>> Does OCTEON and OCTEON II networking continue to function?
>
> I tested today with EBH5600 (OCTEON+) as well and networking works
> as before.

Good, that is the main thing I was worried about.

>
>> There is no SSO provisioning, so there will be limited buffering on packet
>> ingress.  For low packet rates, it should be fine though.
>
> We are aware of limitations. However, I guess this should be added...
> I will take a look.
>

If what you have now works, I would merge this patch set, so:

Acked-by: David Daney <david.daney@cavium.com>


Follow-on improvements can be made with additional patches.

David Daney

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 00/14] MIPS/staging: OCTEON: enable ethernet/xaui on CN68XX
  2015-08-14 19:49     ` David Daney
  2015-08-14 19:49       ` David Daney
@ 2015-08-19 19:40       ` Ralf Baechle
  1 sibling, 0 replies; 21+ messages in thread
From: Ralf Baechle @ 2015-08-19 19:40 UTC (permalink / raw)
  To: David Daney
  Cc: Aaro Koskinen, linux-mips, Janne Huttunen, Greg Kroah-Hartman, devel

On Fri, Aug 14, 2015 at 12:49:58PM -0700, David Daney wrote:

> If what you have now works, I would merge this patch set, so:
> 
> Acked-by: David Daney <david.daney@cavium.com>
> 
> 
> Follow-on improvements can be made with additional patches.

Cool, thanks.  Queued for kernel $n + 1.

  Ralf

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2015-08-19 19:40 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-13 13:21 [PATCH 00/14] MIPS/staging: OCTEON: enable ethernet/xaui on CN68XX Aaro Koskinen
2015-08-13 13:21 ` [PATCH 01/14] MIPS: OCTEON: fix CN6880 hang on XAUI init Aaro Koskinen
2015-08-13 13:21 ` [PATCH 02/14] MIPS: OCTEON: support additional interfaces on CN68XX Aaro Koskinen
2015-08-13 13:21 ` [PATCH 03/14] MIPS: OCTEON: support all PIP input ports " Aaro Koskinen
2015-08-13 13:21 ` [PATCH 04/14] MIPS: OCTEON: configure XAUI pkinds Aaro Koskinen
2015-08-13 13:21 ` [PATCH 05/14] MIPS: OCTEON: configure minimum PKO packet sizes on CN68XX Aaro Koskinen
2015-08-13 13:21 ` [PATCH 06/14] MIPS: OCTEON: add definitions for setting up SSO Aaro Koskinen
2015-08-13 13:21 ` [PATCH 07/14] MIPS/staging: OCTEON: properly enable/disable SSO WQE interrupts Aaro Koskinen
2015-08-13 13:21 ` [PATCH 08/14] MIPS/staging: OCTEON: set SSO group mask properly on CN68XX Aaro Koskinen
2015-08-13 13:21 ` [PATCH 09/14] MIPS/staging: OCTEON: increase output command buffers Aaro Koskinen
2015-08-13 13:21 ` [PATCH 10/14] MIPS/staging: OCTEON: support CN68XX style WQE Aaro Koskinen
2015-08-13 13:21 ` [PATCH 11/14] MIPS: OCTEON: initialize CN68XX PKO Aaro Koskinen
2015-08-13 13:21 ` [PATCH 12/14] MIPS: OCTEON: set up 1:1 mapping between CN68XX PKO queues and ports Aaro Koskinen
2015-08-13 13:21 ` [PATCH 13/14] MIPS: OCTEON: support interfaces 4 and 5 Aaro Koskinen
2015-08-13 13:21 ` [PATCH 14/14] MIPS/staging: OCTEON: use common helpers for determining interface and port Aaro Koskinen
2015-08-13 19:16 ` [PATCH 00/14] MIPS/staging: OCTEON: enable ethernet/xaui on CN68XX David Daney
2015-08-13 19:16   ` David Daney
2015-08-14 13:09   ` Aaro Koskinen
2015-08-14 19:49     ` David Daney
2015-08-14 19:49       ` David Daney
2015-08-19 19:40       ` Ralf Baechle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).