netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Carrier detect ok, don't turn off negotiation
       [not found] <751079597.1884905.1516121905374.ref@mail.yahoo.com>
@ 2018-01-16 16:58 ` Denis Du
  2018-01-22 20:25   ` David Miller
  0 siblings, 1 reply; 10+ messages in thread
From: Denis Du @ 2018-01-16 16:58 UTC (permalink / raw)
  To: khc; +Cc: netdev, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 243 bytes --]

In drivers/net/wan/hdlc_ppp.c, some noise on physical line can cause the carrier detect still ok, but the protocol will fail. So if carrier detect ok, don't turn off protocol negotiation

This patch is against the kernel version Linux 4.15-rc8

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-netdev-carrier-detect-ok-don-t-turn-off-negotiation.patch --]
[-- Type: text/x-patch, Size: 1258 bytes --]

From b5902a4dfc709b62b704997ab64f31c9ef69a6db Mon Sep 17 00:00:00 2001
From: Denis Du <dudenis2000@yahoo.ca>
Date: Mon, 15 Jan 2018 17:26:06 -0500
Subject: [PATCH] netdev: carrier detect ok, don't turn off negotiation

Sometimes when physical lines have a just good noise to make the protocol
handshaking fail, but the carrier detect still good. Then after remove of
the noise, nobody will trigger this protocol to be start again to cause
the link to never come back. The fix is when the carrier is still on, not
terminate the protocol handshaking.

Signed-off-by: Denis Du <dudenis2000@yahoo.ca>
---
 drivers/net/wan/hdlc_ppp.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wan/hdlc_ppp.c b/drivers/net/wan/hdlc_ppp.c
index afeca6b..ab8b3cb 100644
--- a/drivers/net/wan/hdlc_ppp.c
+++ b/drivers/net/wan/hdlc_ppp.c
@@ -574,7 +574,10 @@ static void ppp_timer(struct timer_list *t)
 			ppp_cp_event(proto->dev, proto->pid, TO_GOOD, 0, 0,
 				     0, NULL);
 			proto->restart_counter--;
-		} else
+		} else if (netif_carrier_ok(proto->dev))
+			ppp_cp_event(proto->dev, proto->pid, TO_GOOD, 0, 0,
+				     0, NULL);
+		else
 			ppp_cp_event(proto->dev, proto->pid, TO_BAD, 0, 0,
 				     0, NULL);
 		break;
-- 
2.1.4


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

* Re: [PATCH] Carrier detect ok, don't turn off negotiation
  2018-01-16 16:58 ` [PATCH] Carrier detect ok, don't turn off negotiation Denis Du
@ 2018-01-22 20:25   ` David Miller
  2018-01-22 22:17     ` Denis Du
  2018-01-23 17:08     ` Denis Du
  0 siblings, 2 replies; 10+ messages in thread
From: David Miller @ 2018-01-22 20:25 UTC (permalink / raw)
  To: dudenis2000; +Cc: khc, netdev, linux-kernel

From: Denis Du <dudenis2000@yahoo.ca>
Date: Tue, 16 Jan 2018 16:58:25 +0000 (UTC)

> From b5902a4dfc709b62b704997ab64f31c9ef69a6db Mon Sep 17 00:00:00 2001
> From: Denis Du <dudenis2000@yahoo.ca>
> Date: Mon, 15 Jan 2018 17:26:06 -0500
> Subject: [PATCH] netdev: carrier detect ok, don't turn off negotiation
> 
> Sometimes when physical lines have a just good noise to make the protocol
> handshaking fail, but the carrier detect still good. Then after remove of
> the noise, nobody will trigger this protocol to be start again to cause
> the link to never come back. The fix is when the carrier is still on, not
> terminate the protocol handshaking.
> 
> Signed-off-by: Denis Du <dudenis2000@yahoo.ca>

The timer is supposed to restart the protocol again, that's how this
whole thing is designed to work.

I think you are making changes to the symptom rather than the true
cause of the problems you are seeing.

Sorry, I will not apply this until the exact issue is better
understood.

Thank you.

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

