diff mbox series

[net,v4,10/10] octeontx2-pf: Disable packet I/O for graceful exit

Message ID 20230426074345.750135-11-saikrishnag@marvell.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series octeontx2: Miscellaneous fixes | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 18 this patch: 18
netdev/cc_maintainers success CCed 9 of 9 maintainers
netdev/build_clang success Errors and warnings before: 18 this patch: 18
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 22 this patch: 22
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 31 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Sai Krishna Gajula April 26, 2023, 7:43 a.m. UTC
From: Subbaraya Sundeep <sbhatta@marvell.com>

At the stage of enabling packet I/O in otx2_open, If mailbox
timeout occurs then interface ends up in down state where as
hardware packet I/O is enabled. Hence disable packet I/O also
before bailing out.

As per earlier implementation, when the VF device probe fails due
to error in MSIX vector allocation, the LF resources, NIX and NPA
LF were not detached. This patch fixes in releasing these
resources, when ever this MSIX vector allocation/VF probe fails.

Fixes: 1ea0166da050 ("octeontx2-pf: Fix the device state on error")
Signed-off-by: Subbaraya Sundeep <sbhatta@marvell.com>
Signed-off-by: Sunil Kovvuri Goutham <sgoutham@marvell.com>
Signed-off-by: Sai Krishna <saikrishnag@marvell.com>
---
 drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c | 11 ++++++++++-
 drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c |  2 +-
 2 files changed, 11 insertions(+), 2 deletions(-)

Comments

Simon Horman April 26, 2023, 10:06 a.m. UTC | #1
On Wed, Apr 26, 2023 at 01:13:45PM +0530, Sai Krishna wrote:
> From: Subbaraya Sundeep <sbhatta@marvell.com>
> 
> At the stage of enabling packet I/O in otx2_open, If mailbox
> timeout occurs then interface ends up in down state where as
> hardware packet I/O is enabled. Hence disable packet I/O also
> before bailing out.
> 
> As per earlier implementation, when the VF device probe fails due
> to error in MSIX vector allocation, the LF resources, NIX and NPA
> LF were not detached. This patch fixes in releasing these
> resources, when ever this MSIX vector allocation/VF probe fails.

It seems to me that the issue in the 2nd paragraph / hunk is
different to that in the first. And thus it seems to be appropriate
for it to be in a separate patch, possibly with.

Fixes: 3184fb5ba96e ("octeontx2-vf: Virtual function driver support")

> Fixes: 1ea0166da050 ("octeontx2-pf: Fix the device state on error")
> Signed-off-by: Subbaraya Sundeep <sbhatta@marvell.com>
> Signed-off-by: Sunil Kovvuri Goutham <sgoutham@marvell.com>
> Signed-off-by: Sai Krishna <saikrishnag@marvell.com>
> ---
>  drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c | 11 ++++++++++-
>  drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c |  2 +-
>  2 files changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
> index 179433d0a54a..52a57d2493dc 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
> @@ -1835,13 +1835,22 @@ int otx2_open(struct net_device *netdev)
>  		otx2_dmacflt_reinstall_flows(pf);
>  
>  	err = otx2_rxtx_enable(pf, true);
> -	if (err)
> +	/* If a mbox communication error happens at this point then interface
> +	 * will end up in a state such that it is in down state but hardware
> +	 * mcam entries are enabled to receive the packets. Hence disable the
> +	 * packet I/O.
> +	 */
> +	if (err == EIO)
> +		goto err_disable_rxtx;
> +	else if (err)
>  		goto err_tx_stop_queues;
>  
>  	otx2_do_set_rx_mode(pf);
>  
>  	return 0;
>  
> +err_disable_rxtx:
> +	otx2_rxtx_enable(pf, false);
>  err_tx_stop_queues:
>  	netif_tx_stop_all_queues(netdev);
>  	netif_carrier_off(netdev);
> diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c
> index ab126f8706c7..53366dbfbf27 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c
> @@ -621,7 +621,7 @@ static int otx2vf_probe(struct pci_dev *pdev, const struct pci_device_id *id)
>  
>  	err = otx2vf_realloc_msix_vectors(vf);
>  	if (err)
> -		goto err_mbox_destroy;
> +		goto err_detach_rsrc;
>  
>  	err = otx2_set_real_num_queues(netdev, qcount, qcount);
>  	if (err)
> -- 
> 2.25.1
>
Sai Krishna Gajula April 27, 2023, 7:14 a.m. UTC | #2
> -----Original Message-----
> From: Simon Horman <simon.horman@corigine.com>
> Sent: Wednesday, April 26, 2023 3:36 PM
> To: Sai Krishna Gajula <saikrishnag@marvell.com>
> Cc: davem@davemloft.net; edumazet@google.com; kuba@kernel.org;
> pabeni@redhat.com; netdev@vger.kernel.org; linux-
> kernel@vger.kernel.org; leon@kernel.org; Sunil Kovvuri Goutham
> <sgoutham@marvell.com>; Geethasowjanya Akula <gakula@marvell.com>;
> Linu Cherian <lcherian@marvell.com>; Jerin Jacob Kollanukkaran
> <jerinj@marvell.com>; Hariprasad Kelam <hkelam@marvell.com>;
> Subbaraya Sundeep Bhatta <sbhatta@marvell.com>
> Subject: Re: [net PATCH v4 10/10] octeontx2-pf: Disable packet I/O for
> graceful exit
> 
> On Wed, Apr 26, 2023 at 01:13:45PM +0530, Sai Krishna wrote:
> > From: Subbaraya Sundeep <sbhatta@marvell.com>
> >
> > At the stage of enabling packet I/O in otx2_open, If mailbox timeout
> > occurs then interface ends up in down state where as hardware packet
> > I/O is enabled. Hence disable packet I/O also before bailing out.
> >
> > As per earlier implementation, when the VF device probe fails due to
> > error in MSIX vector allocation, the LF resources, NIX and NPA LF were
> > not detached. This patch fixes in releasing these resources, when ever
> > this MSIX vector allocation/VF probe fails.
> 
> It seems to me that the issue in the 2nd paragraph / hunk is different to that
> in the first. And thus it seems to be appropriate for it to be in a separate
> patch, possibly with.
> 
> Fixes: 3184fb5ba96e ("octeontx2-vf: Virtual function driver support")

