Skip to contentSkip to conversation

net/qede: fix get link details

PATCH Superseded Rasesh Mody 2 participants 4 messages Oct 1, 2020 – Oct 4, 2020 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/qede: fix get link details

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")
---
 drivers/net/qede/qede_main.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/net/qede/qede_main.c +4 -5
index aecb98261..f0ca3373f 100644
@@ -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, "Failed to fill link; No PTT\n");
+		}
 	} else {
 		qed_fill_link(hwfn, NULL, if_link);
 	}
Signature · 1 line
2.18.1
#1 lore raw

PATCH v2 1/1 net/qede: fix get link details

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")
---
 drivers/net/qede/qede_main.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/net/qede/qede_main.c +4 -5
index aecb98261..1ae10d99d 100644
@@ -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);
 	}
Signature · 1 line
2.18.1
Applied
#2 lore raw
Quoted 10 lines · Rasesh Mody

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")

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

Quoted 29 lines
---
 drivers/net/qede/qede_main.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/net/qede/qede_main.c +4 -6
index aecb98261..1ae10d99d 100644
@@ -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

#3 lore raw
In reply to Rasesh Mody

Hi Jerin - please use v2, which addresses the build issues.

On 10/1/20, 3:41 PM, "Rasesh Mody" <[email protected]> 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: [email protected]

    Reported-by: Ferruh Yigit <[email protected]>
    Signed-off-by: Rasesh Mody <[email protected]>
    Signed-off-by: Igor Russkikh <[email protected]> 
    ---
     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..f0ca3373f 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, "Failed to fill link; No PTT\n");
    +		}
     	} else {
     		qed_fill_link(hwfn, NULL, if_link);
     	}
    -- 
    2.18.1