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 56C79C43381 for ; Thu, 21 Feb 2019 12:40:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1D0CF2086A for ; Thu, 21 Feb 2019 12:40:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=Mellanox.com header.i=@Mellanox.com header.b="thb5Ol3t" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727814AbfBUMkH (ORCPT ); Thu, 21 Feb 2019 07:40:07 -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 S1725858AbfBUMkH (ORCPT ); Thu, 21 Feb 2019 07:40:07 -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=i7TXp+D8xorDmvT737YlwXY12nayJihtF8BaLiNsfO8=; b=thb5Ol3tvH46siAsINTFzXCAaQgzHotaHyzsR+zCCaj/F2gvMzO5fCowpPqRG1EGMG4JgvBUGDUs+3XznaSYZNbS1k/QSX8erCIkS6Nc7l/psmKnx0ptm1Gruduur/KU/l7khGsI7kLVqBl7koVqep0XfFcZ6uAkeSpzSY7hPpM= 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:39:59 +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:39:59 +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 3/7] net/ethernet: Add parse_protocol header_ops support Thread-Topic: [PATCH net-next v2 3/7] net/ethernet: Add parse_protocol header_ops support Thread-Index: AQHUyeKOANLqZ/Y8tU+6en1eOI5Unw== Date: Thu, 21 Feb 2019 12:39:59 +0000 Message-ID: <20190221123908.7196-4-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: 55e961bf-88e7-4ed0-f448-08d697f9b12a 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:YRxeXuhvU+dJchOlaSmE+qtvQ9gTbTOAd5vMgc0?= =?iso-8859-1?Q?xP4B24xciAwseRWLrhNqp0Lvil0rS69j5jdLxNl3bhB/5bHQi/jp3XudIp?= =?iso-8859-1?Q?yJLLnlQasx6ZqwfG1VQOy+tsqRcLEG5OhH/PEmhi7J5F7TiEAqghI34J+w?= =?iso-8859-1?Q?SxLe6/fnX+szeASakjEafSv7PKyZG/Ryr2sbdC8Yb2Yv7ZsfXcVoB3Wxem?= =?iso-8859-1?Q?st4+Q6liUWlTUxdj2WKPBy7T1Lqf3khSnGoCS2Y0Se2W4i3LAN1hGM9X6t?= =?iso-8859-1?Q?0w7opuZvXzN0asnQKP+kXTVg+iQws7xsu2L9zsp2MGsRUXlcUfevSPjBFg?= =?iso-8859-1?Q?32HZHVSEDBNBct8oeqVRgaYv91Ey/X3CGpL+9uqsuACSNdETjWTrcVF8LQ?= =?iso-8859-1?Q?ziSPkPscLLiJfvQsfv+WZE0E41PmgEYEAj4/St6ZhQbW9d5d1fUJk0J+6d?= =?iso-8859-1?Q?4Oz5/tSOZsbmQt6IZi+jQQ6GbawOyre6FS+lUlCpL32hXPU9ojomMYaoti?= =?iso-8859-1?Q?4IiRotgIyWxHkzRLfpqf4ju29o3STsGfQzFCWdp1i8VtcjiQN0yMC9ay4R?= =?iso-8859-1?Q?dD0JI/c7b94pb6Rsd8I2epkJPmTGH9ClwbZBVkVn3M7JVZom8/bDvz+eSx?= =?iso-8859-1?Q?BXeSnsFVhMvtOm1EkXGKJkWRA+h5Qljgu5k6JWMQhijzFVEM1eKIKHpjJo?= =?iso-8859-1?Q?dGBcBN+YIcH4avzxgWas2w9+wh68rPYdy8PWSJwTYgDnx8Z15JyIq0n2QM?= =?iso-8859-1?Q?FaVtmy8YktjzWBkmRD6d6s+uHrCy32jLXDMLMyg5fss6TwbwyZfyENReAH?= =?iso-8859-1?Q?ARMQFDh/cpZft+QoNZnnrCOgYbCQipBDlVOszZC+VHK+C7D+h5TQCRzW+0?= =?iso-8859-1?Q?LRj7rgqhXZVtd828Zq6pseRnYlEUVlN2CBQFfx3DlDmXbRFZlEdqCVsAs5?= =?iso-8859-1?Q?OJl/6mg5rK+pm73qqpzc9X+rfdIw/YHFrcq7eTPw4A/whF0lBaWY6z3abv?= =?iso-8859-1?Q?lfRKdjpMX4Lk+K6Vmsvpwe7Ge41xMk/uqmfpmpY3EWTRN7h8Nh9Wqc3unB?= =?iso-8859-1?Q?ms/VNkRuvtV27jt/qhZjSglSBFz/38xjbWkd/knmeYEgYu/ng0mnEqwE7n?= =?iso-8859-1?Q?ovDU/CvdGR23aMLHlUgUzoLq2rI2WUhpIsUzrcPkY2kZzq2iN7gVQD2iKW?= =?iso-8859-1?Q?+F3io0aI622qrh0iE+7AnB2ZVTDyYf+DvSr8jE4USEQbxD3BamE79wwoC/?= =?iso-8859-1?Q?6xR8rK1JcNsvLG8G7LWWggCXL+r6zzd0jxfmXfHGBlOHq3Rs4jMsTm6Vev?= =?iso-8859-1?Q?Xc=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: CIrncRS5mddGR7DH3PcMlRmD/7I5GbcAsT2vXfiQdsuteYyoFU8dbThKzkcMxPN1OnKwj1O9ElJmA50W+lTBfmzWBXo39j4cjD34HnGPmipv7cCjESCIWjONErMMcWSuHs6aepqZ5kIpE7OnfJ9JHk1KCcdh3Ir4qLnW+UQdPlM8dPYrdUyt/K64w9V/Tz5ifKk9CfOivgKg7beNaUU8tz/HYG3XMu5cmeREtoc7288Jkw4/QPJ48kroCGVXMfIrzBRBkREnbo+cg4d1ZLD+WTjZHW1Lk9Tkn2+ZY3R9XSzvVNvquaGIisHU9EDcxyCHRGX6Lfb9HVYi5JONi7Qazw7NJiDrYR9sEulzpBWW5NI1bbcJieI/CL6lz51u4Wta8lF1Mn2ZB1H43Z0hGtRazcrr5tlJp7daEByznl85Vek= 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: 55e961bf-88e7-4ed0-f448-08d697f9b12a X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Feb 2019 12:39:58.5840 (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 The previous commit introduced parse_protocol callback which should extract the protocol number from the L2 header. Make all Ethernet devices support it. Signed-off-by: Maxim Mikityanskiy --- include/linux/etherdevice.h | 1 + net/ethernet/eth.c | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h index 2c0af7b00715..e2f3b21cd72a 100644 --- a/include/linux/etherdevice.h +++ b/include/linux/etherdevice.h @@ -44,6 +44,7 @@ int eth_header_cache(const struct neighbour *neigh, struc= t hh_cache *hh, __be16 type); void eth_header_cache_update(struct hh_cache *hh, const struct net_device = *dev, const unsigned char *haddr); +__be16 eth_header_parse_protocol(const struct sk_buff *skb); int eth_prepare_mac_addr_change(struct net_device *dev, void *p); void eth_commit_mac_addr_change(struct net_device *dev, void *p); int eth_mac_addr(struct net_device *dev, void *p); diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c index 4c520110b04f..f7a3d7a171c7 100644 --- a/net/ethernet/eth.c +++ b/net/ethernet/eth.c @@ -264,6 +264,18 @@ void eth_header_cache_update(struct hh_cache *hh, } EXPORT_SYMBOL(eth_header_cache_update); =20 +/** + * eth_header_parser_protocol - extract protocol from L2 header + * @skb: packet to extract protocol from + */ +__be16 eth_header_parse_protocol(const struct sk_buff *skb) +{ + const struct ethhdr *eth =3D eth_hdr(skb); + + return eth->h_proto; +} +EXPORT_SYMBOL(eth_header_parse_protocol); + /** * eth_prepare_mac_addr_change - prepare for mac change * @dev: network device @@ -346,6 +358,7 @@ const struct header_ops eth_header_ops ____cacheline_al= igned =3D { .parse =3D eth_header_parse, .cache =3D eth_header_cache, .cache_update =3D eth_header_cache_update, + .parse_protocol =3D eth_header_parse_protocol, }; =20 /** --=20 2.19.1