* Re: [PATCH] Carrier detect ok, don't turn off negotiation
  2018-01-22 20:25   ` David Miller
@ 2018-01-22 22:17     ` Denis Du
  2018-01-23 17:08     ` Denis Du
  1 sibling, 0 replies; 10+ messages in thread
From: Denis Du @ 2018-01-22 22:17 UTC (permalink / raw)
  To: David Miller; +Cc: khc, netdev, linux-kernel



The timer is supposed to be triggered by carrier detect interrupt. After remove the line noise, the carrier detect interrupt is never triggered again, because the carrier is always ok and it only trigger the timer once, Since the protocol was terminated and no new interrupts happen, the link will never be back. So the case here is that the line noise is good and just good to make the carrier detect still good  but the protocol fail, the timer will be never triggered again.

Of course, if you increase the noise and make even the carrier detect fail, then remove the noise, the link will be up, Because the carrier down and up again and then trigger the timer to restart.

Denis Du




On Monday, January 22, 2018, 3:25:16 PM EST, David Miller <davem@davemloft.net> wrote: 





From: Denis Du <dudenis2000@yahoo.ca>
Date: Tue, 16 Jan 2018 16:58:25 +0000 (UTC)

> From b5902a4dfc709b62b704997ab64f31c9ef69a6db Mon Sep 17 00:00:00 2001
> From: Denis Du <dudenis2000@yahoo.ca>
> Date: Mon, 15 Jan 2018 17:26:06 -0500
> Subject: [PATCH] netdev: carrier detect ok, don't turn off negotiation
> 
> Sometimes when physical lines have a just good noise to make the protocol
> handshaking fail, but the carrier detect still good. Then after remove of
> the noise, nobody will trigger this protocol to be start again to cause
> the link to never come back. The fix is when the carrier is still on, not
> terminate the protocol handshaking.
> 
> Signed-off-by: Denis Du <dudenis2000@yahoo.ca>

The timer is supposed to restart the protocol again, that's how this
whole thing is designed to work.

I think you are making changes to the symptom rather than the true
cause of the problems you are seeing.

Sorry, I will not apply this until the exact issue is better
understood.

Thank you.

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

* Re: [PATCH] Carrier detect ok, don't turn off negotiation
  2018-01-22 20:25   ` David Miller
  2018-01-22 22:17     ` Denis Du
@ 2018-01-23 17:08     ` Denis Du
  2018-01-28 14:24       ` Krzysztof Halasa
  1 sibling, 1 reply; 10+ messages in thread
From: Denis Du @ 2018-01-23 17:08 UTC (permalink / raw)
  To: David Miller; +Cc: khc, netdev, linux-kernel



Ok, I check the source code again. It have nothing to do with the interrupts, it is related how the hdlc.c is implemented.
In drivers/net/wan/hdlc.c#L108


        if (hdlc->carrier == on)
        goto carrier_exit; /* no change in DCD line level */

    hdlc->carrier = on;

    if (!hdlc->open)
        goto carrier_exit;

    if (hdlc->carrier) {
        netdev_info(dev, "Carrier detected\n");
        hdlc_proto_start(dev);
    } else {
        netdev_info(dev, "Carrier lost\n");
        hdlc_proto_stop(dev);
    }

carrier_exit:
    spin_unlock_irqrestore(&hdlc->state_lock, flags);
    return NOTIFY_DONE;

>From the above code, I can get that only Carrier have some change, it will restart the protocol by hdlc_proto_start(dev);and thus the timer, the previous timer expired due to protocol fail.

If carrier keep no change by if (hdlc->carrier == on)
        goto carrier_exit; /* no change in DCD line level */It will do nothing, not start any new protocol and thus the timer.


My case is the carrier always good, but protocol will fail due to perfect noise, and this issue was found and complained by our customers. So it is not my theory guessing, it is a real problem.






On Monday, January 22, 2018, 3:25:16 PM EST, David Miller <davem@davemloft.net> wrote: 





From: Denis Du <dudenis2000@yahoo.ca>
Date: Tue, 16 Jan 2018 16:58:25 +0000 (UTC)

> From b5902a4dfc709b62b704997ab64f31c9ef69a6db Mon Sep 17 00:00:00 2001
> From: Denis Du <dudenis2000@yahoo.ca>
> Date: Mon, 15 Jan 2018 17:26:06 -0500
> Subject: [PATCH] netdev: carrier detect ok, don't turn off negotiation
> 
> Sometimes when physical lines have a just good noise to make the protocol
> handshaking fail, but the carrier detect still good. Then after remove of
> the noise, nobody will trigger this protocol to be start again to cause
> the link to never come back. The fix is when the carrier is still on, not
> terminate the protocol handshaking.
> 
> Signed-off-by: Denis Du <dudenis2000@yahoo.ca>

The timer is supposed to restart the protocol again, that's how this
whole thing is designed to work.

I think you are making changes to the symptom rather than the true
cause of the problems you are seeing.

Sorry, I will not apply this until the exact issue is better
understood.

Thank you.

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

* Re: [PATCH] Carrier detect ok, don't turn off negotiation
  2018-01-23 17:08     ` Denis Du
