From owner-svn-src-stable-12@freebsd.org Sun Oct 6 03:56:05 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EEEA7F98D8; Sun, 6 Oct 2019 03:56:05 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46m8sx53Mcz4WPW; Sun, 6 Oct 2019 03:56:05 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 713C71F6CB; Sun, 6 Oct 2019 03:56:05 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x963u5JB035228; Sun, 6 Oct 2019 03:56:05 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x963u4Lf035223; Sun, 6 Oct 2019 03:56:04 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910060356.x963u4Lf035223@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 6 Oct 2019 03:56:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353134 - in stable: 11/usr.sbin/cron/cron 11/usr.sbin/cron/crontab 11/usr.sbin/cron/lib 12/usr.sbin/cron/cron 12/usr.sbin/cron/crontab 12/usr.sbin/cron/lib X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/usr.sbin/cron/cron 11/usr.sbin/cron/crontab 11/usr.sbin/cron/lib 12/usr.sbin/cron/cron 12/usr.sbin/cron/crontab 12/usr.sbin/cron/lib X-SVN-Commit-Revision: 353134 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Oct 2019 03:56:06 -0000 Author: kevans Date: Sun Oct 6 03:56:02 2019 New Revision: 353134 URL: https://svnweb.freebsd.org/changeset/base/353134 Log: MFC r352668: cron: log suppression and mail suppression for successful runs This commit adds two new extensions to crontab, ported from OpenBSD: - -n: suppress mail on succesful run - -q: suppress logging of command execution The -q option appears decades old, but -n is relatively new. The original proposal by Job Snijder can be found here [1], and gives very convincing reasons for inclusion in base. This patch is a nearly identical port of OpenBSD cron for -q and -n features. It is written to follow existing conventions and style of the existing codebase. Example usage: # should only send email, but won't show up in log * * * * * -q date # should not send email * * * * * -n date # should not send email or log * * * * * -n -q date # should send email because of ping failure * * * * * -n -q ping -c 1 5.5.5.5 [1]: https://marc.info/?l=openbsd-tech&m=152874866117948&w=2 PR: 237538 Relnotes: yes Modified: stable/12/usr.sbin/cron/cron/cron.h stable/12/usr.sbin/cron/cron/do_command.c stable/12/usr.sbin/cron/cron/popen.c stable/12/usr.sbin/cron/crontab/crontab.5 stable/12/usr.sbin/cron/lib/entry.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/usr.sbin/cron/cron/cron.h stable/11/usr.sbin/cron/cron/do_command.c stable/11/usr.sbin/cron/cron/popen.c stable/11/usr.sbin/cron/crontab/crontab.5 stable/11/usr.sbin/cron/lib/entry.c Directory Properties: stable/11/ (props changed) Modified: stable/12/usr.sbin/cron/cron/cron.h ============================================================================== --- stable/12/usr.sbin/cron/cron/cron.h Sun Oct 6 03:33:28 2019 (r353133) +++ stable/12/usr.sbin/cron/cron/cron.h Sun Oct 6 03:56:02 2019 (r353134) @@ -191,6 +191,8 @@ typedef struct _entry { #define NOT_UNTIL 0x10 #define SEC_RES 0x20 #define INTERVAL 0x40 +#define DONT_LOG 0x80 +#define MAIL_WHEN_ERR 0x100 time_t lastrun; } entry; @@ -257,7 +259,7 @@ user *load_user(int, struct passwd *, char *), entry *load_entry(FILE *, void (*)(char *), struct passwd *, char **); -FILE *cron_popen(char *, char *, entry *); +FILE *cron_popen(char *, char *, entry *, PID_T *); /* in the C tradition, we only create Modified: stable/12/usr.sbin/cron/cron/do_command.c ============================================================================== --- stable/12/usr.sbin/cron/cron/do_command.c Sun Oct 6 03:33:28 2019 (r353133) +++ stable/12/usr.sbin/cron/cron/do_command.c Sun Oct 6 03:56:02 2019 (r353134) @@ -41,6 +41,7 @@ static const char rcsid[] = static void child_process(entry *, user *), do_univ(user *); +static WAIT_T wait_on_child(PID_T, const char *); void do_command(e, u) @@ -94,7 +95,10 @@ child_process(e, u) int stdin_pipe[2], stdout_pipe[2]; register char *input_data; char *usernm, *mailto, *mailfrom; - int children = 0; + PID_T jobpid, stdinjob, mailpid; + register FILE *mail; + register int bytes = 1; + int status = 0; # if defined(LOGIN_CAP) struct passwd *pwd; login_cap_t *lc; @@ -216,7 +220,7 @@ child_process(e, u) /* fork again, this time so we can exec the user's command. */ - switch (vfork()) { + switch (jobpid = vfork()) { case -1: log_it("CRON",getpid(),"error","can't vfork"); exit(ERROR_EXIT); @@ -237,7 +241,7 @@ child_process(e, u) * the actual user command shell was going to get and the * PID is part of the log message. */ - /*local*/{ + if ((e->flags & DONT_LOG) == 0) { char *x = mkprints((u_char *)e->cmd, strlen(e->cmd)); log_it(usernm, getpid(), "CMD", x); @@ -359,8 +363,6 @@ child_process(e, u) break; } - children++; - /* middle process, child of original cron, parent of process running * the user's command. */ @@ -384,7 +386,7 @@ child_process(e, u) * we would block here. thus we must fork again. */ - if (*input_data && fork() == 0) { + if (*input_data && (stdinjob = fork()) == 0) { register FILE *out = fdopen(stdin_pipe[WRITE_PIPE], "w"); register int need_newline = FALSE; register int escaped = FALSE; @@ -440,8 +442,6 @@ child_process(e, u) */ close(stdin_pipe[WRITE_PIPE]); - children++; - /* * read output from the grandchild. it's stderr has been redirected to * it's stdout, which has been redirected to our pipe. if there is any @@ -462,10 +462,6 @@ child_process(e, u) ch = getc(in); if (ch != EOF) { - register FILE *mail; - register int bytes = 1; - int status = 0; - Debug(DPROC|DEXT, ("[%d] got data (%x:%c) from grandchild\n", getpid(), ch, ch)) @@ -500,7 +496,7 @@ child_process(e, u) hostname[sizeof(hostname) - 1] = '\0'; (void) snprintf(mailcmd, sizeof(mailcmd), MAILARGS, MAILCMD); - if (!(mail = cron_popen(mailcmd, "w", e))) { + if (!(mail = cron_popen(mailcmd, "w", e, &mailpid))) { warn("%s", MAILCMD); (void) _exit(ERROR_EXIT); } @@ -538,28 +534,56 @@ child_process(e, u) if (mailto) putc(ch, mail); } + } + /*if data from grandchild*/ - /* only close pipe if we opened it -- i.e., we're - * mailing... - */ + Debug(DPROC, ("[%d] got EOF from grandchild\n", getpid())) - if (mailto) { - Debug(DPROC, ("[%d] closing pipe to mail\n", - getpid())) - /* Note: the pclose will probably see - * the termination of the grandchild - * in addition to the mail process, since - * it (the grandchild) is likely to exit - * after closing its stdout. - */ - status = cron_pclose(mail); - } + /* also closes stdout_pipe[READ_PIPE] */ + fclose(in); + } + /* wait for children to die. + */ + if (jobpid > 0) { + WAIT_T waiter; + + waiter = wait_on_child(jobpid, "grandchild command job"); + + /* If everything went well, and -n was set, _and_ we have mail, + * we won't be mailing... so shoot the messenger! + */ + if (WIFEXITED(waiter) && WEXITSTATUS(waiter) == 0 + && (e->flags & MAIL_WHEN_ERR) == MAIL_WHEN_ERR + && mailto) { + Debug(DPROC, ("[%d] %s executed successfully, mail suppressed\n", + getpid(), "grandchild command job")) + kill(mailpid, SIGKILL); + (void)fclose(mail); + mailto = NULL; + } + + + /* only close pipe if we opened it -- i.e., we're + * mailing... + */ + + if (mailto) { + Debug(DPROC, ("[%d] closing pipe to mail\n", + getpid())) + /* Note: the pclose will probably see + * the termination of the grandchild + * in addition to the mail process, since + * it (the grandchild) is likely to exit + * after closing its stdout. + */ + status = cron_pclose(mail); + /* if there was output and we could not mail it, * log the facts so the poor user can figure out * what's going on. */ - if (mailto && status) { + if (status) { char buf[MAX_TEMPSTR]; snprintf(buf, sizeof(buf), @@ -568,35 +592,38 @@ child_process(e, u) status); log_it(usernm, getpid(), "MAIL", buf); } + } + } - } /*if data from grandchild*/ + if (*input_data && stdinjob > 0) + wait_on_child(stdinjob, "grandchild stdinjob"); +} - Debug(DPROC, ("[%d] got EOF from grandchild\n", getpid())) +static WAIT_T +wait_on_child(PID_T childpid, const char *name) { + WAIT_T waiter; + PID_T pid; - fclose(in); /* also closes stdout_pipe[READ_PIPE] */ - } + Debug(DPROC, ("[%d] waiting for %s (%d) to finish\n", + getpid(), name, childpid)) - /* wait for children to die. - */ - for (; children > 0; children--) - { - WAIT_T waiter; - PID_T pid; +#ifdef POSIX + while ((pid = waitpid(childpid, &waiter, 0)) < 0 && errno == EINTR) +#else + while ((pid = wait4(childpid, &waiter, 0, NULL)) < 0 && errno == EINTR) +#endif + ; - Debug(DPROC, ("[%d] waiting for grandchild #%d to finish\n", - getpid(), children)) - pid = wait(&waiter); - if (pid < OK) { - Debug(DPROC, ("[%d] no more grandchildren--mail written?\n", - getpid())) - break; - } - Debug(DPROC, ("[%d] grandchild #%d finished, status=%04x", - getpid(), pid, WEXITSTATUS(waiter))) - if (WIFSIGNALED(waiter) && WCOREDUMP(waiter)) - Debug(DPROC, (", dumped core")) - Debug(DPROC, ("\n")) - } + if (pid < OK) + return waiter; + + Debug(DPROC, ("[%d] %s (%d) finished, status=%04x", + getpid(), name, pid, WEXITSTATUS(waiter))) + if (WIFSIGNALED(waiter) && WCOREDUMP(waiter)) + Debug(DPROC, (", dumped core")) + Debug(DPROC, ("\n")) + + return waiter; } Modified: stable/12/usr.sbin/cron/cron/popen.c ============================================================================== --- stable/12/usr.sbin/cron/cron/popen.c Sun Oct 6 03:33:28 2019 (r353133) +++ stable/12/usr.sbin/cron/cron/popen.c Sun Oct 6 03:56:02 2019 (r353134) @@ -55,9 +55,10 @@ static PID_T *pids; static int fds; FILE * -cron_popen(program, type, e) +cron_popen(program, type, e, pidptr) char *program, *type; entry *e; + PID_T *pidptr; { register char *cp; FILE *iop; @@ -218,6 +219,9 @@ pfree: free((char *)argv[argc]); } #endif + + *pidptr = pid; + return(iop); } Modified: stable/12/usr.sbin/cron/crontab/crontab.5 ============================================================================== --- stable/12/usr.sbin/cron/crontab/crontab.5 Sun Oct 6 03:33:28 2019 (r353133) +++ stable/12/usr.sbin/cron/crontab/crontab.5 Sun Oct 6 03:56:02 2019 (r353134) @@ -17,7 +17,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 19, 2019 +.Dd September 24, 2019 .Dt CRONTAB 5 .Os .Sh NAME @@ -199,6 +199,8 @@ lists of names are not allowed. .Pp The ``sixth'' field (the rest of the line) specifies the command to be run. +One or more command options may precede the command to modify processing +behavior. The entire command portion of the line, up to a newline or % character, will be executed by .Pa /bin/sh @@ -211,6 +213,22 @@ Percent-signs (%) in the command, unless escaped with after the first % will be sent to the command as standard input. .Pp +The following command options can be supplied: +.Bl -tag -width Ds +.It Fl n +No mail is sent after a successful run. +The execution output will only be mailed if the command exits with a non-zero +exit code. +The +.Fl n +option is an attempt to cure potentially copious volumes of mail coming from +.Xr cron 8 . +.It Fl q +Execution will not be logged. +.El +.sp +Duplicate options are not allowed. +.Pp Note: The day of a command's execution can be specified by two fields \(em day of month, and day of week. If both fields are @@ -271,6 +289,10 @@ MAILTO=paul 5 4 * * sun echo "run at 5 after 4 every sunday" # run at 5 minutes intervals, no matter how long it takes @300 svnlite up /usr/src +# run every minute, suppress logging +* * * * * -q date +# run every minute, only send mail if ping fails +* * * * * -n ping -c 1 freebsd.org .Ed .Sh SEE ALSO .Xr crontab 1 , @@ -314,6 +336,14 @@ All of the .Sq @ directives that can appear in place of the first five fields are extensions. +.Pp +Command processing can be modified using command options. +The +.Sq -q +option suppresses logging. +The +.Sq -n +option does not mail on successful run. .Sh AUTHORS .An Paul Vixie Aq Mt paul@vix.com .Sh BUGS Modified: stable/12/usr.sbin/cron/lib/entry.c ============================================================================== --- stable/12/usr.sbin/cron/lib/entry.c Sun Oct 6 03:33:28 2019 (r353133) +++ stable/12/usr.sbin/cron/lib/entry.c Sun Oct 6 03:56:02 2019 (r353134) @@ -35,7 +35,8 @@ static const char rcsid[] = typedef enum ecode { e_none, e_minute, e_hour, e_dom, e_month, e_dow, - e_cmd, e_timespec, e_username, e_group, e_mem + e_cmd, e_timespec, e_username, e_group, e_option, + e_mem #ifdef LOGIN_CAP , e_class #endif @@ -58,6 +59,7 @@ static char *ecodes[] = "bad time specifier", "bad username", "bad group name", + "bad option", "out of memory", #ifdef LOGIN_CAP "bad class name", @@ -428,6 +430,53 @@ load_entry(file, error_func, pw, envp) goto eof; } #endif + + Debug(DPARS, ("load_entry()...checking for command options\n")) + + ch = get_char(file); + + while (ch == '-') { + Debug(DPARS|DEXT, ("load_entry()...expecting option\n")) + switch (ch = get_char(file)) { + case 'n': + Debug(DPARS|DEXT, ("load_entry()...got MAIL_WHEN_ERR ('n') option\n")) + /* only allow the user to set the option once */ + if ((e->flags & MAIL_WHEN_ERR) == MAIL_WHEN_ERR) { + Debug(DPARS|DEXT, ("load_entry()...duplicate MAIL_WHEN_ERR ('n') option\n")) + ecode = e_option; + goto eof; + } + e->flags |= MAIL_WHEN_ERR; + break; + case 'q': + Debug(DPARS|DEXT, ("load_entry()...got DONT_LOG ('q') option\n")) + /* only allow the user to set the option once */ + if ((e->flags & DONT_LOG) == DONT_LOG) { + Debug(DPARS|DEXT, ("load_entry()...duplicate DONT_LOG ('q') option\n")) + ecode = e_option; + goto eof; + } + e->flags |= DONT_LOG; + break; + default: + Debug(DPARS|DEXT, ("load_entry()...invalid option '%c'\n", ch)) + ecode = e_option; + goto eof; + } + ch = get_char(file); + if (ch!='\t' && ch!=' ') { + ecode = e_option; + goto eof; + } + + Skip_Blanks(ch, file) + if (ch == EOF || ch == '\n') { + ecode = e_cmd; + goto eof; + } + } + + unget_char(ch, file); Debug(DPARS, ("load_entry()...about to parse command\n")) From owner-svn-src-stable-12@freebsd.org Sun Oct 6 03:59:06 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5BBC4F9B1C; Sun, 6 Oct 2019 03:59:06 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46m8xQ1Nmyz4WjQ; Sun, 6 Oct 2019 03:59:06 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EB7041F6D9; Sun, 6 Oct 2019 03:59:05 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x963x5Sv035451; Sun, 6 Oct 2019 03:59:05 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x963x5b9035450; Sun, 6 Oct 2019 03:59:05 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910060359.x963x5b9035450@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 6 Oct 2019 03:59:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353135 - in stable: 11/lib/libusb 12/lib/libusb X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/lib/libusb 12/lib/libusb X-SVN-Commit-Revision: 353135 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Oct 2019 03:59:06 -0000 Author: kevans Date: Sun Oct 6 03:59:05 2019 New Revision: 353135 URL: https://svnweb.freebsd.org/changeset/base/353135 Log: MFC r353009: libusb: LIBUSB_DEBUG env var 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. Modified: stable/12/lib/libusb/libusb10.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/lib/libusb/libusb10.c Directory Properties: stable/11/ (props changed) Modified: stable/12/lib/libusb/libusb10.c ============================================================================== --- stable/12/lib/libusb/libusb10.c Sun Oct 6 03:56:02 2019 (r353134) +++ stable/12/lib/libusb/libusb10.c Sun Oct 6 03:59:05 2019 (r353135) @@ -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, &ep, 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(&ctx->pollfds); TAILQ_INIT(&ctx->tr_done); From owner-svn-src-stable-12@freebsd.org Sun Oct 6 04:01:16 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A860DF9C44; Sun, 6 Oct 2019 04:01:16 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46m8zw2ZXqz4X1M; Sun, 6 Oct 2019 04:01:16 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 36CFF1F72E; Sun, 6 Oct 2019 04:01:16 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9641GpR039578; Sun, 6 Oct 2019 04:01:16 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9641Fen039577; Sun, 6 Oct 2019 04:01:15 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910060401.x9641Fen039577@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 6 Oct 2019 04:01:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353136 - in stable: 11/stand/lua 12/stand/lua X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/stand/lua 12/stand/lua X-SVN-Commit-Revision: 353136 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Oct 2019 04:01:16 -0000 Author: kevans Date: Sun Oct 6 04:01:15 2019 New Revision: 353136 URL: https://svnweb.freebsd.org/changeset/base/353136 Log: MFC r352314: lualoader: Add reload-conf loader command This command will trigger a reload of the configuration from disk. This is useful if you've changed currdev from recovery media to local disk as much as I have over the past ~2 hours and are tired of the extra keystrokes. This is really just a glorified shortcut, but reload-conf is likely easier to remember for other people and does save some keystrokes when reloading the configuration. It is also resilient to the underlying config method changing interface, but this is unlikely to happen. Modified: stable/12/stand/lua/cli.lua stable/12/stand/lua/cli.lua.8 Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/stand/lua/cli.lua stable/11/stand/lua/cli.lua.8 Directory Properties: stable/11/ (props changed) Modified: stable/12/stand/lua/cli.lua ============================================================================== --- stable/12/stand/lua/cli.lua Sun Oct 6 03:59:05 2019 (r353135) +++ stable/12/stand/lua/cli.lua Sun Oct 6 04:01:15 2019 (r353136) @@ -125,6 +125,10 @@ cli['boot-conf'] = function(...) core.autoboot(argstr) end +cli['reload-conf'] = function(...) + config.reload() +end + -- Used for splitting cli varargs into cmd_name and the rest of argv function cli.arguments(...) local argv = {...} Modified: stable/12/stand/lua/cli.lua.8 ============================================================================== --- stable/12/stand/lua/cli.lua.8 Sun Oct 6 03:59:05 2019 (r353135) +++ stable/12/stand/lua/cli.lua.8 Sun Oct 6 04:01:15 2019 (r353136) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 31, 2018 +.Dd September 13, 2019 .Dt CLI.LUA 8 .Os .Sh NAME @@ -82,14 +82,27 @@ As of present, the module by default provides commands for .Ic autoboot , .Ic boot , +.Ic boot-conf , and -.Ic boot-conf. -In all three cases, the +.Ic reload-conf . +.Pp +For +.Ic autoboot , +.Ic boot , +and +.Ic boot-conf , +the .Xr core.lua 8 module will load all ELF modules as-needed before executing the equivalent built-in loader commands. All non-kernel arguments to these commands are passed in the same order to the loader command. +.Pp +The +.Ic reload-conf +command will reload the configuration from disk. +This is useful if you have manually changed currdev and would like to easily +reload the configuration from the new device. .Ss Exported Functions The following functions are exported from .Nm : From owner-svn-src-stable-12@freebsd.org Sun Oct 6 04:02:31 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0DDFAF9E9C; Sun, 6 Oct 2019 04:02:31 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46m91L5WqSz4XQq; Sun, 6 Oct 2019 04:02:30 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8B80C1F8AC; Sun, 6 Oct 2019 04:02:30 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9642Ubn041436; Sun, 6 Oct 2019 04:02:30 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9642UPj041434; Sun, 6 Oct 2019 04:02:30 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910060402.x9642UPj041434@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 6 Oct 2019 04:02:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353137 - in stable: 11/stand/forth 11/stand/lua 12/stand/forth 12/stand/lua X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/stand/forth 11/stand/lua 12/stand/forth 12/stand/lua X-SVN-Commit-Revision: 353137 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Oct 2019 04:02:31 -0000 Author: kevans Date: Sun Oct 6 04:02:29 2019 New Revision: 353137 URL: https://svnweb.freebsd.org/changeset/base/353137 Log: MFC r352559: loader: Respect loader_color=YES for serial consoles It's not uncommon these days for the terminals attached to serial consoles to support ANSI escape sequences. However, we assume escape sequences may break some serial consoles and default to not using them when boot_serial or boot_multicons (or if console contains "comconsole" in the forth loader) for broader compatibility. We also have loader_color which can be explicitly set to "NO" to disable the use of ANSI escape sequences. The problem is that loader_color=YES gets ignored when boot_serial=YES or boot_multicons=YES (or when console contains "comconsole" in the forth loader). To fix, the existing default behavior remains unchanged when loader_color is unset, loader_color=NO explicitly disables the use of ANSI escape sequences still, and the change is that loader_color=YES can now be used to explicitly allow ANSI escapes when a serial console is enabled. Modified: stable/12/stand/forth/color.4th stable/12/stand/lua/color.lua Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/stand/forth/color.4th stable/11/stand/lua/color.lua Directory Properties: stable/11/ (props changed) Modified: stable/12/stand/forth/color.4th ============================================================================== --- stable/12/stand/forth/color.4th Sun Oct 6 04:01:15 2019 (r353136) +++ stable/12/stand/forth/color.4th Sun Oct 6 04:02:29 2019 (r353137) @@ -27,12 +27,14 @@ marker task-color.4th \ This function returns FALSE if the `loader_color' environment variable is set -\ to NO, no, or 0. Otherwise, TRUE is returned (unless booting serial). +\ to NO, no, or 0. It returns TRUE if `loader_color' is set to any other value. +\ If `loader_color' is unset, TRUE is returned (unless booting serial). \ -: loader_color? ( -- N ) +: loader_color? ( -- t ) s" loader_color" getenv dup -1 <> if - + \ `loader_color' is set. + \ Check if it is explicitly disabled. 2dup s" NO" compare-insensitive 0= if 2drop FALSE exit @@ -42,8 +44,12 @@ marker task-color.4th FALSE exit then drop + \ It is enabled. + TRUE + else + \ `loader_color' is unset. + \ Default to using color unless serial boot is active. + drop + boot_serial? 0= then - drop - - boot_serial? if FALSE else TRUE then ; Modified: stable/12/stand/lua/color.lua ============================================================================== --- stable/12/stand/lua/color.lua Sun Oct 6 04:01:15 2019 (r353136) +++ stable/12/stand/lua/color.lua Sun Oct 6 04:02:29 2019 (r353137) @@ -49,9 +49,7 @@ color.DIM = 2 function color.isEnabled() local c = loader.getenv("loader_color") if c ~= nil then - if c:lower() == "no" or c == "0" then - return false - end + return c:lower() ~= "no" and c ~= "0" end return not core.isSerialBoot() end From owner-svn-src-stable-12@freebsd.org Sun Oct 6 04:10:29 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 76459FA02D; Sun, 6 Oct 2019 04:10:29 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46m9BY24Cmz4Xh4; Sun, 6 Oct 2019 04:10:29 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2013A1F8B6; Sun, 6 Oct 2019 04:10:29 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x964ASJF041942; Sun, 6 Oct 2019 04:10:28 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x964ASp5041939; Sun, 6 Oct 2019 04:10:28 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910060410.x964ASp5041939@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 6 Oct 2019 04:10:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353138 - in stable/12: contrib/netbsd-tests/usr.bin/grep usr.bin/grep X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/12: contrib/netbsd-tests/usr.bin/grep usr.bin/grep X-SVN-Commit-Revision: 353138 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Oct 2019 04:10:29 -0000 Author: kevans Date: Sun Oct 6 04:10:28 2019 New Revision: 353138 URL: https://svnweb.freebsd.org/changeset/base/353138 Log: MFC r352691: bsdgrep(1): fixes of empty pattern/exit code/-c behavior When an empty pattern is encountered in the pattern list, I had previously broken bsdgrep to count that as a "match all" and ignore any other patterns in the list. This commit rectifies that mistake, among others: - The -v flag semantics were not quite right; lines matched should have been counted differently based on whether the -v flag was set or not. procline now definitively returns whether it's matched or not, and interpreting that result has been kicked up a level. - Empty patterns with the -x flag was broken similarly to empty patterns with the -w flag. The former is a whole-line match and should be more strict, only matching blank lines. No -x and no -w will will match the empty string at the beginning of each line. - The exit code with -L was broken, w.r.t. modern grep. Modern grap will exit(0) if any file that didn't match was output, so our interpretation was simply backwards. The new interpretation makes sense to me. Tests updated and added to try and catch some of this. This misbehavior was found by autoconf while fixing ports found in PR 229925 expecting either a more sane or a more GNU-like sed. Modified: stable/12/contrib/netbsd-tests/usr.bin/grep/t_grep.sh stable/12/usr.bin/grep/grep.c stable/12/usr.bin/grep/util.c Directory Properties: stable/12/ (props changed) Modified: stable/12/contrib/netbsd-tests/usr.bin/grep/t_grep.sh ============================================================================== --- stable/12/contrib/netbsd-tests/usr.bin/grep/t_grep.sh Sun Oct 6 04:02:29 2019 (r353137) +++ stable/12/contrib/netbsd-tests/usr.bin/grep/t_grep.sh Sun Oct 6 04:10:28 2019 (r353138) @@ -413,6 +413,60 @@ wflag_emptypat_body() atf_check -o file:test4 grep -w -e "" test4 } +atf_test_case xflag_emptypat +xflag_emptypat_body() +{ + printf "" > test1 + printf "\n" > test2 + printf "qaz" > test3 + printf " qaz\n" > test4 + + # -x is whole-line, more strict than -w. + atf_check -s exit:1 -o empty grep -x -e "" test1 + + atf_check -o file:test2 grep -x -e "" test2 + + atf_check -s exit:1 -o empty grep -x -e "" test3 + + atf_check -s exit:1 -o empty grep -x -e "" test4 + + total=$(wc -l /COPYRIGHT | sed 's/[^0-9]//g') + + # Simple checks that grep -x with an empty pattern isn't matching every + # line. The exact counts aren't important, as long as they don't + # match the total line count and as long as they don't match each other. + atf_check -o save:xpositive.count grep -Fxc '' /COPYRIGHT + atf_check -o save:xnegative.count grep -Fvxc '' /COPYRIGHT + + atf_check -o not-inline:"${total}" cat xpositive.count + atf_check -o not-inline:"${total}" cat xnegative.count + + atf_check -o not-file:xnegative.count cat xpositive.count +} + +atf_test_case xflag_emptypat_plus +xflag_emptypat_plus_body() +{ + printf "foo\n\nbar\n\nbaz\n" > target + printf "foo\n \nbar\n \nbaz\n" > target_spacelines + printf "foo\nbar\nbaz\n" > matches + printf " \n \n" > spacelines + + printf "foo\n\nbar\n\nbaz\n" > patlist1 + printf "foo\n\nba\n\nbaz\n" > patlist2 + + sed -e '/bar/d' target > matches_not2 + + # Normal handling first + atf_check -o file:target grep -Fxf patlist1 target + atf_check -o file:matches grep -Fxf patlist1 target_spacelines + atf_check -o file:matches_not2 grep -Fxf patlist2 target + + # -v handling + atf_check -s exit:1 -o empty grep -Fvxf patlist1 target + atf_check -o file:spacelines grep -Fxvf patlist1 target_spacelines +} + atf_test_case excessive_matches excessive_matches_head() { @@ -551,6 +605,12 @@ grep_nomatch_flags_head() grep_nomatch_flags_body() { + grep_type + + if [ $? -eq $GREP_TYPE_GNU_FREEBSD ]; then + atf_expect_fail "this test does not pass with GNU grep in base" + fi + printf "A\nB\nC\n" > test1 atf_check -o inline:"1\n" grep -c -C 1 -e "B" test1 @@ -563,7 +623,7 @@ grep_nomatch_flags_body() atf_check -o inline:"test1\n" grep -l -A 1 -e "B" test1 atf_check -o inline:"test1\n" grep -l -C 1 -e "B" test1 - atf_check -s exit:1 -o inline:"test1\n" grep -L -e "D" test1 + atf_check -o inline:"test1\n" grep -L -e "D" test1 atf_check -o empty grep -q -e "B" test1 atf_check -o empty grep -q -B 1 -e "B" test1 @@ -777,6 +837,8 @@ atf_init_test_cases() atf_add_test_case egrep_empty_invalid atf_add_test_case zerolen atf_add_test_case wflag_emptypat + atf_add_test_case xflag_emptypat + atf_add_test_case xflag_emptypat_plus atf_add_test_case excessive_matches atf_add_test_case wv_combo_break atf_add_test_case fgrep_sanity Modified: stable/12/usr.bin/grep/grep.c ============================================================================== --- stable/12/usr.bin/grep/grep.c Sun Oct 6 04:02:29 2019 (r353137) +++ stable/12/usr.bin/grep/grep.c Sun Oct 6 04:10:28 2019 (r353138) @@ -218,20 +218,9 @@ static void add_pattern(char *pat, size_t len) { - /* Do not add further pattern is we already match everything */ - if (matchall) - return; - /* Check if we can do a shortcut */ if (len == 0) { matchall = true; - for (unsigned int i = 0; i < patterns; i++) { - free(pattern[i].pat); - } - pattern = grep_realloc(pattern, sizeof(struct pat)); - pattern[0].pat = NULL; - pattern[0].len = 0; - patterns = 1; return; } /* Increase size if necessary */ @@ -652,7 +641,7 @@ main(int argc, char *argv[]) aargv += optind; /* Empty pattern file matches nothing */ - if (!needpattern && (patterns == 0)) + if (!needpattern && (patterns == 0) && !matchall) exit(1); /* Fail if we don't have any pattern */ @@ -699,11 +688,10 @@ main(int argc, char *argv[]) r_pattern = grep_calloc(patterns, sizeof(*r_pattern)); - /* Don't process any patterns if we have a blank one */ #ifdef WITH_INTERNAL_NOSPEC - if (!matchall && grepbehave != GREP_FIXED) { + if (grepbehave != GREP_FIXED) { #else - if (!matchall) { + { #endif /* Check if cheating is allowed (always is for fgrep). */ for (i = 0; i < patterns; ++i) { @@ -735,7 +723,12 @@ main(int argc, char *argv[]) matched = true; } - /* Find out the correct return value according to the - results and the command line option. */ + if (Lflag) + matched = !matched; + + /* + * Calculate the correct return value according to the + * results and the command line option. + */ exit(matched ? (file_err ? (qflag ? 0 : 2) : 0) : (file_err ? 2 : 1)); } Modified: stable/12/usr.bin/grep/util.c ============================================================================== --- stable/12/usr.bin/grep/util.c Sun Oct 6 04:02:29 2019 (r353137) +++ stable/12/usr.bin/grep/util.c Sun Oct 6 04:10:28 2019 (r353138) @@ -210,7 +210,7 @@ procmatch_match(struct mprintc *mc, struct parsec *pc) while (pc->matchidx >= MAX_MATCHES) { /* Reset matchidx and try again */ pc->matchidx = 0; - if (procline(pc)) + if (procline(pc) == !vflag) printline(pc, ':'); else break; @@ -355,7 +355,7 @@ procfile(const char *fn) return (0); } - line_matched = procline(&pc); + line_matched = procline(&pc) == !vflag; if (line_matched) ++lines; @@ -469,18 +469,33 @@ procline(struct parsec *pc) matchidx = pc->matchidx; - /* Special case: empty pattern with -w flag, check first character */ - if (matchall && wflag) { + /* + * With matchall (empty pattern), we can try to take some shortcuts. + * Emtpy patterns trivially match every line except in the -w and -x + * cases. For -w (whole-word) cases, we only match if the first + * character isn't a word-character. For -x (whole-line) cases, we only + * match if the line is empty. + */ + if (matchall) { if (pc->ln.len == 0) return (true); - wend = L' '; - if (sscanf(&pc->ln.dat[0], "%lc", &wend) != 1 || iswword(wend)) - return (false); - else + if (wflag) { + wend = L' '; + if (sscanf(&pc->ln.dat[0], "%lc", &wend) == 1 && + !iswword(wend)) + return (true); + } else if (!xflag) return (true); - } else if (matchall) - return (true); + /* + * If we don't have any other patterns, we really don't match. + * If we do have other patterns, we must fall through and check + * them. + */ + if (patterns == 0) + return (false); + } + matched = false; st = pc->lnstart; nst = 0; @@ -609,8 +624,6 @@ procline(struct parsec *pc) /* Reflect the new matchidx in the context */ pc->matchidx = matchidx; - if (vflag) - matched = !matched; return matched; } From owner-svn-src-stable-12@freebsd.org Sun Oct 6 04:12:09 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CE3D7FA2D0; Sun, 6 Oct 2019 04:12:09 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46m9DT4qWwz4Y24; Sun, 6 Oct 2019 04:12:09 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8A49D1FA43; Sun, 6 Oct 2019 04:12:09 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x964C91k044296; Sun, 6 Oct 2019 04:12:09 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x964C9iq044293; Sun, 6 Oct 2019 04:12:09 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910060412.x964C9iq044293@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 6 Oct 2019 04:12:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353139 - in stable/12/usr.bin/grep: . tests X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/12/usr.bin/grep: . tests X-SVN-Commit-Revision: 353139 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Oct 2019 04:12:09 -0000 Author: kevans Date: Sun Oct 6 04:12:08 2019 New Revision: 353139 URL: https://svnweb.freebsd.org/changeset/base/353139 Log: MFC r348503, r351769: bsdgrep nits r348503: grep: Move lone 'r'grep case into the adjacent switch This 'r' case should have belonged to the switch in the first place, but I had somehow missed the switch when initially adding the rgrep link. The zgrep script later came along and faithfully left this case standing alone, so we will now go ahead and join it. Nearby comment also adjusted a tad bit for wording and style. r351769: bsdgrep(1): add some basic tests for some GNU Extension support These will be expanded later as I come up with good test cases; for now, these seem to be enough to trigger bugs in base gnugrep and expose missing features in bsdgrep. Modified: stable/12/usr.bin/grep/grep.c stable/12/usr.bin/grep/tests/grep_freebsd_test.sh Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.bin/grep/grep.c ============================================================================== --- stable/12/usr.bin/grep/grep.c Sun Oct 6 04:10:28 2019 (r353138) +++ stable/12/usr.bin/grep/grep.c Sun Oct 6 04:12:08 2019 (r353139) @@ -332,20 +332,22 @@ main(int argc, char *argv[]) setlocale(LC_ALL, ""); - /* Check what is the program name of the binary. In this - way we can have all the funcionalities in one binary - without the need of scripting and using ugly hacks. */ + /* + * Check how we've bene invoked to determine the behavior we should + * exhibit. In this way we can have all the functionalities in one + * binary without the need of scripting and using ugly hacks. + */ pn = getprogname(); - if (pn[0] == 'r') { - dirbehave = DIR_RECURSE; - Hflag = true; - } switch (pn[0]) { case 'e': grepbehave = GREP_EXTENDED; break; case 'f': grepbehave = GREP_FIXED; + break; + case 'r': + dirbehave = DIR_RECURSE; + Hflag = true; break; } Modified: stable/12/usr.bin/grep/tests/grep_freebsd_test.sh ============================================================================== --- stable/12/usr.bin/grep/tests/grep_freebsd_test.sh Sun Oct 6 04:10:28 2019 (r353138) +++ stable/12/usr.bin/grep/tests/grep_freebsd_test.sh Sun Oct 6 04:12:08 2019 (r353139) @@ -82,8 +82,34 @@ rgrep_body() atf_check -o file:d_grep_r_implied.out rgrep --exclude="*.out" -e "test" "$(atf_get_srcdir)" } +atf_test_case gnuext +gnuext_body() +{ + grep_type + _type=$? + if [ $_type -eq $GREP_TYPE_BSD ]; then + atf_expect_fail "this test requires GNU extensions in regex(3)" + elif [ $_type -eq $GREP_TYPE_GNU_FREEBSD ]; then + atf_expect_fail "\\s and \\S are known to be buggy in base gnugrep" + fi + + atf_check -o save:grep_alnum.out grep -o '[[:alnum:]]' /COPYRIGHT + atf_check -o file:grep_alnum.out grep -o '\w' /COPYRIGHT + + atf_check -o save:grep_nalnum.out grep -o '[^[:alnum:]]' /COPYRIGHT + atf_check -o file:grep_nalnum.out grep -o '\W' /COPYRIGHT + + atf_check -o save:grep_space.out grep -o '[[:space:]]' /COPYRIGHT + atf_check -o file:grep_space.out grep -o '\s' /COPYRIGHT + + atf_check -o save:grep_nspace.out grep -o '[^[:space:]]' /COPYRIGHT + atf_check -o file:grep_nspace.out grep -o '\S' /COPYRIGHT + +} + atf_init_test_cases() { atf_add_test_case grep_r_implied atf_add_test_case rgrep + atf_add_test_case gnuext } From owner-svn-src-stable-12@freebsd.org Sun Oct 6 20:36:27 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2E3F31330F8; Sun, 6 Oct 2019 20:36:27 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46mb4B6mr8z3JN5; Sun, 6 Oct 2019 20:36:26 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CC49B3CCF; Sun, 6 Oct 2019 20:36:26 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x96KaQO6025822; Sun, 6 Oct 2019 20:36:26 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x96KaQA1025818; Sun, 6 Oct 2019 20:36:26 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201910062036.x96KaQA1025818@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Sun, 6 Oct 2019 20:36:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353148 - in stable/12: contrib/netbsd-tests/lib/libc/sys tests/sys/posixshm tests/sys/vm X-SVN-Group: stable-12 X-SVN-Commit-Author: jilles X-SVN-Commit-Paths: in stable/12: contrib/netbsd-tests/lib/libc/sys tests/sys/posixshm tests/sys/vm X-SVN-Commit-Revision: 353148 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Oct 2019 20:36:27 -0000 Author: jilles Date: Sun Oct 6 20:36:25 2019 New Revision: 353148 URL: https://svnweb.freebsd.org/changeset/base/353148 Log: MFC r352495,r352869: Adjust tests for page fault changes in r353102 PR: 211924 Added: stable/12/tests/sys/vm/page_fault_signal.c - copied, changed from r352495, head/tests/sys/vm/page_fault_signal.c Modified: stable/12/contrib/netbsd-tests/lib/libc/sys/t_mmap.c stable/12/tests/sys/posixshm/posixshm_test.c stable/12/tests/sys/vm/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/12/contrib/netbsd-tests/lib/libc/sys/t_mmap.c ============================================================================== --- stable/12/contrib/netbsd-tests/lib/libc/sys/t_mmap.c Sun Oct 6 19:11:01 2019 (r353147) +++ stable/12/contrib/netbsd-tests/lib/libc/sys/t_mmap.c Sun Oct 6 20:36:25 2019 (r353148) @@ -480,10 +480,6 @@ ATF_TC_BODY(mmap_truncate_signal, tc) int fd, sta; pid_t pid; -#ifdef __FreeBSD__ - atf_tc_expect_fail("testcase fails with SIGSEGV on FreeBSD; bug # 211924"); -#endif - fd = open(path, O_RDWR | O_CREAT, 0700); if (fd < 0) Modified: stable/12/tests/sys/posixshm/posixshm_test.c ============================================================================== --- stable/12/tests/sys/posixshm/posixshm_test.c Sun Oct 6 19:11:01 2019 (r353147) +++ stable/12/tests/sys/posixshm/posixshm_test.c Sun Oct 6 20:36:25 2019 (r353148) @@ -445,7 +445,7 @@ ATF_TC_BODY(object_resize, tc) /* * The previous ftruncate(2) shrunk the backing object * so that this address is no longer valid, so reading - * from it should trigger a SIGSEGV. + * from it should trigger a SIGBUS. */ c = page[pagesize]; fprintf(stderr, "child: page 1: '%c'\n", c); @@ -455,7 +455,7 @@ ATF_TC_BODY(object_resize, tc) if (wait(&status) < 0) atf_tc_fail("wait failed; errno=%d", errno); - if (!WIFSIGNALED(status) || WTERMSIG(status) != SIGSEGV) + if (!WIFSIGNALED(status) || WTERMSIG(status) != SIGBUS) atf_tc_fail("child terminated with status %x", status); /* Grow the object back to 2 pages. */ Modified: stable/12/tests/sys/vm/Makefile ============================================================================== --- stable/12/tests/sys/vm/Makefile Sun Oct 6 19:11:01 2019 (r353147) +++ stable/12/tests/sys/vm/Makefile Sun Oct 6 20:36:25 2019 (r353148) @@ -5,6 +5,7 @@ PACKAGE= tests TESTSDIR= ${TESTSBASE}/sys/vm ATF_TESTS_C+= mlock_test \ - mmap_test + mmap_test \ + page_fault_signal .include Copied and modified: stable/12/tests/sys/vm/page_fault_signal.c (from r352495, head/tests/sys/vm/page_fault_signal.c) ============================================================================== --- head/tests/sys/vm/page_fault_signal.c Wed Sep 18 21:00:32 2019 (r352495, copy source) +++ stable/12/tests/sys/vm/page_fault_signal.c Sun Oct 6 20:36:25 2019 (r353148) @@ -129,7 +129,6 @@ ATF_TC_BODY(page_fault_signal__bus_objerr_1, tc) int fd; int sz; - atf_tc_expect_fail("bug 211924"); sz = getpagesize(); fd = shm_open(SHM_ANON, O_RDWR | O_CREAT, 0600); ATF_REQUIRE(fd != -1); @@ -153,7 +152,6 @@ ATF_TC_BODY(page_fault_signal__bus_objerr_2, tc) int r; int sz; - atf_tc_expect_fail("bug 211924"); sz = getpagesize(); fd = shm_open(SHM_ANON, O_RDWR | O_CREAT, 0600); ATF_REQUIRE(fd != -1); From owner-svn-src-stable-12@freebsd.org Mon Oct 7 01:03:15 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1C5681396FC; Mon, 7 Oct 2019 01:03:15 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46mj02749vz448Z; Mon, 7 Oct 2019 01:03:14 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BDF626E14; Mon, 7 Oct 2019 01:03:14 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9713ECd085920; Mon, 7 Oct 2019 01:03:14 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9713EwQ085919; Mon, 7 Oct 2019 01:03:14 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910070103.x9713EwQ085919@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 7 Oct 2019 01:03:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353157 - in stable: 11/sys/net 12/sys/net X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/sys/net 12/sys/net X-SVN-Commit-Revision: 353157 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Oct 2019 01:03:15 -0000 Author: kevans Date: Mon Oct 7 01:03:14 2019 New Revision: 353157 URL: https://svnweb.freebsd.org/changeset/base/353157 Log: MFC r353103: tuntap(4): loosen up tunclose restrictions Realistically, this cannot work. We don't allow the tun to be opened twice, so it must be done via fd passing, fork, dup, some mechanism like these. Applications demonstrably do not enforce strict ordering when they're handing off tun devices, so the parent closing before the child will easily leave the tun/tap device in a bad state where it can't be destroyed and a confused user because they did nothing wrong. Concede that we can't leave the tun/tap device in this kind of state because of software not playing the TUNSIFPID game, but it is still good to find and fix this kind of thing to keep ifconfig(8) up-to-date and help ensure good discipline in tun handling. Modified: stable/12/sys/net/if_tun.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/net/if_tun.c Directory Properties: stable/11/ (props changed) Modified: stable/12/sys/net/if_tun.c ============================================================================== --- stable/12/sys/net/if_tun.c Sun Oct 6 22:29:02 2019 (r353156) +++ stable/12/sys/net/if_tun.c Mon Oct 7 01:03:14 2019 (r353157) @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -493,22 +494,28 @@ tunopen(struct cdev *dev, int flag, int mode, struct t static int tunclose(struct cdev *dev, int foo, int bar, struct thread *td) { + struct proc *p; struct tun_softc *tp; struct ifnet *ifp; + p = td->td_proc; tp = dev->si_drv1; ifp = TUN2IFP(tp); mtx_lock(&tp->tun_mtx); + /* - * Simply close the device if this isn't the controlling process. This - * may happen if, for instance, the tunnel has been handed off to - * another process. The original controller should be able to close it - * without putting us into an inconsistent state. + * Realistically, we can't be obstinate here. This only means that the + * tuntap device was closed out of order, and the last closer wasn't the + * controller. These are still good to know about, though, as software + * should avoid multiple processes with a tuntap device open and + * ill-defined transfer of control (e.g., handoff, TUNSIFPID, close in + * parent). */ - if (td->td_proc->p_pid != tp->tun_pid) { - mtx_unlock(&tp->tun_mtx); - return (0); + if (p->p_pid != tp->tun_pid) { + log(LOG_INFO, + "pid %d (%s), %s: tun/tap protocol violation, non-controlling process closed last.\n", + p->p_pid, p->p_comm, dev->si_name); } /* From owner-svn-src-stable-12@freebsd.org Mon Oct 7 04:44:02 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F1D3913DD61; Mon, 7 Oct 2019 04:44:02 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46mntp6CQwz4FfB; Mon, 7 Oct 2019 04:44:02 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B89539574; Mon, 7 Oct 2019 04:44:02 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x974i2Wk016717; Mon, 7 Oct 2019 04:44:02 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x974i2lx016716; Mon, 7 Oct 2019 04:44:02 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201910070444.x974i2lx016716@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Mon, 7 Oct 2019 04:44:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353164 - in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 10/sys/contrib/ipfilter/netinet 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 353164 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Oct 2019 04:44:03 -0000 Author: cy Date: Mon Oct 7 04:44:01 2019 New Revision: 353164 URL: https://svnweb.freebsd.org/changeset/base/353164 Log: MFC r353116: Add missing definition in DEBUG code. Modified: stable/12/sys/contrib/ipfilter/netinet/radix_ipf.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/10/sys/contrib/ipfilter/netinet/radix_ipf.c stable/11/sys/contrib/ipfilter/netinet/radix_ipf.c Directory Properties: stable/10/ (props changed) stable/11/ (props changed) Modified: stable/12/sys/contrib/ipfilter/netinet/radix_ipf.c ============================================================================== --- stable/12/sys/contrib/ipfilter/netinet/radix_ipf.c Mon Oct 7 04:22:03 2019 (r353163) +++ stable/12/sys/contrib/ipfilter/netinet/radix_ipf.c Mon Oct 7 04:44:01 2019 (r353164) @@ -1323,7 +1323,7 @@ dumptree(rnh) void test_addr(rnh, pref, addr, limit) ipf_rdx_head_t *rnh; - int pref; + int pref, limit; addrfamily_t *addr; { static int extras[14] = { 0, -1, 1, 3, 5, 8, 9, From owner-svn-src-stable-12@freebsd.org Mon Oct 7 08:09:40 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 04EA7FBAA2; Mon, 7 Oct 2019 08:09:40 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46mtS36KMTz4RWC; Mon, 7 Oct 2019 08:09:39 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B7D2CB8B7; Mon, 7 Oct 2019 08:09:39 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9789d3p034676; Mon, 7 Oct 2019 08:09:39 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9789df9034675; Mon, 7 Oct 2019 08:09:39 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201910070809.x9789df9034675@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Oct 2019 08:09:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353169 - stable/12/sys/dev/usb/controller X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/usb/controller X-SVN-Commit-Revision: 353169 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Oct 2019 08:09:40 -0000 Author: hselasky Date: Mon Oct 7 08:09:39 2019 New Revision: 353169 URL: https://svnweb.freebsd.org/changeset/base/353169 Log: MFC r352554: The maximum TD size is 31 and not 15. Found at: EuroBSDcon 2019 Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/usb/controller/xhci.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/usb/controller/xhci.c ============================================================================== --- stable/12/sys/dev/usb/controller/xhci.c Mon Oct 7 08:00:54 2019 (r353168) +++ stable/12/sys/dev/usb/controller/xhci.c Mon Oct 7 08:09:39 2019 (r353169) @@ -2003,7 +2003,7 @@ restart: /* clear TD SIZE to zero, hence this is the last TRB */ /* remove chain bit because this is the last data TRB in the chain */ - td->td_trb[td->ntrb - 1].dwTrb2 &= ~htole32(XHCI_TRB_2_TDSZ_SET(15)); + td->td_trb[td->ntrb - 1].dwTrb2 &= ~htole32(XHCI_TRB_2_TDSZ_SET(31)); td->td_trb[td->ntrb - 1].dwTrb3 &= ~htole32(XHCI_TRB_3_CHAIN_BIT); /* remove CHAIN-BIT from last LINK TRB */ td->td_trb[td->ntrb].dwTrb3 &= ~htole32(XHCI_TRB_3_CHAIN_BIT); From owner-svn-src-stable-12@freebsd.org Mon Oct 7 08:12:29 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 46D13FBEC8; Mon, 7 Oct 2019 08:12:29 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46mtWK1BMFz4SKJ; Mon, 7 Oct 2019 08:12:29 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0C20ABA6F; Mon, 7 Oct 2019 08:12:29 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x978CSpK040364; Mon, 7 Oct 2019 08:12:28 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x978CS7T040363; Mon, 7 Oct 2019 08:12:28 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201910070812.x978CS7T040363@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Oct 2019 08:12:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353173 - stable/12/sys/dev/usb X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/usb X-SVN-Commit-Revision: 353173 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Oct 2019 08:12:29 -0000 Author: hselasky Date: Mon Oct 7 08:12:28 2019 New Revision: 353173 URL: https://svnweb.freebsd.org/changeset/base/353173 Log: MFC r352555: Increase the maximum user-space buffer size from 256kBytes to 32MBytes for libusb. This is useful for speeding up large data transfers while reducing the interrupt rate. Found at: EuroBSDcon 2019 Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/usb/usb_ioctl.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/usb/usb_ioctl.h ============================================================================== --- stable/12/sys/dev/usb/usb_ioctl.h Mon Oct 7 08:11:49 2019 (r353172) +++ stable/12/sys/dev/usb/usb_ioctl.h Mon Oct 7 08:12:28 2019 (r353173) @@ -224,7 +224,7 @@ struct usb_fs_uninit { } USB_IOCTL_STRUCT_ALIGN(1); struct usb_fs_open { -#define USB_FS_MAX_BUFSIZE (1 << 18) +#define USB_FS_MAX_BUFSIZE (1 << 25) /* 32 MBytes */ uint32_t max_bufsize; #define USB_FS_MAX_FRAMES (1U << 12) #define USB_FS_MAX_FRAMES_PRE_SCALE (1U << 31) /* for ISOCHRONOUS transfers */ From owner-svn-src-stable-12@freebsd.org Mon Oct 7 08:24:08 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 43171FC56D; Mon, 7 Oct 2019 08:24:08 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46mtmm0vSjz4TYb; Mon, 7 Oct 2019 08:24:08 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 02B87BDD9; Mon, 7 Oct 2019 08:24:08 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x978O7cm047557; Mon, 7 Oct 2019 08:24:07 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x978O7YX047554; Mon, 7 Oct 2019 08:24:07 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201910070824.x978O7YX047554@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Oct 2019 08:24:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353177 - in stable/12/sys/dev/usb: . controller X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12/sys/dev/usb: . controller X-SVN-Commit-Revision: 353177 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Oct 2019 08:24:08 -0000 Author: hselasky Date: Mon Oct 7 08:24:07 2019 New Revision: 353177 URL: https://svnweb.freebsd.org/changeset/base/353177 Log: MFC r352556: Add quirk for XHCI(4) controllers to support USB control transfers above 1Kbyte. It might look like some XHCI(4) controllers do not support when the USB control transfer is split using a link TRB. The next NORMAL TRB after the link TRB is simply failing with XHCI error code 4. The quirk ensures we allocate a 64Kbyte buffer so that the data stage TRB is not broken with a link TRB. Found at: EuroBSDcon 2019 Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/usb/controller/xhci.c stable/12/sys/dev/usb/usb_bus.h stable/12/sys/dev/usb/usb_transfer.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/usb/controller/xhci.c ============================================================================== --- stable/12/sys/dev/usb/controller/xhci.c Mon Oct 7 08:14:45 2019 (r353176) +++ stable/12/sys/dev/usb/controller/xhci.c Mon Oct 7 08:24:07 2019 (r353177) @@ -601,6 +601,9 @@ xhci_init(struct xhci_softc *sc, device_t self, uint8_ device_printf(self, "%d bytes context size, %d-bit DMA\n", sc->sc_ctx_is_64_byte ? 64 : 32, (int)sc->sc_bus.dma_bits); + /* enable 64Kbyte control endpoint quirk */ + sc->sc_bus.control_ep_quirk = 1; + temp = XREAD4(sc, capa, XHCI_HCSPARAMS1); /* get number of device slots */ Modified: stable/12/sys/dev/usb/usb_bus.h ============================================================================== --- stable/12/sys/dev/usb/usb_bus.h Mon Oct 7 08:14:45 2019 (r353176) +++ stable/12/sys/dev/usb/usb_bus.h Mon Oct 7 08:24:07 2019 (r353177) @@ -131,6 +131,7 @@ struct usb_bus { uint8_t do_probe; /* set if USB should be re-probed */ uint8_t no_explore; /* don't explore USB ports */ uint8_t dma_bits; /* number of DMA address lines */ + uint8_t control_ep_quirk; /* need 64kByte buffer for data stage */ }; #endif /* _USB_BUS_H_ */ Modified: stable/12/sys/dev/usb/usb_transfer.c ============================================================================== --- stable/12/sys/dev/usb/usb_transfer.c Mon Oct 7 08:14:45 2019 (r353176) +++ stable/12/sys/dev/usb/usb_transfer.c Mon Oct 7 08:24:07 2019 (r353177) @@ -106,6 +106,33 @@ static const struct usb_config usb_control_ep_cfg[USB_ }, }; +static const struct usb_config usb_control_ep_quirk_cfg[USB_CTRL_XFER_MAX] = { + + /* This transfer is used for generic control endpoint transfers */ + + [0] = { + .type = UE_CONTROL, + .endpoint = 0x00, /* Control endpoint */ + .direction = UE_DIR_ANY, + .bufsize = 65535, /* bytes */ + .callback = &usb_request_callback, + .usb_mode = USB_MODE_DUAL, /* both modes */ + }, + + /* This transfer is used for generic clear stall only */ + + [1] = { + .type = UE_CONTROL, + .endpoint = 0x00, /* Control pipe */ + .direction = UE_DIR_ANY, + .bufsize = sizeof(struct usb_device_request), + .callback = &usb_do_clear_stall_callback, + .timeout = 1000, /* 1 second */ + .interval = 50, /* 50ms */ + .usb_mode = USB_MODE_HOST, + }, +}; + /* function prototypes */ static void usbd_update_max_frame_size(struct usb_xfer *); @@ -1021,7 +1048,8 @@ usbd_transfer_setup(struct usb_device *udev, * context, else there is a chance of * deadlock! */ - if (setup_start == usb_control_ep_cfg) + if (setup_start == usb_control_ep_cfg || + setup_start == usb_control_ep_quirk_cfg) info->done_p = USB_BUS_CONTROL_XFER_PROC(udev->bus); else if (xfer_mtx == &Giant) @@ -3149,7 +3177,8 @@ repeat: */ iface_index = 0; if (usbd_transfer_setup(udev, &iface_index, - udev->ctrl_xfer, usb_control_ep_cfg, USB_CTRL_XFER_MAX, NULL, + udev->ctrl_xfer, udev->bus->control_ep_quirk ? + usb_control_ep_quirk_cfg : usb_control_ep_cfg, USB_CTRL_XFER_MAX, NULL, &udev->device_mtx)) { DPRINTFN(0, "could not setup default " "USB transfer\n"); From owner-svn-src-stable-12@freebsd.org Mon Oct 7 08:28:07 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 21079FC7EF; Mon, 7 Oct 2019 08:28:07 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46mtsM0587z4V2p; Mon, 7 Oct 2019 08:28:07 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BD643BDDF; Mon, 7 Oct 2019 08:28:06 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x978S6fA048062; Mon, 7 Oct 2019 08:28:06 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x978S6pM048059; Mon, 7 Oct 2019 08:28:06 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201910070828.x978S6pM048059@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Oct 2019 08:28:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353180 - stable/12/sys/contrib/rdma/krping X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/contrib/rdma/krping X-SVN-Commit-Revision: 353180 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Oct 2019 08:28:07 -0000 Author: hselasky Date: Mon Oct 7 08:28:05 2019 New Revision: 353180 URL: https://svnweb.freebsd.org/changeset/base/353180 Log: MFC r352954: Notify all sleeping threads of device removal in krping. Implement d_purge for krping_cdevsw. Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/contrib/rdma/krping/krping.c stable/12/sys/contrib/rdma/krping/krping.h stable/12/sys/contrib/rdma/krping/krping_dev.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/contrib/rdma/krping/krping.c ============================================================================== --- stable/12/sys/contrib/rdma/krping/krping.c Mon Oct 7 08:25:25 2019 (r353179) +++ stable/12/sys/contrib/rdma/krping/krping.c Mon Oct 7 08:28:05 2019 (r353180) @@ -2189,3 +2189,17 @@ krping_walk_cb_list(void (*f)(struct krping_stats *, v (*f)(cb->pd ? &cb->stats : NULL, arg); mutex_unlock(&krping_mutex); } + +void +krping_cancel_all(void) +{ + struct krping_cb *cb; + + mutex_lock(&krping_mutex); + list_for_each_entry(cb, &krping_cbs, list) { + cb->state = ERROR; + wake_up_interruptible(&cb->sem); + } + mutex_unlock(&krping_mutex); +} + Modified: stable/12/sys/contrib/rdma/krping/krping.h ============================================================================== --- stable/12/sys/contrib/rdma/krping/krping.h Mon Oct 7 08:25:25 2019 (r353179) +++ stable/12/sys/contrib/rdma/krping/krping.h Mon Oct 7 08:28:05 2019 (r353180) @@ -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: stable/12/sys/contrib/rdma/krping/krping_dev.c ============================================================================== --- stable/12/sys/contrib/rdma/krping/krping_dev.c Mon Oct 7 08:25:25 2019 (r353179) +++ stable/12/sys/contrib/rdma/krping/krping_dev.c Mon Oct 7 08:28:05 2019 (r353180) @@ -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 From owner-svn-src-stable-12@freebsd.org Mon Oct 7 08:31:32 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E9B66FCAF6; Mon, 7 Oct 2019 08:31:32 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46mtxJ5xmqz4VSC; Mon, 7 Oct 2019 08:31:32 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AF35BBE3D; Mon, 7 Oct 2019 08:31:32 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x978VWk3049104; Mon, 7 Oct 2019 08:31:32 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x978VVDU049100; Mon, 7 Oct 2019 08:31:31 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201910070831.x978VVDU049100@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Oct 2019 08:31:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353182 - stable/12/sys/ofed/drivers/infiniband/ulp/ipoib X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/ofed/drivers/infiniband/ulp/ipoib X-SVN-Commit-Revision: 353182 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Oct 2019 08:31:33 -0000 Author: hselasky Date: Mon Oct 7 08:31:31 2019 New Revision: 353182 URL: https://svnweb.freebsd.org/changeset/base/353182 Log: MFC r352955: 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. Sponsored by: Mellanox Technologies Modified: stable/12/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h stable/12/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c stable/12/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c stable/12/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h ============================================================================== --- stable/12/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h Mon Oct 7 08:28:55 2019 (r353181) +++ stable/12/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h Mon Oct 7 08:31:31 2019 (r353182) @@ -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) & 0xffffff) + +void ipoib_start_locked(struct ifnet *, struct ipoib_dev_priv *); #endif /* _IPOIB_H */ Modified: stable/12/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c ============================================================================== --- stable/12/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c Mon Oct 7 08:28:55 2019 (r353181) +++ stable/12/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c Mon Oct 7 08:31:31 2019 (r353182) @@ -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: stable/12/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c ============================================================================== --- stable/12/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c Mon Oct 7 08:28:55 2019 (r353181) +++ stable/12/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c Mon Oct 7 08:31:31 2019 (r353182) @@ -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(&priv->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(&priv->drain_lock); spin_lock(&priv->lock); - while (ipoib_poll_tx(priv)) + while (ipoib_poll_tx(priv, true)) ; /* nothing */ spin_unlock(&priv->lock); Modified: stable/12/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c ============================================================================== --- stable/12/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Mon Oct 7 08:28:55 2019 (r353181) +++ stable/12/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Mon Oct 7 08:31:31 2019 (r353182) @@ -772,17 +772,13 @@ ipoib_send_one(struct ipoib_dev_priv *priv, struct mbu return 0; } - -static void -_ipoib_start(struct ifnet *dev, struct ipoib_dev_priv *priv) +void +ipoib_start_locked(struct ifnet *dev, struct ipoib_dev_priv *priv) { struct mbuf *mb; - if ((dev->if_drv_flags & (IFF_DRV_RUNNING|IFF_DRV_OACTIVE)) != - IFF_DRV_RUNNING) - return; + assert_spin_locked(&priv->lock); - spin_lock(&priv->lock); while (!IFQ_DRV_IS_EMPTY(&dev->if_snd) && (dev->if_drv_flags & IFF_DRV_OACTIVE) == 0) { IFQ_DRV_DEQUEUE(&dev->if_snd, mb); @@ -791,6 +787,18 @@ _ipoib_start(struct ifnet *dev, struct ipoib_dev_priv IPOIB_MTAP(dev, mb); ipoib_send_one(priv, mb); } +} + +static void +_ipoib_start(struct ifnet *dev, struct ipoib_dev_priv *priv) +{ + + if ((dev->if_drv_flags & (IFF_DRV_RUNNING|IFF_DRV_OACTIVE)) != + IFF_DRV_RUNNING) + return; + + spin_lock(&priv->lock); + ipoib_start_locked(dev, priv); spin_unlock(&priv->lock); } From owner-svn-src-stable-12@freebsd.org Mon Oct 7 08:35:49 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 676C9FCC83; Mon, 7 Oct 2019 08:35:49 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46mv2F2756z4Vv9; Mon, 7 Oct 2019 08:35:49 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 27D7CBFBD; Mon, 7 Oct 2019 08:35:49 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x978ZnG0053929; Mon, 7 Oct 2019 08:35:49 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x978ZmAt053927; Mon, 7 Oct 2019 08:35:48 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201910070835.x978ZmAt053927@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Oct 2019 08:35:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353184 - stable/12/sys/dev/mlx5/mlx5_ib X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_ib X-SVN-Commit-Revision: 353184 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Oct 2019 08:35:49 -0000 Author: hselasky Date: Mon Oct 7 08:35:48 2019 New Revision: 353184 URL: https://svnweb.freebsd.org/changeset/base/353184 Log: MFC r352956: 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 Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Mon Oct 7 08:32:19 2019 (r353183) +++ stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Mon Oct 7 08:35:48 2019 (r353184) @@ -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: stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c Mon Oct 7 08:32:19 2019 (r353183) +++ stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c Mon Oct 7 08:35:48 2019 (r353184) @@ -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; From owner-svn-src-stable-12@freebsd.org Mon Oct 7 08:38:32 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F097DFCDB9; Mon, 7 Oct 2019 08:38:32 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46mv5N654qz4W99; Mon, 7 Oct 2019 08:38:32 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B0D9EBFBF; Mon, 7 Oct 2019 08:38:32 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x978cWJd054176; Mon, 7 Oct 2019 08:38:32 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x978cWDx054175; Mon, 7 Oct 2019 08:38:32 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201910070838.x978cWDx054175@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Oct 2019 08:38:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353186 - stable/12/sys/dev/mlx5/mlx5_ib X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_ib X-SVN-Commit-Revision: 353186 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Oct 2019 08:38:33 -0000 Author: hselasky Date: Mon Oct 7 08:38:32 2019 New Revision: 353186 URL: https://svnweb.freebsd.org/changeset/base/353186 Log: MFC r352957: Update warning and error print formats in mlx5ib. Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib.h ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib.h Mon Oct 7 08:36:44 2019 (r353185) +++ stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib.h Mon Oct 7 08:38:32 2019 (r353186) @@ -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) + \ From owner-svn-src-stable-12@freebsd.org Mon Oct 7 08:39:56 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8A46BFCEE2; Mon, 7 Oct 2019 08:39:56 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46mv7036Zlz4WPv; Mon, 7 Oct 2019 08:39:56 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4E368BFC2; Mon, 7 Oct 2019 08:39:56 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x978du6q054359; Mon, 7 Oct 2019 08:39:56 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x978dutx054358; Mon, 7 Oct 2019 08:39:56 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201910070839.x978dutx054358@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Oct 2019 08:39:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353188 - stable/12/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 353188 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Oct 2019 08:39:56 -0000 Author: hselasky Date: Mon Oct 7 08:39:55 2019 New Revision: 353188 URL: https://svnweb.freebsd.org/changeset/base/353188 Log: MFC r352958: 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. Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c Mon Oct 7 08:39:12 2019 (r353187) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c Mon Oct 7 08:39:55 2019 (r353188) @@ -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; From owner-svn-src-stable-12@freebsd.org Mon Oct 7 08:41:17 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 18D2BFD1CB; Mon, 7 Oct 2019 08:41:17 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46mv8X4ktPz4WrN; Mon, 7 Oct 2019 08:41:16 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 81367C00D; Mon, 7 Oct 2019 08:41:16 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x978fG0f058411; Mon, 7 Oct 2019 08:41:16 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x978fGAl058410; Mon, 7 Oct 2019 08:41:16 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201910070841.x978fGAl058410@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Oct 2019 08:41:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353190 - stable/12/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 353190 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Oct 2019 08:41:17 -0000 Author: hselasky Date: Mon Oct 7 08:41:16 2019 New Revision: 353190 URL: https://svnweb.freebsd.org/changeset/base/353190 Log: MFC r352959: Check return value of mlx5_vector2eqn() function in mlx5en. Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Mon Oct 7 08:40:34 2019 (r353189) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Mon Oct 7 08:41:16 2019 (r353190) @@ -1913,12 +1913,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, &eqn_not_used, &irqn); + if (err) + return (err); + err = mlx5_cqwq_create(mdev, ¶m->wq, param->cqc, &cq->wq, &cq->wq_ctrl); if (err) return (err); - - mlx5_vector2eqn(mdev, eq_ix, &eqn_not_used, &irqn); mcq->cqe_sz = 64; mcq->set_ci_db = cq->wq_ctrl.db.db; From owner-svn-src-stable-12@freebsd.org Mon Oct 7 08:43:03 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C832CFD596; Mon, 7 Oct 2019 08:43:03 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46mvBb4nF0z4XK1; Mon, 7 Oct 2019 08:43:03 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 86763C17C; Mon, 7 Oct 2019 08:43:03 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x978h3qD060010; Mon, 7 Oct 2019 08:43:03 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x978h3gQ060009; Mon, 7 Oct 2019 08:43:03 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201910070843.x978h3gQ060009@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Oct 2019 08:43:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353192 - stable/12/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 353192 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Oct 2019 08:43:03 -0000 Author: hselasky Date: Mon Oct 7 08:43:03 2019 New Revision: 353192 URL: https://svnweb.freebsd.org/changeset/base/353192 Log: MFC r352960: Fix for missing cleanup code in error case in mlx5en. Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c Mon Oct 7 08:41:53 2019 (r353191) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c Mon Oct 7 08:43:03 2019 (r353192) @@ -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(&pdev->dev, "fpga device start failed %d\n", err); - goto err_fpga_start; + goto err_fs; } err = mlx5_register_device(dev); if (err) { dev_err(&pdev->dev, "mlx5_register_device failed %d\n", err); - goto err_fs; + goto err_fpga; } set_bit(MLX5_INTERFACE_STATE_UP, &dev->intf_state); @@ -1148,7 +1148,9 @@ out: mutex_unlock(&dev->intf_state_mutex); return 0; -err_fpga_start: +err_fpga: + mlx5_fpga_device_stop(dev); + err_fs: mlx5_cleanup_fs(dev); From owner-svn-src-stable-12@freebsd.org Mon Oct 7 08:44:30 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C48FEFD6D5; Mon, 7 Oct 2019 08:44:30 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46mvDG13mnz4Xby; Mon, 7 Oct 2019 08:44:30 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E29DCC181; Mon, 7 Oct 2019 08:44:29 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x978iTMn060217; Mon, 7 Oct 2019 08:44:29 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x978iTQM060215; Mon, 7 Oct 2019 08:44:29 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201910070844.x978iTQM060215@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Oct 2019 08:44:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353194 - stable/12/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 353194 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Oct 2019 08:44:30 -0000 Author: hselasky Date: Mon Oct 7 08:44:29 2019 New Revision: 353194 URL: https://svnweb.freebsd.org/changeset/base/353194 Log: MFC r352961: Implement macro for asserting priv lock in mlx5en. Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_en/en.h stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/en.h Mon Oct 7 08:43:45 2019 (r353193) +++ stable/12/sys/dev/mlx5/mlx5_en/en.h Mon Oct 7 08:44:29 2019 (r353194) @@ -987,6 +987,7 @@ struct mlx5e_priv { #define PRIV_LOCK(priv) sx_xlock(&(priv)->state_lock) #define PRIV_UNLOCK(priv) sx_xunlock(&(priv)->state_lock) #define PRIV_LOCKED(priv) sx_xlocked(&(priv)->state_lock) +#define PRIV_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: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c Mon Oct 7 08:43:45 2019 (r353193) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c Mon Oct 7 08:44:29 2019 (r353194) @@ -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))); From owner-svn-src-stable-12@freebsd.org Mon Oct 7 08:46:24 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6CBD8FD8D1; Mon, 7 Oct 2019 08:46:24 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46mvGS30y0z4XvQ; Mon, 7 Oct 2019 08:46:24 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4B963C183; Mon, 7 Oct 2019 08:46:24 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x978kO5E060448; Mon, 7 Oct 2019 08:46:24 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x978kMb0060441; Mon, 7 Oct 2019 08:46:22 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201910070846.x978kMb0060441@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Oct 2019 08:46:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353196 - in stable/12/sys: conf dev/mlx5 dev/mlx5/mlx5_core dev/mlx5/mlx5_en modules/mlx5 X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12/sys: conf dev/mlx5 dev/mlx5/mlx5_core dev/mlx5/mlx5_en modules/mlx5 X-SVN-Commit-Revision: 353196 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Oct 2019 08:46:24 -0000 Author: hselasky Date: Mon Oct 7 08:46:22 2019 New Revision: 353196 URL: https://svnweb.freebsd.org/changeset/base/353196 Log: MFC r352962: 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 Sponsored by: Mellanox Technologies Added: stable/12/sys/dev/mlx5/mlx5_core/mlx5_mpfs.c - copied unchanged from r352962, head/sys/dev/mlx5/mlx5_core/mlx5_mpfs.c stable/12/sys/dev/mlx5/mpfs.h - copied unchanged from r352962, head/sys/dev/mlx5/mpfs.h Modified: stable/12/sys/conf/files stable/12/sys/dev/mlx5/driver.h stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c stable/12/sys/modules/mlx5/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/conf/files ============================================================================== --- stable/12/sys/conf/files Mon Oct 7 08:45:06 2019 (r353195) +++ stable/12/sys/conf/files Mon Oct 7 08:46:22 2019 (r353196) @@ -4810,6 +4810,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.c optional mlx5 pci \ Modified: stable/12/sys/dev/mlx5/driver.h ============================================================================== --- stable/12/sys/dev/mlx5/driver.h Mon Oct 7 08:45:06 2019 (r353195) +++ stable/12/sys/dev/mlx5/driver.h Mon Oct 7 08:46:22 2019 (r353196) @@ -717,6 +717,12 @@ struct mlx5_core_dev { struct mlx5_rsvd_gids reserved_gids; atomic_t roce_en; } roce; + + struct { + spinlock_t spinlock; +#define MLX5_MPFS_TABLE_MAX 32 + long bitmap[BITS_TO_LONGS(MLX5_MPFS_TABLE_MAX)]; + } mpfs; #ifdef CONFIG_MLX5_FPGA struct mlx5_fpga_device *fpga; #endif Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c Mon Oct 7 08:45:06 2019 (r353195) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c Mon Oct 7 08:46:22 2019 (r353196) @@ -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(&pdev->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); Copied: stable/12/sys/dev/mlx5/mlx5_core/mlx5_mpfs.c (from r352962, head/sys/dev/mlx5/mlx5_core/mlx5_mpfs.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_mpfs.c Mon Oct 7 08:46:22 2019 (r353196, copy of r352962, head/sys/dev/mlx5/mlx5_core/mlx5_mpfs.c) @@ -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 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 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$ + */ + +#include +#include + +#include +#include +#include +#include + +#define MPFS_LOCK(dev) spin_lock(&(dev)->mpfs.spinlock) +#define MPFS_UNLOCK(dev) spin_unlock(&(dev)->mpfs.spinlock) + +int +mlx5_mpfs_add_mac(struct mlx5_core_dev *dev, u32 *p_index, const u8 *mac) +{ + const u32 l2table_size = MIN(1U << MLX5_CAP_GEN(dev, log_max_l2_table), + MLX5_MPFS_TABLE_MAX); + u32 in[MLX5_ST_SZ_DW(set_l2_table_entry_in)] = {}; + u32 out[MLX5_ST_SZ_DW(set_l2_table_entry_out)] = {}; + u8 *in_mac_addr; + u32 index; + int err; + + if (!MLX5_CAP_GEN(dev, eswitch_flow_table)) { + *p_index = 0; + return (0); + } + + MPFS_LOCK(dev); + index = find_first_zero_bit(dev->mpfs.bitmap, l2table_size); + if (index < l2table_size) + set_bit(index, dev->mpfs.bitmap); + MPFS_UNLOCK(dev); + + if (index >= l2table_size) + return (-ENOMEM); + + MLX5_SET(set_l2_table_entry_in, in, opcode, MLX5_CMD_OP_SET_L2_TABLE_ENTRY); + MLX5_SET(set_l2_table_entry_in, in, table_index, index); + + in_mac_addr = MLX5_ADDR_OF(set_l2_table_entry_in, in, mac_address); + ether_addr_copy(&in_mac_addr[2], mac); + + err = mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out)); + if (err != 0) { + MPFS_LOCK(dev); + clear_bit(index, dev->mpfs.bitmap); + MPFS_UNLOCK(dev); + } else { + *p_index = index; + } + return (err); +} + +int +mlx5_mpfs_del_mac(struct mlx5_core_dev *dev, u32 index) +{ + u32 in[MLX5_ST_SZ_DW(delete_l2_table_entry_in)] = {}; + u32 out[MLX5_ST_SZ_DW(delete_l2_table_entry_out)] = {}; + int err; + + if (!MLX5_CAP_GEN(dev, eswitch_flow_table)) { + if (index != 0) + return (-EINVAL); + return (0); + } + + MLX5_SET(delete_l2_table_entry_in, in, opcode, MLX5_CMD_OP_DELETE_L2_TABLE_ENTRY); + MLX5_SET(delete_l2_table_entry_in, in, table_index, index); + + err = mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out)); + if (err == 0) { + MPFS_LOCK(dev); + clear_bit(index, dev->mpfs.bitmap); + MPFS_UNLOCK(dev); + } + return (err); +} + +int +mlx5_mpfs_init(struct mlx5_core_dev *dev) +{ + + spin_lock_init(&dev->mpfs.spinlock); + bitmap_zero(dev->mpfs.bitmap, MLX5_MPFS_TABLE_MAX); + return (0); +} + +void +mlx5_mpfs_destroy(struct mlx5_core_dev *dev) +{ + u32 num; + + num = bitmap_weight(dev->mpfs.bitmap, MLX5_MPFS_TABLE_MAX); + if (num != 0) + dev_err(&dev->pdev->dev, "Leaking %u MPFS MAC table entries\n", num); + + spin_lock_destroy(&dev->mpfs.spinlock); +} Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c Mon Oct 7 08:45:06 2019 (r353195) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c Mon Oct 7 08:46:22 2019 (r353196) @@ -29,6 +29,7 @@ #include #include +#include #define MLX5_SET_CFG(p, f, v) MLX5_SET(create_flow_group_in, p, f, v) @@ -54,6 +55,7 @@ enum { struct mlx5e_eth_addr_hash_node { LIST_ENTRY(mlx5e_eth_addr_hash_node) hlist; u8 action; + u32 mpfs_index; struct mlx5e_eth_addr_info ai; }; @@ -63,29 +65,23 @@ mlx5e_hash_eth_addr(const u8 * addr) return (addr[5]); } -static void +static bool mlx5e_add_eth_addr_to_hash(struct mlx5e_eth_addr_hash_head *hash, - const u8 * addr) + struct mlx5e_eth_addr_hash_node *hn_new) { struct mlx5e_eth_addr_hash_node *hn; - int ix = mlx5e_hash_eth_addr(addr); + u32 ix = mlx5e_hash_eth_addr(hn_new->ai.addr); LIST_FOREACH(hn, &hash[ix], hlist) { - if (bcmp(hn->ai.addr, addr, ETHER_ADDR_LEN) == 0) { + if (bcmp(hn->ai.addr, hn_new->ai.addr, ETHER_ADDR_LEN) == 0) { if (hn->action == MLX5E_ACTION_DEL) hn->action = MLX5E_ACTION_NONE; - return; + free(hn_new, M_MLX5EN); + return (false); } } - - hn = malloc(sizeof(*hn), M_MLX5EN, M_NOWAIT | M_ZERO); - if (hn == NULL) - return; - - ether_addr_copy(hn->ai.addr, addr); - hn->action = MLX5E_ACTION_ADD; - - LIST_INSERT_HEAD(&hash[ix], hn, hlist); + LIST_INSERT_HEAD(&hash[ix], hn_new, hlist); + return (true); } static void @@ -757,6 +753,8 @@ mlx5e_execute_action(struct mlx5e_priv *priv, case MLX5E_ACTION_DEL: mlx5e_del_eth_addr_from_flow_table(priv, &hn->ai); + if (hn->mpfs_index != -1U) + mlx5_mpfs_del_mac(priv->mdev, hn->mpfs_index); mlx5e_del_eth_addr_from_hash(hn); break; @@ -765,36 +763,139 @@ mlx5e_execute_action(struct mlx5e_priv *priv, } } +static struct mlx5e_eth_addr_hash_node * +mlx5e_move_hn(struct mlx5e_eth_addr_hash_head *fh, struct mlx5e_eth_addr_hash_head *uh) +{ + struct mlx5e_eth_addr_hash_node *hn; + + hn = LIST_FIRST(fh); + if (hn != NULL) { + LIST_REMOVE(hn, hlist); + LIST_INSERT_HEAD(uh, hn, hlist); + } + return (hn); +} + +static struct mlx5e_eth_addr_hash_node * +mlx5e_remove_hn(struct mlx5e_eth_addr_hash_head *fh) +{ + struct mlx5e_eth_addr_hash_node *hn; + + hn = LIST_FIRST(fh); + if (hn != NULL) + LIST_REMOVE(hn, hlist); + return (hn); +} + static void mlx5e_sync_ifp_addr(struct mlx5e_priv *priv) { + struct mlx5e_eth_addr_hash_head head_free; + struct mlx5e_eth_addr_hash_head head_uc; + struct mlx5e_eth_addr_hash_head head_mc; + struct mlx5e_eth_addr_hash_node *hn; struct ifnet *ifp = priv->ifp; struct ifaddr *ifa; struct ifmultiaddr *ifma; + bool success = false; + size_t x; + size_t num; PRIV_ASSERT_LOCKED(priv); - /* XXX adding this entry might not be needed */ - mlx5e_add_eth_addr_to_hash(priv->eth_addr.if_uc, + LIST_INIT(&head_free); + LIST_INIT(&head_uc); + LIST_INIT(&head_mc); +retry: + num = 1; + + if_addr_rlock(ifp); + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + if (ifa->ifa_addr->sa_family != AF_LINK) + continue; + num++; + } + if_addr_runlock(ifp); + + if_maddr_rlock(ifp); + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + if (ifma->ifma_addr->sa_family != AF_LINK) + continue; + num++; + } + if_maddr_runlock(ifp); + + /* allocate place holders */ + for (x = 0; x != num; x++) { + hn = malloc(sizeof(*hn), M_MLX5EN, M_WAITOK | M_ZERO); + hn->action = MLX5E_ACTION_ADD; + hn->mpfs_index = -1U; + LIST_INSERT_HEAD(&head_free, hn, hlist); + } + + hn = mlx5e_move_hn(&head_free, &head_uc); + if (hn == NULL) + goto cleanup; + + ether_addr_copy(hn->ai.addr, LLADDR((struct sockaddr_dl *)(ifp->if_addr->ifa_addr))); if_addr_rlock(ifp); CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_LINK) continue; - mlx5e_add_eth_addr_to_hash(priv->eth_addr.if_uc, + hn = mlx5e_move_hn(&head_free, &head_uc); + if (hn == NULL) + break; + ether_addr_copy(hn->ai.addr, LLADDR((struct sockaddr_dl *)ifa->ifa_addr)); } if_addr_runlock(ifp); + if (ifa != NULL) + goto cleanup; if_maddr_rlock(ifp); CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; - mlx5e_add_eth_addr_to_hash(priv->eth_addr.if_mc, + hn = mlx5e_move_hn(&head_free, &head_mc); + if (hn == NULL) + break; + ether_addr_copy(hn->ai.addr, LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); } if_maddr_runlock(ifp); + if (ifma != NULL) + goto cleanup; + + /* insert L2 unicast addresses into hash list */ + + while ((hn = mlx5e_remove_hn(&head_uc)) != NULL) { + if (mlx5e_add_eth_addr_to_hash(priv->eth_addr.if_uc, hn) == 0) + continue; + if (hn->mpfs_index == -1U) + mlx5_mpfs_add_mac(priv->mdev, &hn->mpfs_index, hn->ai.addr); + } + + /* insert L2 multicast addresses into hash list */ + + while ((hn = mlx5e_remove_hn(&head_mc)) != NULL) { + if (mlx5e_add_eth_addr_to_hash(priv->eth_addr.if_mc, hn) == 0) + continue; + } + + success = true; + +cleanup: + while ((hn = mlx5e_remove_hn(&head_uc)) != NULL) + free(hn, M_MLX5EN); + while ((hn = mlx5e_remove_hn(&head_mc)) != NULL) + free(hn, M_MLX5EN); + while ((hn = mlx5e_remove_hn(&head_free)) != NULL) + free(hn, M_MLX5EN); + + if (success == false) + goto retry; } static void mlx5e_fill_addr_array(struct mlx5e_priv *priv, int list_type, @@ -1493,6 +1594,8 @@ err_destroy_vlan_flow_table: void mlx5e_close_flow_table(struct mlx5e_priv *priv) { + + mlx5e_handle_ifp_addr(priv); mlx5e_destroy_inner_rss_flow_table(priv); mlx5e_destroy_main_flow_table(priv); mlx5e_destroy_vlan_flow_table(priv); Copied: stable/12/sys/dev/mlx5/mpfs.h (from r352962, head/sys/dev/mlx5/mpfs.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/sys/dev/mlx5/mpfs.h Mon Oct 7 08:46:22 2019 (r353196, copy of r352962, head/sys/dev/mlx5/mpfs.h) @@ -0,0 +1,37 @@ +/*- + * 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 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 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 _MLX5_MPFS_H_ +#define _MLX5_MPFS_H_ + +struct mlx5_core_dev; +int mlx5_mpfs_add_mac(struct mlx5_core_dev *dev, u32 *p_index, const u8 *mac); +int mlx5_mpfs_del_mac(struct mlx5_core_dev *dev, u32 index); +int mlx5_mpfs_init(struct mlx5_core_dev *dev); +void mlx5_mpfs_destroy(struct mlx5_core_dev *dev); + +#endif /* _MLX5_MPFS_H_ */ Modified: stable/12/sys/modules/mlx5/Makefile ============================================================================== --- stable/12/sys/modules/mlx5/Makefile Mon Oct 7 08:45:06 2019 (r353195) +++ stable/12/sys/modules/mlx5/Makefile Mon Oct 7 08:46:22 2019 (r353196) @@ -19,6 +19,7 @@ mlx5_health.c \ mlx5_mad.c \ mlx5_main.c \ mlx5_mcg.c \ +mlx5_mpfs.c \ mlx5_mr.c \ mlx5_pagealloc.c \ mlx5_pd.c \ From owner-svn-src-stable-12@freebsd.org Mon Oct 7 08:48:50 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5A26CFDBC4; Mon, 7 Oct 2019 08:48:50 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46mvKG1kTMz4YHk; Mon, 7 Oct 2019 08:48:50 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1934EC186; Mon, 7 Oct 2019 08:48:50 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x978mnqi060683; Mon, 7 Oct 2019 08:48:49 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x978mnVn060679; Mon, 7 Oct 2019 08:48:49 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201910070848.x978mnVn060679@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Oct 2019 08:48:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353198 - in stable/12/sys/dev/mlx5: . mlx5_core X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 353198 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Oct 2019 08:48:50 -0000 Author: hselasky Date: Mon Oct 7 08:48:49 2019 New Revision: 353198 URL: https://svnweb.freebsd.org/changeset/base/353198 Log: MFC r352963: Cleanup naming of IRQ vectors in mlx5en. Remove unused IRQ naming functions and arrays. Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/driver.h stable/12/sys/dev/mlx5/mlx5_core/mlx5_core.h stable/12/sys/dev/mlx5/mlx5_core/mlx5_eq.c stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/driver.h ============================================================================== --- stable/12/sys/dev/mlx5/driver.h Mon Oct 7 08:47:08 2019 (r353197) +++ stable/12/sys/dev/mlx5/driver.h Mon Oct 7 08:48:49 2019 (r353198) @@ -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 { char name[MLX5_MAX_NAME_LEN]; struct mlx5_eq_table eq_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: stable/12/sys/dev/mlx5/mlx5_core/mlx5_core.h ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_core.h Mon Oct 7 08:47:08 2019 (r353197) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_core.h Mon Oct 7 08:48:49 2019 (r353198) @@ -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: stable/12/sys/dev/mlx5/mlx5_core/mlx5_eq.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_eq.c Mon Oct 7 08:47:08 2019 (r353197) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_eq.c Mon Oct 7 08:48:49 2019 (r353198) @@ -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 = &dev->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, &table->cmd_eq, MLX5_EQ_VEC_CMD, MLX5_NUM_CMD_EQE, 1ull << MLX5_EVENT_TYPE_CMD, - "mlx5_cmd_eq", &dev->priv.uuari.uars[0]); + &dev->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, &table->async_eq, MLX5_EQ_VEC_ASYNC, MLX5_NUM_ASYNC_EQE, async_event_mask, - "mlx5_async_eq", &dev->priv.uuari.uars[0]); + &dev->priv.uuari.uars[0]); if (err) { mlx5_core_warn(dev, "failed to create async EQ %d\n", err); goto err1; @@ -587,7 +585,7 @@ int mlx5_start_eqs(struct mlx5_core_dev *dev) err = mlx5_create_map_eq(dev, &table->pages_eq, MLX5_EQ_VEC_PAGES, /* TODO: sriov max_vf + */ 1, - 1 << MLX5_EVENT_TYPE_PAGE_REQUEST, "mlx5_pages_eq", + 1 << MLX5_EVENT_TYPE_PAGE_REQUEST, &dev->priv.uuari.uars[0]); if (err) { mlx5_core_warn(dev, "failed to create pages EQ %d\n", err); Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c Mon Oct 7 08:47:08 2019 (r353197) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c Mon Oct 7 08:48:49 2019 (r353198) @@ -285,8 +285,6 @@ static int mlx5_enable_msix(struct mlx5_core_dev *dev) priv->msix_arr = kzalloc(nvec * sizeof(*priv->msix_arr), GFP_KERNEL); - priv->irq_info = kzalloc(nvec * sizeof(*priv->irq_info), GFP_KERNEL); - for (i = 0; i < nvec; i++) priv->msix_arr[i].entry = i; @@ -296,9 +294,7 @@ static int mlx5_enable_msix(struct mlx5_core_dev *dev) return nvec; table->num_comp_vectors = nvec - MLX5_EQ_VEC_COMP_BASE; - return 0; - } static void mlx5_disable_msix(struct mlx5_core_dev *dev) @@ -306,7 +302,6 @@ static void mlx5_disable_msix(struct mlx5_core_dev *de struct mlx5_priv *priv = &dev->priv; pci_disable_msix(dev->pdev); - kfree(priv->irq_info); kfree(priv->msix_arr); } @@ -604,30 +599,6 @@ int mlx5_vector2eqn(struct mlx5_core_dev *dev, int vec } EXPORT_SYMBOL(mlx5_vector2eqn); -int mlx5_rename_eq(struct mlx5_core_dev *dev, int eq_ix, char *name) -{ - struct mlx5_priv *priv = &dev->priv; - struct mlx5_eq_table *table = &priv->eq_table; - struct mlx5_eq *eq; - int err = -ENOENT; - - spin_lock(&table->lock); - list_for_each_entry(eq, &table->comp_eqs_list, list) { - if (eq->index == eq_ix) { - int irq_ix = eq_ix + MLX5_EQ_VEC_COMP_BASE; - - snprintf(priv->irq_info[irq_ix].name, MLX5_MAX_IRQ_NAME, - "%s-%d", name, eq_ix); - - err = 0; - break; - } - } - spin_unlock(&table->lock); - - return err; -} - static void free_comp_eqs(struct mlx5_core_dev *dev) { struct mlx5_eq_table *table = &dev->priv.eq_table; @@ -649,7 +620,6 @@ static void free_comp_eqs(struct mlx5_core_dev *dev) static int alloc_comp_eqs(struct mlx5_core_dev *dev) { struct mlx5_eq_table *table = &dev->priv.eq_table; - char name[MLX5_MAX_IRQ_NAME]; struct mlx5_eq *eq; int ncomp_vec; int nent; @@ -662,10 +632,9 @@ static int alloc_comp_eqs(struct mlx5_core_dev *dev) for (i = 0; i < ncomp_vec; i++) { eq = kzalloc(sizeof(*eq), GFP_KERNEL); - snprintf(name, MLX5_MAX_IRQ_NAME, "mlx5_comp%d", i); err = mlx5_create_map_eq(dev, eq, i + MLX5_EQ_VEC_COMP_BASE, nent, 0, - name, &dev->priv.uuari.uars[0]); + &dev->priv.uuari.uars[0]); if (err) { kfree(eq); goto clean; From owner-svn-src-stable-12@freebsd.org Mon Oct 7 08:50:23 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 937A5FDD06; Mon, 7 Oct 2019 08:50:23 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46mvM33BKjz4YXn; Mon, 7 Oct 2019 08:50:23 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 50B01C18B; Mon, 7 Oct 2019 08:50:23 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x978oNr9060920; Mon, 7 Oct 2019 08:50:23 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x978oN6P060919; Mon, 7 Oct 2019 08:50:23 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201910070850.x978oN6P060919@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Oct 2019 08:50:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353200 - stable/12/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 353200 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Oct 2019 08:50:23 -0000 Author: hselasky Date: Mon Oct 7 08:50:22 2019 New Revision: 353200 URL: https://svnweb.freebsd.org/changeset/base/353200 Log: MFC r352964: Export channel IRQ number as part of the "hw_ctx_debug" sysctl(8) in mlx5en(4). Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Mon Oct 7 08:49:32 2019 (r353199) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Mon Oct 7 08:50:22 2019 (r353200) @@ -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(&sb, NULL, 128, req) == NULL) + if (sbuf_new_for_sysctl(&sb, NULL, 1024, req) == NULL) return (ENOMEM); sbuf_clear_flags(&sb, SBUF_INCLUDENUL); PRIV_LOCK(priv); - if (test_bit(MLX5E_STATE_OPENED, &priv->state) == 0) - goto out; - for (i = 0; i < priv->params.num_channels; i++) { - c = &priv->channel[i]; - rq = &c->rq; - sbuf_printf(&sb, "channel %d rq %d cq %d\n", - c->ix, rq->rqn, rq->cq.mcq.cqn); - for (tc = 0; tc < c->num_tc; tc++) { - sq = &c->sq[tc]; - sbuf_printf(&sb, "channel %d tc %d sq %d cq %d\n", - c->ix, tc, sq->sqn, sq->cq.mcq.cqn); + opened = test_bit(MLX5E_STATE_OPENED, &priv->state); + + sbuf_printf(&sb, "pages irq %d\n", + priv->mdev->priv.msix_arr[MLX5_EQ_VEC_PAGES].vector); + sbuf_printf(&sb, "command irq %d\n", + priv->mdev->priv.msix_arr[MLX5_EQ_VEC_CMD].vector); + sbuf_printf(&sb, "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, &eqn_not_used, &irqn) != 0) + continue; + + c = opened ? &priv->channel[i] : NULL; + rq = opened ? &c->rq : NULL; + sbuf_printf(&sb, "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 ? &c->sq[tc] : NULL; + sbuf_printf(&sb, "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(&sb); sbuf_delete(&sb); From owner-svn-src-stable-12@freebsd.org Mon Oct 7 08:59:10 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BFDA5FE1B3; Mon, 7 Oct 2019 08:59:10 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46mvYB4K2Lz4ZRq; Mon, 7 Oct 2019 08:59:10 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5D0ADC36E; Mon, 7 Oct 2019 08:59:10 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x978xAXe066985; Mon, 7 Oct 2019 08:59:10 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x978xAkS066984; Mon, 7 Oct 2019 08:59:10 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201910070859.x978xAkS066984@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Oct 2019 08:59:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353203 - stable/12/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 353203 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Oct 2019 08:59:10 -0000 Author: hselasky Date: Mon Oct 7 08:59:09 2019 New Revision: 353203 URL: https://svnweb.freebsd.org/changeset/base/353203 Log: MFC r352965: Correct and update some counter names in mlx5en(4). Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_en/en.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/en.h Mon Oct 7 08:57:39 2019 (r353202) +++ stable/12/sys/dev/mlx5/mlx5_en/en.h Mon Oct 7 08:59:09 2019 (r353203) @@ -255,7 +255,7 @@ struct mlx5e_vport_stats { m(+1, u64, out_broadcast_pkts, "out_broadcast_pkts", "Out broadcast packets") #define MLX5E_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") \ @@ -339,14 +339,14 @@ struct mlx5e_vport_stats { /* Per priority statistics for PFC */ #define MLX5E_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", \ From owner-svn-src-stable-12@freebsd.org Mon Oct 7 09:01:23 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3D7FFFE583; Mon, 7 Oct 2019 09:01:23 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46mvbl0wTZz4ZwF; Mon, 7 Oct 2019 09:01:23 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F41B4C4D0; Mon, 7 Oct 2019 09:01:22 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9791MkH070075; Mon, 7 Oct 2019 09:01:22 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9791Ms2069047; Mon, 7 Oct 2019 09:01:22 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201910070901.x9791Ms2069047@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Oct 2019 09:01:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353205 - in stable/12/sys/dev/mlx5: . mlx5_core mlx5_en X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12/sys/dev/mlx5: . mlx5_core mlx5_en X-SVN-Commit-Revision: 353205 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Oct 2019 09:01:23 -0000 Author: hselasky Date: Mon Oct 7 09:01:21 2019 New Revision: 353205 URL: https://svnweb.freebsd.org/changeset/base/353205 Log: MFC r352966: Add port module event software counters in mlx5core. While at it, fixup PME based on latest PRM defines. Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/device.h stable/12/sys/dev/mlx5/driver.h stable/12/sys/dev/mlx5/mlx5_core/mlx5_eq.c stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/device.h ============================================================================== --- stable/12/sys/dev/mlx5/device.h Mon Oct 7 09:00:08 2019 (r353204) +++ stable/12/sys/dev/mlx5/device.h Mon Oct 7 09:01:21 2019 (r353205) @@ -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: stable/12/sys/dev/mlx5/driver.h ============================================================================== --- stable/12/sys/dev/mlx5/driver.h Mon Oct 7 09:00:08 2019 (r353204) +++ stable/12/sys/dev/mlx5/driver.h Mon Oct 7 09:01:21 2019 (r353205) @@ -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 { char name[MLX5_MAX_NAME_LEN]; struct mlx5_eq_table eq_table; @@ -624,6 +629,7 @@ struct mlx5_priv { #ifdef RATELIMIT struct mlx5_rl_table rl_table; #endif + struct mlx5_pme_stats pme_stats; }; enum mlx5_device_state { Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_eq.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_eq.c Mon Oct 7 09:00:08 2019 (r353204) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_eq.c Mon Oct 7 09:01:21 2019 (r353205) @@ -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) { case MLX5_MODULE_STATUS_PLUGGED_ENABLED: - device_printf((&pdev->dev)->bsddev, "INFO: ""Module %u, status: plugged and enabled\n", module_num); + device_printf((&pdev->dev)->bsddev, + "INFO: Module %u, status: plugged and enabled\n", + module_num); break; case MLX5_MODULE_STATUS_UNPLUGGED: - device_printf((&pdev->dev)->bsddev, "INFO: ""Module %u, status: unplugged\n", module_num); + device_printf((&pdev->dev)->bsddev, + "INFO: Module %u, status: unplugged\n", module_num); break; case MLX5_MODULE_STATUS_ERROR: - device_printf((&pdev->dev)->bsddev, "INFO: ""Module %u, status: error, %s\n", module_num, mlx5_port_module_event_error_type_to_string(error_type)); + device_printf((&pdev->dev)->bsddev, + "ERROR: Module %u, status: error, %s\n", + module_num, + mlx5_port_module_event_error_type_to_string(error_type)); + if (error_type < MLX5_MODULE_EVENT_ERROR_NUM) + dev->priv.pme_stats.error_counters[error_type]++; break; - case MLX5_MODULE_STATUS_PLUGGED_DISABLED: - device_printf((&pdev->dev)->bsddev, "INFO: ""Module %u, status: plugged but disabled\n", module_num); - break; - default: - device_printf((&pdev->dev)->bsddev, "INFO: ""Module %u, unknown status\n", module_num); + device_printf((&pdev->dev)->bsddev, + "INFO: Module %u, unknown status\n", module_num); } /* store module status */ if (module_num < MLX5_MAX_PORTS) Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c Mon Oct 7 09:00:08 2019 (r353204) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c Mon Oct 7 09:01:21 2019 (r353205) @@ -1244,13 +1244,31 @@ struct mlx5_core_event_handler { void *data); }; +#define MLX5_STATS_DESC(a, b, c, d, e, ...) d, e, + +#define MLX5_PORT_MODULE_ERROR_STATS(m) \ +m(+1, u64, power_budget_exceeded, "power_budget", "Module Power Budget Exceeded") \ +m(+1, u64, long_range, "long_range", "Module Long Range for non MLNX cable/module") \ +m(+1, u64, bus_stuck, "bus_stuck", "Module Bus stuck(I2C or data shorted)") \ +m(+1, u64, no_eeprom, "no_eeprom", "No EEPROM/retry timeout") \ +m(+1, u64, enforce_part_number, "enforce_part_number", "Module Enforce part number list") \ +m(+1, u64, unknown_id, "unknown_id", "Module Unknown identifier") \ +m(+1, u64, high_temp, "high_temp", "Module High Temperature") \ +m(+1, u64, cable_shorted, "cable_shorted", "Module Cable is shorted") + +static const char *mlx5_pme_err_desc[] = { + MLX5_PORT_MODULE_ERROR_STATS(MLX5_STATS_DESC) +}; + static int init_one(struct pci_dev *pdev, const struct pci_device_id *id) { struct mlx5_core_dev *dev; struct mlx5_priv *priv; device_t bsddev = pdev->dev.bsddev; - int err; + int i,err; + struct sysctl_oid *pme_sysctl_node; + struct sysctl_oid *pme_err_sysctl_node; dev = kzalloc(sizeof(*dev), GFP_KERNEL); priv = &dev->priv; @@ -1282,6 +1300,41 @@ static int init_one(struct pci_dev *pdev, OID_AUTO, "power_value", CTLFLAG_RD, &dev->pwr_value, 0, "Current power value in Watts"); + pme_sysctl_node = SYSCTL_ADD_NODE(&dev->sysctl_ctx, + SYSCTL_CHILDREN(device_get_sysctl_tree(bsddev)), + OID_AUTO, "pme_stats", CTLFLAG_RD, NULL, + "Port module event statistics"); + if (pme_sysctl_node == NULL) { + err = -ENOMEM; + goto clean_sysctl_ctx; + } + pme_err_sysctl_node = SYSCTL_ADD_NODE(&dev->sysctl_ctx, + SYSCTL_CHILDREN(pme_sysctl_node), + OID_AUTO, "errors", CTLFLAG_RD, NULL, + "Port module event error statistics"); + if (pme_err_sysctl_node == NULL) { + err = -ENOMEM; + goto clean_sysctl_ctx; + } + SYSCTL_ADD_U64(&dev->sysctl_ctx, + SYSCTL_CHILDREN(pme_sysctl_node), OID_AUTO, + "module_plug", CTLFLAG_RD | CTLFLAG_MPSAFE, + &dev->priv.pme_stats.status_counters[MLX5_MODULE_STATUS_PLUGGED_ENABLED], + 0, "Number of time module plugged"); + SYSCTL_ADD_U64(&dev->sysctl_ctx, + SYSCTL_CHILDREN(pme_sysctl_node), OID_AUTO, + "module_unplug", CTLFLAG_RD | CTLFLAG_MPSAFE, + &dev->priv.pme_stats.status_counters[MLX5_MODULE_STATUS_UNPLUGGED], + 0, "Number of time module unplugged"); + for (i = 0 ; i < MLX5_MODULE_EVENT_ERROR_NUM; i++) { + SYSCTL_ADD_U64(&dev->sysctl_ctx, + SYSCTL_CHILDREN(pme_err_sysctl_node), OID_AUTO, + mlx5_pme_err_desc[2 * i], CTLFLAG_RD | CTLFLAG_MPSAFE, + &dev->priv.pme_stats.error_counters[i], + 0, mlx5_pme_err_desc[2 * i + 1]); + } + + INIT_LIST_HEAD(&priv->ctx_list); spin_lock_init(&priv->ctx_lock); mutex_init(&dev->pci_status_mutex); @@ -1320,8 +1373,9 @@ clean_health: close_pci: mlx5_pci_close(dev, priv); clean_dev: - sysctl_ctx_free(&dev->sysctl_ctx); mtx_destroy(&dev->dump_lock); +clean_sysctl_ctx: + sysctl_ctx_free(&dev->sysctl_ctx); kfree(dev); return err; } Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Mon Oct 7 09:00:08 2019 (r353204) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Mon Oct 7 09:01:21 2019 (r353205) @@ -3387,8 +3387,7 @@ out: } /* Check if module is present before doing an access */ module_status = mlx5_query_module_status(priv->mdev, module_num); - if (module_status != MLX5_MODULE_STATUS_PLUGGED_ENABLED && - module_status != MLX5_MODULE_STATUS_PLUGGED_DISABLED) { + if (module_status != MLX5_MODULE_STATUS_PLUGGED_ENABLED) { error = EINVAL; goto err_i2c; } From owner-svn-src-stable-12@freebsd.org Mon Oct 7 09:03:52 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6FEBBFE8DC; Mon, 7 Oct 2019 09:03:52 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46mvfc22mJz4bHw; Mon, 7 Oct 2019 09:03:52 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 291E3C53A; Mon, 7 Oct 2019 09:03:52 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9793qkh073111; Mon, 7 Oct 2019 09:03:52 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9793plm073110; Mon, 7 Oct 2019 09:03:51 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201910070903.x9793plm073110@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Oct 2019 09:03:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353207 - in stable/12/sys/dev/mlx5: . mlx5_core X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 353207 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Oct 2019 09:03:52 -0000 Author: hselasky Date: Mon Oct 7 09:03:51 2019 New Revision: 353207 URL: https://svnweb.freebsd.org/changeset/base/353207 Log: MFC r352967: Make the mlx5_vsc_wait_on_flag(9) function global. Submitted by: kib@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/driver.h stable/12/sys/dev/mlx5/mlx5_core/mlx5_vsc.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/driver.h ============================================================================== --- stable/12/sys/dev/mlx5/driver.h Mon Oct 7 09:01:59 2019 (r353206) +++ stable/12/sys/dev/mlx5/driver.h Mon Oct 7 09:03:51 2019 (r353207) @@ -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: stable/12/sys/dev/mlx5/mlx5_core/mlx5_vsc.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_vsc.c Mon Oct 7 09:01:59 2019 (r353206) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_vsc.c Mon Oct 7 09:03:51 2019 (r353207) @@ -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; From owner-svn-src-stable-12@freebsd.org Mon Oct 7 09:06:38 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8FD02FEA5A; Mon, 7 Oct 2019 09:06:38 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46mvjp3GdWz4bYN; Mon, 7 Oct 2019 09:06:38 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 53870C53D; Mon, 7 Oct 2019 09:06:38 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9796c6k073422; Mon, 7 Oct 2019 09:06:38 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9796bqT073419; Mon, 7 Oct 2019 09:06:37 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201910070906.x9796bqT073419@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Oct 2019 09:06:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353209 - in stable/12/sys/dev/mlx5: . mlx5_core X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 353209 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Oct 2019 09:06:38 -0000 Author: hselasky Date: Mon Oct 7 09:06:37 2019 New Revision: 353209 URL: https://svnweb.freebsd.org/changeset/base/353209 Log: MFC r352968: Move mlx5_ifc_vsc_space_bits and mlx5_ifc_vsc_addr_bits to mlx5_ifc.h. Submitted by: kib@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_vsc.c stable/12/sys/dev/mlx5/mlx5_ifc.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_vsc.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_vsc.c Mon Oct 7 09:04:32 2019 (r353208) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_vsc.c Mon Oct 7 09:06:37 2019 (r353209) @@ -31,18 +31,6 @@ #define MLX5_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: stable/12/sys/dev/mlx5/mlx5_ifc.h ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_ifc.h Mon Oct 7 09:04:32 2019 (r353208) +++ stable/12/sys/dev/mlx5/mlx5_ifc.h Mon Oct 7 09:06:37 2019 (r353209) @@ -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, From owner-svn-src-stable-12@freebsd.org Mon Oct 7 09:08:34 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7C90EFEB8C; Mon, 7 Oct 2019 09:08:34 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46mvm22l2nz4bpx; Mon, 7 Oct 2019 09:08:34 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 41B37C53F; Mon, 7 Oct 2019 09:08:34 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9798Ym4073669; Mon, 7 Oct 2019 09:08:34 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9798YQP073668; Mon, 7 Oct 2019 09:08:34 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201910070908.x9798YQP073668@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Oct 2019 09:08:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353211 - stable/12/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 353211 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Oct 2019 09:08:34 -0000 Author: hselasky Date: Mon Oct 7 09:08:33 2019 New Revision: 353211 URL: https://svnweb.freebsd.org/changeset/base/353211 Log: MFC r352969: Use the MLX5_VSC_DOMAIN_SEMAPHORES constant instead of hand-rolled symbol in mlx5core. Submitted by: kib@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_vsc.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_vsc.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_vsc.c Mon Oct 7 09:07:33 2019 (r353210) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_vsc.c Mon Oct 7 09:08:33 2019 (r353211) @@ -29,8 +29,6 @@ #include #include -#define MLX5_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; From owner-svn-src-stable-12@freebsd.org Mon Oct 7 09:10:30 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 67468FECD4; Mon, 7 Oct 2019 09:10:30 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46mvpG240Tz4c5G; Mon, 7 Oct 2019 09:10:30 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2A532C545; Mon, 7 Oct 2019 09:10:30 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x979AUgZ073957; Mon, 7 Oct 2019 09:10:30 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x979AUdn073956; Mon, 7 Oct 2019 09:10:30 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201910070910.x979AUdn073956@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Oct 2019 09:10:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353213 - stable/12/sys/dev/mlx5 X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5 X-SVN-Commit-Revision: 353213 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Oct 2019 09:10:30 -0000 Author: hselasky Date: Mon Oct 7 09:10:29 2019 New Revision: 353213 URL: https://svnweb.freebsd.org/changeset/base/353213 Log: MFC r352970: Define MLX5_VSC_DOMAIN_SCAN_CRSPACE. Submitted by: kib@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_ifc.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_ifc.h ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_ifc.h Mon Oct 7 09:09:25 2019 (r353212) +++ stable/12/sys/dev/mlx5/mlx5_ifc.h Mon Oct 7 09:10:29 2019 (r353213) @@ -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, }; From owner-svn-src-stable-12@freebsd.org Mon Oct 7 09:12:59 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 86ED8FEF8A; Mon, 7 Oct 2019 09:12:59 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46mvs730BFz4cbb; Mon, 7 Oct 2019 09:12:59 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4A200C72C; Mon, 7 Oct 2019 09:12:59 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x979Cxv0079423; Mon, 7 Oct 2019 09:12:59 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x979Cw8I079421; Mon, 7 Oct 2019 09:12:58 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201910070912.x979Cw8I079421@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Oct 2019 09:12:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353215 - in stable/12/sys/dev/mlx5: . mlx5_core X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 353215 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Oct 2019 09:12:59 -0000 Author: hselasky Date: Mon Oct 7 09:12:58 2019 New Revision: 353215 URL: https://svnweb.freebsd.org/changeset/base/353215 Log: MFC r352971: Read rege map from crdump scan space in mlx5core. Submitted by: kib@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/driver.h stable/12/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/driver.h ============================================================================== --- stable/12/sys/dev/mlx5/driver.h Mon Oct 7 09:11:27 2019 (r353214) +++ stable/12/sys/dev/mlx5/driver.h Mon Oct 7 09:12:58 2019 (r353215) @@ -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: stable/12/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Mon Oct 7 09:11:27 2019 (r353214) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Mon Oct 7 09:12:58 2019 (r353215) @@ -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, &in, 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, &out, 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, &in, 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, &out, address); + if (next_addr == 0 || next_addr == addr) + break; + if (next_addr != addr + 4) + mdev->dump_rege[++i].addr = next_addr; + addr = next_addr; + } + KASSERT(i + 1 == sz, + ("inconsistent hw crspace reads: sz %u i %u addr %#lx", + sz, i, (unsigned long)addr)); + mdev->dump_size = mlx5_fwdump_getsize(mdev->dump_rege); mdev->dump_data = malloc(mdev->dump_size * sizeof(uint32_t), M_MLX5_DUMP, M_WAITOK | M_ZERO); mdev->dump_valid = false; mdev->dump_copyout = false; + +unlock_vsc: + mlx5_vsc_unlock(mdev); } void @@ -145,6 +200,7 @@ mlx5_fwdump_clean(struct mlx5_core_dev *mdev) msleep(&mdev->dump_copyout, &mdev->dump_lock, 0, "mlx5fwc", 0); mlx5_fwdump_destroy_dd(mdev); mtx_unlock(&mdev->dump_lock); + free(mdev->dump_rege, M_MLX5_DUMP); } static int From owner-svn-src-stable-12@freebsd.org Mon Oct 7 09:14:51 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4C5A5FF0BD; Mon, 7 Oct 2019 09:14:51 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46mvvH1L5sz4crc; Mon, 7 Oct 2019 09:14:51 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 113DBC72E; Mon, 7 Oct 2019 09:14:51 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x979Eos6079656; Mon, 7 Oct 2019 09:14:50 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x979EoXt079652; Mon, 7 Oct 2019 09:14:50 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201910070914.x979EoXt079652@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Oct 2019 09:14:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353217 - in stable/12/sys: conf dev/mlx5/mlx5_core modules/mlx5 X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12/sys: conf dev/mlx5/mlx5_core modules/mlx5 X-SVN-Commit-Revision: 353217 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Oct 2019 09:14:51 -0000 Author: hselasky Date: Mon Oct 7 09:14:50 2019 New Revision: 353217 URL: https://svnweb.freebsd.org/changeset/base/353217 Log: MFC r352972: Remove no longer needed fwdump register tables from mlx5core. Submitted by: kib@ Sponsored by: Mellanox Technologies Deleted: stable/12/sys/dev/mlx5/mlx5_core/mlx5_fwdump_regmaps.c Modified: stable/12/sys/conf/files stable/12/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c stable/12/sys/modules/mlx5/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/conf/files ============================================================================== --- stable/12/sys/conf/files Mon Oct 7 09:13:53 2019 (r353216) +++ stable/12/sys/conf/files Mon Oct 7 09:14:50 2019 (r353217) @@ -4800,8 +4800,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: stable/12/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Mon Oct 7 09:13:53 2019 (r353216) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Mon Oct 7 09:14:50 2019 (r353217) @@ -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: stable/12/sys/modules/mlx5/Makefile ============================================================================== --- stable/12/sys/modules/mlx5/Makefile Mon Oct 7 09:13:53 2019 (r353216) +++ stable/12/sys/modules/mlx5/Makefile Mon Oct 7 09:14:50 2019 (r353217) @@ -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 \ From owner-svn-src-stable-12@freebsd.org Mon Oct 7 09:16:44 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 81ECEFF1EA; Mon, 7 Oct 2019 09:16:44 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46mvxS2sPZz4d6r; Mon, 7 Oct 2019 09:16:44 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4681DC730; Mon, 7 Oct 2019 09:16:44 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x979Gi6V079914; Mon, 7 Oct 2019 09:16:44 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x979GiY6079913; Mon, 7 Oct 2019 09:16:44 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201910070916.x979GiY6079913@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Oct 2019 09:16:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353219 - stable/12/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 353219 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Oct 2019 09:16:44 -0000 Author: hselasky Date: Mon Oct 7 09:16:43 2019 New Revision: 353219 URL: https://svnweb.freebsd.org/changeset/base/353219 Log: MFC r352973: Add missing blank line at the end of the print in mlx5core. Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_eq.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_eq.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_eq.c Mon Oct 7 09:15:47 2019 (r353218) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_eq.c Mon Oct 7 09:16:43 2019 (r353219) @@ -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)); } From owner-svn-src-stable-12@freebsd.org Mon Oct 7 09:18:10 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 18CCBFF325; Mon, 7 Oct 2019 09:18:10 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46mvz56vddz4dN3; Mon, 7 Oct 2019 09:18:09 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B7373C732; Mon, 7 Oct 2019 09:18:09 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x979I94V080131; Mon, 7 Oct 2019 09:18:09 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x979I9Nf080130; Mon, 7 Oct 2019 09:18:09 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201910070918.x979I9Nf080130@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Oct 2019 09:18:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353221 - stable/12/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 353221 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Oct 2019 09:18:10 -0000 Author: hselasky Date: Mon Oct 7 09:18:09 2019 New Revision: 353221 URL: https://svnweb.freebsd.org/changeset/base/353221 Log: MFC r352974: 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@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_health.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_health.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_health.c Mon Oct 7 09:17:21 2019 (r353220) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_health.c Mon Oct 7 09:18:09 2019 (r353221) @@ -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 = &dev->priv.health; struct mlx5_health_buffer __iomem *h = health->health; + u8 synd = ioread8(&h->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(&h->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(&h->hw_id)); printf("mlx5_core: INFO: ""irisc_index %d\n", ioread8(&h->irisc_index)); - printf("mlx5_core: INFO: ""synd 0x%x: %s\n", ioread8(&h->synd), hsynd_str(ioread8(&h->synd))); + printf("mlx5_core: INFO: ""synd 0x%x: %s\n", synd, hsynd_str(synd)); printf("mlx5_core: INFO: ""ext_synd 0x%04x\n", ioread16be(&h->ext_synd)); fw = ioread32be(&h->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); From owner-svn-src-stable-12@freebsd.org Mon Oct 7 09:19:49 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5E087FF466; Mon, 7 Oct 2019 09:19:49 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46mw112Bnwz4ddg; Mon, 7 Oct 2019 09:19:49 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 15576C73E; Mon, 7 Oct 2019 09:19:49 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x979Jnmx080372; Mon, 7 Oct 2019 09:19:49 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x979Jlxe080357; Mon, 7 Oct 2019 09:19:47 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201910070919.x979Jlxe080357@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Oct 2019 09:19:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353223 - stable/12/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 353223 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Oct 2019 09:19:49 -0000 Author: hselasky Date: Mon Oct 7 09:19:46 2019 New Revision: 353223 URL: https://svnweb.freebsd.org/changeset/base/353223 Log: MFC r352975: Unify prints in mlx5core. All prints in mlx5core should use on of the macros: mlx5_core_err/dbg/warn Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_cmd.c stable/12/sys/dev/mlx5/mlx5_core/mlx5_core.h stable/12/sys/dev/mlx5/mlx5_core/mlx5_eq.c stable/12/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c stable/12/sys/dev/mlx5/mlx5_core/mlx5_fw.c stable/12/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c stable/12/sys/dev/mlx5/mlx5_core/mlx5_health.c stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c stable/12/sys/dev/mlx5/mlx5_core/mlx5_mpfs.c stable/12/sys/dev/mlx5/mlx5_core/mlx5_port.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_cmd.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Mon Oct 7 09:18:47 2019 (r353222) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Mon Oct 7 09:19:46 2019 (r353223) @@ -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((&dev->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((&dev->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((&dev->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(&dev->iseg->cmdif_rev_fw_sub) >> 16; if (cmd->cmdif_rev > CMD_IF_REV) { - device_printf((&dev->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((&dev->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((&dev->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: stable/12/sys/dev/mlx5/mlx5_core/mlx5_core.h ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_core.h Mon Oct 7 09:18:47 2019 (r353222) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_core.h Mon Oct 7 09:19:46 2019 (r353223) @@ -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, \ +#define mlx5_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 mlx5_core_warn(_dev, format, ...) \ + device_printf((_dev)->pdev->dev.bsddev, "WARN: ""%s:%d:(pid %d): " format, \ + __func__, __LINE__, curthread->td_proc->p_pid, \ + ##__VA_ARGS__) + +#define mlx5_core_info(_dev, format, ...) \ + device_printf((_dev)->pdev->dev.bsddev, "INFO: ""%s:%d:(pid %d): " format, \ __func__, __LINE__, curthread->td_proc->p_pid, \ ##__VA_ARGS__) Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_eq.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_eq.c Mon Oct 7 09:18:47 2019 (r353222) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_eq.c Mon Oct 7 09:19:46 2019 (r353223) @@ -673,7 +673,6 @@ static void mlx5_port_module_event(struct mlx5_core_de unsigned int module_status; unsigned int error_type; struct mlx5_eqe_port_module_event *module_event_eqe; - struct pci_dev *pdev = dev->pdev; module_event_eqe = &eqe->data.port_module_event; @@ -687,19 +686,19 @@ static void mlx5_port_module_event(struct mlx5_core_de dev->priv.pme_stats.status_counters[module_status]++; switch (module_status) { case MLX5_MODULE_STATUS_PLUGGED_ENABLED: - device_printf((&pdev->dev)->bsddev, - "INFO: Module %u, status: plugged and enabled\n", + mlx5_core_info(dev, + "Module %u, status: plugged and enabled\n", module_num); break; case MLX5_MODULE_STATUS_UNPLUGGED: - device_printf((&pdev->dev)->bsddev, - "INFO: Module %u, status: unplugged\n", module_num); + mlx5_core_info(dev, + "Module %u, status: unplugged\n", module_num); break; case MLX5_MODULE_STATUS_ERROR: - device_printf((&pdev->dev)->bsddev, - "ERROR: Module %u, status: error, %s\n", + mlx5_core_err(dev, + "Module %u, status: error, %s\n", module_num, mlx5_port_module_event_error_type_to_string(error_type)); if (error_type < MLX5_MODULE_EVENT_ERROR_NUM) @@ -707,8 +706,8 @@ static void mlx5_port_module_event(struct mlx5_core_de break; default: - device_printf((&pdev->dev)->bsddev, - "INFO: Module %u, unknown status\n", module_num); + mlx5_core_info(dev, + "Module %u, unknown status\n", module_num); } /* store module status */ if (module_num < MLX5_MAX_PORTS) Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c Mon Oct 7 09:18:47 2019 (r353222) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c Mon Oct 7 09:19:46 2019 (r353223) @@ -139,7 +139,6 @@ static struct mlx5_flow_root_namespace *find_root(stru node = parent; if (node->type != FS_TYPE_NAMESPACE) { - printf("mlx5_core: WARN: ""mlx5: flow steering node %s is not in tree or garbaged\n", node->name); return NULL; } @@ -477,7 +476,7 @@ static int connect_prev_fts(struct fs_prio *locked_pri err = fs_set_star_rule(dev, iter, next_ft); if (err) { mlx5_core_warn(dev, - "mlx5: flow steering can't connect prev and next\n"); + "mlx5: flow steering can't connect prev and next\n"); goto unlock; } else { /* Assume ft's prio is locked */ @@ -605,7 +604,9 @@ static void destroy_star_rule(struct mlx5_flow_table * root = find_root(&prio->base); if (!root) - printf("mlx5_core: ERR: ""mlx5: flow steering failed to find root of priority %s", prio->base.name); + mlx5_core_err(dev, + "flow steering failed to find root of priority %s", + prio->base.name); /* In order to ensure atomic deletion, first update * prev ft to point on the next ft. @@ -765,11 +766,13 @@ static struct mlx5_flow_table *_create_ft_common(struc int log_table_sz; int ft_size; char gen_name[20]; - struct mlx5_flow_root_namespace *root = - find_root(&ns->base); + struct mlx5_flow_root_namespace *root = find_root(&ns->base); + struct mlx5_core_dev *dev = fs_get_dev(&ns->base); if (!root) { - printf("mlx5_core: ERR: ""mlx5: flow steering failed to find root of namespace %s", ns->base.name); + mlx5_core_err(dev, + "flow steering failed to find root of namespace %s", + ns->base.name); return ERR_PTR(-ENODEV); } @@ -987,12 +990,16 @@ int mlx5_destroy_flow_table(struct mlx5_flow_table *ft struct fs_prio *prio; struct mlx5_flow_root_namespace *root; bool is_shared_prio; + struct mlx5_core_dev *dev; fs_get_parent(prio, ft); root = find_root(&prio->base); + dev = fs_get_dev(&prio->base); if (!root) { - printf("mlx5_core: ERR: ""mlx5: flow steering failed to find root of priority %s", prio->base.name); + mlx5_core_err(dev, + "flow steering failed to find root of priority %s", + prio->base.name); return -ENODEV; } Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_fw.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_fw.c Mon Oct 7 09:18:47 2019 (r353222) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_fw.c Mon Oct 7 09:19:46 2019 (r353223) @@ -324,7 +324,7 @@ int mlx5_cmd_fast_teardown_hca(struct mlx5_core_dev *d } while (!time_after(jiffies, end)); if (mlx5_get_nic_state(dev) != MLX5_NIC_IFC_DISABLED) { - dev_err(&dev->pdev->dev, "NIC IFC still %d after %ums.\n", + mlx5_core_err(dev, "NIC IFC still %d after %ums.\n", mlx5_get_nic_state(dev), delay_ms); return -EIO; } Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Mon Oct 7 09:18:47 2019 (r353222) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Mon Oct 7 09:19:46 2019 (r353223) @@ -69,7 +69,7 @@ mlx5_fwdump_prep(struct mlx5_core_dev *mdev) error = mlx5_vsc_find_cap(mdev); if (error != 0) { /* Inability to create a firmware dump is not fatal. */ - device_printf((&mdev->pdev->dev)->bsddev, "WARN: " + mlx5_core_warn(mdev, "mlx5_fwdump_prep failed %d\n", error); return; } @@ -153,13 +153,13 @@ mlx5_fwdump(struct mlx5_core_dev *mdev) uint32_t i, ri; int error; - dev_info(&mdev->pdev->dev, "Issuing FW dump\n"); + mlx5_core_info(mdev, "Issuing FW dump\n"); mtx_lock(&mdev->dump_lock); if (mdev->dump_data == NULL) goto failed; if (mdev->dump_valid) { /* only one dump */ - dev_warn(&mdev->pdev->dev, + mlx5_core_warn(mdev, "Only one FW dump can be captured aborting FW dump\n"); goto failed; } Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_health.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_health.c Mon Oct 7 09:18:47 2019 (r353222) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_health.c Mon Oct 7 09:19:46 2019 (r353223) @@ -78,9 +78,11 @@ static int lock_sem_sw_reset(struct mlx5_core_dev *dev ret = -mlx5_vsc_lock_addr_space(dev, MLX5_SEMAPHORE_SW_RESET); if (ret) { if (ret == -EBUSY) - mlx5_core_dbg(dev, "SW reset FW semaphore already locked, another function will handle the reset\n"); + mlx5_core_dbg(dev, + "SW reset FW semaphore already locked, another function will handle the reset\n"); else - mlx5_core_warn(dev, "SW reset semaphore lock return %d\n", ret); + mlx5_core_warn(dev, + "SW reset semaphore lock return %d\n", ret); } /* Unlock GW access */ @@ -216,11 +218,12 @@ static void reset_fw_if_needed(struct mlx5_core_dev *d if (fatal_error == MLX5_SENSOR_PCI_COMM_ERR || fatal_error == MLX5_SENSOR_NIC_DISABLED || fatal_error == MLX5_SENSOR_NIC_SW_RESET) { - mlx5_core_warn(dev, "Not issuing FW reset. Either it's already done or won't help.\n"); + mlx5_core_warn(dev, + "Not issuing FW reset. Either it's already done or won't help.\n"); return; } - mlx5_core_warn(dev, "Issuing FW Reset\n"); + mlx5_core_info(dev, "Issuing FW Reset\n"); /* Write the NIC interface field to initiate the reset, the command * interface address also resides here, don't overwrite it. */ @@ -251,8 +254,8 @@ mlx5_health_allow_reset(struct mlx5_core_dev *dev) */ health->last_reset_req = ticks ? : -1; if (!ret) - mlx5_core_warn(dev, "Firmware reset elided due to " - "auto-reset frequency threshold.\n"); + mlx5_core_warn(dev, + "Firmware reset elided due to auto-reset frequency threshold.\n"); return (ret); } @@ -313,7 +316,7 @@ void mlx5_enter_error_state(struct mlx5_core_dev *dev, } while (!time_after(jiffies, end)); if (!sensor_nic_disabled(dev)) { - dev_err(&dev->pdev->dev, "NIC IFC still %d after %ums.\n", + mlx5_core_err(dev, "NIC IFC still %d after %ums.\n", mlx5_get_nic_state(dev), delay_ms); } @@ -321,7 +324,7 @@ void mlx5_enter_error_state(struct mlx5_core_dev *dev, if (!lock) unlock_sem_sw_reset(dev); - mlx5_core_err(dev, "system error event triggered\n"); + mlx5_core_info(dev, "System error event triggered\n"); err_state_done: mlx5_core_event(dev, MLX5_DEV_EVENT_SYS_ERROR, 1); @@ -342,9 +345,11 @@ static void mlx5_handle_bad_state(struct mlx5_core_dev * MLX5_NIC_IFC_DISABLED. */ if (dev->priv.health.fatal_error != MLX5_SENSOR_PCI_COMM_ERR) - mlx5_core_warn(dev, "NIC SW reset is already progress\n"); + mlx5_core_warn(dev, + "NIC SW reset is already progress\n"); else - mlx5_core_warn(dev, "Communication with FW over the PCI link is down\n"); + mlx5_core_warn(dev, + "Communication with FW over the PCI link is down\n"); } else { mlx5_core_warn(dev, "NIC mode %d\n", nic_mode); } @@ -372,7 +377,8 @@ static void health_recover(struct work_struct *work) mtx_lock(&Giant); /* XXX newbus needs this */ if (sensor_pci_no_comm(dev)) { - dev_err(&dev->pdev->dev, "health recovery flow aborted, PCI reads still not working\n"); + mlx5_core_err(dev, + "health recovery flow aborted, PCI reads still not working\n"); recover = false; } @@ -384,13 +390,14 @@ static void health_recover(struct work_struct *work) } if (nic_mode != MLX5_NIC_IFC_DISABLED) { - dev_err(&dev->pdev->dev, "health recovery flow aborted, unexpected NIC IFC mode %d.\n", - nic_mode); + mlx5_core_err(dev, + "health recovery flow aborted, unexpected NIC IFC mode %d.\n", + nic_mode); recover = false; } if (recover) { - dev_err(&dev->pdev->dev, "starting health recovery flow\n"); + mlx5_core_info(dev, "Starting health recovery flow\n"); mlx5_recover_device(dev); } @@ -425,12 +432,13 @@ static void health_care(struct work_struct *work) spin_lock_irqsave(&health->wq_lock, flags); if (!test_bit(MLX5_DROP_NEW_RECOVERY_WORK, &health->flags)) { - mlx5_core_warn(dev, "Scheduling recovery work with %lums delay\n", - recover_delay); + mlx5_core_warn(dev, + "Scheduling recovery work with %lums delay\n", + recover_delay); schedule_delayed_work(&health->recover_work, recover_delay); } else { - dev_err(&dev->pdev->dev, - "new health works are not permitted at this stage\n"); + mlx5_core_err(dev, + "new health works are not permitted at this stage\n"); } spin_unlock_irqrestore(&health->wq_lock, flags); } @@ -455,7 +463,7 @@ void mlx5_trigger_health_work(struct mlx5_core_dev *de if (!test_bit(MLX5_DROP_NEW_HEALTH_WORK, &health->flags)) queue_work(health->wq, &health->work); else - dev_err(&dev->pdev->dev, + mlx5_core_err(dev, "new health works are not permitted at this stage\n"); spin_unlock_irqrestore(&health->wq_lock, flags); } @@ -509,18 +517,23 @@ print_health_info(struct mlx5_core_dev *dev) 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)); + mlx5_core_info(dev, "assert_var[%d] 0x%08x\n", i, + ioread32be(h->assert_var + i)); - printf("mlx5_core: INFO: ""assert_exit_ptr 0x%08x\n", ioread32be(&h->assert_exit_ptr)); - printf("mlx5_core: INFO: ""assert_callra 0x%08x\n", ioread32be(&h->assert_callra)); - snprintf(fw_str, sizeof(fw_str), "%d.%d.%d", fw_rev_maj(dev), fw_rev_min(dev), fw_rev_sub(dev)); - printf("mlx5_core: INFO: ""fw_ver %s\n", fw_str); - printf("mlx5_core: INFO: ""hw_id 0x%08x\n", ioread32be(&h->hw_id)); - printf("mlx5_core: INFO: ""irisc_index %d\n", ioread8(&h->irisc_index)); - printf("mlx5_core: INFO: ""synd 0x%x: %s\n", synd, hsynd_str(synd)); - printf("mlx5_core: INFO: ""ext_synd 0x%04x\n", ioread16be(&h->ext_synd)); + mlx5_core_info(dev, "assert_exit_ptr 0x%08x\n", + ioread32be(&h->assert_exit_ptr)); + mlx5_core_info(dev, "assert_callra 0x%08x\n", + ioread32be(&h->assert_callra)); + snprintf(fw_str, sizeof(fw_str), "%d.%d.%d", + fw_rev_maj(dev), fw_rev_min(dev), fw_rev_sub(dev)); + mlx5_core_info(dev, "fw_ver %s\n", fw_str); + mlx5_core_info(dev, "hw_id 0x%08x\n", ioread32be(&h->hw_id)); + mlx5_core_info(dev, "irisc_index %d\n", ioread8(&h->irisc_index)); + mlx5_core_info(dev, "synd 0x%x: %s\n", + ioread8(&h->synd), hsynd_str(ioread8(&h->synd))); + mlx5_core_info(dev, "ext_synd 0x%04x\n", ioread16be(&h->ext_synd)); fw = ioread32be(&h->fw_ver); - printf("mlx5_core: INFO: ""raw fw_ver 0x%08x\n", fw); + mlx5_core_info(dev, "raw fw_ver 0x%08x\n", fw); return synd; } @@ -540,31 +553,38 @@ static void health_watchdog(struct work_struct *work) err = mlx5_pci_read_power_status(dev, &power, &status); if (err < 0) { - mlx5_core_warn(dev, "Failed reading power status: %d\n", err); + mlx5_core_warn(dev, "Failed reading power status: %d\n", + err); return; } dev->pwr_value = power; if (dev->pwr_status != status) { - device_t bsddev = dev->pdev->dev.bsddev; switch (status) { case 0: dev->pwr_status = status; - device_printf(bsddev, "PCI power is not published by the PCIe slot.\n"); + mlx5_core_info(dev, + "PCI power is not published by the PCIe slot.\n"); break; case 1: dev->pwr_status = status; - device_printf(bsddev, "PCIe slot advertised sufficient power (%uW).\n", power); + mlx5_core_info(dev, + "PCIe slot advertised sufficient power (%uW).\n", + power); break; case 2: dev->pwr_status = status; - device_printf(bsddev, "WARN: Detected insufficient power on the PCIe slot (%uW).\n", power); + mlx5_core_warn(dev, + "Detected insufficient power on the PCIe slot (%uW).\n", + power); break; default: dev->pwr_status = 0; - device_printf(bsddev, "WARN: Unknown power state detected(%d).\n", status); + mlx5_core_warn(dev, + "Unknown power state detected(%d).\n", + status); break; } } @@ -580,8 +600,8 @@ mlx5_trigger_health_watchdog(struct mlx5_core_dev *dev if (!test_bit(MLX5_DROP_NEW_WATCHDOG_WORK, &health->flags)) queue_work(health->wq_watchdog, &health->work_watchdog); else - dev_err(&dev->pdev->dev, - "scheduling watchdog is not permitted at this stage\n"); + mlx5_core_err(dev, + "scheduling watchdog is not permitted at this stage\n"); spin_unlock_irqrestore(&health->wq_lock, flags); } @@ -611,7 +631,8 @@ static void poll_health(unsigned long data) fatal_error = check_fatal_sensors(dev); if (fatal_error && !health->fatal_error) { - mlx5_core_err(dev, "Fatal error %u detected\n", fatal_error); + mlx5_core_err(dev, + "Fatal error %u detected\n", fatal_error); dev->priv.health.fatal_error = fatal_error; print_health_info(dev); mlx5_trigger_health_work(dev); Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c Mon Oct 7 09:18:47 2019 (r353222) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c Mon Oct 7 09:19:46 2019 (r353223) @@ -172,24 +172,25 @@ static struct mlx5_profile profiles[] = { static int set_dma_caps(struct pci_dev *pdev) { + struct mlx5_core_dev *dev = pci_get_drvdata(pdev); int err; err = pci_set_dma_mask(pdev, DMA_BIT_MASK(64)); if (err) { - device_printf((&pdev->dev)->bsddev, "WARN: ""Warning: couldn't set 64-bit PCI DMA mask\n"); + mlx5_core_warn(dev, "couldn't set 64-bit PCI DMA mask\n"); err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); if (err) { - device_printf((&pdev->dev)->bsddev, "ERR: ""Can't set PCI DMA mask, aborting\n"); + mlx5_core_err(dev, "Can't set PCI DMA mask, aborting\n"); return err; } } err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)); if (err) { - device_printf((&pdev->dev)->bsddev, "WARN: ""Warning: couldn't set 64-bit consistent PCI DMA mask\n"); + mlx5_core_warn(dev, "couldn't set 64-bit consistent PCI DMA mask\n"); err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); if (err) { - device_printf((&pdev->dev)->bsddev, "ERR: ""Can't set consistent PCI DMA mask, aborting\n"); + mlx5_core_err(dev, "Can't set consistent PCI DMA mask, aborting\n"); return err; } } @@ -243,16 +244,17 @@ static void mlx5_pci_disable_device(struct mlx5_core_d static int request_bar(struct pci_dev *pdev) { + struct mlx5_core_dev *dev = pci_get_drvdata(pdev); int err = 0; if (!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM)) { - device_printf((&pdev->dev)->bsddev, "ERR: ""Missing registers BAR, aborting\n"); + mlx5_core_err(dev, "Missing registers BAR, aborting\n"); return -ENODEV; } err = pci_request_regions(pdev, DRIVER_NAME); if (err) - device_printf((&pdev->dev)->bsddev, "ERR: ""Couldn't get PCI resources, aborting\n"); + mlx5_core_err(dev, "Couldn't get PCI resources, aborting\n"); return err; } @@ -319,7 +321,7 @@ enum { MLX5_DEV_CAP_FLAG_DRAIN_SIGERR, }; -static u16 to_fw_pkey_sz(u32 size) +static u16 to_fw_pkey_sz(struct mlx5_core_dev *dev, u32 size) { switch (size) { case 128: @@ -335,7 +337,7 @@ static u16 to_fw_pkey_sz(u32 size) case 4096: return 5; default: - printf("mlx5_core: WARN: ""invalid pkey table size %d\n", size); + mlx5_core_warn(dev, "invalid pkey table size %d\n", size); return 0; } } @@ -430,7 +432,7 @@ static int handle_hca_cap(struct mlx5_core_dev *dev) 128); /* we limit the size of the pkey table to 128 entries for now */ MLX5_SET(cmd_hca_cap, set_hca_cap, pkey_table_size, - to_fw_pkey_sz(128)); + to_fw_pkey_sz(dev, 128)); if (prof->mask & MLX5_PROF_MASK_QP_SIZE) MLX5_SET(cmd_hca_cap, set_hca_cap, log_max_qp, @@ -544,11 +546,11 @@ static int mlx5_core_set_issi(struct mlx5_core_dev *de mlx5_cmd_mbox_status(query_out, &status, &syndrome); if (status == MLX5_CMD_STAT_BAD_OP_ERR) { - pr_debug("Only ISSI 0 is supported\n"); + mlx5_core_dbg(dev, "Only ISSI 0 is supported\n"); return 0; } - printf("mlx5_core: ERR: ""failed to query ISSI\n"); + mlx5_core_err(dev, "failed to query ISSI\n"); return err; } @@ -563,7 +565,7 @@ static int mlx5_core_set_issi(struct mlx5_core_dev *de err = mlx5_cmd_exec(dev, set_in, sizeof(set_in), set_out, sizeof(set_out)); if (err) { - printf("mlx5_core: ERR: ""failed to set ISSI=1 err(%d)\n", err); + mlx5_core_err(dev, "failed to set ISSI=1 err(%d)\n", err); return err; } @@ -850,13 +852,13 @@ static int mlx5_pci_init(struct mlx5_core_dev *dev, st err = mlx5_pci_enable_device(dev); if (err) { - device_printf((&pdev->dev)->bsddev, "ERR: ""Cannot enable PCI device, aborting\n"); + mlx5_core_err(dev, "Cannot enable PCI device, aborting\n"); goto err_dbg; } err = request_bar(pdev); if (err) { - device_printf((&pdev->dev)->bsddev, "ERR: ""error requesting BARs, aborting\n"); + mlx5_core_err(dev, "error requesting BARs, aborting\n"); goto err_disable; } @@ -864,7 +866,7 @@ static int mlx5_pci_init(struct mlx5_core_dev *dev, st err = set_dma_caps(pdev); if (err) { - device_printf((&pdev->dev)->bsddev, "ERR: ""Failed setting DMA capabilities mask, aborting\n"); + mlx5_core_err(dev, "Failed setting DMA capabilities mask, aborting\n"); goto err_clr_master; } @@ -872,7 +874,7 @@ static int mlx5_pci_init(struct mlx5_core_dev *dev, st dev->iseg = ioremap(dev->iseg_base, sizeof(*dev->iseg)); if (!dev->iseg) { err = -ENOMEM; - device_printf((&pdev->dev)->bsddev, "ERR: ""Failed mapping initialization segment, aborting\n"); + mlx5_core_err(dev, "Failed mapping initialization segment, aborting\n"); goto err_clr_master; } @@ -895,28 +897,27 @@ static void mlx5_pci_close(struct mlx5_core_dev *dev, static int mlx5_init_once(struct mlx5_core_dev *dev, struct mlx5_priv *priv) { - struct pci_dev *pdev = dev->pdev; int err; err = mlx5_vsc_find_cap(dev); if (err) - dev_err(&pdev->dev, "Unable to find vendor specific capabilities\n"); + mlx5_core_err(dev, "Unable to find vendor specific capabilities\n"); err = mlx5_query_hca_caps(dev); if (err) { - dev_err(&pdev->dev, "query hca failed\n"); + mlx5_core_err(dev, "query hca failed\n"); goto out; } err = mlx5_query_board_id(dev); if (err) { - dev_err(&pdev->dev, "query board id failed\n"); + mlx5_core_err(dev, "query board id failed\n"); goto out; } err = mlx5_eq_init(dev); if (err) { - dev_err(&pdev->dev, "failed to initialize eq\n"); + mlx5_core_err(dev, "failed to initialize eq\n"); goto out; } @@ -924,7 +925,7 @@ static int mlx5_init_once(struct mlx5_core_dev *dev, s err = mlx5_init_cq_table(dev); if (err) { - dev_err(&pdev->dev, "failed to initialize cq table\n"); + mlx5_core_err(dev, "failed to initialize cq table\n"); goto err_eq_cleanup; } @@ -938,7 +939,7 @@ static int mlx5_init_once(struct mlx5_core_dev *dev, s #ifdef RATELIMIT err = mlx5_init_rl_table(dev); if (err) { - dev_err(&pdev->dev, "Failed to init rate limiting\n"); + mlx5_core_err(dev, "Failed to init rate limiting\n"); goto err_tables_cleanup; } #endif @@ -976,17 +977,16 @@ static void mlx5_cleanup_once(struct mlx5_core_dev *de static int mlx5_load_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv, bool boot) { - struct pci_dev *pdev = dev->pdev; int err; mutex_lock(&dev->intf_state_mutex); if (test_bit(MLX5_INTERFACE_STATE_UP, &dev->intf_state)) { - dev_warn(&dev->pdev->dev, "%s: interface is up, NOP\n", - __func__); + mlx5_core_warn(dev, "interface is up, NOP\n"); goto out; } - device_printf((&pdev->dev)->bsddev, "INFO: ""firmware version: %d.%d.%d\n", fw_rev_maj(dev), fw_rev_min(dev), fw_rev_sub(dev)); + mlx5_core_dbg(dev, "firmware version: %d.%d.%d\n", + fw_rev_maj(dev), fw_rev_min(dev), fw_rev_sub(dev)); /* * On load removing any previous indication of internal error, @@ -996,103 +996,103 @@ static int mlx5_load_one(struct mlx5_core_dev *dev, st err = mlx5_cmd_init(dev); if (err) { - device_printf((&pdev->dev)->bsddev, "ERR: ""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); if (err) { - device_printf((&dev->pdev->dev)->bsddev, "ERR: ""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; } err = mlx5_core_enable_hca(dev); if (err) { - device_printf((&pdev->dev)->bsddev, "ERR: ""enable hca failed\n"); + mlx5_core_err(dev, "enable hca failed\n"); goto err_cmd_cleanup; } err = mlx5_core_set_issi(dev); if (err) { - device_printf((&pdev->dev)->bsddev, "ERR: ""failed to set issi\n"); + mlx5_core_err(dev, "failed to set issi\n"); goto err_disable_hca; } err = mlx5_pagealloc_start(dev); if (err) { - device_printf((&pdev->dev)->bsddev, "ERR: ""mlx5_pagealloc_start failed\n"); + mlx5_core_err(dev, "mlx5_pagealloc_start failed\n"); goto err_disable_hca; } err = mlx5_satisfy_startup_pages(dev, 1); if (err) { - device_printf((&pdev->dev)->bsddev, "ERR: ""failed to allocate boot pages\n"); + mlx5_core_err(dev, "failed to allocate boot pages\n"); goto err_pagealloc_stop; } err = set_hca_ctrl(dev); if (err) { - device_printf((&pdev->dev)->bsddev, "ERR: ""set_hca_ctrl failed\n"); + mlx5_core_err(dev, "set_hca_ctrl failed\n"); goto reclaim_boot_pages; } err = handle_hca_cap(dev); if (err) { - device_printf((&pdev->dev)->bsddev, "ERR: ""handle_hca_cap failed\n"); + mlx5_core_err(dev, "handle_hca_cap failed\n"); goto reclaim_boot_pages; } err = handle_hca_cap_atomic(dev); if (err) { - device_printf((&pdev->dev)->bsddev, "ERR: ""handle_hca_cap_atomic failed\n"); + mlx5_core_err(dev, "handle_hca_cap_atomic failed\n"); goto reclaim_boot_pages; } err = mlx5_satisfy_startup_pages(dev, 0); if (err) { - device_printf((&pdev->dev)->bsddev, "ERR: ""failed to allocate init pages\n"); + mlx5_core_err(dev, "failed to allocate init pages\n"); goto reclaim_boot_pages; } err = mlx5_cmd_init_hca(dev); if (err) { - device_printf((&pdev->dev)->bsddev, "ERR: ""init hca failed\n"); + mlx5_core_err(dev, "init hca failed\n"); goto reclaim_boot_pages; } mlx5_start_health_poll(dev); if (boot && mlx5_init_once(dev, priv)) { - dev_err(&pdev->dev, "sw objs init failed\n"); + mlx5_core_err(dev, "sw objs init failed\n"); goto err_stop_poll; } err = mlx5_enable_msix(dev); if (err) { - device_printf((&pdev->dev)->bsddev, "ERR: ""enable msix failed\n"); + mlx5_core_err(dev, "enable msix failed\n"); goto err_cleanup_once; } err = mlx5_alloc_uuars(dev, &priv->uuari); if (err) { - device_printf((&pdev->dev)->bsddev, "ERR: ""Failed allocating uar, aborting\n"); + mlx5_core_err(dev, "Failed allocating uar, aborting\n"); goto err_disable_msix; } err = mlx5_start_eqs(dev); if (err) { - device_printf((&pdev->dev)->bsddev, "ERR: ""Failed to start pages and async EQs\n"); + mlx5_core_err(dev, "Failed to start pages and async EQs\n"); goto err_free_uar; } err = alloc_comp_eqs(dev); if (err) { - device_printf((&pdev->dev)->bsddev, "ERR: ""Failed to alloc completion EQs\n"); + mlx5_core_err(dev, "Failed to alloc completion EQs\n"); goto err_stop_eqs; } if (map_bf_area(dev)) - device_printf((&pdev->dev)->bsddev, "ERR: ""Failed to map blue flame area\n"); + mlx5_core_err(dev, "Failed to map blue flame area\n"); err = mlx5_init_fs(dev); if (err) { @@ -1108,13 +1108,13 @@ static int mlx5_load_one(struct mlx5_core_dev *dev, st err = mlx5_fpga_device_start(dev); if (err) { - dev_err(&pdev->dev, "fpga device start failed %d\n", err); + mlx5_core_err(dev, "fpga device start failed %d\n", err); goto err_mpfs; } err = mlx5_register_device(dev); if (err) { - dev_err(&pdev->dev, "mlx5_register_device failed %d\n", err); + mlx5_core_err(dev, "mlx5_register_device failed %d\n", err); goto err_fpga; } @@ -1153,7 +1153,7 @@ err_cleanup_once: err_stop_poll: mlx5_stop_health_poll(dev, boot); if (mlx5_cmd_teardown_hca(dev)) { - device_printf((&dev->pdev->dev)->bsddev, "ERR: ""tear_down_hca failed, skip cleanup\n"); + mlx5_core_err(dev, "tear_down_hca failed, skip cleanup\n"); goto out_err; } @@ -1186,7 +1186,7 @@ static int mlx5_unload_one(struct mlx5_core_dev *dev, mutex_lock(&dev->intf_state_mutex); if (!test_bit(MLX5_INTERFACE_STATE_UP, &dev->intf_state)) { - dev_warn(&dev->pdev->dev, "%s: interface is down, NOP\n", __func__); + mlx5_core_warn(dev, "%s: interface is down, NOP\n", __func__); if (cleanup) mlx5_cleanup_once(dev); goto out; @@ -1208,7 +1208,7 @@ static int mlx5_unload_one(struct mlx5_core_dev *dev, mlx5_stop_health_poll(dev, cleanup); err = mlx5_cmd_teardown_hca(dev); if (err) { - device_printf((&dev->pdev->dev)->bsddev, "ERR: ""tear_down_hca failed, skip cleanup\n"); + mlx5_core_err(dev, "tear_down_hca failed, skip cleanup\n"); goto out; } mlx5_pagealloc_stop(dev); @@ -1276,7 +1276,9 @@ static int init_one(struct pci_dev *pdev, priv->pci_dev_data = id->driver_data; if (mlx5_prof_sel < 0 || mlx5_prof_sel >= ARRAY_SIZE(profiles)) { - device_printf(bsddev, "WARN: selected profile out of range, selecting default (%d)\n", MLX5_DEFAULT_PROF); + device_printf(bsddev, + "WARN: selected profile out of range, selecting default (%d)\n", + MLX5_DEFAULT_PROF); mlx5_prof_sel = MLX5_DEFAULT_PROF; } dev->profile = &profiles[mlx5_prof_sel]; @@ -1342,13 +1344,13 @@ static int init_one(struct pci_dev *pdev, mtx_init(&dev->dump_lock, "mlx5dmp", NULL, MTX_DEF | MTX_NEW); err = mlx5_pci_init(dev, priv); if (err) { - device_printf(bsddev, "ERR: mlx5_pci_init failed %d\n", err); + mlx5_core_err(dev, "mlx5_pci_init failed %d\n", err); goto clean_dev; } err = mlx5_health_init(dev); if (err) { - device_printf(bsddev, "ERR: mlx5_health_init failed %d\n", err); + mlx5_core_err(dev, "mlx5_health_init failed %d\n", err); goto close_pci; } @@ -1356,7 +1358,7 @@ static int init_one(struct pci_dev *pdev, err = mlx5_load_one(dev, priv, true); if (err) { - device_printf(bsddev, "ERR: mlx5_load_one failed %d\n", err); + mlx5_core_err(dev, "mlx5_load_one failed %d\n", err); goto clean_health; } @@ -1386,7 +1388,7 @@ static void remove_one(struct pci_dev *pdev) struct mlx5_priv *priv = &dev->priv; if (mlx5_unload_one(dev, priv, true)) { - dev_err(&dev->pdev->dev, "mlx5_unload_one failed\n"); + mlx5_core_err(dev, "mlx5_unload_one failed\n"); mlx5_health_cleanup(dev); return; } @@ -1407,7 +1409,7 @@ static pci_ers_result_t mlx5_pci_err_detected(struct p struct mlx5_core_dev *dev = pci_get_drvdata(pdev); struct mlx5_priv *priv = &dev->priv; - dev_info(&pdev->dev, "%s was called\n", __func__); + mlx5_core_info(dev, "%s was called\n", __func__); mlx5_enter_error_state(dev, false); mlx5_unload_one(dev, priv, false); @@ -1425,12 +1427,12 @@ static pci_ers_result_t mlx5_pci_slot_reset(struct pci struct mlx5_core_dev *dev = pci_get_drvdata(pdev); int err = 0; - dev_info(&pdev->dev, "%s was called\n", __func__); + mlx5_core_info(dev,"%s was called\n", __func__); err = mlx5_pci_enable_device(dev); if (err) { - dev_err(&pdev->dev, "%s: mlx5_pci_enable_device failed with error code: %d\n" - , __func__, err); + mlx5_core_err(dev, "mlx5_pci_enable_device failed with error code: %d\n" + ,err); return PCI_ERS_RESULT_DISCONNECT; } pci_set_master(pdev); @@ -1458,29 +1460,31 @@ static void wait_vital(struct pci_dev *pdev) msleep(1000); for (i = 0; i < niter; i++) { if (pci_read_config_word(pdev, 2, &did)) { - dev_warn(&pdev->dev, "failed reading config word\n"); + mlx5_core_warn(dev, "failed reading config word\n"); break; } if (did == pdev->device) { - dev_info(&pdev->dev, "device ID correctly read after %d iterations\n", i); + mlx5_core_info(dev, + "device ID correctly read after %d iterations\n", i); break; } msleep(50); } if (i == niter) - dev_warn(&pdev->dev, "%s-%d: could not read device ID\n", __func__, __LINE__); + mlx5_core_warn(dev, "could not read device ID\n"); for (i = 0; i < niter; i++) { count = ioread32be(health->health_counter); if (count && count != 0xffffffff) { - dev_info(&pdev->dev, "Counter value 0x%x after %d iterations\n", count, i); + mlx5_core_info(dev, + "Counter value 0x%x after %d iterations\n", count, i); break; } msleep(50); } if (i == niter) - dev_warn(&pdev->dev, "%s-%d: could not read device ID\n", __func__, __LINE__); + mlx5_core_warn(dev, "could not read device ID\n"); } static void mlx5_pci_resume(struct pci_dev *pdev) @@ -1489,16 +1493,16 @@ static void mlx5_pci_resume(struct pci_dev *pdev) struct mlx5_priv *priv = &dev->priv; int err; - dev_info(&pdev->dev, "%s was called\n", __func__); + mlx5_core_info(dev,"%s was called\n", __func__); wait_vital(pdev); err = mlx5_load_one(dev, priv, false); if (err) - dev_err(&pdev->dev, "%s: mlx5_load_one failed with error code: %d\n" - , __func__, err); + mlx5_core_err(dev, + "mlx5_load_one failed with error code: %d\n" ,err); else - dev_info(&pdev->dev, "%s: device recovered\n", __func__); + mlx5_core_info(dev,"device recovered\n"); } static const struct pci_error_handlers mlx5_err_handler = { Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_mpfs.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_mpfs.c Mon Oct 7 09:18:47 2019 (r353222) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_mpfs.c Mon Oct 7 09:19:46 2019 (r353223) @@ -33,6 +33,8 @@ #include #include +#include "mlx5_core.h" + #define MPFS_LOCK(dev) spin_lock(&(dev)->mpfs.spinlock) #define MPFS_UNLOCK(dev) spin_unlock(&(dev)->mpfs.spinlock) @@ -119,7 +121,7 @@ mlx5_mpfs_destroy(struct mlx5_core_dev *dev) num = bitmap_weight(dev->mpfs.bitmap, MLX5_MPFS_TABLE_MAX); if (num != 0) - dev_err(&dev->pdev->dev, "Leaking %u MPFS MAC table entries\n", num); + mlx5_core_err(dev, "Leaking %u MPFS MAC table entries\n", num); spin_lock_destroy(&dev->mpfs.spinlock); } Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_port.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_port.c Mon Oct 7 09:18:47 2019 (r353222) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_port.c Mon Oct 7 09:19:46 2019 (r353223) @@ -618,7 +618,7 @@ out: } EXPORT_SYMBOL_GPL(mlx5_core_access_ptys); -static int mtu_to_ib_mtu(int mtu) +static int mtu_to_ib_mtu(struct mlx5_core_dev *dev, int mtu) { switch (mtu) { case 256: return 1; @@ -627,7 +627,7 @@ static int mtu_to_ib_mtu(int mtu) case 2048: return 4; case 4096: return 5; default: *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-12@freebsd.org Mon Oct 7 09:25:16 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 20739FF7BB; Mon, 7 Oct 2019 09:25:16 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46mw7J0lLcz4fB0; Mon, 7 Oct 2019 09:25:16 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F0995C8FF; Mon, 7 Oct 2019 09:25:15 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x979PFg9086075; Mon, 7 Oct 2019 09:25:15 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x979PE4J086068; Mon, 7 Oct 2019 09:25:14 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201910070925.x979PE4J086068@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Oct 2019 09:25:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353225 - stable/12/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 353225 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Oct 2019 09:25:16 -0000 Author: hselasky Date: Mon Oct 7 09:25:14 2019 New Revision: 353225 URL: https://svnweb.freebsd.org/changeset/base/353225 Log: MFC r352976: Unify prints in mlx5en(4). All prints in mlx5en(4) should use on of the macros: mlx5_en_err/dbg/warn Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_en/en.h stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_txrx.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/en.h Mon Oct 7 09:24:12 2019 (r353224) +++ stable/12/sys/dev/mlx5/mlx5_en/en.h Mon Oct 7 09:25:14 2019 (r353225) @@ -142,6 +142,21 @@ struct mlx5e_cq; typedef void (mlx5e_cq_comp_t)(struct mlx5_core_cq *); +#define mlx5_en_err(_dev, format, ...) \ + if_printf(_dev, "ERR: ""%s:%d:(pid %d): " format, \ + __func__, __LINE__, curthread->td_proc->p_pid, \ + ##__VA_ARGS__) + +#define mlx5_en_warn(_dev, format, ...) \ + if_printf(_dev, "WARN: ""%s:%d:(pid %d): " format, \ + __func__, __LINE__, curthread->td_proc->p_pid, \ + ##__VA_ARGS__) + +#define mlx5_en_info(_dev, format, ...) \ + if_printf(_dev, "INFO: ""%s:%d:(pid %d): " format, \ + __func__, __LINE__, curthread->td_proc->p_pid, \ + ##__VA_ARGS__) + #define MLX5E_STATS_COUNT(a, ...) a #define MLX5E_STATS_VAR(a, b, c, ...) b c; #define MLX5E_STATS_DESC(a, b, c, d, e, ...) d, e, Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Mon Oct 7 09:24:12 2019 (r353224) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Mon Oct 7 09:25:14 2019 (r353225) @@ -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, &eeprom->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, &data, &size_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), &size_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), &size_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; @@ -983,8 +985,8 @@ mlx5e_read_eeprom(SYSCTL_HANDLER_ARGS) /* Read three first bytes to get important info */ error = mlx5e_get_eeprom_info(priv, &eeprom); if (error) { - if_printf(priv->ifp, "%s:%d: Failed reading eeprom's " - "initial information\n", __func__, __LINE__); + mlx5_en_err(priv->ifp, + "Failed reading eeprom's initial information\n"); error = 0; goto done; } @@ -998,8 +1000,7 @@ mlx5e_read_eeprom(SYSCTL_HANDLER_ARGS) /* Read the whole eeprom information */ error = mlx5e_get_eeprom(priv, &eeprom); if (error) { - if_printf(priv->ifp, "%s:%d: Failed reading eeprom\n", - __func__, __LINE__); + mlx5_en_err(priv->ifp, "Failed reading eeprom\n"); error = 0; /* * Continue printing partial information in case of Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c Mon Oct 7 09:24:12 2019 (r353224) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c Mon Oct 7 09:25:14 2019 (r353225) @@ -436,7 +436,7 @@ mlx5e_add_eth_addr_rule(struct mlx5e_priv *priv, match_value = mlx5_vzalloc(MLX5_ST_SZ_BYTES(fte_match_param)); match_criteria = mlx5_vzalloc(MLX5_ST_SZ_BYTES(fte_match_param)); if (!match_value || !match_criteria) { - if_printf(priv->ifp, "%s: alloc failed\n", __func__); + mlx5_en_err(priv->ifp, "alloc failed\n"); err = -ENOMEM; goto add_eth_addr_rule_out; } @@ -467,7 +467,7 @@ static int mlx5e_vport_context_update_vlans(struct mlx max_list_size = 1 << MLX5_CAP_GEN(priv->mdev, log_max_vlan_list); if (list_size > max_list_size) { - if_printf(ifp, + mlx5_en_err(ifp, "ifnet vlans list size (%d) > (%d) max vport list size, some vlans will be dropped\n", list_size, max_list_size); list_size = max_list_size; @@ -486,7 +486,7 @@ static int mlx5e_vport_context_update_vlans(struct mlx err = mlx5_modify_nic_vport_vlans(priv->mdev, vlans, list_size); if (err) - if_printf(ifp, "Failed to modify vport vlans list err(%d)\n", + mlx5_en_err(ifp, "Failed to modify vport vlans list err(%d)\n", err); kfree(vlans); @@ -549,7 +549,7 @@ mlx5e_add_vlan_rule_sub(struct mlx5e_priv *priv, if (IS_ERR(*rule_p)) { err = PTR_ERR(*rule_p); *rule_p = NULL; - if_printf(priv->ifp, "%s: add rule failed\n", __func__); + mlx5_en_err(priv->ifp, "add rule failed\n"); } return (err); @@ -566,7 +566,7 @@ mlx5e_add_vlan_rule(struct mlx5e_priv *priv, match_value = mlx5_vzalloc(MLX5_ST_SZ_BYTES(fte_match_param)); match_criteria = mlx5_vzalloc(MLX5_ST_SZ_BYTES(fte_match_param)); if (!match_value || !match_criteria) { - if_printf(priv->ifp, "%s: alloc failed\n", __func__); + mlx5_en_err(priv->ifp, "alloc failed\n"); err = -ENOMEM; goto add_vlan_rule_out; } @@ -948,7 +948,7 @@ static void mlx5e_vport_context_update_addr_list(struc size++; if (size > max_size) { - if_printf(priv->ifp, + mlx5_en_err(priv->ifp, "ifp %s list size (%d) > (%d) max vport list size, some addresses will be dropped\n", is_uc ? "UC" : "MC", size, max_size); size = max_size; @@ -966,7 +966,7 @@ static void mlx5e_vport_context_update_addr_list(struc err = mlx5_modify_nic_vport_mac_list(priv->mdev, list_type, addr_array, size); out: if (err) - if_printf(priv->ifp, + mlx5_en_err(priv->ifp, "Failed to modify vport %s list err(%d)\n", is_uc ? "UC" : "MC", err); kfree(addr_array); Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Mon Oct 7 09:24:12 2019 (r353224) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Mon Oct 7 09:25:14 2019 (r353225) @@ -428,8 +428,8 @@ mlx5e_update_carrier(struct mlx5e_priv *priv) if (error) { priv->media_active_last = IFM_ETHER; priv->ifp->if_baudrate = 1; - if_printf(priv->ifp, "%s: query port ptys failed: " - "0x%x\n", __func__, error); + mlx5_en_err(priv->ifp, "query port ptys failed: 0x%x\n", + error); return; } @@ -447,8 +447,8 @@ mlx5e_update_carrier(struct mlx5e_priv *priv) } if (media_entry.subtype == 0) { - if_printf(priv->ifp, "%s: Could not find operational " - "media subtype\n", __func__); + mlx5_en_err(priv->ifp, + "Could not find operational media subtype\n"); return; } @@ -456,8 +456,8 @@ mlx5e_update_carrier(struct mlx5e_priv *priv) case IFM_10G_ER: error = mlx5_query_pddr_range_info(mdev, 1, &is_er_type); if (error != 0) { - if_printf(priv->ifp, "%s: query port pddr failed: %d\n", - __func__, error); + mlx5_en_err(priv->ifp, + "query port pddr failed: %d\n", error); } if (error != 0 || is_er_type == 0) media_entry.subtype = IFM_10G_LR; @@ -465,8 +465,8 @@ mlx5e_update_carrier(struct mlx5e_priv *priv) case IFM_40G_LR4: error = mlx5_query_pddr_range_info(mdev, 1, &is_er_type); if (error != 0) { - if_printf(priv->ifp, "%s: query port pddr failed: %d\n", - __func__, error); + mlx5_en_err(priv->ifp, + "query port pddr failed: %d\n", error); } if (error == 0 && is_er_type != 0) media_entry.subtype = IFM_40G_ER4; @@ -545,9 +545,8 @@ mlx5e_set_port_pfc(struct mlx5e_priv *priv) error = -ENXIO; } else if (priv->params.rx_pauseframe_control || priv->params.tx_pauseframe_control) { - if_printf(priv->ifp, - "Global pauseframes must be disabled before " - "enabling PFC.\n"); + mlx5_en_err(priv->ifp, + "Global pauseframes must be disabled before enabling PFC.\n"); error = -EINVAL; } else { error = mlx5e_set_port_pause_and_pfc(priv); @@ -580,7 +579,7 @@ mlx5e_media_change(struct ifnet *dev) error = mlx5_query_port_ptys(mdev, out, sizeof(out), MLX5_PTYS_EN, 1); if (error != 0) { - if_printf(dev, "Query port media capability failed\n"); + mlx5_en_err(dev, "Query port media capability failed\n"); goto done; } @@ -595,14 +594,14 @@ mlx5e_media_change(struct ifnet *dev) if (IFM_SUBTYPE(priv->media.ifm_media) == IFM_AUTO) { link_mode = eth_proto_cap; if (link_mode == 0) { - if_printf(dev, "Port media capability is zero\n"); + mlx5_en_err(dev, "Port media capability is zero\n"); error = EINVAL; goto done; } } else { link_mode = link_mode & eth_proto_cap; if (link_mode == 0) { - if_printf(dev, "Not supported link mode requested\n"); + mlx5_en_err(dev, "Not supported link mode requested\n"); error = EINVAL; goto done; } @@ -611,7 +610,7 @@ mlx5e_media_change(struct ifnet *dev) /* check if PFC is enabled */ if (priv->params.rx_priority_flow_control || priv->params.tx_priority_flow_control) { - if_printf(dev, "PFC must be disabled before enabling global pauseframes.\n"); + mlx5_en_err(dev, "PFC must be disabled before enabling global pauseframes.\n"); error = EINVAL; goto done; } @@ -1020,7 +1019,8 @@ free_out: priv->params_ethtool.diag_pci_enable ? &priv->params_pci : NULL, priv->params_ethtool.diag_general_enable ? &priv->params_general : NULL); if (error != 0) - if_printf(priv->ifp, "Failed reading diagnostics: %d\n", error); + mlx5_en_err(priv->ifp, + "Failed reading diagnostics: %d\n", error); } } @@ -1172,8 +1172,8 @@ mlx5e_calibration_callout(void *arg) if (((next->clbr_hw_curr - curr->clbr_hw_curr) >> MLX5E_TSTMP_PREC) == 0) { if (priv->clbr_done != 0) { - if_printf(priv->ifp, "HW failed tstmp frozen %#jx %#jx," - "disabling\n", + mlx5_en_err(priv->ifp, + "HW failed tstmp frozen %#jx %#jx, disabling\n", next->clbr_hw_curr, curr->clbr_hw_prev); priv->clbr_done = 0; } @@ -1871,7 +1871,7 @@ mlx5e_drain_sq(struct mlx5e_sq *sq) /* error out remaining requests */ error = mlx5e_modify_sq(sq, MLX5_SQC_STATE_RDY, MLX5_SQC_STATE_ERR); if (error != 0) { - if_printf(sq->ifp, + mlx5_en_err(sq->ifp, "mlx5e_modify_sq() from RDY to ERR failed: %d\n", error); } @@ -2936,16 +2936,17 @@ mlx5e_set_dev_port_mtu(struct ifnet *ifp, int sw_mtu) err = mlx5_set_port_mtu(mdev, hw_mtu); if (err) { - if_printf(ifp, "%s: mlx5_set_port_mtu failed setting %d, err=%d\n", - __func__, sw_mtu, err); + mlx5_en_err(ifp, "mlx5_set_port_mtu failed setting %d, err=%d\n", + sw_mtu, err); return (err); } /* Update vport context MTU */ err = mlx5_set_vport_mtu(mdev, hw_mtu); if (err) { - if_printf(ifp, "%s: Failed updating vport context with MTU size, err=%d\n", - __func__, err); + mlx5_en_err(ifp, + "Failed updating vport context with MTU size, err=%d\n", + err); } ifp->if_mtu = sw_mtu; @@ -2956,17 +2957,19 @@ mlx5e_set_dev_port_mtu(struct ifnet *ifp, int sw_mtu) err = mlx5_query_port_oper_mtu(mdev, &hw_mtu); } if (err) { - if_printf(ifp, "Query port MTU, after setting new " - "MTU value, failed\n"); + mlx5_en_err(ifp, + "Query port MTU, after setting new MTU value, failed\n"); return (err); } else if (MLX5E_HW2SW_MTU(hw_mtu) < sw_mtu) { err = -E2BIG, - if_printf(ifp, "Port MTU %d is smaller than " - "ifp mtu %d\n", hw_mtu, sw_mtu); + mlx5_en_err(ifp, + "Port MTU %d is smaller than ifp mtu %d\n", + hw_mtu, sw_mtu); } else if (MLX5E_HW2SW_MTU(hw_mtu) > sw_mtu) { err = -EINVAL; - if_printf(ifp, "Port MTU %d is bigger than " - "ifp mtu %d\n", hw_mtu, sw_mtu); + mlx5_en_err(ifp, + "Port MTU %d is bigger than ifp mtu %d\n", + hw_mtu, sw_mtu); } priv->params_ethtool.hw_mtu = hw_mtu; @@ -2986,23 +2989,21 @@ mlx5e_open_locked(struct ifnet *ifp) #ifdef RSS if (rss_getnumbuckets() > priv->params.num_channels) { - if_printf(ifp, "NOTE: There are more RSS buckets(%u) than " - "channels(%u) available\n", rss_getnumbuckets(), - priv->params.num_channels); + mlx5_en_info(ifp, + "NOTE: There are more RSS buckets(%u) than channels(%u) available\n", + rss_getnumbuckets(), priv->params.num_channels); } #endif err = mlx5e_open_tises(priv); if (err) { - if_printf(ifp, "%s: mlx5e_open_tises failed, %d\n", - __func__, err); + mlx5_en_err(ifp, "mlx5e_open_tises failed, %d\n", err); return (err); } err = mlx5_vport_alloc_q_counter(priv->mdev, MLX5_INTERFACE_PROTOCOL_ETH, &set_id); if (err) { - if_printf(priv->ifp, - "%s: mlx5_vport_alloc_q_counter failed: %d\n", - __func__, err); + mlx5_en_err(priv->ifp, + "mlx5_vport_alloc_q_counter failed: %d\n", err); goto err_close_tises; } /* store counter set ID */ @@ -3010,32 +3011,30 @@ mlx5e_open_locked(struct ifnet *ifp) err = mlx5e_open_channels(priv); if (err) { - if_printf(ifp, "%s: mlx5e_open_channels failed, %d\n", - __func__, err); + mlx5_en_err(ifp, + "mlx5e_open_channels failed, %d\n", err); goto err_dalloc_q_counter; } err = mlx5e_open_rqt(priv); if (err) { - if_printf(ifp, "%s: mlx5e_open_rqt failed, %d\n", - __func__, err); + mlx5_en_err(ifp, "mlx5e_open_rqt failed, %d\n", err); goto err_close_channels; } err = mlx5e_open_tirs(priv); if (err) { - if_printf(ifp, "%s: mlx5e_open_tir failed, %d\n", - __func__, err); + mlx5_en_err(ifp, "mlx5e_open_tir failed, %d\n", err); goto err_close_rqls; } err = mlx5e_open_flow_table(priv); if (err) { - if_printf(ifp, "%s: mlx5e_open_flow_table failed, %d\n", - __func__, err); + mlx5_en_err(ifp, + "mlx5e_open_flow_table failed, %d\n", err); goto err_close_tirs; } err = mlx5e_add_all_vlan_rules(priv); if (err) { - if_printf(ifp, "%s: mlx5e_add_all_vlan_rules failed, %d\n", - __func__, err); + mlx5_en_err(ifp, + "mlx5e_add_all_vlan_rules failed, %d\n", err); goto err_close_flow_table; } set_bit(MLX5E_STATE_OPENED, &priv->state); @@ -3074,9 +3073,8 @@ mlx5e_open(void *arg) PRIV_LOCK(priv); if (mlx5_set_port_status(priv->mdev, MLX5_PORT_UP)) - if_printf(priv->ifp, - "%s: Setting port status to up failed\n", - __func__); + mlx5_en_err(priv->ifp, + "Setting port status to up failed\n"); mlx5e_open_locked(priv->ifp); priv->ifp->if_drv_flags |= IFF_DRV_RUNNING; @@ -3213,7 +3211,8 @@ mlx5e_ioctl(struct ifnet *ifp, u_long command, caddr_t mlx5e_open_locked(ifp); } else { error = EINVAL; - if_printf(ifp, "Invalid MTU value. Min val: %d, Max val: %d\n", + mlx5_en_err(ifp, + "Invalid MTU value. Min val: %d, Max val: %d\n", MLX5E_MTU_MIN, MIN(MLX5E_MTU_MAX, max_mtu)); } PRIV_UNLOCK(priv); @@ -3267,7 +3266,7 @@ mlx5e_ioctl(struct ifnet *ifp, u_long command, caddr_t !(IFCAP_TXCSUM & ifp->if_capenable)) { ifp->if_capenable &= ~IFCAP_TSO4; ifp->if_hwassist &= ~CSUM_IP_TSO; - if_printf(ifp, + mlx5_en_err(ifp, "tso4 disabled due to -txcsum.\n"); } } @@ -3279,7 +3278,7 @@ mlx5e_ioctl(struct ifnet *ifp, u_long command, caddr_t !(IFCAP_TXCSUM_IPV6 & ifp->if_capenable)) { ifp->if_capenable &= ~IFCAP_TSO6; ifp->if_hwassist &= ~CSUM_IP6_TSO; - if_printf(ifp, + mlx5_en_err(ifp, "tso6 disabled due to -txcsum6.\n"); } } @@ -3290,7 +3289,7 @@ mlx5e_ioctl(struct ifnet *ifp, u_long command, caddr_t if (mask & IFCAP_TSO4) { if (!(IFCAP_TSO4 & ifp->if_capenable) && !(IFCAP_TXCSUM & ifp->if_capenable)) { - if_printf(ifp, "enable txcsum first.\n"); + mlx5_en_err(ifp, "enable txcsum first.\n"); error = EAGAIN; goto out; } @@ -3300,7 +3299,7 @@ mlx5e_ioctl(struct ifnet *ifp, u_long command, caddr_t if (mask & IFCAP_TSO6) { if (!(IFCAP_TSO6 & ifp->if_capenable) && !(IFCAP_TXCSUM_IPV6 & ifp->if_capenable)) { - if_printf(ifp, "enable txcsum6 first.\n"); + mlx5_en_err(ifp, "enable txcsum6 first.\n"); error = EAGAIN; goto out; } @@ -3380,8 +3379,8 @@ out: /* Get module_num which is required for the query_eeprom */ error = mlx5_query_module_num(priv->mdev, &module_num); if (error) { - if_printf(ifp, "Query module num failed, eeprom " - "reading is not supported\n"); + mlx5_en_err(ifp, + "Query module num failed, eeprom reading is not supported\n"); error = EINVAL; goto err_i2c; } @@ -3400,8 +3399,9 @@ out: else if (i2c.dev_addr == 0xA2) read_addr = MLX5E_I2C_ADDR_HIGH; else { - if_printf(ifp, "Query eeprom failed, " - "Invalid Address: %X\n", i2c.dev_addr); + mlx5_en_err(ifp, + "Query eeprom failed, Invalid Address: %X\n", + i2c.dev_addr); error = EINVAL; goto err_i2c; } @@ -3410,8 +3410,8 @@ out: (uint32_t)i2c.offset, (uint32_t)i2c.len, module_num, (uint32_t *)i2c.data, &size_read); if (error) { - if_printf(ifp, "Query eeprom failed, eeprom " - "reading is not supported\n"); + mlx5_en_err(ifp, + "Query eeprom failed, eeprom reading is not supported\n"); error = EINVAL; goto err_i2c; } @@ -3424,8 +3424,8 @@ out: (uint32_t *)(i2c.data + size_read), &size_read); } if (error) { - if_printf(ifp, "Query eeprom failed, eeprom " - "reading is not supported\n"); + mlx5_en_err(ifp, + "Query eeprom failed, eeprom reading is not supported\n"); error = EINVAL; goto err_i2c; } @@ -3561,7 +3561,7 @@ mlx5e_create_mkey(struct mlx5e_priv *priv, u32 pdn, in = mlx5_vzalloc(inlen); if (in == NULL) { - if_printf(ifp, "%s: failed to allocate inbox\n", __func__); + mlx5_en_err(ifp, "failed to allocate inbox\n"); return (-ENOMEM); } @@ -3576,8 +3576,8 @@ mlx5e_create_mkey(struct mlx5e_priv *priv, u32 pdn, err = mlx5_core_create_mkey(mdev, mkey, in, inlen); if (err) - if_printf(ifp, "%s: mlx5_core_create_mkey failed, %d\n", - __func__, err); + mlx5_en_err(ifp, "mlx5_core_create_mkey failed, %d\n", + err); kvfree(in); return (err); @@ -3658,7 +3658,7 @@ mlx5e_resume_sq(struct mlx5e_sq *sq) err = mlx5e_modify_sq(sq, MLX5_SQC_STATE_ERR, MLX5_SQC_STATE_RST); if (err != 0) { - if_printf(sq->ifp, + mlx5_en_err(sq->ifp, "mlx5e_modify_sq() from ERR to RST failed: %d\n", err); } @@ -3671,7 +3671,7 @@ mlx5e_resume_sq(struct mlx5e_sq *sq) err = mlx5e_modify_sq(sq, MLX5_SQC_STATE_RST, MLX5_SQC_STATE_RDY); if (err != 0) { - if_printf(sq->ifp, + mlx5_en_err(sq->ifp, "mlx5e_modify_sq() from RST to RDY failed: %d\n", err); } @@ -3703,7 +3703,7 @@ mlx5e_disable_rx_dma(struct mlx5e_channel *ch) err = mlx5e_modify_rq(rq, MLX5_RQC_STATE_RDY, MLX5_RQC_STATE_ERR); if (err != 0) { - if_printf(rq->ifp, + mlx5_en_err(rq->ifp, "mlx5e_modify_rq() from RDY to RST failed: %d\n", err); } @@ -3718,7 +3718,7 @@ mlx5e_disable_rx_dma(struct mlx5e_channel *ch) */ err = mlx5e_modify_rq(rq, MLX5_RQC_STATE_ERR, MLX5_RQC_STATE_RST); if (err != 0) { - if_printf(rq->ifp, + mlx5_en_err(rq->ifp, "mlx5e_modify_rq() from ERR to RST failed: %d\n", err); } } @@ -3733,7 +3733,7 @@ mlx5e_enable_rx_dma(struct mlx5e_channel *ch) mlx5_wq_ll_update_db_record(&rq->wq); err = mlx5e_modify_rq(rq, MLX5_RQC_STATE_RST, MLX5_RQC_STATE_RDY); if (err != 0) { - if_printf(rq->ifp, + mlx5_en_err(rq->ifp, "mlx5e_modify_rq() from RST to RDY failed: %d\n", err); } @@ -3941,7 +3941,7 @@ mlx5e_setup_pauseframes(struct mlx5e_priv *priv) /* update firmware */ error = mlx5e_set_port_pause_and_pfc(priv); if (error == -EINVAL) { - if_printf(priv->ifp, + mlx5_en_err(priv->ifp, "Global pauseframes must be disabled before enabling PFC.\n"); priv->params.rx_priority_flow_control = 0; priv->params.tx_priority_flow_control = 0; @@ -4201,26 +4201,23 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) err = mlx5_alloc_map_uar(mdev, &priv->cq_uar); if (err) { - if_printf(ifp, "%s: mlx5_alloc_map_uar failed, %d\n", - __func__, err); + mlx5_en_err(ifp, "mlx5_alloc_map_uar failed, %d\n", err); goto err_free_wq; } err = mlx5_core_alloc_pd(mdev, &priv->pdn); if (err) { - if_printf(ifp, "%s: mlx5_core_alloc_pd failed, %d\n", - __func__, err); + mlx5_en_err(ifp, "mlx5_core_alloc_pd failed, %d\n", err); goto err_unmap_free_uar; } err = mlx5_alloc_transport_domain(mdev, &priv->tdn); if (err) { - if_printf(ifp, "%s: mlx5_alloc_transport_domain failed, %d\n", - __func__, err); + mlx5_en_err(ifp, + "mlx5_alloc_transport_domain failed, %d\n", err); goto err_dealloc_pd; } err = mlx5e_create_mkey(priv, priv->pdn, &priv->mr); if (err) { - if_printf(ifp, "%s: mlx5e_create_mkey failed, %d\n", - __func__, err); + mlx5_en_err(ifp, "mlx5e_create_mkey failed, %d\n", err); goto err_dealloc_transport_domain; } mlx5_query_nic_vport_mac_address(priv->mdev, 0, dev_addr); @@ -4229,13 +4226,12 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) if (MLX5_CAP_GEN(priv->mdev, vport_group_manager) == 0 && is_zero_ether_addr(dev_addr)) { random_ether_addr(dev_addr); - if_printf(ifp, "Assigned random MAC address\n"); + mlx5_en_err(ifp, "Assigned random MAC address\n"); } #ifdef RATELIMIT err = mlx5e_rl_init(priv); if (err) { - if_printf(ifp, "%s: mlx5e_rl_init failed, %d\n", - __func__, err); + mlx5_en_err(ifp, "mlx5e_rl_init failed, %d\n", err); goto err_create_mkey; } #endif @@ -4263,8 +4259,7 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) connector_type); } else { eth_proto_cap = 0; - if_printf(ifp, "%s: Query port media capability failed," - " %d\n", __func__, err); + mlx5_en_err(ifp, "Query port media capability failed, %d\n", err); } ifmedia_init(&priv->media, IFM_IMASK | IFM_ETH_FMASK, @@ -4381,8 +4376,8 @@ mlx5e_destroy_ifp(struct mlx5_core_dev *mdev, void *vp * detaching: */ while (READ_ONCE(priv->rl.stats.tx_active_connections) != 0) { - if_printf(priv->ifp, "Waiting for all ratelimit connections " - "to terminate\n"); + mlx5_en_err(priv->ifp, + "Waiting for all ratelimit connections to terminate\n"); pause("W", hz); } #endif @@ -4403,8 +4398,8 @@ mlx5e_destroy_ifp(struct mlx5_core_dev *mdev, void *vp /* wait for all unlimited send tags to go away */ while (priv->channel_refs != 0) { - if_printf(priv->ifp, "Waiting for all unlimited connections " - "to terminate\n"); + mlx5_en_err(priv->ifp, + "Waiting for all unlimited connections to terminate\n"); pause("W", hz); } Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c Mon Oct 7 09:24:12 2019 (r353224) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c Mon Oct 7 09:25:14 2019 (r353225) @@ -518,7 +518,7 @@ mlx5e_rl_worker(void *arg) MLX5E_RL_WORKER_LOCK(rlw); if (error != 0) { - if_printf(priv->ifp, + mlx5_en_err(priv->ifp, "mlx5e_rl_open_channel failed: %d\n", error); break; } @@ -551,7 +551,7 @@ mlx5e_rl_worker(void *arg) MLX5E_RL_RUNLOCK(&priv->rl); if (error != 0) { - if_printf(priv->ifp, + mlx5_en_err(priv->ifp, "mlx5e_rl_open_channel failed: %d\n", error); } else { atomic_add_64(&rlw->priv->rl.stats.tx_open_queues, 1ULL); @@ -565,7 +565,7 @@ mlx5e_rl_worker(void *arg) error = mlx5e_rlw_channel_set_rate_locked(rlw, channel, channel->new_rate * 8ULL); if (error != 0) { - if_printf(priv->ifp, + mlx5_en_err(priv->ifp, "mlx5e_rlw_channel_set_rate_locked failed: %d\n", error); } @@ -574,7 +574,7 @@ mlx5e_rl_worker(void *arg) case MLX5E_RL_ST_DESTROY: error = mlx5e_rlw_channel_set_rate_locked(rlw, channel, 0); if (error != 0) { - if_printf(priv->ifp, + mlx5_en_err(priv->ifp, "mlx5e_rlw_channel_set_rate_locked failed: %d\n", error); } @@ -856,7 +856,7 @@ mlx5e_rl_init(struct mlx5e_priv *priv) PRIV_UNLOCK(priv); if (error != 0) { - if_printf(priv->ifp, + mlx5_en_err(priv->ifp, "mlx5e_rl_open_workers failed: %d\n", error); } @@ -894,7 +894,7 @@ mlx5e_rl_open_workers(struct mlx5e_priv *priv) error = kproc_kthread_add(mlx5e_rl_worker, rlw, &rl_proc, &rl_thread, RFHIGHPID, 0, "mlx5-ratelimit", "mlx5-rl-worker-thread-%d", (int)j); if (error != 0) { - if_printf(rl->priv->ifp, + mlx5_en_err(rl->priv->ifp, "kproc_kthread_add failed: %d\n", error); rlw->worker_done = 1; } @@ -1090,7 +1090,8 @@ mlx5e_find_available_tx_ring_index(struct mlx5e_rl_wor *pchannel = channel; #ifdef RATELIMIT_DEBUG - if_printf(rlw->priv->ifp, "Channel pointer for rate limit connection is %p\n", channel); + mlx5_en_info(rlw->priv->ifp, + "Channel pointer for rate limit connection is %p\n", channel); #endif return (retval); } Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_txrx.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_txrx.c Mon Oct 7 09:24:12 2019 (r353224) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_txrx.c Mon Oct 7 09:25:14 2019 (r353225) @@ -48,6 +48,6 @@ mlx5e_cq_error_event(struct mlx5_core_cq *mcq, int eve { struct mlx5e_cq *cq = container_of(mcq, struct mlx5e_cq, mcq); - if_printf(cq->priv->ifp, "%s: cqn=0x%.6x event=0x%.2x\n", - __func__, mcq->cqn, event); + mlx5_en_err(cq->priv->ifp, "cqn=0x%.6x event=0x%.2x\n", + mcq->cqn, event); } From owner-svn-src-stable-12@freebsd.org Mon Oct 7 09:30:06 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BAF3CFF95B; Mon, 7 Oct 2019 09:30:06 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46mwDt4YXJz4fTp; Mon, 7 Oct 2019 09:30:06 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7FCEDC907; Mon, 7 Oct 2019 09:30:06 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x979U6kh086563; Mon, 7 Oct 2019 09:30:06 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x979U62I086562; Mon, 7 Oct 2019 09:30:06 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201910070930.x979U62I086562@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Oct 2019 09:30:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353227 - stable/12/sys/dev/mlx5 X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5 X-SVN-Commit-Revision: 353227 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Oct 2019 09:30:06 -0000 Author: hselasky Date: Mon Oct 7 09:30:06 2019 New Revision: 353227 URL: https://svnweb.freebsd.org/changeset/base/353227 Log: MFC r352977: Sort the ports registers definitions numerically in mlx5core. Submitted by: kib@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/driver.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/driver.h ============================================================================== --- stable/12/sys/dev/mlx5/driver.h Mon Oct 7 09:28:53 2019 (r353226) +++ stable/12/sys/dev/mlx5/driver.h Mon Oct 7 09:30:06 2019 (r353227) @@ -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, From owner-svn-src-stable-12@freebsd.org Mon Oct 7 09:32:03 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 63DE2FFAB2; Mon, 7 Oct 2019 09:32:03 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46mwH71yGvz4fwZ; Mon, 7 Oct 2019 09:32:03 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 266C1CA89; Mon, 7 Oct 2019 09:32:03 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x979W325088988; Mon, 7 Oct 2019 09:32:03 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x979W3VK088987; Mon, 7 Oct 2019 09:32:03 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201910070932.x979W3VK088987@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Oct 2019 09:32:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353229 - stable/12/sys/dev/mlx5 X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5 X-SVN-Commit-Revision: 353229 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Oct 2019 09:32:03 -0000 Author: hselasky Date: Mon Oct 7 09:32:02 2019 New Revision: 353229 URL: https://svnweb.freebsd.org/changeset/base/353229 Log: MFC r352978: Add definition for the Port Buffer Status Register in mlx5core. Submitted by: kib@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/driver.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/driver.h ============================================================================== --- stable/12/sys/dev/mlx5/driver.h Mon Oct 7 09:31:01 2019 (r353228) +++ stable/12/sys/dev/mlx5/driver.h Mon Oct 7 09:32:02 2019 (r353229) @@ -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, From owner-svn-src-stable-12@freebsd.org Mon Oct 7 09:33:50 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9AEAAFFD4E; Mon, 7 Oct 2019 09:33:50 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46mwKB3Ysxz4gDc; Mon, 7 Oct 2019 09:33:50 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 446D2CAC5; Mon, 7 Oct 2019 09:33:50 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x979XoKu092321; Mon, 7 Oct 2019 09:33:50 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x979XnC2092320; Mon, 7 Oct 2019 09:33:49 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201910070933.x979XnC2092320@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Oct 2019 09:33:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353231 - stable/12/sys/dev/mlx5 X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5 X-SVN-Commit-Revision: 353231 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Oct 2019 09:33:50 -0000 Author: hselasky Date: Mon Oct 7 09:33:49 2019 New Revision: 353231 URL: https://svnweb.freebsd.org/changeset/base/353231 Log: MFC r352979: Update definitons for PPTB and PBMC registers layouts in mlx5core. Submitted by: kib@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_ifc.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_ifc.h ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_ifc.h Mon Oct 7 09:32:53 2019 (r353230) +++ stable/12/sys/dev/mlx5/mlx5_ifc.h Mon Oct 7 09:33:49 2019 (r353231) @@ -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 { From owner-svn-src-stable-12@freebsd.org Mon Oct 7 09:35:38 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EEC50FFE7A; Mon, 7 Oct 2019 09:35:38 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46mwMG64LZz3BwZ; Mon, 7 Oct 2019 09:35:38 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B3D4FCACB; Mon, 7 Oct 2019 09:35:38 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x979ZcYd092571; Mon, 7 Oct 2019 09:35:38 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x979ZcQX092570; Mon, 7 Oct 2019 09:35:38 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201910070935.x979ZcQX092570@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Oct 2019 09:35:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353233 - stable/12/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 353233 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Oct 2019 09:35:39 -0000 Author: hselasky Date: Mon Oct 7 09:35:38 2019 New Revision: 353233 URL: https://svnweb.freebsd.org/changeset/base/353233 Log: MFC r352980: Add mlx5e_dbg() compatibility macro. Submitted by: kib@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_en/en.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/en.h Mon Oct 7 09:34:39 2019 (r353232) +++ stable/12/sys/dev/mlx5/mlx5_en/en.h Mon Oct 7 09:35:38 2019 (r353233) @@ -1169,6 +1169,8 @@ mlx5e_unref_channel(struct mlx5e_priv *priv) atomic_fetchadd_int(&priv->channel_refs, -1); } +#define mlx5e_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 *, From owner-svn-src-stable-12@freebsd.org Mon Oct 7 09:39:07 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6CE49FFFEE; Mon, 7 Oct 2019 09:39:07 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46mwRH2xfJz3CLJ; Mon, 7 Oct 2019 09:39:07 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 47F9BCADA; Mon, 7 Oct 2019 09:39:07 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x979d733092996; Mon, 7 Oct 2019 09:39:07 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x979d6ME092989; Mon, 7 Oct 2019 09:39:06 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201910070939.x979d6ME092989@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Oct 2019 09:39:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353235 - in stable/12/sys: conf dev/mlx5 dev/mlx5/mlx5_core dev/mlx5/mlx5_en modules/mlx5en X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12/sys: conf dev/mlx5 dev/mlx5/mlx5_core dev/mlx5/mlx5_en modules/mlx5en X-SVN-Commit-Revision: 353235 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Oct 2019 09:39:07 -0000 Author: hselasky Date: Mon Oct 7 09:39:05 2019 New Revision: 353235 URL: https://svnweb.freebsd.org/changeset/base/353235 Log: MFC r352981: Import Linux code to query/set buffer state in mlx5en(4). Submitted by: kib@ Sponsored by: Mellanox Technologies Added: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_port_buffer.c - copied unchanged from r352981, head/sys/dev/mlx5/mlx5_en/mlx5_en_port_buffer.c stable/12/sys/dev/mlx5/mlx5_en/port_buffer.h - copied unchanged from r352981, head/sys/dev/mlx5/mlx5_en/port_buffer.h Modified: stable/12/sys/conf/files stable/12/sys/dev/mlx5/mlx5_core/mlx5_port.c stable/12/sys/dev/mlx5/mlx5_en/en.h stable/12/sys/dev/mlx5/port.h stable/12/sys/modules/mlx5en/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/conf/files ============================================================================== --- stable/12/sys/conf/files Mon Oct 7 09:36:30 2019 (r353234) +++ stable/12/sys/conf/files Mon Oct 7 09:39:05 2019 (r353235) @@ -4853,6 +4853,8 @@ dev/mlx5/mlx5_en/mlx5_en_rl.c optional mlx5en pci in compile-with "${OFED_C}" dev/mlx5/mlx5_en/mlx5_en_txrx.c optional 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: stable/12/sys/dev/mlx5/mlx5_core/mlx5_port.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_port.c Mon Oct 7 09:36:30 2019 (r353234) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_port.c Mon Oct 7 09:39:05 2019 (r353235) @@ -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] = 10000, + [MLX5E_10GBASE_KX4] = 10000, + [MLX5E_10GBASE_KR] = 10000, + [MLX5E_20GBASE_KR2] = 20000, + [MLX5E_40GBASE_CR4] = 40000, + [MLX5E_40GBASE_KR4] = 40000, + [MLX5E_56GBASE_R4] = 56000, + [MLX5E_10GBASE_CR] = 10000, + [MLX5E_10GBASE_SR] = 10000, + [MLX5E_10GBASE_ER_LR] = 10000, + [MLX5E_40GBASE_SR4] = 40000, + [MLX5E_40GBASE_LR4_ER4] = 40000, + [MLX5E_50GBASE_SR2] = 50000, + [MLX5E_100GBASE_CR4] = 100000, + [MLX5E_100GBASE_SR4] = 100000, + [MLX5E_100GBASE_KR4] = 100000, + [MLX5E_100GBASE_LR4] = 100000, + [MLX5E_100BASE_TX] = 100, + [MLX5E_1000BASE_T] = 1000, + [MLX5E_10GBASE_T] = 10000, + [MLX5E_25GBASE_CR] = 25000, + [MLX5E_25GBASE_KR] = 25000, + [MLX5E_25GBASE_SR] = 25000, + [MLX5E_50GBASE_CR2] = 50000, + [MLX5E_50GBASE_KR2] = 50000, +}; + +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] = 10000, + [MLX5E_40GBASE_XLAUI_4_XLPPI_4] = 40000, + [MLX5E_25GAUI_1_25GBASE_CR_KR] = 25000, + [MLX5E_50GAUI_2_LAUI_2_50GBASE_CR2_KR2] = 50000, + [MLX5E_50GAUI_1_LAUI_1_50GBASE_CR_KR] = 50000, + [MLX5E_CAUI_4_100GBASE_CR4_KR4] = 100000, + [MLX5E_200GAUI_4_200GBASE_CR4_KR4] = 200000, + [MLX5E_400GAUI_8] = 400000, +}; + +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, &table, &max_size); + i = find_first_bit(&temp, 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, + eth_proto_capability); + eproto->admin = MLX5_GET_ETH_PROTO(ptys_reg, out, ext, eth_proto_admin); + eproto->oper = MLX5_GET_ETH_PROTO(ptys_reg, out, ext, eth_proto_oper); + return 0; +} + +int mlx5e_port_linkspeed(struct mlx5_core_dev *mdev, u32 *speed) +{ + struct mlx5e_port_eth_proto eproto; + bool ext; + int err; + + ext = MLX5_CAP_PCAM_FEATURE(mdev, ptys_extended_ethernet); + err = mlx5_port_query_eth_proto(mdev, 1, ext, &eproto); + if (err) + goto out; + + *speed = mlx5e_port_ptys2speed(mdev, eproto.oper); + if (!(*speed)) + err = -EINVAL; + +out: + return err; +} + +int mlx5e_port_query_pbmc(struct mlx5_core_dev *mdev, void *out) +{ + int sz = MLX5_ST_SZ_BYTES(pbmc_reg); + void *in; + int err; + + in = kzalloc(sz, GFP_KERNEL); + if (!in) + return -ENOMEM; + + MLX5_SET(pbmc_reg, in, local_port, 1); + err = mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_PBMC, 0, 0); + + kfree(in); + return err; +} + +int mlx5e_port_set_pbmc(struct mlx5_core_dev *mdev, void *in) +{ + int sz = MLX5_ST_SZ_BYTES(pbmc_reg); + void *out; + int err; + + out = kzalloc(sz, GFP_KERNEL); + if (!out) + return -ENOMEM; + + MLX5_SET(pbmc_reg, in, local_port, 1); + err = mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_PBMC, 0, 1); + + kfree(out); + return err; +} + +/* buffer[i]: buffer that priority i mapped to */ +int mlx5e_port_query_priority2buffer(struct mlx5_core_dev *mdev, u8 *buffer) +{ + int sz = MLX5_ST_SZ_BYTES(pptb_reg); + u32 prio_x_buff; + void *out; + void *in; + int prio; + int err; + + in = kzalloc(sz, GFP_KERNEL); + out = kzalloc(sz, GFP_KERNEL); + if (!in || !out) { + err = -ENOMEM; + goto out; + } + + MLX5_SET(pptb_reg, in, local_port, 1); + err = mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_PPTB, 0, 0); + if (err) + goto out; + + prio_x_buff = MLX5_GET(pptb_reg, out, prio_x_buff); + for (prio = 0; prio < 8; prio++) { + buffer[prio] = (u8)(prio_x_buff >> (4 * prio)) & 0xF; + mlx5_core_dbg(mdev, "prio %d, buffer %d\n", prio, buffer[prio]); + } +out: + kfree(in); + kfree(out); + return err; +} + +int mlx5e_port_set_priority2buffer(struct mlx5_core_dev *mdev, u8 *buffer) +{ + int sz = MLX5_ST_SZ_BYTES(pptb_reg); + u32 prio_x_buff; + void *out; + void *in; + int prio; + int err; + + in = kzalloc(sz, GFP_KERNEL); + out = kzalloc(sz, GFP_KERNEL); + if (!in || !out) { + err = -ENOMEM; + goto out; + } + + /* First query the pptb register */ + MLX5_SET(pptb_reg, in, local_port, 1); + err = mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_PPTB, 0, 0); + if (err) + goto out; + + memcpy(in, out, sz); + MLX5_SET(pptb_reg, in, local_port, 1); + + /* Update the pm and prio_x_buff */ + MLX5_SET(pptb_reg, in, pm, 0xFF); + + prio_x_buff = 0; + for (prio = 0; prio < 8; prio++) + prio_x_buff |= (buffer[prio] << (4 * prio)); + MLX5_SET(pptb_reg, in, prio_x_buff, prio_x_buff); + + err = mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_PPTB, 0, 1); + +out: + kfree(in); + kfree(out); + return err; +} Modified: stable/12/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/en.h Mon Oct 7 09:36:30 2019 (r353234) +++ stable/12/sys/dev/mlx5/mlx5_en/en.h Mon Oct 7 09:39:05 2019 (r353235) @@ -987,6 +987,11 @@ struct mlx5e_clbr_point { u_int clbr_gen; }; +struct mlx5e_dcbx { + u32 cable_len; + u32 xoff; +}; + struct mlx5e_priv { struct mlx5_core_dev *mdev; /* must be first */ @@ -1054,6 +1059,8 @@ struct mlx5e_priv { int clbr_curr; struct mlx5e_clbr_point clbr_points[2]; u_int clbr_gen; + + struct mlx5e_dcbx dcbx; struct mlx5e_channel channel[]; }; Copied: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_port_buffer.c (from r352981, head/sys/dev/mlx5/mlx5_en/mlx5_en_port_buffer.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_port_buffer.c Mon Oct 7 09:39:05 2019 (r353235, copy of r352981, head/sys/dev/mlx5/mlx5_en/mlx5_en_port_buffer.c) @@ -0,0 +1,328 @@ +/*- + * Copyright (c) 2018 Mellanox Technologies. 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 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 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$ + */ + +#include "port_buffer.h" + +#define MLX5E_MAX_PORT_MTU 9216 + +int mlx5e_port_query_buffer(struct mlx5e_priv *priv, + struct mlx5e_port_buffer *port_buffer) +{ + struct mlx5_core_dev *mdev = priv->mdev; + int sz = MLX5_ST_SZ_BYTES(pbmc_reg); + u32 total_used = 0; + void *buffer; + void *out; + int err; + int i; + + out = kzalloc(sz, GFP_KERNEL); + if (!out) + return -ENOMEM; + + err = mlx5e_port_query_pbmc(mdev, out); + if (err) + goto out; + + for (i = 0; i < MLX5E_MAX_BUFFER; i++) { + buffer = MLX5_ADDR_OF(pbmc_reg, out, buffer[i]); + port_buffer->buffer[i].lossy = + MLX5_GET(bufferx_reg, buffer, lossy); + port_buffer->buffer[i].epsb = + MLX5_GET(bufferx_reg, buffer, epsb); + port_buffer->buffer[i].size = + MLX5_GET(bufferx_reg, buffer, size) << MLX5E_BUFFER_CELL_SHIFT; + port_buffer->buffer[i].xon = + MLX5_GET(bufferx_reg, buffer, xon_threshold) << MLX5E_BUFFER_CELL_SHIFT; + port_buffer->buffer[i].xoff = + MLX5_GET(bufferx_reg, buffer, xoff_threshold) << MLX5E_BUFFER_CELL_SHIFT; + total_used += port_buffer->buffer[i].size; + + mlx5e_dbg(HW, priv, "buffer %d: size=%d, xon=%d, xoff=%d, epsb=%d, lossy=%d\n", i, + port_buffer->buffer[i].size, + port_buffer->buffer[i].xon, + port_buffer->buffer[i].xoff, + port_buffer->buffer[i].epsb, + port_buffer->buffer[i].lossy); + } + + port_buffer->port_buffer_size = + MLX5_GET(pbmc_reg, out, port_buffer_size) << MLX5E_BUFFER_CELL_SHIFT; + port_buffer->spare_buffer_size = + port_buffer->port_buffer_size - total_used; + + mlx5e_dbg(HW, priv, "total buffer size=%d, spare buffer size=%d\n", + port_buffer->port_buffer_size, + port_buffer->spare_buffer_size); +out: + kfree(out); + return err; +} + +static int port_set_buffer(struct mlx5e_priv *priv, + struct mlx5e_port_buffer *port_buffer) +{ + struct mlx5_core_dev *mdev = priv->mdev; + int sz = MLX5_ST_SZ_BYTES(pbmc_reg); + void *buffer; + void *in; + int err; + int i; + + in = kzalloc(sz, GFP_KERNEL); + if (!in) + return -ENOMEM; + + err = mlx5e_port_query_pbmc(mdev, in); + if (err) + goto out; + + for (i = 0; i < MLX5E_MAX_BUFFER; i++) { + buffer = MLX5_ADDR_OF(pbmc_reg, in, buffer[i]); + + MLX5_SET(bufferx_reg, buffer, size, + port_buffer->buffer[i].size >> MLX5E_BUFFER_CELL_SHIFT); + MLX5_SET(bufferx_reg, buffer, lossy, + port_buffer->buffer[i].lossy); + MLX5_SET(bufferx_reg, buffer, xoff_threshold, + port_buffer->buffer[i].xoff >> MLX5E_BUFFER_CELL_SHIFT); + MLX5_SET(bufferx_reg, buffer, xon_threshold, + port_buffer->buffer[i].xon >> MLX5E_BUFFER_CELL_SHIFT); + } + + err = mlx5e_port_set_pbmc(mdev, in); +out: + kfree(in); + return err; +} + +/* xoff = ((301+2.16 * len [m]) * speed [Gbps] + 2.72 MTU [B]) */ +static u32 calculate_xoff(struct mlx5e_priv *priv, unsigned int mtu) +{ + u32 speed; + u32 xoff; + int err; + + err = mlx5e_port_linkspeed(priv->mdev, &speed); + if (err) { + mlx5_core_warn(priv->mdev, "cannot get port speed\n"); + speed = SPEED_40000; + } + speed = max_t(u32, speed, SPEED_40000); + xoff = (301 + 216 * priv->dcbx.cable_len / 100) * speed / 1000 + 272 * mtu / 100; + + mlx5e_dbg(HW, priv, "%s: xoff=%d\n", __func__, xoff); + return xoff; +} + +static int update_xoff_threshold(struct mlx5e_port_buffer *port_buffer, + u32 xoff) +{ + int i; + + for (i = 0; i < MLX5E_MAX_BUFFER; i++) { + if (port_buffer->buffer[i].lossy) { + port_buffer->buffer[i].xoff = 0; + port_buffer->buffer[i].xon = 0; + continue; + } + + if (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 = + port_buffer->buffer[i].xoff - MLX5E_MAX_PORT_MTU; + } + + return 0; +} + +/** + * update_buffer_lossy() + * mtu: device's MTU + * pfc_en: current pfc configuration + * buffer: current prio to buffer mapping + * xoff: xoff value + * port_buffer: port receive buffer configuration + * change: + * + * Update buffer configuration based on pfc configuraiton and priority + * to buffer mapping. + * Buffer's lossy bit is changed to: + * lossless if there is at least one PFC enabled priority mapped to this buffer + * lossy if all priorities mapped to this buffer are PFC disabled + * + * Return: + * Return 0 if no error. + * Set change to true if buffer configuration is modified. + */ +static int update_buffer_lossy(unsigned int mtu, + u8 pfc_en, u8 *buffer, u32 xoff, + struct mlx5e_port_buffer *port_buffer, + bool *change) +{ + bool changed = false; + u8 lossy_count; + u8 prio_count; + u8 lossy; + int prio; + int err; + int i; + + for (i = 0; i < MLX5E_MAX_BUFFER; i++) { + prio_count = 0; + lossy_count = 0; + + for (prio = 0; prio < MLX5E_MAX_PRIORITY; prio++) { + if (buffer[prio] != i) + continue; + + prio_count++; + lossy_count += !(pfc_en & (1 << prio)); + } + + if (lossy_count == prio_count) + lossy = 1; + else /* lossy_count < prio_count */ + lossy = 0; + + if (lossy != port_buffer->buffer[i].lossy) { + port_buffer->buffer[i].lossy = lossy; + changed = true; + } + } + + if (changed) { + err = update_xoff_threshold(port_buffer, xoff); + if (err) + return err; + + *change = true; + } + + return 0; +} + +int mlx5e_port_manual_buffer_config(struct mlx5e_priv *priv, + u32 change, unsigned int mtu, + struct ieee_pfc *pfc, + u32 *buffer_size, + u8 *prio2buffer) +{ + struct mlx5e_port_buffer port_buffer; + u32 xoff = calculate_xoff(priv, mtu); + bool update_prio2buffer = false; + u8 buffer[MLX5E_MAX_PRIORITY]; + bool update_buffer = false; + u32 total_used = 0; + u8 curr_pfc_en; + int err; + int i; + + mlx5e_dbg(HW, priv, "%s: change=%x\n", __func__, change); + + err = mlx5e_port_query_buffer(priv, &port_buffer); + if (err) + return err; + + if (change & MLX5E_PORT_BUFFER_CABLE_LEN) { + update_buffer = true; + err = update_xoff_threshold(&port_buffer, xoff); + if (err) + return err; + } + + if (change & MLX5E_PORT_BUFFER_PFC) { + err = mlx5e_port_query_priority2buffer(priv->mdev, buffer); + if (err) + return err; + + err = update_buffer_lossy(mtu, pfc->pfc_en, buffer, xoff, + &port_buffer, &update_buffer); + if (err) + return err; + } + + if (change & MLX5E_PORT_BUFFER_PRIO2BUFFER) { + update_prio2buffer = true; + err = mlx5_query_port_pfc(priv->mdev, &curr_pfc_en, NULL); + if (err) + return err; + + err = update_buffer_lossy(mtu, curr_pfc_en, prio2buffer, xoff, + &port_buffer, &update_buffer); + if (err) + return err; + } + + if (change & MLX5E_PORT_BUFFER_SIZE) { + for (i = 0; i < MLX5E_MAX_BUFFER; i++) { + mlx5e_dbg(HW, priv, "%s: buffer[%d]=%d\n", __func__, i, buffer_size[i]); + if (!port_buffer.buffer[i].lossy && !buffer_size[i]) { + mlx5e_dbg(HW, priv, "%s: lossless buffer[%d] size cannot be zero\n", + __func__, i); + return -EINVAL; + } + + port_buffer.buffer[i].size = buffer_size[i]; + total_used += buffer_size[i]; + } + + mlx5e_dbg(HW, priv, "%s: total buffer requested=%d\n", __func__, total_used); + + if (total_used > port_buffer.port_buffer_size) + return -EINVAL; + + update_buffer = true; + err = update_xoff_threshold(&port_buffer, xoff); + if (err) + return err; + } + + /* Need to update buffer configuration if xoff value is changed */ + if (!update_buffer && xoff != priv->dcbx.xoff) { + update_buffer = true; + err = update_xoff_threshold(&port_buffer, xoff); + if (err) + return err; + } + priv->dcbx.xoff = xoff; + + /* Apply the settings */ + if (update_buffer) { + err = port_set_buffer(priv, &port_buffer); + if (err) + return err; + } + + if (update_prio2buffer) + err = mlx5e_port_set_priority2buffer(priv->mdev, prio2buffer); + + return err; +} Copied: stable/12/sys/dev/mlx5/mlx5_en/port_buffer.h (from r352981, head/sys/dev/mlx5/mlx5_en/port_buffer.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/sys/dev/mlx5/mlx5_en/port_buffer.h Mon Oct 7 09:39:05 2019 (r353235, copy of r352981, head/sys/dev/mlx5/mlx5_en/port_buffer.h) @@ -0,0 +1,82 @@ +/*- + * Copyright (c) 2018 Mellanox Technologies. 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 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 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 __MLX5_EN_PORT_BUFFER_H__ +#define __MLX5_EN_PORT_BUFFER_H__ + +#include "en.h" +#include + +#define MLX5E_MAX_BUFFER 8 +#define MLX5E_BUFFER_CELL_SHIFT 7 +#define MLX5E_DEFAULT_CABLE_LEN 7 /* 7 meters */ + +#define MLX5_BUFFER_SUPPORTED(mdev) (MLX5_CAP_GEN(mdev, pcam_reg) && \ + MLX5_CAP_PCAM_REG(mdev, pbmc) && \ + MLX5_CAP_PCAM_REG(mdev, pptb)) + +enum { + MLX5E_PORT_BUFFER_CABLE_LEN = BIT(0), + MLX5E_PORT_BUFFER_PFC = BIT(1), + MLX5E_PORT_BUFFER_PRIO2BUFFER = BIT(2), + MLX5E_PORT_BUFFER_SIZE = BIT(3), +}; + +struct mlx5e_bufferx_reg { + u8 lossy; + u8 epsb; + u32 size; + u32 xoff; + u32 xon; +}; + +struct mlx5e_port_buffer { + u32 port_buffer_size; + u32 spare_buffer_size; + struct mlx5e_bufferx_reg buffer[MLX5E_MAX_BUFFER]; +}; + +#define IEEE_8021QAZ_MAX_TCS 8 + +struct ieee_pfc { + __u8 pfc_cap; + __u8 pfc_en; + __u8 mbc; + __u16 delay; + __u64 requests[IEEE_8021QAZ_MAX_TCS]; + __u64 indications[IEEE_8021QAZ_MAX_TCS]; +}; + +int mlx5e_port_manual_buffer_config(struct mlx5e_priv *priv, + u32 change, unsigned int mtu, + struct ieee_pfc *pfc, + u32 *buffer_size, + u8 *prio2buffer); + +int mlx5e_port_query_buffer(struct mlx5e_priv *priv, + struct mlx5e_port_buffer *port_buffer); +#endif Modified: stable/12/sys/dev/mlx5/port.h ============================================================================== --- stable/12/sys/dev/mlx5/port.h Mon Oct 7 09:36:30 2019 (r353234) +++ stable/12/sys/dev/mlx5/port.h Mon Oct 7 09:39:05 2019 (r353235) @@ -179,7 +179,16 @@ enum mlx5_qpts_trust_state { MLX5_QPTS_TRUST_DSCP = 2, MLX5_QPTS_TRUST_BOTH = 3, }; +struct mlx5e_port_eth_proto { + u32 cap; + u32 admin; + u32 oper; +}; +#ifndef SPEED_40000 +#define SPEED_40000 40000 +#endif + #define MLX5E_PROT_MASK(link_mode) (1 << (link_mode)) #define PORT_MODULE_EVENT_MODULE_STATUS_MASK 0xF @@ -251,5 +260,15 @@ int mlx5_set_dscp2prio(struct mlx5_core_dev *mdev, con int mlx5_query_dscp2prio(struct mlx5_core_dev *mdev, u8 *dscp2prio); int mlx5_query_pddr_range_info(struct mlx5_core_dev *mdev, u8 local_port, u8 *is_er_type); + +u32 mlx5e_port_ptys2speed(struct mlx5_core_dev *mdev, u32 eth_proto_oper); +int mlx5e_port_linkspeed(struct mlx5_core_dev *mdev, u32 *speed); +int mlx5_port_query_eth_proto(struct mlx5_core_dev *dev, u8 port, bool ext, + struct mlx5e_port_eth_proto *eproto); + +int mlx5e_port_query_pbmc(struct mlx5_core_dev *mdev, void *out); +int mlx5e_port_set_pbmc(struct mlx5_core_dev *mdev, void *in); +int mlx5e_port_query_priority2buffer(struct mlx5_core_dev *mdev, u8 *buffer); +int mlx5e_port_set_priority2buffer(struct mlx5_core_dev *mdev, u8 *buffer); #endif /* __MLX5_PORT_H__ */ Modified: stable/12/sys/modules/mlx5en/Makefile ============================================================================== --- stable/12/sys/modules/mlx5en/Makefile Mon Oct 7 09:36:30 2019 (r353234) +++ stable/12/sys/modules/mlx5en/Makefile Mon Oct 7 09:39:05 2019 (r353235) @@ -11,6 +11,7 @@ mlx5_en_flow_table.c \ mlx5_en_rx.c \ mlx5_en_rl.c \ mlx5_en_txrx.c \ +mlx5_en_port_buffer.c \ device_if.h bus_if.h vnode_if.h pci_if.h \ opt_inet.h opt_inet6.h opt_rss.h opt_ratelimit.h From owner-svn-src-stable-12@freebsd.org Mon Oct 7 09:42:09 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EBF031282E4; Mon, 7 Oct 2019 09:42:09 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46mwVn5sw0z3CkX; Mon, 7 Oct 2019 09:42:09 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ACAE7CC70; Mon, 7 Oct 2019 09:42:09 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x979g9ax098092; Mon, 7 Oct 2019 09:42:09 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x979g98v098090; Mon, 7 Oct 2019 09:42:09 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201910070942.x979g98v098090@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Oct 2019 09:42:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353237 - stable/12/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 353237 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Oct 2019 09:42:10 -0000 Author: hselasky Date: Mon Oct 7 09:42:08 2019 New Revision: 353237 URL: https://svnweb.freebsd.org/changeset/base/353237 Log: MFC r352982: 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@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_en/en.h stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/en.h Mon Oct 7 09:40:57 2019 (r353236) +++ stable/12/sys/dev/mlx5/mlx5_en/en.h Mon Oct 7 09:42:08 2019 (r353237) @@ -1200,5 +1200,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); +int mlx5e_update_buf_lossy(struct mlx5e_priv *priv); #endif /* _MLX5_EN_H_ */ Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Mon Oct 7 09:40:57 2019 (r353236) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Mon Oct 7 09:42:08 2019 (r353237) @@ -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(&pfc, 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, &pfc, 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, &port_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, &cable_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); +} + #define MLX5_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 : A); #undef B #undef A + } + + if (mlx5e_port_query_buffer(priv, &port_buffer) == 0) { + SYSCTL_ADD_PROC(&priv->sysctl_ctx, SYSCTL_CHILDREN(qos_node), + OID_AUTO, "buffers_size", + CTLTYPE_U32 | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, + priv, 0, mlx5e_buf_size_handler, "IU", + "Set buffers sizes"); + SYSCTL_ADD_PROC(&priv->sysctl_ctx, SYSCTL_CHILDREN(qos_node), + OID_AUTO, "buffers_prio", + CTLTYPE_U8 | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, + priv, 0, mlx5e_buf_prio_handler, "CU", + "Set prio to buffers mapping"); + SYSCTL_ADD_PROC(&priv->sysctl_ctx, SYSCTL_CHILDREN(qos_node), + OID_AUTO, "cable_length", + CTLTYPE_UINT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, + priv, 0, mlx5e_cable_length_handler, "IU", + "Set cable length in meters for xoff threshold calculation"); } } Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Mon Oct 7 09:40:57 2019 (r353236) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Mon Oct 7 09:42:08 2019 (r353237) @@ -3866,8 +3866,11 @@ mlx5e_sysctl_rx_priority_flow_control(SYSCTL_HANDLER_A } /* check if update is required */ - if (rx_pfc != priv->params.rx_priority_flow_control) + if (rx_pfc != priv->params.rx_priority_flow_control) { err = -mlx5e_set_port_pfc(priv); + if (err == 0) + err = mlx5e_update_buf_lossy(priv); + } done: if (err != 0) priv->params.rx_priority_flow_control= rx_pfc; From owner-svn-src-stable-12@freebsd.org Mon Oct 7 09:45:22 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D04E6128460; Mon, 7 Oct 2019 09:45:22 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46mwZV5XF7z3DF9; Mon, 7 Oct 2019 09:45:22 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A1E40CC96; Mon, 7 Oct 2019 09:45:22 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x979jMh9099389; Mon, 7 Oct 2019 09:45:22 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x979jKFq099380; Mon, 7 Oct 2019 09:45:20 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201910070945.x979jKFq099380@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Oct 2019 09:45:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353239 - in stable/12: share/man/man4 sys/dev/mlx5 sys/dev/mlx5/mlx5_core sys/dev/mlx5/mlx5_en X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12: share/man/man4 sys/dev/mlx5 sys/dev/mlx5/mlx5_core sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 353239 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Oct 2019 09:45:22 -0000 Author: hselasky Date: Mon Oct 7 09:45:20 2019 New Revision: 353239 URL: https://svnweb.freebsd.org/changeset/base/353239 Log: MFC r352983 and r353001: 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@ Sponsored by: Mellanox Technologies Modified: stable/12/share/man/man4/mlx5io.4 stable/12/sys/dev/mlx5/diagnostics.h stable/12/sys/dev/mlx5/mlx5_core/mlx5_diagnostics.c stable/12/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c stable/12/sys/dev/mlx5/mlx5_en/en.h stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c stable/12/sys/dev/mlx5/mlx5io.h stable/12/sys/dev/mlx5/port.h Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/mlx5io.4 ============================================================================== --- stable/12/share/man/man4/mlx5io.4 Mon Oct 7 09:42:57 2019 (r353238) +++ stable/12/share/man/man4/mlx5io.4 Mon Oct 7 09:45:20 2019 (r353239) @@ -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: stable/12/sys/dev/mlx5/diagnostics.h ============================================================================== --- stable/12/sys/dev/mlx5/diagnostics.h Mon Oct 7 09:42:57 2019 (r353238) +++ stable/12/sys/dev/mlx5/diagnostics.h Mon Oct 7 09:45:20 2019 (r353239) @@ -32,6 +32,8 @@ #define MLX5_CORE_DIAGNOSTICS_STRUCT(n, s, t) s, #define MLX5_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: stable/12/sys/dev/mlx5/mlx5_core/mlx5_diagnostics.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_diagnostics.c Mon Oct 7 09:42:57 2019 (r353238) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_diagnostics.c Mon Oct 7 09:45:20 2019 (r353239) @@ -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 } return 0; /* not supported counter */ } + +/* + * Read the first three bytes of the eeprom in order to get the needed info + * for the whole reading. + * Byte 0 - Identifier byte + * Byte 1 - Revision byte + * Byte 2 - Status byte + */ +int +mlx5_get_eeprom_info(struct mlx5_core_dev *dev, struct mlx5_eeprom *eeprom) +{ + u32 data = 0; + int size_read = 0; + int ret; + + ret = mlx5_query_module_num(dev, &eeprom->module_num); + if (ret) { + mlx5_core_err(dev, "Failed query module error=%d\n", ret); + return (-ret); + } + + /* Read the first three bytes to get Identifier, Revision and Status */ + ret = mlx5_query_eeprom(dev, eeprom->i2c_addr, eeprom->page_num, + eeprom->device_addr, MLX5_EEPROM_INFO_BYTES, eeprom->module_num, &data, + &size_read); + if (ret) { + mlx5_core_err(dev, + "Failed query EEPROM module error=0x%x\n", ret); + return (-ret); + } + + switch (data & MLX5_EEPROM_IDENTIFIER_BYTE_MASK) { + case SFF_8024_ID_QSFP: + eeprom->type = MLX5_ETH_MODULE_SFF_8436; + eeprom->len = MLX5_ETH_MODULE_SFF_8436_LEN; + break; + case SFF_8024_ID_QSFPPLUS: + case SFF_8024_ID_QSFP28: + if ((data & MLX5_EEPROM_IDENTIFIER_BYTE_MASK) == SFF_8024_ID_QSFP28 || + ((data & MLX5_EEPROM_REVISION_ID_BYTE_MASK) >> 8) >= 0x3) { + eeprom->type = MLX5_ETH_MODULE_SFF_8636; + eeprom->len = MLX5_ETH_MODULE_SFF_8636_LEN; + } else { + eeprom->type = MLX5_ETH_MODULE_SFF_8436; + eeprom->len = MLX5_ETH_MODULE_SFF_8436_LEN; + } + if ((data & MLX5_EEPROM_PAGE_3_VALID_BIT_MASK) == 0) + eeprom->page_valid = 1; + break; + case SFF_8024_ID_SFP: + eeprom->type = MLX5_ETH_MODULE_SFF_8472; + eeprom->len = MLX5_ETH_MODULE_SFF_8472_LEN; + break; + default: + mlx5_core_err(dev, "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); + } + return (0); +} + +/* Read both low and high pages of the eeprom */ +int +mlx5_get_eeprom(struct mlx5_core_dev *dev, struct mlx5_eeprom *ee) +{ + int size_read = 0; + int ret; + + if (ee->len == 0) + return (EINVAL); + + /* Read low page of the eeprom */ + while (ee->device_addr < ee->len) { + ret = mlx5_query_eeprom(dev, ee->i2c_addr, ee->page_num, ee->device_addr, + ee->len - ee->device_addr, ee->module_num, + ee->data + (ee->device_addr / 4), &size_read); + if (ret) { + mlx5_core_err(dev, + "Failed reading EEPROM, error = 0x%02x\n", ret); + return (-ret); + } + ee->device_addr += size_read; + } + + /* Read high page of the eeprom */ + if (ee->page_valid == 1) { + ee->device_addr = MLX5_EEPROM_HIGH_PAGE_OFFSET; + ee->page_num = MLX5_EEPROM_HIGH_PAGE; + size_read = 0; + while (ee->device_addr < MLX5_EEPROM_PAGE_LENGTH) { + ret = mlx5_query_eeprom(dev, ee->i2c_addr, ee->page_num, + ee->device_addr, MLX5_EEPROM_PAGE_LENGTH - ee->device_addr, + ee->module_num, ee->data + (ee->len / 4) + + ((ee->device_addr - MLX5_EEPROM_HIGH_PAGE_OFFSET) / 4), + &size_read); + if (ret) { + mlx5_core_err(dev, + "Failed reading EEPROM, error = 0x%02x\n", + ret); + return (-ret); + } + ee->device_addr += size_read; + } + } + return (0); +} + +/* + * Read cable EEPROM module information by first inspecting the first + * three bytes to get the initial information for a whole reading. + * Information will be printed to dmesg. + */ +int +mlx5_read_eeprom(struct mlx5_core_dev *dev, struct mlx5_eeprom *eeprom) +{ + int error; + + eeprom->i2c_addr = MLX5_I2C_ADDR_LOW; + eeprom->device_addr = 0; + eeprom->page_num = MLX5_EEPROM_LOW_PAGE; + eeprom->page_valid = 0; + + /* Read three first bytes to get important info */ + error = mlx5_get_eeprom_info(dev, eeprom); + if (error) { + mlx5_core_err(dev, + "Failed reading EEPROM initial information\n"); + return (error); + } + /* + * Allocate needed length buffer and additional space for + * page 0x03 + */ + eeprom->data = malloc(eeprom->len + MLX5_EEPROM_PAGE_LENGTH, + M_MLX5_EEPROM, M_WAITOK | M_ZERO); + + /* Read the whole eeprom information */ + error = mlx5_get_eeprom(dev, eeprom); + if (error) { + mlx5_core_err(dev, "Failed reading EEPROM\n"); + error = 0; + /* + * Continue printing partial information in case of + * an error + */ + } + free(eeprom->data, M_MLX5_EEPROM); + + return (error); +} + + Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Mon Oct 7 09:42:57 2019 (r353238) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Mon Oct 7 09:45:20 2019 (r353239) @@ -32,8 +32,10 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include +#include static MALLOC_DEFINE(M_MLX5_DUMP, "MLX5DUMP", "MLX5 Firmware dump"); @@ -306,6 +308,54 @@ mlx5_fw_reset(struct mlx5_core_dev *mdev) } static int +mlx5_eeprom_copyout(struct mlx5_core_dev *dev, struct mlx5_eeprom_get *eeprom_info) +{ + struct mlx5_eeprom eeprom; + int error; + + eeprom.i2c_addr = MLX5_I2C_ADDR_LOW; + eeprom.device_addr = 0; + eeprom.page_num = MLX5_EEPROM_LOW_PAGE; + eeprom.page_valid = 0; + + /* Read three first bytes to get important info */ + error = mlx5_get_eeprom_info(dev, &eeprom); + if (error != 0) { + mlx5_core_err(dev, + "Failed reading EEPROM initial information\n"); + return (error); + } + eeprom_info->eeprom_info_page_valid = eeprom.page_valid; + eeprom_info->eeprom_info_out_len = eeprom.len; + + if (eeprom_info->eeprom_info_buf == NULL) + return (0); + /* + * Allocate needed length buffer and additional space for + * page 0x03 + */ + eeprom.data = malloc(eeprom.len + MLX5_EEPROM_PAGE_LENGTH, + M_MLX5_EEPROM, M_WAITOK | M_ZERO); + + /* Read the whole eeprom information */ + error = mlx5_get_eeprom(dev, &eeprom); + if (error != 0) { + mlx5_core_err(dev, "Failed reading EEPROM error = %d\n", + error); + error = 0; + /* + * Continue printing partial information in case of + * an error + */ + } + error = copyout(eeprom.data, eeprom_info->eeprom_info_buf, + eeprom.len); + free(eeprom.data, M_MLX5_EEPROM); + + return (error); +} + +static int mlx5_ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, struct thread *td) { @@ -314,6 +364,7 @@ mlx5_ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t d struct mlx5_tool_addr *devaddr; struct mlx5_fw_update *fu; struct firmware fake_fw; + struct mlx5_eeprom_get *eeprom_info; int error; error = 0; @@ -391,6 +442,18 @@ mlx5_ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t d if (error != 0) break; error = mlx5_fw_reset(mdev); + break; + case MLX5_EEPROM_GET: + if ((fflag & FREAD) == 0) { + error = EBADF; + break; + } + eeprom_info = (struct mlx5_eeprom_get *)data; + devaddr = &eeprom_info->devaddr; + error = mlx5_dbsf_to_core(devaddr, &mdev); + if (error != 0) + break; + error = mlx5_eeprom_copyout(mdev, eeprom_info); break; default: error = ENOTTY; Modified: stable/12/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/en.h Mon Oct 7 09:42:57 2019 (r353238) +++ stable/12/sys/dev/mlx5/mlx5_en/en.h Mon Oct 7 09:45:20 2019 (r353239) @@ -713,34 +713,6 @@ struct mlx5e_params_ethtool { u8 trust_state; }; -/* EEPROM Standards for plug in modules */ -#ifndef MLX5E_ETH_MODULE_SFF_8472 -#define MLX5E_ETH_MODULE_SFF_8472 0x1 -#define MLX5E_ETH_MODULE_SFF_8472_LEN 128 -#endif - -#ifndef MLX5E_ETH_MODULE_SFF_8636 -#define MLX5E_ETH_MODULE_SFF_8636 0x2 -#define MLX5E_ETH_MODULE_SFF_8636_LEN 256 -#endif - -#ifndef MLX5E_ETH_MODULE_SFF_8436 -#define MLX5E_ETH_MODULE_SFF_8436 0x3 -#define MLX5E_ETH_MODULE_SFF_8436_LEN 256 -#endif - -/* EEPROM I2C Addresses */ -#define MLX5E_I2C_ADDR_LOW 0x50 -#define MLX5E_I2C_ADDR_HIGH 0x51 - -#define MLX5E_EEPROM_LOW_PAGE 0x0 -#define MLX5E_EEPROM_HIGH_PAGE 0x3 - -#define MLX5E_EEPROM_HIGH_PAGE_OFFSET 128 -#define MLX5E_EEPROM_PAGE_LENGTH 256 - -#define MLX5E_EEPROM_INFO_BYTES 0x3 - struct mlx5e_cq { /* data path - accessed per cqe */ struct mlx5_cqwq wq; Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Mon Oct 7 09:42:57 2019 (r353238) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Mon Oct 7 09:45:20 2019 (r353239) @@ -27,7 +27,6 @@ #include "en.h" #include "port_buffer.h" -#include void mlx5e_create_stats(struct sysctl_ctx_list *ctx, @@ -901,214 +900,6 @@ done: return (error); } -/* - * Read the first three bytes of the eeprom in order to get the needed info - * for the whole reading. - * Byte 0 - Identifier byte - * Byte 1 - Revision byte - * Byte 2 - Status byte - */ -static int -mlx5e_get_eeprom_info(struct mlx5e_priv *priv, struct mlx5e_eeprom *eeprom) -{ - struct mlx5_core_dev *dev = priv->mdev; - u32 data = 0; - int size_read = 0; - int ret; - - ret = mlx5_query_module_num(dev, &eeprom->module_num); - if (ret) { - mlx5_en_err(priv->ifp, "Failed query module error=%d\n", - ret); - return (ret); - } - - /* Read the first three bytes to get Identifier, Revision and Status */ - ret = mlx5_query_eeprom(dev, eeprom->i2c_addr, eeprom->page_num, - eeprom->device_addr, MLX5E_EEPROM_INFO_BYTES, eeprom->module_num, &data, - &size_read); - if (ret) { - mlx5_en_err(priv->ifp, - "Failed query eeprom module error=0x%x\n", ret); - return (ret); - } - - switch (data & MLX5_EEPROM_IDENTIFIER_BYTE_MASK) { - case SFF_8024_ID_QSFP: - eeprom->type = MLX5E_ETH_MODULE_SFF_8436; - eeprom->len = MLX5E_ETH_MODULE_SFF_8436_LEN; - break; - case SFF_8024_ID_QSFPPLUS: - case SFF_8024_ID_QSFP28: - if ((data & MLX5_EEPROM_IDENTIFIER_BYTE_MASK) == SFF_8024_ID_QSFP28 || - ((data & MLX5_EEPROM_REVISION_ID_BYTE_MASK) >> 8) >= 0x3) { - eeprom->type = MLX5E_ETH_MODULE_SFF_8636; - eeprom->len = MLX5E_ETH_MODULE_SFF_8636_LEN; - } else { - eeprom->type = MLX5E_ETH_MODULE_SFF_8436; - eeprom->len = MLX5E_ETH_MODULE_SFF_8436_LEN; - } - if ((data & MLX5_EEPROM_PAGE_3_VALID_BIT_MASK) == 0) - eeprom->page_valid = 1; - break; - case SFF_8024_ID_SFP: - eeprom->type = MLX5E_ETH_MODULE_SFF_8472; - eeprom->len = MLX5E_ETH_MODULE_SFF_8472_LEN; - break; - default: - 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); - } - return (0); -} - -/* Read both low and high pages of the eeprom */ -static int -mlx5e_get_eeprom(struct mlx5e_priv *priv, struct mlx5e_eeprom *ee) -{ - struct mlx5_core_dev *dev = priv->mdev; - int size_read = 0; - int ret; - - if (ee->len == 0) - return (EINVAL); - - /* Read low page of the eeprom */ - while (ee->device_addr < ee->len) { - ret = mlx5_query_eeprom(dev, ee->i2c_addr, ee->page_num, ee->device_addr, - ee->len - ee->device_addr, ee->module_num, - ee->data + (ee->device_addr / 4), &size_read); - if (ret) { - mlx5_en_err(priv->ifp, - "Failed reading eeprom, error = 0x%02x\n",ret); - return (ret); - } - ee->device_addr += size_read; - } - - /* Read high page of the eeprom */ - if (ee->page_valid) { - ee->device_addr = MLX5E_EEPROM_HIGH_PAGE_OFFSET; - ee->page_num = MLX5E_EEPROM_HIGH_PAGE; - size_read = 0; - while (ee->device_addr < MLX5E_EEPROM_PAGE_LENGTH) { - ret = mlx5_query_eeprom(dev, ee->i2c_addr, ee->page_num, - ee->device_addr, MLX5E_EEPROM_PAGE_LENGTH - ee->device_addr, - ee->module_num, ee->data + (ee->len / 4) + - ((ee->device_addr - MLX5E_EEPROM_HIGH_PAGE_OFFSET) / 4), - &size_read); - if (ret) { - mlx5_en_err(priv->ifp, - "Failed reading eeprom, error = 0x%02x\n", - ret); - return (ret); - } - ee->device_addr += size_read; - } - } - return (0); -} - -static void -mlx5e_print_eeprom(struct mlx5e_eeprom *eeprom) -{ - int row; - int index_in_row; - int byte_to_write = 0; - int line_length = 16; - - printf("\nOffset\t\tValues\n"); - printf("------\t\t------"); - while (byte_to_write < eeprom->len) { - printf("\n0x%04X\t\t", byte_to_write); - for (index_in_row = 0; index_in_row < line_length; index_in_row++) { - printf("%02X ", ((u8 *)eeprom->data)[byte_to_write]); - byte_to_write++; - } - } - - if (eeprom->page_valid) { - row = MLX5E_EEPROM_HIGH_PAGE_OFFSET; - printf("\n\nUpper Page 0x03\n"); - printf("\nOffset\t\tValues\n"); - printf("------\t\t------"); - while (row < MLX5E_EEPROM_PAGE_LENGTH) { - printf("\n0x%04X\t\t", row); - for (index_in_row = 0; index_in_row < line_length; index_in_row++) { - printf("%02X ", ((u8 *)eeprom->data)[byte_to_write]); - byte_to_write++; - row++; - } - } - } -} - -/* - * Read cable EEPROM module information by first inspecting the first - * three bytes to get the initial information for a whole reading. - * Information will be printed to dmesg. - */ -static int -mlx5e_read_eeprom(SYSCTL_HANDLER_ARGS) -{ - struct mlx5e_priv *priv = arg1; - struct mlx5e_eeprom eeprom; - int error; - int result = 0; - - PRIV_LOCK(priv); - error = sysctl_handle_int(oidp, &result, 0, req); - if (error || !req->newptr) - goto done; - - /* Check if device is gone */ - if (priv->gone) { - error = ENXIO; - goto done; - } - - if (result == 1) { - eeprom.i2c_addr = MLX5E_I2C_ADDR_LOW; - eeprom.device_addr = 0; - eeprom.page_num = MLX5E_EEPROM_LOW_PAGE; - eeprom.page_valid = 0; - - /* Read three first bytes to get important info */ - error = mlx5e_get_eeprom_info(priv, &eeprom); - if (error) { - mlx5_en_err(priv->ifp, - "Failed reading eeprom's initial information\n"); - error = 0; - goto done; - } - /* - * Allocate needed length buffer and additional space for - * page 0x03 - */ - eeprom.data = malloc(eeprom.len + MLX5E_EEPROM_PAGE_LENGTH, - M_MLX5EN, M_WAITOK | M_ZERO); - - /* Read the whole eeprom information */ - error = mlx5e_get_eeprom(priv, &eeprom); - if (error) { - mlx5_en_err(priv->ifp, "Failed reading eeprom\n"); - error = 0; - /* - * Continue printing partial information in case of - * an error - */ - } - mlx5e_print_eeprom(&eeprom); - free(eeprom.data, M_MLX5EN); - } -done: - PRIV_UNLOCK(priv); - return (error); -} - static const char *mlx5e_params_desc[] = { MLX5E_PARAMS(MLX5E_STATS_DESC) }; @@ -1346,11 +1137,6 @@ mlx5e_create_ethtool(struct mlx5e_priv *priv) OID_AUTO, "device_name", CTLFLAG_RD, __DECONST(void *, pnameunit), 0, "PCI device name"); - - /* EEPROM support */ - SYSCTL_ADD_PROC(&priv->sysctl_ctx, SYSCTL_CHILDREN(node), OID_AUTO, "eeprom_info", - CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, priv, 0, - mlx5e_read_eeprom, "I", "EEPROM information"); /* Diagnostics support */ mlx5e_create_diagnostics(priv); Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Mon Oct 7 09:42:57 2019 (r353238) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Mon Oct 7 09:45:20 2019 (r353239) @@ -3395,9 +3395,9 @@ out: * The internal conversion is as follows: */ if (i2c.dev_addr == 0xA0) - read_addr = MLX5E_I2C_ADDR_LOW; + read_addr = MLX5_I2C_ADDR_LOW; else if (i2c.dev_addr == 0xA2) - read_addr = MLX5E_I2C_ADDR_HIGH; + read_addr = MLX5_I2C_ADDR_HIGH; else { mlx5_en_err(ifp, "Query eeprom failed, Invalid Address: %X\n", @@ -3406,7 +3406,7 @@ out: goto err_i2c; } error = mlx5_query_eeprom(priv->mdev, - read_addr, MLX5E_EEPROM_LOW_PAGE, + read_addr, MLX5_EEPROM_LOW_PAGE, (uint32_t)i2c.offset, (uint32_t)i2c.len, module_num, (uint32_t *)i2c.data, &size_read); if (error) { @@ -3418,7 +3418,7 @@ out: if (i2c.len > MLX5_EEPROM_MAX_BYTES) { error = mlx5_query_eeprom(priv->mdev, - read_addr, MLX5E_EEPROM_LOW_PAGE, + read_addr, MLX5_EEPROM_LOW_PAGE, (uint32_t)(i2c.offset + size_read), (uint32_t)(i2c.len - size_read), module_num, (uint32_t *)(i2c.data + size_read), &size_read); Modified: stable/12/sys/dev/mlx5/mlx5io.h ============================================================================== --- stable/12/sys/dev/mlx5/mlx5io.h Mon Oct 7 09:42:57 2019 (r353238) +++ stable/12/sys/dev/mlx5/mlx5io.h Mon Oct 7 09:45:20 2019 (r353239) @@ -55,11 +55,19 @@ struct mlx5_fw_update { size_t img_fw_data_len; }; +struct mlx5_eeprom_get { + struct mlx5_tool_addr devaddr; + uint32_t *eeprom_info_buf; + uint8_t eeprom_info_page_valid; + size_t eeprom_info_out_len; +}; + #define MLX5_FWDUMP_GET _IOWR('m', 1, struct mlx5_fwdump_get) #define MLX5_FWDUMP_RESET _IOW('m', 2, struct mlx5_tool_addr) #define MLX5_FWDUMP_FORCE _IOW('m', 3, struct mlx5_tool_addr) #define MLX5_FW_UPDATE _IOW('m', 4, struct mlx5_fw_update) #define MLX5_FW_RESET _IOW('m', 5, struct mlx5_tool_addr) +#define MLX5_EEPROM_GET _IOWR('m', 6, struct mlx5_eeprom_get) #ifndef _KERNEL #define MLX5_DEV_PATH _PATH_DEV"mlx5ctl" Modified: stable/12/sys/dev/mlx5/port.h ============================================================================== --- stable/12/sys/dev/mlx5/port.h Mon Oct 7 09:42:57 2019 (r353238) +++ stable/12/sys/dev/mlx5/port.h Mon Oct 7 09:45:20 2019 (r353239) @@ -50,13 +50,34 @@ enum mlx5_an_status { MLX5_AN_LINK_DOWN = 4, }; +/* EEPROM I2C Addresses */ +#define MLX5_I2C_ADDR_LOW 0x50 +#define MLX5_I2C_ADDR_HIGH 0x51 +#define MLX5_EEPROM_PAGE_LENGTH 256 #define MLX5_EEPROM_MAX_BYTES 32 #define MLX5_EEPROM_IDENTIFIER_BYTE_MASK 0x000000ff #define MLX5_EEPROM_REVISION_ID_BYTE_MASK 0x0000ff00 #define MLX5_EEPROM_PAGE_3_VALID_BIT_MASK 0x00040000 -#define MLX5_I2C_ADDR_LOW 0x50 -#define MLX5_I2C_ADDR_HIGH 0x51 -#define MLX5_EEPROM_PAGE_LENGTH 256 +#define MLX5_EEPROM_LOW_PAGE 0x0 +#define MLX5_EEPROM_HIGH_PAGE 0x3 +#define MLX5_EEPROM_HIGH_PAGE_OFFSET 128 +#define MLX5_EEPROM_INFO_BYTES 0x3 + +/* EEPROM Standards for plug in modules */ +#ifndef MLX5_ETH_MODULE_SFF_8472 +#define MLX5_ETH_MODULE_SFF_8472 0x1 +#define MLX5_ETH_MODULE_SFF_8472_LEN 128 +#endif + +#ifndef MLX5_ETH_MODULE_SFF_8636 +#define MLX5_ETH_MODULE_SFF_8636 0x2 +#define MLX5_ETH_MODULE_SFF_8636_LEN 256 +#endif + +#ifndef MLX5_ETH_MODULE_SFF_8436 +#define MLX5_ETH_MODULE_SFF_8436 0x3 +#define MLX5_ETH_MODULE_SFF_8436_LEN 256 +#endif enum mlx5e_link_speed { MLX5E_1000BASE_CX_SGMII = 0, From owner-svn-src-stable-12@freebsd.org Mon Oct 7 09:48:21 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BE0B81285C2; Mon, 7 Oct 2019 09:48:21 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46mwdx4bK8z3DWP; Mon, 7 Oct 2019 09:48:21 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7C9D9CC9E; Mon, 7 Oct 2019 09:48:21 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x979mLaI099727; Mon, 7 Oct 2019 09:48:21 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x979mLSJ099725; Mon, 7 Oct 2019 09:48:21 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201910070948.x979mLSJ099725@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Oct 2019 09:48:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353241 - stable/12/usr.sbin/mlx5tool X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/usr.sbin/mlx5tool X-SVN-Commit-Revision: 353241 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Oct 2019 09:48:21 -0000 Author: hselasky Date: Mon Oct 7 09:48:20 2019 New Revision: 353241 URL: https://svnweb.freebsd.org/changeset/base/353241 Log: MFC r352984: Add the ability to query the EEPROM information in mlx5tool(8). Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/12/usr.sbin/mlx5tool/mlx5tool.8 stable/12/usr.sbin/mlx5tool/mlx5tool.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/mlx5tool/mlx5tool.8 ============================================================================== --- stable/12/usr.sbin/mlx5tool/mlx5tool.8 Mon Oct 7 09:46:33 2019 (r353240) +++ stable/12/usr.sbin/mlx5tool/mlx5tool.8 Mon Oct 7 09:48:20 2019 (r353241) @@ -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: stable/12/usr.sbin/mlx5tool/mlx5tool.c ============================================================================== --- stable/12/usr.sbin/mlx5tool/mlx5tool.c Mon Oct 7 09:46:33 2019 (r353240) +++ stable/12/usr.sbin/mlx5tool/mlx5tool.c Mon Oct 7 09:48:20 2019 (r353241) @@ -200,7 +200,86 @@ mlx5tool_fw_reset(int ctldev, const struct mlx5_tool_a return (0); } +#define MLX5_EEPROM_HIGH_PAGE_OFFSET 128 +#define MLX5_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(&eeprom_info, 0, sizeof(eeprom_info)); + eeprom_info.devaddr = *addr; + + error = ioctl(ctldev, MLX5_EEPROM_GET, &eeprom_info); + if (error != 0) { + warn("MLX5_EEPROM_GET"); + return (error); + } + eeprom_info.eeprom_info_buf = + malloc(eeprom_info.eeprom_info_out_len + MLX5_EEPROM_PAGE_LENGTH); + if (eeprom_info.eeprom_info_buf == NULL) { + warn("alloc eeprom_info.eeprom_info_buf "); + return (ENOMEM); + } + error = ioctl(ctldev, MLX5_EEPROM_GET, &eeprom_info); + if (error != 0) { + warn("MLX5_EEPROM_GET"); + free(eeprom_info.eeprom_info_buf); + return (error); + } + + mlx5tool_eeprom_print(&eeprom_info); + + free(eeprom_info.eeprom_info_buf); + return (0); +} + +static void usage(void) { @@ -209,6 +288,7 @@ usage(void) " -e | -f fw.mfa2 | -z]\n"); fprintf(stderr, "\t-w - write firmware dump to the specified file\n"); fprintf(stderr, "\t-r - reset dump\n"); + fprintf(stderr, "\t-E - get eeprom info\n"); fprintf(stderr, "\t-e - force dump\n"); fprintf(stderr, "\t-f fw.img - flash firmware from fw.img\n"); fprintf(stderr, "\t-z - initiate firmware reset\n"); @@ -221,6 +301,7 @@ enum mlx5_action { ACTION_DUMP_FORCE, ACTION_FW_UPDATE, ACTION_FW_RESET, + ACTION_GET_EEPROM_INFO, ACTION_NONE, }; @@ -238,7 +319,7 @@ main(int argc, char *argv[]) addrstr = NULL; dumpname = NULL; img_fw_path = NULL; - while ((c = getopt(argc, argv, "d:ef:ho:rwz")) != -1) { + while ((c = getopt(argc, argv, "d:Eef:ho:rwz")) != -1) { switch (c) { case 'd': addrstr = optarg; @@ -248,6 +329,11 @@ main(int argc, char *argv[]) usage(); act = ACTION_DUMP_GET; break; + case 'E': + if (act != ACTION_NONE) + usage(); + act = ACTION_GET_EEPROM_INFO; + break; case 'e': if (act != ACTION_NONE) usage(); @@ -302,6 +388,9 @@ main(int argc, char *argv[]) break; case ACTION_FW_RESET: res = mlx5tool_fw_reset(ctldev, &addr); + break; + case ACTION_GET_EEPROM_INFO: + res = mlx5tool_get_eeprom_info(ctldev, &addr); break; default: res = 0; From owner-svn-src-stable-12@freebsd.org Mon Oct 7 09:51:05 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7F91312897B; Mon, 7 Oct 2019 09:51:05 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46mwj51pBJz3DvT; Mon, 7 Oct 2019 09:51:05 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0AF81CCCF; Mon, 7 Oct 2019 09:51:05 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x979p4n7001567; Mon, 7 Oct 2019 09:51:04 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x979p3O6001559; Mon, 7 Oct 2019 09:51:03 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201910070951.x979p3O6001559@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Oct 2019 09:51:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353243 - in stable/12/sys/dev/mlx5: . mlx5_en X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12/sys/dev/mlx5: . mlx5_en X-SVN-Commit-Revision: 353243 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Oct 2019 09:51:05 -0000 Author: hselasky Date: Mon Oct 7 09:51:03 2019 New Revision: 353243 URL: https://svnweb.freebsd.org/changeset/base/353243 Log: MFC r352985: Add sysctl(8) to get and set forward error correction, FEC, configuration in mlx5en(4). Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/device.h stable/12/sys/dev/mlx5/driver.h stable/12/sys/dev/mlx5/mlx5_en/en.h stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c stable/12/sys/dev/mlx5/mlx5_ifc.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/device.h ============================================================================== --- stable/12/sys/dev/mlx5/device.h Mon Oct 7 09:49:03 2019 (r353242) +++ stable/12/sys/dev/mlx5/device.h Mon Oct 7 09:51:03 2019 (r353243) @@ -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) +#define MLX5_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: stable/12/sys/dev/mlx5/driver.h ============================================================================== --- stable/12/sys/dev/mlx5/driver.h Mon Oct 7 09:49:03 2019 (r353242) +++ stable/12/sys/dev/mlx5/driver.h Mon Oct 7 09:51:03 2019 (r353243) @@ -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: stable/12/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/en.h Mon Oct 7 09:49:03 2019 (r353242) +++ stable/12/sys/dev/mlx5/mlx5_en/en.h Mon Oct 7 09:51:03 2019 (r353243) @@ -75,6 +75,9 @@ #define MLX5E_MAX_PRIORITY 8 +#define MLX5E_MAX_FEC_10X_25X 4 +#define MLX5E_MAX_FEC_50X 4 + /* IEEE 802.1Qaz standard supported values */ #define IEEE_8021QAZ_MAX_TCS 8 @@ -711,6 +714,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 { @@ -1173,5 +1181,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); int mlx5e_update_buf_lossy(struct mlx5e_priv *priv); +int mlx5e_fec_update(struct mlx5e_priv *priv); #endif /* _MLX5_EN_H_ */ Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Mon Oct 7 09:49:03 2019 (r353242) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Mon Oct 7 09:51:03 2019 (r353243) @@ -345,7 +345,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] = + MLX5_GET(pplm_reg, in, fec_override_cap_56g); + priv->params_ethtool.fec_avail_10x_25x[3] = + MLX5_GET(pplm_reg, in, fec_override_cap_100g); + + /* get 50x mask */ + priv->params_ethtool.fec_mask_50x[0] = + MLX5_GET(pplm_reg, in, fec_override_admin_50g_1x); + priv->params_ethtool.fec_mask_50x[1] = + MLX5_GET(pplm_reg, in, fec_override_admin_100g_2x); + priv->params_ethtool.fec_mask_50x[2] = + MLX5_GET(pplm_reg, in, fec_override_admin_200g_4x); + priv->params_ethtool.fec_mask_50x[3] = + MLX5_GET(pplm_reg, in, fec_override_admin_400g_8x); + + /* get 50x available bits */ + priv->params_ethtool.fec_avail_50x[0] = + MLX5_GET(pplm_reg, in, fec_override_cap_50g_1x); + priv->params_ethtool.fec_avail_50x[1] = + MLX5_GET(pplm_reg, in, fec_override_cap_100g_2x); + priv->params_ethtool.fec_avail_50x[2] = + MLX5_GET(pplm_reg, in, fec_override_cap_200g_4x); + priv->params_ethtool.fec_avail_50x[3] = + MLX5_GET(pplm_reg, in, fec_override_cap_400g_8x); + + /* get current FEC mask */ + priv->params_ethtool.fec_mode_active = + MLX5_GET(pplm_reg, in, fec_mode_active); + + return (0); +} + static int +mlx5e_fec_mask_10x_25x_handler(SYSCTL_HANDLER_ARGS) +{ + struct mlx5e_priv *priv = arg1; + struct mlx5_core_dev *mdev = priv->mdev; + u32 out[MLX5_ST_SZ_DW(pplm_reg)] = {}; + u32 in[MLX5_ST_SZ_DW(pplm_reg)] = {}; + const int sz = MLX5_ST_SZ_BYTES(pplm_reg); + u8 fec_mask_10x_25x[MLX5E_MAX_FEC_10X_25X]; + u8 fec_cap_changed = 0; + u8 x; + int err; + + PRIV_LOCK(priv); + err = SYSCTL_OUT(req, priv->params_ethtool.fec_mask_10x_25x, + sizeof(priv->params_ethtool.fec_mask_10x_25x)); + if (err || !req->newptr) + goto done; + + err = SYSCTL_IN(req, fec_mask_10x_25x, + sizeof(fec_mask_10x_25x)); + if (err) + goto done; + + if (!MLX5_CAP_GEN(mdev, pcam_reg)) { + err = EOPNOTSUPP; + goto done; + } + + if (!MLX5_CAP_PCAM_REG(mdev, pplm)) { + err = EOPNOTSUPP; + goto done; + } + + 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) + goto done; + + /* range check input value */ + for (x = 0; x != MLX5E_MAX_FEC_10X_25X; x++) { + /* check only one bit is set, if any */ + if (fec_mask_10x_25x[x] & (fec_mask_10x_25x[x] - 1)) { + err = ERANGE; + goto done; + } + /* check a supported bit is set, if any */ + if (fec_mask_10x_25x[x] & + ~priv->params_ethtool.fec_avail_10x_25x[x]) { + err = ERANGE; + goto done; + } + fec_cap_changed |= (fec_mask_10x_25x[x] ^ + priv->params_ethtool.fec_mask_10x_25x[x]); + } + + /* check for no changes */ + if (fec_cap_changed == 0) + goto done; + + memset(in, 0, sizeof(in)); + + MLX5_SET(pplm_reg, in, local_port, 1); + + /* set new values */ + MLX5_SET(pplm_reg, in, fec_override_admin_10g_40g, fec_mask_10x_25x[0]); + MLX5_SET(pplm_reg, in, fec_override_admin_25g, fec_mask_10x_25x[1]); + MLX5_SET(pplm_reg, in, fec_override_admin_50g, fec_mask_10x_25x[1]); + MLX5_SET(pplm_reg, in, fec_override_admin_56g, fec_mask_10x_25x[2]); + MLX5_SET(pplm_reg, in, fec_override_admin_100g, fec_mask_10x_25x[3]); + + /* preserve other values */ + MLX5_SET(pplm_reg, in, fec_override_admin_50g_1x, priv->params_ethtool.fec_mask_50x[0]); + MLX5_SET(pplm_reg, in, fec_override_admin_100g_2x, priv->params_ethtool.fec_mask_50x[1]); + MLX5_SET(pplm_reg, in, fec_override_admin_200g_4x, priv->params_ethtool.fec_mask_50x[2]); + MLX5_SET(pplm_reg, in, fec_override_admin_400g_8x, priv->params_ethtool.fec_mask_50x[3]); + + /* send new value to the firmware */ + err = -mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_PPLM, 0, 1); + if (err) + goto done; + + memcpy(priv->params_ethtool.fec_mask_10x_25x, fec_mask_10x_25x, + sizeof(priv->params_ethtool.fec_mask_10x_25x)); + + mlx5_toggle_port_link(priv->mdev); +done: + PRIV_UNLOCK(priv); + return (err); +} + +static int +mlx5e_fec_avail_10x_25x_handler(SYSCTL_HANDLER_ARGS) +{ + struct mlx5e_priv *priv = arg1; + int err; + + PRIV_LOCK(priv); + err = SYSCTL_OUT(req, priv->params_ethtool.fec_avail_10x_25x, + sizeof(priv->params_ethtool.fec_avail_10x_25x)); + PRIV_UNLOCK(priv); + return (err); +} + +static int +mlx5e_fec_mask_50x_handler(SYSCTL_HANDLER_ARGS) +{ + struct mlx5e_priv *priv = arg1; + struct mlx5_core_dev *mdev = priv->mdev; + u32 out[MLX5_ST_SZ_DW(pplm_reg)] = {}; + u32 in[MLX5_ST_SZ_DW(pplm_reg)] = {}; + const int sz = MLX5_ST_SZ_BYTES(pplm_reg); + u16 fec_mask_50x[MLX5E_MAX_FEC_50X]; + u16 fec_cap_changed = 0; + u8 x; + int err; + + PRIV_LOCK(priv); + err = SYSCTL_OUT(req, priv->params_ethtool.fec_mask_50x, + sizeof(priv->params_ethtool.fec_mask_50x)); + if (err || !req->newptr) + goto done; + + err = SYSCTL_IN(req, fec_mask_50x, + sizeof(fec_mask_50x)); + if (err) + goto done; + + if (!MLX5_CAP_GEN(mdev, pcam_reg)) { + err = EOPNOTSUPP; + goto done; + } + + if (!MLX5_CAP_PCAM_REG(mdev, pplm)) { + err = EOPNOTSUPP; + goto done; + } + + 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) + goto done; + + /* range check input value */ + for (x = 0; x != MLX5E_MAX_FEC_50X; x++) { + /* check only one bit is set, if any */ + if (fec_mask_50x[x] & (fec_mask_50x[x] - 1)) { + err = ERANGE; + goto done; + } + /* check a supported bit is set, if any */ + if (fec_mask_50x[x] & + ~priv->params_ethtool.fec_avail_50x[x]) { + err = ERANGE; + goto done; + } + fec_cap_changed |= (fec_mask_50x[x] ^ + priv->params_ethtool.fec_mask_50x[x]); + } + + /* check for no changes */ + if (fec_cap_changed == 0) + goto done; + + memset(in, 0, sizeof(in)); + + MLX5_SET(pplm_reg, in, local_port, 1); + + /* set new values */ + MLX5_SET(pplm_reg, in, fec_override_admin_50g_1x, fec_mask_50x[0]); + MLX5_SET(pplm_reg, in, fec_override_admin_100g_2x, fec_mask_50x[1]); + MLX5_SET(pplm_reg, in, fec_override_admin_200g_4x, fec_mask_50x[2]); + MLX5_SET(pplm_reg, in, fec_override_admin_400g_8x, fec_mask_50x[3]); + + /* preserve other values */ + MLX5_SET(pplm_reg, in, fec_override_admin_10g_40g, priv->params_ethtool.fec_mask_10x_25x[0]); + MLX5_SET(pplm_reg, in, fec_override_admin_25g, priv->params_ethtool.fec_mask_10x_25x[1]); + MLX5_SET(pplm_reg, in, fec_override_admin_50g, priv->params_ethtool.fec_mask_10x_25x[1]); + MLX5_SET(pplm_reg, in, fec_override_admin_56g, priv->params_ethtool.fec_mask_10x_25x[2]); + MLX5_SET(pplm_reg, in, fec_override_admin_100g, priv->params_ethtool.fec_mask_10x_25x[3]); + + /* send new value to the firmware */ + err = -mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_PPLM, 0, 1); + if (err) + goto done; + + memcpy(priv->params_ethtool.fec_mask_50x, fec_mask_50x, + sizeof(priv->params_ethtool.fec_mask_50x)); + + mlx5_toggle_port_link(priv->mdev); +done: + PRIV_UNLOCK(priv); + return (err); +} + +static int +mlx5e_fec_avail_50x_handler(SYSCTL_HANDLER_ARGS) +{ + struct mlx5e_priv *priv = arg1; + int err; + + PRIV_LOCK(priv); + err = SYSCTL_OUT(req, priv->params_ethtool.fec_avail_50x, + sizeof(priv->params_ethtool.fec_avail_50x)); + PRIV_UNLOCK(priv); + return (err); +} + +static int mlx5e_trust_state_handler(SYSCTL_HANDLER_ARGS) { struct mlx5e_priv *priv = arg1; @@ -1046,7 +1325,9 @@ mlx5e_create_diagnostics(struct mlx5e_priv *priv) void mlx5e_create_ethtool(struct mlx5e_priv *priv) { - struct sysctl_oid *node, *qos_node; + struct sysctl_oid *fec_node; + struct sysctl_oid *qos_node; + struct sysctl_oid *node; const char *pnameunit; struct mlx5e_port_buffer port_buffer; unsigned x; @@ -1125,6 +1406,54 @@ mlx5e_create_ethtool(struct mlx5e_priv *priv) mlx5e_ethtool_handler(NULL, priv, x, NULL); #endif } + } + + /* create fec node */ + fec_node = SYSCTL_ADD_NODE(&priv->sysctl_ctx, + SYSCTL_CHILDREN(node), OID_AUTO, + "fec", CTLFLAG_RW, NULL, "Forward Error Correction"); + if (fec_node == NULL) + return; + + if (mlx5e_fec_update(priv) == 0) { + SYSCTL_ADD_U32(&priv->sysctl_ctx, SYSCTL_CHILDREN(fec_node), OID_AUTO, + "mode_active", CTLFLAG_RD | CTLFLAG_MPSAFE, + &priv->params_ethtool.fec_mode_active, 0, + "Current FEC mode bit, if any."); + + SYSCTL_ADD_PROC(&priv->sysctl_ctx, SYSCTL_CHILDREN(fec_node), OID_AUTO, + "mask_10x_25x", CTLTYPE_U8 | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, + priv, 0, &mlx5e_fec_mask_10x_25x_handler, "CU", + "Set FEC masks for 10G_40G, 25G_50G, 56G, 100G respectivly. " + "0:Auto " + "1:NOFEC " + "2:FIRECODE " + "4:RS"); + + SYSCTL_ADD_PROC(&priv->sysctl_ctx, SYSCTL_CHILDREN(fec_node), OID_AUTO, + "avail_10x_25x", CTLTYPE_U8 | CTLFLAG_RD | CTLFLAG_MPSAFE, + priv, 0, &mlx5e_fec_avail_10x_25x_handler, "CU", + "Get available FEC bits for 10G_40G, 25G_50G, 56G, 100G respectivly. " + "0:Auto " + "1:NOFEC " + "2:FIRECODE " + "4:RS"); + + SYSCTL_ADD_PROC(&priv->sysctl_ctx, SYSCTL_CHILDREN(fec_node), OID_AUTO, + "mask_50x", CTLTYPE_U16 | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, + priv, 0, &mlx5e_fec_mask_50x_handler, "SU", + "Set FEC masks for 50G 1x, 100G 2x, 200G 4x, 400G 8x respectivly. " + "0:Auto " + "128:RS " + "512:LL RS"); + + SYSCTL_ADD_PROC(&priv->sysctl_ctx, SYSCTL_CHILDREN(fec_node), OID_AUTO, + "avail_50x", CTLTYPE_U16 | CTLFLAG_RD | CTLFLAG_MPSAFE, + priv, 0, &mlx5e_fec_avail_50x_handler, "SU", + "Get available FEC bits for 50G 1x, 100G 2x, 200G 4x, 400G 8x respectivly. " + "0:Auto " + "128:RS " + "512:LL RS"); } SYSCTL_ADD_PROC(&priv->sysctl_ctx, SYSCTL_CHILDREN(node), OID_AUTO, Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Mon Oct 7 09:49:03 2019 (r353242) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Mon Oct 7 09:51:03 2019 (r353243) @@ -859,6 +859,7 @@ mlx5e_update_stats_locked(struct mlx5e_priv *priv) u64 rx_packets = 0; u64 rx_bytes = 0; u32 rx_out_of_buffer = 0; + int error; int i; int j; @@ -1015,12 +1016,19 @@ free_out: /* Update diagnostics, if any */ if (priv->params_ethtool.diag_pci_enable || priv->params_ethtool.diag_general_enable) { - int error = mlx5_core_get_diagnostics_full(mdev, + error = mlx5_core_get_diagnostics_full(mdev, priv->params_ethtool.diag_pci_enable ? &priv->params_pci : NULL, priv->params_ethtool.diag_general_enable ? &priv->params_general : NULL); if (error != 0) mlx5_en_err(priv->ifp, "Failed reading diagnostics: %d\n", error); + } + + /* Update FEC, if any */ + error = mlx5e_fec_update(priv); + if (error != 0 && error != EOPNOTSUPP) { + mlx5_en_err(priv->ifp, + "Updating FEC failed: %d\n", error); } } Modified: stable/12/sys/dev/mlx5/mlx5_ifc.h ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_ifc.h Mon Oct 7 09:49:03 2019 (r353242) +++ stable/12/sys/dev/mlx5/mlx5_ifc.h Mon Oct 7 09:51:03 2019 (r353243) @@ -7992,31 +7992,47 @@ struct mlx5_ifc_pplr_reg_bits { }; struct mlx5_ifc_pplm_reg_bits { - u8 reserved_0[0x8]; - u8 local_port[0x8]; - u8 reserved_1[0x10]; + u8 reserved_at_0[0x8]; + u8 local_port[0x8]; + u8 reserved_at_10[0x10]; - u8 reserved_2[0x20]; + u8 reserved_at_20[0x20]; - u8 port_profile_mode[0x8]; - u8 static_port_profile[0x8]; - u8 active_port_profile[0x8]; - u8 reserved_3[0x8]; + u8 port_profile_mode[0x8]; + u8 static_port_profile[0x8]; + u8 active_port_profile[0x8]; + u8 reserved_at_58[0x8]; - u8 retransmission_active[0x8]; - u8 fec_mode_active[0x18]; + u8 retransmission_active[0x8]; + u8 fec_mode_active[0x18]; - u8 reserved_4[0x10]; - u8 v_100g_fec_override_cap[0x4]; - u8 v_50g_fec_override_cap[0x4]; - u8 v_25g_fec_override_cap[0x4]; - u8 v_10g_40g_fec_override_cap[0x4]; + u8 rs_fec_correction_bypass_cap[0x4]; + u8 reserved_at_84[0x8]; + u8 fec_override_cap_56g[0x4]; + u8 fec_override_cap_100g[0x4]; + u8 fec_override_cap_50g[0x4]; + u8 fec_override_cap_25g[0x4]; + u8 fec_override_cap_10g_40g[0x4]; - u8 reserved_5[0x10]; - u8 v_100g_fec_override_admin[0x4]; - u8 v_50g_fec_override_admin[0x4]; - u8 v_25g_fec_override_admin[0x4]; - u8 v_10g_40g_fec_override_admin[0x4]; + u8 rs_fec_correction_bypass_admin[0x4]; + u8 reserved_at_a4[0x8]; + u8 fec_override_admin_56g[0x4]; + u8 fec_override_admin_100g[0x4]; + u8 fec_override_admin_50g[0x4]; + u8 fec_override_admin_25g[0x4]; + u8 fec_override_admin_10g_40g[0x4]; + + u8 fec_override_cap_400g_8x[0x10]; + u8 fec_override_cap_200g_4x[0x10]; + u8 fec_override_cap_100g_2x[0x10]; + u8 fec_override_cap_50g_1x[0x10]; + + u8 fec_override_admin_400g_8x[0x10]; + u8 fec_override_admin_200g_4x[0x10]; + u8 fec_override_admin_100g_2x[0x10]; + u8 fec_override_admin_50g_1x[0x10]; + + u8 reserved_at_140[0xC0]; }; struct mlx5_ifc_ppll_reg_bits { @@ -8610,6 +8626,22 @@ struct mlx5_ifc_pcam_enhanced_features_bits { u8 ppcnt_statistical_group[0x1]; }; +struct mlx5_ifc_pcam_regs_5000_to_507f_bits { + u8 port_access_reg_cap_mask_127_to_96[0x20]; + u8 port_access_reg_cap_mask_95_to_64[0x20]; + + u8 port_access_reg_cap_mask_63_to_36[0x1c]; + u8 pplm[0x1]; + u8 port_access_reg_cap_mask_34_to_32[0x3]; + + u8 port_access_reg_cap_mask_31_to_13[0x13]; + u8 pbmc[0x1]; + u8 pptb[0x1]; + u8 port_access_reg_cap_mask_10_to_09[0x2]; + u8 ppcnt[0x1]; + u8 port_access_reg_cap_mask_07_to_00[0x8]; +}; + struct mlx5_ifc_pcam_reg_bits { u8 reserved_at_0[0x8]; u8 feature_group[0x8]; @@ -8619,6 +8651,7 @@ struct mlx5_ifc_pcam_reg_bits { u8 reserved_at_20[0x20]; union { + struct mlx5_ifc_pcam_regs_5000_to_507f_bits regs_5000_to_507f; u8 reserved_at_0[0x80]; } port_access_reg_cap_mask; From owner-svn-src-stable-12@freebsd.org Mon Oct 7 09:53:14 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2283C128EFA; Mon, 7 Oct 2019 09:53:14 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46mwlZ06fZz3FTk; Mon, 7 Oct 2019 09:53:13 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BE681CE6C; Mon, 7 Oct 2019 09:53:13 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x979rDfU005551; Mon, 7 Oct 2019 09:53:13 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x979rDmh005547; Mon, 7 Oct 2019 09:53:13 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201910070953.x979rDmh005547@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Oct 2019 09:53:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353245 - stable/12/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 353245 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Oct 2019 09:53:14 -0000 Author: hselasky Date: Mon Oct 7 09:53:12 2019 New Revision: 353245 URL: https://svnweb.freebsd.org/changeset/base/353245 Log: MFC r352986: Return an error from ioctl(MLX5_FW_RESET) if reset was rejected in mlx5core. Submitted by: kib@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_core.h stable/12/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c stable/12/sys/dev/mlx5/mlx5_core/mlx5_health.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_core.h ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_core.h Mon Oct 7 09:52:10 2019 (r353244) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_core.h Mon Oct 7 09:53:12 2019 (r353245) @@ -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: stable/12/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Mon Oct 7 09:52:10 2019 (r353244) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Mon Oct 7 09:53:12 2019 (r353245) @@ -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(&mdev->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(&mdev->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, &mdev); if (error != 0) break; - mlx5_fwdump(mdev); + error = mlx5_fwdump(mdev); break; case MLX5_FW_UPDATE: if ((fflag & FWRITE) == 0) { Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_health.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_health.c Mon Oct 7 09:52:10 2019 (r353244) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_health.c Mon Oct 7 09:53:12 2019 (r353245) @@ -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; } From owner-svn-src-stable-12@freebsd.org Mon Oct 7 09:55:14 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AA438129042; Mon, 7 Oct 2019 09:55:14 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46mwnt3n9Fz3FnC; Mon, 7 Oct 2019 09:55:14 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 64C91CE6E; Mon, 7 Oct 2019 09:55:14 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x979tE5d005819; Mon, 7 Oct 2019 09:55:14 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x979tDiY005817; Mon, 7 Oct 2019 09:55:13 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201910070955.x979tDiY005817@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Oct 2019 09:55:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353247 - stable/12/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 353247 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Oct 2019 09:55:14 -0000 Author: hselasky Date: Mon Oct 7 09:55:13 2019 New Revision: 353247 URL: https://svnweb.freebsd.org/changeset/base/353247 Log: MFC r352987: Remove mkey_be from channel structure in mlx5en(4). Use value from priv structure instead. This saves some space in the channel structure. Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_en/en.h stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/en.h Mon Oct 7 09:54:08 2019 (r353246) +++ stable/12/sys/dev/mlx5/mlx5_en/en.h Mon Oct 7 09:55:13 2019 (r353247) @@ -862,7 +862,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: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Mon Oct 7 09:54:08 2019 (r353246) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Mon Oct 7 09:55:13 2019 (r353247) @@ -1272,7 +1272,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(&rq->dim.work, mlx5e_dim_work); @@ -1628,7 +1628,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, /* setup send tag */ c->tag.m_snd_tag.ifp = priv->ifp; 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 */ From owner-svn-src-stable-12@freebsd.org Mon Oct 7 09:57:57 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A92DF1291A8; Mon, 7 Oct 2019 09:57:57 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46mws142jzz3G59; Mon, 7 Oct 2019 09:57:57 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6EAA2CE71; Mon, 7 Oct 2019 09:57:57 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x979vv84006106; Mon, 7 Oct 2019 09:57:57 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x979vvH5006105; Mon, 7 Oct 2019 09:57:57 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201910070957.x979vvH5006105@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Oct 2019 09:57:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353249 - stable/12/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 353249 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Oct 2019 09:57:57 -0000 Author: hselasky Date: Mon Oct 7 09:57:57 2019 New Revision: 353249 URL: https://svnweb.freebsd.org/changeset/base/353249 Log: MFC r352988: Remove unused cpu field from channel structure in mlx5en(4). Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_en/en.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/en.h Mon Oct 7 09:57:14 2019 (r353248) +++ stable/12/sys/dev/mlx5/mlx5_en/en.h Mon Oct 7 09:57:57 2019 (r353249) @@ -867,7 +867,6 @@ struct mlx5e_channel { /* control */ struct mlx5e_priv *priv; int ix; - int cpu; } __aligned(MLX5E_CACHELINE_SIZE); enum mlx5e_traffic_types { From owner-svn-src-stable-12@freebsd.org Mon Oct 7 10:09:27 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A96A0129527; Mon, 7 Oct 2019 10:09:27 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46mx6H41qYz3GlY; Mon, 7 Oct 2019 10:09:27 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 691FED031; Mon, 7 Oct 2019 10:09:27 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x97A9RoD012081; Mon, 7 Oct 2019 10:09:27 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x97A9RhY012079; Mon, 7 Oct 2019 10:09:27 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201910071009.x97A9RhY012079@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Oct 2019 10:09:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353251 - stable/12/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 353251 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Oct 2019 10:09:27 -0000 Author: hselasky Date: Mon Oct 7 10:09:26 2019 New Revision: 353251 URL: https://svnweb.freebsd.org/changeset/base/353251 Log: MFC r352989: 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. Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_en/en.h stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/en.h Mon Oct 7 09:58:36 2019 (r353250) +++ stable/12/sys/dev/mlx5/mlx5_en/en.h Mon Oct 7 10:09:26 2019 (r353251) @@ -138,6 +138,10 @@ #define MLX5E_100MB (100000) #define MLX5E_1GB (1000000) +#define MLX5E_ZERO(ptr, field) \ + memset(&(ptr)->field, 0, \ + sizeof(*(ptr)) - __offsetof(__typeof(*(ptr)), field)) + MALLOC_DECLARE(M_MLX5EN); struct mlx5_core_dev; @@ -740,15 +744,18 @@ struct mlx5e_rq_mbuf { }; struct mlx5e_rq { + /* persistant fields */ + struct mtx mtx; + struct mlx5e_rq_stats stats; + /* data path */ +#define mlx5e_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; @@ -782,11 +789,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 */ +#define mlx5e_sq_zero_start dma_tag + bus_dma_tag_t dma_tag; + /* dirtied @completion */ u16 cc; @@ -805,7 +816,6 @@ struct mlx5e_sq { u32 d32[2]; u64 d64; } doorbell; - struct mlx5e_sq_stats stats; struct mlx5e_cq cq; @@ -858,13 +868,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: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Mon Oct 7 09:58:36 2019 (r353250) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Mon Oct 7 10:09:26 2019 (r353251) @@ -1480,8 +1480,6 @@ mlx5e_close_rq(struct mlx5e_rq *rq) callout_stop(&rq->watchdog); mtx_unlock(&rq->mtx); - callout_drain(&rq->watchdog); - mlx5e_modify_rq(rq, MLX5_RQC_STATE_RDY, MLX5_RQC_STATE_ERR); } @@ -1563,7 +1561,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(&c->sq[i].lock); mlx5e_update_sq_inline(&c->sq[i]); mtx_unlock(&c->sq[i].lock); @@ -1750,6 +1748,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); @@ -1861,9 +1865,6 @@ mlx5e_drain_sq(struct mlx5e_sq *sq) mlx5e_sq_send_nops_locked(sq, 1); mtx_unlock(&sq->lock); - /* make sure it is safe to free the callout */ - callout_drain(&sq->cev_callout); - /* wait till SQ is empty or link is down */ mtx_lock(&sq->lock); while (sq->cc != sq->pc && @@ -2048,7 +2049,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, &cparam->tx_cq, &c->sq[tc].cq, &mlx5e_tx_cq_comp, c->ix); @@ -2069,7 +2070,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(&c->sq[tc].cq); } @@ -2080,7 +2081,7 @@ mlx5e_open_sqs(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++) { err = mlx5e_open_sq(c, tc, &cparam->sq, &c->sq[tc]); if (err) goto err_close_sqs; @@ -2100,20 +2101,28 @@ mlx5e_close_sqs_wait(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_sq_wait(&c->sq[tc]); } static void -mlx5e_chan_mtx_init(struct mlx5e_channel *c) +mlx5e_chan_static_init(struct mlx5e_priv *priv, struct mlx5e_channel *c, int ix) { int tc; + /* setup priv and channel number */ + c->priv = priv; + c->ix = ix; + + /* setup send tag */ + c->tag.m_snd_tag.ifp = priv->ifp; + c->tag.type = IF_SND_TAG_TYPE_UNLIMITED; + mtx_init(&c->rq.mtx, "mlx5rx", MTX_NETWORK_LOCK, MTX_DEF); callout_init_mtx(&c->rq.watchdog, &c->rq.mtx, 0); - for (tc = 0; tc < c->num_tc; tc++) { + for (tc = 0; tc != MLX5E_MAX_TX_NUM_TC; tc++) { struct mlx5e_sq *sq = c->sq + tc; mtx_init(&sq->lock, "mlx5tx", @@ -2122,47 +2131,37 @@ mlx5e_chan_mtx_init(struct mlx5e_channel *c) MTX_NETWORK_LOCK " TX", MTX_DEF); callout_init_mtx(&sq->cev_callout, &sq->lock, 0); - - 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; } } static void -mlx5e_chan_mtx_destroy(struct mlx5e_channel *c) +mlx5e_chan_static_destroy(struct mlx5e_channel *c) { int tc; + callout_drain(&c->rq.watchdog); + mtx_destroy(&c->rq.mtx); - for (tc = 0; tc < c->num_tc; tc++) { + for (tc = 0; tc != MLX5E_MAX_TX_NUM_TC; tc++) { + callout_drain(&c->sq[tc].cev_callout); mtx_destroy(&c->sq[tc].lock); mtx_destroy(&c->sq[tc].comp_lock); } } static int -mlx5e_open_channel(struct mlx5e_priv *priv, int ix, +mlx5e_open_channel(struct mlx5e_priv *priv, struct mlx5e_channel_param *cparam, struct mlx5e_channel *c) { - int err; + int i, err; - memset(c, 0, sizeof(*c)); + /* zero non-persistant data */ + MLX5E_ZERO(&c->rq, mlx5e_rq_zero_start); + for (i = 0; i != priv->num_tc; i++) + MLX5E_ZERO(&c->sq[i], mlx5e_sq_zero_start); - c->priv = priv; - c->ix = ix; - /* setup send tag */ - c->tag.m_snd_tag.ifp = priv->ifp; - c->tag.type = IF_SND_TAG_TYPE_UNLIMITED; - c->num_tc = priv->num_tc; - - /* init mutexes */ - mlx5e_chan_mtx_init(c); - /* open transmit completion queue */ err = mlx5e_open_tx_cqs(c, cparam); if (err) @@ -2197,8 +2196,6 @@ err_close_tx_cqs: mlx5e_close_tx_cqs(c); err_free: - /* destroy mutexes */ - mlx5e_chan_mtx_destroy(c); return (err); } @@ -2214,8 +2211,6 @@ mlx5e_close_channel_wait(struct mlx5e_channel *c) mlx5e_close_rq_wait(&c->rq); mlx5e_close_sqs_wait(c); mlx5e_close_tx_cqs(c); - /* destroy mutexes */ - mlx5e_chan_mtx_destroy(c); } static int @@ -2411,14 +2406,16 @@ mlx5e_build_channel_param(struct mlx5e_priv *priv, static int mlx5e_open_channels(struct mlx5e_priv *priv) { - struct mlx5e_channel_param cparam; + struct mlx5e_channel_param *cparam; int err; int i; int j; - mlx5e_build_channel_param(priv, &cparam); + cparam = malloc(sizeof(*cparam), M_MLX5EN, M_WAITOK); + + mlx5e_build_channel_param(priv, cparam); for (i = 0; i < priv->params.num_channels; i++) { - err = mlx5e_open_channel(priv, i, &cparam, &priv->channel[i]); + err = mlx5e_open_channel(priv, cparam, &priv->channel[i]); if (err) goto err_close_channels; } @@ -2428,6 +2425,7 @@ mlx5e_open_channels(struct mlx5e_priv *priv) if (err) goto err_close_channels; } + free(cparam, M_MLX5EN); return (0); err_close_channels: @@ -2435,6 +2433,7 @@ err_close_channels: mlx5e_close_channel(&priv->channel[i]); mlx5e_close_channel_wait(&priv->channel[i]); } + free(cparam, M_MLX5EN); return (err); } @@ -2544,7 +2543,7 @@ mlx5e_refresh_channel_params_sub(struct mlx5e_priv *pr if (err) goto done; - for (i = 0; i != c->num_tc; i++) { + for (i = 0; i != priv->num_tc; i++) { err = mlx5e_refresh_sq_params(priv, &c->sq[i]); if (err) goto done; @@ -3599,17 +3598,26 @@ static const char *mlx5e_pport_stats_desc[] = { }; static void -mlx5e_priv_mtx_init(struct mlx5e_priv *priv) +mlx5e_priv_static_init(struct mlx5e_priv *priv, const uint32_t channels) { + uint32_t x; + mtx_init(&priv->async_events_mtx, "mlx5async", MTX_NETWORK_LOCK, MTX_DEF); sx_init(&priv->state_lock, "mlx5state"); callout_init_mtx(&priv->watchdog, &priv->async_events_mtx, 0); MLX5_INIT_DOORBELL_LOCK(&priv->doorbell_lock); + for (x = 0; x != channels; x++) + mlx5e_chan_static_init(priv, &priv->channel[x], x); } static void -mlx5e_priv_mtx_destroy(struct mlx5e_priv *priv) +mlx5e_priv_static_destroy(struct mlx5e_priv *priv, const uint32_t channels) { + uint32_t x; + + for (x = 0; x != channels; x++) + mlx5e_chan_static_destroy(&priv->channel[x]); + callout_drain(&priv->watchdog); mtx_destroy(&priv->async_events_mtx); sx_destroy(&priv->state_lock); } @@ -3639,7 +3647,7 @@ mlx5e_disable_tx_dma(struct mlx5e_channel *ch) { int i; - for (i = 0; i < ch->num_tc; i++) + for (i = 0; i < ch->priv->num_tc; i++) mlx5e_drain_sq(&ch->sq[i]); } @@ -3691,7 +3699,7 @@ mlx5e_enable_tx_dma(struct mlx5e_channel *ch) { int i; - for (i = 0; i < ch->num_tc; i++) + for (i = 0; i < ch->priv->num_tc; i++) mlx5e_resume_sq(&ch->sq[i]); } @@ -3706,8 +3714,6 @@ mlx5e_disable_rx_dma(struct mlx5e_channel *ch) callout_stop(&rq->watchdog); mtx_unlock(&rq->mtx); - callout_drain(&rq->watchdog); - err = mlx5e_modify_rq(rq, MLX5_RQC_STATE_RDY, MLX5_RQC_STATE_ERR); if (err != 0) { mlx5_en_err(rq->ifp, @@ -4126,13 +4132,15 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) priv = malloc(sizeof(*priv) + (sizeof(priv->channel[0]) * mdev->priv.eq_table.num_comp_vectors), M_MLX5EN, M_WAITOK | M_ZERO); - mlx5e_priv_mtx_init(priv); ifp = priv->ifp = if_alloc(IFT_ETHER); if (ifp == NULL) { mlx5_core_err(mdev, "if_alloc() failed\n"); goto err_free_priv; } + /* setup all static fields */ + mlx5e_priv_static_init(priv, mdev->priv.eq_table.num_comp_vectors); + ifp->if_softc = priv; if_initname(ifp, "mce", device_get_unit(mdev->pdev->dev.bsddev)); ifp->if_mtu = ETHERMTU; @@ -4359,10 +4367,10 @@ err_free_sysctl: sysctl_ctx_free(&priv->sysctl_ctx); if (priv->sysctl_debug) sysctl_ctx_free(&priv->stats.port_stats_debug.ctx); + mlx5e_priv_static_destroy(priv, mdev->priv.eq_table.num_comp_vectors); if_free(ifp); err_free_priv: - mlx5e_priv_mtx_destroy(priv); free(priv, M_MLX5EN); return (NULL); } @@ -4416,7 +4424,6 @@ mlx5e_destroy_ifp(struct mlx5_core_dev *mdev, void *vp /* unregister device */ ifmedia_removeall(&priv->media); ether_ifdetach(ifp); - if_free(ifp); #ifdef RATELIMIT mlx5e_rl_cleanup(priv); @@ -4434,7 +4441,8 @@ mlx5e_destroy_ifp(struct mlx5_core_dev *mdev, void *vp mlx5_unmap_free_uar(priv->mdev, &priv->cq_uar); mlx5e_disable_async_events(priv); flush_workqueue(priv->wq); - mlx5e_priv_mtx_destroy(priv); + mlx5e_priv_static_destroy(priv, mdev->priv.eq_table.num_comp_vectors); + if_free(ifp); free(priv, M_MLX5EN); } From owner-svn-src-stable-12@freebsd.org Mon Oct 7 10:20:24 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1B873129862; Mon, 7 Oct 2019 10:20:24 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46mxLv74Lzz3HLZ; Mon, 7 Oct 2019 10:20:23 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D29A6D1EC; Mon, 7 Oct 2019 10:20:23 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x97AKNLJ018769; Mon, 7 Oct 2019 10:20:23 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x97AKNDa018767; Mon, 7 Oct 2019 10:20:23 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201910071020.x97AKNDa018767@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Oct 2019 10:20:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353253 - in stable/12/sys/dev/mlx5: . mlx5_core X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12/sys/dev/mlx5: . mlx5_core X-SVN-Commit-Revision: 353253 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Oct 2019 10:20:24 -0000 Author: hselasky Date: Mon Oct 7 10:20:23 2019 New Revision: 353253 URL: https://svnweb.freebsd.org/changeset/base/353253 Log: MFC r352991 and 353000: 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. Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/device.h stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/device.h ============================================================================== --- stable/12/sys/dev/mlx5/device.h Mon Oct 7 10:16:50 2019 (r353252) +++ stable/12/sys/dev/mlx5/device.h Mon Oct 7 10:20:23 2019 (r353253) @@ -32,8 +32,10 @@ #include #include -#define FW_INIT_TIMEOUT_MILI 2000 -#define FW_INIT_WAIT_MS 2 +#define FW_INIT_TIMEOUT_MILI 2000 +#define FW_INIT_WAIT_MS 2 +#define FW_PRE_INIT_TIMEOUT_MILI 120000 +#define FW_INIT_WARN_MESSAGE_INTERVAL 20000 #if defined(__LITTLE_ENDIAN) #define MLX5_SET_HOST_ENDIANNESS 0 Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c Mon Oct 7 10:16:50 2019 (r353252) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c Mon Oct 7 10:20:23 2019 (r353253) @@ -676,19 +676,33 @@ static inline int fw_initializing(struct mlx5_core_dev return ioread32be(&dev->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 %u s\n", + (unsigned int)(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(&dev->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(&dev->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; } From owner-svn-src-stable-12@freebsd.org Mon Oct 7 10:23:27 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B3532129B6E; Mon, 7 Oct 2019 10:23:27 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46mxQR4JXSz3Hw6; Mon, 7 Oct 2019 10:23:27 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 77377D3B7; Mon, 7 Oct 2019 10:23:27 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x97ANR7v024408; Mon, 7 Oct 2019 10:23:27 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x97ANR9Y024407; Mon, 7 Oct 2019 10:23:27 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201910071023.x97ANR9Y024407@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Oct 2019 10:23:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353255 - stable/12/usr.sbin/mlx5tool X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/usr.sbin/mlx5tool X-SVN-Commit-Revision: 353255 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Oct 2019 10:23:27 -0000 Author: hselasky Date: Mon Oct 7 10:23:27 2019 New Revision: 353255 URL: https://svnweb.freebsd.org/changeset/base/353255 Log: MFC r352992: 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@ Sponsored by: Mellanox Technologies Modified: stable/12/usr.sbin/mlx5tool/mlx5tool.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/mlx5tool/mlx5tool.c ============================================================================== --- stable/12/usr.sbin/mlx5tool/mlx5tool.c Mon Oct 7 10:21:37 2019 (r353254) +++ stable/12/usr.sbin/mlx5tool/mlx5tool.c Mon Oct 7 10:23:27 2019 (r353255) @@ -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 ", From owner-svn-src-stable-12@freebsd.org Mon Oct 7 10:25:08 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E90EB129CBA; Mon, 7 Oct 2019 10:25:08 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46mxSN5w7Zz3J9v; Mon, 7 Oct 2019 10:25:08 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AE2C2D3BE; Mon, 7 Oct 2019 10:25:08 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x97AP8kb024651; Mon, 7 Oct 2019 10:25:08 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x97AP8Ht024650; Mon, 7 Oct 2019 10:25:08 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201910071025.x97AP8Ht024650@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Oct 2019 10:25:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353257 - stable/12/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 353257 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Oct 2019 10:25:09 -0000 Author: hselasky Date: Mon Oct 7 10:25:08 2019 New Revision: 353257 URL: https://svnweb.freebsd.org/changeset/base/353257 Log: MFC r352993: 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@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_vsc.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_vsc.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_vsc.c Mon Oct 7 10:24:19 2019 (r353256) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_vsc.c Mon Oct 7 10:25:08 2019 (r353257) @@ -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; From owner-svn-src-stable-12@freebsd.org Mon Oct 7 10:26:24 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 67347129DF6; Mon, 7 Oct 2019 10:26:24 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46mxTr26ndz3JQs; Mon, 7 Oct 2019 10:26:24 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2BE6DD3C1; Mon, 7 Oct 2019 10:26:24 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x97AQO6B024879; Mon, 7 Oct 2019 10:26:24 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x97AQOJe024878; Mon, 7 Oct 2019 10:26:24 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201910071026.x97AQOJe024878@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Oct 2019 10:26:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353259 - stable/12/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 353259 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Oct 2019 10:26:24 -0000 Author: hselasky Date: Mon Oct 7 10:26:23 2019 New Revision: 353259 URL: https://svnweb.freebsd.org/changeset/base/353259 Log: MFC r352994: Improve mlx5_fwdump_prep logging in mlx5core. Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Mon Oct 7 10:25:46 2019 (r353258) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Mon Oct 7 10:26:23 2019 (r353259) @@ -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; From owner-svn-src-stable-12@freebsd.org Mon Oct 7 10:27:51 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 41EFC129EFF; Mon, 7 Oct 2019 10:27:51 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46mxWW12n2z3JhX; Mon, 7 Oct 2019 10:27:51 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 07F0AD3C3; Mon, 7 Oct 2019 10:27:51 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x97ARoc9025103; Mon, 7 Oct 2019 10:27:50 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x97ARoZE025098; Mon, 7 Oct 2019 10:27:50 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201910071027.x97ARoZE025098@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Oct 2019 10:27:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353261 - stable/12/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 353261 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Oct 2019 10:27:51 -0000 Author: hselasky Date: Mon Oct 7 10:27:50 2019 New Revision: 353261 URL: https://svnweb.freebsd.org/changeset/base/353261 Log: MFC r352995: Only update lossy buffers config when manual PFC configuration was done in mlx5en(4). Submitted by: kib@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_en/en.h stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_port_buffer.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/en.h Mon Oct 7 10:26:57 2019 (r353260) +++ stable/12/sys/dev/mlx5/mlx5_en/en.h Mon Oct 7 10:27:50 2019 (r353261) @@ -1045,6 +1045,7 @@ struct mlx5e_priv { u_int clbr_gen; struct mlx5e_dcbx dcbx; + bool sw_is_port_buf_owner; struct mlx5e_channel channel[]; }; Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Mon Oct 7 10:26:57 2019 (r353260) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Mon Oct 7 10:27:50 2019 (r353261) @@ -3881,7 +3881,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: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_port_buffer.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_port_buffer.c Mon Oct 7 10:26:57 2019 (r353260) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_port_buffer.c Mon Oct 7 10:27:50 2019 (r353261) @@ -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, &port_buffer, &update_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, &port_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; } From owner-svn-src-stable-12@freebsd.org Mon Oct 7 10:29:31 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 64B1712A00D; Mon, 7 Oct 2019 10:29:31 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46mxYR20kxz3JxX; Mon, 7 Oct 2019 10:29:31 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 29031D3C5; Mon, 7 Oct 2019 10:29:31 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x97ATVCW025365; Mon, 7 Oct 2019 10:29:31 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x97ATVUQ025364; Mon, 7 Oct 2019 10:29:31 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201910071029.x97ATVUQ025364@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Oct 2019 10:29:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353263 - stable/12/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 353263 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Oct 2019 10:29:31 -0000 Author: hselasky Date: Mon Oct 7 10:29:30 2019 New Revision: 353263 URL: https://svnweb.freebsd.org/changeset/base/353263 Log: MFC r352996: Add print to show user a reason for rejecting buffer size change in mlx5en(4). Submitted by: kib@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_port_buffer.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_port_buffer.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_port_buffer.c Mon Oct 7 10:28:51 2019 (r353262) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_port_buffer.c Mon Oct 7 10:29:30 2019 (r353263) @@ -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(&port_buffer, xoff); + err = update_xoff_threshold(priv, &port_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, &port_buffer, &update_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, &port_buffer, &update_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(&port_buffer, xoff); + err = update_xoff_threshold(priv, &port_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(&port_buffer, xoff); + err = update_xoff_threshold(priv, &port_buffer, xoff); if (err) return err; } From owner-svn-src-stable-12@freebsd.org Mon Oct 7 10:30:49 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C7F3E12A12F; Mon, 7 Oct 2019 10:30:49 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46mxZx4xX7z3KDc; Mon, 7 Oct 2019 10:30:49 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8CFFFD4EA; Mon, 7 Oct 2019 10:30:49 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x97AUnZj025622; Mon, 7 Oct 2019 10:30:49 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x97AUnIM025621; Mon, 7 Oct 2019 10:30:49 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201910071030.x97AUnIM025621@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Oct 2019 10:30:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353265 - stable/12/sys/dev/mlx5/mlx5_core X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 353265 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Oct 2019 10:30:49 -0000 Author: hselasky Date: Mon Oct 7 10:30:49 2019 New Revision: 353265 URL: https://svnweb.freebsd.org/changeset/base/353265 Log: MFC r352997: Print numeric error_type and module_status in mlx5core in case the strings are not available. Submitted by: kib@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_eq.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_eq.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_eq.c Mon Oct 7 10:30:09 2019 (r353264) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_eq.c Mon Oct 7 10:30:49 2019 (r353265) @@ -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) From owner-svn-src-stable-12@freebsd.org Mon Oct 7 10:32:24 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E0C5A12A3E8; Mon, 7 Oct 2019 10:32:24 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46mxcm5csZz3KYk; Mon, 7 Oct 2019 10:32:24 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A5B5AD574; Mon, 7 Oct 2019 10:32:24 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x97AWO1l030961; Mon, 7 Oct 2019 10:32:24 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x97AWOT1030958; Mon, 7 Oct 2019 10:32:24 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201910071032.x97AWOT1030958@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Oct 2019 10:32:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353267 - in stable/12/sys/dev/mlx5: mlx5_core mlx5_en mlx5_ib X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12/sys/dev/mlx5: mlx5_core mlx5_en mlx5_ib X-SVN-Commit-Revision: 353267 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Oct 2019 10:32:24 -0000 Author: hselasky Date: Mon Oct 7 10:32:23 2019 New Revision: 353267 URL: https://svnweb.freebsd.org/changeset/base/353267 Log: MFC r352998: Bump driver version for mlx5core, mlx5en(4) and mlx5ib(4). Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_core.h stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_core.h ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_core/mlx5_core.h Mon Oct 7 10:31:27 2019 (r353266) +++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_core.h Mon Oct 7 10:32:23 2019 (r353267) @@ -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: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Mon Oct 7 10:31:27 2019 (r353266) +++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Mon Oct 7 10:32:23 2019 (r353267) @@ -31,9 +31,9 @@ #include #ifndef ETH_DRIVER_VERSION -#define ETH_DRIVER_VERSION "3.5.1" +#define ETH_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: stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Mon Oct 7 10:31:27 2019 (r353266) +++ stable/12/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Mon Oct 7 10:32:23 2019 (r353267) @@ -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"); From owner-svn-src-stable-12@freebsd.org Mon Oct 7 14:46:24 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 58BF3131486; Mon, 7 Oct 2019 14:46:24 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46n3Fr1g1Gz46Q8; Mon, 7 Oct 2019 14:46:24 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1CF8C182B5; Mon, 7 Oct 2019 14:46:24 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x97EkNJR081526; Mon, 7 Oct 2019 14:46:23 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x97EkNZr081525; Mon, 7 Oct 2019 14:46:23 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201910071446.x97EkNZr081525@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 7 Oct 2019 14:46:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353276 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 353276 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Oct 2019 14:46:24 -0000 Author: markj Date: Mon Oct 7 14:46:23 2019 New Revision: 353276 URL: https://svnweb.freebsd.org/changeset/base/353276 Log: MFC r353010: Disallow fcntl(F_READAHEAD) when the vnode is not a regular file. Modified: stable/12/sys/kern/kern_descrip.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/kern_descrip.c ============================================================================== --- stable/12/sys/kern/kern_descrip.c Mon Oct 7 14:24:59 2019 (r353275) +++ stable/12/sys/kern/kern_descrip.c Mon Oct 7 14:46:23 2019 (r353276) @@ -770,6 +770,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(). From owner-svn-src-stable-12@freebsd.org Mon Oct 7 20:41:55 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B652F1392FA; Mon, 7 Oct 2019 20:41:55 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46nC8348Tgz4YRd; Mon, 7 Oct 2019 20:41:55 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 724401C3B5; Mon, 7 Oct 2019 20:41:55 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x97KftWk096977; Mon, 7 Oct 2019 20:41:55 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x97KftjQ096976; Mon, 7 Oct 2019 20:41:55 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201910072041.x97KftjQ096976@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 7 Oct 2019 20:41:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353291 - in stable: 11/sys/opencrypto 12/sys/opencrypto X-SVN-Group: stable-12 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 11/sys/opencrypto 12/sys/opencrypto X-SVN-Commit-Revision: 353291 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Oct 2019 20:41:55 -0000 Author: jhb Date: Mon Oct 7 20:41:55 2019 New Revision: 353291 URL: https://svnweb.freebsd.org/changeset/base/353291 Log: MFC 351557: Adjust the deprecated warnings for /dev/crypto to be less noisy. Warn when actual operations are performed instead of when sessions are created. The /dev/crypto engine in OpenSSL 1.0.x tries to create sessions for all possible algorithms each time it is initialized resulting in spurious warnings. Modified: stable/12/sys/opencrypto/cryptodev.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/opencrypto/cryptodev.c Directory Properties: stable/11/ (props changed) Modified: stable/12/sys/opencrypto/cryptodev.c ============================================================================== --- stable/12/sys/opencrypto/cryptodev.c Mon Oct 7 20:35:04 2019 (r353290) +++ stable/12/sys/opencrypto/cryptodev.c Mon Oct 7 20:41:55 2019 (r353291) @@ -391,8 +391,6 @@ cryptof_ioctl( struct crypt_op copc; struct crypt_kop kopc; #endif - static struct timeval arc4warn, blfwarn, castwarn, deswarn, md5warn; - static struct timeval skipwarn, tdeswarn; switch (cmd) { case CIOCGSESSION: @@ -413,28 +411,18 @@ cryptof_ioctl( case 0: break; case CRYPTO_DES_CBC: - if (ratecheck(&deswarn, &warninterval)) - gone_in(13, "DES cipher via /dev/crypto"); txform = &enc_xform_des; break; case CRYPTO_3DES_CBC: - if (ratecheck(&tdeswarn, &warninterval)) - gone_in(13, "3DES cipher via /dev/crypto"); txform = &enc_xform_3des; break; case CRYPTO_BLF_CBC: - if (ratecheck(&blfwarn, &warninterval)) - gone_in(13, "Blowfish cipher via /dev/crypto"); txform = &enc_xform_blf; break; case CRYPTO_CAST_CBC: - if (ratecheck(&castwarn, &warninterval)) - gone_in(13, "CAST128 cipher via /dev/crypto"); txform = &enc_xform_cast5; break; case CRYPTO_SKIPJACK_CBC: - if (ratecheck(&skipwarn, &warninterval)) - gone_in(13, "Skipjack cipher via /dev/crypto"); txform = &enc_xform_skipjack; break; case CRYPTO_AES_CBC: @@ -447,8 +435,6 @@ cryptof_ioctl( txform = &enc_xform_null; break; case CRYPTO_ARC4: - if (ratecheck(&arc4warn, &warninterval)) - gone_in(13, "ARC4 cipher via /dev/crypto"); txform = &enc_xform_arc4; break; case CRYPTO_CAMELLIA_CBC: @@ -477,9 +463,6 @@ cryptof_ioctl( case 0: break; case CRYPTO_MD5_HMAC: - if (ratecheck(&md5warn, &warninterval)) - gone_in(13, - "MD5-HMAC authenticator via /dev/crypto"); thash = &auth_hash_hmac_md5; break; case CRYPTO_POLY1305: @@ -815,6 +798,47 @@ cod_free(struct cryptop_data *cod) free(cod, M_XDATA); } +static void +cryptodev_warn(struct csession *cse) +{ + static struct timeval arc4warn, blfwarn, castwarn, deswarn, md5warn; + static struct timeval skipwarn, tdeswarn; + + switch (cse->cipher) { + case CRYPTO_DES_CBC: + if (ratecheck(&deswarn, &warninterval)) + gone_in(13, "DES cipher via /dev/crypto"); + break; + case CRYPTO_3DES_CBC: + if (ratecheck(&tdeswarn, &warninterval)) + gone_in(13, "3DES cipher via /dev/crypto"); + break; + case CRYPTO_BLF_CBC: + if (ratecheck(&blfwarn, &warninterval)) + gone_in(13, "Blowfish cipher via /dev/crypto"); + break; + case CRYPTO_CAST_CBC: + if (ratecheck(&castwarn, &warninterval)) + gone_in(13, "CAST128 cipher via /dev/crypto"); + break; + case CRYPTO_SKIPJACK_CBC: + if (ratecheck(&skipwarn, &warninterval)) + gone_in(13, "Skipjack cipher via /dev/crypto"); + break; + case CRYPTO_ARC4: + if (ratecheck(&arc4warn, &warninterval)) + gone_in(13, "ARC4 cipher via /dev/crypto"); + break; + } + + switch (cse->mac) { + case CRYPTO_MD5_HMAC: + if (ratecheck(&md5warn, &warninterval)) + gone_in(13, "MD5-HMAC authenticator via /dev/crypto"); + break; + } +} + static int cryptodev_op( struct csession *cse, @@ -937,6 +961,7 @@ cryptodev_op( error = EINVAL; goto bail; } + cryptodev_warn(cse); again: /* @@ -1106,6 +1131,7 @@ cryptodev_aead( SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); goto bail; } + cryptodev_warn(cse); again: /* * Let the dispatch run unlocked, then, interlock against the From owner-svn-src-stable-12@freebsd.org Tue Oct 8 10:24:48 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D34BF1431A2; Tue, 8 Oct 2019 10:24:48 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46nYPX3zxMz3FK8; Tue, 8 Oct 2019 10:24:48 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6C27F26928; Tue, 8 Oct 2019 10:24:48 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x98AOm29089651; Tue, 8 Oct 2019 10:24:48 GMT (envelope-from tijl@FreeBSD.org) Received: (from tijl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x98AOmOe089650; Tue, 8 Oct 2019 10:24:48 GMT (envelope-from tijl@FreeBSD.org) Message-Id: <201910081024.x98AOmOe089650@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tijl set sender to tijl@FreeBSD.org using -f From: Tijl Coosemans Date: Tue, 8 Oct 2019 10:24:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353300 - stable/12/sys/compat/linsysfs X-SVN-Group: stable-12 X-SVN-Commit-Author: tijl X-SVN-Commit-Paths: stable/12/sys/compat/linsysfs X-SVN-Commit-Revision: 353300 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Oct 2019 10:24:48 -0000 Author: tijl Date: Tue Oct 8 10:24:48 2019 New Revision: 353300 URL: https://svnweb.freebsd.org/changeset/base/353300 Log: MFC r352618: Create a "drm" subdirectory for drm devices in linsysfs. Recent versions of linux libdrm check for the existence of this directory: https://cgit.freedesktop.org/mesa/drm/commit/?id=f8392583418aef5e27bfed9989aeb601e20cc96d Modified: stable/12/sys/compat/linsysfs/linsysfs.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linsysfs/linsysfs.c ============================================================================== --- stable/12/sys/compat/linsysfs/linsysfs.c Tue Oct 8 10:24:01 2019 (r353299) +++ stable/12/sys/compat/linsysfs/linsysfs.c Tue Oct 8 10:24:48 2019 (r353300) @@ -520,6 +520,7 @@ linsysfs_run_bus(device_t dev, struct pfs_node *dir, s device_get_unit(dev) >= 0) { dinfo = device_get_ivars(parent); if (dinfo != NULL && dinfo->cfg.baseclass == PCIC_DISPLAY) { + pfs_create_dir(dir, "drm", NULL, NULL, NULL, 0); sprintf(devname, "226:%d", device_get_unit(dev)); sub_dir = pfs_create_dir(chardev, From owner-svn-src-stable-12@freebsd.org Tue Oct 8 18:06:03 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 999531327CB; Tue, 8 Oct 2019 18:06:03 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46nldl3XGZz4L4Z; Tue, 8 Oct 2019 18:06:03 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5D8294037; Tue, 8 Oct 2019 18:06:03 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x98I63Dp061671; Tue, 8 Oct 2019 18:06:03 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x98I63Cb061670; Tue, 8 Oct 2019 18:06:03 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201910081806.x98I63Cb061670@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Tue, 8 Oct 2019 18:06:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353315 - stable/12 X-SVN-Group: stable-12 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: stable/12 X-SVN-Commit-Revision: 353315 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Oct 2019 18:06:03 -0000 Author: brooks Date: Tue Oct 8 18:06:02 2019 New Revision: 353315 URL: https://svnweb.freebsd.org/changeset/base/353315 Log: MFC r352919: Update cloudabi(32|64) sysents with "make sysent". Modified: stable/12/Makefile.inc1 Directory Properties: stable/12/ (props changed) Modified: stable/12/Makefile.inc1 ============================================================================== --- stable/12/Makefile.inc1 Tue Oct 8 17:55:45 2019 (r353314) +++ stable/12/Makefile.inc1 Tue Oct 8 18:06:02 2019 (r353315) @@ -1425,6 +1425,8 @@ packageworld: .PHONY _sysent_dirs= sys/kern _sysent_dirs+= sys/compat/freebsd32 +_sysent_dirs+= sys/compat/cloudabi32 \ + sys/compat/cloudabi64 _sysent_dirs+= sys/i386/ibcs2 _sysent_dirs+= sys/amd64/linux \ sys/amd64/linux32 \ From owner-svn-src-stable-12@freebsd.org Tue Oct 8 20:14:34 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4C04F135CFD; Tue, 8 Oct 2019 20:14:34 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46npV21Gr0z4SdF; Tue, 8 Oct 2019 20:14:34 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0FBF657ED; Tue, 8 Oct 2019 20:14:34 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x98KEX7w039697; Tue, 8 Oct 2019 20:14:33 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x98KEXlb039696; Tue, 8 Oct 2019 20:14:33 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <201910082014.x98KEXlb039696@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Tue, 8 Oct 2019 20:14:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353322 - stable/12/share/mk X-SVN-Group: stable-12 X-SVN-Commit-Author: sjg X-SVN-Commit-Paths: stable/12/share/mk X-SVN-Commit-Revision: 353322 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Oct 2019 20:14:34 -0000 Author: sjg Date: Tue Oct 8 20:14:33 2019 New Revision: 353322 URL: https://svnweb.freebsd.org/changeset/base/353322 Log: Need to use ${${_${group}DIR_${file}}} for STAGE_DIR STAGE_DIR.${${_${group}DIR_${file}}:C,[/*],_,g} was getting ${STAGE_OBJTOP}BINDIR rather than ${STAGE_OBJTOP}${BINDIR} when FILESDIR=BINDIR MFC of r352942 Reviewed by: stevek Differential Revision: https://reviews.freebsd.org/D21858 Modified: stable/12/share/mk/bsd.files.mk Modified: stable/12/share/mk/bsd.files.mk ============================================================================== --- stable/12/share/mk/bsd.files.mk Tue Oct 8 19:49:25 2019 (r353321) +++ stable/12/share/mk/bsd.files.mk Tue Oct 8 20:14:33 2019 (r353322) @@ -105,7 +105,7 @@ STAGE_AS_${file}= ${${group}NAME_${file}} # we need to expand ${group}DIR_${file} and replace # all '/' and '*' with '_' to make a safe target name. STAGE_AS_SETS+= ${${_${group}DIR_${file}}:C,[/*],_,g} -STAGE_DIR.${${_${group}DIR_${file}}:C,[/*],_,g}= ${STAGE_OBJTOP}${${group}DIR_${file}} +STAGE_DIR.${${_${group}DIR_${file}}:C,[/*],_,g}= ${STAGE_OBJTOP}${${_${group}DIR_${file}}} stage_as.${${_${group}DIR_${file}}:C,[/*],_,g}: ${file} installfiles-${group}: _${group}INS1_${file} From owner-svn-src-stable-12@freebsd.org Wed Oct 9 09:40:03 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E6FC6146AC6; Wed, 9 Oct 2019 09:40:03 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46p8MR5qSkz4B7C; Wed, 9 Oct 2019 09:40:03 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AB62DE8A0; Wed, 9 Oct 2019 09:40:03 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x999e3NU011903; Wed, 9 Oct 2019 09:40:03 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x999e35d011901; Wed, 9 Oct 2019 09:40:03 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910090940.x999e35d011901@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 9 Oct 2019 09:40:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353337 - in stable/12: cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in stable/12: cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 353337 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Oct 2019 09:40:04 -0000 Author: avg Date: Wed Oct 9 09:40:03 2019 New Revision: 353337 URL: https://svnweb.freebsd.org/changeset/base/353337 Log: MFC r352591: MFZoL: Retire send space estimation via ZFS_IOC_SEND Add a small wrapper around libzfs_core's lzc_send_space() to libzfs so that every legacy ZFS_IOC_SEND consumer, along with their userland counterpart estimate_ioctl(), can leverage ZFS_IOC_SEND_SPACE to request send space estimation. The legacy functionality in zfs_ioc_send() is left untouched for compatibility purposes. Obtained from: ZoL Obtained from: zfsonlinux/zfs@cf7684bc8d57 Author: loli10K Modified: stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Directory Properties: stable/12/ (props changed) Modified: stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c ============================================================================== --- stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Wed Oct 9 05:52:07 2019 (r353336) +++ stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Wed Oct 9 09:40:03 2019 (r353337) @@ -948,39 +948,32 @@ typedef struct send_dump_data { } send_dump_data_t; static int -estimate_ioctl(zfs_handle_t *zhp, uint64_t fromsnap_obj, - boolean_t fromorigin, enum lzc_send_flags flags, uint64_t *sizep) +zfs_send_space(zfs_handle_t *zhp, const char *snapname, const char *from, + enum lzc_send_flags flags, uint64_t *spacep) { - zfs_cmd_t zc = { 0 }; libzfs_handle_t *hdl = zhp->zfs_hdl; + int error; - assert(zhp->zfs_type == ZFS_TYPE_SNAPSHOT); - assert(fromsnap_obj == 0 || !fromorigin); + assert(snapname != NULL); + error = lzc_send_space(snapname, from, flags, spacep); - (void) strlcpy(zc.zc_name, zhp->zfs_name, sizeof (zc.zc_name)); - zc.zc_obj = fromorigin; - zc.zc_sendobj = zfs_prop_get_int(zhp, ZFS_PROP_OBJSETID); - zc.zc_fromobj = fromsnap_obj; - zc.zc_guid = 1; /* estimate flag */ - zc.zc_flags = flags; - - if (zfs_ioctl(zhp->zfs_hdl, ZFS_IOC_SEND, &zc) != 0) { + if (error != 0) { char errbuf[1024]; (void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN, - "warning: cannot estimate space for '%s'"), zhp->zfs_name); + "warning: cannot estimate space for '%s'"), snapname); - switch (errno) { + switch (error) { case EXDEV: zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, "not an earlier snapshot from the same fs")); return (zfs_error(hdl, EZFS_CROSSTARGET, errbuf)); case ENOENT: - if (zfs_dataset_exists(hdl, zc.zc_name, + if (zfs_dataset_exists(hdl, snapname, ZFS_TYPE_SNAPSHOT)) { zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, - "incremental source (@%s) does not exist"), - zc.zc_value); + "incremental source (%s) does not exist"), + snapname); } return (zfs_error(hdl, EZFS_NOENT, errbuf)); @@ -994,16 +987,15 @@ estimate_ioctl(zfs_handle_t *zhp, uint64_t fromsnap_ob case ERANGE: case EFAULT: case EROFS: - zfs_error_aux(hdl, strerror(errno)); + case EINVAL: + zfs_error_aux(hdl, strerror(error)); return (zfs_error(hdl, EZFS_BADBACKUP, errbuf)); default: - return (zfs_standard_error(hdl, errno, errbuf)); + return (zfs_standard_error(hdl, error, errbuf)); } } - *sizep = zc.zc_objset_type; - return (0); } @@ -1290,13 +1282,22 @@ dump_snapshot(zfs_handle_t *zhp, void *arg) (sdd->fromorigin || sdd->replicate); if (sdd->verbose || sdd->progress) { - (void) estimate_ioctl(zhp, sdd->prevsnap_obj, - fromorigin, flags, &size); - sdd->size += size; + char fromds[ZFS_MAX_DATASET_NAME_LEN]; - send_print_verbose(fout, zhp->zfs_name, - sdd->prevsnap[0] ? sdd->prevsnap : NULL, - size, sdd->parsable); + if (sdd->prevsnap[0] != '\0') { + (void) strlcpy(fromds, zhp->zfs_name, sizeof (fromds)); + *(strchr(fromds, '@') + 1) = '\0'; + (void) strlcat(fromds, sdd->prevsnap, sizeof (fromds)); + } + if (zfs_send_space(zhp, zhp->zfs_name, + sdd->prevsnap[0] ? fromds : NULL, flags, &size) != 0) { + size = 0; /* cannot estimate send space */ + } else { + send_print_verbose(fout, zhp->zfs_name, + sdd->prevsnap[0] ? sdd->prevsnap : NULL, + size, sdd->parsable); + } + sdd->size += size; } if (!sdd->dryrun) { Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Wed Oct 9 05:52:07 2019 (r353336) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Wed Oct 9 09:40:03 2019 (r353337) @@ -4799,6 +4799,9 @@ out: * * outputs: * zc_objset_type estimated size, if zc_guid is set + * + * NOTE: This is no longer the preferred interface, any new functionality + * should be added to zfs_ioc_send_new() instead. */ static int zfs_ioc_send(zfs_cmd_t *zc) From owner-svn-src-stable-12@freebsd.org Wed Oct 9 14:09:26 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5C65A14CE65; Wed, 9 Oct 2019 14:09:26 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46pGLG1cr0z4T6j; Wed, 9 Oct 2019 14:09:26 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 168B1198F2; Wed, 9 Oct 2019 14:09:26 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x99E9P1N083669; Wed, 9 Oct 2019 14:09:25 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x99E9PaF083668; Wed, 9 Oct 2019 14:09:25 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201910091409.x99E9PaF083668@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 9 Oct 2019 14:09:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353345 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 353345 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Oct 2019 14:09:26 -0000 Author: markj Date: Wed Oct 9 14:09:25 2019 New Revision: 353345 URL: https://svnweb.freebsd.org/changeset/base/353345 Log: MFC r353014: Use OBJT_PHYS VM objects for kernel modules. Modified: stable/12/sys/kern/link_elf.c stable/12/sys/kern/link_elf_obj.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/link_elf.c ============================================================================== --- stable/12/sys/kern/link_elf.c Wed Oct 9 12:14:10 2019 (r353344) +++ stable/12/sys/kern/link_elf.c Wed Oct 9 14:09:25 2019 (r353345) @@ -944,7 +944,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: stable/12/sys/kern/link_elf_obj.c ============================================================================== --- stable/12/sys/kern/link_elf_obj.c Wed Oct 9 12:14:10 2019 (r353344) +++ stable/12/sys/kern/link_elf_obj.c Wed Oct 9 14:09:25 2019 (r353345) @@ -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; From owner-svn-src-stable-12@freebsd.org Wed Oct 9 14:09:58 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1266414CED8; Wed, 9 Oct 2019 14:09:58 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46pGLs6fgNz4TDs; Wed, 9 Oct 2019 14:09:57 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C7A0C198F3; Wed, 9 Oct 2019 14:09:57 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x99E9vxZ083753; Wed, 9 Oct 2019 14:09:57 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x99E9vom083752; Wed, 9 Oct 2019 14:09:57 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201910091409.x99E9vom083752@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 9 Oct 2019 14:09:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353346 - stable/12/sys/modules/hptmv X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/modules/hptmv X-SVN-Commit-Revision: 353346 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Oct 2019 14:09:58 -0000 Author: markj Date: Wed Oct 9 14:09:57 2019 New Revision: 353346 URL: https://svnweb.freebsd.org/changeset/base/353346 Log: MFC r353013: Harmonize the hptmv blob's build rule with that of other hpt* drivers. Modified: stable/12/sys/modules/hptmv/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/modules/hptmv/Makefile ============================================================================== --- stable/12/sys/modules/hptmv/Makefile Wed Oct 9 14:09:25 2019 (r353345) +++ stable/12/sys/modules/hptmv/Makefile Wed Oct 9 14:09:57 2019 (r353346) @@ -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: From owner-svn-src-stable-12@freebsd.org Wed Oct 9 14:35:10 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 25BE414DA28; Wed, 9 Oct 2019 14:35:10 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46pGvy09LTz4WJq; Wed, 9 Oct 2019 14:35:10 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DCF1819E59; Wed, 9 Oct 2019 14:35:09 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x99EZ9dH002430; Wed, 9 Oct 2019 14:35:09 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x99EZ9t7002429; Wed, 9 Oct 2019 14:35:09 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201910091435.x99EZ9t7002429@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 9 Oct 2019 14:35:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353347 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 353347 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Oct 2019 14:35:10 -0000 Author: emaste Date: Wed Oct 9 14:35:09 2019 New Revision: 353347 URL: https://svnweb.freebsd.org/changeset/base/353347 Log: MFC r353021: 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. Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/kern/vfs_subr.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/vfs_subr.c ============================================================================== --- stable/12/sys/kern/vfs_subr.c Wed Oct 9 14:09:57 2019 (r353346) +++ stable/12/sys/kern/vfs_subr.c Wed Oct 9 14:35:09 2019 (r353347) @@ -352,10 +352,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; From owner-svn-src-stable-12@freebsd.org Wed Oct 9 22:18:08 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0A5DC131650; Wed, 9 Oct 2019 22:18:08 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46pTB808Ffz46LX; Wed, 9 Oct 2019 22:18:08 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D64221F3BA; Wed, 9 Oct 2019 22:18:07 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x99MI7Ls084072; Wed, 9 Oct 2019 22:18:07 GMT (envelope-from mm@FreeBSD.org) Received: (from mm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x99MI2VA084037; Wed, 9 Oct 2019 22:18:02 GMT (envelope-from mm@FreeBSD.org) Message-Id: <201910092218.x99MI2VA084037@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mm set sender to mm@FreeBSD.org using -f From: Martin Matuska Date: Wed, 9 Oct 2019 22:18:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353375 - in stable/12/contrib/libarchive: cat cpio libarchive libarchive/test tar tar/test test_utils X-SVN-Group: stable-12 X-SVN-Commit-Author: mm X-SVN-Commit-Paths: in stable/12/contrib/libarchive: cat cpio libarchive libarchive/test tar tar/test test_utils X-SVN-Commit-Revision: 353375 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Oct 2019 22:18:08 -0000 Author: mm Date: Wed Oct 9 22:18:01 2019 New Revision: 353375 URL: https://svnweb.freebsd.org/changeset/base/353375 Log: MFC r352732: Sync libarchive with vendor. Relevant vendor changes: Issue #1237: Fix integer overflow in archive_read_support_filter_lz4.c PR #1249: Correct some typographical and grammatical errors. PR #1250: Minor corrections to the formatting of manual pages Modified: stable/12/contrib/libarchive/cat/bsdcat.1 stable/12/contrib/libarchive/cpio/bsdcpio.1 stable/12/contrib/libarchive/libarchive/archive.h stable/12/contrib/libarchive/libarchive/archive_entry.3 stable/12/contrib/libarchive/libarchive/archive_entry_acl.3 stable/12/contrib/libarchive/libarchive/archive_entry_misc.3 stable/12/contrib/libarchive/libarchive/archive_entry_paths.3 stable/12/contrib/libarchive/libarchive/archive_entry_perms.3 stable/12/contrib/libarchive/libarchive/archive_entry_stat.3 stable/12/contrib/libarchive/libarchive/archive_entry_time.3 stable/12/contrib/libarchive/libarchive/archive_read.3 stable/12/contrib/libarchive/libarchive/archive_read_add_passphrase.3 stable/12/contrib/libarchive/libarchive/archive_read_data.3 stable/12/contrib/libarchive/libarchive/archive_read_disk.3 stable/12/contrib/libarchive/libarchive/archive_read_extract.3 stable/12/contrib/libarchive/libarchive/archive_read_filter.3 stable/12/contrib/libarchive/libarchive/archive_read_format.3 stable/12/contrib/libarchive/libarchive/archive_read_free.3 stable/12/contrib/libarchive/libarchive/archive_read_header.3 stable/12/contrib/libarchive/libarchive/archive_read_new.3 stable/12/contrib/libarchive/libarchive/archive_read_open.3 stable/12/contrib/libarchive/libarchive/archive_read_set_options.3 stable/12/contrib/libarchive/libarchive/archive_read_support_filter_gzip.c stable/12/contrib/libarchive/libarchive/archive_read_support_filter_lz4.c stable/12/contrib/libarchive/libarchive/archive_read_support_format_zip.c stable/12/contrib/libarchive/libarchive/archive_string.c stable/12/contrib/libarchive/libarchive/archive_util.3 stable/12/contrib/libarchive/libarchive/archive_write.3 stable/12/contrib/libarchive/libarchive/archive_write_blocksize.3 stable/12/contrib/libarchive/libarchive/archive_write_data.3 stable/12/contrib/libarchive/libarchive/archive_write_disk.3 stable/12/contrib/libarchive/libarchive/archive_write_disk_posix.c stable/12/contrib/libarchive/libarchive/archive_write_filter.3 stable/12/contrib/libarchive/libarchive/archive_write_finish_entry.3 stable/12/contrib/libarchive/libarchive/archive_write_format.3 stable/12/contrib/libarchive/libarchive/archive_write_free.3 stable/12/contrib/libarchive/libarchive/archive_write_header.3 stable/12/contrib/libarchive/libarchive/archive_write_new.3 stable/12/contrib/libarchive/libarchive/archive_write_open.3 stable/12/contrib/libarchive/libarchive/archive_write_set_format_iso9660.c stable/12/contrib/libarchive/libarchive/archive_write_set_format_mtree.c stable/12/contrib/libarchive/libarchive/archive_write_set_options.3 stable/12/contrib/libarchive/libarchive/archive_write_set_passphrase.3 stable/12/contrib/libarchive/libarchive/libarchive_changes.3 stable/12/contrib/libarchive/libarchive/libarchive_internals.3 stable/12/contrib/libarchive/libarchive/tar.5 stable/12/contrib/libarchive/libarchive/test/test_archive_write_add_filter_by_name.c stable/12/contrib/libarchive/libarchive/test/test_archive_write_set_format_filter_by_ext.c stable/12/contrib/libarchive/libarchive/test/test_read_format_raw.c stable/12/contrib/libarchive/libarchive/test/test_read_format_zip.c stable/12/contrib/libarchive/libarchive/test/test_read_format_zip_traditional_encryption_data.c stable/12/contrib/libarchive/libarchive/test/test_write_filter_zstd.c stable/12/contrib/libarchive/tar/bsdtar.1 stable/12/contrib/libarchive/tar/test/test_option_n.c stable/12/contrib/libarchive/tar/test/test_option_xattrs.c stable/12/contrib/libarchive/test_utils/test_main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/contrib/libarchive/cat/bsdcat.1 ============================================================================== --- stable/12/contrib/libarchive/cat/bsdcat.1 Wed Oct 9 21:48:00 2019 (r353374) +++ stable/12/contrib/libarchive/cat/bsdcat.1 Wed Oct 9 22:18:01 2019 (r353375) @@ -34,16 +34,15 @@ .Nm .Op options .Op files -.Pp .Sh DESCRIPTION .Nm expands files to standard output. .Sh OPTIONS .Nm typically takes a filename as an argument or reads standard input when used in a -pipe. In both cases decompressed data it written to standard output. +pipe. +In both cases decompressed data it written to standard output. .Sh EXAMPLES -.Pp To decompress a file: .Pp .Dl bsdcat example.txt.gz > example.txt @@ -55,8 +54,8 @@ To decompress standard input in a pipe: Both examples achieve the same results - a decompressed file by redirecting output. .Sh SEE ALSO -.Xr uncompress 1 , -.Xr zcat 1 , .Xr bzcat 1 , +.Xr uncompress 1 , .Xr xzcat 1 , -.Xr libarchive-formats 5 , +.Xr zcat 1 , +.Xr libarchive-formats 5 Modified: stable/12/contrib/libarchive/cpio/bsdcpio.1 ============================================================================== --- stable/12/contrib/libarchive/cpio/bsdcpio.1 Wed Oct 9 21:48:00 2019 (r353374) +++ stable/12/contrib/libarchive/cpio/bsdcpio.1 Wed Oct 9 22:18:01 2019 (r353375) @@ -75,7 +75,6 @@ Pass-through. Read a list of filenames from standard input and copy the files to the specified directory. .El -.Pp .Sh OPTIONS Unless specifically stated otherwise, options are applicable in all operating modes. @@ -385,10 +384,10 @@ For best compatibility, scripts should limit themselve standard syntax. .Sh SEE ALSO .Xr bzip2 1 , -.Xr tar 1 , .Xr gzip 1 , .Xr mt 1 , .Xr pax 1 , +.Xr tar 1 , .Xr libarchive 3 , .Xr cpio 5 , .Xr libarchive-formats 5 , Modified: stable/12/contrib/libarchive/libarchive/archive.h ============================================================================== --- stable/12/contrib/libarchive/libarchive/archive.h Wed Oct 9 21:48:00 2019 (r353374) +++ stable/12/contrib/libarchive/libarchive/archive.h Wed Oct 9 22:18:01 2019 (r353375) @@ -52,7 +52,7 @@ */ #if defined(__BORLANDC__) && __BORLANDC__ >= 0x560 # include -#elif !defined(__WATCOMC__) && !defined(_MSC_VER) && !defined(__INTERIX) && !defined(__BORLANDC__) && !defined(_SCO_DS) && !defined(__osf__) +#elif !defined(__WATCOMC__) && !defined(_MSC_VER) && !defined(__INTERIX) && !defined(__BORLANDC__) && !defined(_SCO_DS) && !defined(__osf__) && !defined(__CLANG_INTTYPES_H) # include #endif Modified: stable/12/contrib/libarchive/libarchive/archive_entry.3 ============================================================================== --- stable/12/contrib/libarchive/libarchive/archive_entry.3 Wed Oct 9 21:48:00 2019 (r353374) +++ stable/12/contrib/libarchive/libarchive/archive_entry.3 Wed Oct 9 22:18:01 2019 (r353375) @@ -32,7 +32,7 @@ .Nm archive_entry_clear , .Nm archive_entry_clone , .Nm archive_entry_free , -.Nm archive_entry_new , +.Nm archive_entry_new .Nd functions for managing archive entry descriptions .Sh LIBRARY Streaming Archive Library (libarchive, -larchive) @@ -126,7 +126,6 @@ using the current locale. Similarly, if you store a wide string and then store a narrow string for the same data, the previously-set wide string will be discarded in favor of the new data. -.Pp .\" .Sh EXAMPLE .\" .Sh RETURN VALUES .\" .Sh ERRORS @@ -134,8 +133,8 @@ be discarded in favor of the new data. .Xr archive_entry_acl 3 , .Xr archive_entry_paths 3 , .Xr archive_entry_perms 3 , -.Xr archive_entry_time 3 -.Xr libarchive 3 , +.Xr archive_entry_time 3 , +.Xr libarchive 3 .Sh HISTORY The .Nm libarchive Modified: stable/12/contrib/libarchive/libarchive/archive_entry_acl.3 ============================================================================== --- stable/12/contrib/libarchive/libarchive/archive_entry_acl.3 Wed Oct 9 21:48:00 2019 (r353374) +++ stable/12/contrib/libarchive/libarchive/archive_entry_acl.3 Wed Oct 9 22:18:01 2019 (r353375) @@ -118,15 +118,16 @@ Streaming Archive Library (libarchive, -larchive) .Sh DESCRIPTION The .Dq Access Control Lists (ACLs) -extend the standard Unix perssion model. +extend the standard Unix permission model. The ACL interface of .Nm libarchive -supports both POSIX.1e and NFSv4 style ACLs. Use of ACLs is restricted by +supports both POSIX.1e and NFSv4 style ACLs. +Use of ACLs is restricted by various levels of ACL support in operating systems, file systems and archive formats. .Ss POSIX.1e Access Control Lists A POSIX.1e ACL consists of a number of independent entries. -Each entry specifies the permission set as bitmask of basic permissions. +Each entry specifies the permission set as a bitmask of basic permissions. Valid permissions in the .Fa permset are: @@ -147,13 +148,13 @@ The user specified by the name field. .It Dv ARCHIVE_ENTRY_ACL_USER_OBJ The owner of the file. .It Dv ARCHIVE_ENTRY_ACL_GROUP -The group specied by the name field. +The group specified by the name field. .It Dv ARCHIVE_ENTRY_ACL_GROUP_OBJ -The group who owns the file. +The group which owns the file. .It Dv ARCHIVE_ENTRY_ACL_MASK The maximum permissions to be obtained via group permissions. .It Dv ARCHIVE_ENTRY_ACL_OTHER -Any principal who is not file owner or a member of the owning group. +Any principal who is not the file owner or a member of the owning group. .El .Pp The principals @@ -164,12 +165,12 @@ and are equivalent to user, group and other in the classic Unix permission model and specify non-extended ACL entries. .Pp -All files with have an access ACL +All files have an access ACL .Pq Dv ARCHIVE_ENTRY_ACL_TYPE_ACCESS . This specifies the permissions required for access to the file itself. Directories have an additional ACL .Pq Dv ARCHIVE_ENTRY_ACL_TYPE_DEFAULT , -which controls the initial access ACL for newly created directory entries. +which controls the initial access ACL for newly-created directory entries. .Ss NFSv4 Access Control Lists A NFSv4 ACL consists of multiple individual entries called Access Control Entries (ACEs). @@ -197,11 +198,11 @@ The user specified by the name field. .It Dv ARCHIVE_ENTRY_ACL_USER_OBJ The owner of the file. .It Dv ARCHIVE_ENTRY_ACL_GROUP -The group specied by the name field. +The group specified by the name field. .It Dv ARCHIVE_ENTRY_ACL_GROUP_OBJ -The group who owns the file. +The group which owns the file. .It Dv ARCHIVE_ENTRY_ACL_EVERYONE -Any principal who is not file owner or a member of the owning group. +Any principal who is not the file owner or a member of the owning group. .El .Pp Entries with the @@ -216,9 +217,10 @@ integer. .Pp NFSv4 ACE permissions and flags are stored in the same .Fa permset -bitfield. Some permissions share the same constant and permission character but -have different effect on directories than on files. The following ACE -permissions are supported: +bitfield. +Some permissions share the same constant and permission character +but have different effect on directories than on files. +The following ACE permissions are supported: .Bl -tag -offset indent -compact -width ARCHIV .It Dv ARCHIVE_ENTRY_ACL_READ_DATA ( Sy r ) Read data (file). @@ -265,7 +267,8 @@ Inherit parent directory ACE to subdirectories. .It Dv ARCHIVE_ENTRY_ACL_ENTRY_INHERIT_ONLY ( Sy i ) Only inherit, do not apply the permission on the directory itself. .It Dv ARCHIVE_ENTRY_ACL_ENTRY_NO_PROPAGATE_INHERIT ( Sy n ) -Do not propagate inherit flags. Only first-level entries inherit ACLs. +Do not propagate inherit flags. +Only first-level entries inherit ACLs. .It Dv ARCHIVE_ENTRY_ACL_ENTRY_SUCCESSFUL_ACCESS ( Sy S ) Trigger alarm or audit on successful access. .It Dv ARCHIVE_ENTRY_ACL_ENTRY_FAILED_ACCESS ( Sy F ) @@ -279,8 +282,8 @@ and .Fn archive_entry_acl_add_entry_w add a single ACL entry. For the access ACL and non-extended principals, the classic Unix permissions -are updated. An archive entry cannot contain both POSIX.1e and NFSv4 ACL -entries. +are updated. +An archive entry cannot contain both POSIX.1e and NFSv4 ACL entries. .Pp .Fn archive_entry_acl_clear removes all ACL entries and resets the enumeration pointer. @@ -300,7 +303,8 @@ for POSIX.1e ACLs and .It Dv ARCHIVE_ENTRY_ACL_TYPE_AUDIT .It Dv ARCHIVE_ENTRY_ACL_TYPE_ALARM .El -for NFSv4 ACLs. For POSIX.1e ACLs if +for NFSv4 ACLs. +For POSIX.1e ACLs if .Dv ARCHIVE_ENTRY_ACL_TYPE_ACCESS is included and at least one extended ACL entry is found, the three non-extended ACLs are added. @@ -312,7 +316,8 @@ add new .Pq or merge with existing ACL entries from .Pq wide -text. The argument +text. +The argument .Fa type may take one of the following values: .Bl -tag -offset indent -compact -width "ARCHIVE_ENTRY_ACL_TYPE_DEFAULT" @@ -322,11 +327,13 @@ may take one of the following values: .El Supports all formats that can be created with .Fn archive_entry_acl_to_text -or respective +or respectively .Fn archive_entry_acl_to_text_w . -Existing ACL entries are preserved. To get a clean new ACL from text +Existing ACL entries are preserved. +To get a clean new ACL from text .Fn archive_entry_acl_clear -must be called first. Entries prefixed with +must be called first. +Entries prefixed with .Dq default: are treated as .Dv ARCHIVE_ENTRY_ACL_TYPE_DEFAULT @@ -354,7 +361,7 @@ prepare reading the list of ACL entries with .Fn archive_entry_acl_next or .Fn archive_entry_acl_next_w . -The function returns either 0, if no non-extended ACLs are found. +The function returns 0 if no non-extended ACLs are found. In this case, the access permissions should be obtained by .Xr archive_entry_mode 3 or set using @@ -367,7 +374,8 @@ and .Fn archive_entry_acl_to_text_w convert the ACL entries for the given type into a .Pq wide -string of ACL entries separated by newline. If the pointer +string of ACL entries separated by newline. +If the pointer .Fa len_p is not NULL, then the function shall return the length of the string .Pq not including the NULL terminator @@ -415,7 +423,8 @@ are prefixed with .Dq default: . .Pp .Fn archive_entry_acl_types -get ACL entry types contained in an archive entry's ACL. As POSIX.1e and NFSv4 +get ACL entry types contained in an archive entry's ACL. +As POSIX.1e and NFSv4 ACL entries cannot be mixed, this function is a very efficient way to detect if an ACL already contains POSIX.1e or NFSv4 ACL entries. .Sh RETURN VALUES Modified: stable/12/contrib/libarchive/libarchive/archive_entry_misc.3 ============================================================================== --- stable/12/contrib/libarchive/libarchive/archive_entry_misc.3 Wed Oct 9 21:48:00 2019 (r353374) +++ stable/12/contrib/libarchive/libarchive/archive_entry_misc.3 Wed Oct 9 22:18:01 2019 (r353375) @@ -28,7 +28,7 @@ .Sh NAME .Nm archive_entry_symlink_type , .Nm archive_entry_set_symlink_type -.Nd miscellaneous functions for manipulating properties of archive_entry. +.Nd miscellaneous functions for manipulating properties of archive_entry .Sh LIBRARY Streaming Archive Library (libarchive, -larchive) .Sh SYNOPSIS @@ -42,7 +42,8 @@ The function .Fn archive_entry_symlink_type returns and the function .Fn archive_entry_set_symlink_type -sets the type of the symbolic link stored in an archive entry. These functions +sets the type of the symbolic link stored in an archive entry. +These functions have special meaning on operating systems that support multiple symbolic link types (e.g. Microsoft Windows). .Pp Modified: stable/12/contrib/libarchive/libarchive/archive_entry_paths.3 ============================================================================== --- stable/12/contrib/libarchive/libarchive/archive_entry_paths.3 Wed Oct 9 21:48:00 2019 (r353374) +++ stable/12/contrib/libarchive/libarchive/archive_entry_paths.3 Wed Oct 9 22:18:01 2019 (r353375) @@ -133,7 +133,7 @@ The accessor functions are named .Fn XXX_w . .It UTF-8 Unicode strings encoded as UTF-8. -This are convience functions to update both the multibyte and wide +These are convenience functions to update both the multibyte and wide character strings at the same time. .El .Pp @@ -141,13 +141,13 @@ The sourcepath is a pure filesystem concept and never archive directly. .Pp For that reason, it is only available as multibyte string. -The link path is a convience function for conditionally setting +The link path is a convenience function for conditionally setting hardlink or symlink destination. It doesn't have a corresponding get accessor function. .Pp .Fn archive_entry_set_XXX -is an alias for +is an alias for .Fn archive_entry_copy_XXX . .Sh SEE ALSO -.Xr archive_entry 3 -.Xr libarchive 3 , +.Xr archive_entry 3 , +.Xr libarchive 3 Modified: stable/12/contrib/libarchive/libarchive/archive_entry_perms.3 ============================================================================== --- stable/12/contrib/libarchive/libarchive/archive_entry_perms.3 Wed Oct 9 21:48:00 2019 (r353374) +++ stable/12/contrib/libarchive/libarchive/archive_entry_perms.3 Wed Oct 9 22:18:01 2019 (r353375) @@ -126,7 +126,7 @@ The corresponding functions and .Fn archive_entry_set_perm store the given user id, group id and permission in the entry. -The permission is also set as side effect of calling +The permission is also set as a side effect of calling .Fn archive_entry_set_mode . .Pp .Fn archive_entry_strmode @@ -143,12 +143,12 @@ The accessor functions are named .Fn XXX_w . .It UTF-8 Unicode strings encoded as UTF-8. -This are convience functions to update both the multibyte and wide +These are convenience functions to update both the multibyte and wide character strings at the same time. .El .Pp .Fn archive_entry_set_XXX -is an alias for +is an alias for .Fn archive_entry_copy_XXX . .Ss File Flags File flags are transparently converted between a bitmap @@ -182,7 +182,7 @@ The .Fn archive_entry_copy_fflags_text and .Fn archive_entry_copy_fflags_text_w -functions parse the provided text and sets the internal bitmap values. +functions parse the provided text and set the internal bitmap values. This is a platform-specific operation; names that are not meaningful on the current platform will be ignored. The function returns a pointer to the start of the first name that was not @@ -197,8 +197,8 @@ which stops parsing at the first unrecognized name.) .Xr archive_entry 3 , .Xr archive_entry_acl 3 , .Xr archive_read_disk 3 , -.Xr archive_write_disk 3 -.Xr libarchive 3 , +.Xr archive_write_disk 3 , +.Xr libarchive 3 .Sh BUGS The platform types .Vt uid_t Modified: stable/12/contrib/libarchive/libarchive/archive_entry_stat.3 ============================================================================== --- stable/12/contrib/libarchive/libarchive/archive_entry_stat.3 Wed Oct 9 21:48:00 2019 (r353374) +++ stable/12/contrib/libarchive/libarchive/archive_entry_stat.3 Wed Oct 9 22:18:01 2019 (r353375) @@ -54,7 +54,7 @@ .Nm archive_entry_rdevmajor , .Nm archive_entry_set_rdevmajor , .Nm archive_entry_rdevminor , -.Nm archive_entry_set_rdevminor , +.Nm archive_entry_set_rdevminor .Nd accessor functions for manipulating archive entry descriptions .Sh LIBRARY Streaming Archive Library (libarchive, -larchive) @@ -267,8 +267,8 @@ platforms. Some archive formats use the combined form, while other formats use the split form. .Sh SEE ALSO +.Xr stat 2 , .Xr archive_entry_acl 3 , .Xr archive_entry_perms 3 , .Xr archive_entry_time 3 , -.Xr libarchive 3 , -.Xr stat 2 +.Xr libarchive 3 Modified: stable/12/contrib/libarchive/libarchive/archive_entry_time.3 ============================================================================== --- stable/12/contrib/libarchive/libarchive/archive_entry_time.3 Wed Oct 9 21:48:00 2019 (r353374) +++ stable/12/contrib/libarchive/libarchive/archive_entry_time.3 Wed Oct 9 22:18:01 2019 (r353375) @@ -48,7 +48,7 @@ .Nm archive_entry_mtime_nsec , .Nm archive_entry_mtime_is_set , .Nm archive_entry_set_mtime , -.Nm archive_entry_unset_mtime , +.Nm archive_entry_unset_mtime .Nd functions for manipulating times in archive entry descriptions .Sh LIBRARY Streaming Archive Library (libarchive, -larchive) @@ -113,8 +113,8 @@ The current state can be queried using .Fn XXX_is_set . Unset time fields have a second and nanosecond field of 0. .Sh SEE ALSO -.Xr archive_entry 3 -.Xr libarchive 3 , +.Xr archive_entry 3 , +.Xr libarchive 3 .Sh HISTORY The .Nm libarchive Modified: stable/12/contrib/libarchive/libarchive/archive_read.3 ============================================================================== --- stable/12/contrib/libarchive/libarchive/archive_read.3 Wed Oct 9 21:48:00 2019 (r353374) +++ stable/12/contrib/libarchive/libarchive/archive_read.3 Wed Oct 9 22:18:01 2019 (r353375) @@ -155,7 +155,7 @@ to close the archive, then call .Fn archive_read_free to release all resources, including all memory allocated by the library. .\" -.Sh EXAMPLE +.Sh EXAMPLES The following illustrates basic usage of the library. In this example, the callback functions are simply wrappers around the standard @@ -217,16 +217,16 @@ myclose(struct archive *a, void *client_data) .\" .Sh ERRORS .Sh SEE ALSO .Xr tar 1 , -.Xr libarchive 3 , -.Xr archive_read_new 3 , .Xr archive_read_data 3 , .Xr archive_read_extract 3 , .Xr archive_read_filter 3 , .Xr archive_read_format 3 , .Xr archive_read_header 3 , +.Xr archive_read_new 3 , .Xr archive_read_open 3 , .Xr archive_read_set_options 3 , .Xr archive_util 3 , +.Xr libarchive 3 , .Xr tar 5 .Sh HISTORY The Modified: stable/12/contrib/libarchive/libarchive/archive_read_add_passphrase.3 ============================================================================== --- stable/12/contrib/libarchive/libarchive/archive_read_add_passphrase.3 Wed Oct 9 21:48:00 2019 (r353374) +++ stable/12/contrib/libarchive/libarchive/archive_read_add_passphrase.3 Wed Oct 9 22:18:01 2019 (r353375) @@ -59,16 +59,16 @@ or empty, this function will do nothing and will be returned. Otherwise, .Cm ARCHIVE_OK -will be returned. +will be returned. .It Fn archive_read_set_passphrase_callback -Register callback function that will be invoked to get a passphrase -for decrption after trying all passphrases registered by the +Register a callback function that will be invoked to get a passphrase +for decryption after trying all the passphrases registered by the .Fn archive_read_add_passphrase function failed. .El .\" .Sh ERRORS .Sh SEE ALSO .Xr tar 1 , -.Xr libarchive 3 , .Xr archive_read 3 , -.Xr archive_read_set_options 3 +.Xr archive_read_set_options 3 , +.Xr libarchive 3 Modified: stable/12/contrib/libarchive/libarchive/archive_read_data.3 ============================================================================== --- stable/12/contrib/libarchive/libarchive/archive_read_data.3 Wed Oct 9 21:48:00 2019 (r353374) +++ stable/12/contrib/libarchive/libarchive/archive_read_data.3 Wed Oct 9 22:18:01 2019 (r353375) @@ -28,7 +28,7 @@ .Dt ARCHIVE_READ_DATA 3 .Os .Sh NAME -.Nm archive_read_data +.Nm archive_read_data , .Nm archive_read_data_block , .Nm archive_read_data_skip , .Nm archive_read_data_into_fd @@ -118,7 +118,6 @@ functions. .\" .Sh SEE ALSO .Xr tar 1 , -.Xr libarchive 3 , .Xr archive_read 3 , .Xr archive_read_extract 3 , .Xr archive_read_filter 3 , @@ -127,4 +126,5 @@ functions. .Xr archive_read_open 3 , .Xr archive_read_set_options 3 , .Xr archive_util 3 , +.Xr libarchive 3 , .Xr tar 5 Modified: stable/12/contrib/libarchive/libarchive/archive_read_disk.3 ============================================================================== --- stable/12/contrib/libarchive/libarchive/archive_read_disk.3 Wed Oct 9 21:48:00 2019 (r353374) +++ stable/12/contrib/libarchive/libarchive/archive_read_disk.3 Wed Oct 9 22:18:01 2019 (r353375) @@ -99,9 +99,10 @@ following values: .Bl -tag -compact -width "indent" .It Cm ARCHIVE_READDISK_HONOR_NODUMP Skip files and directories with the nodump file attribute (file flag) set. -By default, the nodump file atrribute is ignored. +By default, the nodump file attribute is ignored. .It Cm ARCHIVE_READDISK_MAC_COPYFILE -Mac OS X specific. Read metadata (ACLs and extended attributes) with +Mac OS X specific. +Read metadata (ACLs and extended attributes) with .Xr copyfile 3 . By default, metadata is read using .Xr copyfile 3 . @@ -120,7 +121,7 @@ or for more information on file attributes. .It Cm ARCHIVE_READDISK_NO_TRAVERSE_MOUNTS Do not traverse mount points. -By defaut, moint points are traversed. +By default, mount points are traversed. .It Cm ARCHIVE_READDISK_NO_XATTR Do not read extended file attributes (xattrs). By default, extended file attributes are read from disk. @@ -216,7 +217,7 @@ of some other operation. (For example, directory traversal libraries often provide this information.) .Pp Where necessary, user and group ids are converted to user and group names -using the currently registered lookup functions above. +using the currently-registered lookup functions above. This affects the file ownership fields and ACL values in the .Tn struct archive_entry object. @@ -226,7 +227,7 @@ More information about the object and the overall design of the library can be found in the .Xr libarchive 3 overview. -.Sh EXAMPLE +.Sh EXAMPLES The following illustrates basic usage of the library by showing how to use it to copy an item on disk into an archive. .Bd -literal -offset indent @@ -291,11 +292,11 @@ and functions. .\" .Sh SEE ALSO +.Xr tar 1 , .Xr archive_read 3 , .Xr archive_util 3 , .Xr archive_write 3 , .Xr archive_write_disk 3 , -.Xr tar 1 , .Xr libarchive 3 .Sh HISTORY The Modified: stable/12/contrib/libarchive/libarchive/archive_read_extract.3 ============================================================================== --- stable/12/contrib/libarchive/libarchive/archive_read_extract.3 Wed Oct 9 21:48:00 2019 (r353374) +++ stable/12/contrib/libarchive/libarchive/archive_read_extract.3 Wed Oct 9 22:18:01 2019 (r353375) @@ -126,7 +126,6 @@ and functions. .Sh SEE ALSO .Xr tar 1 , -.Xr libarchive 3 , .Xr archive_read 3 , .Xr archive_read_data 3 , .Xr archive_read_filter 3 , @@ -134,4 +133,5 @@ functions. .Xr archive_read_open 3 , .Xr archive_read_set_options 3 , .Xr archive_util 3 , +.Xr libarchive 3 , .Xr tar 5 Modified: stable/12/contrib/libarchive/libarchive/archive_read_filter.3 ============================================================================== --- stable/12/contrib/libarchive/libarchive/archive_read_filter.3 Wed Oct 9 21:48:00 2019 (r353374) +++ stable/12/contrib/libarchive/libarchive/archive_read_filter.3 Wed Oct 9 22:18:01 2019 (r353375) @@ -147,8 +147,8 @@ and functions. .\" .Sh SEE ALSO -.Xr libarchive 3 , .Xr archive_read 3 , .Xr archive_read_data 3 , .Xr archive_read_format 3 , -.Xr archive_read_format 3 +.Xr archive_read_format 3 , +.Xr libarchive 3 Modified: stable/12/contrib/libarchive/libarchive/archive_read_format.3 ============================================================================== --- stable/12/contrib/libarchive/libarchive/archive_read_format.3 Wed Oct 9 21:48:00 2019 (r353374) +++ stable/12/contrib/libarchive/libarchive/archive_read_format.3 Wed Oct 9 22:18:01 2019 (r353375) @@ -102,7 +102,7 @@ For example, .Fn archive_read_support_format_tar enables support for a variety of standard tar formats, old-style tar, ustar, pax interchange format, and many common variants. -.It Fn archive_read_support_format_all +.It Fn archive_read_support_format_all Enables support for all available formats except the .Dq raw format (see below). @@ -125,7 +125,7 @@ it is not possible to accurately determine a format fo an empty file based purely on contents. So empty files are treated by libarchive as a distinct format. -.It Fn archive_read_support_format_raw +.It Fn archive_read_support_format_raw The .Dq raw format handler allows libarchive to be used to read arbitrary data. @@ -153,11 +153,11 @@ functions. .\" .Sh SEE ALSO .Xr tar 1 , -.Xr libarchive 3 , .Xr archive_read_data 3 , .Xr archive_read_filter 3 , .Xr archive_read_set_options 3 , .Xr archive_util 3 , +.Xr libarchive 3 , .Xr tar 5 .Sh BUGS Many traditional archiver programs treat Modified: stable/12/contrib/libarchive/libarchive/archive_read_free.3 ============================================================================== --- stable/12/contrib/libarchive/libarchive/archive_read_free.3 Wed Oct 9 21:48:00 2019 (r353374) +++ stable/12/contrib/libarchive/libarchive/archive_read_free.3 Wed Oct 9 22:18:01 2019 (r353375) @@ -83,11 +83,11 @@ and functions. .\" .Sh SEE ALSO -.Xr libarchive 3 , -.Xr archive_read_new 3 , .Xr archive_read_data 3 , .Xr archive_read_filter 3 , .Xr archive_read_format 3 , +.Xr archive_read_new 3 , .Xr archive_read_open 3 , .Xr archive_read_set_options 3 , -.Xr archive_util 3 +.Xr archive_util 3 , +.Xr libarchive 3 Modified: stable/12/contrib/libarchive/libarchive/archive_read_header.3 ============================================================================== --- stable/12/contrib/libarchive/libarchive/archive_read_header.3 Wed Oct 9 21:48:00 2019 (r353374) +++ stable/12/contrib/libarchive/libarchive/archive_read_header.3 Wed Oct 9 22:18:01 2019 (r353375) @@ -79,7 +79,6 @@ functions. .\" .Sh SEE ALSO .Xr tar 1 , -.Xr libarchive 3 , .Xr archive_read 3 , .Xr archive_read_data 3 , .Xr archive_read_extract 3 , @@ -88,4 +87,5 @@ functions. .Xr archive_read_open 3 , .Xr archive_read_set_options 3 , .Xr archive_util 3 , +.Xr libarchive 3 , .Xr tar 5 Modified: stable/12/contrib/libarchive/libarchive/archive_read_new.3 ============================================================================== --- stable/12/contrib/libarchive/libarchive/archive_read_new.3 Wed Oct 9 21:48:00 2019 (r353374) +++ stable/12/contrib/libarchive/libarchive/archive_read_new.3 Wed Oct 9 22:18:01 2019 (r353375) @@ -50,10 +50,10 @@ object can be found in the overview manual page for .\" .Sh ERRORS .Sh SEE ALSO .Xr tar 1 , -.Xr libarchive 3 , .Xr archive_read_data 3 , .Xr archive_read_filter 3 , .Xr archive_read_format 3 , .Xr archive_read_set_options 3 , .Xr archive_util 3 , +.Xr libarchive 3 , .Xr tar 5 Modified: stable/12/contrib/libarchive/libarchive/archive_read_open.3 ============================================================================== --- stable/12/contrib/libarchive/libarchive/archive_read_open.3 Wed Oct 9 21:48:00 2019 (r353374) +++ stable/12/contrib/libarchive/libarchive/archive_read_open.3 Wed Oct 9 22:18:01 2019 (r353375) @@ -205,7 +205,7 @@ On failure, the callback should invoke .Fn archive_set_error to register an error code and message and return -.Cm ARCHIVE_FATAL. +.Cm ARCHIVE_FATAL . .\" .Sh EXAMPLE .\" .Sh RETURN VALUES @@ -223,11 +223,11 @@ functions. .\" .Sh SEE ALSO .Xr tar 1 , -.Xr libarchive 3 , .Xr archive_read 3 , .Xr archive_read_data 3 , .Xr archive_read_filter 3 , .Xr archive_read_format 3 , .Xr archive_read_set_options 3 , .Xr archive_util 3 , +.Xr libarchive 3 , .Xr tar 5 Modified: stable/12/contrib/libarchive/libarchive/archive_read_set_options.3 ============================================================================== --- stable/12/contrib/libarchive/libarchive/archive_read_set_options.3 Wed Oct 9 21:48:00 2019 (r353374) +++ stable/12/contrib/libarchive/libarchive/archive_read_set_options.3 Wed Oct 9 22:18:01 2019 (r353375) @@ -212,7 +212,8 @@ Use to disable. .It Cm read_concatenated_archives Ignore zeroed blocks in the archive, which occurs when multiple tar archives -have been concatenated together. Without this option, only the contents of +have been concatenated together. +Without this option, only the contents of the first concatenated archive would be read. .El .El @@ -226,6 +227,6 @@ functions. .\" .Sh SEE ALSO .Xr tar 1 , -.Xr libarchive 3 , +.Xr archive_read 3 , .Xr archive_write_set_options 3 , -.Xr archive_read 3 +.Xr libarchive 3 Modified: stable/12/contrib/libarchive/libarchive/archive_read_support_filter_gzip.c ============================================================================== --- stable/12/contrib/libarchive/libarchive/archive_read_support_filter_gzip.c Wed Oct 9 21:48:00 2019 (r353374) +++ stable/12/contrib/libarchive/libarchive/archive_read_support_filter_gzip.c Wed Oct 9 22:18:01 2019 (r353375) @@ -131,12 +131,20 @@ archive_read_support_filter_gzip(struct archive *_a) */ static ssize_t peek_at_header(struct archive_read_filter *filter, int *pbits, - struct private_data *state) +#ifdef HAVE_ZLIB_H + struct private_data *state +#else + void *state +#endif + ) { const unsigned char *p; ssize_t avail, len; int bits = 0; int header_flags; +#ifndef HAVE_ZLIB_H + (void)state; /* UNUSED */ +#endif /* Start by looking at the first ten bytes of the header, which * is all fixed layout. */ @@ -153,8 +161,10 @@ peek_at_header(struct archive_read_filter *filter, int bits += 3; header_flags = p[3]; /* Bytes 4-7 are mod time in little endian. */ +#ifdef HAVE_ZLIB_H if (state) state->mtime = archive_le32dec(p + 4); +#endif /* Byte 8 is deflate flags. */ /* XXXX TODO: return deflate flags back to consume_header for use in initializing the decompressor. */ @@ -171,7 +181,9 @@ peek_at_header(struct archive_read_filter *filter, int /* Null-terminated optional filename. */ if (header_flags & 8) { +#ifdef HAVE_ZLIB_H ssize_t file_start = len; +#endif do { ++len; if (avail < len) @@ -181,11 +193,13 @@ peek_at_header(struct archive_read_filter *filter, int return (0); } while (p[len - 1] != 0); +#ifdef HAVE_ZLIB_H if (state) { /* Reset the name in case of repeat header reads. */ free(state->name); state->name = strdup((const char *)&p[file_start]); } +#endif } /* Null-terminated optional comment. */ @@ -236,24 +250,6 @@ gzip_bidder_bid(struct archive_read_filter_bidder *sel return (0); } -static int -gzip_read_header(struct archive_read_filter *self, struct archive_entry *entry) -{ - struct private_data *state; - - state = (struct private_data *)self->data; - - /* A mtime of 0 is considered invalid/missing. */ - if (state->mtime != 0) - archive_entry_set_mtime(entry, state->mtime, 0); - - /* If the name is available, extract it. */ - if (state->name) - archive_entry_set_pathname(entry, state->name); - - return (ARCHIVE_OK); -} - #ifndef HAVE_ZLIB_H /* @@ -277,6 +273,24 @@ gzip_bidder_init(struct archive_read_filter *self) #else +static int +gzip_read_header(struct archive_read_filter *self, struct archive_entry *entry) +{ + struct private_data *state; + + state = (struct private_data *)self->data; + + /* A mtime of 0 is considered invalid/missing. */ + if (state->mtime != 0) + archive_entry_set_mtime(entry, state->mtime, 0); + + /* If the name is available, extract it. */ + if (state->name) + archive_entry_set_pathname(entry, state->name); + + return (ARCHIVE_OK); +} + /* * Initialize the filter object. */ @@ -306,7 +320,9 @@ gzip_bidder_init(struct archive_read_filter *self) self->read = gzip_filter_read; self->skip = NULL; /* not supported */ self->close = gzip_filter_close; +#ifdef HAVE_ZLIB_H self->read_header = gzip_read_header; +#endif state->in_stream = 0; /* We're not actually within a stream yet. */ Modified: stable/12/contrib/libarchive/libarchive/archive_read_support_filter_lz4.c ============================================================================== --- stable/12/contrib/libarchive/libarchive/archive_read_support_filter_lz4.c Wed Oct 9 21:48:00 2019 (r353374) +++ stable/12/contrib/libarchive/libarchive/archive_read_support_filter_lz4.c Wed Oct 9 22:18:01 2019 (r353375) @@ -460,7 +460,7 @@ lz4_filter_read_descriptor(struct archive_read_filter __archive_read_filter_consume(self->upstream, descriptor_bytes); - /* Make sure we have an enough buffer for uncompressed data. */ + /* Make sure we have a large enough buffer for uncompressed data. */ if (lz4_allocate_out_block(self) != ARCHIVE_OK) return (ARCHIVE_FATAL); if (state->flags.stream_checksum) @@ -520,7 +520,7 @@ lz4_filter_read_data_block(struct archive_read_filter if (read_buf == NULL) goto truncated_error; - /* Optional process, checking a block sum. */ + /* Optional processing, checking a block sum. */ if (checksum_size) { unsigned int chsum = __archive_xxhash.XXH32( read_buf + 4, (int)compressed_size, 0); @@ -640,7 +640,7 @@ lz4_filter_read_default_stream(struct archive_read_fil if (ret == 0 && *p == NULL) state->stage = SELECT_STREAM; - /* Optional process, checking a stream sum. */ + /* Optional processing, checking a stream sum. */ if (state->flags.stream_checksum) { if (state->stage == SELECT_STREAM) { unsigned int checksum; @@ -660,7 +660,7 @@ lz4_filter_read_default_stream(struct archive_read_fil if (checksum != checksum_stream) { archive_set_error(&self->archive->archive, ARCHIVE_ERRNO_MISC, - "lz4 stream cheksum error"); + "lz4 stream checksum error"); return (ARCHIVE_FATAL); } } else if (ret > 0) @@ -674,7 +674,7 @@ static ssize_t lz4_filter_read_legacy_stream(struct archive_read_filter *self, const void **p) { struct private_data *state = (struct private_data *)self->data; - int compressed; + uint32_t compressed; const char *read_buf; ssize_t ret; Modified: stable/12/contrib/libarchive/libarchive/archive_read_support_format_zip.c ============================================================================== --- stable/12/contrib/libarchive/libarchive/archive_read_support_format_zip.c Wed Oct 9 21:48:00 2019 (r353374) +++ stable/12/contrib/libarchive/libarchive/archive_read_support_format_zip.c Wed Oct 9 22:18:01 2019 (r353375) @@ -487,7 +487,7 @@ process_extra(struct archive_read *a, struct archive_e /* Some ZIP files may have trailing 0 bytes. Let's check they * are all 0 and ignore them instead of returning an error. * - * This is not techincally correct, but some ZIP files look + * This is not technically correct, but some ZIP files look * like this and other tools support those files - so let's * also support them. */ @@ -1053,7 +1053,7 @@ zip_read_local_file_header(struct archive_read *a, str /* Make sure that entries with a trailing '/' are marked as directories * even if the External File Attributes contains bogus values. If this - * is not a directory and there is no type, assume regularfile. */ + * is not a directory and there is no type, assume a regular file. */ if ((zip_entry->mode & AE_IFMT) != AE_IFDIR) { int has_slash; @@ -1104,7 +1104,7 @@ zip_read_local_file_header(struct archive_read *a, str } if (zip_entry->flags & LA_FROM_CENTRAL_DIRECTORY) { - /* If this came from the central dir, it's size info + /* If this came from the central dir, its size info * is definitive, so ignore the length-at-end flag. */ zip_entry->zip_flags &= ~ZIP_LENGTH_AT_END; /* If local header is missing a value, use the one from Modified: stable/12/contrib/libarchive/libarchive/archive_string.c ============================================================================== --- stable/12/contrib/libarchive/libarchive/archive_string.c Wed Oct 9 21:48:00 2019 (r353374) +++ stable/12/contrib/libarchive/libarchive/archive_string.c Wed Oct 9 22:18:01 2019 (r353375) @@ -458,7 +458,7 @@ archive_wstring_append_from_mbs_in_codepage(struct arc if (from_cp == CP_C_LOCALE) { /* - * "C" locale special process. + * "C" locale special processing. */ wchar_t *ws; const unsigned char *mp; @@ -680,7 +680,7 @@ archive_string_append_from_wcs_in_codepage(struct arch if (to_cp == CP_C_LOCALE) { /* - * "C" locale special process. + * "C" locale special processing. */ const wchar_t *wp = ws; char *p; @@ -889,7 +889,7 @@ add_converter(struct archive_string_conv *sc, int (*co struct archive_string_conv *)) { if (sc == NULL || sc->nconverter >= 2) - __archive_errx(1, "Programing error"); + __archive_errx(1, "Programming error"); sc->converter[sc->nconverter++] = converter; } Modified: stable/12/contrib/libarchive/libarchive/archive_util.3 ============================================================================== --- stable/12/contrib/libarchive/libarchive/archive_util.3 Wed Oct 9 21:48:00 2019 (r353374) +++ stable/12/contrib/libarchive/libarchive/archive_util.3 Wed Oct 9 22:18:01 2019 (r353375) @@ -92,10 +92,10 @@ Clears any error information left over from a previous Not generally used in client code. .It Fn archive_compression Synonym for -.Fn archive_filter_code(a, 0) . +.Fn archive_filter_code a 0 . .It Fn archive_compression_name Synonym for -.Fn archive_filter_name(a, 0) . +.Fn archive_filter_name a 0 . .It Fn archive_copy_error Copies error information from one archive to another. .It Fn archive_errno @@ -142,13 +142,13 @@ filter 0 is the gunzip filter, filter 1 is the uudecode filter, and filter 2 is the pseudo-filter that wraps the archive read functions. In this case, requesting -.Fn archive_position(a, -1) +.Fn archive_position a -1 would be a synonym for -.Fn archive_position(a, 2) +.Fn archive_position a 2 which would return the number of bytes currently read from the archive, while -.Fn archive_position(a, 1) +.Fn archive_position a 1 would return the number of bytes after uudecoding, and -.Fn archive_position(a, 0) +.Fn archive_position a 0 would return the number of bytes after decompression. .It Fn archive_filter_name Returns a textual name identifying the indicated filter. @@ -170,9 +170,9 @@ A textual description of the format of the current ent .It Fn archive_position Returns the number of bytes read from or written to the indicated filter. In particular, -.Fn archive_position(a, 0) +.Fn archive_position a 0 returns the number of bytes read or written by the format handler, while -.Fn archive_position(a, -1) +.Fn archive_position a -1 returns the number of bytes read or written to the archive. See .Fn archive_filter_count Modified: stable/12/contrib/libarchive/libarchive/archive_write.3 ============================================================================== --- stable/12/contrib/libarchive/libarchive/archive_write.3 Wed Oct 9 21:48:00 2019 (r353374) +++ stable/12/contrib/libarchive/libarchive/archive_write.3 Wed Oct 9 22:18:01 2019 (r353375) @@ -118,7 +118,7 @@ After all entries have been written, use the .Fn archive_write_free function to release all resources. .\" -.Sh EXAMPLE +.Sh EXAMPLES The following sketch illustrates basic usage of the library. In this example, the callback functions are simply wrappers around the standard @@ -192,7 +192,7 @@ write_archive(const char *outname, const char **filena if (archive_write_set_format_filter_by_ext(a, outname) != ARCHIVE_OK) { archive_write_add_filter_gzip(a); archive_write_set_format_ustar(a); - } + } archive_write_open(a, mydata, myopen, mywrite, myclose); while (*filename) { stat(*filename, &st); @@ -225,8 +225,8 @@ int main(int argc, const char **argv) .Ed .Sh SEE ALSO .Xr tar 1 , -.Xr libarchive 3 , .Xr archive_write_set_options 3 , +.Xr libarchive 3 , .Xr cpio 5 , .Xr mtree 5 , .Xr tar 5 Modified: stable/12/contrib/libarchive/libarchive/archive_write_blocksize.3 ============================================================================== --- stable/12/contrib/libarchive/libarchive/archive_write_blocksize.3 Wed Oct 9 21:48:00 2019 (r353374) +++ stable/12/contrib/libarchive/libarchive/archive_write_blocksize.3 Wed Oct 9 22:18:01 2019 (r353375) @@ -107,8 +107,8 @@ functions. .\" .Sh SEE ALSO .Xr tar 1 , -.Xr libarchive 3 , *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-12@freebsd.org Thu Oct 10 08:30:51 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4C75B14E331; Thu, 10 Oct 2019 08:30:51 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46pkn71JP7z4nD6; Thu, 10 Oct 2019 08:30:51 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1005C273D7; Thu, 10 Oct 2019 08:30:51 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9A8UogV044393; Thu, 10 Oct 2019 08:30:50 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9A8UocI044392; Thu, 10 Oct 2019 08:30:50 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201910100830.x9A8UocI044392@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 10 Oct 2019 08:30:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353384 - stable/12/sys/fs/tmpfs X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/fs/tmpfs X-SVN-Commit-Revision: 353384 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Oct 2019 08:30:51 -0000 Author: kib Date: Thu Oct 10 08:30:50 2019 New Revision: 353384 URL: https://svnweb.freebsd.org/changeset/base/353384 Log: MFC r353064: tmpfs_rename: style. Modified: stable/12/sys/fs/tmpfs/tmpfs_vnops.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- stable/12/sys/fs/tmpfs/tmpfs_vnops.c Thu Oct 10 08:28:34 2019 (r353383) +++ stable/12/sys/fs/tmpfs/tmpfs_vnops.c Thu Oct 10 08:30:50 2019 (r353384) @@ -793,23 +793,24 @@ tmpfs_rename(struct vop_rename_args *v) struct vnode *tvp = v->a_tvp; struct componentname *tcnp = v->a_tcnp; struct mount *mp = NULL; - char *newname; - int error; struct tmpfs_dirent *de; struct tmpfs_mount *tmp; struct tmpfs_node *fdnode; struct tmpfs_node *fnode; struct tmpfs_node *tnode; struct tmpfs_node *tdnode; + int error; MPASS(VOP_ISLOCKED(tdvp)); MPASS(IMPLIES(tvp != NULL, VOP_ISLOCKED(tvp))); MPASS(fcnp->cn_flags & HASBUF); MPASS(tcnp->cn_flags & HASBUF); - /* Disallow cross-device renames. - * XXX Why isn't this done by the caller? */ + /* + * Disallow cross-device renames. + * XXX Why isn't this done by the caller? + */ if (fvp->v_mount != tdvp->v_mount || (tvp != NULL && fvp->v_mount != tvp->v_mount)) { error = EXDEV; @@ -822,8 +823,10 @@ tmpfs_rename(struct vop_rename_args *v) goto out; } - /* If we need to move the directory between entries, lock the - * source so that we can safely operate on it. */ + /* + * If we need to move the directory between entries, lock the + * source so that we can safely operate on it. + */ if (fdvp != tdvp && fdvp != tvp) { if (vn_lock(fdvp, LK_EXCLUSIVE | LK_NOWAIT) != 0) { mp = tdvp->v_mount; @@ -859,8 +862,10 @@ tmpfs_rename(struct vop_rename_args *v) fnode = VP_TO_TMPFS_NODE(fvp); de = tmpfs_dir_lookup(fdnode, fnode, fcnp); - /* Entry can disappear before we lock fdvp, - * also avoid manipulating '.' and '..' entries. */ + /* + * Entry can disappear before we lock fdvp, + * also avoid manipulating '.' and '..' entries. + */ if (de == NULL) { if ((fcnp->cn_flags & ISDOTDOT) != 0 || (fcnp->cn_namelen == 1 && fcnp->cn_nameptr[0] == '.')) @@ -871,11 +876,13 @@ tmpfs_rename(struct vop_rename_args *v) } MPASS(de->td_node == fnode); - /* If re-naming a directory to another preexisting directory + /* + * If re-naming a directory to another preexisting directory * ensure that the target directory is empty so that its * removal causes no side effects. * Kern_rename guarantees the destination to be a directory - * if the source is one. */ + * if the source is one. + */ if (tvp != NULL) { MPASS(tnode != NULL); @@ -908,29 +915,39 @@ tmpfs_rename(struct vop_rename_args *v) goto out_locked; } - /* Ensure that we have enough memory to hold the new name, if it - * has to be changed. */ + /* + * Ensure that we have enough memory to hold the new name, if it + * has to be changed. + */ if (fcnp->cn_namelen != tcnp->cn_namelen || bcmp(fcnp->cn_nameptr, tcnp->cn_nameptr, fcnp->cn_namelen) != 0) { newname = malloc(tcnp->cn_namelen, M_TMPFSNAME, M_WAITOK); } else newname = NULL; - /* If the node is being moved to another directory, we have to do - * the move. */ + /* + * If the node is being moved to another directory, we have to do + * the move. + */ if (fdnode != tdnode) { - /* In case we are moving a directory, we have to adjust its - * parent to point to the new parent. */ + /* + * In case we are moving a directory, we have to adjust its + * parent to point to the new parent. + */ if (de->td_node->tn_type == VDIR) { struct tmpfs_node *n; - /* Ensure the target directory is not a child of the + /* + * Ensure the target directory is not a child of the * directory being moved. Otherwise, we'd end up - * with stale nodes. */ + * with stale nodes. + */ n = tdnode; - /* TMPFS_LOCK garanties that no nodes are freed while + /* + * TMPFS_LOCK guaranties that no nodes are freed while * traversing the list. Nodes can only be marked as - * removed: tn_parent == NULL. */ + * removed: tn_parent == NULL. + */ TMPFS_LOCK(tmp); TMPFS_NODE_LOCK(n); while (n != n->tn_dir.tn_parent) { @@ -973,9 +990,11 @@ tmpfs_rename(struct vop_rename_args *v) de->td_node->tn_dir.tn_parent = tdnode; TMPFS_NODE_UNLOCK(de->td_node); - /* As a result of changing the target of the '..' + /* + * As a result of changing the target of the '..' * entry, the link count of the source and target - * directories has to be adjusted. */ + * directories has to be adjusted. + */ TMPFS_NODE_LOCK(tdnode); TMPFS_ASSERT_LOCKED(tdnode); tdnode->tn_links++; @@ -988,8 +1007,10 @@ tmpfs_rename(struct vop_rename_args *v) } } - /* Do the move: just remove the entry from the source directory - * and insert it into the target one. */ + /* + * Do the move: just remove the entry from the source directory + * and insert it into the target one. + */ tmpfs_dir_detach(fdvp, de); if (fcnp->cn_flags & DOWHITEOUT) @@ -997,8 +1018,10 @@ tmpfs_rename(struct vop_rename_args *v) if (tcnp->cn_flags & ISWHITEOUT) tmpfs_dir_whiteout_remove(tdvp, tcnp); - /* If the name has changed, we need to make it effective by changing - * it in the directory entry. */ + /* + * If the name has changed, we need to make it effective by changing + * it in the directory entry. + */ if (newname != NULL) { MPASS(tcnp->cn_namelen <= MAXNAMLEN); @@ -1010,8 +1033,10 @@ tmpfs_rename(struct vop_rename_args *v) tdnode->tn_status |= TMPFS_NODE_MODIFIED; } - /* If we are overwriting an entry, we have to remove the old one - * from the target directory. */ + /* + * If we are overwriting an entry, we have to remove the old one + * from the target directory. + */ if (tvp != NULL) { struct tmpfs_dirent *tde; @@ -1019,9 +1044,11 @@ tmpfs_rename(struct vop_rename_args *v) tde = tmpfs_dir_lookup(tdnode, tnode, tcnp); tmpfs_dir_detach(tdvp, tde); - /* Free the directory entry we just deleted. Note that the + /* + * Free the directory entry we just deleted. Note that the * node referred by it will not be removed until the vnode is - * really reclaimed. */ + * really reclaimed. + */ tmpfs_free_dirent(VFS_TO_TMPFS(tvp->v_mount), tde); } @@ -1041,9 +1068,11 @@ out_locked: VOP_UNLOCK(fdvp, 0); out: - /* Release target nodes. */ - /* XXX: I don't understand when tdvp can be the same as tvp, but - * other code takes care of this... */ + /* + * Release target nodes. + * XXX: I don't understand when tdvp can be the same as tvp, but + * other code takes care of this... + */ if (tdvp == tvp) vrele(tdvp); else @@ -1058,7 +1087,7 @@ out: if (mp != NULL) vfs_unbusy(mp); - return error; + return (error); } static int From owner-svn-src-stable-12@freebsd.org Thu Oct 10 08:28:35 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 69EDD14E24C; Thu, 10 Oct 2019 08:28:35 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46pkkW0pKfz4n25; Thu, 10 Oct 2019 08:28:35 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F36B0272B9; Thu, 10 Oct 2019 08:28:34 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9A8SYje041863; Thu, 10 Oct 2019 08:28:34 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9A8SYkb041862; Thu, 10 Oct 2019 08:28:34 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201910100828.x9A8SYkb041862@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 10 Oct 2019 08:28:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353383 - stable/12/sys/fs/tmpfs X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/fs/tmpfs X-SVN-Commit-Revision: 353383 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Oct 2019 08:28:35 -0000 Author: kib Date: Thu Oct 10 08:28:34 2019 New Revision: 353383 URL: https://svnweb.freebsd.org/changeset/base/353383 Log: MFC r353033: Remove unnecessary vm/vm_page.h and vm/vm_pager.h includes from tmpfs/tmpfs_vnops.c. Modified: stable/12/sys/fs/tmpfs/tmpfs_vnops.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- stable/12/sys/fs/tmpfs/tmpfs_vnops.c Thu Oct 10 07:41:42 2019 (r353382) +++ stable/12/sys/fs/tmpfs/tmpfs_vnops.c Thu Oct 10 08:28:34 2019 (r353383) @@ -59,8 +59,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include -#include #include #include From owner-svn-src-stable-12@freebsd.org Thu Oct 10 14:52:49 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BB9C013DA21; Thu, 10 Oct 2019 14:52:49 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46pvFs3HHTz47p3; Thu, 10 Oct 2019 14:52:49 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 551113A0B; Thu, 10 Oct 2019 14:52:49 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9AEqnLx071391; Thu, 10 Oct 2019 14:52:49 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9AEqn8o071390; Thu, 10 Oct 2019 14:52:49 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201910101452.x9AEqn8o071390@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 10 Oct 2019 14:52:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353401 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 353401 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Oct 2019 14:52:49 -0000 Author: tuexen Date: Thu Oct 10 14:52:48 2019 New Revision: 353401 URL: https://svnweb.freebsd.org/changeset/base/353401 Log: MFC r353145: Plumb an mbuf leak in a code path that should not be taken. Also avoid that this path is taken by setting the tail pointer correctly. There is still bug related to handling unordered unfragmented messages which were delayed in deferred handling. This issue was found by OSS-Fuzz testing the usrsctp stack and reported in https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=17794 Modified: stable/12/sys/netinet/sctp_indata.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_indata.c ============================================================================== --- stable/12/sys/netinet/sctp_indata.c Thu Oct 10 14:51:38 2019 (r353400) +++ stable/12/sys/netinet/sctp_indata.c Thu Oct 10 14:52:48 2019 (r353401) @@ -716,6 +716,7 @@ sctp_add_to_tail_pointer(struct sctp_queued_to_read *c } if (control->tail_mbuf == NULL) { /* TSNH */ + sctp_m_freem(control->data); control->data = m; sctp_setup_tail_pointer(control); return; @@ -2119,10 +2120,13 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struc struct mbuf *mm; control->data = dmbuf; + control->tail_mbuf = NULL; for (mm = control->data; mm; mm = mm->m_next) { control->length += SCTP_BUF_LEN(mm); + if (SCTP_BUF_NEXT(mm) == NULL) { + control->tail_mbuf = mm; + } } - control->tail_mbuf = NULL; control->end_added = 1; control->last_frag_seen = 1; control->first_frag_seen = 1; From owner-svn-src-stable-12@freebsd.org Thu Oct 10 14:49:50 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6894B13D3B5; Thu, 10 Oct 2019 14:49:50 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46pvBQ1ytqz473X; Thu, 10 Oct 2019 14:49:50 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 26FB23831; Thu, 10 Oct 2019 14:49:50 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9AEnonT065795; Thu, 10 Oct 2019 14:49:50 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9AEno70065794; Thu, 10 Oct 2019 14:49:50 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201910101449.x9AEno70065794@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 10 Oct 2019 14:49:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353398 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 353398 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Oct 2019 14:49:50 -0000 Author: tuexen Date: Thu Oct 10 14:49:49 2019 New Revision: 353398 URL: https://svnweb.freebsd.org/changeset/base/353398 Log: MFC r353119: Fix the adding of padding to COOKIE-ECHO chunks. Thanks to Mark Wodrich who found this issue while fuzz testing the usrsctp stack and reported the issue in https://github.com/sctplab/usrsctp/issues/382 Modified: stable/12/sys/netinet/sctp_output.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_output.c ============================================================================== --- stable/12/sys/netinet/sctp_output.c Thu Oct 10 14:48:48 2019 (r353397) +++ stable/12/sys/netinet/sctp_output.c Thu Oct 10 14:49:49 2019 (r353398) @@ -9059,8 +9059,7 @@ sctp_send_cookie_echo(struct mbuf *m, pad = 4 - pad; } if (pad > 0) { - cookie = sctp_pad_lastmbuf(cookie, pad, NULL); - if (cookie == NULL) { + if (sctp_pad_lastmbuf(cookie, pad, NULL) == NULL) { return (-8); } } From owner-svn-src-stable-12@freebsd.org Thu Oct 10 14:50:44 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E114113D77E; Thu, 10 Oct 2019 14:50:44 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46pvCS5fmzz47GY; Thu, 10 Oct 2019 14:50:44 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A3E373849; Thu, 10 Oct 2019 14:50:44 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9AEoipq066548; Thu, 10 Oct 2019 14:50:44 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9AEoiwh066536; Thu, 10 Oct 2019 14:50:44 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201910101450.x9AEoiwh066536@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 10 Oct 2019 14:50:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353399 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 353399 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Oct 2019 14:50:45 -0000 Author: tuexen Date: Thu Oct 10 14:50:44 2019 New Revision: 353399 URL: https://svnweb.freebsd.org/changeset/base/353399 Log: MFC r353122: Plumb an mbuf leak found by Mark Wodrich from Google by fuzz testing the userland stack and reporting it in: https://github.com/sctplab/usrsctp/issues/396 Modified: stable/12/sys/netinet/sctp_input.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_input.c ============================================================================== --- stable/12/sys/netinet/sctp_input.c Thu Oct 10 14:49:49 2019 (r353398) +++ stable/12/sys/netinet/sctp_input.c Thu Oct 10 14:50:44 2019 (r353399) @@ -465,6 +465,10 @@ sctp_process_init_ack(struct mbuf *m, int iphlen, int if (!cookie_found) { uint16_t len; + /* Only report the missing cookie parameter */ + if (op_err != NULL) { + sctp_m_freem(op_err); + } len = (uint16_t)(sizeof(struct sctp_error_missing_param) + sizeof(uint16_t)); /* We abort with an error of missing mandatory param */ op_err = sctp_get_mbuf_for_msg(len, 0, M_NOWAIT, 1, MT_DATA); From owner-svn-src-stable-12@freebsd.org Thu Oct 10 14:54:23 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8BCA513DC17; Thu, 10 Oct 2019 14:54:23 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46pvHg39FGz482T; Thu, 10 Oct 2019 14:54:23 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 511DA3A15; Thu, 10 Oct 2019 14:54:23 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9AEsNBj071512; Thu, 10 Oct 2019 14:54:23 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9AEsMKs071511; Thu, 10 Oct 2019 14:54:22 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201910101454.x9AEsMKs071511@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 10 Oct 2019 14:54:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353402 - in stable/12: share/man/man4 sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: in stable/12: share/man/man4 sys/netinet X-SVN-Commit-Revision: 353402 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Oct 2019 14:54:23 -0000 Author: tuexen Date: Thu Oct 10 14:54:22 2019 New Revision: 353402 URL: https://svnweb.freebsd.org/changeset/base/353402 Log: MFC r353290: In r343587 a simple port filter as sysctl tunable was added to siftr. The new sysctl was not added to the siftr.4 man page at the time. This updates the man page, and removes one left over trailing whitespace. Submitted by: Richard Scheffenegger Differential Revision: https://reviews.freebsd.org/D21619 Modified: stable/12/share/man/man4/siftr.4 stable/12/sys/netinet/siftr.c Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/siftr.4 ============================================================================== --- stable/12/share/man/man4/siftr.4 Thu Oct 10 14:52:48 2019 (r353401) +++ stable/12/share/man/man4/siftr.4 Thu Oct 10 14:54:22 2019 (r353402) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 18, 2015 +.Dd October 7, 2019 .Dt SIFTR 4 .Os .Sh NAME @@ -130,6 +130,14 @@ By default, the value is set to 0, which means no hash The hashes are useful to correlate which TCP packet triggered the generation of a particular log message, but calculating them adds additional computational overhead into the fast path. +.El +.Bl -tag -offset indent -width Va +.It Va net.inet.siftr.port_filter +controls on which source or destination port siftr should capture +.Nm . +By default, the value is set to 0, which means all ports are eligible for logging. +Set to any other value, only packets where either the source or destination +port is equal to this number are logged. .El .Ss Log Format A typical Modified: stable/12/sys/netinet/siftr.c ============================================================================== --- stable/12/sys/netinet/siftr.c Thu Oct 10 14:52:48 2019 (r353401) +++ stable/12/sys/netinet/siftr.c Thu Oct 10 14:54:22 2019 (r353402) @@ -916,7 +916,7 @@ siftr_chkpkt(void *arg, struct mbuf **m, struct ifnet * Only pkts selected by the tcp port filter * can be inserted into the pkt_queue */ - if ((siftr_port_filter != 0) && + if ((siftr_port_filter != 0) && (siftr_port_filter != ntohs(inp->inp_lport)) && (siftr_port_filter != ntohs(inp->inp_fport))) { goto inp_unlock; From owner-svn-src-stable-12@freebsd.org Thu Oct 10 14:48:49 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8CEC613D30B; Thu, 10 Oct 2019 14:48:49 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46pv9F2Gkmz46wt; Thu, 10 Oct 2019 14:48:49 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 32091382F; Thu, 10 Oct 2019 14:48:49 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9AEmnaT065698; Thu, 10 Oct 2019 14:48:49 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9AEmnZ2065697; Thu, 10 Oct 2019 14:48:49 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201910101448.x9AEmnZ2065697@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 10 Oct 2019 14:48:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353397 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 353397 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Oct 2019 14:48:49 -0000 Author: tuexen Date: Thu Oct 10 14:48:48 2019 New Revision: 353397 URL: https://svnweb.freebsd.org/changeset/base/353397 Log: MFC r353071: When skipping the address parameter, take the padding into account. Modified: stable/12/sys/netinet/sctp_asconf.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_asconf.c ============================================================================== --- stable/12/sys/netinet/sctp_asconf.c Thu Oct 10 14:47:39 2019 (r353396) +++ stable/12/sys/netinet/sctp_asconf.c Thu Oct 10 14:48:48 2019 (r353397) @@ -699,8 +699,8 @@ sctp_handle_asconf(struct mbuf *m, unsigned int offset sctp_m_freem(m_ack); return; } - /* param_length is already validated in process_control... */ - offset += ntohs(p_addr->ph.param_length); /* skip lookup addr */ + /* skip lookup addr */ + offset += SCTP_SIZE32(ntohs(p_addr->ph.param_length)); /* get pointer to first asconf param in ASCONF */ aph = (struct sctp_asconf_paramhdr *)sctp_m_getptr(m, offset, sizeof(struct sctp_asconf_paramhdr), (uint8_t *)&aparam_buf); if (aph == NULL) { From owner-svn-src-stable-12@freebsd.org Thu Oct 10 08:33:14 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DF96314E52D; Thu, 10 Oct 2019 08:33:14 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46pkqt5YnWz4nY1; Thu, 10 Oct 2019 08:33:14 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A35C027484; Thu, 10 Oct 2019 08:33:14 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9A8XEdB047501; Thu, 10 Oct 2019 08:33:14 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9A8XEBJ047500; Thu, 10 Oct 2019 08:33:14 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201910100833.x9A8XEBJ047500@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 10 Oct 2019 08:33:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353385 - stable/12/sys/fs/tmpfs X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/fs/tmpfs X-SVN-Commit-Revision: 353385 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Oct 2019 08:33:14 -0000 Author: kib Date: Thu Oct 10 08:33:14 2019 New Revision: 353385 URL: https://svnweb.freebsd.org/changeset/base/353385 Log: MFC r353065: tmpfs_readdir(): unlock the locked node. Modified: stable/12/sys/fs/tmpfs/tmpfs_subr.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/fs/tmpfs/tmpfs_subr.c ============================================================================== --- stable/12/sys/fs/tmpfs/tmpfs_subr.c Thu Oct 10 08:30:50 2019 (r353384) +++ stable/12/sys/fs/tmpfs/tmpfs_subr.c Thu Oct 10 08:33:14 2019 (r353385) @@ -1149,8 +1149,9 @@ static int tmpfs_dir_getdotdotdent(struct tmpfs_mount *tm, struct tmpfs_node *node, struct uio *uio) { - int error; + struct tmpfs_node *parent; struct dirent dent; + int error; TMPFS_VALIDATE_DIR(node); MPASS(uio->uio_offset == TMPFS_DIRCOOKIE_DOTDOT); @@ -1159,12 +1160,13 @@ tmpfs_dir_getdotdotdent(struct tmpfs_mount *tm, struct * Return ENOENT if the current node is already removed. */ TMPFS_ASSERT_LOCKED(node); - if (node->tn_dir.tn_parent == NULL) + parent = node->tn_dir.tn_parent; + if (parent == NULL) return (ENOENT); - TMPFS_NODE_LOCK(node->tn_dir.tn_parent); - dent.d_fileno = node->tn_dir.tn_parent->tn_id; - TMPFS_NODE_UNLOCK(node->tn_dir.tn_parent); + TMPFS_NODE_LOCK(parent); + dent.d_fileno = parent->tn_id; + TMPFS_NODE_UNLOCK(parent); dent.d_type = DT_DIR; dent.d_namlen = 2; From owner-svn-src-stable-12@freebsd.org Thu Oct 10 14:46:00 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7643613CE16; Thu, 10 Oct 2019 14:46:00 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46pv602XsXz45w4; Thu, 10 Oct 2019 14:46:00 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 21614382B; Thu, 10 Oct 2019 14:46:00 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9AEk0P3065458; Thu, 10 Oct 2019 14:46:00 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9AEk0Jl065457; Thu, 10 Oct 2019 14:46:00 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201910101446.x9AEk0Jl065457@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 10 Oct 2019 14:46:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353395 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 353395 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Oct 2019 14:46:00 -0000 Author: tuexen Date: Thu Oct 10 14:45:59 2019 New Revision: 353395 URL: https://svnweb.freebsd.org/changeset/base/353395 Log: MFC r353060: Add missing input validation. This could result in reading from uninitialized memory. The issue was found by OSS-Fuzz for usrsctp and reported in https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=17780 Modified: stable/12/sys/netinet/sctp_asconf.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_asconf.c ============================================================================== --- stable/12/sys/netinet/sctp_asconf.c Thu Oct 10 13:44:12 2019 (r353394) +++ stable/12/sys/netinet/sctp_asconf.c Thu Oct 10 14:45:59 2019 (r353395) @@ -169,10 +169,16 @@ sctp_process_asconf_add_ip(struct sockaddr *src, struc #endif aparam_length = ntohs(aph->ph.param_length); + if (aparam_length < sizeof(struct sctp_asconf_paramhdr) + sizeof(struct sctp_paramhdr)) { + return (NULL); + } ph = (struct sctp_paramhdr *)(aph + 1); param_type = ntohs(ph->param_type); #if defined(INET) || defined(INET6) param_length = ntohs(ph->param_length); + if (param_length + sizeof(struct sctp_asconf_paramhdr) != aparam_length) { + return (NULL); + } #endif sa = &store.sa; switch (param_type) { @@ -325,8 +331,14 @@ sctp_process_asconf_delete_ip(struct sockaddr *src, aparam_length = ntohs(aph->ph.param_length); ph = (struct sctp_paramhdr *)(aph + 1); param_type = ntohs(ph->param_type); + if (aparam_length < sizeof(struct sctp_asconf_paramhdr) + sizeof(struct sctp_paramhdr)) { + return (NULL); + } #if defined(INET) || defined(INET6) param_length = ntohs(ph->param_length); + if (param_length + sizeof(struct sctp_asconf_paramhdr) != aparam_length) { + return (NULL); + } #endif sa = &store.sa; switch (param_type) { @@ -454,10 +466,16 @@ sctp_process_asconf_set_primary(struct sockaddr *src, #endif aparam_length = ntohs(aph->ph.param_length); + if (aparam_length < sizeof(struct sctp_asconf_paramhdr) + sizeof(struct sctp_paramhdr)) { + return (NULL); + } ph = (struct sctp_paramhdr *)(aph + 1); param_type = ntohs(ph->param_type); #if defined(INET) || defined(INET6) param_length = ntohs(ph->param_length); + if (param_length + sizeof(struct sctp_asconf_paramhdr) != aparam_length) { + return (NULL); + } #endif sa = &store.sa; switch (param_type) { From owner-svn-src-stable-12@freebsd.org Thu Oct 10 14:47:40 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 04FA013CFCA; Thu, 10 Oct 2019 14:47:40 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46pv7v6M34z46NB; Thu, 10 Oct 2019 14:47:39 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BEB27382C; Thu, 10 Oct 2019 14:47:39 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9AEldq8065594; Thu, 10 Oct 2019 14:47:39 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9AElddG065593; Thu, 10 Oct 2019 14:47:39 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201910101447.x9AElddG065593@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 10 Oct 2019 14:47:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353396 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 353396 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Oct 2019 14:47:40 -0000 Author: tuexen Date: Thu Oct 10 14:47:39 2019 New Revision: 353396 URL: https://svnweb.freebsd.org/changeset/base/353396 Log: MFC r353069: Cleanup sctp_asconf_error_response() and ensure that the parameter is padded as required. This fixes the followig bug reported by OSS-Fuzz for the usersctp stack: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=17790 Modified: stable/12/sys/netinet/sctp_asconf.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_asconf.c ============================================================================== --- stable/12/sys/netinet/sctp_asconf.c Thu Oct 10 14:45:59 2019 (r353395) +++ stable/12/sys/netinet/sctp_asconf.c Thu Oct 10 14:47:39 2019 (r353396) @@ -105,42 +105,47 @@ sctp_asconf_error_response(uint32_t id, uint16_t cause struct mbuf *m_reply = NULL; struct sctp_asconf_paramhdr *aph; struct sctp_error_cause *error; + size_t buf_len; + uint16_t i, param_length, cause_length, padding_length; uint8_t *tlv; - m_reply = sctp_get_mbuf_for_msg((sizeof(struct sctp_asconf_paramhdr) + - tlv_length + - sizeof(struct sctp_error_cause)), - 0, M_NOWAIT, 1, MT_DATA); + if (error_tlv == NULL) { + tlv_length = 0; + } + cause_length = sizeof(struct sctp_error_cause) + tlv_length; + param_length = sizeof(struct sctp_asconf_paramhdr) + cause_length; + padding_length = tlv_length % 4; + if (padding_length != 0) { + padding_length = 4 - padding_length; + } + buf_len = param_length + padding_length; + if (buf_len > MLEN) { + SCTPDBG(SCTP_DEBUG_ASCONF1, + "asconf_error_response: tlv_length (%xh) too big\n", + tlv_length); + return (NULL); + } + m_reply = sctp_get_mbuf_for_msg(buf_len, 0, M_NOWAIT, 1, MT_DATA); if (m_reply == NULL) { SCTPDBG(SCTP_DEBUG_ASCONF1, "asconf_error_response: couldn't get mbuf!\n"); return (NULL); } aph = mtod(m_reply, struct sctp_asconf_paramhdr *); - error = (struct sctp_error_cause *)(aph + 1); - - aph->correlation_id = id; aph->ph.param_type = htons(SCTP_ERROR_CAUSE_IND); + aph->ph.param_length = htons(param_length); + aph->correlation_id = id; + error = (struct sctp_error_cause *)(aph + 1); error->code = htons(cause); - error->length = tlv_length + sizeof(struct sctp_error_cause); - aph->ph.param_length = error->length + - sizeof(struct sctp_asconf_paramhdr); - - if (aph->ph.param_length > MLEN) { - SCTPDBG(SCTP_DEBUG_ASCONF1, - "asconf_error_response: tlv_length (%xh) too big\n", - tlv_length); - sctp_m_freem(m_reply); /* discard */ - return (NULL); - } + error->length = htons(cause_length); if (error_tlv != NULL) { tlv = (uint8_t *)(error + 1); memcpy(tlv, error_tlv, tlv_length); + for (i = 0; i < padding_length; i++) { + tlv[tlv_length + i] = 0; + } } - SCTP_BUF_LEN(m_reply) = aph->ph.param_length; - error->length = htons(error->length); - aph->ph.param_length = htons(aph->ph.param_length); - + SCTP_BUF_LEN(m_reply) = buf_len; return (m_reply); } @@ -780,8 +785,6 @@ sctp_handle_asconf(struct mbuf *m, unsigned int offset if (m_result != NULL) { SCTP_BUF_NEXT(m_tail) = m_result; m_tail = m_result; - /* update lengths, make sure it's aligned too */ - SCTP_BUF_LEN(m_result) = SCTP_SIZE32(SCTP_BUF_LEN(m_result)); ack_cp->ch.chunk_length += SCTP_BUF_LEN(m_result); /* set flag to force success reports */ error = 1; From owner-svn-src-stable-12@freebsd.org Thu Oct 10 14:51:39 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 494DB13D896; Thu, 10 Oct 2019 14:51:39 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46pvDW0g28z47RG; Thu, 10 Oct 2019 14:51:39 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EE2E939B1; Thu, 10 Oct 2019 14:51:38 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9AEpcbE068838; Thu, 10 Oct 2019 14:51:38 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9AEpcOK068837; Thu, 10 Oct 2019 14:51:38 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201910101451.x9AEpcOK068837@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 10 Oct 2019 14:51:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353400 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 353400 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Oct 2019 14:51:39 -0000 Author: tuexen Date: Thu Oct 10 14:51:38 2019 New Revision: 353400 URL: https://svnweb.freebsd.org/changeset/base/353400 Log: MFC r353123: Fix a use after free bug when removing remote addresses. This bug was found by OSS-Fuzz and reported in https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=18004 Modified: stable/12/sys/netinet/sctp_asconf.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_asconf.c ============================================================================== --- stable/12/sys/netinet/sctp_asconf.c Thu Oct 10 14:50:44 2019 (r353399) +++ stable/12/sys/netinet/sctp_asconf.c Thu Oct 10 14:51:38 2019 (r353400) @@ -283,7 +283,7 @@ sctp_process_asconf_add_ip(struct sockaddr *src, struc static int sctp_asconf_del_remote_addrs_except(struct sctp_tcb *stcb, struct sockaddr *src) { - struct sctp_nets *src_net, *net; + struct sctp_nets *src_net, *net, *nnet; /* make sure the source address exists as a destination net */ src_net = sctp_findnet(stcb, src); @@ -293,10 +293,9 @@ sctp_asconf_del_remote_addrs_except(struct sctp_tcb *s } /* delete all destination addresses except the source */ - TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) { + TAILQ_FOREACH_SAFE(net, &stcb->asoc.nets, sctp_next, nnet) { if (net != src_net) { /* delete this address */ - sctp_remove_net(stcb, net); SCTPDBG(SCTP_DEBUG_ASCONF1, "asconf_del_remote_addrs_except: deleting "); SCTPDBG_ADDR(SCTP_DEBUG_ASCONF1, @@ -304,6 +303,7 @@ sctp_asconf_del_remote_addrs_except(struct sctp_tcb *s /* notify upper layer */ sctp_ulp_notify(SCTP_NOTIFY_ASCONF_DELETE_IP, stcb, 0, (struct sockaddr *)&net->ro._l_addr, SCTP_SO_NOT_LOCKED); + sctp_remove_net(stcb, net); } } return (0); From owner-svn-src-stable-12@freebsd.org Thu Oct 10 14:56:30 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 326FC13DE3A; Thu, 10 Oct 2019 14:56:30 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46pvL60gy3z48FM; Thu, 10 Oct 2019 14:56:30 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EEF083A1A; Thu, 10 Oct 2019 14:56:29 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9AEuThi071688; Thu, 10 Oct 2019 14:56:29 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9AEuTW0071687; Thu, 10 Oct 2019 14:56:29 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201910101456.x9AEuTW0071687@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 10 Oct 2019 14:56:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353403 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 353403 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Oct 2019 14:56:30 -0000 Author: tuexen Date: Thu Oct 10 14:56:29 2019 New Revision: 353403 URL: https://svnweb.freebsd.org/changeset/base/353403 Log: MFC r353303: Validate length before use it, not vice versa. r353060 should have contained this... This fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=18070 Modified: stable/12/sys/netinet/sctp_asconf.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_asconf.c ============================================================================== --- stable/12/sys/netinet/sctp_asconf.c Thu Oct 10 14:54:22 2019 (r353402) +++ stable/12/sys/netinet/sctp_asconf.c Thu Oct 10 14:56:29 2019 (r353403) @@ -334,11 +334,11 @@ sctp_process_asconf_delete_ip(struct sockaddr *src, #endif aparam_length = ntohs(aph->ph.param_length); - ph = (struct sctp_paramhdr *)(aph + 1); - param_type = ntohs(ph->param_type); if (aparam_length < sizeof(struct sctp_asconf_paramhdr) + sizeof(struct sctp_paramhdr)) { return (NULL); } + ph = (struct sctp_paramhdr *)(aph + 1); + param_type = ntohs(ph->param_type); #if defined(INET) || defined(INET6) param_length = ntohs(ph->param_length); if (param_length + sizeof(struct sctp_asconf_paramhdr) != aparam_length) { From owner-svn-src-stable-12@freebsd.org Thu Oct 10 15:36:46 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 502DC141E1E; Thu, 10 Oct 2019 15:36:46 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46pwDZ0jYNz4FQH; Thu, 10 Oct 2019 15:36:46 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EDFA54186; Thu, 10 Oct 2019 15:36:45 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9AFajx7094978; Thu, 10 Oct 2019 15:36:45 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9AFajUf094977; Thu, 10 Oct 2019 15:36:45 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201910101536.x9AFajUf094977@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 10 Oct 2019 15:36:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353405 - stable/12/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 353405 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Oct 2019 15:36:46 -0000 Author: hselasky Date: Thu Oct 10 15:36:45 2019 New Revision: 353405 URL: https://svnweb.freebsd.org/changeset/base/353405 Log: MFC r353321: Fix regression issue after r352989: As noted by the commit message, callouts are now persistant and should not be in the auto-zero section of the RQ's and SQ's. This fixes an assert when using the TX completion event factor feature with mlx5en(4). Found by: gallatin@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/mlx5/mlx5_en/en.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- stable/12/sys/dev/mlx5/mlx5_en/en.h Thu Oct 10 15:19:49 2019 (r353404) +++ stable/12/sys/dev/mlx5/mlx5_en/en.h Thu Oct 10 15:36:45 2019 (r353405) @@ -747,6 +747,7 @@ struct mlx5e_rq { /* persistant fields */ struct mtx mtx; struct mlx5e_rq_stats stats; + struct callout watchdog; /* data path */ #define mlx5e_rq_zero_start wq @@ -768,7 +769,6 @@ struct mlx5e_rq { struct mlx5_wq_ctrl wq_ctrl; u32 rqn; struct mlx5e_channel *channel; - struct callout watchdog; } __aligned(MLX5E_CACHELINE_SIZE); struct mlx5e_sq_mbuf { @@ -793,6 +793,7 @@ struct mlx5e_sq { struct mtx lock; struct mtx comp_lock; struct mlx5e_sq_stats stats; + struct callout cev_callout; /* data path */ #define mlx5e_sq_zero_start dma_tag @@ -811,7 +812,6 @@ struct mlx5e_sq { #define MLX5E_CEV_STATE_SEND_NOPS 1 /* send NOPs */ #define MLX5E_CEV_STATE_HOLD_NOPS 2 /* don't send NOPs yet */ u16 running; /* set if SQ is running */ - struct callout cev_callout; union { u32 d32[2]; u64 d64; From owner-svn-src-stable-12@freebsd.org Thu Oct 10 17:29:47 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BCA76144855; Thu, 10 Oct 2019 17:29:47 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46pykz4Vh5z4MFV; Thu, 10 Oct 2019 17:29:47 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 799DD549F; Thu, 10 Oct 2019 17:29:47 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9AHTlwN060224; Thu, 10 Oct 2019 17:29:47 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9AHTlnC060223; Thu, 10 Oct 2019 17:29:47 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201910101729.x9AHTlnC060223@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Thu, 10 Oct 2019 17:29:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353409 - stable/12/usr.sbin/pkg X-SVN-Group: stable-12 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: stable/12/usr.sbin/pkg X-SVN-Commit-Revision: 353409 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Oct 2019 17:29:47 -0000 Author: gjb Date: Thu Oct 10 17:29:47 2019 New Revision: 353409 URL: https://svnweb.freebsd.org/changeset/base/353409 Log: MFC r353320: Rework the logic for installing the pkg(8) configuration. 'quarterly' package sets do not exist for head, so explicitly install the 'latest' configuration file there. Otherwise, fall back to the original conditional evaluation to determine if the 'latest' or 'quarterly' configuration file should be installed. Sponsored by: Rubicon Communications, LLC (Netgate) Modified: stable/12/usr.sbin/pkg/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/pkg/Makefile ============================================================================== --- stable/12/usr.sbin/pkg/Makefile Thu Oct 10 16:29:13 2019 (r353408) +++ stable/12/usr.sbin/pkg/Makefile Thu Oct 10 17:29:47 2019 (r353409) @@ -1,14 +1,18 @@ # $FreeBSD$ -.if ${MACHINE} != "amd64" && ${MACHINE} != "i386" -PKGCONFBRANCH?= quarterly -.else _BRANCH!= ${MAKE} -C ${SRCTOP}/release -V BRANCH BRANCH?= ${_BRANCH} +.if ${BRANCH:MCURRENT} != "" +PKGCONFBRANCH?= latest +.else . if ${BRANCH:MBETA*} || ${BRANCH:MRC*} || ${BRANCH:MRELEASE*} PKGCONFBRANCH?= quarterly . else +. if ${MACHINE} != "amd64" && ${MACHINE} != "i386" +PKGCONFBRANCH?= quarterly +. else PKGCONFBRANCH?= latest +. endif . endif .endif CONFS= FreeBSD.conf.${PKGCONFBRANCH} From owner-svn-src-stable-12@freebsd.org Sat Oct 12 01:02:46 2019 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AF40A136C06; Sat, 12 Oct 2019 01:02:46 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46qmlB4FmLz4CP5; Sat, 12 Oct 2019 01:02:46 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7542B2293C; Sat, 12 Oct 2019 01:02:46 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9C12kZB086436; Sat, 12 Oct 2019 01:02:46 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9C12kD1086435; Sat, 12 Oct 2019 01:02:46 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201910120102.x9C12kD1086435@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Sat, 12 Oct 2019 01:02:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353450 - in stable: 11/lib/libucl 12/lib/libucl X-SVN-Group: stable-12 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: in stable: 11/lib/libucl 12/lib/libucl X-SVN-Commit-Revision: 353450 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Oct 2019 01:02:46 -0000 Author: gjb Date: Sat Oct 12 01:02:45 2019 New Revision: 353450 URL: https://svnweb.freebsd.org/changeset/base/353450 Log: MFC r353348: Connect the libucl(3) manual page to the build. Sponsored by: Rubicon Communications, LLC (Netgate) Modified: stable/12/lib/libucl/Makefile Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/lib/libucl/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/12/lib/libucl/Makefile ============================================================================== --- stable/12/lib/libucl/Makefile Fri Oct 11 21:28:02 2019 (r353449) +++ stable/12/lib/libucl/Makefile Sat Oct 12 01:02:45 2019 (r353450) @@ -17,7 +17,8 @@ SRCS= ucl_emitter_streamline.c \ ucl_util.c .PATH: ${LIBUCL}/src \ - ${LIBUCL}/include + ${LIBUCL}/include \ + ${LIBUCL}/doc INCS= ucl.h LIBADD= m @@ -27,5 +28,7 @@ CFLAGS+= -I${LIBUCL}/include \ -I${LIBUCL}/src \ -I${LIBUCL}/uthash \ -I${LIBUCL}/klib + +MAN+= libucl.3 .include