Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp693136pxu; Mon, 23 Nov 2020 01:22:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJzZ5XkOo5iSuJfilEnkiFur6rDfUmdtF6nkbw0REj3tf+i+qG4j5gCI3OQrde4aeu9KCx5R X-Received: by 2002:a50:ab07:: with SMTP id s7mr14152590edc.374.1606123373965; Mon, 23 Nov 2020 01:22:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606123373; cv=none; d=google.com; s=arc-20160816; b=e5F/VZ3Tj7IdYY6htPCfCdte9QJ8MrJk2mN5GJovTGz9oTeiYdx7ucoM5rp58uUyM1 T4CW5VJUzMJ6pRDqKv4WhumUqV8Sr3BOKWDVA79ebTDGrpDcqpYdgF0c3M4CaHubgQaE hN44b9PwsZgMGQPOHJJI001DXcfeD3qIPZLHfQdnaWV+ZXy5DyPCKQKvy6zlV/qt3A4j jgcPK8QJoRE6+z9c9D/CvjlgI0TK+eZvJk4DJlqdEOGja+Eq8wgqbtpCMO9z3OwFEGe/ uri0nWOUchAEOLzgSM9HbSa+5iDxHxivCWwsTVdytcXZBhHLSqSRLuAi6+Zh1rOxz8I8 z/WQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=A2OCYPW48+EaJEiSvyQJ2+kFYlsiz/LUK7yoFIj7s/0=; b=x5x9DtQCK/ahQr8DZZb5fD0fmbsSmr9coUdD1w7oCNBXLCTOroN2W9702f0M2Dz+DF HGVwWPwHMFXB+kXFWjYmRbkD2kpNTrjTblHhFkgDnbQvt85AKoiiCp0mVkhnSokybpGF c9b9iheVjJlSyA7DydhYh6awjBHSvyj+qjU/ryftBp4aIFsbrllR3yGhQ2Dffk4f2we6 0EHLGih9JxYjyvfg+bOD069Y7qtEePshQZpTV92WlFwWXRnX34X90oASgZeCysZLdC/l nK87MuErWmwGpgImlSkkdjcdVlHvCmkpeiZ1aB1vjk3o2+VXkCgKmZKZ+EYqnvcXurTr peXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ARYHclAh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hh1si6283547ejb.605.2020.11.23.01.22.31; Mon, 23 Nov 2020 01:22:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ARYHclAh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727440AbgKWIbu (ORCPT + 99 others); Mon, 23 Nov 2020 03:31:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725320AbgKWIbt (ORCPT ); Mon, 23 Nov 2020 03:31:49 -0500 Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C509C0613CF; Mon, 23 Nov 2020 00:31:48 -0800 (PST) Received: by mail-pf1-x443.google.com with SMTP id b6so3793727pfp.7; Mon, 23 Nov 2020 00:31:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=A2OCYPW48+EaJEiSvyQJ2+kFYlsiz/LUK7yoFIj7s/0=; b=ARYHclAhefMjQHT4pgy8KkNlOofEUe0LkbQSPGkdnzqUV2+hD6tBxSunTjYE5sCLw5 uvuR9gciPL3KO0c8LfdT/WsDQyWWd+8g4+W/ZeM7hApLOw7CHS6PwFO0uXjUfPIpW8Rd atZazrkI4VZL27dree/jNephYhEoySeNnC0jFyiocUZ8WlGVYoIqytNkHjT/0gmiGaOx S2qdJszwvrGaAonzGFg9OAPsvqYO5yNiCoSt7nS2C8dHNUDX2EvA1Pa+Sj0kgJawS9td uJZB6Sp8xX5ouYYG2dtlYMSJ4/ani1XY3s1n5qXaCSlAnTxylkV4YOteyF2R5YeO31N9 txqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=A2OCYPW48+EaJEiSvyQJ2+kFYlsiz/LUK7yoFIj7s/0=; b=qA6MKfmz51/1KbXqXchcmjyinHT+QZPAiuQj+ZGXw/UQw15r2ohlIEbL5u/OWzTGUc dIB15d2Qy2TTdw94thjsPhTLcp6H6u47NXt/+re7dAqGROarapodTMfC4a6Z59UHGxAN Ks8xomn8BZ8bxzFD/B7KsPSL8qvhMdE4b4o6VaCstj7LUvFG05T72mPDkKb6tFjHy/Ys WyfRFKEzQFi8ZMnx8380hBx633h9KHSbiJfHadzIyvOcZzBo3l8j/yTIyxnJw3WnsUPv BPgJgjviO5tFqkiacpSwWNUamjLR1XXs5HS3Om85pABBDRNLkxUkCvAqfP/QMdsYitPI wemQ== X-Gm-Message-State: AOAM533XJu/KPXzlmqlX4zdkzhemTJCNo7INnXMpLnWo2/PkN2i0Zc8E sY7sQ+BEYjEAGTIxj98x/ZY8Z4hDL7/sZN0dHajpI51wcMw= X-Received: by 2002:a65:560b:: with SMTP id l11mr27674361pgs.63.1606120307543; Mon, 23 Nov 2020 00:31:47 -0800 (PST) MIME-Version: 1.0 References: <20201120054036.15199-1-ms@dev.tdt.de> <20201120054036.15199-3-ms@dev.tdt.de> <87a620b6a55ea8386bffefca0a1f8b77@dev.tdt.de> In-Reply-To: <87a620b6a55ea8386bffefca0a1f8b77@dev.tdt.de> From: Xie He Date: Mon, 23 Nov 2020 00:31:36 -0800 Message-ID: Subject: Re: [PATCH net-next v4 2/5] net/lapb: support netdev events To: Martin Schiller Cc: Andrew Hendry , "David S. Miller" , Jakub Kicinski , Linux X25 , Linux Kernel Network Developers , LKML Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Nov 22, 2020 at 10:55 PM Martin Schiller wrote: > > No, they aren't independent. The carrier can only be up if the device / > interface is UP. And as far as I can see a NETDEV_CHANGE event will also > only be generated on interfaces that are UP. > > So you can be sure, that if there is a NETDEV_CHANGE event then the > device is UP. OK. Thanks for your explanation! > I removed the NETDEV_UP handling because I don't think it makes sense > to implicitly try to establish layer2 (LAPB) if there is no carrier. As I understand, when the device goes up, the carrier can be either down or up. Right? If this is true, when a device goes up and the carrier then goes up after that, L2 will automatically connect, but if a device goes up and the carrier is already up, L2 will not automatically connect. I think it might be better to eliminate this difference in handling. It might be better to make it automatically connect in both situations, or in neither situations. If you want to go with the second way (auto connect in neither situations), the next (3rd) patch of this series might be also not needed. I just want to make the behavior of LAPB more consistent. I think we should either make LAPB auto-connect in all situations, or make LAPB wait for L3's instruction to connect in all situations. > And with the first X.25 connection request on that interface, it will > be established anyway by x25_transmit_link(). > > I've tested it here with an HDLC WAN Adapter and it works as expected. > > These are also the ideal conditions for the already mentioned "on > demand" scenario. The only necessary change would be to call > x25_terminate_link() on an interface after clearing the last X.25 > session. > > > On NETDEV_GOING_DOWN, we can also check the carrier status first and > > if it is down, we don't need to call lapb_disconnect_request. > > This is not necessary because lapb_disconnect_request() checks the > current state. And if the carrier is DOWN then the state should also be > LAPB_STATE_0 and so lapb_disconnect_request() does nothing. Yes, I understand. I just thought adding this check might make the code cleaner. But you are right.