svn commit: r353030 - head/sys/netgraph
Author: glebius Date: Thu Oct 3 04:41:57 2019 New Revision: 353030 URL: https://svnweb.freebsd.org/changeset/base/353030 Log: Fix build failure from r353026. Somehow module build allowed this. Pointy hat to:glebius Modified: head/sys/netgraph/ng_bridge.c Modified: head/sys/netgraph/ng_bridge.c == --- head/sys/netgraph/ng_bridge.c Thu Oct 3 02:59:30 2019 (r353029) +++ head/sys/netgraph/ng_bridge.c Thu Oct 3 04:41:57 2019 (r353030) @@ -372,13 +372,14 @@ ng_bridge_newhook(node_p node, hook_p hook, const char * Receive a control message */ static int -ng_bridge_reset_link(hook_p hook, int ret) +ng_bridge_reset_link(hook_p hook, void *arg __unused) { link_p priv = NG_HOOK_PRIVATE(hook); priv->loopCount = 0; bzero(>stats, sizeof(priv->stats)); - return (ret); + + return (1); } @@ -429,7 +430,8 @@ ng_bridge_rcvmsg(node_p node, item_p item, hook_p last ng_bridge_remove_hosts(priv, NULL); /* Reset all loop detection counters and stats */ - NG_NODE_FOREACH_HOOK(node, ng_bridge_reset_link, 1, rethook); + NG_NODE_FOREACH_HOOK(node, ng_bridge_reset_link, NULL, + rethook); break; } case NGM_BRIDGE_GET_STATS: @@ -530,8 +532,9 @@ struct ng_bridge_send_ctx { }; static int -ng_bridge_send_ctx(hook_p dst, struct ng_bridge_send_ctx * ctx) +ng_bridge_send_ctx(hook_p dst, void *arg) { + struct ng_bridge_send_ctx *ctx = arg; link_p destLink = NG_HOOK_PRIVATE(dst); struct mbuf *m2 = NULL; int error = 0; @@ -959,11 +962,12 @@ ng_bridge_remove_hosts(priv_p priv, link_p link) * the hashtable whom we haven't heard from in a long while. */ static int -ng_bridge_unmute(hook_p hook, int *counter) +ng_bridge_unmute(hook_p hook, void *arg) { link_p link = NG_HOOK_PRIVATE(hook); node_p node = NG_HOOK_NODE(hook); priv_p priv = NG_NODE_PRIVATE(node); + int *counter = arg; if (link->loopCount != 0) { link->loopCount--; ___ 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: r353028 - releng/12.1/lib/libkvm
Author: karels Date: Thu Oct 3 02:51:48 2019 New Revision: 353028 URL: https://svnweb.freebsd.org/changeset/base/353028 Log: MFC r352867: Add support for ps -H on corefiles in libkvm Add support for kernel threads in kvm_getprocs() and the underlying kvm_proclist() in libkvm when fetching from a kernel core file. This has been missing/needed for several releases, when kernel threads became normal threads. The loop over the processes now contains a sub-loop for threads, which iterates beyond the first thread only when threads are requested. Also set some fields such as tid that were previously uninitialized. Approved by: re (gjb) Sponsored by: Forcepoint LLC Modified: releng/12.1/lib/libkvm/kvm_proc.c Directory Properties: releng/12.1/ (props changed) Modified: releng/12.1/lib/libkvm/kvm_proc.c == --- releng/12.1/lib/libkvm/kvm_proc.c Thu Oct 3 02:34:51 2019 (r353027) +++ releng/12.1/lib/libkvm/kvm_proc.c Thu Oct 3 02:51:48 2019 (r353028) @@ -67,6 +67,7 @@ __SCCSID("@(#)kvm_proc.c 8.3 (Berkeley) 9/23/93"); #include #include #include +#include #include #include #include @@ -130,13 +131,16 @@ kvm_proclist(kvm_t *kd, int what, int arg, struct proc struct proc pproc; struct sysentvec sysent; char svname[KI_EMULNAMELEN]; + struct thread *td = NULL; + bool first_thread; kp = _proc; kp->ki_structsize = sizeof(kinfo_proc); /* -* Loop on the processes. this is completely broken because we need to be -* able to loop on the threads and merge the ones that are the same process some how. +* Loop on the processes, then threads within the process if requested. */ + if (what == KERN_PROC_ALL) + what |= KERN_PROC_INC_THREAD; for (; cnt < maxcnt && p != NULL; p = LIST_NEXT(, p_list)) { memset(kp, 0, sizeof *kp); if (KREAD(kd, (u_long)p, )) { @@ -145,15 +149,6 @@ kvm_proclist(kvm_t *kd, int what, int arg, struct proc } if (proc.p_state == PRS_NEW) continue; - if (proc.p_state != PRS_ZOMBIE) { - if (KREAD(kd, (u_long)TAILQ_FIRST(_threads), - )) { - _kvm_err(kd, kd->program, - "can't read thread at %p", - TAILQ_FIRST(_threads)); - return (-1); - } - } if (KREAD(kd, (u_long)proc.p_ucred, ) == 0) { kp->ki_ruid = ucred.cr_ruid; kp->ki_svuid = ucred.cr_svuid; @@ -222,6 +217,7 @@ kvm_proclist(kvm_t *kd, int what, int arg, struct proc kp->ki_addr = 0;/* XXX uarea */ /* kp->ki_kstack = proc.p_thread.td_kstack; XXXKSE */ kp->ki_args = proc.p_args; + kp->ki_numthreads = proc.p_numthreads; kp->ki_tracep = proc.p_tracevp; kp->ki_textvp = proc.p_textvp; kp->ki_fd = proc.p_fd; @@ -285,9 +281,6 @@ kvm_proclist(kvm_t *kd, int what, int arg, struct proc kp->ki_sid = sess.s_sid; (void)memcpy(kp->ki_login, sess.s_login, sizeof(kp->ki_login)); - kp->ki_kiflag = sess.s_ttyvp ? KI_CTTY : 0; - if (sess.s_leader == p) - kp->ki_kiflag |= KI_SLEADER; if ((proc.p_flag & P_CONTROLT) && sess.s_ttyp != NULL) { if (KREAD(kd, (u_long)sess.s_ttyp, )) { _kvm_err(kd, kd->program, @@ -330,9 +323,6 @@ kvm_proclist(kvm_t *kd, int what, int arg, struct proc nopgrp: kp->ki_tdev = NODEV; } - if ((proc.p_state != PRS_ZOMBIE) && mtd.td_wmesg) - (void)kvm_read(kd, (u_long)mtd.td_wmesg, - kp->ki_wmesg, WMESGLEN); (void)kvm_read(kd, (u_long)proc.p_vmspace, (char *), sizeof(vmspace)); @@ -374,85 +364,127 @@ nopgrp: sizeof(svname)); if (svname[0] != 0) strlcpy(kp->ki_emul, svname, KI_EMULNAMELEN); - if ((proc.p_state != PRS_ZOMBIE) && - (mtd.td_blocked != 0)) { - kp->ki_kiflag |= KI_LOCKBLOCK; - if (mtd.td_lockname) - (void)kvm_read(kd, - (u_long)mtd.td_lockname, - kp->ki_lockname, LOCKNAMELEN); - kp->ki_lockname[LOCKNAMELEN] = 0; - } kp->ki_runtime = cputick2usec(proc.p_rux.rux_runtime);
svn commit: r353027 - head/sys/netgraph
Author: glebius Date: Thu Oct 3 02:34:51 2019 New Revision: 353027 URL: https://svnweb.freebsd.org/changeset/base/353027 Log: Protect access to seq->xwin[] with the seq mutex. MFC after:5 weeks Modified: head/sys/netgraph/ng_l2tp.c Modified: head/sys/netgraph/ng_l2tp.c == --- head/sys/netgraph/ng_l2tp.c Thu Oct 3 02:32:55 2019(r353026) +++ head/sys/netgraph/ng_l2tp.c Thu Oct 3 02:34:51 2019(r353027) @@ -1462,6 +1462,7 @@ ng_l2tp_seq_rack_timeout(node_p node, hook_p hook, voi /* Sanity check */ L2TP_SEQ_CHECK(seq); + mtx_lock(>mtx); priv->stats.xmitRetransmits++; /* Have we reached the retransmit limit? If so, notify owner. */ @@ -1482,7 +1483,9 @@ ng_l2tp_seq_rack_timeout(node_p node, hook_p hook, voi seq->acks = 0; /* Retransmit oldest unack'd packet */ - if ((m = L2TP_COPY_MBUF(seq->xwin[0], M_NOWAIT)) == NULL) + m = L2TP_COPY_MBUF(seq->xwin[0], M_NOWAIT); + mtx_unlock(>mtx); + if (m == NULL) priv->stats.memoryFailures++; else ng_l2tp_xmit_ctrl(priv, m, seq->ns++); ___ 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: r353026 - in head: share/man/man4 sys/netgraph
Author: glebius Date: Thu Oct 3 02:32:55 2019 New Revision: 353026 URL: https://svnweb.freebsd.org/changeset/base/353026 Log: - Remove the compile time limit for number of links a ng_bridge node can handle. Instead using an array on node private data, use per-hook private data. - Use NG_NODE_FOREACH_HOOK() to traverse through hooks instead of array. PR: 240787 Submitted by: Lutz Donnerhacke Differential Revision: https://reviews.freebsd.org/D21803 Modified: head/share/man/man4/ng_bridge.4 head/sys/netgraph/ng_bridge.c head/sys/netgraph/ng_bridge.h Modified: head/share/man/man4/ng_bridge.4 == --- head/share/man/man4/ng_bridge.4 Wed Oct 2 23:19:34 2019 (r353025) +++ head/share/man/man4/ng_bridge.4 Thu Oct 3 02:32:55 2019 (r353026) @@ -34,7 +34,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 5, 2010 +.Dd October 2, 2019 .Dt NG_BRIDGE 4 .Os .Sh NAME @@ -76,9 +76,7 @@ Processing of IP packets via the .Xr ipfirewall 4 mechanism on a per-link basis is not yet implemented. .Sh HOOKS -This node type supports up to -.Dv NG_BRIDGE_MAX_LINKS -hooks. +This node type supports an unlimited number of hooks. Each connected hook represents a bridged link. The hooks are named .Dv link0 , @@ -106,7 +104,6 @@ as an argument: .Bd -literal -offset 0n /* Node configuration structure */ struct ng_bridge_config { - u_char ipfw[NG_BRIDGE_MAX_LINKS]; /* enable ipfw */ u_char debugLevel; /* debug level */ uint32_tloopTimeout; /* link loopback mute time */ uint32_tmaxStaleness; /* max host age before nuking */ @@ -114,11 +111,6 @@ struct ng_bridge_config { }; .Ed .Pp -The -.Dv ipfw -array enables -.Xr ipfirewall 4 -processing of IP packets received on the corresponding links. The .Dv debugLevel field sets the debug level on the node. Modified: head/sys/netgraph/ng_bridge.c == --- head/sys/netgraph/ng_bridge.c Wed Oct 2 23:19:34 2019 (r353025) +++ head/sys/netgraph/ng_bridge.c Thu Oct 3 02:32:55 2019 (r353026) @@ -1,7 +1,3 @@ -/* - * ng_bridge.c - */ - /*- * Copyright (c) 2000 Whistle Communications, Inc. * All rights reserved. @@ -101,7 +97,6 @@ struct ng_bridge_link { /* Per-node private data */ struct ng_bridge_private { struct ng_bridge_bucket *tab; /* hash table bucket array */ - struct ng_bridge_link *links[NG_BRIDGE_MAX_LINKS]; struct ng_bridge_config conf; /* node configuration */ node_p node; /* netgraph node */ u_int numHosts; /* num entries in table */ @@ -132,9 +127,9 @@ static ng_disconnect_t ng_bridge_disconnect; /* Other internal functions */ static struct ng_bridge_host *ng_bridge_get(priv_p priv, const u_char *addr); -static int ng_bridge_put(priv_p priv, const u_char *addr, int linkNum); +static int ng_bridge_put(priv_p priv, const u_char *addr, link_p link); static voidng_bridge_rehash(priv_p priv); -static voidng_bridge_remove_hosts(priv_p priv, int linkNum); +static voidng_bridge_remove_hosts(priv_p priv, link_p link); static voidng_bridge_timeout(node_p node, hook_p hook, void *arg1, int arg2); static const char *ng_bridge_nodename(node_p node); @@ -142,9 +137,6 @@ static constchar *ng_bridge_nodename(node_p node); static const u_char ng_bridge_bcast_addr[ETHER_ADDR_LEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; -/* Store each hook's link number in the private field */ -#define LINK_NUM(hook) (*(u_int16_t *)(&(hook)->private)) - /* Compare Ethernet addresses using 32 and 16 bit words instead of bytewise */ #define ETHER_EQUAL(a,b) (((const u_int32_t *)(a))[0] \ == ((const u_int32_t *)(b))[0] \ @@ -200,16 +192,8 @@ static const struct ng_parse_type ng_bridge_host_ary_t }; /* Parse type for struct ng_bridge_config */ -static const struct ng_parse_fixedarray_info ng_bridge_ipfwary_type_info = { - _parse_uint8_type, - NG_BRIDGE_MAX_LINKS -}; -static const struct ng_parse_type ng_bridge_ipfwary_type = { - _parse_fixedarray_type, - _bridge_ipfwary_type_info -}; static const struct ng_parse_struct_field ng_bridge_config_type_fields[] - = NG_BRIDGE_CONFIG_TYPE_INFO(_bridge_ipfwary_type); + = NG_BRIDGE_CONFIG_TYPE_INFO; static const struct ng_parse_type ng_bridge_config_type = { _parse_struct_type, _bridge_config_type_fields @@ -352,26 +336,30 @@ ng_bridge_newhook(node_p node, hook_p hook, const char const priv_p priv = NG_NODE_PRIVATE(node); /* Check for a link hook */ - if (strncmp(name, NG_BRIDGE_HOOK_LINK_PREFIX, - strlen(NG_BRIDGE_HOOK_LINK_PREFIX)) == 0) { - const
svn commit: r353025 - head/usr.sbin/daemon
Author: ian Date: Wed Oct 2 23:19:34 2019 New Revision: 353025 URL: https://svnweb.freebsd.org/changeset/base/353025 Log: Bump .Dd for earlier update (should have been part of r353024). Modified: head/usr.sbin/daemon/daemon.8 Modified: head/usr.sbin/daemon/daemon.8 == --- head/usr.sbin/daemon/daemon.8 Wed Oct 2 23:06:17 2019 (r353024) +++ head/usr.sbin/daemon/daemon.8 Wed Oct 2 23:19:34 2019 (r353025) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 25, 2019 +.Dd October 2, 2019 .Dt DAEMON 8 .Os .Sh NAME ___ 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: r353024 - head/usr.sbin/daemon
Author: ian Date: Wed Oct 2 23:06:17 2019 New Revision: 353024 URL: https://svnweb.freebsd.org/changeset/base/353024 Log: Clarify how the -f option for daemon(8) interacts with other options related to redirecting stdout and stderr. Modified: head/usr.sbin/daemon/daemon.8 Modified: head/usr.sbin/daemon/daemon.8 == --- head/usr.sbin/daemon/daemon.8 Wed Oct 2 21:49:39 2019 (r353023) +++ head/usr.sbin/daemon/daemon.8 Wed Oct 2 23:06:17 2019 (r353024) @@ -63,6 +63,11 @@ Change the current working directory to the root .It Fl f Redirect standard input, standard output and standard error to .Pa /dev/null . +When this option is used together with any of the options related to file +or syslog output, the standard file descriptors are first redirected to +.Pa /dev/null , +then stdout and/or stderr is redirected to a file or to syslog as +specified by the other options. .It Fl S Enable syslog output. This is implicitly applied if other syslog parameters are provided. ___ 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: r352312 - in head: lib/geom/nop sys/geom/nop
On Wed, Oct 02, 2019 at 08:11:57AM -0600, Alan Somers wrote: > On Fri, Sep 13, 2019 at 5:04 PM Chuck Silvers wrote: > > > Author: chs > > Date: Fri Sep 13 23:03:56 2019 > > New Revision: 352312 > > URL: https://svnweb.freebsd.org/changeset/base/352312 > > > > Log: > > Add a "count_until_fail" option to gnop, which says to start failing > > I/O requests after the given number have been allowed though. > > > > Approved by:imp (mentor) > > Reviewed by:rpokala kib 0mp mckusick > > Sponsored by: Netflix > > Differential Revision: https://reviews.freebsd.org/D21593 > > > > Modified: > > head/lib/geom/nop/geom_nop.c > > head/lib/geom/nop/gnop.8 > > head/sys/geom/nop/g_nop.c > > head/sys/geom/nop/g_nop.h > > > > This patch introduces a backwards-compatibility bug. On a system with a > post-352312 kernel but a pre-352312 userland, the gnop command will always > fail with the error "gnop: Missing count_until_fail argument". > -Alan Thanks for pointing this out, I'll see about fixing it right away. -Chuck ___ 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: r353023 - head/sys/conf
Author: jhb Date: Wed Oct 2 21:49:39 2019 New Revision: 353023 URL: https://svnweb.freebsd.org/changeset/base/353023 Log: Fix the EMBEDFS_FORMAT helper variable for riscv64. It was defined with the wrong MACHINE_ARCH previously. This permits using an MFS image without defining MD_ROOT_SIZE which has various benefits (one being that the build is able to treat the MFS image as a dependency and properly re-link the kernel with the new image when building with NO_CLEAN). MFC after:2 weeks Sponsored by: DARPA Modified: head/sys/conf/kern.pre.mk Modified: head/sys/conf/kern.pre.mk == --- head/sys/conf/kern.pre.mk Wed Oct 2 21:35:39 2019(r353022) +++ head/sys/conf/kern.pre.mk Wed Oct 2 21:49:39 2019(r353023) @@ -322,7 +322,7 @@ EMBEDFS_FORMAT.mips?= elf32-tradbigmips EMBEDFS_FORMAT.mipsel?=elf32-tradlittlemips EMBEDFS_FORMAT.mips64?=elf64-tradbigmips EMBEDFS_FORMAT.mips64el?= elf64-tradlittlemips -EMBEDFS_FORMAT.riscv?= elf64-littleriscv +EMBEDFS_FORMAT.riscv64?= elf64-littleriscv .endif .endif ___ 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: r353022 - head/release/tools
Author: cperciva Date: Wed Oct 2 21:35:39 2019 New Revision: 353022 URL: https://svnweb.freebsd.org/changeset/base/353022 Log: Switch EC2 AMIs from using the dual-dhclient script to using the new dual-dhclient-daemon daemon. This makes it possible to stop/restart the dhclients. MFC after:1 month Modified: head/release/tools/ec2.conf Modified: head/release/tools/ec2.conf == --- head/release/tools/ec2.conf Wed Oct 2 21:01:23 2019(r353021) +++ head/release/tools/ec2.conf Wed Oct 2 21:35:39 2019(r353022) @@ -6,7 +6,7 @@ # Packages to install into the image we're creating. This is a deliberately # minimalist set, providing only the packages necessary to bootstrap further # package installation as specified via EC2 user-data. -export VM_EXTRA_PACKAGES="ec2-scripts firstboot-freebsd-update firstboot-pkgs dual-dhclient" +export VM_EXTRA_PACKAGES="ec2-scripts firstboot-freebsd-update firstboot-pkgs dual-dhclient-daemon" # Include the amazon-ssm-agent package in amd64 images, since some users want # to be able to use it on systems which are not connected to the Internet. ___ 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: r353021 - head/sys/kern
Author: emaste Date: Wed Oct 2 21:01:23 2019 New Revision: 353021 URL: https://svnweb.freebsd.org/changeset/base/353021 Log: simplify path handling in sysctl_try_reclaim_vnode MAXPATHLEN / PATH_MAX includes space for the terminating NUL, and namei verifies the presence of the NUL. Thus there is no need to increase the buffer size here. The sysctl passes the string excluding the NUL, so req->newlen equal to PATH_MAX is too long. Reviewed by: kib MFC after:1 week Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D21876 Modified: head/sys/kern/vfs_subr.c Modified: head/sys/kern/vfs_subr.c == --- head/sys/kern/vfs_subr.cWed Oct 2 19:13:35 2019(r353020) +++ head/sys/kern/vfs_subr.cWed Oct 2 21:01:23 2019(r353021) @@ -351,10 +351,10 @@ sysctl_try_reclaim_vnode(SYSCTL_HANDLER_ARGS) if (req->newptr == NULL) return (EINVAL); - if (req->newlen > PATH_MAX) + if (req->newlen >= PATH_MAX) return (E2BIG); - buf = malloc(PATH_MAX + 1, M_TEMP, M_WAITOK); + buf = malloc(PATH_MAX, M_TEMP, M_WAITOK); error = SYSCTL_IN(req, buf, req->newlen); if (error != 0) goto out; ___ 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: r353020 - head/sys/dev/nvdimm
Author: cem Date: Wed Oct 2 19:13:35 2019 New Revision: 353020 URL: https://svnweb.freebsd.org/changeset/base/353020 Log: nvdimm: Fix error path mis-free Regression introduced in r343629 when malloc result was renamed from spa to spa_mapping and the 'spa' name was instead used to iterate a table, but the free() target was not updated. Reviewed by: kib, scottph Sponsored by: Dell EMC Isilon Differential Revision:https://reviews.freebsd.org/D21871 Modified: head/sys/dev/nvdimm/nvdimm_acpi.c Modified: head/sys/dev/nvdimm/nvdimm_acpi.c == --- head/sys/dev/nvdimm/nvdimm_acpi.c Wed Oct 2 17:18:18 2019 (r353019) +++ head/sys/dev/nvdimm/nvdimm_acpi.c Wed Oct 2 19:13:35 2019 (r353020) @@ -141,7 +141,7 @@ nvdimm_root_create_spas(struct nvdimm_root_dev *dev, A error = nvdimm_spa_init(spa_mapping, *spa, spa_type); if (error != 0) { nvdimm_spa_fini(spa_mapping); - free(spa, M_NVDIMM_ACPI); + free(spa_mapping, M_NVDIMM_ACPI); break; } nvdimm_create_namespaces(spa_mapping, nfitbl); ___ 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: r352396 - stable/12/sys/arm64/arm64
On Wed, 2 Oct 2019 at 15:04, Ed Maste wrote: > > Will you merge this to releng/12.0? Oops, I meant 12.1, and it's already there. ___ 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: r352396 - stable/12/sys/arm64/arm64
On Mon, 16 Sep 2019 at 10:07, Andrew Turner wrote: > > Author: andrew > Date: Mon Sep 16 14:07:30 2019 > New Revision: 352396 > URL: https://svnweb.freebsd.org/changeset/base/352396 > > Log: > MFC r343876: > > Add missing data barriers after storeing a new valid pagetable entry. Will you merge this to releng/12.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"
Re: svn commit: r352925 - head/sys/dev/xen/control
-Original Message- From: Roger Pau Monné Date: 2019-10-02, Wednesday at 00:53 To: Ravi Pokala Cc: , , Subject: Re: svn commit: r352925 - head/sys/dev/xen/control On Tue, Oct 01, 2019 at 06:42:14PM -0700, Ravi Pokala wrote: > Hi Roger, > > If I'm understanding this diff correctly, all of (poweroff, reboot, suspend) will use the common string "shutdown", rather than an event-specific string. Is that what we want? I think there's some misunderstanding here. All power control events use the same xenstore node (~/control/shutdown), but the command read from it is different depending on the requested action (poweroff, reboot, halt...). Ah! Yes indeed, that was a misunderstanding on my part. I thought "shutdown" was the command text, rather than a component of the path containing the command. See [0] for a slightly more detailed description of the xenstore node. Note that this commit doesn't change any of this logic, it just clears the contents of ~/control/shutdown (by writing "") so the toolstack knows FreeBSD has acknowledged the request and it's processing it. Yes, that all makes sense. Thanks for clarifying! -Ravi (rpokala@) Roger. [0] http://xenbits.xen.org/docs/4.12-testing/misc/xenstore-paths.html#platform-feature-and-control-paths ___ 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: r353019 - head/share/mk
Author: kevans Date: Wed Oct 2 17:18:18 2019 New Revision: 353019 URL: https://svnweb.freebsd.org/changeset/base/353019 Log: Override the TLS model when building mips64 binaries and static libraries GCC uses "dynamic" TLS models when -fpic or -fPIC is explicitly specified on the command line (which is only true for shared libraries). It uses "static" (or "exec") TLS models otherwise. In particular, GCC does _not_ use dynamic TLS models when PIC is implicitly enabled (which it is on MIPS), only if a PIC flag is explicitly provided. llvm uses "dynamic" TLS models if PIC is enabled either via a PIC flag or if it is implicily enabled (as on MIPS64). This means that llvm on MIPS64 always uses "dynamic" TLS models. However, dynamic TLS models do not work for static binaries and libraries as the __tls_get_addr function they invoke is only defined in rtld. Written by: jhb Reviewed by: arichardson Differential Revision:https://reviews.freebsd.org/D21699 Modified: head/share/mk/bsd.lib.mk head/share/mk/bsd.prog.mk Modified: head/share/mk/bsd.lib.mk == --- head/share/mk/bsd.lib.mkWed Oct 2 17:15:38 2019(r353018) +++ head/share/mk/bsd.lib.mkWed Oct 2 17:18:18 2019(r353019) @@ -92,6 +92,12 @@ CXXFLAGS+= ${DEBUG_FILES_CFLAGS} CTFFLAGS+= -g .endif +# clang currently defaults to dynamic TLS for mips64 object files without -fPIC +.if ${MACHINE_ARCH:Mmips64*} && ${COMPILER_TYPE} == "clang" +STATIC_CFLAGS+= -ftls-model=initial-exec +STATIC_CXXFLAGS+= -ftls-model=initial-exec +.endif + .include # prefer .s to a .c, add .po, remove stuff not used in the BSD libraries Modified: head/share/mk/bsd.prog.mk == --- head/share/mk/bsd.prog.mk Wed Oct 2 17:15:38 2019(r353018) +++ head/share/mk/bsd.prog.mk Wed Oct 2 17:18:18 2019(r353019) @@ -82,6 +82,11 @@ TAG_ARGS=-T ${TAGS:[*]:S/ /,/g} LDFLAGS+= -static .endif +# clang currently defaults to dynamic TLS for mips64 binaries +.if ${MACHINE_ARCH:Mmips64*} && ${COMPILER_TYPE} == "clang" +CFLAGS+= -ftls-model=initial-exec +.endif + .if ${MK_DEBUG_FILES} != "no" PROG_FULL=${PROG}.full # Use ${DEBUGDIR} for base system debug files, else .debug subdirectory ___ 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: r353018 - head/usr.bin/clang
Author: kevans Date: Wed Oct 2 17:15:38 2019 New Revision: 353018 URL: https://svnweb.freebsd.org/changeset/base/353018 Log: clang: use -mxgot for 32-bit mips Various bits in usr.bin/clang/* will fail to compile without -mxgot due to truncated relocations. -mxgot entails a speed penalty, but I suspect we don't care as much about compiler performance in 32-bit mips land. Reviewed by: arichardson Differential Revision:https://reviews.freebsd.org/D21698 Modified: head/usr.bin/clang/Makefile.inc Modified: head/usr.bin/clang/Makefile.inc == --- head/usr.bin/clang/Makefile.inc Wed Oct 2 17:08:20 2019 (r353017) +++ head/usr.bin/clang/Makefile.inc Wed Oct 2 17:15:38 2019 (r353018) @@ -12,4 +12,9 @@ DEBUG_FILES_CFLAGS= -gline-tables-only DEBUG_FILES_CFLAGS= -g1 .endif +.if ${MACHINE_ARCH:Mmips*} && ${MACHINE_ARCH:Mmips64*} == "" +CFLAGS+= -mxgot +CXXFLAGS+= -mxgot +.endif + .include "../Makefile.inc" ___ 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: r353017 - head/sys/sparc64/include
Author: kevans Date: Wed Oct 2 17:08:20 2019 New Revision: 353017 URL: https://svnweb.freebsd.org/changeset/base/353017 Log: sparc64: use generic sub-word atomic *cmpset Most of this diff is refactoring to reduce duplication between the different acq_ and rel_ variants. Differential Revision:https://reviews.freebsd.org/D21822 Modified: head/sys/sparc64/include/atomic.h Modified: head/sys/sparc64/include/atomic.h == --- head/sys/sparc64/include/atomic.h Wed Oct 2 17:07:59 2019 (r353016) +++ head/sys/sparc64/include/atomic.h Wed Oct 2 17:08:20 2019 (r353017) @@ -48,6 +48,11 @@ #define__ASI_ATOMICASI_P #endif +static __inline int atomic_cmpset_8(__volatile uint8_t *, uint8_t, uint8_t); +static __inline int atomic_fcmpset_8(__volatile uint8_t *, uint8_t *, uint8_t); +static __inline int atomic_cmpset_16(__volatile uint16_t *, uint16_t, uint16_t); +static __inline int atomic_fcmpset_16(__volatile uint16_t *, uint16_t *, uint16_t); + /* * Various simple arithmetic on memory which is atomic in the presence * of interrupts and multiple processors. See atomic(9) for details. @@ -356,6 +361,68 @@ ATOMIC_GEN(64, uint64_t *, uint64_t, uint64_t, 64); ATOMIC_GEN(ptr, uintptr_t *, uintptr_t, uintptr_t, 64); +#defineATOMIC_CMPSET_ACQ_REL(WIDTH) \ +static __inline int \ +atomic_cmpset_acq_##WIDTH(__volatile uint##WIDTH##_t *p, \ +uint##WIDTH##_t cmpval, uint##WIDTH##_t newval)\ +{ \ + int retval; \ + \ + retval = atomic_cmpset_##WIDTH(p, cmpval, newval); \ + mb(); \ + return (retval);\ +} \ + \ +static __inline int \ +atomic_cmpset_rel_##WIDTH(__volatile uint##WIDTH##_t *p, \ +uint##WIDTH##_t cmpval, uint##WIDTH##_t newval)\ +{ \ + mb(); \ + return (atomic_cmpset_##WIDTH(p, cmpval, newval)); \ +} + +#defineATOMIC_FCMPSET_ACQ_REL(WIDTH) \ +static __inline int \ +atomic_fcmpset_acq_##WIDTH(__volatile uint##WIDTH##_t *p, \ +uint##WIDTH##_t *cmpval, uint##WIDTH##_t newval) \ +{ \ + int retval; \ + \ + retval = atomic_fcmpset_##WIDTH(p, cmpval, newval); \ + mb(); \ + return (retval);\ +} \ + \ +static __inline int \ +atomic_fcmpset_rel_##WIDTH(__volatile uint##WIDTH##_t *p, \ +uint##WIDTH##_t *cmpval, uint##WIDTH##_t newval) \ +{ \ + mb(); \ + return (atomic_fcmpset_##WIDTH(p, cmpval, newval)); \ +} + +/* + * Atomically compare the value stored at *p with cmpval and if the + * two values are equal, update the value of *p with newval. Returns + * zero if the compare failed, nonzero otherwise. + */ +ATOMIC_CMPSET_ACQ_REL(8); +ATOMIC_CMPSET_ACQ_REL(16); +ATOMIC_FCMPSET_ACQ_REL(8); +ATOMIC_FCMPSET_ACQ_REL(16); + +#defineatomic_cmpset_char atomic_cmpset_8 +#defineatomic_cmpset_acq_char atomic_cmpset_acq_8 +#defineatomic_cmpset_rel_char atomic_cmpset_rel_8 +#defineatomic_fcmpset_acq_char atomic_fcmpset_acq_8 +#defineatomic_fcmpset_rel_char atomic_fcmpset_rel_8 + +#defineatomic_cmpset_short atomic_cmpset_16 +#defineatomic_cmpset_acq_short atomic_cmpset_acq_16 +#defineatomic_cmpset_rel_short atomic_cmpset_rel_16 +#defineatomic_fcmpset_acq_shortatomic_fcmpset_acq_16 +#define
svn commit: r353016 - head/sys/mips/include
Author: kevans Date: Wed Oct 2 17:07:59 2019 New Revision: 353016 URL: https://svnweb.freebsd.org/changeset/base/353016 Log: mips: use generic sub-word atomic *cmpset Most of this diff is refactoring to reduce duplication between the different acq_ and rel_ variants. Differential Revision:https://reviews.freebsd.org/D21822 Modified: head/sys/mips/include/atomic.h Modified: head/sys/mips/include/atomic.h == --- head/sys/mips/include/atomic.h Wed Oct 2 17:06:28 2019 (r353015) +++ head/sys/mips/include/atomic.h Wed Oct 2 17:07:59 2019 (r353016) @@ -81,6 +81,11 @@ void atomic_clear_16(__volatile uint16_t *, uint16_t); void atomic_add_16(__volatile uint16_t *, uint16_t); void atomic_subtract_16(__volatile uint16_t *, uint16_t); +static __inline int atomic_cmpset_8(__volatile uint8_t *, uint8_t, uint8_t); +static __inline int atomic_fcmpset_8(__volatile uint8_t *, uint8_t *, uint8_t); +static __inline int atomic_cmpset_16(__volatile uint16_t *, uint16_t, uint16_t); +static __inline int atomic_fcmpset_16(__volatile uint16_t *, uint16_t *, uint16_t); + static __inline void atomic_set_32(__volatile uint32_t *p, uint32_t v) { @@ -376,23 +381,6 @@ atomic_cmpset_32(__volatile uint32_t *p, uint32_t cmpv * zero if the compare failed, nonzero otherwise. */ static __inline int -atomic_cmpset_acq_32(__volatile uint32_t *p, uint32_t cmpval, uint32_t newval) -{ - int retval; - - retval = atomic_cmpset_32(p, cmpval, newval); - mips_sync(); - return (retval); -} - -static __inline int -atomic_cmpset_rel_32(__volatile uint32_t *p, uint32_t cmpval, uint32_t newval) -{ - mips_sync(); - return (atomic_cmpset_32(p, cmpval, newval)); -} - -static __inline int atomic_fcmpset_32(__volatile uint32_t *p, uint32_t *cmpval, uint32_t newval) { int ret; @@ -422,24 +410,59 @@ atomic_fcmpset_32(__volatile uint32_t *p, uint32_t *cm return ret; } -static __inline int -atomic_fcmpset_acq_32(__volatile uint32_t *p, uint32_t *cmpval, uint32_t newval) -{ - int retval; - - retval = atomic_fcmpset_32(p, cmpval, newval); - mips_sync(); - return (retval); +#defineATOMIC_CMPSET_ACQ_REL(WIDTH) \ +static __inline int \ +atomic_cmpset_acq_##WIDTH(__volatile uint##WIDTH##_t *p, \ +uint##WIDTH##_t cmpval, uint##WIDTH##_t newval)\ +{ \ + int retval; \ + \ + retval = atomic_cmpset_##WIDTH(p, cmpval, newval); \ + mips_sync();\ + return (retval);\ +} \ + \ +static __inline int \ +atomic_cmpset_rel_##WIDTH(__volatile uint##WIDTH##_t *p, \ +uint##WIDTH##_t cmpval, uint##WIDTH##_t newval)\ +{ \ + mips_sync();\ + return (atomic_cmpset_##WIDTH(p, cmpval, newval)); \ } -static __inline int -atomic_fcmpset_rel_32(__volatile uint32_t *p, uint32_t *cmpval, uint32_t newval) -{ - mips_sync(); - return (atomic_fcmpset_32(p, cmpval, newval)); +#defineATOMIC_FCMPSET_ACQ_REL(WIDTH) \ +static __inline int \ +atomic_fcmpset_acq_##WIDTH(__volatile uint##WIDTH##_t *p, \ +uint##WIDTH##_t *cmpval, uint##WIDTH##_t newval) \ +{ \ + int retval; \ + \ + retval = atomic_fcmpset_##WIDTH(p, cmpval, newval); \ + mips_sync();\ + return (retval);\ +} \ + \ +static __inline int \ +atomic_fcmpset_rel_##WIDTH(__volatile uint##WIDTH##_t *p, \ +uint##WIDTH##_t *cmpval, uint##WIDTH##_t newval) \ +{ \ +
svn commit: r353015 - head/sys/sys
Author: kevans Date: Wed Oct 2 17:06:28 2019 New Revision: 353015 URL: https://svnweb.freebsd.org/changeset/base/353015 Log: Provide generic sub-word atomic *cmpset Provide *cmpset_{8,16} as wrappers around atomic_fcmpset_32. Initial users will be mips and sparc64, and perhaps parts of powerpc. This are not for general consumption; machine/atomic.h should include this header as needed to provide atomic_{,f}cmpset_{8,16} and machine/atomic.h should provide acq_ and rel_ variants. Reviewed by: jhibbits, kib Differential Revision:https://reviews.freebsd.org/D21822 Added: head/sys/sys/_atomic_subword.h (contents, props changed) Added: head/sys/sys/_atomic_subword.h == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/sys/_atomic_subword.h Wed Oct 2 17:06:28 2019 (r353015) @@ -0,0 +1,168 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 Kyle Evans + * + * 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, 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 AND CONTRIBUTORS ``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 OR CONTRIBUTORS 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. + * + * $FreeBSD$ + */ +#ifndef _SYS__ATOMIC_SUBWORD_H_ +#define_SYS__ATOMIC_SUBWORD_H_ + +/* + * This header is specifically for platforms that either do not have ways to or + * simply do not do sub-word atomic operations. These are not ideal as they + * require a little more effort to make sure our atomic operations are failing + * because of the bits of the word we're trying to write rather than the rest + * of the word. + */ +#ifndef _MACHINE_ATOMIC_H_ +#error do not include this header, use machine/atomic.h +#endif + +#include + +#ifndef NBBY +#defineNBBY8 +#endif + +#define_ATOMIC_WORD_ALIGNED(p) \ +(uint32_t *)((__uintptr_t)(p) - ((__uintptr_t)(p) % 4)) + +#if _BYTE_ORDER == _BIG_ENDIAN +#define_ATOMIC_BYTE_SHIFT(p) \ +((3 - ((__uintptr_t)(p) % 4)) * NBBY) + +#define_ATOMIC_HWORD_SHIFT(p) \ +((2 - ((__uintptr_t)(p) % 4)) * NBBY) +#else +#define_ATOMIC_BYTE_SHIFT(p) \ +__uintptr_t)(p) % 4)) * NBBY) + +#define_ATOMIC_HWORD_SHIFT(p) \ +__uintptr_t)(p) % 4)) * NBBY) +#endif + +/* + * Pass these bad boys a couple words and a mask of the bits you care about, + * they'll loop until we either succeed or fail because of those bits rather + * than the ones we're not masking. old and val should already be preshifted to + * the proper position. + */ +static __inline int +_atomic_cmpset_masked_word(uint32_t *addr, uint32_t old, uint32_t val, +uint32_t mask) +{ + int ret; + uint32_t wcomp; + + wcomp = old; + + /* +* We'll attempt the cmpset on the entire word. Loop here in case the +* operation fails due to the other half-word resident in that word, +* rather than the half-word we're trying to operate on. Ideally we +* only take one trip through here. We'll have to recalculate the old +* value since it's the other part of the word changing. +*/ + do { + old = (*addr & ~mask) | wcomp; + ret = atomic_fcmpset_32(addr, , (old & ~mask) | val); + } while (ret == 0 && (old & mask) == wcomp); + + return (ret); +} + +static __inline int +_atomic_fcmpset_masked_word(uint32_t *addr, uint32_t *old, uint32_t val, +uint32_t mask) +{ + + /* +* fcmpset_* is documented in atomic(9) to allow spurious failures where +* *old == val on ll/sc architectures because the sc may fail due to +* parallel writes or other reasons. We take advantage of that here +* and only attempt once, because the caller should be
svn commit: r353014 - head/sys/kern
Author: markj Date: Wed Oct 2 16:34:42 2019 New Revision: 353014 URL: https://svnweb.freebsd.org/changeset/base/353014 Log: Use OBJT_PHYS VM objects for kernel modules. OBJT_DEFAULT incurs some unnecessary overhead given that kernel module pages cannot be paged out. Reviewed by: alc, kib MFC after:1 week Sponsored by: Netflix Differential Revision:https://reviews.freebsd.org/D21862 Modified: head/sys/kern/link_elf.c head/sys/kern/link_elf_obj.c Modified: head/sys/kern/link_elf.c == --- head/sys/kern/link_elf.cWed Oct 2 16:18:50 2019(r353013) +++ head/sys/kern/link_elf.cWed Oct 2 16:34:42 2019(r353014) @@ -991,7 +991,7 @@ link_elf_load_file(linker_class_t cls, const char* fil ef = (elf_file_t) lf; #ifdef SPARSE_MAPPING - ef->object = vm_object_allocate(OBJT_DEFAULT, mapsize >> PAGE_SHIFT); + ef->object = vm_object_allocate(OBJT_PHYS, atop(mapsize)); if (ef->object == NULL) { error = ENOMEM; goto out; Modified: head/sys/kern/link_elf_obj.c == --- head/sys/kern/link_elf_obj.cWed Oct 2 16:18:50 2019 (r353013) +++ head/sys/kern/link_elf_obj.cWed Oct 2 16:34:42 2019 (r353014) @@ -774,8 +774,7 @@ link_elf_load_file(linker_class_t cls, const char *fil * This stuff needs to be in a single chunk so that profiling etc * can get the bounds and gdb can associate offsets with modules */ - ef->object = vm_object_allocate(OBJT_DEFAULT, - round_page(mapsize) >> PAGE_SHIFT); + ef->object = vm_object_allocate(OBJT_PHYS, atop(round_page(mapsize))); if (ef->object == NULL) { error = ENOMEM; goto out; ___ 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: r353012 - head/usr.sbin/bsdinstall/scripts
On Wed, Oct 02, 2019 at 10:13:01AM -0600, Ian Lepore wrote: > On Wed, 2019-10-02 at 16:09 +, Glen Barber wrote: > > Author: gjb > > Date: Wed Oct 2 16:09:28 2019 > > New Revision: 353012 > > URL: https://svnweb.freebsd.org/changeset/base/353012 > > > > Log: > > Add a comment explaining why the opensolaris_load line in loader.conf > > is explicitly added. > > > > Requested by: rgrimes > > MFC after:3 days > > MFC with: r353004 > > Sponsored by: Rubicon Communications, LLC (Netgate) > > > > Modified: > > head/usr.sbin/bsdinstall/scripts/config > > > > Modified: head/usr.sbin/bsdinstall/scripts/config > > == > > --- head/usr.sbin/bsdinstall/scripts/config Wed Oct 2 16:08:01 2019 > > (r353011) > > +++ head/usr.sbin/bsdinstall/scripts/config Wed Oct 2 16:09:28 2019 > > (r353012) > > @@ -44,6 +44,8 @@ cp $BSDINSTALL_TMPETC/* $BSDINSTALL_CHROOT/etc > > > > cat $BSDINSTALL_TMPBOOT/loader.conf.* >> $BSDINSTALL_TMPBOOT/loader.conf > > rm $BSDINSTALL_TMPBOOT/loader.conf.* > > +# The 'opensolaris_load' line is a workaround for arm64, which does not > > +# automatically load opensolaris.ko with zfs.ko. > > df -t zfs $BSDINSTALL_CHROOT > /dev/null && echo > > "opensolaris_load=\"YES\"" >> $BSDINSTALL_TMPBOOT/loader.conf > > df -t zfs $BSDINSTALL_CHROOT > /dev/null && echo "zfs_load=\"YES\"" >> > > $BSDINSTALL_TMPBOOT/loader.conf > > > > Is this our long-existing problem of not being able to run kldxref as > part of a cross build and install? Or is this some other arm64- > specific problem? > This is a good question. I do not see an error in the log when kldxref is invoked, but I am not certain if that necessarily means anything. Glen signature.asc Description: PGP signature
svn commit: r353013 - head/sys/modules/hptmv
Author: markj Date: Wed Oct 2 16:18:50 2019 New Revision: 353013 URL: https://svnweb.freebsd.org/changeset/base/353013 Log: Harmonize the hptmv blob's build rule with that of other hpt* drivers. No functional change intended. Reviewed by: emaste MFC after:1 week Differential Revision:https://reviews.freebsd.org/D21866 Modified: head/sys/modules/hptmv/Makefile Modified: head/sys/modules/hptmv/Makefile == --- head/sys/modules/hptmv/Makefile Wed Oct 2 16:09:28 2019 (r353012) +++ head/sys/modules/hptmv/Makefile Wed Oct 2 16:18:50 2019 (r353013) @@ -13,14 +13,8 @@ SRCS+= bus_if.h device_if.h pci_if.h SRCS+= mv.c entry.c ioctl.c hptproc.c gui_lib.c OBJS+= hptmvraid.o -.if $(MACHINE_CPUARCH) == "amd64" -HPTMV_RAID_O = amd64-elf.raid.o.uu -.else -HPTMV_RAID_O = i386-elf.raid.o.uu -.endif - -hptmvraid.o: ${HPTMV}/$(HPTMV_RAID_O) - uudecode -p < ${HPTMV}/$(HPTMV_RAID_O) > ${.TARGET} +hptmvraid.o: + uudecode -p < ${HPTMV}/${MACHINE_CPUARCH}-elf.raid.o.uu > ${.TARGET} # # Debug Options: ___ 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: r353012 - head/usr.sbin/bsdinstall/scripts
> On Wed, 2019-10-02 at 16:09 +, Glen Barber wrote: > > Author: gjb > > Date: Wed Oct 2 16:09:28 2019 > > New Revision: 353012 > > URL: https://svnweb.freebsd.org/changeset/base/353012 > > > > Log: > > Add a comment explaining why the opensolaris_load line in loader.conf > > is explicitly added. > > > > Requested by: rgrimes > > MFC after:3 days > > MFC with: r353004 > > Sponsored by: Rubicon Communications, LLC (Netgate) > > > > Modified: > > head/usr.sbin/bsdinstall/scripts/config > > > > Modified: head/usr.sbin/bsdinstall/scripts/config > > == > > --- head/usr.sbin/bsdinstall/scripts/config Wed Oct 2 16:08:01 2019 > > (r353011) > > +++ head/usr.sbin/bsdinstall/scripts/config Wed Oct 2 16:09:28 2019 > > (r353012) > > @@ -44,6 +44,8 @@ cp $BSDINSTALL_TMPETC/* $BSDINSTALL_CHROOT/etc > > > > cat $BSDINSTALL_TMPBOOT/loader.conf.* >> $BSDINSTALL_TMPBOOT/loader.conf > > rm $BSDINSTALL_TMPBOOT/loader.conf.* > > +# The 'opensolaris_load' line is a workaround for arm64, which does not > > +# automatically load opensolaris.ko with zfs.ko. > > df -t zfs $BSDINSTALL_CHROOT > /dev/null && echo > > "opensolaris_load=\"YES\"" >> $BSDINSTALL_TMPBOOT/loader.conf > > df -t zfs $BSDINSTALL_CHROOT > /dev/null && echo "zfs_load=\"YES\"" >> > > $BSDINSTALL_TMPBOOT/loader.conf > > > > Is this our long-existing problem of not being able to run kldxref as > part of a cross build and install? Or is this some other arm64- > specific problem? I think it boils down to that, though I have not re-investigated the issue since kldxref was fixed to run on arm64 (which was the orignal problem). -- Rod Grimes rgri...@freebsd.org ___ 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: r353012 - head/usr.sbin/bsdinstall/scripts
> Author: gjb > Date: Wed Oct 2 16:09:28 2019 > New Revision: 353012 > URL: https://svnweb.freebsd.org/changeset/base/353012 > > Log: > Add a comment explaining why the opensolaris_load line in loader.conf > is explicitly added. Thank you, Rod > > Requested by: rgrimes > MFC after: 3 days > MFC with: r353004 > Sponsored by: Rubicon Communications, LLC (Netgate) > > Modified: > head/usr.sbin/bsdinstall/scripts/config > > Modified: head/usr.sbin/bsdinstall/scripts/config > == > --- head/usr.sbin/bsdinstall/scripts/config Wed Oct 2 16:08:01 2019 > (r353011) > +++ head/usr.sbin/bsdinstall/scripts/config Wed Oct 2 16:09:28 2019 > (r353012) > @@ -44,6 +44,8 @@ cp $BSDINSTALL_TMPETC/* $BSDINSTALL_CHROOT/etc > > cat $BSDINSTALL_TMPBOOT/loader.conf.* >> $BSDINSTALL_TMPBOOT/loader.conf > rm $BSDINSTALL_TMPBOOT/loader.conf.* > +# The 'opensolaris_load' line is a workaround for arm64, which does not > +# automatically load opensolaris.ko with zfs.ko. > df -t zfs $BSDINSTALL_CHROOT > /dev/null && echo "opensolaris_load=\"YES\"" > >> $BSDINSTALL_TMPBOOT/loader.conf > df -t zfs $BSDINSTALL_CHROOT > /dev/null && echo "zfs_load=\"YES\"" >> > $BSDINSTALL_TMPBOOT/loader.conf > > -- Rod Grimes rgri...@freebsd.org ___ 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: r353012 - head/usr.sbin/bsdinstall/scripts
On Wed, 2019-10-02 at 16:09 +, Glen Barber wrote: > Author: gjb > Date: Wed Oct 2 16:09:28 2019 > New Revision: 353012 > URL: https://svnweb.freebsd.org/changeset/base/353012 > > Log: > Add a comment explaining why the opensolaris_load line in loader.conf > is explicitly added. > > Requested by: rgrimes > MFC after: 3 days > MFC with: r353004 > Sponsored by: Rubicon Communications, LLC (Netgate) > > Modified: > head/usr.sbin/bsdinstall/scripts/config > > Modified: head/usr.sbin/bsdinstall/scripts/config > == > --- head/usr.sbin/bsdinstall/scripts/config Wed Oct 2 16:08:01 2019 > (r353011) > +++ head/usr.sbin/bsdinstall/scripts/config Wed Oct 2 16:09:28 2019 > (r353012) > @@ -44,6 +44,8 @@ cp $BSDINSTALL_TMPETC/* $BSDINSTALL_CHROOT/etc > > cat $BSDINSTALL_TMPBOOT/loader.conf.* >> $BSDINSTALL_TMPBOOT/loader.conf > rm $BSDINSTALL_TMPBOOT/loader.conf.* > +# The 'opensolaris_load' line is a workaround for arm64, which does not > +# automatically load opensolaris.ko with zfs.ko. > df -t zfs $BSDINSTALL_CHROOT > /dev/null && echo "opensolaris_load=\"YES\"" > >> $BSDINSTALL_TMPBOOT/loader.conf > df -t zfs $BSDINSTALL_CHROOT > /dev/null && echo "zfs_load=\"YES\"" >> > $BSDINSTALL_TMPBOOT/loader.conf > Is this our long-existing problem of not being able to run kldxref as part of a cross build and install? Or is this some other arm64- specific problem? -- Ian ___ 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: r353012 - head/usr.sbin/bsdinstall/scripts
Author: gjb Date: Wed Oct 2 16:09:28 2019 New Revision: 353012 URL: https://svnweb.freebsd.org/changeset/base/353012 Log: Add a comment explaining why the opensolaris_load line in loader.conf is explicitly added. Requested by: rgrimes MFC after:3 days MFC with: r353004 Sponsored by: Rubicon Communications, LLC (Netgate) Modified: head/usr.sbin/bsdinstall/scripts/config Modified: head/usr.sbin/bsdinstall/scripts/config == --- head/usr.sbin/bsdinstall/scripts/config Wed Oct 2 16:08:01 2019 (r353011) +++ head/usr.sbin/bsdinstall/scripts/config Wed Oct 2 16:09:28 2019 (r353012) @@ -44,6 +44,8 @@ cp $BSDINSTALL_TMPETC/* $BSDINSTALL_CHROOT/etc cat $BSDINSTALL_TMPBOOT/loader.conf.* >> $BSDINSTALL_TMPBOOT/loader.conf rm $BSDINSTALL_TMPBOOT/loader.conf.* +# The 'opensolaris_load' line is a workaround for arm64, which does not +# automatically load opensolaris.ko with zfs.ko. df -t zfs $BSDINSTALL_CHROOT > /dev/null && echo "opensolaris_load=\"YES\"" >> $BSDINSTALL_TMPBOOT/loader.conf df -t zfs $BSDINSTALL_CHROOT > /dev/null && echo "zfs_load=\"YES\"" >> $BSDINSTALL_TMPBOOT/loader.conf ___ 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: r353011 - in head/usr.bin: killall split
Author: kan Date: Wed Oct 2 16:08:01 2019 New Revision: 353011 URL: https://svnweb.freebsd.org/changeset/base/353011 Log: Revert r352953: Convert pnmatch to single element array in regexec calls Requested by: cem Modified: head/usr.bin/killall/killall.c head/usr.bin/split/split.c Modified: head/usr.bin/killall/killall.c == --- head/usr.bin/killall/killall.c Wed Oct 2 15:45:49 2019 (r353010) +++ head/usr.bin/killall/killall.c Wed Oct 2 16:08:01 2019 (r353011) @@ -98,7 +98,7 @@ main(int ac, char **av) struct stat sb; struct passwd *pw; regex_t rgx; - regmatch_t pmatch[1]; + regmatch_t pmatch; int i, j, ch; charbuf[256]; charfirst; @@ -361,9 +361,9 @@ main(int ac, char **av) } } if (mflag) { - pmatch[0].rm_so = 0; - pmatch[0].rm_eo = strlen(thiscmd); - if (regexec(, thiscmd, 0, pmatch, + pmatch.rm_so = 0; + pmatch.rm_eo = strlen(thiscmd); + if (regexec(, thiscmd, 0, , REG_STARTEND) != 0) matched = 0; regfree(); @@ -387,9 +387,9 @@ main(int ac, char **av) } } if (mflag) { - pmatch[0].rm_so = 0; - pmatch[0].rm_eo = strlen(thiscmd); - if (regexec(, thiscmd, 0, pmatch, + pmatch.rm_so = 0; + pmatch.rm_eo = strlen(thiscmd); + if (regexec(, thiscmd, 0, , REG_STARTEND) == 0) matched = 1; regfree(); Modified: head/usr.bin/split/split.c == --- head/usr.bin/split/split.c Wed Oct 2 15:45:49 2019(r353010) +++ head/usr.bin/split/split.c Wed Oct 2 16:08:01 2019(r353011) @@ -281,11 +281,11 @@ split2(void) /* Check if we need to start a new file */ if (pflag) { - regmatch_t pmatch[1]; + regmatch_t pmatch; - pmatch[0].rm_so = 0; - pmatch[0].rm_eo = len - 1; - if (regexec(, bfr, 0, pmatch, REG_STARTEND) == 0) + pmatch.rm_so = 0; + pmatch.rm_eo = len - 1; + if (regexec(, bfr, 0, , REG_STARTEND) == 0) newfile(); } else if (lcnt++ == numlines) { newfile(); ___ 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: r353010 - head/sys/kern
Author: markj Date: Wed Oct 2 15:45:49 2019 New Revision: 353010 URL: https://svnweb.freebsd.org/changeset/base/353010 Log: Disallow fcntl(F_READAHEAD) when the vnode is not a regular file. The mountpoint may not have defined an iosize parameter, so an attempt to configure readahead on a device file can lead to a divide-by-zero crash. The sequential heuristic is not applied to I/O to or from device files, and posix_fadvise(2) returns an error when v_type != VREG, so perform the same check here. Reported by: syzbot+e4b682208761aa5bc...@syzkaller.appspotmail.com Reviewed by: kib MFC after:3 days Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D21864 Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c == --- head/sys/kern/kern_descrip.cWed Oct 2 15:19:39 2019 (r353009) +++ head/sys/kern/kern_descrip.cWed Oct 2 15:45:49 2019 (r353010) @@ -788,6 +788,12 @@ kern_fcntl(struct thread *td, int fd, int cmd, intptr_ break; } vp = fp->f_vnode; + if (vp->v_type != VREG) { + fdrop(fp, td); + error = ENOTTY; + break; + } + /* * Exclusive lock synchronizes against f_seqcount reads and * writes in sequential_heuristic(). ___ 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: r352953 - in head/usr.bin: killall split
> Hi Alexander, > > Coverity has millions of spurious warnings of this class and they're > basically all false positives. I think we should instead try to > figure out how to disable this class of warning on our codebase, since > it is largely incorrect. > > I would encourage reverting this change, because it uglies up the code > for no functional benefit. The code was correct before the change; > only Coverity was wrong. Again, I would like to suggest that a "working group", or team be formed that would be responsible for reviewing all Coverty/static analysis type fixes before they are committed to the tree? Simply a group of people that are willing to look at a code review in phabricator before a change is committed, to prevent exactly this type of issue. The team should consist of experts in static analysis or language contruction so that we catch these types of false positive fixes before they are committed to the tree. I also fully support Conrad in his assertion that we should start to find ways to silence Coverity on these false positives. Regards, Rod > > Best, > Conrad > > On Tue, Oct 1, 2019 at 11:15 PM Alexander Kabaev wrote: > > > > Author: kan > > Date: Wed Oct 2 06:15:30 2019 > > New Revision: 352953 > > URL: https://svnweb.freebsd.org/changeset/base/352953 > > > > Log: > > Convert pnmatch to single element array in regexec calls > > > > The regexec function is declared as taking an array of regmatch_t > > elements, and passing in the pointer to singleton element, while > > correct, triggers a Coverity warning. Convert the singleton into > > an array of one to silence the warning. > > > > Reported by: Coverity > > Coverity CID: 1009732, 1009733 > > MFC after:2 weeks > > > > Modified: > > head/usr.bin/killall/killall.c > > head/usr.bin/split/split.c > > > > Modified: head/usr.bin/killall/killall.c > > == > > --- head/usr.bin/killall/killall.c Wed Oct 2 02:37:34 2019 > > (r352952) > > +++ head/usr.bin/killall/killall.c Wed Oct 2 06:15:30 2019 > > (r352953) > > @@ -98,7 +98,7 @@ main(int ac, char **av) > > struct stat sb; > > struct passwd *pw; > > regex_t rgx; > > - regmatch_t pmatch; > > + regmatch_t pmatch[1]; > > int i, j, ch; > > charbuf[256]; > > charfirst; > > @@ -361,9 +361,9 @@ main(int ac, char **av) > > } > > } > > if (mflag) { > > - pmatch.rm_so = 0; > > - pmatch.rm_eo = strlen(thiscmd); > > - if (regexec(, thiscmd, 0, , > > + pmatch[0].rm_so = 0; > > + pmatch[0].rm_eo = strlen(thiscmd); > > + if (regexec(, thiscmd, 0, pmatch, > > REG_STARTEND) != 0) > > matched = 0; > > regfree(); > > @@ -387,9 +387,9 @@ main(int ac, char **av) > > } > > } > > if (mflag) { > > - pmatch.rm_so = 0; > > - pmatch.rm_eo = strlen(thiscmd); > > - if (regexec(, thiscmd, 0, , > > + pmatch[0].rm_so = 0; > > + pmatch[0].rm_eo = strlen(thiscmd); > > + if (regexec(, thiscmd, 0, pmatch, > > REG_STARTEND) == 0) > > matched = 1; > > regfree(); > > > > Modified: head/usr.bin/split/split.c > > == > > --- head/usr.bin/split/split.c Wed Oct 2 02:37:34 2019(r352952) > > +++ head/usr.bin/split/split.c Wed Oct 2 06:15:30 2019(r352953) > > @@ -281,11 +281,11 @@ split2(void) > > > > /* Check if we need to start a new file */ > > if (pflag) { > > - regmatch_t pmatch; > > + regmatch_t pmatch[1]; > > > > - pmatch.rm_so = 0; > > - pmatch.rm_eo = len - 1; > > - if (regexec(, bfr, 0, , REG_STARTEND) == > > 0) > > + pmatch[0].rm_so = 0; > > + pmatch[0].rm_eo = len - 1; > > + if (regexec(, bfr, 0, pmatch, REG_STARTEND) == > > 0) > > newfile(); > > } else if (lcnt++ == numlines) { > > newfile(); > -- Rod Grimes rgri...@freebsd.org
svn commit: r353009 - head/lib/libusb
Author: kevans Date: Wed Oct 2 15:19:39 2019 New Revision: 353009 URL: https://svnweb.freebsd.org/changeset/base/353009 Log: libusb: LIBUSB_DEBUG environment variable override of libusb_set_debug The debug level generally just controls verbosity of libusb for debugging libusb devices/usage. We allow the environment to set the debug level independent of the application, but the application will always override this if it explicitly sets the debug level. Changing the environment is easy, but patching the software to change the debug level isn't necessarily easy or possible. Further, there's this write-only debug_fixed variable that would seem to imply that the debug level should be fixed, but it isn't currently used. Change the logic to use strtol() so we can detect real 0 vs. conversion failure, then honor debug_fixed in libusb_set_debug. Reviewed by: hselasky MFC after:3 days Differential Revision:https://reviews.freebsd.org/D21877 Modified: head/lib/libusb/libusb10.c Modified: head/lib/libusb/libusb10.c == --- head/lib/libusb/libusb10.c Wed Oct 2 15:13:40 2019(r353008) +++ head/lib/libusb/libusb10.c Wed Oct 2 15:19:39 2019(r353009) @@ -91,7 +91,8 @@ void libusb_set_debug(libusb_context *ctx, int level) { ctx = GET_CONTEXT(ctx); - if (ctx) + /* debug_fixed is set when the environment overrides libusb_set_debug */ + if (ctx && ctx->debug_fixed == 0) ctx->debug = level; } @@ -132,7 +133,7 @@ libusb_init(libusb_context **context) { struct libusb_context *ctx; pthread_condattr_t attr; - char *debug; + char *debug, *ep; int ret; ctx = malloc(sizeof(*ctx)); @@ -143,9 +144,23 @@ libusb_init(libusb_context **context) debug = getenv("LIBUSB_DEBUG"); if (debug != NULL) { - ctx->debug = atoi(debug); - if (ctx->debug != 0) + /* +* If LIBUSB_DEBUG is set, we'll honor that and use it to +* override libusb_set_debug calls. +*/ + errno = 0; + ctx->debug = strtol(debug, , 10); + if (errno == 0 && *ep == '\0') { ctx->debug_fixed = 1; + } else { + /* +* LIBUSB_DEBUG conversion failed for some reason, but +* we don't care about the specifics all that much. We +* can't use it either way. Force it to the default, +* 0, in case we had a partial number. +*/ + ctx->debug = 0; + } } TAILQ_INIT(>pollfds); TAILQ_INIT(>tr_done); ___ 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: r353008 - head/sys/mips/include
Author: kevans Date: Wed Oct 2 15:13:40 2019 New Revision: 353008 URL: https://svnweb.freebsd.org/changeset/base/353008 Log: mips: fcmpset: do not spin on sc failure For ll/sc architectures, atomic(9) allows failure modes where *old == val due to write failure and callers should compensate for this. Do not retry on failure, just leave 0 in ret and fail the operation if we couldn't sc it. This lets the caller determine if it should retry or not. Reviewed by: kib Looks ok: imp Differential Revision:https://reviews.freebsd.org/D21836 Modified: head/sys/mips/include/atomic.h Modified: head/sys/mips/include/atomic.h == --- head/sys/mips/include/atomic.h Wed Oct 2 13:46:40 2019 (r353007) +++ head/sys/mips/include/atomic.h Wed Oct 2 15:13:40 2019 (r353008) @@ -397,18 +397,25 @@ atomic_fcmpset_32(__volatile uint32_t *p, uint32_t *cm { int ret; + /* +* The following sequence (similar to that in atomic_fcmpset_64) will +* attempt to update the value of *p with newval if the comparison +* succeeds. Note that they'll exit regardless of whether the store +* actually succeeded, leaving *cmpval untouched. This is in line with +* the documentation of atomic_fcmpset_() in atomic(9) for ll/sc +* architectures. +*/ __asm __volatile ( - "1:\n\t" "ll %0, %1\n\t" /* load old value */ - "bne%0, %4, 2f\n\t" /* compare */ + "bne%0, %4, 1f\n\t" /* compare */ "move %0, %3\n\t" /* value to store */ "sc %0, %1\n\t" /* attempt to store */ - "beqz %0, 1b\n\t" /* if it failed, spin */ - "j 3f\n\t" - "2:\n\t" + "j 2f\n\t" /* exit regardless of success */ + "nop\n\t" /* avoid delay slot accident */ + "1:\n\t" "sw %0, %2\n\t" /* save old value */ "li %0, 0\n\t" - "3:\n" + "2:\n" : "=" (ret), "+m" (*p), "=m" (*cmpval) : "r" (newval), "r" (*cmpval) : "memory"); @@ -508,17 +515,16 @@ atomic_fcmpset_64(__volatile uint64_t *p, uint64_t *cm int ret; __asm __volatile ( -"1:\n\t" "lld%0, %1\n\t" /* load old value */ -"bne %0, %4, 2f\n\t" /* compare */ +"bne %0, %4, 1f\n\t" /* compare */ "move %0, %3\n\t" /* value to store */ "scd %0, %1\n\t" /* attempt to store */ -"beqz %0, 1b\n\t" /* if it failed, spin */ -"j 3f\n\t" -"2:\n\t" + "j 2f\n\t" /* exit regardless of success */ + "nop\n\t" /* avoid delay slot accident */ +"1:\n\t" "sd%0, %2\n\t" /* save old value */ "li%0, 0\n\t" -"3:\n" +"2:\n" : "=" (ret), "+m" (*p), "=m" (*cmpval) : "r" (newval), "r" (*cmpval) : "memory"); ___ 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: r352938 - head/sys/arm/include
On Tue, Oct 01, 2019 at 01:53:05PM -0600, Ian Lepore wrote: > On Tue, 2019-10-01 at 22:49 +0300, Konstantin Belousov wrote: > > On Tue, Oct 01, 2019 at 07:39:00PM +, Ian Lepore wrote: > > > Author: ian > > > Date: Tue Oct 1 19:39:00 2019 > > > New Revision: 352938 > > > URL: https://svnweb.freebsd.org/changeset/base/352938 > > > > > > Log: > > > Add 8 and 16 bit versions of atomic_cmpset and atomic_fcmpset for arm. > > > > > > This adds 8 and 16 bit versions of the cmpset and fcmpset functions. > > > Macros > > > are used to generate all the flavors from the same set of instructions; > > > the > > > macro expansion handles the couple minor differences between each size > > > variation (generating ldrexb/ldrexh/ldrex for 8/16/32, etc). > > > > > > In addition to handling new sizes, the instruction sequences used for > > > cmpset > > > and fcmpset are rewritten to be a bit shorter/faster, and the new > > > sequence > > > will not return false when *dst==*old but the store-exclusive fails > > > because > > > of concurrent writers. Instead, it just loops like ldrex/strex sequences > > > normally do until it gets a non-conflicted store. The manpage allows > > > LL/SC > > > architectures to bogusly return false, but there's no reason to > > > actually do > > > so, at least on arm. > > > > The reason is to avoid nested loops. The outer control for retry was the > > initial design decision for fcmpset() comparing to cmpset(). casueword() > > also started following this approach after the fixes for ll/sc looping > > after the external control. > > If the implementation is forbidden from looping, then the manpage > should say so. What I commited meets the requirements currently stated > in the manpage. Until somebody explains to me why it is somehow > harmful to return the RIGHT information at a cost of either 0 or 1 > extra cpu cycle, it's staying the way it is. Implementation is not forbidden from looping, but looping definitely deteriorates the quality of the implementation. Problem with the loop is that the outer caller does not have control over the inner loop, while it is the outer caller who knows more about terminating conditions. I can only point out casueword(9) where inner looping is causing CVE-level issues. I do not believe that any of atomic(9) primitives on ll/sc machines cause the CVE for us right now (but casueword did). Note that even x86 does not use the comparision with dest, but rely on the CPU flag to provide the result (this is the closest analog of not looping for CAS). ___ 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: r352312 - in head: lib/geom/nop sys/geom/nop
On Fri, Sep 13, 2019 at 5:04 PM Chuck Silvers wrote: > Author: chs > Date: Fri Sep 13 23:03:56 2019 > New Revision: 352312 > URL: https://svnweb.freebsd.org/changeset/base/352312 > > Log: > Add a "count_until_fail" option to gnop, which says to start failing > I/O requests after the given number have been allowed though. > > Approved by:imp (mentor) > Reviewed by:rpokala kib 0mp mckusick > Sponsored by: Netflix > Differential Revision: https://reviews.freebsd.org/D21593 > > Modified: > head/lib/geom/nop/geom_nop.c > head/lib/geom/nop/gnop.8 > head/sys/geom/nop/g_nop.c > head/sys/geom/nop/g_nop.h > This patch introduces a backwards-compatibility bug. On a system with a post-352312 kernel but a pre-352312 userland, the gnop command will always fail with the error "gnop: Missing count_until_fail argument". -Alan ___ 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: r353007 - stable/11/sys/x86/x86
Author: kib Date: Wed Oct 2 13:46:40 2019 New Revision: 353007 URL: https://svnweb.freebsd.org/changeset/base/353007 Log: MFC r352684: x86: Fall back to leaf 0x16 if TSC frequency is obtained by CPUID and leaf 0x15 is not functional. Modified: stable/11/sys/x86/x86/tsc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/x86/x86/tsc.c == --- stable/11/sys/x86/x86/tsc.c Wed Oct 2 13:43:24 2019(r353006) +++ stable/11/sys/x86/x86/tsc.c Wed Oct 2 13:46:40 2019(r353007) @@ -130,7 +130,11 @@ tsc_freq_vmware(void) /* * Calculate TSC frequency using information from the CPUID leaf 0x15 - * 'Time Stamp Counter and Nominal Core Crystal Clock'. It should be + * 'Time Stamp Counter and Nominal Core Crystal Clock'. If leaf 0x15 + * is not functional, as it is on Skylake/Kabylake, try 0x16 'Processor + * Frequency Information'. Leaf 0x16 is described in the SDM as + * informational only, but if 0x15 did not work, and TSC calibration + * is disabled, it is the best we can get at all. It should still be * an improvement over the parsing of the CPU model name in * tsc_freq_intel(), when available. */ @@ -142,10 +146,20 @@ tsc_freq_cpuid(void) if (cpu_high < 0x15) return (false); do_cpuid(0x15, regs); - if (regs[0] == 0 || regs[1] == 0 || regs[2] == 0) + if (regs[0] != 0 && regs[1] != 0 && regs[2] != 0) { + tsc_freq = (uint64_t)regs[2] * regs[1] / regs[0]; + return (true); + } + + if (cpu_high < 0x16) return (false); - tsc_freq = (uint64_t)regs[2] * regs[1] / regs[0]; - return (true); + do_cpuid(0x16, regs); + if (regs[0] != 0) { + tsc_freq = (uint64_t)regs[0] * 100; + return (true); + } + + return (false); } 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: r353006 - stable/12/sys/x86/x86
Author: kib Date: Wed Oct 2 13:43:24 2019 New Revision: 353006 URL: https://svnweb.freebsd.org/changeset/base/353006 Log: MFC r352684: x86: Fall back to leaf 0x16 if TSC frequency is obtained by CPUID and leaf 0x15 is not functional. Modified: stable/12/sys/x86/x86/tsc.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/x86/x86/tsc.c == --- stable/12/sys/x86/x86/tsc.c Wed Oct 2 13:36:54 2019(r353005) +++ stable/12/sys/x86/x86/tsc.c Wed Oct 2 13:43:24 2019(r353006) @@ -133,7 +133,11 @@ tsc_freq_vmware(void) /* * Calculate TSC frequency using information from the CPUID leaf 0x15 - * 'Time Stamp Counter and Nominal Core Crystal Clock'. It should be + * 'Time Stamp Counter and Nominal Core Crystal Clock'. If leaf 0x15 + * is not functional, as it is on Skylake/Kabylake, try 0x16 'Processor + * Frequency Information'. Leaf 0x16 is described in the SDM as + * informational only, but if 0x15 did not work, and TSC calibration + * is disabled, it is the best we can get at all. It should still be * an improvement over the parsing of the CPU model name in * tsc_freq_intel(), when available. */ @@ -145,10 +149,20 @@ tsc_freq_cpuid(void) if (cpu_high < 0x15) return (false); do_cpuid(0x15, regs); - if (regs[0] == 0 || regs[1] == 0 || regs[2] == 0) + if (regs[0] != 0 && regs[1] != 0 && regs[2] != 0) { + tsc_freq = (uint64_t)regs[2] * regs[1] / regs[0]; + return (true); + } + + if (cpu_high < 0x16) return (false); - tsc_freq = (uint64_t)regs[2] * regs[1] / regs[0]; - return (true); + do_cpuid(0x16, regs); + if (regs[0] != 0) { + tsc_freq = (uint64_t)regs[0] * 100; + return (true); + } + + return (false); } 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: r353005 - releng/12.1/sys/dev/vt
Author: avg Date: Wed Oct 2 13:36:54 2019 New Revision: 353005 URL: https://svnweb.freebsd.org/changeset/base/353005 Log: MFS12 r352896: vt: fix problems with trying to switch to a closed VT Approved by: re (gjb) Modified: releng/12.1/sys/dev/vt/vt_core.c Directory Properties: releng/12.1/ (props changed) Modified: releng/12.1/sys/dev/vt/vt_core.c == --- releng/12.1/sys/dev/vt/vt_core.cWed Oct 2 13:30:17 2019 (r353004) +++ releng/12.1/sys/dev/vt/vt_core.cWed Oct 2 13:36:54 2019 (r353005) @@ -335,7 +335,7 @@ static void vt_switch_timer(void *arg) { - vt_late_window_switch((struct vt_window *)arg); + (void)vt_late_window_switch((struct vt_window *)arg); } static int @@ -457,13 +457,22 @@ vt_window_postswitch(struct vt_window *vw) static int vt_late_window_switch(struct vt_window *vw) { + struct vt_window *curvw; int ret; callout_stop(>vw_proc_dead_timer); ret = vt_window_switch(vw); - if (ret) + if (ret != 0) { + /* +* If the switch hasn't happened, then return the VT +* to the current owner, if any. +*/ + curvw = vw->vw_device->vd_curwindow; + if (curvw->vw_smode.mode == VT_PROCESS) + (void)vt_window_postswitch(curvw); return (ret); + } /* Notify owner process about terminal availability. */ if (vw->vw_smode.mode == VT_PROCESS) { @@ -509,6 +518,19 @@ vt_proc_window_switch(struct vt_window *vw) return (0); /* success */ } + /* +* Early check for an attempt to switch to a non-functional VT. +* The same check is done in vt_window_switch(), but it's better +* to fail as early as possible to avoid needless pre-switch +* actions. +*/ + VT_LOCK(vd); + if ((vw->vw_flags & (VWF_OPENED|VWF_CONSOLE)) == 0) { + VT_UNLOCK(vd); + return (EINVAL); + } + VT_UNLOCK(vd); + /* Ask current process permission to switch away. */ if (curvw->vw_smode.mode == VT_PROCESS) { DPRINTF(30, "%s: VT_PROCESS ", __func__); @@ -1792,7 +1814,7 @@ finish_vt_rel(struct vt_window *vw, int release, int * vw->vw_flags &= ~VWF_SWWAIT_REL; if (release) { callout_drain(>vw_proc_dead_timer); - vt_late_window_switch(vw->vw_switch_to); + (void)vt_late_window_switch(vw->vw_switch_to); } 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: r353004 - head/usr.sbin/bsdinstall/scripts
Author: gjb Date: Wed Oct 2 13:30:17 2019 New Revision: 353004 URL: https://svnweb.freebsd.org/changeset/base/353004 Log: Explicitly add opensolaris_load="YES" to loader.conf through the installer when installing the system on a ZFS root filesystem. For arm64, zfs_load="YES" does not add opensolaris.ko as a kld dependency, so add it explicitly to prevent boot-time failures out-of-box. PR: 240478 MFC after:3 days Sponsored by: Rubicon Communications, LLC (Netgate) Modified: head/usr.sbin/bsdinstall/scripts/config Modified: head/usr.sbin/bsdinstall/scripts/config == --- head/usr.sbin/bsdinstall/scripts/config Wed Oct 2 13:25:28 2019 (r353003) +++ head/usr.sbin/bsdinstall/scripts/config Wed Oct 2 13:30:17 2019 (r353004) @@ -44,6 +44,7 @@ cp $BSDINSTALL_TMPETC/* $BSDINSTALL_CHROOT/etc cat $BSDINSTALL_TMPBOOT/loader.conf.* >> $BSDINSTALL_TMPBOOT/loader.conf rm $BSDINSTALL_TMPBOOT/loader.conf.* +df -t zfs $BSDINSTALL_CHROOT > /dev/null && echo "opensolaris_load=\"YES\"" >> $BSDINSTALL_TMPBOOT/loader.conf df -t zfs $BSDINSTALL_CHROOT > /dev/null && echo "zfs_load=\"YES\"" >> $BSDINSTALL_TMPBOOT/loader.conf cp $BSDINSTALL_TMPBOOT/* $BSDINSTALL_CHROOT/boot ___ 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: r353003 - releng/12.1/cddl/contrib/opensolaris/lib/libzfs/common
Author: avg Date: Wed Oct 2 13:25:28 2019 New Revision: 353003 URL: https://svnweb.freebsd.org/changeset/base/353003 Log: MFS12 r352721: print summary line for space estimate of zfs send from bookmark This should have been merged as a part of r352901 but I missed it. Approved by: re (gjb) Modified: releng/12.1/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Directory Properties: releng/12.1/ (props changed) Modified: releng/12.1/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c == --- releng/12.1/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Wed Oct 2 12:46:28 2019(r353002) +++ releng/12.1/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Wed Oct 2 13:25:28 2019(r353003) @@ -2054,6 +2054,15 @@ zfs_send_one(zfs_handle_t *zhp, const char *from, int if (err == 0) { send_print_verbose(fout, zhp->zfs_name, from, size, flags.parsable); + if (flags.parsable) { + (void) fprintf(fout, "size\t%llu\n", + (longlong_t)size); + } else { + char buf[16]; + zfs_nicenum(size, buf, sizeof (buf)); + (void) fprintf(fout, dgettext(TEXT_DOMAIN, + "total estimated size is %s\n"), buf); + } } else { (void) fprintf(stderr, "Cannot estimate send size: " "%s\n", strerror(errno)); ___ 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: r338679 - head/lib/libusb
On 2019-10-02 14:58, Kyle Evans wrote: Sorry, I missed that the (ctx)->debug checks just moved a little further in... debugging a little better, because LIBUSB_DEBUG=0 doesn't seem to do the trick for this person. I believe the prints are off by default, unless you call libusb_set_debug() in your application. If you want them compile-time removed, you'll need to do something. --HPS ___ 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: r338679 - head/lib/libusb
On 2019-10-02 14:55, Kyle Evans wrote: On Fri, Sep 14, 2018 at 8:41 AM Hans Petter Selasky wrote: Author: hselasky Date: Fri Sep 14 13:41:37 2018 New Revision: 338679 URL: https://svnweb.freebsd.org/changeset/base/338679 Log: Improve LibUSB debugging by simultaneously allowing both function and transfer prints. Make sure the debug level comes from the correct USB context. Found by: Ludovic Rousseau PR: 231264 MFC after:1 week Approved by: re (kib) Sponsored by: Mellanox Technologies Modified: head/lib/libusb/libusb10.h head/lib/libusb/libusb10_io.c Modified: head/lib/libusb/libusb10.h == --- head/lib/libusb/libusb10.h Fri Sep 14 01:52:34 2018(r338678) +++ head/lib/libusb/libusb10.h Fri Sep 14 13:41:37 2018(r338679) @@ -41,22 +41,24 @@ #defineHOTPLUG_LOCK(ctx) pthread_mutex_lock(&(ctx)->hotplug_lock) #defineHOTPLUG_UNLOCK(ctx) pthread_mutex_unlock(&(ctx)->hotplug_lock) -#defineDPRINTF(ctx, dbg, format, args...) do { \ -if ((ctx)->debug == dbg) { \ - switch (dbg) { \ - case LIBUSB_DEBUG_FUNCTION: \ - printf("LIBUSB_FUNCTION: " \ - format "\n", ## args); \ - break; \ - case LIBUSB_DEBUG_TRANSFER: \ - printf("LIBUSB_TRANSFER: " \ - format "\n", ## args); \ - break; \ - default:\ - break; \ - } \ -} \ -} while(0) +#defineDPRINTF(ctx, dbg, format, ...) do { \ + switch (dbg) { \ + case LIBUSB_DEBUG_FUNCTION: \ + if ((ctx)->debug & LIBUSB_DEBUG_FUNCTION) { \ + printf("LIBUSB_FUNCTION: " \ + format "\n", ## __VA_ARGS__);\ + } \ + break; \ + case LIBUSB_DEBUG_TRANSFER: \ + if ((ctx)->debug & LIBUSB_DEBUG_TRANSFER) { \ + printf("LIBUSB_TRANSFER: " \ + format "\n", ## __VA_ARGS__);\ + } \ + break; \ + default:\ + break; \ + } \ +} while (0) /* internal structures */ Hi, How are people/users of libusb supposed to disable these messages after this? The only thing stopping them was the debug level in the context, I guess, because DPRINTF is always compiled to this and the users of DPRINTF are just invoking it all willy-nilly. Feel free to submit a patch. Maybe you need to make a new option for user-space like WITH_USB_DEBUG --HPS ___ 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: r338679 - head/lib/libusb
On Wed, Oct 2, 2019 at 7:55 AM Kyle Evans wrote: > > On Fri, Sep 14, 2018 at 8:41 AM Hans Petter Selasky > wrote: > > > > Author: hselasky > > Date: Fri Sep 14 13:41:37 2018 > > New Revision: 338679 > > URL: https://svnweb.freebsd.org/changeset/base/338679 > > > > Log: > > Improve LibUSB debugging by simultaneously allowing both function > > and transfer prints. Make sure the debug level comes from the > > correct USB context. > > > > Found by: Ludovic Rousseau > > > > PR: 231264 > > MFC after:1 week > > Approved by: re (kib) > > Sponsored by: Mellanox Technologies > > > > Modified: > > head/lib/libusb/libusb10.h > > head/lib/libusb/libusb10_io.c > > > > Modified: head/lib/libusb/libusb10.h > > == > > --- head/lib/libusb/libusb10.h Fri Sep 14 01:52:34 2018(r338678) > > +++ head/lib/libusb/libusb10.h Fri Sep 14 13:41:37 2018(r338679) > > @@ -41,22 +41,24 @@ > > #defineHOTPLUG_LOCK(ctx) pthread_mutex_lock(&(ctx)->hotplug_lock) > > #defineHOTPLUG_UNLOCK(ctx) > > pthread_mutex_unlock(&(ctx)->hotplug_lock) > > > > -#defineDPRINTF(ctx, dbg, format, args...) do { \ > > -if ((ctx)->debug == dbg) { \ > > - switch (dbg) { \ > > - case LIBUSB_DEBUG_FUNCTION: \ > > - printf("LIBUSB_FUNCTION: " \ > > - format "\n", ## args); \ > > - break; \ > > - case LIBUSB_DEBUG_TRANSFER: \ > > - printf("LIBUSB_TRANSFER: " \ > > - format "\n", ## args); \ > > - break; \ > > - default:\ > > - break; \ > > - } \ > > -} \ > > -} while(0) > > +#defineDPRINTF(ctx, dbg, format, ...) do { \ > > + switch (dbg) { \ > > + case LIBUSB_DEBUG_FUNCTION: \ > > + if ((ctx)->debug & LIBUSB_DEBUG_FUNCTION) { \ > > + printf("LIBUSB_FUNCTION: " \ > > + format "\n", ## __VA_ARGS__);\ > > + } \ > > + break; \ > > + case LIBUSB_DEBUG_TRANSFER: \ > > + if ((ctx)->debug & LIBUSB_DEBUG_TRANSFER) { \ > > + printf("LIBUSB_TRANSFER: " \ > > + format "\n", ## __VA_ARGS__);\ > > + } \ > > + break; \ > > + default:\ > > + break; \ > > + } \ > > +} while (0) > > > > /* internal structures */ > > > > Hi, > > How are people/users of libusb supposed to disable these messages > after this? The only thing stopping them was the debug level in the > context, I guess, because DPRINTF is always compiled to this and the > users of DPRINTF are just invoking it all willy-nilly. > Sorry, I missed that the (ctx)->debug checks just moved a little further in... debugging a little better, because LIBUSB_DEBUG=0 doesn't seem to do the trick for this person. ___ 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: r338679 - head/lib/libusb
On Fri, Sep 14, 2018 at 8:41 AM Hans Petter Selasky wrote: > > Author: hselasky > Date: Fri Sep 14 13:41:37 2018 > New Revision: 338679 > URL: https://svnweb.freebsd.org/changeset/base/338679 > > Log: > Improve LibUSB debugging by simultaneously allowing both function > and transfer prints. Make sure the debug level comes from the > correct USB context. > > Found by: Ludovic Rousseau > PR: 231264 > MFC after:1 week > Approved by: re (kib) > Sponsored by: Mellanox Technologies > > Modified: > head/lib/libusb/libusb10.h > head/lib/libusb/libusb10_io.c > > Modified: head/lib/libusb/libusb10.h > == > --- head/lib/libusb/libusb10.h Fri Sep 14 01:52:34 2018(r338678) > +++ head/lib/libusb/libusb10.h Fri Sep 14 13:41:37 2018(r338679) > @@ -41,22 +41,24 @@ > #defineHOTPLUG_LOCK(ctx) pthread_mutex_lock(&(ctx)->hotplug_lock) > #defineHOTPLUG_UNLOCK(ctx) pthread_mutex_unlock(&(ctx)->hotplug_lock) > > -#defineDPRINTF(ctx, dbg, format, args...) do { \ > -if ((ctx)->debug == dbg) { \ > - switch (dbg) { \ > - case LIBUSB_DEBUG_FUNCTION: \ > - printf("LIBUSB_FUNCTION: " \ > - format "\n", ## args); \ > - break; \ > - case LIBUSB_DEBUG_TRANSFER: \ > - printf("LIBUSB_TRANSFER: " \ > - format "\n", ## args); \ > - break; \ > - default:\ > - break; \ > - } \ > -} \ > -} while(0) > +#defineDPRINTF(ctx, dbg, format, ...) do { \ > + switch (dbg) { \ > + case LIBUSB_DEBUG_FUNCTION: \ > + if ((ctx)->debug & LIBUSB_DEBUG_FUNCTION) { \ > + printf("LIBUSB_FUNCTION: " \ > + format "\n", ## __VA_ARGS__);\ > + } \ > + break; \ > + case LIBUSB_DEBUG_TRANSFER: \ > + if ((ctx)->debug & LIBUSB_DEBUG_TRANSFER) { \ > + printf("LIBUSB_TRANSFER: " \ > + format "\n", ## __VA_ARGS__);\ > + } \ > + break; \ > + default:\ > + break; \ > + } \ > +} while (0) > > /* internal structures */ > Hi, How are people/users of libusb supposed to disable these messages after this? The only thing stopping them was the debug level in the context, I guess, because DPRINTF is always compiled to this and the users of DPRINTF are just invoking it all willy-nilly. Thanks, Kyle Evans ___ 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: r353002 - in head/usr.sbin: etcupdate mergemaster
Author: kevans Date: Wed Oct 2 12:46:28 2019 New Revision: 353002 URL: https://svnweb.freebsd.org/changeset/base/353002 Log: Unbreak etcupdate(8) and mergemaster(8) after r352950 r352950 introduced improper case fall-through for shell scripts. Fix it with a pipe. Reported by: lwhsu, David Wolfskill Modified: head/usr.sbin/etcupdate/etcupdate.sh head/usr.sbin/mergemaster/mergemaster.sh Modified: head/usr.sbin/etcupdate/etcupdate.sh == --- head/usr.sbin/etcupdate/etcupdate.shWed Oct 2 12:45:39 2019 (r353001) +++ head/usr.sbin/etcupdate/etcupdate.shWed Oct 2 12:46:28 2019 (r353002) @@ -595,8 +595,7 @@ post_install_file() NEWALIAS_WARN=yes fi ;; - /usr/share/certs/trusted/*) - /usr/share/certs/blacklisted/*) + /usr/share/certs/trusted/* | /usr/share/certs/blacklisted/*) log "certctl rehash" if [ -z "$dryrun" ]; then env DESTDIR=${DESTDIR} certctl rehash >&3 2>&1 Modified: head/usr.sbin/mergemaster/mergemaster.sh == --- head/usr.sbin/mergemaster/mergemaster.shWed Oct 2 12:45:39 2019 (r353001) +++ head/usr.sbin/mergemaster/mergemaster.shWed Oct 2 12:46:28 2019 (r353002) @@ -883,8 +883,7 @@ mm_install () { /etc/mail/aliases) NEED_NEWALIASES=yes ;; -/usr/share/certs/trusted/*) -/usr/share/certs/blacklisted/*) +/usr/share/certs/trusted/* | /usr/share/certs/blacklisted/*) NEED_CERTCTL=yes ;; /etc/login.conf) ___ 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: r353001 - head/sys/dev/mlx5/mlx5_en
Author: hselasky Date: Wed Oct 2 12:45:39 2019 New Revision: 353001 URL: https://svnweb.freebsd.org/changeset/base/353001 Log: Fix build failure for gcc after r352983, due to not using static variable declared by net/sff8472.h . MFC after:3 days Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c == --- head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Wed Oct 2 12:02:14 2019 (r353000) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Wed Oct 2 12:45:39 2019 (r353001) @@ -27,7 +27,6 @@ #include "en.h" #include "port_buffer.h" -#include void mlx5e_create_stats(struct sysctl_ctx_list *ctx, ___ 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: r353000 - head/sys/dev/mlx5/mlx5_core
Author: hselasky Date: Wed Oct 2 12:02:14 2019 New Revision: 353000 URL: https://svnweb.freebsd.org/changeset/base/353000 Log: Fix build failure for 32-bit platforms after r352991, due to incorrect printf() formatter string. MFC after:3 days Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_core/mlx5_main.c Modified: head/sys/dev/mlx5/mlx5_core/mlx5_main.c == --- head/sys/dev/mlx5/mlx5_core/mlx5_main.c Wed Oct 2 11:40:40 2019 (r352999) +++ head/sys/dev/mlx5/mlx5_core/mlx5_main.c Wed Oct 2 12:02:14 2019 (r353000) @@ -692,8 +692,8 @@ static int wait_fw_init(struct mlx5_core_dev *dev, u32 } if (warn_time_mili && time_after(jiffies, warn)) { mlx5_core_warn(dev, - "Waiting for FW initialization, timeout abort in %lu s\n", - jiffies_to_msecs(end - warn) / 1000); + "Waiting for FW initialization, timeout abort in %u s\n", + (unsigned int)(jiffies_to_msecs(end - warn) / 1000)); warn = jiffies + msecs_to_jiffies(warn_time_mili); } msleep(FW_INIT_WAIT_MS); ___ 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: r352953 - in head/usr.bin: killall split
Sorry for the crap formatting, mobile. We can perhaps also fix this class with a proper modelling file. koobs was going to send out an email about it, but I haven't seen anything. On Wed, Oct 2, 2019, 02:03 Conrad Meyer wrote: > Hi Alexander, > > Coverity has millions of spurious warnings of this class and they're > basically all false positives. I think we should instead try to > figure out how to disable this class of warning on our codebase, since > it is largely incorrect. > > I would encourage reverting this change, because it uglies up the code > for no functional benefit. The code was correct before the change; > only Coverity was wrong. > > Best, > Conrad > > On Tue, Oct 1, 2019 at 11:15 PM Alexander Kabaev wrote: > > > > Author: kan > > Date: Wed Oct 2 06:15:30 2019 > > New Revision: 352953 > > URL: https://svnweb.freebsd.org/changeset/base/352953 > > > > Log: > > Convert pnmatch to single element array in regexec calls > > > > The regexec function is declared as taking an array of regmatch_t > > elements, and passing in the pointer to singleton element, while > > correct, triggers a Coverity warning. Convert the singleton into > > an array of one to silence the warning. > > > > Reported by: Coverity > > Coverity CID: 1009732, 1009733 > > MFC after:2 weeks > > > > Modified: > > head/usr.bin/killall/killall.c > > head/usr.bin/split/split.c > > > > Modified: head/usr.bin/killall/killall.c > > > == > > --- head/usr.bin/killall/killall.c Wed Oct 2 02:37:34 2019 > (r352952) > > +++ head/usr.bin/killall/killall.c Wed Oct 2 06:15:30 2019 > (r352953) > > @@ -98,7 +98,7 @@ main(int ac, char **av) > > struct stat sb; > > struct passwd *pw; > > regex_t rgx; > > - regmatch_t pmatch; > > + regmatch_t pmatch[1]; > > int i, j, ch; > > charbuf[256]; > > charfirst; > > @@ -361,9 +361,9 @@ main(int ac, char **av) > > } > > } > > if (mflag) { > > - pmatch.rm_so = 0; > > - pmatch.rm_eo = strlen(thiscmd); > > - if (regexec(, thiscmd, 0, , > > + pmatch[0].rm_so = 0; > > + pmatch[0].rm_eo = strlen(thiscmd); > > + if (regexec(, thiscmd, 0, pmatch, > > REG_STARTEND) != 0) > > matched = 0; > > regfree(); > > @@ -387,9 +387,9 @@ main(int ac, char **av) > > } > > } > > if (mflag) { > > - pmatch.rm_so = 0; > > - pmatch.rm_eo = strlen(thiscmd); > > - if (regexec(, thiscmd, 0, , > > + pmatch[0].rm_so = 0; > > + pmatch[0].rm_eo = strlen(thiscmd); > > + if (regexec(, thiscmd, 0, pmatch, > > REG_STARTEND) == 0) > > matched = 1; > > regfree(); > > > > Modified: head/usr.bin/split/split.c > > > == > > --- head/usr.bin/split/split.c Wed Oct 2 02:37:34 2019(r352952) > > +++ head/usr.bin/split/split.c Wed Oct 2 06:15:30 2019(r352953) > > @@ -281,11 +281,11 @@ split2(void) > > > > /* Check if we need to start a new file */ > > if (pflag) { > > - regmatch_t pmatch; > > + regmatch_t pmatch[1]; > > > > - pmatch.rm_so = 0; > > - pmatch.rm_eo = len - 1; > > - if (regexec(, bfr, 0, , REG_STARTEND) > == 0) > > + pmatch[0].rm_so = 0; > > + pmatch[0].rm_eo = len - 1; > > + if (regexec(, bfr, 0, pmatch, REG_STARTEND) > == 0) > > newfile(); > > } else if (lcnt++ == numlines) { > > newfile(); > ___ 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: r352999 - head/libexec/rc/rc.d
Author: trasz Date: Wed Oct 2 11:40:40 2019 New Revision: 352999 URL: https://svnweb.freebsd.org/changeset/base/352999 Log: Rename etc/rc.d/abi to etc/rc.d/linux; after moving out the SysV IPC stuff it's entirely linux-specific. Reviewed by: emaste MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D21830 Added: head/libexec/rc/rc.d/linux - copied, changed from r352839, head/libexec/rc/rc.d/abi Deleted: head/libexec/rc/rc.d/abi Modified: head/libexec/rc/rc.d/Makefile head/libexec/rc/rc.d/SERVERS head/libexec/rc/rc.d/localpkg Modified: head/libexec/rc/rc.d/Makefile == --- head/libexec/rc/rc.d/Makefile Wed Oct 2 11:15:35 2019 (r352998) +++ head/libexec/rc/rc.d/Makefile Wed Oct 2 11:40:40 2019 (r352999) @@ -11,7 +11,6 @@ CONFS=DAEMON \ LOGIN \ NETWORKING \ SERVERS \ - abi \ addswap \ adjkerntz \ archdep \ @@ -51,6 +50,7 @@ CONFS=DAEMON \ kldxref \ ${_kpasswdd} \ ldconfig \ + linux \ local \ localpkg \ lockd \ Modified: head/libexec/rc/rc.d/SERVERS == --- head/libexec/rc/rc.d/SERVERSWed Oct 2 11:15:35 2019 (r352998) +++ head/libexec/rc/rc.d/SERVERSWed Oct 2 11:40:40 2019 (r352999) @@ -4,7 +4,7 @@ # # PROVIDE: SERVERS -# REQUIRE: mountcritremote sysvipc abi ldconfig savecore watchdogd +# REQUIRE: mountcritremote sysvipc linux ldconfig savecore watchdogd # This is a dummy dependency, for early-start servers relying on # some basic configuration. Copied and modified: head/libexec/rc/rc.d/linux (from r352839, head/libexec/rc/rc.d/abi) == --- head/libexec/rc/rc.d/abiSat Sep 28 09:50:01 2019(r352839, copy source) +++ head/libexec/rc/rc.d/linux Wed Oct 2 11:40:40 2019(r352999) @@ -3,14 +3,14 @@ # $FreeBSD$ # -# PROVIDE: abi +# PROVIDE: linux # REQUIRE: archdep # KEYWORD: nojail . /etc/rc.subr -name="abi" -desc="Enable foreign ABIs" +name="linux" +desc="Enable Linux ABI" start_cmd="${name}_start" stop_cmd=":" @@ -18,7 +18,6 @@ linux_start() { local _tmpdir - echo -n ' linux' load_kld -e 'linux(aout|elf)' linux case `sysctl -n hw.machine_arch` in amd64) @@ -33,21 +32,6 @@ linux_start() fi rm -rf ${_tmpdir} fi -} - -abi_start() -{ - local _echostop - - _echostop= - if checkyesno linux_enable; then - echo -n 'Additional ABI support:' - _echostop=yes - fi - - checkyesno linux_enable && linux_start - - [ -n "${_echostop}" ] && echo '.' } load_rc_config $name Modified: head/libexec/rc/rc.d/localpkg == --- head/libexec/rc/rc.d/localpkg Wed Oct 2 11:15:35 2019 (r352998) +++ head/libexec/rc/rc.d/localpkg Wed Oct 2 11:40:40 2019 (r352999) @@ -4,7 +4,7 @@ # # PROVIDE: localpkg -# REQUIRE: sysvipc abi +# REQUIRE: sysvipc linux # BEFORE: securelevel # KEYWORD: shutdown ___ 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: r352998 - in head/sys/dev/mlx5: mlx5_core mlx5_en mlx5_ib
Author: hselasky Date: Wed Oct 2 11:15:35 2019 New Revision: 352998 URL: https://svnweb.freebsd.org/changeset/base/352998 Log: Bump driver version for mlx5core, mlx5en(4) and mlx5ib(4). MFC after:3 days Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_core/mlx5_core.h head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Modified: head/sys/dev/mlx5/mlx5_core/mlx5_core.h == --- head/sys/dev/mlx5/mlx5_core/mlx5_core.h Wed Oct 2 11:06:01 2019 (r352997) +++ head/sys/dev/mlx5/mlx5_core/mlx5_core.h Wed Oct 2 11:15:35 2019 (r352998) @@ -36,9 +36,9 @@ #define DRIVER_NAME "mlx5_core" #ifndef DRIVER_VERSION -#define DRIVER_VERSION "3.5.1" +#define DRIVER_VERSION "3.5.2" #endif -#define DRIVER_RELDATE "April 2019" +#define DRIVER_RELDATE "September 2019" extern int mlx5_core_debug_mask; Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c == --- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cWed Oct 2 11:06:01 2019 (r352997) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cWed Oct 2 11:15:35 2019 (r352998) @@ -32,9 +32,9 @@ #include #ifndef ETH_DRIVER_VERSION -#defineETH_DRIVER_VERSION "3.5.1" +#defineETH_DRIVER_VERSION "3.5.2" #endif -#define DRIVER_RELDATE "April 2019" +#define DRIVER_RELDATE "September 2019" static const char mlx5e_version[] = "mlx5en: Mellanox Ethernet driver " ETH_DRIVER_VERSION " (" DRIVER_RELDATE ")\n"; Modified: head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c == --- head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.cWed Oct 2 11:06:01 2019 (r352997) +++ head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.cWed Oct 2 11:15:35 2019 (r352998) @@ -52,9 +52,9 @@ #define DRIVER_NAME "mlx5ib" #ifndef DRIVER_VERSION -#define DRIVER_VERSION "3.5.1" +#define DRIVER_VERSION "3.5.2" #endif -#define DRIVER_RELDATE "April 2019" +#define DRIVER_RELDATE "September 2019" MODULE_DESCRIPTION("Mellanox Connect-IB HCA IB driver"); MODULE_LICENSE("Dual BSD/GPL"); ___ 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: r352997 - head/sys/dev/mlx5/mlx5_core
Author: hselasky Date: Wed Oct 2 11:06:01 2019 New Revision: 352997 URL: https://svnweb.freebsd.org/changeset/base/352997 Log: Print numeric error_type and module_status in mlx5core in case the strings are not available. Submitted by: kib@ MFC after:3 days Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_core/mlx5_eq.c Modified: head/sys/dev/mlx5/mlx5_core/mlx5_eq.c == --- head/sys/dev/mlx5/mlx5_core/mlx5_eq.c Wed Oct 2 11:05:05 2019 (r352996) +++ head/sys/dev/mlx5/mlx5_core/mlx5_eq.c Wed Oct 2 11:06:01 2019 (r352997) @@ -698,16 +698,17 @@ static void mlx5_port_module_event(struct mlx5_core_de case MLX5_MODULE_STATUS_ERROR: mlx5_core_err(dev, - "Module %u, status: error, %s\n", + "Module %u, status: error, %s (%d)\n", module_num, - mlx5_port_module_event_error_type_to_string(error_type)); + mlx5_port_module_event_error_type_to_string(error_type), + error_type); if (error_type < MLX5_MODULE_EVENT_ERROR_NUM) dev->priv.pme_stats.error_counters[error_type]++; break; default: mlx5_core_info(dev, - "Module %u, unknown status\n", module_num); + "Module %u, unknown status %d\n", module_num, module_status); } /* store module status */ if (module_num < MLX5_MAX_PORTS) ___ 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: r352996 - head/sys/dev/mlx5/mlx5_en
Author: hselasky Date: Wed Oct 2 11:05:05 2019 New Revision: 352996 URL: https://svnweb.freebsd.org/changeset/base/352996 Log: Add print to show user a reason for rejecting buffer size change in mlx5en(4). Submitted by: kib@ MFC after:3 days Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_port_buffer.c Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_port_buffer.c == --- head/sys/dev/mlx5/mlx5_en/mlx5_en_port_buffer.c Wed Oct 2 11:02:54 2019(r352995) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_port_buffer.c Wed Oct 2 11:05:05 2019(r352996) @@ -139,8 +139,8 @@ static u32 calculate_xoff(struct mlx5e_priv *priv, uns return xoff; } -static int update_xoff_threshold(struct mlx5e_port_buffer *port_buffer, -u32 xoff) +static int update_xoff_threshold(struct mlx5e_priv *priv, +struct mlx5e_port_buffer *port_buffer, u32 xoff) { int i; @@ -152,8 +152,14 @@ static int update_xoff_threshold(struct mlx5e_port_buf } if (port_buffer->buffer[i].size < - (xoff + MLX5E_MAX_PORT_MTU + (1 << MLX5E_BUFFER_CELL_SHIFT))) + (xoff + MLX5E_MAX_PORT_MTU + (1 << MLX5E_BUFFER_CELL_SHIFT))) { + mlx5_en_info(priv->ifp, + "non-lossy buffer %d size %d less than xoff threshold %d\n", + i, port_buffer->buffer[i].size, + xoff + MLX5E_MAX_PORT_MTU + + (1 << MLX5E_BUFFER_CELL_SHIFT)); return -ENOMEM; + } port_buffer->buffer[i].xoff = port_buffer->buffer[i].size - xoff; port_buffer->buffer[i].xon = @@ -182,7 +188,7 @@ static int update_xoff_threshold(struct mlx5e_port_buf * Return 0 if no error. * Set change to true if buffer configuration is modified. */ -static int update_buffer_lossy(unsigned int mtu, +static int update_buffer_lossy(struct mlx5e_priv *priv, unsigned int mtu, u8 pfc_en, u8 *buffer, u32 xoff, struct mlx5e_port_buffer *port_buffer, bool *change) @@ -219,7 +225,7 @@ static int update_buffer_lossy(unsigned int mtu, } if (changed) { - err = update_xoff_threshold(port_buffer, xoff); + err = update_xoff_threshold(priv, port_buffer, xoff); if (err) return err; @@ -253,7 +259,7 @@ int mlx5e_port_manual_buffer_config(struct mlx5e_priv if (change & MLX5E_PORT_BUFFER_CABLE_LEN) { update_buffer = true; - err = update_xoff_threshold(_buffer, xoff); + err = update_xoff_threshold(priv, _buffer, xoff); if (err) return err; } @@ -264,7 +270,7 @@ int mlx5e_port_manual_buffer_config(struct mlx5e_priv return err; priv->sw_is_port_buf_owner = true; - err = update_buffer_lossy(mtu, pfc->pfc_en, buffer, xoff, + err = update_buffer_lossy(priv, mtu, pfc->pfc_en, buffer, xoff, _buffer, _buffer); if (err) return err; @@ -276,7 +282,7 @@ int mlx5e_port_manual_buffer_config(struct mlx5e_priv if (err) return err; - err = update_buffer_lossy(mtu, curr_pfc_en, prio2buffer, xoff, + err = update_buffer_lossy(priv, mtu, curr_pfc_en, prio2buffer, xoff, _buffer, _buffer); if (err) return err; @@ -301,7 +307,7 @@ int mlx5e_port_manual_buffer_config(struct mlx5e_priv return -EINVAL; update_buffer = true; - err = update_xoff_threshold(_buffer, xoff); + err = update_xoff_threshold(priv, _buffer, xoff); if (err) return err; } @@ -309,7 +315,7 @@ int mlx5e_port_manual_buffer_config(struct mlx5e_priv /* Need to update buffer configuration if xoff value is changed */ if (!update_buffer && xoff != priv->dcbx.xoff) { update_buffer = true; - err = update_xoff_threshold(_buffer, xoff); + err = update_xoff_threshold(priv, _buffer, xoff); if (err) return err; } ___ 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: r352995 - head/sys/dev/mlx5/mlx5_en
Author: hselasky Date: Wed Oct 2 11:02:54 2019 New Revision: 352995 URL: https://svnweb.freebsd.org/changeset/base/352995 Log: Only update lossy buffers config when manual PFC configuration was done in mlx5en(4). Submitted by: kib@ MFC after:3 days Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_en/en.h head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c head/sys/dev/mlx5/mlx5_en/mlx5_en_port_buffer.c Modified: head/sys/dev/mlx5/mlx5_en/en.h == --- head/sys/dev/mlx5/mlx5_en/en.h Wed Oct 2 11:01:05 2019 (r352994) +++ head/sys/dev/mlx5/mlx5_en/en.h Wed Oct 2 11:02:54 2019 (r352995) @@ -1046,6 +1046,7 @@ struct mlx5e_priv { u_int clbr_gen; struct mlx5e_dcbx dcbx; + boolsw_is_port_buf_owner; struct pfil_head *pfil; struct mlx5e_channel channel[]; Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c == --- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cWed Oct 2 11:01:05 2019 (r352994) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cWed Oct 2 11:02:54 2019 (r352995) @@ -3903,7 +3903,7 @@ mlx5e_sysctl_rx_priority_flow_control(SYSCTL_HANDLER_A /* check if update is required */ if (rx_pfc != priv->params.rx_priority_flow_control) { err = -mlx5e_set_port_pfc(priv); - if (err == 0) + if (err == 0 && priv->sw_is_port_buf_owner) err = mlx5e_update_buf_lossy(priv); } done: Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_port_buffer.c == --- head/sys/dev/mlx5/mlx5_en/mlx5_en_port_buffer.c Wed Oct 2 11:01:05 2019(r352994) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_port_buffer.c Wed Oct 2 11:02:54 2019(r352995) @@ -263,6 +263,7 @@ int mlx5e_port_manual_buffer_config(struct mlx5e_priv if (err) return err; + priv->sw_is_port_buf_owner = true; err = update_buffer_lossy(mtu, pfc->pfc_en, buffer, xoff, _buffer, _buffer); if (err) @@ -316,13 +317,16 @@ int mlx5e_port_manual_buffer_config(struct mlx5e_priv /* Apply the settings */ if (update_buffer) { + priv->sw_is_port_buf_owner = true; err = port_set_buffer(priv, _buffer); if (err) return err; } - if (update_prio2buffer) + if (update_prio2buffer) { + priv->sw_is_port_buf_owner = true; err = mlx5e_port_set_priority2buffer(priv->mdev, prio2buffer); + } return err; } ___ 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: r352994 - head/sys/dev/mlx5/mlx5_core
Author: hselasky Date: Wed Oct 2 11:01:05 2019 New Revision: 352994 URL: https://svnweb.freebsd.org/changeset/base/352994 Log: Improve mlx5_fwdump_prep logging in mlx5core. Submitted by: slavash@ MFC after:3 days Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Modified: head/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c == --- head/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Wed Oct 2 10:59:44 2019 (r352993) +++ head/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Wed Oct 2 11:01:05 2019 (r352994) @@ -72,7 +72,8 @@ mlx5_fwdump_prep(struct mlx5_core_dev *mdev) if (error != 0) { /* Inability to create a firmware dump is not fatal. */ mlx5_core_warn(mdev, - "mlx5_fwdump_prep failed %d\n", error); + "Failed to find vendor-specific capability, error %d\n", + error); return; } error = mlx5_vsc_lock(mdev); @@ -86,7 +87,7 @@ mlx5_fwdump_prep(struct mlx5_core_dev *mdev) dev = mdev->pdev->dev.bsddev; vsc_addr = mdev->vsc_addr; if (vsc_addr == 0) { - mlx5_core_warn(mdev, "Cannot read vsc, no address\n"); + mlx5_core_warn(mdev, "Cannot read VSC, no address\n"); goto unlock_vsc; } @@ -97,7 +98,8 @@ mlx5_fwdump_prep(struct mlx5_core_dev *mdev) error = mlx5_vsc_wait_on_flag(mdev, 1); if (error != 0) { mlx5_core_warn(mdev, - "Failed waiting for read complete flag, error %d\n", error); + "Failed waiting for read complete flag, error %d addr %#x\n", + error, addr); goto unlock_vsc; } pci_read_config(dev, vsc_addr + MLX5_VSC_DATA_OFFSET, 4); @@ -120,7 +122,8 @@ mlx5_fwdump_prep(struct mlx5_core_dev *mdev) error = mlx5_vsc_wait_on_flag(mdev, 1); if (error != 0) { mlx5_core_warn(mdev, - "Failed waiting for read complete flag, error %d\n", error); + "Failed waiting for read complete flag, error %d addr %#x\n", + error, addr); free(mdev->dump_rege, M_MLX5_DUMP); mdev->dump_rege = NULL; goto unlock_vsc; ___ 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: r352993 - head/sys/dev/mlx5/mlx5_core
Author: hselasky Date: Wed Oct 2 10:59:44 2019 New Revision: 352993 URL: https://svnweb.freebsd.org/changeset/base/352993 Log: Randomize the delay when waiting for VSC flag in mlx5core. The PRM suggests random 0 - 10ms to prevent multiple waiters on the same interval in order to avoid starvation. Submitted by: slavash@ MFC after:3 days Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_core/mlx5_vsc.c Modified: head/sys/dev/mlx5/mlx5_core/mlx5_vsc.c == --- head/sys/dev/mlx5/mlx5_core/mlx5_vsc.c Wed Oct 2 10:58:27 2019 (r352992) +++ head/sys/dev/mlx5/mlx5_core/mlx5_vsc.c Wed Oct 2 10:59:44 2019 (r352993) @@ -52,7 +52,7 @@ int mlx5_vsc_lock(struct mlx5_core_dev *mdev) * The PRM suggests random 0 - 10ms to prevent multiple * waiters on the same interval in order to avoid starvation */ - DELAY((random() % 11) * 1000); + DELAY((random() % 9000) + 1000); continue; } @@ -99,7 +99,7 @@ mlx5_vsc_wait_on_flag(struct mlx5_core_dev *mdev, u32 break; retries++; - DELAY(10); + DELAY((random() % 90) + 10); } 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: r352992 - head/usr.sbin/mlx5tool
Author: hselasky Date: Wed Oct 2 10:58:27 2019 New Revision: 352992 URL: https://svnweb.freebsd.org/changeset/base/352992 Log: Use size_t for byte_to_write variable when comparing to eeprom_info_out_len which is also size_t in mlx5tool(8). Submitted by: slavash@ MFC after:3 days Sponsored by: Mellanox Technologies Modified: head/usr.sbin/mlx5tool/mlx5tool.c Modified: head/usr.sbin/mlx5tool/mlx5tool.c == --- head/usr.sbin/mlx5tool/mlx5tool.c Wed Oct 2 10:53:28 2019 (r352991) +++ head/usr.sbin/mlx5tool/mlx5tool.c Wed Oct 2 10:58:27 2019 (r352992) @@ -206,7 +206,8 @@ mlx5tool_fw_reset(int ctldev, const struct mlx5_tool_a static void mlx5tool_eeprom_print(struct mlx5_eeprom_get *eeprom_info) { - unsigned int byte_to_write, index_in_row, line_length, row; + int index_in_row, line_length, row; + size_t byte_to_write; byte_to_write = 0; line_length = 16; @@ -214,7 +215,7 @@ mlx5tool_eeprom_print(struct mlx5_eeprom_get *eeprom_i printf("\nOffset\t\tValues\n"); printf("--\t\t--"); while (byte_to_write < eeprom_info->eeprom_info_out_len) { - printf("\n0x%04X\t\t", byte_to_write); + printf("\n0x%04zX\t\t", byte_to_write); for (index_in_row = 0; index_in_row < line_length; index_in_row++) { printf("%02X ", ___ 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: r352991 - in head/sys/dev/mlx5: . mlx5_core
Author: hselasky Date: Wed Oct 2 10:53:28 2019 New Revision: 352991 URL: https://svnweb.freebsd.org/changeset/base/352991 Log: Wait for FW readiness before initializing command interface in mlx5core. Before attempting to initialize the command interface we must wait till the fw_initializing bit is clear. If we fail to meet this condition the hardware will drop our configuration, specifically the descriptors page address. This scenario can happen when the firmware is still executing an FLR flow and did not finish yet so the driver needs to wait for that to finish. Linux commits: 6c780a0267b8 b8a92577f4be. MFC after:3 days Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/device.h head/sys/dev/mlx5/mlx5_core/mlx5_main.c Modified: head/sys/dev/mlx5/device.h == --- head/sys/dev/mlx5/device.h Wed Oct 2 10:46:57 2019(r352990) +++ head/sys/dev/mlx5/device.h Wed Oct 2 10:53:28 2019(r352991) @@ -32,8 +32,10 @@ #include #include -#define FW_INIT_TIMEOUT_MILI 2000 -#define FW_INIT_WAIT_MS 2 +#defineFW_INIT_TIMEOUT_MILI2000 +#defineFW_INIT_WAIT_MS 2 +#defineFW_PRE_INIT_TIMEOUT_MILI12 +#defineFW_INIT_WARN_MESSAGE_INTERVAL 2 #if defined(__LITTLE_ENDIAN) #define MLX5_SET_HOST_ENDIANNESS 0 Modified: head/sys/dev/mlx5/mlx5_core/mlx5_main.c == --- head/sys/dev/mlx5/mlx5_core/mlx5_main.c Wed Oct 2 10:46:57 2019 (r352990) +++ head/sys/dev/mlx5/mlx5_core/mlx5_main.c Wed Oct 2 10:53:28 2019 (r352991) @@ -676,19 +676,33 @@ static inline int fw_initializing(struct mlx5_core_dev return ioread32be(>iseg->initializing) >> 31; } -static int wait_fw_init(struct mlx5_core_dev *dev, u32 max_wait_mili) +static int wait_fw_init(struct mlx5_core_dev *dev, u32 max_wait_mili, + u32 warn_time_mili) { - u64 end = jiffies + msecs_to_jiffies(max_wait_mili); + int warn = jiffies + msecs_to_jiffies(warn_time_mili); + int end = jiffies + msecs_to_jiffies(max_wait_mili); int err = 0; - while (fw_initializing(dev)) { + MPASS(max_wait_mili > warn_time_mili); + + while (fw_initializing(dev) == 1) { if (time_after(jiffies, end)) { err = -EBUSY; break; } + if (warn_time_mili && time_after(jiffies, warn)) { + mlx5_core_warn(dev, + "Waiting for FW initialization, timeout abort in %lu s\n", + jiffies_to_msecs(end - warn) / 1000); + warn = jiffies + msecs_to_jiffies(warn_time_mili); + } msleep(FW_INIT_WAIT_MS); } + if (err != 0) + mlx5_core_dbg(dev, "Full initializing bit dword = 0x%x\n", + ioread32be(>iseg->initializing)); + return err; } @@ -994,15 +1008,29 @@ static int mlx5_load_one(struct mlx5_core_dev *dev, st */ dev->state = MLX5_DEVICE_STATE_UP; + /* wait for firmware to accept initialization segments configurations + */ + err = wait_fw_init(dev, FW_PRE_INIT_TIMEOUT_MILI, + FW_INIT_WARN_MESSAGE_INTERVAL); + if (err) { + dev_err(>pdev->dev, + "Firmware over %d MS in pre-initializing state, aborting\n", + FW_PRE_INIT_TIMEOUT_MILI); + goto out_err; + } + err = mlx5_cmd_init(dev); if (err) { - mlx5_core_err(dev, "Failed initializing command interface, aborting\n"); + mlx5_core_err(dev, + "Failed initializing command interface, aborting\n"); goto out_err; } - err = wait_fw_init(dev, FW_INIT_TIMEOUT_MILI); + err = wait_fw_init(dev, FW_INIT_TIMEOUT_MILI, 0); if (err) { - mlx5_core_err(dev, "Firmware over %d MS in initializing state, aborting\n", FW_INIT_TIMEOUT_MILI); + mlx5_core_err(dev, + "Firmware over %d MS in initializing state, aborting\n", + FW_INIT_TIMEOUT_MILI); goto err_cmd_cleanup; } ___ 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: r352990 - head/sys/dev/mlx5/mlx5_en
Author: hselasky Date: Wed Oct 2 10:46:57 2019 New Revision: 352990 URL: https://svnweb.freebsd.org/changeset/base/352990 Log: Fix regression issue about bad refcounting of unlimited send tags in mlx5en(4) after r348254. The unlimited send tags are shared amount multiple connections and are not allocated per send tag allocation request. Only increment the refcount. MFC after:3 days Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_en/en.h head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Modified: head/sys/dev/mlx5/mlx5_en/en.h == --- head/sys/dev/mlx5/mlx5_en/en.h Wed Oct 2 10:43:49 2019 (r352989) +++ head/sys/dev/mlx5/mlx5_en/en.h Wed Oct 2 10:46:57 2019 (r352990) @@ -873,6 +873,7 @@ struct mlx5e_channel { struct mlx5e_snd_tag tag; struct mlx5e_sq sq[MLX5E_MAX_TX_NUM_TC]; struct mlx5e_priv *priv; + struct completion completion; int ix; } __aligned(MLX5E_CACHELINE_SIZE); @@ -998,7 +999,6 @@ struct mlx5e_priv { u32 pdn; u32 tdn; struct mlx5_core_mr mr; - volatile unsigned int channel_refs; u32 tisn[MLX5E_MAX_TX_NUM_TC]; u32 rqtn; @@ -1142,24 +1142,6 @@ mlx5e_cq_arm(struct mlx5e_cq *cq, spinlock_t *dblock) mcq = >mcq; mlx5_cq_arm(mcq, MLX5_CQ_DB_REQ_NOT, mcq->uar->map, dblock, cq->wq.cc); -} - -static inline void -mlx5e_ref_channel(struct mlx5e_priv *priv) -{ - - KASSERT(priv->channel_refs < INT_MAX, - ("Channel refs will overflow")); - atomic_fetchadd_int(>channel_refs, 1); -} - -static inline void -mlx5e_unref_channel(struct mlx5e_priv *priv) -{ - - KASSERT(priv->channel_refs > 0, - ("Channel refs is not greater than zero")); - atomic_fetchadd_int(>channel_refs, -1); } #definemlx5e_dbg(_IGN, _priv, ...) mlx5_core_dbg((_priv)->mdev, __VA_ARGS__) Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c == --- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cWed Oct 2 10:43:49 2019 (r352989) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cWed Oct 2 10:46:57 2019 (r352990) @@ -2119,6 +2119,8 @@ mlx5e_chan_static_init(struct mlx5e_priv *priv, struct c->tag.type = IF_SND_TAG_TYPE_UNLIMITED; m_snd_tag_init(>tag.m_snd_tag, c->priv->ifp); + init_completion(>completion); + mtx_init(>rq.mtx, "mlx5rx", MTX_NETWORK_LOCK, MTX_DEF); callout_init_mtx(>rq.watchdog, >rq.mtx, 0); @@ -2136,13 +2138,27 @@ mlx5e_chan_static_init(struct mlx5e_priv *priv, struct } static void -mlx5e_chan_static_destroy(struct mlx5e_channel *c) +mlx5e_chan_wait_for_completion(struct mlx5e_channel *c) { - int tc; - /* drop our reference */ m_snd_tag_rele(>tag.m_snd_tag); + wait_for_completion(>completion); +} +static void +mlx5e_priv_wait_for_completion(struct mlx5e_priv *priv, const uint32_t channels) +{ + uint32_t x; + + for (x = 0; x != channels; x++) + mlx5e_chan_wait_for_completion(>channel[x]); +} + +static void +mlx5e_chan_static_destroy(struct mlx5e_channel *c) +{ + int tc; + callout_drain(>rq.watchdog); mtx_destroy(>rq.mtx); @@ -4010,9 +4026,7 @@ mlx5e_ul_snd_tag_alloc(struct ifnet *ifp, /* check if send queue is not running */ if (unlikely(pch->sq[0].running == 0)) return (ENXIO); - mlx5e_ref_channel(priv); - MPASS(pch->tag.m_snd_tag.refcount == 0); - m_snd_tag_init(>tag.m_snd_tag, ifp); + m_snd_tag_ref(>tag.m_snd_tag); *ppmt = >tag.m_snd_tag; return (0); } @@ -4035,7 +4049,7 @@ mlx5e_ul_snd_tag_free(struct m_snd_tag *pmt) struct mlx5e_channel *pch = container_of(pmt, struct mlx5e_channel, tag.m_snd_tag); - mlx5e_unref_channel(pch->priv); + complete(>completion); } static int @@ -4461,6 +4475,9 @@ mlx5e_destroy_ifp(struct mlx5_core_dev *mdev, void *vp pause("W", hz); } #endif + /* wait for all unlimited send tags to complete */ + mlx5e_priv_wait_for_completion(priv, mdev->priv.eq_table.num_comp_vectors); + /* stop watchdog timer */ callout_drain(>watchdog); @@ -4475,13 +4492,6 @@ mlx5e_destroy_ifp(struct mlx5_core_dev *mdev, void *vp PRIV_LOCK(priv); mlx5e_close_locked(ifp); PRIV_UNLOCK(priv); - - /* wait for all unlimited send tags to go away */ - while (priv->channel_refs != 0) { - mlx5_en_err(priv->ifp, - "Waiting for all unlimited connections to terminate\n"); - pause("W", hz); - } /* deregister pfil */ if (priv->pfil
svn commit: r352989 - head/sys/dev/mlx5/mlx5_en
Author: hselasky Date: Wed Oct 2 10:43:49 2019 New Revision: 352989 URL: https://svnweb.freebsd.org/changeset/base/352989 Log: Seal transmit path with regards to using destroyed mutex in mlx5en(4). It may happen during link down that the running state may be observed non-zero in the transmit routine, right before the running state is cleared. This may end up using a destroyed mutex. Make all channel mutexes and callouts persistant. Preserve receive and send queue statistics during link toggle. MFC after:3 days Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_en/en.h head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Modified: head/sys/dev/mlx5/mlx5_en/en.h == --- head/sys/dev/mlx5/mlx5_en/en.h Wed Oct 2 10:26:26 2019 (r352988) +++ head/sys/dev/mlx5/mlx5_en/en.h Wed Oct 2 10:43:49 2019 (r352989) @@ -139,6 +139,10 @@ #defineMLX5E_100MB (10) #defineMLX5E_1GB (100) +#defineMLX5E_ZERO(ptr, field)\ + memset(&(ptr)->field, 0, \ + sizeof(*(ptr)) - __offsetof(__typeof(*(ptr)), field)) + MALLOC_DECLARE(M_MLX5EN); struct mlx5_core_dev; @@ -741,15 +745,18 @@ struct mlx5e_rq_mbuf { }; struct mlx5e_rq { + /* persistant fields */ + struct mtx mtx; + struct mlx5e_rq_stats stats; + /* data path */ +#definemlx5e_rq_zero_start wq struct mlx5_wq_ll wq; - struct mtx mtx; bus_dma_tag_t dma_tag; u32 wqe_sz; u32 nsegs; struct mlx5e_rq_mbuf *mbuf; struct ifnet *ifp; - struct mlx5e_rq_stats stats; struct mlx5e_cq cq; struct lro_ctrl lro; volatile int enabled; @@ -783,11 +790,15 @@ struct mlx5e_snd_tag { }; struct mlx5e_sq { - /* data path */ + /* persistant fields */ struct mtx lock; - bus_dma_tag_t dma_tag; struct mtx comp_lock; + struct mlx5e_sq_stats stats; + /* data path */ +#definemlx5e_sq_zero_start dma_tag + bus_dma_tag_t dma_tag; + /* dirtied @completion */ u16 cc; @@ -806,7 +817,6 @@ struct mlx5e_sq { u32 d32[2]; u64 d64; } doorbell; - struct mlx5e_sq_stats stats; struct mlx5e_cq cq; @@ -859,13 +869,9 @@ mlx5e_sq_queue_level(struct mlx5e_sq *sq) } struct mlx5e_channel { - /* data path */ struct mlx5e_rq rq; struct mlx5e_snd_tag tag; struct mlx5e_sq sq[MLX5E_MAX_TX_NUM_TC]; - u8 num_tc; - - /* control */ struct mlx5e_priv *priv; int ix; } __aligned(MLX5E_CACHELINE_SIZE); Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c == --- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cWed Oct 2 10:26:26 2019 (r352988) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cWed Oct 2 10:43:49 2019 (r352989) @@ -1481,8 +1481,6 @@ mlx5e_close_rq(struct mlx5e_rq *rq) callout_stop(>watchdog); mtx_unlock(>mtx); - callout_drain(>watchdog); - mlx5e_modify_rq(rq, MLX5_RQC_STATE_RDY, MLX5_RQC_STATE_ERR); } @@ -1564,7 +1562,7 @@ mlx5e_refresh_sq_inline_sub(struct mlx5e_priv *priv, s { int i; - for (i = 0; i != c->num_tc; i++) { + for (i = 0; i != priv->num_tc; i++) { mtx_lock(>sq[i].lock); mlx5e_update_sq_inline(>sq[i]); mtx_unlock(>sq[i].lock); @@ -1751,6 +1749,12 @@ mlx5e_open_sq(struct mlx5e_channel *c, { int err; + sq->cev_factor = c->priv->params_ethtool.tx_completion_fact; + + /* ensure the TX completion event factor is not zero */ + if (sq->cev_factor == 0) + sq->cev_factor = 1; + err = mlx5e_create_sq(c, tc, param, sq); if (err) return (err); @@ -1862,9 +1866,6 @@ mlx5e_drain_sq(struct mlx5e_sq *sq) mlx5e_sq_send_nops_locked(sq, 1); mtx_unlock(>lock); - /* make sure it is safe to free the callout */ - callout_drain(>cev_callout); - /* wait till SQ is empty or link is down */ mtx_lock(>lock); while (sq->cc != sq->pc && @@ -2049,7 +2050,7 @@ mlx5e_open_tx_cqs(struct mlx5e_channel *c, int err; int tc; - for (tc = 0; tc < c->num_tc; tc++) { + for (tc = 0; tc < c->priv->num_tc; tc++) { /* open completion queue */ err = mlx5e_open_cq(c->priv, >tx_cq, >sq[tc].cq, _tx_cq_comp, c->ix); @@ -2070,7 +2071,7 @@ mlx5e_close_tx_cqs(struct mlx5e_channel *c) { int tc; - for (tc = 0; tc < c->num_tc; tc++) + for (tc = 0; tc < c->priv->num_tc; tc++) mlx5e_close_cq(>sq[tc].cq); } @@ -2081,7 +2082,7 @@ mlx5e_open_sqs(struct mlx5e_channel *c, int
svn commit: r352988 - head/sys/dev/mlx5/mlx5_en
Author: hselasky Date: Wed Oct 2 10:26:26 2019 New Revision: 352988 URL: https://svnweb.freebsd.org/changeset/base/352988 Log: Remove unused cpu field from channel structure in mlx5en(4). MFC after:3 days Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_en/en.h Modified: head/sys/dev/mlx5/mlx5_en/en.h == --- head/sys/dev/mlx5/mlx5_en/en.h Wed Oct 2 10:25:47 2019 (r352987) +++ head/sys/dev/mlx5/mlx5_en/en.h Wed Oct 2 10:26:26 2019 (r352988) @@ -868,7 +868,6 @@ struct mlx5e_channel { /* control */ struct mlx5e_priv *priv; int ix; - int cpu; } __aligned(MLX5E_CACHELINE_SIZE); enum mlx5e_traffic_types { ___ 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: r352987 - head/sys/dev/mlx5/mlx5_en
Author: hselasky Date: Wed Oct 2 10:25:47 2019 New Revision: 352987 URL: https://svnweb.freebsd.org/changeset/base/352987 Log: Remove mkey_be from channel structure in mlx5en(4). Use value from priv structure instead. This saves some space in the channel structure. MFC after:3 days Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_en/en.h head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Modified: head/sys/dev/mlx5/mlx5_en/en.h == --- head/sys/dev/mlx5/mlx5_en/en.h Wed Oct 2 10:24:13 2019 (r352986) +++ head/sys/dev/mlx5/mlx5_en/en.h Wed Oct 2 10:25:47 2019 (r352987) @@ -863,7 +863,6 @@ struct mlx5e_channel { struct mlx5e_rq rq; struct mlx5e_snd_tag tag; struct mlx5e_sq sq[MLX5E_MAX_TX_NUM_TC]; - u32 mkey_be; u8 num_tc; /* control */ Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c == --- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cWed Oct 2 10:24:13 2019 (r352986) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cWed Oct 2 10:25:47 2019 (r352987) @@ -1273,7 +1273,7 @@ mlx5e_create_rq(struct mlx5e_channel *c, /* set value for constant fields */ for (j = 0; j < rq->nsegs; j++) - wqe->data[j].lkey = c->mkey_be; + wqe->data[j].lkey = cpu_to_be32(priv->mr.key); } INIT_WORK(>dim.work, mlx5e_dim_work); @@ -1629,7 +1629,7 @@ mlx5e_create_sq(struct mlx5e_channel *c, if (err) goto err_sq_wq_destroy; - sq->mkey_be = c->mkey_be; + sq->mkey_be = cpu_to_be32(priv->mr.key); sq->ifp = priv->ifp; sq->priv = priv; sq->tc = tc; @@ -2158,7 +2158,6 @@ mlx5e_open_channel(struct mlx5e_priv *priv, int ix, c->ix = ix; /* setup send tag */ c->tag.type = IF_SND_TAG_TYPE_UNLIMITED; - c->mkey_be = cpu_to_be32(priv->mr.key); c->num_tc = priv->num_tc; /* init mutexes */ ___ 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: r352986 - head/sys/dev/mlx5/mlx5_core
Author: hselasky Date: Wed Oct 2 10:24:13 2019 New Revision: 352986 URL: https://svnweb.freebsd.org/changeset/base/352986 Log: Return an error from ioctl(MLX5_FW_RESET) if reset was rejected in mlx5core. Submitted by: kib@ MFC after:3 days Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_core/mlx5_core.h head/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c head/sys/dev/mlx5/mlx5_core/mlx5_health.c Modified: head/sys/dev/mlx5/mlx5_core/mlx5_core.h == --- head/sys/dev/mlx5/mlx5_core/mlx5_core.h Wed Oct 2 10:22:15 2019 (r352985) +++ head/sys/dev/mlx5/mlx5_core/mlx5_core.h Wed Oct 2 10:24:13 2019 (r352986) @@ -110,7 +110,7 @@ void mlx5e_cleanup(void); int mlx5_ctl_init(void); void mlx5_ctl_fini(void); void mlx5_fwdump_prep(struct mlx5_core_dev *mdev); -void mlx5_fwdump(struct mlx5_core_dev *mdev); +int mlx5_fwdump(struct mlx5_core_dev *mdev); void mlx5_fwdump_clean(struct mlx5_core_dev *mdev); struct mlx5_crspace_regmap { Modified: head/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c == --- head/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Wed Oct 2 10:22:15 2019 (r352985) +++ head/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Wed Oct 2 10:24:13 2019 (r352986) @@ -148,7 +148,7 @@ unlock_vsc: mlx5_vsc_unlock(mdev); } -void +int mlx5_fwdump(struct mlx5_core_dev *mdev) { const struct mlx5_crspace_regmap *r; @@ -157,12 +157,15 @@ mlx5_fwdump(struct mlx5_core_dev *mdev) mlx5_core_info(mdev, "Issuing FW dump\n"); mtx_lock(>dump_lock); - if (mdev->dump_data == NULL) + if (mdev->dump_data == NULL) { + error = EIO; goto failed; + } if (mdev->dump_valid) { /* only one dump */ mlx5_core_warn(mdev, "Only one FW dump can be captured aborting FW dump\n"); + error = EEXIST; goto failed; } @@ -187,6 +190,7 @@ unlock_vsc: mlx5_vsc_unlock(mdev); failed: mtx_unlock(>dump_lock); + return (error); } void @@ -400,7 +404,7 @@ mlx5_ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t d error = mlx5_dbsf_to_core(devaddr, ); if (error != 0) break; - mlx5_fwdump(mdev); + error = mlx5_fwdump(mdev); break; case MLX5_FW_UPDATE: if ((fflag & FWRITE) == 0) { Modified: head/sys/dev/mlx5/mlx5_core/mlx5_health.c == --- head/sys/dev/mlx5/mlx5_core/mlx5_health.c Wed Oct 2 10:22:15 2019 (r352985) +++ head/sys/dev/mlx5/mlx5_core/mlx5_health.c Wed Oct 2 10:24:13 2019 (r352986) @@ -300,7 +300,7 @@ void mlx5_enter_error_state(struct mlx5_core_dev *dev, /* Execute cr-dump and SW reset */ if (lock != -EBUSY) { - mlx5_fwdump(dev); + (void)mlx5_fwdump(dev); reset_fw_if_needed(dev); delay_ms = MLX5_FW_RESET_WAIT_MS; } ___ 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: r352985 - in head/sys/dev/mlx5: . mlx5_en
Author: hselasky Date: Wed Oct 2 10:22:15 2019 New Revision: 352985 URL: https://svnweb.freebsd.org/changeset/base/352985 Log: Add sysctl(8) to get and set forward error correction, FEC, configuration in mlx5en(4). MFC after:3 days Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/device.h head/sys/dev/mlx5/driver.h head/sys/dev/mlx5/mlx5_en/en.h head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c head/sys/dev/mlx5/mlx5_ifc.h Modified: head/sys/dev/mlx5/device.h == --- head/sys/dev/mlx5/device.h Wed Oct 2 10:19:17 2019(r352984) +++ head/sys/dev/mlx5/device.h Wed Oct 2 10:22:15 2019(r352985) @@ -1053,6 +1053,9 @@ enum mlx5_mcam_feature_groups { #define MLX5_CAP_PCAM_FEATURE(mdev, fld) \ MLX5_GET(pcam_reg, (mdev)->caps.pcam, feature_cap_mask.enhanced_features.fld) +#defineMLX5_CAP_PCAM_REG(mdev, reg) \ + MLX5_GET(pcam_reg, (mdev)->caps.pcam, port_access_reg_cap_mask.regs_5000_to_507f.reg) + #define MLX5_CAP_MCAM_FEATURE(mdev, fld) \ MLX5_GET(mcam_reg, (mdev)->caps.mcam, mng_feature_cap_mask.enhanced_features.fld) Modified: head/sys/dev/mlx5/driver.h == --- head/sys/dev/mlx5/driver.h Wed Oct 2 10:19:17 2019(r352984) +++ head/sys/dev/mlx5/driver.h Wed Oct 2 10:22:15 2019(r352985) @@ -144,6 +144,7 @@ enum { MLX5_REG_PVLC= 0x500F, MLX5_REG_PMPE= 0x5010, MLX5_REG_PMAOS = 0x5012, + MLX5_REG_PPLM= 0x5023, MLX5_REG_PBSR= 0x5038, MLX5_REG_PCAM= 0x507f, MLX5_REG_NODE_DESC = 0x6001, Modified: head/sys/dev/mlx5/mlx5_en/en.h == --- head/sys/dev/mlx5/mlx5_en/en.h Wed Oct 2 10:19:17 2019 (r352984) +++ head/sys/dev/mlx5/mlx5_en/en.h Wed Oct 2 10:22:15 2019 (r352985) @@ -76,6 +76,9 @@ #defineMLX5E_MAX_PRIORITY 8 +#defineMLX5E_MAX_FEC_10X_25X 4 +#defineMLX5E_MAX_FEC_50X 4 + /* IEEE 802.1Qaz standard supported values */ #defineIEEE_8021QAZ_MAX_TCS8 @@ -712,6 +715,11 @@ struct mlx5e_params_ethtool { u8 prio_tc[MLX5E_MAX_PRIORITY]; u8 dscp2prio[MLX5_MAX_SUPPORTED_DSCP]; u8 trust_state; + u8 fec_mask_10x_25x[MLX5E_MAX_FEC_10X_25X]; + u16 fec_mask_50x[MLX5E_MAX_FEC_50X]; + u8 fec_avail_10x_25x[MLX5E_MAX_FEC_10X_25X]; + u16 fec_avail_50x[MLX5E_MAX_FEC_50X]; + u32 fec_mode_active; }; struct mlx5e_cq { @@ -1175,5 +1183,6 @@ void mlx5e_resume_sq(struct mlx5e_sq *sq); void mlx5e_update_sq_inline(struct mlx5e_sq *sq); void mlx5e_refresh_sq_inline(struct mlx5e_priv *priv); intmlx5e_update_buf_lossy(struct mlx5e_priv *priv); +intmlx5e_fec_update(struct mlx5e_priv *priv); #endif /* _MLX5_EN_H_ */ Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c == --- head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Wed Oct 2 10:19:17 2019 (r352984) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Wed Oct 2 10:22:15 2019 (r352985) @@ -346,7 +346,286 @@ done: return (err); } +int +mlx5e_fec_update(struct mlx5e_priv *priv) +{ + struct mlx5_core_dev *mdev = priv->mdev; + u32 in[MLX5_ST_SZ_DW(pplm_reg)] = {}; + const int sz = MLX5_ST_SZ_BYTES(pplm_reg); + int err; + + if (!MLX5_CAP_GEN(mdev, pcam_reg)) + return (EOPNOTSUPP); + + if (!MLX5_CAP_PCAM_REG(mdev, pplm)) + return (EOPNOTSUPP); + + MLX5_SET(pplm_reg, in, local_port, 1); + + err = -mlx5_core_access_reg(mdev, in, sz, in, sz, MLX5_REG_PPLM, 0, 0); + if (err) + return (err); + + /* get 10x..25x mask */ + priv->params_ethtool.fec_mask_10x_25x[0] = + MLX5_GET(pplm_reg, in, fec_override_admin_10g_40g); + priv->params_ethtool.fec_mask_10x_25x[1] = + MLX5_GET(pplm_reg, in, fec_override_admin_25g) & + MLX5_GET(pplm_reg, in, fec_override_admin_50g); + priv->params_ethtool.fec_mask_10x_25x[2] = + MLX5_GET(pplm_reg, in, fec_override_admin_56g); + priv->params_ethtool.fec_mask_10x_25x[3] = + MLX5_GET(pplm_reg, in, fec_override_admin_100g); + + /* get 10x..25x available bits */ + priv->params_ethtool.fec_avail_10x_25x[0] = + MLX5_GET(pplm_reg, in, fec_override_cap_10g_40g); + priv->params_ethtool.fec_avail_10x_25x[1] = + MLX5_GET(pplm_reg, in, fec_override_cap_25g) & + MLX5_GET(pplm_reg, in, fec_override_cap_50g); + priv->params_ethtool.fec_avail_10x_25x[2] = +
svn commit: r352984 - head/usr.sbin/mlx5tool
Author: hselasky Date: Wed Oct 2 10:19:17 2019 New Revision: 352984 URL: https://svnweb.freebsd.org/changeset/base/352984 Log: Add the ability to query the EEPROM information in mlx5tool(8). Submitted by: slavash@ MFC after:3 days Sponsored by: Mellanox Technologies Modified: head/usr.sbin/mlx5tool/mlx5tool.8 head/usr.sbin/mlx5tool/mlx5tool.c Modified: head/usr.sbin/mlx5tool/mlx5tool.8 == --- head/usr.sbin/mlx5tool/mlx5tool.8 Wed Oct 2 10:14:55 2019 (r352983) +++ head/usr.sbin/mlx5tool/mlx5tool.8 Wed Oct 2 10:19:17 2019 (r352984) @@ -30,28 +30,31 @@ .Os .Sh NAME .Nm mlx5tool -.Nd Utility for managing Connect-X 4/5 Mellanox network adapters +.Nd Utility for managing Connect-X 4/5/6 Mellanox network adapters .Sh SYNOPSIS .Nm .Fl d Ar domain:bus:slot:func +.Fl E +.Nm +.Fl d Ar domain:bus:slot:func .Fl e .Nm .Fl d Ar domain:bus:slot:func -.Fl rn +.Fl f Ar file.mfa2 .Nm .Fl d Ar domain:bus:slot:func .Fl o Ar file .Fl w .Nm .Fl d Ar domain:bus:slot:func -.Fl f Ar file.mfa2 +.Fl r .Nm .Fl d Ar domain:bus:slot:func .Fl z .Sh DESCRIPTION The .Nm -utility is provided for management of the Connect-X 4 and 5 network adapters +utility is provided for management of the Connect-X4, 5 and 6 network adapters in the aspects not covered by the generic .Xr ifconfig 8 command, mostly related to the PCIe attachment and internal card working. @@ -73,21 +76,13 @@ analysis of the failure by the Mellanox support team. .Pp The following commands are currently implemented: .Bl -tag -width indent +.It Fl E +Print EEPROM information .It Fl e Take the snapshot of the firmware registers state and store it in the kernel buffer. The buffer must be empty, in other words, no dumps should be written so far, or existing dump cleared with the -.Fl r -command for the specified device. -.It Fl r -Clear the stored firmware dump, preparing the kernel buffer for -the next dump. -.It Fl w -Fetches the stored firmware dump and writes it into the file specified -by the -.Fl o -option argument. .It Fl f Flashes the firmware image .Fa file.mfa2 @@ -100,6 +95,16 @@ newly flashed image, which can be performed by the sys or using the .Fl z option. +.Fl r +command for the specified device. +.It Fl r +Clear the stored firmware dump, preparing the kernel buffer for +the next dump. +.It Fl w +Fetches the stored firmware dump and writes it into the file specified +by the +.Fl o +option argument. .It Fl z Performs PCIe link-level reset on the specified device. .El Modified: head/usr.sbin/mlx5tool/mlx5tool.c == --- head/usr.sbin/mlx5tool/mlx5tool.c Wed Oct 2 10:14:55 2019 (r352983) +++ head/usr.sbin/mlx5tool/mlx5tool.c Wed Oct 2 10:19:17 2019 (r352984) @@ -200,7 +200,86 @@ mlx5tool_fw_reset(int ctldev, const struct mlx5_tool_a return (0); } +#defineMLX5_EEPROM_HIGH_PAGE_OFFSET128 +#defineMLX5_EEPROM_PAGE_LENGTH 256 + static void +mlx5tool_eeprom_print(struct mlx5_eeprom_get *eeprom_info) +{ + unsigned int byte_to_write, index_in_row, line_length, row; + + byte_to_write = 0; + line_length = 16; + + printf("\nOffset\t\tValues\n"); + printf("--\t\t--"); + while (byte_to_write < eeprom_info->eeprom_info_out_len) { + printf("\n0x%04X\t\t", byte_to_write); + for (index_in_row = 0; index_in_row < line_length; + index_in_row++) { + printf("%02X ", + ((uint8_t *)eeprom_info->eeprom_info_buf)[ + byte_to_write]); + byte_to_write++; + } + } + + if (eeprom_info->eeprom_info_page_valid) { + row = MLX5_EEPROM_HIGH_PAGE_OFFSET; + printf("\n\nUpper Page 0x03\n"); + printf("\nOffset\t\tValues\n"); + printf("--\t\t--"); + for (row = MLX5_EEPROM_HIGH_PAGE_OFFSET; + row < MLX5_EEPROM_PAGE_LENGTH;) { + printf("\n0x%04X\t\t", row); + for (index_in_row = 0; +index_in_row < line_length; +index_in_row++) { + printf("%02X ", + ((uint8_t *)eeprom_info-> + eeprom_info_buf)[byte_to_write]); + byte_to_write++; + row++; + } + } + } + printf("\n"); +} + +static int +mlx5tool_get_eeprom_info(int ctldev, const struct mlx5_tool_addr *addr) +{ + struct mlx5_eeprom_get eeprom_info; + int error; + + memset(_info, 0, sizeof(eeprom_info)); + eeprom_info.devaddr =
Re: svn commit: r352795 - head/lib/libc/sys
On Tue, 1 Oct 2019, Ed Maste wrote: On Tue, 1 Oct 2019 at 12:23, Brooks Davis wrote: This isn't true with CHERI and as a result I've moved the variadic argument handling (except for syscall() and __syscall()) into libc. My grep found: open, openat, fcntl, semsys, msgsys, shmsys Is that the full list? I already wrote that this is quite broken for open and fcntl in POSIX. hecking some details shows that it is more fundamentally broken than I thought: - for open(), the type of the mode argument passed by the caller is unspecified. Whatever it is, it is "taken" as type mode_t, whatevr "taking" is. Since historical mode_t has only 16 bits, it can be represented by int even on systems with 16-bit ints, so the caller can start with either mode_t or int provided mode_t is no larger than historical mode_t and ints are either larger than 16 bits or 16 bits and not too exotic (the sign bit might cause problems if not 2's complement) - for fcntl() with F_SETOWN, the type of the pid argument passed by the caller is unspecified. Whatever it is, it is "taken" as type int. Thus if pid_t is larger than int, passing all possible values of pid_t is impossible. If also PID_MAX <= INT_MAX and all values of pid_t are actually <= PID_MAX, then all possible (positive) values can be passed, but the iplementation may have to do extra work to properly break a passed __default_promotion_of(pid_t) type by "taking" it as an int. This was discussed on the POSIX list recently. IMO it is too late and not useful to change the old specification to "take" the arg as anything except int. So pid_t might as well be specified as being a signed integer type whose default promotion is int. It is currently specified as being a signed integer type (with any size or exoticness). Bruce ___ 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: r352983 - in head: share/man/man4 sys/dev/mlx5 sys/dev/mlx5/mlx5_core sys/dev/mlx5/mlx5_en
Author: hselasky Date: Wed Oct 2 10:14:55 2019 New Revision: 352983 URL: https://svnweb.freebsd.org/changeset/base/352983 Log: Move EEPROM information query from a sysctl in mlx5en(4) to an ioctl in mlx5core. The EEPROM information is not only a property of the mlx5en(4) driver. Submitted by: slavash@ MFC after:3 days Sponsored by: Mellanox Technologies Modified: head/share/man/man4/mlx5io.4 head/sys/dev/mlx5/diagnostics.h head/sys/dev/mlx5/mlx5_core/mlx5_diagnostics.c head/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c head/sys/dev/mlx5/mlx5_en/en.h head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c head/sys/dev/mlx5/mlx5io.h head/sys/dev/mlx5/port.h Modified: head/share/man/man4/mlx5io.4 == --- head/share/man/man4/mlx5io.4Wed Oct 2 10:08:04 2019 (r352982) +++ head/share/man/man4/mlx5io.4Wed Oct 2 10:14:55 2019 (r352983) @@ -25,18 +25,18 @@ .\" .\" $FreeBSD$ .\" -.Dd May 7, 2019 +.Dd October 2, 2019 .Dt mlx5io 4 .Os .Sh NAME .Nm mlx5io -.Nd IOCTL interface to manage Connect-X 4/5 Mellanox network adapters +.Nd IOCTL interface to manage Connect-X 4/5/6 Mellanox network adapters .Sh SYNOPSIS .In dev/mlx5/mlx5io.h .Sh DESCRIPTION The .Nm -interface is provided for management of the Connect-X 4 and 5 network adapters +interface is provided for management of the Connect-X4, 5 and 6 network adapters in the aspects not covered by the generic network configuration, mostly related to the PCIe attachment and internal card working. Interface consists of the commands, which are passed by means of @@ -147,6 +147,29 @@ Requests PCIe link-level reset on the device. The address of the device is specified by the .Vt struct mlx5_tool_addr structure, which should be passed as an argument. +.It Dv MLX5_EEPROM_GET +Fetch EEPROM information. +The argument to the command should point to the input/output +.Vt struct mlx5_eeprom_get +structure where, the +.Dv devaddr +field specifies the address of the device. +.Bd -literal +struct mlx5_eeprom_get { +struct mlx5_tool_addr devaddr; +size_t eeprom_info_page_valid; +uint32_t *eeprom_info_buf; +size_t eeprom_info_out_len; +}; +.Ed +.Pp +On successfull return, the +.Dv eeprom_info_out_len +field reports the length of the EEPROM information. +.Dv eeprom_info_buf +field contains the actual EEPROM information. +.Dv eeprom_info_page_valid +field reports the third page validity. .El .Sh FILES The Modified: head/sys/dev/mlx5/diagnostics.h == --- head/sys/dev/mlx5/diagnostics.h Wed Oct 2 10:08:04 2019 (r352982) +++ head/sys/dev/mlx5/diagnostics.h Wed Oct 2 10:14:55 2019 (r352983) @@ -32,6 +32,8 @@ #defineMLX5_CORE_DIAGNOSTICS_STRUCT(n, s, t) s, #defineMLX5_CORE_DIAGNOSTICS_ENTRY(n, s, t) { #s, (t) }, +static MALLOC_DEFINE(M_MLX5_EEPROM, "MLX5EEPROM", "MLX5 EEPROM information"); + struct mlx5_core_diagnostics_entry { const char *desc; u16 counter_id; @@ -127,6 +129,18 @@ union mlx5_core_general_diagnostics { extern const struct mlx5_core_diagnostics_entry mlx5_core_general_diagnostics_table[MLX5_CORE_GENERAL_DIAGNOSTICS_NUM]; +struct mlx5_eeprom { + int lock_bit; + int i2c_addr; + int page_num; + int device_addr; + int module_num; + int len; + int type; + int page_valid; + u32 *data; +}; + /* function prototypes */ int mlx5_core_set_diagnostics_full(struct mlx5_core_dev *mdev, u8 enable_pci, u8 enable_general); @@ -134,5 +148,8 @@ int mlx5_core_get_diagnostics_full(struct mlx5_core_de union mlx5_core_pci_diagnostics *ppci, union mlx5_core_general_diagnostics *pgen); int mlx5_core_supports_diagnostics(struct mlx5_core_dev *mdev, u16 counter_id); +int mlx5_read_eeprom(struct mlx5_core_dev *dev, struct mlx5_eeprom *eeprom); +int mlx5_get_eeprom_info(struct mlx5_core_dev *dev, struct mlx5_eeprom *eeprom); +int mlx5_get_eeprom(struct mlx5_core_dev *dev, struct mlx5_eeprom *ee); #endif /* MLX5_CORE_DIAGNOSTICS_H */ Modified: head/sys/dev/mlx5/mlx5_core/mlx5_diagnostics.c == --- head/sys/dev/mlx5/mlx5_core/mlx5_diagnostics.c Wed Oct 2 10:08:04 2019(r352982) +++ head/sys/dev/mlx5/mlx5_core/mlx5_diagnostics.c Wed Oct 2 10:14:55 2019(r352983) @@ -26,7 +26,10 @@ */ #include +#include #include +#include +#include const struct mlx5_core_diagnostics_entry mlx5_core_pci_diagnostics_table[ @@ -284,3 +287,156 @@ int mlx5_core_supports_diagnostics(struct mlx5_core_de }
svn commit: r352982 - head/sys/dev/mlx5/mlx5_en
Author: hselasky Date: Wed Oct 2 10:08:04 2019 New Revision: 352982 URL: https://svnweb.freebsd.org/changeset/base/352982 Log: Add support for buffer parameter manipulations in mlx5en(4). The following sysctls are added: dev.mce.N.conf.qos.cable_length dev.mce.N.conf.qos.buffers_size dev.mce.N.conf.qos.buffers_prio Submitted by: kib@ MFC after:3 days Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_en/en.h head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Modified: head/sys/dev/mlx5/mlx5_en/en.h == --- head/sys/dev/mlx5/mlx5_en/en.h Wed Oct 2 10:05:34 2019 (r352981) +++ head/sys/dev/mlx5/mlx5_en/en.h Wed Oct 2 10:08:04 2019 (r352982) @@ -1202,5 +1202,6 @@ void mlx5e_modify_rx_dma(struct mlx5e_priv *priv, uint void mlx5e_resume_sq(struct mlx5e_sq *sq); void mlx5e_update_sq_inline(struct mlx5e_sq *sq); void mlx5e_refresh_sq_inline(struct mlx5e_priv *priv); +intmlx5e_update_buf_lossy(struct mlx5e_priv *priv); #endif /* _MLX5_EN_H_ */ Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c == --- head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Wed Oct 2 10:05:34 2019 (r352981) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Wed Oct 2 10:08:04 2019 (r352982) @@ -26,6 +26,7 @@ */ #include "en.h" +#include "port_buffer.h" #include void @@ -429,6 +430,99 @@ done: return (err); } +int +mlx5e_update_buf_lossy(struct mlx5e_priv *priv) +{ + struct ieee_pfc pfc; + + PRIV_ASSERT_LOCKED(priv); + bzero(, sizeof(pfc)); + pfc.pfc_en = priv->params.rx_priority_flow_control; + return (-mlx5e_port_manual_buffer_config(priv, MLX5E_PORT_BUFFER_PFC, + priv->params_ethtool.hw_mtu, , NULL, NULL)); +} + +static int +mlx5e_buf_size_handler(SYSCTL_HANDLER_ARGS) +{ + struct mlx5e_priv *priv; + u32 buf_size[MLX5E_MAX_BUFFER]; + struct mlx5e_port_buffer port_buffer; + int error, i; + + priv = arg1; + PRIV_LOCK(priv); + error = -mlx5e_port_query_buffer(priv, _buffer); + if (error != 0) + goto done; + for (i = 0; i < nitems(buf_size); i++) + buf_size[i] = port_buffer.buffer[i].size; + error = SYSCTL_OUT(req, buf_size, sizeof(buf_size)); + if (error != 0 || req->newptr == NULL) + goto done; + error = SYSCTL_IN(req, buf_size, sizeof(buf_size)); + if (error != 0) + goto done; + error = -mlx5e_port_manual_buffer_config(priv, MLX5E_PORT_BUFFER_SIZE, + priv->params_ethtool.hw_mtu, NULL, buf_size, NULL); +done: + PRIV_UNLOCK(priv); + return (error); +} + +static int +mlx5e_buf_prio_handler(SYSCTL_HANDLER_ARGS) +{ + struct mlx5e_priv *priv; + struct mlx5_core_dev *mdev; + u8 buffer[MLX5E_MAX_BUFFER]; + int error; + + priv = arg1; + mdev = priv->mdev; + PRIV_LOCK(priv); + error = -mlx5e_port_query_priority2buffer(mdev, buffer); + if (error != 0) + goto done; + error = SYSCTL_OUT(req, buffer, MLX5E_MAX_BUFFER); + if (error != 0 || req->newptr == NULL) + goto done; + error = SYSCTL_IN(req, buffer, MLX5E_MAX_BUFFER); + if (error != 0) + goto done; + error = -mlx5e_port_manual_buffer_config(priv, + MLX5E_PORT_BUFFER_PRIO2BUFFER, + priv->params_ethtool.hw_mtu, NULL, NULL, buffer); + if (error == 0) + error = mlx5e_update_buf_lossy(priv); +done: + PRIV_UNLOCK(priv); + return (error); +} + +static int +mlx5e_cable_length_handler(SYSCTL_HANDLER_ARGS) +{ + struct mlx5e_priv *priv; + u_int cable_len; + int error; + + priv = arg1; + PRIV_LOCK(priv); + cable_len = priv->dcbx.cable_len; + error = sysctl_handle_int(oidp, _len, 0, req); + if (error == 0 && req->newptr != NULL && + cable_len != priv->dcbx.cable_len) { + error = -mlx5e_port_manual_buffer_config(priv, + MLX5E_PORT_BUFFER_CABLE_LEN, priv->params_ethtool.hw_mtu, + NULL, NULL, NULL); + if (error == 0) + priv->dcbx.cable_len = cable_len; + } + PRIV_UNLOCK(priv); + return (error); +} + #defineMLX5_PARAM_OFFSET(n)\ __offsetof(struct mlx5e_priv, params_ethtool.n) @@ -1163,6 +1257,7 @@ mlx5e_create_ethtool(struct mlx5e_priv *priv) { struct sysctl_oid *node, *qos_node; const char *pnameunit; + struct mlx5e_port_buffer port_buffer; unsigned x; int i; @@ -1312,5 +1407,23 @@ mlx5e_create_ethtool(struct mlx5e_priv *priv) A B
svn commit: r352981 - in head/sys: conf dev/mlx5 dev/mlx5/mlx5_core dev/mlx5/mlx5_en modules/mlx5en
Author: hselasky Date: Wed Oct 2 10:05:34 2019 New Revision: 352981 URL: https://svnweb.freebsd.org/changeset/base/352981 Log: Import Linux code to query/set buffer state in mlx5en(4). Submitted by: kib@ MFC after:3 days Sponsored by: Mellanox Technologies Added: head/sys/dev/mlx5/mlx5_en/mlx5_en_port_buffer.c (contents, props changed) head/sys/dev/mlx5/mlx5_en/port_buffer.h (contents, props changed) Modified: head/sys/conf/files head/sys/dev/mlx5/mlx5_core/mlx5_port.c head/sys/dev/mlx5/mlx5_en/en.h head/sys/dev/mlx5/port.h head/sys/modules/mlx5en/Makefile Modified: head/sys/conf/files == --- head/sys/conf/files Wed Oct 2 09:59:42 2019(r352980) +++ head/sys/conf/files Wed Oct 2 10:05:34 2019(r352981) @@ -4770,6 +4770,8 @@ dev/mlx5/mlx5_en/mlx5_en_rl.c optional mlx5en pci in compile-with "${OFED_C}" dev/mlx5/mlx5_en/mlx5_en_txrx.coptional mlx5en pci inet inet6 \ compile-with "${OFED_C}" +dev/mlx5/mlx5_en/mlx5_en_port_buffer.c optional mlx5en pci inet inet6 \ + compile-with "${OFED_C}" # crypto support opencrypto/cast.c optional crypto | ipsec | ipsec_support Modified: head/sys/dev/mlx5/mlx5_core/mlx5_port.c == --- head/sys/dev/mlx5/mlx5_core/mlx5_port.c Wed Oct 2 09:59:42 2019 (r352980) +++ head/sys/dev/mlx5/mlx5_core/mlx5_port.c Wed Oct 2 10:05:34 2019 (r352981) @@ -1236,3 +1236,220 @@ mlx5_set_mfrl_reg(struct mlx5_core_dev *mdev, u8 reset return (mlx5_core_access_reg(mdev, mfrl, sz, mfrl, sz, MLX5_REG_MFRL, 0, 1)); } + +/* speed in units of 1Mb */ +static const u32 mlx5e_link_speed[/*MLX5E_LINK_MODES_NUMBER*/] = { + [MLX5E_1000BASE_CX_SGMII] = 1000, + [MLX5E_1000BASE_KX] = 1000, + [MLX5E_10GBASE_CX4] = 1, + [MLX5E_10GBASE_KX4] = 1, + [MLX5E_10GBASE_KR]= 1, + [MLX5E_20GBASE_KR2] = 2, + [MLX5E_40GBASE_CR4] = 4, + [MLX5E_40GBASE_KR4] = 4, + [MLX5E_56GBASE_R4]= 56000, + [MLX5E_10GBASE_CR]= 1, + [MLX5E_10GBASE_SR]= 1, + [MLX5E_10GBASE_ER_LR] = 1, + [MLX5E_40GBASE_SR4] = 4, + [MLX5E_40GBASE_LR4_ER4] = 4, + [MLX5E_50GBASE_SR2] = 5, + [MLX5E_100GBASE_CR4] = 10, + [MLX5E_100GBASE_SR4] = 10, + [MLX5E_100GBASE_KR4] = 10, + [MLX5E_100GBASE_LR4] = 10, + [MLX5E_100BASE_TX]= 100, + [MLX5E_1000BASE_T]= 1000, + [MLX5E_10GBASE_T] = 1, + [MLX5E_25GBASE_CR]= 25000, + [MLX5E_25GBASE_KR]= 25000, + [MLX5E_25GBASE_SR]= 25000, + [MLX5E_50GBASE_CR2] = 5, + [MLX5E_50GBASE_KR2] = 5, +}; + +static const u32 mlx5e_ext_link_speed[/*MLX5E_EXT_LINK_MODES_NUMBER*/] = { + [MLX5E_SGMII_100M] = 100, + [MLX5E_1000BASE_X_SGMII]= 1000, + [MLX5E_5GBASE_R]= 5000, + [MLX5E_10GBASE_XFI_XAUI_1] = 1, + [MLX5E_40GBASE_XLAUI_4_XLPPI_4] = 4, + [MLX5E_25GAUI_1_25GBASE_CR_KR] = 25000, + [MLX5E_50GAUI_2_LAUI_2_50GBASE_CR2_KR2] = 5, + [MLX5E_50GAUI_1_LAUI_1_50GBASE_CR_KR] = 5, + [MLX5E_CAUI_4_100GBASE_CR4_KR4] = 10, + [MLX5E_200GAUI_4_200GBASE_CR4_KR4] = 20, + [MLX5E_400GAUI_8] = 40, +}; + +static void mlx5e_port_get_speed_arr(struct mlx5_core_dev *mdev, +const u32 **arr, u32 *size) +{ + bool ext = MLX5_CAP_PCAM_FEATURE(mdev, ptys_extended_ethernet); + + *size = ext ? ARRAY_SIZE(mlx5e_ext_link_speed) : + ARRAY_SIZE(mlx5e_link_speed); + *arr = ext ? mlx5e_ext_link_speed : mlx5e_link_speed; +} + +u32 mlx5e_port_ptys2speed(struct mlx5_core_dev *mdev, u32 eth_proto_oper) +{ + unsigned long temp = eth_proto_oper; + const u32 *table; + u32 speed = 0; + u32 max_size; + int i; + + mlx5e_port_get_speed_arr(mdev, , _size); + i = find_first_bit(, max_size); + if (i < max_size) + speed = table[i]; + return speed; +} + +int mlx5_port_query_eth_proto(struct mlx5_core_dev *dev, u8 port, bool ext, + struct mlx5e_port_eth_proto *eproto) +{ + u32 out[MLX5_ST_SZ_DW(ptys_reg)]; + int err; + + if (!eproto) + return -EINVAL; + + err = mlx5_query_port_ptys(dev, out, sizeof(out), MLX5_PTYS_EN, port); + if (err) + return err; + + eproto->cap = MLX5_GET_ETH_PROTO(ptys_reg, out, ext, +
svn commit: r352980 - head/sys/dev/mlx5/mlx5_en
Author: hselasky Date: Wed Oct 2 09:59:42 2019 New Revision: 352980 URL: https://svnweb.freebsd.org/changeset/base/352980 Log: Add mlx5e_dbg() compatibility macro. Submitted by: kib@ MFC after:3 days Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_en/en.h Modified: head/sys/dev/mlx5/mlx5_en/en.h == --- head/sys/dev/mlx5/mlx5_en/en.h Wed Oct 2 09:58:00 2019 (r352979) +++ head/sys/dev/mlx5/mlx5_en/en.h Wed Oct 2 09:59:42 2019 (r352980) @@ -1171,6 +1171,8 @@ mlx5e_unref_channel(struct mlx5e_priv *priv) atomic_fetchadd_int(>channel_refs, -1); } +#definemlx5e_dbg(_IGN, _priv, ...) mlx5_core_dbg((_priv)->mdev, __VA_ARGS__) + extern const struct ethtool_ops mlx5e_ethtool_ops; void mlx5e_create_ethtool(struct mlx5e_priv *); void mlx5e_create_stats(struct sysctl_ctx_list *, ___ 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: r352978 - head/sys/dev/mlx5
Author: hselasky Date: Wed Oct 2 09:57:12 2019 New Revision: 352978 URL: https://svnweb.freebsd.org/changeset/base/352978 Log: Add definition for the Port Buffer Status Register in mlx5core. Submitted by: kib@ MFC after:3 days Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/driver.h Modified: head/sys/dev/mlx5/driver.h == --- head/sys/dev/mlx5/driver.h Wed Oct 2 09:56:27 2019(r352977) +++ head/sys/dev/mlx5/driver.h Wed Oct 2 09:57:12 2019(r352978) @@ -144,6 +144,7 @@ enum { MLX5_REG_PVLC= 0x500F, MLX5_REG_PMPE= 0x5010, MLX5_REG_PMAOS = 0x5012, + MLX5_REG_PBSR= 0x5038, MLX5_REG_PCAM= 0x507f, MLX5_REG_NODE_DESC = 0x6001, MLX5_REG_HOST_ENDIANNESS = 0x7004, ___ 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: r352979 - head/sys/dev/mlx5
Author: hselasky Date: Wed Oct 2 09:58:00 2019 New Revision: 352979 URL: https://svnweb.freebsd.org/changeset/base/352979 Log: Update definitons for PPTB and PBMC registers layouts in mlx5core. Submitted by: kib@ MFC after:3 days Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_ifc.h Modified: head/sys/dev/mlx5/mlx5_ifc.h == --- head/sys/dev/mlx5/mlx5_ifc.hWed Oct 2 09:57:12 2019 (r352978) +++ head/sys/dev/mlx5/mlx5_ifc.hWed Oct 2 09:58:00 2019 (r352979) @@ -1557,26 +1557,19 @@ struct mlx5_ifc_field_select_802_1qau_rp_bits { }; struct mlx5_ifc_pptb_reg_bits { - u8 reserved_0[0x2]; + u8 reserved_at_0[0x2]; u8 mm[0x2]; - u8 reserved_1[0x4]; + u8 reserved_at_4[0x4]; u8 local_port[0x8]; - u8 reserved_2[0x6]; + u8 reserved_at_10[0x6]; u8 cm[0x1]; u8 um[0x1]; u8 pm[0x8]; - u8 prio7buff[0x4]; - u8 prio6buff[0x4]; - u8 prio5buff[0x4]; - u8 prio4buff[0x4]; - u8 prio3buff[0x4]; - u8 prio2buff[0x4]; - u8 prio1buff[0x4]; - u8 prio0buff[0x4]; + u8 prio_x_buff[0x20]; u8 pm_msb[0x8]; - u8 reserved_3[0x10]; + u8 reserved_at_48[0x10]; u8 ctrl_buff[0x4]; u8 untagged_buff[0x4]; }; @@ -8690,21 +8683,20 @@ struct mlx5_ifc_pcap_reg_bits { }; struct mlx5_ifc_pbmc_reg_bits { - u8 reserved_0[0x8]; + u8 reserved_at_0[0x8]; u8 local_port[0x8]; - u8 reserved_1[0x10]; + u8 reserved_at_10[0x10]; u8 xoff_timer_value[0x10]; u8 xoff_refresh[0x10]; - u8 reserved_2[0x10]; + u8 reserved_at_40[0x9]; + u8 fullness_threshold[0x7]; u8 port_buffer_size[0x10]; struct mlx5_ifc_bufferx_reg_bits buffer[10]; - u8 reserved_3[0x40]; - - u8 port_shared_buffer[0x40]; + u8 reserved_at_2e0[0x40]; }; struct mlx5_ifc_paos_reg_bits { ___ 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: r352977 - head/sys/dev/mlx5
Author: hselasky Date: Wed Oct 2 09:56:27 2019 New Revision: 352977 URL: https://svnweb.freebsd.org/changeset/base/352977 Log: Sort the ports registers definitions numerically in mlx5core. Submitted by: kib@ MFC after:3 days Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/driver.h Modified: head/sys/dev/mlx5/driver.h == --- head/sys/dev/mlx5/driver.h Wed Oct 2 09:49:44 2019(r352976) +++ head/sys/dev/mlx5/driver.h Wed Oct 2 09:56:27 2019(r352977) @@ -126,24 +126,24 @@ enum { MLX5_REG_QCAM= 0x4019, MLX5_REG_DCBX_PARAM = 0x4020, MLX5_REG_DCBX_APP= 0x4021, - MLX5_REG_PCAP= 0x5001, MLX5_REG_FPGA_CAP= 0x4022, MLX5_REG_FPGA_CTRL = 0x4023, MLX5_REG_FPGA_ACCESS_REG = 0x4024, MLX5_REG_FPGA_SHELL_CNTR = 0x4025, + MLX5_REG_PCAP= 0x5001, + MLX5_REG_PMLP= 0x5002, MLX5_REG_PMTU= 0x5003, MLX5_REG_PTYS= 0x5004, MLX5_REG_PAOS= 0x5006, MLX5_REG_PFCC= 0x5007, MLX5_REG_PPCNT = 0x5008, - MLX5_REG_PMAOS = 0x5012, MLX5_REG_PUDE= 0x5009, MLX5_REG_PPTB= 0x500B, MLX5_REG_PBMC= 0x500C, + MLX5_REG_PELC= 0x500E, + MLX5_REG_PVLC= 0x500F, MLX5_REG_PMPE= 0x5010, - MLX5_REG_PELC= 0x500e, - MLX5_REG_PVLC= 0x500f, - MLX5_REG_PMLP= 0x5002, + MLX5_REG_PMAOS = 0x5012, MLX5_REG_PCAM= 0x507f, MLX5_REG_NODE_DESC = 0x6001, MLX5_REG_HOST_ENDIANNESS = 0x7004, ___ 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: r352976 - head/sys/dev/mlx5/mlx5_en
Author: hselasky Date: Wed Oct 2 09:49:44 2019 New Revision: 352976 URL: https://svnweb.freebsd.org/changeset/base/352976 Log: Unify prints in mlx5en(4). All prints in mlx5en(4) should use on of the macros: mlx5_en_err/dbg/warn Submitted by: slavash@ MFC after:3 days Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_en/en.h head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c head/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c head/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c head/sys/dev/mlx5/mlx5_en/mlx5_en_txrx.c Modified: head/sys/dev/mlx5/mlx5_en/en.h == --- head/sys/dev/mlx5/mlx5_en/en.h Wed Oct 2 09:48:01 2019 (r352975) +++ head/sys/dev/mlx5/mlx5_en/en.h Wed Oct 2 09:49:44 2019 (r352976) @@ -143,6 +143,21 @@ struct mlx5e_cq; typedef void (mlx5e_cq_comp_t)(struct mlx5_core_cq *); +#definemlx5_en_err(_dev, format, ...) \ + if_printf(_dev, "ERR: ""%s:%d:(pid %d): " format, \ + __func__, __LINE__, curthread->td_proc->p_pid, \ + ##__VA_ARGS__) + +#definemlx5_en_warn(_dev, format, ...) \ + if_printf(_dev, "WARN: ""%s:%d:(pid %d): " format, \ + __func__, __LINE__, curthread->td_proc->p_pid, \ + ##__VA_ARGS__) + +#definemlx5_en_info(_dev, format, ...) \ + if_printf(_dev, "INFO: ""%s:%d:(pid %d): " format, \ + __func__, __LINE__, curthread->td_proc->p_pid, \ + ##__VA_ARGS__) + #defineMLX5E_STATS_COUNT(a, ...) a #defineMLX5E_STATS_VAR(a, b, c, ...) b c; #defineMLX5E_STATS_DESC(a, b, c, d, e, ...) d, e, Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c == --- head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Wed Oct 2 09:48:01 2019 (r352975) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Wed Oct 2 09:49:44 2019 (r352976) @@ -684,7 +684,7 @@ mlx5e_ethtool_handler(SYSCTL_HANDLER_ARGS) } else { priv->params.hw_lro_en = false; - if_printf(priv->ifp, "To enable HW LRO " + mlx5_en_warn(priv->ifp, "To enable HW LRO " "please also enable LRO via ifconfig(8).\n"); } } else { @@ -824,8 +824,8 @@ mlx5e_get_eeprom_info(struct mlx5e_priv *priv, struct ret = mlx5_query_module_num(dev, >module_num); if (ret) { - if_printf(priv->ifp, "%s:%d: Failed query module error=%d\n", - __func__, __LINE__, ret); + mlx5_en_err(priv->ifp, "Failed query module error=%d\n", + ret); return (ret); } @@ -834,8 +834,8 @@ mlx5e_get_eeprom_info(struct mlx5e_priv *priv, struct eeprom->device_addr, MLX5E_EEPROM_INFO_BYTES, eeprom->module_num, , _read); if (ret) { - if_printf(priv->ifp, "%s:%d: Failed query eeprom module error=0x%x\n", - __func__, __LINE__, ret); + mlx5_en_err(priv->ifp, + "Failed query eeprom module error=0x%x\n", ret); return (ret); } @@ -862,8 +862,9 @@ mlx5e_get_eeprom_info(struct mlx5e_priv *priv, struct eeprom->len = MLX5E_ETH_MODULE_SFF_8472_LEN; break; default: - if_printf(priv->ifp, "%s:%d: Not recognized cable type = 0x%x(%s)\n", - __func__, __LINE__, data & MLX5_EEPROM_IDENTIFIER_BYTE_MASK, + mlx5_en_err(priv->ifp, + "Not recognized cable type = 0x%x(%s)\n", + data & MLX5_EEPROM_IDENTIFIER_BYTE_MASK, sff_8024_id[data & MLX5_EEPROM_IDENTIFIER_BYTE_MASK]); return (EINVAL); } @@ -887,8 +888,8 @@ mlx5e_get_eeprom(struct mlx5e_priv *priv, struct mlx5e ee->len - ee->device_addr, ee->module_num, ee->data + (ee->device_addr / 4), _read); if (ret) { - if_printf(priv->ifp, "%s:%d: Failed reading eeprom, " - "error = 0x%02x\n", __func__, __LINE__, ret); + mlx5_en_err(priv->ifp, + "Failed reading eeprom, error = 0x%02x\n",ret); return (ret); } ee->device_addr += size_read; @@ -906,8 +907,9 @@ mlx5e_get_eeprom(struct mlx5e_priv *priv, struct mlx5e ((ee->device_addr - MLX5E_EEPROM_HIGH_PAGE_OFFSET) / 4), _read); if (ret) { - if_printf(priv->ifp, "%s:%d:
svn commit: r352975 - head/sys/dev/mlx5/mlx5_core
Author: hselasky Date: Wed Oct 2 09:48:01 2019 New Revision: 352975 URL: https://svnweb.freebsd.org/changeset/base/352975 Log: Unify prints in mlx5core. All prints in mlx5core should use on of the macros: mlx5_core_err/dbg/warn Submitted by: slavash@ MFC after:3 days Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c head/sys/dev/mlx5/mlx5_core/mlx5_core.h head/sys/dev/mlx5/mlx5_core/mlx5_eq.c head/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c head/sys/dev/mlx5/mlx5_core/mlx5_fw.c head/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c head/sys/dev/mlx5/mlx5_core/mlx5_health.c head/sys/dev/mlx5/mlx5_core/mlx5_main.c head/sys/dev/mlx5/mlx5_core/mlx5_mpfs.c head/sys/dev/mlx5/mlx5_core/mlx5_port.c Modified: head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c == --- head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Wed Oct 2 09:46:14 2019 (r352974) +++ head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Wed Oct 2 09:48:01 2019 (r352975) @@ -1489,7 +1489,9 @@ int mlx5_cmd_init(struct mlx5_core_dev *dev) memset(cmd, 0, sizeof(*cmd)); cmd_if_rev = cmdif_rev_get(dev); if (cmd_if_rev != CMD_IF_REV) { - device_printf((>pdev->dev)->bsddev, "ERR: ""Driver cmdif rev(%d) differs from firmware's(%d)\n", CMD_IF_REV, cmd_if_rev); + mlx5_core_err(dev, + "Driver cmdif rev(%d) differs from firmware's(%d)\n", + CMD_IF_REV, cmd_if_rev); return -EINVAL; } @@ -1501,13 +1503,16 @@ int mlx5_cmd_init(struct mlx5_core_dev *dev) cmd->log_sz = cmd_l >> 4 & 0xf; cmd->log_stride = cmd_l & 0xf; if (1 << cmd->log_sz > MLX5_MAX_COMMANDS) { - device_printf((>pdev->dev)->bsddev, "ERR: ""firmware reports too many outstanding commands %d\n", 1 << cmd->log_sz); + mlx5_core_err(dev, + "firmware reports too many outstanding commands %d\n", + 1 << cmd->log_sz); err = -EINVAL; goto err_free_page; } if (cmd->log_sz + cmd->log_stride > MLX5_ADAPTER_PAGE_SHIFT) { - device_printf((>pdev->dev)->bsddev, "ERR: ""command queue size overflow\n"); + mlx5_core_err(dev, + "command queue size overflow\n"); err = -EINVAL; goto err_free_page; } @@ -1518,7 +1523,9 @@ int mlx5_cmd_init(struct mlx5_core_dev *dev) cmd->cmdif_rev = ioread32be(>iseg->cmdif_rev_fw_sub) >> 16; if (cmd->cmdif_rev > CMD_IF_REV) { - device_printf((>pdev->dev)->bsddev, "ERR: ""driver does not support command interface version. driver %d, firmware %d\n", CMD_IF_REV, cmd->cmdif_rev); + mlx5_core_err(dev, + "driver does not support command interface version. driver %d, firmware %d\n", + CMD_IF_REV, cmd->cmdif_rev); err = -ENOTSUPP; goto err_free_page; } @@ -1534,7 +1541,7 @@ int mlx5_cmd_init(struct mlx5_core_dev *dev) cmd_h = (u32)((u64)(cmd->dma) >> 32); cmd_l = (u32)(cmd->dma); if (cmd_l & 0xfff) { - device_printf((>pdev->dev)->bsddev, "ERR: ""invalid command queue address\n"); + mlx5_core_err(dev, "invalid command queue address\n"); err = -ENOMEM; goto err_free_page; } @@ -1551,7 +1558,7 @@ int mlx5_cmd_init(struct mlx5_core_dev *dev) err = create_msg_cache(dev); if (err) { - device_printf((>pdev->dev)->bsddev, "ERR: ""failed to create command cache\n"); + mlx5_core_err(dev, "failed to create command cache\n"); goto err_free_page; } return 0; Modified: head/sys/dev/mlx5/mlx5_core/mlx5_core.h == --- head/sys/dev/mlx5/mlx5_core/mlx5_core.h Wed Oct 2 09:46:14 2019 (r352974) +++ head/sys/dev/mlx5/mlx5_core/mlx5_core.h Wed Oct 2 09:48:01 2019 (r352975) @@ -53,13 +53,18 @@ do { \ mlx5_core_dbg(dev, format, ##__VA_ARGS__); \ } while (0) -#define mlx5_core_err(_dev, format, ...) \ - device_printf((&(_dev)->pdev->dev)->bsddev, "ERR: ""%s:%d:(pid %d): " format, \ +#definemlx5_core_err(_dev, format, ...) \ + device_printf((_dev)->pdev->dev.bsddev, "ERR: ""%s:%d:(pid %d): " format, \ __func__, __LINE__, curthread->td_proc->p_pid, \ ##__VA_ARGS__) -#define mlx5_core_warn(_dev, format, ...) \ - device_printf((&(_dev)->pdev->dev)->bsddev, "WARN: ""%s:%d:(pid %d): " format, \ +#define
svn commit: r352974 - head/sys/dev/mlx5/mlx5_core
Author: hselasky Date: Wed Oct 2 09:46:14 2019 New Revision: 352974 URL: https://svnweb.freebsd.org/changeset/base/352974 Log: Add proper print in case of 0x0 health syndrome in mlx5core. In case of health counter fails to increment it indicates a bad device health. In case when the syndrome indicated by firmware is 0x0, this indicates that firmware is unable to respond to initialization segment reads. Add proper print in this case. Submitted by: slavash@ MFC after:3 days Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_core/mlx5_health.c Modified: head/sys/dev/mlx5/mlx5_core/mlx5_health.c == --- head/sys/dev/mlx5/mlx5_core/mlx5_health.c Wed Oct 2 09:45:07 2019 (r352973) +++ head/sys/dev/mlx5/mlx5_core/mlx5_health.c Wed Oct 2 09:46:14 2019 (r352974) @@ -490,17 +490,23 @@ static const char *hsynd_str(u8 synd) } } -static void print_health_info(struct mlx5_core_dev *dev) +static u8 +print_health_info(struct mlx5_core_dev *dev) { struct mlx5_core_health *health = >priv.health; struct mlx5_health_buffer __iomem *h = health->health; + u8 synd = ioread8(>synd); char fw_str[18]; u32 fw; int i; - /* If the syndrom is 0, the device is OK and no need to print buffer */ - if (!ioread8(>synd)) - return; + /* +* If synd is 0x0 - this indicates that FW is unable to +* respond to initialization segment reads and health buffer +* should not be read. +*/ + if (synd == 0) + return (0); for (i = 0; i < ARRAY_SIZE(h->assert_var); i++) printf("mlx5_core: INFO: ""assert_var[%d] 0x%08x\n", i, ioread32be(h->assert_var + i)); @@ -511,10 +517,12 @@ static void print_health_info(struct mlx5_core_dev *de printf("mlx5_core: INFO: ""fw_ver %s\n", fw_str); printf("mlx5_core: INFO: ""hw_id 0x%08x\n", ioread32be(>hw_id)); printf("mlx5_core: INFO: ""irisc_index %d\n", ioread8(>irisc_index)); - printf("mlx5_core: INFO: ""synd 0x%x: %s\n", ioread8(>synd), hsynd_str(ioread8(>synd))); + printf("mlx5_core: INFO: ""synd 0x%x: %s\n", synd, hsynd_str(synd)); printf("mlx5_core: INFO: ""ext_synd 0x%04x\n", ioread16be(>ext_synd)); fw = ioread32be(>fw_ver); printf("mlx5_core: INFO: ""raw fw_ver 0x%08x\n", fw); + + return synd; } static void health_watchdog(struct work_struct *work) @@ -596,7 +604,8 @@ static void poll_health(unsigned long data) health->prev = count; if (health->miss_counter == MAX_MISSES) { mlx5_core_err(dev, "device's health compromised - reached miss count\n"); - print_health_info(dev); + if (print_health_info(dev) == 0) + mlx5_core_err(dev, "FW is unable to respond to initialization segment reads\n"); } fatal_error = check_fatal_sensors(dev); ___ 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: r352973 - head/sys/dev/mlx5/mlx5_core
Author: hselasky Date: Wed Oct 2 09:45:07 2019 New Revision: 352973 URL: https://svnweb.freebsd.org/changeset/base/352973 Log: Add missing blank line at the end of the print in mlx5core. Submitted by: slavash@ MFC after:3 days Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_core/mlx5_eq.c Modified: head/sys/dev/mlx5/mlx5_core/mlx5_eq.c == --- head/sys/dev/mlx5/mlx5_core/mlx5_eq.c Wed Oct 2 09:43:48 2019 (r352972) +++ head/sys/dev/mlx5/mlx5_core/mlx5_eq.c Wed Oct 2 09:45:07 2019 (r352973) @@ -219,7 +219,7 @@ mlx5_temp_warning_event(struct mlx5_core_dev *dev, str { mlx5_core_warn(dev, - "High temperature on sensors with bit set %#jx %#jx", + "High temperature on sensors with bit set %#jx %#jx\n", (uintmax_t)be64_to_cpu(eqe->data.temp_warning.sensor_warning_msb), (uintmax_t)be64_to_cpu(eqe->data.temp_warning.sensor_warning_lsb)); } ___ 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: r352972 - in head/sys: conf dev/mlx5/mlx5_core modules/mlx5
Author: hselasky Date: Wed Oct 2 09:43:48 2019 New Revision: 352972 URL: https://svnweb.freebsd.org/changeset/base/352972 Log: Remove no longer needed fwdump register tables from mlx5core. Submitted by: kib@ MFC after:3 days Sponsored by: Mellanox Technologies Deleted: head/sys/dev/mlx5/mlx5_core/mlx5_fwdump_regmaps.c Modified: head/sys/conf/files head/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c head/sys/modules/mlx5/Makefile Modified: head/sys/conf/files == --- head/sys/conf/files Wed Oct 2 09:40:23 2019(r352971) +++ head/sys/conf/files Wed Oct 2 09:43:48 2019(r352972) @@ -4717,8 +4717,6 @@ dev/mlx5/mlx5_core/mlx5_fw.c optional mlx5 pci \ compile-with "${OFED_C}" dev/mlx5/mlx5_core/mlx5_fwdump.c optional mlx5 pci \ compile-with "${OFED_C}" -dev/mlx5/mlx5_core/mlx5_fwdump_regmaps.c optional mlx5 pci \ - compile-with "${OFED_C}" dev/mlx5/mlx5_core/mlx5_health.c optional mlx5 pci \ compile-with "${OFED_C}" dev/mlx5/mlx5_core/mlx5_mad.c optional mlx5 pci \ Modified: head/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c == --- head/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Wed Oct 2 09:40:23 2019 (r352971) +++ head/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Wed Oct 2 09:43:48 2019 (r352972) @@ -35,10 +35,6 @@ __FBSDID("$FreeBSD$"); #include #include -extern const struct mlx5_crspace_regmap mlx5_crspace_regmap_mt4117[]; -extern const struct mlx5_crspace_regmap mlx5_crspace_regmap_mt4115[]; -extern const struct mlx5_crspace_regmap mlx5_crspace_regmap_connectx5[]; - static MALLOC_DEFINE(M_MLX5_DUMP, "MLX5DUMP", "MLX5 Firmware dump"); static unsigned Modified: head/sys/modules/mlx5/Makefile == --- head/sys/modules/mlx5/Makefile Wed Oct 2 09:40:23 2019 (r352971) +++ head/sys/modules/mlx5/Makefile Wed Oct 2 09:43:48 2019 (r352972) @@ -14,7 +14,6 @@ mlx5_fs_cmd.c \ mlx5_fs_tree.c \ mlx5_fw.c \ mlx5_fwdump.c \ -mlx5_fwdump_regmaps.c \ mlx5_health.c \ mlx5_mad.c \ mlx5_main.c \ ___ 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: r352971 - in head/sys/dev/mlx5: . mlx5_core
Author: hselasky Date: Wed Oct 2 09:40:23 2019 New Revision: 352971 URL: https://svnweb.freebsd.org/changeset/base/352971 Log: Read rege map from crdump scan space in mlx5core. Submitted by: kib@ MFC after:3 days Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/driver.h head/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Modified: head/sys/dev/mlx5/driver.h == --- head/sys/dev/mlx5/driver.h Wed Oct 2 09:34:34 2019(r352970) +++ head/sys/dev/mlx5/driver.h Wed Oct 2 09:40:23 2019(r352971) @@ -698,7 +698,7 @@ struct mlx5_core_dev { struct mlx5_flow_root_namespace *sniffer_rx_root_ns; struct mlx5_flow_root_namespace *sniffer_tx_root_ns; u32 num_q_counter_allocated[MLX5_INTERFACE_NUMBER]; - const struct mlx5_crspace_regmap *dump_rege; + struct mlx5_crspace_regmap *dump_rege; uint32_t *dump_data; unsigned dump_size; bool dump_valid; Modified: head/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c == --- head/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Wed Oct 2 09:34:34 2019 (r352970) +++ head/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Wed Oct 2 09:40:23 2019 (r352971) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2018, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2018, 2019 Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -64,7 +64,10 @@ mlx5_fwdump_destroy_dd(struct mlx5_core_dev *mdev) void mlx5_fwdump_prep(struct mlx5_core_dev *mdev) { - int error; + device_t dev; + int error, vsc_addr; + unsigned i, sz; + u32 addr, in, out, next_addr; mdev->dump_data = NULL; error = mlx5_vsc_find_cap(mdev); @@ -74,25 +77,77 @@ mlx5_fwdump_prep(struct mlx5_core_dev *mdev) "mlx5_fwdump_prep failed %d\n", error); return; } - switch (pci_get_device(mdev->pdev->dev.bsddev)) { - case 0x1013: - mdev->dump_rege = mlx5_crspace_regmap_mt4115; - break; - case 0x1015: - mdev->dump_rege = mlx5_crspace_regmap_mt4117; - break; - case 0x1017: - case 0x1019: - mdev->dump_rege = mlx5_crspace_regmap_connectx5; - break; - default: - return; /* silently fail, do not prevent driver attach */ + error = mlx5_vsc_lock(mdev); + if (error != 0) + return; + error = mlx5_vsc_set_space(mdev, MLX5_VSC_DOMAIN_SCAN_CRSPACE); + if (error != 0) { + mlx5_core_warn(mdev, "VSC scan space is not supported\n"); + goto unlock_vsc; } + dev = mdev->pdev->dev.bsddev; + vsc_addr = mdev->vsc_addr; + if (vsc_addr == 0) { + mlx5_core_warn(mdev, "Cannot read vsc, no address\n"); + goto unlock_vsc; + } + + in = 0; + for (sz = 1, addr = 0;;) { + MLX5_VSC_SET(vsc_addr, , address, addr); + pci_write_config(dev, vsc_addr + MLX5_VSC_ADDR_OFFSET, in, 4); + error = mlx5_vsc_wait_on_flag(mdev, 1); + if (error != 0) { + mlx5_core_warn(mdev, + "Failed waiting for read complete flag, error %d\n", error); + goto unlock_vsc; + } + pci_read_config(dev, vsc_addr + MLX5_VSC_DATA_OFFSET, 4); + out = pci_read_config(dev, vsc_addr + MLX5_VSC_ADDR_OFFSET, 4); + next_addr = MLX5_VSC_GET(vsc_addr, , address); + if (next_addr == 0 || next_addr == addr) + break; + if (next_addr != addr + 4) + sz++; + addr = next_addr; + } + mdev->dump_rege = malloc(sz * sizeof(struct mlx5_crspace_regmap), + M_MLX5_DUMP, M_WAITOK | M_ZERO); + + for (i = 0, addr = 0;;) { + MPASS(i < sz); + mdev->dump_rege[i].cnt++; + MLX5_VSC_SET(vsc_addr, , address, addr); + pci_write_config(dev, vsc_addr + MLX5_VSC_ADDR_OFFSET, in, 4); + error = mlx5_vsc_wait_on_flag(mdev, 1); + if (error != 0) { + mlx5_core_warn(mdev, + "Failed waiting for read complete flag, error %d\n", error); + free(mdev->dump_rege, M_MLX5_DUMP); + mdev->dump_rege = NULL; + goto unlock_vsc; + } + pci_read_config(dev, vsc_addr + MLX5_VSC_DATA_OFFSET, 4); + out = pci_read_config(dev, vsc_addr + MLX5_VSC_ADDR_OFFSET, 4); + next_addr = MLX5_VSC_GET(vsc_addr, ,
svn commit: r352970 - head/sys/dev/mlx5
Author: hselasky Date: Wed Oct 2 09:34:34 2019 New Revision: 352970 URL: https://svnweb.freebsd.org/changeset/base/352970 Log: Define MLX5_VSC_DOMAIN_SCAN_CRSPACE. Submitted by: kib@ MFC after:3 days Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_ifc.h Modified: head/sys/dev/mlx5/mlx5_ifc.h == --- head/sys/dev/mlx5/mlx5_ifc.hWed Oct 2 09:33:38 2019 (r352969) +++ head/sys/dev/mlx5/mlx5_ifc.hWed Oct 2 09:34:34 2019 (r352970) @@ -9725,6 +9725,7 @@ struct mlx5_ifc_mtt_bits { enum { MLX5_VSC_DOMAIN_ICMD= 0x1, MLX5_VSC_DOMAIN_PROTECTED_CRSPACE = 0x6, + MLX5_VSC_DOMAIN_SCAN_CRSPACE= 0x7, MLX5_VSC_DOMAIN_SEMAPHORES = 0xA, }; ___ 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: r352969 - head/sys/dev/mlx5/mlx5_core
Author: hselasky Date: Wed Oct 2 09:33:38 2019 New Revision: 352969 URL: https://svnweb.freebsd.org/changeset/base/352969 Log: Use the MLX5_VSC_DOMAIN_SEMAPHORES constant instead of hand-rolled symbol in mlx5core. Submitted by: kib@ MFC after:3 days Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_core/mlx5_vsc.c Modified: head/sys/dev/mlx5/mlx5_core/mlx5_vsc.c == --- head/sys/dev/mlx5/mlx5_core/mlx5_vsc.c Wed Oct 2 09:32:41 2019 (r352968) +++ head/sys/dev/mlx5/mlx5_core/mlx5_vsc.c Wed Oct 2 09:33:38 2019 (r352969) @@ -29,8 +29,6 @@ #include #include -#defineMLX5_SEMAPHORE_SPACE_DOMAIN 0xA - int mlx5_vsc_lock(struct mlx5_core_dev *mdev) { device_t dev = mdev->pdev->dev.bsddev; @@ -188,7 +186,7 @@ int mlx5_vsc_lock_addr_space(struct mlx5_core_dev *mde int ret; u32 id; - ret = mlx5_vsc_set_space(mdev, MLX5_SEMAPHORE_SPACE_DOMAIN); + ret = mlx5_vsc_set_space(mdev, MLX5_VSC_DOMAIN_SEMAPHORES); if (ret) return ret; @@ -215,7 +213,7 @@ int mlx5_vsc_unlock_addr_space(struct mlx5_core_dev *m u32 data = 0; int ret; - ret = mlx5_vsc_set_space(mdev, MLX5_SEMAPHORE_SPACE_DOMAIN); + ret = mlx5_vsc_set_space(mdev, MLX5_VSC_DOMAIN_SEMAPHORES); if (ret) return ret; ___ 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: r352968 - in head/sys/dev/mlx5: . mlx5_core
Author: hselasky Date: Wed Oct 2 09:32:41 2019 New Revision: 352968 URL: https://svnweb.freebsd.org/changeset/base/352968 Log: Move mlx5_ifc_vsc_space_bits and mlx5_ifc_vsc_addr_bits to mlx5_ifc.h. Submitted by: kib@ MFC after:3 days Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_core/mlx5_vsc.c head/sys/dev/mlx5/mlx5_ifc.h Modified: head/sys/dev/mlx5/mlx5_core/mlx5_vsc.c == --- head/sys/dev/mlx5/mlx5_core/mlx5_vsc.c Wed Oct 2 09:31:36 2019 (r352967) +++ head/sys/dev/mlx5/mlx5_core/mlx5_vsc.c Wed Oct 2 09:32:41 2019 (r352968) @@ -31,18 +31,6 @@ #defineMLX5_SEMAPHORE_SPACE_DOMAIN 0xA -struct mlx5_ifc_vsc_space_bits { - u8 status[0x3]; - u8 reserved0[0xd]; - u8 space[0x10]; -}; - -struct mlx5_ifc_vsc_addr_bits { - u8 flag[0x1]; - u8 reserved0[0x1]; - u8 address[0x1e]; -}; - int mlx5_vsc_lock(struct mlx5_core_dev *mdev) { device_t dev = mdev->pdev->dev.bsddev; Modified: head/sys/dev/mlx5/mlx5_ifc.h == --- head/sys/dev/mlx5/mlx5_ifc.hWed Oct 2 09:31:36 2019 (r352967) +++ head/sys/dev/mlx5/mlx5_ifc.hWed Oct 2 09:32:41 2019 (r352968) @@ -9749,6 +9749,18 @@ struct mlx5_ifc_vendor_specific_cap_bits { u8 data[0x20]; }; +struct mlx5_ifc_vsc_space_bits { + u8 status[0x3]; + u8 reserved0[0xd]; + u8 space[0x10]; +}; + +struct mlx5_ifc_vsc_addr_bits { + u8 flag[0x1]; + u8 reserved0[0x1]; + u8 address[0x1e]; +}; + enum { MLX5_INITIAL_SEG_NIC_INTERFACE_FULL_DRIVER = 0x0, MLX5_INITIAL_SEG_NIC_INTERFACE_DISABLED = 0x1, ___ 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: r352967 - in head/sys/dev/mlx5: . mlx5_core
Author: hselasky Date: Wed Oct 2 09:31:36 2019 New Revision: 352967 URL: https://svnweb.freebsd.org/changeset/base/352967 Log: Make the mlx5_vsc_wait_on_flag(9) function global. Submitted by: kib@ MFC after:3 days Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/driver.h head/sys/dev/mlx5/mlx5_core/mlx5_vsc.c Modified: head/sys/dev/mlx5/driver.h == --- head/sys/dev/mlx5/driver.h Wed Oct 2 09:29:55 2019(r352966) +++ head/sys/dev/mlx5/driver.h Wed Oct 2 09:31:36 2019(r352967) @@ -1096,6 +1096,7 @@ int mlx5_vsc_find_cap(struct mlx5_core_dev *mdev); int mlx5_vsc_lock(struct mlx5_core_dev *mdev); void mlx5_vsc_unlock(struct mlx5_core_dev *mdev); int mlx5_vsc_set_space(struct mlx5_core_dev *mdev, u16 space); +int mlx5_vsc_wait_on_flag(struct mlx5_core_dev *mdev, u32 expected); int mlx5_vsc_write(struct mlx5_core_dev *mdev, u32 addr, const u32 *data); int mlx5_vsc_read(struct mlx5_core_dev *mdev, u32 addr, u32 *data); int mlx5_vsc_lock_addr_space(struct mlx5_core_dev *mdev, u32 addr); Modified: head/sys/dev/mlx5/mlx5_core/mlx5_vsc.c == --- head/sys/dev/mlx5/mlx5_core/mlx5_vsc.c Wed Oct 2 09:29:55 2019 (r352966) +++ head/sys/dev/mlx5/mlx5_core/mlx5_vsc.c Wed Oct 2 09:31:36 2019 (r352967) @@ -96,7 +96,8 @@ void mlx5_vsc_unlock(struct mlx5_core_dev *mdev) pci_write_config(dev, vsc_addr + MLX5_VSC_SEMA_OFFSET, 0, 4); } -static int mlx5_vsc_wait_on_flag(struct mlx5_core_dev *mdev, u32 expected) +int +mlx5_vsc_wait_on_flag(struct mlx5_core_dev *mdev, u32 expected) { device_t dev = mdev->pdev->dev.bsddev; int vsc_addr = mdev->vsc_addr; ___ 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: r352966 - in head/sys/dev/mlx5: . mlx5_core mlx5_en
Author: hselasky Date: Wed Oct 2 09:29:55 2019 New Revision: 352966 URL: https://svnweb.freebsd.org/changeset/base/352966 Log: Add port module event software counters in mlx5core. While at it, fixup PME based on latest PRM defines. Submitted by: slavash@ MFC after:3 days Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/device.h head/sys/dev/mlx5/driver.h head/sys/dev/mlx5/mlx5_core/mlx5_eq.c head/sys/dev/mlx5/mlx5_core/mlx5_main.c head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Modified: head/sys/dev/mlx5/device.h == --- head/sys/dev/mlx5/device.h Wed Oct 2 09:27:56 2019(r352965) +++ head/sys/dev/mlx5/device.h Wed Oct 2 09:29:55 2019(r352966) @@ -537,7 +537,7 @@ enum { MLX5_MODULE_STATUS_PLUGGED_ENABLED = 0x1, MLX5_MODULE_STATUS_UNPLUGGED= 0x2, MLX5_MODULE_STATUS_ERROR= 0x3, - MLX5_MODULE_STATUS_PLUGGED_DISABLED = 0x4, + MLX5_MODULE_STATUS_NUM , }; enum { @@ -549,7 +549,7 @@ enum { MLX5_MODULE_EVENT_ERROR_UNSUPPORTED_CABLE = 0x5, MLX5_MODULE_EVENT_ERROR_HIGH_TEMPERATURE = 0x6, MLX5_MODULE_EVENT_ERROR_CABLE_IS_SHORTED = 0x7, - MLX5_MODULE_EVENT_ERROR_PCIE_SYSTEM_POWER_SLOT_EXCEEDED = 0xc, + MLX5_MODULE_EVENT_ERROR_NUM , }; struct mlx5_eqe_port_module_event { Modified: head/sys/dev/mlx5/driver.h == --- head/sys/dev/mlx5/driver.h Wed Oct 2 09:27:56 2019(r352965) +++ head/sys/dev/mlx5/driver.h Wed Oct 2 09:29:55 2019(r352966) @@ -569,6 +569,11 @@ struct mlx5_rl_table { }; #endif +struct mlx5_pme_stats { + u64 status_counters[MLX5_MODULE_STATUS_NUM]; + u64 error_counters[MLX5_MODULE_EVENT_ERROR_NUM]; +}; + struct mlx5_priv { charname[MLX5_MAX_NAME_LEN]; struct mlx5_eq_tableeq_table; @@ -624,6 +629,7 @@ struct mlx5_priv { #ifdef RATELIMIT struct mlx5_rl_tablerl_table; #endif + struct mlx5_pme_stats pme_stats; }; enum mlx5_device_state { Modified: head/sys/dev/mlx5/mlx5_core/mlx5_eq.c == --- head/sys/dev/mlx5/mlx5_core/mlx5_eq.c Wed Oct 2 09:27:56 2019 (r352965) +++ head/sys/dev/mlx5/mlx5_core/mlx5_eq.c Wed Oct 2 09:29:55 2019 (r352966) @@ -639,9 +639,9 @@ static const char *mlx5_port_module_event_error_type_t { switch (error_type) { case MLX5_MODULE_EVENT_ERROR_POWER_BUDGET_EXCEEDED: - return "Power Budget Exceeded"; + return "Power budget exceeded"; case MLX5_MODULE_EVENT_ERROR_LONG_RANGE_FOR_NON_MLNX_CABLE_MODULE: - return "Long Range for non MLNX cable/module"; + return "Long Range for non MLNX cable"; case MLX5_MODULE_EVENT_ERROR_BUS_STUCK: return "Bus stuck(I2C or data shorted)"; case MLX5_MODULE_EVENT_ERROR_NO_EEPROM_RETRY_TIMEOUT: @@ -649,18 +649,11 @@ static const char *mlx5_port_module_event_error_type_t case MLX5_MODULE_EVENT_ERROR_ENFORCE_PART_NUMBER_LIST: return "Enforce part number list"; case MLX5_MODULE_EVENT_ERROR_UNSUPPORTED_CABLE: - return "Unsupported Cable"; + return "Unknown identifier"; case MLX5_MODULE_EVENT_ERROR_HIGH_TEMPERATURE: return "High Temperature"; case MLX5_MODULE_EVENT_ERROR_CABLE_IS_SHORTED: - return "Cable is shorted"; - case MLX5_MODULE_EVENT_ERROR_PCIE_SYSTEM_POWER_SLOT_EXCEEDED: - return "One or more network ports have been powered " - "down due to insufficient/unadvertised power on " - "the PCIe slot. Please refer to the card's user " - "manual for power specifications or contact " - "Mellanox support."; - + return "Bad or shorted cable/module"; default: return "Unknown error type"; } @@ -686,29 +679,36 @@ static void mlx5_port_module_event(struct mlx5_core_de module_num = (unsigned int)module_event_eqe->module; module_status = (unsigned int)module_event_eqe->module_status & - PORT_MODULE_EVENT_MODULE_STATUS_MASK; + PORT_MODULE_EVENT_MODULE_STATUS_MASK; error_type = (unsigned int)module_event_eqe->error_type & -PORT_MODULE_EVENT_ERROR_TYPE_MASK; + PORT_MODULE_EVENT_ERROR_TYPE_MASK; + if (module_status < MLX5_MODULE_STATUS_NUM) + dev->priv.pme_stats.status_counters[module_status]++; switch (module_status) {
svn commit: r352965 - head/sys/dev/mlx5/mlx5_en
Author: hselasky Date: Wed Oct 2 09:27:56 2019 New Revision: 352965 URL: https://svnweb.freebsd.org/changeset/base/352965 Log: Correct and update some counter names in mlx5en(4). MFC after:3 days Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_en/en.h Modified: head/sys/dev/mlx5/mlx5_en/en.h == --- head/sys/dev/mlx5/mlx5_en/en.h Wed Oct 2 09:27:08 2019 (r352964) +++ head/sys/dev/mlx5/mlx5_en/en.h Wed Oct 2 09:27:56 2019 (r352965) @@ -256,7 +256,7 @@ struct mlx5e_vport_stats { m(+1, u64, out_broadcast_pkts, "out_broadcast_pkts", "Out broadcast packets") #defineMLX5E_PPORT_ETHERNET_EXTENDED_STATS_DEBUG(m) \ - m(+1, u64, port_transmit_wait_high, "port_transmit_wait_high", "Port transmit wait high") \ + m(+1, u64, port_transmit_wait, "port_transmit_wait", "Port transmit wait") \ m(+1, u64, ecn_marked, "ecn_marked", "ECN marked") \ m(+1, u64, no_buffer_discard_mc, "no_buffer_discard_mc", "No buffer discard mc") \ m(+1, u64, rx_ebp, "rx_ebp", "RX EBP") \ @@ -340,14 +340,14 @@ struct mlx5e_vport_stats { /* Per priority statistics for PFC */ #defineMLX5E_PPORT_PER_PRIO_STATS_SUB(m,n,p) \ m(n, p, +1, u64, rx_octets, "rx_octets", "Received octets") \ - m(n, p, +1, u64, reserved_0, "reserved_0", "Reserved") \ - m(n, p, +1, u64, reserved_1, "reserved_1", "Reserved") \ - m(n, p, +1, u64, reserved_2, "reserved_2", "Reserved") \ + m(n, p, +1, u64, rx_uc_frames, "rx_uc_frames", "Received unicast frames") \ + m(n, p, +1, u64, rx_mc_frames, "rx_mc_frames", "Received multicast frames") \ + m(n, p, +1, u64, rx_bc_frames, "rx_bc_frames", "Received broadcast frames") \ m(n, p, +1, u64, rx_frames, "rx_frames", "Received frames") \ m(n, p, +1, u64, tx_octets, "tx_octets", "Transmitted octets") \ - m(n, p, +1, u64, reserved_3, "reserved_3", "Reserved") \ - m(n, p, +1, u64, reserved_4, "reserved_4", "Reserved") \ - m(n, p, +1, u64, reserved_5, "reserved_5", "Reserved") \ + m(n, p, +1, u64, tx_uc_frames, "tx_uc_frames", "Transmitted unicast frames") \ + m(n, p, +1, u64, tx_mc_frames, "tx_mc_frames", "Transmitted multicast frames") \ + m(n, p, +1, u64, tx_bc_frames, "tx_bc_frames", "Transmitted broadcast frames") \ m(n, p, +1, u64, tx_frames, "tx_frames", "Transmitted frames") \ m(n, p, +1, u64, rx_pause, "rx_pause", "Received pause frames") \ m(n, p, +1, u64, rx_pause_duration, "rx_pause_duration", \ ___ 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: r352964 - head/sys/dev/mlx5/mlx5_en
Author: hselasky Date: Wed Oct 2 09:27:08 2019 New Revision: 352964 URL: https://svnweb.freebsd.org/changeset/base/352964 Log: Export channel IRQ number as part of the "hw_ctx_debug" sysctl(8) in mlx5en(4). MFC after:3 days Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c == --- head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Wed Oct 2 09:23:33 2019 (r352963) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Wed Oct 2 09:27:08 2019 (r352964) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015 Mellanox Technologies. All rights reserved. + * Copyright (c) 2015-2019 Mellanox Technologies. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -1031,30 +1031,49 @@ mlx5e_ethtool_debug_channel_info(SYSCTL_HANDLER_ARGS) struct mlx5e_sq *sq; struct mlx5e_rq *rq; int error, i, tc; + bool opened; priv = arg1; error = sysctl_wire_old_buffer(req, 0); if (error != 0) return (error); - if (sbuf_new_for_sysctl(, NULL, 128, req) == NULL) + if (sbuf_new_for_sysctl(, NULL, 1024, req) == NULL) return (ENOMEM); sbuf_clear_flags(, SBUF_INCLUDENUL); PRIV_LOCK(priv); - if (test_bit(MLX5E_STATE_OPENED, >state) == 0) - goto out; - for (i = 0; i < priv->params.num_channels; i++) { - c = >channel[i]; - rq = >rq; - sbuf_printf(, "channel %d rq %d cq %d\n", - c->ix, rq->rqn, rq->cq.mcq.cqn); - for (tc = 0; tc < c->num_tc; tc++) { - sq = >sq[tc]; - sbuf_printf(, "channel %d tc %d sq %d cq %d\n", - c->ix, tc, sq->sqn, sq->cq.mcq.cqn); + opened = test_bit(MLX5E_STATE_OPENED, >state); + + sbuf_printf(, "pages irq %d\n", + priv->mdev->priv.msix_arr[MLX5_EQ_VEC_PAGES].vector); + sbuf_printf(, "command irq %d\n", + priv->mdev->priv.msix_arr[MLX5_EQ_VEC_CMD].vector); + sbuf_printf(, "async irq %d\n", + priv->mdev->priv.msix_arr[MLX5_EQ_VEC_ASYNC].vector); + + for (i = 0; i != priv->params.num_channels; i++) { + int eqn_not_used = -1; + int irqn = MLX5_EQ_VEC_COMP_BASE; + + if (mlx5_vector2eqn(priv->mdev, i, _not_used, ) != 0) + continue; + + c = opened ? >channel[i] : NULL; + rq = opened ? >rq : NULL; + sbuf_printf(, "channel %d rq %d cq %d irq %d\n", i, + opened ? rq->rqn : -1, + opened ? rq->cq.mcq.cqn : -1, + priv->mdev->priv.msix_arr[irqn].vector); + + for (tc = 0; tc != priv->num_tc; tc++) { + sq = opened ? >sq[tc] : NULL; + sbuf_printf(, "channel %d tc %d sq %d cq %d irq %d\n", + i, tc, + opened ? sq->sqn : -1, + opened ? sq->cq.mcq.cqn : -1, + priv->mdev->priv.msix_arr[irqn].vector); } } -out: PRIV_UNLOCK(priv); error = sbuf_finish(); sbuf_delete(); ___ 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: r352963 - in head/sys/dev/mlx5: . mlx5_core
Author: hselasky Date: Wed Oct 2 09:23:33 2019 New Revision: 352963 URL: https://svnweb.freebsd.org/changeset/base/352963 Log: Cleanup naming of IRQ vectors in mlx5en. Remove unused IRQ naming functions and arrays. MFC after:3 days Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/driver.h head/sys/dev/mlx5/mlx5_core/mlx5_core.h head/sys/dev/mlx5/mlx5_core/mlx5_eq.c head/sys/dev/mlx5/mlx5_core/mlx5_main.c Modified: head/sys/dev/mlx5/driver.h == --- head/sys/dev/mlx5/driver.h Wed Oct 2 09:22:22 2019(r352962) +++ head/sys/dev/mlx5/driver.h Wed Oct 2 09:23:33 2019(r352963) @@ -84,10 +84,6 @@ enum { }; enum { - MLX5_MAX_IRQ_NAME = 32 -}; - -enum { MLX5_ATOMIC_MODE_OFF= 16, MLX5_ATOMIC_MODE_NONE = 0 << MLX5_ATOMIC_MODE_OFF, MLX5_ATOMIC_MODE_IB_COMP= 1 << MLX5_ATOMIC_MODE_OFF, @@ -556,10 +552,6 @@ struct mlx5_mr_table { struct radix_tree_root tree; }; -struct mlx5_irq_info { - char name[MLX5_MAX_IRQ_NAME]; -}; - #ifdef RATELIMIT struct mlx5_rl_entry { u32 rate; @@ -581,7 +573,6 @@ struct mlx5_priv { charname[MLX5_MAX_NAME_LEN]; struct mlx5_eq_tableeq_table; struct msix_entry *msix_arr; - struct mlx5_irq_info*irq_info; struct mlx5_uuar_info uuari; MLX5_DECLARE_DOORBELL_LOCK(cq_uar_lock); int disable_irqs; @@ -1029,7 +1020,7 @@ struct mlx5_core_srq *mlx5_core_get_srq(struct mlx5_co void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u64 vector, enum mlx5_cmd_mode mode); void mlx5_cq_event(struct mlx5_core_dev *dev, u32 cqn, int event_type); int mlx5_create_map_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq, u8 vecidx, - int nent, u64 mask, const char *name, struct mlx5_uar *uar); + int nent, u64 mask, struct mlx5_uar *uar); int mlx5_destroy_unmap_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq); int mlx5_start_eqs(struct mlx5_core_dev *dev); int mlx5_stop_eqs(struct mlx5_core_dev *dev); Modified: head/sys/dev/mlx5/mlx5_core/mlx5_core.h == --- head/sys/dev/mlx5/mlx5_core/mlx5_core.h Wed Oct 2 09:22:22 2019 (r352962) +++ head/sys/dev/mlx5/mlx5_core/mlx5_core.h Wed Oct 2 09:23:33 2019 (r352963) @@ -102,8 +102,6 @@ int mlx5_firmware_flash(struct mlx5_core_dev *dev, con void mlx5e_init(void); void mlx5e_cleanup(void); -int mlx5_rename_eq(struct mlx5_core_dev *dev, int eq_ix, char *name); - int mlx5_ctl_init(void); void mlx5_ctl_fini(void); void mlx5_fwdump_prep(struct mlx5_core_dev *mdev); Modified: head/sys/dev/mlx5/mlx5_core/mlx5_eq.c == --- head/sys/dev/mlx5/mlx5_core/mlx5_eq.c Wed Oct 2 09:22:22 2019 (r352962) +++ head/sys/dev/mlx5/mlx5_core/mlx5_eq.c Wed Oct 2 09:23:33 2019 (r352963) @@ -415,7 +415,7 @@ static void init_eq_buf(struct mlx5_eq *eq) } int mlx5_create_map_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq, u8 vecidx, - int nent, u64 mask, const char *name, struct mlx5_uar *uar) + int nent, u64 mask, struct mlx5_uar *uar) { u32 out[MLX5_ST_SZ_DW(create_eq_out)] = {0}; struct mlx5_priv *priv = >priv; @@ -463,10 +463,8 @@ int mlx5_create_map_eq(struct mlx5_core_dev *dev, stru eq->irqn = vecidx; eq->dev = dev; eq->doorbell = uar->map + MLX5_EQ_DOORBEL_OFFSET; - snprintf(priv->irq_info[vecidx].name, MLX5_MAX_IRQ_NAME, "%s@pci:%s", -name, pci_name(dev->pdev)); err = request_irq(priv->msix_arr[vecidx].vector, mlx5_msix_handler, 0, - priv->irq_info[vecidx].name, eq); + "mlx5_core", eq); if (err) goto err_eq; #ifdef RSS @@ -568,7 +566,7 @@ int mlx5_start_eqs(struct mlx5_core_dev *dev) err = mlx5_create_map_eq(dev, >cmd_eq, MLX5_EQ_VEC_CMD, MLX5_NUM_CMD_EQE, 1ull << MLX5_EVENT_TYPE_CMD, -"mlx5_cmd_eq", >priv.uuari.uars[0]); +>priv.uuari.uars[0]); if (err) { mlx5_core_warn(dev, "failed to create cmd EQ %d\n", err); return err; @@ -578,7 +576,7 @@ int mlx5_start_eqs(struct mlx5_core_dev *dev) err = mlx5_create_map_eq(dev, >async_eq, MLX5_EQ_VEC_ASYNC, MLX5_NUM_ASYNC_EQE, async_event_mask, -"mlx5_async_eq", >priv.uuari.uars[0]); +>priv.uuari.uars[0]); if (err) { mlx5_core_warn(dev, "failed to create async EQ %d\n", err);
svn commit: r352962 - in head/sys: conf dev/mlx5 dev/mlx5/mlx5_core dev/mlx5/mlx5_en modules/mlx5
Author: hselasky Date: Wed Oct 2 09:22:22 2019 New Revision: 352962 URL: https://svnweb.freebsd.org/changeset/base/352962 Log: Add support for Multi-Physical Function Switch, MPFS, in mlx5en. MPFS is a logical switch in the Mellanox device which forward packets based on a hardware driven L2 address table, to one or more physical- or virtual- functions. The physical- or virtual- function is required to tell the MPFS by using the MPFS firmware commands, which unicast MAC addresses it is requesting from the physical port's traffic. Broadcast and multicast traffic however, is copied to all listening physical- and virtual- functions and does not need a rule in the MPFS switching table. Linux commit: eeb66cdb682678bfd1f02a4547e3649b38ffea7e MFC after:3 days Sponsored by: Mellanox Technologies Added: head/sys/dev/mlx5/mlx5_core/mlx5_mpfs.c (contents, props changed) head/sys/dev/mlx5/mpfs.h (contents, props changed) Modified: head/sys/conf/files head/sys/dev/mlx5/driver.h head/sys/dev/mlx5/mlx5_core/mlx5_main.c head/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c head/sys/modules/mlx5/Makefile Modified: head/sys/conf/files == --- head/sys/conf/files Wed Oct 2 09:16:17 2019(r352961) +++ head/sys/conf/files Wed Oct 2 09:22:22 2019(r352962) @@ -4727,6 +4727,8 @@ dev/mlx5/mlx5_core/mlx5_main.c optional mlx5 pci \ compile-with "${OFED_C}" dev/mlx5/mlx5_core/mlx5_mcg.c optional mlx5 pci \ compile-with "${OFED_C}" +dev/mlx5/mlx5_core/mlx5_mpfs.c optional mlx5 pci \ + compile-with "${OFED_C}" dev/mlx5/mlx5_core/mlx5_mr.c optional mlx5 pci \ compile-with "${OFED_C}" dev/mlx5/mlx5_core/mlx5_pagealloc.coptional mlx5 pci \ Modified: head/sys/dev/mlx5/driver.h == --- head/sys/dev/mlx5/driver.h Wed Oct 2 09:16:17 2019(r352961) +++ head/sys/dev/mlx5/driver.h Wed Oct 2 09:22:22 2019(r352962) @@ -717,6 +717,12 @@ struct mlx5_core_dev { struct mlx5_rsvd_gids reserved_gids; atomic_troce_en; } roce; + + struct { + spinlock_t spinlock; +#defineMLX5_MPFS_TABLE_MAX 32 + longbitmap[BITS_TO_LONGS(MLX5_MPFS_TABLE_MAX)]; + } mpfs; #ifdef CONFIG_MLX5_FPGA struct mlx5_fpga_device *fpga; #endif Modified: head/sys/dev/mlx5/mlx5_core/mlx5_main.c == --- head/sys/dev/mlx5/mlx5_core/mlx5_main.c Wed Oct 2 09:16:17 2019 (r352961) +++ head/sys/dev/mlx5/mlx5_core/mlx5_main.c Wed Oct 2 09:22:22 2019 (r352962) @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -1130,10 +1131,16 @@ static int mlx5_load_one(struct mlx5_core_dev *dev, st goto err_free_comp_eqs; } + err = mlx5_mpfs_init(dev); + if (err) { + mlx5_core_err(dev, "mpfs init failed %d\n", err); + goto err_fs; + } + err = mlx5_fpga_device_start(dev); if (err) { dev_err(>dev, "fpga device start failed %d\n", err); - goto err_fs; + goto err_mpfs; } err = mlx5_register_device(dev); @@ -1151,6 +1158,9 @@ out: err_fpga: mlx5_fpga_device_stop(dev); +err_mpfs: + mlx5_mpfs_destroy(dev); + err_fs: mlx5_cleanup_fs(dev); @@ -1216,6 +1226,7 @@ static int mlx5_unload_one(struct mlx5_core_dev *dev, mlx5_unregister_device(dev); mlx5_fpga_device_stop(dev); + mlx5_mpfs_destroy(dev); mlx5_cleanup_fs(dev); unmap_bf_area(dev); mlx5_wait_for_reclaim_vfs_pages(dev); Added: head/sys/dev/mlx5/mlx5_core/mlx5_mpfs.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/mlx5/mlx5_core/mlx5_mpfs.c Wed Oct 2 09:22:22 2019 (r352962) @@ -0,0 +1,125 @@ +/*- + * Copyright (c) 2019, Mellanox Technologies, Ltd. 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, 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 AUTHOR AND CONTRIBUTORS `AS IS' AND + * ANY
svn commit: r352961 - head/sys/dev/mlx5/mlx5_en
Author: hselasky Date: Wed Oct 2 09:16:17 2019 New Revision: 352961 URL: https://svnweb.freebsd.org/changeset/base/352961 Log: Implement macro for asserting priv lock in mlx5en. MFC after:3 days Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_en/en.h head/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c Modified: head/sys/dev/mlx5/mlx5_en/en.h == --- head/sys/dev/mlx5/mlx5_en/en.h Wed Oct 2 09:15:07 2019 (r352960) +++ head/sys/dev/mlx5/mlx5_en/en.h Wed Oct 2 09:16:17 2019 (r352961) @@ -988,6 +988,7 @@ struct mlx5e_priv { #definePRIV_LOCK(priv) sx_xlock(&(priv)->state_lock) #definePRIV_UNLOCK(priv) sx_xunlock(&(priv)->state_lock) #definePRIV_LOCKED(priv) sx_xlocked(&(priv)->state_lock) +#definePRIV_ASSERT_LOCKED(priv) sx_assert(&(priv)->state_lock, SA_XLOCKED) struct sx state_lock; /* Protects Interface state */ struct mlx5_uar cq_uar; u32 pdn; Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c == --- head/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c Wed Oct 2 09:15:07 2019(r352960) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c Wed Oct 2 09:16:17 2019(r352961) @@ -772,6 +772,8 @@ mlx5e_sync_ifp_addr(struct mlx5e_priv *priv) struct ifaddr *ifa; struct ifmultiaddr *ifma; + PRIV_ASSERT_LOCKED(priv); + /* XXX adding this entry might not be needed */ mlx5e_add_eth_addr_to_hash(priv->eth_addr.if_uc, LLADDR((struct sockaddr_dl *)(ifp->if_addr->ifa_addr))); ___ 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: r352960 - head/sys/dev/mlx5/mlx5_core
Author: hselasky Date: Wed Oct 2 09:15:07 2019 New Revision: 352960 URL: https://svnweb.freebsd.org/changeset/base/352960 Log: Fix for missing cleanup code in error case in mlx5en. MFC after:3 days Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_core/mlx5_main.c Modified: head/sys/dev/mlx5/mlx5_core/mlx5_main.c == --- head/sys/dev/mlx5/mlx5_core/mlx5_main.c Wed Oct 2 09:14:01 2019 (r352959) +++ head/sys/dev/mlx5/mlx5_core/mlx5_main.c Wed Oct 2 09:15:07 2019 (r352960) @@ -1133,13 +1133,13 @@ static int mlx5_load_one(struct mlx5_core_dev *dev, st err = mlx5_fpga_device_start(dev); if (err) { dev_err(>dev, "fpga device start failed %d\n", err); - goto err_fpga_start; + goto err_fs; } err = mlx5_register_device(dev); if (err) { dev_err(>dev, "mlx5_register_device failed %d\n", err); - goto err_fs; + goto err_fpga; } set_bit(MLX5_INTERFACE_STATE_UP, >intf_state); @@ -1148,7 +1148,9 @@ out: mutex_unlock(>intf_state_mutex); return 0; -err_fpga_start: +err_fpga: + mlx5_fpga_device_stop(dev); + err_fs: mlx5_cleanup_fs(dev); ___ 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: r352959 - head/sys/dev/mlx5/mlx5_en
Author: hselasky Date: Wed Oct 2 09:14:01 2019 New Revision: 352959 URL: https://svnweb.freebsd.org/changeset/base/352959 Log: Check return value of mlx5_vector2eqn() function in mlx5en. MFC after:3 days Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c == --- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cWed Oct 2 09:12:53 2019 (r352958) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cWed Oct 2 09:14:01 2019 (r352959) @@ -1914,12 +1914,14 @@ mlx5e_create_cq(struct mlx5e_priv *priv, param->wq.buf_numa_node = 0; param->wq.db_numa_node = 0; + err = mlx5_vector2eqn(mdev, eq_ix, _not_used, ); + if (err) + return (err); + err = mlx5_cqwq_create(mdev, >wq, param->cqc, >wq, >wq_ctrl); if (err) return (err); - - mlx5_vector2eqn(mdev, eq_ix, _not_used, ); mcq->cqe_sz = 64; mcq->set_ci_db = cq->wq_ctrl.db.db; ___ 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: r352958 - head/sys/dev/mlx5/mlx5_core
Author: hselasky Date: Wed Oct 2 09:12:53 2019 New Revision: 352958 URL: https://svnweb.freebsd.org/changeset/base/352958 Log: Make sure the number of IRQ vectors doesn't exceed 256 in mlx5core. The "intr" field in "struct mlx5_ifc_eqc_bits" is only 8 bits wide. MFC after:3 days Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_core/mlx5_main.c Modified: head/sys/dev/mlx5/mlx5_core/mlx5_main.c == --- head/sys/dev/mlx5/mlx5_core/mlx5_main.c Wed Oct 2 09:11:01 2019 (r352957) +++ head/sys/dev/mlx5/mlx5_core/mlx5_main.c Wed Oct 2 09:12:53 2019 (r352958) @@ -275,7 +275,10 @@ static int mlx5_enable_msix(struct mlx5_core_dev *dev) else nvec += MLX5_CAP_GEN(dev, num_ports) * num_online_cpus(); - nvec = min_t(int, nvec, num_eqs); + if (nvec > num_eqs) + nvec = num_eqs; + if (nvec > 256) + nvec = 256; /* limit of firmware API */ if (nvec <= MLX5_EQ_VEC_COMP_BASE) return -ENOMEM; ___ 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: r352957 - head/sys/dev/mlx5/mlx5_ib
Author: hselasky Date: Wed Oct 2 09:11:01 2019 New Revision: 352957 URL: https://svnweb.freebsd.org/changeset/base/352957 Log: Update warning and error print formats in mlx5ib. Submitted by: slavash@ MFC after:3 days Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_ib/mlx5_ib.h Modified: head/sys/dev/mlx5/mlx5_ib/mlx5_ib.h == --- head/sys/dev/mlx5/mlx5_ib/mlx5_ib.h Wed Oct 2 09:09:28 2019 (r352956) +++ head/sys/dev/mlx5/mlx5_ib/mlx5_ib.h Wed Oct 2 09:11:01 2019 (r352957) @@ -46,11 +46,11 @@ pr_debug("%s:%s:%d:(pid %d): " format, (dev)->ib_dev.n __LINE__, current->pid, ##arg) #define mlx5_ib_err(dev, format, arg...) \ -pr_err("%s:%s:%d:(pid %d): " format, (dev)->ib_dev.name, __func__, \ +pr_err("%s: ERR: %s:%d:(pid %d): " format, (dev)->ib_dev.name, __func__, \ __LINE__, current->pid, ##arg) #define mlx5_ib_warn(dev, format, arg...) \ -pr_warn("%s:%s:%d:(pid %d): " format, (dev)->ib_dev.name, __func__,\ +pr_warn("%s: WARN: %s:%d:(pid %d): " format, (dev)->ib_dev.name, __func__, \ __LINE__, current->pid, ##arg) #define field_avail(type, fld, sz) (offsetof(type, fld) + \ ___ 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: r352956 - head/sys/dev/mlx5/mlx5_ib
Author: hselasky Date: Wed Oct 2 09:09:28 2019 New Revision: 352956 URL: https://svnweb.freebsd.org/changeset/base/352956 Log: Fix reported max SGE calculation in mlx5ib. Add the 512 bytes limit of RDMA READ and the size of remote address to the max SGE calculation. Submitted by: slavash@ Linux commit: 288c01b746aa MFC after:3 days Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c head/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c Modified: head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c == --- head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.cWed Oct 2 09:06:13 2019 (r352955) +++ head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.cWed Oct 2 09:09:28 2019 (r352956) @@ -636,6 +636,7 @@ static int mlx5_ib_query_device(struct ib_device *ibde struct mlx5_ib_dev *dev = to_mdev(ibdev); struct mlx5_core_dev *mdev = dev->mdev; int err = -ENOMEM; + int max_sq_desc; int max_rq_sg; int max_sq_sg; u64 min_page_size = 1ull << MLX5_CAP_GEN(mdev, log_pg_sz); @@ -758,9 +759,10 @@ static int mlx5_ib_query_device(struct ib_device *ibde props->max_qp_wr = 1 << MLX5_CAP_GEN(mdev, log_max_qp_sz); max_rq_sg = MLX5_CAP_GEN(mdev, max_wqe_sz_rq) / sizeof(struct mlx5_wqe_data_seg); - max_sq_sg = (MLX5_CAP_GEN(mdev, max_wqe_sz_sq) - -sizeof(struct mlx5_wqe_ctrl_seg)) / -sizeof(struct mlx5_wqe_data_seg); + max_sq_desc = min_t(int, MLX5_CAP_GEN(mdev, max_wqe_sz_sq), 512); + max_sq_sg = (max_sq_desc - sizeof(struct mlx5_wqe_ctrl_seg) - +sizeof(struct mlx5_wqe_raddr_seg)) / + sizeof(struct mlx5_wqe_data_seg); props->max_sge = min(max_rq_sg, max_sq_sg); props->max_sge_rd = MLX5_MAX_SGE_RD; props->max_cq = 1 << MLX5_CAP_GEN(mdev, log_max_cq); Modified: head/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c == --- head/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c Wed Oct 2 09:06:13 2019 (r352955) +++ head/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c Wed Oct 2 09:09:28 2019 (r352956) @@ -346,6 +346,29 @@ static int calc_send_wqe(struct ib_qp_init_attr *attr) return ALIGN(max_t(int, inl_size, size), MLX5_SEND_WQE_BB); } +static int get_send_sge(struct ib_qp_init_attr *attr, int wqe_size) +{ + int max_sge; + + if (attr->qp_type == IB_QPT_RC) + max_sge = (min_t(int, wqe_size, 512) - + sizeof(struct mlx5_wqe_ctrl_seg) - + sizeof(struct mlx5_wqe_raddr_seg)) / + sizeof(struct mlx5_wqe_data_seg); + else if (attr->qp_type == IB_QPT_XRC_INI) + max_sge = (min_t(int, wqe_size, 512) - + sizeof(struct mlx5_wqe_ctrl_seg) - + sizeof(struct mlx5_wqe_xrc_seg) - + sizeof(struct mlx5_wqe_raddr_seg)) / + sizeof(struct mlx5_wqe_data_seg); + else + max_sge = (wqe_size - sq_overhead(attr)) / + sizeof(struct mlx5_wqe_data_seg); + + return min_t(int, max_sge, wqe_size - sq_overhead(attr) / +sizeof(struct mlx5_wqe_data_seg)); +} + static int calc_sq_size(struct mlx5_ib_dev *dev, struct ib_qp_init_attr *attr, struct mlx5_ib_qp *qp) { @@ -382,7 +405,11 @@ static int calc_sq_size(struct mlx5_ib_dev *dev, struc return -ENOMEM; } qp->sq.wqe_shift = ilog2(MLX5_SEND_WQE_BB); - qp->sq.max_gs = attr->cap.max_send_sge; + qp->sq.max_gs = get_send_sge(attr, wqe_size); + if (qp->sq.max_gs < attr->cap.max_send_sge) + return -ENOMEM; + + attr->cap.max_send_sge = qp->sq.max_gs; qp->sq.max_post = wq_size / wqe_size; attr->cap.max_send_wr = qp->sq.max_post; ___ 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: r352955 - head/sys/ofed/drivers/infiniband/ulp/ipoib
Author: hselasky Date: Wed Oct 2 09:06:13 2019 New Revision: 352955 URL: https://svnweb.freebsd.org/changeset/base/352955 Log: Make sure the transmit loop doesn't get starved in ipoib. When the software send queue gets filled up, callbacks to if_transmit will stop. Make sure the transmit callback routine checks the send queue and outputs any remaining mbufs. Else the remaining mbufs may simply sit in the output queue blocking the transmit path. MFC after:3 days Sponsored by: Mellanox Technologies Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h == --- head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h Wed Oct 2 09:03:48 2019(r352954) +++ head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h Wed Oct 2 09:06:13 2019(r352955) @@ -536,7 +536,7 @@ void ipoib_drain_cq(struct ipoib_dev_priv *priv); int ipoib_dma_map_tx(struct ib_device *ca, struct ipoib_tx_buf *tx_req, int max); void ipoib_dma_unmap_tx(struct ib_device *ca, struct ipoib_tx_buf *tx_req); -int ipoib_poll_tx(struct ipoib_dev_priv *priv); +int ipoib_poll_tx(struct ipoib_dev_priv *priv, bool do_start); void ipoib_dma_unmap_rx(struct ipoib_dev_priv *priv, struct ipoib_rx_buf *rx_req); void ipoib_dma_mb(struct ipoib_dev_priv *priv, struct mbuf *mb, unsigned int length); @@ -763,5 +763,7 @@ extern int ipoib_debug_level; #endif /* CONFIG_INFINIBAND_IPOIB_DEBUG_DATA */ #define IPOIB_QPN(ha) (be32_to_cpup((__be32 *) ha) & 0xff) + +void ipoib_start_locked(struct ifnet *, struct ipoib_dev_priv *); #endif /* _IPOIB_H */ Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c == --- head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c Wed Oct 2 09:03:48 2019(r352954) +++ head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c Wed Oct 2 09:06:13 2019(r352955) @@ -618,8 +618,10 @@ void ipoib_cm_send(struct ipoib_dev_priv *priv, struct struct ipoib_cm_tx_buf *tx_req; struct ifnet *dev = priv->dev; - if (unlikely(priv->tx_outstanding > MAX_SEND_CQE)) - while (ipoib_poll_tx(priv)); /* nothing */ + if (unlikely(priv->tx_outstanding > MAX_SEND_CQE)) { + while (ipoib_poll_tx(priv, false)) + ; /* nothing */ + } m_adj(mb, sizeof(struct ipoib_pseudoheader)); if (unlikely(mb->m_pkthdr.len > tx->mtu)) { Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c == --- head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c Wed Oct 2 09:03:48 2019(r352954) +++ head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c Wed Oct 2 09:06:13 2019(r352955) @@ -366,7 +366,7 @@ static void ipoib_ib_handle_tx_wc(struct ipoib_dev_pri } int -ipoib_poll_tx(struct ipoib_dev_priv *priv) +ipoib_poll_tx(struct ipoib_dev_priv *priv, bool do_start) { int n, i; @@ -379,6 +379,9 @@ ipoib_poll_tx(struct ipoib_dev_priv *priv) ipoib_ib_handle_tx_wc(priv, wc); } + if (do_start && n != 0) + ipoib_start_locked(priv->dev, priv); + return n == MAX_SEND_CQE; } @@ -425,7 +428,7 @@ static void drain_tx_cq(struct ipoib_dev_priv *priv) struct ifnet *dev = priv->dev; spin_lock(>lock); - while (ipoib_poll_tx(priv)) + while (ipoib_poll_tx(priv, true)) ; /* nothing */ if (dev->if_drv_flags & IFF_DRV_OACTIVE) @@ -482,7 +485,7 @@ ipoib_send(struct ipoib_dev_priv *priv, struct mbuf *m void *phead; if (unlikely(priv->tx_outstanding > MAX_SEND_CQE)) - while (ipoib_poll_tx(priv)) + while (ipoib_poll_tx(priv, false)) ; /* nothing */ m_adj(mb, sizeof (struct ipoib_pseudoheader)); @@ -762,7 +765,7 @@ void ipoib_drain_cq(struct ipoib_dev_priv *priv) spin_unlock(>drain_lock); spin_lock(>lock); - while (ipoib_poll_tx(priv)) + while (ipoib_poll_tx(priv, true)) ; /* nothing */ spin_unlock(>lock); Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c == --- head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Wed Oct 2 09:03:48 2019(r352954) +++ head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Wed Oct 2 09:06:13 2019(r352955) @@ -773,17 +773,13 @@ ipoib_send_one(struct ipoib_dev_priv *priv, struct mbu return 0; }
svn commit: r352954 - head/sys/contrib/rdma/krping
Author: hselasky Date: Wed Oct 2 09:03:48 2019 New Revision: 352954 URL: https://svnweb.freebsd.org/changeset/base/352954 Log: Notify all sleeping threads of device removal in krping. Implement d_purge for krping_cdevsw. Submitted by: slavash@ MFC after:3 days Sponsored by: Mellanox Technologies Modified: head/sys/contrib/rdma/krping/krping.c head/sys/contrib/rdma/krping/krping.h head/sys/contrib/rdma/krping/krping_dev.c Modified: head/sys/contrib/rdma/krping/krping.c == --- head/sys/contrib/rdma/krping/krping.c Wed Oct 2 06:15:30 2019 (r352953) +++ head/sys/contrib/rdma/krping/krping.c Wed Oct 2 09:03:48 2019 (r352954) @@ -2189,3 +2189,17 @@ krping_walk_cb_list(void (*f)(struct krping_stats *, v (*f)(cb->pd ? >stats : NULL, arg); mutex_unlock(_mutex); } + +void +krping_cancel_all(void) +{ + struct krping_cb *cb; + + mutex_lock(_mutex); + list_for_each_entry(cb, _cbs, list) { + cb->state = ERROR; + wake_up_interruptible(>sem); + } + mutex_unlock(_mutex); +} + Modified: head/sys/contrib/rdma/krping/krping.h == --- head/sys/contrib/rdma/krping/krping.h Wed Oct 2 06:15:30 2019 (r352953) +++ head/sys/contrib/rdma/krping/krping.h Wed Oct 2 09:03:48 2019 (r352954) @@ -17,3 +17,4 @@ struct krping_stats { int krping_doit(char *); void krping_walk_cb_list(void (*)(struct krping_stats *, void *), void *); int krping_sigpending(void); +void krping_cancel_all(void); Modified: head/sys/contrib/rdma/krping/krping_dev.c == --- head/sys/contrib/rdma/krping/krping_dev.c Wed Oct 2 06:15:30 2019 (r352953) +++ head/sys/contrib/rdma/krping/krping_dev.c Wed Oct 2 09:03:48 2019 (r352954) @@ -40,6 +40,7 @@ static d_open_t krping_open; static d_close_t krping_close; static d_read_t krping_read; static d_write_t krping_write; +static d_purge_t krping_purge; /* Character device entry points */ static struct cdevsw krping_cdevsw = { @@ -48,6 +49,7 @@ static struct cdevsw krping_cdevsw = { .d_close = krping_close, .d_read = krping_read, .d_write = krping_write, + .d_purge = krping_purge, .d_name = "krping", }; @@ -208,6 +210,13 @@ krping_write(struct cdev *dev, struct uio *uio, int io done: free(krpingmsg, M_DEVBUF); return(err); +} + +static void +krping_purge(struct cdev *dev __unused) +{ + + krping_cancel_all(); } int ___ 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: r352925 - head/sys/dev/xen/control
On Tue, Oct 01, 2019 at 06:42:14PM -0700, Ravi Pokala wrote: > Hi Roger, > > If I'm understanding this diff correctly, all of (poweroff, reboot, suspend) > will use the common string "shutdown", rather than an event-specific string. > Is that what we want? I think there's some misunderstanding here. All power control events use the same xenstore node (~/control/shutdown), but the command read from it is different depending on the requested action (poweroff, reboot, halt...). See [0] for a slightly more detailed description of the xenstore node. Note that this commit doesn't change any of this logic, it just clears the contents of ~/control/shutdown (by writing "") so the toolstack knows FreeBSD has acknowledged the request and it's processing it. Roger. [0] http://xenbits.xen.org/docs/4.12-testing/misc/xenstore-paths.html#platform-feature-and-control-paths ___ 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: r352953 - in head/usr.bin: killall split
Hi Alexander, Coverity has millions of spurious warnings of this class and they're basically all false positives. I think we should instead try to figure out how to disable this class of warning on our codebase, since it is largely incorrect. I would encourage reverting this change, because it uglies up the code for no functional benefit. The code was correct before the change; only Coverity was wrong. Best, Conrad On Tue, Oct 1, 2019 at 11:15 PM Alexander Kabaev wrote: > > Author: kan > Date: Wed Oct 2 06:15:30 2019 > New Revision: 352953 > URL: https://svnweb.freebsd.org/changeset/base/352953 > > Log: > Convert pnmatch to single element array in regexec calls > > The regexec function is declared as taking an array of regmatch_t > elements, and passing in the pointer to singleton element, while > correct, triggers a Coverity warning. Convert the singleton into > an array of one to silence the warning. > > Reported by: Coverity > Coverity CID: 1009732, 1009733 > MFC after:2 weeks > > Modified: > head/usr.bin/killall/killall.c > head/usr.bin/split/split.c > > Modified: head/usr.bin/killall/killall.c > == > --- head/usr.bin/killall/killall.c Wed Oct 2 02:37:34 2019 > (r352952) > +++ head/usr.bin/killall/killall.c Wed Oct 2 06:15:30 2019 > (r352953) > @@ -98,7 +98,7 @@ main(int ac, char **av) > struct stat sb; > struct passwd *pw; > regex_t rgx; > - regmatch_t pmatch; > + regmatch_t pmatch[1]; > int i, j, ch; > charbuf[256]; > charfirst; > @@ -361,9 +361,9 @@ main(int ac, char **av) > } > } > if (mflag) { > - pmatch.rm_so = 0; > - pmatch.rm_eo = strlen(thiscmd); > - if (regexec(, thiscmd, 0, , > + pmatch[0].rm_so = 0; > + pmatch[0].rm_eo = strlen(thiscmd); > + if (regexec(, thiscmd, 0, pmatch, > REG_STARTEND) != 0) > matched = 0; > regfree(); > @@ -387,9 +387,9 @@ main(int ac, char **av) > } > } > if (mflag) { > - pmatch.rm_so = 0; > - pmatch.rm_eo = strlen(thiscmd); > - if (regexec(, thiscmd, 0, , > + pmatch[0].rm_so = 0; > + pmatch[0].rm_eo = strlen(thiscmd); > + if (regexec(, thiscmd, 0, pmatch, > REG_STARTEND) == 0) > matched = 1; > regfree(); > > Modified: head/usr.bin/split/split.c > == > --- head/usr.bin/split/split.c Wed Oct 2 02:37:34 2019(r352952) > +++ head/usr.bin/split/split.c Wed Oct 2 06:15:30 2019(r352953) > @@ -281,11 +281,11 @@ split2(void) > > /* Check if we need to start a new file */ > if (pflag) { > - regmatch_t pmatch; > + regmatch_t pmatch[1]; > > - pmatch.rm_so = 0; > - pmatch.rm_eo = len - 1; > - if (regexec(, bfr, 0, , REG_STARTEND) == 0) > + pmatch[0].rm_so = 0; > + pmatch[0].rm_eo = len - 1; > + if (regexec(, bfr, 0, pmatch, REG_STARTEND) == 0) > newfile(); > } else if (lcnt++ == numlines) { > newfile(); ___ 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: r352953 - in head/usr.bin: killall split
Author: kan Date: Wed Oct 2 06:15:30 2019 New Revision: 352953 URL: https://svnweb.freebsd.org/changeset/base/352953 Log: Convert pnmatch to single element array in regexec calls The regexec function is declared as taking an array of regmatch_t elements, and passing in the pointer to singleton element, while correct, triggers a Coverity warning. Convert the singleton into an array of one to silence the warning. Reported by: Coverity Coverity CID: 1009732, 1009733 MFC after:2 weeks Modified: head/usr.bin/killall/killall.c head/usr.bin/split/split.c Modified: head/usr.bin/killall/killall.c == --- head/usr.bin/killall/killall.c Wed Oct 2 02:37:34 2019 (r352952) +++ head/usr.bin/killall/killall.c Wed Oct 2 06:15:30 2019 (r352953) @@ -98,7 +98,7 @@ main(int ac, char **av) struct stat sb; struct passwd *pw; regex_t rgx; - regmatch_t pmatch; + regmatch_t pmatch[1]; int i, j, ch; charbuf[256]; charfirst; @@ -361,9 +361,9 @@ main(int ac, char **av) } } if (mflag) { - pmatch.rm_so = 0; - pmatch.rm_eo = strlen(thiscmd); - if (regexec(, thiscmd, 0, , + pmatch[0].rm_so = 0; + pmatch[0].rm_eo = strlen(thiscmd); + if (regexec(, thiscmd, 0, pmatch, REG_STARTEND) != 0) matched = 0; regfree(); @@ -387,9 +387,9 @@ main(int ac, char **av) } } if (mflag) { - pmatch.rm_so = 0; - pmatch.rm_eo = strlen(thiscmd); - if (regexec(, thiscmd, 0, , + pmatch[0].rm_so = 0; + pmatch[0].rm_eo = strlen(thiscmd); + if (regexec(, thiscmd, 0, pmatch, REG_STARTEND) == 0) matched = 1; regfree(); Modified: head/usr.bin/split/split.c == --- head/usr.bin/split/split.c Wed Oct 2 02:37:34 2019(r352952) +++ head/usr.bin/split/split.c Wed Oct 2 06:15:30 2019(r352953) @@ -281,11 +281,11 @@ split2(void) /* Check if we need to start a new file */ if (pflag) { - regmatch_t pmatch; + regmatch_t pmatch[1]; - pmatch.rm_so = 0; - pmatch.rm_eo = len - 1; - if (regexec(, bfr, 0, , REG_STARTEND) == 0) + pmatch[0].rm_so = 0; + pmatch[0].rm_eo = len - 1; + if (regexec(, bfr, 0, pmatch, REG_STARTEND) == 0) newfile(); } else if (lcnt++ == numlines) { newfile(); ___ 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"