2023-03-22 09:30:46

by Veerasenareddy Burru

[permalink] [raw]
Subject: [PATCH net-next v4 0/8] octeon_ep: deferred probe and mailbox

Implement Deferred probe, mailbox enhancements and heartbeat monitor.

v3 -> v4:
- addressed review comments on v3
https://lore.kernel.org/all/[email protected]/
- 0004-xxx.patch v3 is split into 0004-xxx.patch and 0005-xxx.patch
in v4.
- API changes to accept function ID are moved to 0005-xxx.patch.
- fixed rct violations.
- reverted newly added changes that do not yet have use cases.

v2 -> v3:
- removed SRIOV VF support changes from v2, as new drivers which use
ndo_get_vf_xxx() and ndo_set_vf_xxx() are not accepted.
https://lore.kernel.org/all/[email protected]/

Will implement VF representors and submit again.
- 0007-xxx.patch and 0008-xxx.patch from v2 are removed and
0009-xxx.patch in v2 is now 0007-xxx.patch in v3.
- accordingly, changed title for cover letter.

v1 -> v2:
- remove separate workqueue task to wait for firmware ready.
instead defer probe when firmware is not ready.
Reported-by: Leon Romanovsky <[email protected]>
- This change has resulted in update of 0001-xxx.patch and
all other patches in the patchset.

Veerasenareddy Burru (8):
octeon_ep: defer probe if firmware not ready
octeon_ep: poll for control messages
octeon_ep: control mailbox for multiple PFs
octeon_ep: add separate mailbox command and response queues
octeon_ep: include function id in mailbox commands
octeon_ep: support asynchronous notifications
octeon_ep: function id in link info and stats mailbox commands
octeon_ep: add heartbeat monitor

.../marvell/octeon_ep/octep_cn9k_pf.c | 72 ++--
.../ethernet/marvell/octeon_ep/octep_config.h | 6 +
.../marvell/octeon_ep/octep_ctrl_mbox.c | 276 +++++++------
.../marvell/octeon_ep/octep_ctrl_mbox.h | 88 ++--
.../marvell/octeon_ep/octep_ctrl_net.c | 387 ++++++++++++------
.../marvell/octeon_ep/octep_ctrl_net.h | 196 +++++----
.../marvell/octeon_ep/octep_ethtool.c | 12 +-
.../ethernet/marvell/octeon_ep/octep_main.c | 181 +++++---
.../ethernet/marvell/octeon_ep/octep_main.h | 18 +-
.../marvell/octeon_ep/octep_regs_cn9k_pf.h | 6 +
10 files changed, 785 insertions(+), 457 deletions(-)


base-commit: 56c874f7dbcab2ab5cf8055d46a2ef36dec3d664
--
2.36.0


2023-03-22 09:32:05

by Veerasenareddy Burru

[permalink] [raw]
Subject: [PATCH net-next v4 6/8] octeon_ep: support asynchronous notifications

Add asynchronous notification support to the control mailbox.

Signed-off-by: Veerasenareddy Burru <[email protected]>
Signed-off-by: Abhijit Ayarekar <[email protected]>
---
v3 -> v4:
* 0005-xxx.patch in v3 is 0006-xxx.patch in v4.
* addressed review comments
https://lore.kernel.org/all/Y+0J94sowllCe5Gs@boxer/
- fixed rct violation.
- process_mbox_notify() now returns void.

v2 -> v3:
* no change

v1 -> v2:
* no change

.../marvell/octeon_ep/octep_ctrl_net.c | 29 +++++++++++++++++++
1 file changed, 29 insertions(+)

diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_ctrl_net.c b/drivers/net/ethernet/marvell/octeon_ep/octep_ctrl_net.c
index cef4bc3b1ec0..465eef2824e3 100644
--- a/drivers/net/ethernet/marvell/octeon_ep/octep_ctrl_net.c
+++ b/drivers/net/ethernet/marvell/octeon_ep/octep_ctrl_net.c
@@ -271,6 +271,33 @@ static void process_mbox_resp(struct octep_device *oct,
}
}