@ 2018-01-28 14:24       ` Krzysztof Halasa
  2018-02-06 15:18         ` Denis Du
       [not found]         ` <438911112.3985245.1517930128335@mail.yahoo.com>
  0 siblings, 2 replies; 10+ messages in thread
From: Krzysztof Halasa @ 2018-01-28 14:24 UTC (permalink / raw)
  To: Denis Du; +Cc: David Miller, netdev, linux-kernel

Denis Du <dudenis2000@yahoo.ca> writes:

>>From the above code, I can get that only Carrier have some change, it
> will restart the protocol by hdlc_proto_start(dev);and thus the timer,
> the previous timer expired due to protocol fail.
>
> If carrier keep no change by if (hdlc->carrier == on)
>         goto carrier_exit; /* no change in DCD line level */It will do
> nothing, not start any new protocol and thus the timer.

Sorry about being late, just returned home and am trying to get all the
backlogs under control.

I remember the PPP standard is a bit cloudy about the possible issue,
but the latter indeed exists (the PPP state machine was written directly
to STD-51). There is related (more visible in practice, though we aren't
affected) issue of "active" vs "passive" mode (hdlc_ppp.c is "active",
and two "passives" wouldn't negotiate at all).

Anyway the problem is real (though not very visible in practice,
especially on relatively modern links rather than 300 or 1200 bps dialup
connections) and should be fixed. Looking at the patch, my first
impression is it makes the code differ from STD-51 a little bit.
On the other hand, perhaps applying it as is and forgetting about the
issue is the way to go.

Ideally, I think the negotiation failure should end up (optionally, in
addition to the current behavior) in some configurable sleep, then
the negotiation should restart. If it's worth the effort at this point,
I don't know.

Perhaps I could look at this later, but no promises (this requires
pulling on and setting up some legacy hardware).

Anyway, since the patch is safe and can solve an existing problem:

Acked-by: Krzysztof Halasa <khc@pm.waw.pl>
-- 
Krzysztof Halasa

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

* Re: [PATCH] Carrier detect ok, don't turn off negotiation
  2018-01-28 14:24       ` Krzysztof Halasa
@ 2018-02-06 15:18         ` Denis Du
       [not found]         ` <438911112.3985245.1517930128335@mail.yahoo.com>
  1 sibling, 0 replies; 10+ messages in thread
From: Denis Du @ 2018-02-06 15:18 UTC (permalink / raw)
  To: Krzysztof Halasa; +Cc: David Miller, netdev, linux-kernel



Hi, David:

How  do you think my patch?

As you see, Krzysztof  think my patch is ok to be accepted.

But if you have a better idea to fix it,I am glad to see it. Anyway, this issue have to be fixed.



Denis DU




On Sunday, January 28, 2018, 9:34:15 AM EST, Krzysztof Halasa <khc@pm.waw.pl> wrote: 





Denis Du <dudenis2000@yahoo.ca> writes:


>>From the above code, I can get that only Carrier have some change, it
> will restart the protocol by hdlc_proto_start(dev);and thus the timer,
> the previous timer expired due to protocol fail.
>
> If carrier keep no change by if (hdlc->carrier == on)
>         goto carrier_exit; /* no change in DCD line level */It will do
> nothing, not start any new protocol and thus the timer.


Sorry about being late, just returned home and am trying to get all the
backlogs under control.

