diff mbox

[RFC,net-next,3/6] net: Introduce IFF_LWT_NETDEV flag

Message ID 20170506160734.47084-4-dsahern@gmail.com
State RFC, archived
Delegated to: David Miller
Headers show

Commit Message

David Ahern May 6, 2017, 4:07 p.m. UTC
Add new flag to denote lightweight netdevices. Add helper to identify
such devices.

Signed-off-by: David Ahern <dsahern@gmail.com>
---
 include/linux/netdevice.h | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Johannes Berg May 8, 2017, 8:55 a.m. UTC | #1
> +static inline bool netif_is_lwd(struct net_device *dev)
> +{
> +	return !!(dev->priv_flags & IFF_LWT_NETDEV);
> +}

Am I the only one who thinks that this "LWT_NETDEV" vs "LWD" is a bit
confusing?

Is "netif_is_lwt_netdev()" really too long?

johannes
David Miller May 8, 2017, 8:11 p.m. UTC | #2
From: Johannes Berg <johannes@sipsolutions.net>
Date: Mon, 08 May 2017 10:55:12 +0200

> 
>> +static inline bool netif_is_lwd(struct net_device *dev)
>> +{
>> +	return !!(dev->priv_flags & IFF_LWT_NETDEV);
>> +}
> 
> Am I the only one who thinks that this "LWT_NETDEV" vs "LWD" is a bit
> confusing?

Agreed, my old eyes can't discern them at a distance :-)
Roopa Prabhu May 8, 2017, 9:37 p.m. UTC | #3
On Mon, May 8, 2017 at 1:11 PM, David Miller <davem@davemloft.net> wrote:
> From: Johannes Berg <johannes@sipsolutions.net>
> Date: Mon, 08 May 2017 10:55:12 +0200
>
>>
>>> +static inline bool netif_is_lwd(struct net_device *dev)
>>> +{
>>> +    return !!(dev->priv_flags & IFF_LWT_NETDEV);
>>> +}
>>
>> Am I the only one who thinks that this "LWT_NETDEV" vs "LWD" is a bit
>> confusing?
>
> Agreed, my old eyes can't discern them at a distance :-)


agree.

mix of LWT_NETDEV and LWD can get confusing.

LWT already stands for Light Weight Tunnel...,
this can only be LWD or  LWN ;)....if people don't confuse it with
some weekly news device :)
David Ahern May 9, 2017, 12:57 a.m. UTC | #4
On 5/8/17 1:11 PM, David Miller wrote:
> From: Johannes Berg <johannes@sipsolutions.net>
> Date: Mon, 08 May 2017 10:55:12 +0200
> 
>>
>>> +static inline bool netif_is_lwd(struct net_device *dev)
>>> +{
>>> +	return !!(dev->priv_flags & IFF_LWT_NETDEV);
>>> +}
>>
>> Am I the only one who thinks that this "LWT_NETDEV" vs "LWD" is a bit
>> confusing?
> 
> Agreed, my old eyes can't discern them at a distance :-)
> 

perhaps it is the tiny font your old eyes are having trouble with :-)

I am fine with Johannes' suggestion -- just spell it out:
    netif_is_lwt_netdev

where lwt = LightWeighT
Roopa Prabhu May 9, 2017, 5:04 a.m. UTC | #5
On Mon, May 8, 2017 at 5:57 PM, David Ahern <dsahern@gmail.com> wrote:
> On 5/8/17 1:11 PM, David Miller wrote:
>> From: Johannes Berg <johannes@sipsolutions.net>
>> Date: Mon, 08 May 2017 10:55:12 +0200
>>
>>>
>>>> +static inline bool netif_is_lwd(struct net_device *dev)
>>>> +{
>>>> +   return !!(dev->priv_flags & IFF_LWT_NETDEV);
>>>> +}
>>>
>>> Am I the only one who thinks that this "LWT_NETDEV" vs "LWD" is a bit
>>> confusing?
>>
>> Agreed, my old eyes can't discern them at a distance :-)
>>
>
> perhaps it is the tiny font your old eyes are having trouble with :-)
>
> I am fine with Johannes' suggestion -- just spell it out:
>     netif_is_lwt_netdev
>
> where lwt = LightWeighT

makes sense...but this does sound like a 'light weight tunnel
netdevice' though.....just cause 'LWT' already expands to 'light
weight tunnel'
diff mbox

Patch

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index f47c8712398a..08151fd34973 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1401,6 +1401,7 @@  enum netdev_priv_flags {
 	IFF_RXFH_CONFIGURED		= 1<<25,
 	IFF_PHONY_HEADROOM		= 1<<26,
 	IFF_MACSEC			= 1<<27,
+	IFF_LWT_NETDEV			= 1<<28,
 };
 
 #define IFF_802_1Q_VLAN			IFF_802_1Q_VLAN
@@ -1430,6 +1431,7 @@  enum netdev_priv_flags {
 #define IFF_TEAM			IFF_TEAM
 #define IFF_RXFH_CONFIGURED		IFF_RXFH_CONFIGURED
 #define IFF_MACSEC			IFF_MACSEC
+#define IFF_LWT_NETDEV			IFF_LWT_NETDEV
 
 /**
  *	struct net_device - The DEVICE structure.
@@ -4137,6 +4139,11 @@  static inline void skb_gso_error_unwind(struct sk_buff *skb, __be16 protocol,
 	skb->mac_len = mac_len;
 }
 
+static inline bool netif_is_lwd(struct net_device *dev)
+{
+	return !!(dev->priv_flags & IFF_LWT_NETDEV);
+}
+
 static inline bool netif_is_macsec(const struct net_device *dev)
 {
 	return dev->priv_flags & IFF_MACSEC;