Re: svn commit: r326383 - head/sys/x86/cpufreq
On Fri, Dec 8, 2017 at 6:23 AM, Andriy Gaponwrote: > On 07/12/2017 12:03, Alexey Dokuchaev wrote: >> On Thu, Nov 30, 2017 at 03:08:49PM -0500, Jung-uk Kim wrote: >>> ... >>> Probably. However, I am just trying to fix my FX-8350 and A10-6800 and >>> I don't have Zen processors to verify the MSRs are actually working on >>> those CPUs. >> >> Ah, that's so lovely, thanks Jung-uk; I feel that our support for AMD >> fam. 15h CPUs is lacking. E.g. only four P-states are reported for my >> A8-5550M, while it supports boosted P-states per BKDG, and reading MSRs >> directly via `sysutils/amdmsrtweaker' reports eight of them (P0 .. P7), >> with three turbo P-states P0 P1 P2. >> >> Since you have A10-6800 you might try to reproduce what I see here with >> A8-5550M. > > I think that the boosted states are supposed to be hidden from the OS. > It may be possible to query them though hardware specific registers, but they > can not be set by software directly anyway. For most of the modern Intel CPUs, boosted state is _not_ hidden from OS, it normally shows as max_freq+1, e.g. if max_freq is 3400, then the boosted state will have freq 3401. > My impression is that the proper way to observe the boost states is via APERF > / > MPERF MSRs. They are useful for other things, e.g. C0 residency, too. Yeah, that's the only way to observe the current frequency of the cpu; on most of the modern Intel CPUs, P-state just sets the frequency upper limit. Thanks, sephe ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r324519 - head/sys/net
Author: sephe Date: Wed Oct 11 06:08:01 2017 New Revision: 324519 URL: https://svnweb.freebsd.org/changeset/base/324519 Log: rss: Remove never defined UDP_IPV4_EX Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D12455 Modified: head/sys/net/rss_config.c head/sys/net/rss_config.h Modified: head/sys/net/rss_config.c == --- head/sys/net/rss_config.c Wed Oct 11 05:55:52 2017(r324518) +++ head/sys/net/rss_config.c Wed Oct 11 06:08:01 2017(r324519) @@ -489,7 +489,6 @@ rss_gethashconfig(void) |RSS_HASHTYPE_RSS_TCP_IPV6_EX #if 0 |RSS_HASHTYPE_RSS_UDP_IPV4 - |RSS_HASHTYPE_RSS_UDP_IPV4_EX |RSS_HASHTYPE_RSS_UDP_IPV6 |RSS_HASHTYPE_RSS_UDP_IPV6_EX #endif Modified: head/sys/net/rss_config.h == --- head/sys/net/rss_config.h Wed Oct 11 05:55:52 2017(r324518) +++ head/sys/net/rss_config.h Wed Oct 11 06:08:01 2017(r324519) @@ -66,7 +66,6 @@ #defineRSS_HASHTYPE_RSS_IPV6_EX(1 << 5)/* IPv6 2-tuple + ext hdrs */ #defineRSS_HASHTYPE_RSS_TCP_IPV6_EX(1 << 6)/* TCPv6 4-tiple + ext hdrs */ #defineRSS_HASHTYPE_RSS_UDP_IPV4 (1 << 7)/* IPv4 UDP 4-tuple */ -#defineRSS_HASHTYPE_RSS_UDP_IPV4_EX(1 << 8)/* IPv4 UDP 4-tuple + ext hdrs */ #defineRSS_HASHTYPE_RSS_UDP_IPV6 (1 << 9)/* IPv6 UDP 4-tuple */ #defineRSS_HASHTYPE_RSS_UDP_IPV6_EX(1 << 10) /* IPv6 UDP 4-tuple + ext hdrs */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r324518 - head/sys/dev/ixgbe
Author: sephe Date: Wed Oct 11 05:55:52 2017 New Revision: 324518 URL: https://svnweb.freebsd.org/changeset/base/324518 Log: ixgbe: Remove never defined UDP_IPV4_EX Reviewed by: sbruno Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D12454 Modified: head/sys/dev/ixgbe/if_ix.c head/sys/dev/ixgbe/if_ixv.c head/sys/dev/ixgbe/ixgbe_rss.h Modified: head/sys/dev/ixgbe/if_ix.c == --- head/sys/dev/ixgbe/if_ix.c Wed Oct 11 05:28:51 2017(r324517) +++ head/sys/dev/ixgbe/if_ix.c Wed Oct 11 05:55:52 2017(r324518) @@ -469,9 +469,6 @@ ixgbe_initialize_rss_mapping(struct adapter *adapter) mrqc |= IXGBE_MRQC_RSS_FIELD_IPV6_EX_TCP; if (rss_hash_config & RSS_HASHTYPE_RSS_UDP_IPV4) mrqc |= IXGBE_MRQC_RSS_FIELD_IPV4_UDP; - if (rss_hash_config & RSS_HASHTYPE_RSS_UDP_IPV4_EX) - device_printf(adapter->dev, "%s: RSS_HASHTYPE_RSS_UDP_IPV4_EX defined, but not supported\n", - __func__); if (rss_hash_config & RSS_HASHTYPE_RSS_UDP_IPV6) mrqc |= IXGBE_MRQC_RSS_FIELD_IPV6_UDP; if (rss_hash_config & RSS_HASHTYPE_RSS_UDP_IPV6_EX) Modified: head/sys/dev/ixgbe/if_ixv.c == --- head/sys/dev/ixgbe/if_ixv.c Wed Oct 11 05:28:51 2017(r324517) +++ head/sys/dev/ixgbe/if_ixv.c Wed Oct 11 05:55:52 2017(r324518) @@ -1403,9 +1403,6 @@ ixv_initialize_rss_mapping(struct adapter *adapter) __func__); if (rss_hash_config & RSS_HASHTYPE_RSS_UDP_IPV4) mrqc |= IXGBE_MRQC_RSS_FIELD_IPV4_UDP; - if (rss_hash_config & RSS_HASHTYPE_RSS_UDP_IPV4_EX) - device_printf(adapter->dev, "%s: RSS_HASHTYPE_RSS_UDP_IPV4_EX defined, but not supported\n", - __func__); if (rss_hash_config & RSS_HASHTYPE_RSS_UDP_IPV6) mrqc |= IXGBE_MRQC_RSS_FIELD_IPV6_UDP; if (rss_hash_config & RSS_HASHTYPE_RSS_UDP_IPV6_EX) Modified: head/sys/dev/ixgbe/ixgbe_rss.h == --- head/sys/dev/ixgbe/ixgbe_rss.h Wed Oct 11 05:28:51 2017 (r324517) +++ head/sys/dev/ixgbe/ixgbe_rss.h Wed Oct 11 05:55:52 2017 (r324518) @@ -49,7 +49,6 @@ #define RSS_HASHTYPE_RSS_IPV6_EX (1 << 5) #define RSS_HASHTYPE_RSS_TCP_IPV6_EX (1 << 6) #define RSS_HASHTYPE_RSS_UDP_IPV4 (1 << 7) -#define RSS_HASHTYPE_RSS_UDP_IPV4_EX (1 << 8) #define RSS_HASHTYPE_RSS_UDP_IPV6 (1 << 9) #define RSS_HASHTYPE_RSS_UDP_IPV6_EX (1 << 10) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r324517 - head/sys/dev/hyperv/netvsc
Author: sephe Date: Wed Oct 11 05:28:51 2017 New Revision: 324517 URL: https://svnweb.freebsd.org/changeset/base/324517 Log: hyperv/hn: Enable transparent VF by default. MFC after:3 days Sponsored by: Microsoft Modified: head/sys/dev/hyperv/netvsc/if_hn.c Modified: head/sys/dev/hyperv/netvsc/if_hn.c == --- head/sys/dev/hyperv/netvsc/if_hn.c Wed Oct 11 05:15:49 2017 (r324516) +++ head/sys/dev/hyperv/netvsc/if_hn.c Wed Oct 11 05:28:51 2017 (r324517) @@ -584,7 +584,7 @@ SYSCTL_PROC(_hw_hn, OID_AUTO, vfmap, CTLFLAG_RD | CTLT 0, 0, hn_vfmap_sysctl, "A", "VF mapping"); /* Transparent VF */ -static int hn_xpnt_vf = 0; +static int hn_xpnt_vf = 1; SYSCTL_INT(_hw_hn, OID_AUTO, vf_transparent, CTLFLAG_RDTUN, _xpnt_vf, 0, "Transparent VF mod"); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r324516 - head/sys/dev/hyperv/netvsc
Author: sephe Date: Wed Oct 11 05:15:49 2017 New Revision: 324516 URL: https://svnweb.freebsd.org/changeset/base/324516 Log: hyperv/hn: Workaround erroneous hash type observed on WS2016 for VF. The background was described in r324489. MFC after:3 days Sponsored by: Microsoft Modified: head/sys/dev/hyperv/netvsc/hn_rndis.c head/sys/dev/hyperv/netvsc/if_hn.c head/sys/dev/hyperv/netvsc/ndis.h Modified: head/sys/dev/hyperv/netvsc/hn_rndis.c == --- head/sys/dev/hyperv/netvsc/hn_rndis.c Wed Oct 11 05:07:37 2017 (r324515) +++ head/sys/dev/hyperv/netvsc/hn_rndis.c Wed Oct 11 05:15:49 2017 (r324516) @@ -521,6 +521,10 @@ hn_rndis_query_rsscaps(struct hn_softc *sc, int *rxr_c /* Commit! */ sc->hn_rss_ind_size = indsz; sc->hn_rss_hcap = hash_func | hash_types; + if (sc->hn_caps & HN_CAP_UDPHASH) { + /* UDP 4-tuple hash is unconditionally enabled. */ + sc->hn_rss_hcap |= NDIS_HASH_UDP_IPV4_X; + } *rxr_cnt0 = rxr_cnt; return (0); } @@ -760,8 +764,10 @@ hn_rndis_conf_rss(struct hn_softc *sc, uint16_t flags) ("NDIS 6.20+ is required, NDIS version 0x%08x", sc->hn_ndis_ver)); /* XXX only one can be specified through, popcnt? */ - KASSERT((sc->hn_rss_hash & NDIS_HASH_FUNCTION_MASK), ("no hash func")); - KASSERT((sc->hn_rss_hash & NDIS_HASH_TYPE_MASK), ("no hash types")); + KASSERT((sc->hn_rss_hash & NDIS_HASH_FUNCTION_MASK), + ("no hash func %08x", sc->hn_rss_hash)); + KASSERT((sc->hn_rss_hash & NDIS_HASH_STD), + ("no standard hash types %08x", sc->hn_rss_hash)); KASSERT(sc->hn_rss_ind_size > 0, ("no indirect table size")); if (bootverbose) { @@ -780,7 +786,8 @@ hn_rndis_conf_rss(struct hn_softc *sc, uint16_t flags) prm->ndis_hdr.ndis_rev = NDIS_RSS_PARAMS_REV_2; prm->ndis_hdr.ndis_size = rss_size; prm->ndis_flags = flags; - prm->ndis_hash = sc->hn_rss_hash; + prm->ndis_hash = sc->hn_rss_hash & + (NDIS_HASH_FUNCTION_MASK | NDIS_HASH_STD); prm->ndis_indsize = sizeof(rss->rss_ind[0]) * sc->hn_rss_ind_size; prm->ndis_indoffset = __offsetof(struct ndis_rssprm_toeplitz, rss_ind[0]); Modified: head/sys/dev/hyperv/netvsc/if_hn.c == --- head/sys/dev/hyperv/netvsc/if_hn.c Wed Oct 11 05:07:37 2017 (r324515) +++ head/sys/dev/hyperv/netvsc/if_hn.c Wed Oct 11 05:15:49 2017 (r324516) @@ -1424,6 +1424,8 @@ hn_rss_type_fromndis(uint32_t rss_hash) types |= RSS_TYPE_TCP_IPV6; if (rss_hash & NDIS_HASH_TCP_IPV6_EX) types |= RSS_TYPE_TCP_IPV6_EX; + if (rss_hash & NDIS_HASH_UDP_IPV4_X) + types |= RSS_TYPE_UDP_IPV4; return (types); } @@ -1432,9 +1434,8 @@ hn_rss_type_tondis(uint32_t types) { uint32_t rss_hash = 0; - KASSERT((types & - (RSS_TYPE_UDP_IPV4 | RSS_TYPE_UDP_IPV6 | RSS_TYPE_UDP_IPV6_EX)) == 0, - ("UDP4, UDP6 and UDP6EX are not supported")); + KASSERT((types & (RSS_TYPE_UDP_IPV6 | RSS_TYPE_UDP_IPV6_EX)) == 0, + ("UDP6 and UDP6EX are not supported")); if (types & RSS_TYPE_IPV4) rss_hash |= NDIS_HASH_IPV4; @@ -1448,6 +1449,8 @@ hn_rss_type_tondis(uint32_t types) rss_hash |= NDIS_HASH_TCP_IPV6; if (types & RSS_TYPE_TCP_IPV6_EX) rss_hash |= NDIS_HASH_TCP_IPV6_EX; + if (types & RSS_TYPE_UDP_IPV4) + rss_hash |= NDIS_HASH_UDP_IPV4_X; return (rss_hash); } @@ -1546,6 +1549,13 @@ hn_vf_rss_fixup(struct hn_softc *sc, bool reconf) * NOTE: * We don't disable the hash type, but stop delivery the hash * value/type through mbufs on RX path. +* +* XXX If HN_CAP_UDPHASH is set in hn_caps, then UDP 4-tuple +* hash is delivered with type of TCP_IPV4. This means if +* UDP_IPV4 is enabled, then TCP_IPV4 should be forced, at +* least to hn_mbuf_hash. However, given that _all_ of the +* NICs implement TCP_IPV4, this will _not_ impose any issues +* here. */ if ((my_types & RSS_TYPE_IPV4) && (diff_types & ifrh.ifrh_types & @@ -3582,7 +3592,9 @@ hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int , ); } if (l3proto == ETHERTYPE_IP) { - if (l4proto == IPPROTO_UDP) { + if (l4proto == IPPROTO_UDP && + (rxr->hn_mbuf_hash & +NDIS_HASH_UDP_IPV4_X)) {
svn commit: r324489 - head/sys/dev/hyperv/netvsc
Author: sephe Date: Tue Oct 10 08:32:03 2017 New Revision: 324489 URL: https://svnweb.freebsd.org/changeset/base/324489 Log: hyperv/hn: Workaround erroneous hash type observed on WS2016. Background: - UDP 4-tuple hash type is unconditionally enabled in Hyper-V on WS2016, which is _not_ affected by NDIS_OBJTYPE_RSS_PARAMS. - Non-fragment UDP/IPv4 datagrams' hash type is delivered to VM as TCP_IPV4. Currently this erroneous behavior only applies to WS2016/Windows10. Force l3/l4 protocol check, if the RXed packet's hash type is TCP_IPV4, and the Hyper-V is running on WS2016/Windows10. If the RXed packet is UDP datagram, adjust mbuf hash type to UDP_IPV4. MFC after:3 days Sponsored by: Microsoft Modified: head/sys/dev/hyperv/netvsc/hn_nvs.c head/sys/dev/hyperv/netvsc/if_hn.c head/sys/dev/hyperv/netvsc/if_hnvar.h Modified: head/sys/dev/hyperv/netvsc/hn_nvs.c == --- head/sys/dev/hyperv/netvsc/hn_nvs.c Tue Oct 10 08:23:19 2017 (r324488) +++ head/sys/dev/hyperv/netvsc/hn_nvs.c Tue Oct 10 08:32:03 2017 (r324489) @@ -601,6 +601,11 @@ hn_nvs_attach(struct hn_softc *sc, int mtu) { int error; + if (hyperv_ver_major >= 10) { + /* UDP 4-tuple hash is enforced. */ + sc->hn_caps |= HN_CAP_UDPHASH; + } + /* * Initialize NVS. */ Modified: head/sys/dev/hyperv/netvsc/if_hn.c == --- head/sys/dev/hyperv/netvsc/if_hn.c Tue Oct 10 08:23:19 2017 (r324488) +++ head/sys/dev/hyperv/netvsc/if_hn.c Tue Oct 10 08:32:03 2017 (r324489) @@ -385,6 +385,7 @@ static void hn_link_status(struct hn_softc *); static int hn_create_rx_data(struct hn_softc *, int); static voidhn_destroy_rx_data(struct hn_softc *); static int hn_check_iplen(const struct mbuf *, int); +static voidhn_rxpkt_proto(const struct mbuf *, int *, int *); static int hn_set_rxfilter(struct hn_softc *, uint32_t); static int hn_rxfilter_config(struct hn_softc *); static int hn_rss_reconfig(struct hn_softc *); @@ -399,6 +400,7 @@ static int hn_tx_ring_create(struct hn_softc *, int) static voidhn_tx_ring_destroy(struct hn_tx_ring *); static int hn_create_tx_data(struct hn_softc *, int); static voidhn_fixup_tx_data(struct hn_softc *); +static voidhn_fixup_rx_data(struct hn_softc *); static voidhn_destroy_tx_data(struct hn_softc *); static voidhn_txdesc_dmamap_destroy(struct hn_txdesc *); static voidhn_txdesc_gc(struct hn_tx_ring *, @@ -2238,9 +2240,10 @@ hn_attach(device_t dev) #endif /* -* Fixup TX stuffs after synthetic parts are attached. +* Fixup TX/RX stuffs after synthetic parts are attached. */ hn_fixup_tx_data(sc); + hn_fixup_rx_data(sc); ctx = device_get_sysctl_ctx(dev); child = SYSCTL_CHILDREN(device_get_sysctl_tree(dev)); @@ -3378,6 +3381,7 @@ hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int struct mbuf *m_new; int size, do_lro = 0, do_csum = 1, is_vf = 0; int hash_type = M_HASHTYPE_NONE; + int l3proto = ETHERTYPE_MAX, l4proto = IPPROTO_DONE; ifp = hn_ifp; if (rxr->hn_rxvf_ifp != NULL) { @@ -3477,31 +3481,9 @@ hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int (NDIS_RXCSUM_INFO_TCPCS_OK | NDIS_RXCSUM_INFO_IPCS_OK)) do_lro = 1; } else { - const struct ether_header *eh; - uint16_t etype; - int hoff; - - hoff = sizeof(*eh); - /* Checked at the beginning of this function. */ - KASSERT(m_new->m_len >= hoff, ("not ethernet frame")); - - eh = mtod(m_new, struct ether_header *); - etype = ntohs(eh->ether_type); - if (etype == ETHERTYPE_VLAN) { - const struct ether_vlan_header *evl; - - hoff = sizeof(*evl); - if (m_new->m_len < hoff) - goto skip; - evl = mtod(m_new, struct ether_vlan_header *); - etype = ntohs(evl->evl_proto); - } - - if (etype == ETHERTYPE_IP) { - int pr; - - pr = hn_check_iplen(m_new, hoff); - if (pr == IPPROTO_TCP) { + hn_rxpkt_proto(m_new, , ); + if (l3proto == ETHERTYPE_IP) { + if (l4proto == IPPROTO_TCP) { if
svn commit: r324488 - in head/sys/dev/hyperv: include vmbus
Author: sephe Date: Tue Oct 10 08:23:19 2017 New Revision: 324488 URL: https://svnweb.freebsd.org/changeset/base/324488 Log: hyperv/vmbus: Expose Hyper-V major version. MFC after:3 days Sponsored by: Microsoft Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/vmbus/hyperv.c Modified: head/sys/dev/hyperv/include/hyperv.h == --- head/sys/dev/hyperv/include/hyperv.hTue Oct 10 08:16:55 2017 (r324487) +++ head/sys/dev/hyperv/include/hyperv.hTue Oct 10 08:23:19 2017 (r324488) @@ -90,6 +90,7 @@ int hyperv_guid2str(const struct hyperv_guid *, char */ extern hyperv_tc64_t hyperv_tc64; extern u_int hyperv_features;/* CPUID_HV_MSR_ */ +extern u_int hyperv_ver_major; #endif /* _KERNEL */ Modified: head/sys/dev/hyperv/vmbus/hyperv.c == --- head/sys/dev/hyperv/vmbus/hyperv.c Tue Oct 10 08:16:55 2017 (r324487) +++ head/sys/dev/hyperv/vmbus/hyperv.c Tue Oct 10 08:23:19 2017 (r324488) @@ -77,6 +77,8 @@ static u_int hyperv_get_timecount(struct timecounter static boolhyperv_identify(void); static voidhypercall_memfree(void); +u_int hyperv_ver_major; + u_int hyperv_features; u_int hyperv_recommends; @@ -169,8 +171,9 @@ hyperv_identify(void) hyperv_features3 = regs[3]; do_cpuid(CPUID_LEAF_HV_IDENTITY, regs); + hyperv_ver_major = regs[1] >> 16; printf("Hyper-V Version: %d.%d.%d [SP%d]\n", - regs[1] >> 16, regs[1] & 0x, regs[0], regs[2]); + hyperv_ver_major, regs[1] & 0x, regs[0], regs[2]); printf(" Features=0x%b\n", hyperv_features, "\020" ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r324487 - head/sys/dev/hyperv/vmbus
Author: sephe Date: Tue Oct 10 08:16:55 2017 New Revision: 324487 URL: https://svnweb.freebsd.org/changeset/base/324487 Log: hyperv/vmbus: Add tunable to pin/unpin event tasks. Event tasks are pinned to their respective CPU by default, in the same fashion as they were. Unpin the event tasks by setting hw.vmbus.pin_evttask to 0, if certain CPUs serve special purpose. MFC after:3 days Sponsored by: Microsoft Modified: head/sys/dev/hyperv/vmbus/vmbus.c Modified: head/sys/dev/hyperv/vmbus/vmbus.c == --- head/sys/dev/hyperv/vmbus/vmbus.c Tue Oct 10 08:07:05 2017 (r324486) +++ head/sys/dev/hyperv/vmbus/vmbus.c Tue Oct 10 08:16:55 2017 (r324487) @@ -128,6 +128,13 @@ static void vmbus_event_proc_dummy(struct vmbus_soft static struct vmbus_softc *vmbus_sc; +SYSCTL_NODE(_hw, OID_AUTO, vmbus, CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, +"Hyper-V vmbus"); + +static int vmbus_pin_evttask = 1; +SYSCTL_INT(_hw_vmbus, OID_AUTO, pin_evttask, CTLFLAG_RDTUN, +_pin_evttask, 0, "Pin event tasks to their respective CPU"); + extern inthand_t IDTVEC(vmbus_isr); static const uint32_t vmbus_version[] = { @@ -905,10 +912,16 @@ vmbus_intr_setup(struct vmbus_softc *sc) VMBUS_PCPU_GET(sc, event_tq, cpu) = taskqueue_create_fast( "hyperv event", M_WAITOK, taskqueue_thread_enqueue, VMBUS_PCPU_PTR(sc, event_tq, cpu)); - CPU_SETOF(cpu, _mask); - taskqueue_start_threads_cpuset( - VMBUS_PCPU_PTR(sc, event_tq, cpu), 1, PI_NET, _mask, - "hvevent%d", cpu); + if (vmbus_pin_evttask) { + CPU_SETOF(cpu, _mask); + taskqueue_start_threads_cpuset( + VMBUS_PCPU_PTR(sc, event_tq, cpu), 1, PI_NET, + _mask, "hvevent%d", cpu); + } else { + taskqueue_start_threads( + VMBUS_PCPU_PTR(sc, event_tq, cpu), 1, PI_NET, + "hvevent%d", cpu); + } /* * Setup tasks and taskqueues to handle messages. ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r324316 - head/sys/dev/hyperv/netvsc
Author: sephe Date: Thu Oct 5 13:22:14 2017 New Revision: 324316 URL: https://svnweb.freebsd.org/changeset/base/324316 Log: hyperv/hn: Fix options RSS building Reported by: np MFC after:1 week Sponsored by: Microsoft Modified: head/sys/dev/hyperv/netvsc/if_hn.c Modified: head/sys/dev/hyperv/netvsc/if_hn.c == --- head/sys/dev/hyperv/netvsc/if_hn.c Thu Oct 5 13:12:59 2017 (r324315) +++ head/sys/dev/hyperv/netvsc/if_hn.c Thu Oct 5 13:22:14 2017 (r324316) @@ -387,9 +387,7 @@ static void hn_destroy_rx_data(struct hn_softc *); static int hn_check_iplen(const struct mbuf *, int); static int hn_set_rxfilter(struct hn_softc *, uint32_t); static int hn_rxfilter_config(struct hn_softc *); -#ifndef RSS static int hn_rss_reconfig(struct hn_softc *); -#endif static voidhn_rss_ind_fixup(struct hn_softc *); static voidhn_rss_mbuf_hash(struct hn_softc *, uint32_t); static int hn_rxpkt(struct hn_rx_ring *, const void *, @@ -1025,7 +1023,6 @@ hn_get_txswq_depth(const struct hn_tx_ring *txr) return hn_tx_swq_depth; } -#ifndef RSS static int hn_rss_reconfig(struct hn_softc *sc) { @@ -1064,7 +1061,6 @@ hn_rss_reconfig(struct hn_softc *sc) } return (0); } -#endif /* !RSS */ static void hn_rss_ind_fixup(struct hn_softc *sc) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r324077 - head/sys/dev/hyperv/netvsc
Author: sephe Date: Thu Sep 28 07:02:56 2017 New Revision: 324077 URL: https://svnweb.freebsd.org/changeset/base/324077 Log: hyperv/hn: Unbreak i386 building. Reported by: cy MFC after:1 week Sponsored by: Microsoft Modified: head/sys/dev/hyperv/netvsc/if_hn.c Modified: head/sys/dev/hyperv/netvsc/if_hn.c == --- head/sys/dev/hyperv/netvsc/if_hn.c Thu Sep 28 05:20:37 2017 (r324076) +++ head/sys/dev/hyperv/netvsc/if_hn.c Thu Sep 28 07:02:56 2017 (r324077) @@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$"); #include "opt_rss.h" #include +#include #include #include #include @@ -77,7 +78,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r324049 - head/sys/dev/hyperv/netvsc
Thanks, I am doing a test building. I am planning to drop the Hyper-V on i386, which is never officially supported. On Thu, Sep 28, 2017 at 2:08 PM, Cy Schubert <cy.schub...@komquats.com> wrote: > In message <201709270544.v8r5io50067...@repo.freebsd.org>, Sepherosa Ziehau > wri > tes: >> Author: sephe >> Date: Wed Sep 27 05:44:50 2017 >> New Revision: 324049 >> URL: https://svnweb.freebsd.org/changeset/base/324049 >> >> Log: >> hyperv/hn: Fix UDP checksum offload issue in Azure. >> >> UDP checksum offload does not work in Azure if following conditions are >> met: >> - sizeof(IP hdr + UDP hdr + payload) > 1420. >> - IP_DF is not set in IP hdr >> >> Use software checksum for UDP datagrams falling into this category. >> >> Add two tunables to disable UDP/IPv4 and UDP/IPv6 checksum offload, in >> case something unexpected happened. >> >> MFC after: 1 week >> Sponsored by: Microsoft >> Differential Revision: https://reviews.freebsd.org/D12429 >> >> Modified: >> head/sys/dev/hyperv/netvsc/if_hn.c >> >> Modified: head/sys/dev/hyperv/netvsc/if_hn.c >> = >> = >> --- head/sys/dev/hyperv/netvsc/if_hn.cWed Sep 27 04:42:40 2017 >> (r324048) >> +++ head/sys/dev/hyperv/netvsc/if_hn.cWed Sep 27 05:44:50 2017 >> (r324049) >> @@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$"); >> >> #include >> #include >> +#include > > Shouldn't this go after the #include ? > > Found in tinderbox: > > i386 GENERIC-NODEBUG kernel failed, check _.i386.GENERIC-NODEBUG for details > > In _.i386.GENERIC-NODEBUG: > > In file included from /home/cy/current/sys/dev/hyperv/netvsc/if_hn.c:65: > In file included from /home/cy/current/sys/sys/counter.h:35: > ./machine/counter.h:172:3: error: implicit declaration of function > 'critical_ent > er' is invalid in C99 [-Werror,-Wimplicit-function-declaration] > critical_enter(); > ^ > WARNING: ctfconvert: enum pmc_event has too many values: 2629 > 1023 > ./machine/counter.h:172:3: error: this function declaration is not a > prototype [ > -Werror,-Wstrict-prototypes] > ./machine/counter.h:174:3: error: implicit declaration of function > 'critical_exi > t' is invalid in C99 [-Werror,-Wimplicit-function-declaration] > critical_exit(); > > >> #include >> #include >> #include > > > > -- > Cheers, > Cy Schubert <cy.schub...@cschubert.com> > FreeBSD UNIX: <c...@freebsd.org> Web: http://www.FreeBSD.org > > The need of the many outweighs the greed of the few. > > > -- Tomorrow Will Never Die ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r324053 - head/sys/sys
Author: sephe Date: Wed Sep 27 06:33:55 2017 New Revision: 324053 URL: https://svnweb.freebsd.org/changeset/base/324053 Log: kernel: Bump __FreeBSD_version for the removal of M_HASHTYPE_RSS_UDP_IPV4_EX Sponsored by: Microsoft Modified: head/sys/sys/param.h Modified: head/sys/sys/param.h == --- head/sys/sys/param.hWed Sep 27 06:31:35 2017(r324052) +++ head/sys/sys/param.hWed Sep 27 06:33:55 2017(r324053) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1200046 /* Master, propagated to newvers */ +#define __FreeBSD_version 1200047 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r324052 - head/sys/sys
Author: sephe Date: Wed Sep 27 06:31:35 2017 New Revision: 324052 URL: https://svnweb.freebsd.org/changeset/base/324052 Log: mbuf: Remove UDP_IPV4_EX, which was never defined. Add comment to explain the IPV6_EX suffix. The confusion about these RSS hash type probably stems from the facts that they were never widely implemented by hardwares. Reviewed by: rwatson Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D12453 Modified: head/sys/sys/mbuf.h Modified: head/sys/sys/mbuf.h == --- head/sys/sys/mbuf.h Wed Sep 27 05:59:54 2017(r324051) +++ head/sys/sys/mbuf.h Wed Sep 27 06:31:35 2017(r324052) @@ -335,6 +335,16 @@ struct mbuf { * for ordering and distribution without explicit affinity. Additionally, * M_HASHTYPE_OPAQUE_HASH indicates that the flow identifier has hash * properties. + * + * The meaning of the IPV6_EX suffix: + * "o Home address from the home address option in the IPv6 destination + * options header. If the extension header is not present, use the Source + * IPv6 Address. + * o IPv6 address that is contained in the Routing-Header-Type-2 from the + * associated extension header. If the extension header is not present, + * use the Destination IPv6 Address." + * Quoted from: + * https://docs.microsoft.com/en-us/windows-hardware/drivers/network/rss-hashing-types#ndishashipv6ex */ #defineM_HASHTYPE_HASHPROP 0x80/* has hash properties */ #defineM_HASHTYPE_HASH(t) (M_HASHTYPE_HASHPROP | (t)) @@ -348,10 +358,7 @@ struct mbuf { * ext hdrs */ #defineM_HASHTYPE_RSS_TCP_IPV6_EX M_HASHTYPE_HASH(6) /* TCPv6 4-tuple + * ext hdrs */ -/* Non-standard RSS hash types */ #defineM_HASHTYPE_RSS_UDP_IPV4 M_HASHTYPE_HASH(7) /* IPv4 UDP 4-tuple*/ -#defineM_HASHTYPE_RSS_UDP_IPV4_EX M_HASHTYPE_HASH(8) /* IPv4 UDP 4-tuple + - * ext hdrs */ #defineM_HASHTYPE_RSS_UDP_IPV6 M_HASHTYPE_HASH(9) /* IPv6 UDP 4-tuple*/ #defineM_HASHTYPE_RSS_UDP_IPV6_EX M_HASHTYPE_HASH(10)/* IPv6 UDP 4-tuple + * ext hdrs */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r324051 - head/sys/dev/ixl
Author: sephe Date: Wed Sep 27 05:59:54 2017 New Revision: 324051 URL: https://svnweb.freebsd.org/changeset/base/324051 Log: ixl: Fix mbuf hash type settings. IPV6_EXs in RSS never mean fragment. They mean: "- Home address from the home address option in the IPv6 destination options header. If the extension header is not present, use the Source IPv6 Address. - IPv6 address that is contained in the Routing-Header-Type-2 from the associated extension header. If the extension header is not present, use the Destination IPv6 Address." UDP_IPV4_EX is an invalid RSS hash type, which will be removed. Quoted from: https://docs.microsoft.com/en-us/windows-hardware/drivers/network/rss-hashing-types#ndishashipv6ex Reviewed by: erj Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D12450 Modified: head/sys/dev/ixl/ixl_txrx.c Modified: head/sys/dev/ixl/ixl_txrx.c == --- head/sys/dev/ixl/ixl_txrx.c Wed Sep 27 05:52:37 2017(r324050) +++ head/sys/dev/ixl/ixl_txrx.c Wed Sep 27 05:59:54 2017(r324051) @@ -1446,10 +1446,8 @@ static inline int ixl_ptype_to_hash(u8 ptype) { struct i40e_rx_ptype_decoded decoded; - u8 ex = 0; decoded = decode_rx_desc_ptype(ptype); - ex = decoded.outer_frag; if (!decoded.known) return M_HASHTYPE_OPAQUE_HASH; @@ -1460,34 +1458,22 @@ ixl_ptype_to_hash(u8 ptype) /* Note: anything that gets to this point is IP */ if (decoded.outer_ip_ver == I40E_RX_PTYPE_OUTER_IPV6) { switch (decoded.inner_prot) { - case I40E_RX_PTYPE_INNER_PROT_TCP: - if (ex) - return M_HASHTYPE_RSS_TCP_IPV6_EX; - else - return M_HASHTYPE_RSS_TCP_IPV6; - case I40E_RX_PTYPE_INNER_PROT_UDP: - if (ex) - return M_HASHTYPE_RSS_UDP_IPV6_EX; - else - return M_HASHTYPE_RSS_UDP_IPV6; - default: - if (ex) - return M_HASHTYPE_RSS_IPV6_EX; - else - return M_HASHTYPE_RSS_IPV6; + case I40E_RX_PTYPE_INNER_PROT_TCP: + return M_HASHTYPE_RSS_TCP_IPV6; + case I40E_RX_PTYPE_INNER_PROT_UDP: + return M_HASHTYPE_RSS_UDP_IPV6; + default: + return M_HASHTYPE_RSS_IPV6; } } if (decoded.outer_ip_ver == I40E_RX_PTYPE_OUTER_IPV4) { switch (decoded.inner_prot) { - case I40E_RX_PTYPE_INNER_PROT_TCP: - return M_HASHTYPE_RSS_TCP_IPV4; - case I40E_RX_PTYPE_INNER_PROT_UDP: - if (ex) - return M_HASHTYPE_RSS_UDP_IPV4_EX; - else - return M_HASHTYPE_RSS_UDP_IPV4; - default: - return M_HASHTYPE_RSS_IPV4; + case I40E_RX_PTYPE_INNER_PROT_TCP: + return M_HASHTYPE_RSS_TCP_IPV4; + case I40E_RX_PTYPE_INNER_PROT_UDP: + return M_HASHTYPE_RSS_UDP_IPV4; + default: + return M_HASHTYPE_RSS_IPV4; } } /* We should never get here!! */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r324050 - head/sys/netinet
Author: sephe Date: Wed Sep 27 05:52:37 2017 New Revision: 324050 URL: https://svnweb.freebsd.org/changeset/base/324050 Log: tcp: Don't "negotiate" MSS. _NO_ OSes actually "negotiate" MSS. RFC 879: "... This Maximum Segment Size (MSS) announcement (often mistakenly called a negotiation) ..." This negotiation behaviour was introduced 11 years ago by r159955 without any explaination about why FreeBSD had to "negotiate" MSS: In syncache_respond() do not reply with a MSS that is larger than what the peer announced to us but make it at least tcp_minmss in size. Sponsored by: TCP/IP Optimization Fundraise 2005 The tcp_minmss behaviour is still kept. Syncookie fix was prodded by tuexen, who also helped to test this patch w/ packetdrill. Reviewed by: tuexen, karels, bz (previous version) MFC after:2 week Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D12430 Modified: head/sys/netinet/tcp_syncache.c Modified: head/sys/netinet/tcp_syncache.c == --- head/sys/netinet/tcp_syncache.c Wed Sep 27 05:44:50 2017 (r324049) +++ head/sys/netinet/tcp_syncache.c Wed Sep 27 05:52:37 2017 (r324050) @@ -1634,9 +1634,7 @@ syncache_respond(struct syncache *sc, struct syncache_ tlen = hlen + sizeof(struct tcphdr); /* Determine MSS we advertize to other end of connection. */ - mssopt = tcp_mssopt(>sc_inc); - if (sc->sc_peer_mss) - mssopt = max( min(sc->sc_peer_mss, mssopt), V_tcp_minmss); + mssopt = max(tcp_mssopt(>sc_inc), V_tcp_minmss); /* XXX: Assume that the entire packet will fit in a header mbuf. */ KASSERT(max_linkhdr + tlen + TCP_MAXOLEN <= MHLEN, @@ -1985,7 +1983,7 @@ syncookie_mac(struct in_conninfo *inc, tcp_seq irs, ui static tcp_seq syncookie_generate(struct syncache_head *sch, struct syncache *sc) { - u_int i, mss, secbit, wscale; + u_int i, secbit, wscale; uint32_t iss, hash; uint8_t *secbits; union syncookie cookie; @@ -1995,8 +1993,8 @@ syncookie_generate(struct syncache_head *sch, struct s cookie.cookie = 0; /* Map our computed MSS into the 3-bit index. */ - mss = min(tcp_mssopt(>sc_inc), max(sc->sc_peer_mss, V_tcp_minmss)); - for (i = nitems(tcp_sc_msstab) - 1; tcp_sc_msstab[i] > mss && i > 0; + for (i = nitems(tcp_sc_msstab) - 1; +tcp_sc_msstab[i] > sc->sc_peer_mss && i > 0; i--) ; cookie.flags.mss_idx = i; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r324049 - head/sys/dev/hyperv/netvsc
Author: sephe Date: Wed Sep 27 05:44:50 2017 New Revision: 324049 URL: https://svnweb.freebsd.org/changeset/base/324049 Log: hyperv/hn: Fix UDP checksum offload issue in Azure. UDP checksum offload does not work in Azure if following conditions are met: - sizeof(IP hdr + UDP hdr + payload) > 1420. - IP_DF is not set in IP hdr Use software checksum for UDP datagrams falling into this category. Add two tunables to disable UDP/IPv4 and UDP/IPv6 checksum offload, in case something unexpected happened. MFC after:1 week Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D12429 Modified: head/sys/dev/hyperv/netvsc/if_hn.c Modified: head/sys/dev/hyperv/netvsc/if_hn.c == --- head/sys/dev/hyperv/netvsc/if_hn.c Wed Sep 27 04:42:40 2017 (r324048) +++ head/sys/dev/hyperv/netvsc/if_hn.c Wed Sep 27 05:44:50 2017 (r324049) @@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -460,6 +461,35 @@ SYSCTL_INT(_hw_hn, OID_AUTO, trust_hostip, CTLFLAG_RDT "Trust ip packet verification on host side, " "when csum info is missing (global setting)"); +/* + * Offload UDP/IPv4 checksum. + */ +static int hn_enable_udp4cs = 1; +SYSCTL_INT(_hw_hn, OID_AUTO, enable_udp4cs, CTLFLAG_RDTUN, +_enable_udp4cs, 0, "Offload UDP/IPv4 checksum"); + +/* + * Offload UDP/IPv6 checksum. + */ +static int hn_enable_udp6cs = 1; +SYSCTL_INT(_hw_hn, OID_AUTO, enable_udp6cs, CTLFLAG_RDTUN, +_enable_udp6cs, 0, "Offload UDP/IPv6 checksum"); + +/* Stats. */ +static counter_u64_t hn_udpcs_fixup; +SYSCTL_COUNTER_U64(_hw_hn, OID_AUTO, udpcs_fixup, CTLFLAG_RW, +_udpcs_fixup, "# of UDP checksum fixup"); + +/* + * See hn_set_hlen(). + * + * This value is for Azure. For Hyper-V, set this above + * 65536 to disable UDP datagram checksum fixup. + */ +static int hn_udpcs_fixup_mtu = 1420; +SYSCTL_INT(_hw_hn, OID_AUTO, udpcs_fixup_mtu, CTLFLAG_RWTUN, +_udpcs_fixup_mtu, 0, "UDP checksum fixup MTU threshold"); + /* Limit TSO burst size */ static int hn_tso_maxlen = IP_MAXPACKET; SYSCTL_INT(_hw_hn, OID_AUTO, tso_maxlen, CTLFLAG_RDTUN, @@ -799,6 +829,27 @@ hn_set_hlen(struct mbuf *m_head) ip = mtodo(m_head, ehlen); iphlen = ip->ip_hl << 2; m_head->m_pkthdr.l3hlen = iphlen; + + /* +* UDP checksum offload does not work in Azure, if the +* following conditions meet: +* - sizeof(IP hdr + UDP hdr + payload) > 1420. +* - IP_DF is not set in the IP hdr. +* +* Fallback to software checksum for these UDP datagrams. +*/ + if ((m_head->m_pkthdr.csum_flags & CSUM_IP_UDP) && + m_head->m_pkthdr.len > hn_udpcs_fixup_mtu + ehlen && + (ntohs(ip->ip_off) & IP_DF) == 0) { + uint16_t off = ehlen + iphlen; + + counter_u64_add(hn_udpcs_fixup, 1); + PULLUP_HDR(m_head, off + sizeof(struct udphdr)); + *(uint16_t *)(m_head->m_data + off + +m_head->m_pkthdr.csum_data) = in_cksum_skip( + m_head, m_head->m_pkthdr.len, off); + m_head->m_pkthdr.csum_flags &= ~CSUM_IP_UDP; + } } #endif #if defined(INET6) && defined(INET) @@ -5479,11 +5530,11 @@ hn_fixup_tx_data(struct hn_softc *sc) csum_assist |= CSUM_IP; if (sc->hn_caps & HN_CAP_TCP4CS) csum_assist |= CSUM_IP_TCP; - if (sc->hn_caps & HN_CAP_UDP4CS) + if ((sc->hn_caps & HN_CAP_UDP4CS) && hn_enable_udp4cs) csum_assist |= CSUM_IP_UDP; if (sc->hn_caps & HN_CAP_TCP6CS) csum_assist |= CSUM_IP6_TCP; - if (sc->hn_caps & HN_CAP_UDP6CS) + if ((sc->hn_caps & HN_CAP_UDP6CS) && hn_enable_udp6cs) csum_assist |= CSUM_IP6_UDP; for (i = 0; i < sc->hn_tx_ring_cnt; ++i) sc->hn_tx_ring[i].hn_csum_assist = csum_assist; @@ -7336,6 +7387,8 @@ hn_sysinit(void *arg __unused) { int i; + hn_udpcs_fixup = counter_u64_alloc(M_WAITOK); + #ifdef HN_IFSTART_SUPPORT /* * Don't use ifnet.if_start if transparent VF mode is requested; @@ -7415,5 +7468,7 @@ hn_sysuninit(void *arg __unused) if (hn_vfmap != NULL) free(hn_vfmap, M_DEVBUF); rm_destroy(_vfmap_lock); + + counter_u64_free(hn_udpcs_fixup); } SYSUNINIT(hn_sysuninit, SI_SUB_DRIVERS, SI_ORDER_SECOND, hn_sysuninit, NULL); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe,
svn commit: r324048 - head/sys/dev/hyperv/netvsc
Author: sephe Date: Wed Sep 27 04:42:40 2017 New Revision: 324048 URL: https://svnweb.freebsd.org/changeset/base/324048 Log: hyperv/hn: Set tcp header offset for CSUM/LSO offloading. No observable effect; better safe than sorry. MFC after:1 week Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D12417 Modified: head/sys/dev/hyperv/netvsc/if_hn.c head/sys/dev/hyperv/netvsc/ndis.h Modified: head/sys/dev/hyperv/netvsc/if_hn.c == --- head/sys/dev/hyperv/netvsc/if_hn.c Wed Sep 27 01:47:54 2017 (r324047) +++ head/sys/dev/hyperv/netvsc/if_hn.c Wed Sep 27 04:42:40 2017 (r324048) @@ -727,6 +727,7 @@ hn_tso_fixup(struct mbuf *m_head) ehlen = ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN; else ehlen = ETHER_HDR_LEN; + m_head->m_pkthdr.l2hlen = ehlen; #ifdef INET if (m_head->m_pkthdr.csum_flags & CSUM_IP_TSO) { @@ -736,6 +737,7 @@ hn_tso_fixup(struct mbuf *m_head) PULLUP_HDR(m_head, ehlen + sizeof(*ip)); ip = mtodo(m_head, ehlen); iphlen = ip->ip_hl << 2; + m_head->m_pkthdr.l3hlen = iphlen; PULLUP_HDR(m_head, ehlen + iphlen + sizeof(*th)); th = mtodo(m_head, ehlen + iphlen); @@ -759,6 +761,7 @@ hn_tso_fixup(struct mbuf *m_head) m_freem(m_head); return (NULL); } + m_head->m_pkthdr.l3hlen = sizeof(*ip6); PULLUP_HDR(m_head, ehlen + sizeof(*ip6) + sizeof(*th)); th = mtodo(m_head, ehlen + sizeof(*ip6)); @@ -768,41 +771,34 @@ hn_tso_fixup(struct mbuf *m_head) } #endif return (m_head); - } /* * NOTE: If this function failed, the m_head would be freed. */ static __inline struct mbuf * -hn_check_tcpsyn(struct mbuf *m_head, int *tcpsyn) +hn_set_hlen(struct mbuf *m_head) { const struct ether_vlan_header *evl; - const struct tcphdr *th; int ehlen; - *tcpsyn = 0; - PULLUP_HDR(m_head, sizeof(*evl)); evl = mtod(m_head, const struct ether_vlan_header *); if (evl->evl_encap_proto == ntohs(ETHERTYPE_VLAN)) ehlen = ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN; else ehlen = ETHER_HDR_LEN; + m_head->m_pkthdr.l2hlen = ehlen; #ifdef INET - if (m_head->m_pkthdr.csum_flags & CSUM_IP_TCP) { + if (m_head->m_pkthdr.csum_flags & (CSUM_IP_TCP | CSUM_IP_UDP)) { const struct ip *ip; int iphlen; PULLUP_HDR(m_head, ehlen + sizeof(*ip)); ip = mtodo(m_head, ehlen); iphlen = ip->ip_hl << 2; - - PULLUP_HDR(m_head, ehlen + iphlen + sizeof(*th)); - th = mtodo(m_head, ehlen + iphlen); - if (th->th_flags & TH_SYN) - *tcpsyn = 1; + m_head->m_pkthdr.l3hlen = iphlen; } #endif #if defined(INET6) && defined(INET) @@ -814,18 +810,36 @@ hn_check_tcpsyn(struct mbuf *m_head, int *tcpsyn) PULLUP_HDR(m_head, ehlen + sizeof(*ip6)); ip6 = mtodo(m_head, ehlen); - if (ip6->ip6_nxt != IPPROTO_TCP) - return (m_head); - - PULLUP_HDR(m_head, ehlen + sizeof(*ip6) + sizeof(*th)); - th = mtodo(m_head, ehlen + sizeof(*ip6)); - if (th->th_flags & TH_SYN) - *tcpsyn = 1; + if (ip6->ip6_nxt != IPPROTO_TCP) { + m_freem(m_head); + return (NULL); + } + m_head->m_pkthdr.l3hlen = sizeof(*ip6); } #endif return (m_head); } +/* + * NOTE: If this function failed, the m_head would be freed. + */ +static __inline struct mbuf * +hn_check_tcpsyn(struct mbuf *m_head, int *tcpsyn) +{ + const struct tcphdr *th; + int ehlen, iphlen; + + *tcpsyn = 0; + ehlen = m_head->m_pkthdr.l2hlen; + iphlen = m_head->m_pkthdr.l3hlen; + + PULLUP_HDR(m_head, ehlen + iphlen + sizeof(*th)); + th = mtodo(m_head, ehlen + iphlen); + if (th->th_flags & TH_SYN) + *tcpsyn = 1; + return (m_head); +} + #undef PULLUP_HDR #endif /* INET6 || INET */ @@ -3010,7 +3024,8 @@ hn_encap(struct ifnet *ifp, struct hn_tx_ring *txr, st NDIS_LSO2_INFO_SIZE, NDIS_PKTINFO_TYPE_LSO); #ifdef INET if (m_head->m_pkthdr.csum_flags & CSUM_IP_TSO) { - *pi_data = NDIS_LSO2_INFO_MAKEIPV4(0, + *pi_data = NDIS_LSO2_INFO_MAKEIPV4( + m_head->m_pkthdr.l2hlen + m_head->m_pkthdr.l3hlen, m_head->m_pkthdr.tso_segsz); } #endif @@ -3019,7 +3034,8 @@ hn_encap(struct ifnet *ifp, struct hn_tx_ring *txr, st
svn commit: r323729 - head/sys/dev/hyperv/netvsc
Author: sephe Date: Tue Sep 19 06:46:00 2017 New Revision: 323729 URL: https://svnweb.freebsd.org/changeset/base/323729 Log: hyperv/hn: Incease max supported MTU MFC after:1 week Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D12365 Modified: head/sys/dev/hyperv/netvsc/if_hnvar.h Modified: head/sys/dev/hyperv/netvsc/if_hnvar.h == --- head/sys/dev/hyperv/netvsc/if_hnvar.h Tue Sep 19 06:38:57 2017 (r323728) +++ head/sys/dev/hyperv/netvsc/if_hnvar.h Tue Sep 19 06:46:00 2017 (r323729) @@ -36,8 +36,7 @@ #define HN_RXBUF_SIZE (16 * 1024 * 1024) #define HN_RXBUF_SIZE_COMPAT (15 * 1024 * 1024) -/* Claimed to be 12232B */ -#define HN_MTU_MAX (9 * 1024) +#define HN_MTU_MAX (65535 - ETHER_ADDR_LEN) #define HN_TXBR_SIZE (128 * PAGE_SIZE) #define HN_RXBR_SIZE (128 * PAGE_SIZE) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r323728 - head/sys/dev/hyperv/netvsc
Author: sephe Date: Tue Sep 19 06:38:57 2017 New Revision: 323728 URL: https://svnweb.freebsd.org/changeset/base/323728 Log: hyperv/hn: Fix MTU setting - Add size of an ethernet header to the value configured to NVS. This does not seem to have any effects if MTU is 1500, but fix hypervisor side's setting if MTU > 1500. - Override the MTU setting according to the view from the hypervisor side. MFC after:1 week Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D12352 Modified: head/sys/dev/hyperv/netvsc/hn_nvs.c head/sys/dev/hyperv/netvsc/hn_rndis.c head/sys/dev/hyperv/netvsc/hn_rndis.h head/sys/dev/hyperv/netvsc/if_hn.c Modified: head/sys/dev/hyperv/netvsc/hn_nvs.c == --- head/sys/dev/hyperv/netvsc/hn_nvs.c Tue Sep 19 06:29:38 2017 (r323727) +++ head/sys/dev/hyperv/netvsc/hn_nvs.c Tue Sep 19 06:38:57 2017 (r323728) @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -503,7 +504,7 @@ hn_nvs_conf_ndis(struct hn_softc *sc, int mtu) memset(, 0, sizeof(conf)); conf.nvs_type = HN_NVS_TYPE_NDIS_CONF; - conf.nvs_mtu = mtu; + conf.nvs_mtu = mtu + ETHER_HDR_LEN; conf.nvs_caps = HN_NVS_NDIS_CONF_VLAN; if (sc->hn_nvs_ver >= HN_NVS_VERSION_5) conf.nvs_caps |= HN_NVS_NDIS_CONF_SRIOV; Modified: head/sys/dev/hyperv/netvsc/hn_rndis.c == --- head/sys/dev/hyperv/netvsc/hn_rndis.c Tue Sep 19 06:29:38 2017 (r323727) +++ head/sys/dev/hyperv/netvsc/hn_rndis.c Tue Sep 19 06:38:57 2017 (r323728) @@ -188,6 +188,24 @@ hn_rndis_get_linkstatus(struct hn_softc *sc, uint32_t return (0); } +int +hn_rndis_get_mtu(struct hn_softc *sc, uint32_t *mtu) +{ + size_t size; + int error; + + size = sizeof(*mtu); + error = hn_rndis_query(sc, OID_GEN_MAXIMUM_FRAME_SIZE, NULL, 0, + mtu, ); + if (error) + return (error); + if (size != sizeof(uint32_t)) { + if_printf(sc->hn_ifp, "invalid mtu len %zu\n", size); + return (EINVAL); + } + return (0); +} + static const void * hn_rndis_xact_exec1(struct hn_softc *sc, struct vmbus_xact *xact, size_t reqlen, struct hn_nvs_sendctx *sndc, size_t *comp_len) Modified: head/sys/dev/hyperv/netvsc/hn_rndis.h == --- head/sys/dev/hyperv/netvsc/hn_rndis.h Tue Sep 19 06:29:38 2017 (r323727) +++ head/sys/dev/hyperv/netvsc/hn_rndis.h Tue Sep 19 06:38:57 2017 (r323728) @@ -41,6 +41,7 @@ int hn_rndis_get_eaddr(struct hn_softc *sc, uint8_t * /* link_status: NDIS_MEDIA_STATE_ */ inthn_rndis_get_linkstatus(struct hn_softc *sc, uint32_t *link_status); +inthn_rndis_get_mtu(struct hn_softc *sc, uint32_t *mtu); /* filter: NDIS_PACKET_TYPE_. */ inthn_rndis_set_rxfilter(struct hn_softc *sc, uint32_t filter); void hn_rndis_rx_ctrl(struct hn_softc *sc, const void *data, Modified: head/sys/dev/hyperv/netvsc/if_hn.c == --- head/sys/dev/hyperv/netvsc/if_hn.c Tue Sep 19 06:29:38 2017 (r323727) +++ head/sys/dev/hyperv/netvsc/if_hn.c Tue Sep 19 06:38:57 2017 (r323728) @@ -2003,6 +2003,7 @@ hn_attach(device_t dev) uint8_t eaddr[ETHER_ADDR_LEN]; struct ifnet *ifp = NULL; int error, ring_cnt, tx_ring_cnt; + uint32_t mtu; sc->hn_dev = dev; sc->hn_prichan = vmbus_get_channel(dev); @@ -2159,6 +2160,12 @@ hn_attach(device_t dev) if (error) goto failed; + error = hn_rndis_get_mtu(sc, ); + if (error) + mtu = ETHERMTU; + else if (bootverbose) + device_printf(dev, "RNDIS mtu %u\n", mtu); + #if __FreeBSD_version >= 1100099 if (sc->hn_rx_ring_inuse > 1) { /* @@ -2343,6 +2350,10 @@ hn_attach(device_t dev) if_printf(ifp, "TSO segcnt %u segsz %u\n", ifp->if_hw_tsomaxsegcount, ifp->if_hw_tsomaxsegsize); } + if (mtu < ETHERMTU) { + if_printf(ifp, "fixup mtu %u -> %u\n", ifp->if_mtu, mtu); + ifp->if_mtu = mtu; + } /* Inform the upper layer about the long frame support. */ ifp->if_hdrlen = sizeof(struct ether_vlan_header); @@ -3587,6 +3598,7 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) int mask, error = 0; struct ifrsskey *ifrk; struct ifrsshash *ifrh; + uint32_t mtu; switch (cmd) { case SIOCSIFMTU: @@ -3650,11 +3662,23 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
svn commit: r323727 - head/sys/dev/hyperv/netvsc
Author: sephe Date: Tue Sep 19 06:29:38 2017 New Revision: 323727 URL: https://svnweb.freebsd.org/changeset/base/323727 Log: hyperv/hn: Apply VF's RSS setting Since in Azure SYN and SYN|ACK go through the synthetic parts while the rest of the same TCP flow goes through the VF, apply VF's RSS settings to synthetic parts to have a consistent hash value/type for the same TCP flow. MFC after:1 week Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D12333 Modified: head/sys/dev/hyperv/netvsc/hn_rndis.c head/sys/dev/hyperv/netvsc/if_hn.c head/sys/dev/hyperv/netvsc/if_hnvar.h head/sys/dev/hyperv/netvsc/ndis.h Modified: head/sys/dev/hyperv/netvsc/hn_rndis.c == --- head/sys/dev/hyperv/netvsc/hn_rndis.c Tue Sep 19 05:48:53 2017 (r323726) +++ head/sys/dev/hyperv/netvsc/hn_rndis.c Tue Sep 19 06:29:38 2017 (r323727) @@ -502,7 +502,7 @@ hn_rndis_query_rsscaps(struct hn_softc *sc, int *rxr_c /* Commit! */ sc->hn_rss_ind_size = indsz; - sc->hn_rss_hash = hash_func | hash_types; + sc->hn_rss_hcap = hash_func | hash_types; *rxr_cnt0 = rxr_cnt; return (0); } Modified: head/sys/dev/hyperv/netvsc/if_hn.c == --- head/sys/dev/hyperv/netvsc/if_hn.c Tue Sep 19 05:48:53 2017 (r323726) +++ head/sys/dev/hyperv/netvsc/if_hn.c Tue Sep 19 06:29:38 2017 (r323727) @@ -284,6 +284,8 @@ static void hn_xpnt_vf_init_taskfunc(void *, int); static voidhn_xpnt_vf_init(struct hn_softc *); static voidhn_xpnt_vf_setenable(struct hn_softc *); static voidhn_xpnt_vf_setdisable(struct hn_softc *, bool); +static voidhn_vf_rss_fixup(struct hn_softc *, bool); +static voidhn_vf_rss_restore(struct hn_softc *); static int hn_rndis_rxinfo(const void *, int, struct hn_rxinfo *); @@ -327,6 +329,8 @@ static int hn_rss_key_sysctl(SYSCTL_HANDLER_ARGS); static int hn_rss_ind_sysctl(SYSCTL_HANDLER_ARGS); #endif static int hn_rss_hash_sysctl(SYSCTL_HANDLER_ARGS); +static int hn_rss_hcap_sysctl(SYSCTL_HANDLER_ARGS); +static int hn_rss_mbuf_sysctl(SYSCTL_HANDLER_ARGS); static int hn_txagg_size_sysctl(SYSCTL_HANDLER_ARGS); static int hn_txagg_pkts_sysctl(SYSCTL_HANDLER_ARGS); static int hn_txagg_pktmax_sysctl(SYSCTL_HANDLER_ARGS); @@ -386,8 +390,11 @@ static int hn_rxfilter_config(struct hn_softc *); static int hn_rss_reconfig(struct hn_softc *); #endif static voidhn_rss_ind_fixup(struct hn_softc *); +static voidhn_rss_mbuf_hash(struct hn_softc *, uint32_t); static int hn_rxpkt(struct hn_rx_ring *, const void *, int, const struct hn_rxinfo *); +static uint32_thn_rss_type_fromndis(uint32_t); +static uint32_thn_rss_type_tondis(uint32_t); static int hn_tx_ring_create(struct hn_softc *, int); static voidhn_tx_ring_destroy(struct hn_tx_ring *); @@ -1134,11 +1141,13 @@ hn_rxvf_change(struct hn_softc *sc, struct ifnet *ifp, hn_rxvf_set(sc, rxvf ? ifp : NULL); if (rxvf) { + hn_vf_rss_fixup(sc, true); hn_suspend_mgmt(sc); sc->hn_link_flags &= ~(HN_LINK_FLAG_LINKUP | HN_LINK_FLAG_NETCHG); if_link_state_change(hn_ifp, LINK_STATE_DOWN); } else { + hn_vf_rss_restore(sc); hn_resume_mgmt(sc); } @@ -1335,7 +1344,249 @@ hn_mtu_change_fixup(struct hn_softc *sc) #endif } +static uint32_t +hn_rss_type_fromndis(uint32_t rss_hash) +{ + uint32_t types = 0; + + if (rss_hash & NDIS_HASH_IPV4) + types |= RSS_TYPE_IPV4; + if (rss_hash & NDIS_HASH_TCP_IPV4) + types |= RSS_TYPE_TCP_IPV4; + if (rss_hash & NDIS_HASH_IPV6) + types |= RSS_TYPE_IPV6; + if (rss_hash & NDIS_HASH_IPV6_EX) + types |= RSS_TYPE_IPV6_EX; + if (rss_hash & NDIS_HASH_TCP_IPV6) + types |= RSS_TYPE_TCP_IPV6; + if (rss_hash & NDIS_HASH_TCP_IPV6_EX) + types |= RSS_TYPE_TCP_IPV6_EX; + return (types); +} + +static uint32_t +hn_rss_type_tondis(uint32_t types) +{ + uint32_t rss_hash = 0; + + KASSERT((types & + (RSS_TYPE_UDP_IPV4 | RSS_TYPE_UDP_IPV6 | RSS_TYPE_UDP_IPV6_EX)) == 0, + ("UDP4, UDP6 and UDP6EX are not supported")); + + if (types & RSS_TYPE_IPV4) +
svn commit: r323176 - head/sys/dev/hyperv/netvsc
Author: sephe Date: Tue Sep 5 06:20:02 2017 New Revision: 323176 URL: https://svnweb.freebsd.org/changeset/base/323176 Log: hyperv/hn: Log RSS capabilities mask. This helps to detect when UDP hash types can be supported. MFC after:3 days Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D12177 Modified: head/sys/dev/hyperv/netvsc/hn_rndis.c Modified: head/sys/dev/hyperv/netvsc/hn_rndis.c == --- head/sys/dev/hyperv/netvsc/hn_rndis.c Tue Sep 5 06:05:48 2017 (r323175) +++ head/sys/dev/hyperv/netvsc/hn_rndis.c Tue Sep 5 06:20:02 2017 (r323176) @@ -497,6 +497,8 @@ hn_rndis_query_rsscaps(struct hn_softc *sc, int *rxr_c caps.ndis_caps); return (EOPNOTSUPP); } + if (bootverbose) + if_printf(sc->hn_ifp, "RSS caps %#x\n", caps.ndis_caps); /* Commit! */ sc->hn_rss_ind_size = indsz; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r323175 - head/sys/dev/hyperv/netvsc
Author: sephe Date: Tue Sep 5 06:05:48 2017 New Revision: 323175 URL: https://svnweb.freebsd.org/changeset/base/323175 Log: hyperv/hn: Implement SIOCGIFRSS{KEY,HASH}. The conditional compiling in the review request is removed, since these IOCTLs will be available in stable/10 and stable/11. Reviewed by: gallatin MFC after:1 week Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D12175 Modified: head/sys/dev/hyperv/netvsc/if_hn.c Modified: head/sys/dev/hyperv/netvsc/if_hn.c == --- head/sys/dev/hyperv/netvsc/if_hn.c Tue Sep 5 05:53:43 2017 (r323174) +++ head/sys/dev/hyperv/netvsc/if_hn.c Tue Sep 5 06:05:48 2017 (r323175) @@ -3316,6 +3316,8 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) struct ifreq *ifr = (struct ifreq *)data, ifr_vf; struct ifnet *vf_ifp; int mask, error = 0; + struct ifrsskey *ifrk; + struct ifrsshash *ifrh; switch (cmd) { case SIOCSIFMTU: @@ -3571,6 +3573,56 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) } HN_UNLOCK(sc); error = ifmedia_ioctl(ifp, ifr, >hn_media, cmd); + break; + + case SIOCGIFRSSHASH: + ifrh = (struct ifrsshash *)data; + HN_LOCK(sc); + if (sc->hn_rx_ring_inuse == 1) { + HN_UNLOCK(sc); + ifrh->ifrh_func = RSS_FUNC_NONE; + ifrh->ifrh_types = 0; + break; + } + + if (sc->hn_rss_hash & NDIS_HASH_FUNCTION_TOEPLITZ) + ifrh->ifrh_func = RSS_FUNC_TOEPLITZ; + else + ifrh->ifrh_func = RSS_FUNC_PRIVATE; + + ifrh->ifrh_types = 0; + if (sc->hn_rss_hash & NDIS_HASH_IPV4) + ifrh->ifrh_types |= RSS_TYPE_IPV4; + if (sc->hn_rss_hash & NDIS_HASH_TCP_IPV4) + ifrh->ifrh_types |= RSS_TYPE_TCP_IPV4; + if (sc->hn_rss_hash & NDIS_HASH_IPV6) + ifrh->ifrh_types |= RSS_TYPE_IPV6; + if (sc->hn_rss_hash & NDIS_HASH_IPV6_EX) + ifrh->ifrh_types |= RSS_TYPE_IPV6_EX; + if (sc->hn_rss_hash & NDIS_HASH_TCP_IPV6) + ifrh->ifrh_types |= RSS_TYPE_TCP_IPV6; + if (sc->hn_rss_hash & NDIS_HASH_TCP_IPV6_EX) + ifrh->ifrh_types |= RSS_TYPE_TCP_IPV6_EX; + HN_UNLOCK(sc); + break; + + case SIOCGIFRSSKEY: + ifrk = (struct ifrsskey *)data; + HN_LOCK(sc); + if (sc->hn_rx_ring_inuse == 1) { + HN_UNLOCK(sc); + ifrk->ifrk_func = RSS_FUNC_NONE; + ifrk->ifrk_keylen = 0; + break; + } + if (sc->hn_rss_hash & NDIS_HASH_FUNCTION_TOEPLITZ) + ifrk->ifrk_func = RSS_FUNC_TOEPLITZ; + else + ifrk->ifrk_func = RSS_FUNC_PRIVATE; + ifrk->ifrk_keylen = NDIS_HASH_KEYSIZE_TOEPLITZ; + memcpy(ifrk->ifrk_key, sc->hn_rss.rss_key, + NDIS_HASH_KEYSIZE_TOEPLITZ); + HN_UNLOCK(sc); break; default: ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r323170 - in head/sys: net sys
Author: sephe Date: Tue Sep 5 05:28:52 2017 New Revision: 323170 URL: https://svnweb.freebsd.org/changeset/base/323170 Log: if: Add ioctls to get RSS key and hash type/function. It will be needed by hn(4) to configure its RSS key and hash type/function in the transparent VF mode in order to match VF's RSS settings. The description of the transparent VF mode and the RSS hash value issue are here: https://svnweb.freebsd.org/base?view=revision=322299 https://svnweb.freebsd.org/base?view=revision=322485 These are generic enough to promise two independent IOCs instead of abusing SIOCGDRVSPEC. Setting RSS key and hash type/function is a different story, which probably requires more discussion. Comment about UDP_{IPV4,IPV6,IPV6_EX} were only in the patch in the review request; these hash types are standardized now. Reviewed by: gallatin MFC after:1 week Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D12174 Modified: head/sys/net/if.c head/sys/net/if.h head/sys/sys/sockio.h Modified: head/sys/net/if.c == --- head/sys/net/if.c Tue Sep 5 01:40:53 2017(r323169) +++ head/sys/net/if.c Tue Sep 5 05:28:52 2017(r323170) @@ -2661,6 +2661,8 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, caddr_t data, case SIOCGIFMEDIA: case SIOCGIFXMEDIA: case SIOCGIFGENERIC: + case SIOCGIFRSSKEY: + case SIOCGIFRSSHASH: if (ifp->if_ioctl == NULL) return (EOPNOTSUPP); error = (*ifp->if_ioctl)(ifp, cmd, data); Modified: head/sys/net/if.h == --- head/sys/net/if.h Tue Sep 5 01:40:53 2017(r323169) +++ head/sys/net/if.h Tue Sep 5 05:28:52 2017(r323170) @@ -526,6 +526,42 @@ struct ifi2creq { uint8_t data[8];/* read buffer */ }; +/* + * RSS hash. + */ + +#defineRSS_FUNC_NONE 0 /* RSS disabled */ +#defineRSS_FUNC_PRIVATE1 /* non-standard */ +#defineRSS_FUNC_TOEPLITZ 2 + +#defineRSS_TYPE_IPV4 0x0001 +#defineRSS_TYPE_TCP_IPV4 0x0002 +#defineRSS_TYPE_IPV6 0x0004 +#defineRSS_TYPE_IPV6_EX0x0008 +#defineRSS_TYPE_TCP_IPV6 0x0010 +#defineRSS_TYPE_TCP_IPV6_EX0x0020 +#defineRSS_TYPE_UDP_IPV4 0x0040 +#defineRSS_TYPE_UDP_IPV6 0x0080 +#defineRSS_TYPE_UDP_IPV6_EX0x0100 + +#defineRSS_KEYLEN 128 + +struct ifrsskey { + charifrk_name[IFNAMSIZ];/* if name, e.g. "en0" */ + uint8_t ifrk_func; /* RSS_FUNC_ */ + uint8_t ifrk_spare0; + uint16_tifrk_keylen; + uint8_t ifrk_key[RSS_KEYLEN]; +}; + +struct ifrsshash { + charifrh_name[IFNAMSIZ];/* if name, e.g. "en0" */ + uint8_t ifrh_func; /* RSS_FUNC_ */ + uint8_t ifrh_spare0; + uint16_tifrh_spare1; + uint32_tifrh_types; /* RSS_TYPE_ */ +}; + #endif /* __BSD_VISIBLE */ #ifdef _KERNEL Modified: head/sys/sys/sockio.h == --- head/sys/sys/sockio.h Tue Sep 5 01:40:53 2017(r323169) +++ head/sys/sys/sockio.h Tue Sep 5 05:28:52 2017(r323170) @@ -134,4 +134,8 @@ #defineSIOCGIFGMEMB_IOWR('i', 138, struct ifgroupreq) /* get members */ #defineSIOCGIFXMEDIA _IOWR('i', 139, struct ifmediareq) /* get net xmedia */ +#defineSIOCGIFRSSKEY _IOWR('i', 150, struct ifrsskey)/* get RSS key */ +#defineSIOCGIFRSSHASH _IOWR('i', 151, struct ifrsshash)/* get the current RSS + type/func settings */ + #endif /* !_SYS_SOCKIO_H_ */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r322323 - in head/sys: amd64/amd64 i386/include x86/include x86/x86
I just MFCed it to stable/11. Please MFC it to stable/10. On Mon, Aug 14, 2017 at 2:28 PM, Sepherosa Ziehau <sepher...@gmail.com> wrote: > Please MFC this to 10-stable/11-stable. > > Thanks, > sephe > > On Thu, Aug 10, 2017 at 2:09 AM, Jung-uk Kim <j...@freebsd.org> wrote: >> Author: jkim >> Date: Wed Aug 9 18:09:09 2017 >> New Revision: 322323 >> URL: https://svnweb.freebsd.org/changeset/base/322323 >> >> Log: >> Split identify_cpu() into two functions for amd64 as we do for i386. This >> reduces diff between amd64 and i386. Also, it fixes a regression >> introduced >> in r322076, i.e., identify_hypervisor() failed to identify some >> hypervisors. >> This function assumes cpu_feature2 is already initialized. >> >> Reported by: dexuan >> Tested by:dexuan >> >> Modified: >> head/sys/amd64/amd64/machdep.c >> head/sys/i386/include/md_var.h >> head/sys/x86/include/x86_var.h >> head/sys/x86/x86/identcpu.c >> >> Modified: head/sys/amd64/amd64/machdep.c >> == >> --- head/sys/amd64/amd64/machdep.c Wed Aug 9 18:06:27 2017 >> (r322322) >> +++ head/sys/amd64/amd64/machdep.c Wed Aug 9 18:09:09 2017 >> (r322323) >> @@ -1537,6 +1537,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) >> >> kmdp = init_ops.parse_preload_data(modulep); >> >> + identify_cpu(); >> identify_hypervisor(); >> >> /* Init basic tunables, hz etc */ >> @@ -1643,7 +1644,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) >> != NULL) >> vty_set_preferred(VTY_VT); >> >> - identify_cpu(); /* Final stage of CPU initialization */ >> + finishidentcpu(); /* Final stage of CPU initialization */ >> initializecpu();/* Initialize CPU registers */ >> initializecpucache(); >> >> >> Modified: head/sys/i386/include/md_var.h >> == >> --- head/sys/i386/include/md_var.h Wed Aug 9 18:06:27 2017 >> (r322322) >> +++ head/sys/i386/include/md_var.h Wed Aug 9 18:09:09 2017 >> (r322323) >> @@ -59,7 +59,6 @@ void doreti_popl_es(void) __asm(__STRING(doreti_popl_e >> void doreti_popl_es_fault(void) __asm(__STRING(doreti_popl_es_fault)); >> void doreti_popl_fs(void) __asm(__STRING(doreti_popl_fs)); >> void doreti_popl_fs_fault(void) __asm(__STRING(doreti_popl_fs_fault)); >> -void finishidentcpu(void); >> void fill_based_sd(struct segment_descriptor *sdp, uint32_t base); >> void i686_pagezero(void *addr); >> void sse2_pagezero(void *addr); >> >> Modified: head/sys/x86/include/x86_var.h >> == >> --- head/sys/x86/include/x86_var.h Wed Aug 9 18:06:27 2017 >> (r322322) >> +++ head/sys/x86/include/x86_var.h Wed Aug 9 18:09:09 2017 >> (r322323) >> @@ -115,6 +115,7 @@ voidcpu_probe_amdc1e(void); >> void cpu_setregs(void); >> void dump_add_page(vm_paddr_t); >> void dump_drop_page(vm_paddr_t); >> +void finishidentcpu(void); >> void identify_cpu(void); >> void identify_hypervisor(void); >> void initializecpu(void); >> >> Modified: head/sys/x86/x86/identcpu.c >> == >> --- head/sys/x86/x86/identcpu.c Wed Aug 9 18:06:27 2017(r322322) >> +++ head/sys/x86/x86/identcpu.c Wed Aug 9 18:09:09 2017(r322323) >> @@ -1372,23 +1372,12 @@ fix_cpuid(void) >> return (false); >> } >> >> -/* >> - * Final stage of CPU identification. >> - */ >> -#ifdef __i386__ >> +#ifdef __amd64__ >> void >> -finishidentcpu(void) >> -#else >> -void >> identify_cpu(void) >> -#endif >> { >> - u_int regs[4], cpu_stdext_disable; >> -#ifdef __i386__ >> - u_char ccr3; >> -#endif >> + u_int regs[4]; >> >> -#ifdef __amd64__ >> do_cpuid(0, regs); >> cpu_high = regs[0]; >> ((u_int *)_vendor)[0] = regs[1]; >> @@ -1401,6 +1390,18 @@ identify_cpu(void) >> cpu_procinfo = regs[1]; >> cpu_feature = regs[3]; >> cpu_feature2 = regs[2]; >> +} >> +#endif >> + >> +/* >
Re: svn commit: r322323 - in head/sys: amd64/amd64 i386/include x86/include x86/x86
Please MFC this to 10-stable/11-stable. Thanks, sephe On Thu, Aug 10, 2017 at 2:09 AM, Jung-uk Kimwrote: > Author: jkim > Date: Wed Aug 9 18:09:09 2017 > New Revision: 322323 > URL: https://svnweb.freebsd.org/changeset/base/322323 > > Log: > Split identify_cpu() into two functions for amd64 as we do for i386. This > reduces diff between amd64 and i386. Also, it fixes a regression introduced > in r322076, i.e., identify_hypervisor() failed to identify some hypervisors. > This function assumes cpu_feature2 is already initialized. > > Reported by: dexuan > Tested by:dexuan > > Modified: > head/sys/amd64/amd64/machdep.c > head/sys/i386/include/md_var.h > head/sys/x86/include/x86_var.h > head/sys/x86/x86/identcpu.c > > Modified: head/sys/amd64/amd64/machdep.c > == > --- head/sys/amd64/amd64/machdep.c Wed Aug 9 18:06:27 2017 > (r322322) > +++ head/sys/amd64/amd64/machdep.c Wed Aug 9 18:09:09 2017 > (r322323) > @@ -1537,6 +1537,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) > > kmdp = init_ops.parse_preload_data(modulep); > > + identify_cpu(); > identify_hypervisor(); > > /* Init basic tunables, hz etc */ > @@ -1643,7 +1644,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) > != NULL) > vty_set_preferred(VTY_VT); > > - identify_cpu(); /* Final stage of CPU initialization */ > + finishidentcpu(); /* Final stage of CPU initialization */ > initializecpu();/* Initialize CPU registers */ > initializecpucache(); > > > Modified: head/sys/i386/include/md_var.h > == > --- head/sys/i386/include/md_var.h Wed Aug 9 18:06:27 2017 > (r322322) > +++ head/sys/i386/include/md_var.h Wed Aug 9 18:09:09 2017 > (r322323) > @@ -59,7 +59,6 @@ void doreti_popl_es(void) __asm(__STRING(doreti_popl_e > void doreti_popl_es_fault(void) __asm(__STRING(doreti_popl_es_fault)); > void doreti_popl_fs(void) __asm(__STRING(doreti_popl_fs)); > void doreti_popl_fs_fault(void) __asm(__STRING(doreti_popl_fs_fault)); > -void finishidentcpu(void); > void fill_based_sd(struct segment_descriptor *sdp, uint32_t base); > void i686_pagezero(void *addr); > void sse2_pagezero(void *addr); > > Modified: head/sys/x86/include/x86_var.h > == > --- head/sys/x86/include/x86_var.h Wed Aug 9 18:06:27 2017 > (r322322) > +++ head/sys/x86/include/x86_var.h Wed Aug 9 18:09:09 2017 > (r322323) > @@ -115,6 +115,7 @@ voidcpu_probe_amdc1e(void); > void cpu_setregs(void); > void dump_add_page(vm_paddr_t); > void dump_drop_page(vm_paddr_t); > +void finishidentcpu(void); > void identify_cpu(void); > void identify_hypervisor(void); > void initializecpu(void); > > Modified: head/sys/x86/x86/identcpu.c > == > --- head/sys/x86/x86/identcpu.c Wed Aug 9 18:06:27 2017(r322322) > +++ head/sys/x86/x86/identcpu.c Wed Aug 9 18:09:09 2017(r322323) > @@ -1372,23 +1372,12 @@ fix_cpuid(void) > return (false); > } > > -/* > - * Final stage of CPU identification. > - */ > -#ifdef __i386__ > +#ifdef __amd64__ > void > -finishidentcpu(void) > -#else > -void > identify_cpu(void) > -#endif > { > - u_int regs[4], cpu_stdext_disable; > -#ifdef __i386__ > - u_char ccr3; > -#endif > + u_int regs[4]; > > -#ifdef __amd64__ > do_cpuid(0, regs); > cpu_high = regs[0]; > ((u_int *)_vendor)[0] = regs[1]; > @@ -1401,6 +1390,18 @@ identify_cpu(void) > cpu_procinfo = regs[1]; > cpu_feature = regs[3]; > cpu_feature2 = regs[2]; > +} > +#endif > + > +/* > + * Final stage of CPU identification. > + */ > +void > +finishidentcpu(void) > +{ > + u_int regs[4], cpu_stdext_disable; > +#ifdef __i386__ > + u_char ccr3; > #endif > > cpu_vendor_id = find_cpu_vendor_id(); > ___ > svn-src-...@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org" -- Tomorrow Will Never Die ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r322488 - in head/sys/dev/hyperv: include netvsc pcib storvsc utilities vmbus vmbus/amd64
Author: sephe Date: Mon Aug 14 06:00:50 2017 New Revision: 322488 URL: https://svnweb.freebsd.org/changeset/base/322488 Log: hyperv: Update copyright for the files changed in 2017 MFC after:3 days Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D11982 Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/netvsc/hn_nvs.c head/sys/dev/hyperv/netvsc/hn_nvs.h head/sys/dev/hyperv/netvsc/hn_rndis.c head/sys/dev/hyperv/netvsc/hn_rndis.h head/sys/dev/hyperv/netvsc/if_hn.c head/sys/dev/hyperv/netvsc/if_hnreg.h head/sys/dev/hyperv/netvsc/if_hnvar.h head/sys/dev/hyperv/pcib/vmbus_pcib.c head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c head/sys/dev/hyperv/storvsc/hv_vstorage.h head/sys/dev/hyperv/utilities/hv_kvp.c head/sys/dev/hyperv/utilities/vmbus_timesync.c head/sys/dev/hyperv/vmbus/amd64/hyperv_machdep.c head/sys/dev/hyperv/vmbus/hyperv.c head/sys/dev/hyperv/vmbus/vmbus.c head/sys/dev/hyperv/vmbus/vmbus_et.c Modified: head/sys/dev/hyperv/include/hyperv.h == --- head/sys/dev/hyperv/include/hyperv.hMon Aug 14 05:55:16 2017 (r322487) +++ head/sys/dev/hyperv/include/hyperv.hMon Aug 14 06:00:50 2017 (r322488) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2009-2012,2016 Microsoft Corp. + * Copyright (c) 2009-2012,2016-2017 Microsoft Corp. * Copyright (c) 2012 NetApp Inc. * Copyright (c) 2012 Citrix Inc. * All rights reserved. Modified: head/sys/dev/hyperv/netvsc/hn_nvs.c == --- head/sys/dev/hyperv/netvsc/hn_nvs.c Mon Aug 14 05:55:16 2017 (r322487) +++ head/sys/dev/hyperv/netvsc/hn_nvs.c Mon Aug 14 06:00:50 2017 (r322488) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2009-2012,2016 Microsoft Corp. + * Copyright (c) 2009-2012,2016-2017 Microsoft Corp. * Copyright (c) 2010-2012 Citrix Inc. * Copyright (c) 2012 NetApp Inc. * All rights reserved. Modified: head/sys/dev/hyperv/netvsc/hn_nvs.h == --- head/sys/dev/hyperv/netvsc/hn_nvs.h Mon Aug 14 05:55:16 2017 (r322487) +++ head/sys/dev/hyperv/netvsc/hn_nvs.h Mon Aug 14 06:00:50 2017 (r322488) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2009-2012,2016 Microsoft Corp. + * Copyright (c) 2009-2012,2016-2017 Microsoft Corp. * Copyright (c) 2010-2012 Citrix Inc. * Copyright (c) 2012 NetApp Inc. * All rights reserved. Modified: head/sys/dev/hyperv/netvsc/hn_rndis.c == --- head/sys/dev/hyperv/netvsc/hn_rndis.c Mon Aug 14 05:55:16 2017 (r322487) +++ head/sys/dev/hyperv/netvsc/hn_rndis.c Mon Aug 14 06:00:50 2017 (r322488) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2009-2012,2016 Microsoft Corp. + * Copyright (c) 2009-2012,2016-2017 Microsoft Corp. * Copyright (c) 2010-2012 Citrix Inc. * Copyright (c) 2012 NetApp Inc. * All rights reserved. Modified: head/sys/dev/hyperv/netvsc/hn_rndis.h == --- head/sys/dev/hyperv/netvsc/hn_rndis.h Mon Aug 14 05:55:16 2017 (r322487) +++ head/sys/dev/hyperv/netvsc/hn_rndis.h Mon Aug 14 06:00:50 2017 (r322488) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2009-2012,2016 Microsoft Corp. + * Copyright (c) 2009-2012,2016-2017 Microsoft Corp. * Copyright (c) 2010-2012 Citrix Inc. * Copyright (c) 2012 NetApp Inc. * All rights reserved. Modified: head/sys/dev/hyperv/netvsc/if_hn.c == --- head/sys/dev/hyperv/netvsc/if_hn.c Mon Aug 14 05:55:16 2017 (r322487) +++ head/sys/dev/hyperv/netvsc/if_hn.c Mon Aug 14 06:00:50 2017 (r322488) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2010-2012 Citrix Inc. - * Copyright (c) 2009-2012,2016 Microsoft Corp. + * Copyright (c) 2009-2012,2016-2017 Microsoft Corp. * Copyright (c) 2012 NetApp Inc. * All rights reserved. * Modified: head/sys/dev/hyperv/netvsc/if_hnreg.h == --- head/sys/dev/hyperv/netvsc/if_hnreg.h Mon Aug 14 05:55:16 2017 (r322487) +++ head/sys/dev/hyperv/netvsc/if_hnreg.h Mon Aug 14 06:00:50 2017 (r322488) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2016 Microsoft Corp. + * Copyright (c) 2016-2017 Microsoft Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/hyperv/netvsc/if_hnvar.h == --- head/sys/dev/hyperv/netvsc/if_hnvar.h Mon Aug 14 05:55:16 2017 (r322487) +++ head/sys/dev/hyperv/netvsc/if_hnvar.h Mon Aug 14 06:00:50 2017 (r322488) @@ -1,5
svn commit: r322487 - head/sys/dev/hyperv/netvsc
Author: sephe Date: Mon Aug 14 05:55:16 2017 New Revision: 322487 URL: https://svnweb.freebsd.org/changeset/base/322487 Log: hyperv/hn: Re-set datapath after synthetic parts reattached. Do this even for non-transparent mode VF. Better safe than sorry. MFC after:3 days Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D11981 Modified: head/sys/dev/hyperv/netvsc/if_hn.c Modified: head/sys/dev/hyperv/netvsc/if_hn.c == --- head/sys/dev/hyperv/netvsc/if_hn.c Mon Aug 14 05:46:50 2017 (r322486) +++ head/sys/dev/hyperv/netvsc/if_hn.c Mon Aug 14 05:55:16 2017 (r322487) @@ -3403,7 +3403,8 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) */ hn_resume(sc); - if (sc->hn_xvf_flags & HN_XVFFLAG_ENABLED) { + if ((sc->hn_flags & HN_FLAG_RXVF) || + (sc->hn_xvf_flags & HN_XVFFLAG_ENABLED)) { /* * Since we have reattached the NVS part, * change the datapath to VF again; in case ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r322486 - head/sys/dev/hyperv/netvsc
Author: sephe Date: Mon Aug 14 05:46:50 2017 New Revision: 322486 URL: https://svnweb.freebsd.org/changeset/base/322486 Log: hyperv/hn: Minor cleanup MFC after:3 days Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D11979 Modified: head/sys/dev/hyperv/netvsc/if_hn.c Modified: head/sys/dev/hyperv/netvsc/if_hn.c == --- head/sys/dev/hyperv/netvsc/if_hn.c Mon Aug 14 05:40:52 2017 (r322485) +++ head/sys/dev/hyperv/netvsc/if_hn.c Mon Aug 14 05:46:50 2017 (r322486) @@ -580,6 +580,12 @@ hn_rss_key_default[NDIS_HASH_KEYSIZE_TOEPLITZ] = { }; #endif /* !RSS */ +static const struct hyperv_guidhn_guid = { + .hv_guid = { + 0x63, 0x51, 0x61, 0xf8, 0x3e, 0xdf, 0xc5, 0x46, + 0x91, 0x3f, 0xf2, 0xd2, 0xf9, 0x65, 0xed, 0x0e } +}; + static device_method_t hn_methods[] = { /* Device interface */ DEVMETHOD(device_probe, hn_probe), @@ -1711,18 +1717,11 @@ hn_ifnet_lnkevent(void *xsc, struct ifnet *ifp, int li if_link_state_change(sc->hn_ifp, link_state); } -/* {F8615163-DF3E-46c5-913F-F2D2F965ED0E} */ -static const struct hyperv_guid g_net_vsc_device_type = { - .hv_guid = {0x63, 0x51, 0x61, 0xF8, 0x3E, 0xDF, 0xc5, 0x46, - 0x91, 0x3F, 0xF2, 0xD2, 0xF9, 0x65, 0xED, 0x0E} -}; - static int hn_probe(device_t dev) { - if (VMBUS_PROBE_GUID(device_get_parent(dev), dev, - _net_vsc_device_type) == 0) { + if (VMBUS_PROBE_GUID(device_get_parent(dev), dev, _guid) == 0) { device_set_desc(dev, "Hyper-V Network Interface"); return BUS_PROBE_DEFAULT; } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r322485 - head/sys/dev/hyperv/netvsc
Author: sephe Date: Mon Aug 14 05:40:52 2017 New Revision: 322485 URL: https://svnweb.freebsd.org/changeset/base/322485 Log: hyperv/hn: Fix/enhance receiving path when VF is activated. - Update hn(4)'s stats properly for non-transparent mode VF. - Allow BPF tapping to hn(4) for non-transparent mode VF. - Don't setup mbuf hash, if 'options RSS' is set. In Azure, when VF is activated, TCP SYN and SYN|ACK go through hn(4) while the rest of segments and ACKs belonging to the same TCP 4-tuple go through the VF. So don't setup mbuf hash, if a VF is activated and 'options RSS' is not enabled. hn(4) and the VF may use neither the same RSS hash key nor the same RSS hash function, so the hash value for packets belonging to the same flow could be different! - Disable LRO. hn(4) will only receive broadcast packets, multicast packets, TCP SYN and SYN|ACK (in Azure), LRO is useless for these packet types. For non-transparent, we definitely _cannot_ enable LRO at all, since the LRO flush will use hn(4) as the receiving interface; i.e. hn_ifp->if_input(hn_ifp, m). While I'm here, remove unapplied comment and minor style change. MFC after:3 days Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D11978 Modified: head/sys/dev/hyperv/netvsc/if_hn.c head/sys/dev/hyperv/netvsc/if_hnvar.h Modified: head/sys/dev/hyperv/netvsc/if_hn.c == --- head/sys/dev/hyperv/netvsc/if_hn.c Mon Aug 14 05:31:51 2017 (r322484) +++ head/sys/dev/hyperv/netvsc/if_hn.c Mon Aug 14 05:40:52 2017 (r322485) @@ -282,6 +282,8 @@ static bool hn_xpnt_vf_isready(struct hn_softc *); static voidhn_xpnt_vf_setready(struct hn_softc *); static voidhn_xpnt_vf_init_taskfunc(void *, int); static voidhn_xpnt_vf_init(struct hn_softc *); +static voidhn_xpnt_vf_setenable(struct hn_softc *); +static voidhn_xpnt_vf_setdisable(struct hn_softc *, bool); static int hn_rndis_rxinfo(const void *, int, struct hn_rxinfo *); @@ -1427,6 +1429,40 @@ hn_xpnt_vf_isready(struct hn_softc *sc) } static void +hn_xpnt_vf_setenable(struct hn_softc *sc) +{ + int i; + + HN_LOCK_ASSERT(sc); + + /* NOTE: hn_vf_lock for hn_transmit()/hn_qflush() */ + rm_wlock(>hn_vf_lock); + sc->hn_xvf_flags |= HN_XVFFLAG_ENABLED; + rm_wunlock(>hn_vf_lock); + + for (i = 0; i < sc->hn_rx_ring_cnt; ++i) + sc->hn_rx_ring[i].hn_rx_flags |= HN_RX_FLAG_XPNT_VF; +} + +static void +hn_xpnt_vf_setdisable(struct hn_softc *sc, bool clear_vf) +{ + int i; + + HN_LOCK_ASSERT(sc); + + /* NOTE: hn_vf_lock for hn_transmit()/hn_qflush() */ + rm_wlock(>hn_vf_lock); + sc->hn_xvf_flags &= ~HN_XVFFLAG_ENABLED; + if (clear_vf) + sc->hn_vf_ifp = NULL; + rm_wunlock(>hn_vf_lock); + + for (i = 0; i < sc->hn_rx_ring_cnt; ++i) + sc->hn_rx_ring[i].hn_rx_flags &= ~HN_RX_FLAG_XPNT_VF; +} + +static void hn_xpnt_vf_init(struct hn_softc *sc) { int error; @@ -1459,10 +1495,8 @@ hn_xpnt_vf_init(struct hn_softc *sc) */ hn_nvs_set_datapath(sc, HN_NVS_DATAPATH_VF); - /* NOTE: hn_vf_lock for hn_transmit()/hn_qflush() */ - rm_wlock(>hn_vf_lock); - sc->hn_xvf_flags |= HN_XVFFLAG_ENABLED; - rm_wunlock(>hn_vf_lock); + /* Mark transparent mode VF as enabled. */ + hn_xpnt_vf_setenable(sc); } static void @@ -1648,11 +1682,8 @@ hn_ifnet_detevent(void *xsc, struct ifnet *ifp) hn_resume_mgmt(sc); } - /* NOTE: hn_vf_lock for hn_transmit()/hn_qflush() */ - rm_wlock(>hn_vf_lock); - sc->hn_xvf_flags &= ~HN_XVFFLAG_ENABLED; - sc->hn_vf_ifp = NULL; - rm_wunlock(>hn_vf_lock); + /* Mark transparent mode VF as disabled. */ + hn_xpnt_vf_setdisable(sc, true /* clear hn_vf_ifp */); rm_wlock(_vfmap_lock); @@ -2994,13 +3025,16 @@ static int hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int dlen, const struct hn_rxinfo *info) { - struct ifnet *ifp; + struct ifnet *ifp, *hn_ifp = rxr->hn_ifp; struct mbuf *m_new; int size, do_lro = 0, do_csum = 1; int hash_type; - /* If the VF is active, inject the packet through the VF */ - ifp = rxr->hn_rxvf_ifp ? rxr->hn_rxvf_ifp : rxr->hn_ifp; + /* +* If the non-transparent mode VF is active, inject this packet +* into the VF. +*/ + ifp = rxr->hn_rxvf_ifp ? rxr->hn_rxvf_ifp : hn_ifp; if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { /* @@ -3014,10 +3048,15 @@ hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int return (0); } +
svn commit: r322483 - head/sys/dev/hyperv/netvsc
Author: sephe Date: Mon Aug 14 05:30:02 2017 New Revision: 322483 URL: https://svnweb.freebsd.org/changeset/base/322483 Log: hyperv/hn: Update VF's ibytes properly under transparent VF mode. While, I'm here add comment about why updating VF's imcast stat is not necessary. MFC after:3 days Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D11948 Modified: head/sys/dev/hyperv/netvsc/if_hn.c Modified: head/sys/dev/hyperv/netvsc/if_hn.c == --- head/sys/dev/hyperv/netvsc/if_hn.c Mon Aug 14 04:48:35 2017 (r322482) +++ head/sys/dev/hyperv/netvsc/if_hn.c Mon Aug 14 05:30:02 2017 (r322483) @@ -1266,16 +1266,37 @@ hn_xpnt_vf_input(struct ifnet *vf_ifp, struct mbuf *m) rm_runlock(_vfmap_lock, ); if (hn_ifp != NULL) { - /* -* Fix up rcvif and go through hn(4)'s if_input and -* increase ipackets. -*/ for (mn = m; mn != NULL; mn = mn->m_nextpkt) { - /* Allow tapping on the VF. */ + /* +* Allow tapping on the VF. +*/ ETHER_BPF_MTAP(vf_ifp, mn); + + /* +* Update VF stats. +*/ + if ((vf_ifp->if_capenable & IFCAP_HWSTATS) == 0) { + if_inc_counter(vf_ifp, IFCOUNTER_IBYTES, + mn->m_pkthdr.len); + } + /* +* XXX IFCOUNTER_IMCAST +* This stat updating is kinda invasive, since it +* requires two checks on the mbuf: the length check +* and the ethernet header check. As of this write, +* all multicast packets go directly to hn(4), which +* makes imcast stat updating in the VF a try in vian. +*/ + + /* +* Fix up rcvif and increase hn(4)'s ipackets. +*/ mn->m_pkthdr.rcvif = hn_ifp; if_inc_counter(hn_ifp, IFCOUNTER_IPACKETS, 1); } + /* +* Go through hn(4)'s if_input. +*/ hn_ifp->if_input(hn_ifp, m); } else { /* ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r322299 - head/sys/dev/hyperv/netvsc
Author: sephe Date: Wed Aug 9 05:59:45 2017 New Revision: 322299 URL: https://svnweb.freebsd.org/changeset/base/322299 Log: hyperv/hn: Implement transparent mode network VF. How network VF works with hn(4) on Hyper-V in transparent mode: - Each network VF has a cooresponding hn(4). - The network VF and the it's cooresponding hn(4) have the same hardware address. - Once the network VF is attached, the cooresponding hn(4) waits several seconds to make sure that the network VF attach routing completes, then: o Set the intersection of the network VF's if_capabilities and the cooresponding hn(4)'s if_capabilities to the cooresponding hn(4)'s if_capabilities. And adjust the cooresponding hn(4) if_capable and if_hwassist accordingly. (*) o Make sure that the cooresponding hn(4)'s TSO parameters meet the constraints posed by both the network VF and the cooresponding hn(4). (*) o The network VF's if_input is overridden. The overriding if_input changes the input packet's rcvif to the cooreponding hn(4). The network layers are tricked into thinking that all packets are neceived by the cooresponding hn(4). o If the cooresponding hn(4) was brought up, bring up the network VF. The transmission dispatched to the cooresponding hn(4) are redispatched to the network VF. o Bringing down the cooresponding hn(4) also brings down the network VF. o All IOCTLs issued to the cooresponding hn(4) are pass-through'ed to the network VF; the cooresponding hn(4) changes its internal state if necessary. o The media status of the cooresponding hn(4) solely relies on the network VF. o If there are multicast filters on the cooresponding hn(4), allmulti will be enabled on the network VF. (**) - Once the network VF is detached. Undo all damages did to the cooresponding hn(4) in the above item. NOTE: No operation should be issued directly to the network VF, if the network VF transparent mode is enabled. The network VF transparent mode can be enabled by setting tunable hw.hn.vf_transparent to 1. The network VF transparent mode is _not_ enabled by default, as of this commit. The benefit of the network VF transparent mode is that the network VF attachment and detachment are transparent to all network layers; e.g. live migration detaches and reattaches the network VF. The major drawbacks of the network VF transparent mode: - The netmap(4) support is lost, even if the VF supports it. - ALTQ does not work, since if_start method cannot be properly supported. (*) These decisions were made so that things will not be messed up too much during the transition period. (**) This does _not_ need to go through the fancy multicast filter management stuffs like what vlan(4) has, at least currently: - As of this write, multicast does not work in Azure. - As of this write, multicast packets go through the cooresponding hn(4). MFC after:3 days Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D11803 Modified: head/sys/dev/hyperv/netvsc/if_hn.c head/sys/dev/hyperv/netvsc/if_hnreg.h head/sys/dev/hyperv/netvsc/if_hnvar.h Modified: head/sys/dev/hyperv/netvsc/if_hn.c == --- head/sys/dev/hyperv/netvsc/if_hn.c Wed Aug 9 05:21:57 2017 (r322298) +++ head/sys/dev/hyperv/netvsc/if_hn.c Wed Aug 9 05:59:45 2017 (r322299) @@ -123,6 +123,8 @@ __FBSDID("$FreeBSD$"); #define HN_VFMAP_SIZE_DEF 8 +#define HN_XPNT_VF_ATTWAIT_MIN 2 /* seconds */ + /* YYY should get it from the underlying channel */ #define HN_TX_DESC_CNT 512 @@ -263,6 +265,7 @@ static void hn_ifnet_event(void *, struct ifnet *, i static voidhn_ifaddr_event(void *, struct ifnet *); static voidhn_ifnet_attevent(void *, struct ifnet *); static voidhn_ifnet_detevent(void *, struct ifnet *); +static voidhn_ifnet_lnkevent(void *, struct ifnet *, int); static boolhn_ismyvf(const struct hn_softc *, const struct ifnet *); @@ -270,6 +273,15 @@ static voidhn_rxvf_change(struct hn_softc *, struct ifnet *, bool); static voidhn_rxvf_set(struct hn_softc *, struct ifnet *); static voidhn_rxvf_set_task(void *, int); +static voidhn_xpnt_vf_input(struct ifnet *, struct mbuf *); +static int hn_xpnt_vf_iocsetflags(struct hn_softc *); +static int hn_xpnt_vf_iocsetcaps(struct hn_softc *, + struct ifreq *); +static void
svn commit: r321965 - head/sys/dev/hyperv/utilities
Author: sephe Date: Thu Aug 3 01:44:40 2017 New Revision: 321965 URL: https://svnweb.freebsd.org/changeset/base/321965 Log: hyperv/kvp: Use proper size macro for adapter id. Submitted by: Christopher Ertl MFC after:3 days Sponsored by: Microsoft Modified: head/sys/dev/hyperv/utilities/hv_kvp.c Modified: head/sys/dev/hyperv/utilities/hv_kvp.c == --- head/sys/dev/hyperv/utilities/hv_kvp.c Thu Aug 3 01:40:05 2017 (r321964) +++ head/sys/dev/hyperv/utilities/hv_kvp.c Thu Aug 3 01:44:40 2017 (r321965) @@ -253,7 +253,7 @@ hv_kvp_convert_utf8_ipinfo_to_utf16(struct hv_kvp_msg UNUSED_FLAG, _dns); utf8_to_utf16((uint16_t *)host_ip_msg->kvp_ip_val.adapter_id, - MAX_IP_ADDR_SIZE, + MAX_ADAPTER_ID_SIZE, (char *)umsg->body.kvp_ip_val.adapter_id, strlen((char *)umsg->body.kvp_ip_val.adapter_id), UNUSED_FLAG, ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r321837 - head/sys/dev/hyperv/netvsc
Author: sephe Date: Tue Aug 1 02:55:43 2017 New Revision: 321837 URL: https://svnweb.freebsd.org/changeset/base/321837 Log: hyperv/hn: Add comment about ether_ifattach event subscription. MFC after:3 days Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D11710 Modified: head/sys/dev/hyperv/netvsc/if_hn.c Modified: head/sys/dev/hyperv/netvsc/if_hn.c == --- head/sys/dev/hyperv/netvsc/if_hn.c Tue Aug 1 02:45:54 2017 (r321836) +++ head/sys/dev/hyperv/netvsc/if_hn.c Tue Aug 1 02:55:43 2017 (r321837) @@ -1541,6 +1541,12 @@ hn_attach(device_t dev) sc->hn_ifaddr_evthand = EVENTHANDLER_REGISTER(ifaddr_event, hn_ifaddr_event, sc, EVENTHANDLER_PRI_ANY); + /* +* NOTE: +* Subscribe ether_ifattach event, instead of ifnet_arrival event, +* since interface's LLADDR is needed; interface LLADDR is not +* available when ifnet_arrival event is triggered. +*/ sc->hn_ifnet_atthand = EVENTHANDLER_REGISTER(ether_ifattach_event, hn_ifnet_attevent, sc, EVENTHANDLER_PRI_ANY); sc->hn_ifnet_dethand = EVENTHANDLER_REGISTER(ifnet_departure_event, ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r321836 - head/sys/dev/hyperv/netvsc
Author: sephe Date: Tue Aug 1 02:45:54 2017 New Revision: 321836 URL: https://svnweb.freebsd.org/changeset/base/321836 Log: hyperv/hn: Renaming and minor cleanup This prepares for the upcoming transparent VF support. MFC after:3 days Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D11708 Modified: head/sys/dev/hyperv/netvsc/if_hn.c head/sys/dev/hyperv/netvsc/if_hnvar.h Modified: head/sys/dev/hyperv/netvsc/if_hn.c == --- head/sys/dev/hyperv/netvsc/if_hn.c Tue Aug 1 01:39:54 2017 (r321835) +++ head/sys/dev/hyperv/netvsc/if_hn.c Tue Aug 1 02:45:54 2017 (r321836) @@ -222,9 +222,9 @@ struct hn_rxinfo { uint32_thash_value; }; -struct hn_update_vf { +struct hn_rxvf_setarg { struct hn_rx_ring *rxr; - struct ifnet*vf; + struct ifnet*vf_ifp; }; #define HN_RXINFO_VLAN 0x0001 @@ -264,6 +264,13 @@ static voidhn_ifaddr_event(void *, struct ifnet *); static voidhn_ifnet_attevent(void *, struct ifnet *); static voidhn_ifnet_detevent(void *, struct ifnet *); +static boolhn_ismyvf(const struct hn_softc *, + const struct ifnet *); +static voidhn_rxvf_change(struct hn_softc *, + struct ifnet *, bool); +static voidhn_rxvf_set(struct hn_softc *, struct ifnet *); +static voidhn_rxvf_set_task(void *, int); + static int hn_rndis_rxinfo(const void *, int, struct hn_rxinfo *); static voidhn_rndis_rx_data(struct hn_rx_ring *, @@ -801,7 +808,7 @@ hn_rxfilter_config(struct hn_softc *sc) HN_LOCK_ASSERT(sc); if ((ifp->if_flags & IFF_PROMISC) || - (sc->hn_flags & HN_FLAG_VF)) { + (sc->hn_flags & HN_FLAG_RXVF)) { filter = NDIS_PACKET_TYPE_PROMISCUOUS; } else { filter = NDIS_PACKET_TYPE_DIRECTED; @@ -991,39 +998,39 @@ hn_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *i } static void -hn_update_vf_task(void *arg, int pending __unused) +hn_rxvf_set_task(void *xarg, int pending __unused) { - struct hn_update_vf *uv = arg; + struct hn_rxvf_setarg *arg = xarg; - uv->rxr->hn_rxvf_ifp = uv->vf; + arg->rxr->hn_rxvf_ifp = arg->vf_ifp; } static void -hn_update_vf(struct hn_softc *sc, struct ifnet *vf) +hn_rxvf_set(struct hn_softc *sc, struct ifnet *vf_ifp) { struct hn_rx_ring *rxr; - struct hn_update_vf uv; + struct hn_rxvf_setarg arg; struct task task; int i; HN_LOCK_ASSERT(sc); - TASK_INIT(, 0, hn_update_vf_task, ); + TASK_INIT(, 0, hn_rxvf_set_task, ); for (i = 0; i < sc->hn_rx_ring_cnt; ++i) { rxr = >hn_rx_ring[i]; if (i < sc->hn_rx_ring_inuse) { - uv.rxr = rxr; - uv.vf = vf; + arg.rxr = rxr; + arg.vf_ifp = vf_ifp; vmbus_chan_run_task(rxr->hn_chan, ); } else { - rxr->hn_rxvf_ifp = vf; + rxr->hn_rxvf_ifp = vf_ifp; } } } -static __inline bool +static bool hn_ismyvf(const struct hn_softc *sc, const struct ifnet *ifp) { const struct ifnet *hn_ifp; @@ -1048,7 +1055,7 @@ hn_ismyvf(const struct hn_softc *sc, const struct ifne } static void -hn_set_vf(struct hn_softc *sc, struct ifnet *ifp, bool vf) +hn_rxvf_change(struct hn_softc *sc, struct ifnet *ifp, bool rxvf) { struct ifnet *hn_ifp; @@ -1059,21 +1066,19 @@ hn_set_vf(struct hn_softc *sc, struct ifnet *ifp, bool if (!hn_ismyvf(sc, ifp)) goto out; - hn_ifp = sc->hn_ifp; - /* Now we're sure 'ifp' is a real VF device. */ - if (vf) { - if (sc->hn_flags & HN_FLAG_VF) + if (rxvf) { + if (sc->hn_flags & HN_FLAG_RXVF) goto out; - sc->hn_flags |= HN_FLAG_VF; + sc->hn_flags |= HN_FLAG_RXVF; hn_rxfilter_config(sc); } else { - if (!(sc->hn_flags & HN_FLAG_VF)) + if (!(sc->hn_flags & HN_FLAG_RXVF)) goto out; - sc->hn_flags &= ~HN_FLAG_VF; + sc->hn_flags &= ~HN_FLAG_RXVF; if (hn_ifp->if_drv_flags & IFF_DRV_RUNNING) hn_rxfilter_config(sc); else @@ -1081,11 +1086,11 @@ hn_set_vf(struct hn_softc *sc, struct ifnet *ifp, bool } hn_nvs_set_datapath(sc, - vf ? HN_NVS_DATAPATH_VF : HN_NVS_DATAPATH_SYNTHETIC); +
svn commit: r321763 - head/usr.bin/calendar/calendars
Author: sephe Date: Mon Jul 31 07:48:08 2017 New Revision: 321763 URL: https://svnweb.freebsd.org/changeset/base/321763 Log: calendar: Add myself. Reminded by: mckusick Modified: head/usr.bin/calendar/calendars/calendar.freebsd Modified: head/usr.bin/calendar/calendars/calendar.freebsd == --- head/usr.bin/calendar/calendars/calendar.freebsdMon Jul 31 07:18:15 2017(r321762) +++ head/usr.bin/calendar/calendars/calendar.freebsdMon Jul 31 07:48:08 2017(r321763) @@ -364,6 +364,7 @@ 11/21 Mark Johnston <ma...@freebsd.org> born in Toronto, Ontario, Canada, 1989 11/22 Frederic Culot <cu...@freebsd.org> born in Saint-Germain-En-Laye, France, 1976 11/23 Josef Lawrence Karthauser <j...@freebsd.org> born in Pembury, Kent, United Kingdom, 1972 +11/23 Sepherosa Ziehau <se...@freebsd.org> born in Shanghai, China, 1980 11/24 Andrey Zakhvatov <a...@freebsd.org> born in Chelyabinsk, Russian Federation, 1974 11/24 Daniel Gerzo <dan...@freebsd.org> born in Bratislava, Slovakia, 1986 11/28 Nik Clayton <n...@freebsd.org> born in Peterborough, United Kingdom, 1973 ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r321762 - in head: contrib/hyperv/tools/scripts etc/devd libexec/hyperv
Author: sephe Date: Mon Jul 31 07:18:15 2017 New Revision: 321762 URL: https://svnweb.freebsd.org/changeset/base/321762 Log: hyperv: Add VF bringup scripts and devd rules. How network VF works with hn(4) on Hyper-V in non-transparent mode: - Each network VF has a cooresponding hn(4). - The network VF and the it's cooresponding hn(4) have the same hardware address. - Once the network VF is up, e.g. ifconfig VF up: o All of the transmission should go through the network VF. o Most of the reception goes through the network VF. o Small amount of reception may go through the cooresponding hn(4). This reception will happen, even if the the cooresponding hn(4) is down. The cooresponding hn(4) will change the reception interface to the network VF, so that network layer and application layer will be tricked into thinking that these packets were received by the network VF. o The cooresponding hn(4) pretends the physical link is down. - Once the network VF is down or detached: o All of the transmission should go through the cooresponding hn(4). o All of the reception goes through the cooresponding hn(4). o The cooresponding hn(4) fallbacks to the original physical link detection logic. All these features are mainly used to help live migration, during which the network VF will be detached, while the network communication to the VM must not be cut off. In order to reach this level of live migration transparency, we use failover mode lagg(4) with the network VF and the cooresponding hn(4) attached to it. To ease user configuration for both network VF and non-network VF, the lagg(4) will be created by the following rules, and the configuration of the cooresponding hn(4) will be applied to the lagg(4) automatically. Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D11635 Added: head/contrib/hyperv/tools/scripts/hyperv_vfattach head/contrib/hyperv/tools/scripts/hyperv_vfup Modified: head/etc/devd/hyperv.conf head/libexec/hyperv/Makefile Added: head/contrib/hyperv/tools/scripts/hyperv_vfattach == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/hyperv/tools/scripts/hyperv_vfattach Mon Jul 31 07:18:15 2017(r321762) @@ -0,0 +1,79 @@ +#!/bin/sh + +# +# If transparent VF is enabled, don't do anything. +# + +sysctl -n hw.hn.vf_transparent > /dev/null 2>&1 +if [ $? -ne 0 ] +then + # Old kernel; no transparent VF. + vf_transparent=0 +else + vf_transparent=`sysctl -n hw.hn.vf_transparent` +fi + +if [ $vf_transparent -ne 0 ] +then + # Transparent VF; done! + exit 0 +fi + +iface=$1 +delay=$2 + +if [ $delay -gt 0 ] +then + # + # Delayed VF up. + # + sleep $delay + ifconfig $iface up + # Done! + exit $? +fi + +# +# Check to see whether $iface is a VF or not. +# If $iface is a VF, bring it up now. +# + +# for hyperv_vf_delay +. /etc/rc.conf + +sysctl -n hw.hn.vflist > /dev/null 2>&1 +if [ $? -ne 0 ] +then + # Old kernel; nothing could be done properly. + exit 0 +fi +vf_list=`sysctl -n hw.hn.vflist` + +for vf in $vf_list +do + if [ $vf = $iface ] + then + # + # Linger a little bit (at least 2 seconds) mainly to + # make sure that $iface is fully attached. + # + # NOTE: + # In Azure hyperv_vf_delay should be configured to a + # large value, e.g. 120 seconds, to avoid racing cloud + # agent goofs. + # + test $hyperv_vf_delay -ge 2 > /dev/null 2>&1 + if [ $? -ne 0 ] + then + hyperv_vf_delay=2 + fi + # + # NOTE: + # "(sleep ..; ifconfig .. up) > /dev/null 2>&1 &" + # does _not_ work. + # + daemon -f /usr/libexec/hyperv/hyperv_vfattach \ + $iface $hyperv_vf_delay + break + fi +done Added: head/contrib/hyperv/tools/scripts/hyperv_vfup == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/hyperv/tools/scripts/hyperv_vfup Mon Jul 31 07:18:15 2017(r321762) @@ -0,0 +1,119 @@ +#!/bin/sh + +. /etc/rc.subr +. /etc/network.subr + +load_rc_config netif + +# +# Customized per-interface setup, e.g. hyperv_vfup.hn1 +# +# NOTE-CUSTOMIZE: +# Comment this out, if this script is used as template +# for the customized per-interface setup. +# +if [ -f /usr/libexec/hyperv/hyperv_vfup.$1 ] +then + /usr/libexec/hyperv/hyperv_vfup.$1 + exit $? +fi + +# NOTE-CUSTOMIZE: +#hn=${0##*.} +hn=$1 +hn_unit=`echo $hn | sed
svn commit: r321409 - head/sys/dev/hyperv/netvsc
Author: sephe Date: Mon Jul 24 04:00:43 2017 New Revision: 321409 URL: https://svnweb.freebsd.org/changeset/base/321409 Log: hyperv/hn: Ignore LINK_SPEED_CHANGE status. This status will be reported if the backend NIC is wireless; it's not useful. Due to the high frequency of the reporting, this could be pretty annoying; ignore it. MFC after:3 days Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D11651 Modified: head/sys/dev/hyperv/netvsc/if_hn.c Modified: head/sys/dev/hyperv/netvsc/if_hn.c == --- head/sys/dev/hyperv/netvsc/if_hn.c Mon Jul 24 03:59:50 2017 (r321408) +++ head/sys/dev/hyperv/netvsc/if_hn.c Mon Jul 24 04:00:43 2017 (r321409) @@ -5574,6 +5574,7 @@ hn_rndis_rx_status(struct hn_softc *sc, const void *da break; case RNDIS_STATUS_TASK_OFFLOAD_CURRENT_CONFIG: + case RNDIS_STATUS_LINK_SPEED_CHANGE: /* Not really useful; ignore. */ break; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r321408 - head/sys/net
Author: sephe Date: Mon Jul 24 03:59:50 2017 New Revision: 321408 URL: https://svnweb.freebsd.org/changeset/base/321408 Log: rndis: Add LINK_SPEED_CHANGE status Reviewed by: hselasky MFC after:3 days Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D11650 Modified: head/sys/net/rndis.h Modified: head/sys/net/rndis.h == --- head/sys/net/rndis.hMon Jul 24 03:52:32 2017(r321407) +++ head/sys/net/rndis.hMon Jul 24 03:59:50 2017(r321408) @@ -31,6 +31,7 @@ #defineRNDIS_STATUS_PENDING0x0103L #defineRNDIS_STATUS_MEDIA_CONNECT 0x4001000BL #defineRNDIS_STATUS_MEDIA_DISCONNECT 0x4001000CL +#defineRNDIS_STATUS_LINK_SPEED_CHANGE 0x40010013L #defineRNDIS_STATUS_NETWORK_CHANGE 0x40010018L #defineRNDIS_STATUS_TASK_OFFLOAD_CURRENT_CONFIG0x40020006L #defineRNDIS_STATUS_BUFFER_OVERFLOW0x8005L ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r321407 - head/sys/dev/hyperv/netvsc
Author: sephe Date: Mon Jul 24 03:52:32 2017 New Revision: 321407 URL: https://svnweb.freebsd.org/changeset/base/321407 Log: hyperv/hn: Export VF list and VF-HN mapping The VF-HN map will be used later on to implement "transparent VF". MFC after:3 days Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D11618 Modified: head/sys/dev/hyperv/netvsc/if_hn.c head/sys/dev/hyperv/netvsc/if_hnvar.h Modified: head/sys/dev/hyperv/netvsc/if_hn.c == --- head/sys/dev/hyperv/netvsc/if_hn.c Mon Jul 24 03:32:10 2017 (r321406) +++ head/sys/dev/hyperv/netvsc/if_hn.c Mon Jul 24 03:52:32 2017 (r321407) @@ -69,6 +69,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include #include @@ -119,6 +121,8 @@ __FBSDID("$FreeBSD$"); #define HN_RING_CNT_DEF_MAX8 +#define HN_VFMAP_SIZE_DEF 8 + /* YYY should get it from the underlying channel */ #define HN_TX_DESC_CNT 512 @@ -255,6 +259,11 @@ static int hn_ifmedia_upd(struct ifnet *); static voidhn_ifmedia_sts(struct ifnet *, struct ifmediareq *); +static voidhn_ifnet_event(void *, struct ifnet *, int); +static voidhn_ifaddr_event(void *, struct ifnet *); +static voidhn_ifnet_attevent(void *, struct ifnet *); +static voidhn_ifnet_detevent(void *, struct ifnet *); + static int hn_rndis_rxinfo(const void *, int, struct hn_rxinfo *); static voidhn_rndis_rx_data(struct hn_rx_ring *, @@ -303,6 +312,9 @@ static int hn_txagg_pktmax_sysctl(SYSCTL_HANDLER_ARG static int hn_txagg_align_sysctl(SYSCTL_HANDLER_ARGS); static int hn_polling_sysctl(SYSCTL_HANDLER_ARGS); static int hn_vf_sysctl(SYSCTL_HANDLER_ARGS); +static int hn_rxvf_sysctl(SYSCTL_HANDLER_ARGS); +static int hn_vflist_sysctl(SYSCTL_HANDLER_ARGS); +static int hn_vfmap_sysctl(SYSCTL_HANDLER_ARGS); static voidhn_stop(struct hn_softc *, bool); static voidhn_init_locked(struct hn_softc *); @@ -502,9 +514,21 @@ static int hn_tx_agg_pkts = -1; SYSCTL_INT(_hw_hn, OID_AUTO, tx_agg_pkts, CTLFLAG_RDTUN, _tx_agg_pkts, 0, "Packet transmission aggregation packet limit"); +/* VF list */ +SYSCTL_PROC(_hw_hn, OID_AUTO, vflist, CTLFLAG_RD | CTLTYPE_STRING, +0, 0, hn_vflist_sysctl, "A", "VF list"); + +/* VF mapping */ +SYSCTL_PROC(_hw_hn, OID_AUTO, vfmap, CTLFLAG_RD | CTLTYPE_STRING, +0, 0, hn_vfmap_sysctl, "A", "VF mapping"); + static u_int hn_cpu_index; /* next CPU for channel */ static struct taskqueue**hn_tx_taskque;/* shared TX taskqueues */ +static struct rmlock hn_vfmap_lock; +static int hn_vfmap_size; +static struct ifnet**hn_vfmap; + #ifndef RSS static const uint8_t hn_rss_key_default[NDIS_HASH_KEYSIZE_TOEPLITZ] = { @@ -971,7 +995,7 @@ hn_update_vf_task(void *arg, int pending __unused) { struct hn_update_vf *uv = arg; - uv->rxr->hn_vf = uv->vf; + uv->rxr->hn_rxvf_ifp = uv->vf; } static void @@ -994,37 +1018,50 @@ hn_update_vf(struct hn_softc *sc, struct ifnet *vf) uv.vf = vf; vmbus_chan_run_task(rxr->hn_chan, ); } else { - rxr->hn_vf = vf; + rxr->hn_rxvf_ifp = vf; } } } -static void -hn_set_vf(struct hn_softc *sc, struct ifnet *ifp, bool vf) +static __inline bool +hn_ismyvf(const struct hn_softc *sc, const struct ifnet *ifp) { - struct ifnet *hn_ifp; + const struct ifnet *hn_ifp; - HN_LOCK(sc); - - if (!(sc->hn_flags & HN_FLAG_SYNTH_ATTACHED)) - goto out; - hn_ifp = sc->hn_ifp; if (ifp == hn_ifp) - goto out; + return (false); if (ifp->if_alloctype != IFT_ETHER) - goto out; + return (false); /* Ignore lagg/vlan interfaces */ if (strcmp(ifp->if_dname, "lagg") == 0 || strcmp(ifp->if_dname, "vlan") == 0) - goto out; + return (false); if (bcmp(IF_LLADDR(ifp), IF_LLADDR(hn_ifp), ETHER_ADDR_LEN) != 0) + return (false); + + return (true); +} + +static void +hn_set_vf(struct hn_softc *sc, struct ifnet *ifp, bool vf) +{ + struct ifnet *hn_ifp; + + HN_LOCK(sc); + + if (!(sc->hn_flags & HN_FLAG_SYNTH_ATTACHED)) goto out; + if (!hn_ismyvf(sc, ifp)) + goto out; + +
svn commit: r321406 - head/sys/net
Author: sephe Date: Mon Jul 24 03:32:10 2017 New Revision: 321406 URL: https://svnweb.freebsd.org/changeset/base/321406 Log: ethernet: Add ethernet interface attached event and devctl notification. ifnet_arrival_event may not be adequate under certain situation; e.g. when the LLADDR is needed. So the ethernet ifattach event is announced after all necessary bits are setup. MFC after:3 days Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D11617 Modified: head/sys/net/ethernet.h head/sys/net/if_ethersubr.c Modified: head/sys/net/ethernet.h == --- head/sys/net/ethernet.h Mon Jul 24 02:13:46 2017(r321405) +++ head/sys/net/ethernet.h Mon Jul 24 03:32:10 2017(r321406) @@ -406,6 +406,12 @@ void ether_vlan_mtap(struct bpf_if *, struct mbuf *, void *, u_int); struct mbuf *ether_vlanencap(struct mbuf *, uint16_t); +#ifdef _SYS_EVENTHANDLER_H_ +/* new ethernet interface attached event */ +typedef void (*ether_ifattach_event_handler_t)(void *, struct ifnet *); +EVENTHANDLER_DECLARE(ether_ifattach_event, ether_ifattach_event_handler_t); +#endif + #else /* _KERNEL */ #include Modified: head/sys/net/if_ethersubr.c == --- head/sys/net/if_ethersubr.c Mon Jul 24 02:13:46 2017(r321405) +++ head/sys/net/if_ethersubr.c Mon Jul 24 03:32:10 2017(r321406) @@ -38,6 +38,8 @@ #include #include +#include +#include #include #include #include @@ -931,6 +933,11 @@ ether_ifattach(struct ifnet *ifp, const u_int8_t *lla) if_printf(ifp, "Ethernet address: %6D\n", lla, ":"); uuid_ether_add(LLADDR(sdl)); + + /* Add necessary bits are setup; announce it now. */ + EVENTHANDLER_INVOKE(ether_ifattach_event, ifp); + if (IS_DEFAULT_VNET(curvnet)) + devctl_notify("ETHERNET", ifp->if_xname, "IFATTACH", NULL); } /* ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r321286 - head/sys/dev/hyperv/storvsc
Author: sephe Date: Thu Jul 20 07:13:26 2017 New Revision: 321286 URL: https://svnweb.freebsd.org/changeset/base/321286 Log: hyperv/storvsc: Force SPC3 for CDROM attached. This unbreaks the CDROM attaching on GEN2 VMs. On GEN1 VMs, CDROM is attached to emulated ATA controller. PR: 220790 Submitted by: Hongjiang Zhang MFC after:3 days Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D11634 Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c == --- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.cThu Jul 20 06:54:58 2017(r321285) +++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.cThu Jul 20 07:13:26 2017(r321286) @@ -2210,6 +2210,23 @@ storvsc_io_done(struct hv_storvsc_request *reqp) resp_buf[3], resp_buf[4]); } /* +* XXX: Hyper-V (since win2012r2) responses inquiry with +* unknown version (0) for GEN-2 DVD device. +* Manually set the version number to SPC3 in order to +* ask CAM to continue probing with "PROBE_REPORT_LUNS". +* see probedone() in scsi_xpt.c +*/ + if (SID_TYPE(inq_data) == T_CDROM && + inq_data->version == 0 && + (vmstor_proto_version >= VMSTOR_PROTOCOL_VERSION_WIN8)) { + inq_data->version = SCSI_REV_SPC3; + if (bootverbose) { + xpt_print(ccb->ccb_h.path, + "set version from 0 to %d\n", + inq_data->version); + } + } + /* * XXX: Manually fix the wrong response returned from WS2012 */ if (!is_scsi_valid(inq_data) && @@ -2218,7 +2235,7 @@ storvsc_io_done(struct hv_storvsc_request *reqp) vmstor_proto_version == VMSTOR_PROTOCOL_VERSION_WIN7)) { if (data_len >= 4 && (resp_buf[2] == 0 || resp_buf[3] == 0)) { - resp_buf[2] = 5; // verion=5 means SPC-3 + resp_buf[2] = SCSI_REV_SPC3; resp_buf[3] = 2; // resp fmt must be 2 if (bootverbose) xpt_print(ccb->ccb_h.path, ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r320490 - head/sys/dev/hyperv/input
Author: sephe Date: Fri Jun 30 03:01:22 2017 New Revision: 320490 URL: https://svnweb.freebsd.org/changeset/base/320490 Log: hyperv/input: Remove unnecessary inclusion. The unbreaks gcc compilation. Submitted by: Ryan Libby MFC after:1 week Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D11415 Modified: head/sys/dev/hyperv/input/hv_kbdc.c Modified: head/sys/dev/hyperv/input/hv_kbdc.c == --- head/sys/dev/hyperv/input/hv_kbdc.c Fri Jun 30 02:11:32 2017 (r320489) +++ head/sys/dev/hyperv/input/hv_kbdc.c Fri Jun 30 03:01:22 2017 (r320490) @@ -49,7 +49,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r320184 - head/sys/dev/hyperv/storvsc
Author: sephe Date: Wed Jun 21 06:44:56 2017 New Revision: 320184 URL: https://svnweb.freebsd.org/changeset/base/320184 Log: hyperv/storvsc: Reduce log verbosity On some windows hosts TEST_UNIT_READY command will return SRB_STATUS_ERROR and sense data "NOT READY asc:3a,1 (Medium not present - tray closed)", this occurs periodically, and not hurt anything else. So, we prefer to ignore this kind of errors. PR: 219973 Submitted by: Hongjiang Zhang MFC after:3 days Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D11271 Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c == --- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.cWed Jun 21 06:34:06 2017(r320183) +++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.cWed Jun 21 06:44:56 2017(r320184) @@ -2095,6 +2095,7 @@ storvsc_io_done(struct hv_storvsc_request *reqp) struct vmscsi_req *vm_srb = >vstor_packet.u.vm_srb; bus_dma_segment_t *ori_sglist = NULL; int ori_sg_count = 0; + const struct scsi_generic *cmd; /* destroy bounce buffer if it is used */ if (reqp->bounce_sgl_count) { @@ -2145,16 +2146,14 @@ storvsc_io_done(struct hv_storvsc_request *reqp) callout_drain(>callout); } #endif + cmd = (const struct scsi_generic *) + ((ccb->ccb_h.flags & CAM_CDB_POINTER) ? +csio->cdb_io.cdb_ptr : csio->cdb_io.cdb_bytes); ccb->ccb_h.status &= ~CAM_SIM_QUEUED; ccb->ccb_h.status &= ~CAM_STATUS_MASK; int srb_status = SRB_STATUS(vm_srb->srb_status); if (vm_srb->scsi_status == SCSI_STATUS_OK) { - const struct scsi_generic *cmd; - - cmd = (const struct scsi_generic *) - ((ccb->ccb_h.flags & CAM_CDB_POINTER) ? -csio->cdb_io.cdb_ptr : csio->cdb_io.cdb_bytes); if (srb_status != SRB_STATUS_SUCCESS) { /* * If there are errors, for example, invalid LUN, @@ -2252,11 +2251,23 @@ storvsc_io_done(struct hv_storvsc_request *reqp) } } } else { - mtx_lock(>hs_lock); - xpt_print(ccb->ccb_h.path, - "storvsc scsi_status = %d\n", - vm_srb->scsi_status); - mtx_unlock(>hs_lock); + /** +* On Some Windows hosts TEST_UNIT_READY command can return +* SRB_STATUS_ERROR and sense data, for example, asc=0x3a,1 +* "(Medium not present - tray closed)". This error can be +* ignored since it will be sent to host periodically. +*/ + boolean_t unit_not_ready = \ + vm_srb->scsi_status == SCSI_STATUS_CHECK_COND && + cmd->opcode == TEST_UNIT_READY && + srb_status == SRB_STATUS_ERROR; + if (!unit_not_ready && bootverbose) { + mtx_lock(>hs_lock); + xpt_print(ccb->ccb_h.path, + "storvsc scsi_status = %d, srb_status = %d\n", + vm_srb->scsi_status, srb_status); + mtx_unlock(>hs_lock); + } ccb->ccb_h.status |= CAM_SCSI_STATUS_ERROR; } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r318512 - head/sys/net
Author: sephe Date: Fri May 19 01:42:31 2017 New Revision: 318512 URL: https://svnweb.freebsd.org/changeset/base/318512 Log: net/vlan: Revert 305177 Miss read the parentheses. Reported by: oleg@ Reviewed by: hps@ MFC after:3 days Sponsored by: Microsoft Modified: head/sys/net/ethernet.h Modified: head/sys/net/ethernet.h == --- head/sys/net/ethernet.h Fri May 19 01:23:06 2017(r318511) +++ head/sys/net/ethernet.h Fri May 19 01:42:31 2017(r318512) @@ -92,7 +92,7 @@ struct ether_vlan_header { #defineEVL_PRIOFTAG(tag) (((tag) >> 13) & 7) #defineEVL_CFIOFTAG(tag) (((tag) >> 12) & 1) #defineEVL_MAKETAG(vlid, pri, cfi) \ - ((pri) & 7) << 13) | ((cfi) & 1)) << 12) | ((vlid) & EVL_VLID_MASK)) + ((pri) & 7) << 1) | ((cfi) & 1)) << 12) | ((vlid) & EVL_VLID_MASK)) /* * NOTE: 0x-0x05DC (0..1500) are generally IEEE 802.3 length fields. ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r305177 - head/sys/net
Oh, my fault. I will revert it. On Thu, May 18, 2017 at 11:11 PM, Hans Petter Selasky <h...@selasky.org> wrote: > On 05/18/17 17:00, Oleg Bulyzhin wrote: >> >> On Thu, May 18, 2017 at 04:25:01PM +0200, Hans Petter Selasky wrote: >>> >>> On 05/18/17 16:04, Oleg Bulyzhin wrote: >>>> >>>> On Thu, Sep 01, 2016 at 06:32:35AM +, Sepherosa Ziehau wrote: >>>>> >>>>> Author: sephe >>>>> Date: Thu Sep 1 06:32:35 2016 >>>>> New Revision: 305177 >>>>> URL: https://svnweb.freebsd.org/changeset/base/305177 >>>>> >>>>> Log: >>>>> net/vlan: Shift for pri is 13 (pri mask 0xe000) not 1. >>>>> Reviewed by:araujo, hps >>>>> MFC after: 1 week >>>>> Sponsored by: Microsoft >>>>> Differential Revision: https://reviews.freebsd.org/D7710 >>>>> >>>>> Modified: >>>>> head/sys/net/ethernet.h >>>>> >>>>> Modified: head/sys/net/ethernet.h >>>>> >>>>> == >>>>> --- head/sys/net/ethernet.h Thu Sep 1 06:05:08 2016 >>>>> (r305176) >>>>> +++ head/sys/net/ethernet.h Thu Sep 1 06:32:35 2016 >>>>> (r305177) >>>>> @@ -92,7 +92,7 @@ struct ether_vlan_header { >>>>>#define EVL_PRIOFTAG(tag) (((tag) >> 13) & 7) >>>>>#define EVL_CFIOFTAG(tag) (((tag) >> 12) & 1) >>>>>#define EVL_MAKETAG(vlid, pri, cfi) >>>>> \ >>>>> - ((pri) & 7) << 1) | ((cfi) & 1)) << 12) | ((vlid) & >>>>> EVL_VLID_MASK)) >>>>> + ((pri) & 7) << 13) | ((cfi) & 1)) << 12) | ((vlid) & >>>>> EVL_VLID_MASK)) >>>>> /* >>>>> * NOTE: 0x-0x05DC (0..1500) are generally IEEE 802.3 length >>>>> fields. >>>> >>>> >>>> Please revert this one. It's just plain wrong and previous one was ok. >>>> >>> >>> Hi, >>> >>> Can you explain a bit more what is wrong? >>> >>>> If you care about readability it should be: >>>> pri) & 7) << 13) | (((cfi) & 1) << 12) | ((vlid) & EVL_VLID_MASK)) >>> >>> >>> Isn't this exactly what the patch is doing? -R ??? >> >> >> Current version is shifting pri out of uint16. If you examine parentheses: >> pri is shifted left 13, then 12. >> Original version did it right (shift 1, then 12 (total 13)). >> > > Hi Oleg, > > I see. The VLAN priority is then always zero after this change. > > I'll let Sepherosa handle the revert and/or readability update. > > --HPS -- Tomorrow Will Never Die ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r318136 - in head/sys: conf dev/acpica dev/hyperv/vmbus modules/hyperv/vmbus
Author: sephe Date: Wed May 10 05:28:14 2017 New Revision: 318136 URL: https://svnweb.freebsd.org/changeset/base/318136 Log: hyperv/vmbus: Reorganize vmbus device tree For GEN1 Hyper-V, vmbus is attached to pcib0, which contains the resources for PCI passthrough and SR-IOV. There is no acpi_syscontainer0 on GEN1 Hyper-V. For GEN2 Hyper-V, vmbus is attached to acpi_syscontainer0, which contains the resources for PCI passthrough and SR-IOV. There is no pcib0 on GEN2 Hyper-V. The ACPI VMBUS device now only holds its _CRS, which is empty as of this commit; its existence is mainly for upward compatibility. Device tree structure is suggested by jhb@. Tested-by:dexuan@ Collabrated-wth: dexuan@ MFC after:1 week Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D10565 Added: head/sys/dev/acpica/acpi_container.c (contents, props changed) head/sys/dev/hyperv/vmbus/vmbus_res.c (contents, props changed) Modified: head/sys/conf/files head/sys/conf/files.amd64 head/sys/conf/files.i386 head/sys/dev/acpica/acpi_pcib_acpi.c head/sys/dev/hyperv/vmbus/vmbus.c head/sys/modules/hyperv/vmbus/Makefile Modified: head/sys/conf/files == --- head/sys/conf/files Wed May 10 05:07:41 2017(r318135) +++ head/sys/conf/files Wed May 10 05:28:14 2017(r318136) @@ -673,6 +673,7 @@ dev/acpica/acpi_perf.c optional acpi dev/acpica/acpi_powerres.c optional acpi dev/acpica/acpi_quirk.coptional acpi dev/acpica/acpi_resource.c optional acpi +dev/acpica/acpi_container.coptional acpi dev/acpica/acpi_smbat.coptional acpi dev/acpica/acpi_thermal.c optional acpi dev/acpica/acpi_throttle.c optional acpi Modified: head/sys/conf/files.amd64 == --- head/sys/conf/files.amd64 Wed May 10 05:07:41 2017(r318135) +++ head/sys/conf/files.amd64 Wed May 10 05:28:14 2017(r318136) @@ -323,6 +323,7 @@ dev/hyperv/vmbus/vmbus_br.c optional dev/hyperv/vmbus/vmbus_chan.c optionalhyperv dev/hyperv/vmbus/vmbus_et.coptionalhyperv dev/hyperv/vmbus/vmbus_if.moptionalhyperv +dev/hyperv/vmbus/vmbus_res.c optionalhyperv dev/hyperv/vmbus/vmbus_xact.c optionalhyperv dev/hyperv/vmbus/amd64/hyperv_machdep.coptional hyperv dev/hyperv/vmbus/amd64/vmbus_vector.S optionalhyperv Modified: head/sys/conf/files.i386 == --- head/sys/conf/files.i386Wed May 10 05:07:41 2017(r318135) +++ head/sys/conf/files.i386Wed May 10 05:28:14 2017(r318136) @@ -244,6 +244,7 @@ dev/hyperv/vmbus/vmbus_br.c optional dev/hyperv/vmbus/vmbus_chan.c optionalhyperv dev/hyperv/vmbus/vmbus_et.coptionalhyperv dev/hyperv/vmbus/vmbus_if.moptionalhyperv +dev/hyperv/vmbus/vmbus_res.c optionalhyperv dev/hyperv/vmbus/vmbus_xact.c optionalhyperv dev/hyperv/vmbus/i386/hyperv_machdep.c optionalhyperv dev/hyperv/vmbus/i386/vmbus_vector.S optionalhyperv Added: head/sys/dev/acpica/acpi_container.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/acpica/acpi_container.cWed May 10 05:28:14 2017 (r318136) @@ -0,0 +1,166 @@ +/*- + * Copyright (c) 2017 Microsoft Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice unmodified, this list of conditions, and the following + *disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO,
svn commit: r317821 - head/sys/dev/hyperv/input
Author: sephe Date: Fri May 5 03:28:30 2017 New Revision: 317821 URL: https://svnweb.freebsd.org/changeset/base/317821 Log: hyperv/kbd: Channel read expects non-NULL channel argument. MFC after:now Sponsored by: Microsoft Modified: head/sys/dev/hyperv/input/hv_kbd.c Modified: head/sys/dev/hyperv/input/hv_kbd.c == --- head/sys/dev/hyperv/input/hv_kbd.c Fri May 5 00:54:23 2017 (r317820) +++ head/sys/dev/hyperv/input/hv_kbd.c Fri May 5 03:28:30 2017 (r317821) @@ -198,7 +198,7 @@ static void hvkbd_do_poll(hv_kbd_sc *sc, uint8_t wait) { while (!hv_kbd_prod_is_ready(sc)) { - hv_kbd_read_channel(NULL, sc); + hv_kbd_read_channel(sc->hs_chan, sc); if (!wait) break; } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r317786 - head/sys/amd64/pci
Author: sephe Date: Thu May 4 05:28:46 2017 New Revision: 317786 URL: https://svnweb.freebsd.org/changeset/base/317786 Log: pcicfg: Fix direct calls of pci_cfg{read,write} on systems w/o PCI host bridge. Reported by: dexuan@ Reviewed by: jhb@ MFC after:1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D10564 Modified: head/sys/amd64/pci/pci_cfgreg.c Modified: head/sys/amd64/pci/pci_cfgreg.c == --- head/sys/amd64/pci/pci_cfgreg.c Thu May 4 05:26:37 2017 (r317785) +++ head/sys/amd64/pci/pci_cfgreg.c Thu May 4 05:28:46 2017 (r317786) @@ -64,6 +64,7 @@ static vm_offset_t pcie_base; static int pcie_minbus, pcie_maxbus; static uint32_t pcie_badslots; static struct mtx pcicfg_mtx; +MTX_SYSINIT(pcicfg_mtx, _mtx, "pcicfg_mtx", MTX_SPIN); static int mcfg_enable = 1; SYSCTL_INT(_hw_pci, OID_AUTO, mcfg, CTLFLAG_RDTUN, _enable, 0, "Enable support for PCI-e memory mapped config access"); @@ -74,15 +75,9 @@ SYSCTL_INT(_hw_pci, OID_AUTO, mcfg, CTLF int pci_cfgregopen(void) { - static int once = 0; uint64_t pciebar; uint16_t did, vid; - if (!once) { - mtx_init(_mtx, "pcicfg", NULL, MTX_SPIN); - once = 1; - } - if (cfgmech != CFGMECH_NONE) return (1); cfgmech = CFGMECH_1; @@ -138,6 +133,9 @@ pci_cfgregread(int bus, int slot, int fu { uint32_t line; + if (cfgmech == CFGMECH_NONE) + return (0x); + /* * Some BIOS writers seem to want to ignore the spec and put * 0 in the intline rather than 255 to indicate none. Some use @@ -162,6 +160,9 @@ void pci_cfgregwrite(int bus, int slot, int func, int reg, u_int32_t data, int bytes) { + if (cfgmech == CFGMECH_NONE) + return; + if (cfgmech == CFGMECH_PCIE && (bus >= pcie_minbus && bus <= pcie_maxbus) && (bus != 0 || !(1 << slot & pcie_badslots))) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r317783 - head/contrib/hyperv/tools
Author: sephe Date: Thu May 4 01:46:04 2017 New Revision: 317783 URL: https://svnweb.freebsd.org/changeset/base/317783 Log: hyperv/kvp: Fix pool direcrory and file permission PR: 209385 MFC after:2 weeks Sponsored by: Microsoft Modified: head/contrib/hyperv/tools/hv_kvp_daemon.c Modified: head/contrib/hyperv/tools/hv_kvp_daemon.c == --- head/contrib/hyperv/tools/hv_kvp_daemon.c Thu May 4 00:04:17 2017 (r317782) +++ head/contrib/hyperv/tools/hv_kvp_daemon.c Thu May 4 01:46:04 2017 (r317783) @@ -61,6 +61,10 @@ typedef uint16_t __u16; typedef uint32_t __u32; typedef uint64_t __u64; +#define POOL_FILE_MODE (S_IRUSR | S_IWUSR) +#define POOL_DIR_MODE (POOL_FILE_MODE | S_IXUSR) +#define POOL_DIR "/var/db/hyperv/pool" + /* * ENUM Data */ @@ -285,11 +289,12 @@ kvp_file_init(void) int i; int alloc_unit = sizeof(struct kvp_record) * ENTRIES_PER_BLOCK; - if (mkdir("/var/db/hyperv/pool", S_IRUSR | S_IWUSR | S_IROTH) < 0 && + if (mkdir(POOL_DIR, POOL_DIR_MODE) < 0 && (errno != EEXIST && errno != EISDIR)) { KVP_LOG(LOG_ERR, " Failed to create /var/db/hyperv/pool\n"); exit(EXIT_FAILURE); } + chmod(POOL_DIR, POOL_DIR_MODE); /* fix old mistake */ for (i = 0; i < HV_KVP_POOL_COUNT; i++) { @@ -297,11 +302,12 @@ kvp_file_init(void) records_read = 0; num_blocks = 1; snprintf(fname, MAX_FILE_NAME, "/var/db/hyperv/pool/.kvp_pool_%d", i); - fd = open(fname, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR | S_IROTH); + fd = open(fname, O_RDWR | O_CREAT, POOL_FILE_MODE); if (fd == -1) { return (1); } + fchmod(fd, POOL_FILE_MODE); /* fix old mistake */ filep = fopen(fname, "r"); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r317353 - head/sys/dev/hyperv/netvsc
Author: sephe Date: Mon Apr 24 07:52:27 2017 New Revision: 317353 URL: https://svnweb.freebsd.org/changeset/base/317353 Log: hyperv/hn: Use channel0, i.e. TX ring0, for TCP SYN/SYN|ACK. Hyper-V hot channel effect: Operation latency on hot channel is only _half_ of the operation latency on cold channels. This commit takes the advantage of the above Hyper-V host channel effect, and can reduce more than 75% latency and more than 50% latency stdev, i.e. lower and more stable/predictable latency, for various types of web server workloads. MFC after:3 days Sponsored by: Microsoft Modified: head/sys/dev/hyperv/netvsc/if_hn.c Modified: head/sys/dev/hyperv/netvsc/if_hn.c == --- head/sys/dev/hyperv/netvsc/if_hn.c Mon Apr 24 06:33:08 2017 (r317352) +++ head/sys/dev/hyperv/netvsc/if_hn.c Mon Apr 24 07:52:27 2017 (r317353) @@ -622,6 +622,16 @@ hn_chim_free(struct hn_softc *sc, uint32 } #if defined(INET6) || defined(INET) + +#define PULLUP_HDR(m, len) \ +do { \ + if (__predict_false((m)->m_len < (len))) { \ + (m) = m_pullup((m), (len)); \ + if ((m) == NULL)\ + return (NULL); \ + } \ +} while (0) + /* * NOTE: If this function failed, the m_head would be freed. */ @@ -634,15 +644,6 @@ hn_tso_fixup(struct mbuf *m_head) KASSERT(M_WRITABLE(m_head), ("TSO mbuf not writable")); -#define PULLUP_HDR(m, len) \ -do { \ - if (__predict_false((m)->m_len < (len))) { \ - (m) = m_pullup((m), (len)); \ - if ((m) == NULL)\ - return (NULL); \ - } \ -} while (0) - PULLUP_HDR(m_head, sizeof(*evl)); evl = mtod(m_head, struct ether_vlan_header *); if (evl->evl_encap_proto == ntohs(ETHERTYPE_VLAN)) @@ -691,8 +692,65 @@ do { \ #endif return (m_head); -#undef PULLUP_HDR } + +/* + * NOTE: If this function failed, the m_head would be freed. + */ +static __inline struct mbuf * +hn_check_tcpsyn(struct mbuf *m_head, int *tcpsyn) +{ + const struct ether_vlan_header *evl; + const struct tcphdr *th; + int ehlen; + + *tcpsyn = 0; + + PULLUP_HDR(m_head, sizeof(*evl)); + evl = mtod(m_head, const struct ether_vlan_header *); + if (evl->evl_encap_proto == ntohs(ETHERTYPE_VLAN)) + ehlen = ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN; + else + ehlen = ETHER_HDR_LEN; + +#ifdef INET + if (m_head->m_pkthdr.csum_flags & CSUM_IP_TCP) { + const struct ip *ip; + int iphlen; + + PULLUP_HDR(m_head, ehlen + sizeof(*ip)); + ip = mtodo(m_head, ehlen); + iphlen = ip->ip_hl << 2; + + PULLUP_HDR(m_head, ehlen + iphlen + sizeof(*th)); + th = mtodo(m_head, ehlen + iphlen); + if (th->th_flags & TH_SYN) + *tcpsyn = 1; + } +#endif +#if defined(INET6) && defined(INET) + else +#endif +#ifdef INET6 + { + const struct ip6_hdr *ip6; + + PULLUP_HDR(m_head, ehlen + sizeof(*ip6)); + ip6 = mtodo(m_head, ehlen); + if (ip6->ip6_nxt != IPPROTO_TCP) + return (m_head); + + PULLUP_HDR(m_head, ehlen + sizeof(*ip6) + sizeof(*th)); + th = mtodo(m_head, ehlen + sizeof(*ip6)); + if (th->th_flags & TH_SYN) + *tcpsyn = 1; + } +#endif + return (m_head); +} + +#undef PULLUP_HDR + #endif /* INET6 || INET */ static int @@ -4369,7 +4427,29 @@ hn_transmit(struct ifnet *ifp, struct mb idx = bid % sc->hn_tx_ring_inuse; else #endif - idx = m->m_pkthdr.flowid % sc->hn_tx_ring_inuse; + { +#if defined(INET6) || defined(INET) + int tcpsyn = 0; + + if (m->m_pkthdr.len < 128 && + (m->m_pkthdr.csum_flags & +(CSUM_IP_TCP | CSUM_IP6_TCP)) && + (m->m_pkthdr.csum_flags & CSUM_TSO) == 0) { + m = hn_check_tcpsyn(m, ); + if (__predict_false(m == NULL)) { + if_inc_counter(ifp, + IFCOUNTER_OERRORS, 1); + return (EIO); + } +
svn commit: r317107 - head/sys/dev/hyperv/vmbus
Author: sephe Date: Wed Apr 19 02:39:48 2017 New Revision: 317107 URL: https://svnweb.freebsd.org/changeset/base/317107 Log: hyperv: Use kmem_malloc for hypercall memory due to NX bit change. Reported by: dexuan@ MFC after:now Sponsored by: Microsoft Modified: head/sys/dev/hyperv/vmbus/hyperv.c Modified: head/sys/dev/hyperv/vmbus/hyperv.c == --- head/sys/dev/hyperv/vmbus/hyperv.c Tue Apr 18 23:59:15 2017 (r317106) +++ head/sys/dev/hyperv/vmbus/hyperv.c Wed Apr 19 02:39:48 2017 (r317107) @@ -34,9 +34,15 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include +#include +#include +#include +#include + #include #include #include @@ -64,7 +70,7 @@ __FBSDID("$FreeBSD$"); struct hypercall_ctx { void*hc_addr; - struct hyperv_dma hc_dma; + vm_paddr_t hc_paddr; }; static u_int hyperv_get_timecount(struct timecounter *); @@ -255,8 +261,8 @@ SYSINIT(hyperv_initialize, SI_SUB_HYPERV static void hypercall_memfree(void) { - hyperv_dmamem_free(_context.hc_dma, - hypercall_context.hc_addr); + kmem_free(kernel_arena, (vm_offset_t)hypercall_context.hc_addr, + PAGE_SIZE); hypercall_context.hc_addr = NULL; } @@ -268,14 +274,15 @@ hypercall_create(void *arg __unused) if (vm_guest != VM_GUEST_HV) return; - hypercall_context.hc_addr = hyperv_dmamem_alloc(NULL, PAGE_SIZE, 0, - PAGE_SIZE, _context.hc_dma, BUS_DMA_WAITOK); - if (hypercall_context.hc_addr == NULL) { - printf("hyperv: Hypercall page allocation failed\n"); - /* Can't perform any Hyper-V specific actions */ - vm_guest = VM_GUEST_VM; - return; - } + /* +* NOTE: +* - busdma(9), i.e. hyperv_dmamem APIs, can _not_ be used due to +* the NX bit. +* - Assume kmem_malloc() returns properly aligned memory. +*/ + hypercall_context.hc_addr = (void *)kmem_malloc(kernel_arena, PAGE_SIZE, + M_WAITOK); + hypercall_context.hc_paddr = vtophys(hypercall_context.hc_addr); /* Get the 'reserved' bits, which requires preservation. */ hc_orig = rdmsr(MSR_HV_HYPERCALL); @@ -285,7 +292,7 @@ hypercall_create(void *arg __unused) * * NOTE: 'reserved' bits MUST be preserved. */ - hc = ((hypercall_context.hc_dma.hv_paddr >> PAGE_SHIFT) << + hc = ((hypercall_context.hc_paddr >> PAGE_SHIFT) << MSR_HV_HYPERCALL_PGSHIFT) | (hc_orig & MSR_HV_HYPERCALL_RSVD_MASK) | MSR_HV_HYPERCALL_ENABLE; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r316815 - head/sys/dev/hyperv/utilities
Author: sephe Date: Fri Apr 14 05:29:27 2017 New Revision: 316815 URL: https://svnweb.freebsd.org/changeset/base/316815 Log: hyperv/kvp: Remove always false condition. Reported by: PVS MFC after:3 days Sponsored by: Microsoft Modified: head/sys/dev/hyperv/utilities/hv_kvp.c Modified: head/sys/dev/hyperv/utilities/hv_kvp.c == --- head/sys/dev/hyperv/utilities/hv_kvp.c Fri Apr 14 05:25:40 2017 (r316814) +++ head/sys/dev/hyperv/utilities/hv_kvp.c Fri Apr 14 05:29:27 2017 (r316815) @@ -516,7 +516,7 @@ hv_kvp_convert_usermsg_to_hostmsg(struct /* Use values by string */ host_exchg_data->value_type = HV_REG_SZ; - if ((hkey_len < 0) || (hvalue_len < 0)) + if (hvalue_len < 0) return (EINVAL); return (0); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r316813 - head/sys/dev/hyperv/storvsc
Author: sephe Date: Fri Apr 14 05:25:21 2017 New Revision: 316813 URL: https://svnweb.freebsd.org/changeset/base/316813 Log: hyperv/storvsc: Use ULL for 64bits value shift. Reported by: PVS MFC after:3 days Sponsored by: Microsoft Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c == --- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.cFri Apr 14 05:18:42 2017(r316812) +++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.cFri Apr 14 05:25:21 2017(r316813) @@ -1771,7 +1771,7 @@ storvsc_check_bounce_buffer_sgl(bus_dma_ } pre_aligned = TRUE; } else { - tmp_bits |= 1 << i; + tmp_bits |= 1ULL << i; if (!pre_aligned) { if (phys_addr != vtophys(sgl[i-1].ds_addr + sgl[i-1].ds_len)) { ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r316812 - head/sys/dev/hyperv/input
Author: sephe Date: Fri Apr 14 05:18:42 2017 New Revision: 316812 URL: https://svnweb.freebsd.org/changeset/base/316812 Log: hyperv/kbd: Remove unnecessary assignment. Reported by: PVS MFC after:3 days Sponsored by: Microsoft Modified: head/sys/dev/hyperv/input/hv_kbdc.c Modified: head/sys/dev/hyperv/input/hv_kbdc.c == --- head/sys/dev/hyperv/input/hv_kbdc.c Fri Apr 14 05:13:50 2017 (r316811) +++ head/sys/dev/hyperv/input/hv_kbdc.c Fri Apr 14 05:18:42 2017 (r316812) @@ -298,7 +298,6 @@ hv_kbd_read_channel(struct vmbus_channel int ret = 0; hv_kbd_sc *sc = (hv_kbd_sc*)context; - channel = vmbus_get_channel(sc->dev); buf = sc->buf; buflen = sc->buflen; for (;;) { ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r316520 - head/sys/dev/hyperv/netvsc
Author: sephe Date: Wed Apr 5 08:25:22 2017 New Revision: 316520 URL: https://svnweb.freebsd.org/changeset/base/316520 Log: hyperv/hn: Fixat RNDIS rxfilter after the successful RNDIS init. Under certain conditions on certain versions of Hyper-V, the RNDIS rxfilter is _not_ zero on the hypervisor side after the successful RNDIS initialization, which breaks the assumption of any following code (well, it breaks the RNDIS API contract actually). Clear the RNDIS rxfilter explicitly, drain packets sneaking through, and drain the interrupt taskqueues scheduled due to the stealth packets. Reported by: dexuan@ MFC after:3 days Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D10230 Modified: head/sys/dev/hyperv/netvsc/hn_rndis.c head/sys/dev/hyperv/netvsc/hn_rndis.h head/sys/dev/hyperv/netvsc/if_hn.c Modified: head/sys/dev/hyperv/netvsc/hn_rndis.c == --- head/sys/dev/hyperv/netvsc/hn_rndis.c Wed Apr 5 08:15:47 2017 (r316519) +++ head/sys/dev/hyperv/netvsc/hn_rndis.c Wed Apr 5 08:25:22 2017 (r316520) @@ -979,16 +979,19 @@ hn_rndis_query_hwcaps(struct hn_softc *s } int -hn_rndis_attach(struct hn_softc *sc, int mtu) +hn_rndis_attach(struct hn_softc *sc, int mtu, int *init_done) { int error; + *init_done = 0; + /* * Initialize RNDIS. */ error = hn_rndis_init(sc); if (error) return (error); + *init_done = 1; /* * Configure NDIS offload settings. Modified: head/sys/dev/hyperv/netvsc/hn_rndis.h == --- head/sys/dev/hyperv/netvsc/hn_rndis.h Wed Apr 5 08:15:47 2017 (r316519) +++ head/sys/dev/hyperv/netvsc/hn_rndis.h Wed Apr 5 08:25:22 2017 (r316520) @@ -33,7 +33,7 @@ struct hn_softc; -inthn_rndis_attach(struct hn_softc *sc, int mtu); +inthn_rndis_attach(struct hn_softc *sc, int mtu, int *init_done); void hn_rndis_detach(struct hn_softc *sc); inthn_rndis_conf_rss(struct hn_softc *sc, uint16_t flags); inthn_rndis_query_rsscaps(struct hn_softc *sc, int *rxr_cnt); Modified: head/sys/dev/hyperv/netvsc/if_hn.c == --- head/sys/dev/hyperv/netvsc/if_hn.c Wed Apr 5 08:15:47 2017 (r316519) +++ head/sys/dev/hyperv/netvsc/if_hn.c Wed Apr 5 08:25:22 2017 (r316520) @@ -261,6 +261,7 @@ static void hn_rndis_rx_data(struct hn const void *, int); static voidhn_rndis_rx_status(struct hn_softc *, const void *, int); +static voidhn_rndis_init_fixat(struct hn_softc *, int); static voidhn_nvs_handle_notify(struct hn_softc *, const struct vmbus_chanpkt_hdr *); @@ -328,6 +329,8 @@ static void hn_resume_mgmt(struct hn_s static voidhn_suspend_mgmt_taskfunc(void *, int); static voidhn_chan_drain(struct hn_softc *, struct vmbus_channel *); +static voidhn_disable_rx(struct hn_softc *); +static voidhn_drain_rxtx(struct hn_softc *, int); static voidhn_polling(struct hn_softc *, u_int); static voidhn_chan_polling(struct vmbus_channel *, u_int); @@ -2267,6 +2270,18 @@ hn_rxpkt(struct hn_rx_ring *rxr, const v /* If the VF is active, inject the packet through the VF */ ifp = rxr->hn_vf ? rxr->hn_vf : rxr->hn_ifp; + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { + /* +* NOTE: +* See the NOTE of hn_rndis_init_fixat(). This +* function can be reached, immediately after the +* RNDIS is initialized but before the ifnet is +* setup on the hn_attach() path; drop the unexpected +* packets. +*/ + return (0); + } + if (dlen <= MHLEN) { m_new = m_gethdr(M_NOWAIT, MT_DATA); if (m_new == NULL) { @@ -4711,6 +4726,27 @@ hn_synth_attachable(const struct hn_soft return (true); } +/* + * Make sure that the RX filter is zero after the successful + * RNDIS initialization. + * + * NOTE: + * Under certain conditions on certain versions of Hyper-V, + * the RNDIS rxfilter is _not_ zero on the hypervisor side + * after the successful RNDIS initialization, which breaks + * the assumption of any following code (well, it breaks the + * RNDIS API contract actually). Clear the RNDIS rxfilter + * explicitly, drain packets sneaking through, and drain the + *
svn commit: r316519 - head/sys/dev/hyperv/storvsc
Author: sephe Date: Wed Apr 5 08:15:47 2017 New Revision: 316519 URL: https://svnweb.freebsd.org/changeset/base/316519 Log: hyperv/storvsc: Fixup SRB status. This unbreaks GEN2 Hyper-V cd support. Submitted by: Hongjiang Zhang Reviewed by: dexuan@ MFC after:3 days Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D10212 Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c head/sys/dev/hyperv/storvsc/hv_vstorage.h Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c == --- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.cWed Apr 5 06:41:42 2017(r316518) +++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.cWed Apr 5 08:15:47 2017(r316519) @@ -2148,19 +2148,20 @@ storvsc_io_done(struct hv_storvsc_reques ccb->ccb_h.status &= ~CAM_SIM_QUEUED; ccb->ccb_h.status &= ~CAM_STATUS_MASK; + int srb_status = SRB_STATUS(vm_srb->srb_status); if (vm_srb->scsi_status == SCSI_STATUS_OK) { const struct scsi_generic *cmd; cmd = (const struct scsi_generic *) ((ccb->ccb_h.flags & CAM_CDB_POINTER) ? csio->cdb_io.cdb_ptr : csio->cdb_io.cdb_bytes); - if (vm_srb->srb_status != SRB_STATUS_SUCCESS) { + if (srb_status != SRB_STATUS_SUCCESS) { /* * If there are errors, for example, invalid LUN, * host will inform VM through SRB status. */ if (bootverbose) { - if (vm_srb->srb_status == SRB_STATUS_INVALID_LUN) { + if (srb_status == SRB_STATUS_INVALID_LUN) { xpt_print(ccb->ccb_h.path, "invalid LUN %d for op: %s\n", vm_srb->lun, @@ -2168,7 +2169,7 @@ storvsc_io_done(struct hv_storvsc_reques } else { xpt_print(ccb->ccb_h.path, "Unknown SRB flag: %d for op: %s\n", - vm_srb->srb_status, + srb_status, scsi_op_desc(cmd->opcode, NULL)); } } @@ -2191,7 +2192,7 @@ storvsc_io_done(struct hv_storvsc_reques } if (cmd->opcode == INQUIRY && - vm_srb->srb_status == SRB_STATUS_SUCCESS) { + srb_status == SRB_STATUS_SUCCESS) { int resp_xfer_len, resp_buf_len, data_len; uint8_t *resp_buf = (uint8_t *)csio->data_ptr; struct scsi_inquiry_data *inq_data = Modified: head/sys/dev/hyperv/storvsc/hv_vstorage.h == --- head/sys/dev/hyperv/storvsc/hv_vstorage.h Wed Apr 5 06:41:42 2017 (r316518) +++ head/sys/dev/hyperv/storvsc/hv_vstorage.h Wed Apr 5 08:15:47 2017 (r316519) @@ -242,17 +242,16 @@ struct vstor_packet { #define SRB_STATUS_PENDING 0x00 #define SRB_STATUS_SUCCESS 0x01 #define SRB_STATUS_ABORTED 0x02 -#define SRB_STATUS_ABORT_FAILED0x03 #define SRB_STATUS_ERROR 0x04 -#define SRB_STATUS_BUSY0x05 - +#define SRB_STATUS_INVALID_LUN 0x20 /** * SRB Status Masks (can be combined with above status codes) */ #define SRB_STATUS_QUEUE_FROZEN 0x40 #define SRB_STATUS_AUTOSENSE_VALID 0x80 -#define SRB_STATUS_INVALID_LUN 0X20 +#define SRB_STATUS(status) \ + ((status) & ~(SRB_STATUS_AUTOSENSE_VALID | SRB_STATUS_QUEUE_FROZEN)) /* * SRB Flag Bits */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r316515 - in head/sys: conf dev/hyperv/input
Author: sephe Date: Wed Apr 5 05:01:23 2017 New Revision: 316515 URL: https://svnweb.freebsd.org/changeset/base/316515 Log: hyperv/kbd: Add support for synthetic keyboard. Synthetic keyboard is the only supported keyboard on GEN2 Hyper-V. Submitted by: Hongjiang Zhang MFC after:1 week Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D10196 Added: head/sys/dev/hyperv/input/ head/sys/dev/hyperv/input/hv_kbd.c (contents, props changed) head/sys/dev/hyperv/input/hv_kbdc.c (contents, props changed) head/sys/dev/hyperv/input/hv_kbdc.h (contents, props changed) Modified: head/sys/conf/files.amd64 Modified: head/sys/conf/files.amd64 == --- head/sys/conf/files.amd64 Wed Apr 5 03:05:04 2017(r316514) +++ head/sys/conf/files.amd64 Wed Apr 5 05:01:23 2017(r316515) @@ -303,6 +303,8 @@ dev/hwpmc/hwpmc_uncore.coptionalhwpmc dev/hwpmc/hwpmc_piv.c optionalhwpmc dev/hwpmc/hwpmc_tsc.c optionalhwpmc dev/hwpmc/hwpmc_x86.c optionalhwpmc +dev/hyperv/input/hv_kbd.c optionalhyperv +dev/hyperv/input/hv_kbdc.c optionalhyperv dev/hyperv/pcib/vmbus_pcib.c optionalhyperv pci dev/hyperv/netvsc/hn_nvs.c optionalhyperv dev/hyperv/netvsc/hn_rndis.c optionalhyperv Added: head/sys/dev/hyperv/input/hv_kbd.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/hyperv/input/hv_kbd.c Wed Apr 5 05:01:23 2017 (r316515) @@ -0,0 +1,564 @@ +/*- + * Copyright (c) 2017 Microsoft Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice unmodified, this list of conditions, and the following + *disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "dev/hyperv/input/hv_kbdc.h" + +#define HVKBD_MTX_LOCK(_m) do {\ + mtx_lock(_m); \ +} while (0) + +#define HVKBD_MTX_UNLOCK(_m) do { \ + mtx_unlock(_m); \ +} while (0) + +#define HVKBD_MTX_ASSERT(_m, _t) do { \ + mtx_assert(_m, _t); \ +} while (0) + +#defineHVKBD_LOCK()HVKBD_MTX_LOCK() +#defineHVKBD_UNLOCK() HVKBD_MTX_UNLOCK() +#defineHVKBD_LOCK_ASSERT() HVKBD_MTX_ASSERT(, MA_OWNED) + +#define HVKBD_FLAG_POLLING 0x0002 + +/* early keyboard probe, not supported */ +static int +hvkbd_configure(int flags) +{ + return (0); +} + +/* detect a keyboard, not used */ +static int +hvkbd_probe(int unit, void *arg, int flags) +{ + return (ENXIO); +} + +/* reset and initialize the device, not used */ +static int +hvkbd_init(int unit, keyboard_t **kbdp, void *arg, int flags) +{ + DEBUG_HVKBD(*kbdp, "%s\n", __func__); + return (ENXIO); +} + +/* test the interface to the device, not used */ +static int +hvkbd_test_if(keyboard_t *kbd) +{ + DEBUG_HVKBD(kbd, "%s\n", __func__); + return (0); +} + +/* finish using this keyboard, not used */ +static int +hvkbd_term(keyboard_t *kbd) +{ + DEBUG_HVKBD(kbd, "%s\n", __func__); + return (ENXIO); +} + +/* keyboard interrupt routine, not used */ +static int +hvkbd_intr(keyboard_t *kbd, void
Re: svn commit: r316309 - head/sys/dev/qlxgbe
Maybe it's time to add an IFCAP for HWLRO. On Fri, Mar 31, 2017 at 7:39 AM, Somayajulu, Davidwrote: >>> > I know this is not a new topic but a little more descriptive commit-log >>> > would have been nicer. Also, you should update the manpage reflecting >>> > this change. i.e. now it also supports software LRO when h/w LRO is >>> > disabled. >>> Will do. Sorry about that. > Minor correction. Please note that the driver provides the ability to choose > between SoftwareLRO and HW LRO, when LRO is enabled - it is HW LRO by > default. If LRO is turned off via ifconfig, neither Software nor HW LRO is > enabled. > > Cheers > David S. > > -Original Message- > From: hiren panchasara [mailto:hi...@strugglingcoder.info] > Sent: Thursday, March 30, 2017 4:12 PM > To: Somayajulu, David > Cc: David C Somayajulu ; src-committ...@freebsd.org; > svn-src-...@freebsd.org; svn-src-head@freebsd.org > Subject: Re: svn commit: r316309 - head/sys/dev/qlxgbe > > On 03/30/17 at 11:07P, Somayajulu, David wrote: >> Hi Hiren, >> > I know this is not a new topic but a little more descriptive commit-log >> > would have been nicer. Also, you should update the manpage reflecting this >> > change. i.e. now it also supports software LRO when h/w LRO is disabled. >> Will do. Sorry about that. > > Thanks! >> >> > Do you know of a case where one would want to disable h/w lro and enable >> > s/w lro? I guess where you want to free up nic and make cpu do more work? >> I was under the impression as well, that s/w lro is moot, if h/w lro was >> available, till one costumer asked for it. Not sure what the use case is. > > I thought this idea (like gro in linux) was popular when lro in h/w was > considered buggy and couldn't correctly do batching (i.e. hide useful flags). > Not sure if that's still the case. > > cheers, > Hiren > ___ > svn-src-...@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org" -- Tomorrow Will Never Die ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r314485 - head/sys/dev/hyperv/netvsc
Author: sephe Date: Wed Mar 1 09:05:12 2017 New Revision: 314485 URL: https://svnweb.freebsd.org/changeset/base/314485 Log: hyperv/hn: Misaligned chimney sending buffers should not be used MFC after:1 week Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D9714 Modified: head/sys/dev/hyperv/netvsc/hn_nvs.c Modified: head/sys/dev/hyperv/netvsc/hn_nvs.c == --- head/sys/dev/hyperv/netvsc/hn_nvs.c Wed Mar 1 08:50:41 2017 (r314484) +++ head/sys/dev/hyperv/netvsc/hn_nvs.c Wed Mar 1 09:05:12 2017 (r314485) @@ -272,12 +272,17 @@ hn_nvs_conn_chim(struct hn_softc *sc) error = EIO; goto cleanup; } - if (sectsz == 0) { + if (sectsz == 0 || sectsz % sizeof(uint32_t) != 0) { /* * Can't use chimney sending buffer; done! */ - if_printf(sc->hn_ifp, "zero chimney sending buffer " - "section size\n"); + if (sectsz == 0) { + if_printf(sc->hn_ifp, "zero chimney sending buffer " + "section size\n"); + } else { + if_printf(sc->hn_ifp, "misaligned chimney sending " + "buffers, section size: %u\n", sectsz); + } sc->hn_chim_szmax = 0; sc->hn_chim_cnt = 0; sc->hn_flags |= HN_FLAG_CHIM_CONNECTED; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r314484 - head/sys/dev/hyperv/netvsc
Author: sephe Date: Wed Mar 1 08:50:41 2017 New Revision: 314484 URL: https://svnweb.freebsd.org/changeset/base/314484 Log: hyperv/hn: Make sure that RNDIS packet message is at least 4B aligned. MFC after:1 week Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D9713 Modified: head/sys/dev/hyperv/netvsc/hn_rndis.c Modified: head/sys/dev/hyperv/netvsc/hn_rndis.c == --- head/sys/dev/hyperv/netvsc/hn_rndis.c Wed Mar 1 08:24:17 2017 (r314483) +++ head/sys/dev/hyperv/netvsc/hn_rndis.c Wed Mar 1 08:50:41 2017 (r314484) @@ -841,9 +841,22 @@ hn_rndis_init(struct hn_softc *sc) sc->hn_rndis_agg_pkts = comp->rm_pktmaxcnt; sc->hn_rndis_agg_align = 1U << comp->rm_align; + if (sc->hn_rndis_agg_align < sizeof(uint32_t)) { + /* +* The RNDIS packet messsage encap assumes that the RNDIS +* packet message is at least 4 bytes aligned. Fix up the +* alignment here, if the remote side sets the alignment +* too low. +*/ + if_printf(sc->hn_ifp, "fixup RNDIS aggpkt align: %u -> %zu\n", + sc->hn_rndis_agg_align, sizeof(uint32_t)); + sc->hn_rndis_agg_align = sizeof(uint32_t); + } + if (bootverbose) { - if_printf(sc->hn_ifp, "RNDIS ver %u.%u, pktsz %u, pktcnt %u, " - "align %u\n", comp->rm_ver_major, comp->rm_ver_minor, + if_printf(sc->hn_ifp, "RNDIS ver %u.%u, " + "aggpkt size %u, aggpkt cnt %u, aggpkt align %u\n", + comp->rm_ver_major, comp->rm_ver_minor, sc->hn_rndis_agg_size, sc->hn_rndis_agg_pkts, sc->hn_rndis_agg_align); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r314483 - head/sys/dev/hyperv/netvsc
Author: sephe Date: Wed Mar 1 08:24:17 2017 New Revision: 314483 URL: https://svnweb.freebsd.org/changeset/base/314483 Log: hyperv/hn: Simplify RNDIS packet total length calculation. MFC after:1 week Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D9712 Modified: head/sys/dev/hyperv/netvsc/if_hn.c Modified: head/sys/dev/hyperv/netvsc/if_hn.c == --- head/sys/dev/hyperv/netvsc/if_hn.c Wed Mar 1 08:22:51 2017 (r314482) +++ head/sys/dev/hyperv/netvsc/if_hn.c Wed Mar 1 08:24:17 2017 (r314483) @@ -1784,9 +1784,6 @@ hn_rndis_pktinfo_append(struct rndis_pac pi->rm_type = pi_type; pi->rm_pktinfooffset = RNDIS_PKTINFO_OFFSET; - /* Update RNDIS packet msg length */ - pkt->rm_len += pi_size; - return (pi->rm_data); } @@ -1928,7 +1925,7 @@ hn_encap(struct ifnet *ifp, struct hn_tx } pkt->rm_type = REMOTE_NDIS_PACKET_MSG; - pkt->rm_len = sizeof(*pkt) + m_head->m_pkthdr.len; + pkt->rm_len = m_head->m_pkthdr.len; pkt->rm_dataoffset = 0; pkt->rm_datalen = m_head->m_pkthdr.len; pkt->rm_oobdataoffset = 0; @@ -1999,6 +1996,8 @@ hn_encap(struct ifnet *ifp, struct hn_tx } pkt_hlen = pkt->rm_pktinfooffset + pkt->rm_pktinfolen; + /* Fixup RNDIS packet message total length */ + pkt->rm_len += pkt_hlen; /* Convert RNDIS packet message offsets */ pkt->rm_dataoffset = hn_rndis_pktmsg_offset(pkt_hlen); pkt->rm_pktinfooffset = hn_rndis_pktmsg_offset(pkt->rm_pktinfooffset); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r314382 - head/sys/dev/hyperv/netvsc
Author: sephe Date: Tue Feb 28 09:50:34 2017 New Revision: 314382 URL: https://svnweb.freebsd.org/changeset/base/314382 Log: hyperv/hn: Simplify RNDIS packet data offset calculation. MFC after:1 week Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D9699 Modified: head/sys/dev/hyperv/netvsc/if_hn.c Modified: head/sys/dev/hyperv/netvsc/if_hn.c == --- head/sys/dev/hyperv/netvsc/if_hn.c Tue Feb 28 06:46:41 2017 (r314381) +++ head/sys/dev/hyperv/netvsc/if_hn.c Tue Feb 28 09:50:34 2017 (r314382) @@ -1784,9 +1784,6 @@ hn_rndis_pktinfo_append(struct rndis_pac pi->rm_type = pi_type; pi->rm_pktinfooffset = RNDIS_PKTINFO_OFFSET; - /* Data immediately follow per-packet-info. */ - pkt->rm_dataoffset += pi_size; - /* Update RNDIS packet msg length */ pkt->rm_len += pi_size; @@ -1932,7 +1929,7 @@ hn_encap(struct ifnet *ifp, struct hn_tx pkt->rm_type = REMOTE_NDIS_PACKET_MSG; pkt->rm_len = sizeof(*pkt) + m_head->m_pkthdr.len; - pkt->rm_dataoffset = sizeof(*pkt); + pkt->rm_dataoffset = 0; pkt->rm_datalen = m_head->m_pkthdr.len; pkt->rm_oobdataoffset = 0; pkt->rm_oobdatalen = 0; @@ -2003,7 +2000,7 @@ hn_encap(struct ifnet *ifp, struct hn_tx pkt_hlen = pkt->rm_pktinfooffset + pkt->rm_pktinfolen; /* Convert RNDIS packet message offsets */ - pkt->rm_dataoffset = hn_rndis_pktmsg_offset(pkt->rm_dataoffset); + pkt->rm_dataoffset = hn_rndis_pktmsg_offset(pkt_hlen); pkt->rm_pktinfooffset = hn_rndis_pktmsg_offset(pkt->rm_pktinfooffset); /* ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r314369 - head/sys/dev/bnxt
On Tue, Feb 28, 2017 at 10:27 AM, Stephen Hurdwrote: > Modified: head/sys/dev/bnxt/bnxt_txrx.c > == > --- head/sys/dev/bnxt/bnxt_txrx.c Tue Feb 28 00:58:16 2017 > (r314368) > +++ head/sys/dev/bnxt/bnxt_txrx.c Tue Feb 28 02:27:51 2017 > (r314369) > @@ -412,6 +412,37 @@ cmpl_invalid: > return avail; > } > > +static void > +bnxt_set_rsstype(if_rxd_info_t ri, uint8_t rss_hash_type) > +{ > + uint8_t rss_profile_id; > + > + rss_profile_id = BNXT_GET_RSS_PROFILE_ID(rss_hash_type); > + switch (rss_profile_id) { > + default: > + ri->iri_rsstype = M_HASHTYPE_OPAQUE; > + break; Is it a hash value or just ring index? If its a hash value, you should set it to M_HASHTYPE_OPAQUE_HASH here. Thanks, sephe ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r312250 - in head: share/man/man4 sys/dev/alc sys/dev/pci
Author: sephe Date: Mon Jan 16 03:03:47 2017 New Revision: 312250 URL: https://svnweb.freebsd.org/changeset/base/312250 Log: alc: Add Killer E2500 support Reviewed by: jhb, yongari MFC after:1 week Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D9058 Modified: head/share/man/man4/alc.4 head/sys/dev/alc/if_alc.c head/sys/dev/alc/if_alcreg.h head/sys/dev/pci/pci.c Modified: head/share/man/man4/alc.4 == --- head/share/man/man4/alc.4 Mon Jan 16 01:38:34 2017(r312249) +++ head/share/man/man4/alc.4 Mon Jan 16 03:03:47 2017(r312250) @@ -124,6 +124,8 @@ Atheros AR8172 PCI Express Fast Ethernet Killer E2200 Gigabit Ethernet controller .It Killer E2400 Gigabit Ethernet controller +.It +Killer E2500 Gigabit Ethernet controller .El .Sh LOADER TUNABLES Tunables can be set at the Modified: head/sys/dev/alc/if_alc.c == --- head/sys/dev/alc/if_alc.c Mon Jan 16 01:38:34 2017(r312249) +++ head/sys/dev/alc/if_alc.c Mon Jan 16 03:03:47 2017(r312250) @@ -123,6 +123,8 @@ static struct alc_ident alc_ident_table[ "Killer E2200 Gigabit Ethernet" }, { VENDORID_ATHEROS, DEVICEID_ATHEROS_E2400, 9 * 1024, "Killer E2400 Gigabit Ethernet" }, + { VENDORID_ATHEROS, DEVICEID_ATHEROS_E2500, 9 * 1024, + "Killer E2500 Gigabit Ethernet" }, { 0, 0, 0, NULL} }; @@ -1083,6 +1085,7 @@ alc_phy_down(struct alc_softc *sc) case DEVICEID_ATHEROS_AR8161: case DEVICEID_ATHEROS_E2200: case DEVICEID_ATHEROS_E2400: + case DEVICEID_ATHEROS_E2500: case DEVICEID_ATHEROS_AR8162: case DEVICEID_ATHEROS_AR8171: case DEVICEID_ATHEROS_AR8172: @@ -1402,6 +1405,7 @@ alc_attach(device_t dev) switch (sc->alc_ident->deviceid) { case DEVICEID_ATHEROS_E2200: case DEVICEID_ATHEROS_E2400: + case DEVICEID_ATHEROS_E2500: sc->alc_flags |= ALC_FLAG_E2X00; /* FALLTHROUGH */ case DEVICEID_ATHEROS_AR8161: @@ -1480,7 +1484,8 @@ alc_attach(device_t dev) if (alc_dma_burst[sc->alc_dma_wr_burst] > 1024) sc->alc_dma_wr_burst = 3; /* -* Force maximum payload size to 128 bytes for E2200/E2400. +* Force maximum payload size to 128 bytes for +* E2200/E2400/E2500. * Otherwise it triggers DMA write error. */ if ((sc->alc_flags & ALC_FLAG_E2X00) != 0) Modified: head/sys/dev/alc/if_alcreg.h == --- head/sys/dev/alc/if_alcreg.hMon Jan 16 01:38:34 2017 (r312249) +++ head/sys/dev/alc/if_alcreg.hMon Jan 16 03:03:47 2017 (r312250) @@ -50,6 +50,7 @@ #defineDEVICEID_ATHEROS_AR8172 0x10A0 #defineDEVICEID_ATHEROS_E2200 0xE091 #defineDEVICEID_ATHEROS_E2400 0xE0A1 +#defineDEVICEID_ATHEROS_E2500 0xE0B1 #defineATHEROS_AR8152_B_V100xC0 #defineATHEROS_AR8152_B_V110xC1 Modified: head/sys/dev/pci/pci.c == --- head/sys/dev/pci/pci.c Mon Jan 16 01:38:34 2017(r312249) +++ head/sys/dev/pci/pci.c Mon Jan 16 03:03:47 2017(r312250) @@ -281,13 +281,14 @@ static const struct pci_quirk pci_quirks { 0x43851002, PCI_QUIRK_UNMAP_REG, 0x14, 0 }, /* -* Atheros AR8161/AR8162/E2200/E2400 Ethernet controllers have a -* bug that MSI interrupt does not assert if PCIM_CMD_INTxDIS bit +* Atheros AR8161/AR8162/E2200/E2400/E2500 Ethernet controllers have +* a bug that MSI interrupt does not assert if PCIM_CMD_INTxDIS bit * of the command register is set. */ { 0x10911969, PCI_QUIRK_MSI_INTX_BUG, 0, 0 }, { 0xE0911969, PCI_QUIRK_MSI_INTX_BUG, 0, 0 }, { 0xE0A11969, PCI_QUIRK_MSI_INTX_BUG, 0, 0 }, + { 0xE0B11969, PCI_QUIRK_MSI_INTX_BUG, 0, 0 }, { 0x10901969, PCI_QUIRK_MSI_INTX_BUG, 0, 0 }, /* ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r311743 - in head/sys/dev/hyperv: include utilities vmbus vmbus/amd64
Author: sephe Date: Mon Jan 9 03:38:41 2017 New Revision: 311743 URL: https://svnweb.freebsd.org/changeset/base/311743 Log: hyperv: Add method to read 64bit Hyper-V specific time value. MFC after:1 week Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D9057 Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/utilities/vmbus_timesync.c head/sys/dev/hyperv/vmbus/amd64/hyperv_machdep.c head/sys/dev/hyperv/vmbus/hyperv.c head/sys/dev/hyperv/vmbus/vmbus_et.c Modified: head/sys/dev/hyperv/include/hyperv.h == --- head/sys/dev/hyperv/include/hyperv.hMon Jan 9 03:21:21 2017 (r311742) +++ head/sys/dev/hyperv/include/hyperv.hMon Jan 9 03:38:41 2017 (r311743) @@ -79,9 +79,17 @@ struct hyperv_guid { #define HYPERV_GUID_STRLEN 40 -inthyperv_guid2str(const struct hyperv_guid *, char *, size_t); +typedef uint64_t (*hyperv_tc64_t)(void); -extern u_int hyperv_features;/* CPUID_HV_MSR_ */ +inthyperv_guid2str(const struct hyperv_guid *, char *, + size_t); + +/* + * hyperv_tc64 could be NULL, if there were no suitable Hyper-V + * specific timecounter. + */ +extern hyperv_tc64_t hyperv_tc64; +extern u_int hyperv_features;/* CPUID_HV_MSR_ */ #endif /* _KERNEL */ Modified: head/sys/dev/hyperv/utilities/vmbus_timesync.c == --- head/sys/dev/hyperv/utilities/vmbus_timesync.c Mon Jan 9 03:21:21 2017(r311742) +++ head/sys/dev/hyperv/utilities/vmbus_timesync.c Mon Jan 9 03:38:41 2017(r311743) @@ -52,8 +52,7 @@ __FBSDID("$FreeBSD$"); VMBUS_ICVER_LE(VMBUS_IC_VERSION(4, 0), (sc)->ic_msgver) #define VMBUS_TIMESYNC_DORTT(sc) \ - (VMBUS_TIMESYNC_MSGVER4((sc)) &&\ -(hyperv_features & CPUID_HV_MSR_TIME_REFCNT)) + (VMBUS_TIMESYNC_MSGVER4((sc)) && hyperv_tc64 != NULL) static int vmbus_timesync_probe(device_t); static int vmbus_timesync_attach(device_t); @@ -117,7 +116,7 @@ vmbus_timesync(struct vmbus_ic_softc *sc uint64_t hv_ns, vm_ns, rtt = 0; if (VMBUS_TIMESYNC_DORTT(sc)) - rtt = rdmsr(MSR_HV_TIME_REF_COUNT) - sent_tc; + rtt = hyperv_tc64() - sent_tc; hv_ns = (hvtime - VMBUS_ICMSG_TS_BASE + rtt) * HYPERV_TIMER_NS_FACTOR; nanotime(_ts); Modified: head/sys/dev/hyperv/vmbus/amd64/hyperv_machdep.c == --- head/sys/dev/hyperv/vmbus/amd64/hyperv_machdep.cMon Jan 9 03:21:21 2017(r311742) +++ head/sys/dev/hyperv/vmbus/amd64/hyperv_machdep.cMon Jan 9 03:38:41 2017(r311743) @@ -133,8 +133,8 @@ hyperv_tsc_vdso_timehands(struct vdso_ti } #define HYPERV_TSC_TIMECOUNT(fence)\ -static u_int \ -hyperv_tsc_timecount_##fence(struct timecounter *tc) \ +static uint64_t \ +hyperv_tc64_tsc_##fence(void) \ { \ struct hyperv_reftsc *tsc_ref = hyperv_ref_tsc.tsc_ref; \ uint32_t seq; \ @@ -162,6 +162,13 @@ hyperv_tsc_timecount_##fence(struct time /* Fallback to the generic timecounter, i.e. rdmsr. */ \ return (rdmsr(MSR_HV_TIME_REF_COUNT)); \ } \ + \ +static u_int \ +hyperv_tsc_timecount_##fence(struct timecounter *tc __unused) \ +{ \ + \ + return (hyperv_tc64_tsc_##fence()); \ +} \ struct __hack HYPERV_TSC_TIMECOUNT(lfence); @@ -170,6 +177,7 @@ HYPERV_TSC_TIMECOUNT(mfence); static void hyperv_tsc_tcinit(void *dummy __unused) { + hyperv_tc64_t tc64 = NULL; uint64_t val, orig; if ((hyperv_features & @@ -182,11 +190,13 @@ hyperv_tsc_tcinit(void *dummy __unused) case CPU_VENDOR_AMD: hyperv_tsc_timecounter.tc_get_timecount = hyperv_tsc_timecount_mfence; + tc64 = hyperv_tc64_tsc_mfence; break; case CPU_VENDOR_INTEL:
svn commit: r311475 - head/sys/net
Author: sephe Date: Fri Jan 6 05:10:49 2017 New Revision: 311475 URL: https://svnweb.freebsd.org/changeset/base/311475 Log: if: Defer the if_up until the ifnet.if_ioctl is called. This ensures the interface is initialized by the interface driver before it can be used by the rest of the system. Reviewed by: jhb, karels, gnn MFC after:3 week Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D8905 Modified: head/sys/net/if.c Modified: head/sys/net/if.c == --- head/sys/net/if.c Fri Jan 6 04:38:38 2017(r311474) +++ head/sys/net/if.c Fri Jan 6 05:10:49 2017(r311475) @@ -2300,7 +2300,7 @@ static int ifhwioctl(u_long cmd, struct ifnet *ifp, caddr_t data, struct thread *td) { struct ifreq *ifr; - int error = 0; + int error = 0, do_ifup = 0; int new_flags, temp_flags; size_t namelen, onamelen; size_t descrlen; @@ -2427,7 +2427,7 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, if_down(ifp); } else if (new_flags & IFF_UP && (ifp->if_flags & IFF_UP) == 0) { - if_up(ifp); + do_ifup = 1; } /* See if permanently promiscuous mode bit is about to flip */ if ((ifp->if_flags ^ new_flags) & IFF_PPROMISC) { @@ -2446,6 +2446,8 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, if (ifp->if_ioctl) { (void) (*ifp->if_ioctl)(ifp, cmd, data); } + if (do_ifup) + if_up(ifp); getmicrotime(>if_lastchange); break; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r310658 - head/sys/dev/hyperv/netvsc
Author: sephe Date: Wed Dec 28 04:47:17 2016 New Revision: 310658 URL: https://svnweb.freebsd.org/changeset/base/310658 Log: hyperv/hn: Factor out function to set rxfilter. MFC after:1 week Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D8928 Modified: head/sys/dev/hyperv/netvsc/if_hn.c Modified: head/sys/dev/hyperv/netvsc/if_hn.c == --- head/sys/dev/hyperv/netvsc/if_hn.c Wed Dec 28 04:35:52 2016 (r310657) +++ head/sys/dev/hyperv/netvsc/if_hn.c Wed Dec 28 04:47:17 2016 (r310658) @@ -333,6 +333,7 @@ static void hn_link_status(struct hn_s static int hn_create_rx_data(struct hn_softc *, int); static voidhn_destroy_rx_data(struct hn_softc *); static int hn_check_iplen(const struct mbuf *, int); +static int hn_set_rxfilter(struct hn_softc *, uint32_t); static int hn_rxfilter_config(struct hn_softc *); #ifndef RSS static int hn_rss_reconfig(struct hn_softc *); @@ -684,11 +685,25 @@ do { \ #endif /* INET6 || INET */ static int +hn_set_rxfilter(struct hn_softc *sc, uint32_t filter) +{ + int error = 0; + + HN_LOCK_ASSERT(sc); + + if (sc->hn_rx_filter != filter) { + error = hn_rndis_set_rxfilter(sc, filter); + if (!error) + sc->hn_rx_filter = filter; + } + return (error); +} + +static int hn_rxfilter_config(struct hn_softc *sc) { struct ifnet *ifp = sc->hn_ifp; uint32_t filter; - int error = 0; HN_LOCK_ASSERT(sc); @@ -703,13 +718,7 @@ hn_rxfilter_config(struct hn_softc *sc) !TAILQ_EMPTY(>if_multiaddrs)) filter |= NDIS_PACKET_TYPE_ALL_MULTICAST; } - - if (sc->hn_rx_filter != filter) { - error = hn_rndis_set_rxfilter(sc, filter); - if (!error) - sc->hn_rx_filter = filter; - } - return (error); + return (hn_set_rxfilter(sc, filter)); } static void @@ -4817,8 +4826,7 @@ hn_suspend_data(struct hn_softc *sc) /* * Disable RX by clearing RX filter. */ - sc->hn_rx_filter = NDIS_PACKET_TYPE_NONE; - hn_rndis_set_rxfilter(sc, sc->hn_rx_filter); + hn_set_rxfilter(sc, NDIS_PACKET_TYPE_NONE); /* * Give RNDIS enough time to flush all pending data packets. ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r310657 - head/sys/dev/hyperv/netvsc
Author: sephe Date: Wed Dec 28 04:35:52 2016 New Revision: 310657 URL: https://svnweb.freebsd.org/changeset/base/310657 Log: hyperv/hn: Function renaming; no functional changes. MFC after:1 week Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D8908 Modified: head/sys/dev/hyperv/netvsc/if_hn.c Modified: head/sys/dev/hyperv/netvsc/if_hn.c == --- head/sys/dev/hyperv/netvsc/if_hn.c Wed Dec 28 04:31:07 2016 (r310656) +++ head/sys/dev/hyperv/netvsc/if_hn.c Wed Dec 28 04:35:52 2016 (r310657) @@ -333,7 +333,7 @@ static void hn_link_status(struct hn_s static int hn_create_rx_data(struct hn_softc *, int); static voidhn_destroy_rx_data(struct hn_softc *); static int hn_check_iplen(const struct mbuf *, int); -static int hn_set_rxfilter(struct hn_softc *); +static int hn_rxfilter_config(struct hn_softc *); #ifndef RSS static int hn_rss_reconfig(struct hn_softc *); #endif @@ -684,7 +684,7 @@ do { \ #endif /* INET6 || INET */ static int -hn_set_rxfilter(struct hn_softc *sc) +hn_rxfilter_config(struct hn_softc *sc) { struct ifnet *ifp = sc->hn_ifp; uint32_t filter; @@ -2431,7 +2431,7 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, * reply. */ HN_NO_SLEEPING(sc); - hn_set_rxfilter(sc); + hn_rxfilter_config(sc); HN_SLEEPING_OK(sc); } else { hn_init_locked(sc); @@ -2508,7 +2508,7 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, * the RNDIS reply. */ HN_NO_SLEEPING(sc); - hn_set_rxfilter(sc); + hn_rxfilter_config(sc); HN_SLEEPING_OK(sc); } @@ -2566,7 +2566,7 @@ hn_init_locked(struct hn_softc *sc) return; /* Configure RX filter */ - hn_set_rxfilter(sc); + hn_rxfilter_config(sc); /* Clear OACTIVE bit. */ atomic_clear_int(>if_drv_flags, IFF_DRV_OACTIVE); @@ -4925,7 +4925,7 @@ hn_resume_data(struct hn_softc *sc) /* * Re-enable RX. */ - hn_set_rxfilter(sc); + hn_rxfilter_config(sc); /* * Make sure to clear suspend status on "all" TX rings, ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r310652 - head/sys/dev/hyperv/netvsc
Author: sephe Date: Wed Dec 28 03:19:59 2016 New Revision: 310652 URL: https://svnweb.freebsd.org/changeset/base/310652 Log: hyperv/hn: Consolidate hn_{suspend,resume} MFC after:1 week Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D8907 Modified: head/sys/dev/hyperv/netvsc/if_hn.c Modified: head/sys/dev/hyperv/netvsc/if_hn.c == --- head/sys/dev/hyperv/netvsc/if_hn.c Wed Dec 28 03:07:58 2016 (r310651) +++ head/sys/dev/hyperv/netvsc/if_hn.c Wed Dec 28 03:19:59 2016 (r310652) @@ -2367,9 +2367,6 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, break; } - /* Disable polling. */ - hn_polling(sc, 0); - /* * Suspend this interface before the synthetic parts * are ripped. @@ -2415,13 +2412,6 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, */ hn_resume(sc); - /* -* Re-enable polling if this interface is running and -* the polling is requested. -*/ - if ((ifp->if_drv_flags & IFF_DRV_RUNNING) && sc->hn_pollhz > 0) - hn_polling(sc, sc->hn_pollhz); - HN_UNLOCK(sc); break; @@ -4900,6 +4890,9 @@ static void hn_suspend(struct hn_softc *sc) { + /* Disable polling. */ + hn_polling(sc, 0); + if (sc->hn_ifp->if_drv_flags & IFF_DRV_RUNNING) hn_suspend_data(sc); hn_suspend_mgmt(sc); @@ -4992,6 +4985,13 @@ hn_resume(struct hn_softc *sc) if (sc->hn_ifp->if_drv_flags & IFF_DRV_RUNNING) hn_resume_data(sc); hn_resume_mgmt(sc); + + /* +* Re-enable polling if this interface is running and +* the polling is requested. +*/ + if ((sc->hn_ifp->if_drv_flags & IFF_DRV_RUNNING) && sc->hn_pollhz > 0) + hn_polling(sc, sc->hn_pollhz); } static void ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r310651 - head/sys/dev/hyperv/vmbus
Author: sephe Date: Wed Dec 28 03:07:58 2016 New Revision: 310651 URL: https://svnweb.freebsd.org/changeset/base/310651 Log: hyperv/vmbus: Nuke unnecessary critical sections. MFC after:1 week Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D8906 Modified: head/sys/dev/hyperv/vmbus/vmbus.c head/sys/dev/hyperv/vmbus/vmbus_chan.c head/sys/dev/hyperv/vmbus/vmbus_var.h Modified: head/sys/dev/hyperv/vmbus/vmbus.c == --- head/sys/dev/hyperv/vmbus/vmbus.c Wed Dec 28 02:55:26 2016 (r310650) +++ head/sys/dev/hyperv/vmbus/vmbus.c Wed Dec 28 03:07:58 2016 (r310651) @@ -1393,7 +1393,7 @@ cleanup: vmbus_xact_ctx_destroy(sc->vmbus_xc); sc->vmbus_xc = NULL; } - free(sc->vmbus_chmap, M_DEVBUF); + free(__DEVOLATILE(void *, sc->vmbus_chmap), M_DEVBUF); mtx_destroy(>vmbus_prichan_lock); mtx_destroy(>vmbus_chan_lock); @@ -1480,7 +1480,7 @@ vmbus_detach(device_t dev) sc->vmbus_xc = NULL; } - free(sc->vmbus_chmap, M_DEVBUF); + free(__DEVOLATILE(void *, sc->vmbus_chmap), M_DEVBUF); mtx_destroy(>vmbus_prichan_lock); mtx_destroy(>vmbus_chan_lock); Modified: head/sys/dev/hyperv/vmbus/vmbus_chan.c == --- head/sys/dev/hyperv/vmbus/vmbus_chan.c Wed Dec 28 02:55:26 2016 (r310650) +++ head/sys/dev/hyperv/vmbus/vmbus_chan.c Wed Dec 28 03:07:58 2016 (r310651) @@ -775,9 +775,7 @@ vmbus_chan_clrchmap_task(void *xchan, in { struct vmbus_channel *chan = xchan; - critical_enter(); chan->ch_vmbus->vmbus_chmap[chan->ch_id] = NULL; - critical_exit(); } static void @@ -1308,15 +1306,17 @@ vmbus_chan_pollcfg_task(void *xarg, int chan->ch_poll_flags = poll_flags; /* -* Disable interrupt from the RX bufring (TX bufring does not -* generate interrupt to VM), and disconnect this channel from -* the channel map to make sure that ISR can not enqueue this -* channel task anymore. +* Disconnect this channel from the channel map to make sure that +* the RX bufring interrupt enabling bit can not be touched, and +* ISR can not enqueue this channel task anymore. THEN, disable +* interrupt from the RX bufring (TX bufring does not generate +* interrupt to VM). +* +* NOTE: order is critical. */ - critical_enter(); - vmbus_rxbr_intr_mask(>ch_rxbr); chan->ch_vmbus->vmbus_chmap[chan->ch_id] = NULL; - critical_exit(); + __compiler_membar(); + vmbus_rxbr_intr_mask(>ch_rxbr); /* * NOTE: @@ -1380,11 +1380,9 @@ vmbus_chan_polldis_task(void *xchan, int * Plug this channel back to the channel map and unmask * the RX bufring interrupt. */ - critical_enter(); chan->ch_vmbus->vmbus_chmap[chan->ch_id] = chan; __compiler_membar(); vmbus_rxbr_intr_unmask(>ch_rxbr); - critical_exit(); /* * Kick start the interrupt task, just in case unmasking Modified: head/sys/dev/hyperv/vmbus/vmbus_var.h == --- head/sys/dev/hyperv/vmbus/vmbus_var.h Wed Dec 28 02:55:26 2016 (r310650) +++ head/sys/dev/hyperv/vmbus/vmbus_var.h Wed Dec 28 03:07:58 2016 (r310651) @@ -93,7 +93,7 @@ struct vmbus_softc { u_long *vmbus_rx_evtflags; /* compat evtflgs from host */ - struct vmbus_channel**vmbus_chmap; + struct vmbus_channel *volatile *vmbus_chmap; struct vmbus_xact_ctx *vmbus_xc; struct vmbus_pcpu_data vmbus_pcpu[MAXCPU]; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r310465 - head/sys/dev/hyperv/utilities
Author: sephe Date: Fri Dec 23 08:52:10 2016 New Revision: 310465 URL: https://svnweb.freebsd.org/changeset/base/310465 Log: hyperv/ic: Allow applying the samples from hypervisor unconditionally. MFC after:1 week Sponsored by: Microsoft Modified: head/sys/dev/hyperv/utilities/vmbus_timesync.c Modified: head/sys/dev/hyperv/utilities/vmbus_timesync.c == --- head/sys/dev/hyperv/utilities/vmbus_timesync.c Fri Dec 23 08:49:30 2016(r310464) +++ head/sys/dev/hyperv/utilities/vmbus_timesync.c Fri Dec 23 08:52:10 2016(r310465) @@ -139,7 +139,7 @@ vmbus_timesync(struct vmbus_ic_softc *sc } if ((tsflags & VMBUS_ICMSG_TS_FLAG_SAMPLE) && - vmbus_ts_sample_thresh > 0) { + vmbus_ts_sample_thresh >= 0) { int64_t diff; if (vmbus_ts_sample_verbose) { ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r310462 - head/sys/dev/hyperv/utilities
Author: sephe Date: Fri Dec 23 08:41:28 2016 New Revision: 310462 URL: https://svnweb.freebsd.org/changeset/base/310462 Log: hyperv/ic: Fix version4 timesync message format. It is not compat w/ the old timesync message format, which the message type stays the same as the old timesync message. MFC after:1 week Sponsored by: Microsoft Modified: head/sys/dev/hyperv/utilities/vmbus_icreg.h head/sys/dev/hyperv/utilities/vmbus_timesync.c Modified: head/sys/dev/hyperv/utilities/vmbus_icreg.h == --- head/sys/dev/hyperv/utilities/vmbus_icreg.h Fri Dec 23 08:31:29 2016 (r310461) +++ head/sys/dev/hyperv/utilities/vmbus_icreg.h Fri Dec 23 08:41:28 2016 (r310462) @@ -114,8 +114,17 @@ struct vmbus_icmsg_timesync { struct vmbus_icmsg_hdr ic_hdr; uint64_tic_hvtime; uint64_tic_vmtime; + uint64_tic_rtt; + uint8_t ic_tsflags; /* VMBUS_ICMSG_TS_FLAG_ */ +} __packed; + +/* VMBUS_ICMSG_TYPE_TIMESYNC, MSGVER4 */ +struct vmbus_icmsg_timesync4 { + struct vmbus_icmsg_hdr ic_hdr; + uint64_tic_hvtime; uint64_tic_sent_tc; uint8_t ic_tsflags; /* VMBUS_ICMSG_TS_FLAG_ */ + uint8_t ic_rsvd[5]; } __packed; #define VMBUS_ICMSG_TS_FLAG_SYNC 0x01 Modified: head/sys/dev/hyperv/utilities/vmbus_timesync.c == --- head/sys/dev/hyperv/utilities/vmbus_timesync.c Fri Dec 23 08:31:29 2016(r310461) +++ head/sys/dev/hyperv/utilities/vmbus_timesync.c Fri Dec 23 08:41:28 2016(r310462) @@ -48,8 +48,11 @@ __FBSDID("$FreeBSD$"); #define VMBUS_TIMESYNC_MSGVER \ VMBUS_IC_VERSION(VMBUS_TIMESYNC_MSGVER_MAJOR, 0) +#define VMBUS_TIMESYNC_MSGVER4(sc) \ + VMBUS_ICVER_LE(VMBUS_IC_VERSION(4, 0), (sc)->ic_msgver) + #define VMBUS_TIMESYNC_DORTT(sc) \ - ((sc)->ic_msgver >= VMBUS_IC_VERSION(4, 0) && \ + (VMBUS_TIMESYNC_MSGVER4((sc)) &&\ (hyperv_features & CPUID_HV_MSR_TIME_REFCNT)) static int vmbus_timesync_probe(device_t); @@ -174,7 +177,6 @@ vmbus_timesync_cb(struct vmbus_channel * { struct vmbus_ic_softc *sc = xsc; struct vmbus_icmsg_hdr *hdr; - const struct vmbus_icmsg_timesync *msg; int dlen, error; uint64_t xactid; void *data; @@ -209,14 +211,28 @@ vmbus_timesync_cb(struct vmbus_channel * break; case VMBUS_ICMSG_TYPE_TIMESYNC: - if (dlen < sizeof(*msg)) { - device_printf(sc->ic_dev, "invalid timesync len %d\n", - dlen); - return; + if (VMBUS_TIMESYNC_MSGVER4(sc)) { + const struct vmbus_icmsg_timesync4 *msg4; + + if (dlen < sizeof(*msg4)) { + device_printf(sc->ic_dev, "invalid timesync4 " + "len %d\n", dlen); + return; + } + msg4 = data; + vmbus_timesync(sc, msg4->ic_hvtime, msg4->ic_sent_tc, + msg4->ic_tsflags); + } else { + const struct vmbus_icmsg_timesync *msg; + + if (dlen < sizeof(*msg)) { + device_printf(sc->ic_dev, "invalid timesync " + "len %d\n", dlen); + return; + } + msg = data; + vmbus_timesync(sc, msg->ic_hvtime, 0, msg->ic_tsflags); } - msg = data; - vmbus_timesync(sc, msg->ic_hvtime, msg->ic_sent_tc, - msg->ic_tsflags); break; default: ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r310348 - head/sys/dev/hyperv/vmbus
Author: sephe Date: Wed Dec 21 03:23:35 2016 New Revision: 310348 URL: https://svnweb.freebsd.org/changeset/base/310348 Log: hyperv: Unbreak EARLY_AP_STARUP Hyper-V bootstrap by using intrhook Properly working pause and friends are required. MFC after:3 days Sponsored by: Microsoft Modified: head/sys/dev/hyperv/vmbus/vmbus.c head/sys/dev/hyperv/vmbus/vmbus_var.h Modified: head/sys/dev/hyperv/vmbus/vmbus.c == --- head/sys/dev/hyperv/vmbus/vmbus.c Wed Dec 21 03:09:07 2016 (r310347) +++ head/sys/dev/hyperv/vmbus/vmbus.c Wed Dec 21 03:23:35 2016 (r310348) @@ -99,6 +99,9 @@ static uint32_t vmbus_get_vcpu_id_meth device_t dev, int cpu); static struct taskqueue*vmbus_get_eventtq_method(device_t, device_t, int); +#ifdef EARLY_AP_STARTUP +static voidvmbus_intrhook(void *); +#endif static int vmbus_init(struct vmbus_softc *); static int vmbus_connect(struct vmbus_softc *, uint32_t); @@ -1402,6 +1405,21 @@ vmbus_event_proc_dummy(struct vmbus_soft { } +#ifdef EARLY_AP_STARTUP + +static void +vmbus_intrhook(void *xsc) +{ + struct vmbus_softc *sc = xsc; + + if (bootverbose) + device_printf(sc->vmbus_dev, "intrhook\n"); + vmbus_doattach(sc); + config_intrhook_disestablish(>vmbus_intrhook); +} + +#endif /* EARLY_AP_STARTUP */ + static int vmbus_attach(device_t dev) { @@ -1416,7 +1434,14 @@ vmbus_attach(device_t dev) */ vmbus_sc->vmbus_event_proc = vmbus_event_proc_dummy; -#ifndef EARLY_AP_STARTUP +#ifdef EARLY_AP_STARTUP + /* +* Defer the real attach until the pause(9) works as expected. +*/ + vmbus_sc->vmbus_intrhook.ich_func = vmbus_intrhook; + vmbus_sc->vmbus_intrhook.ich_arg = vmbus_sc; + config_intrhook_establish(_sc->vmbus_intrhook); +#else /* !EARLY_AP_STARTUP */ /* * If the system has already booted and thread * scheduling is possible indicated by the global @@ -1424,8 +1449,8 @@ vmbus_attach(device_t dev) * initialization directly. */ if (!cold) -#endif vmbus_doattach(vmbus_sc); +#endif /* EARLY_AP_STARTUP */ return (0); } Modified: head/sys/dev/hyperv/vmbus/vmbus_var.h == --- head/sys/dev/hyperv/vmbus/vmbus_var.h Wed Dec 21 03:09:07 2016 (r310347) +++ head/sys/dev/hyperv/vmbus/vmbus_var.h Wed Dec 21 03:23:35 2016 (r310348) @@ -30,6 +30,7 @@ #define _VMBUS_VAR_H_ #include +#include #include #include @@ -128,6 +129,8 @@ struct vmbus_softc { struct mtx vmbus_chan_lock; TAILQ_HEAD(, vmbus_channel) vmbus_chans; + struct intr_config_hook vmbus_intrhook; + #ifdef NEW_PCIB /* The list of usable MMIO ranges for PCIe pass-through */ struct pcib_host_resources vmbus_mmio_res; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r310347 - head/sys/dev/hyperv/storvsc
Author: sephe Date: Wed Dec 21 03:09:07 2016 New Revision: 310347 URL: https://svnweb.freebsd.org/changeset/base/310347 Log: hyperv/storvsc: The max channel in PDU actually means the max sub-chans. Use proper name for local variables. PDU fields' name was not changed yet. While I'm here, make # of usable channels tunable. This eases further testing. MFC after:1 week Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D8851 Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c == --- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.cWed Dec 21 01:48:54 2016(r310346) +++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.cWed Dec 21 03:09:07 2016(r310347) @@ -147,6 +147,10 @@ static u_int hv_storvsc_max_io = 512; SYSCTL_UINT(_hw_storvsc, OID_AUTO, max_io, CTLFLAG_RDTUN, _storvsc_max_io, 0, "Hyper-V storage max io limit"); +static int hv_storvsc_chan_cnt = 0; +SYSCTL_INT(_hw_storvsc, OID_AUTO, chan_cnt, CTLFLAG_RDTUN, + _storvsc_chan_cnt, 0, "# of channels to use"); + #define STORVSC_MAX_IO \ vmbus_chan_prplist_nelem(hv_storvsc_ringbuffer_size,\ STORVSC_DATA_SEGCNT_MAX, VSTOR_PKT_SIZE) @@ -385,16 +389,16 @@ storvsc_subchan_attach(struct storvsc_so * @param max_chans the max channels supported by vmbus */ static void -storvsc_send_multichannel_request(struct storvsc_softc *sc, int max_chans) +storvsc_send_multichannel_request(struct storvsc_softc *sc, int max_subch) { struct vmbus_channel **subchan; struct hv_storvsc_request *request; struct vstor_packet *vstor_packet; - int request_channels_cnt = 0; + int request_subch; int ret, i; - /* get multichannels count that need to create */ - request_channels_cnt = MIN(max_chans, mp_ncpus); + /* get sub-channel count that need to create */ + request_subch = MIN(max_subch, mp_ncpus - 1); request = >hs_init_req; @@ -407,7 +411,7 @@ storvsc_send_multichannel_request(struct vstor_packet->operation = VSTOR_OPERATION_CREATE_MULTI_CHANNELS; vstor_packet->flags = REQUEST_COMPLETION_FLAG; - vstor_packet->u.multi_channels_cnt = request_channels_cnt; + vstor_packet->u.multi_channels_cnt = request_subch; ret = vmbus_chan_send(sc->hs_chan, VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC, @@ -424,17 +428,17 @@ storvsc_send_multichannel_request(struct } /* Update channel count */ - sc->hs_nchan = request_channels_cnt + 1; + sc->hs_nchan = request_subch + 1; /* Wait for sub-channels setup to complete. */ - subchan = vmbus_subchan_get(sc->hs_chan, request_channels_cnt); + subchan = vmbus_subchan_get(sc->hs_chan, request_subch); /* Attach the sub-channels. */ - for (i = 0; i < request_channels_cnt; ++i) + for (i = 0; i < request_subch; ++i) storvsc_subchan_attach(sc, subchan[i]); /* Release the sub-channels. */ - vmbus_subchan_rel(subchan, request_channels_cnt); + vmbus_subchan_rel(subchan, request_subch); if (bootverbose) printf("Storvsc create multi-channel success!\n"); @@ -452,11 +456,11 @@ hv_storvsc_channel_init(struct storvsc_s int ret = 0, i; struct hv_storvsc_request *request; struct vstor_packet *vstor_packet; - uint16_t max_chans = 0; - boolean_t support_multichannel = FALSE; + uint16_t max_subch; + boolean_t support_multichannel; uint32_t version; - max_chans = 0; + max_subch = 0; support_multichannel = FALSE; request = >hs_init_req; @@ -550,14 +554,21 @@ hv_storvsc_channel_init(struct storvsc_s goto cleanup; } + max_subch = vstor_packet->u.chan_props.max_channel_cnt; + if (hv_storvsc_chan_cnt > 0 && hv_storvsc_chan_cnt < (max_subch + 1)) + max_subch = hv_storvsc_chan_cnt - 1; + /* multi-channels feature is supported by WIN8 and above version */ - max_chans = vstor_packet->u.chan_props.max_channel_cnt; version = VMBUS_GET_VERSION(device_get_parent(sc->hs_dev), sc->hs_dev); if (version != VMBUS_VERSION_WIN7 && version != VMBUS_VERSION_WS2008 && (vstor_packet->u.chan_props.flags & HV_STORAGE_SUPPORTS_MULTI_CHANNEL)) { support_multichannel = TRUE; } + if (bootverbose) { + device_printf(sc->hs_dev, "max chans %d%s\n", max_subch + 1, + support_multichannel ? ", multi-chan capable" : ""); + } memset(vstor_packet, 0, sizeof(struct vstor_packet)); vstor_packet->operation =
svn commit: r310345 - head/sys/geom
Author: sephe Date: Wed Dec 21 01:39:11 2016 New Revision: 310345 URL: https://svnweb.freebsd.org/changeset/base/310345 Log: build: Unbreak LINT Sponsored by: Microsoft Modified: head/sys/geom/geom_map.c Modified: head/sys/geom/geom_map.c == --- head/sys/geom/geom_map.cWed Dec 21 01:38:44 2016(r310344) +++ head/sys/geom/geom_map.cWed Dec 21 01:39:11 2016(r310345) @@ -147,8 +147,13 @@ find_marker(struct g_consumer *cp, const bzero(search_key, MAP_MAX_MARKER_LEN); sectorsize = cp->provider->sectorsize; +#ifdef __LP64__ + ret = sscanf(line, "search:%li:%li:%63c", + _start, _step, search_key); +#else ret = sscanf(line, "search:%qi:%qi:%63c", _start, _step, search_key); +#endif if (ret < 3) return (1); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r310324 - in head/sys: conf dev/hyperv/utilities modules/hyperv/utilities
Author: sephe Date: Tue Dec 20 09:46:14 2016 New Revision: 310324 URL: https://svnweb.freebsd.org/changeset/base/310324 Log: hyperv/ic: Rename cleaned up files. MFC after:1 week Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D8850 Added: head/sys/dev/hyperv/utilities/vmbus_heartbeat.c - copied unchanged from r310323, head/sys/dev/hyperv/utilities/hv_heartbeat.c head/sys/dev/hyperv/utilities/vmbus_shutdown.c - copied unchanged from r310323, head/sys/dev/hyperv/utilities/hv_shutdown.c head/sys/dev/hyperv/utilities/vmbus_timesync.c - copied unchanged from r310323, head/sys/dev/hyperv/utilities/hv_timesync.c Deleted: head/sys/dev/hyperv/utilities/hv_heartbeat.c head/sys/dev/hyperv/utilities/hv_shutdown.c head/sys/dev/hyperv/utilities/hv_timesync.c Modified: head/sys/conf/files.amd64 head/sys/conf/files.i386 head/sys/modules/hyperv/utilities/Makefile Modified: head/sys/conf/files.amd64 == --- head/sys/conf/files.amd64 Tue Dec 20 08:49:13 2016(r310323) +++ head/sys/conf/files.amd64 Tue Dec 20 09:46:14 2016(r310324) @@ -298,12 +298,12 @@ dev/hyperv/netvsc/hn_nvs.c optionalh dev/hyperv/netvsc/hn_rndis.c optionalhyperv dev/hyperv/netvsc/if_hn.c optionalhyperv dev/hyperv/storvsc/hv_storvsc_drv_freebsd.coptionalhyperv -dev/hyperv/utilities/hv_heartbeat.coptionalhyperv dev/hyperv/utilities/hv_kvp.c optionalhyperv dev/hyperv/utilities/hv_snapshot.c optionalhyperv -dev/hyperv/utilities/hv_shutdown.c optionalhyperv -dev/hyperv/utilities/hv_timesync.c optionalhyperv +dev/hyperv/utilities/vmbus_heartbeat.c optionalhyperv dev/hyperv/utilities/vmbus_ic.coptional hyperv +dev/hyperv/utilities/vmbus_shutdown.c optionalhyperv +dev/hyperv/utilities/vmbus_timesync.c optionalhyperv dev/hyperv/vmbus/hyperv.c optionalhyperv dev/hyperv/vmbus/hyperv_busdma.c optionalhyperv dev/hyperv/vmbus/vmbus.c optionalhyperv pci Modified: head/sys/conf/files.i386 == --- head/sys/conf/files.i386Tue Dec 20 08:49:13 2016(r310323) +++ head/sys/conf/files.i386Tue Dec 20 09:46:14 2016(r310324) @@ -254,12 +254,12 @@ dev/hyperv/netvsc/hn_nvs.c optionalh dev/hyperv/netvsc/hn_rndis.c optionalhyperv dev/hyperv/netvsc/if_hn.c optionalhyperv dev/hyperv/storvsc/hv_storvsc_drv_freebsd.coptionalhyperv -dev/hyperv/utilities/hv_heartbeat.coptionalhyperv dev/hyperv/utilities/hv_kvp.c optionalhyperv dev/hyperv/utilities/hv_snapshot.c optionalhyperv -dev/hyperv/utilities/hv_shutdown.c optionalhyperv -dev/hyperv/utilities/hv_timesync.c optionalhyperv +dev/hyperv/utilities/vmbus_heartbeat.c optionalhyperv dev/hyperv/utilities/vmbus_ic.coptional hyperv +dev/hyperv/utilities/vmbus_shutdown.c optionalhyperv +dev/hyperv/utilities/vmbus_timesync.c optionalhyperv dev/hyperv/vmbus/hyperv.c optionalhyperv dev/hyperv/vmbus/hyperv_busdma.c optionalhyperv dev/hyperv/vmbus/vmbus.c optionalhyperv pci Copied: head/sys/dev/hyperv/utilities/vmbus_heartbeat.c (from r310323, head/sys/dev/hyperv/utilities/hv_heartbeat.c) == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/hyperv/utilities/vmbus_heartbeat.c Tue Dec 20 09:46:14 2016(r310324, copy of r310323, head/sys/dev/hyperv/utilities/hv_heartbeat.c) @@ -0,0 +1,152 @@ +/*- + * Copyright (c) 2014,2016 Microsoft Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice unmodified, this list of conditions, and the following + *disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice,
svn commit: r310318 - head/sys/dev/hyperv/utilities
Author: sephe Date: Tue Dec 20 07:34:44 2016 New Revision: 310318 URL: https://svnweb.freebsd.org/changeset/base/310318 Log: hyperv/ic: Cleanup driver glue. MFC after:1 week Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D8849 Modified: head/sys/dev/hyperv/utilities/hv_heartbeat.c head/sys/dev/hyperv/utilities/hv_shutdown.c head/sys/dev/hyperv/utilities/hv_timesync.c Modified: head/sys/dev/hyperv/utilities/hv_heartbeat.c == --- head/sys/dev/hyperv/utilities/hv_heartbeat.cTue Dec 20 07:14:24 2016(r310317) +++ head/sys/dev/hyperv/utilities/hv_heartbeat.cTue Dec 20 07:34:44 2016(r310318) @@ -46,6 +46,9 @@ __FBSDID("$FreeBSD$"); #define VMBUS_HEARTBEAT_MSGVER \ VMBUS_IC_VERSION(VMBUS_HEARTBEAT_MSGVER_MAJOR, 0) +static int vmbus_heartbeat_probe(device_t); +static int vmbus_heartbeat_attach(device_t); + static const struct vmbus_ic_desc vmbus_heartbeat_descs[] = { { .ic_guid = { .hv_guid = { @@ -56,6 +59,27 @@ static const struct vmbus_ic_desc vmbus_ VMBUS_IC_DESC_END }; +static device_method_t vmbus_heartbeat_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, vmbus_heartbeat_probe), + DEVMETHOD(device_attach,vmbus_heartbeat_attach), + DEVMETHOD(device_detach,vmbus_ic_detach), + DEVMETHOD_END +}; + +static driver_t vmbus_heartbeat_driver = { + "hvheartbeat", + vmbus_heartbeat_methods, + sizeof(struct vmbus_ic_softc) +}; + +static devclass_t vmbus_heartbeat_devclass; + +DRIVER_MODULE(hv_heartbeat, vmbus, vmbus_heartbeat_driver, +vmbus_heartbeat_devclass, NULL, NULL); +MODULE_VERSION(hv_heartbeat, 1); +MODULE_DEPEND(hv_heartbeat, vmbus, 1, 1, 1); + static void vmbus_heartbeat_cb(struct vmbus_channel *chan, void *xsc) { @@ -114,35 +138,15 @@ vmbus_heartbeat_cb(struct vmbus_channel } static int -hv_heartbeat_probe(device_t dev) +vmbus_heartbeat_probe(device_t dev) { return (vmbus_ic_probe(dev, vmbus_heartbeat_descs)); } static int -hv_heartbeat_attach(device_t dev) +vmbus_heartbeat_attach(device_t dev) { return (vmbus_ic_attach(dev, vmbus_heartbeat_cb)); } - -static device_method_t heartbeat_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, hv_heartbeat_probe), - DEVMETHOD(device_attach, hv_heartbeat_attach), - DEVMETHOD(device_detach, vmbus_ic_detach), - { 0, 0 } -}; - -static driver_t heartbeat_driver = { - "hvheartbeat", - heartbeat_methods, - sizeof(struct vmbus_ic_softc) -}; - -static devclass_t heartbeat_devclass; - -DRIVER_MODULE(hv_heartbeat, vmbus, heartbeat_driver, heartbeat_devclass, NULL, NULL); -MODULE_VERSION(hv_heartbeat, 1); -MODULE_DEPEND(hv_heartbeat, vmbus, 1, 1, 1); Modified: head/sys/dev/hyperv/utilities/hv_shutdown.c == --- head/sys/dev/hyperv/utilities/hv_shutdown.c Tue Dec 20 07:14:24 2016 (r310317) +++ head/sys/dev/hyperv/utilities/hv_shutdown.c Tue Dec 20 07:34:44 2016 (r310318) @@ -47,6 +47,9 @@ __FBSDID("$FreeBSD$"); #define VMBUS_SHUTDOWN_MSGVER \ VMBUS_IC_VERSION(VMBUS_SHUTDOWN_MSGVER_MAJOR, 0) +static int vmbus_shutdown_probe(device_t); +static int vmbus_shutdown_attach(device_t); + static const struct vmbus_ic_desc vmbus_shutdown_descs[] = { { .ic_guid = { .hv_guid = { @@ -57,6 +60,27 @@ static const struct vmbus_ic_desc vmbus_ VMBUS_IC_DESC_END }; +static device_method_t vmbus_shutdown_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, vmbus_shutdown_probe), + DEVMETHOD(device_attach,vmbus_shutdown_attach), + DEVMETHOD(device_detach,vmbus_ic_detach), + DEVMETHOD_END +}; + +static driver_t vmbus_shutdown_driver = { + "hvshutdown", + vmbus_shutdown_methods, + sizeof(struct vmbus_ic_softc) +}; + +static devclass_t vmbus_shutdown_devclass; + +DRIVER_MODULE(hv_shutdown, vmbus, vmbus_shutdown_driver, +vmbus_shutdown_devclass, NULL, NULL); +MODULE_VERSION(hv_shutdown, 1); +MODULE_DEPEND(hv_shutdown, vmbus, 1, 1, 1); + static void vmbus_shutdown_cb(struct vmbus_channel *chan, void *xsc) { @@ -129,35 +153,15 @@ vmbus_shutdown_cb(struct vmbus_channel * } static int -hv_shutdown_probe(device_t dev) +vmbus_shutdown_probe(device_t dev) { return (vmbus_ic_probe(dev, vmbus_shutdown_descs)); } static int -hv_shutdown_attach(device_t dev) +vmbus_shutdown_attach(device_t dev) { return (vmbus_ic_attach(dev, vmbus_shutdown_cb)); } - -static device_method_t shutdown_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe,
svn commit: r310317 - in head/sys: conf dev/hyperv/utilities modules/hyperv/utilities
Author: sephe Date: Tue Dec 20 07:14:24 2016 New Revision: 310317 URL: https://svnweb.freebsd.org/changeset/base/310317 Log: hyperv/ic: Rname cleaned up file. MFC after:1 week Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D8848 Added: head/sys/dev/hyperv/utilities/vmbus_ic.c - copied unchanged from r310316, head/sys/dev/hyperv/utilities/hv_util.c Deleted: head/sys/dev/hyperv/utilities/hv_util.c Modified: head/sys/conf/files.amd64 head/sys/conf/files.i386 head/sys/modules/hyperv/utilities/Makefile Modified: head/sys/conf/files.amd64 == --- head/sys/conf/files.amd64 Tue Dec 20 05:45:52 2016(r310316) +++ head/sys/conf/files.amd64 Tue Dec 20 07:14:24 2016(r310317) @@ -303,7 +303,7 @@ dev/hyperv/utilities/hv_kvp.c optiona dev/hyperv/utilities/hv_snapshot.c optionalhyperv dev/hyperv/utilities/hv_shutdown.c optionalhyperv dev/hyperv/utilities/hv_timesync.c optionalhyperv -dev/hyperv/utilities/hv_util.c optionalhyperv +dev/hyperv/utilities/vmbus_ic.coptional hyperv dev/hyperv/vmbus/hyperv.c optionalhyperv dev/hyperv/vmbus/hyperv_busdma.c optionalhyperv dev/hyperv/vmbus/vmbus.c optionalhyperv pci Modified: head/sys/conf/files.i386 == --- head/sys/conf/files.i386Tue Dec 20 05:45:52 2016(r310316) +++ head/sys/conf/files.i386Tue Dec 20 07:14:24 2016(r310317) @@ -259,7 +259,7 @@ dev/hyperv/utilities/hv_kvp.c optiona dev/hyperv/utilities/hv_snapshot.c optionalhyperv dev/hyperv/utilities/hv_shutdown.c optionalhyperv dev/hyperv/utilities/hv_timesync.c optionalhyperv -dev/hyperv/utilities/hv_util.c optionalhyperv +dev/hyperv/utilities/vmbus_ic.coptional hyperv dev/hyperv/vmbus/hyperv.c optionalhyperv dev/hyperv/vmbus/hyperv_busdma.c optionalhyperv dev/hyperv/vmbus/vmbus.c optionalhyperv pci Copied: head/sys/dev/hyperv/utilities/vmbus_ic.c (from r310316, head/sys/dev/hyperv/utilities/hv_util.c) == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/hyperv/utilities/vmbus_ic.cTue Dec 20 07:14:24 2016 (r310317, copy of r310316, head/sys/dev/hyperv/utilities/hv_util.c) @@ -0,0 +1,299 @@ +/*- + * Copyright (c) 2014,2016 Microsoft Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice unmodified, this list of conditions, and the following + *disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "vmbus_if.h" + +#define VMBUS_IC_BRSIZE(4 * PAGE_SIZE) + +#define VMBUS_IC_VERCNT2 +#define VMBUS_IC_NEGOSZ\ + __offsetof(struct vmbus_icmsg_negotiate, ic_ver[VMBUS_IC_VERCNT]) +CTASSERT(VMBUS_IC_NEGOSZ < VMBUS_IC_BRSIZE); + +static int vmbus_ic_fwver_sysctl(SYSCTL_HANDLER_ARGS); +static int vmbus_ic_msgver_sysctl(SYSCTL_HANDLER_ARGS); + +int +vmbus_ic_negomsg(struct vmbus_ic_softc *sc, void *data, int *dlen0, +uint32_t
svn commit: r310315 - head/sys/dev/hyperv/utilities
Author: sephe Date: Tue Dec 20 05:39:00 2016 New Revision: 310315 URL: https://svnweb.freebsd.org/changeset/base/310315 Log: hyperv/ic: Inclusion cleanup MFC after:1 week Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D8847 Modified: head/sys/dev/hyperv/utilities/hv_heartbeat.c head/sys/dev/hyperv/utilities/hv_shutdown.c head/sys/dev/hyperv/utilities/hv_timesync.c head/sys/dev/hyperv/utilities/hv_util.c Modified: head/sys/dev/hyperv/utilities/hv_heartbeat.c == --- head/sys/dev/hyperv/utilities/hv_heartbeat.cTue Dec 20 05:26:38 2016(r310314) +++ head/sys/dev/hyperv/utilities/hv_heartbeat.cTue Dec 20 05:39:00 2016(r310315) @@ -38,8 +38,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include "vmbus_if.h" - #define VMBUS_HEARTBEAT_FWVER_MAJOR3 #define VMBUS_HEARTBEAT_FWVER \ VMBUS_IC_VERSION(VMBUS_HEARTBEAT_FWVER_MAJOR, 0) Modified: head/sys/dev/hyperv/utilities/hv_shutdown.c == --- head/sys/dev/hyperv/utilities/hv_shutdown.c Tue Dec 20 05:26:38 2016 (r310314) +++ head/sys/dev/hyperv/utilities/hv_shutdown.c Tue Dec 20 05:39:00 2016 (r310315) @@ -39,8 +39,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include "vmbus_if.h" - #define VMBUS_SHUTDOWN_FWVER_MAJOR 3 #define VMBUS_SHUTDOWN_FWVER \ VMBUS_IC_VERSION(VMBUS_SHUTDOWN_FWVER_MAJOR, 0) Modified: head/sys/dev/hyperv/utilities/hv_timesync.c == --- head/sys/dev/hyperv/utilities/hv_timesync.c Tue Dec 20 05:26:38 2016 (r310314) +++ head/sys/dev/hyperv/utilities/hv_timesync.c Tue Dec 20 05:39:00 2016 (r310315) @@ -40,8 +40,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include "vmbus_if.h" - #define VMBUS_TIMESYNC_FWVER_MAJOR 3 #define VMBUS_TIMESYNC_FWVER \ VMBUS_IC_VERSION(VMBUS_TIMESYNC_FWVER_MAJOR, 0) Modified: head/sys/dev/hyperv/utilities/hv_util.c == --- head/sys/dev/hyperv/utilities/hv_util.c Tue Dec 20 05:26:38 2016 (r310314) +++ head/sys/dev/hyperv/utilities/hv_util.c Tue Dec 20 05:39:00 2016 (r310315) @@ -22,23 +22,16 @@ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ */ -/* - * A common driver for all hyper-V util services. - */ +#include +__FBSDID("$FreeBSD$"); #include -#include #include #include -#include -#include #include #include -#include #include #include ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r310314 - head/sys/dev/hyperv/utilities
Author: sephe Date: Tue Dec 20 05:26:38 2016 New Revision: 310314 URL: https://svnweb.freebsd.org/changeset/base/310314 Log: hyperv/ic: Rename cleaned up header file. MFC after:1 week Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D8846 Added: head/sys/dev/hyperv/utilities/vmbus_icvar.h - copied unchanged from r310313, head/sys/dev/hyperv/utilities/hv_util.h Deleted: head/sys/dev/hyperv/utilities/hv_util.h Modified: head/sys/dev/hyperv/utilities/hv_heartbeat.c head/sys/dev/hyperv/utilities/hv_kvp.c head/sys/dev/hyperv/utilities/hv_shutdown.c head/sys/dev/hyperv/utilities/hv_snapshot.c head/sys/dev/hyperv/utilities/hv_timesync.c head/sys/dev/hyperv/utilities/hv_util.c Modified: head/sys/dev/hyperv/utilities/hv_heartbeat.c == --- head/sys/dev/hyperv/utilities/hv_heartbeat.cTue Dec 20 05:07:12 2016(r310313) +++ head/sys/dev/hyperv/utilities/hv_heartbeat.cTue Dec 20 05:26:38 2016(r310314) @@ -35,8 +35,8 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include +#include #include "vmbus_if.h" Modified: head/sys/dev/hyperv/utilities/hv_kvp.c == --- head/sys/dev/hyperv/utilities/hv_kvp.c Tue Dec 20 05:07:12 2016 (r310313) +++ head/sys/dev/hyperv/utilities/hv_kvp.c Tue Dec 20 05:26:38 2016 (r310314) @@ -64,8 +64,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include -#include "hv_util.h" #include "unicode.h" #include "hv_kvp.h" #include "vmbus_if.h" Modified: head/sys/dev/hyperv/utilities/hv_shutdown.c == --- head/sys/dev/hyperv/utilities/hv_shutdown.c Tue Dec 20 05:07:12 2016 (r310313) +++ head/sys/dev/hyperv/utilities/hv_shutdown.c Tue Dec 20 05:26:38 2016 (r310314) @@ -36,8 +36,8 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include +#include #include "vmbus_if.h" Modified: head/sys/dev/hyperv/utilities/hv_snapshot.c == --- head/sys/dev/hyperv/utilities/hv_snapshot.c Tue Dec 20 05:07:12 2016 (r310313) +++ head/sys/dev/hyperv/utilities/hv_snapshot.c Tue Dec 20 05:26:38 2016 (r310314) @@ -57,8 +57,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include -#include "hv_util.h" #include "hv_snapshot.h" #include "vmbus_if.h" Modified: head/sys/dev/hyperv/utilities/hv_timesync.c == --- head/sys/dev/hyperv/utilities/hv_timesync.c Tue Dec 20 05:07:12 2016 (r310313) +++ head/sys/dev/hyperv/utilities/hv_timesync.c Tue Dec 20 05:26:38 2016 (r310314) @@ -37,8 +37,8 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include +#include #include "vmbus_if.h" Modified: head/sys/dev/hyperv/utilities/hv_util.c == --- head/sys/dev/hyperv/utilities/hv_util.c Tue Dec 20 05:07:12 2016 (r310313) +++ head/sys/dev/hyperv/utilities/hv_util.c Tue Dec 20 05:26:38 2016 (r310314) @@ -42,8 +42,8 @@ #include #include -#include #include +#include #include "vmbus_if.h" Copied: head/sys/dev/hyperv/utilities/vmbus_icvar.h (from r310313, head/sys/dev/hyperv/utilities/hv_util.h) == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/hyperv/utilities/vmbus_icvar.h Tue Dec 20 05:26:38 2016 (r310314, copy of r310313, head/sys/dev/hyperv/utilities/hv_util.h) @@ -0,0 +1,61 @@ +/*- + * Copyright (c) 2009-2012,2016 Microsoft Corp. + * Copyright (c) 2012 NetApp Inc. + * Copyright (c) 2012 Citrix Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice unmodified, this list of conditions, and the following + *disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF
svn commit: r310313 - head/sys/dev/hyperv/utilities
Author: sephe Date: Tue Dec 20 05:07:12 2016 New Revision: 310313 URL: https://svnweb.freebsd.org/changeset/base/310313 Log: hyperv/ic: Cleanup common struct and functions. MFC after:1 week Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D8845 Modified: head/sys/dev/hyperv/utilities/hv_heartbeat.c head/sys/dev/hyperv/utilities/hv_kvp.c head/sys/dev/hyperv/utilities/hv_shutdown.c head/sys/dev/hyperv/utilities/hv_snapshot.c head/sys/dev/hyperv/utilities/hv_timesync.c head/sys/dev/hyperv/utilities/hv_util.c head/sys/dev/hyperv/utilities/hv_util.h Modified: head/sys/dev/hyperv/utilities/hv_heartbeat.c == --- head/sys/dev/hyperv/utilities/hv_heartbeat.cTue Dec 20 04:51:14 2016(r310312) +++ head/sys/dev/hyperv/utilities/hv_heartbeat.cTue Dec 20 05:07:12 2016(r310313) @@ -61,7 +61,7 @@ static const struct vmbus_ic_desc vmbus_ static void vmbus_heartbeat_cb(struct vmbus_channel *chan, void *xsc) { - struct hv_util_sc *sc = xsc; + struct vmbus_ic_softc *sc = xsc; struct vmbus_icmsg_hdr *hdr; int dlen, error; uint64_t xactid; @@ -70,7 +70,7 @@ vmbus_heartbeat_cb(struct vmbus_channel /* * Receive request. */ - data = sc->receive_buffer; + data = sc->ic_buf; dlen = sc->ic_buflen; error = vmbus_chan_recv(chan, data, , ); KASSERT(error != ENOBUFS, ("icbuf is not large enough")); @@ -126,18 +126,22 @@ static int hv_heartbeat_attach(device_t dev) { - return (hv_util_attach(dev, vmbus_heartbeat_cb)); + return (vmbus_ic_attach(dev, vmbus_heartbeat_cb)); } static device_method_t heartbeat_methods[] = { /* Device interface */ DEVMETHOD(device_probe, hv_heartbeat_probe), DEVMETHOD(device_attach, hv_heartbeat_attach), - DEVMETHOD(device_detach, hv_util_detach), + DEVMETHOD(device_detach, vmbus_ic_detach), { 0, 0 } }; -static driver_t heartbeat_driver = { "hvheartbeat", heartbeat_methods, sizeof(hv_util_sc)}; +static driver_t heartbeat_driver = { + "hvheartbeat", + heartbeat_methods, + sizeof(struct vmbus_ic_softc) +}; static devclass_t heartbeat_devclass; Modified: head/sys/dev/hyperv/utilities/hv_kvp.c == --- head/sys/dev/hyperv/utilities/hv_kvp.c Tue Dec 20 04:51:14 2016 (r310312) +++ head/sys/dev/hyperv/utilities/hv_kvp.c Tue Dec 20 05:07:12 2016 (r310313) @@ -128,7 +128,7 @@ static struct cdevsw hv_kvp_cdevsw = * KVP transaction requests from the host. */ typedef struct hv_kvp_sc { - struct hv_util_sc util_sc; + struct vmbus_ic_softc util_sc; device_tdev; /* Unless specified the pending mutex should be @@ -590,7 +590,7 @@ hv_kvp_process_request(void *context, in hv_kvp_log_info("%s: entering hv_kvp_process_request\n", __func__); sc = (hv_kvp_sc*)context; - kvp_buf = sc->util_sc.receive_buffer; + kvp_buf = sc->util_sc.ic_buf; channel = vmbus_get_channel(sc->dev); recvlen = sc->util_sc.ic_buflen; @@ -885,7 +885,7 @@ hv_kvp_attach(device_t dev) return (error); sc->hv_kvp_dev->si_drv1 = sc; - return hv_util_attach(dev, hv_kvp_callback); + return (vmbus_ic_attach(dev, hv_kvp_callback)); } static int @@ -900,7 +900,7 @@ hv_kvp_detach(device_t dev) } destroy_dev(sc->hv_kvp_dev); - return hv_util_detach(dev); + return (vmbus_ic_detach(dev)); } static device_method_t kvp_methods[] = { Modified: head/sys/dev/hyperv/utilities/hv_shutdown.c == --- head/sys/dev/hyperv/utilities/hv_shutdown.c Tue Dec 20 04:51:14 2016 (r310312) +++ head/sys/dev/hyperv/utilities/hv_shutdown.c Tue Dec 20 05:07:12 2016 (r310313) @@ -62,7 +62,7 @@ static const struct vmbus_ic_desc vmbus_ static void vmbus_shutdown_cb(struct vmbus_channel *chan, void *xsc) { - struct hv_util_sc *sc = xsc; + struct vmbus_ic_softc *sc = xsc; struct vmbus_icmsg_hdr *hdr; struct vmbus_icmsg_shutdown *msg; int dlen, error, do_shutdown = 0; @@ -72,7 +72,7 @@ vmbus_shutdown_cb(struct vmbus_channel * /* * Receive request. */ - data = sc->receive_buffer; + data = sc->ic_buf; dlen = sc->ic_buflen; error = vmbus_chan_recv(chan, data, , ); KASSERT(error != ENOBUFS, ("icbuf is not large enough")); @@ -141,18 +141,22 @@ static int hv_shutdown_attach(device_t dev) { - return (hv_util_attach(dev, vmbus_shutdown_cb)); + return (vmbus_ic_attach(dev, vmbus_shutdown_cb)); } static device_method_t shutdown_methods[] = { /* Device
svn commit: r310312 - head/sys/dev/hyperv/utilities
Author: sephe Date: Tue Dec 20 04:51:14 2016 New Revision: 310312 URL: https://svnweb.freebsd.org/changeset/base/310312 Log: hyperv/ic: Factor out function to send IC response MFC after:1 week Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D8844 Modified: head/sys/dev/hyperv/utilities/hv_heartbeat.c head/sys/dev/hyperv/utilities/hv_shutdown.c head/sys/dev/hyperv/utilities/hv_timesync.c head/sys/dev/hyperv/utilities/hv_util.c head/sys/dev/hyperv/utilities/hv_util.h Modified: head/sys/dev/hyperv/utilities/hv_heartbeat.c == --- head/sys/dev/hyperv/utilities/hv_heartbeat.cTue Dec 20 04:05:21 2016(r310311) +++ head/sys/dev/hyperv/utilities/hv_heartbeat.cTue Dec 20 04:51:14 2016(r310312) @@ -110,13 +110,9 @@ vmbus_heartbeat_cb(struct vmbus_channel } /* -* Send response by echoing the updated request back. +* Send response by echoing the request back. */ - hdr->ic_flags = VMBUS_ICMSG_FLAG_XACT | VMBUS_ICMSG_FLAG_RESP; - error = vmbus_chan_send(chan, VMBUS_CHANPKT_TYPE_INBAND, 0, - data, dlen, xactid); - if (error) - device_printf(sc->ic_dev, "resp send failed: %d\n", error); + vmbus_ic_sendresp(sc, chan, data, dlen, xactid); } static int Modified: head/sys/dev/hyperv/utilities/hv_shutdown.c == --- head/sys/dev/hyperv/utilities/hv_shutdown.c Tue Dec 20 04:05:21 2016 (r310311) +++ head/sys/dev/hyperv/utilities/hv_shutdown.c Tue Dec 20 04:51:14 2016 (r310312) @@ -122,13 +122,9 @@ vmbus_shutdown_cb(struct vmbus_channel * } /* -* Send response by echoing the updated request back. +* Send response by echoing the request back. */ - hdr->ic_flags = VMBUS_ICMSG_FLAG_XACT | VMBUS_ICMSG_FLAG_RESP; - error = vmbus_chan_send(chan, VMBUS_CHANPKT_TYPE_INBAND, 0, - data, dlen, xactid); - if (error) - device_printf(sc->ic_dev, "resp send failed: %d\n", error); + vmbus_ic_sendresp(sc, chan, data, dlen, xactid); if (do_shutdown) shutdown_nice(RB_POWEROFF); Modified: head/sys/dev/hyperv/utilities/hv_timesync.c == --- head/sys/dev/hyperv/utilities/hv_timesync.c Tue Dec 20 04:05:21 2016 (r310311) +++ head/sys/dev/hyperv/utilities/hv_timesync.c Tue Dec 20 04:51:14 2016 (r310312) @@ -203,13 +203,9 @@ vmbus_timesync_cb(struct vmbus_channel * } /* -* Send response by echoing the updated request back. +* Send response by echoing the request back. */ - hdr->ic_flags = VMBUS_ICMSG_FLAG_XACT | VMBUS_ICMSG_FLAG_RESP; - error = vmbus_chan_send(chan, VMBUS_CHANPKT_TYPE_INBAND, 0, - data, dlen, xactid); - if (error) - device_printf(sc->ic_dev, "resp send failed: %d\n", error); + vmbus_ic_sendresp(sc, chan, data, dlen, xactid); } static int Modified: head/sys/dev/hyperv/utilities/hv_util.c == --- head/sys/dev/hyperv/utilities/hv_util.c Tue Dec 20 04:05:21 2016 (r310311) +++ head/sys/dev/hyperv/utilities/hv_util.c Tue Dec 20 04:51:14 2016 (r310312) @@ -287,3 +287,21 @@ hv_util_detach(device_t dev) return (0); } + +int +vmbus_ic_sendresp(struct hv_util_sc *sc, struct vmbus_channel *chan, +void *data, int dlen, uint64_t xactid) +{ + struct vmbus_icmsg_hdr *hdr; + int error; + + KASSERT(dlen >= sizeof(*hdr), ("invalid data length %d", dlen)); + hdr = data; + + hdr->ic_flags = VMBUS_ICMSG_FLAG_XACT | VMBUS_ICMSG_FLAG_RESP; + error = vmbus_chan_send(chan, VMBUS_CHANPKT_TYPE_INBAND, 0, + data, dlen, xactid); + if (error) + device_printf(sc->ic_dev, "resp send failed: %d\n", error); + return (error); +} Modified: head/sys/dev/hyperv/utilities/hv_util.h == --- head/sys/dev/hyperv/utilities/hv_util.h Tue Dec 20 04:05:21 2016 (r310311) +++ head/sys/dev/hyperv/utilities/hv_util.h Tue Dec 20 04:51:14 2016 (r310312) @@ -58,5 +58,8 @@ int hv_util_detach(device_t dev); intvmbus_ic_probe(device_t dev, const struct vmbus_ic_desc descs[]); intvmbus_ic_negomsg(struct hv_util_sc *sc, void *data, int *dlen, uint32_t fw_ver, uint32_t msg_ver); +intvmbus_ic_sendresp(struct hv_util_sc *sc, + struct vmbus_channel *chan, void *data, int dlen, + uint64_t xactid); #endif ___
Re: svn commit: r310171 - head/sys/sys
On Tue, Dec 20, 2016 at 4:37 AM, Ravi Pokala <rpok...@mac.com> wrote: > -Original Message- >> From: <owner-src-committ...@freebsd.org> on behalf of Ian Lepore >> <i...@freebsd.org> >> Date: 2016-12-19, Monday at 11:20 >> To: Warner Losh <i...@bsdimp.com>, Ravi Pokala <rpok...@mac.com> >> Cc: Sepherosa Ziehau <sepher...@gmail.com>, Dimitry Andric >> <d...@freebsd.org>, src-committers <src-committ...@freebsd.org>, >> "svn-src-...@freebsd.org" <svn-src-...@freebsd.org>, >> "svn-src-head@freebsd.org" <svn-src-head@freebsd.org> >> Subject: Re: svn commit: r310171 - head/sys/sys >> >> On Mon, 2016-12-19 at 11:58 -0700, Warner Losh wrote: >>> >>> ... >>> >>> Are there other precedence for avoiding the SCN macros in the tree as >>> well, or is this new art? >>> >>> Warner >> >> There was another commit recently the fixed the same kind of scanf >> error by making the variable fit the scanf type (changing uint64_t to >> an explicit long long unsigned, iirc). I don't know if that alone >> counts as a precedent, but IMO it's a more palatible fix than the >> SCN/PRI ugliness. > > With all apologies to Churchill, SCN/PRI are the worst way to address this in > a machine-independent way, except for all the other ways that have been tried > from time to time. :-P > If no objection comes, I'd commit the posted patch as it is tomorrow in my time. Thanks, sephe -- Tomorrow Will Never Die ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r310239 - in head: lib/libc/x86/sys sys/dev/hyperv/vmbus/amd64 sys/sys sys/x86/include
Author: sephe Date: Mon Dec 19 07:40:45 2016 New Revision: 310239 URL: https://svnweb.freebsd.org/changeset/base/310239 Log: hyperv: Implement userspace gettimeofday(2) with Hyper-V reference TSC This 6 times gettimeofday performance, as measured by tools/tools/syscall_timing Reviewed by: kib MFC after:1 week Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D8789 Modified: head/lib/libc/x86/sys/__vdso_gettc.c head/sys/dev/hyperv/vmbus/amd64/hyperv_machdep.c head/sys/sys/vdso.h head/sys/x86/include/vdso.h Modified: head/lib/libc/x86/sys/__vdso_gettc.c == --- head/lib/libc/x86/sys/__vdso_gettc.cMon Dec 19 00:28:04 2016 (r310238) +++ head/lib/libc/x86/sys/__vdso_gettc.cMon Dec 19 07:40:45 2016 (r310239) @@ -45,6 +45,10 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifdef __amd64__ +#include +#include +#endif #include "libc_private.h" static void @@ -144,6 +148,67 @@ __vdso_init_hpet(uint32_t u) _close(fd); } +#ifdef __amd64__ + +#define HYPERV_REFTSC_DEVPATH "/dev/" HYPERV_REFTSC_DEVNAME + +/* + * NOTE: + * We use 'NULL' for this variable to indicate that initialization + * is required. And if this variable is 'MAP_FAILED', then Hyper-V + * reference TSC can not be used, e.g. in misconfigured jail. + */ +static struct hyperv_reftsc *hyperv_ref_tsc; + +static void +__vdso_init_hyperv_tsc(void) +{ + int fd; + + fd = _open(HYPERV_REFTSC_DEVPATH, O_RDONLY); + if (fd < 0) { + /* Prevent the caller from re-entering. */ + hyperv_ref_tsc = MAP_FAILED; + return; + } + hyperv_ref_tsc = mmap(NULL, sizeof(*hyperv_ref_tsc), PROT_READ, + MAP_SHARED, fd, 0); + _close(fd); +} + +static int +__vdso_hyperv_tsc(struct hyperv_reftsc *tsc_ref, u_int *tc) +{ + uint64_t disc, ret, tsc, scale; + uint32_t seq; + int64_t ofs; + + while ((seq = atomic_load_acq_int(_ref->tsc_seq)) != 0) { + scale = tsc_ref->tsc_scale; + ofs = tsc_ref->tsc_ofs; + + lfence_mb(); + tsc = rdtsc(); + + /* ret = ((tsc * scale) >> 64) + ofs */ + __asm__ __volatile__ ("mulq %3" : + "=d" (ret), "=a" (disc) : + "a" (tsc), "r" (scale)); + ret += ofs; + + atomic_thread_fence_acq(); + if (tsc_ref->tsc_seq == seq) { + *tc = ret; + return (0); + } + + /* Sequence changed; re-sync. */ + } + return (ENOSYS); +} + +#endif /* __amd64__ */ + #pragma weak __vdso_gettc int __vdso_gettc(const struct vdso_timehands *th, u_int *tc) @@ -165,6 +230,14 @@ __vdso_gettc(const struct vdso_timehands return (ENOSYS); *tc = *(volatile uint32_t *)(hpet_dev_map + HPET_MAIN_COUNTER); return (0); +#ifdef __amd64__ + case VDSO_TH_ALGO_X86_HVTSC: + if (hyperv_ref_tsc == NULL) + __vdso_init_hyperv_tsc(); + if (hyperv_ref_tsc == MAP_FAILED) + return (ENOSYS); + return (__vdso_hyperv_tsc(hyperv_ref_tsc, tc)); +#endif default: return (ENOSYS); } Modified: head/sys/dev/hyperv/vmbus/amd64/hyperv_machdep.c == --- head/sys/dev/hyperv/vmbus/amd64/hyperv_machdep.cMon Dec 19 00:28:04 2016(r310238) +++ head/sys/dev/hyperv/vmbus/amd64/hyperv_machdep.cMon Dec 19 07:40:45 2016(r310239) @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -52,18 +53,20 @@ struct hyperv_reftsc_ctx { struct hyperv_dma tsc_ref_dma; }; +static uint32_thyperv_tsc_vdso_timehands( + struct vdso_timehands *, + struct timecounter *); + static d_open_thyperv_tsc_open; static d_mmap_thyperv_tsc_mmap; static struct timecounter hyperv_tsc_timecounter = { .tc_get_timecount = NULL, /* based on CPU vendor. */ - .tc_poll_pps= NULL, .tc_counter_mask= 0x, .tc_frequency = HYPERV_TIMER_FREQ, .tc_name= "Hyper-V-TSC", .tc_quality = 3000, - .tc_flags = 0, - .tc_priv= NULL + .tc_fill_vdso_timehands = hyperv_tsc_vdso_timehands, }; static struct cdevsw hyperv_tsc_cdevsw = { @@ -117,6 +120,18 @@ hyperv_tsc_mmap(struct cdev *dev __unuse return (0); } +static uint32_t +hyperv_tsc_vdso_timehands(struct
Re: svn commit: r310171 - head/sys/sys
The following patch unbreaks the LINT builds on amd64 for me after this commit: https://people.freebsd.org/~sephe/geom_sscanf.diff Please review it. Thanks, sephe On Sat, Dec 17, 2016 at 3:49 AM, Dimitry Andricwrote: > Author: dim > Date: Fri Dec 16 19:49:22 2016 > New Revision: 310171 > URL: https://svnweb.freebsd.org/changeset/base/310171 > > Log: > Add __scanflike attributes to the kernel's sscanf() and vsscanf() > declarations. This should help to catch future mismatches between > format strings and arguments. > > MFC after:1 week > > Modified: > head/sys/sys/systm.h > > Modified: head/sys/sys/systm.h > == > --- head/sys/sys/systm.hFri Dec 16 19:09:57 2016(r310170) > +++ head/sys/sys/systm.hFri Dec 16 19:49:22 2016(r310171) > @@ -227,8 +227,8 @@ int vsnprintf(char *, size_t, const char > intvsnrprintf(char *, size_t, int, const char *, __va_list) > __printflike(4, 0); > intvsprintf(char *buf, const char *, __va_list) __printflike(2, 0); > intttyprintf(struct tty *, const char *, ...) __printflike(2, 3); > -intsscanf(const char *, char const *, ...) __nonnull(1) __nonnull(2); > -intvsscanf(const char *, char const *, __va_list) __nonnull(1) > __nonnull(2); > +intsscanf(const char *, char const *, ...) __nonnull(1) __nonnull(2) > __scanflike(2, 3); > +intvsscanf(const char *, char const *, __va_list) __nonnull(1) > __nonnull(2) __scanflike(2, 0); > long strtol(const char *, char **, int) __nonnull(1); > u_long strtoul(const char *, char **, int) __nonnull(1); > quad_t strtoq(const char *, char **, int) __nonnull(1); > ___ > svn-src-...@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org" -- Tomorrow Will Never Die ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r310101 - in head: include sys/dev/hyperv/include sys/dev/hyperv/vmbus sys/dev/hyperv/vmbus/amd64
Author: sephe Date: Thu Dec 15 03:32:24 2016 New Revision: 310101 URL: https://svnweb.freebsd.org/changeset/base/310101 Log: hyperv: Allow userland to ro-mmap reference TSC page This paves way to implement VDSO for the enlightened time counter. Reviewed by: kib MFC after:1 week Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D8768 Modified: head/include/Makefile head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/vmbus/amd64/hyperv_machdep.c head/sys/dev/hyperv/vmbus/hyperv_reg.h Modified: head/include/Makefile == --- head/include/Makefile Thu Dec 15 02:05:29 2016(r310100) +++ head/include/Makefile Thu Dec 15 03:32:24 2016(r310101) @@ -185,6 +185,9 @@ copies: .PHONY .META ${DESTDIR}${INCLUDEDIR}/dev/evdev; \ ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 uinput.h \ ${DESTDIR}${INCLUDEDIR}/dev/evdev + cd ${.CURDIR}/../sys/dev/hyperv/include; \ + ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 hyperv.h \ + ${DESTDIR}${INCLUDEDIR}/dev/hyperv cd ${.CURDIR}/../sys/dev/hyperv/utilities; \ ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 hv_snapshot.h \ ${DESTDIR}${INCLUDEDIR}/dev/hyperv @@ -293,6 +296,11 @@ symlinks: .PHONY .META ln -fs ../../../../sys/dev/evdev/$$h \ ${DESTDIR}${INCLUDEDIR}/dev/evdev; \ done + cd ${.CURDIR}/../sys/dev/hyperv/include; \ + for h in hyperv.h; do \ + ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/dev/hyperv/include/$$h \ + ${DESTDIR}${INCLUDEDIR}/dev/hyperv; \ + done cd ${.CURDIR}/../sys/dev/hyperv/utilities; \ for h in hv_snapshot.h; do \ ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/dev/hyperv/utilities/$$h \ Modified: head/sys/dev/hyperv/include/hyperv.h == --- head/sys/dev/hyperv/include/hyperv.hThu Dec 15 02:05:29 2016 (r310100) +++ head/sys/dev/hyperv/include/hyperv.hThu Dec 15 03:32:24 2016 (r310101) @@ -31,10 +31,10 @@ #ifndef _HYPERV_H_ #define _HYPERV_H_ -#include +#ifdef _KERNEL -#include -#include +#include +#include #define MSR_HV_TIME_REF_COUNT 0x4020 @@ -54,14 +54,35 @@ #define HYPERV_TIMER_NS_FACTOR 100ULL #define HYPERV_TIMER_FREQ (NANOSEC / HYPERV_TIMER_NS_FACTOR) +#endif /* _KERNEL */ + +#define HYPERV_REFTSC_DEVNAME "hv_tsc" + +/* + * Hyper-V Reference TSC + */ +struct hyperv_reftsc { + volatile uint32_t tsc_seq; + volatile uint32_t tsc_rsvd1; + volatile uint64_t tsc_scale; + volatile int64_ttsc_ofs; +} __packed __aligned(PAGE_SIZE); +#ifdef CTASSERT +CTASSERT(sizeof(struct hyperv_reftsc) == PAGE_SIZE); +#endif + +#ifdef _KERNEL + struct hyperv_guid { - uint8_t hv_guid[16]; + uint8_t hv_guid[16]; } __packed; -#define HYPERV_GUID_STRLEN 40 +#define HYPERV_GUID_STRLEN 40 inthyperv_guid2str(const struct hyperv_guid *, char *, size_t); extern u_int hyperv_features;/* CPUID_HV_MSR_ */ +#endif /* _KERNEL */ + #endif /* _HYPERV_H_ */ Modified: head/sys/dev/hyperv/vmbus/amd64/hyperv_machdep.c == --- head/sys/dev/hyperv/vmbus/amd64/hyperv_machdep.cThu Dec 15 02:05:29 2016(r310100) +++ head/sys/dev/hyperv/vmbus/amd64/hyperv_machdep.cThu Dec 15 03:32:24 2016(r310101) @@ -28,6 +28,8 @@ __FBSDID("$FreeBSD$"); #include +#include +#include #include #include #include @@ -35,6 +37,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include + +#include #include #include @@ -47,6 +52,9 @@ struct hyperv_reftsc_ctx { struct hyperv_dma tsc_ref_dma; }; +static d_open_thyperv_tsc_open; +static d_mmap_thyperv_tsc_mmap; + static struct timecounter hyperv_tsc_timecounter = { .tc_get_timecount = NULL, /* based on CPU vendor. */ .tc_poll_pps= NULL, @@ -58,6 +66,13 @@ static struct timecounterhyperv_tsc_tim .tc_priv= NULL }; +static struct cdevsw hyperv_tsc_cdevsw = { + .d_version = D_VERSION, + .d_open = hyperv_tsc_open, + .d_mmap = hyperv_tsc_mmap, + .d_name = HYPERV_REFTSC_DEVNAME +}; + static struct hyperv_reftsc_ctxhyperv_ref_tsc; uint64_t @@ -72,6 +87,36 @@ hypercall_md(volatile void *hc_addr, uin return (status); } +static int +hyperv_tsc_open(struct cdev
svn commit: r310048 - in head/sys/dev/hyperv: include vmbus vmbus/amd64
Author: sephe Date: Wed Dec 14 03:20:57 2016 New Revision: 310048 URL: https://svnweb.freebsd.org/changeset/base/310048 Log: hyperv: Implement "enlightened" time counter, which is rdtsc based. Reviewed by: kib MFC after:1 week Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D8763 Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/vmbus/amd64/hyperv_machdep.c head/sys/dev/hyperv/vmbus/hyperv_reg.h Modified: head/sys/dev/hyperv/include/hyperv.h == --- head/sys/dev/hyperv/include/hyperv.hWed Dec 14 03:01:15 2016 (r310047) +++ head/sys/dev/hyperv/include/hyperv.hWed Dec 14 03:20:57 2016 (r310048) @@ -45,6 +45,7 @@ #define CPUID_HV_MSR_HYPERCALL 0x0020 /* MSR_HV_GUEST_OS_ID * MSR_HV_HYPERCALL */ #define CPUID_HV_MSR_VP_INDEX 0x0040 /* MSR_HV_VP_INDEX */ +#define CPUID_HV_MSR_REFERENCE_TSC 0x0200 /* MSR_HV_REFERENCE_TSC */ #define CPUID_HV_MSR_GUEST_IDLE0x0400 /* MSR_HV_GUEST_IDLE */ #ifndef NANOSEC Modified: head/sys/dev/hyperv/vmbus/amd64/hyperv_machdep.c == --- head/sys/dev/hyperv/vmbus/amd64/hyperv_machdep.cWed Dec 14 03:01:15 2016(r310047) +++ head/sys/dev/hyperv/vmbus/amd64/hyperv_machdep.cWed Dec 14 03:20:57 2016(r310048) @@ -28,7 +28,37 @@ __FBSDID("$FreeBSD$"); #include +#include +#include +#include + +#include +#include +#include + +#include +#include #include +#include +#include + +struct hyperv_reftsc_ctx { + struct hyperv_reftsc*tsc_ref; + struct hyperv_dma tsc_ref_dma; +}; + +static struct timecounter hyperv_tsc_timecounter = { + .tc_get_timecount = NULL, /* based on CPU vendor. */ + .tc_poll_pps= NULL, + .tc_counter_mask= 0x, + .tc_frequency = HYPERV_TIMER_FREQ, + .tc_name= "Hyper-V-TSC", + .tc_quality = 3000, + .tc_flags = 0, + .tc_priv= NULL +}; + +static struct hyperv_reftsc_ctxhyperv_ref_tsc; uint64_t hypercall_md(volatile void *hc_addr, uint64_t in_val, @@ -41,3 +71,85 @@ hypercall_md(volatile void *hc_addr, uin "c" (in_val), "d" (in_paddr), "m" (hc_addr)); return (status); } + +#define HYPERV_TSC_TIMECOUNT(fence)\ +static u_int \ +hyperv_tsc_timecount_##fence(struct timecounter *tc) \ +{ \ + struct hyperv_reftsc *tsc_ref = hyperv_ref_tsc.tsc_ref; \ + uint32_t seq; \ + \ + while ((seq = atomic_load_acq_int(_ref->tsc_seq)) != 0) { \ + uint64_t disc, ret, tsc;\ + uint64_t scale = tsc_ref->tsc_scale;\ + int64_t ofs = tsc_ref->tsc_ofs; \ + \ + fence();\ + tsc = rdtsc(); \ + \ + /* ret = ((tsc * scale) >> 64) + ofs */ \ + __asm__ __volatile__ ("mulq %3" : \ + "=d" (ret), "=a" (disc) : \ + "a" (tsc), "r" (scale));\ + ret += ofs; \ + \ + atomic_thread_fence_acq(); \ + if (tsc_ref->tsc_seq == seq)\ + return (ret); \ + \ + /* Sequence changed; re-sync. */\ + } \ + /* Fallback to the generic timecounter, i.e. rdmsr. */ \ + return (rdmsr(MSR_HV_TIME_REF_COUNT)); \ +} \ +struct __hack + +HYPERV_TSC_TIMECOUNT(lfence); +HYPERV_TSC_TIMECOUNT(mfence); + +static void +hyperv_tsc_tcinit(void *dummy __unused) +{ + uint64_t val, orig; + + if ((hyperv_features & +(CPUID_HV_MSR_TIME_REFCNT |
svn commit: r309875 - head/sys/dev/hyperv/netvsc
Author: sephe Date: Mon Dec 12 05:18:03 2016 New Revision: 309875 URL: https://svnweb.freebsd.org/changeset/base/309875 Log: hyperv/hn: Add polling support MFC after:1 week Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D8739 Modified: head/sys/dev/hyperv/netvsc/if_hn.c head/sys/dev/hyperv/netvsc/if_hnvar.h Modified: head/sys/dev/hyperv/netvsc/if_hn.c == --- head/sys/dev/hyperv/netvsc/if_hn.c Mon Dec 12 05:04:55 2016 (r309874) +++ head/sys/dev/hyperv/netvsc/if_hn.c Mon Dec 12 05:18:03 2016 (r309875) @@ -293,6 +293,7 @@ static int hn_txagg_size_sysctl(SYSCTL static int hn_txagg_pkts_sysctl(SYSCTL_HANDLER_ARGS); static int hn_txagg_pktmax_sysctl(SYSCTL_HANDLER_ARGS); static int hn_txagg_align_sysctl(SYSCTL_HANDLER_ARGS); +static int hn_polling_sysctl(SYSCTL_HANDLER_ARGS); static voidhn_stop(struct hn_softc *); static voidhn_init_locked(struct hn_softc *); @@ -319,6 +320,8 @@ static void hn_resume_mgmt(struct hn_s static voidhn_suspend_mgmt_taskfunc(void *, int); static voidhn_chan_drain(struct hn_softc *, struct vmbus_channel *); +static voidhn_polling(struct hn_softc *, u_int); +static voidhn_chan_polling(struct vmbus_channel *, u_int); static voidhn_update_link_status(struct hn_softc *); static voidhn_change_network(struct hn_softc *); @@ -1117,6 +1120,10 @@ hn_attach(device_t dev) hn_txagg_pkts_sysctl, "I", "Packet transmission aggregation packets, " "0 -- disable, -1 -- auto"); + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "polling", + CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, 0, + hn_polling_sysctl, "I", + "Polling frequency: [100,100], 0 disable polling"); /* * Setup the ifmedia, which has been initialized earlier. @@ -2360,6 +2367,9 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, break; } + /* Disable polling. */ + hn_polling(sc, 0); + /* * Suspend this interface before the synthetic parts * are ripped. @@ -2405,6 +2415,13 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, */ hn_resume(sc); + /* +* Re-enable polling if this interface is running and +* the polling is requested. +*/ + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) && sc->hn_pollhz > 0) + hn_polling(sc, sc->hn_pollhz); + HN_UNLOCK(sc); break; @@ -2531,6 +2548,9 @@ hn_stop(struct hn_softc *sc) KASSERT(sc->hn_flags & HN_FLAG_SYNTH_ATTACHED, ("synthetic parts were not attached")); + /* Disable polling. */ + hn_polling(sc, 0); + /* Clear RUNNING bit _before_ hn_suspend_data() */ atomic_clear_int(>if_drv_flags, IFF_DRV_RUNNING); hn_suspend_data(sc); @@ -2568,6 +2588,10 @@ hn_init_locked(struct hn_softc *sc) /* Everything is ready; unleash! */ atomic_set_int(>if_drv_flags, IFF_DRV_RUNNING); + + /* Re-enable polling if requested. */ + if (sc->hn_pollhz > 0) + hn_polling(sc, sc->hn_pollhz); } static void @@ -2875,6 +2899,61 @@ hn_txagg_align_sysctl(SYSCTL_HANDLER_ARG return (sysctl_handle_int(oidp, , 0, req)); } +static void +hn_chan_polling(struct vmbus_channel *chan, u_int pollhz) +{ + if (pollhz == 0) + vmbus_chan_poll_disable(chan); + else + vmbus_chan_poll_enable(chan, pollhz); +} + +static void +hn_polling(struct hn_softc *sc, u_int pollhz) +{ + int nsubch = sc->hn_rx_ring_inuse - 1; + + HN_LOCK_ASSERT(sc); + + if (nsubch > 0) { + struct vmbus_channel **subch; + int i; + + subch = vmbus_subchan_get(sc->hn_prichan, nsubch); + for (i = 0; i < nsubch; ++i) + hn_chan_polling(subch[i], pollhz); + vmbus_subchan_rel(subch, nsubch); + } + hn_chan_polling(sc->hn_prichan, pollhz); +} + +static int +hn_polling_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct hn_softc *sc = arg1; + int pollhz, error; + + pollhz = sc->hn_pollhz; + error = sysctl_handle_int(oidp, , 0, req); + if (error || req->newptr == NULL) + return (error); + + if (pollhz != 0 && + (pollhz < VMBUS_CHAN_POLLHZ_MIN || pollhz > VMBUS_CHAN_POLLHZ_MAX)) + return (EINVAL); + + HN_LOCK(sc); + if (sc->hn_pollhz !=
svn commit: r309874 - in head/sys/dev/hyperv: include vmbus
Author: sephe Date: Mon Dec 12 05:04:55 2016 New Revision: 309874 URL: https://svnweb.freebsd.org/changeset/base/309874 Log: hyperv/vmbus: Add channel polling support. MFC after:1 week Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D8738 Modified: head/sys/dev/hyperv/include/vmbus.h head/sys/dev/hyperv/vmbus/vmbus_chan.c head/sys/dev/hyperv/vmbus/vmbus_chanvar.h Modified: head/sys/dev/hyperv/include/vmbus.h == --- head/sys/dev/hyperv/include/vmbus.h Mon Dec 12 03:46:40 2016 (r309873) +++ head/sys/dev/hyperv/include/vmbus.h Mon Dec 12 05:04:55 2016 (r309874) @@ -49,6 +49,9 @@ #define VMBUS_VERSION_MAJOR(ver) (((uint32_t)(ver)) >> 16) #define VMBUS_VERSION_MINOR(ver) (((uint32_t)(ver)) & 0x) +#define VMBUS_CHAN_POLLHZ_MIN 100 /* 10ms interval */ +#define VMBUS_CHAN_POLLHZ_MAX 100 /* 1us interval */ + /* * GPA stuffs. */ @@ -220,4 +223,8 @@ boolvmbus_chan_tx_empty(const struct v struct taskqueue * vmbus_chan_mgmt_tq(const struct vmbus_channel *chan); +void vmbus_chan_poll_enable(struct vmbus_channel *chan, + u_int pollhz); +void vmbus_chan_poll_disable(struct vmbus_channel *chan); + #endif /* !_VMBUS_H_ */ Modified: head/sys/dev/hyperv/vmbus/vmbus_chan.c == --- head/sys/dev/hyperv/vmbus/vmbus_chan.c Mon Dec 12 03:46:40 2016 (r309873) +++ head/sys/dev/hyperv/vmbus/vmbus_chan.c Mon Dec 12 05:04:55 2016 (r309874) @@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -50,6 +51,11 @@ __FBSDID("$FreeBSD$"); #include #include +struct vmbus_chan_pollarg { + struct vmbus_channel*poll_chan; + u_int poll_hz; +}; + static voidvmbus_chan_update_evtflagcnt( struct vmbus_softc *, const struct vmbus_channel *); @@ -68,6 +74,10 @@ static void vmbus_chan_clear_chmap(str static voidvmbus_chan_detach(struct vmbus_channel *); static boolvmbus_chan_wait_revoke( const struct vmbus_channel *, bool); +static voidvmbus_chan_poll_timeout(void *); +static boolvmbus_chan_poll_cancel_intq( + struct vmbus_channel *); +static voidvmbus_chan_poll_cancel(struct vmbus_channel *); static voidvmbus_chan_ins_prilist(struct vmbus_softc *, struct vmbus_channel *); @@ -84,7 +94,11 @@ static void vmbus_chan_rem_sublist(str static voidvmbus_chan_task(void *, int); static voidvmbus_chan_task_nobatch(void *, int); +static voidvmbus_chan_poll_task(void *, int); static voidvmbus_chan_clrchmap_task(void *, int); +static voidvmbus_chan_pollcfg_task(void *, int); +static voidvmbus_chan_polldis_task(void *, int); +static voidvmbus_chan_poll_cancel_task(void *, int); static voidvmbus_prichan_attach_task(void *, int); static voidvmbus_subchan_attach_task(void *, int); static voidvmbus_prichan_detach_task(void *, int); @@ -782,6 +796,22 @@ vmbus_chan_set_chmap(struct vmbus_channe chan->ch_vmbus->vmbus_chmap[chan->ch_id] = chan; } +static void +vmbus_chan_poll_cancel_task(void *xchan, int pending __unused) +{ + + vmbus_chan_poll_cancel_intq(xchan); +} + +static void +vmbus_chan_poll_cancel(struct vmbus_channel *chan) +{ + struct task poll_cancel; + + TASK_INIT(_cancel, 0, vmbus_chan_poll_cancel_task, chan); + vmbus_chan_run_task(chan, _cancel); +} + static int vmbus_chan_close_internal(struct vmbus_channel *chan) { @@ -818,6 +848,11 @@ vmbus_chan_close_internal(struct vmbus_c sysctl_ctx_free(>ch_sysctl_ctx); /* +* Cancel polling, if it is enabled. +*/ + vmbus_chan_poll_cancel(chan); + + /* * NOTE: * Order is critical. This channel _must_ be uninstalled first, * else the channel task may be enqueued by the IDT after it has @@ -1185,6 +1220,9 @@ vmbus_chan_task(void *xchan, int pending vmbus_chan_callback_t cb = chan->ch_cb; void *cbarg = chan->ch_cbarg; + KASSERT(chan->ch_poll_intvl == 0, + ("chan%u: interrupted in polling mode", chan->ch_id)); + /* * Optimize host to guest signaling by ensuring: * 1. While reading the channel, we disable interrupts from @@ -1216,9
svn commit: r309728 - head/sys/dev/hyperv/storvsc
Author: sephe Date: Fri Dec 9 06:18:12 2016 New Revision: 309728 URL: https://svnweb.freebsd.org/changeset/base/309728 Log: hyperv/storvsc: Minor style changes; no functional changes. Reported by: rpokala MFC after:1 week Sponsored by: Microsoft Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c == --- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.cFri Dec 9 04:35:07 2016(r309727) +++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.cFri Dec 9 06:18:12 2016(r309728) @@ -2057,6 +2057,7 @@ static uint32_t is_scsi_valid(const struct scsi_inquiry_data *inq_data) { u_int8_t type; + type = SID_TYPE(inq_data); if (type == T_NODEVICE) return (0); @@ -2064,6 +2065,7 @@ is_scsi_valid(const struct scsi_inquiry_ return (0); return (1); } + /** * @brief completion function before returning to CAM * @@ -2082,6 +2084,7 @@ storvsc_io_done(struct hv_storvsc_reques struct vmscsi_req *vm_srb = >vstor_packet.u.vm_srb; bus_dma_segment_t *ori_sglist = NULL; int ori_sg_count = 0; + /* destroy bounce buffer if it is used */ if (reqp->bounce_sgl_count) { ori_sglist = (bus_dma_segment_t *)ccb->csio.data_ptr; @@ -2136,6 +2139,7 @@ storvsc_io_done(struct hv_storvsc_reques ccb->ccb_h.status &= ~CAM_STATUS_MASK; if (vm_srb->scsi_status == SCSI_STATUS_OK) { const struct scsi_generic *cmd; + cmd = (const struct scsi_generic *) ((ccb->ccb_h.flags & CAM_CDB_POINTER) ? csio->cdb_io.cdb_ptr : csio->cdb_io.cdb_bytes); @@ -2178,11 +2182,12 @@ storvsc_io_done(struct hv_storvsc_reques if (cmd->opcode == INQUIRY && vm_srb->srb_status == SRB_STATUS_SUCCESS) { int resp_xfer_len, resp_buf_len, data_len; + uint8_t *resp_buf = (uint8_t *)csio->data_ptr; struct scsi_inquiry_data *inq_data = (struct scsi_inquiry_data *)csio->data_ptr; + /* Get the buffer length reported by host */ resp_xfer_len = vm_srb->transfer_len; - uint8_t *resp_buf = (uint8_t *)csio->data_ptr; /* Get the available buffer length */ resp_buf_len = resp_xfer_len >= 5 ? resp_buf[4] + 5 : 0; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r309726 - head/sys/dev/hyperv/storvsc
Author: sephe Date: Fri Dec 9 03:16:36 2016 New Revision: 309726 URL: https://svnweb.freebsd.org/changeset/base/309726 Log: hyperv/storvsc: Fix the SCSI disk attachment issue. On pre-WS2016 Hyper-V, if the only LUNs > 7 are used, then all disks fails to attach. Mainly because those versions of Hyper-V do not set SRB_STATUS properly and deliver junky INQUERY responses. Submitted by: Hongjiang Zhang Reported by: Hongxiong Xian MFC after:1 week Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D8724 Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c == --- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.cFri Dec 9 02:21:27 2016(r309725) +++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.cFri Dec 9 03:16:36 2016(r309726) @@ -2053,6 +2053,17 @@ create_storvsc_request(union ccb *ccb, s return(0); } +static uint32_t +is_scsi_valid(const struct scsi_inquiry_data *inq_data) +{ + u_int8_t type; + type = SID_TYPE(inq_data); + if (type == T_NODEVICE) + return (0); + if (SID_QUAL(inq_data) == SID_QUAL_BAD_LU) + return (0); + return (1); +} /** * @brief completion function before returning to CAM * @@ -2164,32 +2175,46 @@ storvsc_io_done(struct hv_storvsc_reques ccb->ccb_h.status |= CAM_REQ_CMP; } - if (cmd->opcode == INQUIRY) { + if (cmd->opcode == INQUIRY && + vm_srb->srb_status == SRB_STATUS_SUCCESS) { + int resp_xfer_len, resp_buf_len, data_len; struct scsi_inquiry_data *inq_data = (struct scsi_inquiry_data *)csio->data_ptr; - uint8_t *resp_buf = (uint8_t *)csio->data_ptr; - int resp_xfer_len, resp_buf_len, data_len; - /* Get the buffer length reported by host */ resp_xfer_len = vm_srb->transfer_len; + uint8_t *resp_buf = (uint8_t *)csio->data_ptr; + /* Get the available buffer length */ resp_buf_len = resp_xfer_len >= 5 ? resp_buf[4] + 5 : 0; data_len = (resp_buf_len < resp_xfer_len) ? resp_buf_len : resp_xfer_len; - if (bootverbose && data_len >= 5) { xpt_print(ccb->ccb_h.path, "storvsc inquiry " "(%d) [%x %x %x %x %x ... ]\n", data_len, resp_buf[0], resp_buf[1], resp_buf[2], resp_buf[3], resp_buf[4]); } - if (vm_srb->srb_status == SRB_STATUS_SUCCESS && - data_len >= SHORT_INQUIRY_LENGTH) { + /* +* XXX: Manually fix the wrong response returned from WS2012 +*/ + if (!is_scsi_valid(inq_data) && + (vmstor_proto_version == VMSTOR_PROTOCOL_VERSION_WIN8_1 || + vmstor_proto_version == VMSTOR_PROTOCOL_VERSION_WIN8 || + vmstor_proto_version == VMSTOR_PROTOCOL_VERSION_WIN7)) { + if (data_len >= 4 && + (resp_buf[2] == 0 || resp_buf[3] == 0)) { + resp_buf[2] = 5; // verion=5 means SPC-3 + resp_buf[3] = 2; // resp fmt must be 2 + if (bootverbose) + xpt_print(ccb->ccb_h.path, + "fix version and resp fmt for 0x%x\n", + vmstor_proto_version); + } + } else if (data_len >= SHORT_INQUIRY_LENGTH) { char vendor[16]; cam_strvis(vendor, inq_data->vendor, sizeof(inq_data->vendor), sizeof(vendor)); - /* * XXX: Upgrade SPC2 to SPC3 if host is WIN8 or * WIN2012 R2 in order to support UNMAP feature. ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r309705 - in head/sys/dev/hyperv: include utilities vmbus
Author: sephe Date: Thu Dec 8 05:37:39 2016 New Revision: 309705 URL: https://svnweb.freebsd.org/changeset/base/309705 Log: hyperv/timesync: Support "sent TC" to improve accuracy. MFC after:1 week Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D8723 Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/utilities/hv_timesync.c head/sys/dev/hyperv/utilities/vmbus_icreg.h head/sys/dev/hyperv/vmbus/hyperv_reg.h head/sys/dev/hyperv/vmbus/hyperv_var.h head/sys/dev/hyperv/vmbus/vmbus_et.c Modified: head/sys/dev/hyperv/include/hyperv.h == --- head/sys/dev/hyperv/include/hyperv.hThu Dec 8 05:15:00 2016 (r309704) +++ head/sys/dev/hyperv/include/hyperv.hThu Dec 8 05:37:39 2016 (r309705) @@ -36,6 +36,23 @@ #include #include +#define MSR_HV_TIME_REF_COUNT 0x4020 + +#define CPUID_HV_MSR_TIME_REFCNT 0x0002 /* MSR_HV_TIME_REF_COUNT */ +#define CPUID_HV_MSR_SYNIC 0x0004 /* MSRs for SynIC */ +#define CPUID_HV_MSR_SYNTIMER 0x0008 /* MSRs for SynTimer */ +#define CPUID_HV_MSR_APIC 0x0010 /* MSR_HV_{EOI,ICR,TPR} */ +#define CPUID_HV_MSR_HYPERCALL 0x0020 /* MSR_HV_GUEST_OS_ID +* MSR_HV_HYPERCALL */ +#define CPUID_HV_MSR_VP_INDEX 0x0040 /* MSR_HV_VP_INDEX */ +#define CPUID_HV_MSR_GUEST_IDLE0x0400 /* MSR_HV_GUEST_IDLE */ + +#ifndef NANOSEC +#define NANOSEC10ULL +#endif +#define HYPERV_TIMER_NS_FACTOR 100ULL +#define HYPERV_TIMER_FREQ (NANOSEC / HYPERV_TIMER_NS_FACTOR) + struct hyperv_guid { uint8_t hv_guid[16]; } __packed; @@ -44,4 +61,6 @@ struct hyperv_guid { inthyperv_guid2str(const struct hyperv_guid *, char *, size_t); +extern u_int hyperv_features;/* CPUID_HV_MSR_ */ + #endif /* _HYPERV_H_ */ Modified: head/sys/dev/hyperv/utilities/hv_timesync.c == --- head/sys/dev/hyperv/utilities/hv_timesync.c Thu Dec 8 05:15:00 2016 (r309704) +++ head/sys/dev/hyperv/utilities/hv_timesync.c Thu Dec 8 05:37:39 2016 (r309705) @@ -46,10 +46,14 @@ __FBSDID("$FreeBSD$"); #define VMBUS_TIMESYNC_FWVER \ VMBUS_IC_VERSION(VMBUS_TIMESYNC_FWVER_MAJOR, 0) -#define VMBUS_TIMESYNC_MSGVER_MAJOR3 +#define VMBUS_TIMESYNC_MSGVER_MAJOR4 #define VMBUS_TIMESYNC_MSGVER \ VMBUS_IC_VERSION(VMBUS_TIMESYNC_MSGVER_MAJOR, 0) +#define VMBUS_TIMESYNC_DORTT(sc) \ + ((sc)->ic_msgver >= VMBUS_IC_VERSION(4, 0) && \ +(hyperv_features & CPUID_HV_MSR_TIME_REFCNT)) + static const struct vmbus_ic_desc vmbus_timesync_descs[] = { { .ic_guid = { .hv_guid = { @@ -81,12 +85,16 @@ SYSCTL_INT(_hw_hvtimesync, OID_AUTO, sam _ts_sample_verbose, 0, "Increase sample request verbosity."); static void -vmbus_timesync(struct hv_util_sc *sc, uint64_t hvtime, uint8_t tsflags) +vmbus_timesync(struct hv_util_sc *sc, uint64_t hvtime, uint64_t sent_tc, +uint8_t tsflags) { struct timespec vm_ts; - uint64_t hv_ns, vm_ns; + uint64_t hv_ns, vm_ns, rtt = 0; + + if (VMBUS_TIMESYNC_DORTT(sc)) + rtt = rdmsr(MSR_HV_TIME_REF_COUNT) - sent_tc; - hv_ns = (hvtime - VMBUS_ICMSG_TS_BASE) * VMBUS_ICMSG_TS_FACTOR; + hv_ns = (hvtime - VMBUS_ICMSG_TS_BASE + rtt) * HYPERV_TIMER_NS_FACTOR; nanotime(_ts); vm_ns = (vm_ts.tv_sec * NANOSEC) + vm_ts.tv_nsec; @@ -174,6 +182,8 @@ vmbus_timesync_cb(struct vmbus_channel * VMBUS_TIMESYNC_FWVER, VMBUS_TIMESYNC_MSGVER); if (error) return; + if (VMBUS_TIMESYNC_DORTT(sc)) + device_printf(sc->ic_dev, "RTT\n"); break; case VMBUS_ICMSG_TYPE_TIMESYNC: @@ -183,7 +193,8 @@ vmbus_timesync_cb(struct vmbus_channel * return; } msg = data; - vmbus_timesync(sc, msg->ic_hvtime, msg->ic_tsflags); + vmbus_timesync(sc, msg->ic_hvtime, msg->ic_sent_tc, + msg->ic_tsflags); break; default: Modified: head/sys/dev/hyperv/utilities/vmbus_icreg.h == --- head/sys/dev/hyperv/utilities/vmbus_icreg.h Thu Dec 8 05:15:00 2016 (r309704) +++ head/sys/dev/hyperv/utilities/vmbus_icreg.h Thu Dec 8 05:37:39 2016 (r309705) @@ -114,18 +114,13 @@ struct vmbus_icmsg_timesync { struct vmbus_icmsg_hdr ic_hdr; uint64_tic_hvtime; uint64_tic_vmtime; - uint64_tic_rtt; + uint64_t
svn commit: r309704 - head/sys/dev/hyperv/vmbus
Author: sephe Date: Thu Dec 8 05:15:00 2016 New Revision: 309704 URL: https://svnweb.freebsd.org/changeset/base/309704 Log: hyperv/vmbus: Utilize vmbus_chan_run_task() MFC after:1 week Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D8686 Modified: head/sys/dev/hyperv/vmbus/vmbus_chan.c Modified: head/sys/dev/hyperv/vmbus/vmbus_chan.c == --- head/sys/dev/hyperv/vmbus/vmbus_chan.c Thu Dec 8 04:29:29 2016 (r309703) +++ head/sys/dev/hyperv/vmbus/vmbus_chan.c Thu Dec 8 05:15:00 2016 (r309704) @@ -772,8 +772,7 @@ vmbus_chan_clear_chmap(struct vmbus_chan struct task chmap_task; TASK_INIT(_task, 0, vmbus_chan_clrchmap_task, chan); - taskqueue_enqueue(chan->ch_tq, _task); - taskqueue_drain(chan->ch_tq, _task); + vmbus_chan_run_task(chan, _task); } static void ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r309670 - head/sys/dev/hyperv/vmbus
Author: sephe Date: Wed Dec 7 08:12:02 2016 New Revision: 309670 URL: https://svnweb.freebsd.org/changeset/base/309670 Log: hyperv/vmbus: Use pause if possible. This makes booting on Hyper-V w/ small # of vCPUs work properly. Reported by: Hongxiong Xian , Hongjiang Zhang MFC after:1 week Sponsored by: Microsoft Modified: head/sys/dev/hyperv/vmbus/vmbus_chan.c Modified: head/sys/dev/hyperv/vmbus/vmbus_chan.c == --- head/sys/dev/hyperv/vmbus/vmbus_chan.c Wed Dec 7 07:27:47 2016 (r309669) +++ head/sys/dev/hyperv/vmbus/vmbus_chan.c Wed Dec 7 08:12:02 2016 (r309670) @@ -67,7 +67,7 @@ static void vmbus_chan_set_chmap(struc static voidvmbus_chan_clear_chmap(struct vmbus_channel *); static voidvmbus_chan_detach(struct vmbus_channel *); static boolvmbus_chan_wait_revoke( - const struct vmbus_channel *); + const struct vmbus_channel *, bool); static voidvmbus_chan_ins_prilist(struct vmbus_softc *, struct vmbus_channel *); @@ -478,14 +478,14 @@ vmbus_chan_open_br(struct vmbus_channel msg = vmbus_msghc_poll_result(sc, mh); if (msg != NULL) break; - DELAY(1000); + pause("rchopen", 1); } #undef REVOKE_LINGER if (msg == NULL) vmbus_msghc_exec_cancel(sc, mh); break; } - DELAY(1000); + pause("chopen", 1); } if (msg != NULL) { status = ((const struct vmbus_chanmsg_chopen_resp *) @@ -658,7 +658,7 @@ vmbus_chan_gpadl_connect(struct vmbus_ch } static bool -vmbus_chan_wait_revoke(const struct vmbus_channel *chan) +vmbus_chan_wait_revoke(const struct vmbus_channel *chan, bool can_sleep) { #define WAIT_COUNT 200 /* 200ms */ @@ -667,8 +667,10 @@ vmbus_chan_wait_revoke(const struct vmbu for (i = 0; i < WAIT_COUNT; ++i) { if (vmbus_chan_is_revoked(chan)) return (true); - /* Not sure about the context; use busy-wait. */ - DELAY(1000); + if (can_sleep) + pause("wchrev", 1); + else + DELAY(1000); } return (false); @@ -705,7 +707,7 @@ vmbus_chan_gpadl_disconnect(struct vmbus if (error) { vmbus_msghc_put(sc, mh); - if (vmbus_chan_wait_revoke(chan)) { + if (vmbus_chan_wait_revoke(chan, true)) { /* * Error is benign; this channel is revoked, * so this GPADL will not be touched anymore. ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r309372 - head/sys/sys
peek_clear_sc is added to address the issue you mentioned. IMHO, this commit weakens the proper assertion. On Fri, Dec 2, 2016 at 5:08 AM, Ryan Stonewrote: > Author: rstone > Date: Thu Dec 1 21:08:42 2016 > New Revision: 309372 > URL: https://svnweb.freebsd.org/changeset/base/309372 > > Log: > Fix a false positive in a buf_ring assert > > buf_ring contains an assert that checks whether an item being > enqueued already exists on the ring. There is a subtle bug in > this assert. An item can be returned by a peek() function and > freed, and then the consumer thread can be preempted before > calling advance(). If this happens the item appears to still be > on the queue, but another thread may allocate the item from the > free pool and wind up trying to enqueue it again, causing the > assert to trigger incorrectly. > > Fix this by skipping the head of the consumer's portion of the > ring, as this index is what will be returned by peek(). > > Sponsored by: Dell EMC Isilon > MFC After:1 week > Differential Revision:https://reviews.freebsd.org/D8685 > Reviewed by: hselasky > > Modified: > head/sys/sys/buf_ring.h > > Modified: head/sys/sys/buf_ring.h > == > --- head/sys/sys/buf_ring.h Thu Dec 1 20:36:48 2016(r309371) > +++ head/sys/sys/buf_ring.h Thu Dec 1 21:08:42 2016(r309372) > @@ -67,11 +67,13 @@ buf_ring_enqueue(struct buf_ring *br, vo > uint32_t prod_head, prod_next, cons_tail; > #ifdef DEBUG_BUFRING > int i; > - for (i = br->br_cons_head; i != br->br_prod_head; > -i = ((i + 1) & br->br_cons_mask)) > - if(br->br_ring[i] == buf) > - panic("buf=%p already enqueue at %d prod=%d cons=%d", > - buf, i, br->br_prod_tail, br->br_cons_tail); > + if (br->br_cons_head != br->br_prod_head) { > + for (i = (br->br_cons_head + 1) & br->br_cons_mask; i != > br->br_prod_head; > + i = ((i + 1) & br->br_cons_mask)) > + if(br->br_ring[i] == buf) > + panic("buf=%p already enqueue at %d prod=%d > cons=%d", > + buf, i, br->br_prod_tail, > br->br_cons_tail); > + } > #endif > critical_enter(); > do { > ___ > svn-src-...@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org" -- Tomorrow Will Never Die ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r309353 - in head/sys: dev/hyperv/netvsc modules/hyperv/netvsc
Author: sephe Date: Thu Dec 1 05:37:29 2016 New Revision: 309353 URL: https://svnweb.freebsd.org/changeset/base/309353 Log: hyperv/hn: Add 'options RSS' support. Reviewed by: adrian MFC after:1 week Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D8676 Modified: head/sys/dev/hyperv/netvsc/if_hn.c head/sys/modules/hyperv/netvsc/Makefile Modified: head/sys/dev/hyperv/netvsc/if_hn.c == --- head/sys/dev/hyperv/netvsc/if_hn.c Thu Dec 1 05:16:27 2016 (r309352) +++ head/sys/dev/hyperv/netvsc/if_hn.c Thu Dec 1 05:37:29 2016 (r309353) @@ -55,9 +55,10 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_hn.h" #include "opt_inet6.h" #include "opt_inet.h" -#include "opt_hn.h" +#include "opt_rss.h" #include #include @@ -87,6 +88,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifdef RSS +#include +#endif #include #include @@ -170,7 +174,11 @@ do { \ #define HN_PKTSIZE(m, align) \ roundup2((m)->m_pkthdr.len + HN_RNDIS_PKT_LEN, (align)) +#ifdef RSS +#define HN_RING_IDX2CPU(sc, idx) rss_getcpu((idx) % rss_getnumbuckets()) +#else #define HN_RING_IDX2CPU(sc, idx) (((sc)->hn_cpu + (idx)) % mp_ncpus) +#endif struct hn_txdesc { #ifndef HN_USE_TXDESC_BUFRING @@ -276,8 +284,10 @@ static int hn_ndis_version_sysctl(SYSC static int hn_caps_sysctl(SYSCTL_HANDLER_ARGS); static int hn_hwassist_sysctl(SYSCTL_HANDLER_ARGS); static int hn_rxfilter_sysctl(SYSCTL_HANDLER_ARGS); +#ifndef RSS static int hn_rss_key_sysctl(SYSCTL_HANDLER_ARGS); static int hn_rss_ind_sysctl(SYSCTL_HANDLER_ARGS); +#endif static int hn_rss_hash_sysctl(SYSCTL_HANDLER_ARGS); static int hn_txagg_size_sysctl(SYSCTL_HANDLER_ARGS); static int hn_txagg_pkts_sysctl(SYSCTL_HANDLER_ARGS); @@ -321,7 +331,9 @@ static int hn_create_rx_data(struct hn static voidhn_destroy_rx_data(struct hn_softc *); static int hn_check_iplen(const struct mbuf *, int); static int hn_set_rxfilter(struct hn_softc *); +#ifndef RSS static int hn_rss_reconfig(struct hn_softc *); +#endif static voidhn_rss_ind_fixup(struct hn_softc *); static int hn_rxpkt(struct hn_rx_ring *, const void *, int, const struct hn_rxinfo *); @@ -478,6 +490,7 @@ SYSCTL_INT(_hw_hn, OID_AUTO, tx_agg_pkts static u_int hn_cpu_index; /* next CPU for channel */ static struct taskqueue**hn_tx_taskque;/* shared TX taskqueues */ +#ifndef RSS static const uint8_t hn_rss_key_default[NDIS_HASH_KEYSIZE_TOEPLITZ] = { 0x6d, 0x5a, 0x56, 0xda, 0x25, 0x5b, 0x0e, 0xc2, @@ -486,6 +499,7 @@ hn_rss_key_default[NDIS_HASH_KEYSIZE_TOE 0x77, 0xcb, 0x2d, 0xa3, 0x80, 0x30, 0xf2, 0x0c, 0x6a, 0x42, 0xb7, 0x3b, 0xbe, 0xac, 0x01, 0xfa }; +#endif /* !RSS */ static device_method_t hn_methods[] = { /* Device interface */ @@ -783,6 +797,7 @@ hn_get_txswq_depth(const struct hn_tx_ri return hn_tx_swq_depth; } +#ifndef RSS static int hn_rss_reconfig(struct hn_softc *sc) { @@ -821,6 +836,7 @@ hn_rss_reconfig(struct hn_softc *sc) } return (0); } +#endif /* !RSS */ static void hn_rss_ind_fixup(struct hn_softc *sc) @@ -969,6 +985,10 @@ hn_attach(device_t dev) } else if (ring_cnt > mp_ncpus) { ring_cnt = mp_ncpus; } +#ifdef RSS + if (ring_cnt > rss_getnumbuckets()) + ring_cnt = rss_getnumbuckets(); +#endif tx_ring_cnt = hn_tx_ring_cnt; if (tx_ring_cnt <= 0 || tx_ring_cnt > ring_cnt) @@ -1068,12 +1088,17 @@ hn_attach(device_t dev) hn_rss_hash_sysctl, "A", "RSS hash"); SYSCTL_ADD_INT(ctx, child, OID_AUTO, "rss_ind_size", CTLFLAG_RD, >hn_rss_ind_size, 0, "RSS indirect entry count"); +#ifndef RSS + /* +* Don't allow RSS key/indirect table changes, if RSS is defined. +*/ SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "rss_key", CTLTYPE_OPAQUE | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, 0, hn_rss_key_sysctl, "IU", "RSS key"); SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "rss_ind", CTLTYPE_OPAQUE | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, 0, hn_rss_ind_sysctl, "IU", "RSS indirect table"); +#endif SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "rndis_agg_size", CTLFLAG_RD, >hn_rndis_agg_size, 0, "RNDIS offered packet transmission aggregation size limit"); @@ -2905,6 +2930,8 @@ hn_rxfilter_sysctl(SYSCTL_HANDLER_ARGS) return
svn commit: r309348 - head/sys/dev/hyperv/netvsc
Author: sephe Date: Thu Dec 1 03:39:34 2016 New Revision: 309348 URL: https://svnweb.freebsd.org/changeset/base/309348 Log: hyperv/hn: Don't hold txdesc, if no BPFs are attached. MFC after:1 week Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D8675 Modified: head/sys/dev/hyperv/netvsc/if_hn.c Modified: head/sys/dev/hyperv/netvsc/if_hn.c == --- head/sys/dev/hyperv/netvsc/if_hn.c Thu Dec 1 03:34:04 2016 (r309347) +++ head/sys/dev/hyperv/netvsc/if_hn.c Thu Dec 1 03:39:34 2016 (r309348) @@ -1924,17 +1924,20 @@ done: static int hn_txpkt(struct ifnet *ifp, struct hn_tx_ring *txr, struct hn_txdesc *txd) { - int error, send_failed = 0; + int error, send_failed = 0, has_bpf; again: - /* -* Make sure that this txd and any aggregated txds are not freed -* before ETHER_BPF_MTAP. -*/ - hn_txdesc_hold(txd); + has_bpf = bpf_peers_present(ifp->if_bpf); + if (has_bpf) { + /* +* Make sure that this txd and any aggregated txds are not +* freed before ETHER_BPF_MTAP. +*/ + hn_txdesc_hold(txd); + } error = txr->hn_sendpkt(txr, txd); if (!error) { - if (bpf_peers_present(ifp->if_bpf)) { + if (has_bpf) { const struct hn_txdesc *tmp_txd; ETHER_BPF_MTAP(ifp, txd->m); @@ -1957,7 +1960,8 @@ again: txr->hn_pkts += txr->hn_stat_pkts; txr->hn_sends++; } - hn_txdesc_put(txr, txd); + if (has_bpf) + hn_txdesc_put(txr, txd); if (__predict_false(error)) { int freed; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r309346 - in head/sys: conf dev/hyperv/netvsc modules/hyperv/netvsc
Author: sephe Date: Thu Dec 1 03:27:16 2016 New Revision: 309346 URL: https://svnweb.freebsd.org/changeset/base/309346 Log: hyperv/hn: Add HN_DEBUG kernel option. If bufring is used for per-TX ring descs, don't update "available" counter, which is only used to help debugging. MFC after:1 week Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D8674 Modified: head/sys/conf/options head/sys/dev/hyperv/netvsc/if_hn.c head/sys/modules/hyperv/netvsc/Makefile Modified: head/sys/conf/options == --- head/sys/conf/options Thu Dec 1 02:35:15 2016(r309345) +++ head/sys/conf/options Thu Dec 1 03:27:16 2016(r309346) @@ -1001,3 +1001,5 @@ EVDEV_SUPPORT opt_evdev.h EVDEV_DEBUGopt_evdev.h UINPUT_DEBUG opt_evdev.h +# Hyper-V network driver +HN_DEBUG opt_hn.h Modified: head/sys/dev/hyperv/netvsc/if_hn.c == --- head/sys/dev/hyperv/netvsc/if_hn.c Thu Dec 1 02:35:15 2016 (r309345) +++ head/sys/dev/hyperv/netvsc/if_hn.c Thu Dec 1 03:27:16 2016 (r309346) @@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$"); #include "opt_inet6.h" #include "opt_inet.h" +#include "opt_hn.h" #include #include @@ -1428,10 +1429,12 @@ hn_txdesc_put(struct hn_tx_ring *txr, st txr->hn_txdesc_avail++; SLIST_INSERT_HEAD(>hn_txlist, txd, link); mtx_unlock_spin(>hn_txlist_spin); -#else +#else /* HN_USE_TXDESC_BUFRING */ +#ifdef HN_DEBUG atomic_add_int(>hn_txdesc_avail, 1); - buf_ring_enqueue(txr->hn_txdesc_br, txd); #endif + buf_ring_enqueue(txr->hn_txdesc_br, txd); +#endif /* !HN_USE_TXDESC_BUFRING */ return 1; } @@ -1457,8 +1460,10 @@ hn_txdesc_get(struct hn_tx_ring *txr) if (txd != NULL) { #ifdef HN_USE_TXDESC_BUFRING +#ifdef HN_DEBUG atomic_subtract_int(>hn_txdesc_avail, 1); #endif +#endif /* HN_USE_TXDESC_BUFRING */ KASSERT(txd->m == NULL && txd->refs == 0 && STAILQ_EMPTY(>agg_list) && txd->chim_index == HN_NVS_CHIM_IDX_INVALID && @@ -3467,9 +3472,11 @@ hn_tx_ring_create(struct hn_softc *sc, i if (txr->hn_tx_sysctl_tree != NULL) { child = SYSCTL_CHILDREN(txr->hn_tx_sysctl_tree); +#ifdef HN_DEBUG SYSCTL_ADD_INT(ctx, child, OID_AUTO, "txdesc_avail", CTLFLAG_RD, >hn_txdesc_avail, 0, "# of available TX descs"); +#endif #ifdef HN_IFSTART_SUPPORT if (!hn_use_if_start) #endif Modified: head/sys/modules/hyperv/netvsc/Makefile == --- head/sys/modules/hyperv/netvsc/Makefile Thu Dec 1 02:35:15 2016 (r309345) +++ head/sys/modules/hyperv/netvsc/Makefile Thu Dec 1 03:27:16 2016 (r309346) @@ -5,7 +5,7 @@ KMOD= hv_netvsc SRCS= hn_nvs.c hn_rndis.c if_hn.c -SRCS+= bus_if.h device_if.h opt_inet.h opt_inet6.h vmbus_if.h +SRCS+= bus_if.h device_if.h opt_inet.h opt_inet6.h vmbus_if.h opt_hn.h CFLAGS+= -I${.CURDIR}/../../../dev/hyperv/netvsc ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r309320 - head/sys/dev/hyperv/storvsc
Author: sephe Date: Wed Nov 30 08:21:15 2016 New Revision: 309320 URL: https://svnweb.freebsd.org/changeset/base/309320 Log: hyperv/storvsc: Don't use timedwait. The timeout is unnecessary. Reviewed by: jhb MFC after:1 week Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D8656 Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c == --- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.cWed Nov 30 08:10:49 2016(r309319) +++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.cWed Nov 30 08:21:15 2016(r309320) @@ -413,13 +413,7 @@ storvsc_send_multichannel_request(struct VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC, vstor_packet, VSTOR_PKT_SIZE, (uint64_t)(uintptr_t)request); - /* wait for 5 seconds */ - ret = sema_timedwait(>synch_sema, 5 * hz); - if (ret != 0) { - printf("Storvsc_error: create multi-channel timeout, %d\n", - ret); - return; - } + sema_wait(>synch_sema); if (vstor_packet->operation != VSTOR_OPERATION_COMPLETEIO || vstor_packet->status != 0) { @@ -486,10 +480,7 @@ hv_storvsc_channel_init(struct storvsc_s if (ret != 0) goto cleanup; - /* wait 5 seconds */ - ret = sema_timedwait(>synch_sema, 5 * hz); - if (ret != 0) - goto cleanup; + sema_wait(>synch_sema); if (vstor_packet->operation != VSTOR_OPERATION_COMPLETEIO || vstor_packet->status != 0) { @@ -516,11 +507,7 @@ hv_storvsc_channel_init(struct storvsc_s if (ret != 0) goto cleanup; - /* wait 5 seconds */ - ret = sema_timedwait(>synch_sema, 5 * hz); - - if (ret) - goto cleanup; + sema_wait(>synch_sema); if (vstor_packet->operation != VSTOR_OPERATION_COMPLETEIO) { ret = EINVAL; @@ -555,11 +542,7 @@ hv_storvsc_channel_init(struct storvsc_s if ( ret != 0) goto cleanup; - /* wait 5 seconds */ - ret = sema_timedwait(>synch_sema, 5 * hz); - - if (ret != 0) - goto cleanup; + sema_wait(>synch_sema); /* TODO: Check returned version */ if (vstor_packet->operation != VSTOR_OPERATION_COMPLETEIO || @@ -588,11 +571,7 @@ hv_storvsc_channel_init(struct storvsc_s goto cleanup; } - /* wait 5 seconds */ - ret = sema_timedwait(>synch_sema, 5 * hz); - - if (ret != 0) - goto cleanup; + sema_wait(>synch_sema); if (vstor_packet->operation != VSTOR_OPERATION_COMPLETEIO || vstor_packet->status != 0) @@ -672,12 +651,7 @@ hv_storvsc_host_reset(struct storvsc_sof goto cleanup; } - ret = sema_timedwait(>synch_sema, 5 * hz); /* KYS 5 seconds */ - - if (ret) { - goto cleanup; - } - + sema_wait(>synch_sema); /* * At this point, all outstanding requests in the adapter ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r309319 - head/sys/dev/hyperv/vmbus
Author: sephe Date: Wed Nov 30 08:10:49 2016 New Revision: 309319 URL: https://svnweb.freebsd.org/changeset/base/309319 Log: hypver/vmbus: Remove extra assertion. It is asserted by vmbus_chan_gpadl_connect() now. MFC after:1 week Sponsored by: Microsoft Differential Revision:https://reviews.freebsd.org/D8660 Modified: head/sys/dev/hyperv/vmbus/vmbus_chan.c Modified: head/sys/dev/hyperv/vmbus/vmbus_chan.c == --- head/sys/dev/hyperv/vmbus/vmbus_chan.c Wed Nov 30 07:54:28 2016 (r309318) +++ head/sys/dev/hyperv/vmbus/vmbus_chan.c Wed Nov 30 08:10:49 2016 (r309319) @@ -405,8 +405,6 @@ vmbus_chan_open_br(struct vmbus_channel /* * Connect the bufrings, both RX and TX, to this channel. */ - KASSERT(chan->ch_bufring_gpadl == 0, - ("bufring GPADL is still connected")); error = vmbus_chan_gpadl_connect(chan, cbr->cbr_paddr, txbr_size + rxbr_size, >ch_bufring_gpadl); if (error) { ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"