netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: sundeep.lkml@gmail.com
To: davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org
Cc: rsaladi2@marvell.com, sgoutham@marvell.com,
	Subbaraya Sundeep <sbhatta@marvell.com>
Subject: [net-next PATCH 08/10] octeontx2-pf: Calculate LBK link instead of hardcoding
Date: Tue, 13 Oct 2020 15:56:30 +0530	[thread overview]
Message-ID: <1602584792-22274-9-git-send-email-sundeep.lkml@gmail.com> (raw)
In-Reply-To: <1602584792-22274-1-git-send-email-sundeep.lkml@gmail.com>

From: Subbaraya Sundeep <sbhatta@marvell.com>

CGX links are followed by LBK links but number of
CGX and LBK links varies between platforms. Hence
get the number of links present in hardware from
AF and use it to calculate LBK link number.

Signed-off-by: Subbaraya Sundeep <sbhatta@marvell.com>
Signed-off-by: Sunil Goutham <sgoutham@marvell.com>
Signed-off-by: Rakesh Babu <rsaladi2@marvell.com>
---
 drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c | 8 ++++++--
 drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h | 2 ++
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
index d258109..fc765e8 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
@@ -531,8 +531,10 @@ static int otx2_get_link(struct otx2_nic *pfvf)
 		link = 4 * ((map >> 8) & 0xF) + ((map >> 4) & 0xF);
 	}
 	/* LBK channel */
-	if (pfvf->hw.tx_chan_base < SDP_CHAN_BASE)
-		link = 12;
+	if (pfvf->hw.tx_chan_base < SDP_CHAN_BASE) {
+		map = pfvf->hw.tx_chan_base & 0x7FF;
+		link = pfvf->hw.cgx_links | ((map >> 8) & 0xF);
+	}
 
 	return link;
 }
@@ -1503,6 +1505,8 @@ void mbox_handler_nix_lf_alloc(struct otx2_nic *pfvf,
 	pfvf->hw.tx_chan_base = rsp->tx_chan_base;
 	pfvf->hw.lso_tsov4_idx = rsp->lso_tsov4_idx;
 	pfvf->hw.lso_tsov6_idx = rsp->lso_tsov6_idx;
+	pfvf->hw.cgx_links = rsp->cgx_links;
+	pfvf->hw.lbk_links = rsp->lbk_links;
 }
 EXPORT_SYMBOL(mbox_handler_nix_lf_alloc);
 
diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
index d6253f2..386cb08 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
@@ -197,6 +197,8 @@ struct otx2_hw {
 	struct otx2_drv_stats	drv_stats;
 	u64			cgx_rx_stats[CGX_RX_STATS_COUNT];
 	u64			cgx_tx_stats[CGX_TX_STATS_COUNT];
+	u8			cgx_links;  /* No. of CGX links present in HW */
+	u8			lbk_links;  /* No. of LBK links present in HW */
 };
 
 struct otx2_vf_config {
-- 
2.7.4


  parent reply	other threads:[~2020-10-13 10:27 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-13 10:26 [net-next PATCH 00/10] Support for OcteonTx2 98xx silcion sundeep.lkml
2020-10-13 10:26 ` [net-next PATCH 01/10] octeontx2-af: Update get/set resource count functions sundeep.lkml
2020-10-15 15:57   ` Jesse Brandeburg
2020-10-16  3:31     ` sundeep subbaraya
2020-10-13 10:26 ` [net-next PATCH 02/10] octeontx2-af: Manage new blocks in 98xx sundeep.lkml
2020-10-13 10:26 ` [net-next PATCH 03/10] octeontx2-af: Initialize NIX1 block sundeep.lkml
2020-10-13 10:26 ` [net-next PATCH 04/10] octeontx2-af: Map NIX block from CGX connection sundeep.lkml
2020-10-13 10:26 ` [net-next PATCH 05/10] octeontx2-af: Setup MCE context for assigned NIX sundeep.lkml
2020-10-13 10:26 ` [net-next PATCH 06/10] octeontx2-af: Add NIX1 interfaces to NPC sundeep.lkml
2020-10-15  2:48   ` Jakub Kicinski
2020-10-15 12:23     ` sundeep subbaraya
2020-10-15 15:32       ` Jakub Kicinski
2020-10-16  3:29         ` sundeep subbaraya
2020-10-16 17:48           ` Jakub Kicinski
2020-10-17  4:52             ` sundeep subbaraya
2020-10-18 16:11               ` Jakub Kicinski
2020-10-19 12:45                 ` sundeep subbaraya
2020-10-13 10:26 ` [net-next PATCH 07/10] octeontx2-af: Mbox changes for 98xx sundeep.lkml
2020-10-13 10:26 ` sundeep.lkml [this message]
2020-10-13 10:26 ` [net-next PATCH 09/10] octeontx2-af: Display NIX1 also in debugfs sundeep.lkml
2020-10-13 10:26 ` [net-next PATCH 10/10] octeontx2-af: Display CGX, NIX and PF map " sundeep.lkml

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=1602584792-22274-9-git-send-email-sundeep.lkml@gmail.com \
    --to=sundeep.lkml@gmail.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=rsaladi2@marvell.com \
    --cc=sbhatta@marvell.com \
    --cc=sgoutham@marvell.com \
    /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).