<br><tt><font size=2>kashyapv@linux.vnet.ibm.com wrote on 05/07/2010 03:21:53
PM:<br>
<br>
> [image removed] </font></tt>
<br><tt><font size=2>> <br>
> Re: [libvirt] [PATCH] more interface functions; some needed for VEPA</font></tt>
<br><tt><font size=2>> <br>
> kashyapv </font></tt>
<br><tt><font size=2>> <br>
> to:</font></tt>
<br><tt><font size=2>> <br>
> Stefan Berger</font></tt>
<br><tt><font size=2>> <br>
> 05/07/2010 03:22 PM</font></tt>
<br><tt><font size=2>> <br>
> Cc:</font></tt>
<br><tt><font size=2>> <br>
> libvir-list</font></tt>
<br><tt><font size=2>> <br>
> On Fri, 7 May 2010, Stefan Berger wrote:<br>
> <br>
> > Then there is a new function that reads the VLANid of a VLAN
interface<br>
> > via an ioctl(). This one will be needed by upcoming VEPA related<br>
> > patches.<br>
> <br>
> Yes, this is needed by VEPA. With this patch it should be possible
to <br>
> collect all the components required for the VEPA (for VSI discovery
protocol).<br>
> <br>
> As per your/David's earlier RFC for sending the netlink message to<br>
> the VSI engine (LLDPAD), the netlink message will need to contain:<br>
> <br>
> 1. 'Port profile'  comprising of :<br>
>     VSI Manager ID      1 octet<br>
>     VSI Type ID         3 octets<br>
>     VSI Type ID Version 1 octet<br>
>     VSI Instance ID    16 octets<br>
> <br>
> Therefore need to extend the domain xml to take the above 4 values.<br>
> <br>
> reference, Pg 50 of the proposal here<br>
>     </font></tt><a href="http://www.ieee802.org/1/files/public/docs2010/bg-joint-evb-0410v1.pdf"><tt><font size=2>http://www.ieee802.org/1/files/public/docs2010/bg-joint-evb-0410v1.pdf</font></tt></a>
<br>
<br><tt><font size=2>Gerhard and I defined the following XML for the above:</font></tt>
<br>
<br><tt><font size=2>    <interface type='direct'></font></tt><font size=3>
</font><tt><font size=2><br>
      <source dev='static' mode='vepa'/></font></tt><font size=3>
</font><tt><font size=2 color=red><br>
</font></tt><tt><font size=2>-->   <vsi managerid='12' typeid='1193046'
typeidversion='1' instanceid='fa9b7fff-b0a0-4893-8e0e-beef4ff18f8f'/></font></tt><font size=3>
</font><tt><font size=2>   <--<br>
    </interface></font></tt><font size=3> <br>