+static int process_mbox_notify(struct octep_device *oct,
+ struct octep_ctrl_mbox_msg *msg)
+{
+ struct net_device *netdev = oct->netdev;
+ struct octep_ctrl_net_f2h_req *req;
+
+ req = (struct octep_ctrl_net_f2h_req *)msg->sg_list[0].msg;
+ switch (req->hdr.s.cmd) {
+ case OCTEP_CTRL_NET_F2H_CMD_LINK_STATUS:
+ if (netif_running(netdev)) {
+ if (req->link.state) {
+ dev_info(&oct->pdev->dev, "netif_carrier_on\n");
+ netif_carrier_on(netdev);
+ } else {
+ dev_info(&oct->pdev->dev, "netif_carrier_off\n");
+ netif_carrier_off(netdev);
+ }
+ }
+ break;
+ default:
+ pr_info("Unknown mbox req : %u\n", req->hdr.s.cmd);
+ break;
+ }
+
+ return 0;
+}
+
void octep_ctrl_net_recv_fw_messages(struct octep_device *oct)
{
static u16 msg_sz = sizeof(union octep_ctrl_net_max_data);
@@ -291,6 +318,8 @@ void octep_ctrl_net_recv_fw_messages(struct octep_device *oct)

if (msg.hdr.s.flags & OCTEP_CTRL_MBOX_MSG_HDR_FLAG_RESP)
process_mbox_resp(oct, &msg);
+ else if (msg.hdr.s.flags & OCTEP_CTRL_MBOX_MSG_HDR_FLAG_NOTIFY)
+ process_mbox_notify(oct, &msg);
}
}

--
2.36.0

2023-03-23 10:45:36

by Leon Romanovsky

[permalink] [raw]
Subject: Re: [PATCH net-next v4 6/8] octeon_ep: support asynchronous notifications

