From owner-svn-src-all@FreeBSD.ORG Wed Oct 22 17:09:13 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 68DD932F; Wed, 22 Oct 2014 17:09:13 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3BF3F6A7; Wed, 22 Oct 2014 17:09:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9MH9DX7060189; Wed, 22 Oct 2014 17:09:13 GMT (envelope-from royger@FreeBSD.org) Received: (from royger@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9MH9DWc060188; Wed, 22 Oct 2014 17:09:13 GMT (envelope-from royger@FreeBSD.org) Message-Id: <201410221709.s9MH9DWc060188@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: royger set sender to royger@FreeBSD.org using -f From: Roger Pau Monné Date: Wed, 22 Oct 2014 17:09:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273477 - head/sys/dev/xen/netback X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 17:09:13 -0000 Author: royger Date: Wed Oct 22 17:09:12 2014 New Revision: 273477 URL: https://svnweb.freebsd.org/changeset/base/273477 Log: netback: change xnb naming convention Current FreeBSD netback names the interface with xnb, but this is not suitable for usage with the Xen toolstack, which expects something similar to . In order to solve this, change the netback naming convention to use xnb.. Sponsored by: Citrix Systems R&D dev/xen/netback/netback.c: - Change netback to use the nomenclature stated above. Modified: head/sys/dev/xen/netback/netback.c Modified: head/sys/dev/xen/netback/netback.c ============================================================================== --- head/sys/dev/xen/netback/netback.c Wed Oct 22 17:07:20 2014 (r273476) +++ head/sys/dev/xen/netback/netback.c Wed Oct 22 17:09:12 2014 (r273477) @@ -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. + * + * 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;