</font><tt><font size=2><br>
(whether above node is called 'vsi' or 'vdp' -- I don't care either way,
but 'vsi' for now)</font></tt><font size=3> <br>
</font><tt><font size=2><br>
following this schema and corresponding (self-explanatory) data types:</font></tt><font size=3>
<br>
</font><tt><font size=2><br>
+  <define name="vsiProfile"></font></tt><font size=3>
</font><tt><font size=2><br>
+    <element name="vsi"></font></tt><font size=3>
</font><tt><font size=2><br>
+      <attribute name="managerid"></font></tt><font size=3>
</font><tt><font size=2><br>
+        <ref name="uint8range"/></font></tt><font size=3>
</font><tt><font size=2><br>
+      </attribute></font></tt><font size=3> </font><tt><font size=2><br>
+      <attribute name="typeid"></font></tt><font size=3>
</font><tt><font size=2><br>
+        <ref name="uint24range"/></font></tt><font size=3>
</font><tt><font size=2><br>
+      </attribute></font></tt><font size=3> </font><tt><font size=2><br>
+      <attribute name="typeidversion"></font></tt><font size=3>
</font><tt><font size=2><br>
+        <ref name="uint8range"/></font></tt><font size=3>
</font><tt><font size=2><br>
+      </attribute></font></tt><font size=3> </font><tt><font size=2><br>
+      <attribute name="instanceid"></font></tt><font size=3>
</font><tt><font size=2><br>
+        <ref name="UUID"/></font></tt><font size=3>
</font><tt><font size=2><br>
+      </attribute></font></tt><font size=3> </font><tt><font size=2><br>
+    </element></font></tt><font size=3> </font><tt><font size=2><br>
+  </define></font></tt><font size=3> <br>
</font><tt><font size=2><br>
So the previous switchport and profile are gone.</font></tt><font size=3>
</font>
<br>
<br><font size=3>Regards,</font>
<br><font size=3>    Stefan</font>
<br>
<br><tt><font size=2><br>
> <br>
> 2. MAC address (of the virtual interface)<br>
> <br>
> 3. VLAN tag  (associtaed with the virtual interface)<br>
> <br>
> thanks<br>
>     Vivek<br>
> <br>
> <br>
> <br>
> ><br>
> > On cygwin for example none of the newly added functions are available.<br>
> > The flags related function could not be exported due to missing<br>
> > PF_PACKET -- or maybe other type of protocol that needs to be
used when<br>
> > opening the socket for running the ioctl() on.<br>
> ><br>
> > Signed-off-by: Stefan Berger <stefanb@us.ibm.com><br>
> ><br>
> <..snip><br>
> > +<br>
> > +#ifdef __linux__<br>
> > +int<br>
> > +ifaceGetVlanID(const char *vlanifname, int *vlanid) {<br>
> > +    struct vlan_ioctl_args vlanargs = {<br>
> > +      .cmd = GET_VLAN_VID_CMD,<br>
> > +    };<br>
> > +    int rc = 0;<br>
> > +    int fd = socket(PF_PACKET, SOCK_DGRAM, 0);<br>
> > +<br>
> > +    if (fd < 0)<br>
> > +        return errno;<br>
> > +<br>
> > +    if (virStrcpyStatic(vlanargs.device1, vlanifname)
== NULL) {<br>
> > +        rc = EINVAL;<br>
> > +        goto err_exit;<br>
> > +    }<br>
> > +<br>
> > +    if (ioctl(fd, SIOCGIFVLAN, &vlanargs) != 0)
{<br>
> > +        rc = errno;<br>
> > +        goto err_exit;<br>
> > +    }<br>
> > +<br>
> > +    *vlanid = vlanargs.u.VID;<br>
> > +<br>
> > + err_exit:<br>
> > +    close(fd);<br>
> > +<br>
> > +    return rc;<br>
> > +}<br>
> > +<br>
> > +#else<br>
> > +<br>
> > +int<br>
> > +ifaceGetVlanID(const char *vlanifname ATTRIBUTE_UNUSED,<br>
> > +               int *vlanid
ATTRIBUTE_UNUSED) {<br>
> > +<br>
> > +    ifaceError(VIR_ERR_INTERNAL_ERROR, "%s",<br>
> > +               _("ifaceGetVlanID
is not supported on non-linux <br>
> platforms"));<br>
> > +<br>
> > +    return ENOSYS;<br>
> > +}<br>
> > +#endif /* __linux__ */<br>
> > Index: libvirt-acl/src/util/interface.h<br>
> > ===================================================================<br>
> > --- libvirt-acl.orig/src/util/interface.h<br>
> > +++ libvirt-acl/src/util/interface.h<br>
> > @@ -12,6 +12,9 @@<br>
> ><br>
> > # include "datatypes.h"<br>
> ><br>
> > +int ifaceGetFlags(const char *name, short *flags);<br>
> > +int ifaceIsUp(const char *name, bool *up);<br>
> > +<br>
> > int ifaceCtrl(const char *name, bool up);<br>
> ><br>
> > static inline int ifaceUp(const char *name) {<br>
> > @@ -27,4 +30,6 @@ int ifaceCheck(bool reportError, const c<br>
> ><br>
> > int ifaceGetIndex(bool reportError, const char *ifname, int *ifindex);<br>
> ><br>
> > +int ifaceGetVlanID(const char *vlanifname, int *vlanid);<br>
> > +<br>
> > #endif /* __VIR_INTERFACE_H__ */<br>
> > Index: libvirt-acl/src/libvirt_private.syms<br>
> > ===================================================================<br>
> > --- libvirt-acl.orig/src/libvirt_private.syms<br>
> > +++ libvirt-acl/src/libvirt_private.syms<br>
> > @@ -685,6 +685,9 @@ virArgvToString;<br>
> > ifaceCtrl;<br>
> > ifaceCheck;<br>
> > ifaceGetIndex;<br>
> > +ifaceGetFlags;<br>
> > +ifaceIsUp;<br>
> > +ifaceGetVlanID;<br>
> ><br>
> > # usb.h<br>
> > usbGetDevice;<br>
> ><br>
> > --<br>
> > libvir-list mailing list<br>
> > libvir-list@redhat.com<br>
> > </font></tt><a href="https://www.redhat.com/mailman/listinfo/libvir-list"><tt><font size=2>https://www.redhat.com/mailman/listinfo/libvir-list</font></tt></a><tt><font size=2><br>
> ><br>
</font></tt>