Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3673679pxb; Mon, 1 Feb 2021 01:22:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJyg5PZpCb5z3Ew5fEUoGc5JE6q7AypsXAFBcMJqzLA2md6sUgq2WO7Tw3c93uYdEFSF9rK2 X-Received: by 2002:a17:906:a384:: with SMTP id k4mr16678269ejz.194.1612171336932; Mon, 01 Feb 2021 01:22:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612171336; cv=none; d=google.com; s=arc-20160816; b=tyDBwze7H8vilyeaQezA7nIj5fxJHgpo4RqbJk3KPi068nrGtLzJwRFN7YVaynJ0Os GK6bZsATz8qIgooL0embvCC4TKLbb0iWl2eJnMKhGIlqT9MupwoIJCvhgd0VJrpUUUAn +FSvdNKoY7APXYtd2SGMhQ76e135Zk8rLvJVJNMo5Ks4NUe5xDMfZVIqbry5aJ6Lmt7/ OJlCZPAK+DAUFuCOvari9JnsfewDCVAEUTdk9BN61W98ru2Vv0LH+akQDV3Yy3KWmfEJ Jy4Wk5PV90zEZLbXWt3jK3IUYk08lYmFjx/KClIq1jWtvNcDQhdc+LrJt4YdGOZ8KsXf LxPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:message-id:references:in-reply-to :organization:subject:cc:to:from:date:content-transfer-encoding :mime-version; bh=6UCYrJPbryVp67sSvrmli3WtRpgqAWJy7gpOuH6OYU0=; b=YWPEIQVeGh46Xw954iziEMSY2ycEV7APIP2c5FzImqHmabjtPaweAnwwYDeTYV/UMX 41AXJBYGfxYTpPxEWc+2S4xnD5l/SWKT8cahiAWnLiS2elnzNRcXl6TgAGZLQSN1VryV +ZQANAwXzR5yna3xEOktWabYBFfbYcUaRYMvTjNBC0P4JVBuAuiQqpSrd5/SlhoBtg8p 2pfvC3J5Cxn/d35I0Cp7exEaVkA6j1pxayWHp5KaWKkRCngaY5AY67zGuhLYpCVDyTWC 7hLEjyNaJJb1cpPuSBs6icYJ/MAD+kEJL3dJMVB4nNNn9rmB+j8rrmEXTKUEzg1gsVMu WC6g== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i24si458854ejy.153.2021.02.01.01.21.52; Mon, 01 Feb 2021 01:22:16 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232706AbhBAJU1 (ORCPT + 99 others); Mon, 1 Feb 2021 04:20:27 -0500 Received: from mxout70.expurgate.net ([194.37.255.70]:60653 "EHLO mxout70.expurgate.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232758AbhBAJUT (ORCPT ); Mon, 1 Feb 2021 04:20:19 -0500 Received: from [127.0.0.1] (helo=localhost) by relay.expurgate.net with smtp (Exim 4.90) (envelope-from ) id 1l6VLl-0004xN-M0; Mon, 01 Feb 2021 10:18:25 +0100 Received: from [195.243.126.94] (helo=securemail.tdt.de) by relay.expurgate.net with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90) (envelope-from ) id 1l6VLk-0002MG-Ia; Mon, 01 Feb 2021 10:18:24 +0100 Received: from securemail.tdt.de (localhost [127.0.0.1]) by securemail.tdt.de (Postfix) with ESMTP id 2426C240041; Mon, 1 Feb 2021 10:18:24 +0100 (CET) Received: from mail.dev.tdt.de (unknown [10.2.4.42]) by securemail.tdt.de (Postfix) with ESMTP id 97CDE240040; Mon, 1 Feb 2021 10:18:23 +0100 (CET) Received: from mail.dev.tdt.de (localhost [IPv6:::1]) by mail.dev.tdt.de (Postfix) with ESMTP id 264DB200AA; Mon, 1 Feb 2021 10:18:23 +0100 (CET) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 01 Feb 2021 10:18:23 +0100 From: Martin Schiller To: Xie He Cc: Jakub Kicinski , "David S. Miller" , Linux X25 , Linux Kernel Network Developers , LKML , Krzysztof Halasa Subject: Re: [PATCH net] net: hdlc_x25: Use qdisc to queue outgoing LAPB frames Organization: TDT AG In-Reply-To: References: <20210127090747.364951-1-xie.he.0141@gmail.com> <20210128114659.2d81a85f@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> <3f67b285671aaa4b7903733455a730e1@dev.tdt.de> <20210129173650.7c0b7cda@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> <20210130111618.335b6945@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> Message-ID: <36a6c0769c57cd6835d32cc0fb95bca6@dev.tdt.de> X-Sender: ms@dev.tdt.de User-Agent: Roundcube Webmail/1.3.16 X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.dev.tdt.de X-purgate-ID: 151534::1612171105-0000A9C4-B60B7990/0/0 X-purgate-type: clean X-purgate: clean Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021-01-31 04:16, Xie He wrote: > On Sat, Jan 30, 2021 at 11:16 AM Jakub Kicinski > wrote: >> >> Sounds like too much afford for a sub-optimal workaround. >> The qdisc semantics are borken in the proposed scheme (double >> counting packets) - both in term of statistics and if user decides >> to add a policer, filter etc. > > Hmm... > > Another solution might be creating another virtual device on top of > the HDLC device (similar to what "hdlc_fr.c" does), so that we can > first queue L3 packets in the virtual device's qdisc queue, and then > queue the L2 frames in the actual HDLC device's qdisc queue. This way > we can avoid the same outgoing data being queued to qdisc twice. But > this would significantly change the way the user uses the hdlc_x25 > driver. > >> Another worry is that something may just inject a packet with >> skb->protocol == ETH_P_HDLC but unexpected structure (IDK if >> that's a real concern). > > This might not be a problem. Ethernet devices also allow the user to > inject raw frames with user constructed headers. "hdlc_fr.c" also > allows the user to bypass the virtual circuit interfaces and inject > raw frames directly on the HDLC interface. I think the receiving side > should be able to recognize and drop invalid frames. > >> It may be better to teach LAPB to stop / start the internal queue. >> The lower level drivers just needs to call LAPB instead of making >> the start/wake calls directly to the stack, and LAPB can call the >> stack. Would that not work? > > I think this is a good solution. But this requires changing a lot of > code. The HDLC subsystem needs to be changed to allow HDLC Hardware > Drivers to ask HDLC Protocol Drivers (like hdlc_x25.c) to stop/wake > the TX queue. The hdlc_x25.c driver can then ask the LAPB module to > stop/wake the queue. > > So this means new APIs need to be added to both the HDLC subsystem and > the LAPB module, and a number of HDLC Hardware Drivers need to be > changed to call the new API of the HDLC subsystem. > > Martin, do you have any suggestions? I have thought about this issue again. I also have to say that I have never noticed any problems in this area before. So again for (my) understanding: When a hardware driver calls netif_stop_queue, the frames sent from layer 3 (X.25) with dev_queue_xmit are queued and not passed "directly" to x25_xmit of the hdlc_x25 driver. So nothing is added to the write_queue anymore (except possibly un-acked-frames by lapb_requeue_frames). Shouldn't it actually be sufficient to check for netif_queue_stopped in lapb_kick and then do "nothing" if necessary? As soon as the hardware driver calls netif_wake_queue, the whole thing should just continue running. Or am I missing something?