I remember the PPP standard is a bit cloudy about the possible issue,
but the latter indeed exists (the PPP state machine was written directly
to STD-51). There is related (more visible in practice, though we aren't
affected) issue of "active" vs "passive" mode (hdlc_ppp.c is "active",
and two "passives" wouldn't negotiate at all).

Anyway the problem is real (though not very visible in practice,
especially on relatively modern links rather than 300 or 1200 bps dialup
connections) and should be fixed. Looking at the patch, my first
impression is it makes the code differ from STD-51 a little bit.
On the other hand, perhaps applying it as is and forgetting about the
issue is the way to go.

Ideally, I think the negotiation failure should end up (optionally, in
addition to the current behavior) in some configurable sleep, then
the negotiation should restart. If it's worth the effort at this point,
I don't know.

Perhaps I could look at this later, but no promises (this requires
pulling on and setting up some legacy hardware).

Anyway, since the patch is safe and can solve an existing problem:

Acked-by: Krzysztof Halasa <khc@pm.waw.pl>
-- 
Krzysztof Halasa

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

* Re: [PATCH] Carrier detect ok, don't turn off negotiation
       [not found]         ` <438911112.3985245.1517930128335@mail.yahoo.com>
@ 2018-02-06 15:29           ` David Miller
  2018-02-06 16:50             ` Denis Du
  0 siblings, 1 reply; 10+ messages in thread
From: David Miller @ 2018-02-06 15:29 UTC (permalink / raw)
  To: dudenis2000; +Cc: khc, netdev, linux-kernel

From: Denis Du <dudenis2000@yahoo.ca>
Date: Tue, 6 Feb 2018 15:15:28 +0000 (UTC)

> How  do you think my patch?
> 
> As you see, Krzysztof  think my patch is ok to be accepted.
> But if you have a better idea to fix it,I am glad to see it. Anyway, this issue have to be fixed.

Please resubmit it and I'll think about it again, thank you.

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

* Re: [PATCH] Carrier detect ok, don't turn off negotiation
  2018-02-06 15:29           ` David Miller
@ 2018-02-06 16:50             ` Denis Du
  2018-02-21  3:35               ` Denis Du
  0 siblings, 1 reply; 10+ messages in thread
From: Denis Du @ 2018-02-06 16:50 UTC (permalink / raw)
  To: David Miller; +Cc: khc, netdev, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 748 bytes --]



Ok, I submit it  again.


In drivers/net/wan/hdlc_ppp.c, some noise on physical line can cause the carrier detect still ok, but the protocol will fail. So if carrier detect ok, don't turn off protocol negotiation

This patch is against the kernel version Linux 4.15-rc8





On Tuesday, February 6, 2018, 10:29:53 AM EST, David Miller <davem@davemloft.net> wrote: 





From: Denis Du <dudenis2000@yahoo.ca>

Date: Tue, 6 Feb 2018 15:15:28 +0000 (UTC)

> How  do you think my patch?
> 
> As you see, Krzysztof  think my patch is ok to be accepted.
> But if you have a better idea to fix it,I am glad to see it. Anyway, this issue have to be fixed.


Please resubmit it and I'll think about it again, thank you.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-netdev-carrier-detect-ok-don-t-turn-off-negotiation.patch --]
[-- Type: text/x-patch, Size: 1258 bytes --]

From b5902a4dfc709b62b704997ab64f31c9ef69a6db Mon Sep 17 00:00:00 2001
From: Denis Du <dudenis2000@yahoo.ca>
Date: Mon, 15 Jan 2018 17:26:06 -0500
Subject: [PATCH] netdev: carrier detect ok, don't turn off negotiation

Sometimes when physical lines have a just good noise to make the protocol
handshaking fail, but the carrier detect still good. Then after remove of
the noise, nobody will trigger this protocol to be start again to cause
the link to never come back. The fix is when the carrier is still on, not
terminate the protocol handshaking.

Signed-off-by: Denis Du <dudenis2000@yahoo.ca>
---
 drivers/net/wan/hdlc_ppp.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wan/hdlc_ppp.c b/drivers/net/wan/hdlc_ppp.c
index afeca6b..ab8b3cb 100644
--- a/drivers/net/wan/hdlc_ppp.c
+++ b/drivers/net/wan/hdlc_ppp.c
@@ -574,7 +574,10 @@ static void ppp_timer(struct timer_list *t)
 			ppp_cp_event(proto->dev, proto->pid, TO_GOOD, 0, 0,
 				     0, NULL);
 			proto->restart_counter--;
-		} else
+		} else if (netif_carrier_ok(proto->dev))
+			ppp_cp_event(proto->dev, proto->pid, TO_GOOD, 0, 0,
+				     0, NULL);
+		else
 			ppp_cp_event(proto->dev, proto->pid, TO_BAD, 0, 0,
 				     0, NULL);
 		break;
-- 
2.1.4


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

