Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2888167pxb; Sat, 30 Jan 2021 19:21:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJzz0/uxDFdTEGF//3XkFqDBO8jUk3pXPlplLor4iGtL2vg3M4mv9+uOHYlOhJdwyGXavJ7d X-Received: by 2002:a05:6402:c92:: with SMTP id cm18mr12909968edb.367.1612063273258; Sat, 30 Jan 2021 19:21:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612063273; cv=none; d=google.com; s=arc-20160816; b=c45k7offJ08lpI7c6bcybp5FZZja0Ids5WqZ8/uYjQKS5xCOJUKasFlMHMPhbwuPdo VEL0/64lalfxCybU3745x9DjDATdaHBvMYrumP3jsvkTKQP/pZpZ9hJmIZwGRBg1MOA9 IEldJqAe4Li8lU7sO1k0LJk6mQKtioOZg66VdxDyuNzgVRETo9yZNzsotpisz2e0XJWr UVcea9AKBjsttkg3Popf1Tdrd97/vbDe+cwgnXnCBY/tN1W6C46htSgwnGqxU5/tXzCx 8qLmDO3w3++N9F0ECsmDT2Vk1FsmuC3iA8ign9PWFFkmntfZddGn5QRjC8DiN8IppuEc RVwQ== 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=ohey/n9HC50LcT9SfB1APHEExDxmpN/T94GswSnA44U=; b=bNGeuQZ9c5lFRE7NsWPttjpgLyyfy0thbF6gvHSI1EyKzrfeq7akxZCLCmVq4AaxKP BT4bF4BaSCKWpEqrg3eK6/aq3KxMKKAVSRxANs4NXdIkYrzoDMoUpmVtWcia8EENazgS Fek5GivdXmZ4O+x4tFMA29xu31Ojkh8ZbIoldQYYoTseD4/PfWZbk8o9Ugb0olATuL9x k1+MtZDwOVVDx9NjyripszXqPKO2UbOC5fOg/dOSXSOdJPFiN0THOqWody6TIQHs2OhK asffuYFG3FhUC6Ytp8gYXd59EF43REdREm8mfRGkPl+VZFwPs5CgxCxbOPn5uBWi04/f gttA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=NQTJszeG; 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 t14si1643421ejr.662.2021.01.30.19.20.35; Sat, 30 Jan 2021 19:21:13 -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=NQTJszeG; 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 S229677AbhAaDQw (ORCPT + 99 others); Sat, 30 Jan 2021 22:16:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229468AbhAaDQw (ORCPT ); Sat, 30 Jan 2021 22:16:52 -0500 Received: from mail-pg1-x535.google.com (mail-pg1-x535.google.com [IPv6:2607:f8b0:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E180AC061573; Sat, 30 Jan 2021 19:16:11 -0800 (PST) Received: by mail-pg1-x535.google.com with SMTP id i7so9599126pgc.8; Sat, 30 Jan 2021 19:16:11 -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=ohey/n9HC50LcT9SfB1APHEExDxmpN/T94GswSnA44U=; b=NQTJszeGFJ+SLfhMg24MZxPuqDcRn8iY0x6u0pvyOTcY7L3qThofp937GjRnHBtwyd GT9s01S9jxE4Wf2eQYuO6Kc29cIwkcnuDIcBQZE00zAquyuylJBYNWBIjYd8nOUmCc9n JvjTqHtDKkeDNQZIQveJycwgupWWZ3vId/nSy/Z+uXlsv7Gn40wdLIdlkpQy9W6TuQfW V2ckBfRWm9AdsPj+rQ8HU8qIfrgS80SeHd113c8Mgsci8mZOuCiaVOaJx1oLOoU8RwWS N5lLQHZvGkURl0la4UnDmwI+PVUa/NGM6JcOzWq4PMGzulwYOCjAQyOz1tyUteIN18id HCog== 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=ohey/n9HC50LcT9SfB1APHEExDxmpN/T94GswSnA44U=; b=d/8ccOlI9VhK+sEAC2Lza6to5ZMeResGhuv4ATT8niAsSWXAIDDv/fcLh0Dj3NW+eV BPdbianXzsvvy4k+gYUX1rhCnJtFeT8lUFhTMGhVElVY083h72vhUZsDs4VbaNNUOQOc mNKXiUi0mqLm/3bvWX9+31IcRaGMk//Ix3k4yOOWEQiSI0ZVCCYOp/2sPo+dMpwNdfTs Swn4/CrPSF/Gbgq+AdnYv+PI8ROqevxxs3c3WaRo931t8GP61eLKmf5l6pBGjT3vJuI0 L/V91BPBtVZZt+RLUzPK4EwLszWJpXVlWRiYf6QlzjyJhDWcaPxobftXnxItgDqZxxsn qPLQ== X-Gm-Message-State: AOAM531krJwbzMyW5wDoIyxzLoh+SK/jnA2DLAhof84G13nbJdFln3wn 30f62ta0CV6EnJQ+MrCsuiZ3PUurHM+lgDdtKL73mF1vxFU= X-Received: by 2002:a62:503:0:b029:1c0:aed7:c88 with SMTP id 3-20020a6205030000b02901c0aed70c88mr4913844pff.76.1612062971326; Sat, 30 Jan 2021 19:16:11 -0800 (PST) MIME-Version: 1.0 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> In-Reply-To: <20210130111618.335b6945@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> From: Xie He Date: Sat, 30 Jan 2021 19:16:00 -0800 Message-ID: Subject: Re: [PATCH net] net: hdlc_x25: Use qdisc to queue outgoing LAPB frames To: Jakub Kicinski Cc: Martin Schiller , "David S. Miller" , Linux X25 , Linux Kernel Network Developers , LKML , Krzysztof Halasa Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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?