This is a note to let you know that I've just added the patch titled net: Introduce parse_protocol header_ops callback to the 4.14-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: net-introduce-parse_protocol-header_ops-callback.patch and it can be found in the queue-4.14 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From e78b2915517e8fcadb1bc130ad6aeac7099e510c Mon Sep 17 00:00:00 2001 From: Maxim Mikityanskiy <maximmi@xxxxxxxxxxxx> Date: Thu, 21 Feb 2019 12:39:58 +0000 Subject: net: Introduce parse_protocol header_ops callback From: Maxim Mikityanskiy <maximmi@xxxxxxxxxxxx> commit e78b2915517e8fcadb1bc130ad6aeac7099e510c upstream. Introduce a new optional header_ops callback called parse_protocol and a wrapper function dev_parse_header_protocol, similar to dev_parse_header. The new callback's purpose is to extract the protocol number from the L2 header, the format of which is known to the driver, but not to the upper layers of the stack. Signed-off-by: Maxim Mikityanskiy <maximmi@xxxxxxxxxxxx> Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- include/linux/netdevice.h | 10 ++++++++++ 1 file changed, 10 insertions(+) --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -272,6 +272,7 @@ struct header_ops { const struct net_device *dev, const unsigned char *haddr); bool (*validate)(const char *ll_header, unsigned int len); + __be16 (*parse_protocol)(const struct sk_buff *skb); }; /* These flag bits are private to the generic network queueing @@ -2731,6 +2732,15 @@ static inline int dev_parse_header(const return dev->header_ops->parse(skb, haddr); } +static inline __be16 dev_parse_header_protocol(const struct sk_buff *skb) +{ + const struct net_device *dev = skb->dev; + + if (!dev->header_ops || !dev->header_ops->parse_protocol) + return 0; + return dev->header_ops->parse_protocol(skb); +} + /* ll_header must have at least hard_header_len allocated */ static inline bool dev_validate_header(const struct net_device *dev, char *ll_header, int len) Patches currently in stable-queue which might be from maximmi@xxxxxxxxxxxx are queue-4.14/net-introduce-parse_protocol-header_ops-callback.patch