This adds a Netfront device stub. Diff is more for educational purposes at the moment. Perhaps Paul will chip in and help me add flesh to it.
--- sys/arch/amd64/conf/GENERIC | 1 + sys/dev/pv/files.pv | 4 ++++ sys/dev/pv/if_xnf.c | 46 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 sys/dev/pv/if_xnf.c diff --git sys/arch/amd64/conf/GENERIC sys/arch/amd64/conf/GENERIC index a4a87b0..981a8d0 100644 --- sys/arch/amd64/conf/GENERIC +++ sys/arch/amd64/conf/GENERIC @@ -67,10 +67,11 @@ mpbios0 at bios0 ipmi0 at mainbus? disable # IPMI vmt0 at pvbus? # VMware Tools #xen0 at pvbus? # Xen HVM domU +#xnf* at xen? # Xen Netfront option PCIVERBOSE option USBVERBOSE pchb* at pci? # PCI-Host bridges diff --git sys/dev/pv/files.pv sys/dev/pv/files.pv index 461ea08..a4b1789 100644 --- sys/dev/pv/files.pv +++ sys/dev/pv/files.pv @@ -16,5 +16,9 @@ file dev/pv/vmt.c vmt needs-flag # Xen device xen {} attach xen at pvbus file dev/pv/xen.c xen needs-flag file dev/pv/xenstore.c xen + +device xnf: ether, ifnet, ifmedia +attach xnf at xen +file dev/pv/if_xnf.c xnf diff --git sys/dev/pv/if_xnf.c sys/dev/pv/if_xnf.c new file mode 100644 index 0000000..d2d31c6 --- /dev/null +++ sys/dev/pv/if_xnf.c @@ -0,0 +1,46 @@ +#include <sys/param.h> +#include <sys/systm.h> +#include <sys/atomic.h> +#include <sys/malloc.h> +#include <sys/kernel.h> +#include <sys/device.h> + +#include <uvm/uvm_extern.h> + +#include <dev/pv/xenreg.h> +#include <dev/pv/xenvar.h> + +struct xnf_softc { + struct device sc_dev; +}; + +int xnf_match(struct device *, void *, void *); +void xnf_attach(struct device *, struct device *, void *); + + +struct cfdriver xnf_cd = { + NULL, "xnf", DV_IFNET +}; + +struct cfattach xnf_ca = { + sizeof(struct xnf_softc), xnf_match, xnf_attach +}; + +int +xnf_match(struct device *parent, void *match, void *aux) +{ + struct xen_attach_args *xa = aux; + + if (strcmp("vif", xa->xa_name)) + return (0); + + return (1); +} + +void +xnf_attach(struct device *parent, struct device *self, void *aux) +{ + struct xen_attach_args *xa = aux; + + printf(": \"%s\"\n", xa->xa_node); +} -- 2.6.3