From: Samuel Mendoza-Jonas <sam@mendozajonas.com>
To: Joel Stanley <joel@jms.id.au>
Cc: OpenBMC Maillist <openbmc@lists.ozlabs.org>,
Ravindra S Rao1 <ravindra.s@in.ibm.com>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Ratan K Gupta <ratagupt@in.ibm.com>
Subject: Re: [RFC PATCH 3/3] net/ncsi: Configure VLAN tag filter
Date: Fri, 11 Aug 2017 08:42:49 +1000 [thread overview]
Message-ID: <1502404969.9340.3.camel@mendozajonas.com> (raw)
In-Reply-To: <CACPK8XeHv3JGaGExkmEiznsUeh5sFHkxyPw45OGeD_KUq2Mx7w@mail.gmail.com>
On Thu, 2017-08-10 at 17:19 +0930, Joel Stanley wrote:
> On Wed, Aug 9, 2017 at 6:24 PM, Samuel Mendoza-Jonas
> <sam@mendozajonas.com> wrote:
> > Make use of the ndo_vlan_rx_{add,kill}_vid callbacks to have the NCSI
> > stack process new VLAN tags and configure the channel VLAN filter
> > appropriately.
> > Several VLAN tags can be set and a "Set VLAN Filter" packet must be sent
> > for each one, meaning the ncsi_dev_state_config_svf state must be
> > repeated. An internal list of VLAN tags is maintained, and compared
> > against the current channel's ncsi_channel_filter in order to keep track
> > within the state. VLAN filters are removed in a similar manner, with the
> > introduction of the ncsi_dev_state_config_clear_vids state. The maximum
> > number of VLAN tag filters is determined by the "Get Capabilities"
> > response from the channel.
> >
> > Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
>
> Thanks Sam. I've made some comments below.
>
> > ---
> > drivers/net/ethernet/faraday/ftgmac100.c | 2 +
> > include/net/ncsi.h | 2 +
> > net/ncsi/internal.h | 11 ++
> > net/ncsi/ncsi-manage.c | 257 ++++++++++++++++++++++++++++++-
> > net/ncsi/ncsi-rsp.c | 13 +-
> > 5 files changed, 281 insertions(+), 4 deletions(-)
>
>
> > @@ -699,11 +706,93 @@ static void ncsi_configure_channel(struct ncsi_dev_priv *ndp)
> > nca.package = np->id;
> > nca.channel = nc->id;
> >
> > + /* Clear any active filters on the channel before setting */
> > + if (nd->state == ncsi_dev_state_config_clear_vids) {
>
> This is epic. Could it go in a function?
Yep, I'll clean up and split out what I can.
>
> > + clear = false;
> > + vlan_index = -1;
> > + spin_lock_irqsave(&nc->lock, flags);
> > + ncf = nc->filters[NCSI_FILTER_VLAN];
> > + while ((vlan_index = find_next_bit((void *)&ncf->bitmap, ncf->total, vlan_index + 1))
>
> We should make ->bitmap an unsigned long, then we can pass it to
> find_next_bit without casting. Other users of it do the same thing
> with a temporary variable.
Ack
>
> > + < ncf->total) {
> > + clear = true;
> > + // TODO retrieve the vid that was set
>
> Still WIP?
Definitely still 'rough' :)
>
> > + netdev_printk(KERN_DEBUG, dev, "ncsi: removed vlan tag at index %d\n",
>
> Do we get a ncsi prefix from the driver name?
No we get a prefix of the form
"ftgmac100 1e660000.ethernet eth0:"
so yes adding a NCSI prefix would be good.
>
> > + vlan_index);
> > + ncsi_remove_filter(nc, NCSI_FILTER_VLAN, vlan_index);
> > + break;
> > + }
> > + spin_unlock_irqrestore(&nc->lock, flags);
> > +
> > +int ncsi_vlan_rx_add_vid(struct net_device *dev, __be16 proto, u16 vid)
> > +{
> > + struct ncsi_channel_filter *ncf;
> > + struct ncsi_dev_priv *ndp;
> > + unsigned int n_vids = 0;
> > + struct vlan_vid *vlan;
> > + struct ncsi_dev *nd;
> > + bool found = false;
> > +
> > + if (n_vids >= ncf->total) {
> > + netdev_info(dev, "NCSI Channel supports up to %u VLAN tags but %u are already set\n",
> > + ncf->total, n_vids);
> > + return -EINVAL;
> > + }
> > +
> > + vlan = kzalloc(sizeof(struct vlan_vid), GFP_KERNEL);
>
> Does this get freed anywhere?
Whoops!
>
> > + if (!vlan) {
> > + netdev_err(dev, "could not alloc vlan_vid struct\n");
> > + return -ENOMEM;
> > + }
> >
next prev parent reply other threads:[~2017-08-10 22:42 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-09 8:54 [RFC PATCH 0/3] NCSI VLAN Filtering Support Samuel Mendoza-Jonas
2017-08-09 8:54 ` [RFC PATCH 1/3] ftgmac: Include NETIF_F_HW_VLAN_CTAG_FILTER in features Samuel Mendoza-Jonas
2017-08-10 7:49 ` Joel Stanley
2017-08-10 11:30 ` Benjamin Herrenschmidt
2017-08-11 0:05 ` Joel Stanley
2017-08-09 8:54 ` [RFC PATCH 2/3] net/ncsi: Fix several packet definitions Samuel Mendoza-Jonas
2017-08-10 7:03 ` Joel Stanley
2017-08-10 11:28 ` Benjamin Herrenschmidt
2017-08-10 22:39 ` Samuel Mendoza-Jonas
2017-08-11 0:11 ` Joel Stanley
2017-08-09 8:54 ` [RFC PATCH 3/3] net/ncsi: Configure VLAN tag filter Samuel Mendoza-Jonas
2017-08-10 7:49 ` Joel Stanley
2017-08-10 22:42 ` Samuel Mendoza-Jonas [this message]
2017-08-10 8:25 ` Joel Stanley
2017-08-10 22:45 ` Samuel Mendoza-Jonas
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=1502404969.9340.3.camel@mendozajonas.com \
--to=sam@mendozajonas.com \
--cc=benh@kernel.crashing.org \
--cc=joel@jms.id.au \
--cc=openbmc@lists.ozlabs.org \
--cc=ratagupt@in.ibm.com \
--cc=ravindra.s@in.ibm.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 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.