public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Joseph Gasparakis <joseph.gasparakis@intel•com>
To: Daniel Borkmann <dborkman@redhat•com>
Cc: Jeff Kirsher <jeffrey.t.kirsher@intel•com>,
	davem@davemloft•net,
	Joseph Gasparakis <joseph.gasparakis@intel•com>,
	netdev@vger•kernel.org, gospo@redhat•com, sassmann@redhat•com,
	John Fastabend <john.r.fastabend@intel•com>,
	Stephen Hemminger <stephen@networkplumber•org>
Subject: Re: [net-next v4] vxlan: Notify drivers for listening UDP port changes
Date: Fri, 6 Sep 2013 16:42:26 -0700 (PDT)	[thread overview]
Message-ID: <alpine.LFD.2.03.1309061629420.21291@intel.com> (raw)
In-Reply-To: <522A5FA9.7000001@redhat.com>



On Fri, 6 Sep 2013, Daniel Borkmann wrote:

> On 09/04/2013 11:13 AM, Jeff Kirsher wrote:
> > From: Joseph Gasparakis <joseph.gasparakis@intel•com>
> > 
> > This patch adds two more ndo ops: ndo_add_rx_vxlan_port() and
> > ndo_del_rx_vxlan_port().
> > 
> > Drivers can get notifications through the above functions about changes
> > of the UDP listening port of VXLAN. Also, when physical ports come up,
> > now they can call vxlan_get_rx_port() in order to obtain the port number(s)
> > of the existing VXLAN interface in case they already up before them.
> > 
> > This information about the listening UDP port would be used for VXLAN
> > related offloads.
> > 
> > A big thank you to John Fastabend (john.r.fastabend@intel•com) for his
> > input and his suggestions on this patch set.
> > 
> > CC: John Fastabend <john.r.fastabend@intel•com>
> > CC: Stephen Hemminger <stephen@networkplumber•org>
> > Signed-off-by: Joseph Gasparakis <joseph.gasparakis@intel•com>
> > Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel•com>
> > ---
> >   drivers/net/vxlan.c       | 68
> > ++++++++++++++++++++++++++++++++++++++++++++++-
> >   include/linux/netdevice.h | 19 +++++++++++++
> >   include/net/vxlan.h       |  1 +
> >   3 files changed, 87 insertions(+), 1 deletion(-)
> [...]
> > +/* Calls the ndo_add_vxlan_port of the caller in order to
> > + * supply the listening VXLAN udp ports.
> > + */
> > +void vxlan_get_rx_port(struct net_device *dev)
> > +{
> > +	struct vxlan_sock *vs;
> > +	struct net *net = dev_net(dev);
> > +	struct vxlan_net *vn = net_generic(net, vxlan_net_id);
> > +	sa_family_t sa_family;
> > +	u16 port;
> > +	int i;
> > +
> > +	if (!dev || !dev->netdev_ops || !dev->netdev_ops->ndo_add_vxlan_port)
> > +		return;
> 
> Here, either parts of this if statement are unnecessary, or in case they are
> necessary then vars 'net' and 'vn' should have been assigned after that I
> think
> as we would first get an offset and then dereference it before actually
> checking
> if dev is NULL.

That is correct, I started assuming dev will be a valid pointer, but then 
I thought I shouldn't trust the caller, so I ended up with this. In fact I 
have some upcoming sparse fixes too, so I will incorporate all this in one 
patch. For this particular comment I will be checking dev first and 
assigning net and vn after that.

> 
> > +	spin_lock(&vn->sock_lock);
> > +	for (i = 0; i < PORT_HASH_SIZE; ++i) {
> > +		hlist_for_each_entry_rcu(vs, vs_head(net, i), hlist) {
> > +			port = htons(inet_sk(vs->sock->sk)->inet_sport);
> > +			sa_family = vs->sock->sk->sk_family;
> > +			dev->netdev_ops->ndo_add_vxlan_port(dev, sa_family,
> > +							    port);
> > +		}
> > +	}
> > +	spin_unlock(&vn->sock_lock);
> > +}
> > +EXPORT_SYMBOL_GPL(vxlan_get_rx_port);
> 

  reply	other threads:[~2013-09-06 23:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-04  9:13 [net-next v4] vxlan: Notify drivers for listening UDP port changes Jeff Kirsher
2013-09-04  9:13 ` [net-next v4 RFC] ixgbe: Get and display the notifications from changes of the Rx vxlan UDP port Jeff Kirsher
2013-10-10 10:07   ` Or Gerlitz
2013-09-05 16:45 ` [net-next v4] vxlan: Notify drivers for listening UDP port changes David Miller
2013-09-06 23:05 ` Daniel Borkmann
2013-09-06 23:42   ` Joseph Gasparakis [this message]
2013-09-06 23:50     ` Stephen Hemminger
2013-09-07  0:09       ` Joseph Gasparakis

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=alpine.LFD.2.03.1309061629420.21291@intel.com \
    --to=joseph.gasparakis@intel$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=dborkman@redhat$(echo .)com \
    --cc=gospo@redhat$(echo .)com \
    --cc=jeffrey.t.kirsher@intel$(echo .)com \
    --cc=john.r.fastabend@intel$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=sassmann@redhat$(echo .)com \
    --cc=stephen@networkplumber$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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