linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] net: thunderx: Support pass-2 revision hardware.
@ 2015-10-24  0:14 David Daney
  2015-10-24  0:14 ` [PATCH 1/4] net: thunderx: Remove PF soft reset David Daney
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: David Daney @ 2015-10-24  0:14 UTC (permalink / raw)
  To: linux-kernel, linux-arm-kernel, netdev, Sunil Goutham, Robert Richter
  Cc: David Daney

From: David Daney <david.daney@cavium.com>

With the availability of a new revision of the ThunderX NIC hardware a
few changes to the driver are required.  With these, the driver works
on all currently available hardware revisions.

David Daney (1):
  net: thunderx: Rewrite silicon revision tests.

Sunil Goutham (2):
  net: thunderx: Remove PF soft reset.
  net: thunderx: Fix incorrect subsystem devid of VF on pass2 silicon

Thanneeru Srinivasulu (1):
  net: thunderx: Incorporate pass2 silicon CPI index configuration
    changes

 drivers/net/ethernet/cavium/thunder/nic_main.c   | 42 ++++++++++++++++--------
 drivers/net/ethernet/cavium/thunder/nic_reg.h    |  4 +++
 drivers/net/ethernet/cavium/thunder/nicvf_main.c |  2 +-
 3 files changed, 34 insertions(+), 14 deletions(-)

-- 
1.8.3.1


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

* [PATCH 1/4] net: thunderx: Remove PF soft reset.
  2015-10-24  0:14 [PATCH 0/4] net: thunderx: Support pass-2 revision hardware David Daney
@ 2015-10-24  0:14 ` David Daney
  2015-10-24  0:14 ` [PATCH 2/4] net: thunderx: Fix incorrect subsystem devid of VF on pass2 silicon David Daney
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: David Daney @ 2015-10-24  0:14 UTC (permalink / raw)
  To: linux-kernel, linux-arm-kernel, netdev, Sunil Goutham, Robert Richter
  Cc: David Daney

From: Sunil Goutham <sgoutham@cavium.com>

In some silicon revisions, the soft reset clobbers PCI config space,
so quit doing the reset.

Signed-off-by: Sunil Goutham <sgoutham@cavium.com>
Signed-off-by: David Daney <david.daney@cavium.com>
---
 drivers/net/ethernet/cavium/thunder/nic_main.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/net/ethernet/cavium/thunder/nic_main.c b/drivers/net/ethernet/cavium/thunder/nic_main.c
index b3a5947..d6e3219 100644
--- a/drivers/net/ethernet/cavium/thunder/nic_main.c
+++ b/drivers/net/ethernet/cavium/thunder/nic_main.c
@@ -305,9 +305,6 @@ static void nic_init_hw(struct nicpf *nic)
 {
 	int i;
 
-	/* Reset NIC, in case the driver is repeatedly inserted and removed */
-	nic_reg_write(nic, NIC_PF_SOFT_RESET, 1);
-
 	/* Enable NIC HW block */
 	nic_reg_write(nic, NIC_PF_CFG, 0x3);
 
-- 
1.8.3.1


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

* [PATCH 2/4] net: thunderx: Fix incorrect subsystem devid of VF on pass2 silicon
  2015-10-24  0:14 [PATCH 0/4] net: thunderx: Support pass-2 revision hardware David Daney
  2015-10-24  0:14 ` [PATCH 1/4] net: thunderx: Remove PF soft reset David Daney
@ 2015-10-24  0:14 ` David Daney
  2015-10-24  0:14 ` [PATCH 3/4] net: thunderx: Rewrite silicon revision tests David Daney
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: David Daney @ 2015-10-24  0:14 UTC (permalink / raw)
  To: linux-kernel, linux-arm-kernel, netdev, Sunil Goutham, Robert Richter
  Cc: David Daney

From: Sunil Goutham <sgoutham@cavium.com>

Signed-off-by: Sunil Goutham <sgoutham@cavium.com>
Signed-off-by: David Daney <david.daney@cavium.com>
---
 drivers/net/ethernet/cavium/thunder/nicvf_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_main.c b/drivers/net/ethernet/cavium/thunder/nicvf_main.c
