svn commit: r301856 - stable/10/sys/dev/hyperv/netvsc
Author: sephe Date: Mon Jun 13 05:43:42 2016 New Revision: 301856 URL: https://svnweb.freebsd.org/changeset/base/301856 Log: MFC 295296,295297,295298,295299,295300,295301 295296 hyperv/hn: Avoid duplicate csum features settings - Record csum features in softc, so we don't need to duplicate the logic from attach path to ioctl path. - Protect if_capenable and if_hwassist changes by main lock. - Prefer turn on/off bits in if_hwassist explicitly instead of using XOR. Reviewed by:adrian, Hongjiang Zhang Approved by:adrian (mentor) MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D5085 295297 hyperv/hn: Reorganize TX csum offloading - For non-TSO offloading, we don't need to access mbuf to know which csum offloading is requested, we can just use the CSUM_{IP,TCP,UDP} in the csum_flags. - For TSO offloading, we still can depend on CSUM_{TSO4,TSO6} in the csum_flags to tell whether the TSO packet is an IPv4 TSO packet or an IPv6 TSO packet. This streamlines csum offloading handling (remove the two goto) and allows us the nuke the unnecessary get_transport_proto_type(). Reviewed by:adrian, Hongjiang Zhang Approved by:adrian (mentor) MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D5098 295298 hyperv/hn: Enable IP header checksum offloading So that: - TCP/IP stack will not do unnecessary IP header checksum for TSO packets. - Reduce guest load for non-TSO IP packets. Reviewed by:adrian Approved by:adrian (mentor) MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D5099 295299 hyperv/hn: Enable UDP RXCSUM Reviewed by:adrian Approved by:adrian (mentor) MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D5102 295300 hyperv/hn: Add sysctls to trust host side UDP and IP csum verification Reviewed by:adrian, Hongjiang Zhang Approved by:adrian (mentor) MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D5103 295301 hyperv/hn: Obey IFCAP_RXCSUM configure Reviewed by:adrian Approved by:adrian (mentor) MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D5104 Modified: stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h == --- stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.hMon Jun 13 05:13:52 2016(r301855) +++ stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.hMon Jun 13 05:43:42 2016(r301856) @@ -1016,6 +1016,7 @@ typedef struct hn_softc { bus_dma_tag_t hn_tx_rndis_dtag; int hn_tx_chimney_size; int hn_tx_chimney_max; + uint64_thn_csum_assist; struct mtx hn_txlist_spin; struct hn_txdesc_list hn_txlist; @@ -1031,11 +1032,12 @@ typedef struct hn_softc { struct lro_ctrl hn_lro; int hn_lro_hiwat; - /* Trust tcp segments verification on host side */ - int hn_trust_hosttcp; + /* Trust csum verification on host side */ + int hn_trust_hcsum; /* HN_TRUST_HCSUM_ */ u_long hn_csum_ip; u_long hn_csum_tcp; + u_long hn_csum_udp; u_long hn_csum_trusted; u_long hn_lro_tried; u_long hn_small_pkts; @@ -1046,6 +1048,9 @@ typedef struct hn_softc { u_long hn_tx_chimney; } hn_softc_t; +#define HN_TRUST_HCSUM_IP 0x0001 +#define HN_TRUST_HCSUM_TCP 0x0002 +#define HN_TRUST_HCSUM_UDP 0x0004 /* * Externs Modified: stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c == --- stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Jun 13 05:13:52 2016(r301855) +++ stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Jun 13 05:43:42 2016(r301856) @@ -167,14 +167,12 @@ struct hn_txdesc { #define HN_TXD_FLAG_DMAMAP 0x2 /* - * A unified flag for all outbound check sum flags is useful, - * and it helps avoiding unnecessary check sum calculation
svn commit: r301855 - stable/10/sys/dev/hyperv/storvsc
Author: sephe Date: Mon Jun 13 05:13:52 2016 New Revision: 301855 URL: https://svnweb.freebsd.org/changeset/base/301855 Log: MFC 295295 hyperv/stor: Fix the NULL pointer dereference Reported by:Netapp Submitted by: Hongjiang Zhang Reviewed by:adrian, sephe, Dexuan Cui Approved by:adrian (mentor) MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D5097 Modified: stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c == --- stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Mon Jun 13 05:06:07 2016(r301854) +++ stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Mon Jun 13 05:13:52 2016(r301855) @@ -1561,13 +1561,12 @@ static void storvsc_destroy_bounce_buffer(struct sglist *sgl) { struct hv_sgl_node *sgl_node = NULL; - - sgl_node = LIST_FIRST(_hv_sgl_page_pool.in_use_sgl_list); - LIST_REMOVE(sgl_node, link); - if (NULL == sgl_node) { + if (LIST_EMPTY(_hv_sgl_page_pool.in_use_sgl_list)) { printf("storvsc error: not enough in use sgl\n"); return; } + sgl_node = LIST_FIRST(_hv_sgl_page_pool.in_use_sgl_list); + LIST_REMOVE(sgl_node, link); sgl_node->sgl_data = sgl; LIST_INSERT_HEAD(_hv_sgl_page_pool.free_sgl_list, sgl_node, link); } @@ -1593,12 +1592,12 @@ storvsc_create_bounce_buffer(uint16_t se struct hv_sgl_node *sgl_node = NULL; /* get struct sglist from free_sgl_list */ - sgl_node = LIST_FIRST(_hv_sgl_page_pool.free_sgl_list); - LIST_REMOVE(sgl_node, link); - if (NULL == sgl_node) { + if (LIST_EMPTY(_hv_sgl_page_pool.free_sgl_list)) { printf("storvsc error: not enough free sgl\n"); return NULL; } + sgl_node = LIST_FIRST(_hv_sgl_page_pool.free_sgl_list); + LIST_REMOVE(sgl_node, link); bounce_sgl = sgl_node->sgl_data; LIST_INSERT_HEAD(_hv_sgl_page_pool.in_use_sgl_list, sgl_node, link); ___ svn-src-all@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"
svn commit: r301854 - in stable/10/sys/dev/hyperv: include vmbus
Author: sephe Date: Mon Jun 13 05:06:07 2016 New Revision: 301854 URL: https://svnweb.freebsd.org/changeset/base/301854 Log: MFC 294886 hyperv/vmbus: Event handling code refactor. - Use taskqueue instead of swi for event handling. - Scan the interrupt flags in filter - Disable ringbuffer interrupt mask in filter to ensure no unnecessary interrupts. Submitted by: Jun Su Reviewed by:adrian, sephe, Dexuan Approved by:adrian (mentor) MFC after: 2 weeks Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D4920 Modified: stable/10/sys/dev/hyperv/include/hyperv.h stable/10/sys/dev/hyperv/vmbus/hv_channel.c stable/10/sys/dev/hyperv/vmbus/hv_connection.c stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c stable/10/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/include/hyperv.h == --- stable/10/sys/dev/hyperv/include/hyperv.h Mon Jun 13 03:45:08 2016 (r301853) +++ stable/10/sys/dev/hyperv/include/hyperv.h Mon Jun 13 05:06:07 2016 (r301854) @@ -755,6 +755,8 @@ typedef struct hv_vmbus_channel { struct mtx inbound_lock; + struct taskqueue * rxq; + struct task channel_task; hv_vmbus_pfn_channel_callback on_channel_callback; void* channel_callback_context; Modified: stable/10/sys/dev/hyperv/vmbus/hv_channel.c == --- stable/10/sys/dev/hyperv/vmbus/hv_channel.c Mon Jun 13 03:45:08 2016 (r301853) +++ stable/10/sys/dev/hyperv/vmbus/hv_channel.c Mon Jun 13 05:06:07 2016 (r301854) @@ -52,6 +52,7 @@ static intvmbus_channel_create_gpadl_h uint32_t* message_count); static voidvmbus_channel_set_event(hv_vmbus_channel* channel); +static voidVmbusProcessChannelEvent(void* channel, int pending); /** * @brief Trigger an event notification on the specified channel @@ -115,6 +116,9 @@ hv_vmbus_channel_open( new_channel->on_channel_callback = pfn_on_channel_callback; new_channel->channel_callback_context = context; + new_channel->rxq = hv_vmbus_g_context.hv_event_queue[new_channel->target_cpu]; + TASK_INIT(_channel->channel_task, 0, VmbusProcessChannelEvent, new_channel); + /* Allocate the ring buffer */ out = contigmalloc((send_ring_buffer_size + recv_ring_buffer_size), M_DEVBUF, M_ZERO, 0UL, BUS_SPACE_MAXADDR, PAGE_SIZE, 0); @@ -518,6 +522,7 @@ static void hv_vmbus_channel_close_internal(hv_vmbus_channel *channel) { int ret = 0; + struct taskqueue *rxq = channel->rxq; hv_vmbus_channel_close_channel* msg; hv_vmbus_channel_msg_info* info; @@ -525,6 +530,11 @@ hv_vmbus_channel_close_internal(hv_vmbus channel->sc_creation_callback = NULL; /* +* set rxq to NULL to avoid more requests be scheduled +*/ + channel->rxq = NULL; + taskqueue_drain(rxq, >channel_task); + /* * Grab the lock to prevent race condition when a packet received * and unloading driver is in the process. */ @@ -877,3 +887,67 @@ hv_vmbus_channel_recv_packet_raw( return (0); } + + +/** + * Process a channel event notification + */ +static void +VmbusProcessChannelEvent(void* context, int pending) +{ + void* arg; + uint32_t bytes_to_read; + hv_vmbus_channel* channel = (hv_vmbus_channel*)context; + boolean_t is_batched_reading; + + /** +* Find the channel based on this relid and invokes +* the channel callback to process the event +*/ + + if (channel == NULL) { + return; + } + /** +* To deal with the race condition where we might +* receive a packet while the relevant driver is +* being unloaded, dispatch the callback while +* holding the channel lock. The unloading driver +* will acquire the same channel lock to set the +* callback to NULL. This closes the window. +*/ + + /* +* Disable the lock due to newly added WITNESS check in r277723. +* Will seek other way to avoid race condition. +* -- whu +*/ + // mtx_lock(>inbound_lock); + if (channel->on_channel_callback != NULL) { + arg = channel->channel_callback_context; + is_batched_reading = channel->batched_reading; + /* +* Optimize host to guest signaling by ensuring: +* 1. While reading the channel, we disable interrupts from +
svn commit: r301853 - head/sys/amd64/amd64
Author: kib Date: Mon Jun 13 03:45:08 2016 New Revision: 301853 URL: https://svnweb.freebsd.org/changeset/base/301853 Log: Do not access pv_table array for fictitious pages, since the array does not cover the dynamically registered ficititious ranges, and fictitious pages mappings are not promoted. Offer a dummy struct md_page to fetch constant superpage pv list generation to satisfy logic. Also, by initializing the pv_dummy pv_list to empty, we can remove several explicit PG_FICTITIOUS tests. Reported and tested by: Michael Butler(previous version) Reviewed by: alc Sponsored by: The FreeBSD Foundation MFC after:1 week Differential revision:https://reviews.freebsd.org/D6728 Approved by: re (hrs) Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c == --- head/sys/amd64/amd64/pmap.c Mon Jun 13 03:42:46 2016(r301852) +++ head/sys/amd64/amd64/pmap.c Mon Jun 13 03:45:08 2016(r301853) @@ -386,6 +386,7 @@ static struct mtx pv_chunks_mutex; static struct rwlock pv_list_locks[NPV_LIST_LOCKS]; static u_long pv_invl_gen[NPV_LIST_LOCKS]; static struct md_page *pv_table; +static struct md_page pv_dummy; /* * All those kernel PT submaps that BSD is so fond of @@ -1264,6 +1265,7 @@ pmap_init(void) M_WAITOK | M_ZERO); for (i = 0; i < pv_npg; i++) TAILQ_INIT(_table[i].pv_list); + TAILQ_INIT(_dummy.pv_list); pmap_initialized = 1; for (i = 0; i < PMAP_PREINIT_MAPPING_COUNT; i++) { @@ -3920,11 +3922,10 @@ pmap_remove_all(vm_page_t m) ("pmap_remove_all: page %p is not managed", m)); SLIST_INIT(); lock = VM_PAGE_TO_PV_LIST_LOCK(m); - pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m)); + pvh = (m->flags & PG_FICTITIOUS) != 0 ? _dummy : + pa_to_pvh(VM_PAGE_TO_PHYS(m)); retry: rw_wlock(lock); - if ((m->flags & PG_FICTITIOUS) != 0) - goto small_mappings; while ((pv = TAILQ_FIRST(>pv_list)) != NULL) { pmap = PV_PMAP(pv); if (!PMAP_TRYLOCK(pmap)) { @@ -3943,7 +3944,6 @@ retry: (void)pmap_demote_pde_locked(pmap, pde, va, ); PMAP_UNLOCK(pmap); } -small_mappings: while ((pv = TAILQ_FIRST(>md.pv_list)) != NULL) { pmap = PV_PMAP(pv); if (!PMAP_TRYLOCK(pmap)) { @@ -5743,11 +5743,10 @@ pmap_remove_write(vm_page_t m) if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0) return; lock = VM_PAGE_TO_PV_LIST_LOCK(m); - pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m)); + pvh = (m->flags & PG_FICTITIOUS) != 0 ? _dummy : + pa_to_pvh(VM_PAGE_TO_PHYS(m)); retry_pv_loop: rw_wlock(lock); - if ((m->flags & PG_FICTITIOUS) != 0) - goto small_mappings; TAILQ_FOREACH_SAFE(pv, >pv_list, pv_next, next_pv) { pmap = PV_PMAP(pv); if (!PMAP_TRYLOCK(pmap)) { @@ -5771,7 +5770,6 @@ retry_pv_loop: lock, VM_PAGE_TO_PV_LIST_LOCK(m), m)); PMAP_UNLOCK(pmap); } -small_mappings: TAILQ_FOREACH(pv, >md.pv_list, pv_next) { pmap = PV_PMAP(pv); if (!PMAP_TRYLOCK(pmap)) { @@ -5877,12 +5875,11 @@ pmap_ts_referenced(vm_page_t m) cleared = 0; pa = VM_PAGE_TO_PHYS(m); lock = PHYS_TO_PV_LIST_LOCK(pa); - pvh = pa_to_pvh(pa); + pvh = (m->flags & PG_FICTITIOUS) != 0 ? _dummy : pa_to_pvh(pa); rw_wlock(lock); retry: not_cleared = 0; - if ((m->flags & PG_FICTITIOUS) != 0 || - (pvf = TAILQ_FIRST(>pv_list)) == NULL) + if ((pvf = TAILQ_FIRST(>pv_list)) == NULL) goto small_mappings; pv = pvf; do { @@ -6194,12 +6191,11 @@ pmap_clear_modify(vm_page_t m) */ if ((m->aflags & PGA_WRITEABLE) == 0) return; - pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m)); + pvh = (m->flags & PG_FICTITIOUS) != 0 ? _dummy : + pa_to_pvh(VM_PAGE_TO_PHYS(m)); lock = VM_PAGE_TO_PV_LIST_LOCK(m); rw_wlock(lock); restart: - if ((m->flags & PG_FICTITIOUS) != 0) - goto small_mappings; TAILQ_FOREACH_SAFE(pv, >pv_list, pv_next, next_pv) { pmap = PV_PMAP(pv); if (!PMAP_TRYLOCK(pmap)) { @@ -6243,7 +6239,6 @@ restart: } PMAP_UNLOCK(pmap); } -small_mappings: TAILQ_FOREACH(pv, >md.pv_list, pv_next) { pmap = PV_PMAP(pv); if (!PMAP_TRYLOCK(pmap)) { ___ svn-src-all@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"
svn commit: r301852 - head/sys/vm
Author: kib Date: Mon Jun 13 03:42:46 2016 New Revision: 301852 URL: https://svnweb.freebsd.org/changeset/base/301852 Log: Fix inconsistent locking of the swap pager named objects list. Right now, all modifications of the list are locked by sw_alloc_mtx. But initial lookup of the object by the handle in swap_pager_alloc() is not protected by sw_alloc_mtx, which means that vm_pager_object_lookup() could follow freed pointer. Create a new named swap object with the OBJT_SWAP type, instead of OBJT_DEFAULT. With this change, swp_pager_meta_build() never need to upgrade named OBJT_DEFAULT to OBJT_SWAP (in the other place, we do not forbid for client code to create named OBJT_DEFAULT objects at all). That change allows to remove sw_alloc_mtx and make the list locked by sw_alloc_sx lock. Update swap_pager_copy() to new locking mode. Create helper swap_pager_alloc_init() to consolidate named and anonymous swap objects creation, while a caller ensures that the neccesary locks are held around the helper. Reviewed by: alc Sponsored by: The FreeBSD Foundation MFC after:2 weeks Approved by: re (hrs) Modified: head/sys/vm/swap_pager.c Modified: head/sys/vm/swap_pager.c == --- head/sys/vm/swap_pager.cMon Jun 13 03:39:16 2016(r301851) +++ head/sys/vm/swap_pager.cMon Jun 13 03:42:46 2016(r301852) @@ -345,7 +345,6 @@ static struct sx sw_alloc_sx; #define NOBJLIST(handle) \ (_pager_object_list[((int)(intptr_t)handle >> 4) & (NOBJLISTS-1)]) -static struct mtx sw_alloc_mtx;/* protect list manipulation */ static struct pagerlst swap_pager_object_list[NOBJLISTS]; static uma_zone_t swap_zone; @@ -486,7 +485,6 @@ swap_pager_init(void) for (i = 0; i < NOBJLISTS; ++i) TAILQ_INIT(_pager_object_list[i]); - mtx_init(_alloc_mtx, "swap_pager list", NULL, MTX_DEF); mtx_init(_dev_mtx, "swapdev", NULL, MTX_DEF); sx_init(_alloc_sx, "swspsx"); sx_init(_syscall_lock, "swsysc"); @@ -583,28 +581,46 @@ swap_pager_swap_init(void) mtx_init(_mtx, "swap_pager swhash", NULL, MTX_DEF); } +static vm_object_t +swap_pager_alloc_init(void *handle, struct ucred *cred, vm_ooffset_t size, +vm_ooffset_t offset) +{ + vm_object_t object; + + if (cred != NULL) { + if (!swap_reserve_by_cred(size, cred)) + return (NULL); + crhold(cred); + } + object = vm_object_allocate(OBJT_SWAP, OFF_TO_IDX(offset + + PAGE_MASK + size)); + object->handle = handle; + if (cred != NULL) { + object->cred = cred; + object->charge = size; + } + object->un_pager.swp.swp_bcount = 0; + return (object); +} + /* * SWAP_PAGER_ALLOC() -allocate a new OBJT_SWAP VM object and instantiate * its metadata structures. * * This routine is called from the mmap and fork code to create a new - * OBJT_SWAP object. We do this by creating an OBJT_DEFAULT object - * and then converting it with swp_pager_meta_build(). - * - * This routine may block in vm_object_allocate() and create a named - * object lookup race, so we must interlock. + * OBJT_SWAP object. * - * MPSAFE + * This routine must ensure that no live duplicate is created for + * the named object request, which is protected against by + * holding the sw_alloc_sx lock in case handle != NULL. */ static vm_object_t swap_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot, vm_ooffset_t offset, struct ucred *cred) { vm_object_t object; - vm_pindex_t pindex; - pindex = OFF_TO_IDX(offset + PAGE_MASK + size); - if (handle) { + if (handle != NULL) { /* * Reference existing named region or allocate new one. There * should not be a race here against swp_pager_meta_build() @@ -614,38 +630,16 @@ swap_pager_alloc(void *handle, vm_ooffse sx_xlock(_alloc_sx); object = vm_pager_object_lookup(NOBJLIST(handle), handle); if (object == NULL) { - if (cred != NULL) { - if (!swap_reserve_by_cred(size, cred)) { - sx_xunlock(_alloc_sx); - return (NULL); - } - crhold(cred); - } - object = vm_object_allocate(OBJT_DEFAULT, pindex); - VM_OBJECT_WLOCK(object); - object->handle = handle; - if (cred != NULL) { - object->cred = cred; - object->charge = size; + object =
svn commit: r301851 - head/sys/vm
Author: kib Date: Mon Jun 13 03:39:16 2016 New Revision: 301851 URL: https://svnweb.freebsd.org/changeset/base/301851 Log: Explicitely initialize sw_alloc_sx. Currently it is not initialized but works due to zeroed out bss on startup. Reviewed by: alc Sponsored by: The FreeBSD Foundation MFC after:1 week Approved by: re (hrs) Modified: head/sys/vm/swap_pager.c Modified: head/sys/vm/swap_pager.c == --- head/sys/vm/swap_pager.cMon Jun 13 03:28:37 2016(r301850) +++ head/sys/vm/swap_pager.cMon Jun 13 03:39:16 2016(r301851) @@ -488,6 +488,7 @@ swap_pager_init(void) TAILQ_INIT(_pager_object_list[i]); mtx_init(_alloc_mtx, "swap_pager list", NULL, MTX_DEF); mtx_init(_dev_mtx, "swapdev", NULL, MTX_DEF); + sx_init(_alloc_sx, "swspsx"); sx_init(_syscall_lock, "swsysc"); /* ___ svn-src-all@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"
svn commit: r301850 - in stable/10/sys/dev/hyperv: netvsc vmbus
Author: sephe Date: Mon Jun 13 03:28:37 2016 New Revision: 301850 URL: https://svnweb.freebsd.org/changeset/base/301850 Log: MFC 294701,294702,294703,294705,294788 294701 hyperv/hn: Use m_copydata for chimney sending. While I'm here, move stack variables near their usage. Reviewed by:adrian, delphij, Jun Su Approved by:adrian (mentor) Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D4977 294702 hyperv/hn: Remove unnecessary zeroing out the netvsc_packet All used fields are setup one by one, so there is no need to zero out this large struct. While I'm here, move the stack variable near its usage. Reviewed by:adrian, delphij, Jun Su Approved by:adrian (mentor) Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D4978 294703 hyperv/hn: Trust host TCP segment checksum verification by default. According to all available information, VMSWITCH always does the TCP segment checksum verification before sending the segment to guest. Reviewed by:adrian, delphij, Hongjiang Zhang Approved by:adrian (mentor) Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D4991 294705 hyperv/vmbus: Avoid extra copy of page information. The page information array could contain up to 32 elements (i.e. 512B). And on network side w/ TSO, 11+ (176B+) elements, i.e. ~44K TSO packet, in the page information array is quite common. This saves us some cpu cycles. Reviewed by:adrian, delphij Approved by:adrian (mentor) Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D4992 294788 hyperv/hn: Improve sending performance - Avoid main lock contention by trylock for if_start, if that fails, schedule TX taskqueue for if_start - Don't do direct sending if the packet to be sent is large, e.g. TSO packet. This change gives me stable 9.1Gbps TCP sending performance w/ TSO over a 10Gbe directly connected network (the performance fluctuated between 4Gbps and 9Gbps before this commit). It also improves non- TSO TCP sending performance a lot. Reviewed by:adrian, royger Approved by:adrian (mentor) Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D5074 Modified: stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c stable/10/sys/dev/hyperv/vmbus/hv_channel.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h == --- stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.hMon Jun 13 03:17:00 2016(r301849) +++ stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.hMon Jun 13 03:28:37 2016(r301850) @@ -39,9 +39,11 @@ #define __HV_NET_VSC_H__ #include +#include #include #include #include +#include #include #include @@ -1009,7 +1011,6 @@ typedef struct hn_softc { struct hv_device *hn_dev_obj; netvsc_dev *net_dev; - int hn_txdesc_cnt; struct hn_txdesc *hn_txdesc; bus_dma_tag_t hn_tx_data_dtag; bus_dma_tag_t hn_tx_rndis_dtag; @@ -1018,9 +1019,15 @@ typedef struct hn_softc { struct mtx hn_txlist_spin; struct hn_txdesc_list hn_txlist; + int hn_txdesc_cnt; int hn_txdesc_avail; int hn_txeof; + int hn_direct_tx_size; + struct taskqueue *hn_tx_taskq; + struct task hn_start_task; + struct task hn_txeof_task; + struct lro_ctrl hn_lro; int hn_lro_hiwat; Modified: stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c == --- stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Jun 13 03:17:00 2016(r301849) +++ stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Jun 13 03:28:37 2016(r301850) @@ -146,6 +146,8 @@ __FBSDID("$FreeBSD$"); #define HN_TX_DATA_SEGCNT_MAX \ (NETVSC_PACKET_MAXPAGE - HV_RF_NUM_TX_RESERVED_PAGE_BUFS) +#define HN_DIRECT_TX_SIZE_DEF 128 + struct hn_txdesc { SLIST_ENTRY(hn_txdesc) link; struct mbuf *m; @@ -194,6 +196,7 @@ struct hn_txdesc { #define NV_LOCK_INIT(_sc, _name) \ mtx_init(&(_sc)->hn_lock, _name,
svn commit: r301849 - head/sys/mips/mips
Author: adrian Date: Mon Jun 13 03:17:00 2016 New Revision: 301849 URL: https://svnweb.freebsd.org/changeset/base/301849 Log: [mips] set hardfloat for fpu instruction generation for gcc/binutils 5.x This allows -HEAD to be compiled again using the gcc-5 mips port compiler. Reviewed by: imp Approved by: re@ Modified: head/sys/mips/mips/swtch.S Modified: head/sys/mips/mips/swtch.S == --- head/sys/mips/mips/swtch.S Mon Jun 13 03:03:08 2016(r301848) +++ head/sys/mips/mips/swtch.S Mon Jun 13 03:17:00 2016(r301849) @@ -400,6 +400,7 @@ END(cpu_switch) * * */ +.set hardfloat LEAF(MipsSwitchFPState) mfc0t1, MIPS_COP_0_STATUS # Save old SR li t0, MIPS_SR_COP_1_BIT # enable the coprocessor ___ svn-src-all@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"
svn commit: r301848 - stable/10/sys/dev/bge
Author: sephe Date: Mon Jun 13 03:03:08 2016 New Revision: 301848 URL: https://svnweb.freebsd.org/changeset/base/301848 Log: MFC 300985, 301103 r300985 bge: Support 5717 C0, which is almost same as 5720 A0 PR: 209758 Obtained from: DragonFlyBSD d79f5d8f5fe94cd6769207b2901422977d502bc0 MFC after: 1 week r301103 bge: Force chipid to 5720 A0 for 5717 C0 in an early place Discussed with: yongari MFC after: 1 week Sponsored by: Microsoft OSTC Modified: stable/10/sys/dev/bge/if_bge.c stable/10/sys/dev/bge/if_bgereg.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/bge/if_bge.c == --- stable/10/sys/dev/bge/if_bge.c Mon Jun 13 02:54:58 2016 (r301847) +++ stable/10/sys/dev/bge/if_bge.c Mon Jun 13 03:03:08 2016 (r301848) @@ -170,6 +170,7 @@ static const struct bge_type { { BCOM_VENDORID,BCOM_DEVICEID_BCM5715 }, { BCOM_VENDORID,BCOM_DEVICEID_BCM5715S }, { BCOM_VENDORID,BCOM_DEVICEID_BCM5717 }, + { BCOM_VENDORID,BCOM_DEVICEID_BCM5717C }, { BCOM_VENDORID,BCOM_DEVICEID_BCM5718 }, { BCOM_VENDORID,BCOM_DEVICEID_BCM5719 }, { BCOM_VENDORID,BCOM_DEVICEID_BCM5720 }, @@ -310,6 +311,7 @@ static const struct bge_revision { { BGE_CHIPID_BCM5715_A3,"BCM5715 A3" }, { BGE_CHIPID_BCM5717_A0,"BCM5717 A0" }, { BGE_CHIPID_BCM5717_B0,"BCM5717 B0" }, + { BGE_CHIPID_BCM5717_C0,"BCM5717 C0" }, { BGE_CHIPID_BCM5719_A0,"BCM5719 A0" }, { BGE_CHIPID_BCM5720_A0,"BCM5720 A0" }, { BGE_CHIPID_BCM5755_A0,"BCM5755 A0" }, @@ -2689,6 +2691,10 @@ bge_chipid(device_t dev) * registers. */ switch (pci_get_device(dev)) { + case BCOM_DEVICEID_BCM5717C: + /* 5717 C0 seems to belong to 5720 line. */ + id = BGE_CHIPID_BCM5720_A0; + break; case BCOM_DEVICEID_BCM5717: case BCOM_DEVICEID_BCM5718: case BCOM_DEVICEID_BCM5719: Modified: stable/10/sys/dev/bge/if_bgereg.h == --- stable/10/sys/dev/bge/if_bgereg.h Mon Jun 13 02:54:58 2016 (r301847) +++ stable/10/sys/dev/bge/if_bgereg.h Mon Jun 13 03:03:08 2016 (r301848) @@ -329,6 +329,7 @@ #defineBGE_CHIPID_BCM57780_A1 0x57780001 #defineBGE_CHIPID_BCM5717_A0 0x05717000 #defineBGE_CHIPID_BCM5717_B0 0x05717100 +#defineBGE_CHIPID_BCM5717_C0 0x05717200 #defineBGE_CHIPID_BCM5719_A0 0x05719000 #defineBGE_CHIPID_BCM5720_A0 0x0572 #defineBGE_CHIPID_BCM5762_A0 0x05762000 @@ -2452,6 +2453,7 @@ struct bge_status_block { #defineBCOM_DEVICEID_BCM5715 0x1678 #defineBCOM_DEVICEID_BCM5715S 0x1679 #defineBCOM_DEVICEID_BCM5717 0x1655 +#defineBCOM_DEVICEID_BCM5717C 0x1665 #defineBCOM_DEVICEID_BCM5718 0x1656 #defineBCOM_DEVICEID_BCM5719 0x1657 #defineBCOM_DEVICEID_BCM5720_PP0x1658 /* Not released to public. */ ___ svn-src-all@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"
svn commit: r301847 - stable/10/contrib/hyperv/tools
Author: sephe Date: Mon Jun 13 02:54:58 2016 New Revision: 301847 URL: https://svnweb.freebsd.org/changeset/base/301847 Log: MFC 293653 hyperv/kvp_daemon: Make poll(2) block indefinitely Submitted by: Jun Su Reviewed by:Dexuan Cui , me, adrain Approved by:adrian Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D4762 Modified: stable/10/contrib/hyperv/tools/hv_kvp_daemon.c Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/hyperv/tools/hv_kvp_daemon.c == --- stable/10/contrib/hyperv/tools/hv_kvp_daemon.c Mon Jun 13 01:33:02 2016(r301846) +++ stable/10/contrib/hyperv/tools/hv_kvp_daemon.c Mon Jun 13 02:54:58 2016(r301847) @@ -1437,7 +1437,7 @@ main(int argc, char *argv[]) for (;;) { - r = poll (hv_kvp_poll_fd, 1, 100); + r = poll (hv_kvp_poll_fd, 1, INFTIM); KVP_LOG(LOG_DEBUG, "poll returned r = %d, revent = 0x%x\n", r, hv_kvp_poll_fd[0].revents); ___ svn-src-all@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"
svn commit: r301846 - head/lib/libusb
Author: hselasky Date: Mon Jun 13 01:33:02 2016 New Revision: 301846 URL: https://svnweb.freebsd.org/changeset/base/301846 Log: Fix compile warning. Approved by: re (delphij) MFC after:1 week Modified: head/lib/libusb/libusb10_desc.c Modified: head/lib/libusb/libusb10_desc.c == --- head/lib/libusb/libusb10_desc.c Mon Jun 13 00:13:20 2016 (r301845) +++ head/lib/libusb/libusb10_desc.c Mon Jun 13 01:33:02 2016 (r301846) @@ -332,7 +332,7 @@ libusb_get_string_descriptor_ascii(libus if (libusb20_dev_req_string_simple_sync(pdev, desc_index, data, length) == 0) - return (strlen(data)); + return (strlen((char *)data)); return (LIBUSB_ERROR_OTHER); } ___ svn-src-all@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"
svn commit: r301845 - head/sys/dev/iwm
Author: adrian Date: Mon Jun 13 00:13:20 2016 New Revision: 301845 URL: https://svnweb.freebsd.org/changeset/base/301845 Log: [iwm] Fix up busdma use in the RX path When allocating a new mbuf or bus_dmamap_load()-ing it fails, we can just keep the old mbuf since we are dropping that packet anyway. Instead of doing bus_dmamap_create() and bus_dmamap_destroy() all the time, create an extra bus_dmamap_t which we can use to safely try bus_dmamap_load()-ing the new mbuf. On success we just swap the spare bus_dmamap_t with the data->map of that ring entry. Tested: Tested with Intel AC7260, verified with vmstat -m that new kernel no longer visibly leaks memory from the M_DEVBUF malloc type. Before, leakage was 1KB every few seconds while ping(8)-ing over the wlan connection. Submitted by: Imre VadaszApproved by: re@ Obtained from:DragonflyBSD.git cc440b26818b5dfdd9af504d71c1b0e6522b53ef Differential Revision:https://reviews.freebsd.org/D6742 Modified: head/sys/dev/iwm/if_iwm.c head/sys/dev/iwm/if_iwmvar.h Modified: head/sys/dev/iwm/if_iwm.c == --- head/sys/dev/iwm/if_iwm.c Mon Jun 13 00:03:55 2016(r301844) +++ head/sys/dev/iwm/if_iwm.c Mon Jun 13 00:13:20 2016(r301845) @@ -866,10 +866,28 @@ iwm_alloc_rx_ring(struct iwm_softc *sc, goto fail; } + /* Allocate spare bus_dmamap_t for iwm_rx_addbuf() */ + error = bus_dmamap_create(ring->data_dmat, 0, >spare_map); + if (error != 0) { + device_printf(sc->sc_dev, + "%s: could not create RX buf DMA map, error %d\n", + __func__, error); + goto fail; + } /* * Allocate and map RX buffers. */ for (i = 0; i < IWM_RX_RING_COUNT; i++) { + struct iwm_rx_data *data = >data[i]; + error = bus_dmamap_create(ring->data_dmat, 0, >map); + if (error != 0) { + device_printf(sc->sc_dev, + "%s: could not create RX buf DMA map, error %d\n", + __func__, error); + goto fail; + } + data->m = NULL; + if ((error = iwm_rx_addbuf(sc, IWM_RBUF_SIZE, i)) != 0) { goto fail; } @@ -923,6 +941,10 @@ iwm_free_rx_ring(struct iwm_softc *sc, s data->map = NULL; } } + if (ring->spare_map != NULL) { + bus_dmamap_destroy(ring->data_dmat, ring->spare_map); + ring->spare_map = NULL; + } if (ring->data_dmat != NULL) { bus_dma_tag_destroy(ring->data_dmat); ring->data_dmat = NULL; @@ -2119,6 +2141,7 @@ iwm_rx_addbuf(struct iwm_softc *sc, int struct iwm_rx_ring *ring = >rxq; struct iwm_rx_data *data = >data[idx]; struct mbuf *m; + bus_dmamap_t dmamap = NULL; int error; bus_addr_t paddr; @@ -2126,28 +2149,26 @@ iwm_rx_addbuf(struct iwm_softc *sc, int if (m == NULL) return ENOBUFS; - if (data->m != NULL) - bus_dmamap_unload(ring->data_dmat, data->map); - m->m_len = m->m_pkthdr.len = m->m_ext.ext_size; - error = bus_dmamap_create(ring->data_dmat, 0, >map); - if (error != 0) { - device_printf(sc->sc_dev, - "%s: could not create RX buf DMA map, error %d\n", - __func__, error); - goto fail; - } - data->m = m; - error = bus_dmamap_load(ring->data_dmat, data->map, - mtod(data->m, void *), IWM_RBUF_SIZE, iwm_dma_map_addr, + error = bus_dmamap_load(ring->data_dmat, ring->spare_map, + mtod(m, void *), IWM_RBUF_SIZE, iwm_dma_map_addr, , BUS_DMA_NOWAIT); if (error != 0 && error != EFBIG) { device_printf(sc->sc_dev, - "%s: can't not map mbuf, error %d\n", __func__, - error); + "%s: can't map mbuf, error %d\n", __func__, error); goto fail; } + + if (data->m != NULL) + bus_dmamap_unload(ring->data_dmat, data->map); + + /* Swap ring->spare_map with data->map */ + dmamap = data->map; + data->map = ring->spare_map; + ring->spare_map = dmamap; + bus_dmamap_sync(ring->data_dmat, data->map, BUS_DMASYNC_PREREAD); + data->m = m; /* Update RX descriptor. */ ring->desc[idx] = htole32(paddr >> 8); @@ -2156,6 +2177,7 @@ iwm_rx_addbuf(struct iwm_softc *sc, int return 0; fail: + m_free(m); return error; } Modified: head/sys/dev/iwm/if_iwmvar.h == ---
svn commit: r301844 - head/lib/libcasper/libcasper
Author: oshogbo Date: Mon Jun 13 00:03:55 2016 New Revision: 301844 URL: https://svnweb.freebsd.org/changeset/base/301844 Log: Don't close fd if it's lower then stderr, otherwise we can close one of the descriptor which we just set. Pointed out by: jilles Approved by: re (hrs) Modified: head/lib/libcasper/libcasper/service.c Modified: head/lib/libcasper/libcasper/service.c == --- head/lib/libcasper/libcasper/service.c Sun Jun 12 23:34:48 2016 (r301843) +++ head/lib/libcasper/libcasper/service.c Mon Jun 13 00:03:55 2016 (r301844) @@ -360,7 +360,8 @@ stdnull(void) if (dup2(fd, STDERR_FILENO) == -1) errx(1, "Unable to cover stderr"); - close(fd); + if (fd > STDERR_FILENO) + close(fd); } static void ___ svn-src-all@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"
svn commit: r301843 - head/contrib/blacklist/libexec
Author: lidl Date: Sun Jun 12 23:34:48 2016 New Revision: 301843 URL: https://svnweb.freebsd.org/changeset/base/301843 Log: Add ipfilter support to blacklistd-helper In addition to adding initial support for the ipfilter packet filtering system, wrap a few long lines, perform whitespace cleanup and sync with upstream changes made in NetBSD. Submitted by: cy Reviewed by: cy Approved by: re (hrs) Relnotes: YES Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D6823 Modified: head/contrib/blacklist/libexec/blacklistd-helper Modified: head/contrib/blacklist/libexec/blacklistd-helper == --- head/contrib/blacklist/libexec/blacklistd-helperSun Jun 12 23:26:38 2016(r301842) +++ head/contrib/blacklist/libexec/blacklistd-helperSun Jun 12 23:34:48 2016(r301843) @@ -10,12 +10,6 @@ # $7 id pf= -for f in npf pf; do - if [ -f "/etc/$f.conf" ]; then - pf="$f" - break - fi -done if [ -f "/etc/ipfw-blacklist.rc" ]; then pf="ipfw" . /etc/ipfw-blacklist.rc @@ -23,6 +17,15 @@ if [ -f "/etc/ipfw-blacklist.rc" ]; then fi if [ -z "$pf" ]; then + for f in npf pf ipf; do + if [ -f "/etc/$f.conf" ]; then + pf="$f" + break + fi + done +fi + +if [ -z "$pf" ]; then echo "$0: Unsupported packet filter" 1>&2 exit 1 fi @@ -48,12 +51,20 @@ esac case "$1" in add) case "$pf" in + ipf) + /sbin/ipfstat -io | /sbin/ipf -I -f - >/dev/null 2>&1 + echo block in quick $proto from $addr/$mask to \ + any port=$6 head port$6 | \ + /sbin/ipf -I -f - -s >/dev/null 2>&1 + ;; ipfw) - rule=$(( $ipfw_offset + $6 )) # use $ipfw_offset+$port for rule number + # use $ipfw_offset+$port for rule number + rule=$(($ipfw_offset + $6)) tname="port$6" /sbin/ipfw table $tname create type addr 2>/dev/null /sbin/ipfw -q table $tname add "$addr/$mask" - /sbin/ipfw -q add $rule drop $3 from "table("$tname")" to any dst-port $6 + /sbin/ipfw -q add $rule drop $3 from "table("$tname")" to \ + any dst-port $6 ;; npf) /sbin/npfctl rule "$2" add block in final $proto from \ @@ -69,6 +80,12 @@ add) ;; rem) case "$pf" in + ipf) + /sbin/ipfstat -io | /sbin/ipf -I -f - >/dev/null 2>&1 + echo block in quick $proto from $addr/$mask to \ + any port=$6 head port$6 | \ + /sbin/ipf -I -r -f - -s >/dev/null 2>&1 + ;; ipfw) /sbin/ipfw table "port$6" delete "$addr/$mask" 2>/dev/null ;; @@ -81,7 +98,10 @@ rem) esac ;; flush) - case "$pf" in + case "$pf" in + ipf) + /sbin/ipf -Z -I -Fi -s > /dev/null + ;; ipfw) /sbin/ipfw table "port$6" flush 2>/dev/null ;; ___ svn-src-all@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"
svn commit: r301842 - head/lib/libusb
Author: hselasky Date: Sun Jun 12 23:26:38 2016 New Revision: 301842 URL: https://svnweb.freebsd.org/changeset/base/301842 Log: Implement code to stop all USB endpoints before executing a USB device reset command, alternate setting command or set configuration command. Else LibUSB v1.0 will not re-open the endpoints which the kernel closes and the USB application might wait infinitely for transfers to complete. Approved by: re (hrs) MFC after:3 days Modified: head/lib/libusb/libusb10.c Modified: head/lib/libusb/libusb10.c == --- head/lib/libusb/libusb10.c Sun Jun 12 22:55:50 2016(r301841) +++ head/lib/libusb/libusb10.c Sun Jun 12 23:26:38 2016(r301842) @@ -51,6 +51,8 @@ #include "libusb.h" #include "libusb10.h" +#defineLIBUSB_NUM_SW_ENDPOINTS (16 * 4) + static pthread_mutex_t default_context_lock = PTHREAD_MUTEX_INITIALIZER; struct libusb_context *usbi_default_context = NULL; @@ -442,7 +444,7 @@ libusb_open(libusb_device *dev, libusb_d if (dev == NULL) return (LIBUSB_ERROR_INVALID_PARAM); - err = libusb20_dev_open(pdev, 16 * 4 /* number of endpoints */ ); + err = libusb20_dev_open(pdev, LIBUSB_NUM_SW_ENDPOINTS); if (err) { libusb_unref_device(dev); return (LIBUSB_ERROR_NO_MEM); @@ -1482,7 +1484,17 @@ libusb_cancel_transfer(struct libusb_tra UNEXPORTED void libusb10_cancel_all_transfer(libusb_device *dev) { - /* TODO */ + struct libusb20_device *pdev = dev->os_priv; + unsigned x; + + for (x = 0; x != LIBUSB_NUM_SW_ENDPOINTS; x++) { + struct libusb20_transfer *xfer; + + xfer = libusb20_tr_get_pointer(pdev, x); + if (xfer == NULL) + continue; + libusb20_tr_close(xfer); + } } uint16_t ___ svn-src-all@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"
svn commit: r301841 - head/sys/dev/dwc
Author: jmcneill Date: Sun Jun 12 22:55:50 2016 New Revision: 301841 URL: https://svnweb.freebsd.org/changeset/base/301841 Log: Fix an issue with multicast hash filters on Amlogic and Allwinner boards. For DWC_GMAC_ALT_DESC implementations, the multicast hash table has only 64 entries. Instead of 8 registers starting at 0x500, a pair of registers at 0x08 and 0x0c are used instead. Approved by: re (hrs) Submitted by: Guy YurModified: head/sys/dev/dwc/if_dwc.c head/sys/dev/dwc/if_dwc.h Modified: head/sys/dev/dwc/if_dwc.c == --- head/sys/dev/dwc/if_dwc.c Sun Jun 12 15:37:35 2016(r301840) +++ head/sys/dev/dwc/if_dwc.c Sun Jun 12 22:55:50 2016(r301841) @@ -587,14 +587,13 @@ dwc_setup_rxfilter(struct dwc_softc *sc) struct ifmultiaddr *ifma; struct ifnet *ifp; uint8_t *eaddr, val; - uint32_t crc, ffval, hashbit, hashreg, hi, lo, hash[8], hmask; + uint32_t crc, ffval, hashbit, hashreg, hi, lo, hash[8]; int nhash, i; DWC_ASSERT_LOCKED(sc); ifp = sc->ifp; nhash = sc->mactype == DWC_GMAC_ALT_DESC ? 2 : 8; - hmask = ((nhash << 5) - 1) | 0xf; /* * Set the multicast (group) filter hash. @@ -615,11 +614,10 @@ dwc_setup_rxfilter(struct dwc_softc *sc) ifma->ifma_addr), ETHER_ADDR_LEN); /* Take lower 8 bits and reverse it */ - val = bitreverse(~crc & 0xff) & hmask; + val = bitreverse(~crc & 0xff); if (sc->mactype == DWC_GMAC_ALT_DESC) - hashreg = (val >> 5) == 0; - else - hashreg = (val >> 5); + val >>= nhash; /* Only need lower 6 bits */ + hashreg = (val >> 5); hashbit = (val & 31); hash[hashreg] |= (1 << hashbit); } @@ -642,8 +640,13 @@ dwc_setup_rxfilter(struct dwc_softc *sc) WRITE4(sc, MAC_ADDRESS_LOW(0), lo); WRITE4(sc, MAC_ADDRESS_HIGH(0), hi); WRITE4(sc, MAC_FRAME_FILTER, ffval); - for (i = 0; i < nhash; i++) - WRITE4(sc, HASH_TABLE_REG(i), hash[i]); + if (sc->mactype == DWC_GMAC_ALT_DESC) { + WRITE4(sc, GMAC_MAC_HTLOW, hash[0]); + WRITE4(sc, GMAC_MAC_HTHIGH, hash[1]); + } else { + for (i = 0; i < nhash; i++) + WRITE4(sc, HASH_TABLE_REG(i), hash[i]); + } } static int Modified: head/sys/dev/dwc/if_dwc.h == --- head/sys/dev/dwc/if_dwc.h Sun Jun 12 15:37:35 2016(r301840) +++ head/sys/dev/dwc/if_dwc.h Sun Jun 12 22:55:50 2016(r301841) @@ -53,6 +53,8 @@ #define FRAME_FILTER_HMC (1 << 2) #define FRAME_FILTER_HUC (1 << 1) #define FRAME_FILTER_PR(1 << 0)/* All Incoming Frames */ +#defineGMAC_MAC_HTHIGH 0x08 +#defineGMAC_MAC_HTLOW 0x0c #defineGMII_ADDRESS0x10 #define GMII_ADDRESS_PA_MASK 0x1f/* Phy device */ #define GMII_ADDRESS_PA_SHIFT 11 ___ svn-src-all@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"
Re: svn commit: r300943 - in head: . lib/libc++ lib/libcxxrt share/mk
Hi Bryan, On 29.05.16 08:20, Bryan Drewery wrote: Author: bdrewery Date: Sun May 29 06:20:15 2016 New Revision: 300943 URL: https://svnweb.freebsd.org/changeset/base/300943 Log: GCC External: Revert r300886, r300904, r300917, r300918 The fix in r300873 is mostly enough. A fix for lib32 will be committed.separately. Did this commit already happen? I still suffer a broken buildworld on powerpc64 for 32-bit with internal tools. Unknown option -std=c++11... Thanks, Andreas ___ svn-src-all@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"
svn commit: r301839 - stable/10/sys/sys
Author: dim Date: Sun Jun 12 11:45:45 2016 New Revision: 301839 URL: https://svnweb.freebsd.org/changeset/base/301839 Log: MFC r300967: Stop exposing the C11 _Atomic() macro in , when compiling for C++. It clashes with the one in libc++'s header. (Previously, the _Atomic() macro was defined in , which is only for use with C11, but for various reasons it was moved to its current location in r251804.) Discussed with: bdrewery, ed Modified: stable/10/sys/sys/cdefs.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/sys/cdefs.h == --- stable/10/sys/sys/cdefs.h Sun Jun 12 11:13:38 2016(r301838) +++ stable/10/sys/sys/cdefs.h Sun Jun 12 11:45:45 2016(r301839) @@ -273,7 +273,8 @@ #define_Alignof(x) __alignof(x) #endif -#if !__has_extension(c_atomic) && !__has_extension(cxx_atomic) +#if !defined(__cplusplus) && !__has_extension(c_atomic) && \ +!__has_extension(cxx_atomic) /* * No native support for _Atomic(). Place object in structure to prevent * most forms of direct non-atomic access. ___ svn-src-all@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"
svn commit: r301838 - head/sys/compat/linprocfs
Author: kib Date: Sun Jun 12 11:13:38 2016 New Revision: 301838 URL: https://svnweb.freebsd.org/changeset/base/301838 Log: swap_dev_info() does not require Giant, so Giant locking around the loop in linprocfs_doswaps() is useless. List of the registered filesystems is protected by vfsconf_sx, not by the Giant. Adjust linprocfs_dofilesystems() correspondingly. Approved by: re (delphij), des (linprocfs maintainer) Sponsored by: The FreeBSD Foundation MFC after:1 week Modified: head/sys/compat/linprocfs/linprocfs.c Modified: head/sys/compat/linprocfs/linprocfs.c == --- head/sys/compat/linprocfs/linprocfs.c Sun Jun 12 08:32:39 2016 (r301837) +++ head/sys/compat/linprocfs/linprocfs.c Sun Jun 12 11:13:38 2016 (r301838) @@ -490,7 +490,6 @@ linprocfs_doswaps(PFS_FILL_ARGS) char devname[SPECNAMELEN + 1]; sbuf_printf(sb, "Filename\t\t\t\tType\t\tSize\tUsed\tPriority\n"); - mtx_lock(); for (n = 0; ; n++) { if (swap_dev_info(n, , devname, sizeof(devname)) != 0) break; @@ -504,7 +503,6 @@ linprocfs_doswaps(PFS_FILL_ARGS) sbuf_printf(sb, "/dev/%-34s unknown\t\t%jd\t%jd\t-1\n", devname, total, used); } - mtx_unlock(); return (0); } @@ -1326,13 +1324,13 @@ linprocfs_dofilesystems(PFS_FILL_ARGS) { struct vfsconf *vfsp; - mtx_lock(); + vfsconf_slock(); TAILQ_FOREACH(vfsp, , vfc_list) { if (vfsp->vfc_flags & VFCF_SYNTHETIC) sbuf_printf(sb, "nodev"); sbuf_printf(sb, "\t%s\n", vfsp->vfc_name); } - mtx_unlock(); + vfsconf_sunlock(); return(0); } ___ svn-src-all@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"
svn commit: r301837 - stable/9/contrib/top
Author: ngie Date: Sun Jun 12 08:32:39 2016 New Revision: 301837 URL: https://svnweb.freebsd.org/changeset/base/301837 Log: MFstable/10 r301836: MFC r300395: Silence top(1) compiler warnings The contrib/top code is no longer maintained upstream (last pulled 16 years ago). The K followed by the code spews -Wimplicit-int and -Wreturn-type warnings, amongst others. This silences 131 warnings with as little modification as possible by adding necessary return types, definitions, headers, and header guards, and missing header includes. The 5 warnings that remain are due to undeclared ncurses references. I didn't include curses.h and term.h because there are several local functions and macros that conflict with those definitions. Added: stable/9/contrib/top/commands.h - copied unchanged from r301836, stable/10/contrib/top/commands.h stable/9/contrib/top/username.h - copied unchanged from r301836, stable/10/contrib/top/username.h Modified: stable/9/contrib/top/commands.c stable/9/contrib/top/display.c stable/9/contrib/top/display.h stable/9/contrib/top/machine.h stable/9/contrib/top/screen.c stable/9/contrib/top/screen.h stable/9/contrib/top/top.c stable/9/contrib/top/top.h stable/9/contrib/top/username.c stable/9/contrib/top/utils.h stable/9/contrib/top/version.c Directory Properties: stable/9/ (props changed) stable/9/contrib/ (props changed) stable/9/contrib/top/ (props changed) Modified: stable/9/contrib/top/commands.c == --- stable/9/contrib/top/commands.c Sun Jun 12 05:57:42 2016 (r301836) +++ stable/9/contrib/top/commands.c Sun Jun 12 08:32:39 2016 (r301837) @@ -19,16 +19,21 @@ */ #include "os.h" -#include -#include -#include + #include #include +#include +#include +#include +#include + +#include "commands.h" #include "sigdesc.h" /* generated automatically */ #include "top.h" #include "boolean.h" #include "utils.h" +#include "machine.h" extern int errno; @@ -39,12 +44,15 @@ extern int overstrike; int err_compar(); char *err_string(); +static int str_adderr(char *str, int len, int err); +static int str_addarg(char *str, int len, char *arg, int first); /* * show_help() - display the help screen; invoked in response to * either 'h' or '?'. */ +void show_help() { @@ -123,6 +131,7 @@ register char *str; return(*str == '\0' ? NULL : str); } +int scanint(str, intp) char *str; @@ -262,6 +271,7 @@ char *err_string() * the string "str". */ +static int str_adderr(str, len, err) char *str; @@ -289,6 +299,7 @@ int err; * is set (indicating that a comma should NOT be added to the front). */ +static int str_addarg(str, len, arg, first) char *str; @@ -321,6 +332,7 @@ int first; * for sorting errors. */ +int err_compar(p1, p2) register struct errs *p1, *p2; @@ -339,6 +351,7 @@ register struct errs *p1, *p2; * error_count() - return the number of errors currently logged. */ +int error_count() { @@ -349,6 +362,7 @@ error_count() * show_errors() - display on stdout the current log of errors. */ +void show_errors() { Copied: stable/9/contrib/top/commands.h (from r301836, stable/10/contrib/top/commands.h) == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/contrib/top/commands.h Sun Jun 12 08:32:39 2016 (r301837, copy of r301836, stable/10/contrib/top/commands.h) @@ -0,0 +1,21 @@ +/* + * Top users/processes display for Unix + * Version 3 + * + * This program may be freely redistributed, + * but this entire comment MUST remain intact. + * + * Copyright (c) 1984, 1989, William LeFebvre, Rice University + * Copyright (c) 1989, 1990, 1992, William LeFebvre, Northwestern University + * Copyright (c) 2016, Randy Westlund + * + * $FreeBSD$ + */ +#ifndef COMMANDS_H +#define COMMANDS_H + +void show_errors(void); +interror_count(void); +void show_help(void); + +#endif /* COMMANDS_H */ Modified: stable/9/contrib/top/display.c == --- stable/9/contrib/top/display.c Sun Jun 12 05:57:42 2016 (r301836) +++ stable/9/contrib/top/display.c Sun Jun 12 08:32:39 2016 (r301837) @@ -29,9 +29,12 @@ */ #include "os.h" + +#include + #include #include -#include +#include #include "screen.h"/* interface to screen package */ #include "layout.h"/* defines for screen position layout */ @@ -56,7 +59,6 @@ static int display_width = MAX_COLS; #define lineindex(l) ((l)*display_width) -char *printable(); /* things initialized by display_init and used thruout */ @@ -239,6 +241,7 @@ struct statics *statics; return(lines); } +void