linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: sunil.kovvuri@gmail.com (sunil.kovvuri at gmail.com)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 05/15] net: thunderx: Enable CQE_RX desc's extension fields
Date: Fri, 15 Jul 2016 18:28:10 +0530	[thread overview]
Message-ID: <1468587500-32103-6-git-send-email-sunil.kovvuri@gmail.com> (raw)
In-Reply-To: <1468587500-32103-1-git-send-email-sunil.kovvuri@gmail.com>

From: Sunil Goutham <sgoutham@cavium.com>

Unlike 88xx, CQE_RX descriptor's tunnelling extension i.e CQE_RX2_S
is always enabled on 81xx/83xx and HW does insert these fields into
CQE_RX. As a result receive buffer addresses will now be present at
7th word of CQE_RX instead of 6th.

Enable CQE_RX2_S on 88xx pass 2.x as well.

Signed-off-by: Sunil Goutham <sgoutham@cavium.com>
---
 drivers/net/ethernet/cavium/thunder/nic.h          |  9 ++++++++-
 drivers/net/ethernet/cavium/thunder/nic_main.c     |  7 +++++++
 drivers/net/ethernet/cavium/thunder/nic_reg.h      |  1 +
 drivers/net/ethernet/cavium/thunder/nicvf_queues.c | 12 +++++++++++-
 4 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/cavium/thunder/nic.h b/drivers/net/ethernet/cavium/thunder/nic.h
