From owner-svn-src-stable-10@freebsd.org Sun Nov 5 20:28:29 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D9407E50775; Sun, 5 Nov 2017 20:28:29 +0000 (UTC) (envelope-from rmacklem@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 mx1.freebsd.org (Postfix) with ESMTPS id B496469B1E; Sun, 5 Nov 2017 20:28:29 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vA5KSSDn054486; Sun, 5 Nov 2017 20:28:28 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vA5KSSlF054484; Sun, 5 Nov 2017 20:28:28 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201711052028.vA5KSSlF054484@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Sun, 5 Nov 2017 20:28:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r325448 - stable/10/sys/fs/nfsserver X-SVN-Group: stable-10 X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: stable/10/sys/fs/nfsserver X-SVN-Commit-Revision: 325448 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-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Nov 2017 20:28:30 -0000 Author: rmacklem Date: Sun Nov 5 20:28:28 2017 New Revision: 325448 URL: https://svnweb.freebsd.org/changeset/base/325448 Log: MFC: r324639 Fix the client IP address reported by nfsdumpstate for 64bit arch and NFSv4.1. The client IP address was not being reported for some NFSv4 mounts by nfsdumpstate. Upon investigation, two problems were found for mounts using IPv4. One was that the code (originally written and tested on i386) assumed that a "u_long" was a "uint32_t" and would exactly store an IPv4 host address. Not correct for 64bit arches. Also, for NFSv4.1 mounts, the field was not being filled in. This was basically correct, because NFSv4.1 does not use a callback address. However, it meant that nfsdumpstate could not report the client IP addr. This patch should fix both of these issues. For IPv6, the address will still not be reported. The original NFSv4 RFC only specified IPv4 callback addresses. I think this has changed and, if so, a future commit to fix reporting of IPv6 addresses will be needed. Modified: stable/10/sys/fs/nfsserver/nfs_nfsdserv.c stable/10/sys/fs/nfsserver/nfs_nfsdstate.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfsserver/nfs_nfsdserv.c ============================================================================== --- stable/10/sys/fs/nfsserver/nfs_nfsdserv.c Sun Nov 5 20:03:57 2017 (r325447) +++ stable/10/sys/fs/nfsserver/nfs_nfsdserv.c Sun Nov 5 20:28:28 2017 (r325448) @@ -3700,6 +3700,7 @@ nfsrvd_exchangeid(struct nfsrv_descript *nd, __unused uint32_t sp4type, v41flags; uint64_t owner_minor; struct timespec verstime; + struct sockaddr_in *sad, *rad; if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) { nd->nd_repstat = NFSERR_WRONGSEC; @@ -3723,6 +3724,13 @@ nfsrvd_exchangeid(struct nfsrv_descript *nd, __unused NFSINITSOCKMUTEX(&clp->lc_req.nr_mtx); NFSSOCKADDRALLOC(clp->lc_req.nr_nam); NFSSOCKADDRSIZE(clp->lc_req.nr_nam, sizeof (struct sockaddr_in)); + sad = NFSSOCKADDR(nd->nd_nam, struct sockaddr_in *); + rad = NFSSOCKADDR(clp->lc_req.nr_nam, struct sockaddr_in *); + rad->sin_family = AF_INET; + rad->sin_addr.s_addr = 0; + rad->sin_port = 0; + if (sad->sin_family == AF_INET) + rad->sin_addr.s_addr = sad->sin_addr.s_addr; clp->lc_req.nr_cred = NULL; NFSBCOPY(verf, clp->lc_verf, NFSX_VERF); clp->lc_idlen = idlen; Modified: stable/10/sys/fs/nfsserver/nfs_nfsdstate.c ============================================================================== --- stable/10/sys/fs/nfsserver/nfs_nfsdstate.c Sun Nov 5 20:03:57 2017 (r325447) +++ stable/10/sys/fs/nfsserver/nfs_nfsdstate.c Sun Nov 5 20:28:28 2017 (r325448) @@ -3888,11 +3888,11 @@ nfsrv_getclientipaddr(struct nfsrv_descript *nd, struc u_char protocol[5], addr[24]; int error = 0, cantparse = 0; union { - u_long ival; + in_addr_t ival; u_char cval[4]; } ip; union { - u_short sval; + in_port_t sval; u_char cval[2]; } port; @@ -3986,8 +3986,10 @@ nfsrv_getclientipaddr(struct nfsrv_descript *nd, struc } if (cantparse) { sad = NFSSOCKADDR(nd->nd_nam, struct sockaddr_in *); - rad->sin_addr.s_addr = sad->sin_addr.s_addr; - rad->sin_port = 0x0; + if (sad->sin_family == AF_INET) { + rad->sin_addr.s_addr = sad->sin_addr.s_addr; + rad->sin_port = 0x0; + } clp->lc_program = 0; } nfsmout: From owner-svn-src-stable-10@freebsd.org Sun Nov 5 22:34:28 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 87B0DE53F4F; Sun, 5 Nov 2017 22:34:28 +0000 (UTC) (envelope-from ngie@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 mx1.freebsd.org (Postfix) with ESMTPS id 567FF6F8D6; Sun, 5 Nov 2017 22:34:28 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vA5MYRUL011219; Sun, 5 Nov 2017 22:34:27 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vA5MYREj011218; Sun, 5 Nov 2017 22:34:27 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201711052234.vA5MYREj011218@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sun, 5 Nov 2017 22:34:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r325460 - stable/10/sys/kern X-SVN-Group: stable-10 X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: stable/10/sys/kern X-SVN-Commit-Revision: 325460 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-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Nov 2017 22:34:28 -0000 Author: ngie Date: Sun Nov 5 22:34:27 2017 New Revision: 325460 URL: https://svnweb.freebsd.org/changeset/base/325460 Log: MFC r324862: Clean up trailing whitespace in kdb_thr_ctx(..) Modified: stable/10/sys/kern/subr_kdb.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/subr_kdb.c ============================================================================== --- stable/10/sys/kern/subr_kdb.c Sun Nov 5 22:33:41 2017 (r325459) +++ stable/10/sys/kern/subr_kdb.c Sun Nov 5 22:34:27 2017 (r325460) @@ -515,12 +515,12 @@ kdb_reenter(void) struct pcb * kdb_thr_ctx(struct thread *thr) -{ +{ #if defined(SMP) && defined(KDB_STOPPEDPCB) struct pcpu *pc; #endif - - if (thr == curthread) + + if (thr == curthread) return (&kdb_pcb); #if defined(SMP) && defined(KDB_STOPPEDPCB) From owner-svn-src-stable-10@freebsd.org Sun Nov 5 22:36:34 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0D080E54047; Sun, 5 Nov 2017 22:36:34 +0000 (UTC) (envelope-from ngie@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 mx1.freebsd.org (Postfix) with ESMTPS id CE2836FB45; Sun, 5 Nov 2017 22:36:33 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vA5MaWOc011457; Sun, 5 Nov 2017 22:36:32 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vA5MaWP4011456; Sun, 5 Nov 2017 22:36:32 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201711052236.vA5MaWP4011456@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sun, 5 Nov 2017 22:36:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r325462 - stable/10/lib/libugidfw X-SVN-Group: stable-10 X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: stable/10/lib/libugidfw X-SVN-Commit-Revision: 325462 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-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Nov 2017 22:36:34 -0000 Author: ngie Date: Sun Nov 5 22:36:32 2017 New Revision: 325462 URL: https://svnweb.freebsd.org/changeset/base/325462 Log: MFC r324928: Remove dead stores The return value of various snprintf calls was stored in `len` and not used in many functions. Modified: stable/10/lib/libugidfw/ugidfw.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libugidfw/ugidfw.c ============================================================================== --- stable/10/lib/libugidfw/ugidfw.c Sun Nov 5 22:36:02 2017 (r325461) +++ stable/10/lib/libugidfw/ugidfw.c Sun Nov 5 22:36:32 2017 (r325462) @@ -513,7 +513,6 @@ bsde_parse_uidrange(char *spec, uid_t *min, uid_t *max uid_t uid1, uid2; char *spec1, *spec2, *endp; unsigned long value; - size_t len; spec2 = spec; spec1 = strsep(&spec2, ":"); @@ -524,8 +523,7 @@ bsde_parse_uidrange(char *spec, uid_t *min, uid_t *max else { value = strtoul(spec1, &endp, 10); if (*endp != '\0') { - len = snprintf(errstr, buflen, - "invalid uid: '%s'", spec1); + snprintf(errstr, buflen, "invalid uid: '%s'", spec1); return (-1); } uid1 = value; @@ -542,8 +540,7 @@ bsde_parse_uidrange(char *spec, uid_t *min, uid_t *max else { value = strtoul(spec2, &endp, 10); if (*endp != '\0') { - len = snprintf(errstr, buflen, - "invalid uid: '%s'", spec2); + snprintf(errstr, buflen, "invalid uid: '%s'", spec2); return (-1); } uid2 = value; @@ -562,7 +559,6 @@ bsde_parse_gidrange(char *spec, gid_t *min, gid_t *max gid_t gid1, gid2; char *spec1, *spec2, *endp; unsigned long value; - size_t len; spec2 = spec; spec1 = strsep(&spec2, ":"); @@ -573,8 +569,7 @@ bsde_parse_gidrange(char *spec, gid_t *min, gid_t *max else { value = strtoul(spec1, &endp, 10); if (*endp != '\0') { - len = snprintf(errstr, buflen, - "invalid gid: '%s'", spec1); + snprintf(errstr, buflen, "invalid gid: '%s'", spec1); return (-1); } gid1 = value; @@ -591,8 +586,7 @@ bsde_parse_gidrange(char *spec, gid_t *min, gid_t *max else { value = strtoul(spec2, &endp, 10); if (*endp != '\0') { - len = snprintf(errstr, buflen, - "invalid gid: '%s'", spec2); + snprintf(errstr, buflen, "invalid gid: '%s'", spec2); return (-1); } gid2 = value; @@ -614,7 +608,6 @@ bsde_parse_subject(int argc, char *argv[], uid_t uid_min, uid_max; gid_t gid_min, gid_max; int jid; - size_t len; long value; current = 0; @@ -631,11 +624,11 @@ bsde_parse_subject(int argc, char *argv[], while (current < argc) { if (strcmp(argv[current], "uid") == 0) { if (current + 2 > argc) { - len = snprintf(errstr, buflen, "uid short"); + snprintf(errstr, buflen, "uid short"); return (-1); } if (flags & MBS_UID_DEFINED) { - len = snprintf(errstr, buflen, "one uid only"); + snprintf(errstr, buflen, "one uid only"); return (-1); } if (bsde_parse_uidrange(argv[current+1], @@ -649,11 +642,11 @@ bsde_parse_subject(int argc, char *argv[], current += 2; } else if (strcmp(argv[current], "gid") == 0) { if (current + 2 > argc) { - len = snprintf(errstr, buflen, "gid short"); + snprintf(errstr, buflen, "gid short"); return (-1); } if (flags & MBS_GID_DEFINED) { - len = snprintf(errstr, buflen, "one gid only"); + snprintf(errstr, buflen, "one gid only"); return (-1); } if (bsde_parse_gidrange(argv[current+1], @@ -667,17 +660,17 @@ bsde_parse_subject(int argc, char *argv[], current += 2; } else if (strcmp(argv[current], "jailid") == 0) { if (current + 2 > argc) { - len = snprintf(errstr, buflen, "prison short"); + snprintf(errstr, buflen, "prison short"); return (-1); } if (flags & MBS_PRISON_DEFINED) { - len = snprintf(errstr, buflen, "one jail only"); + snprintf(errstr, buflen, "one jail only"); return (-1); } value = strtol(argv[current+1], &endp, 10); if (*endp != '\0') { - len = snprintf(errstr, buflen, - "invalid jid: '%s'", argv[current+1]); + snprintf(errstr, buflen, "invalid jid: '%s'", + argv[current+1]); return (-1); } jid = value; @@ -689,14 +682,13 @@ bsde_parse_subject(int argc, char *argv[], current += 2; } else if (strcmp(argv[current], "!") == 0) { if (nextnot) { - len = snprintf(errstr, buflen, - "double negative"); + snprintf(errstr, buflen, "double negative"); return (-1); } nextnot = 1; current += 1; } else { - len = snprintf(errstr, buflen, "'%s' not expected", + snprintf(errstr, buflen, "'%s' not expected", argv[current]); return (-1); } @@ -724,7 +716,6 @@ bsde_parse_subject(int argc, char *argv[], int bsde_parse_type(char *spec, int *type, size_t buflen, char *errstr) { - size_t len; int i; *type = 0; @@ -756,10 +747,10 @@ bsde_parse_type(char *spec, int *type, size_t buflen, *type |= MBO_ALL_TYPE; break; default: - len = snprintf(errstr, buflen, "Unknown type code: %c", + snprintf(errstr, buflen, "Unknown type code: %c", spec[i]); return (-1); - } + } } return (0); @@ -768,11 +759,10 @@ bsde_parse_type(char *spec, int *type, size_t buflen, int bsde_parse_fsid(char *spec, struct fsid *fsid, size_t buflen, char *errstr) { - size_t len; struct statfs buf; if (statfs(spec, &buf) < 0) { - len = snprintf(errstr, buflen, "Unable to get id for %s: %s", + snprintf(errstr, buflen, "Unable to get id for %s: %s", spec, strerror(errno)); return (-1); } @@ -792,7 +782,6 @@ bsde_parse_object(int argc, char *argv[], gid_t gid_min, gid_max; int type; struct fsid fsid; - size_t len; current = 0; flags = 0; @@ -808,11 +797,11 @@ bsde_parse_object(int argc, char *argv[], while (current < argc) { if (strcmp(argv[current], "uid") == 0) { if (current + 2 > argc) { - len = snprintf(errstr, buflen, "uid short"); + snprintf(errstr, buflen, "uid short"); return (-1); } if (flags & MBO_UID_DEFINED) { - len = snprintf(errstr, buflen, "one uid only"); + snprintf(errstr, buflen, "one uid only"); return (-1); } if (bsde_parse_uidrange(argv[current+1], @@ -826,11 +815,11 @@ bsde_parse_object(int argc, char *argv[], current += 2; } else if (strcmp(argv[current], "gid") == 0) { if (current + 2 > argc) { - len = snprintf(errstr, buflen, "gid short"); + snprintf(errstr, buflen, "gid short"); return (-1); } if (flags & MBO_GID_DEFINED) { - len = snprintf(errstr, buflen, "one gid only"); + snprintf(errstr, buflen, "one gid only"); return (-1); } if (bsde_parse_gidrange(argv[current+1], @@ -844,11 +833,11 @@ bsde_parse_object(int argc, char *argv[], current += 2; } else if (strcmp(argv[current], "filesys") == 0) { if (current + 2 > argc) { - len = snprintf(errstr, buflen, "filesys short"); + snprintf(errstr, buflen, "filesys short"); return (-1); } if (flags & MBO_FSID_DEFINED) { - len = snprintf(errstr, buflen, "one fsid only"); + snprintf(errstr, buflen, "one fsid only"); return (-1); } if (bsde_parse_fsid(argv[current+1], &fsid, @@ -890,11 +879,11 @@ bsde_parse_object(int argc, char *argv[], current += 1; } else if (strcmp(argv[current], "type") == 0) { if (current + 2 > argc) { - len = snprintf(errstr, buflen, "type short"); + snprintf(errstr, buflen, "type short"); return (-1); } if (flags & MBO_TYPE_DEFINED) { - len = snprintf(errstr, buflen, "one type only"); + snprintf(errstr, buflen, "one type only"); return (-1); } if (bsde_parse_type(argv[current+1], &type, @@ -908,14 +897,14 @@ bsde_parse_object(int argc, char *argv[], current += 2; } else if (strcmp(argv[current], "!") == 0) { if (nextnot) { - len = snprintf(errstr, buflen, + snprintf(errstr, buflen, "double negative'"); return (-1); } nextnot = 1; current += 1; } else { - len = snprintf(errstr, buflen, "'%s' not expected", + snprintf(errstr, buflen, "'%s' not expected", argv[current]); return (-1); } @@ -946,16 +935,15 @@ int bsde_parse_mode(int argc, char *argv[], mode_t *mode, size_t buflen, char *errstr) { - size_t len; int i; if (argc == 0) { - len = snprintf(errstr, buflen, "mode expects mode value"); + snprintf(errstr, buflen, "mode expects mode value"); return (-1); } if (argc != 1) { - len = snprintf(errstr, buflen, "'%s' unexpected", argv[1]); + snprintf(errstr, buflen, "'%s' unexpected", argv[1]); return (-1); } @@ -981,7 +969,7 @@ bsde_parse_mode(int argc, char *argv[], mode_t *mode, /* ignore */ break; default: - len = snprintf(errstr, buflen, "Unknown mode letter: %c", + snprintf(errstr, buflen, "Unknown mode letter: %c", argv[0][i]); return (-1); } @@ -998,17 +986,16 @@ bsde_parse_rule(int argc, char *argv[], struct mac_bsd int object, object_elements, object_elements_length; int mode, mode_elements, mode_elements_length; int error, i; - size_t len; bzero(rule, sizeof(*rule)); if (argc < 1) { - len = snprintf(errstr, buflen, "Rule must begin with subject"); + snprintf(errstr, buflen, "Rule must begin with subject"); return (-1); } if (strcmp(argv[0], "subject") != 0) { - len = snprintf(errstr, buflen, "Rule must begin with subject"); + snprintf(errstr, buflen, "Rule must begin with subject"); return (-1); } subject = 0; @@ -1022,7 +1009,7 @@ bsde_parse_rule(int argc, char *argv[], struct mac_bsd object = i; if (object == -1) { - len = snprintf(errstr, buflen, "Rule must contain an object"); + snprintf(errstr, buflen, "Rule must contain an object"); return (-1); } @@ -1033,7 +1020,7 @@ bsde_parse_rule(int argc, char *argv[], struct mac_bsd mode = i; if (mode == -1) { - len = snprintf(errstr, buflen, "Rule must contain mode"); + snprintf(errstr, buflen, "Rule must contain mode"); return (-1); } @@ -1112,12 +1099,12 @@ bsde_check_version(size_t buflen, char *errstr) len = sizeof(version); error = sysctlbyname(MIB ".rule_version", &version, &len, NULL, 0); if (error) { - len = snprintf(errstr, buflen, "version check failed: %s", + snprintf(errstr, buflen, "version check failed: %s", strerror(errno)); return (-1); } if (version != MB_VERSION) { - len = snprintf(errstr, buflen, "module v%d != library v%d", + snprintf(errstr, buflen, "module v%d != library v%d", version, MB_VERSION); return (-1); } @@ -1134,11 +1121,11 @@ bsde_get_rule_count(size_t buflen, char *errstr) len = sizeof(rule_count); error = sysctlbyname(MIB ".rule_count", &rule_count, &len, NULL, 0); if (error) { - len = snprintf(errstr, buflen, "%s", strerror(errno)); + snprintf(errstr, buflen, "%s", strerror(errno)); return (-1); } if (len != sizeof(rule_count)) { - len = snprintf(errstr, buflen, "Data error in %s.rule_count", + snprintf(errstr, buflen, "Data error in %s.rule_count", MIB); return (-1); } @@ -1156,12 +1143,11 @@ bsde_get_rule_slots(size_t buflen, char *errstr) len = sizeof(rule_slots); error = sysctlbyname(MIB ".rule_slots", &rule_slots, &len, NULL, 0); if (error) { - len = snprintf(errstr, buflen, "%s", strerror(errno)); + snprintf(errstr, buflen, "%s", strerror(errno)); return (-1); } if (len != sizeof(rule_slots)) { - len = snprintf(errstr, buflen, "Data error in %s.rule_slots", - MIB); + snprintf(errstr, buflen, "Data error in %s.rule_slots", MIB); return (-1); } @@ -1187,7 +1173,7 @@ bsde_get_rule(int rulenum, struct mac_bsdextended_rule len = 10; error = bsde_get_mib(MIB ".rules", name, &len); if (error) { - len = snprintf(errstr, errlen, "%s: %s", MIB ".rules", + snprintf(errstr, errlen, "%s: %s", MIB ".rules", strerror(errno)); return (-1); } @@ -1199,11 +1185,11 @@ bsde_get_rule(int rulenum, struct mac_bsdextended_rule if (error == -1 && errno == ENOENT) return (-2); if (error) { - len = snprintf(errstr, errlen, "%s.%d: %s", MIB ".rules", + snprintf(errstr, errlen, "%s.%d: %s", MIB ".rules", rulenum, strerror(errno)); return (-1); } else if (size != sizeof(*rule)) { - len = snprintf(errstr, errlen, "Data error in %s.%d: %s", + snprintf(errstr, errlen, "Data error in %s.%d: %s", MIB ".rules", rulenum, strerror(errno)); return (-1); } @@ -1225,7 +1211,7 @@ bsde_delete_rule(int rulenum, size_t buflen, char *err len = 10; error = bsde_get_mib(MIB ".rules", name, &len); if (error) { - len = snprintf(errstr, buflen, "%s: %s", MIB ".rules", + snprintf(errstr, buflen, "%s: %s", MIB ".rules", strerror(errno)); return (-1); } @@ -1236,7 +1222,7 @@ bsde_delete_rule(int rulenum, size_t buflen, char *err size = sizeof(rule); error = sysctl(name, len, NULL, NULL, &rule, 0); if (error) { - len = snprintf(errstr, buflen, "%s.%d: %s", MIB ".rules", + snprintf(errstr, buflen, "%s.%d: %s", MIB ".rules", rulenum, strerror(errno)); return (-1); } @@ -1258,7 +1244,7 @@ bsde_set_rule(int rulenum, struct mac_bsdextended_rule len = 10; error = bsde_get_mib(MIB ".rules", name, &len); if (error) { - len = snprintf(errstr, buflen, "%s: %s", MIB ".rules", + snprintf(errstr, buflen, "%s: %s", MIB ".rules", strerror(errno)); return (-1); } @@ -1269,7 +1255,7 @@ bsde_set_rule(int rulenum, struct mac_bsdextended_rule size = sizeof(*rule); error = sysctl(name, len, NULL, NULL, rule, size); if (error) { - len = snprintf(errstr, buflen, "%s.%d: %s", MIB ".rules", + snprintf(errstr, buflen, "%s.%d: %s", MIB ".rules", rulenum, strerror(errno)); return (-1); } @@ -1292,14 +1278,14 @@ bsde_add_rule(int *rulenum, struct mac_bsdextended_rul len = 10; error = bsde_get_mib(MIB ".rules", name, &len); if (error) { - len = snprintf(errstr, buflen, "%s: %s", MIB ".rules", + snprintf(errstr, buflen, "%s: %s", MIB ".rules", strerror(errno)); return (-1); } rule_slots = bsde_get_rule_slots(BUFSIZ, charstr); if (rule_slots == -1) { - len = snprintf(errstr, buflen, "unable to get rule slots: %s", + snprintf(errstr, buflen, "unable to get rule slots: %s", strerror(errno)); return (-1); } @@ -1310,7 +1296,7 @@ bsde_add_rule(int *rulenum, struct mac_bsdextended_rul size = sizeof(*rule); error = sysctl(name, len, NULL, NULL, rule, size); if (error) { - len = snprintf(errstr, buflen, "%s.%d: %s", MIB ".rules", + snprintf(errstr, buflen, "%s.%d: %s", MIB ".rules", rule_slots, strerror(errno)); return (-1); } From owner-svn-src-stable-10@freebsd.org Mon Nov 6 11:11:45 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5D395E5A0D9; Mon, 6 Nov 2017 11:11:45 +0000 (UTC) (envelope-from eugen@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 mx1.freebsd.org (Postfix) with ESMTPS id 3A04B6A4AA; Mon, 6 Nov 2017 11:11:45 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vA6BBixt030142; Mon, 6 Nov 2017 11:11:44 GMT (envelope-from eugen@FreeBSD.org) Received: (from eugen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vA6BBilN030141; Mon, 6 Nov 2017 11:11:44 GMT (envelope-from eugen@FreeBSD.org) Message-Id: <201711061111.vA6BBilN030141@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eugen set sender to eugen@FreeBSD.org using -f From: Eugene Grosbein Date: Mon, 6 Nov 2017 11:11:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r325472 - stable/10/libexec/ftpd X-SVN-Group: stable-10 X-SVN-Commit-Author: eugen X-SVN-Commit-Paths: stable/10/libexec/ftpd X-SVN-Commit-Revision: 325472 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-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Nov 2017 11:11:45 -0000 Author: eugen (ports committer) Date: Mon Nov 6 11:11:44 2017 New Revision: 325472 URL: https://svnweb.freebsd.org/changeset/base/325472 Log: MFC r324364: ftpd(8): fix user context handling Apply authenticated user context after update of wtmp(5) at start of session, so that ftpd process is not killed by kernel with SIGXFSZ when user has "filesize" limit lower than size of system wtmp file. Same applies to session finalization: revert to super-user context before update of wtmp. If ftpd hits limit while writing a file at user request, do not get killed with SIGXFSZ instantly but apparently ignore the signal, process error and report it to the user, and continue with the session. PR: 143570 Approved by: mav (mentor) Modified: stable/10/libexec/ftpd/ftpd.c Modified: stable/10/libexec/ftpd/ftpd.c ============================================================================== --- stable/10/libexec/ftpd/ftpd.c Mon Nov 6 11:10:43 2017 (r325471) +++ stable/10/libexec/ftpd/ftpd.c Mon Nov 6 11:11:44 2017 (r325472) @@ -420,6 +420,10 @@ main(int argc, char *argv[], char **envp) } } + /* handle filesize limit gracefully */ + sa.sa_handler = SIG_IGN; + (void)sigaction(SIGXFSZ, &sa, NULL); + if (daemon_mode) { int *ctl_sock, fd, maxfd = -1, nfds, i; fd_set defreadfds, readfds; @@ -1185,14 +1189,14 @@ end_login(void) #endif (void) seteuid(0); - if (logged_in && dowtmp) - ftpd_logwtmp(wtmpid, NULL, NULL); - pw = NULL; #ifdef LOGIN_CAP setusercontext(NULL, getpwuid(0), 0, LOGIN_SETALL & ~(LOGIN_SETLOGIN | LOGIN_SETUSER | LOGIN_SETGROUP | LOGIN_SETPATH | LOGIN_SETENV)); #endif + if (logged_in && dowtmp) + ftpd_logwtmp(wtmpid, NULL, NULL); + pw = NULL; #ifdef USE_PAM if (pamh) { if ((e = pam_setcred(pamh, PAM_DELETE_CRED)) != PAM_SUCCESS) @@ -1464,7 +1468,7 @@ skip: } } setusercontext(lc, pw, 0, LOGIN_SETALL & - ~(LOGIN_SETUSER | LOGIN_SETPATH | LOGIN_SETENV)); + ~(LOGIN_SETRESOURCES | LOGIN_SETUSER | LOGIN_SETPATH | LOGIN_SETENV)); #else setlogin(pw->pw_name); (void) initgroups(pw->pw_name, pw->pw_gid); @@ -1506,6 +1510,10 @@ skip: (struct sockaddr *)&his_addr); logged_in = 1; +#ifdef LOGIN_CAP + setusercontext(lc, pw, 0, LOGIN_SETRESOURCES); +#endif + if (guest && stats && statfd < 0) #ifdef VIRTUAL_HOSTING statfd = open(thishost->statfile, O_WRONLY|O_APPEND); @@ -2756,6 +2764,11 @@ dologout(int status) if (logged_in && dowtmp) { (void) seteuid(0); +#ifdef LOGIN_CAP + setusercontext(NULL, getpwuid(0), 0, LOGIN_SETALL & ~(LOGIN_SETLOGIN | + LOGIN_SETUSER | LOGIN_SETGROUP | LOGIN_SETPATH | + LOGIN_SETENV)); +#endif ftpd_logwtmp(wtmpid, NULL, NULL); } /* beware of flushing buffers after a SIGPIPE */ From owner-svn-src-stable-10@freebsd.org Mon Nov 6 12:45:53 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 69E00E5D4CD; Mon, 6 Nov 2017 12:45:53 +0000 (UTC) (envelope-from eugen@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 mx1.freebsd.org (Postfix) with ESMTPS id 2C5136DD1A; Mon, 6 Nov 2017 12:45:53 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vA6Cjqj4068610; Mon, 6 Nov 2017 12:45:52 GMT (envelope-from eugen@FreeBSD.org) Received: (from eugen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vA6CjqAf068608; Mon, 6 Nov 2017 12:45:52 GMT (envelope-from eugen@FreeBSD.org) Message-Id: <201711061245.vA6CjqAf068608@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eugen set sender to eugen@FreeBSD.org using -f From: Eugene Grosbein Date: Mon, 6 Nov 2017 12:45:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r325474 - stable/10/usr.bin/rsh X-SVN-Group: stable-10 X-SVN-Commit-Author: eugen X-SVN-Commit-Paths: stable/10/usr.bin/rsh X-SVN-Commit-Revision: 325474 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-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Nov 2017 12:45:53 -0000 Author: eugen (ports committer) Date: Mon Nov 6 12:45:51 2017 New Revision: 325474 URL: https://svnweb.freebsd.org/changeset/base/325474 Log: MFC r324212: rsh: introduce new option -N disabling shutdown of socket sending path. PR: 205144 Approved by: mav (mentor) Modified: stable/10/usr.bin/rsh/rsh.1 stable/10/usr.bin/rsh/rsh.c Modified: stable/10/usr.bin/rsh/rsh.1 ============================================================================== --- stable/10/usr.bin/rsh/rsh.1 Mon Nov 6 12:44:26 2017 (r325473) +++ stable/10/usr.bin/rsh/rsh.1 Mon Nov 6 12:45:51 2017 (r325474) @@ -36,7 +36,7 @@ .Nd remote shell .Sh SYNOPSIS .Nm -.Op Fl 46dn +.Op Fl 46dnN .Op Fl l Ar username .Op Fl t Ar timeout .Ar host @@ -87,12 +87,22 @@ By default, the remote username is the same as the loc Authorization is determined as in .Xr rlogin 1 . +.It Fl N +Opposite to +.Fl n +option: do not send the "end of file" (EOF) indication for input stream +to the remote host. This option makes the +.Nm +utility compatible with protocol implementations confused by receiving +EOF, like some Cisco IOS versions. Disables +.Fl n . .It Fl n Redirect input from the special device .Pa /dev/null (see the .Sx BUGS -section of this manual page). +section of this manual page). Disables +.Fl N . .It Fl t Ar timeout Allow a .Ar timeout Modified: stable/10/usr.bin/rsh/rsh.c ============================================================================== --- stable/10/usr.bin/rsh/rsh.c Mon Nov 6 12:44:26 2017 (r325473) +++ stable/10/usr.bin/rsh/rsh.c Mon Nov 6 12:45:51 2017 (r325474) @@ -85,7 +85,7 @@ char rlogin[] = "rlogin"; void connect_timeout(int); char *copyargs(char * const *); void sendsig(int); -void talk(int, long, pid_t, int, int); +void talk(int, int, long, pid_t, int, int); void usage(void); int @@ -94,13 +94,13 @@ main(int argc, char *argv[]) struct passwd const *pw; struct servent const *sp; long omask; - int argoff, asrsh, ch, dflag, nflag, one, rem; + int argoff, asrsh, ch, dflag, nflag, Nflag, one, rem; pid_t pid = 0; uid_t uid; char *args, *host, *p, *user; int timeout = 0; - argoff = asrsh = dflag = nflag = 0; + argoff = asrsh = dflag = nflag = Nflag = 0; one = 1; host = user = NULL; @@ -120,7 +120,7 @@ main(int argc, char *argv[]) argoff = 1; } -#define OPTIONS "468Lde:l:nt:w" +#define OPTIONS "468LNde:l:nt:w" while ((ch = getopt(argc - argoff, argv + argoff, OPTIONS)) != -1) switch(ch) { case '4': @@ -131,6 +131,10 @@ main(int argc, char *argv[]) family = PF_INET6; break; + case 'N': + Nflag = 1; + nflag = 0; + break; case 'L': /* -8Lew are ignored to allow rlogin aliases */ case 'e': case 'w': @@ -144,6 +148,7 @@ main(int argc, char *argv[]) break; case 'n': nflag = 1; + Nflag = 0; break; case 't': timeout = atoi(optarg); @@ -227,7 +232,7 @@ main(int argc, char *argv[]) (void)ioctl(rfd2, FIONBIO, &one); (void)ioctl(rem, FIONBIO, &one); - talk(nflag, omask, pid, rem, timeout); + talk(nflag, Nflag, omask, pid, rem, timeout); if (!nflag) (void)kill(pid, SIGKILL); @@ -235,7 +240,7 @@ main(int argc, char *argv[]) } void -talk(int nflag, long omask, pid_t pid, int rem, int timeout) +talk(int nflag, int Nflag, long omask, pid_t pid, int rem, int timeout) { int cc, wc; fd_set readfrom, ready, rembits; @@ -276,8 +281,8 @@ rewrite: if (cc == 0) goto reread; goto rewrite; -done: - (void)shutdown(rem, SHUT_WR); +done: if (!Nflag) + (void)shutdown(rem, SHUT_WR); exit(0); } @@ -371,6 +376,6 @@ usage(void) { (void)fprintf(stderr, - "usage: rsh [-46dn] [-l username] [-t timeout] host [command]\n"); + "usage: rsh [-46Ndn] [-l username] [-t timeout] host [command]\n"); exit(1); } From owner-svn-src-stable-10@freebsd.org Mon Nov 6 18:07:24 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CE9BFE6405D; Mon, 6 Nov 2017 18:07:24 +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 mx1.freebsd.org (Postfix) with ESMTPS id 9B8247D38E; Mon, 6 Nov 2017 18:07:24 +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 vA6I7NuD006061; Mon, 6 Nov 2017 18:07:23 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vA6I7Nh9006060; Mon, 6 Nov 2017 18:07:23 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201711061807.vA6I7Nh9006060@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Mon, 6 Nov 2017 18:07:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r325491 - in stable: 10/release/tools 11/release/tools X-SVN-Group: stable-10 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: in stable: 10/release/tools 11/release/tools X-SVN-Commit-Revision: 325491 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-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Nov 2017 18:07:24 -0000 Author: gjb Date: Mon Nov 6 18:07:23 2017 New Revision: 325491 URL: https://svnweb.freebsd.org/changeset/base/325491 Log: MFC r325156: Set a default hostname for virtual machine images. Sponsored by: The FreeBSD Foundation Modified: stable/10/release/tools/vmimage.subr Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/release/tools/vmimage.subr Directory Properties: stable/11/ (props changed) Modified: stable/10/release/tools/vmimage.subr ============================================================================== --- stable/10/release/tools/vmimage.subr Mon Nov 6 17:59:04 2017 (r325490) +++ stable/10/release/tools/vmimage.subr Mon Nov 6 18:07:23 2017 (r325491) @@ -134,6 +134,10 @@ vm_install_base() { >> ${DESTDIR}/etc/fstab fi + local hostname + hostname="$(echo $(uname -o) | tr '[:upper:]' '[:lower:]')" + echo "hostname=\"${hostname}\"" >> ${DESTDIR}/etc/rc.conf + mkdir -p ${DESTDIR}/dev mount -t devfs devfs ${DESTDIR}/dev chroot ${DESTDIR} /usr/bin/newaliases From owner-svn-src-stable-10@freebsd.org Mon Nov 6 20:08:03 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D9193E66C68; Mon, 6 Nov 2017 20:08:03 +0000 (UTC) (envelope-from ken@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 mx1.freebsd.org (Postfix) with ESMTPS id 9BAF881880; Mon, 6 Nov 2017 20:08:03 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vA6K82iM074358; Mon, 6 Nov 2017 20:08:02 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vA6K8299074356; Mon, 6 Nov 2017 20:08:02 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201711062008.vA6K8299074356@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Mon, 6 Nov 2017 20:08:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r325496 - in stable/10: lib/libmt usr.bin/mt X-SVN-Group: stable-10 X-SVN-Commit-Author: ken X-SVN-Commit-Paths: in stable/10: lib/libmt usr.bin/mt X-SVN-Commit-Revision: 325496 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-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Nov 2017 20:08:04 -0000 Author: ken Date: Mon Nov 6 20:08:02 2017 New Revision: 325496 URL: https://svnweb.freebsd.org/changeset/base/325496 Log: MFC r325371 ------------------------------------------------------------------------ r325371 | ken | 2017-11-03 15:04:22 -0600 (Fri, 03 Nov 2017) | 19 lines Add the LTO-8 Type M density code (0x5d, LTO-8M) to libmt and the mt(1) man page. LTO-8 Type M (also known as M8) is a pristine LTO-7 cartridge formatted in a LTO-8 drive in a new, higher density format. It has a separate density code, and is only readable in an LTO-8 drive. lib/libmt/mtlib.c: Add the LTO-8 Type M density code to the density table in libmt. usr.bin/mt/mt.1: Add the LTO-8 Type M density code to the density table in the mt(1) man page. Sponsored by: Spectra Logic ------------------------------------------------------------------------ Modified: stable/10/lib/libmt/mtlib.c stable/10/usr.bin/mt/mt.1 Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libmt/mtlib.c ============================================================================== --- stable/10/lib/libmt/mtlib.c Mon Nov 6 20:08:00 2017 (r325495) +++ stable/10/lib/libmt/mtlib.c Mon Nov 6 20:08:02 2017 (r325496) @@ -645,6 +645,7 @@ static struct densities { { 0x58, 15142, 384607, "LTO-5" }, { 0x5A, 15142, 384607, "LTO-6" }, { 0x5C, 19107, 485318, "LTO-7" }, + { 0x5D, 19107, 485318, "LTO-M8" }, { 0x5E, 20669, 524993, "LTO-8" }, { 0x71, 11800, 299720, "3592A1 (encrypted)" }, { 0x72, 11800, 299720, "3592A2 (encrypted)" }, Modified: stable/10/usr.bin/mt/mt.1 ============================================================================== --- stable/10/usr.bin/mt/mt.1 Mon Nov 6 20:08:00 2017 (r325495) +++ stable/10/usr.bin/mt/mt.1 Mon Nov 6 20:08:02 2017 (r325496) @@ -29,7 +29,7 @@ .\" @(#)mt.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd August 11, 2017 +.Dd November 3, 2017 .Dt MT 1 .Os .Sh NAME @@ -522,6 +522,7 @@ Value Width Tracks Density Code Typ 0x58 12.7 (0.5) 1280 15,142 (384,607) C LTO-5 0x5A 12.7 (0.5) 2176 15,142 (384,607) C LTO-6 0x5C 12.7 (0.5) 3584 19,107 (485,318) C LTO-7 +0x5D 12.7 (0.5) 5376 19,107 (485,318) C LTO-M8 14 0x5E 12.7 (0.5) 6656 20,669 (524,993) C LTO-8 0x71 12.7 (0.5) 512 11,800 (299,720) C 3592A1 (encrypted) 0x72 12.7 (0.5) 896 11,800 (299,720) C 3592A2 (encrypted) @@ -565,6 +566,10 @@ NOTES 12. This is Exabyte 8500 uncompressed format. The compressed format density code is 0x8c. 13. This density code (0x48) was also used for DAT-160. +14. Officially known as LTO-8 Type M, abbreviated M8. This is a pristine + LTO-7 cartridge initialized with a higher density format by an LTO-8 + drive. It cannot be read by an LTO-7 drive. Uncompressed capacity + is 9TB, compared to 6TB for LTO-7 and 12TB for LTO-8. .Ed .Bd -literal -offset 2n NOTE ON QIC STREAMERS From owner-svn-src-stable-10@freebsd.org Tue Nov 7 14:28:11 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6D946E5A85B; Tue, 7 Nov 2017 14:28:11 +0000 (UTC) (envelope-from pfg@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 mx1.freebsd.org (Postfix) with ESMTPS id 3CCFB6A7C4; Tue, 7 Nov 2017 14:28:11 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vA7ESA9l015501; Tue, 7 Nov 2017 14:28:10 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vA7ESAW7015500; Tue, 7 Nov 2017 14:28:10 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201711071428.vA7ESAW7015500@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Tue, 7 Nov 2017 14:28:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r325514 - stable/10/sys/kern X-SVN-Group: stable-10 X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: stable/10/sys/kern X-SVN-Commit-Revision: 325514 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-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Nov 2017 14:28:11 -0000 Author: pfg Date: Tue Nov 7 14:28:10 2017 New Revision: 325514 URL: https://svnweb.freebsd.org/changeset/base/325514 Log: MFC r325397: ANSI-fy exec_shell_imgact(). Fix a stray space while here. PR: 223317 Modified: stable/10/sys/kern/imgact_shell.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/imgact_shell.c ============================================================================== --- stable/10/sys/kern/imgact_shell.c Tue Nov 7 14:25:09 2017 (r325513) +++ stable/10/sys/kern/imgact_shell.c Tue Nov 7 14:28:10 2017 (r325514) @@ -97,8 +97,7 @@ CTASSERT(MAXSHELLCMDLEN >= MAXINTERP + 3); * 6.x branch on May 28, 2005 (matching __FreeBSD_version 600029). */ int -exec_shell_imgact(imgp) - struct image_params *imgp; +exec_shell_imgact(struct image_params *imgp) { const char *image_header = imgp->image_header; const char *ihp, *interpb, *interpe, *maxp, *optb, *opte, *fname; @@ -125,7 +124,7 @@ exec_shell_imgact(imgp) * However, we don't know how far into the page the contents are * valid -- the actual file might be much shorter than the page. * So find out the file size. - */ + */ error = VOP_GETATTR(imgp->vp, &vattr, imgp->proc->p_ucred); if (error) return (error); From owner-svn-src-stable-10@freebsd.org Wed Nov 8 09:35:07 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5B01FE725F9; Wed, 8 Nov 2017 09:35:07 +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 mx1.freebsd.org (Postfix) with ESMTPS id 2495472657; Wed, 8 Nov 2017 09:35:07 +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 vA89Z6jI080706; Wed, 8 Nov 2017 09:35:06 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vA89Z6xp080705; Wed, 8 Nov 2017 09:35:06 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201711080935.vA89Z6xp080705@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 8 Nov 2017 09:35:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r325540 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-10 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 325540 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-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Nov 2017 09:35:07 -0000 Author: avg Date: Wed Nov 8 09:35:06 2017 New Revision: 325540 URL: https://svnweb.freebsd.org/changeset/base/325540 Log: MFC r324757: remove spa_sync_on assert from spa_async_thread_vd Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Wed Nov 8 09:25:32 2017 (r325539) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Wed Nov 8 09:35:06 2017 (r325540) @@ -6129,8 +6129,6 @@ spa_async_thread_vd(void *arg) spa_t *spa = arg; int tasks; - ASSERT(spa->spa_sync_on); - mutex_enter(&spa->spa_async_lock); tasks = spa->spa_async_tasks; retry: From owner-svn-src-stable-10@freebsd.org Wed Nov 8 11:39:43 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CA8A8E4FB43; Wed, 8 Nov 2017 11:39:43 +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 mx1.freebsd.org (Postfix) with ESMTPS id A199975D59; Wed, 8 Nov 2017 11:39:43 +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 vA8Bdgtk031635; Wed, 8 Nov 2017 11:39:42 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vA8BdgAn031630; Wed, 8 Nov 2017 11:39:42 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201711081139.vA8BdgAn031630@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 8 Nov 2017 11:39:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r325543 - in stable/10/sys: amd64/amd64 i386/i386 i386/isa X-SVN-Group: stable-10 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/10/sys: amd64/amd64 i386/i386 i386/isa X-SVN-Commit-Revision: 325543 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-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Nov 2017 11:39:43 -0000 Author: kib Date: Wed Nov 8 11:39:42 2017 New Revision: 325543 URL: https://svnweb.freebsd.org/changeset/base/325543 Log: MFC r325270: Consistently ensure that we do not load MXCSR with reserved bits set. Modified: stable/10/sys/amd64/amd64/fpu.c stable/10/sys/amd64/amd64/machdep.c stable/10/sys/i386/i386/machdep.c stable/10/sys/i386/isa/npx.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/amd64/amd64/fpu.c ============================================================================== --- stable/10/sys/amd64/amd64/fpu.c Wed Nov 8 11:25:19 2017 (r325542) +++ stable/10/sys/amd64/amd64/fpu.c Wed Nov 8 11:39:42 2017 (r325543) @@ -804,6 +804,7 @@ fpusetregs(struct thread *td, struct savefpu *addr, ch struct pcb *pcb; int error; + addr->sv_env.en_mxcsr &= cpu_mxcsr_mask; pcb = td->td_pcb; critical_enter(); if (td == PCPU_GET(fpcurthread) && PCB_USER_FPU(pcb)) { Modified: stable/10/sys/amd64/amd64/machdep.c ============================================================================== --- stable/10/sys/amd64/amd64/machdep.c Wed Nov 8 11:25:19 2017 (r325542) +++ stable/10/sys/amd64/amd64/machdep.c Wed Nov 8 11:39:42 2017 (r325543) @@ -2529,7 +2529,6 @@ static int set_fpcontext(struct thread *td, mcontext_t *mcp, char *xfpustate, size_t xfpustate_len) { - struct savefpu *fpstate; int error; if (mcp->mc_fpformat == _MC_FPFMT_NODEV) @@ -2542,9 +2541,8 @@ set_fpcontext(struct thread *td, mcontext_t *mcp, char error = 0; } else if (mcp->mc_ownedfp == _MC_FPOWNED_FPU || mcp->mc_ownedfp == _MC_FPOWNED_PCB) { - fpstate = (struct savefpu *)&mcp->mc_fpstate; - fpstate->sv_env.en_mxcsr &= cpu_mxcsr_mask; - error = fpusetregs(td, fpstate, xfpustate, xfpustate_len); + error = fpusetregs(td, (struct savefpu *)&mcp->mc_fpstate, + xfpustate, xfpustate_len); } else return (EINVAL); return (error); Modified: stable/10/sys/i386/i386/machdep.c ============================================================================== --- stable/10/sys/i386/i386/machdep.c Wed Nov 8 11:25:19 2017 (r325542) +++ stable/10/sys/i386/i386/machdep.c Wed Nov 8 11:39:42 2017 (r325543) @@ -3932,7 +3932,6 @@ static int set_fpcontext(struct thread *td, mcontext_t *mcp, char *xfpustate, size_t xfpustate_len) { - union savefpu *fpstate; int error; if (mcp->mc_fpformat == _MC_FPFMT_NODEV) @@ -3947,12 +3946,8 @@ set_fpcontext(struct thread *td, mcontext_t *mcp, char } else if (mcp->mc_ownedfp == _MC_FPOWNED_FPU || mcp->mc_ownedfp == _MC_FPOWNED_PCB) { #ifdef DEV_NPX - fpstate = (union savefpu *)&mcp->mc_fpstate; -#ifdef CPU_ENABLE_SSE - if (cpu_fxsr) - fpstate->sv_xmm.sv_env.en_mxcsr &= cpu_mxcsr_mask; -#endif - error = npxsetregs(td, fpstate, xfpustate, xfpustate_len); + error = npxsetregs(td, (union savefpu *)&mcp->mc_fpstate, + xfpustate, xfpustate_len); #else error = EINVAL; #endif Modified: stable/10/sys/i386/isa/npx.c ============================================================================== --- stable/10/sys/i386/isa/npx.c Wed Nov 8 11:25:19 2017 (r325542) +++ stable/10/sys/i386/isa/npx.c Wed Nov 8 11:39:42 2017 (r325543) @@ -1124,6 +1124,10 @@ npxsetregs(struct thread *td, union savefpu *addr, cha if (!hw_float) return (ENXIO); +#ifdef CPU_ENABLE_SSE + if (cpu_fxsr) + addr->sv_xmm.sv_env.en_mxcsr &= cpu_mxcsr_mask; +#endif pcb = td->td_pcb; critical_enter(); if (td == PCPU_GET(fpcurthread) && PCB_USER_FPU(pcb)) { From owner-svn-src-stable-10@freebsd.org Thu Nov 9 17:02:21 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7C3B0E560ED; Thu, 9 Nov 2017 17:02: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 mx1.freebsd.org (Postfix) with ESMTPS id 562466F5E1; Thu, 9 Nov 2017 17:02: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 vA9H2KUK085699; Thu, 9 Nov 2017 17:02:20 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vA9H2Kas085698; Thu, 9 Nov 2017 17:02:20 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201711091702.vA9H2Kas085698@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 9 Nov 2017 17:02:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r325599 - stable/10/sys/dev/mlx5/mlx5_ib X-SVN-Group: stable-10 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/10/sys/dev/mlx5/mlx5_ib X-SVN-Commit-Revision: 325599 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-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Nov 2017 17:02:21 -0000 Author: hselasky Date: Thu Nov 9 17:02:20 2017 New Revision: 325599 URL: https://svnweb.freebsd.org/changeset/base/325599 Log: Use MAC-based GID format for the GID table entries in mlx5ib(4) to be compatible with the ibcore module in FreeBSD 10-stable. This fixes RDMA over VLAN, because the MAC-based GID format embeds the VLAN ID into the GID itself and this is what ibcore expects when requesting GID indexes from the GID cache. RoCE V1.5 and V2 is not supported in 10-stable by mlx5ib(4). This is a direct commit. Sponsored by: Mellanox Technologies Modified: stable/10/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Modified: stable/10/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c ============================================================================== --- stable/10/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Thu Nov 9 15:43:15 2017 (r325598) +++ stable/10/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Thu Nov 9 17:02:20 2017 (r325599) @@ -541,49 +541,32 @@ int mlx5_ib_query_port(struct ib_device *ibdev, u8 por } } -static inline int -mlx5_addrconf_ifid_eui48(u8 *eui, struct net_device *dev) +static void +mlx5_addrconf_ifid_eui48(u8 *eui, u16 vlan_id, struct net_device *dev) { if (dev->if_addrlen != ETH_ALEN) - return -1; + return; + memcpy(eui, IF_LLADDR(dev), 3); memcpy(eui + 5, IF_LLADDR(dev) + 3, 3); - /* NOTE: The scope ID is added by the GID to IP conversion */ - - eui[3] = 0xFF; - eui[4] = 0xFE; + if (vlan_id < 0x1000) { + eui[3] = vlan_id >> 8; + eui[4] = vlan_id & 0xff; + } else { + eui[3] = 0xFF; + eui[4] = 0xFE; + } eui[0] ^= 2; - return 0; } static void mlx5_make_default_gid(struct net_device *dev, union ib_gid *gid) { gid->global.subnet_prefix = cpu_to_be64(0xfe80000000000000LL); - mlx5_addrconf_ifid_eui48(&gid->raw[8], dev); + mlx5_addrconf_ifid_eui48(&gid->raw[8], 0xFFFF, dev); } -static inline int -mlx5_ip2gid(const struct sockaddr *addr, union ib_gid *gid) -{ - switch (addr->sa_family) { - case AF_INET: - ipv6_addr_set_v4mapped(((const struct sockaddr_in *)addr)->sin_addr.s_addr, - (struct in6_addr *)gid->raw); - break; - case AF_INET6: - memcpy(gid->raw, &((const struct sockaddr_in6 *)addr)->sin6_addr, 16); - /* clear SCOPE ID */ - gid->raw[2] = 0; - gid->raw[3] = 0; - break; - default: - return -EINVAL; - } - return 0; -} - static void mlx5_ib_roce_port_update(void *arg) { @@ -593,7 +576,6 @@ mlx5_ib_roce_port_update(void *arg) struct net_device *xdev[MLX5_IB_GID_MAX]; struct net_device *idev; struct net_device *ndev; - struct ifaddr *ifa; union ib_gid gid_temp; while (port->port_gone == 0) { @@ -626,38 +608,36 @@ mlx5_ib_roce_port_update(void *arg) } if (idev != NULL) { TAILQ_FOREACH(idev, &V_ifnet, if_link) { + u16 vid; + if (idev != ndev) { if (idev->if_type != IFT_L2VLAN) continue; if (ndev != rdma_vlan_dev_real_dev(idev)) continue; } - /* clone address information for IPv4 and IPv6 */ - IF_ADDR_RLOCK(idev); - TAILQ_FOREACH(ifa, &idev->if_addrhead, ifa_link) { - if (ifa->ifa_addr == NULL || - (ifa->ifa_addr->sa_family != AF_INET && - ifa->ifa_addr->sa_family != AF_INET6) || - gid_index >= MLX5_IB_GID_MAX) - continue; - memset(&gid_temp, 0, sizeof(gid_temp)); - mlx5_ip2gid(ifa->ifa_addr, &gid_temp); - /* check for existing entry */ - for (j = 0; j != gid_index; j++) { - if (bcmp(&gid_temp, &port->gid_table[j], sizeof(gid_temp)) == 0) - break; + + /* setup valid MAC-based GID */ + memset(&gid_temp, 0, sizeof(gid_temp)); + gid_temp.global.subnet_prefix = cpu_to_be64(0xfe80000000000000LL); + vid = rdma_vlan_dev_vlan_id(idev); + mlx5_addrconf_ifid_eui48(&gid_temp.raw[8], vid, idev); + + /* check for existing entry */ + for (j = 0; j != gid_index; j++) { + if (bcmp(&gid_temp, &port->gid_table[j], sizeof(gid_temp)) == 0) + break; + } + + /* check if new entry should be added */ + if (j == gid_index && gid_index < MLX5_IB_GID_MAX) { + if (bcmp(&gid_temp, &port->gid_table[gid_index], sizeof(gid_temp))) { + port->gid_table[gid_index] = gid_temp; + update = 1; } - /* check if new entry must be added */ - if (j == gid_index) { - if (bcmp(&gid_temp, &port->gid_table[gid_index], sizeof(gid_temp))) { - port->gid_table[gid_index] = gid_temp; - update = 1; - } - xdev[gid_index] = idev; - gid_index++; - } + xdev[gid_index] = idev; + gid_index++; } - IF_ADDR_RUNLOCK(idev); } } IFNET_RUNLOCK(); From owner-svn-src-stable-10@freebsd.org Thu Nov 9 17:51:56 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 35FE4E5725E; Thu, 9 Nov 2017 17:51: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 mx1.freebsd.org (Postfix) with ESMTPS id 0FFD270FBB; Thu, 9 Nov 2017 17:51:55 +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 vA9HptGl006867; Thu, 9 Nov 2017 17:51:55 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vA9HptuU006866; Thu, 9 Nov 2017 17:51:55 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201711091751.vA9HptuU006866@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 9 Nov 2017 17:51:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r325602 - stable/10/sys/contrib/rdma/krping X-SVN-Group: stable-10 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/10/sys/contrib/rdma/krping X-SVN-Commit-Revision: 325602 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-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Nov 2017 17:51:56 -0000 Author: hselasky Date: Thu Nov 9 17:51:55 2017 New Revision: 325602 URL: https://svnweb.freebsd.org/changeset/base/325602 Log: MFC r324490: Add support for parsing and using IPv6 addresses in krping. Sponsored by: Mellanox Technologies Modified: stable/10/sys/contrib/rdma/krping/krping.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/contrib/rdma/krping/krping.c ============================================================================== --- stable/10/sys/contrib/rdma/krping/krping.c Thu Nov 9 17:49:45 2017 (r325601) +++ stable/10/sys/contrib/rdma/krping/krping.c Thu Nov 9 17:51:55 2017 (r325602) @@ -82,6 +82,7 @@ static const struct krping_option krping_opts[] = { {"count", OPT_INT, 'C'}, {"size", OPT_INT, 'S'}, {"addr", OPT_STRING, 'a'}, + {"addr6", OPT_STRING, 'A'}, {"port", OPT_INT, 'p'}, {"verbose", OPT_NOPARAM, 'v'}, {"validate", OPT_NOPARAM, 'V'}, @@ -216,7 +217,11 @@ struct krping_cb { struct krping_stats stats; uint16_t port; /* dst port in NBO */ - struct in_addr addr; /* dst addr in NBO */ + union { + struct in_addr v4; + struct in6_addr v6; + } addr; /* dst addr in NBO */ + int addr_type; /* AF_INET or AF_INET6 */ char *addr_str; /* dst addr string */ int verbose; /* verbose logging */ int count; /* ping count */ @@ -1562,15 +1567,31 @@ static int fastreg_supported(struct krping_cb *cb) static int krping_bind_server(struct krping_cb *cb) { - struct sockaddr_in sin; + union { + struct sockaddr_in v4; + struct sockaddr_in6 v6; + } sin; int ret; memset(&sin, 0, sizeof(sin)); - sin.sin_len = sizeof sin; - sin.sin_family = AF_INET; - sin.sin_addr.s_addr = cb->addr.s_addr; - sin.sin_port = cb->port; + switch (cb->addr_type) { + case AF_INET: + sin.v4.sin_len = sizeof sin.v4; + sin.v4.sin_family = AF_INET; + sin.v4.sin_addr = cb->addr.v4; + sin.v4.sin_port = cb->port; + break; + case AF_INET6: + sin.v6.sin6_len = sizeof sin.v6; + sin.v6.sin6_family = AF_INET6; + sin.v6.sin6_addr = cb->addr.v6; + sin.v6.sin6_port = cb->port; + break; + default: + return (-EINVAL); + } + ret = rdma_bind_addr(cb->cm_id, (struct sockaddr *) &sin); if (ret) { PRINTF(cb, "rdma_bind_addr error %d\n", ret); @@ -2033,15 +2054,31 @@ static int krping_connect_client(struct krping_cb *cb) static int krping_bind_client(struct krping_cb *cb) { - struct sockaddr_in sin; + union { + struct sockaddr_in v4; + struct sockaddr_in6 v6; + } sin; int ret; memset(&sin, 0, sizeof(sin)); - sin.sin_len = sizeof sin; - sin.sin_family = AF_INET; - sin.sin_addr.s_addr = cb->addr.s_addr; - sin.sin_port = cb->port; + switch (cb->addr_type) { + case AF_INET: + sin.v4.sin_len = sizeof sin.v4; + sin.v4.sin_family = AF_INET; + sin.v4.sin_addr = cb->addr.v4; + sin.v4.sin_port = cb->port; + break; + case AF_INET6: + sin.v6.sin6_len = sizeof sin.v6; + sin.v6.sin6_family = AF_INET6; + sin.v6.sin6_addr = cb->addr.v6; + sin.v6.sin6_port = cb->port; + break; + default: + return (-EINVAL); + } + ret = rdma_resolve_addr(cb->cm_id, NULL, (struct sockaddr *) &sin, 2000); if (ret) { @@ -2114,12 +2151,29 @@ err1: krping_free_qp(cb); } +static uint16_t +krping_get_ipv6_scope_id(char *name) +{ + struct ifnet *ifp; + uint16_t retval; + + if (name == NULL) + return (0); + ifp = ifunit_ref(name); + if (ifp == NULL) + return (0); + retval = ifp->if_index; + if_rele(ifp); + return (retval); +} + int krping_doit(char *cmd, void *cookie) { struct krping_cb *cb; int op; int ret = 0; char *optarg; + char *scope; unsigned long optint; cb = kzalloc(sizeof(*cb), GFP_KERNEL); @@ -2136,6 +2190,7 @@ int krping_doit(char *cmd, void *cookie) cb->size = 64; cb->txdepth = RPING_SQ_DEPTH; cb->mem = DMA; + cb->addr_type = AF_INET; init_waitqueue_head(&cb->sem); while ((op = krping_getopt("krping", &cmd, krping_opts, NULL, &optarg, @@ -2143,11 +2198,33 @@ int krping_doit(char *cmd, void *cookie) switch (op) { case 'a': cb->addr_str = optarg; - DEBUG_LOG(cb, "ipaddr (%s)\n", optarg); - if (!inet_aton(optarg, &cb->addr)) { + cb->addr_type = AF_INET; + DEBUG_LOG(cb, "ipv4addr (%s)\n", optarg); + if (inet_pton(AF_INET, optarg, &cb->addr) != 1) { PRINTF(cb, "bad addr string %s\n", optarg); ret = EINVAL; + } + break; + case 'A': + cb->addr_str = optarg; + cb->addr_type = AF_INET6; + DEBUG_LOG(cb, "ipv6addr (%s)\n", optarg); + scope = strstr(optarg, "%"); + /* extract scope ID, if any */ + if (scope != NULL) + *scope++ = 0; + /* extract IPv6 network address */ + if (inet_pton(AF_INET6, optarg, &cb->addr) != 1) { + PRINTF(cb, "bad addr string %s\n", + optarg); + ret = EINVAL; + } else if (IN6_IS_SCOPE_LINKLOCAL(&cb->addr.v6) || + IN6_IS_ADDR_MC_INTFACELOCAL(&cb->addr.v6)) { + uint16_t scope_id = krping_get_ipv6_scope_id(scope); + DEBUG_LOG(cb, "ipv6 scope ID = %d\n", scope_id); + cb->addr.v6.s6_addr[2] = scope_id >> 8; + cb->addr.v6.s6_addr[3] = scope_id & 0xFF; } break; case 'p': From owner-svn-src-stable-10@freebsd.org Thu Nov 9 19:00:14 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 32F05E58BEE; Thu, 9 Nov 2017 19:00: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 mx1.freebsd.org (Postfix) with ESMTPS id CB1CB736B8; Thu, 9 Nov 2017 19:00: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 vA9J0DNQ032736; Thu, 9 Nov 2017 19:00:13 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vA9J0Ce4032726; Thu, 9 Nov 2017 19:00:12 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201711091900.vA9J0Ce4032726@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 9 Nov 2017 19:00:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r325611 - in stable/10/sys: dev/cxgbe/iw_cxgbe dev/mlx5/mlx5_ib ofed/drivers/infiniband/core ofed/drivers/infiniband/hw/mlx4 ofed/drivers/infiniband/hw/mthca ofed/include/linux ofed/inc... X-SVN-Group: stable-10 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/10/sys: dev/cxgbe/iw_cxgbe dev/mlx5/mlx5_ib ofed/drivers/infiniband/core ofed/drivers/infiniband/hw/mlx4 ofed/drivers/infiniband/hw/mthca ofed/include/linux ofed/include/rdma X-SVN-Commit-Revision: 325611 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-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Nov 2017 19:00:14 -0000 Author: hselasky Date: Thu Nov 9 19:00:11 2017 New Revision: 325611 URL: https://svnweb.freebsd.org/changeset/base/325611 Log: MFC r324792: The remote DMA TCP portspace selector, RDMA_PS_TCP, is used for both iWarp and RoCE in ibcore. The selection of RDMA_PS_TCP can not be used to indicate iWarp protocol use. Backport the proper IB device capabilities from Linux upstream to distinguish between iWarp and RoCE. Only allocate the additional socket required for iWarp for RDMA IDs when at least one iWarp device present. This resolves interopability issues between iWarp and RoCE in ibcore Reviewed by: np @ Differential Revision: https://reviews.freebsd.org/D12563 Sponsored by: Mellanox Technologies Modified: stable/10/sys/dev/cxgbe/iw_cxgbe/provider.c stable/10/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c stable/10/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c stable/10/sys/ofed/drivers/infiniband/core/cma.c stable/10/sys/ofed/drivers/infiniband/core/device.c stable/10/sys/ofed/drivers/infiniband/hw/mlx4/main.c stable/10/sys/ofed/drivers/infiniband/hw/mthca/mthca_provider.c stable/10/sys/ofed/include/linux/kernel.h stable/10/sys/ofed/include/rdma/ib_mad.h stable/10/sys/ofed/include/rdma/ib_verbs.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/cxgbe/iw_cxgbe/provider.c ============================================================================== --- stable/10/sys/dev/cxgbe/iw_cxgbe/provider.c Thu Nov 9 18:22:42 2017 (r325610) +++ stable/10/sys/dev/cxgbe/iw_cxgbe/provider.c Thu Nov 9 19:00:11 2017 (r325611) @@ -388,6 +388,24 @@ c4iw_query_port(struct ib_device *ibdev, u8 port, stru return 0; } +static int c4iw_port_immutable(struct ib_device *ibdev, u8 port_num, + struct ib_port_immutable *immutable) +{ + struct ib_port_attr attr; + int err; + + immutable->core_cap_flags = RDMA_CORE_PORT_IWARP; + + err = ib_query_port(ibdev, port_num, &attr); + if (err) + return err; + + immutable->pkey_tbl_len = attr.pkey_tbl_len; + immutable->gid_tbl_len = attr.gid_tbl_len; + + return 0; +} + /* * Returns -errno on error. */ @@ -471,6 +489,7 @@ c4iw_register_device(struct c4iw_dev *dev) ibdev->post_send = c4iw_post_send; ibdev->post_recv = c4iw_post_receive; ibdev->uverbs_abi_ver = C4IW_UVERBS_ABI_VERSION; + ibdev->get_port_immutable = c4iw_port_immutable; iwcm = kmalloc(sizeof(*iwcm), GFP_KERNEL); if (iwcm == NULL) Modified: stable/10/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c ============================================================================== --- stable/10/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Thu Nov 9 18:22:42 2017 (r325610) +++ stable/10/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Thu Nov 9 19:00:11 2017 (r325611) @@ -1671,6 +1671,57 @@ static void destroy_dev_resources(struct mlx5_ib_resou mlx5_ib_dealloc_pd(devr->p0); } +static u32 get_core_cap_flags(struct ib_device *ibdev) +{ + struct mlx5_ib_dev *dev = to_mdev(ibdev); + enum rdma_link_layer ll = mlx5_ib_port_link_layer(ibdev, 1); + u8 l3_type_cap = MLX5_CAP_ROCE(dev->mdev, l3_type); + u8 roce_version_cap = MLX5_CAP_ROCE(dev->mdev, roce_version); + u32 ret = 0; + + if (ll == IB_LINK_LAYER_INFINIBAND) + return RDMA_CORE_PORT_IBA_IB; + + ret = RDMA_CORE_PORT_RAW_PACKET; + + if (!(l3_type_cap & MLX5_ROCE_L3_TYPE_IPV4_CAP)) + return ret; + + if (!(l3_type_cap & MLX5_ROCE_L3_TYPE_IPV6_CAP)) + return ret; + + if (roce_version_cap & MLX5_ROCE_VERSION_1_CAP) + ret |= RDMA_CORE_PORT_IBA_ROCE; + + if (roce_version_cap & MLX5_ROCE_VERSION_2_CAP) + ret |= RDMA_CORE_PORT_IBA_ROCE_UDP_ENCAP; + + return ret; +} + +static int mlx5_port_immutable(struct ib_device *ibdev, u8 port_num, + struct ib_port_immutable *immutable) +{ + struct ib_port_attr attr; + struct mlx5_ib_dev *dev = to_mdev(ibdev); + enum rdma_link_layer ll = mlx5_ib_port_link_layer(ibdev, port_num); + int err; + + immutable->core_cap_flags = get_core_cap_flags(ibdev); + + err = ib_query_port(ibdev, port_num, &attr); + if (err) + return err; + + immutable->pkey_tbl_len = attr.pkey_tbl_len; + immutable->gid_tbl_len = attr.gid_tbl_len; + immutable->core_cap_flags = get_core_cap_flags(ibdev); + if ((ll == IB_LINK_LAYER_INFINIBAND) || MLX5_CAP_GEN(dev->mdev, roce)) + immutable->max_mad_size = IB_MGMT_MAD_SIZE; + + return 0; +} + static void enable_dc_tracer(struct mlx5_ib_dev *dev) { struct device *device = dev->ib_dev.dma_device; @@ -2115,6 +2166,7 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev) dev->ib_dev.attach_mcast = mlx5_ib_mcg_attach; dev->ib_dev.detach_mcast = mlx5_ib_mcg_detach; dev->ib_dev.process_mad = mlx5_ib_process_mad; + dev->ib_dev.get_port_immutable = mlx5_port_immutable; dev->ib_dev.alloc_fast_reg_mr = mlx5_ib_alloc_fast_reg_mr; dev->ib_dev.alloc_fast_reg_page_list = mlx5_ib_alloc_fast_reg_page_list; dev->ib_dev.free_fast_reg_page_list = mlx5_ib_free_fast_reg_page_list; Modified: stable/10/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c ============================================================================== --- stable/10/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c Thu Nov 9 18:22:42 2017 (r325610) +++ stable/10/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c Thu Nov 9 19:00:11 2017 (r325611) @@ -1576,7 +1576,7 @@ static int mlx5_set_path(struct mlx5_ib_dev *dev, cons int gid_type; if ((ll == IB_LINK_LAYER_ETHERNET) || (ah->ah_flags & IB_AH_GRH)) { - int len = dev->ib_dev.gid_tbl_len[port - 1]; + int len = dev->mdev->port_caps[port - 1].gid_table_len; if (ah->grh.sgid_index >= len) { printf("mlx5_ib: ERR: ""sgid_index (%u) too large. max is %d\n", ah->grh.sgid_index, len - 1); return -EINVAL; Modified: stable/10/sys/ofed/drivers/infiniband/core/cma.c ============================================================================== --- stable/10/sys/ofed/drivers/infiniband/core/cma.c Thu Nov 9 18:22:42 2017 (r325610) +++ stable/10/sys/ofed/drivers/infiniband/core/cma.c Thu Nov 9 19:00:11 2017 (r325611) @@ -171,6 +171,7 @@ struct rdma_id_private { u32 qp_num; u8 srq; u8 tos; + int unify_ps_tcp; }; struct cma_multicast { @@ -739,28 +740,24 @@ int rdma_init_qp_attr(struct rdma_cm_id *id, struct ib int ret = 0; id_priv = container_of(id, struct rdma_id_private, id); - switch (rdma_node_get_transport(id_priv->id.device->node_type)) { - case RDMA_TRANSPORT_IB: + if (rdma_cap_ib_cm(id->device, id->port_num)) { if (!id_priv->cm_id.ib || cma_is_ud_ps(id_priv->id.ps)) ret = cma_ib_init_qp_attr(id_priv, qp_attr, qp_attr_mask); else ret = ib_cm_init_qp_attr(id_priv->cm_id.ib, qp_attr, qp_attr_mask); + if (qp_attr->qp_state == IB_QPS_RTR) qp_attr->rq_psn = id_priv->seq_num; - break; - case RDMA_TRANSPORT_IWARP: + } else if (rdma_cap_iw_cm(id->device, id->port_num)) { if (!id_priv->cm_id.iw) { qp_attr->qp_access_flags = 0; *qp_attr_mask = IB_QP_STATE | IB_QP_ACCESS_FLAGS; } else ret = iw_cm_init_qp_attr(id_priv->cm_id.iw, qp_attr, qp_attr_mask); - break; - default: + } else ret = -ENOSYS; - break; - } return ret; } @@ -1000,17 +997,12 @@ void rdma_destroy_id(struct rdma_cm_id *id) mutex_lock(&lock); if (id_priv->cma_dev) { mutex_unlock(&lock); - switch (rdma_node_get_transport(id_priv->id.device->node_type)) { - case RDMA_TRANSPORT_IB: + if (rdma_cap_ib_cm(id_priv->id.device, 1)) { if (id_priv->cm_id.ib && !IS_ERR(id_priv->cm_id.ib)) ib_destroy_cm_id(id_priv->cm_id.ib); - break; - case RDMA_TRANSPORT_IWARP: + } else if (rdma_cap_iw_cm(id_priv->id.device, 1)) { if (id_priv->cm_id.iw && !IS_ERR(id_priv->cm_id.iw)) iw_destroy_cm_id(id_priv->cm_id.iw); - break; - default: - break; } cma_leave_mc_groups(id_priv); mutex_lock(&lock); @@ -1025,6 +1017,10 @@ void rdma_destroy_id(struct rdma_cm_id *id) if (id_priv->internal_id) cma_deref_id(id_priv->id.context); + if (id_priv->sock != NULL && !id_priv->internal_id && + !id_priv->unify_ps_tcp) + sock_release(id_priv->sock); + kfree(id_priv->id.route.path_rec); kfree(id_priv); } @@ -1663,18 +1659,15 @@ int rdma_listen(struct rdma_cm_id *id, int backlog) id_priv->backlog = backlog; if (id->device) { - switch (rdma_node_get_transport(id->device->node_type)) { - case RDMA_TRANSPORT_IB: + if (rdma_cap_ib_cm(id->device, 1)) { ret = cma_ib_listen(id_priv); if (ret) goto err; - break; - case RDMA_TRANSPORT_IWARP: + } else if (rdma_cap_iw_cm(id->device, 1)) { ret = cma_iw_listen(id_priv, backlog); if (ret) goto err; - break; - default: + } else { ret = -ENOSYS; goto err; } @@ -1979,26 +1972,15 @@ int rdma_resolve_route(struct rdma_cm_id *id, int time return -EINVAL; atomic_inc(&id_priv->refcount); - switch (rdma_node_get_transport(id->device->node_type)) { - case RDMA_TRANSPORT_IB: - switch (rdma_port_get_link_layer(id->device, id->port_num)) { - case IB_LINK_LAYER_INFINIBAND: - ret = cma_resolve_ib_route(id_priv, timeout_ms); - break; - case IB_LINK_LAYER_ETHERNET: - ret = cma_resolve_iboe_route(id_priv); - break; - default: - ret = -ENOSYS; - } - break; - case RDMA_TRANSPORT_IWARP: + if (rdma_cap_ib_sa(id->device, id->port_num)) + ret = cma_resolve_ib_route(id_priv, timeout_ms); + else if (rdma_protocol_roce(id->device, id->port_num)) + ret = cma_resolve_iboe_route(id_priv); + else if (rdma_protocol_iwarp(id->device, id->port_num)) ret = cma_resolve_iw_route(id_priv, timeout_ms); - break; - default: + else ret = -ENOSYS; - break; - } + if (ret) goto err; @@ -2348,6 +2330,10 @@ static int cma_get_tcp_port(struct rdma_id_private *id (struct sockaddr *) &id_priv->id.route.addr.src_addr, ip_addr_size((struct sockaddr *) &id_priv->id.route.addr.src_addr)); #else + SOCK_LOCK(sock); + sock->so_options |= SO_REUSEADDR; + SOCK_UNLOCK(sock); + ret = -sobind(sock, (struct sockaddr *)&id_priv->id.route.addr.src_addr, curthread); @@ -2372,6 +2358,7 @@ static int cma_get_tcp_port(struct rdma_id_private *id static int cma_get_port(struct rdma_id_private *id_priv) { + struct cma_device *cma_dev; struct idr *ps; int ret; @@ -2381,7 +2368,18 @@ static int cma_get_port(struct rdma_id_private *id_pri break; case RDMA_PS_TCP: ps = &tcp_ps; - if (unify_tcp_port_space) { + + mutex_lock(&lock); + /* check if there are any iWarp IB devices present */ + list_for_each_entry(cma_dev, &dev_list, list) { + if (rdma_protocol_iwarp(cma_dev->device, 1)) { + id_priv->unify_ps_tcp = 1; + break; + } + } + mutex_unlock(&lock); + + if (id_priv->unify_ps_tcp) { ret = cma_get_tcp_port(id_priv); if (ret) goto out; @@ -2765,20 +2763,15 @@ int rdma_connect(struct rdma_cm_id *id, struct rdma_co id_priv->srq = conn_param->srq; } - switch (rdma_node_get_transport(id->device->node_type)) { - case RDMA_TRANSPORT_IB: + if (rdma_cap_ib_cm(id->device, id->port_num)) { if (cma_is_ud_ps(id->ps)) ret = cma_resolve_ib_udp(id_priv, conn_param); else ret = cma_connect_ib(id_priv, conn_param); - break; - case RDMA_TRANSPORT_IWARP: + } else if (rdma_cap_iw_cm(id->device, id->port_num)) ret = cma_connect_iw(id_priv, conn_param); - break; - default: + else ret = -ENOSYS; - break; - } if (ret) goto err; @@ -2878,8 +2871,7 @@ int rdma_accept(struct rdma_cm_id *id, struct rdma_con id_priv->srq = conn_param->srq; } - switch (rdma_node_get_transport(id->device->node_type)) { - case RDMA_TRANSPORT_IB: + if (rdma_cap_ib_cm(id->device, id->port_num)) { if (cma_is_ud_ps(id->ps)) ret = cma_send_sidr_rep(id_priv, IB_SIDR_SUCCESS, conn_param->private_data, @@ -2888,14 +2880,10 @@ int rdma_accept(struct rdma_cm_id *id, struct rdma_con ret = cma_accept_ib(id_priv, conn_param); else ret = cma_rep_recv(id_priv); - break; - case RDMA_TRANSPORT_IWARP: + } else if (rdma_cap_iw_cm(id->device, id->port_num)) ret = cma_accept_iw(id_priv, conn_param); - break; - default: + else ret = -ENOSYS; - break; - } if (ret) goto reject; @@ -2939,8 +2927,7 @@ int rdma_reject(struct rdma_cm_id *id, const void *pri if (!cma_has_cm_dev(id_priv)) return -EINVAL; - switch (rdma_node_get_transport(id->device->node_type)) { - case RDMA_TRANSPORT_IB: + if (rdma_cap_ib_cm(id->device, id->port_num)) { if (cma_is_ud_ps(id->ps)) ret = cma_send_sidr_rep(id_priv, IB_SIDR_REJECT, private_data, private_data_len); @@ -2948,15 +2935,12 @@ int rdma_reject(struct rdma_cm_id *id, const void *pri ret = ib_send_cm_rej(id_priv->cm_id.ib, IB_CM_REJ_CONSUMER_DEFINED, NULL, 0, private_data, private_data_len); - break; - case RDMA_TRANSPORT_IWARP: + } else if (rdma_cap_iw_cm(id->device, id->port_num)) { ret = iw_cm_reject(id_priv->cm_id.iw, private_data, private_data_len); - break; - default: + } else ret = -ENOSYS; - break; - } + return ret; } EXPORT_SYMBOL(rdma_reject); @@ -2970,22 +2954,18 @@ int rdma_disconnect(struct rdma_cm_id *id) if (!cma_has_cm_dev(id_priv)) return -EINVAL; - switch (rdma_node_get_transport(id->device->node_type)) { - case RDMA_TRANSPORT_IB: + if (rdma_cap_ib_cm(id->device, id->port_num)) { ret = cma_modify_qp_err(id_priv); if (ret) goto out; /* Initiate or respond to a disconnect. */ if (ib_send_cm_dreq(id_priv->cm_id.ib, NULL, 0)) ib_send_cm_drep(id_priv->cm_id.ib, NULL, 0); - break; - case RDMA_TRANSPORT_IWARP: + } else if (rdma_cap_iw_cm(id->device, id->port_num)) { ret = iw_cm_disconnect(id_priv->cm_id.iw, 0); - break; - default: + } else ret = -EINVAL; - break; - } + out: return ret; } Modified: stable/10/sys/ofed/drivers/infiniband/core/device.c ============================================================================== --- stable/10/sys/ofed/drivers/infiniband/core/device.c Thu Nov 9 18:22:42 2017 (r325610) +++ stable/10/sys/ofed/drivers/infiniband/core/device.c Thu Nov 9 19:00:11 2017 (r325611) @@ -94,7 +94,8 @@ static int ib_device_check_mandatory(struct ib_device IB_MANDATORY_FUNC(poll_cq), IB_MANDATORY_FUNC(req_notify_cq), IB_MANDATORY_FUNC(get_dma_mr), - IB_MANDATORY_FUNC(dereg_mr) + IB_MANDATORY_FUNC(dereg_mr), + IB_MANDATORY_FUNC(get_port_immutable) }; int i; @@ -153,13 +154,13 @@ static int alloc_name(char *name) return 0; } -static int start_port(struct ib_device *device) +static int rdma_start_port(struct ib_device *device) { return (device->node_type == RDMA_NODE_IB_SWITCH) ? 0 : 1; } -static int end_port(struct ib_device *device) +static int rdma_end_port(struct ib_device *device) { return (device->node_type == RDMA_NODE_IB_SWITCH) ? 0 : device->phys_port_cnt; @@ -192,6 +193,7 @@ EXPORT_SYMBOL(ib_alloc_device); void ib_dealloc_device(struct ib_device *device) { if (device->reg_state == IB_DEV_UNINITIALIZED) { + kfree(device->port_immutable); kfree(device); return; } @@ -224,43 +226,42 @@ static int add_client_context(struct ib_device *device return 0; } -static int read_port_table_lengths(struct ib_device *device) +static int verify_immutable(const struct ib_device *dev, u8 port) { - struct ib_port_attr *tprops = NULL; - int num_ports, ret = -ENOMEM; - u8 port_index; + return WARN_ON(!rdma_cap_ib_mad(dev, port) && + rdma_max_mad_size(dev, port) != 0); +} - tprops = kmalloc(sizeof *tprops, GFP_KERNEL); - if (!tprops) - goto out; +static int read_port_immutable(struct ib_device *device) +{ + int ret; + u8 start_port = rdma_start_port(device); + u8 end_port = rdma_end_port(device); + u8 port; - num_ports = end_port(device) - start_port(device) + 1; + /** + * device->port_immutable is indexed directly by the port number to make + * access to this data as efficient as possible. + * + * Therefore port_immutable is declared as a 1 based array with + * potential empty slots at the beginning. + */ + device->port_immutable = kzalloc(sizeof(*device->port_immutable) + * (end_port + 1), + GFP_KERNEL); + if (!device->port_immutable) + return -ENOMEM; - device->pkey_tbl_len = kmalloc(sizeof *device->pkey_tbl_len * num_ports, - GFP_KERNEL); - device->gid_tbl_len = kmalloc(sizeof *device->gid_tbl_len * num_ports, - GFP_KERNEL); - if (!device->pkey_tbl_len || !device->gid_tbl_len) - goto err; - - for (port_index = 0; port_index < num_ports; ++port_index) { - ret = ib_query_port(device, port_index + start_port(device), - tprops); + for (port = start_port; port <= end_port; ++port) { + ret = device->get_port_immutable(device, port, + &device->port_immutable[port]); if (ret) - goto err; - device->pkey_tbl_len[port_index] = tprops->pkey_tbl_len; - device->gid_tbl_len[port_index] = tprops->gid_tbl_len; - } + return ret; - ret = 0; - goto out; - -err: - kfree(device->gid_tbl_len); - kfree(device->pkey_tbl_len); -out: - kfree(tprops); - return ret; + if (verify_immutable(device, port)) + return -EINVAL; + } + return 0; } /** @@ -298,10 +299,11 @@ int ib_register_device(struct ib_device *device, device->ib_uverbs_xrcd_table = RB_ROOT; mutex_init(&device->xrcd_table_mutex); - ret = read_port_table_lengths(device); + + ret = read_port_immutable(device); if (ret) { - printk(KERN_WARNING "Couldn't create table lengths cache for device %s\n", - device->name); + printk(KERN_WARNING "Couldn't create per port immutable data %s\n", + device->name); goto out; } @@ -309,8 +311,7 @@ int ib_register_device(struct ib_device *device, if (ret) { printk(KERN_WARNING "Couldn't register device %s with driver model\n", device->name); - kfree(device->gid_tbl_len); - kfree(device->pkey_tbl_len); + kfree(device->port_immutable); goto out; } @@ -352,9 +353,6 @@ void ib_unregister_device(struct ib_device *device) list_del(&device->core_list); - kfree(device->gid_tbl_len); - kfree(device->pkey_tbl_len); - mutex_unlock(&device_mutex); ib_device_unregister_sysfs(device); @@ -579,7 +577,7 @@ int ib_query_port(struct ib_device *device, u8 port_num, struct ib_port_attr *port_attr) { - if (port_num < start_port(device) || port_num > end_port(device)) + if (port_num < rdma_start_port(device) || port_num > rdma_end_port(device)) return -EINVAL; return device->query_port(device, port_num, port_attr); @@ -651,7 +649,7 @@ int ib_modify_port(struct ib_device *device, u8 port_num, int port_modify_mask, struct ib_port_modify *port_modify) { - if (port_num < start_port(device) || port_num > end_port(device)) + if (port_num < rdma_start_port(device) || port_num > rdma_end_port(device)) return -EINVAL; return device->modify_port(device, port_num, port_modify_mask, @@ -674,8 +672,8 @@ int ib_find_gid(struct ib_device *device, union ib_gid union ib_gid tmp_gid; int ret, port, i; - for (port = start_port(device); port <= end_port(device); ++port) { - for (i = 0; i < device->gid_tbl_len[port - start_port(device)]; ++i) { + for (port = rdma_start_port(device); port <= rdma_end_port(device); ++port) { + for (i = 0; i < device->port_immutable[port].gid_tbl_len; ++i) { ret = ib_query_gid(device, port, i, &tmp_gid); if (ret) return ret; @@ -706,7 +704,7 @@ int ib_find_pkey(struct ib_device *device, int ret, i; u16 tmp_pkey; - for (i = 0; i < device->pkey_tbl_len[port_num - start_port(device)]; ++i) { + for (i = 0; i < device->port_immutable[port_num].pkey_tbl_len; ++i) { ret = ib_query_pkey(device, port_num, i, &tmp_pkey); if (ret) return ret; Modified: stable/10/sys/ofed/drivers/infiniband/hw/mlx4/main.c ============================================================================== --- stable/10/sys/ofed/drivers/infiniband/hw/mlx4/main.c Thu Nov 9 18:22:42 2017 (r325610) +++ stable/10/sys/ofed/drivers/infiniband/hw/mlx4/main.c Thu Nov 9 19:00:11 2017 (r325611) @@ -1864,6 +1864,38 @@ err: "is incorrect. The parameter value is discarded!"); } +static int mlx4_port_immutable(struct ib_device *ibdev, u8 port_num, + struct ib_port_immutable *immutable) +{ + struct ib_port_attr attr; + struct mlx4_ib_dev *mdev = to_mdev(ibdev); + int err; + + if (mlx4_ib_port_link_layer(ibdev, port_num) == IB_LINK_LAYER_INFINIBAND) { + immutable->core_cap_flags = RDMA_CORE_PORT_IBA_IB; + immutable->max_mad_size = IB_MGMT_MAD_SIZE; + } else { + if (mdev->dev->caps.flags & MLX4_DEV_CAP_FLAG_IBOE) + immutable->core_cap_flags = RDMA_CORE_PORT_IBA_ROCE; + if (mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_ROCEV2) + immutable->core_cap_flags = RDMA_CORE_PORT_IBA_ROCE | + RDMA_CORE_PORT_IBA_ROCE_UDP_ENCAP; + immutable->core_cap_flags |= RDMA_CORE_PORT_RAW_PACKET; + if (immutable->core_cap_flags & (RDMA_CORE_PORT_IBA_ROCE | + RDMA_CORE_PORT_IBA_ROCE_UDP_ENCAP)) + immutable->max_mad_size = IB_MGMT_MAD_SIZE; + } + + err = ib_query_port(ibdev, port_num, &attr); + if (err) + return err; + + immutable->pkey_tbl_len = attr.pkey_tbl_len; + immutable->gid_tbl_len = attr.gid_tbl_len; + + return 0; +} + static void *mlx4_ib_add(struct mlx4_dev *dev) { struct mlx4_ib_dev *ibdev; @@ -1993,6 +2025,7 @@ static void *mlx4_ib_add(struct mlx4_dev *dev) ibdev->ib_dev.attach_flow = mlx4_ib_flow_attach; ibdev->ib_dev.detach_flow = mlx4_ib_flow_detach; ibdev->ib_dev.process_mad = mlx4_ib_process_mad; + ibdev->ib_dev.get_port_immutable = mlx4_port_immutable; if (!mlx4_is_slave(ibdev->dev)) { ibdev->ib_dev.alloc_fmr = mlx4_ib_fmr_alloc; Modified: stable/10/sys/ofed/drivers/infiniband/hw/mthca/mthca_provider.c ============================================================================== --- stable/10/sys/ofed/drivers/infiniband/hw/mthca/mthca_provider.c Thu Nov 9 18:22:42 2017 (r325610) +++ stable/10/sys/ofed/drivers/infiniband/hw/mthca/mthca_provider.c Thu Nov 9 19:00:11 2017 (r325611) @@ -1297,6 +1297,25 @@ out: return err; } +static int mthca_port_immutable(struct ib_device *ibdev, u8 port_num, + struct ib_port_immutable *immutable) +{ + struct ib_port_attr attr; + int err; + + immutable->core_cap_flags = RDMA_CORE_PORT_IBA_IB; + + err = ib_query_port(ibdev, port_num, &attr); + if (err) + return err; + + immutable->pkey_tbl_len = attr.pkey_tbl_len; + immutable->gid_tbl_len = attr.gid_tbl_len; + immutable->max_mad_size = IB_MGMT_MAD_SIZE; + + return 0; +} + int mthca_register_device(struct mthca_dev *dev) { int ret; @@ -1376,6 +1395,7 @@ int mthca_register_device(struct mthca_dev *dev) dev->ib_dev.reg_phys_mr = mthca_reg_phys_mr; dev->ib_dev.reg_user_mr = mthca_reg_user_mr; dev->ib_dev.dereg_mr = mthca_dereg_mr; + dev->ib_dev.get_port_immutable = mthca_port_immutable; if (dev->mthca_flags & MTHCA_FLAG_FMR) { dev->ib_dev.alloc_fmr = mthca_alloc_fmr; Modified: stable/10/sys/ofed/include/linux/kernel.h ============================================================================== --- stable/10/sys/ofed/include/linux/kernel.h Thu Nov 9 18:22:42 2017 (r325610) +++ stable/10/sys/ofed/include/linux/kernel.h Thu Nov 9 19:00:11 2017 (r325611) @@ -63,7 +63,14 @@ #define BUG() panic("BUG") #define BUG_ON(condition) do { if (condition) BUG(); } while(0) -#define WARN_ON BUG_ON +#define WARN_ON(cond) ({ \ + bool __ret = (cond); \ + if (__ret) { \ + printf("WARNING %s failed at %s:%d\n", \ + __stringify(cond), __FILE__, __LINE__); \ + } \ + unlikely(__ret); \ +}) #undef ALIGN #define ALIGN(x, y) roundup2((x), (y)) Modified: stable/10/sys/ofed/include/rdma/ib_mad.h ============================================================================== --- stable/10/sys/ofed/include/rdma/ib_mad.h Thu Nov 9 18:22:42 2017 (r325610) +++ stable/10/sys/ofed/include/rdma/ib_mad.h Thu Nov 9 19:00:11 2017 (r325611) @@ -125,6 +125,7 @@ enum { IB_MGMT_SA_DATA = 200, IB_MGMT_DEVICE_HDR = 64, IB_MGMT_DEVICE_DATA = 192, + IB_MGMT_MAD_SIZE = IB_MGMT_MAD_HDR + IB_MGMT_MAD_DATA, }; struct ib_mad_hdr { Modified: stable/10/sys/ofed/include/rdma/ib_verbs.h ============================================================================== --- stable/10/sys/ofed/include/rdma/ib_verbs.h Thu Nov 9 18:22:42 2017 (r325610) +++ stable/10/sys/ofed/include/rdma/ib_verbs.h Thu Nov 9 19:00:11 2017 (r325611) @@ -306,6 +306,56 @@ union rdma_protocol_stats { struct iw_protocol_stats iw; }; +/* Define bits for the various functionality this port needs to be supported by + * the core. + */ +/* Management 0x00000FFF */ +#define RDMA_CORE_CAP_IB_MAD 0x00000001 +#define RDMA_CORE_CAP_IB_SMI 0x00000002 +#define RDMA_CORE_CAP_IB_CM 0x00000004 +#define RDMA_CORE_CAP_IW_CM 0x00000008 +#define RDMA_CORE_CAP_IB_SA 0x00000010 +#define RDMA_CORE_CAP_OPA_MAD 0x00000020 + +/* Address format 0x000FF000 */ +#define RDMA_CORE_CAP_AF_IB 0x00001000 +#define RDMA_CORE_CAP_ETH_AH 0x00002000 +#define RDMA_CORE_CAP_OPA_AH 0x00004000 + +/* Protocol 0xFFF00000 */ +#define RDMA_CORE_CAP_PROT_IB 0x00100000 +#define RDMA_CORE_CAP_PROT_ROCE 0x00200000 +#define RDMA_CORE_CAP_PROT_IWARP 0x00400000 +#define RDMA_CORE_CAP_PROT_ROCE_UDP_ENCAP 0x00800000 +#define RDMA_CORE_CAP_PROT_RAW_PACKET 0x01000000 +#define RDMA_CORE_CAP_PROT_USNIC 0x02000000 + +#define RDMA_CORE_PORT_IBA_IB (RDMA_CORE_CAP_PROT_IB \ + | RDMA_CORE_CAP_IB_MAD \ + | RDMA_CORE_CAP_IB_SMI \ + | RDMA_CORE_CAP_IB_CM \ + | RDMA_CORE_CAP_IB_SA \ + | RDMA_CORE_CAP_AF_IB) +#define RDMA_CORE_PORT_IBA_ROCE (RDMA_CORE_CAP_PROT_ROCE \ + | RDMA_CORE_CAP_IB_MAD \ + | RDMA_CORE_CAP_IB_CM \ + | RDMA_CORE_CAP_AF_IB \ + | RDMA_CORE_CAP_ETH_AH) +#define RDMA_CORE_PORT_IBA_ROCE_UDP_ENCAP \ + (RDMA_CORE_CAP_PROT_ROCE_UDP_ENCAP \ + | RDMA_CORE_CAP_IB_MAD \ + | RDMA_CORE_CAP_IB_CM \ + | RDMA_CORE_CAP_AF_IB \ + | RDMA_CORE_CAP_ETH_AH) +#define RDMA_CORE_PORT_IWARP (RDMA_CORE_CAP_PROT_IWARP \ + | RDMA_CORE_CAP_IW_CM) +#define RDMA_CORE_PORT_INTEL_OPA (RDMA_CORE_PORT_IBA_IB \ + | RDMA_CORE_CAP_OPA_MAD) + +#define RDMA_CORE_PORT_RAW_PACKET (RDMA_CORE_CAP_PROT_RAW_PACKET) + +#define RDMA_CORE_PORT_USNIC (RDMA_CORE_CAP_PROT_USNIC) + struct ib_port_attr { enum ib_port_state state; enum ib_mtu max_mtu; @@ -1170,6 +1220,13 @@ struct ib_dma_mapping_ops { struct iw_cm_verbs; +struct ib_port_immutable { + int pkey_tbl_len; + int gid_tbl_len; + u32 core_cap_flags; + u32 max_mad_size; +}; + struct ib_device { struct device *dma_device; @@ -1183,8 +1240,10 @@ struct ib_device { struct list_head client_data_list; struct ib_cache cache; - int *pkey_tbl_len; - int *gid_tbl_len; + /** + * port_immutable is indexed by port number + */ + struct ib_port_immutable *port_immutable; int num_comp_vectors; @@ -1387,6 +1446,14 @@ struct ib_device { u8 phys_port_cnt; struct rb_root ib_uverbs_xrcd_table; struct mutex xrcd_table_mutex; + + /** + * The following mandatory functions are used only at device + * registration. Keep functions such as these at the end of this + * structure to avoid cache line misses when accessing struct ib_device + * in fast paths. + */ + int (*get_port_immutable)(struct ib_device *, u8, struct ib_port_immutable *); }; struct ib_client { @@ -1452,6 +1519,252 @@ int ib_query_port(struct ib_device *device, enum rdma_link_layer rdma_port_get_link_layer(struct ib_device *device, u8 port_num); + +static inline bool rdma_protocol_ib(const struct ib_device *device, u8 port_num) +{ + return device->port_immutable[port_num].core_cap_flags & RDMA_CORE_CAP_PROT_IB; +} + +static inline bool rdma_protocol_roce(const struct ib_device *device, u8 port_num) +{ + return device->port_immutable[port_num].core_cap_flags & + (RDMA_CORE_CAP_PROT_ROCE | RDMA_CORE_CAP_PROT_ROCE_UDP_ENCAP); +} + +static inline bool rdma_protocol_roce_udp_encap(const struct ib_device *device, u8 port_num) +{ + return device->port_immutable[port_num].core_cap_flags & RDMA_CORE_CAP_PROT_ROCE_UDP_ENCAP; +} + +static inline bool rdma_protocol_roce_eth_encap(const struct ib_device *device, u8 port_num) +{ + return device->port_immutable[port_num].core_cap_flags & RDMA_CORE_CAP_PROT_ROCE; +} + +static inline bool rdma_protocol_iwarp(const struct ib_device *device, u8 port_num) +{ + return device->port_immutable[port_num].core_cap_flags & RDMA_CORE_CAP_PROT_IWARP; +} + +static inline bool rdma_ib_or_roce(const struct ib_device *device, u8 port_num) +{ + return rdma_protocol_ib(device, port_num) || + rdma_protocol_roce(device, port_num); +} + +/** + * rdma_cap_ib_mad - Check if the port of a device supports Infiniband + * Management Datagrams. + * @device: Device to check + * @port_num: Port number to check + * + * Management Datagrams (MAD) are a required part of the InfiniBand + * specification and are supported on all InfiniBand devices. A slightly + * extended version are also supported on OPA interfaces. + * + * Return: true if the port supports sending/receiving of MAD packets. + */ +static inline bool rdma_cap_ib_mad(const struct ib_device *device, u8 port_num) +{ + return device->port_immutable[port_num].core_cap_flags & RDMA_CORE_CAP_IB_MAD; +} + +/** + * rdma_cap_opa_mad - Check if the port of device provides support for OPA + * Management Datagrams. + * @device: Device to check + * @port_num: Port number to check + * + * Intel OmniPath devices extend and/or replace the InfiniBand Management + * datagrams with their own versions. These OPA MADs share many but not all of + * the characteristics of InfiniBand MADs. + * + * OPA MADs differ in the following ways: + * + * 1) MADs are variable size up to 2K + * IBTA defined MADs remain fixed at 256 bytes + * 2) OPA SMPs must carry valid PKeys + * 3) OPA SMP packets are a different format + * + * Return: true if the port supports OPA MAD packet formats. + */ +static inline bool rdma_cap_opa_mad(struct ib_device *device, u8 port_num) +{ + return (device->port_immutable[port_num].core_cap_flags & RDMA_CORE_CAP_OPA_MAD) + == RDMA_CORE_CAP_OPA_MAD; +} + +/** + * rdma_cap_ib_smi - Check if the port of a device provides an Infiniband + * Subnet Management Agent (SMA) on the Subnet Management Interface (SMI). + * @device: Device to check + * @port_num: Port number to check + * + * Each InfiniBand node is required to provide a Subnet Management Agent + * that the subnet manager can access. Prior to the fabric being fully + * configured by the subnet manager, the SMA is accessed via a well known + * interface called the Subnet Management Interface (SMI). This interface + * uses directed route packets to communicate with the SM to get around the + * chicken and egg problem of the SM needing to know what's on the fabric + * in order to configure the fabric, and needing to configure the fabric in + * order to send packets to the devices on the fabric. These directed + * route packets do not need the fabric fully configured in order to reach + * their destination. The SMI is the only method allowed to send + * directed route packets on an InfiniBand fabric. + * + * Return: true if the port provides an SMI. + */ +static inline bool rdma_cap_ib_smi(const struct ib_device *device, u8 port_num) +{ + return device->port_immutable[port_num].core_cap_flags & RDMA_CORE_CAP_IB_SMI; +} + +/** + * rdma_cap_ib_cm - Check if the port of device has the capability Infiniband + * Communication Manager. + * @device: Device to check + * @port_num: Port number to check + * + * The InfiniBand Communication Manager is one of many pre-defined General + * Service Agents (GSA) that are accessed via the General Service + * Interface (GSI). It's role is to facilitate establishment of connections + * between nodes as well as other management related tasks for established + * connections. + * + * Return: true if the port supports an IB CM (this does not guarantee that + * a CM is actually running however). + */ +static inline bool rdma_cap_ib_cm(const struct ib_device *device, u8 port_num) +{ + return device->port_immutable[port_num].core_cap_flags & RDMA_CORE_CAP_IB_CM; +} + +/** + * rdma_cap_iw_cm - Check if the port of device has the capability IWARP + * Communication Manager. + * @device: Device to check + * @port_num: Port number to check + * + * Similar to above, but specific to iWARP connections which have a different + * managment protocol than InfiniBand. + * + * Return: true if the port supports an iWARP CM (this does not guarantee that + * a CM is actually running however). + */ +static inline bool rdma_cap_iw_cm(const struct ib_device *device, u8 port_num) +{ + return device->port_immutable[port_num].core_cap_flags & RDMA_CORE_CAP_IW_CM; +} + +/** + * rdma_cap_ib_sa - Check if the port of device has the capability Infiniband + * Subnet Administration. + * @device: Device to check + * @port_num: Port number to check + * + * An InfiniBand Subnet Administration (SA) service is a pre-defined General + * Service Agent (GSA) provided by the Subnet Manager (SM). On InfiniBand + * fabrics, devices should resolve routes to other hosts by contacting the + * SA to query the proper route. + * + * Return: true if the port should act as a client to the fabric Subnet + * Administration interface. This does not imply that the SA service is + * running locally. + */ +static inline bool rdma_cap_ib_sa(const struct ib_device *device, u8 port_num) +{ + return device->port_immutable[port_num].core_cap_flags & RDMA_CORE_CAP_IB_SA; +} + +/** + * rdma_cap_ib_mcast - Check if the port of device has the capability Infiniband + * Multicast. + * @device: Device to check + * @port_num: Port number to check + * + * InfiniBand multicast registration is more complex than normal IPv4 or + * IPv6 multicast registration. Each Host Channel Adapter must register + * with the Subnet Manager when it wishes to join a multicast group. It + * should do so only once regardless of how many queue pairs it subscribes + * to this group. And it should leave the group only after all queue pairs + * attached to the group have been detached. + * + * Return: true if the port must undertake the additional adminstrative + * overhead of registering/unregistering with the SM and tracking of the + * total number of queue pairs attached to the multicast group. + */ +static inline bool rdma_cap_ib_mcast(const struct ib_device *device, u8 port_num) +{ + return rdma_cap_ib_sa(device, port_num); +} + +/** + * rdma_cap_af_ib - Check if the port of device has the capability + * Native Infiniband Address. + * @device: Device to check + * @port_num: Port number to check + * + * InfiniBand addressing uses a port's GUID + Subnet Prefix to make a default + * GID. RoCE uses a different mechanism, but still generates a GID via + * a prescribed mechanism and port specific data. + * + * Return: true if the port uses a GID address to identify devices on the + * network. + */ +static inline bool rdma_cap_af_ib(const struct ib_device *device, u8 port_num) +{ + return device->port_immutable[port_num].core_cap_flags & RDMA_CORE_CAP_AF_IB; +} + +/** + * rdma_cap_eth_ah - Check if the port of device has the capability + * Ethernet Address Handle. + * @device: Device to check + * @port_num: Port number to check + * + * RoCE is InfiniBand over Ethernet, and it uses a well defined technique + * to fabricate GIDs over Ethernet/IP specific addresses native to the + * port. Normally, packet headers are generated by the sending host + * adapter, but when sending connectionless datagrams, we must manually + * inject the proper headers for the fabric we are communicating over. + * *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-10@freebsd.org Thu Nov 9 19:15:30 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1DB35E59184; Thu, 9 Nov 2017 19:15: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 mx1.freebsd.org (Postfix) with ESMTPS id D546373FAD; Thu, 9 Nov 2017 19:15: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 vA9JFSGU040894; Thu, 9 Nov 2017 19:15:28 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vA9JFSK3040893; Thu, 9 Nov 2017 19:15:28 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201711091915.vA9JFSK3040893@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 9 Nov 2017 19:15:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r325613 - stable/10/sys/ofed/include/linux X-SVN-Group: stable-10 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/10/sys/ofed/include/linux X-SVN-Commit-Revision: 325613 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-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Nov 2017 19:15:30 -0000 Author: hselasky Date: Thu Nov 9 19:15:28 2017 New Revision: 325613 URL: https://svnweb.freebsd.org/changeset/base/325613 Log: MFC r325278: Unconditionally include "opt_inet6.h" in the LinuxKPI. This makes sure the INET6 macro gets properly defined, also for kernel module builds. Sponsored by: Mellanox Technologies Modified: stable/10/sys/ofed/include/linux/in6.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/ofed/include/linux/in6.h ============================================================================== --- stable/10/sys/ofed/include/linux/in6.h Thu Nov 9 19:08:30 2017 (r325612) +++ stable/10/sys/ofed/include/linux/in6.h Thu Nov 9 19:15:28 2017 (r325613) @@ -30,8 +30,6 @@ #ifndef _LINUX_IN6_H_ #define _LINUX_IN6_H_ -#ifndef KLD_MODULE #include "opt_inet6.h" -#endif #endif /* _LINUX_IN6_H_ */ From owner-svn-src-stable-10@freebsd.org Thu Nov 9 19:46:41 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DC691E5A047; Thu, 9 Nov 2017 19:46:41 +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 mx1.freebsd.org (Postfix) with ESMTPS id A5D4D75A7C; Thu, 9 Nov 2017 19:46:41 +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 vA9Jked5054894; Thu, 9 Nov 2017 19:46:40 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vA9JkeYV054893; Thu, 9 Nov 2017 19:46:40 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201711091946.vA9JkeYV054893@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 9 Nov 2017 19:46:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r325617 - stable/10/sys/ofed/drivers/infiniband/core X-SVN-Group: stable-10 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/10/sys/ofed/drivers/infiniband/core X-SVN-Commit-Revision: 325617 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-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Nov 2017 19:46:42 -0000 Author: hselasky Date: Thu Nov 9 19:46:40 2017 New Revision: 325617 URL: https://svnweb.freebsd.org/changeset/base/325617 Log: Remove the now obsolete "unify_tcp_port_space" ibcore module parameter. Missed as part of the MFC of r324792 in r325611. This is a direct commit. Sponsored by: Mellanox Technologies Modified: stable/10/sys/ofed/drivers/infiniband/core/cma.c Modified: stable/10/sys/ofed/drivers/infiniband/core/cma.c ============================================================================== --- stable/10/sys/ofed/drivers/infiniband/core/cma.c Thu Nov 9 19:30:10 2017 (r325616) +++ stable/10/sys/ofed/drivers/infiniband/core/cma.c Thu Nov 9 19:46:40 2017 (r325617) @@ -62,11 +62,6 @@ static int tavor_quirk = 0; module_param_named(tavor_quirk, tavor_quirk, int, 0644); MODULE_PARM_DESC(tavor_quirk, "Tavor performance quirk: limit MTU to 1K if > 0"); -int unify_tcp_port_space = 1; -module_param(unify_tcp_port_space, int, 0644); -MODULE_PARM_DESC(unify_tcp_port_space, "Unify the host TCP and RDMA port " - "space allocation (default=1)"); - #define CMA_CM_RESPONSE_TIMEOUT 20 #define CMA_MAX_CM_RETRIES 15 #define CMA_CM_MRA_SETTING (IB_CM_MRA_FLAG_DELAY | 24) From owner-svn-src-stable-10@freebsd.org Fri Nov 10 12:31:59 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5771DE6CF2A; Fri, 10 Nov 2017 12:31:59 +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 mx1.freebsd.org (Postfix) with ESMTPS id 2499971902; Fri, 10 Nov 2017 12:31:59 +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 vAACVwrp078584; Fri, 10 Nov 2017 12:31:58 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vAACVwLx078583; Fri, 10 Nov 2017 12:31:58 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201711101231.vAACVwLx078583@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 10 Nov 2017 12:31:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r325643 - stable/10/sys/kern X-SVN-Group: stable-10 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/10/sys/kern X-SVN-Commit-Revision: 325643 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-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Nov 2017 12:31:59 -0000 Author: kib Date: Fri Nov 10 12:31:58 2017 New Revision: 325643 URL: https://svnweb.freebsd.org/changeset/base/325643 Log: MFC r325567: Zero whole struct ptrace_lwpinfo to not leak kernel stack data. Security: CVE-2017-1086 Modified: stable/10/sys/kern/sys_process.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/sys_process.c ============================================================================== --- stable/10/sys/kern/sys_process.c Fri Nov 10 12:28:43 2017 (r325642) +++ stable/10/sys/kern/sys_process.c Fri Nov 10 12:31:58 2017 (r325643) @@ -474,6 +474,7 @@ ptrace_lwpinfo_to32(const struct ptrace_lwpinfo *pl, struct ptrace_lwpinfo32 *pl32) { + bzero(pl32, sizeof(*pl32)); pl32->pl_lwpid = pl->pl_lwpid; pl32->pl_event = pl->pl_event; pl32->pl_flags = pl->pl_flags; @@ -1276,6 +1277,7 @@ kern_ptrace(struct thread *td, int req, pid_t pid, voi } else #endif pl = addr; + bzero(pl, sizeof(*pl)); pl->pl_lwpid = td2->td_tid; pl->pl_event = PL_EVENT_NONE; pl->pl_flags = 0; @@ -1296,8 +1298,6 @@ kern_ptrace(struct thread *td, int req, pid_t pid, voi pl->pl_siginfo = td2->td_dbgksi.ksi_info; } } - if ((pl->pl_flags & PL_FLAG_SI) == 0) - bzero(&pl->pl_siginfo, sizeof(pl->pl_siginfo)); if (td2->td_dbgflags & TDB_SCE) pl->pl_flags |= PL_FLAG_SCE; else if (td2->td_dbgflags & TDB_SCX)