Re: xn0: Error 2 parsing device/vif/0/mac [PATCH]

2011-01-31 Thread Justin T. Gibbs
On 1/15/2011 3:12 AM, Janne Snabb wrote:
 On Sat, 15 Jan 2011, Janne Snabb wrote:

 It appears that that the netfront driver fails to get the vif mac
 address which leads to panic shortly afterwards.

 The patch at the bottom of this message solves the problem for me.
 After that the current 8.2RC2 system works fine on amd64 with XENHVM
 kernel with Xen 4.0.1 (have not tested other versions).

 If the mac node does not appear in the front-end vif directory
 (does it ever appear there? in my experience no), we fetch a link
 to the backend directory for the same vif and try to get the mac
 node from there.

 I am not sure if this is the proper way to fix this, but it works
 for me.

As with most things Xen, there is no official specification for what
xenstore nodes are where.  If we assume the Linux driver is the
definitive reference, then the current FreeBSD driver behavior is
correct:


http://xenbits.xensource.com/linux-2.6.18-xen.hg?file/5e08fff8dc05/drivers/xen/netfront/netfront.c

See talk_to_backend() and the xen_net_read_mac() function.

There are two environments that setup the xenstore nodes: the Xen cloud
platform, and the more common phython tool stack (aka xend).  I haven't
reviewed XCP, but Xend populates the MAC node in the frontend's tree
unless the ioemu tag is in the VIF configuration line for that interface.
Why this is the case, I have no idea - again the behavior is not documented.
However, it seems reasonable to do what you've done in this patch and to
rely on the backend's copy if the frontend's doesn't exist.  It would also
be good to add support to netfront to maintain the mac node in the frontend
tree and to allow it to be set just like a real device.  I believe netback
will pick up and use the updated MAC value if you bounce the Xenbus
connection after making the change.

--
Justin

___
freebsd-xen@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-xen
To unsubscribe, send any mail to freebsd-xen-unsubscr...@freebsd.org


Re: xn0: Error 2 parsing device/vif/0/mac [PATCH]

2011-01-30 Thread Martin Cracauer
Janne Snabb wrote on Wed, Jan 26, 2011 at 09:05:49AM +: 
 On Fri, 21 Jan 2011, Nick Sayer wrote:
 
  +1 to the patch Janne Snabb posted. I have a domU at rootbsd and
  had suffered the exact same do something smart panic when I tried
  to build a xen kernel, but his patch fixed it for me.
 
 Thanks for confirming that I am not the only one suffering of this.
 I was wondering if I am doing something wrong.
 
 I did send-pr this with my patch so that it does not get forgotten.
 PR kern/154302

I can confirm that I had the same smart error and it went away with
the patch.

amd64/-current/hvm/pxe

Martin
-- 
%%%
Martin Cracauer craca...@cons.org   http://www.cons.org/cracauer/
___
freebsd-xen@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-xen
To unsubscribe, send any mail to freebsd-xen-unsubscr...@freebsd.org


Re: xn0: Error 2 parsing device/vif/0/mac [PATCH]

2011-01-21 Thread Nick Sayer
+1 to the patch Janne Snabb posted. I have a domU at rootbsd and had suffered 
the exact same do something smart panic when I tried to build a xen kernel, 
but his patch fixed it for me.___
freebsd-xen@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-xen
To unsubscribe, send any mail to freebsd-xen-unsubscr...@freebsd.org


Re: xn0: Error 2 parsing device/vif/0/mac [PATCH]

2011-01-17 Thread Janne Snabb
On Sat, 15 Jan 2011, Janne Snabb wrote:

 On Sat, 15 Jan 2011, Janne Snabb wrote:
 
  It appears that that the netfront driver fails to get the vif mac 
  address which leads to panic shortly afterwards.
 
 The patch at the bottom of this message solves the problem for me.

This patch might be a bit neater. I found out about
xenbus_get_otherend_path().

Best Regards,
--
Janne Snabb / EPIPE Communications
sn...@epipe.com - http://epipe.com/

