diff mbox series

[net-next,v3,5/7] octeon_ep: support asynchronous notifications

Message ID 20230214051422.13705-6-vburru@marvell.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series octeon_ep: deferred probe and mailbox | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Series has a cover letter
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 41 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Veerasenareddy Burru Feb. 14, 2023, 5:14 a.m. UTC
Add asynchronous notification support to the control mailbox.

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

v1 -> v2:
 * no change

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

Comments

Fijalkowski, Maciej Feb. 15, 2023, 4:36 p.m. UTC | #1
On Mon, Feb 13, 2023 at 09:14:20PM -0800, Veerasenareddy Burru wrote:
> Add asynchronous notification support to the control mailbox.
> 
> Signed-off-by: Veerasenareddy Burru <vburru@marvell.com>
> Signed-off-by: Abhijit Ayarekar <aayarekar@marvell.com>
> ---
> 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 715af1891d0d..80bcd6cd4732 100644
> --- a/drivers/net/ethernet/marvell/octeon_ep/octep_ctrl_net.c
> +++ b/drivers/net/ethernet/marvell/octeon_ep/octep_ctrl_net.c
> @@ -279,6 +279,33 @@ static int process_mbox_resp(struct octep_device *oct,
>  	return 0;
>  }
>  
> +static int process_mbox_notify(struct octep_device *oct,

void

> +			       struct octep_ctrl_mbox_msg *msg)
> +{
> +	struct octep_ctrl_net_f2h_req *req;
> +	struct net_device *netdev = oct->netdev;

RCT

> +
> +	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;
> +}
> +
>  int octep_ctrl_net_recv_fw_messages(struct octep_device *oct)
>  {
>  	static u16 msg_sz = sizeof(union octep_ctrl_net_max_data);
> @@ -303,6 +330,8 @@ int octep_ctrl_net_recv_fw_messages(struct octep_device *oct)
>  			process_mbox_req(oct, &msg);
>  		else 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);
>  	}
>  
>  	return 0;
> -- 
> 2.36.0
>
Veerasenareddy Burru March 22, 2023, 7:26 a.m. UTC | #2
> -----Original Message-----
> From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
> Sent: Wednesday, February 15, 2023 8:36 AM
> To: Veerasenareddy Burru <vburru@marvell.com>
> Cc: netdev@vger.kernel.org; linux-kernel@vger.kernel.org; Abhijit Ayarekar
> <aayarekar@marvell.com>; Sathesh B Edara <sedara@marvell.com>;
> Satananda Burla <sburla@marvell.com>; linux-doc@vger.kernel.org; David S.
> Miller <davem@davemloft.net>; Eric Dumazet <edumazet@google.com>;
> Jakub Kicinski <kuba@kernel.org>; Paolo Abeni <pabeni@redhat.com>
> Subject: [EXT] Re: [PATCH net-next v3 5/7] octeon_ep: support
> asynchronous notifications
> 
> External Email
> 
> ----------------------------------------------------------------------
> On Mon, Feb 13, 2023 at 09:14:20PM -0800, Veerasenareddy Burru wrote:
> > Add asynchronous notification support to the control mailbox.
> >
> > Signed-off-by: Veerasenareddy Burru <vburru@marvell.com>
> > Signed-off-by: Abhijit Ayarekar <aayarekar@marvell.com>
> > ---
> > 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 715af1891d0d..80bcd6cd4732 100644
> > --- a/drivers/net/ethernet/marvell/octeon_ep/octep_ctrl_net.c
> > +++ b/drivers/net/ethernet/marvell/octeon_ep/octep_ctrl_net.c
> > @@ -279,6 +279,33 @@ static int process_mbox_resp(struct octep_device
> *oct,
> >  	return 0;
> >  }
> >
> > +static int process_mbox_notify(struct octep_device *oct,
> 
> void
> 

Will change in next revision.

> > +			       struct octep_ctrl_mbox_msg *msg) {
> > +	struct octep_ctrl_net_f2h_req *req;
> > +	struct net_device *netdev = oct->netdev;
> 
> RCT
> 

Will fix in next revision. I missed some RCT violations in this patchset. Will take care for future submissions.
Thank you for kind review.

> > +
> > +	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;
> > +}
> > +
> >  int octep_ctrl_net_recv_fw_messages(struct octep_device *oct)  {
> >  	static u16 msg_sz = sizeof(union octep_ctrl_net_max_data); @@ -
> 303,6
> > +330,8 @@ int octep_ctrl_net_recv_fw_messages(struct octep_device
> *oct)
> >  			process_mbox_req(oct, &msg);
> >  		else 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);
> >  	}
> >
> >  	return 0;
> > --
> > 2.36.0
> >
diff mbox series

Patch

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 715af1891d0d..80bcd6cd4732 100644
--- a/drivers/net/ethernet/marvell/octeon_ep/octep_ctrl_net.c
+++ b/drivers/net/ethernet/marvell/octeon_ep/octep_ctrl_net.c
@@ -279,6 +279,33 @@  static int process_mbox_resp(struct octep_device *oct,
 	return 0;
 }
 
+static int process_mbox_notify(struct octep_device *oct,
+			       struct octep_ctrl_mbox_msg *msg)
+{
+	struct octep_ctrl_net_f2h_req *req;
+	struct net_device *netdev = oct->netdev;
+
+	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;
+}
+
 int octep_ctrl_net_recv_fw_messages(struct octep_device *oct)
 {
 	static u16 msg_sz = sizeof(union octep_ctrl_net_max_data);
@@ -303,6 +330,8 @@  int octep_ctrl_net_recv_fw_messages(struct octep_device *oct)
 			process_mbox_req(oct, &msg);
 		else 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);
 	}
 
 	return 0;