From 8346b8c38298ca1b858f562ffe20cceb9d54b003 Mon Sep 17 00:00:00 2001 From: glebius Date: Fri, 20 Dec 2013 00:09:14 +0000 Subject: [PATCH] Merge r259541 from stable/10: Merge r256868,257276-257277,257515,257913 from head. These are fixes required to make Xen buildable w/o INET. Approved by: re (delphij) git-svn-id: svn://svn.freebsd.org/base/releng/10.0@259637 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- sys/amd64/conf/NOTES | 6 +++++ sys/dev/xen/netback/netback.c | 11 ++++++-- sys/dev/xen/netback/netback_unit_tests.c | 25 +++++++++++------- sys/dev/xen/netfront/netfront.c | 33 +++++------------------- 4 files changed, 37 insertions(+), 38 deletions(-) diff --git a/sys/amd64/conf/NOTES b/sys/amd64/conf/NOTES index ad010886..f774d266 100644 --- a/sys/amd64/conf/NOTES +++ b/sys/amd64/conf/NOTES @@ -473,6 +473,12 @@ device virtio_blk # VirtIO Block device device virtio_scsi # VirtIO SCSI device device virtio_balloon # VirtIO Memory Balloon device +device hyperv # HyperV drivers + +# Xen HVM Guest Optimizations +options XENHVM # Xen HVM kernel infrastructure +device xenpci # Xen HVM Hypervisor services driver + ##################################################################### # diff --git a/sys/dev/xen/netback/netback.c b/sys/dev/xen/netback/netback.c index 8f0286c3..9287a5bd 100644 --- a/sys/dev/xen/netback/netback.c +++ b/sys/dev/xen/netback/netback.c @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); * from this FreeBSD domain to other domains. */ #include "opt_inet.h" +#include "opt_inet6.h" #include "opt_global.h" #include "opt_sctp.h" @@ -183,7 +184,6 @@ static int xnb_rxpkt2gnttab(const struct xnb_pkt *pkt, static int xnb_rxpkt2rsp(const struct xnb_pkt *pkt, const gnttab_copy_table gnttab, int n_entries, netif_rx_back_ring_t *ring); -static void xnb_add_mbuf_cksum(struct mbuf *mbufc); static void xnb_stop(struct xnb_softc*); static int xnb_ioctl(struct ifnet*, u_long, caddr_t); static void xnb_start_locked(struct ifnet*); @@ -194,6 +194,9 @@ static void xnb_ifinit(void*); static int xnb_unit_test_main(SYSCTL_HANDLER_ARGS); static int xnb_dump_rings(SYSCTL_HANDLER_ARGS); #endif +#if defined(INET) || defined(INET6) +static void xnb_add_mbuf_cksum(struct mbuf *mbufc); +#endif /*------------------------------ Data Structures -----------------------------*/ @@ -1778,7 +1781,9 @@ xnb_update_mbufc(struct mbuf *mbufc, const gnttab_copy_table gnttab, } mbufc->m_pkthdr.len = total_size; +#if defined(INET) || defined(INET6) xnb_add_mbuf_cksum(mbufc); +#endif } /** @@ -2121,6 +2126,7 @@ xnb_rxpkt2rsp(const struct xnb_pkt *pkt, const gnttab_copy_table gnttab, return n_responses; } +#if defined(INET) || defined(INET6) /** * Add IP, TCP, and/or UDP checksums to every mbuf in a chain. The first mbuf * in the chain must start with a struct ether_header. @@ -2175,6 +2181,7 @@ xnb_add_mbuf_cksum(struct mbuf *mbufc) break; } } +#endif /* INET || INET6 */ static void xnb_stop(struct xnb_softc *xnb) @@ -2191,8 +2198,8 @@ static int xnb_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { struct xnb_softc *xnb = ifp->if_softc; -#ifdef INET struct ifreq *ifr = (struct ifreq*) data; +#ifdef INET struct ifaddr *ifa = (struct ifaddr*)data; #endif int error = 0; diff --git a/sys/dev/xen/netback/netback_unit_tests.c b/sys/dev/xen/netback/netback_unit_tests.c index 92e2b68e..390f9f78 100644 --- a/sys/dev/xen/netback/netback_unit_tests.c +++ b/sys/dev/xen/netback/netback_unit_tests.c @@ -104,10 +104,6 @@ struct test_fixture { typedef struct test_fixture test_fixture_t; -static void xnb_fill_eh_and_ip(struct mbuf *m, uint16_t ip_len, - uint16_t ip_id, uint16_t ip_p, - uint16_t ip_off, uint16_t ip_sum); -static void xnb_fill_tcp(struct mbuf *m); static int xnb_get1pkt(struct xnb_pkt *pkt, size_t size, uint16_t flags); static int xnb_unit_test_runner(test_fixture_t const tests[], int ntests, char *buffer, size_t buflen); @@ -163,17 +159,24 @@ static testcase_t xnb_rxpkt2rsp_extra; static testcase_t xnb_rxpkt2rsp_2short; static testcase_t xnb_rxpkt2rsp_2slots; static testcase_t xnb_rxpkt2rsp_copyerror; +static testcase_t xnb_sscanf_llu; +static testcase_t xnb_sscanf_lld; +static testcase_t xnb_sscanf_hhu; +static testcase_t xnb_sscanf_hhd; +static testcase_t xnb_sscanf_hhn; + +#if defined(INET) || defined(INET6) /* TODO: add test cases for xnb_add_mbuf_cksum for IPV6 tcp and udp */ static testcase_t xnb_add_mbuf_cksum_arp; static testcase_t xnb_add_mbuf_cksum_tcp; static testcase_t xnb_add_mbuf_cksum_udp; static testcase_t xnb_add_mbuf_cksum_icmp; static testcase_t xnb_add_mbuf_cksum_tcp_swcksum; -static testcase_t xnb_sscanf_llu; -static testcase_t xnb_sscanf_lld; -static testcase_t xnb_sscanf_hhu; -static testcase_t xnb_sscanf_hhd; -static testcase_t xnb_sscanf_hhn; +static void xnb_fill_eh_and_ip(struct mbuf *m, uint16_t ip_len, + uint16_t ip_id, uint16_t ip_p, + uint16_t ip_off, uint16_t ip_sum); +static void xnb_fill_tcp(struct mbuf *m); +#endif /* INET || INET6 */ /** Private data used by unit tests */ static struct { @@ -307,11 +310,13 @@ xnb_unit_test_main(SYSCTL_HANDLER_ARGS) { {setup_pvt_data, xnb_rxpkt2rsp_2short, teardown_pvt_data}, {setup_pvt_data, xnb_rxpkt2rsp_2slots, teardown_pvt_data}, {setup_pvt_data, xnb_rxpkt2rsp_copyerror, teardown_pvt_data}, +#if defined(INET) || defined(INET6) {null_setup, xnb_add_mbuf_cksum_arp, null_teardown}, {null_setup, xnb_add_mbuf_cksum_icmp, null_teardown}, {null_setup, xnb_add_mbuf_cksum_tcp, null_teardown}, {null_setup, xnb_add_mbuf_cksum_tcp_swcksum, null_teardown}, {null_setup, xnb_add_mbuf_cksum_udp, null_teardown}, +#endif {null_setup, xnb_sscanf_hhd, null_teardown}, {null_setup, xnb_sscanf_hhu, null_teardown}, {null_setup, xnb_sscanf_lld, null_teardown}, @@ -2066,6 +2071,7 @@ xnb_rxpkt2rsp_copyerror(char *buffer, size_t buflen) safe_m_freem(&mbuf); } +#if defined(INET) || defined(INET6) /** * xnb_add_mbuf_cksum on an ARP request packet */ @@ -2430,6 +2436,7 @@ xnb_add_mbuf_cksum_tcp_swcksum(char *buffer, size_t buflen) m_freem(mbufc); } +#endif /* INET || INET6 */ /** * sscanf on unsigned chars diff --git a/sys/dev/xen/netfront/netfront.c b/sys/dev/xen/netfront/netfront.c index f9c72e6f..030cd3f7 100644 --- a/sys/dev/xen/netfront/netfront.c +++ b/sys/dev/xen/netfront/netfront.c @@ -28,6 +28,7 @@ __FBSDID("$FreeBSD$"); #include "opt_inet.h" +#include "opt_inet6.h" #include #include @@ -165,7 +166,6 @@ static int xn_configure_features(struct netfront_info *np); static void xn_watchdog(struct ifnet *); #endif -static void show_device(struct netfront_info *sc); #ifdef notyet static void netfront_closing(device_t dev); #endif @@ -644,8 +644,6 @@ setup_device(device_t dev, struct netfront_info *info) goto fail; } - show_device(info); - return (0); fail: @@ -967,7 +965,7 @@ static void xn_rxeof(struct netfront_info *np) { struct ifnet *ifp; -#if __FreeBSD_version >= 700000 +#if __FreeBSD_version >= 700000 && (defined(INET) || defined(INET6)) struct lro_ctrl *lro = &np->xn_lro; struct lro_entry *queued; #endif @@ -1064,7 +1062,7 @@ xn_rxeof(struct netfront_info *np) * Do we really need to drop the rx lock? */ XN_RX_UNLOCK(np); -#if __FreeBSD_version >= 700000 +#if __FreeBSD_version >= 700000 && (defined(INET) || defined(INET6)) /* Use LRO if possible */ if ((ifp->if_capenable & IFCAP_LRO) == 0 || lro->lro_cnt == 0 || tcp_lro_rx(lro, m, 0)) { @@ -1082,7 +1080,7 @@ xn_rxeof(struct netfront_info *np) np->rx.rsp_cons = i; -#if __FreeBSD_version >= 700000 +#if __FreeBSD_version >= 700000 && (defined(INET) || defined(INET6)) /* * Flush any outstanding LRO work */ @@ -1969,25 +1967,6 @@ network_connect(struct netfront_info *np) return (0); } -static void -show_device(struct netfront_info *sc) -{ -#ifdef DEBUG - if (sc) { - IPRINTK("\n", - sc->xn_ifno, - be_state_name[sc->xn_backend_state], - sc->xn_user_state ? "open" : "closed", - sc->xn_evtchn, - sc->xn_irq, - sc->xn_tx_if, - sc->xn_rx_if); - } else { - IPRINTK("\n"); - } -#endif -} - static void xn_query_features(struct netfront_info *np) { @@ -2024,14 +2003,14 @@ xn_configure_features(struct netfront_info *np) int err; err = 0; -#if __FreeBSD_version >= 700000 +#if __FreeBSD_version >= 700000 && (defined(INET) || defined(INET6)) if ((np->xn_ifp->if_capenable & IFCAP_LRO) != 0) tcp_lro_free(&np->xn_lro); #endif np->xn_ifp->if_capenable = np->xn_ifp->if_capabilities & ~(IFCAP_LRO|IFCAP_TSO4); np->xn_ifp->if_hwassist &= ~CSUM_TSO; -#if __FreeBSD_version >= 700000 +#if __FreeBSD_version >= 700000 && (defined(INET) || defined(INET6)) if (xn_enable_lro && (np->xn_ifp->if_capabilities & IFCAP_LRO) != 0) { err = tcp_lro_init(&np->xn_lro); if (err) { -- 2.45.0