* Re: xen-netback notify DomU to send ARP.
@ 2013-01-09 15:07 Jason Luan
0 siblings, 0 replies; 5+ messages in thread
From: Jason Luan @ 2013-01-09 15:07 UTC (permalink / raw)
To: Ian Campbell; +Cc: netdev, xen-devel, JBeulich, konrad.wilk
[-- Attachment #1.1: Type: text/plain, Size: 2907 bytes --]
于 2013年01月09日 20:03, Ian Campbell 写道:
> On Wed, 2013-01-09 at 01:07 +0000, Jason Luan wrote:
>> 于 2013年01月09日 00:00, Ian Campbell 写道:
>>> On Tue, 2013-01-08 at 15:40 +0000, jianhai luan wrote:
>>>> On 2013-1-8 21:42, Ian Campbell wrote:
>>>>> On Tue, 2013-01-08 at 13:13 +0000, Jan Beulich wrote:
>>>>>>>>> On 08.01.13 at 12:57, jianhai luan <jianhai.luan@oracle.com>
>>>>>>>>> wrote:
>>>>>>> When Xen Dom0's network circumstance changed, DomU
>>>>>>> should be notified in some special condition. For
>>>>>>> example the below circumstance:
>>>>>>> ping from Guest A to DomU:
>>>>>>> Guest A --> eth0 - bond0 - xenbr0 --VIF(DOMU)
>>>>>>> eth1 /
>>>>>>> when eth0 inactive, and eth1 active.
>>>>> How is eth0 failing? Are you unplugging it, un-enslaving it or
>>>>> taking
>>>>> some other sort of administrative action?
>>>> In my emulation environment, i unplug it or ifdown the interface,
>>> I expect these would behave rather different, since the affect of
>>> ifdown
>>> looks rather different to an unplug from the PoV of the switch.
>>>
>>> Is the ifdown case something which you are trying to solve or just what
>>> appeared to be a convenient test case? I'd be less inclined to worry
>>> about explict admin actions such as that.
>>>
>>> Unplugging the cable should cause:
>>>
>> I do above listed thing to let switch active slave only.
>> I think that we should put attention on the thing which bond switch
>> active slave interface in active-backup mode. In network circumstance,
>> many thing will cause the switch, what do Vif when the event happen?
> Sorry, I'm having a bit of trouble parsing the above, but are you asking
> what the VIF should do when the active slave in the bond changes without
> the previously active slave actually failing?
sorry for your misunderstanding.
>
> The issue is that traffic will continue to arrive on the now inactive
> slave, but will be discarded (the expected behaviour for
> Active/Passive)?
Yes. the traffic will continue to arrive on the switcher's port which
connected the inactive
slave before, and the switcher's port don't connect (or don't reach) the
inactive slave now,
so the link will be disconnected before DomU send ARP. After DomU send
ARP, the traffic will
know how to reach the correct switcher's port which connected with the
active slave.
>
> Is this something which happens in practice? Does the active slave
> change even while it remains a viable path?
Yes, please think the below the scene.
PC -- switcher
port A -- eth0 --bond0 --xenbr0 -DomU
port B -- eth1/
or
PC -- switcher A -- eth0 -- bond0 -- xenbr0 -- DomU
\- switcher B -- eth1 /
If Port A or switcher A wrong, the traffic from PC to DomU will be
disconnected before found
correct path (port B or Switcher B ).
>
> Ian.
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
[-- Attachment #1.2: Type: text/html, Size: 6594 bytes --]
[-- Attachment #2: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* xen-netback notify DomU to send ARP.
@ 2013-01-08 11:57 jianhai luan
2013-01-08 13:13 ` [Xen-devel] " Jan Beulich
0 siblings, 1 reply; 5+ messages in thread
From: jianhai luan @ 2013-01-08 11:57 UTC (permalink / raw)
To: Ian Campbell; +Cc: xen-devel, netdev, Konrad Rzeszutek Wilk
[-- Attachment #1: Type: text/plain, Size: 747 bytes --]
Hi,
When Xen Dom0's network circumstance changed, DomU
should be notified in some special condition. For
example the below circumstance:
ping from Guest A to DomU:
Guest A --> eth0 - bond0 - xenbr0 --VIF(DOMU)
eth1 /
when eth0 inactive, and eth1 active.
Guest A --> eth0 bond0 - xenbr0 --VIF(DOMU)
eth1 /
Guest A will don't reach to DomU. After Guest A
send ARP request and DomU respond, Guest A will
reach DomU. But some more second will be elapsed.
eth0 bond0 - xenbr0 --VIF(DOMU)
Guest A --> eth1/
If Xen netback watch the network change, will notify
DomU by change it own status. So netfront will watch
netback's change, and DomU send ARP initiative.
Thanks,
Jason
[-- Attachment #2: .0001-xen-netback-notify-DomU-to-send-ARP.patch.swp --]
[-- Type: application/octet-stream, Size: 12288 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Xen-devel] xen-netback notify DomU to send ARP.
2013-01-08 11:57 jianhai luan
@ 2013-01-08 13:13 ` Jan Beulich
2013-01-08 13:42 ` Ian Campbell
0 siblings, 1 reply; 5+ messages in thread
From: Jan Beulich @ 2013-01-08 13:13 UTC (permalink / raw)
To: jianhai luan; +Cc: Ian Campbell, xen-devel, Konrad Rzeszutek Wilk, netdev
>>> On 08.01.13 at 12:57, jianhai luan <jianhai.luan@oracle.com> wrote:
> When Xen Dom0's network circumstance changed, DomU
> should be notified in some special condition. For
> example the below circumstance:
> ping from Guest A to DomU:
> Guest A --> eth0 - bond0 - xenbr0 --VIF(DOMU)
> eth1 /
> when eth0 inactive, and eth1 active.
> Guest A --> eth0 bond0 - xenbr0 --VIF(DOMU)
> eth1 /
> Guest A will don't reach to DomU. After Guest A
> send ARP request and DomU respond, Guest A will
> reach DomU. But some more second will be elapsed.
> eth0 bond0 - xenbr0 --VIF(DOMU)
> Guest A --> eth1/
Isn't a change to the availability of the bonds supposed to be
transparent to Guest A _and_ DomU? I.e. aren't you trying to fix
an eventual problem here in the wrong place?
> If Xen netback watch the network change, will notify
> DomU by change it own status. So netfront will watch
> netback's change, and DomU send ARP initiative.
Your patch is, at least according to what I see, completely
unusable - line breaks dropped, line order reversed, and
(guessing) some UTF-16/UCS-2 characters inserted at the top.
Please attach patches as plain ASCII.
Jan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Xen-devel] xen-netback notify DomU to send ARP.
2013-01-08 13:13 ` [Xen-devel] " Jan Beulich
@ 2013-01-08 13:42 ` Ian Campbell
2013-01-08 15:40 ` jianhai luan
0 siblings, 1 reply; 5+ messages in thread
From: Ian Campbell @ 2013-01-08 13:42 UTC (permalink / raw)
To: Jan Beulich
Cc: jianhai luan, xen-devel@lists.xensource.com,
Konrad Rzeszutek Wilk, netdev@vger.kernel.org
On Tue, 2013-01-08 at 13:13 +0000, Jan Beulich wrote:
> >>> On 08.01.13 at 12:57, jianhai luan <jianhai.luan@oracle.com> wrote:
> > When Xen Dom0's network circumstance changed, DomU
> > should be notified in some special condition. For
> > example the below circumstance:
> > ping from Guest A to DomU:
> > Guest A --> eth0 - bond0 - xenbr0 --VIF(DOMU)
> > eth1 /
> > when eth0 inactive, and eth1 active.
How is eth0 failing? Are you unplugging it, un-enslaving it or taking
some other sort of administrative action?
Which bonding mode are you using?
Doesn't this state change cause the switch to which eth0 and eth1 are
attached to forget the MAC tables associated with the eth0 port, meaning
that subsequent traffic will be flooded until it learns that eth1 is the
new port?
> > Guest A --> eth0 bond0 - xenbr0 --VIF(DOMU)
> > eth1 /
> > Guest A will don't reach to DomU. After Guest A
> > send ARP request and DomU respond, Guest A will
> > reach DomU. But some more second will be elapsed.
> > eth0 bond0 - xenbr0 --VIF(DOMU)
> > Guest A --> eth1/
>
> Isn't a change to the availability of the bonds supposed to be
> transparent to Guest A _and_ DomU? I.e. aren't you trying to fix
> an eventual problem here in the wrong place?
In non-virtualised bonding the bonding drive can take care of some of
this because it knows its own MAC address and can send appropriate
gratuitous frames (depends on the bonding mode) to paper over things. In
the virtualised case it (most likely) doesn't know VIF(DOMU)s MAC
address.
> > If Xen netback watch the network change, will notify
> > DomU by change it own status. So netfront will watch
> > netback's change, and DomU send ARP initiative.
>
> Your patch is, at least according to what I see, completely
> unusable - line breaks dropped, line order reversed, and
> (guessing) some UTF-16/UCS-2 characters inserted at the top.
> Please attach patches as plain ASCII.
>From the name it looks to me like it is the vi temp file created while
you have the file open rather than the actual patch file...
Ian.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: xen-netback notify DomU to send ARP.
2013-01-08 13:42 ` Ian Campbell
@ 2013-01-08 15:40 ` jianhai luan
2013-01-08 16:00 ` [Xen-devel] " Ian Campbell
0 siblings, 1 reply; 5+ messages in thread
From: jianhai luan @ 2013-01-08 15:40 UTC (permalink / raw)
To: Ian Campbell; +Cc: netdev, xen-devel, Ian Campbell, Konrad Rzeszutek Wilk
[-- Attachment #1.1: Type: text/plain, Size: 2657 bytes --]
On 2013-1-8 21:42, Ian Campbell wrote:
> On Tue, 2013-01-08 at 13:13 +0000, Jan Beulich wrote:
>>>>> On 08.01.13 at 12:57, jianhai luan <jianhai.luan@oracle.com> wrote:
>>> When Xen Dom0's network circumstance changed, DomU
>>> should be notified in some special condition. For
>>> example the below circumstance:
>>> ping from Guest A to DomU:
>>> Guest A --> eth0 - bond0 - xenbr0 --VIF(DOMU)
>>> eth1 /
>>> when eth0 inactive, and eth1 active.
> How is eth0 failing? Are you unplugging it, un-enslaving it or taking
> some other sort of administrative action?
In my emulation environment, i unplug it or ifdown the interface, while
eth0 maybe wrong in productive environment.
>
> Which bonding mode are you using?
Bond running in active-backup mode.
>
> Doesn't this state change cause the switch to which eth0 and eth1 are
> attached to forget the MAC tables associated with the eth0 port, meaning
> that subsequent traffic will be flooded until it learns that eth1 is the
> new port?
>
>>> Guest A --> eth0 bond0 - xenbr0 --VIF(DOMU)
>>> eth1 /
>>> Guest A will don't reach to DomU. After Guest A
>>> send ARP request and DomU respond, Guest A will
>>> reach DomU. But some more second will be elapsed.
>>> eth0 bond0 - xenbr0 --VIF(DOMU)
>>> Guest A --> eth1/
>> Isn't a change to the availability of the bonds supposed to be
>> transparent to Guest A _and_ DomU? I.e. aren't you trying to fix
>> an eventual problem here in the wrong place?
> In non-virtualised bonding the bonding drive can take care of some of
> this because it knows its own MAC address and can send appropriate
> gratuitous frames (depends on the bonding mode) to paper over things. In
> the virtualised case it (most likely) doesn't know VIF(DOMU)s MAC
> address.
If you have know all ip and mac before modprobe bond, you can
configure the bond argument. But you don't know all ip and mac before
start new virtual.
If bond want to know all DomU's ip and mac which pass through, it
must check all skb. it's not good idea.
>
>>> If Xen netback watch the network change, will notify
>>> DomU by change it own status. So netfront will watch
>>> netback's change, and DomU send ARP initiative.
>> Your patch is, at least according to what I see, completely
>> unusable - line breaks dropped, line order reversed, and
>> (guessing) some UTF-16/UCS-2 characters inserted at the top.
>> Please attach patches as plain ASCII.
> From the name it looks to me like it is the vi temp file created while
> you have the file open rather than the actual patch file...
>
> Ian.
>
Thanks,
Jason
[-- Attachment #1.2: Type: text/html, Size: 5439 bytes --]
[-- Attachment #2: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Xen-devel] xen-netback notify DomU to send ARP.
2013-01-08 15:40 ` jianhai luan
@ 2013-01-08 16:00 ` Ian Campbell
2013-01-09 1:07 ` Jason Luan
2013-01-09 7:39 ` [Xen-devel] " jianhai luan
0 siblings, 2 replies; 5+ messages in thread
From: Ian Campbell @ 2013-01-08 16:00 UTC (permalink / raw)
To: jianhai luan
Cc: xen-devel@lists.xensource.com, netdev@vger.kernel.org,
Konrad Rzeszutek Wilk
On Tue, 2013-01-08 at 15:40 +0000, jianhai luan wrote:
>
> On 2013-1-8 21:42, Ian Campbell wrote:
> > On Tue, 2013-01-08 at 13:13 +0000, Jan Beulich wrote:
> > > > > > On 08.01.13 at 12:57, jianhai luan <jianhai.luan@oracle.com>
> > > > > > wrote:
> > > > When Xen Dom0's network circumstance changed, DomU
> > > > should be notified in some special condition. For
> > > > example the below circumstance:
> > > > ping from Guest A to DomU:
> > > > Guest A --> eth0 - bond0 - xenbr0 --VIF(DOMU)
> > > > eth1 /
> > > > when eth0 inactive, and eth1 active.
> > How is eth0 failing? Are you unplugging it, un-enslaving it or
> > taking
> > some other sort of administrative action?
> In my emulation environment, i unplug it or ifdown the interface,
I expect these would behave rather different, since the affect of ifdown
looks rather different to an unplug from the PoV of the switch.
Is the ifdown case something which you are trying to solve or just what
appeared to be a convenient test case? I'd be less inclined to worry
about explict admin actions such as that.
Unplugging the cable should cause:
> > Doesn't this state change cause the switch to which eth0 and eth1
> > are
> > attached to forget the MAC tables associated with the eth0 port,
> > meaning
> > that subsequent traffic will be flooded until it learns that eth1 is
> > the
> > new port?
Ian
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: xen-netback notify DomU to send ARP.
2013-01-08 16:00 ` [Xen-devel] " Ian Campbell
@ 2013-01-09 1:07 ` Jason Luan
2013-01-09 7:39 ` [Xen-devel] " jianhai luan
1 sibling, 0 replies; 5+ messages in thread
From: Jason Luan @ 2013-01-09 1:07 UTC (permalink / raw)
To: Ian Campbell; +Cc: netdev, xen-devel, konrad.wilk
于 2013年01月09日 00:00, Ian Campbell 写道:
> On Tue, 2013-01-08 at 15:40 +0000, jianhai luan wrote:
>> On 2013-1-8 21:42, Ian Campbell wrote:
>>> On Tue, 2013-01-08 at 13:13 +0000, Jan Beulich wrote:
>>>>>>> On 08.01.13 at 12:57, jianhai luan <jianhai.luan@oracle.com>
>>>>>>> wrote:
>>>>> When Xen Dom0's network circumstance changed, DomU
>>>>> should be notified in some special condition. For
>>>>> example the below circumstance:
>>>>> ping from Guest A to DomU:
>>>>> Guest A --> eth0 - bond0 - xenbr0 --VIF(DOMU)
>>>>> eth1 /
>>>>> when eth0 inactive, and eth1 active.
>>> How is eth0 failing? Are you unplugging it, un-enslaving it or
>>> taking
>>> some other sort of administrative action?
>> In my emulation environment, i unplug it or ifdown the interface,
> I expect these would behave rather different, since the affect of ifdown
> looks rather different to an unplug from the PoV of the switch.
>
> Is the ifdown case something which you are trying to solve or just what
> appeared to be a convenient test case? I'd be less inclined to worry
> about explict admin actions such as that.
>
> Unplugging the cable should cause:
>
I do above listed thing to let switch active slave only.
I think that we should put attention on the thing which bond switch
active slave interface in active-backup mode. In network circumstance,
many thing will cause the switch, what do Vif when the event happen?
>>> Doesn't this state change cause the switch to which eth0 and eth1
>>> are
>>> attached to forget the MAC tables associated with the eth0 port,
>>> meaning
>>> that subsequent traffic will be flooded until it learns that eth1 is
>>> the
>>> new port?
> Ian
>
>
>
> _______________________________________________
> Xen-devel mailing list
Thanks,
Jason
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Xen-devel] xen-netback notify DomU to send ARP.
2013-01-08 16:00 ` [Xen-devel] " Ian Campbell
2013-01-09 1:07 ` Jason Luan
@ 2013-01-09 7:39 ` jianhai luan
2013-01-09 10:06 ` Jan Beulich
1 sibling, 1 reply; 5+ messages in thread
From: jianhai luan @ 2013-01-09 7:39 UTC (permalink / raw)
To: Ian Campbell; +Cc: xen-devel, Jan Beulich, netdev, Konrad Rzeszutek Wilk
[-- Attachment #1: Type: text/plain, Size: 1498 bytes --]
Sorry,
My attachment is wrong, please check the patch.
On 2013-1-9 0:00, Ian Campbell wrote:
> On Tue, 2013-01-08 at 15:40 +0000, jianhai luan wrote:
>> On 2013-1-8 21:42, Ian Campbell wrote:
>>> On Tue, 2013-01-08 at 13:13 +0000, Jan Beulich wrote:
>>>>>>> On 08.01.13 at 12:57, jianhai luan <jianhai.luan@oracle.com>
>>>>>>> wrote:
>>>>> When Xen Dom0's network circumstance changed, DomU
>>>>> should be notified in some special condition. For
>>>>> example the below circumstance:
>>>>> ping from Guest A to DomU:
>>>>> Guest A --> eth0 - bond0 - xenbr0 --VIF(DOMU)
>>>>> eth1 /
>>>>> when eth0 inactive, and eth1 active.
>>> How is eth0 failing? Are you unplugging it, un-enslaving it or
>>> taking
>>> some other sort of administrative action?
>> In my emulation environment, i unplug it or ifdown the interface,
> I expect these would behave rather different, since the affect of ifdown
> looks rather different to an unplug from the PoV of the switch.
>
> Is the ifdown case something which you are trying to solve or just what
> appeared to be a convenient test case? I'd be less inclined to worry
> about explict admin actions such as that.
>
> Unplugging the cable should cause:
>
>>> Doesn't this state change cause the switch to which eth0 and eth1
>>> are
>>> attached to forget the MAC tables associated with the eth0 port,
>>> meaning
>>> that subsequent traffic will be flooded until it learns that eth1 is
>>> the
>>> new port?
> Ian
>
>
[-- Attachment #2: 0001-xen-netback-notify-DomU-to-send-ARP.patch --]
[-- Type: text/plain, Size: 3169 bytes --]
>From f1235377724b4363cba27ef8b29fb89e2b36189a Mon Sep 17 00:00:00 2001
From: Jason Luan <jianhai.luan@oracle.com>
Date: Fri, 28 Dec 2012 15:43:06 +0800
Subject: [PATCH] xen-netback notify DomU to send ARP.
When Xen Dom0's network circumstance changed, DomU
should be notified in some special condition. For
example the below circumstance:
ping from Guest A to DomU:
Guest A --> eth0 - bond0 - xenbr0 --VIF(DOMU)
eth1 /
when eth0 inactive, and eth1 active.
Guest A --> eth0 bond0 - xenbr0 --VIF(DOMU)
eth1 /
Guest A will don't reach to DomU. After Guest A
send ARP request and DomU respond, Guest A will
reach DomU. But some more second will be elapsed.
eth0 bond0 - xenbr0 --VIF(DOMU)
Guest A --> eth1/
If Xen netback watch the network change, will notify
DomU by change it own status. So netfront will watch
netback's change, and DomU send ARP initiative.
Signed-off-by: Jason Luan <jianhai.luan@oracle.com>
---
drivers/net/xen-netback/xenbus.c | 36 ++++++++++++++++++++++++++++++++++++
1 files changed, 36 insertions(+), 0 deletions(-)
diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c
index 410018c..ead1a28 100644
--- a/drivers/net/xen-netback/xenbus.c
+++ b/drivers/net/xen-netback/xenbus.c
@@ -26,6 +26,7 @@ struct backend_info {
struct xenvif *vif;
enum xenbus_state frontend_state;
struct xenbus_watch hotplug_status_watch;
+ struct notifier_block vif_notifier;
u8 have_hotplug_status_watch:1;
};
@@ -34,11 +35,42 @@ static void connect(struct backend_info *);
static void backend_create_xenvif(struct backend_info *be);
static void unregister_hotplug_status_watch(struct backend_info *be);
+#define nb_to_backend(nb) container_of(nb, struct backend_info, vif_notifier)
+/**
+ * When network condition of vif change, notify the frontend.
+ */
+static int netback_netdev_event(struct notifier_block *this,
+ unsigned long event, void *ptr)
+{
+ struct net_device *event_dev = (struct net_device *)ptr;
+ struct backend_info *be = nb_to_backend(this);
+
+ pr_debug("event_dev: %s, event: %lx\n",
+ event_dev ? event_dev->name : "None", event);
+
+ if (!be->vif)
+ goto out;
+
+ switch (event) {
+ case NETDEV_NOTIFY_PEERS:
+ /* Notify frontend to Send gratuitous ARP */
+ xenbus_switch_state(be->dev, XenbusStateInitialised);
+ xenbus_switch_state(be->dev, XenbusStateConnected);
+ break;
+ default:
+ break;
+ }
+
+out:
+ return NOTIFY_DONE;
+}
+
static int netback_remove(struct xenbus_device *dev)
{
struct backend_info *be = dev_get_drvdata(&dev->dev);
unregister_hotplug_status_watch(be);
+ unregister_netdevice_notifier(&be->vif_notifier);
if (be->vif) {
kobject_uevent(&dev->dev.kobj, KOBJ_OFFLINE);
xenbus_rm(XBT_NIL, dev->nodename, "hotplug-status");
@@ -129,6 +161,10 @@ static int netback_probe(struct xenbus_device *dev,
/* This kicks hotplug scripts, so do it immediately. */
backend_create_xenvif(be);
+ /* Register Frontend Event Notify */
+ (be->vif_notifier).notifier_call = netback_netdev_event;
+ register_netdevice_notifier(&be->vif_notifier);
+
return 0;
abort_transaction:
--
1.7.6.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Xen-devel] xen-netback notify DomU to send ARP.
2013-01-09 7:39 ` [Xen-devel] " jianhai luan
@ 2013-01-09 10:06 ` Jan Beulich
2013-01-09 12:28 ` jianhai luan
0 siblings, 1 reply; 5+ messages in thread
From: Jan Beulich @ 2013-01-09 10:06 UTC (permalink / raw)
To: jianhai luan; +Cc: Ian Campbell, xen-devel, Konrad Rzeszutek Wilk, netdev
>>> On 09.01.13 at 08:39, jianhai luan <jianhai.luan@oracle.com> wrote:
>@@ -34,11 +35,42 @@ static void connect(struct backend_info *);
> static void backend_create_xenvif(struct backend_info *be);
> static void unregister_hotplug_status_watch(struct backend_info *be);
>
>+#define nb_to_backend(nb) container_of(nb, struct backend_info, vif_notifier)
>+/**
>+ * When network condition of vif change, notify the frontend.
>+ */
>+static int netback_netdev_event(struct notifier_block *this,
>+ unsigned long event, void *ptr)
>+{
>+ struct net_device *event_dev = (struct net_device *)ptr;
Pointless cast.
>+ struct backend_info *be = nb_to_backend(this);
>+
>+ pr_debug("event_dev: %s, event: %lx\n",
>+ event_dev ? event_dev->name : "None", event);
>+
>+ if (!be->vif)
>+ goto out;
>+
>+ switch (event) {
>+ case NETDEV_NOTIFY_PEERS:
>+ /* Notify frontend to Send gratuitous ARP */
>+ xenbus_switch_state(be->dev, XenbusStateInitialised);
>+ xenbus_switch_state(be->dev, XenbusStateConnected);
This is the sort of change that clearly isn't acceptable, as I don't
think you have ways to check _all_ existing frontends for their
compatibility with this. A connected -> connected transition
might be acceptable (that was done in the block frontend too, for
implementing dynamic resize), but will likely need to be
accompanied by a frontend side patch to handle that (which so
far should be a no-op).
>+ break;
>+ default:
>+ break;
Pointless default case.
>+ }
>+
>+out:
I don't think you really need the label (and the goto above) - just
put a return there.
>+ return NOTIFY_DONE;
>+}
>+
> static int netback_remove(struct xenbus_device *dev)
> {
> struct backend_info *be = dev_get_drvdata(&dev->dev);
>
> unregister_hotplug_status_watch(be);
>+ unregister_netdevice_notifier(&be->vif_notifier);
> if (be->vif) {
> kobject_uevent(&dev->dev.kobj, KOBJ_OFFLINE);
> xenbus_rm(XBT_NIL, dev->nodename, "hotplug-status");
>@@ -129,6 +161,10 @@ static int netback_probe(struct xenbus_device *dev,
> /* This kicks hotplug scripts, so do it immediately. */
> backend_create_xenvif(be);
>
>+ /* Register Frontend Event Notify */
>+ (be->vif_notifier).notifier_call = netback_netdev_event;
Pointless parentheses.
Jan
>+ register_netdevice_notifier(&be->vif_notifier);
>+
> return 0;
>
> abort_transaction:
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Xen-devel] xen-netback notify DomU to send ARP.
2013-01-09 10:06 ` Jan Beulich
@ 2013-01-09 12:28 ` jianhai luan
2013-01-09 13:44 ` Jan Beulich
0 siblings, 1 reply; 5+ messages in thread
From: jianhai luan @ 2013-01-09 12:28 UTC (permalink / raw)
To: Jan Beulich; +Cc: xen-devel, netdev, Jan Beulich, Konrad Rzeszutek Wilk
[-- Attachment #1: Type: text/plain, Size: 2654 bytes --]
On 2013-1-9 18:06, Jan Beulich wrote:
>>>> On 09.01.13 at 08:39, jianhai luan <jianhai.luan@oracle.com> wrote:
>> @@ -34,11 +35,42 @@ static void connect(struct backend_info *);
>> static void backend_create_xenvif(struct backend_info *be);
>> static void unregister_hotplug_status_watch(struct backend_info *be);
>>
>> +#define nb_to_backend(nb) container_of(nb, struct backend_info, vif_notifier)
>> +/**
>> + * When network condition of vif change, notify the frontend.
>> + */
>> +static int netback_netdev_event(struct notifier_block *this,
>> + unsigned long event, void *ptr)
>> +{
>> + struct net_device *event_dev = (struct net_device *)ptr;
> Pointless cast.
>
>> + struct backend_info *be = nb_to_backend(this);
>> +
>> + pr_debug("event_dev: %s, event: %lx\n",
>> + event_dev ? event_dev->name : "None", event);
>> +
>> + if (!be->vif)
>> + goto out;
>> +
>> + switch (event) {
>> + case NETDEV_NOTIFY_PEERS:
>> + /* Notify frontend to Send gratuitous ARP */
>> + xenbus_switch_state(be->dev, XenbusStateInitialised);
>> + xenbus_switch_state(be->dev, );
> This is the sort of change that clearly isn't acceptable, as I don't
> think you have ways to check _all_ existing frontends for their
> compatibility with this. A connected -> connected transition
> might be acceptable (that was done in the block frontend too, for
> implementing dynamic resize), but will likely need to be
> accompanied by a frontend side patch to handle that (which so
> far should be a no-op).
The latest xen net-frontent driver have handled the condition. State
XenbusStateInitialised will do nothing,
but change to XenbusStateConnected will trigger
netdev_notify_peers(netdev) to send ARP.
>
>> + break;
>> + default:
>> + break;
> Pointless default case.
>
>> + }
>> +
>> +out:
> I don't think you really need the label (and the goto above) - just
> put a return there.
>
>> + return NOTIFY_DONE;
>> +}
>> +
>> static int netback_remove(struct xenbus_device *dev)
>> {
>> struct backend_info *be = dev_get_drvdata(&dev->dev);
>>
>> unregister_hotplug_status_watch(be);
>> + unregister_netdevice_notifier(&be->vif_notifier);
>> if (be->vif) {
>> kobject_uevent(&dev->dev.kobj, KOBJ_OFFLINE);
>> xenbus_rm(XBT_NIL, dev->nodename, "hotplug-status");
>> @@ -129,6 +161,10 @@ static int netback_probe(struct xenbus_device *dev,
>> /* This kicks hotplug scripts, so do it immediately. */
>> backend_create_xenvif(be);
>>
>> + /* Event Notify */
>> + (be->vif_notifier).notifier_call = netback_netdev_event;
> Pointless parentheses.
>
> Jan
>
>> + register_netdevice_notifier(&be->vif_notifier);
>> +
>> return 0;
>>
>> abort_transaction:
>
[-- Attachment #2: 0001-xen-netback-notify-DomU-to-send-ARP.patch --]
[-- Type: text/plain, Size: 3126 bytes --]
>From a64d80cc0c780bee7a8d6e842126cb5f7d17f0d2 Mon Sep 17 00:00:00 2001
From: Jason Luan <jianhai.luan@oracle.com>
Date: Fri, 28 Dec 2012 15:43:06 +0800
Subject: [PATCH] xen-netback notify DomU to send ARP.
When Xen Dom0's network circumstance changed, DomU
should be notified in some special condition. For
example the below circumstance:
ping from Guest A to DomU:
Guest A --> eth0 - bond0 - xenbr0 --VIF(DOMU)
eth1 /
when eth0 inactive, and eth1 active.
Guest A --> eth0 bond0 - xenbr0 --VIF(DOMU)
eth1 /
Guest A will don't reach to DomU. After Guest A
send ARP request and DomU respond, Guest A will
reach DomU. But some more second will be elapsed.
eth0 bond0 - xenbr0 --VIF(DOMU)
Guest A --> eth1/
If Xen netback watch the network change, will notify
DomU by change it own status. So netfront will watch
netback's change, and DomU send ARP initiative.
Signed-off-by: Jason Luan <jianhai.luan@oracle.com>
---
drivers/net/xen-netback/xenbus.c | 33 +++++++++++++++++++++++++++++++++
1 files changed, 33 insertions(+), 0 deletions(-)
diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c
index 410018c..17a3990 100644
--- a/drivers/net/xen-netback/xenbus.c
+++ b/drivers/net/xen-netback/xenbus.c
@@ -26,6 +26,7 @@ struct backend_info {
struct xenvif *vif;
enum xenbus_state frontend_state;
struct xenbus_watch hotplug_status_watch;
+ struct notifier_block vif_notifier;
u8 have_hotplug_status_watch:1;
};
@@ -34,11 +35,39 @@ static void connect(struct backend_info *);
static void backend_create_xenvif(struct backend_info *be);
static void unregister_hotplug_status_watch(struct backend_info *be);
+#define nb_to_backend(nb) container_of(nb, struct backend_info, vif_notifier)
+/**
+ * When network condition of vif change, notify the frontend.
+ */
+static int netback_netdev_event(struct notifier_block *this,
+ unsigned long event, void *ptr)
+{
+ struct net_device *event_dev = ptr;
+ struct backend_info *be = nb_to_backend(this);
+
+ pr_debug("event_dev: %s, event: %lx\n",
+ event_dev ? event_dev->name : "None", event);
+
+ if (!be->vif)
+ return NOTIFY_DONE;
+
+ switch (event) {
+ case NETDEV_NOTIFY_PEERS:
+ /* Notify frontend to Send gratuitous ARP */
+ xenbus_switch_state(be->dev, XenbusStateInitialised);
+ xenbus_switch_state(be->dev, XenbusStateConnected);
+ break;
+ }
+
+ return NOTIFY_DONE;
+}
+
static int netback_remove(struct xenbus_device *dev)
{
struct backend_info *be = dev_get_drvdata(&dev->dev);
unregister_hotplug_status_watch(be);
+ unregister_netdevice_notifier(&be->vif_notifier);
if (be->vif) {
kobject_uevent(&dev->dev.kobj, KOBJ_OFFLINE);
xenbus_rm(XBT_NIL, dev->nodename, "hotplug-status");
@@ -129,6 +158,10 @@ static int netback_probe(struct xenbus_device *dev,
/* This kicks hotplug scripts, so do it immediately. */
backend_create_xenvif(be);
+ /* Register Frontend Event Notify */
+ be->vif_notifier.notifier_call = netback_netdev_event;
+ register_netdevice_notifier(&be->vif_notifier);
+
return 0;
abort_transaction:
--
1.7.6.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Xen-devel] xen-netback notify DomU to send ARP.
2013-01-09 12:28 ` jianhai luan
@ 2013-01-09 13:44 ` Jan Beulich
2013-01-09 15:37 ` Jason Luan
0 siblings, 1 reply; 5+ messages in thread
From: Jan Beulich @ 2013-01-09 13:44 UTC (permalink / raw)
To: jianhai luan; +Cc: xen-devel, Konrad Rzeszutek Wilk, netdev
>>> On 09.01.13 at 13:28, jianhai luan <jianhai.luan@oracle.com> wrote:
>>> + switch (event) {
>>> + case NETDEV_NOTIFY_PEERS:
>>> + /* Notify frontend to Send gratuitous ARP */
>>> + xenbus_switch_state(be->dev, XenbusStateInitialised);
>>> + xenbus_switch_state(be->dev, );
>> This is the sort of change that clearly isn't acceptable, as I don't
>> think you have ways to check _all_ existing frontends for their
>> compatibility with this. A connected -> connected transition
>> might be acceptable (that was done in the block frontend too, for
>> implementing dynamic resize), but will likely need to be
>> accompanied by a frontend side patch to handle that (which so
>> far should be a no-op).
> The latest xen net-frontent driver have handled the condition. State
> XenbusStateInitialised will do nothing,
> but change to XenbusStateConnected will trigger
> netdev_notify_peers(netdev) to send ARP.
Did you read my earlier reply carefully? You still only talk about
(upstream) Linux netfront, but this is not the only (possible)
frontend. You should not invoke state transitions that can -
even if only theoretically - blow up frontends. And afaict the
only thing you can safely assume frontends ought to tolerate
are transitions from Connected to Connected (or more
generally from one state to the same one, but the other
states aren't useful here, except maybe the Reconfigur* ones).
Jan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: xen-netback notify DomU to send ARP.
2013-01-09 13:44 ` Jan Beulich
@ 2013-01-09 15:37 ` Jason Luan
0 siblings, 0 replies; 5+ messages in thread
From: Jason Luan @ 2013-01-09 15:37 UTC (permalink / raw)
To: Jan Beulich; +Cc: netdev, xen-devel, Ian Campbell, konrad.wilk
于 2013年01月09日 21:44, Jan Beulich 写道:
>>>> On 09.01.13 at 13:28, jianhai luan <jianhai.luan@oracle.com> wrote:
>>>> + switch (event) {
>>>> + case NETDEV_NOTIFY_PEERS:
>>>> + /* Notify frontend to Send gratuitous ARP */
>>>> + xenbus_switch_state(be->dev, XenbusStateInitialised);
>>>> + xenbus_switch_state(be->dev, );
>>> This is the sort of change that clearly isn't acceptable, as I don't
>>> think you have ways to check _all_ existing frontends for their
>>> compatibility with this. A connected -> connected transition
>>> might be acceptable (that was done in the block frontend too, for
>>> implementing dynamic resize), but will likely need to be
>>> accompanied by a frontend side patch to handle that (which so
>>> far should be a no-op).
>> The latest xen net-frontent driver have handled the condition. State
>> XenbusStateInitialised will do nothing,
>> but change to XenbusStateConnected will trigger
>> netdev_notify_peers(netdev) to send ARP.
> Did you read my earlier reply carefully? You still only talk about
> (upstream) Linux netfront, but this is not the only (possible)
> frontend. You should not invoke state transitions that can -
> even if only theoretically - blow up frontends. And afaict the
I only want to notify xen-netfront. I don't know what is better way?
To attainthegoal, i try to modify virtual interrupt, but the way is
morecomplicated,modified and working. So, i give up the way.
Would you like to give some suggestion about how to notify xen-netfront?
> only thing you can safely assume frontends ought to tolerate
> are transitions from Connected to Connected (or more
> generally from one state to the same one, but the other
> states aren't useful here, except maybe the Reconfigur* ones).
Sorry for that. At the beginning the patch be applied in kernel 2.6.18 to
fixed one issue. Only XenbusStateInitialised and XenbusStateClosed ( Not
Reconfigure* one) don't any thing, so i choose the XenbusStateInitialised.
Do you suggestion that i choose Reconfigure*?
>
> Jan
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-01-09 15:37 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-09 15:07 xen-netback notify DomU to send ARP Jason Luan
-- strict thread matches above, loose matches on Subject: below --
2013-01-08 11:57 jianhai luan
2013-01-08 13:13 ` [Xen-devel] " Jan Beulich
2013-01-08 13:42 ` Ian Campbell
2013-01-08 15:40 ` jianhai luan
2013-01-08 16:00 ` [Xen-devel] " Ian Campbell
2013-01-09 1:07 ` Jason Luan
2013-01-09 7:39 ` [Xen-devel] " jianhai luan
2013-01-09 10:06 ` Jan Beulich
2013-01-09 12:28 ` jianhai luan
2013-01-09 13:44 ` Jan Beulich
2013-01-09 15:37 ` Jason Luan
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).