[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201118135919.1447-4-ms@dev.tdt.de>
Date: Wed, 18 Nov 2020 14:59:16 +0100
From: Martin Schiller <ms@....tdt.de>
To: andrew.hendry@...il.com, davem@...emloft.net, kuba@...nel.org,
xie.he.0141@...il.com
Cc: linux-x25@...r.kernel.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, Martin Schiller <ms@....tdt.de>
Subject: [PATCH net-next v3 3/6] net/lapb: handle carrier loss correctly
In case of carrier loss, clear all queues, enter state LABB_STATE_0 and
stop all timers.
By setting rc = LAPB_NOTCONNECTED, the upper layer is informed about the
disconnect.
Signed-off-by: Martin Schiller <ms@....tdt.de>
---
net/lapb/lapb_iface.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/net/lapb/lapb_iface.c b/net/lapb/lapb_iface.c
index 8dd7c420ae93..017bc169c334 100644
--- a/net/lapb/lapb_iface.c
+++ b/net/lapb/lapb_iface.c
@@ -303,6 +303,18 @@ int lapb_disconnect_request(struct net_device *dev)
if (!lapb)
goto out;
+ if (!netif_carrier_ok(dev)) {
+ lapb_dbg(0, "(%p) Carrier lost!\n", lapb->dev);
+ lapb_dbg(0, "(%p) S%d -> S0\n", lapb->dev, lapb->state);
+ lapb_clear_queues(lapb);
+ lapb->state = LAPB_STATE_0;
+ lapb->n2count = 0;
+ lapb_stop_t1timer(lapb);
+ lapb_stop_t2timer(lapb);
+ rc = LAPB_NOTCONNECTED;
+ goto out_put;
+ }
+
switch (lapb->state) {
case LAPB_STATE_0:
rc = LAPB_NOTCONNECTED;
--
2.20.1
Powered by blists - more mailing lists