--- sys/dev/xen/netfront/netfront.c.orig2010-12-21 17:09:25.0 
+
+++ sys/dev/xen/netfront/netfront.c 2011-01-17 10:11:06.0 +
@@ -401,13 +401,14 @@
 xen_net_read_mac(device_t dev, uint8_t mac[])
 {
int error, i;
char *s, *e, *macstr;
 
-   error = xs_read(XST_NIL, xenbus_get_node(dev), mac, NULL,
-   (void **) macstr);
-   if (error)
+   if ((error = xs_read(XST_NIL, xenbus_get_node(dev), mac, NULL,
+   (void **) macstr)) != 0 
+   (error = xs_read(XST_NIL, xenbus_get_otherend_path(dev), 
+   mac, NULL, (void **) macstr) != 0))
return (error);
 
s = macstr;
for (i = 0; i  ETHER_ADDR_LEN; i++) {
mac[i] = strtoul(s, e, 16);
___
freebsd-xen@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-xen
To unsubscribe, send any mail to freebsd-xen-unsubscr...@freebsd.org


Re: xn0: Error 2 parsing device/vif/0/mac [PATCH]

2011-01-17 Thread Gót András
I'll give it a try today or later tomorrow with AMD and Xeon machines 
with Xen 3.4.3. I hope Colin can also make this for 8.2 release, if 
these are fine.




Janne Snabb wrote:

On Mon, 17 Jan 2011, Janne Snabb wrote:


This patch might be a bit neater.


Oops, bug. A bracket at the wrong place. This one should be better.

Sorry about the noise,
--
Janne Snabb / EPIPE Communications
sn...@epipe.com - http://epipe.com/


--- sys/dev/xen/netfront/netfront.c.orig2010-12-21 17:09:25.0 
+
+++ sys/dev/xen/netfront/netfront.c 2011-01-17 10:11:06.0 +
@@ -401,13 +401,14 @@
 xen_net_read_mac(device_t dev, uint8_t mac[])
 {
int error, i;
char *s, *e, *macstr;
 
-	error = xs_read(XST_NIL, xenbus_get_node(dev), mac, NULL,

-   (void **) macstr);
-   if (error)
+   if ((error = xs_read(XST_NIL, xenbus_get_node(dev), mac, NULL,
+   (void **) macstr)) != 0 
+	(error = xs_read(XST_NIL, xenbus_get_otherend_path(dev), 
+	mac, NULL, (void **) macstr)) != 0)

return (error);
 
 	s = macstr;

for (i = 0; i  ETHER_ADDR_LEN; i++) {
mac[i] = strtoul(s, e, 16);
___
freebsd-xen@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-xen
To unsubscribe, send any mail to freebsd-xen-unsubscr...@freebsd.org

___
freebsd-xen@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-xen
To unsubscribe, send any mail to freebsd-xen-unsubscr...@freebsd.org


Re: xn0: Error 2 parsing device/vif/0/mac [PATCH]

2011-01-15 Thread Janne Snabb
On Sat, 15 Jan 2011, Janne Snabb wrote:

 It appears that that the netfront driver fails to get the vif mac 
 address which leads to panic shortly afterwards.

The patch at the bottom of this message solves the problem for me.
After that the current 8.2RC2 system works fine on amd64 with XENHVM
kernel with Xen 4.0.1 (have not tested other versions).

If the mac node does not appear in the front-end vif directory
(does it ever appear there? in my experience no), we fetch a link
to the backend directory for the same vif and try to get the mac
node from there.

I am not sure if this is the proper way to fix this, but it works
for me.

I can send-pr this if desired.

Best Regards,
--
Janne Snabb / EPIPE Communications
sn...@epipe.com - http://epipe.com/

--- sys/dev/xen/netfront/netfront.c.orig2010-12-21 17:09:25.0 
+
+++ sys/dev/xen/netfront/netfront.c 2011-01-15 10:01:12.0 +
@@ -399,16 +399,30 @@
  */
 static int 
 xen_net_read_mac(device_t dev, uint8_t mac[])
 {
int error, i;
-   char *s, *e, *macstr;
+   char *s, *e, *macstr, *backend;
 
error = xs_read(XST_NIL, xenbus_get_node(dev), mac, NULL,
(void **) macstr);
-   if (error)
-   return (error);
+
+   if (error) {
+   error = xs_read(XST_NIL, xenbus_get_node(dev), backend, NULL,
+   (void **) backend);
+
+   if (error)
+   return (error);
+
+   error = xs_read(XST_NIL, backend, mac, NULL,
+   (void **) macstr);
+
+   free(backend, M_XENBUS);
+
+   if (error)
+   return (error);
+   }
 
s = macstr;
for (i = 0; i  ETHER_ADDR_LEN; i++) {
mac[i] = strtoul(s, e, 16);
if (s == e || (e[0] != ':'  e[0] != 0)) {
___
freebsd-xen@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-xen
To unsubscribe, send any mail to freebsd-xen-unsubscr...@freebsd.org