From: "Michael S. Tsirkin" <mst@redhat.com>
To: "Samudrala, Sridhar" <sridhar.samudrala@intel.com>
Cc: Stephen Hemminger <stephen@networkplumber.org>,
davem@davemloft.net, netdev@vger.kernel.org,
virtualization@lists.linux-foundation.org,
virtio-dev@lists.oasis-open.org, jesse.brandeburg@intel.com,
alexander.h.duyck@intel.com, kubakici@wp.pl, jasowang@redhat.com,
loseweigh@gmail.com, jiri@resnulli.us, aaron.f.brown@intel.com
Subject: [virtio-dev] Re: [PATCH net-next v10 2/4] net: Introduce generic failover module
Date: Fri, 11 May 2018 20:15:58 +0300 [thread overview]
Message-ID: <20180511201450-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <e8454b29-d66b-9e20-a887-cb312a63847e@intel.com>
On Mon, May 07, 2018 at 05:24:27PM -0700, Samudrala, Sridhar wrote:
>
>
> On 5/7/2018 4:53 PM, Stephen Hemminger wrote:
> > On Mon, 7 May 2018 15:10:44 -0700
> > Sridhar Samudrala <sridhar.samudrala@intel.com> wrote:
> >
> > > +static struct net_device *net_failover_get_bymac(u8 *mac,
> > > + struct net_failover_ops **ops)
> > > +{
> > > + struct net_device *failover_dev;
> > > + struct net_failover *failover;
> > > +
> > > + spin_lock(&net_failover_lock);
> > > + list_for_each_entry(failover, &net_failover_list, list) {
> > > + failover_dev = rtnl_dereference(failover->failover_dev);
> > > + if (ether_addr_equal(failover_dev->perm_addr, mac)) {
> > > + *ops = rtnl_dereference(failover->ops);
> > > + spin_unlock(&net_failover_lock);
> > > + return failover_dev;
> > > + }
> > > + }
> > > + spin_unlock(&net_failover_lock);
> > > + return NULL;
> > > +}
> > This is broken if non-ethernet devices such as Infiniband are present.
>
> There is check to make sure that a slave and failover devices are of the same type in
> net_failover_slave_register()
>
> failover_dev = net_failover_get_bymac(slave_dev->perm_addr, &nfo_ops);
> if (!failover_dev)
> goto done;
>
> if (failover_dev->type != slave_dev->type)
> goto done;
>
> Do you think this is not good enough? I had an explicit check for ARPHRD_ETHER in
> earlier patchsets, but removed it based on Jiri's comment.
Right but how is ether_addr_equal supposed to work if types are
identical but not ethernet?
This can also benefit from a comment referring to the check in
net_failover_slave_register.
--
MST
---------------------------------------------------------------------
To unsubscribe, e-mail: virtio-dev-unsubscribe@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-help@lists.oasis-open.org
WARNING: multiple messages have this Message-ID (diff)
From: "Michael S. Tsirkin" <mst@redhat.com>
To: "Samudrala, Sridhar" <sridhar.samudrala@intel.com>
Cc: alexander.h.duyck@intel.com, virtio-dev@lists.oasis-open.org,
jiri@resnulli.us, kubakici@wp.pl, netdev@vger.kernel.org,
virtualization@lists.linux-foundation.org, loseweigh@gmail.com,
aaron.f.brown@intel.com, davem@davemloft.net
Subject: Re: [PATCH net-next v10 2/4] net: Introduce generic failover module
Date: Fri, 11 May 2018 20:15:58 +0300 [thread overview]
Message-ID: <20180511201450-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <e8454b29-d66b-9e20-a887-cb312a63847e@intel.com>
On Mon, May 07, 2018 at 05:24:27PM -0700, Samudrala, Sridhar wrote:
>
>
> On 5/7/2018 4:53 PM, Stephen Hemminger wrote:
> > On Mon, 7 May 2018 15:10:44 -0700
> > Sridhar Samudrala <sridhar.samudrala@intel.com> wrote:
> >
> > > +static struct net_device *net_failover_get_bymac(u8 *mac,
> > > + struct net_failover_ops **ops)
> > > +{
> > > + struct net_device *failover_dev;
> > > + struct net_failover *failover;
> > > +
> > > + spin_lock(&net_failover_lock);
> > > + list_for_each_entry(failover, &net_failover_list, list) {
> > > + failover_dev = rtnl_dereference(failover->failover_dev);
> > > + if (ether_addr_equal(failover_dev->perm_addr, mac)) {
> > > + *ops = rtnl_dereference(failover->ops);
> > > + spin_unlock(&net_failover_lock);
> > > + return failover_dev;
> > > + }
> > > + }
> > > + spin_unlock(&net_failover_lock);
> > > + return NULL;
> > > +}
> > This is broken if non-ethernet devices such as Infiniband are present.
>
> There is check to make sure that a slave and failover devices are of the same type in
> net_failover_slave_register()
>
> failover_dev = net_failover_get_bymac(slave_dev->perm_addr, &nfo_ops);
> if (!failover_dev)
> goto done;
>
> if (failover_dev->type != slave_dev->type)
> goto done;
>
> Do you think this is not good enough? I had an explicit check for ARPHRD_ETHER in
> earlier patchsets, but removed it based on Jiri's comment.
Right but how is ether_addr_equal supposed to work if types are
identical but not ethernet?
This can also benefit from a comment referring to the check in
net_failover_slave_register.
--
MST
next prev parent reply other threads:[~2018-05-11 17:16 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-07 22:10 [virtio-dev] [PATCH net-next v10 0/4] Enable virtio_net to act as a standby for a passthru device Sridhar Samudrala
2018-05-07 22:10 ` Sridhar Samudrala
2018-05-07 22:10 ` [PATCH net-next v10 1/4] virtio_net: Introduce VIRTIO_NET_F_STANDBY feature bit Sridhar Samudrala
2018-05-07 22:10 ` [virtio-dev] " Sridhar Samudrala
2018-05-07 22:10 ` Sridhar Samudrala
2018-05-07 22:10 ` [PATCH net-next v10 2/4] net: Introduce generic failover module Sridhar Samudrala
2018-05-07 22:10 ` [virtio-dev] " Sridhar Samudrala
2018-05-07 22:10 ` Sridhar Samudrala
2018-05-07 22:39 ` Randy Dunlap
2018-05-07 22:39 ` Randy Dunlap
2018-05-11 15:43 ` [virtio-dev] " Samudrala, Sridhar
2018-05-11 15:43 ` Samudrala, Sridhar
2018-05-11 18:09 ` [virtio-dev] " Michael S. Tsirkin
2018-05-11 18:09 ` Michael S. Tsirkin
2018-05-11 18:09 ` Michael S. Tsirkin
2018-05-07 23:46 ` Stephen Hemminger
2018-05-11 15:40 ` [virtio-dev] " Samudrala, Sridhar
2018-05-11 15:40 ` Samudrala, Sridhar
2018-05-11 15:40 ` Samudrala, Sridhar
2018-05-07 23:46 ` Stephen Hemminger
2018-05-07 23:53 ` Stephen Hemminger
2018-05-08 0:24 ` [virtio-dev] " Samudrala, Sridhar
2018-05-08 0:24 ` Samudrala, Sridhar
2018-05-11 17:15 ` Michael S. Tsirkin [this message]
2018-05-11 17:15 ` Michael S. Tsirkin
2018-05-08 0:24 ` Samudrala, Sridhar
2018-05-07 23:53 ` Stephen Hemminger
2018-05-07 23:59 ` Stephen Hemminger
2018-05-08 0:11 ` [virtio-dev] " Samudrala, Sridhar
2018-05-08 0:11 ` Samudrala, Sridhar
2018-05-08 0:11 ` Samudrala, Sridhar
2018-05-07 23:59 ` Stephen Hemminger
2018-05-08 9:02 ` kbuild test robot
2018-05-08 9:02 ` kbuild test robot
2018-05-07 22:10 ` [virtio-dev] [PATCH net-next v10 3/4] virtio_net: Extend virtio to use VF datapath when available Sridhar Samudrala
2018-05-07 22:10 ` Sridhar Samudrala
2018-05-07 22:10 ` Sridhar Samudrala
2018-05-07 22:10 ` [virtio-dev] [PATCH net-next v10 4/4] netvsc: refactor notifier/event handling code to use the failover framework Sridhar Samudrala
2018-05-07 22:10 ` Sridhar Samudrala
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=20180511201450-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=aaron.f.brown@intel.com \
--cc=alexander.h.duyck@intel.com \
--cc=davem@davemloft.net \
--cc=jasowang@redhat.com \
--cc=jesse.brandeburg@intel.com \
--cc=jiri@resnulli.us \
--cc=kubakici@wp.pl \
--cc=loseweigh@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=sridhar.samudrala@intel.com \
--cc=stephen@networkplumber.org \
--cc=virtio-dev@lists.oasis-open.org \
--cc=virtualization@lists.linux-foundation.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.