index b63e579..a937772 100644
--- a/drivers/net/ethernet/cavium/thunder/nicvf_main.c
+++ b/drivers/net/ethernet/cavium/thunder/nicvf_main.c
@@ -29,7 +29,7 @@
 static const struct pci_device_id nicvf_id_table[] = {
 	{ PCI_DEVICE_SUB(PCI_VENDOR_ID_CAVIUM,
 			 PCI_DEVICE_ID_THUNDER_NIC_VF,
-			 PCI_VENDOR_ID_CAVIUM, 0xA11E) },
+			 PCI_VENDOR_ID_CAVIUM, 0xA134) },
 	{ PCI_DEVICE_SUB(PCI_VENDOR_ID_CAVIUM,
 			 PCI_DEVICE_ID_THUNDER_PASS1_NIC_VF,
 			 PCI_VENDOR_ID_CAVIUM, 0xA11E) },
-- 
1.8.3.1


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

* [PATCH 3/4] net: thunderx: Rewrite silicon revision tests.
  2015-10-24  0:14 [PATCH 0/4] net: thunderx: Support pass-2 revision hardware David Daney
  2015-10-24  0:14 ` [PATCH 1/4] net: thunderx: Remove PF soft reset David Daney
  2015-10-24  0:14 ` [PATCH 2/4] net: thunderx: Fix incorrect subsystem devid of VF on pass2 silicon David Daney
