svn commit: r367630 - in head/sbin/nvmecontrol: . modules/wdc
Author: mav Date: Fri Nov 13 02:05:45 2020 New Revision: 367630 URL: https://svnweb.freebsd.org/changeset/base/367630 Log: Improve nvmecontrol error reporting. MFC after:1 week Sponsored by: iXsystems, Inc. Modified: head/sbin/nvmecontrol/comnd.c head/sbin/nvmecontrol/devlist.c head/sbin/nvmecontrol/firmware.c head/sbin/nvmecontrol/format.c head/sbin/nvmecontrol/identify.c head/sbin/nvmecontrol/logpage.c head/sbin/nvmecontrol/modules/wdc/wdc.c head/sbin/nvmecontrol/ns.c head/sbin/nvmecontrol/nvmecontrol.c head/sbin/nvmecontrol/nvmecontrol.h head/sbin/nvmecontrol/passthru.c head/sbin/nvmecontrol/perftest.c head/sbin/nvmecontrol/power.c head/sbin/nvmecontrol/reset.c head/sbin/nvmecontrol/resv.c head/sbin/nvmecontrol/sanitize.c Modified: head/sbin/nvmecontrol/comnd.c == --- head/sbin/nvmecontrol/comnd.c Fri Nov 13 01:53:59 2020 (r367629) +++ head/sbin/nvmecontrol/comnd.c Fri Nov 13 02:05:45 2020 (r367630) @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include "comnd.h" @@ -77,7 +78,7 @@ gen_usage(const struct cmd *t) SLIST_FOREACH(walker, &t->subcmd, link) { print_usage(walker); } - exit(1); + exit(EX_USAGE); } int @@ -158,7 +159,7 @@ arg_help(int argc __unused, char * const *argv, const fprintf(stderr, "%-30.30s - %s\n", buf, opts[i].descr); } } - exit(1); + exit(EX_USAGE); } static int @@ -188,10 +189,10 @@ arg_parse(int argc, char * const * argv, const struct n++; lopts = malloc((n + 2) * sizeof(struct option)); if (lopts == NULL) - err(1, "option memory"); + err(EX_OSERR, "option memory"); p = shortopts = malloc((2 * n + 3) * sizeof(char)); if (shortopts == NULL) - err(1, "shortopts memory"); + err(EX_OSERR, "shortopts memory"); idx = 0; for (i = 0; i < n; i++) { lopts[i].name = opts[i].long_arg; @@ -279,7 +280,7 @@ bad_arg: fprintf(stderr, "Bad value to --%s: %s\n", opts[idx].long_arg, optarg); free(lopts); free(shortopts); - exit(1); + exit(EX_USAGE); } /* @@ -301,7 +302,7 @@ cmd_load_dir(const char *dir __unused, cmd_load_cb_t c continue; asprintf(&path, "%s/%s", dir, dent->d_name); if (path == NULL) - err(1, "Can't malloc for path, giving up."); + err(EX_OSERR, "Can't malloc for path, giving up."); if ((h = dlopen(path, RTLD_NOW | RTLD_GLOBAL)) == NULL) warnx("Can't load %s: %s", path, dlerror()); else { Modified: head/sbin/nvmecontrol/devlist.c == --- head/sbin/nvmecontrol/devlist.c Fri Nov 13 01:53:59 2020 (r367629) +++ head/sbin/nvmecontrol/devlist.c Fri Nov 13 02:05:45 2020 (r367630) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include "nvmecontrol.h" @@ -102,12 +103,14 @@ devlist(const struct cmd *f, int argc, char *argv[]) continue; found++; - read_controller_data(fd, &cdata); + if (read_controller_data(fd, &cdata)) + continue; nvme_strvis(mn, cdata.mn, sizeof(mn), NVME_MODEL_NUMBER_LENGTH); printf("%6s: %s\n", name, mn); for (i = 0; i < cdata.nn; i++) { - read_namespace_data(fd, i + 1, &nsdata); + if (read_namespace_data(fd, i + 1, &nsdata)) + continue; if (nsdata.nsze == 0) continue; sprintf(name, "%s%d%s%d", NVME_CTRLR_PREFIX, ctrlr, @@ -124,7 +127,7 @@ devlist(const struct cmd *f, int argc, char *argv[]) if (found == 0) { printf("No NVMe controllers found.\n"); - exit(1); + exit(EX_UNAVAILABLE); } exit(0); Modified: head/sbin/nvmecontrol/firmware.c == --- head/sbin/nvmecontrol/firmware.cFri Nov 13 01:53:59 2020 (r367629) +++ head/sbin/nvmecontrol/firmware.cFri Nov 13 02:05:45 2020 (r367630) @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include "nvmecontrol.h" @@ -123,9 +124,9 @@ read_image_file(const char *path, void **buf, int32_t *buf = NULL; if ((fd = open(path, O_RDONLY)) < 0) - err(1, "unable to open '%s'", path); + err(EX_NOINP
svn commit: r367629 - head/sys/sys
Author: adrian Date: Fri Nov 13 01:53:59 2020 New Revision: 367629 URL: https://svnweb.freebsd.org/changeset/base/367629 Log: [malloc] quieten -Werror=missing-braces with malloc.h wth gcc-6.4 This sets off gcc-6.4 to spit out a 'error: missing braces around initializer' error when compiling this. Remove it as it isn't needed. Reviewed by: brooks Differential Revision: https://reviews.freebsd.org/D27183 Modified: head/sys/sys/malloc.h Modified: head/sys/sys/malloc.h == --- head/sys/sys/malloc.h Thu Nov 12 21:58:47 2020(r367628) +++ head/sys/sys/malloc.h Fri Nov 13 01:53:59 2020(r367629) @@ -147,7 +147,6 @@ struct malloc_type_header { .ks_next = NULL,\ .ks_version = M_VERSION,\ .ks_shortdesc = shortdesc, \ - .ks_mti = { 0 },\ } \ }; \ SYSINIT(type##_init, SI_SUB_KMEM, SI_ORDER_THIRD, malloc_init, \ ___ 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: r367626 - head/sys/geom/bde
On 11/12/20, Oliver Pinter wrote: > On Thursday, November 12, 2020, Mateusz Guzik wrote: > >> Author: mjg >> Date: Thu Nov 12 20:20:57 2020 >> New Revision: 367626 >> URL: https://svnweb.freebsd.org/changeset/base/367626 >> >> Log: >> gbde: replace malloc_last_fail with a kludge >> >> This facilitates removal of malloc_last_fail without really impacting >> anything. >> >> Modified: >> head/sys/geom/bde/g_bde_work.c >> >> Modified: head/sys/geom/bde/g_bde_work.c >> >> == >> --- head/sys/geom/bde/g_bde_work.c Thu Nov 12 20:20:43 2020 >> (r367625) >> +++ head/sys/geom/bde/g_bde_work.c Thu Nov 12 20:20:57 2020 >> (r367626) >> @@ -77,6 +77,20 @@ >> #include >> #include >> >> +/* >> + * FIXME: This used to call malloc_last_fail which in practice was >> almost >> + * guaranteed to return time_uptime even in face of severe memory >> shortage. >> + * As GBDE is the only consumer the kludge below was added to facilitate >> the >> + * removal with minimial changes. The code should be fixed to respond to >> memory >> + * pressure (e.g., by using lowmem eventhandler) instead. >> + */ >> +static int >> +g_bde_malloc_last_fail(void) >> +{ >> + >> + return (time_uptime); >> +} >> + > > > Previously malloc_last_fail returned a relatively small number - if i read > the code correctly: > > -int > -malloc_last_fail(void) > -{ > - > - return (time_uptime - t_malloc_fail); > -} > - > > >> static void g_bde_delete_sector(struct g_bde_softc *wp, struct >> g_bde_sector *sp); >> static struct g_bde_sector * g_bde_new_sector(struct g_bde_work *wp, >> u_int len); >> static void g_bde_release_keysector(struct g_bde_work *wp); >> @@ -210,7 +224,7 @@ g_bde_get_keysector(struct g_bde_work *wp) >> g_trace(G_T_TOPOLOGY, "g_bde_get_keysector(%p, %jd)", wp, >> (intmax_t)offset); >> sc = wp->softc; >> >> - if (malloc_last_fail() < g_bde_ncache) >> + if (g_bde_malloc_last_fail() < g_bde_ncache) >> g_bde_purge_sector(sc, -1); > > > And in this case, the semantic change renders all of these calls from alway > true to always false expression. > t_malloc_fail value was almost guaranteed to always be 0, so there is no actual change. The hack was put in place so that gbde does not stall work on malloc. gbde itself definitely needs love. > >> >> sp = TAILQ_FIRST(&sc->freelist); >> @@ -228,7 +242,7 @@ g_bde_get_keysector(struct g_bde_work *wp) >> if (sp->ref == 1) >> sp->owner = wp; >> } else { >> - if (malloc_last_fail() < g_bde_ncache) { >> + if (g_bde_malloc_last_fail() < g_bde_ncache) { >> TAILQ_FOREACH(sp, &sc->freelist, list) >> if (sp->ref == 0) >> break; >> @@ -311,7 +325,7 @@ g_bde_purge_sector(struct g_bde_softc *sc, int >> fractio >> if (fraction > 0) >> n = sc->ncache / fraction + 1; >> else >> - n = g_bde_ncache - malloc_last_fail(); >> + n = g_bde_ncache - g_bde_malloc_last_fail(); >> if (n < 0) >> return; >> if (n > sc->ncache) >> ___ >> 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" >> > -- Mateusz Guzik ___ 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: r367626 - head/sys/geom/bde
On Thursday, November 12, 2020, Mateusz Guzik wrote: > Author: mjg > Date: Thu Nov 12 20:20:57 2020 > New Revision: 367626 > URL: https://svnweb.freebsd.org/changeset/base/367626 > > Log: > gbde: replace malloc_last_fail with a kludge > > This facilitates removal of malloc_last_fail without really impacting > anything. > > Modified: > head/sys/geom/bde/g_bde_work.c > > Modified: head/sys/geom/bde/g_bde_work.c > > == > --- head/sys/geom/bde/g_bde_work.c Thu Nov 12 20:20:43 2020 > (r367625) > +++ head/sys/geom/bde/g_bde_work.c Thu Nov 12 20:20:57 2020 > (r367626) > @@ -77,6 +77,20 @@ > #include > #include > > +/* > + * FIXME: This used to call malloc_last_fail which in practice was almost > + * guaranteed to return time_uptime even in face of severe memory > shortage. > + * As GBDE is the only consumer the kludge below was added to facilitate > the > + * removal with minimial changes. The code should be fixed to respond to > memory > + * pressure (e.g., by using lowmem eventhandler) instead. > + */ > +static int > +g_bde_malloc_last_fail(void) > +{ > + > + return (time_uptime); > +} > + Previously malloc_last_fail returned a relatively small number - if i read the code correctly: -int -malloc_last_fail(void) -{ - - return (time_uptime - t_malloc_fail); -} - > static void g_bde_delete_sector(struct g_bde_softc *wp, struct > g_bde_sector *sp); > static struct g_bde_sector * g_bde_new_sector(struct g_bde_work *wp, > u_int len); > static void g_bde_release_keysector(struct g_bde_work *wp); > @@ -210,7 +224,7 @@ g_bde_get_keysector(struct g_bde_work *wp) > g_trace(G_T_TOPOLOGY, "g_bde_get_keysector(%p, %jd)", wp, > (intmax_t)offset); > sc = wp->softc; > > - if (malloc_last_fail() < g_bde_ncache) > + if (g_bde_malloc_last_fail() < g_bde_ncache) > g_bde_purge_sector(sc, -1); And in this case, the semantic change renders all of these calls from alway true to always false expression. > > sp = TAILQ_FIRST(&sc->freelist); > @@ -228,7 +242,7 @@ g_bde_get_keysector(struct g_bde_work *wp) > if (sp->ref == 1) > sp->owner = wp; > } else { > - if (malloc_last_fail() < g_bde_ncache) { > + if (g_bde_malloc_last_fail() < g_bde_ncache) { > TAILQ_FOREACH(sp, &sc->freelist, list) > if (sp->ref == 0) > break; > @@ -311,7 +325,7 @@ g_bde_purge_sector(struct g_bde_softc *sc, int fractio > if (fraction > 0) > n = sc->ncache / fraction + 1; > else > - n = g_bde_ncache - malloc_last_fail(); > + n = g_bde_ncache - g_bde_malloc_last_fail(); > if (n < 0) > return; > if (n > sc->ncache) > ___ > 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-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: r367628 - head/sys/netinet
Author: gnn Date: Thu Nov 12 21:58:47 2020 New Revision: 367628 URL: https://svnweb.freebsd.org/changeset/base/367628 Log: An earlier commit effectively turned out the fast forwading path due to its lack of support for ICMP redirects. The following commit adds redirects to the fastforward path, again allowing for decent forwarding performance in the kernel. Reviewed by: ae, melifaro Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate") Modified: head/sys/netinet/ip_fastfwd.c head/sys/netinet/ip_input.c head/sys/netinet/ip_var.h Modified: head/sys/netinet/ip_fastfwd.c == --- head/sys/netinet/ip_fastfwd.c Thu Nov 12 20:22:58 2020 (r367627) +++ head/sys/netinet/ip_fastfwd.c Thu Nov 12 21:58:47 2020 (r367628) @@ -111,6 +111,43 @@ __FBSDID("$FreeBSD$"); #include +#defineV_ipsendredirects VNET(ipsendredirects) + +static struct mbuf * +ip_redir_alloc(struct mbuf *m, struct nhop_object *nh, +struct ip *ip, in_addr_t *addr) +{ + struct mbuf *mcopy = m_gethdr(M_NOWAIT, m->m_type); + if (mcopy != NULL && !m_dup_pkthdr(mcopy, m, M_NOWAIT)) { + /* +* It's probably ok if the pkthdr dup fails (because +* the deep copy of the tag chain failed), but for now +* be conservative and just discard the copy since +* code below may some day want the tags. +*/ + m_free(mcopy); + return (NULL); + } + mcopy->m_len = min(ntohs(ip->ip_len), M_TRAILINGSPACE(mcopy)); + mcopy->m_pkthdr.len = mcopy->m_len; + m_copydata(m, 0, mcopy->m_len, mtod(mcopy, caddr_t)); + + if (nh != NULL && + ((nh->nh_flags & (NHF_REDIRECT|NHF_DEFAULT)) == 0)) { + struct in_ifaddr *nh_ia = (struct in_ifaddr *)(nh->nh_ifa); + u_long src = ntohl(ip->ip_src.s_addr); + + if (nh_ia != NULL && (src & nh_ia->ia_subnetmask) == nh_ia->ia_subnet) { + if (nh->nh_flags & NHF_GATEWAY) + *addr = nh->gw4_sa.sin_addr.s_addr; + else + *addr = ip->ip_dst.s_addr; + } + } + return (mcopy); +} + + static int ip_findroute(struct nhop_object **pnh, struct in_addr dest, struct mbuf *m) { @@ -156,13 +193,14 @@ ip_tryforward(struct mbuf *m) { struct ip *ip; struct mbuf *m0 = NULL; - struct nhop_object *nh; + struct nhop_object *nh = NULL; struct sockaddr_in dst; struct in_addr dest, odest, rtdest; uint16_t ip_len, ip_off; int error = 0; struct m_tag *fwd_tag = NULL; - + struct mbuf *mcopy = NULL; + struct in_addr redest; /* * Are we active and forwarding packets? */ @@ -387,6 +425,13 @@ passout: dst.sin_addr = dest; /* +* Handle redirect case. +*/ + redest.s_addr = 0; + if (V_ipsendredirects && (nh->nh_ifp == m->m_pkthdr.rcvif)) + mcopy = ip_redir_alloc(m, nh, ip, &redest.s_addr); + + /* * Check if packet fits MTU or if hardware will fragment for us */ if (ip_len <= nh->nh_mtu) { @@ -455,7 +500,16 @@ passout: IPSTAT_INC(ips_forward); IPSTAT_INC(ips_fastforward); } + + /* Send required redirect */ + if (mcopy != NULL) { + icmp_error(mcopy, ICMP_REDIRECT, ICMP_REDIRECT_HOST, redest.s_addr, 0); + mcopy = NULL; /* Freed by caller */ + } + consumed: + if (mcopy != NULL) + m_freem(mcopy); return NULL; drop: if (m) Modified: head/sys/netinet/ip_input.c == --- head/sys/netinet/ip_input.c Thu Nov 12 20:22:58 2020(r367627) +++ head/sys/netinet/ip_input.c Thu Nov 12 21:58:47 2020(r367628) @@ -111,8 +111,11 @@ SYSCTL_INT(_net_inet_ip, IPCTL_FORWARDING, forwarding, &VNET_NAME(ipforwarding), 0, "Enable IP forwarding between interfaces"); -VNET_DEFINE_STATIC(int, ipsendredirects) = 1; /* XXX */ -#defineV_ipsendredirects VNET(ipsendredirects) +/* + * Respond with an ICMP host redirect when we forward a packet out of + * the same interface on which it was received. See RFC 792. + */ +VNET_DEFINE(int, ipsendredirects) = 1; SYSCTL_INT(_net_inet_ip, IPCTL_SENDREDIRECTS, redirect, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(ipsendredirects), 0, "Enable sending IP redirects"); @@ -571,7 +574,7 @@ tooshort: * case skip another inbound firewall processing and update * ip pointer. */ - if (V_ipforwarding != 0 && V_ipsendredirects == 0 + if (V_ipforwarding != 0 #if defined(IPSEC) || defined(IPSEC_SUPPOR
svn commit: r367627 - in head/sys: kern sys
Author: mjg Date: Thu Nov 12 20:22:58 2020 New Revision: 367627 URL: https://svnweb.freebsd.org/changeset/base/367627 Log: malloc: retire malloc_last_fail The routine does not serve any practical purpose. Memory can be allocated in many other ways and most consumers pass the M_WAITOK flag, making malloc not fail in the first place. Reviewed by: markj Differential Revision:https://reviews.freebsd.org/D27143 Modified: head/sys/kern/kern_malloc.c head/sys/sys/malloc.h head/sys/sys/param.h Modified: head/sys/kern/kern_malloc.c == --- head/sys/kern/kern_malloc.c Thu Nov 12 20:20:57 2020(r367626) +++ head/sys/kern/kern_malloc.c Thu Nov 12 20:22:58 2020(r367627) @@ -231,11 +231,6 @@ static int sysctl_kern_mprof(SYSCTL_HANDLER_ARGS); static int sysctl_kern_malloc_stats(SYSCTL_HANDLER_ARGS); -/* - * time_uptime of the last malloc(9) failure (induced or real). - */ -static time_t t_malloc_fail; - #if defined(MALLOC_MAKE_FAILURES) || (MALLOC_DEBUG_MAXZONES > 1) static SYSCTL_NODE(_debug, OID_AUTO, malloc, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "Kernel malloc debugging options"); @@ -373,13 +368,6 @@ mtp_get_subzone(struct malloc_type *mtp) } #endif /* MALLOC_DEBUG_MAXZONES > 1 */ -int -malloc_last_fail(void) -{ - - return (time_uptime - t_malloc_fail); -} - /* * An allocation has succeeded -- update malloc type statistics for the * amount of bucket size. Occurs within a critical section so that the @@ -535,7 +523,6 @@ malloc_dbg(caddr_t *vap, size_t *sizep, struct malloc_ atomic_add_int(&malloc_nowait_count, 1); if ((malloc_nowait_count % malloc_failure_rate) == 0) { atomic_add_int(&malloc_failure_count, 1); - t_malloc_fail = time_uptime; *vap = NULL; return (EJUSTRETURN); } @@ -662,7 +649,6 @@ void * if (__predict_false(va == NULL)) { KASSERT((flags & M_WAITOK) == 0, ("malloc(M_WAITOK) returned NULL")); - t_malloc_fail = time_uptime; } #ifdef DEBUG_REDZONE if (va != NULL) @@ -730,7 +716,6 @@ malloc_domainset(size_t size, struct malloc_type *mtp, if (__predict_false(va == NULL)) { KASSERT((flags & M_WAITOK) == 0, ("malloc(M_WAITOK) returned NULL")); - t_malloc_fail = time_uptime; } #ifdef DEBUG_REDZONE if (va != NULL) @@ -761,7 +746,6 @@ malloc_exec(size_t size, struct malloc_type *mtp, int if (__predict_false(va == NULL)) { KASSERT((flags & M_WAITOK) == 0, ("malloc(M_WAITOK) returned NULL")); - t_malloc_fail = time_uptime; } #ifdef DEBUG_REDZONE if (va != NULL) @@ -791,7 +775,6 @@ malloc_domainset_exec(size_t size, struct malloc_type if (__predict_false(va == NULL)) { KASSERT((flags & M_WAITOK) == 0, ("malloc(M_WAITOK) returned NULL")); - t_malloc_fail = time_uptime; } #ifdef DEBUG_REDZONE if (va != NULL) Modified: head/sys/sys/malloc.h == --- head/sys/sys/malloc.h Thu Nov 12 20:20:57 2020(r367626) +++ head/sys/sys/malloc.h Thu Nov 12 20:22:58 2020(r367627) @@ -252,7 +252,6 @@ void*malloc_domainset_exec(size_t size, struct malloc struct domainset *ds, int flags) __malloc_like __result_use_check __alloc_size(1); void malloc_init(void *); -intmalloc_last_fail(void); void malloc_type_allocated(struct malloc_type *type, unsigned long size); void malloc_type_freed(struct malloc_type *type, unsigned long size); void malloc_type_list(malloc_type_list_func_t *, void *); Modified: head/sys/sys/param.h == --- head/sys/sys/param.hThu Nov 12 20:20:57 2020(r367626) +++ head/sys/sys/param.hThu Nov 12 20:22:58 2020(r367627) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1300128 /* Master, propagated to newvers */ +#define __FreeBSD_version 1300129 /* 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: r367625 - head/sys/dev/nvme
Author: mav Date: Thu Nov 12 20:20:43 2020 New Revision: 367625 URL: https://svnweb.freebsd.org/changeset/base/367625 Log: Fix panic if NVMe is detached before the intrhook call. MFC after:1 week Sponsored by: iXsystems, Inc. Modified: head/sys/dev/nvme/nvme.c head/sys/dev/nvme/nvme_ctrlr.c Modified: head/sys/dev/nvme/nvme.c == --- head/sys/dev/nvme/nvme.cThu Nov 12 20:02:48 2020(r367624) +++ head/sys/dev/nvme/nvme.cThu Nov 12 20:20:43 2020(r367625) @@ -139,9 +139,14 @@ nvme_attach(device_t dev) } int -nvme_detach (device_t dev) +nvme_detach(device_t dev) { struct nvme_controller *ctrlr = DEVICE2SOFTC(dev); + + if (ctrlr->config_hook.ich_arg != NULL) { + config_intrhook_disestablish(&ctrlr->config_hook); + ctrlr->config_hook.ich_arg = NULL; + } nvme_ctrlr_destruct(ctrlr, dev); return (0); Modified: head/sys/dev/nvme/nvme_ctrlr.c == --- head/sys/dev/nvme/nvme_ctrlr.c Thu Nov 12 20:02:48 2020 (r367624) +++ head/sys/dev/nvme/nvme_ctrlr.c Thu Nov 12 20:20:43 2020 (r367625) @@ -1135,6 +1135,7 @@ nvme_ctrlr_start_config_hook(void *arg) fail: nvme_ctrlr_fail(ctrlr); config_intrhook_disestablish(&ctrlr->config_hook); + ctrlr->config_hook.ich_arg = NULL; return; } @@ -1152,6 +1153,7 @@ fail: nvme_sysctl_initialize_ctrlr(ctrlr); config_intrhook_disestablish(&ctrlr->config_hook); + ctrlr->config_hook.ich_arg = NULL; ctrlr->is_initialized = 1; nvme_notify_new_controller(ctrlr); ___ 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: r367626 - head/sys/geom/bde
Author: mjg Date: Thu Nov 12 20:20:57 2020 New Revision: 367626 URL: https://svnweb.freebsd.org/changeset/base/367626 Log: gbde: replace malloc_last_fail with a kludge This facilitates removal of malloc_last_fail without really impacting anything. Modified: head/sys/geom/bde/g_bde_work.c Modified: head/sys/geom/bde/g_bde_work.c == --- head/sys/geom/bde/g_bde_work.c Thu Nov 12 20:20:43 2020 (r367625) +++ head/sys/geom/bde/g_bde_work.c Thu Nov 12 20:20:57 2020 (r367626) @@ -77,6 +77,20 @@ #include #include +/* + * FIXME: This used to call malloc_last_fail which in practice was almost + * guaranteed to return time_uptime even in face of severe memory shortage. + * As GBDE is the only consumer the kludge below was added to facilitate the + * removal with minimial changes. The code should be fixed to respond to memory + * pressure (e.g., by using lowmem eventhandler) instead. + */ +static int +g_bde_malloc_last_fail(void) +{ + + return (time_uptime); +} + static void g_bde_delete_sector(struct g_bde_softc *wp, struct g_bde_sector *sp); static struct g_bde_sector * g_bde_new_sector(struct g_bde_work *wp, u_int len); static void g_bde_release_keysector(struct g_bde_work *wp); @@ -210,7 +224,7 @@ g_bde_get_keysector(struct g_bde_work *wp) g_trace(G_T_TOPOLOGY, "g_bde_get_keysector(%p, %jd)", wp, (intmax_t)offset); sc = wp->softc; - if (malloc_last_fail() < g_bde_ncache) + if (g_bde_malloc_last_fail() < g_bde_ncache) g_bde_purge_sector(sc, -1); sp = TAILQ_FIRST(&sc->freelist); @@ -228,7 +242,7 @@ g_bde_get_keysector(struct g_bde_work *wp) if (sp->ref == 1) sp->owner = wp; } else { - if (malloc_last_fail() < g_bde_ncache) { + if (g_bde_malloc_last_fail() < g_bde_ncache) { TAILQ_FOREACH(sp, &sc->freelist, list) if (sp->ref == 0) break; @@ -311,7 +325,7 @@ g_bde_purge_sector(struct g_bde_softc *sc, int fractio if (fraction > 0) n = sc->ncache / fraction + 1; else - n = g_bde_ncache - malloc_last_fail(); + n = g_bde_ncache - g_bde_malloc_last_fail(); if (n < 0) return; if (n > sc->ncache) ___ 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: r367624 - head/sys/dev/cxgbe/tom
Author: np Date: Thu Nov 12 20:02:48 2020 New Revision: 367624 URL: https://svnweb.freebsd.org/changeset/base/367624 Log: cxgbe/t4_tom: Handle VXLAN-encapsulated SYNs correctly. TCP SYNs in inner traffic will hit hardware listeners when VXLAN/NVGRE rx parsing is enabled in the chip. t4_tom should pass on these SYNs to the kernel and let it deal with them as if they arrived on the non-TOE path. Reported by: Sony at Chelsio MFC after:1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/tom/t4_listen.c Modified: head/sys/dev/cxgbe/tom/t4_listen.c == --- head/sys/dev/cxgbe/tom/t4_listen.c Thu Nov 12 19:25:31 2020 (r367623) +++ head/sys/dev/cxgbe/tom/t4_listen.c Thu Nov 12 20:02:48 2020 (r367624) @@ -1003,6 +1003,17 @@ t4opt_to_tcpopt(const struct tcp_options *t4opt, struc to->to_flags |= TOF_SACKPERM; } +static bool +encapsulated_syn(struct adapter *sc, const struct cpl_pass_accept_req *cpl) +{ + u_int hlen = be32toh(cpl->hdr_len); + + if (chip_id(sc) >= CHELSIO_T6) + return (G_T6_ETH_HDR_LEN(hlen) > sizeof(struct ether_vlan_header)); + else + return (G_ETH_HDR_LEN(hlen) > sizeof(struct ether_vlan_header)); +} + static void pass_accept_req_to_protohdrs(struct adapter *sc, const struct mbuf *m, struct in_conninfo *inc, struct tcphdr *th, uint8_t *iptos) @@ -1194,22 +1205,38 @@ do_pass_accept_req(struct sge_iq *iq, const struct rss CTR4(KTR_CXGBE, "%s: stid %u, tid %u, lctx %p", __func__, stid, tid, lctx); + /* +* Figure out the port the SYN arrived on. We'll look for an exact VI +* match in a bit but in case we don't find any we'll use the main VI as +* the incoming ifnet. +*/ + l2info = be16toh(cpl->l2info); + pi = sc->port[G_SYN_INTF(l2info)]; + hw_ifp = pi->vi[0].ifp; + m->m_pkthdr.rcvif = hw_ifp; + CURVNET_SET(lctx->vnet);/* before any potential REJECT */ /* +* If VXLAN/NVGRE parsing is enabled then SYNs in the inner traffic will +* also hit the listener. We don't want to offload those. +*/ + if (encapsulated_syn(sc, cpl)) { + REJECT_PASS_ACCEPT_REQ(true); + } + + /* * Use the MAC index to lookup the associated VI. If this SYN didn't * match a perfect MAC filter, punt. */ - l2info = be16toh(cpl->l2info); - pi = sc->port[G_SYN_INTF(l2info)]; if (!(l2info & F_SYN_XACT_MATCH)) { - REJECT_PASS_ACCEPT_REQ(false); + REJECT_PASS_ACCEPT_REQ(true); } for_each_vi(pi, v, vi) { if (vi->xact_addr_filt == G_SYN_MAC_IDX(l2info)) goto found; } - REJECT_PASS_ACCEPT_REQ(false); + REJECT_PASS_ACCEPT_REQ(true); found: hw_ifp = vi->ifp; /* the cxgbe ifnet */ m->m_pkthdr.rcvif = hw_ifp; ___ 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: r367623 - head/contrib/llvm-project/lld/ELF
Author: dim Date: Thu Nov 12 19:25:31 2020 New Revision: 367623 URL: https://svnweb.freebsd.org/changeset/base/367623 Log: Merge commit 8df4e6094 from llvm git (by Fangrui Song): [ELF] Don't consider SHF_ALLOC ".debug*" sections debug sections Fixes PR48071 * The Rust compiler produces SHF_ALLOC `.debug_gdb_scripts` (which normally does not have the flag) * `.debug_gdb_scripts` sections are removed from `inputSections` due to --strip-debug/--strip-all * When processing --gc-sections, pieces of a SHF_MERGE section can be marked live separately `=>` segfault when marking liveness of a `.debug_gdb_scripts` which is not split into pieces (because it is not in `inputSections`) This patch circumvents the problem by not treating SHF_ALLOC ".debug*" as debug sections (to prevent --strip-debug's stripping) (which is still useful on its own). Reviewed By: grimar Differential Revision: https://reviews.llvm.org/D91291 This should fix lld segfaulting when linking the rust-based parts of the devel/py-maturin port. Reported by: Nick Venenga PR: 250783 MFC after:3 days Modified: head/contrib/llvm-project/lld/ELF/InputSection.h Modified: head/contrib/llvm-project/lld/ELF/InputSection.h == --- head/contrib/llvm-project/lld/ELF/InputSection.hThu Nov 12 18:24:37 2020(r367622) +++ head/contrib/llvm-project/lld/ELF/InputSection.hThu Nov 12 19:25:31 2020(r367623) @@ -391,7 +391,8 @@ class InputSection : public InputSectionBase { (privat }; inline bool isDebugSection(const InputSectionBase &sec) { - return sec.name.startswith(".debug") || sec.name.startswith(".zdebug"); + return (sec.flags & llvm::ELF::SHF_ALLOC) == 0 && + (sec.name.startswith(".debug") || sec.name.startswith(".zdebug")); } // The list of all input sections. ___ 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: r367622 - in head/sys/dev/usb: . quirk
Author: hselasky Date: Thu Nov 12 18:24:37 2020 New Revision: 367622 URL: https://svnweb.freebsd.org/changeset/base/367622 Log: Add more USB quirks. PR: 230038 MFC after:1 week Sponsored by: Mellanox Technologies // NVIDIA Networking Modified: head/sys/dev/usb/quirk/usb_quirk.c head/sys/dev/usb/usbdevs Modified: head/sys/dev/usb/quirk/usb_quirk.c == --- head/sys/dev/usb/quirk/usb_quirk.c Thu Nov 12 17:28:29 2020 (r367621) +++ head/sys/dev/usb/quirk/usb_quirk.c Thu Nov 12 18:24:37 2020 (r367622) @@ -240,7 +240,9 @@ static struct usb_quirk_entry usb_quirks[USB_DEV_QUIRK USB_QUIRK(FREECOM, DVD, 0x, 0x, UQ_MSC_FORCE_PROTO_SCSI), USB_QUIRK(FUJIPHOTO, MASS0100, 0x, 0x, UQ_MSC_FORCE_WIRE_CBI_I, UQ_MSC_FORCE_PROTO_ATAPI, UQ_MSC_NO_RS_CLEAR_UA, UQ_MSC_NO_SYNC_CACHE), + USB_QUIRK(GARMIN, DAKOTA20, 0x, 0x, UQ_MSC_NO_INQUIRY), USB_QUIRK(GARMIN, FORERUNNER230, 0x, 0x, UQ_MSC_NO_INQUIRY), + USB_QUIRK(GARMIN, GPSMAP62S, 0x, 0x, UQ_MSC_NO_INQUIRY), USB_QUIRK(GENESYS, GL641USB2IDE, 0x, 0x, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_FORCE_SHORT_INQ, UQ_MSC_NO_START_STOP, UQ_MSC_IGNORE_RESIDUE, UQ_MSC_NO_SYNC_CACHE), Modified: head/sys/dev/usb/usbdevs == --- head/sys/dev/usb/usbdevsThu Nov 12 17:28:29 2020(r367621) +++ head/sys/dev/usb/usbdevsThu Nov 12 18:24:37 2020(r367622) @@ -2253,7 +2253,9 @@ product FUJITSU AH_F401U 0x105b AH-F401U Air H device product FUJITSUSIEMENS SCR 0x0009 Fujitsu-Siemens SCR USB Reader /* Garmin products */ +product GARMIN DAKOTA200x23c0 Dakota 20 product GARMIN FORERUNNER230 0x086d ForeRunner 230 +product GARMIN GPSMAP62S 0x2459 GPSMAP 62s product GARMIN IQUE_3600 0x0004 iQue 3600 /* Gemalto products */ ___ 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: r367621 - head/share/examples/mdoc
Author: 0mp (doc,ports committer) Date: Thu Nov 12 17:28:29 2020 New Revision: 367621 URL: https://svnweb.freebsd.org/changeset/base/367621 Log: Remove macros from the width arguments passed to Bl macros I've not removed the Er macro from one of the lists in example.9, however, because it seems to be doing some special kind of magic. Let's leave it there for now. Modified: head/share/examples/mdoc/example.1 head/share/examples/mdoc/example.3 head/share/examples/mdoc/example.4 head/share/examples/mdoc/example.9 Modified: head/share/examples/mdoc/example.1 == --- head/share/examples/mdoc/example.1 Thu Nov 12 17:26:19 2020 (r367620) +++ head/share/examples/mdoc/example.1 Thu Nov 12 17:28:29 2020 (r367621) @@ -47,7 +47,7 @@ It is intended that this example can be used as a temp when writing a new manual page. .Pp The options are as follows: -.Bl -tag -width ".Fl d Ar argument" +.Bl -tag -width "-d Ar argument" .It Fl a Example optional .Fl a @@ -76,7 +76,7 @@ command ignores the .Ev EXAMPLE environment variable. .Sh FILES -.Bl -tag -width ".Pa /dev/null" -compact +.Bl -tag -width "/dev/null" -compact .It Pa /dev/null Example of a file in the .Sx FILES Modified: head/share/examples/mdoc/example.3 == --- head/share/examples/mdoc/example.3 Thu Nov 12 17:26:19 2020 (r367620) +++ head/share/examples/mdoc/example.3 Thu Nov 12 17:28:29 2020 (r367621) @@ -57,7 +57,7 @@ and The argument .Fa mode may have one of the following values: -.Bl -tag -width ".Dv EXAMPLE_ONE" +.Bl -tag -width "EXAMPLE_ONE" .It Dv EXAMPLE_ONE First example of a defined variable. .Dv EXAMPLE_ONE @@ -86,7 +86,7 @@ library function ignores the .Ev EXAMPLE environment variable. .Sh FILES -.Bl -tag -width ".Pa /dev/null" -compact +.Bl -tag -width "/dev/null" -compact .It Pa /dev/null Example of a file in the .Sx FILES Modified: head/share/examples/mdoc/example.4 == --- head/share/examples/mdoc/example.4 Thu Nov 12 17:26:19 2020 (r367620) +++ head/share/examples/mdoc/example.4 Thu Nov 12 17:28:29 2020 (r367621) @@ -59,7 +59,7 @@ when writing a new manual page. The .Nm driver supports the following ioctls: -.Bl -tag -width ".Dv EIOCNULL" +.Bl -tag -width "EIOCNULL" .It Dv EIOCEX Example ioctl. .It Dv EIOCNULL Modified: head/share/examples/mdoc/example.9 == --- head/share/examples/mdoc/example.9 Thu Nov 12 17:26:19 2020 (r367620) +++ head/share/examples/mdoc/example.9 Thu Nov 12 17:28:29 2020 (r367621) @@ -54,7 +54,7 @@ and The argument .Fa mode may have one of the following values: -.Bl -tag -width ".Dv EXAMPLE_ONE" +.Bl -tag -width "EXAMPLE_ONE" .It Dv EXAMPLE_ONE First example of a defined variable. .Dv EXAMPLE_ONE ___ 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: r367619 - head/share/man/man9
Author: 0mp (doc,ports committer) Date: Thu Nov 12 16:44:56 2020 New Revision: 367619 URL: https://svnweb.freebsd.org/changeset/base/367619 Log: Add a missing period and remove a macro from Bl's width argument MFC after:3 days Modified: head/share/man/man9/VOP_RDWR.9 Modified: head/share/man/man9/VOP_RDWR.9 == --- head/share/man/man9/VOP_RDWR.9 Thu Nov 12 15:50:18 2020 (r367618) +++ head/share/man/man9/VOP_RDWR.9 Thu Nov 12 16:44:56 2020 (r367619) @@ -44,7 +44,7 @@ .Ft int .Fn VOP_WRITE "struct vnode *vp" "struct uio *uio" "int ioflag" "struct ucred *cred" .Sh DESCRIPTION -These entry points read or write the contents of a file +These entry points read or write the contents of a file. .Pp The arguments are: .Bl -tag -width ioflag @@ -66,7 +66,7 @@ read-ahead hint (in units of file system blocks) that should attempt. The low 16 bits are a bit mask which can contain the following flags: -.Bl -tag -width ".Dv IO_NODELOCKED" +.Bl -tag -width "IO_NODELOCKED" .It Dv IO_UNIT Do I/O as atomic unit. .It Dv IO_APPEND ___ 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: r367618 - head/sys/dev/md
Author: 0mp (doc,ports committer) Date: Thu Nov 12 15:50:18 2020 New Revision: 367618 URL: https://svnweb.freebsd.org/changeset/base/367618 Log: Fix a typo in a license comment Approved by: kaktus (src) Modified: head/sys/dev/md/md.c Modified: head/sys/dev/md/md.c == --- head/sys/dev/md/md.cThu Nov 12 15:00:48 2020(r367617) +++ head/sys/dev/md/md.cThu Nov 12 15:50:18 2020(r367618) @@ -13,7 +13,7 @@ */ /*- - * The following functions are based in the vn(4) driver: mdstart_swap(), + * The following functions are based on the vn(4) driver: mdstart_swap(), * mdstart_vnode(), mdcreate_swap(), mdcreate_vnode() and mddestroy(), * and as such under the following copyright: * ___ 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: r367617 - head/sys/dev/qat
Author: markj Date: Thu Nov 12 15:00:48 2020 New Revision: 367617 URL: https://svnweb.freebsd.org/changeset/base/367617 Log: qat: Fix nits reported by Coverity MFC after:3 days Sponsored by: Rubicon Communications, LLC (Netgate) Modified: head/sys/dev/qat/qat.c head/sys/dev/qat/qat_ae.c head/sys/dev/qat/qatvar.h Modified: head/sys/dev/qat/qat.c == --- head/sys/dev/qat/qat.c Thu Nov 12 14:04:08 2020(r367616) +++ head/sys/dev/qat/qat.c Thu Nov 12 15:00:48 2020(r367617) @@ -573,7 +573,8 @@ qat_detach(device_t dev) sc->sc_ih_cookie = NULL; } if (sc->sc_ih != NULL) { - (void)bus_release_resource(dev, SYS_RES_IRQ, i + 1, sc->sc_ih); + (void)bus_release_resource(dev, SYS_RES_IRQ, + sc->sc_hw.qhw_num_banks + 1, sc->sc_ih); sc->sc_ih = NULL; } pci_release_msi(dev); Modified: head/sys/dev/qat/qat_ae.c == --- head/sys/dev/qat/qat_ae.c Thu Nov 12 14:04:08 2020(r367616) +++ head/sys/dev/qat/qat_ae.c Thu Nov 12 15:00:48 2020(r367617) @@ -2616,7 +2616,7 @@ qat_aefw_suof_load(struct qat_softc *sc, struct qat_dm static int qat_aefw_suof_write(struct qat_softc *sc) { - struct qat_suof_image *qsi = NULL; + struct qat_suof_image *qsi; int i, error = 0; for (i = 0; i < sc->sc_aefw_suof.qafs_num_simgs; i++) { @@ -2626,21 +2626,20 @@ qat_aefw_suof_write(struct qat_softc *sc) if (error) return error; error = qat_aefw_auth(sc, &qsi->qsi_dma); - if (error) - goto fail; + if (error) { + qat_free_dmamem(sc, &qsi->qsi_dma); + return error; + } error = qat_aefw_suof_load(sc, &qsi->qsi_dma); - if (error) - goto fail; - + if (error) { + qat_free_dmamem(sc, &qsi->qsi_dma); + return error; + } qat_free_dmamem(sc, &qsi->qsi_dma); } qat_free_mem(sc->sc_aefw_suof.qafs_simg); return 0; -fail: - if (qsi != NULL) - qat_free_dmamem(sc, &qsi->qsi_dma); - return error; } static int Modified: head/sys/dev/qat/qatvar.h == --- head/sys/dev/qat/qatvar.h Thu Nov 12 14:04:08 2020(r367616) +++ head/sys/dev/qat/qatvar.h Thu Nov 12 15:00:48 2020(r367617) @@ -594,7 +594,7 @@ struct qat_crypto_desc { bus_addr_t qcd_desc_paddr; bus_addr_t qcd_hash_state_paddr; - enum fw_slice qcd_slices[MAX_FW_SLICE]; + enum fw_slice qcd_slices[MAX_FW_SLICE + 1]; enum fw_la_cmd_id qcd_cmd_id; enum hw_cipher_dir qcd_cipher_dir; ___ 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: r367616 - head/lib/libzstd
Author: manu Date: Thu Nov 12 14:04:08 2020 New Revision: 367616 URL: https://svnweb.freebsd.org/changeset/base/367616 Log: pkgbase: Move libprivatezstd from utilities to runtime libarchive depends on it by default and tar uses libarchive. So on a update : 1/ runtime contain tar 2/ runtime have libarchive in shlibs_required 3/ libarchive packages depends on utilities 4/ utilities depends on runtime 5/ kaboom All users of libprivatezstd (libarchive related stuff and objcopy/ar) are already in utilities. Discussed with: bapt Modified: head/lib/libzstd/Makefile Modified: head/lib/libzstd/Makefile == --- head/lib/libzstd/Makefile Thu Nov 12 09:26:01 2020(r367615) +++ head/lib/libzstd/Makefile Thu Nov 12 14:04:08 2020(r367616) @@ -40,6 +40,7 @@ CFLAGS+= -I${ZSTDDIR}/lib -I${ZSTDDIR}/lib/common -DXX LIBADD=pthread PRIVATELIB=yes +PACKAGE= runtime ZSTDDIR= ${SRCTOP}/sys/contrib/zstd .PATH: ${ZSTDDIR}/lib/common ${ZSTDDIR}/lib/compress \ ___ 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: r367615 - head/sys/dev/sound/usb
Author: hselasky Date: Thu Nov 12 09:26:01 2020 New Revision: 367615 URL: https://svnweb.freebsd.org/changeset/base/367615 Log: Add a tunable sysctl, hw.usb.uaudio.handle_hid, to allow disabling the the HID volume keys support in the USB audio driver. While at it re-organize the USB audio sysctls a bit. Differential Revision:https://reviews.freebsd.org/D27180 MFC after:1 week Sponsored by: Mellanox Technologies // NVIDIA Networking Modified: head/sys/dev/sound/usb/uaudio.c Modified: head/sys/dev/sound/usb/uaudio.c == --- head/sys/dev/sound/usb/uaudio.c Thu Nov 12 09:15:07 2020 (r367614) +++ head/sys/dev/sound/usb/uaudio.c Thu Nov 12 09:26:01 2020 (r367615) @@ -98,15 +98,12 @@ static int uaudio_default_rate = 0; /* use rate list static int uaudio_default_bits = 32; static int uaudio_default_channels = 0;/* use default */ static int uaudio_buffer_ms = 8; +static bool uaudio_handle_hid = true; -#ifdef USB_DEBUG -static int uaudio_debug; - static SYSCTL_NODE(_hw_usb, OID_AUTO, uaudio, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, "USB uaudio"); - -SYSCTL_INT(_hw_usb_uaudio, OID_AUTO, debug, CTLFLAG_RWTUN, -&uaudio_debug, 0, "uaudio debug level"); +SYSCTL_BOOL(_hw_usb_uaudio, OID_AUTO, handle_hid, CTLFLAG_RWTUN, +&uaudio_handle_hid, 0, "uaudio handles any HID volume/mute keys, if set"); SYSCTL_INT(_hw_usb_uaudio, OID_AUTO, default_rate, CTLFLAG_RWTUN, &uaudio_default_rate, 0, "uaudio default sample rate"); SYSCTL_INT(_hw_usb_uaudio, OID_AUTO, default_bits, CTLFLAG_RWTUN, @@ -138,6 +135,12 @@ SYSCTL_PROC(_hw_usb_uaudio, OID_AUTO, buffer_ms, CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, 0, sizeof(int), uaudio_buffer_ms_sysctl, "I", "uaudio buffering delay from 2ms to 8ms"); + +#ifdef USB_DEBUG +static int uaudio_debug; + +SYSCTL_INT(_hw_usb_uaudio, OID_AUTO, debug, CTLFLAG_RWTUN, +&uaudio_debug, 0, "uaudio debug level"); #else #defineuaudio_debug 0 #endif @@ -1116,10 +1119,12 @@ uaudio_attach(device_t dev) goto detach; } - if (uaudio_hid_probe(sc, uaa) == 0) { - device_printf(dev, "HID volume keys found.\n"); - } else { - device_printf(dev, "No HID volume keys found.\n"); + if (uaudio_handle_hid) { + if (uaudio_hid_probe(sc, uaa) == 0) { + device_printf(dev, "HID volume keys found.\n"); + } else { + device_printf(dev, "No HID volume keys found.\n"); + } } /* reload all mixer settings */ ___ 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: r367614 - head/sys/dev/usb/controller
Author: hselasky Date: Thu Nov 12 09:15:07 2020 New Revision: 367614 URL: https://svnweb.freebsd.org/changeset/base/367614 Log: When doing a USB alternate setting on an USB interface we need to re-configure the XHCI endpoint context. Differential Revision:https://reviews.freebsd.org/D27174 MFC after:1 week Sponsored by: Mellanox Technologies // NVIDIA Networking Modified: head/sys/dev/usb/controller/xhci.c Modified: head/sys/dev/usb/controller/xhci.c == --- head/sys/dev/usb/controller/xhci.c Thu Nov 12 02:52:01 2020 (r367613) +++ head/sys/dev/usb/controller/xhci.c Thu Nov 12 09:15:07 2020 (r367614) @@ -4020,6 +4020,9 @@ xhci_ep_init(struct usb_device *udev, struct usb_endpo struct usb_endpoint *ep) { struct xhci_endpoint_ext *pepext; + struct xhci_softc *sc; + uint8_t index; + uint8_t epno; DPRINTFN(2, "endpoint=%p, addr=%d, endpt=%d, mode=%d\n", ep, udev->address, edesc->bEndpointAddress, udev->flags.usb_mode); @@ -4036,6 +4039,18 @@ xhci_ep_init(struct usb_device *udev, struct usb_endpo USB_BUS_LOCK(udev->bus); pepext->trb_halted = 1; pepext->trb_running = 0; + + /* +* When doing an alternate setting, except for control +* endpoints, we need to re-configure the XHCI endpoint +* context: +*/ + if ((edesc->bEndpointAddress & UE_ADDR) != 0) { + sc = XHCI_BUS2SC(udev->bus); + index = udev->controller_slot_id; + epno = XHCI_EPNO2EPID(edesc->bEndpointAddress); + sc->sc_hw.devs[index].ep_configured &= ~(1U << epno); + } USB_BUS_UNLOCK(udev->bus); } ___ 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"