Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp748997ybg; Tue, 28 Jul 2020 18:42:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx/dnhTGj/XHD8MCEbgcHnbJ2Fwkjg4+0tUUPZm415+VxozRU/pTHkwFbUICxKBSo0Gui6R X-Received: by 2002:a50:a6d0:: with SMTP id f16mr19405376edc.7.1595986944556; Tue, 28 Jul 2020 18:42:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595986944; cv=none; d=google.com; s=arc-20160816; b=lXc7tQ/0+iE1w5EWDNj59w1deKAUpv07MnsNouAslmZlxFco2fic9Kxy4BIH0eSQTT ill+xn1ez/qZGIwW0fRnYJVhCV9eRJkeK6FabCys5GUL6tE2o3TxhhsdU+UsuHiZtwph PK2n4+nL17IvroNfB5p0cTggZJBGUi9EHHYFhx88C5faODBurBjQqYDgS7dCRzlDNhSy fDfkzSDPgcqZiQW2DnkMYFOVZKYwysy/n/fxn871PNc5lmDEgRy8NruUqHJTc+pvFUGU 5zgrOssi4Ky+buosxT9Kf4GWpm9zdTyYwPUGfzpHhNGV3vtUPITxyuWwbl5UK3v2QbG0 8sPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=ShpMJE4OIEv6PxHTCcLYNHQznGjFTXHy5yRHP4HI7Go=; b=g6YDxSPaUrf67BmEXEd+z6Q7/TFQLGg73xrMAoHMMclktQfz4F6HbP4Jf3km9/7rHt Xka6eMD4cq2nW8uj5LHkfiyCso2LDrJBOrbl9cILKUWRZ+N28VP8omMuBQqXaAbRFEzL 8rGlsJt9DsXtdVDLBcGvRyDRaOGckZ6TmhWihSOckDvO9N8YxacrhrJt7AsNic1I7VW4 NqUyxathKoTtk6zpPTZHZVM0dtmuWDYsh49mTp4QNp0XlVfeAecXOUD/egWWVkG2PCbt J3HTo0FeVFz8PFAVA3E5RxfguMbz+hBT39h7MRz4oYE5QzLpJYtWeP2AngkeTNyVv7Vo FkFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=BClZOK3d; 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 bi14si168366ejb.251.2020.07.28.18.42.01; Tue, 28 Jul 2020 18:42:24 -0700 (PDT) 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=BClZOK3d; 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 S1730353AbgG2Bl5 (ORCPT + 99 others); Tue, 28 Jul 2020 21:41:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730117AbgG2Bl5 (ORCPT ); Tue, 28 Jul 2020 21:41:57 -0400 Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5EDDC061794; Tue, 28 Jul 2020 18:41:56 -0700 (PDT) Received: by mail-pf1-x442.google.com with SMTP id 74so3824099pfx.13; Tue, 28 Jul 2020 18:41:56 -0700 (PDT) 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=ShpMJE4OIEv6PxHTCcLYNHQznGjFTXHy5yRHP4HI7Go=; b=BClZOK3dAzubCSEkbwRfwnCusyjEcYWZ7pk8/KbxyBcExOrFWxmlvM19CYMKFTYj/w C7sIyeILZs1yEzEVoYrjY2zvprbMcO9Vvjow5oWczQC1JIEi2oZ/bKDVqfReXYasxfjW JaQtvkzKr/3qVnoSxEgL6Ebd8YtCEAbOlqC2D9JxOgpxYIhB2nhH+8zNg87hRGDFWrWe q6GKmziLH6Oe4Hiit/fwwXxYnl0JSCMo8uFehR1mQU9RMgbUVTQ0Z8iup0dPlChQ/Pb3 qwGBs/ms5wfED9RjRmE0ZBybq53yewSsNNkLVDGESsXuhPSRQVKY7lI3KDKt79WuYK3v TdQQ== 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=ShpMJE4OIEv6PxHTCcLYNHQznGjFTXHy5yRHP4HI7Go=; b=lipN9On+MtpkJn1ljpY8cGWST8NcYGtnr0Xe9Ej5vWdot18RGunoX9K43ENQw7xDGA wPSPGVpjLa3XggUDbawQineWCXaNT9ZfbmEn25gYUTSmbvnupgdcPqXoDEAAUOd7xr3p Dv9tX2vQ8upXjQlt03knuC1hnp+bAA258IOTyDnJFegGEJ1Z4+YXY9NQ1e7PDfqmwg0+ /HKkfLGqNmsLmhKTdNwXkl5mfOe0kRYxyQ4E2RJuFICUFuuzmvJwEG/cffY1R+fj91PQ E7Z1VqT2/6rxLqLrSWbOXLhGNXlAvuZ3pGzTHsxF5kB+rdPEGFyDrZ87tFI5rGOtQEDM oE9w== X-Gm-Message-State: AOAM530fWpjTwpbnHhL+QxOscWS7drhbL81fmncS+vYmkpg7rJziVdq9 aBWfy5Fp7wjVLtlnvC44HO6oMh4OkL0Vf1KzMJc= X-Received: by 2002:aa7:9d0e:: with SMTP id k14mr3291266pfp.162.1595986916147; Tue, 28 Jul 2020 18:41:56 -0700 (PDT) MIME-Version: 1.0 References: <20200726110524.151957-1-xie.he.0141@gmail.com> <20200728195246.GA482576@google.com> In-Reply-To: <20200728195246.GA482576@google.com> From: Xie He Date: Tue, 28 Jul 2020 18:41:45 -0700 Message-ID: Subject: Re: [PATCH] drivers/net/wan/lapbether: Use needed_headroom instead of hard_header_len To: Brian Norris Cc: "David S. Miller" , Jakub Kicinski , Linux Kernel Network Developers , LKML , Linux X25 , Cong Wang Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Thank you for your detailed review, Brian! I guess we have the same understanding on the "hard_header_len vs needed_headroom" part. I agree it is not well documented and is also confusing to driver developers. I didn't understand it either until I looked at af_packet.c. On Tue, Jul 28, 2020 at 12:52 PM -0700 Brian Norris wrote: > > What's to say you shouldn't be implementing header_ops instead? Note > that with WiFi drivers, they're exposing themselves as ARPHRD_ETHER, and > only the Ethernet headers are part of the upper "protocol" headers. So > my patch deferred to the eth headers. > > What is the intention with this X25 protocol? I guess the headers added > in lapbeth_data_transmit() are supposed to be "invisible", as with this > note in af_packet.c? > > - if device has no dev->hard_header routine, it adds and removes ll header > inside itself. In this case ll header is invisible outside of device, > but higher levels still should reserve dev->hard_header_len. > > If that's the case, then yes, I believe this patch should be correct. This driver is not intended to be used with IPv4 or IPv6 protocols, but is intended to be used with a special "X.25" protocol. That's the reason the device type is ARPHRD_X25. I used "grep" in the X.25 network layer code (net/x25) and I found there's nowhere "dev_hard_header" is called. I also used "grep" in all the X.25 drivers in the kernel (lapbether.c, x25_asy.c, hdlc_x25.c under drivers/net/wan) and I found no driver implemented "header_ops". So I think the X.25 networking code doesn't expect any header visible outside of the device driver, and X.25 drivers should make their headers invisible outside of them. So I think hard_header_len should be 0 for all X.25 drivers, so that they can be used correctly with af_packet.c. I don't know if this sounds plausible to you. If it does, could you please let me have your name in a "Reviewed_by" tag. It would be of great help to have your support. Thanks!