From: Heiner Kallweit <hkallweit1@gmail.com>
To: Jakub Kicinski <kuba@kernel.org>, David Miller <davem@davemloft.net>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: [PATCH RFC] net: add helper eth_set_protocol
Date: Tue, 6 Oct 2020 22:10:00 +0200 [thread overview]
Message-ID: <027ab4c5-57e8-10b8-816a-17c783f82323@gmail.com> (raw)
In all cases I've seen eth_type_trans() is used as in the new helper.
Biggest benefit is improved readability when replacing statements like
the following:
desc->skb->protocol = eth_type_trans(desc->skb, priv->dev);
Coccinelle tells me that using the new helper tree-wide would touch
313 files. Therefore I'd like to check for feedback before bothering
100+ maintainers.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
include/linux/etherdevice.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index 2e5debc03..c7f89b1bf 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -64,6 +64,11 @@ static const u8 eth_reserved_addr_base[ETH_ALEN] __aligned(2) =
{ 0x01, 0x80, 0xc2, 0x00, 0x00, 0x00 };
#define eth_stp_addr eth_reserved_addr_base
+static inline void eth_set_protocol(struct sk_buff *skb, struct net_device *dev)
+{
+ skb->protocol = eth_type_trans(skb, dev);
+}
+
/**
* is_link_local_ether_addr - Determine if given Ethernet address is link-local
* @addr: Pointer to a six-byte array containing the Ethernet address
--
2.28.0
next reply other threads:[~2020-10-06 20:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-06 20:10 Heiner Kallweit [this message]
2020-10-11 22:13 ` [PATCH RFC] net: add helper eth_set_protocol Jakub Kicinski
2020-10-11 22:24 ` Heiner Kallweit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=027ab4c5-57e8-10b8-816a-17c783f82323@gmail.com \
--to=hkallweit1@gmail.com \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).