From: Antonio Quartulli <ordex@autistici.org>
To: The list for a Better Approach To Mobile Ad-hoc Networking
<b.a.t.m.a.n@lists.open-mesh.org>
Subject: Re: [B.A.T.M.A.N.] [PATCHv2 6/7] batman-adv: add per VLAN interface attribute framework
Date: Fri, 24 May 2013 09:03:46 +0200 [thread overview]
Message-ID: <20130524070345.GI1679@ritirata.org> (raw)
In-Reply-To: <201305241423.42027.lindner_marek@yahoo.de>
[-- Attachment #1: Type: text/plain, Size: 4988 bytes --]
On Fri, May 24, 2013 at 02:23:41PM +0800, Marek Lindner wrote:
> On Friday, May 24, 2013 04:15:21 Antonio Quartulli wrote:
> > From: Antonio Quartulli <antonio@open-mesh.com>
> >
> > Since batman-adv is now fully VLAN-aware, a proper framework
> > able to handle per-vlan-interface attributes is now needed.
>
> We have "now" twice in the same sentence. :)
>
>
> > diff --git a/compat.c b/compat.c
> > index da556a4..b99d505 100644
> > --- a/compat.c
> > +++ b/compat.c
> > @@ -27,6 +27,15 @@
> >
> > #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0)
> >
> > +void batadv_free_rcu_priv_vlan(struct rcu_head *rcu)
> > +{
> > + struct batadv_priv_vlan *vlan;
> > +
> > + vlan = container_of(rcu, struct batadv_priv_vlan, rcu);
> > +
> > + kfree(vlan);
> > +}
>
> I bet you didn't try to compile that on an older kernel ...
ah, no I did not. :)
I'll add the prototype to compat.h
>
>
> > +/**
> > + * batadv_get_priv_vlan - get VLAN priv data
>
> The naming could be better. Following your initial scheme this function should
> be called "batadv_priv_vlan_get". How about replacing "priv" with "softif" ?
> We'd end up with:
> * batadv_softif_vlan_free_ref()
> * batadv_softif_vlan_get()
>
ok, will use 'softif'
>
> > +/**
> > + * batadv_add_vid - ndo_add_vid API implementation
>
> Again, the naming .. didn't we introduce a naming convention for each file ?
> soft-interface.c uses "interface" a lot. Why not using it ? For example,
> batadv_interface_vid_add() ?
>
ok, I will add 'interface'.
>
> > + * @dev: the netdev of the mesh interface
> > + * @vid: identifier of the new VLAN
> > + *
> > + * Set up all the internal structures for handling the new VLAN on top of
> the
> > + * mesh interface
> > + */
>
> Returns ?
ops :)
>
>
> > +/**
> > + * batadv_kill_vid - ndo_kill_vid API implementation
>
> Same here. It should be batadv_interface_vid_kill() or something similar.
>
ok
>
> > + * @dev: the netdev of the mesh interface
> > + * @vid: identifier of the deleted VLAN
> > + *
> > + * Destroy all the internal structures used to handle the VLAN identified
> > by vid + * on top of the mesh interface
> > + */
>
> Returns ?
ops :)
>
>
> > +static int batadv_kill_vid(struct net_device *dev, unsigned short vid)
> > +{
> > + struct batadv_priv *bat_priv = netdev_priv(dev);
> > + struct batadv_priv_vlan *vlan, *vlan_tmp = NULL;
> > +
> > + list_for_each_entry_rcu(vlan, &bat_priv->priv_vlan_list, list) {
> > + if (vlan->vid != vid)
> > + continue;
> > + vlan_tmp = vlan;
> > + break;
> > + }
>
> How about re-using your get() function from above ?
I'll check, I remember there was a reason to do not use gat().
>
>
> > +/*
> > + * struct batadv_priv_vlan - per VLAN attributes set
> > + * @vid: VLAN identifier
> > + * @kobj: kobject for sysfs vlan subdirectory
> > + * @list: list node for bat_priv::priv_vlan_list
> > + * @refcount: number of context where this object is currently in use
> > + * @rcu: struct used for freeing in a RCU-safe manner
> > + */
> > +struct batadv_priv_vlan {
> > + unsigned short vid;
> > + struct kobject *kobj;
> > + struct list_head list;
> > + atomic_t refcount;
> > + struct rcu_head rcu;
> > +};
>
> I am not so happy about the choice regarding the name again. The "batadv_priv"
> prefix has been introduced for bat_priv sub structs. Clearly, this isn't one
> but an element for a list.
ok, I'll change it to softif as stated above.
>
>
> > /**
> > * struct batadv_priv - per mesh interface data
> > * @mesh_state: current status of the mesh (inactive/active/deactivating)
> > @@ -573,6 +589,9 @@ struct batadv_priv_nc {
> > * @primary_if: one of the hard interfaces assigned to this mesh interface
> > * becomes the primary interface
> > * @bat_algo_ops: routing algorithm used by this mesh interface
> > + * @priv_vlan_list: a list of priv_vlan structs, one per VLAN created on
> > top of + * the mesh interface represented by this object
> > + * @priv_vlan_list_lock: lock protecting priv_vlan_list
> > * @bla: bridge loope avoidance data
> > * @debug_log: holding debug logging relevant data
> > * @gw: gateway data
> > @@ -620,6 +639,8 @@ struct batadv_priv {
> > struct work_struct cleanup_work;
> > struct batadv_hard_iface __rcu *primary_if; /* rcu protected pointer */
> > struct batadv_algo_ops *bat_algo_ops;
> > + struct list_head priv_vlan_list;
> > + spinlock_t priv_vlan_list_lock; /* protects priv_vlan_list */
> > #ifdef CONFIG_BATMAN_ADV_BLA
> > struct batadv_priv_bla bla;
> > #endif
>
> This leads to weird code like: bat_priv->priv_vlan_list_lock (priv twice) ..
yeah, softif everywhere! :D
Thanks a lot!
I'll send v3 and I'll include the BLA integration too.
Cheers,
--
Antonio Quartulli
..each of us alone is worth nothing..
Ernesto "Che" Guevara
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2013-05-24 7:03 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-23 20:15 [B.A.T.M.A.N.] [PATCHv2 0/7] make the Translation Table component VLAN-aware Antonio Quartulli
2013-05-23 20:15 ` [B.A.T.M.A.N.] [PATCHv2 1/7] batman-adv: add the VLAN ID attribute to the TT entry Antonio Quartulli
2013-05-23 20:15 ` [B.A.T.M.A.N.] [PATCHv2 2/7] batman-adv: use vid when computing local and global TT CRC Antonio Quartulli
2013-05-23 20:15 ` [B.A.T.M.A.N.] [PATCHv2 3/7] batman-adv: print the VID together with the TT entries Antonio Quartulli
2013-05-23 20:15 ` [B.A.T.M.A.N.] [PATCHv2 4/7] batman-adv: make the GW module correctly talk to the new VLAN-TT Antonio Quartulli
2013-05-23 20:15 ` [B.A.T.M.A.N.] [PATCHv2 5/7] batman-adv: make the Distributed ARP Table vlan aware Antonio Quartulli
2013-05-23 20:15 ` [B.A.T.M.A.N.] [PATCHv2 6/7] batman-adv: add per VLAN interface attribute framework Antonio Quartulli
2013-05-24 6:23 ` Marek Lindner
2013-05-24 7:03 ` Antonio Quartulli [this message]
2013-05-23 20:15 ` [B.A.T.M.A.N.] [PATCHv2 7/7] batman-adv: make the AP isolation attribute VLAN specific Antonio Quartulli
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=20130524070345.GI1679@ritirata.org \
--to=ordex@autistici.org \
--cc=b.a.t.m.a.n@lists.open-mesh.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