index 6b0b240..136db2a 100644
--- a/drivers/net/ethernet/cavium/thunder/nic.h
+++ b/drivers/net/ethernet/cavium/thunder/nic.h
@@ -493,7 +493,14 @@ static inline int nic_get_node_id(struct pci_dev *pdev)
 
 static inline bool pass1_silicon(struct pci_dev *pdev)
 {
-	return pdev->revision < 8;
+	return (pdev->revision < 8) &&
+		(pdev->subsystem_device == PCI_SUBSYS_DEVID_88XX_NIC_PF);
+}
+
+static inline bool pass2_silicon(struct pci_dev *pdev)
+{
+	return (pdev->revision >= 8) &&
+		(pdev->subsystem_device == PCI_SUBSYS_DEVID_88XX_NIC_PF);
 }
 
 int nicvf_set_real_num_queues(struct net_device *netdev,
diff --git a/drivers/net/ethernet/cavium/thunder/nic_main.c b/drivers/net/ethernet/cavium/thunder/nic_main.c
index 0d81117..3f52b36 100644
--- a/drivers/net/ethernet/cavium/thunder/nic_main.c
+++ b/drivers/net/ethernet/cavium/thunder/nic_main.c
@@ -799,6 +799,13 @@ static void nic_handle_mbx_intr(struct nicpf *nic, int vf)
 			   (mbx.rq.qs_num << NIC_QS_ID_SHIFT) |
 			   (mbx.rq.rq_num << NIC_Q_NUM_SHIFT);
 		nic_reg_write(nic, reg_addr, mbx.rq.cfg);
+		/* Enable CQE_RX2_S extension in CQE_RX descriptor.
+		 * This gets appended by default on 81xx/83xx chips,
+		 * for consistency enabling the same on 88xx pass2
+		 * where this is introduced.
+		 */
+		if (pass2_silicon(nic->pdev))
+			nic_reg_write(nic, NIC_PF_RX_CFG, 0x01);
 		break;
 	case NIC_MBOX_MSG_RQ_BP_CFG:
 		reg_addr = NIC_PF_QSET_0_127_RQ_0_7_BP_CFG |
diff --git a/drivers/net/ethernet/cavium/thunder/nic_reg.h b/drivers/net/ethernet/cavium/thunder/nic_reg.h
index 833cf3d..b4a7953 100644
--- a/drivers/net/ethernet/cavium/thunder/nic_reg.h
+++ b/drivers/net/ethernet/cavium/thunder/nic_reg.h
@@ -36,6 +36,7 @@
 #define   NIC_PF_MAILBOX_ENA_W1C		(0x0450)
 #define   NIC_PF_MAILBOX_ENA_W1S		(0x0470)
 #define   NIC_PF_RX_ETYPE_0_7			(0x0500)
+#define   NIC_PF_RX_CFG				(0x05D0)
 #define   NIC_PF_PKIND_0_15_CFG			(0x0600)
 #define   NIC_PF_ECC0_FLIP0			(0x1000)
 #define   NIC_PF_ECC1_FLIP0			(0x1008)
diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_queues.c b/drivers/net/ethernet/cavium/thunder/nicvf_queues.c
index e521a94..ca223aa 100644
--- a/drivers/net/ethernet/cavium/thunder/nicvf_queues.c
+++ b/drivers/net/ethernet/cavium/thunder/nicvf_queues.c
@@ -1190,7 +1190,17 @@ struct sk_buff *nicvf_get_rcv_skb(struct nicvf *nic, struct cqe_rx_t *cqe_rx)
 	u64 *rb_ptrs = NULL;
 
 	rb_lens = (void *)cqe_rx + (3 * sizeof(u64));
-	rb_ptrs = (void *)cqe_rx + (6 * sizeof(u64));
+	/* Except 88xx pass1 on all other chips CQE_RX2_S is added to
+	 * CQE_RX at word6, hence buffer pointers move by word
+	 *
+	 * Use existing 'hw_tso' flag which will be set for all chips
+	 * except 88xx pass1 instead of a additional cache line
+	 * access (or miss) by using pci dev's revision.
+	 */
+	if (!nic->hw_tso)
+		rb_ptrs = (void *)cqe_rx + (6 * sizeof(u64));
+	else
+		rb_ptrs = (void *)cqe_rx + (7 * sizeof(u64));
 
 	netdev_dbg(nic->netdev, "%s rb_cnt %d rb0_ptr %llx rb0_sz %d\n",
 		   __func__, cqe_rx->rb_cnt, cqe_rx->rb0_ptr, cqe_rx->rb0_sz);
-- 
2.7.4

  parent reply	other threads:[~2016-07-15 12:58 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-15 12:58 [PATCH v3 00/15] net: thunderx: Add support for 81xx and 83xx sunil.kovvuri at gmail.com
2016-07-15 12:58 ` [PATCH v3 01/15] net: thunderx: Moved HW capability info from macros to structure sunil.kovvuri at gmail.com
2016-07-15 12:58 ` [PATCH v3 02/15] net: thunderx: Add VNIC's PCI devid on future chips sunil.kovvuri at gmail.com
2016-07-15 12:58 ` [PATCH v3 03/15] net: thunderx: Add support for 81xx and 83xx chips sunil.kovvuri at gmail.com
2016-07-15 12:58 ` [PATCH v3 04/15] net: thunderx: Set queue count based on number of CPUs sunil.kovvuri at gmail.com
2016-07-15 12:58 ` sunil.kovvuri at gmail.com [this message]
2016-07-15 12:58 ` [PATCH v3 06/15] net: thunderx: Enable mailbox interrupts on 81xx/83xx sunil.kovvuri at gmail.com
2016-07-15 12:58 ` [PATCH v3 07/15] net: thunderx: Support for different LMAC types within BGX sunil.kovvuri at gmail.com
2016-07-15 12:58 ` [PATCH v3 08/15] net: thunderx: Add 81xx support to BGX driver sunil.kovvuri at gmail.com
2016-07-15 12:58 ` [PATCH v3 09/15] net: thunderx: Add QSGMII interface type support sunil.kovvuri at gmail.com
2016-07-15 12:58 ` [PATCH v3 10/15] net: thunderx: Add RGMII " sunil.kovvuri at gmail.com
2016-07-15 12:58 ` [PATCH v3 11/15] net: thunderx: Use netdev's name for naming VF's interrupts sunil.kovvuri at gmail.com
2016-07-15 12:58 ` [PATCH v3 12/15] net: thunderx: Use skb_add_rx_frag() for split buffer Rx pkts sunil.kovvuri at gmail.com
2016-07-15 12:58 ` [PATCH v3 13/15] net: thunderx: Improvement for MBX interface debug messages sunil.kovvuri at gmail.com
2016-07-15 12:58 ` [PATCH v3 14/15] net: thunderx: Reset RXQ HW stats when interface is brought down sunil.kovvuri at gmail.com
2016-07-15 12:58 ` [PATCH v3 15/15] net: thunderx: Don't set mac address for secondary Qset VFs sunil.kovvuri at gmail.com
2016-07-21  5:58 ` [PATCH v3 00/15] net: thunderx: Add support for 81xx and 83xx Sunil Kovvuri
2016-07-31 16:44   ` Sunil Kovvuri
2016-07-31 18:54     ` David Miller
2016-08-01  3:29       ` Sunil Kovvuri
2016-08-01  3:36         ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1468587500-32103-6-git-send-email-sunil.kovvuri@gmail.com \
    --to=sunil.kovvuri@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).