xen: net features
PATCH 5/5 xen: net features
Allow (1) the making of both frontend and backend vif MACs read-only (independently), (2) the addition of some xen-specific sysfs attributes on front/back vifs, (3) an option to set several vif defaults in a domain config file, for ease of use when creating multiple vifs.
diffstat:
linux-2.6.10-xen-sparse/drivers/xen/netback/common.h | 10 + linux-2.6.10-xen-sparse/drivers/xen/netback/interface.c | 121 +++++++++++++++- linux-2.6.10-xen-sparse/drivers/xen/netfront/netfront.c | 73 +++++++++ tools/python/xen/lowlevel/xu/xu.c | 18 ++ tools/python/xen/xend/XendDomainInfo.py | 1 tools/python/xen/xend/server/messages.py | 9 + tools/python/xen/xend/server/netif.py | 62 ++++++++ tools/python/xen/xm/create.py | 91 +++++++++++- xen/include/public/io/domain_controller.h | 10 - 9 files changed, 388 insertions(+), 7 deletions(-)
linux-2.6.10-xen-sparse/drivers/xen/netback/common.h +10 -0
@@ -35,7 +35,17 @@domid_t domid;unsigned int handle; +/* Frontend information */ u8 fe_dev_addr[6 ]; +unsigned char fe_dom_name[16 ]; + +/* netif flags */ +#define NETIF_IFFLAG_MAC_WRITE (1 << 0) +#define NETIF_IFFLAG_BE_MAC_WRITE (1 << 1) +#define NETIF_IFFLAG_EXT_SYSFS (1 << 2) +u16 flags; + +int (*set_mac_address)(struct net_device *dev,void *addr);/* Physical parameters of the comms window. */ unsigned long tx_shmem_frame;
linux-2.6.10-xen-sparse/drivers/xen/netback/interface.c +120 -1
148 lines not on this page · raw message
linux-2.6.10-xen-sparse/drivers/xen/netfront/netfront.c +72 -1
115 lines not on this page · raw message
tools/python/xen/lowlevel/xu/xu.c +18 -0
@@ -607,6 +607,7 @@P2C (netif_fe_interface_status_t, status, u32);P2C (netif_fe_interface_status_t, evtchn, u16);P2C (netif_fe_interface_status_t, domid, u16); +P2C (netif_fe_interface_status_t, flags, u16);P2C (netif_fe_interface_status_t, mac[0 ], u8);P2C (netif_fe_interface_status_t, mac[1 ], u8);P2C (netif_fe_interface_status_t, mac[2 ], u8);
@@ -617,6 +618,7 @@case TYPE (CMSG_NETIF_BE ,CMSG_NETIF_BE_CREATE ):P2C (netif_be_create_t, domid, u32);P2C (netif_be_create_t, netif_handle, u32); +P2C (netif_be_create_t, flags, u16);P2C (netif_be_create_t, mac[0 ], u8);P2C (netif_be_create_t, mac[1 ], u8);P2C (netif_be_create_t, mac[2 ], u8);
@@ -629,6 +631,22 @@P2C (netif_be_create_t, be_mac[3 ], u8);P2C (netif_be_create_t, be_mac[4 ], u8);P2C (netif_be_create_t, be_mac[5 ], u8); +P2C (netif_be_create_t, fe_dom_name[0 ], u8); +P2C (netif_be_create_t, fe_dom_name[1 ], u8); +P2C (netif_be_create_t, fe_dom_name[2 ], u8); +P2C (netif_be_create_t, fe_dom_name[3 ], u8); +P2C (netif_be_create_t, fe_dom_name[4 ], u8); +P2C (netif_be_create_t, fe_dom_name[5 ], u8); +P2C (netif_be_create_t, fe_dom_name[6 ], u8); +P2C (netif_be_create_t, fe_dom_name[7 ], u8); +P2C (netif_be_create_t, fe_dom_name[8 ], u8); +P2C (netif_be_create_t, fe_dom_name[9 ], u8); +P2C (netif_be_create_t, fe_dom_name[10 ], u8); +P2C (netif_be_create_t, fe_dom_name[11 ], u8); +P2C (netif_be_create_t, fe_dom_name[12 ], u8); +P2C (netif_be_create_t, fe_dom_name[13 ], u8); +P2C (netif_be_create_t, fe_dom_name[14 ], u8); +P2C (netif_be_create_t, fe_dom_name[15 ], u8);break ;case TYPE (CMSG_NETIF_BE ,CMSG_NETIF_BE_DESTROY ):P2C (netif_be_destroy_t, domid, u32);
tools/python/xen/xend/XendDomainInfo.py +1 -0
@@ -1106,6 +1106,7 @@ ctrl = xend.netif_create(vm.dom, recreate=vm.recreate) log.debug("Creating vif dom=%d vif=%d mac=%s", vm.dom, vif, str(vmac)) recreate = vm.get_device_recreate('vif', index) + val.append(['vmname', vm.name]) defer = ctrl.attachDevice(vif, val, recreate=recreate) def cbok(dev): dev.vifctl('up', vmname=vm.name)
tools/python/xen/xend/server/messages.py +9 -0
@@ -152,6 +152,10 @@ CMSG_NETIF_BE_DISCONNECT = 3 CMSG_NETIF_BE_DRIVER_STATUS = 32 +NETIF_IFFLAG_MAC_WRITE = 1<<0 +NETIF_IFFLAG_BE_MAC_WRITE = 1<<1 +NETIF_IFFLAG_EXT_SYSFS = 1<<2 + NETIF_INTERFACE_STATUS_CLOSED = 0 #/* Interface doesn't exist. */ NETIF_INTERFACE_STATUS_DISCONNECTED = 1 #/* Exists but is disconnected. */ NETIF_INTERFACE_STATUS_CONNECTED = 2 #/* Exists and is connected. */
@@ -269,6 +273,11 @@ if k in ['mac', 'be_mac']: for i in range(0, 6): args['%s[%d]' % (k, i)] = v[i] + elif k == 'fe_dom_name': + for i in range(min(len(v), 15)): + args['fe_dom_name[%d]' % i] = ord(v[i]) + for i in range(len(v), max(len(v), 16)): + args['fe_dom_name[%d]' % i] = 0 else: args[k] = v msg = xu.message(major, minor, msgid, args)
tools/python/xen/xend/server/netif.py +62 -0
112 lines not on this page · raw message
tools/python/xen/xm/create.py +89 -2
148 lines not on this page · raw message
xen/include/public/io/domain_controller.h +7 -3
@@ -366,7 +366,8 @@u16 evtchn;/* 8: status == NETIF_INTERFACE_STATUS_CONNECTED */ u8 mac[6 ];/* 10: status == NETIF_INTERFACE_STATUS_CONNECTED */ domid_t domid;/* 16: status != NETIF_INTERFACE_STATUS_DESTROYED */ -}PACKED netif_fe_interface_status_t;/* 18 bytes */ +u16 flags;/* 18 */ +}PACKED netif_fe_interface_status_t;/* 20 bytes */ /* * CMSG_NETIF_FE_DRIVER_STATUS:
@@ -480,9 +481,12 @@u16 __pad1;/* 14 */ u8 be_mac[6 ];/* 16 */ u16 __pad2;/* 22 */ +u8 fe_dom_name[16 ];/* 24 */ +u16 flags;/* 40 */ +u16 __pad3;/* 42 */ /* OUT */ -u32 status;/* 24 */ -}PACKED netif_be_create_t;/* 28 bytes */ +u32 status;/* 44 */ +}PACKED netif_be_create_t;/* 48 bytes */ /* * CMSG_NETIF_BE_DESTROY:
-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting Tool for open source databases. Create drag-&-drop reports. Save time by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. Download a FREE copy at http://www.intelliview.com/go/osdn_nl
Quoted 6 lines · Jody Belka
Allow (1) the making of both frontend and backend vif MACs read-only (independently), (2) the addition of some xen-specific sysfs attributes on front/back vifs, (3) an option to set several vif defaults in a domain config file, for ease of use when creating multiple vifs.
diffstat:
Quoted 10 lines
linux-2.6.10-xen-sparse/drivers/xen/netback/common.h | 10 + linux-2.6.10-xen-sparse/drivers/xen/netback/interface.c | 121 +++++++++++++++- linux-2.6.10-xen-sparse/drivers/xen/netfront/netfront.c | 73 +++++++++ tools/python/xen/lowlevel/xu/xu.c | 18 ++ tools/python/xen/xend/XendDomainInfo.py | 1 tools/python/xen/xend/server/messages.py | 9 + tools/python/xen/xend/server/netif.py | 62 ++++++++ tools/python/xen/xm/create.py | 91 +++++++++++- xen/include/public/io/domain_controller.h | 10 - 9 files changed, 388 insertions(+), 7 deletions(-)
Note, this patch requires the previous two [3,4] to be present to apply, although only the previous one [4] is required functionality-wise.
J
Signature · 9 lines
Jody Belka knew (at) pimb (dot) org ------------------------------------------------------- This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting Tool for open source databases. Create drag-&-drop reports. Save time by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. Download a FREE copy at http://www.intelliview.com/go/osdn_nl