All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vlad Yasevich <vyasevich@gmail.com>
To: Michal Kubecek <mkubecek@suse.cz>, netdev@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>,
	Patrick McHardy <kaber@trash.net>,
	John Fastabend <john.r.fastabend@intel.com>
Subject: Re: [PATCH net v2 1/2] macvlan: introduce macvlan_dev_real_dev() helper function
Date: Thu, 14 Nov 2013 10:03:19 -0500	[thread overview]
Message-ID: <5284E637.5060805@gmail.com> (raw)
In-Reply-To: <b4ca4f2204f0ffb0bd7f959192462944a8d846a4.1384436410.git.mkubecek@suse.cz>

On 11/14/2013 09:00 AM, Michal Kubecek wrote:
> Introduce helper function macvlan_dev_real_dev which returns the
> underlying device of a macvlan device, similar to vlan_dev_real_dev()
> for 802.1q VLAN devices.
>
> v2: IFF_MACVLAN flag and equivalent of is_macvlan_dev() were
> introduced in the meantime
>
> Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
> ---
>   include/linux/if_macvlan.h | 16 ++++++++++++++++
>   1 file changed, 16 insertions(+)
>
> diff --git a/include/linux/if_macvlan.h b/include/linux/if_macvlan.h
> index c270285..ac9aab2 100644
> --- a/include/linux/if_macvlan.h
> +++ b/include/linux/if_macvlan.h
> @@ -119,4 +119,20 @@ extern int macvlan_link_register(struct rtnl_link_ops *ops);
>   extern netdev_tx_t macvlan_start_xmit(struct sk_buff *skb,
>   				      struct net_device *dev);
>
> +#if IS_ENABLED(CONFIG_MACVLAN)
> +static inline struct net_device *
> +macvlan_dev_real_dev(const struct net_device *dev)
> +{
> +	struct macvlan_dev *macvlan = netdev_priv(dev);
> +
> +	return macvlan->lowerdev;
> +}
> +#else
> +static inline struct net_device *
> +macvlan_dev_real_dev(const struct net_device *dev)
> +{
> +	return NULL;
> +}
> +#endif
> +

You may want to do the same here as was done for vlan_dev_real_dev(). 
This function is not intended to be called blindly and should always
be called after netif_is_macvlan().

-vlad


>   #endif /* _LINUX_IF_MACVLAN_H */
>

  reply	other threads:[~2013-11-14 15:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-14 14:00 [PATCH net v2 0/2] macvlan: disable LRO on lowerdev instead of a macvlan Michal Kubecek
2013-11-14 14:00 ` [PATCH net v2 1/2] macvlan: introduce macvlan_dev_real_dev() helper function Michal Kubecek
2013-11-14 15:03   ` Vlad Yasevich [this message]
2013-11-14 15:57     ` Michal Kubecek
2013-11-14 22:03       ` David Miller
2013-11-15  5:26         ` Michal Kubecek
2013-11-15  2:43       ` Vlad Yasevich
2013-11-14 14:00 ` [PATCH net v2 2/2] macvlan: disable LRO on lower device instead of macvlan Michal Kubecek

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=5284E637.5060805@gmail.com \
    --to=vyasevich@gmail.com \
    --cc=davem@davemloft.net \
    --cc=john.r.fastabend@intel.com \
    --cc=kaber@trash.net \
    --cc=mkubecek@suse.cz \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.