Linux PCI Non-Transparent Bridge framework and drivers
 help / color / mirror / Atom feed
* [PATCH] ntb: stop link work when we do not have memory
@ 2016-02-23 21:11 Dave Jiang
  2016-02-23 22:25 ` Allen Hubbe
  0 siblings, 1 reply; 2+ messages in thread
From: Dave Jiang @ 2016-02-23 21:11 UTC (permalink / raw)
  To: allen.hubbe, jdmason; +Cc: alex, linux-ntb

Instead of keep trying to go through the init routine when we aren't able
to allocate memory, we should just stop and go down.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Tested-by: Alex Depoutovitch <alex@pernixdata.com>
---
 drivers/ntb/ntb_transport.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/ntb/ntb_transport.c b/drivers/ntb/ntb_transport.c
index 06d4e58..50ecbd6 100644
--- a/drivers/ntb/ntb_transport.c
+++ b/drivers/ntb/ntb_transport.c
@@ -829,7 +829,7 @@ static void ntb_transport_link_work(struct work_struct *work)
 	struct pci_dev *pdev = ndev->pdev;
 	resource_size_t size;
 	u32 val;
-	int rc, i, spad;
+	int rc = 0, i, spad;
 
 	/* send the local info, in the opposite order of the way we read it */
 	for (i = 0; i < nt->mw_count; i++) {
@@ -899,6 +899,14 @@ static void ntb_transport_link_work(struct work_struct *work)
 out1:
 	for (i = 0; i < nt->mw_count; i++)
 		ntb_free_mw(nt, i);
+
+	/* if there's an actual failure, we should just bail */
+	if (rc < 0) {
+		nt->link_is_up = false;
+		ntb_transport_link_cleanup(nt);
+		return;
+	}
+
 out:
 	if (ntb_link_is_up(ndev, NULL, NULL) == 1)
 		schedule_delayed_work(&nt->link_work,


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* RE: [PATCH] ntb: stop link work when we do not have memory
  2016-02-23 21:11 [PATCH] ntb: stop link work when we do not have memory Dave Jiang
@ 2016-02-23 22:25 ` Allen Hubbe
  0 siblings, 0 replies; 2+ messages in thread
From: Allen Hubbe @ 2016-02-23 22:25 UTC (permalink / raw)
  To: 'Dave Jiang', jdmason; +Cc: alex, linux-ntb

> From: Dave Jiang <dave.jiang@intel.com>
> 
> Instead of keep trying to go through the init routine when we aren't
> able
> to allocate memory, we should just stop and go down.
> 
> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
> Tested-by: Alex Depoutovitch <alex@pernixdata.com>
> ---
>  drivers/ntb/ntb_transport.c |   10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/ntb/ntb_transport.c b/drivers/ntb/ntb_transport.c
> index 06d4e58..50ecbd6 100644
> --- a/drivers/ntb/ntb_transport.c
> +++ b/drivers/ntb/ntb_transport.c
> @@ -829,7 +829,7 @@ static void ntb_transport_link_work(struct
> work_struct *work)
>  	struct pci_dev *pdev = ndev->pdev;
>  	resource_size_t size;
>  	u32 val;
> -	int rc, i, spad;
> +	int rc = 0, i, spad;
> 
>  	/* send the local info, in the opposite order of the way we read it
> */
>  	for (i = 0; i < nt->mw_count; i++) {
> @@ -899,6 +899,14 @@ static void ntb_transport_link_work(struct
> work_struct *work)
>  out1:
>  	for (i = 0; i < nt->mw_count; i++)
>  		ntb_free_mw(nt, i);
> +
> +	/* if there's an actual failure, we should just bail */
> +	if (rc < 0) {
> +		nt->link_is_up = false;

Why not ntb_link_disable()?  As long as we leave the link up, the peer will keep spinning trying to connect.  Should we try again if the peer resets the link, or never again?

> +		ntb_transport_link_cleanup(nt);
> +		return;
> +	}
> +
>  out:
>  	if (ntb_link_is_up(ndev, NULL, NULL) == 1)
>  		schedule_delayed_work(&nt->link_work,



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-02-23 22:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-23 21:11 [PATCH] ntb: stop link work when we do not have memory Dave Jiang
2016-02-23 22:25 ` Allen Hubbe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox