Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3443705pxk; Mon, 28 Sep 2020 18:40:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy8b7W87pyWvE1pCXxWDZu9QrXVk8kb+6HsAgk1YfzGsFXXXCM4Lxu6NiOiMir2EkO/IrtQ X-Received: by 2002:a17:906:af53:: with SMTP id ly19mr1448085ejb.503.1601343613577; Mon, 28 Sep 2020 18:40:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601343613; cv=none; d=google.com; s=arc-20160816; b=mxPqigwN06uY8zcbY3NE/DSdaYhKVzl9xk/sYlLNu7v4A7d0h+kvh21RDFfuANvqJg 84MdXIyDYSQsx8gw8lQYePekC6MA3ijSSKtZCGpMfmByd2XQz2LZuptVDHtbJDFhs4XM 3y7WA5i/+9TWVzTCrEV1yiQKlbZg+gSBYMhJaKzoFXKt8bOR0ellKONz68p7qYFVs3Aj mdVl9STmbzQcpTuBdapoydzDo1c6VJAs/JiuQ4ezVn41oQs0wbkL1kdbxugLuvR/0pqG 960j3BBEBNdhAKHWH1rQeR1BLQ6wbtoGvc712/GQPHl0GBz8ToO5QbWzQsKBZfkDFTEv ejRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=vcHXQDLyyh3Wlf5un/p7GGvxE5Jbhnjnab5HQ3ZO+5E=; b=OjvYzOc5o69DcaMrQY6bTb3b05nulNmOdXDuEfPC6FelXw3geN5RLm7xc/Di9J/Nfi D7PwHb3RQwVBDBuOUeJ9QIzWUYqh9t+H4D79Q40VgUv/3dXDcGYvWGfXkO2NdKLEOUE9 vDxJn+mCoJrC0XWulA4fbBWrDN2JPlY36mMqOA3wat4ysgBKE2w9I7QCoUuLgif4CsDl zF6webTpd4DDjnSEBi0tNK/uUeelSi6If1UCfyLUpZ8Nx0xqYFd7WTcy3KDVj5tdkcC1 TlORPcgvG1FLBG8DpTGxoP/Y6xtEzSDyNpCdd/Tg68ISavb8p6TtCwoXS5TUWHTbNU3w k2OA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SmA8rw+o; 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 v1si1751330ejw.413.2020.09.28.18.39.42; Mon, 28 Sep 2020 18:40:13 -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=@kernel.org header.s=default header.b=SmA8rw+o; 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 S1728014AbgI2BhF (ORCPT + 99 others); Mon, 28 Sep 2020 21:37:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:39428 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727305AbgI2Baf (ORCPT ); Mon, 28 Sep 2020 21:30:35 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id F1829216C4; Tue, 29 Sep 2020 01:30:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601343034; bh=4cOnDL084QNcZBUqFADt3BSsfxvJdhmNTQZseo5pD9s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SmA8rw+ozIKSxJdx6MgdG2stupf/CFtAYSVZLzDs0tfwKZuJvoz8l3Miim1pw63ut KFu0QuVwTImRpaXzyqsIxmBr6l2UHl1T7lajEj5uI0Nryma7LCuXqrrXQ5PFhmC3VU KiEoagzyvqE8+adj91Xm3Q8fszvIKPcgv448Ru4M= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Xie He , Krzysztof Halasa , Martin Schiller , Jakub Kicinski , Sasha Levin , netdev@vger.kernel.org Subject: [PATCH AUTOSEL 5.8 05/29] drivers/net/wan/hdlc_fr: Add needed_headroom for PVC devices Date: Mon, 28 Sep 2020 21:30:02 -0400 Message-Id: <20200929013027.2406344-5-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200929013027.2406344-1-sashal@kernel.org> References: <20200929013027.2406344-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xie He [ Upstream commit 44a049c42681de71c783d75cd6e56b4e339488b0 ] 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 Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- 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 9acad651ea1f6..12b35404cd8e7 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