netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Cc: netdev@vger.kernel.org, Jiri Pirko <jiri@resnulli.us>,
	Scott Feldman <sfeldma@gmail.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	kernel@savoirfairelinux.com
Subject: Re: [RFC PATCH net-next 1/3] net: switchdev: extract switchdev_obj_vlan
Date: Tue, 8 Sep 2015 22:58:41 +0200	[thread overview]
Message-ID: <20150908205841.GF29184@lunn.ch> (raw)
In-Reply-To: <1441745275-13200-2-git-send-email-vivien.didelot@savoirfairelinux.com>

> +/* SWITCHDEV_OBJ_PORT_VLAN */
> +struct switchdev_obj_vlan {
> +	struct switchdev_obj obj;	/* must be first */
> +	u16 flags;
> +	u16 vid_begin;
> +	u16 vid_end;
> +};

I know you give a few examples for where this is done in network code,
but i think container_of() is used much more. You can then place the
struct switchdev_obj anywhere in the structure, and it will work.

#define to_switchdev_obj_vlan(o) container_of(o, struct switchdev_obj_vlan, obj)

	Andrew

  reply	other threads:[~2015-09-08 21:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-08 20:47 [RFC PATCH net-next 0/3] net: switchdev: extract specific object structures Vivien Didelot
2015-09-08 20:47 ` [RFC PATCH net-next 1/3] net: switchdev: extract switchdev_obj_vlan Vivien Didelot
2015-09-08 20:58   ` Andrew Lunn [this message]
2015-09-09 16:12   ` Scott Feldman
2015-09-08 20:47 ` [RFC PATCH net-next 2/3] net: switchdev: extract switchdev_obj_ipv4_fib Vivien Didelot
2015-09-08 20:47 ` [RFC PATCH net-next 3/3] net: switchdev: extract switchdev_obj_fdb Vivien Didelot
2015-09-09  6:45 ` [RFC PATCH net-next 0/3] net: switchdev: extract specific object structures Jiri Pirko
2015-09-09 16:25 ` Scott Feldman

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=20150908205841.GF29184@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=f.fainelli@gmail.com \
    --cc=jiri@resnulli.us \
    --cc=kernel@savoirfairelinux.com \
    --cc=netdev@vger.kernel.org \
    --cc=sfeldma@gmail.com \
    --cc=vivien.didelot@savoirfairelinux.com \
    /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).