On Wed, Mar 22, 2023 at 02:19:55AM -0700, Veerasenareddy Burru wrote:
> Add asynchronous notification support to the control mailbox.
>
> Signed-off-by: Veerasenareddy Burru <[email protected]>
> Signed-off-by: Abhijit Ayarekar <[email protected]>
> ---
> v3 -> v4:
> * 0005-xxx.patch in v3 is 0006-xxx.patch in v4.
> * addressed review comments
> https://lore.kernel.org/all/Y+0J94sowllCe5Gs@boxer/
> - fixed rct violation.
> - process_mbox_notify() now returns void.
>
> v2 -> v3:
> * no change
>
> v1 -> v2:
> * no change
>
> .../marvell/octeon_ep/octep_ctrl_net.c | 29 +++++++++++++++++++
> 1 file changed, 29 insertions(+)
>
> diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_ctrl_net.c b/drivers/net/ethernet/marvell/octeon_ep/octep_ctrl_net.c
> index cef4bc3b1ec0..465eef2824e3 100644
> --- a/drivers/net/ethernet/marvell/octeon_ep/octep_ctrl_net.c
> +++ b/drivers/net/ethernet/marvell/octeon_ep/octep_ctrl_net.c
> @@ -271,6 +271,33 @@ static void process_mbox_resp(struct octep_device *oct,
> }
> }
>
> +static int process_mbox_notify(struct octep_device *oct,
> + struct octep_ctrl_mbox_msg *msg)
> +{
> + struct net_device *netdev = oct->netdev;
> + struct octep_ctrl_net_f2h_req *req;
> +
> + req = (struct octep_ctrl_net_f2h_req *)msg->sg_list[0].msg;
> + switch (req->hdr.s.cmd) {
> + case OCTEP_CTRL_NET_F2H_CMD_LINK_STATUS:
> + if (netif_running(netdev)) {
> + if (req->link.state) {
> + dev_info(&oct->pdev->dev, "netif_carrier_on\n");
> + netif_carrier_on(netdev);
> + } else {
> + dev_info(&oct->pdev->dev, "netif_carrier_off\n");
> + netif_carrier_off(netdev);
> + }

Shouldn't netdev changes be protected by some lock?
Is is safe to get event from FW and process it as is?

Thanks

2023-03-23 17:26:47

by Veerasenareddy Burru

[permalink] [raw]
Subject: RE: [EXT] Re: [PATCH net-next v4 6/8] octeon_ep: support asynchronous notifications



> -----Original Message-----
> From: Leon Romanovsky <[email protected]>
> Sent: Thursday, March 23, 2023 3:39 AM
> To: Veerasenareddy Burru <[email protected]>
> Cc: [email protected]; [email protected]; Abhijit Ayarekar
> <[email protected]>; Sathesh B Edara <[email protected]>;
> Satananda Burla <[email protected]>; [email protected]; David S.
> Miller <[email protected]>; Eric Dumazet <[email protected]>;
> Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>
> Subject: [EXT] Re: [PATCH net-next v4 6/8] octeon_ep: support
> asynchronous notifications
>
> External Email
>
> ----------------------------------------------------------------------
> On Wed, Mar 22, 2023 at 02:19:55AM -0700, Veerasenareddy Burru wrote:
> > Add asynchronous notification support to the control mailbox.
> >
> > Signed-off-by: Veerasenareddy Burru <[email protected]>
> > Signed-off-by: Abhijit Ayarekar <[email protected]>
> > ---
> > v3 -> v4:
> > * 0005-xxx.patch in v3 is 0006-xxx.patch in v4.
> > * addressed review comments
> > https://urldefense.proofpoint.com/v2/url?u=https-
> 3A__lore.kernel.org_all_Y-2B0J94sowllCe5Gs-
> 40boxer_&d=DwIBAg&c=nKjWec2b6R0mOyPaz7xtfQ&r=XkP_75lnbPIeeucsP
> X36ZgjiMqEKttwZfwNyWMCLjT0&m=5CnsD-
> SX6ZoW98szwM0k4IXgNC3wY0EwCQHxDKGyNIRUJxdaNe3zorLcOhc9iU6d&s
> =k73McQSsjbjj87VbCCB8EFFtGWtksMIGhn15RK12XF8&e=
> > - fixed rct violation.
> > - process_mbox_notify() now returns void.
> >
> > v2 -> v3:
> > * no change
> >
> > v1 -> v2:
> > * no change
> >
> > .../marvell/octeon_ep/octep_ctrl_net.c | 29 +++++++++++++++++++
> > 1 file changed, 29 insertions(+)
> >
> > diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_ctrl_net.c
> > b/drivers/net/ethernet/marvell/octeon_ep/octep_ctrl_net.c
> > index cef4bc3b1ec0..465eef2824e3 100644
> > --- a/drivers/net/ethernet/marvell/octeon_ep/octep_ctrl_net.c
> > +++ b/drivers/net/ethernet/marvell/octeon_ep/octep_ctrl_net.c
> > @@ -271,6 +271,33 @@ static void process_mbox_resp(struct
> octep_device *oct,
> > }
> > }
> >
> > +static int process_mbox_notify(struct octep_device *oct,
> > + struct octep_ctrl_mbox_msg *msg) {
> > + struct net_device *netdev = oct->netdev;
> > + struct octep_ctrl_net_f2h_req *req;
> > +
> > + req = (struct octep_ctrl_net_f2h_req *)msg->sg_list[0].msg;
> > + switch (req->hdr.s.cmd) {
> > + case OCTEP_CTRL_NET_F2H_CMD_LINK_STATUS:
> > + if (netif_running(netdev)) {
> > + if (req->link.state) {
> > + dev_info(&oct->pdev->dev,
> "netif_carrier_on\n");
> > + netif_carrier_on(netdev);
> > + } else {
> > + dev_info(&oct->pdev->dev,
> "netif_carrier_off\n");
> > + netif_carrier_off(netdev);
> > + }
>
> Shouldn't netdev changes be protected by some lock?
> Is is safe to get event from FW and process it as is?
>
> Thanks

Thanks for the kind feedback.
I do not see netif_carrier_on/off require any protection. I referred few other drivers and do not see such protection used for carrier on/off.
Please suggest if I am missing something here.

2023-03-29 07:44:36

by Leon Romanovsky

[permalink] [raw]
Subject: Re: [EXT] Re: [PATCH net-next v4 6/8] octeon_ep: support asynchronous notifications

On Thu, Mar 23, 2023 at 05:24:55PM +0000, Veerasenareddy Burru wrote:
>
>
> > -----Original Message-----
> > From: Leon Romanovsky <[email protected]>
> > Sent: Thursday, March 23, 2023 3:39 AM
> > To: Veerasenareddy Burru <[email protected]>
> > Cc: [email protected]; [email protected]; Abhijit Ayarekar
> > <[email protected]>; Sathesh B Edara <[email protected]>;
> > Satananda Burla <[email protected]>; [email protected]; David S.
> > Miller <[email protected]>; Eric Dumazet <[email protected]>;
> > Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>
> > Subject: [EXT] Re: [PATCH net-next v4 6/8] octeon_ep: support
> > asynchronous notifications
> >
> > External Email
> >
> > ----------------------------------------------------------------------
> > On Wed, Mar 22, 2023 at 02:19:55AM -0700, Veerasenareddy Burru wrote:
> > > Add asynchronous notification support to the control mailbox.
> > >
> > > Signed-off-by: Veerasenareddy Burru <[email protected]>
> > > Signed-off-by: Abhijit Ayarekar <[email protected]>
> > > ---
> > > v3 -> v4:
> > > * 0005-xxx.patch in v3 is 0006-xxx.patch in v4.
> > > * addressed review comments
> > > https://urldefense.proofpoint.com/v2/url?u=https-
> > 3A__lore.kernel.org_all_Y-2B0J94sowllCe5Gs-
> > 40boxer_&d=DwIBAg&c=nKjWec2b6R0mOyPaz7xtfQ&r=XkP_75lnbPIeeucsP
> > X36ZgjiMqEKttwZfwNyWMCLjT0&m=5CnsD-
> > SX6ZoW98szwM0k4IXgNC3wY0EwCQHxDKGyNIRUJxdaNe3zorLcOhc9iU6d&s
> > =k73McQSsjbjj87VbCCB8EFFtGWtksMIGhn15RK12XF8&e=
> > > - fixed rct violation.
> > > - process_mbox_notify() now returns void.
> > >
> > > v2 -> v3:
> > > * no change
> > >
> > > v1 -> v2:
> > > * no change
> > >
> > > .../marvell/octeon_ep/octep_ctrl_net.c | 29 +++++++++++++++++++
> > > 1 file changed, 29 insertions(+)
> > >
> > > diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_ctrl_net.c
> > > b/drivers/net/ethernet/marvell/octeon_ep/octep_ctrl_net.c
> > > index cef4bc3b1ec0..465eef2824e3 100644
> > > --- a/drivers/net/ethernet/marvell/octeon_ep/octep_ctrl_net.c
> > > +++ b/drivers/net/ethernet/marvell/octeon_ep/octep_ctrl_net.c
> > > @@ -271,6 +271,33 @@ static void process_mbox_resp(struct
> > octep_device *oct,
> > > }
> > > }
> > >
> > > +static int process_mbox_notify(struct octep_device *oct,
> > > + struct octep_ctrl_mbox_msg *msg) {
> > > + struct net_device *netdev = oct->netdev;
> > > + struct octep_ctrl_net_f2h_req *req;
> > > +
> > > + req = (struct octep_ctrl_net_f2h_req *)msg->sg_list[0].msg;
> > > + switch (req->hdr.s.cmd) {
> > > + case OCTEP_CTRL_NET_F2H_CMD_LINK_STATUS:
> > > + if (netif_running(netdev)) {
> > > + if (req->link.state) {
> > > + dev_info(&oct->pdev->dev,
> > "netif_carrier_on\n");
> > > + netif_carrier_on(netdev);
> > > + } else {
> > > + dev_info(&oct->pdev->dev,
> > "netif_carrier_off\n");
> > > + netif_carrier_off(netdev);
> > > + }
> >
> > Shouldn't netdev changes be protected by some lock?
> > Is is safe to get event from FW and process it as is?
> >
> > Thanks
>
> Thanks for the kind feedback.
> I do not see netif_carrier_on/off require any protection. I referred few other drivers and do not see such protection used for carrier on/off.
> Please suggest if I am missing something here.

I see that Dave already applied your v5. I think that you are missing context in which you
are running FW commands. They run independently from netdev and makes netif_running() check
to be racy.

Thanks

>