We will separate this VF patch and send it in V5 patch series or as a separate patch.

> 
> > Fixes: 1ea0166da050 ("octeontx2-pf: Fix the device state on error")
> > Signed-off-by: Subbaraya Sundeep <sbhatta@marvell.com>
> > Signed-off-by: Sunil Kovvuri Goutham <sgoutham@marvell.com>
> > Signed-off-by: Sai Krishna <saikrishnag@marvell.com>
> > ---
> >  drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c | 11 ++++++++++-
> > drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c |  2 +-
> >  2 files changed, 11 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
> > b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
> > index 179433d0a54a..52a57d2493dc 100644
> > --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
> > +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
> > @@ -1835,13 +1835,22 @@ int otx2_open(struct net_device *netdev)
> >  		otx2_dmacflt_reinstall_flows(pf);
> >
> >  	err = otx2_rxtx_enable(pf, true);
> > -	if (err)
> > +	/* If a mbox communication error happens at this point then
> interface
> > +	 * will end up in a state such that it is in down state but hardware
> > +	 * mcam entries are enabled to receive the packets. Hence disable
> the
> > +	 * packet I/O.
> > +	 */
> > +	if (err == EIO)
> > +		goto err_disable_rxtx;
> > +	else if (err)
> >  		goto err_tx_stop_queues;
> >
> >  	otx2_do_set_rx_mode(pf);
> >
> >  	return 0;
> >
> > +err_disable_rxtx:
> > +	otx2_rxtx_enable(pf, false);
> >  err_tx_stop_queues:
> >  	netif_tx_stop_all_queues(netdev);
> >  	netif_carrier_off(netdev);
> > diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c
> > b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c
> > index ab126f8706c7..53366dbfbf27 100644
> > --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c
> > +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c
> > @@ -621,7 +621,7 @@ static int otx2vf_probe(struct pci_dev *pdev,
> > const struct pci_device_id *id)
> >
> >  	err = otx2vf_realloc_msix_vectors(vf);
> >  	if (err)
> > -		goto err_mbox_destroy;
> > +		goto err_detach_rsrc;
> >
> >  	err = otx2_set_real_num_queues(netdev, qcount, qcount);
> >  	if (err)
> > --
> > 2.25.1
> >
diff mbox series

Patch

diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
index 179433d0a54a..52a57d2493dc 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
@@ -1835,13 +1835,22 @@  int otx2_open(struct net_device *netdev)
 		otx2_dmacflt_reinstall_flows(pf);
 
 	err = otx2_rxtx_enable(pf, true);
-	if (err)
+	/* If a mbox communication error happens at this point then interface
+	 * will end up in a state such that it is in down state but hardware
+	 * mcam entries are enabled to receive the packets. Hence disable the
+	 * packet I/O.
+	 */
+	if (err == EIO)
+		goto err_disable_rxtx;
+	else if (err)
 		goto err_tx_stop_queues;
 
 	otx2_do_set_rx_mode(pf);
 
 	return 0;
 
+err_disable_rxtx:
+	otx2_rxtx_enable(pf, false);
 err_tx_stop_queues:
 	netif_tx_stop_all_queues(netdev);
 	netif_carrier_off(netdev);
diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c
index ab126f8706c7..53366dbfbf27 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c
@@ -621,7 +621,7 @@  static int otx2vf_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 
 	err = otx2vf_realloc_msix_vectors(vf);
 	if (err)
-		goto err_mbox_destroy;
+		goto err_detach_rsrc;
 
 	err = otx2_set_real_num_queues(netdev, qcount, qcount);
 	if (err)