@ 2015-10-24  0:14 ` David Daney
  2015-10-24  0:14 ` [PATCH 4/4] net: thunderx: Incorporate pass2 silicon CPI index configuration changes David Daney
  2015-10-26  1:16 ` [PATCH 0/4] net: thunderx: Support pass-2 revision hardware David Miller
  4 siblings, 0 replies; 6+ messages in thread
From: David Daney @ 2015-10-24  0:14 UTC (permalink / raw)
  To: linux-kernel, linux-arm-kernel, netdev, Sunil Goutham, Robert Richter
  Cc: David Daney

From: David Daney <david.daney@cavium.com>

The test for pass-1 silicon was incorrect, it should be for all
revisions less than 8.  Also the revision is already present in the
pci_dev, so there is no need to read and keep a private copy.

Remove rev_id and code to read it from struct nicpf.  Create new
static inline function pass1_silicon() to be used to testing the
silicon version.  Use pass1_silicon() for revision checks, this will
be more widely used in follow on patches.

Signed-off-by: David Daney <david.daney@cavium.com>
---
 drivers/net/ethernet/cavium/thunder/nic_main.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/cavium/thunder/nic_main.c b/drivers/net/ethernet/cavium/thunder/nic_main.c
index d6e3219..52e1acb 100644
--- a/drivers/net/ethernet/cavium/thunder/nic_main.c
+++ b/drivers/net/ethernet/cavium/thunder/nic_main.c
@@ -22,7 +22,6 @@
 
 struct nicpf {
 	struct pci_dev		*pdev;
-	u8			rev_id;
 	u8			node;
 	unsigned int		flags;
 	u8			num_vf_en;      /* No of VF enabled */
@@ -54,6 +53,11 @@ struct nicpf {
 	bool			irq_allocated[NIC_PF_MSIX_VECTORS];
 };
 
+static inline bool pass1_silicon(struct nicpf *nic)
+{
+	return nic->pdev->revision < 8;
+}
+
 /* Supported devices */
 static const struct pci_device_id nic_id_table[] = {
 	{ PCI_DEVICE(PCI_VENDOR_ID_CAVIUM, PCI_DEVICE_ID_THUNDER_NIC_PF) },
@@ -117,7 +121,7 @@ static void nic_send_msg_to_vf(struct nicpf *nic, int vf, union nic_mbx *mbx)
 	 * when PF writes to MBOX(1), in next revisions when
 	 * PF writes to MBOX(0)
 	 */
-	if (nic->rev_id == 0) {
+	if (pass1_silicon(nic)) {
 		/* see the comment for nic_reg_write()/nic_reg_read()
 		 * functions above
 		 */
@@ -998,8 +1002,6 @@ static int nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 		goto err_release_regions;
 	}
 
-	pci_read_config_byte(pdev, PCI_REVISION_ID, &nic->rev_id);
-
 	nic->node = nic_get_node_id(pdev);
 
 	nic_set_lmac_vf_mapping(nic);
-- 
1.8.3.1


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

* [PATCH 4/4] net: thunderx: Incorporate pass2 silicon CPI index configuration changes
  2015-10-24  0:14 [PATCH 0/4] net: thunderx: Support pass-2 revision hardware David Daney
                   ` (2 preceding siblings ...)
  2015-10-24  0:14 ` [PATCH 3/4] net: thunderx: Rewrite silicon revision tests David Daney
@ 2015-10-24  0:14 ` David Daney
  2015-10-26  1:16 ` [PATCH 0/4] net: thunderx: Support pass-2 revision hardware David Miller
  4 siblings, 0 replies; 6+ messages in thread
From: David Daney @ 2015-10-24  0:14 UTC (permalink / raw)
  To: linux-kernel, linux-arm-kernel, netdev, Sunil Goutham, Robert Richter
  Cc: Thanneeru Srinivasulu, David Daney

From: Thanneeru Srinivasulu <tsrinivasulu@caviumnetworks.com>

Add support for ThunderX pass2 CPI and MPI configuration changes.
MPI_ALG is not enabled i.e MCAM parsing is disabled.

Signed-off-by: Thanneeru Srinivasulu <tsrinivasulu@caviumnetworks.com>
Signed-off-by: Sunil Goutham <sgoutham@cavium.com>
Signed-off-by: David Daney <david.daney@cavium.com>
---
 drivers/net/ethernet/cavium/thunder/nic_main.c | 29 ++++++++++++++++++++------
 drivers/net/ethernet/cavium/thunder/nic_reg.h  |  4 ++++
 2 files changed, 27 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/cavium/thunder/nic_main.c b/drivers/net/ethernet/cavium/thunder/nic_main.c
index 52e1acb..c561fdc 100644
--- a/drivers/net/ethernet/cavium/thunder/nic_main.c
+++ b/drivers/net/ethernet/cavium/thunder/nic_main.c
@@ -43,6 +43,7 @@ struct nicpf {
 	u8			duplex[MAX_LMAC];
 	u32			speed[MAX_LMAC];
 	u16			cpi_base[MAX_NUM_VFS_SUPPORTED];
+	u16			rssi_base[MAX_NUM_VFS_SUPPORTED];
 	u16			rss_ind_tbl_size;
 	bool			mbx_lock[MAX_NUM_VFS_SUPPORTED];
 
@@ -396,8 +397,18 @@ static void nic_config_cpi(struct nicpf *nic, struct cpi_cfg_msg *cfg)
 			padd = cpi % 8; /* 3 bits CS out of 6bits DSCP */
 
 		/* Leave RSS_SIZE as '0' to disable RSS */
-		nic_reg_write(nic, NIC_PF_CPI_0_2047_CFG | (cpi << 3),
-			      (vnic << 24) | (padd << 16) | (rssi_base + rssi));
+		if (pass1_silicon(nic)) {
+			nic_reg_write(nic, NIC_PF_CPI_0_2047_CFG | (cpi << 3),
+				      (vnic << 24) | (padd << 16) |
+				      (rssi_base + rssi));
+		} else {
+			/* Set MPI_ALG to '0' to disable MCAM parsing */
+			nic_reg_write(nic, NIC_PF_CPI_0_2047_CFG | (cpi << 3),
+				      (padd << 16));
+			/* MPI index is same as CPI if MPI_ALG is not enabled */
+			nic_reg_write(nic, NIC_PF_MPI_0_2047_CFG | (cpi << 3),
+				      (vnic << 24) | (rssi_base + rssi));
+		}
 
 		if ((rssi + 1) >= cfg->rq_cnt)
 			continue;
@@ -410,6 +421,7 @@ static void nic_config_cpi(struct nicpf *nic, struct cpi_cfg_msg *cfg)
 			rssi = ((cpi - cpi_base) & 0x38) >> 3;
 	}
 	nic->cpi_base[cfg->vf_id] = cpi_base;
+	nic->rssi_base[cfg->vf_id] = rssi_base;
 }
 
 /* Responsds to VF with its RSS indirection table size */
@@ -435,10 +447,9 @@ static void nic_config_rss(struct nicpf *nic, struct rss_cfg_msg *cfg)
 {
 	u8  qset, idx = 0;
 	u64 cpi_cfg, cpi_base, rssi_base, rssi;
+	u64 idx_addr;
 
-	cpi_base = nic->cpi_base[cfg->vf_id];
-	cpi_cfg = nic_reg_read(nic, NIC_PF_CPI_0_2047_CFG | (cpi_base << 3));
-	rssi_base = (cpi_cfg & 0x0FFF) + cfg->tbl_offset;
+	rssi_base = nic->rssi_base[cfg->vf_id] + cfg->tbl_offset;
 
 	rssi = rssi_base;
 	qset = cfg->vf_id;
@@ -455,9 +466,15 @@ static void nic_config_rss(struct nicpf *nic, struct rss_cfg_msg *cfg)
 		idx++;
 	}
 
+	cpi_base = nic->cpi_base[cfg->vf_id];
+	if (pass1_silicon(nic))
+		idx_addr = NIC_PF_CPI_0_2047_CFG;
+	else
+		idx_addr = NIC_PF_MPI_0_2047_CFG;
+	cpi_cfg = nic_reg_read(nic, idx_addr | (cpi_base << 3));
 	cpi_cfg &= ~(0xFULL << 20);
 	cpi_cfg |= (cfg->hash_bits << 20);
-	nic_reg_write(nic, NIC_PF_CPI_0_2047_CFG | (cpi_base << 3), cpi_cfg);
+	nic_reg_write(nic, idx_addr | (cpi_base << 3), cpi_cfg);
 }
 
 /* 4 level transmit side scheduler configutation
diff --git a/drivers/net/ethernet/cavium/thunder/nic_reg.h b/drivers/net/ethernet/cavium/thunder/nic_reg.h
index 58197bb..dd536be 100644
--- a/drivers/net/ethernet/cavium/thunder/nic_reg.h
+++ b/drivers/net/ethernet/cavium/thunder/nic_reg.h
@@ -85,7 +85,11 @@
 #define   NIC_PF_ECC3_DBE_INT_W1S		(0x2708)
 #define   NIC_PF_ECC3_DBE_ENA_W1C		(0x2710)
 #define   NIC_PF_ECC3_DBE_ENA_W1S		(0x2718)
+#define   NIC_PF_MCAM_0_191_ENA			(0x100000)
+#define   NIC_PF_MCAM_0_191_M_0_5_DATA		(0x110000)
+#define   NIC_PF_MCAM_CTRL			(0x120000)
 #define   NIC_PF_CPI_0_2047_CFG			(0x200000)
+#define   NIC_PF_MPI_0_2047_CFG			(0x210000)
 #define   NIC_PF_RSSI_0_4097_RQ			(0x220000)
 #define   NIC_PF_LMAC_0_7_CFG			(0x240000)
 #define   NIC_PF_LMAC_0_7_SW_XOFF		(0x242000)
-- 
1.8.3.1


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

* Re: [PATCH 0/4] net: thunderx: Support pass-2 revision hardware.
  2015-10-24  0:14 [PATCH 0/4] net: thunderx: Support pass-2 revision hardware David Daney
                   ` (3 preceding siblings ...)
  2015-10-24  0:14 ` [PATCH 4/4] net: thunderx: Incorporate pass2 silicon CPI index configuration changes David Daney
@ 2015-10-26  1:16 ` David Miller
  4 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2015-10-26  1:16 UTC (permalink / raw)
  To: ddaney.cavm
  Cc: linux-kernel, linux-arm-kernel, netdev, sgoutham, rric, david.daney

From: David Daney <ddaney.cavm@gmail.com>
Date: Fri, 23 Oct 2015 17:14:06 -0700

> With the availability of a new revision of the ThunderX NIC hardware a
> few changes to the driver are required.  With these, the driver works
> on all currently available hardware revisions.

Series applied, thanks.

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

end of thread, other threads:[~2015-10-26  1:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-24  0:14 [PATCH 0/4] net: thunderx: Support pass-2 revision hardware David Daney
2015-10-24  0:14 ` [PATCH 1/4] net: thunderx: Remove PF soft reset David Daney
2015-10-24  0:14 ` [PATCH 2/4] net: thunderx: Fix incorrect subsystem devid of VF on pass2 silicon David Daney
2015-10-24  0:14 ` [PATCH 3/4] net: thunderx: Rewrite silicon revision tests David Daney
2015-10-24  0:14 ` [PATCH 4/4] net: thunderx: Incorporate pass2 silicon CPI index configuration changes David Daney
2015-10-26  1:16 ` [PATCH 0/4] net: thunderx: Support pass-2 revision hardware David Miller

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).