All of lore.kernel.org
 help / color / mirror / Atom feed
From: Veerasenareddy Burru <vburru@marvell.com>
To: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<aayarekar@marvell.com>, <sedara@marvell.com>,
	<sburla@marvell.com>
Cc: <linux-doc@vger.kernel.org>,
	Veerasenareddy Burru <vburru@marvell.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Subject: [PATCH net-next v3 3/7] octeon_ep: control mailbox for multiple PFs
Date: Mon, 13 Feb 2023 21:14:18 -0800	[thread overview]
Message-ID: <20230214051422.13705-4-vburru@marvell.com> (raw)
In-Reply-To: <20230214051422.13705-1-vburru@marvell.com>

Add control mailbox support for multiple PFs.
Update control mbox base address calculation based on PF function link.

Signed-off-by: Veerasenareddy Burru <vburru@marvell.com>
Signed-off-by: Abhijit Ayarekar <aayarekar@marvell.com>
---
v2 -> v3:
 * no change

v1 -> v2:
 * no change

 .../ethernet/marvell/octeon_ep/octep_cn9k_pf.c   | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_cn9k_pf.c b/drivers/net/ethernet/marvell/octeon_ep/octep_cn9k_pf.c
index f40ebac15a79..c82a1347eed8 100644
--- a/drivers/net/ethernet/marvell/octeon_ep/octep_cn9k_pf.c
+++ b/drivers/net/ethernet/marvell/octeon_ep/octep_cn9k_pf.c
@@ -13,6 +13,9 @@
 #include "octep_main.h"
 #include "octep_regs_cn9k_pf.h"
 
+#define CTRL_MBOX_MAX_PF	128
+#define CTRL_MBOX_SZ		((size_t)(0x400000 / CTRL_MBOX_MAX_PF))
+
 /* Names of Hardware non-queue generic interrupts */
 static char *cn93_non_ioq_msix_names[] = {
 	"epf_ire_rint",
@@ -199,6 +202,8 @@ static void octep_init_config_cn93_pf(struct octep_device *oct)
 	struct octep_config *conf = oct->conf;
 	struct pci_dev *pdev = oct->pdev;
 	u64 val;
+	int pos;
+	u8 link = 0;
 
 	/* Read ring configuration:
 	 * PF ring count, number of VFs and rings per VF supported
@@ -234,7 +239,16 @@ static void octep_init_config_cn93_pf(struct octep_device *oct)
 	conf->msix_cfg.ioq_msix = conf->pf_ring_cfg.active_io_rings;
 	conf->msix_cfg.non_ioq_msix_names = cn93_non_ioq_msix_names;
 
-	conf->ctrl_mbox_cfg.barmem_addr = (void __iomem *)oct->mmio[2].hw_addr + (0x400000ull * 7);
+	pos = pci_find_ext_capability(oct->pdev, PCI_EXT_CAP_ID_SRIOV);
+	if (pos) {
+		pci_read_config_byte(oct->pdev,
+				     pos + PCI_SRIOV_FUNC_LINK,
+				     &link);
+		link = PCI_DEVFN(PCI_SLOT(oct->pdev->devfn), link);
+	}
+	conf->ctrl_mbox_cfg.barmem_addr = (void __iomem *)oct->mmio[2].hw_addr +
+					   (0x400000ull * 8) +
+					   (link * CTRL_MBOX_SZ);
 }
 
 /* Setup registers for a hardware Tx Queue  */
-- 
2.36.0


  parent reply	other threads:[~2023-02-14  5:15 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-14  5:14 [PATCH net-next v3 0/7] octeon_ep: deferred probe and mailbox Veerasenareddy Burru
2023-02-14  5:14 ` [PATCH net-next v3 1/7] octeon_ep: defer probe if firmware not ready Veerasenareddy Burru
2023-02-14 17:32   ` Maciej Fijalkowski
2023-02-15 11:43     ` Leon Romanovsky
2023-02-17  8:21     ` [EXT] " Veerasenareddy Burru
2023-02-14  5:14 ` [PATCH net-next v3 2/7] octeon_ep: poll for control messages Veerasenareddy Burru
2023-02-14 17:42   ` Maciej Fijalkowski
2023-02-17  8:25     ` [EXT] " Veerasenareddy Burru
2023-02-14  5:14 ` Veerasenareddy Burru [this message]
2023-02-14 17:49   ` [PATCH net-next v3 3/7] octeon_ep: control mailbox for multiple PFs Maciej Fijalkowski
2023-02-17 17:15     ` [EXT] " Veerasenareddy Burru
2023-02-14  5:14 ` [PATCH net-next v3 4/7] octeon_ep: enhance control mailbox for VF support Veerasenareddy Burru
2023-02-15 15:55   ` Maciej Fijalkowski
2023-03-22  7:24     ` [EXT] " Veerasenareddy Burru
2023-02-14  5:14 ` [PATCH net-next v3 5/7] octeon_ep: support asynchronous notifications Veerasenareddy Burru
2023-02-15 16:36   ` Maciej Fijalkowski
2023-03-22  7:26     ` [EXT] " Veerasenareddy Burru
2023-02-14  5:14 ` [PATCH net-next v3 6/7] octeon_ep: control mbox support for VF stats and link info Veerasenareddy Burru
2023-02-14  5:14 ` [PATCH net-next v3 7/7] octeon_ep: add heartbeat monitor Veerasenareddy Burru

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=20230214051422.13705-4-vburru@marvell.com \
    --to=vburru@marvell.com \
    --cc=aayarekar@marvell.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sburla@marvell.com \
    --cc=sedara@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.