netback: change xnb naming convention
Current FreeBSD netback names the interface with xnb<device unit>, but this is not suitable for usage with the Xen toolstack, which expects something similar to <prefix><domid><handle>. In order to solve this, change the netback naming convention to use xnb<domid>.<handle>. Sponsored by: Citrix Systems R&D dev/xen/netback/netback.c: - Change netback to use the nomenclature stated above.
This commit is contained in:
parent
919b7d8b7c
commit
72ff21680d
@ -511,6 +511,9 @@ struct xnb_softc {
|
||||
|
||||
/** The size of the global kva pool. */
|
||||
int kva_size;
|
||||
|
||||
/** Name of the interface */
|
||||
char if_name[IFNAMSIZ];
|
||||
};
|
||||
|
||||
/*---------------------------- Debugging functions ---------------------------*/
|
||||
@ -1201,6 +1204,7 @@ create_netdev(device_t dev)
|
||||
struct ifnet *ifp;
|
||||
struct xnb_softc *xnb;
|
||||
int err = 0;
|
||||
uint32_t handle;
|
||||
|
||||
xnb = device_get_softc(dev);
|
||||
mtx_init(&xnb->sc_lock, "xnb_softc", "xen netback softc lock", MTX_DEF);
|
||||
@ -1225,11 +1229,24 @@ create_netdev(device_t dev)
|
||||
*/
|
||||
bzero(&xnb->mac[0], sizeof(xnb->mac));
|
||||
|
||||
/* The interface will be named using the following nomenclature:
|
||||
*
|
||||
* xnb<domid>.<handle>
|
||||
*
|
||||
* Where handle is the oder of the interface referred to the guest.
|
||||
*/
|
||||
err = xs_scanf(XST_NIL, xenbus_get_node(xnb->dev), "handle", NULL,
|
||||
"%" PRIu32, &handle);
|
||||
if (err != 0)
|
||||
return (err);
|
||||
snprintf(xnb->if_name, IFNAMSIZ, "xnb%" PRIu16 ".%" PRIu32,
|
||||
xenbus_get_otherend_id(dev), handle);
|
||||
|
||||
if (err == 0) {
|
||||
/* Set up ifnet structure */
|
||||
ifp = xnb->xnb_ifp = if_alloc(IFT_ETHER);
|
||||
ifp->if_softc = xnb;
|
||||
if_initname(ifp, "xnb", device_get_unit(dev));
|
||||
if_initname(ifp, xnb->if_name, IF_DUNIT_NONE);
|
||||
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
|
||||
ifp->if_ioctl = xnb_ioctl;
|
||||
ifp->if_output = ether_output;
|
||||
|
Loading…
Reference in New Issue
Block a user