Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp136713pxk; Wed, 2 Sep 2020 17:08:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz8nc5GvJziD11ydG4pQfGZgTLdhzXONMr3SeHSZXg501Kbffyco7kY1dPMkIoqOGDqc36H X-Received: by 2002:a05:6402:17b9:: with SMTP id j25mr360568edy.203.1599091697499; Wed, 02 Sep 2020 17:08:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599091697; cv=none; d=google.com; s=arc-20160816; b=FU7tY2gZOlLomkkQoHAgyv0iQ7Pj/pJlhu07V1ZqypA40z2b9ueEZvOzC0CI4uy1QE goRM3mgg2w6KcuJDjsFF8LaLDJ/ijprf4ngiWqoJKXAzrlIeePGSYJFeAwYSce5YmldW BnLWqAmJvGffYL9PMohrIMflK9r6gOeQ9L5HxU2I/ahMDP2ummh/b/89DlcD5jDSJF8H UBdsjnZTkyMfPiAfio3ZMpnlCFB0Ryh9Luok2r48KGjGs5CyGSX3yzTl9Qe45pKV7Jv8 DOHUGTdVikFHNzC1vI+p0Rs8DXBopciw1Eqa73NWQSlPskbkljUnPxIILYfYe+glONxa bErQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=etdQESEPzizayB9lC3xmaZESCXB50mJ00LfBR9308WE=; b=udsZc+v6uMnkJxBIyKGDj8t8jE4ZP3y9t5Nwy+sJgJUrhcqoUPsojB9Vx+AjAEr4XA gMn7IJq2EB4nNniYuN707HMnIHNL0xyhfKUiqZMGspvsVVcE5mZOqbTkCAtfWGLuy5KW CIWcyPBbyJNArpzR3aK77fs3V1xmVuVoG2wBYBtuSWv1kgBW91VS4SDz3Yp3VM/PWORO kjdpkMZiSnr6vp/pOTA5w/ljjGKY5q0UKaloVAj+pnKFz/WTiPvgF1dyXLwO5xeXTPJB UZ8Xxe+TxxjbQ7xdsHkBw0SvohhAwVPIaaSGvnCrGO/rWewjcsOaOPG1//+icEPpRqaK aRQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=rPxrj2ar; 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 k9si692255eja.354.2020.09.02.17.07.52; Wed, 02 Sep 2020 17:08:17 -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=rPxrj2ar; 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 S1727115AbgICAHC (ORCPT + 99 others); Wed, 2 Sep 2020 20:07:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726594AbgICAHC (ORCPT ); Wed, 2 Sep 2020 20:07:02 -0400 Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5AA01C061244; Wed, 2 Sep 2020 17:07:02 -0700 (PDT) Received: by mail-pg1-x541.google.com with SMTP id v15so605133pgh.6; Wed, 02 Sep 2020 17:07:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=etdQESEPzizayB9lC3xmaZESCXB50mJ00LfBR9308WE=; b=rPxrj2arycz5jzRcUqZvd9oV5NCS7SThLH4FjF0dwugb9yI00Ya0L+9a27W7buNHAJ tfh7jK/uCD9eyOqGmw5jNZ0TNY3ANcaNP4IDfPiokFUSjgP8e9E2DXyyLwligjBOSjAJ Liz4RDJzVS9Ljx0YR++yMDsmT8Ujz8rirBuheCS3rDOv4N0rktRjV1rQSeiOdNr/6nIS s95bt7F6Xo7e4zL01NmVfAv44rmrD/1Fy1LUB1IJjWv4Bp2TOqUyT9aRq2vuRTHapWax 9/wbs5KzcmGzYaVtNVLA35lCPtiMW1Vs+Kmmj8iuKXCN+UGB+rGw2NbDE4oVB+Qv2TE6 yblQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=etdQESEPzizayB9lC3xmaZESCXB50mJ00LfBR9308WE=; b=BRO3Ex0vY/lVKvFlSZFGnmNOLDe7Q6zTrmIdDN4uibwFugePeVXfwibFO8oFtwKkeP 6mfaKn4AdUBHnc2VPy6Sg3jfUlPOVOuXkZ90x82lI7y8oQjcmZ68HJE2+637rhIZEwv3 VWjSRPhwDFGX47RcAno3OjfR2kzmmb67Fg4mRYkLVg7xSVoDTQ/fnjnm1bSWSRPX26QA 6Ry1lvtu42Wa9unussT7tZ+6l2HVWBe2ZuEFqqvmiPJypBXt/K/vEF/hFc4DrBfU5Es2 4AKOidCzGuEDUq7uF5xLqkhSZzjoPggEuMOnKDHf24BGhW2Xv6rVaPTayW72nfQlyjoo 9Eng== X-Gm-Message-State: AOAM533zX67KmkjHc+RQAjEoeWHJ1moXpE1lz3wYwXwWLhAXNKWCjGN2 c3mZNtkCCetEnwxjN2dOTwU= X-Received: by 2002:a63:9d02:: with SMTP id i2mr355802pgd.378.1599091621877; Wed, 02 Sep 2020 17:07:01 -0700 (PDT) Received: from shane-XPS-13-9380.hsd1.ca.comcast.net ([2601:646:8880:9ae0:b49f:31b6:73e2:b3d2]) by smtp.gmail.com with ESMTPSA id b12sm468947pgr.34.2020.09.02.17.07.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Sep 2020 17:07:01 -0700 (PDT) From: Xie He To: Krzysztof Halasa , "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Xie He , Martin Schiller Subject: [PATCH net v2] drivers/net/wan/hdlc_fr: Add needed_headroom for PVC devices Date: Wed, 2 Sep 2020 17:06:58 -0700 Message-Id: <20200903000658.89944-1-xie.he.0141@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org PVC devices are virtual devices in this driver stacked on top of the actual HDLC device. They are the devices normal users would use. PVC devices have two types: normal PVC devices and Ethernet-emulating PVC devices. When transmitting data with PVC devices, the ndo_start_xmit function will prepend a header of 4 or 10 bytes. Currently this driver requests this headroom to be reserved for normal PVC devices by setting their hard_header_len to 10. However, this does not work when these devices are used with AF_PACKET/RAW sockets. Also, this driver does not request this headroom for Ethernet-emulating PVC devices (but deals with this problem by reallocating the skb when needed, which is not optimal). This patch replaces hard_header_len with needed_headroom, and set needed_headroom for Ethernet-emulating PVC devices, too. This makes the driver to request headroom for all PVC devices in all cases. Cc: Krzysztof Halasa Cc: Martin Schiller Signed-off-by: Xie He --- Change from v1: English language fix for the commit message. Changed "Ethernet-emulated" to "Ethernet-emulating" because the device is emulating an Ethernet device, rather than being emulated by an Ethernet device. I'm sorry for my poor English. --- drivers/net/wan/hdlc_fr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/wan/hdlc_fr.c b/drivers/net/wan/hdlc_fr.c index 9acad651ea1f..12b35404cd8e 100644 --- a/drivers/net/wan/hdlc_fr.c +++ b/drivers/net/wan/hdlc_fr.c @@ -1041,7 +1041,7 @@ static void pvc_setup(struct net_device *dev) { dev->type = ARPHRD_DLCI; dev->flags = IFF_POINTOPOINT; - dev->hard_header_len = 10; + dev->hard_header_len = 0; dev->addr_len = 2; netif_keep_dst(dev); } @@ -1093,6 +1093,7 @@ static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type) dev->mtu = HDLC_MAX_MTU; dev->min_mtu = 68; dev->max_mtu = HDLC_MAX_MTU; + dev->needed_headroom = 10; dev->priv_flags |= IFF_NO_QUEUE; dev->ml_priv = pvc; -- 2.25.1