From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0FA0AC43381 for ; Thu, 21 Feb 2019 12:40:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C95552086A for ; Thu, 21 Feb 2019 12:40:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=Mellanox.com header.i=@Mellanox.com header.b="gd38kBWV" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727870AbfBUMkM (ORCPT ); Thu, 21 Feb 2019 07:40:12 -0500 Received: from mail-eopbgr20078.outbound.protection.outlook.com ([40.107.2.78]:6395 "EHLO EUR02-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725858AbfBUMkK (ORCPT ); Thu, 21 Feb 2019 07:40:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=cuLz48uDWxXtKFO2u91Ns5gt5bqyEbAWN0cSW6b1yEo=; b=gd38kBWV2SpTWM3sSodWjFZJl6vSefXO2fqTX/Y7R+S1T5V2WT+DP7uOiayiYHegJYanzGx/MmLtNj7Tw3oCZxYyxG5hAPMP0z049IyBrj+h9njoi6ogqHIVqcrDQ+OJFfDA20SuIURo+u2n/fSRKX/i8dAMGWOGjXjkSVwUQIY= Received: from AM6PR05MB5879.eurprd05.prod.outlook.com (20.179.0.76) by AM6PR05MB5816.eurprd05.prod.outlook.com (20.178.94.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1622.16; Thu, 21 Feb 2019 12:40:02 +0000 Received: from AM6PR05MB5879.eurprd05.prod.outlook.com ([fe80::98c7:b5be:ac6b:144]) by AM6PR05MB5879.eurprd05.prod.outlook.com ([fe80::98c7:b5be:ac6b:144%5]) with mapi id 15.20.1643.014; Thu, 21 Feb 2019 12:40:02 +0000 From: Maxim Mikityanskiy To: "David S. Miller" , Saeed Mahameed , Willem de Bruijn , Jason Wang , Eric Dumazet CC: "netdev@vger.kernel.org" , Eran Ben Elisha , Tariq Toukan , Maxim Mikityanskiy Subject: [PATCH net-next v2 5/7] net/packet: Remove redundant skb->protocol set Thread-Topic: [PATCH net-next v2 5/7] net/packet: Remove redundant skb->protocol set Thread-Index: AQHUyeKQIpGnAW8z6UmUTLxNMQT4mQ== Date: Thu, 21 Feb 2019 12:40:02 +0000 Message-ID: <20190221123908.7196-6-maximmi@mellanox.com> References: <20190221123908.7196-1-maximmi@mellanox.com> In-Reply-To: <20190221123908.7196-1-maximmi@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: LNXP265CA0070.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:5d::34) To AM6PR05MB5879.eurprd05.prod.outlook.com (2603:10a6:20b:a2::12) authentication-results: spf=none (sender IP is ) smtp.mailfrom=maximmi@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.19.1 x-originating-ip: [141.226.120.58] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: f519129a-d2ee-4223-cd34-08d697f9b2cd x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605104)(4618075)(2017052603328)(7153060)(7193020);SRVR:AM6PR05MB5816; x-ms-traffictypediagnostic: AM6PR05MB5816: x-microsoft-exchange-diagnostics: =?iso-8859-1?Q?1;AM6PR05MB5816;23:qrgtXOBVd4lxSiwhHtm1WwQpVmpjkEhbMiDqm7S?= =?iso-8859-1?Q?wwCfPeC7H5F9tDMRaZtSDgm4LeFbdOisGARZ2oxJRULnOa4Fa0gLLdDtuv?= =?iso-8859-1?Q?MCzQTx5dm09WIFY1uHDTygP0d+rq43qtFoA2IpB13VA1pZaAFuPE9AIHJx?= =?iso-8859-1?Q?UObSnUmAMw5P+PDEsLNHH+X+LiqJQavcq2jkF1B7DzTQo8j2cnccJjKa3i?= =?iso-8859-1?Q?MtVEAJR7v4tdmXV7rF1oU0pu67/4yp620s8lrhE8pvwsczKHkFJxr5Meu8?= =?iso-8859-1?Q?GLr4Zte8ZRCe9+SLlecwzQcrfp+5UH8aQVWdkPKJxaYX+hW1+qV4NVmYBJ?= =?iso-8859-1?Q?X5T/jy35safFRLgMqbtBPvoFpAUEiGKRdQIN/bhfXDtxrgKaCtNhyzvEo4?= =?iso-8859-1?Q?mGVTTESB6VyjgUwy7ErKMPJLZ2dTZnVX8cB5P3+9WS1aMztet+6T+Hg78h?= =?iso-8859-1?Q?5Aq+n13TfdYUoLvJI6ydKqPFTdTShSS4y6BlxikfAKdgTdXJPwkgqaBhbK?= =?iso-8859-1?Q?qnT85oOcH8zn+HZObA09WFixwTzfiKYohTPKbGSfDUhNh9UiZ8nthYutCY?= =?iso-8859-1?Q?9emnBLcGWABF7gVufjVQEGQc1m2yLwAtAbu5rrN7kEbvO9RKvL0ZAXuivl?= =?iso-8859-1?Q?89R9oEgRxblY01qeVP3IrzRw3VxohX7f30PA0vCgmtlhwFbZDtU2BwNVyO?= =?iso-8859-1?Q?NGTdCHH5R97grHcdkdU5rmRfcBxXKqCYt7gi+BNhXdt/o0qc2DNe2HrXki?= =?iso-8859-1?Q?q6P/BACYVeLkLfclgwf64bbjK5MZVTIyZvRIRxsIxZBsrgBzR/8tHtic0r?= =?iso-8859-1?Q?X8jipqLreohoFj1S0gQi4OCqBrTpwSy+Yw3npWsXVdmV8XWBZ7K6CnlxIl?= =?iso-8859-1?Q?XTUZYGM7tXJ3M4ID+5dMY5/WfcEW1ZMSHYjDlv/KWrvCD9m8ZOdqJy9oGD?= =?iso-8859-1?Q?kY60pbVCVB7hPy/PbIyXJddFQ1bIPES9NWVAjeQB2XiD4no2zTVa+I9lYy?= =?iso-8859-1?Q?LVzlzDExhQG7hqC1DG486u+j+MqNxC/Xe6IiSjeA+Ir0XzLv3ilhTWa9tf?= =?iso-8859-1?Q?ktl8nmTONmDCQXuz5k3cESfS7Ji65AwLMkirbMV1iqNbfCYL1uOifgYFuf?= =?iso-8859-1?Q?+xdJPE8lvc7qfw2noNAWn526ZixDpzSGURPTaDL3PYc65DDwjEVVFPZp91?= =?iso-8859-1?Q?0XjCKYGzi72SkoQdk43niIYwhj6EqwglVi+NfMXzLsdgJL9DDycWR3ASr0?= =?iso-8859-1?Q?tOpjugORYywiDTrJ8SSnbqYOBSStxih3HeMg/+2r4KzpShnyuNmoHlG/NT?= =?iso-8859-1?Q?tQ=3D?= x-microsoft-antispam-prvs: x-forefront-prvs: 09555FB1AD x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(136003)(39860400002)(366004)(376002)(396003)(346002)(189003)(199004)(6512007)(316002)(1076003)(54906003)(305945005)(25786009)(478600001)(7736002)(66066001)(81166006)(99286004)(53936002)(110136005)(68736007)(8676002)(8936002)(76176011)(71200400001)(71190400001)(6436002)(52116002)(5660300002)(81156014)(50226002)(6486002)(4326008)(256004)(107886003)(86362001)(102836004)(26005)(476003)(186003)(11346002)(14444005)(2906002)(3846002)(6116002)(105586002)(386003)(36756003)(6506007)(446003)(97736004)(14454004)(486006)(2616005)(106356001);DIR:OUT;SFP:1101;SCL:1;SRVR:AM6PR05MB5816;H:AM6PR05MB5879.eurprd05.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: Rgo3tj+4k58XrAn9UTE6F7mr5JrdbZmxL0K6SOtuIG2qdquF05FTwNS4UmC0mjY4X0cqWArz6d1SLq5/2bmqCOuJjxHbx26zHdDLSW3vo3Hgi5FS/ameN0UawKT39CYK+wLe/KKppMOhLp9HuVDs0bP1tZ4Nv3DViPoEwR115PeSXis0jIC5PKPsjIpP/cBRvYKG3Dl3eVphc08+soyJ6YCeU0Zko+DDku0HQacfabONErbDH95HLbczgLWMUPwAmIJdxkBj+FOWYTTOZmzjOVj7XvpXHRMCt4EDjQ8rf7PFJYpVTQ/uNa4HdfIFlgJzjpG7/mrE+2Ngqaex+lBD0VE6xRFI3wem3p4CC9dfGDqH7CKC+35i83mCKlFER+meGJlTLsapEqqqZ9/OuDNEZozO52WuiUi+cJcTL2RbJZ0= Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: f519129a-d2ee-4223-cd34-08d697f9b2cd X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Feb 2019 12:40:01.3240 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR05MB5816 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org c72219b75f introduced tpacket_set_protocol that parses the Ethernet L2 header and sets skb->protocol if it's unset. It is no longer needed since the introduction of packet_parse_headers. In case of SOCK_RAW and unset skb->protocol, packet_parse_headers asks the driver to tell the protocol number, and it's implemented for all Ethernet devices. As the old function supported only Ethernet, no functionality is lost. Signed-off-by: Maxim Mikityanskiy --- net/packet/af_packet.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index cac4c1a3f807..8376bc1c1508 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c @@ -2413,15 +2413,6 @@ static void tpacket_destruct_skb(struct sk_buff *skb= ) sock_wfree(skb); } =20 -static void tpacket_set_protocol(const struct net_device *dev, - struct sk_buff *skb) -{ - if (dev->type =3D=3D ARPHRD_ETHER) { - skb_reset_mac_header(skb); - skb->protocol =3D eth_hdr(skb)->h_proto; - } -} - static int __packet_snd_vnet_parse(struct virtio_net_hdr *vnet_hdr, size_t= len) { if ((vnet_hdr->flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) && @@ -2492,8 +2483,6 @@ static int tpacket_fill_skb(struct packet_sock *po, s= truct sk_buff *skb, return err; if (!dev_validate_header(dev, skb->data, hdrlen)) return -EINVAL; - if (!skb->protocol) - tpacket_set_protocol(dev, skb); =20 data +=3D hdrlen; to_write -=3D hdrlen; --=20 2.19.1