Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4804859pxb; Mon, 15 Feb 2021 01:28:01 -0800 (PST) X-Google-Smtp-Source: ABdhPJxhXBocvsS8rFmSWu1RMZF/e+aTuRrPxP3ibZAaeATFJQ9mv16v6eJ1Ubhe0JMF34Tt9ssy X-Received: by 2002:a17:907:1191:: with SMTP id uz17mr14730934ejb.371.1613381281455; Mon, 15 Feb 2021 01:28:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613381281; cv=none; d=google.com; s=arc-20160816; b=ltTGERexTYzCrH86+qnFYMYKwgzlG5kP1862dUE/Kdg0gXwq7r9ftbjjVB0yGrjvSt NP3roB2hytUh+8v6a/YvWAUKyicre/jJK42Br+yBBh+PJ8QueZoN7Chw9gweM+cbl+JY PtEyDNzJGuGceNJzw5hmkof2WWncqZBwVBIlmm3ljGq3uYnfAPjcqRYiS9a5Ea6Ix2bv NXJ3frnsJs7UtpCM6XsdECZfBwPablYkjS05oUfZGAkF8a47kCb7Ai2nvucQdo8amSVC g9GdJbyDoW2ou6dVKqePQYIj3IlfHWPXjibetJ1n3CfP8bVCSIW83zZ1iDbdW2luCeB1 z8TA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=+FcQuKG84OlNnjTiACL/hRrLr/iJNVmq325EupTZjr8=; b=jplHktHR3Cm4ym1EymJmEjejhdh6S7cv2jhdjW73MB5LnmpS9tLyKgJSU/ykmWAln0 HF4cxb6W5ivhwoCfLhbPAQGlzr4qZeI7/oCJxnwAd2ZCEX7fhaH40ozKomfYgubc93wl BxWnmkkuw2fvnCHnvsiWOfsPCnUbKoWZQ0vaHKAf0SqIaTI0OlUi0YvIZX4DBF2MKORY aslyUwEJsfOG4cnGeo0NHMazbOKt9rWVXWrO1ffeI59J/iCdcT/v9lOIOEqS8CbnCgoQ wXGPcRxSZK3pv5+X0gQkD/8bNRfC/VvF4KXHl+EsHtiG4S4fl9WsrrPY61LONgXPBtj8 l8zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="IsVSG/ZQ"; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dg27si11235939edb.283.2021.02.15.01.27.38; Mon, 15 Feb 2021 01:28:01 -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=@kernel.org header.s=k20201202 header.b="IsVSG/ZQ"; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230162AbhBOJ0F (ORCPT + 99 others); Mon, 15 Feb 2021 04:26:05 -0500 Received: from mail.kernel.org ([198.145.29.99]:44628 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230138AbhBOJZp (ORCPT ); Mon, 15 Feb 2021 04:25:45 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9C18D64DEE; Mon, 15 Feb 2021 09:25:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1613381104; bh=bfvSPlI4bOZ5PvYmk6nN5TYccj5PzjzSAJoKeX5M+pw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=IsVSG/ZQlyd3wQIjwsnY7ygCfS7ysRv9A+Ob9FzgzshzMdDYHLLkq1fMqfY9V4Eh+ krxug0eXpQ8WUGpTDTadVv8b1g5VmtMXJJUxMdqvGt9Bd18vAg4vuGO4zorNFKsoXC 6ggLrJgwjwm5aCJCyivNtnA/NeilemdN/K6Rhzv9TenICLwmknzcFQoNxUXxh67gFp Vl4DPPVbcHJTFmNujzI48TeJwYL9r8kVjYYUu+i5rPC8LLNhiG4Fj3umATIHDzHaC0 hMsgPacItYgC3UBFeUmOrzL5TnDzy03/frRDtMOVdqJa/i9/NkgbiP1dd4YjSV2sJ2 Fv01A+YBJF6wA== Date: Mon, 15 Feb 2021 11:24:59 +0200 From: Leon Romanovsky To: Xie He Cc: "David S. Miller" , Jakub Kicinski , linux-x25@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Martin Schiller , Krzysztof Halasa Subject: Re: [PATCH net-next RFC v3] net: hdlc_x25: Queue outgoing LAPB frames Message-ID: References: <20210215072703.43952-1-xie.he.0141@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210215072703.43952-1-xie.he.0141@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Feb 14, 2021 at 11:27:03PM -0800, Xie He wrote: > When sending packets, we will first hand over the (L3) packets to the > LAPB module. The LAPB module will then hand over the corresponding LAPB > (L2) frames back to us for us to transmit. > > The LAPB module can also emit LAPB (L2) frames at any time, even without > an (L3) packet currently being sent on the device. This happens when the > LAPB module tries to send (L3) packets queued up in its internal queue, > or when the LAPB module decides to send some (L2) control frame. > > This means we need to have a queue for these outgoing LAPB (L2) frames, > otherwise frames can be dropped if sent when the hardware driver is > already busy in transmitting. The queue needs to be controlled by > the hardware driver's netif_stop_queue and netif_wake_queue calls. > Therefore, we need to use the device's qdisc TX queue for this purpose. > However, currently outgoing LAPB (L2) frames are not queued. > > On the other hand, outgoing (L3) packets (before they are handed over > to the LAPB module) don't need to be queued, because the LAPB module > already has an internal queue for them, and is able to queue new outgoing > (L3) packets at any time. However, currently outgoing (L3) packets are > being queued in the device's qdisc TX queue, which is controlled by > the hardware driver's netif_stop_queue and netif_wake_queue calls. > This is unnecessary and meaningless. > > To fix these issues, we can split the HDLC device into two devices - > a virtual X.25 device and the actual HDLC device, use the virtual X.25 > device to send (L3) packets and then use the actual HDLC device to > queue LAPB (L2) frames. The outgoing (L2) LAPB queue will be controlled > by the hardware driver's netif_stop_queue and netif_wake_queue calls, > while outgoing (L3) packets will not be affected by these calls. > > Cc: Martin Schiller > Signed-off-by: Xie He > --- > > Change from RFC v2: > Simplified the commit message. > Dropped the x25_open fix which is already merged into net-next now. > Use HDLC_MAX_MTU as the mtu of the X.25 virtual device. > Add an explanation to the documentation about the X.25 virtual device. > > Change from RFC v1: > Properly initialize state(hdlc)->x25_dev and state(hdlc)->x25_dev_lock. > > --- > Documentation/networking/generic-hdlc.rst | 3 + > drivers/net/wan/hdlc_x25.c | 153 ++++++++++++++++++---- > 2 files changed, 130 insertions(+), 26 deletions(-) <...> > +static void x25_setup_virtual_dev(struct net_device *dev) > +{ > + dev->netdev_ops = &hdlc_x25_netdev_ops; > + dev->type = ARPHRD_X25; > + dev->addr_len = 0; > + dev->hard_header_len = 0; > + dev->mtu = HDLC_MAX_MTU; > + > + /* When transmitting data: > + * first we'll remove a pseudo header of 1 byte, > + * then the LAPB module will prepend an LAPB header of at most 3 bytes. > + */ > + dev->needed_headroom = 3 - 1; 3 - 1 = 2 Thanks > +} > +