* Re: [PATCH] Carrier detect ok, don't turn off negotiation
  2018-02-06 16:50             ` Denis Du
@ 2018-02-21  3:35               ` Denis Du
  2018-02-22 19:04                 ` David Miller
  0 siblings, 1 reply; 10+ messages in thread
From: Denis Du @ 2018-02-21  3:35 UTC (permalink / raw)
  To: David Miller; +Cc: khc, netdev, linux-kernel

Hi, David:

How  is your thinking about this patch?



>From b5902a4dfc709b62b704997ab64f31c9ef69a6db Mon Sep 17 00:00:00 2001 
From: Denis Du <dudenis2000@yahoo.ca> 
Date: Mon, 15 Jan 2018 17:26:06 -0500 
Subject: [PATCH] netdev: carrier detect ok, don't turn off negotiation 

Sometimes when physical lines have a just good noise to make the protocol 
handshaking fail, but the carrier detect still good. Then after remove of 
the noise, nobody will trigger this protocol to be start again to cause 
the link to never come back. The fix is when the carrier is still on, not 
terminate the protocol handshaking. 

Signed-off-by: Denis Du <dudenis2000@yahoo.ca> 
--- 
drivers/net/wan/hdlc_ppp.c | 5 ++++- 
1 file changed, 4 insertions(+), 1 deletion(-) 

diff --git a/drivers/net/wan/hdlc_ppp.c b/drivers/net/wan/hdlc_ppp.c 
index afeca6b..ab8b3cb 100644 
--- a/drivers/net/wan/hdlc_ppp.c 
+++ b/drivers/net/wan/hdlc_ppp.c 
@@ -574,7 +574,10 @@ static void ppp_timer(struct timer_list *t) 
            ppp_cp_event(proto->dev, proto->pid, TO_GOOD, 0, 0, 
                     0, NULL); 
            proto->restart_counter--; 
-        } else 
+        } else if (netif_carrier_ok(proto->dev)) 
+            ppp_cp_event(proto->dev, proto->pid, TO_GOOD, 0, 0, 
+                     0, NULL); 
+        else 
            ppp_cp_event(proto->dev, proto->pid, TO_BAD, 0, 0, 
                     0, NULL); 
        break; 
-- 
2.1.4 





On ‎Tuesday‎, ‎February‎ ‎06‎, ‎2018‎ ‎12‎:‎06‎:‎43‎ ‎PM‎ ‎EST, Denis Du <dudenis2000@yahoo.ca> wrote: 







Ok, I submit it  again.


In drivers/net/wan/hdlc_ppp.c, some noise on physical line can cause the carrier detect still ok, but the protocol will fail. So if carrier detect ok, don't turn off protocol negotiation

This patch is against the kernel version Linux 4.15-rc8





On Tuesday, February 6, 2018, 10:29:53 AM EST, David Miller <davem@davemloft.net> wrote: 





From: Denis Du <dudenis2000@yahoo.ca>

Date: Tue, 6 Feb 2018 15:15:28 +0000 (UTC)

> How  do you think my patch?
> 
> As you see, Krzysztof  think my patch is ok to be accepted.
> But if you have a better idea to fix it,I am glad to see it. Anyway, this issue have to be fixed.


Please resubmit it and I'll think about it again, thank you.

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

* Re: [PATCH] Carrier detect ok, don't turn off negotiation
  2018-02-21  3:35               ` Denis Du
@ 2018-02-22 19:04                 ` David Miller
  0 siblings, 0 replies; 10+ messages in thread
From: David Miller @ 2018-02-22 19:04 UTC (permalink / raw)
  To: dudenis2000; +Cc: khc, netdev, linux-kernel

From: Denis Du <dudenis2000@yahoo.ca>
Date: Wed, 21 Feb 2018 03:35:31 +0000 (UTC)

> How� is your thinking about this patch?

I cannot apply a patch which has been corrupted by your email client like
this.

Please send it properly again, plain ASCII text, and no trasnformations
by your email client.

You should send the patch to yourself and try to apply the patch you
receive, do not send to the list until you can pass the test properly.

Do not use attachments to fix this problem, the patch must be inline
after your commit message and signoffs.

Please read Documentation/process/submitting-patches.rst and
Documentation/process/email-clients.rsDt for more information.

Thank you.

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

end of thread, other threads:[~2018-02-22 19:04 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <751079597.1884905.1516121905374.ref@mail.yahoo.com>
2018-01-16 16:58 ` [PATCH] Carrier detect ok, don't turn off negotiation Denis Du
2018-01-22 20:25   ` David Miller
2018-01-22 22:17     ` Denis Du
2018-01-23 17:08     ` Denis Du
2018-01-28 14:24       ` Krzysztof Halasa
2018-02-06 15:18         ` Denis Du
     [not found]         ` <438911112.3985245.1517930128335@mail.yahoo.com>
2018-02-06 15:29           ` David Miller
2018-02-06 16:50             ` Denis Du
2018-02-21  3:35               ` Denis Du
2018-02-22 19:04                 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).