[v2] net/qede: fix get link details

Message ID 20201002195945.20343-1-rmody@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: Jerin Jacob
Headers
Series [v2] net/qede: fix get link details |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/travis-robot success Travis build: passed
ci/iol-testing warning Testing issues
ci/Intel-compilation success Compilation OK

Commit Message

Rasesh Mody Oct. 2, 2020, 7:59 p.m. UTC
  This patch fixes get current link details, without this change the link
details can be inaccurate if proper lock is not acquired.

Fixes: 739a5b2f2b49 ("net/qede/base: use passed ptt handler")
Cc: stable@dpdk.org

Reported-by: Ferruh Yigit <ferruh.yigit@intel.com>
Signed-off-by: Rasesh Mody <rmody@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
---
 drivers/net/qede/qede_main.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
  

Comments

Jerin Jacob Oct. 4, 2020, 8:37 a.m. UTC | #1
On Sat, Oct 3, 2020 at 1:30 AM Rasesh Mody <rmody@marvell.com> wrote:
>
> This patch fixes get current link details, without this change the link
> details can be inaccurate if proper lock is not acquired.
>
> Fixes: 739a5b2f2b49 ("net/qede/base: use passed ptt handler")
> Cc: stable@dpdk.org
>
> Reported-by: Ferruh Yigit <ferruh.yigit@intel.com>
> Signed-off-by: Rasesh Mody <rmody@marvell.com>
> Signed-off-by: Igor Russkikh <irusskikh@marvell.com>


Applied to dpdk-next-net-mrvl/main. Thanks


> ---
>  drivers/net/qede/qede_main.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/qede/qede_main.c b/drivers/net/qede/qede_main.c
> index aecb98261..1ae10d99d 100644
> --- a/drivers/net/qede/qede_main.c
> +++ b/drivers/net/qede/qede_main.c
> @@ -584,13 +584,12 @@ qed_get_current_link(struct ecore_dev *edev, struct qed_link_output *if_link)
>         hwfn = &edev->hwfns[0];
>         if (IS_PF(edev)) {
>                 ptt = ecore_ptt_acquire(hwfn);
> -               if (!ptt)
> -                       DP_NOTICE(hwfn, true, "Failed to fill link; No PTT\n");
> -
> +               if (ptt) {
>                         qed_fill_link(hwfn, ptt, if_link);
> -
> -               if (ptt)
>                         ecore_ptt_release(hwfn, ptt);
> +               } else {
> +                       DP_NOTICE(hwfn, true, "Failed to fill link; No PTT\n");
> +               }
>         } else {
>                 qed_fill_link(hwfn, NULL, if_link);
>         }
> --
> 2.18.1
>
  

Patch

diff --git a/drivers/net/qede/qede_main.c b/drivers/net/qede/qede_main.c
index aecb98261..1ae10d99d 100644
--- a/drivers/net/qede/qede_main.c
+++ b/drivers/net/qede/qede_main.c
@@ -584,13 +584,12 @@  qed_get_current_link(struct ecore_dev *edev, struct qed_link_output *if_link)
 	hwfn = &edev->hwfns[0];
 	if (IS_PF(edev)) {
 		ptt = ecore_ptt_acquire(hwfn);
-		if (!ptt)
-			DP_NOTICE(hwfn, true, "Failed to fill link; No PTT\n");
-
+		if (ptt) {
 			qed_fill_link(hwfn, ptt, if_link);
-
-		if (ptt)
 			ecore_ptt_release(hwfn, ptt);
+		} else {
+			DP_NOTICE(hwfn, true, "Failed to fill link; No PTT\n");
+		}
 	} else {
 		qed_fill_link(hwfn, NULL, if_link);
 	}