From owner-svn-src-projects@FreeBSD.ORG Sun Aug 8 11:58:16 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 10E1E1065670; Sun, 8 Aug 2010 11:58:16 +0000 (UTC) (envelope-from emaste@freebsd.org) Received: from mail1.sandvine.com (mail1.sandvine.com [64.7.137.162]) by mx1.freebsd.org (Postfix) with ESMTP id 7EF0D8FC08; Sun, 8 Aug 2010 11:58:15 +0000 (UTC) Received: from labgw2.phaedrus.sandvine.com (192.168.222.22) by WTL-EXCH-1.sandvine.com (192.168.196.31) with Microsoft SMTP Server id 14.0.694.0; Sun, 8 Aug 2010 07:47:24 -0400 Received: by labgw2.phaedrus.sandvine.com (Postfix, from userid 10332) id 330F833C00; Sun, 8 Aug 2010 07:47:26 -0400 (EDT) Date: Sun, 8 Aug 2010 07:47:26 -0400 From: Ed Maste To: Attilio Rao Message-ID: <20100808114725.GA34359@sandvine.com> References: <201008071739.o77HdM2Y009458@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <201008071739.o77HdM2Y009458@svn.freebsd.org> User-Agent: Mutt/1.4.2.1i Cc: svn-src-projects@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r211029 - projects/sv/sys/net X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Aug 2010 11:58:16 -0000 On Sat, Aug 07, 2010 at 05:39:22PM +0000, Attilio Rao wrote: > Author: attilio > Date: Sat Aug 7 17:39:22 2010 > New Revision: 211029 > URL: http://svn.freebsd.org/changeset/base/211029 > > Log: > Add a tunable for nd_enable. > As long as TUNABLE_INT is discouraged, however, switch the type int -> long > and adjust accordingly the sysctl stubs. This doesn't really make sense as far as I can tell - and particularly for sysctls, using a long can introduce 32-bit compat issues. I'd prefer that this remain an int. What benefit does using a long provide in this case? -Ed From owner-svn-src-projects@FreeBSD.ORG Sun Aug 8 12:55:33 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 38F731065676; Sun, 8 Aug 2010 12:55:33 +0000 (UTC) (envelope-from emaste@freebsd.org) Received: from mail1.sandvine.com (mail1.sandvine.com [64.7.137.162]) by mx1.freebsd.org (Postfix) with ESMTP id 826668FC1D; Sun, 8 Aug 2010 12:55:32 +0000 (UTC) Received: from labgw2.phaedrus.sandvine.com (192.168.222.22) by WTL-EXCH-1.sandvine.com (192.168.196.31) with Microsoft SMTP Server id 14.0.694.0; Sun, 8 Aug 2010 08:55:30 -0400 Received: by labgw2.phaedrus.sandvine.com (Postfix, from userid 10332) id 7343A33C00; Sun, 8 Aug 2010 08:55:31 -0400 (EDT) Date: Sun, 8 Aug 2010 08:55:31 -0400 From: Ed Maste To: Attilio Rao Message-ID: <20100808125531.GA40928@sandvine.com> References: <201008071739.o77HdM2Y009458@svn.freebsd.org> <20100808114725.GA34359@sandvine.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.1i Cc: svn-src-projects@freebsd.org, src-committers@freebsd.org, Ed Maste Subject: Re: svn commit: r211029 - projects/sv/sys/net X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Aug 2010 12:55:33 -0000 On Sun, Aug 08, 2010 at 02:35:53PM +0200, Attilio Rao wrote: > 2010/8/8 Ed Maste : > > On Sat, Aug 07, 2010 at 05:39:22PM +0000, Attilio Rao wrote: > > > >> Author: attilio > >> Date: Sat Aug ??7 17:39:22 2010 > >> New Revision: 211029 > >> URL: http://svn.freebsd.org/changeset/base/211029 > >> > >> Log: > >> ?? Add a tunable for nd_enable. > >> ?? As long as TUNABLE_INT is discouraged, however, switch the type int -> long > >> ?? and adjust accordingly the sysctl stubs. > > > > This doesn't really make sense as far as I can tell - and particularly > > for sysctls, using a long can introduce 32-bit compat issues. ??I'd > > prefer that this remain an int. > > > > What benefit does using a long provide in this case? > > Did you see the recent thread on hackers@ about it? > If we choice to go with a direction on TUNABLES_* I'd prefer to follow it now. I just read it now, but I don't see any actual reason to prefer long in that thread. -Ed From owner-svn-src-projects@FreeBSD.ORG Sun Aug 8 13:02:14 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 04945106567A for ; Sun, 8 Aug 2010 13:02:14 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-qw0-f54.google.com (mail-qw0-f54.google.com [209.85.216.54]) by mx1.freebsd.org (Postfix) with ESMTP id A793C8FC1A for ; Sun, 8 Aug 2010 13:02:13 +0000 (UTC) Received: by qwg5 with SMTP id 5so5299080qwg.13 for ; Sun, 08 Aug 2010 06:02:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=jG5A5bjex8+8WDeXelJxt5Vp5/aunlKrySOkWI74Rxw=; b=U0UIGLTcGD9h0KC+mhMeq1kKOrkqLF0qKn+1o64qebkm3E5fHogJyeoSbS6IpQSe7W 8yY3g7Gd4q4J4rFCw450lF+SWHnDrLISPmESZ67b9nUIzkxuBDxwpK6hqvVeMbSG4qdT wjSpTSdjcJfxr7HJWX4R2pHyxu03ghU/XKxEE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=RGBqqb+6rzwx19td1f3Poz01vugdOc4UUXJBgHk+9gB362PtkKQMBcwLnAysim9Mq8 2VeC1Cnfp7czVwHAeljZUbTU6/0FY/WOknFkE3i+rEREvzUtM36cIo2e9EkRra+YyszR Ikr1GQjbYso70H8hSBry9k3Q0O+Bj5U1hqyUY= MIME-Version: 1.0 Received: by 10.224.115.79 with SMTP id h15mr7678705qaq.21.1281270953941; Sun, 08 Aug 2010 05:35:53 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.229.251.6 with HTTP; Sun, 8 Aug 2010 05:35:53 -0700 (PDT) In-Reply-To: <20100808114725.GA34359@sandvine.com> References: <201008071739.o77HdM2Y009458@svn.freebsd.org> <20100808114725.GA34359@sandvine.com> Date: Sun, 8 Aug 2010 14:35:53 +0200 X-Google-Sender-Auth: iMtRxkISzMvU5UdP2Epw3p9lnFA Message-ID: From: Attilio Rao To: Ed Maste Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-projects@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r211029 - projects/sv/sys/net X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Aug 2010 13:02:14 -0000 2010/8/8 Ed Maste : > On Sat, Aug 07, 2010 at 05:39:22PM +0000, Attilio Rao wrote: > >> Author: attilio >> Date: Sat Aug =C2=A07 17:39:22 2010 >> New Revision: 211029 >> URL: http://svn.freebsd.org/changeset/base/211029 >> >> Log: >> =C2=A0 Add a tunable for nd_enable. >> =C2=A0 As long as TUNABLE_INT is discouraged, however, switch the type i= nt -> long >> =C2=A0 and adjust accordingly the sysctl stubs. > > This doesn't really make sense as far as I can tell - and particularly > for sysctls, using a long can introduce 32-bit compat issues. =C2=A0I'd > prefer that this remain an int. > > What benefit does using a long provide in this case? Did you see the recent thread on hackers@ about it? If we choice to go with a direction on TUNABLES_* I'd prefer to follow it n= ow. Attilio --=20 Peace can only be achieved by understanding - A. Einstein From owner-svn-src-projects@FreeBSD.ORG Sun Aug 8 13:17:36 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C52591065672; Sun, 8 Aug 2010 13:17:36 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-qy0-f175.google.com (mail-qy0-f175.google.com [209.85.216.175]) by mx1.freebsd.org (Postfix) with ESMTP id 445E98FC1B; Sun, 8 Aug 2010 13:17:35 +0000 (UTC) Received: by qyk11 with SMTP id 11so1363965qyk.13 for ; Sun, 08 Aug 2010 06:17:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type; bh=GkkCXcStj7oeRpVLyFlDd98sc9t//aB+FqR+xEhXLrk=; b=gDibSdZ9M7s/giF6TfvybxOuZwM5MQg4QJt+S5obSCsHoD5zjWo7mD7HSdfKsqMrGu r/u7D6WtIn82QoDCwfIsHP4ESggG/eX9aVCL7ycpiaYBN1AnJhgNDC9n+iuSeU4Jlz/M 1twLatPTTf1CmJX+5tfeVOjklxoWxrMbatsNQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; b=pjvmfvCRe5z2yRe5dnSlmwcvq7ScGVCIdLzzIdY3aN1caxVxmcfvKIW4LPoPd6vXsm CWvz86iETdTX7LpqI44ylWWedE+U5HmpelwNYLbtzM2fDBtvxC0ovQWGpUTvOg6ew9vT tzBc6zyM4T3087em4AywC8y9o57FlL7YWQSdY= MIME-Version: 1.0 Received: by 10.224.69.14 with SMTP id x14mr7569065qai.212.1281273455128; Sun, 08 Aug 2010 06:17:35 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.229.251.6 with HTTP; Sun, 8 Aug 2010 06:17:35 -0700 (PDT) In-Reply-To: <20100808125531.GA40928@sandvine.com> References: <201008071739.o77HdM2Y009458@svn.freebsd.org> <20100808114725.GA34359@sandvine.com> <20100808125531.GA40928@sandvine.com> Date: Sun, 8 Aug 2010 15:17:35 +0200 X-Google-Sender-Auth: YfU1RwHip1-xt8HDxVTIZ4A5BTs Message-ID: From: Attilio Rao To: Ed Maste Content-Type: text/plain; charset=UTF-8 Cc: svn-src-projects@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r211029 - projects/sv/sys/net X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Aug 2010 13:17:36 -0000 2010/8/8 Ed Maste : > On Sun, Aug 08, 2010 at 02:35:53PM +0200, Attilio Rao wrote: > >> 2010/8/8 Ed Maste : >> > On Sat, Aug 07, 2010 at 05:39:22PM +0000, Attilio Rao wrote: >> > >> >> Author: attilio >> >> Date: Sat Aug ??7 17:39:22 2010 >> >> New Revision: 211029 >> >> URL: http://svn.freebsd.org/changeset/base/211029 >> >> >> >> Log: >> >> ?? Add a tunable for nd_enable. >> >> ?? As long as TUNABLE_INT is discouraged, however, switch the type int -> long >> >> ?? and adjust accordingly the sysctl stubs. >> > >> > This doesn't really make sense as far as I can tell - and particularly >> > for sysctls, using a long can introduce 32-bit compat issues. ??I'd >> > prefer that this remain an int. >> > >> > What benefit does using a long provide in this case? >> >> Did you see the recent thread on hackers@ about it? >> If we choice to go with a direction on TUNABLES_* I'd prefer to follow it now. > > I just read it now, but I don't see any actual reason to prefer long in > that thread. Probabilly remove the comment would be the best thing then. I'm in favor of it. Attilio -- Peace can only be achieved by understanding - A. Einstein From owner-svn-src-projects@FreeBSD.ORG Sun Aug 8 15:35:17 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 963761065677; Sun, 8 Aug 2010 15:35:17 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7CD938FC1D; Sun, 8 Aug 2010 15:35:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o78FZH2b006255; Sun, 8 Aug 2010 15:35:17 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o78FZHx2006253; Sun, 8 Aug 2010 15:35:17 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201008081535.o78FZHx2006253@svn.freebsd.org> From: Attilio Rao Date: Sun, 8 Aug 2010 15:35:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211075 - projects/sv/sys/net X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Aug 2010 15:35:17 -0000 Author: attilio Date: Sun Aug 8 15:35:17 2010 New Revision: 211075 URL: http://svn.freebsd.org/changeset/base/211075 Log: Revert r211029. The suggestion to skip TUNABLE_INT() may not be well centered for all cases. Modified: projects/sv/sys/net/netdump_client.c Modified: projects/sv/sys/net/netdump_client.c ============================================================================== --- projects/sv/sys/net/netdump_client.c Sun Aug 8 15:29:27 2010 (r211074) +++ projects/sv/sys/net/netdump_client.c Sun Aug 8 15:35:17 2010 (r211075) @@ -162,7 +162,7 @@ static unsigned char buf[MAXDUMPPGS*PAGE * us */ static struct ether_addr nd_server_mac; -static long nd_enable = 0; /* if we should perform a network dump */ +static int nd_enable = 0; /* if we should perform a network dump */ static struct in_addr nd_server = {INADDR_ANY}; /* server address */ static struct in_addr nd_client = {INADDR_ANY}; /* client (our) address */ struct ifnet *nd_nic = NULL; @@ -343,9 +343,9 @@ SYSCTL_INT(_net_dump, OID_AUTO, polls, C "times to poll NIC per retry"); SYSCTL_INT(_net_dump, OID_AUTO, retries, CTLTYPE_INT|CTLFLAG_RW, &nd_retries, 0, "times to retransmit lost packets"); -SYSCTL_LONG(_net_dump, OID_AUTO, enable, CTLTYPE_LONG|CTLFLAG_RW, &nd_enable, +SYSCTL_INT(_net_dump, OID_AUTO, enable, CTLTYPE_INT|CTLFLAG_RW, &nd_enable, 0, "enable network dump"); -TUNABLE_LONG("net.dump.enable", &nd_enable); +TUNABLE_INT("net.dump.enable", &nd_enable); /*- * Network specific primitives. From owner-svn-src-projects@FreeBSD.ORG Sun Aug 8 15:44:44 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 110861065678; Sun, 8 Aug 2010 15:44:44 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EA4708FC0A; Sun, 8 Aug 2010 15:44:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o78Fihcm008359; Sun, 8 Aug 2010 15:44:43 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o78FihwX008357; Sun, 8 Aug 2010 15:44:43 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201008081544.o78FihwX008357@svn.freebsd.org> From: Attilio Rao Date: Sun, 8 Aug 2010 15:44:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211076 - projects/sv/sys/net X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Aug 2010 15:44:44 -0000 Author: attilio Date: Sun Aug 8 15:44:43 2010 New Revision: 211076 URL: http://svn.freebsd.org/changeset/base/211076 Log: - Compile netdump.debug.force just when NETDUMP_DEBUG in included - Fix the usage of nd_force_crash which is not necessarilly to have a static storage Modified: projects/sv/sys/net/netdump_client.c Modified: projects/sv/sys/net/netdump_client.c ============================================================================== --- projects/sv/sys/net/netdump_client.c Sun Aug 8 15:35:17 2010 (r211075) +++ projects/sv/sys/net/netdump_client.c Sun Aug 8 15:44:43 2010 (r211076) @@ -146,7 +146,9 @@ static int netdump_send_arp(void); static void netdump_trigger(void *arg, int howto); static int netdump_udp_output(struct mbuf *m); +#ifdef NETDUMP_DEBUG static int sysctl_force_crash(SYSCTL_HANDLER_ARGS); +#endif static int sysctl_ip(SYSCTL_HANDLER_ARGS); static int sysctl_nic(SYSCTL_HANDLER_ARGS); @@ -166,7 +168,6 @@ static int nd_enable = 0; /* if we shou static struct in_addr nd_server = {INADDR_ANY}; /* server address */ static struct in_addr nd_client = {INADDR_ANY}; /* client (our) address */ struct ifnet *nd_nic = NULL; -static int nd_force_crash=0; static int nd_polls=10000; /* Times to poll the NIC (0.5ms each poll) before * assuming packetloss occurred: 5s by default */ static int nd_retries=10; /* Times to retransmit lost packets */ @@ -292,16 +293,18 @@ sysctl_nic(SYSCTL_HANDLER_ARGS) return error; } +#ifdef NETDUMP_DEBUG static int sysctl_force_crash(SYSCTL_HANDLER_ARGS) { - int error; + int error, force_crash; - error = sysctl_handle_int(oidp, &nd_force_crash, nd_force_crash, req); + force_crash = 0; + error = sysctl_handle_int(oidp, &force_crash, force_crash, req); if (error || req->newptr == NULL) return error; - switch (nd_force_crash) { + switch (force_crash) { case 1: printf("\nLivelocking system...\n"); for (;;); @@ -329,6 +332,7 @@ sysctl_force_crash(SYSCTL_HANDLER_ARGS) } return 0; } +#endif SYSCTL_NODE(_net, OID_AUTO, dump, CTLFLAG_RW, 0, "netdump"); SYSCTL_PROC(_net_dump, OID_AUTO, server, CTLTYPE_STRING|CTLFLAG_RW, &nd_server, @@ -337,8 +341,6 @@ SYSCTL_PROC(_net_dump, OID_AUTO, client, 0, sysctl_ip, "A", "dump client"); SYSCTL_PROC(_net_dump, OID_AUTO, nic, CTLTYPE_STRING|CTLFLAG_RW, &nd_nic, IFNAMSIZ, sysctl_nic, "A", "NIC to dump on"); -SYSCTL_PROC(_net_dump, OID_AUTO, crash, CTLTYPE_INT|CTLFLAG_RW, - 0, sizeof(nd_force_crash), sysctl_force_crash, "I", "force crashing"); SYSCTL_INT(_net_dump, OID_AUTO, polls, CTLTYPE_INT|CTLFLAG_RW, &nd_polls, 0, "times to poll NIC per retry"); SYSCTL_INT(_net_dump, OID_AUTO, retries, CTLTYPE_INT|CTLFLAG_RW, &nd_retries, 0, @@ -346,6 +348,10 @@ SYSCTL_INT(_net_dump, OID_AUTO, retries, SYSCTL_INT(_net_dump, OID_AUTO, enable, CTLTYPE_INT|CTLFLAG_RW, &nd_enable, 0, "enable network dump"); TUNABLE_INT("net.dump.enable", &nd_enable); +#ifdef NETDUMP_DEBUG +SYSCTL_PROC(_net_dump, OID_AUTO, crash, CTLTYPE_INT|CTLFLAG_RW, 0, sizeof(int), + sysctl_force_crash, "I", "force crashing"); +#endif /*- * Network specific primitives. From owner-svn-src-projects@FreeBSD.ORG Sun Aug 8 16:17:29 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9C509106566C; Sun, 8 Aug 2010 16:17:29 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-qw0-f54.google.com (mail-qw0-f54.google.com [209.85.216.54]) by mx1.freebsd.org (Postfix) with ESMTP id 337E28FC17; Sun, 8 Aug 2010 16:17:28 +0000 (UTC) Received: by qwg5 with SMTP id 5so5409291qwg.13 for ; Sun, 08 Aug 2010 09:17:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=A4QowHHRhZ/RQo4fJKugp1+SmrYtATCFiVD5Ijg6lOg=; b=w2FGF/AzW6i0NjVzovGiARLrvutD4QwRXNvHUUsPNCOWN9Fb5A+aW/do/dczkSH4kt ynooyx6sSy4bhxq+OR/fgpepViBosytvpR7z0LQXkwqxo9vW7FpVX4tTP75Oyxocz/xj ZKEl8hmqD4DPxw/n3PgWyfTC6B+Tz0d9NBk7g= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=CKPqKhQoreNd+dAe1VUta+X49I1pYuO9HnO5mJHYwaSyrdjQsEhng9ckOe/RFRP8ZA gnabdtyM7IkJ58RRVaAjn1MPPXNt60/Xa9vHGmp7ZFxCmvPg0dIfnehlJwIKaZ77GRbR G/maJ/ofM0WrRinHFgvudEuC8S74Vk6oTUnzQ= MIME-Version: 1.0 Received: by 10.224.115.79 with SMTP id h15mr7803861qaq.21.1281284248212; Sun, 08 Aug 2010 09:17:28 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.229.251.6 with HTTP; Sun, 8 Aug 2010 09:17:28 -0700 (PDT) In-Reply-To: <20100808161342.GF22295@deviant.kiev.zoral.com.ua> References: <201008081544.o78FihwX008357@svn.freebsd.org> <20100808161342.GF22295@deviant.kiev.zoral.com.ua> Date: Sun, 8 Aug 2010 18:17:28 +0200 X-Google-Sender-Auth: UgFK72Lte0di5_ruZXQoEehljes Message-ID: From: Attilio Rao To: Kostik Belousov Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-projects@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r211076 - projects/sv/sys/net X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Aug 2010 16:17:29 -0000 Yes, I'm still considering more options for it, like usage of fail(9) as suggested by emaste. Thanks, Attilio 2010/8/8 Kostik Belousov : > On Sun, Aug 08, 2010 at 03:44:43PM +0000, Attilio Rao wrote: >> Author: attilio >> Date: Sun Aug =C2=A08 15:44:43 2010 >> New Revision: 211076 >> URL: http://svn.freebsd.org/changeset/base/211076 >> >> Log: >> =C2=A0 - Compile netdump.debug.force just when NETDUMP_DEBUG in included >> =C2=A0 - Fix the usage of nd_force_crash which is not necessarilly to ha= ve >> =C2=A0 =C2=A0 a static storage >> >> Modified: >> =C2=A0 projects/sv/sys/net/netdump_client.c >> >> Modified: projects/sv/sys/net/netdump_client.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- projects/sv/sys/net/netdump_client.c =C2=A0 =C2=A0 =C2=A0Sun Aug =C2= =A08 15:35:17 2010 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r211075) >> +++ projects/sv/sys/net/netdump_client.c =C2=A0 =C2=A0 =C2=A0Sun Aug =C2= =A08 15:44:43 2010 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r211076) >> @@ -146,7 +146,9 @@ static int =C2=A0 =C2=A0 =C2=A0 =C2=A0 netdump_send_= arp(void); >> =C2=A0static void =C2=A0 netdump_trigger(void *arg, int howto); >> =C2=A0static int =C2=A0 =C2=A0netdump_udp_output(struct mbuf *m); >> >> +#ifdef NETDUMP_DEBUG >> =C2=A0static int =C2=A0 =C2=A0sysctl_force_crash(SYSCTL_HANDLER_ARGS); >> +#endif >> =C2=A0static int =C2=A0 =C2=A0sysctl_ip(SYSCTL_HANDLER_ARGS); >> =C2=A0static int =C2=A0 =C2=A0sysctl_nic(SYSCTL_HANDLER_ARGS); >> >> @@ -166,7 +168,6 @@ static int nd_enable =3D 0; =C2=A0/* if we shou >> =C2=A0static struct in_addr nd_server =3D {INADDR_ANY}; /* server addres= s */ >> =C2=A0static struct in_addr nd_client =3D {INADDR_ANY}; /* client (our) = address */ >> =C2=A0struct ifnet *nd_nic =3D NULL; >> -static int nd_force_crash=3D0; >> =C2=A0static int nd_polls=3D10000; /* Times to poll the NIC (0.5ms each = poll) before >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 * assuming packetloss occurred: 5s by default */ >> =C2=A0static int nd_retries=3D10; /* Times to retransmit lost packets */ >> @@ -292,16 +293,18 @@ sysctl_nic(SYSCTL_HANDLER_ARGS) >> =C2=A0 =C2=A0 =C2=A0 return error; >> =C2=A0} >> >> +#ifdef NETDUMP_DEBUG >> =C2=A0static int >> =C2=A0sysctl_force_crash(SYSCTL_HANDLER_ARGS) >> =C2=A0{ >> - =C2=A0 =C2=A0 int error; >> + =C2=A0 =C2=A0 int error, force_crash; >> >> - =C2=A0 =C2=A0 error =3D sysctl_handle_int(oidp, &nd_force_crash, nd_fo= rce_crash, req); >> + =C2=A0 =C2=A0 force_crash =3D 0; >> + =C2=A0 =C2=A0 error =3D sysctl_handle_int(oidp, &force_crash, force_cr= ash, req); >> =C2=A0 =C2=A0 =C2=A0 if (error || req->newptr =3D=3D NULL) >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return error; >> >> - =C2=A0 =C2=A0 switch (nd_force_crash) { >> + =C2=A0 =C2=A0 switch (force_crash) { >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 case 1: >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 printf("\nLivelocking system...\n"); >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 for (;;); >> @@ -329,6 +332,7 @@ sysctl_force_crash(SYSCTL_HANDLER_ARGS) >> =C2=A0 =C2=A0 =C2=A0 } >> =C2=A0 =C2=A0 =C2=A0 return 0; >> =C2=A0} >> +#endif >> >> =C2=A0SYSCTL_NODE(_net, OID_AUTO, dump, CTLFLAG_RW, 0, "netdump"); >> =C2=A0SYSCTL_PROC(_net_dump, OID_AUTO, server, CTLTYPE_STRING|CTLFLAG_RW= , &nd_server, >> @@ -337,8 +341,6 @@ SYSCTL_PROC(_net_dump, OID_AUTO, client, >> =C2=A0 =C2=A0 =C2=A0 0, sysctl_ip, "A", "dump client"); >> =C2=A0SYSCTL_PROC(_net_dump, OID_AUTO, nic, CTLTYPE_STRING|CTLFLAG_RW, &= nd_nic, >> =C2=A0 =C2=A0 =C2=A0 IFNAMSIZ, sysctl_nic, "A", "NIC to dump on"); >> -SYSCTL_PROC(_net_dump, OID_AUTO, crash, CTLTYPE_INT|CTLFLAG_RW, >> - =C2=A0 =C2=A0 0, sizeof(nd_force_crash), sysctl_force_crash, "I", "for= ce crashing"); >> =C2=A0SYSCTL_INT(_net_dump, OID_AUTO, polls, CTLTYPE_INT|CTLFLAG_RW, &nd= _polls, 0, >> =C2=A0 =C2=A0 =C2=A0 "times to poll NIC per retry"); >> =C2=A0SYSCTL_INT(_net_dump, OID_AUTO, retries, CTLTYPE_INT|CTLFLAG_RW, &= nd_retries, 0, >> @@ -346,6 +348,10 @@ SYSCTL_INT(_net_dump, OID_AUTO, retries, >> =C2=A0SYSCTL_INT(_net_dump, OID_AUTO, enable, CTLTYPE_INT|CTLFLAG_RW, &n= d_enable, >> =C2=A0 =C2=A0 =C2=A0 0, "enable network dump"); >> =C2=A0TUNABLE_INT("net.dump.enable", &nd_enable); >> +#ifdef NETDUMP_DEBUG >> +SYSCTL_PROC(_net_dump, OID_AUTO, crash, CTLTYPE_INT|CTLFLAG_RW, 0, size= of(int), >> + =C2=A0 =C2=A0sysctl_force_crash, "I", "force crashing"); >> +#endif > > We have debug.kdb.panic and friends. Might be, it makes sense to move > net.dump.crash there ? debug. looks as a more logical choice for most > sysctls too. > --=20 Peace can only be achieved by understanding - A. Einstein From owner-svn-src-projects@FreeBSD.ORG Sun Aug 8 16:41:24 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 287041065677 for ; Sun, 8 Aug 2010 16:41:24 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id B5CA38FC1A for ; Sun, 8 Aug 2010 16:41:23 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id o78GDh90068531 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 8 Aug 2010 19:13:43 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4) with ESMTP id o78GDhF2053256; Sun, 8 Aug 2010 19:13:43 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id o78GDg21053255; Sun, 8 Aug 2010 19:13:42 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 8 Aug 2010 19:13:42 +0300 From: Kostik Belousov To: Attilio Rao Message-ID: <20100808161342.GF22295@deviant.kiev.zoral.com.ua> References: <201008081544.o78FihwX008357@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="LOZHMhvLB6lqiwkv" Content-Disposition: inline In-Reply-To: <201008081544.o78FihwX008357@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-2.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_40, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: svn-src-projects@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r211076 - projects/sv/sys/net X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Aug 2010 16:41:24 -0000 --LOZHMhvLB6lqiwkv Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Aug 08, 2010 at 03:44:43PM +0000, Attilio Rao wrote: > Author: attilio > Date: Sun Aug 8 15:44:43 2010 > New Revision: 211076 > URL: http://svn.freebsd.org/changeset/base/211076 >=20 > Log: > - Compile netdump.debug.force just when NETDUMP_DEBUG in included > - Fix the usage of nd_force_crash which is not necessarilly to have > a static storage >=20 > Modified: > projects/sv/sys/net/netdump_client.c >=20 > Modified: projects/sv/sys/net/netdump_client.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- projects/sv/sys/net/netdump_client.c Sun Aug 8 15:35:17 2010 (r21107= 5) > +++ projects/sv/sys/net/netdump_client.c Sun Aug 8 15:44:43 2010 (r21107= 6) > @@ -146,7 +146,9 @@ static int netdump_send_arp(void); > static void netdump_trigger(void *arg, int howto); > static int netdump_udp_output(struct mbuf *m); > =20 > +#ifdef NETDUMP_DEBUG > static int sysctl_force_crash(SYSCTL_HANDLER_ARGS); > +#endif > static int sysctl_ip(SYSCTL_HANDLER_ARGS); > static int sysctl_nic(SYSCTL_HANDLER_ARGS); > =20 > @@ -166,7 +168,6 @@ static int nd_enable =3D 0; /* if we shou > static struct in_addr nd_server =3D {INADDR_ANY}; /* server address */ > static struct in_addr nd_client =3D {INADDR_ANY}; /* client (our) addres= s */ > struct ifnet *nd_nic =3D NULL; > -static int nd_force_crash=3D0; > static int nd_polls=3D10000; /* Times to poll the NIC (0.5ms each poll) = before > * assuming packetloss occurred: 5s by default */ > static int nd_retries=3D10; /* Times to retransmit lost packets */ > @@ -292,16 +293,18 @@ sysctl_nic(SYSCTL_HANDLER_ARGS) > return error; > } > =20 > +#ifdef NETDUMP_DEBUG > static int > sysctl_force_crash(SYSCTL_HANDLER_ARGS)=20 > { > - int error; > + int error, force_crash; > =20 > - error =3D sysctl_handle_int(oidp, &nd_force_crash, nd_force_crash, req); > + force_crash =3D 0; > + error =3D sysctl_handle_int(oidp, &force_crash, force_crash, req); > if (error || req->newptr =3D=3D NULL) > return error; > =20 > - switch (nd_force_crash) { > + switch (force_crash) { > case 1: > printf("\nLivelocking system...\n"); > for (;;); > @@ -329,6 +332,7 @@ sysctl_force_crash(SYSCTL_HANDLER_ARGS)=20 > } > return 0; > } > +#endif > =20 > SYSCTL_NODE(_net, OID_AUTO, dump, CTLFLAG_RW, 0, "netdump"); > SYSCTL_PROC(_net_dump, OID_AUTO, server, CTLTYPE_STRING|CTLFLAG_RW, &nd_= server, > @@ -337,8 +341,6 @@ SYSCTL_PROC(_net_dump, OID_AUTO, client, > 0, sysctl_ip, "A", "dump client"); > SYSCTL_PROC(_net_dump, OID_AUTO, nic, CTLTYPE_STRING|CTLFLAG_RW, &nd_nic, > IFNAMSIZ, sysctl_nic, "A", "NIC to dump on"); > -SYSCTL_PROC(_net_dump, OID_AUTO, crash, CTLTYPE_INT|CTLFLAG_RW, > - 0, sizeof(nd_force_crash), sysctl_force_crash, "I", "force crashing"); > SYSCTL_INT(_net_dump, OID_AUTO, polls, CTLTYPE_INT|CTLFLAG_RW, &nd_polls= , 0, > "times to poll NIC per retry"); > SYSCTL_INT(_net_dump, OID_AUTO, retries, CTLTYPE_INT|CTLFLAG_RW, &nd_ret= ries, 0, > @@ -346,6 +348,10 @@ SYSCTL_INT(_net_dump, OID_AUTO, retries, > SYSCTL_INT(_net_dump, OID_AUTO, enable, CTLTYPE_INT|CTLFLAG_RW, &nd_enab= le, > 0, "enable network dump"); > TUNABLE_INT("net.dump.enable", &nd_enable); > +#ifdef NETDUMP_DEBUG > +SYSCTL_PROC(_net_dump, OID_AUTO, crash, CTLTYPE_INT|CTLFLAG_RW, 0, sizeo= f(int), > + sysctl_force_crash, "I", "force crashing"); > +#endif We have debug.kdb.panic and friends. Might be, it makes sense to move net.dump.crash there ? debug. looks as a more logical choice for most sysctls too. --LOZHMhvLB6lqiwkv Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAkxe17YACgkQC3+MBN1Mb4j08ACgr9G78ZnXJGBXIEhVgGSS8vS4 J/wAnii3ugkydHeJn5el85/vVOIlQ/XR =Lgyc -----END PGP SIGNATURE----- --LOZHMhvLB6lqiwkv-- From owner-svn-src-projects@FreeBSD.ORG Sun Aug 8 16:52:48 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 01881106564A; Sun, 8 Aug 2010 16:52:48 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E560C8FC0A; Sun, 8 Aug 2010 16:52:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o78Gql6u023417; Sun, 8 Aug 2010 16:52:47 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o78Gql5j023415; Sun, 8 Aug 2010 16:52:47 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201008081652.o78Gql5j023415@svn.freebsd.org> From: Attilio Rao Date: Sun, 8 Aug 2010 16:52:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211078 - projects/sv/sys/net X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Aug 2010 16:52:48 -0000 Author: attilio Date: Sun Aug 8 16:52:47 2010 New Revision: 211078 URL: http://svn.freebsd.org/changeset/base/211078 Log: Move the crash OID under debug.netdump.crash Suggested by: kib Modified: projects/sv/sys/net/netdump_client.c Modified: projects/sv/sys/net/netdump_client.c ============================================================================== --- projects/sv/sys/net/netdump_client.c Sun Aug 8 16:20:32 2010 (r211077) +++ projects/sv/sys/net/netdump_client.c Sun Aug 8 16:52:47 2010 (r211078) @@ -349,8 +349,9 @@ SYSCTL_INT(_net_dump, OID_AUTO, enable, 0, "enable network dump"); TUNABLE_INT("net.dump.enable", &nd_enable); #ifdef NETDUMP_DEBUG -SYSCTL_PROC(_net_dump, OID_AUTO, crash, CTLTYPE_INT|CTLFLAG_RW, 0, sizeof(int), - sysctl_force_crash, "I", "force crashing"); +SYSCTL_DECL(_debug_netdump); +SYSCTL_PROC(_debug_netdump, OID_AUTO, crash, CTLTYPE_INT|CTLFLAG_RW, 0, + sizeof(int), sysctl_force_crash, "I", "force crashing"); #endif /*- From owner-svn-src-projects@FreeBSD.ORG Mon Aug 9 21:43:37 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 344B41065677; Mon, 9 Aug 2010 21:43:37 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0952E8FC0C; Mon, 9 Aug 2010 21:43:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o79Lhalo014943; Mon, 9 Aug 2010 21:43:36 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o79LhanM014942; Mon, 9 Aug 2010 21:43:36 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201008092143.o79LhanM014942@svn.freebsd.org> From: Attilio Rao Date: Mon, 9 Aug 2010 21:43:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211118 - in projects/sv/sys: net netinet X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Aug 2010 21:43:37 -0000 Author: attilio Date: Mon Aug 9 21:43:36 2010 New Revision: 211118 URL: http://svn.freebsd.org/changeset/base/211118 Log: Move the netdump.h header into netinet part. Added: projects/sv/sys/netinet/netdump.h - copied unchanged from r210845, projects/sv/sys/net/netdump.h Deleted: projects/sv/sys/net/netdump.h Copied: projects/sv/sys/netinet/netdump.h (from r210845, projects/sv/sys/net/netdump.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/sv/sys/netinet/netdump.h Mon Aug 9 21:43:36 2010 (r211118, copy of r210845, projects/sv/sys/net/netdump.h) @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2005-2006 Sandvine Incorporated. All rights reserved. + * - Modified by Adrian Dewhurst to work with FreeBSD 5.2, send a dump header, + * and improve performance. + * + * Copyright (c) 2000 Darrell Anderson + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef __NETDUMP_H +#define __NETDUMP_H + +#ifdef _KERNEL + +struct mtx; + +struct netdump_methods { + void (*test_get_lock)(struct ifnet *); + int (*break_lock)(struct ifnet *, int *, uint8_t *, u_int); + void (*release_lock)(struct ifnet *); + int (*poll_locked)(struct ifnet *, enum poll_cmd, int); +}; + +int netdump_break_lock(struct mtx *lock, const char *name, + int *broke_lock, uint8_t *broken_state, u_int index, + u_int bstatesz); + +#endif + +#endif /* __NETDUMP_H */ From owner-svn-src-projects@FreeBSD.ORG Mon Aug 9 21:45:05 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 99713106564A; Mon, 9 Aug 2010 21:45:05 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 896E28FC20; Mon, 9 Aug 2010 21:45:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o79Lj5C3015334; Mon, 9 Aug 2010 21:45:05 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o79Lj55I015332; Mon, 9 Aug 2010 21:45:05 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201008092145.o79Lj55I015332@svn.freebsd.org> From: Attilio Rao Date: Mon, 9 Aug 2010 21:45:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211119 - projects/sv/sys/netinet X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Aug 2010 21:45:05 -0000 Author: attilio Date: Mon Aug 9 21:45:05 2010 New Revision: 211119 URL: http://svn.freebsd.org/changeset/base/211119 Log: Use the correct header markers. Modified: projects/sv/sys/netinet/netdump.h Modified: projects/sv/sys/netinet/netdump.h ============================================================================== --- projects/sv/sys/netinet/netdump.h Mon Aug 9 21:43:36 2010 (r211118) +++ projects/sv/sys/netinet/netdump.h Mon Aug 9 21:45:05 2010 (r211119) @@ -28,8 +28,8 @@ * SUCH DAMAGE. */ -#ifndef __NETDUMP_H -#define __NETDUMP_H +#ifndef _NETINET_NETDUMP_H_ +#define _NETINET_NETDUMP_H_ #ifdef _KERNEL @@ -48,4 +48,4 @@ int netdump_break_lock(struct mtx *lock #endif -#endif /* __NETDUMP_H */ +#endif /* _NETINET_NETDUMP_H_ */ From owner-svn-src-projects@FreeBSD.ORG Mon Aug 9 22:19:23 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E800B1065677; Mon, 9 Aug 2010 22:19:22 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CC1278FC15; Mon, 9 Aug 2010 22:19:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o79MJM4u023101; Mon, 9 Aug 2010 22:19:22 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o79MJMTq023098; Mon, 9 Aug 2010 22:19:22 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201008092219.o79MJMTq023098@svn.freebsd.org> From: Attilio Rao Date: Mon, 9 Aug 2010 22:19:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211121 - in projects/sv/sys: net netinet X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Aug 2010 22:19:23 -0000 Author: attilio Date: Mon Aug 9 22:19:22 2010 New Revision: 211121 URL: http://svn.freebsd.org/changeset/base/211121 Log: Export some informations because they will be used by the userland server application. Also do some BSDification (using the right s/u_/u for bits types and moving the payload of the msg to be using uint8_t). Modified: projects/sv/sys/net/netdump_client.c projects/sv/sys/netinet/netdump.h Modified: projects/sv/sys/net/netdump_client.c ============================================================================== --- projects/sv/sys/net/netdump_client.c Mon Aug 9 22:06:08 2010 (r211120) +++ projects/sv/sys/net/netdump_client.c Mon Aug 9 22:19:22 2010 (r211121) @@ -99,35 +99,8 @@ #define NETDDEBUGV_IF(i, f, ...) #endif -#define NETDUMP_PORT 20023 /* server udp port number for data */ -#define NETDUMP_ACKPORT 20024 /* client udp port number for acks */ - -#define NETDUMP_DATASIZE 8192 /* how big to let the packets be */ - -#define NETDUMP_HERALD 1 /* broadcast before starting a dump */ -#define NETDUMP_FINISHED 2 /* send after finishing a dump */ -#define NETDUMP_VMCORE 3 /* packet contains dump data */ -#define NETDUMP_KDH 4 /* packet contains kernel dump header */ - #define NETDUMP_BROKEN_STATE_BUFFER_SIZE (5 * sizeof(struct mtx)) -struct netdump_msg_hdr { - u_int32_t type; /* NETDUMP_HERALD, _FINISHED, _VMCORE or _KDH */ - u_int32_t seqno; /* match acks with msgs */ - u_int64_t offset; /* vmcore offset, in bytes */ - u_int32_t len; /* attached data, in bytes */ - u_int8_t pad[4]; /* Pad for parifying 32 and 64 bits */ -}; - -struct netdump_msg { - struct netdump_msg_hdr hdr; - unsigned char data[NETDUMP_DATASIZE];/* real message may contain less */ -}; - -struct netdump_ack { - u_int32_t seqno; /* match acks with msgs */ -}; - static void nd_handle_arp(struct mbuf **mb); static void nd_handle_ip(struct mbuf **mb); static int netdump_arp_server(void); Modified: projects/sv/sys/netinet/netdump.h ============================================================================== --- projects/sv/sys/netinet/netdump.h Mon Aug 9 22:06:08 2010 (r211120) +++ projects/sv/sys/netinet/netdump.h Mon Aug 9 22:19:22 2010 (r211121) @@ -31,6 +31,33 @@ #ifndef _NETINET_NETDUMP_H_ #define _NETINET_NETDUMP_H_ +#define NETDUMP_PORT 20023 /* Server udp port number for data. */ +#define NETDUMP_ACKPORT 20024 /* Client udp port number for acks. */ + +#define NETDUMP_HERALD 1 /* Broadcast before starting a dump. */ +#define NETDUMP_FINISHED 2 /* Send after finishing a dump. */ +#define NETDUMP_VMCORE 3 /* Contains dump datas. */ +#define NETDUMP_KDH 4 /* Contains kernel dump header. */ + +#define NETDUMP_DATASIZE 8192 /* Packets payload. */ + +struct netdump_msg_hdr { + uint32_t type; /* NETDUMP_HERALD, _FINISHED, _VMCORE, _KDH. */ + uint32_t seqno; /* Match acks with msgs. */ + uint64_t offset; /* vmcore offset (bytes). */ + uint32_t len; /* Attached data (bytes). */ + uint8_t pad[4]; /* Pad for parifying 32 and 64 bits. */ +}; + +struct netdump_ack { + uint32_t seqno; /* Match acks with msgs. */ +}; + +struct netdump_msg { + struct netdump_msg_hdr hdr; + uint8_t data[NETDUMP_DATASIZE]; +}; + #ifdef _KERNEL struct mtx; From owner-svn-src-projects@FreeBSD.ORG Mon Aug 9 22:22:06 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 59A841065675; Mon, 9 Aug 2010 22:22:06 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 498C78FC1F; Mon, 9 Aug 2010 22:22:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o79MM6Wr023765; Mon, 9 Aug 2010 22:22:06 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o79MM6Jx023763; Mon, 9 Aug 2010 22:22:06 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201008092222.o79MM6Jx023763@svn.freebsd.org> From: Attilio Rao Date: Mon, 9 Aug 2010 22:22:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211122 - projects/sv/sys/netinet X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Aug 2010 22:22:06 -0000 Author: attilio Date: Mon Aug 9 22:22:06 2010 New Revision: 211122 URL: http://svn.freebsd.org/changeset/base/211122 Log: As long as this header can be included from userland, include sys/types.h in order to avoid further inclusion from there. Modified: projects/sv/sys/netinet/netdump.h Modified: projects/sv/sys/netinet/netdump.h ============================================================================== --- projects/sv/sys/netinet/netdump.h Mon Aug 9 22:19:22 2010 (r211121) +++ projects/sv/sys/netinet/netdump.h Mon Aug 9 22:22:06 2010 (r211122) @@ -31,6 +31,8 @@ #ifndef _NETINET_NETDUMP_H_ #define _NETINET_NETDUMP_H_ +#include + #define NETDUMP_PORT 20023 /* Server udp port number for data. */ #define NETDUMP_ACKPORT 20024 /* Client udp port number for acks. */ From owner-svn-src-projects@FreeBSD.ORG Mon Aug 9 22:29:31 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B8935106564A; Mon, 9 Aug 2010 22:29:31 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A65788FC13; Mon, 9 Aug 2010 22:29:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o79MTV3L025510; Mon, 9 Aug 2010 22:29:31 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o79MTVvn025508; Mon, 9 Aug 2010 22:29:31 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201008092229.o79MTVvn025508@svn.freebsd.org> From: Attilio Rao Date: Mon, 9 Aug 2010 22:29:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211124 - projects/sv/usr.sbin/netdumpsrv X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Aug 2010 22:29:31 -0000 Author: attilio Date: Mon Aug 9 22:29:31 2010 New Revision: 211124 URL: http://svn.freebsd.org/changeset/base/211124 Log: Add the server implementation of netdumps. Added: projects/sv/usr.sbin/netdumpsrv/ projects/sv/usr.sbin/netdumpsrv/netdump_server.c (contents, props changed) Added: projects/sv/usr.sbin/netdumpsrv/netdump_server.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/sv/usr.sbin/netdumpsrv/netdump_server.c Mon Aug 9 22:29:31 2010 (r211124) @@ -0,0 +1,887 @@ +/*- + * Copyright (c) 2005-2006 Sandvine Incorporated. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* How many dumps to allow per IP before they need to be cleaned out */ +#define MAX_DUMPS 256 +/* Clients time out after two minutes */ +#define CLIENT_TIMEOUT 120 +/* Host name length (keep at least as big as INET_ADDRSTRLEN) */ +#define MAXHOSTNAMELEN 256 + +struct netdump_client +{ + char infofilename[MAXPATHLEN]; + char corefilename[MAXPATHLEN]; + char hostname[MAXHOSTNAMELEN]; + struct in_addr ip; + FILE *infofile; + int corefd; + int sock; + time_t last_msg; + unsigned int printed_port_warning : 1; + unsigned int any_data_rcvd : 1; + + struct netdump_client *next; +}; + +struct netdump_client *clients; +char dumpdir[MAXPATHLEN]; +char *handler_script=NULL; +time_t now; +int do_shutdown; +struct in_addr bindip; +struct pidfh *pfh; +int sock; + +char * client_ipstr(struct netdump_client *client) +{ + return addr2ascii(AF_INET, &client->ip, sizeof(client->ip), NULL); +} + +struct netdump_client * alloc_client(struct in_addr *ip) +{ + struct sockaddr_in saddr; + struct netdump_client *client; + struct hostent *hp; + int i, fd, bufsz; + + client = malloc(sizeof(*client)); + if (!client) + { + perror("malloc"); + return NULL; + } + bzero(client, sizeof(*client)); + bcopy(ip, &client->ip, sizeof(*ip)); + client->corefd = -1; + client->sock = -1; + client->last_msg = now; + + /* Get the hostname */ + if ((hp = gethostbyaddr((const char *)ip, sizeof(*ip), AF_INET)) == NULL || + !hp->h_name || strlen(hp->h_name) == 0) + { + /* Can't resolve; use IP */ + addr2ascii(AF_INET, ip, sizeof(*ip), client->hostname); + } + else + { + char *firstdot; + + /* Grab the hostname */ + strncpy(client->hostname, hp->h_name, MAXHOSTNAMELEN); + hp->h_name[MAXHOSTNAMELEN-1]='\0'; + + /* Strip off the domain name */ + firstdot = strchr(client->hostname, '.'); + if (firstdot) + { + *firstdot='\0'; + } + } + + /* Set up the client socket */ + if ((client->sock = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1) + { + perror("socket"); + free(client); + return NULL; + } + if (fcntl(client->sock, F_SETFL, O_NONBLOCK) == -1) { + perror("fcntl(client->sock, F_SETFL, O_NONBLOCK)"); + close(client->sock); + free(client); + return NULL; + } + bzero(&saddr, sizeof(saddr)); + saddr.sin_len = sizeof(saddr); + saddr.sin_family = AF_INET; + saddr.sin_addr.s_addr = bindip.s_addr; + saddr.sin_port = htons(0); + if (bind(client->sock, (struct sockaddr *)&saddr, sizeof(saddr))) { + perror("bind"); + close(client->sock); + free(client); + return NULL; + } + bzero(&saddr, sizeof(saddr)); + saddr.sin_len = sizeof(saddr); + saddr.sin_family = AF_INET; + saddr.sin_addr.s_addr = ip->s_addr; + saddr.sin_port = htons(NETDUMP_ACKPORT); + if (connect(client->sock, (struct sockaddr *)&saddr, sizeof(saddr))) { + perror("connect"); + close(client->sock); + free(client); + return NULL; + } + bufsz=131072; /* Enough to hold approx twice the chunk size. Should be + * plenty for any 1 client. */ + if (setsockopt(client->sock, SOL_SOCKET, SO_RCVBUF, &bufsz, sizeof(bufsz))) + { + perror("setsockopt(SOL_SOCKET, SO_RCVBUF)"); + fprintf(stderr, "Warning: May drop packets from %s due to small receive" + " buffer\n", client->hostname); + } + + /* Try info.host.0 through info.host.255 in sequence */ + for (i=0; i < MAX_DUMPS; i++) + { + snprintf(client->infofilename, sizeof(client->infofilename), + "%s/info.%s.%d", dumpdir, client->hostname, i); + snprintf(client->corefilename, sizeof(client->corefilename), + "%s/vmcore.%s.%d", dumpdir, client->hostname, i); + + /* Try the info file first */ + if ((fd = open(client->infofilename, O_WRONLY|O_CREAT|O_EXCL, + DEFFILEMODE)) == -1) + { + if (errno == EEXIST) + { + continue; + } + + fprintf(stderr, "open(\"%s\"): %s\n", client->infofilename, + strerror(errno)); + continue; + } + if (!(client->infofile = fdopen(fd, "w"))) + { + perror("fdopen"); + close(fd); + unlink(client->infofilename); + continue; + } + + /* Next make the core file */ + if ((fd = open(client->corefilename, O_RDWR|O_CREAT|O_EXCL, + DEFFILEMODE)) == -1) + { + /* Failed. Keep the numbers in sync. */ + fclose(client->infofile); + unlink(client->infofilename); + client->infofile = NULL; + + if (errno == EEXIST) + { + continue; + } + + fprintf(stderr, "open(\"%s\"): %s\n", client->corefilename, + strerror(errno)); + continue; + } + client->corefd = fd; + break; + } + + if (!client->infofile || client->corefd == -1) + { + fprintf(stderr, "Can't create output files for new client %s [%s]\n", + client->hostname, client_ipstr(client)); + if (client->infofile) + { + fclose(client->infofile); + } + if (client->corefd != -1) + { + close(client->corefd); + } + if (client->sock != -1) + { + close(client->sock); + } + free(client); + return NULL; + } + + client->next = clients; + clients = client; + return client; +} + +void free_client(struct netdump_client *client) +{ + /* Remove from the list */ + if (clients == client) + { + clients = client->next; + } + else + { + struct netdump_client *parent; + for (parent=clients; parent; parent = parent->next) + { + if (parent->next == client) + { + break; + } + } + parent->next = client->next; + } + + fclose(client->infofile); + close(client->corefd); + close(client->sock); + free(client); +} + +void exec_handler(struct netdump_client *client, const char *reason) +{ + int pid=fork(); + + if (pid == -1) + { + perror("fork"); + return; + } + else if (pid) + { + return; + } + else + { + close(sock); + pidfile_close(pfh); + execl(handler_script, handler_script, reason, client_ipstr(client), + client->hostname, client->infofilename, client->corefilename, + NULL); + perror("execl"); + _exit(1); + } +} + +void handle_timeout(struct netdump_client *client) +{ + printf("Client %s timed out\n", client_ipstr(client)); + fputs("Dump incomplete: client timed out\n", client->infofile); + exec_handler(client, "timeout"); + free_client(client); +} + +void timeout_clients() +{ + static time_t last_timeout_check; + struct netdump_client **node; + + /* Only time out clients every 10 seconds */ + if (now - last_timeout_check < 10) + { + return; + } + + last_timeout_check = now; + + /* Traverse the list looking for stale clients */ + for (node=&clients; *node; node = &(*node)->next) + { + while (*node && (*node)->last_msg+CLIENT_TIMEOUT < now) + { + handle_timeout(*node); + } + + if (*node == NULL) + { + break; + } + } +} + +void send_ack(struct netdump_client *client, struct netdump_msg *msg) +{ + struct netdump_ack ack; + int tryagain; + + bzero(&ack, sizeof(ack)); + ack.seqno = htonl(msg->hdr.seqno); + + do + { + tryagain=0; + + if (send(client->sock, &ack, sizeof(ack), 0) == -1) + { + if (errno == EINTR) + { + tryagain=1; + continue; + } + + /* XXX: On EAGAIN, we should probably queue the packet to be sent + * when the socket is writable... but that's too much effort, since + * it's mostly harmless to wait for the client to retransmit. */ + perror("sendto"); + } + } + while (tryagain); +} + +int handle_herald(struct sockaddr_in *from, struct netdump_client *client, + struct netdump_msg *msg) +{ + int freed_client=0; + + if (client) + { + if (!client->any_data_rcvd) + { + /* Must be a retransmit of the herald packet. */ + send_ack(client, msg); + return 0; + } + + /* An old connection must have timed out. Clean it up first */ + handle_timeout(client); + freed_client=1; + } + + client = alloc_client(&from->sin_addr); + + if (!client) + { + /* alloc_client would have printed an error message already */ + return freed_client; + } + + fprintf(client->infofile, "Dump from %s [%s]\n", client->hostname, + client_ipstr(client)); + + printf("New dump from client %s [%s] (to %s)\n", client->hostname, + client_ipstr(client), client->corefilename); + + send_ack(client, msg); + + return freed_client; +} + +int handle_kdh(struct netdump_client *client, struct netdump_msg *msg) +{ + struct kerneldumpheader *h=(void *)msg->data; + uint64_t dumplen; + FILE *f; + time_t t; + int parity_check; + + if (!client) + { + return 0; + } + + client->any_data_rcvd = 1; + + f = client->infofile; + + if (msg->hdr.len < sizeof(struct kerneldumpheader)) + { + fprintf(stderr, "Bad KDH from %s [%s]: packet too small\n", + client->hostname, client_ipstr(client)); + fputs("Bad KDH: packet too small\n", f); + fflush(f); + send_ack(client, msg); + + return 0; + } + + parity_check = kerneldump_parity(h); + + /* Make sure we null terminate all the strings */ + h->architecture[sizeof(h->architecture)-1] = '\0'; + h->hostname[sizeof(h->hostname)-1] = '\0'; + h->versionstring[sizeof(h->versionstring)-1] = '\0'; + h->panicstring[sizeof(h->panicstring)-1] = '\0'; + + fprintf(f, " Architecture: %s\n", h->architecture); + fprintf(f, " Architecture version: %d\n", dtoh32(h->architectureversion)); + dumplen = dtoh64(h->dumplength); + fprintf(f, " Dump length: %lldB (%lld MB)\n", (long long)dumplen, + (long long)(dumplen >> 20)); + fprintf(f, " Blocksize: %d\n", dtoh32(h->blocksize)); + t = dtoh64(h->dumptime); + fprintf(f, " Dumptime: %s", ctime(&t)); + fprintf(f, " Hostname: %s\n", h->hostname); + fprintf(f, " Versionstring: %s", h->versionstring); + fprintf(f, " Panicstring: %s\n", h->panicstring); + fprintf(f, " Header parity check: %s\n", parity_check ? "Fail" : "Pass"); + fflush(f); + + fprintf(stdout, "(KDH from %s [%s])", client->hostname, + client_ipstr(client)); + fflush(stdout); + + send_ack(client, msg); + + return 0; +} + +int handle_vmcore(struct netdump_client *client, struct netdump_msg *msg) +{ + if (!client) + { + return 0; + } + + client->any_data_rcvd = 1; + + if (msg->hdr.seqno % 11523 == 0) + { + /* Approximately every 16MB with MTU of 1500 */ + putc('.', stdout); + fflush(stdout); + } + + if (pwrite(client->corefd, msg->data, msg->hdr.len, msg->hdr.offset) == -1) + { + fprintf(stderr, "pwrite (for client %s [%s]): %s\n", client->hostname, + client_ipstr(client), strerror(errno)); + fprintf(client->infofile, "Dump unsuccessful: write error at offset %08"PRIx64": %s\n", + msg->hdr.offset, strerror(errno)); + exec_handler(client, "error"); + free_client(client); + return 1; + } + + send_ack(client, msg); + + return 0; +} + +int handle_finish(struct netdump_client *client, struct netdump_msg *msg) +{ + if (!client) + { + return 0; + } + + + printf("\nCompleted dump from client %s [%s]\n", client->hostname, + client_ipstr(client)); + fflush(stdout); + fputs("Dump complete\n", client->infofile); + + /* Do this before we free the client */ + send_ack(client, msg); + + exec_handler(client, "success"); + free_client(client); + + return 1; +} + + +int receive_message(int sock, struct sockaddr_in *from, char *fromstr, + size_t fromstrlen, struct netdump_msg *msg) +{ + socklen_t fromlen; + ssize_t len; + + bzero(from, sizeof(*from)); + from->sin_family = AF_INET; + from->sin_len = fromlen = sizeof(*from); + from->sin_port = 0; + from->sin_addr.s_addr = INADDR_ANY; + + if ((len = recvfrom(sock, msg, sizeof(*msg), 0, + (struct sockaddr *)from, &fromlen)) == -1) + { + /* The caller can use errno to find the error */ + return -1; + } + + snprintf(fromstr, fromstrlen, "%s:%hu", + addr2ascii(AF_INET, &from->sin_addr, sizeof(from->sin_addr), NULL), + ntohs(from->sin_port)); + + if ((size_t)len < sizeof(struct netdump_msg_hdr)) + { + fprintf(stderr, "Ignoring runt packet from %s (got %zu)\n", fromstr, + (size_t)len); + return 0; + } + + /* Convert byte order */ + msg->hdr.type = ntohl(msg->hdr.type); + msg->hdr.seqno = ntohl(msg->hdr.seqno); + msg->hdr.offset = ntohll(msg->hdr.offset); + msg->hdr.len = ntohl(msg->hdr.len); + + if ((size_t)len < sizeof(struct netdump_msg_hdr) + msg->hdr.len) + { + fprintf(stderr, "Packet too small from %s (got %zu, expected %zu)\n", + fromstr, (size_t)len, sizeof(struct netdump_msg_hdr) + msg->hdr.len); + return 0; + } + + return len; +} + +int handle_packet(struct netdump_client *client, struct sockaddr_in *from, + const char *fromstr, struct netdump_msg *msg) +{ + int freed_client; + + if (client) + { + client->last_msg = time(NULL); + } + + switch (msg->hdr.type) + { + case NETDUMP_HERALD: + freed_client = handle_herald(from, client, msg); + break; + case NETDUMP_KDH: + freed_client = handle_kdh(client, msg); + break; + case NETDUMP_VMCORE: + freed_client = handle_vmcore(client, msg); + break; + case NETDUMP_FINISHED: + freed_client = handle_finish(client, msg); + break; + default: + freed_client=0; + fprintf(stderr, "Received unknown message type %d from %s\n", + msg->hdr.type, fromstr); + } + + return freed_client; +} + +void eventloop() +{ + struct netdump_msg msg; + + while (!do_shutdown) + { + fd_set readfds; + int maxfd=sock+1; + struct netdump_client *client; + struct timeval tv; + struct sockaddr_in from; + char fromstr[INET_ADDRSTRLEN+6]; /* Long enough for IP+':'+port+'\0' */ + + FD_ZERO(&readfds); + FD_SET(sock, &readfds); + for (client=clients; client; client = client->next) + { + FD_SET(client->sock, &readfds); + if (maxfd <= client->sock) + { + maxfd = client->sock+1; + } + } + + /* So that we time out clients regularly */ + tv.tv_sec = 10; + tv.tv_usec = 0; + + if (select(maxfd, &readfds, NULL, NULL, &tv) == -1) + { + if (errno == EINTR) + { + continue; + } + + perror("select"); + /* Errors with select() probably won't go away if we just try to + * select() again */ + exit(1); + } + + now = time(NULL); + + if (FD_ISSET(sock, &readfds)) { + int len; + + len = receive_message(sock, &from, fromstr, sizeof(fromstr), &msg); + + if (len == -1) + { + if (errno == EINTR) + { + continue; + } + + if (errno != EAGAIN) + { + /* Server socket is broken for some reason */ + perror("recvfrom"); + exit(1); + } + } + else if (len == 0) + { + /* The packet was rejected (probably because it was too small). + * Just ignore it. */ + } + else + { + /* Check if they're on the clients list */ + for (client=clients; client; client = client->next) + { + if (client->ip.s_addr == from.sin_addr.s_addr) + { + break; + } + } + + /* Technically, clients shouldn't be responding on the server + * port, so client should be NULL, however, if they insist on + * doing so, it's not really going to hurt anything (except + * maybe fill up the server socket's receive buffer), so still + * accept it. The only possibly legitimate case is if there's + * a new dump starting and the previous one didn't finish + * cleanly. Handle this by suppressing the error on HERALD + * packets. + */ + if (client && msg.hdr.type != NETDUMP_HERALD && + !client->printed_port_warning) + { + printf("Warning: Client %s responding on server port\n", + client->hostname); + client->printed_port_warning = 1; + } + + handle_packet(client, &from, fromstr, &msg); + } + } + + for (client=clients; client; client = client->next) + { + if (FD_ISSET(client->sock, &readfds)) + { + int len = receive_message(client->sock, &from, fromstr, + sizeof(fromstr), &msg); + if (len == -1) + { + if (errno == EINTR || errno == EAGAIN) + { + continue; + } + + perror("recvfrom"); + /* Client socket is broken for some reason */ + handle_timeout(client); + /* The client pointer is now invalid */ + client = clients; + if (!client) + { + break; + } + } + else if (len == 0) + { + /* The packet was rejected (probably because it was too + * small). Just ignore it. */ + } + else + { + FD_CLR(client->sock, &readfds); + if (handle_packet(client, &from, fromstr, &msg)) + { + /* Client was freed; we have a stale pointer */ + client = clients; + if (!client) + { + break; + } + } + } + } + } + + timeout_clients(); + } + + puts("Shutting down..."); + /* Clients is the head of the list, so clients != NULL iff the list isn't + * empty. Call it a timeout so that the scripts get run. */ + while (clients) + { + handle_timeout(clients); + } +} + +void signal_shutdown(int sig) +{ + do_shutdown=1; +} + +int main(int argc, char **argv) +{ + struct stat statbuf; + struct sockaddr_in bindaddr; + struct sigaction sa; + + pfh = pidfile_open(NULL, 0600, NULL); + if (pfh == NULL) { + if (errno == EEXIST) + printf("Instance of netdump already running\n"); + else + printf("Impossible to open the pid file\n"); + exit(1); + } + pidfile_write(pfh); + + /* Check argc and set the bindaddr and handler_script */ + switch (argc) + { + case 4: + handler_script = strdup(argv[3]); + if (access(handler_script, F_OK|X_OK)) + { + pidfile_remove(pfh); + fputs("Warning: may be unable to execute handler script\n", + stderr); + free(handler_script); + return 1; + } + case 3: + if (ascii2addr(AF_INET, argv[2], &bindip) == -1) + { + pidfile_remove(pfh); + fputs("Invalid bind IP specified\n", stderr); + return 1; + } + printf("Listening on IP %s\n", + addr2ascii(AF_INET, &bindip, + sizeof(bindip), NULL)); + break; + case 2: + bindip.s_addr = INADDR_ANY; + puts("Listening on all interfaces"); + break; + default: + pidfile_remove(pfh); + fprintf(stderr, "Usage: %s " + "[bind IP [handler script]]\n", argv[0]); + return 1; + } + + /* Check dump location for sanity */ + if (stat(argv[1], &statbuf)) + { + pidfile_remove(pfh); + perror("stat"); + fputs("Invalid dump location specified\n", stderr); + return 1; + } + if ((statbuf.st_mode & S_IFMT) != S_IFDIR) + { + pidfile_remove(pfh); + fputs("Dump location is not a directory\n", stderr); + return 1; + } + if (access(argv[1], F_OK|W_OK)) + { + fprintf(stderr, "Warning: May be unable to write into dump " + "location: %s\n", strerror(errno)); + } + strncpy(dumpdir, argv[1], sizeof(dumpdir)-1); + dumpdir[sizeof(dumpdir)-1]='\0'; + + /* Set up the server socket */ + if ((sock = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1) + { + pidfile_remove(pfh); + perror("socket"); + return 1; + } + bzero(&bindaddr, sizeof(bindaddr)); + bindaddr.sin_len = sizeof(bindaddr); + bindaddr.sin_family = AF_INET; + bindaddr.sin_addr.s_addr = bindip.s_addr; + bindaddr.sin_port = htons(NETDUMP_PORT); + if (bind(sock, (struct sockaddr *)&bindaddr, sizeof(bindaddr))) + { + pidfile_remove(pfh); + perror("bind"); + close(sock); + return 1; + } + if (fcntl(sock, F_SETFL, O_NONBLOCK) == -1) { + pidfile_remove(pfh); + perror("fcntl(sock, F_SETFL, O_NONBLOCK)"); + close(sock); + return 1; + } + + /* Signal handlers */ + bzero(&sa, sizeof(sa)); + sa.sa_handler = signal_shutdown; + if (sigaction(SIGINT, &sa, NULL) || sigaction(SIGTERM, &sa, NULL)) + { + pidfile_remove(pfh); + perror("sigaction"); + close(sock); + return 1; + } + bzero(&sa, sizeof(sa)); + sa.sa_handler = SIG_IGN; + sa.sa_flags = SA_NOCLDWAIT; + if (sigaction(SIGCHLD, &sa, NULL)) + { + pidfile_remove(pfh); + perror("sigaction"); + close(sock); + return 1; + } + + printf("Waiting for clients.\n"); + fflush(stdout); + + do_shutdown=0; + eventloop(); + + if (handler_script) + { + free(handler_script); + } + pidfile_remove(pfh); + + return 0; +} + From owner-svn-src-projects@FreeBSD.ORG Mon Aug 9 22:30:14 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C1F411065675; Mon, 9 Aug 2010 22:30:14 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B15318FC1C; Mon, 9 Aug 2010 22:30:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o79MUEvJ025721; Mon, 9 Aug 2010 22:30:14 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o79MUEpR025719; Mon, 9 Aug 2010 22:30:14 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201008092230.o79MUEpR025719@svn.freebsd.org> From: Attilio Rao Date: Mon, 9 Aug 2010 22:30:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211125 - projects/sv/usr.sbin/netdumpsrv X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Aug 2010 22:30:14 -0000 Author: attilio Date: Mon Aug 9 22:30:14 2010 New Revision: 211125 URL: http://svn.freebsd.org/changeset/base/211125 Log: Switch the use of hand-crafted list into a SLIST_* handling. Modified: projects/sv/usr.sbin/netdumpsrv/netdump_server.c Modified: projects/sv/usr.sbin/netdumpsrv/netdump_server.c ============================================================================== --- projects/sv/usr.sbin/netdumpsrv/netdump_server.c Mon Aug 9 22:29:31 2010 (r211124) +++ projects/sv/usr.sbin/netdumpsrv/netdump_server.c Mon Aug 9 22:30:14 2010 (r211125) @@ -41,6 +41,7 @@ #include #include #include +#include #include #include @@ -53,6 +54,7 @@ struct netdump_client { + SLIST_ENTRY(netdump_client) iter; char infofilename[MAXPATHLEN]; char corefilename[MAXPATHLEN]; char hostname[MAXHOSTNAMELEN]; @@ -63,11 +65,9 @@ struct netdump_client time_t last_msg; unsigned int printed_port_warning : 1; unsigned int any_data_rcvd : 1; - - struct netdump_client *next; }; -struct netdump_client *clients; +SLIST_HEAD(, netdump_client) clients = SLIST_HEAD_INITIALIZER(clients); char dumpdir[MAXPATHLEN]; char *handler_script=NULL; time_t now; @@ -237,32 +237,14 @@ struct netdump_client * alloc_client(str free(client); return NULL; } - - client->next = clients; - clients = client; + SLIST_INSERT_HEAD(&clients, client, iter); return client; } void free_client(struct netdump_client *client) { /* Remove from the list */ - if (clients == client) - { - clients = client->next; - } - else - { - struct netdump_client *parent; - for (parent=clients; parent; parent = parent->next) - { - if (parent->next == client) - { - break; - } - } - parent->next = client->next; - } - + SLIST_REMOVE(&clients, client, netdump_client, iter); fclose(client->infofile); close(client->corefd); close(client->sock); @@ -305,7 +287,7 @@ void handle_timeout(struct netdump_clien void timeout_clients() { static time_t last_timeout_check; - struct netdump_client **node; + struct netdump_client *client, *tmp; /* Only time out clients every 10 seconds */ if (now - last_timeout_check < 10) @@ -316,16 +298,10 @@ void timeout_clients() last_timeout_check = now; /* Traverse the list looking for stale clients */ - for (node=&clients; *node; node = &(*node)->next) - { - while (*node && (*node)->last_msg+CLIENT_TIMEOUT < now) - { - handle_timeout(*node); - } - - if (*node == NULL) + SLIST_FOREACH_SAFE(client, &clients, iter, tmp) { + if (client->last_msg+CLIENT_TIMEOUT < now) { - break; + handle_timeout(client); } } } @@ -605,8 +581,7 @@ void eventloop() FD_ZERO(&readfds); FD_SET(sock, &readfds); - for (client=clients; client; client = client->next) - { + SLIST_FOREACH(client, &clients, iter) { FD_SET(client->sock, &readfds); if (maxfd <= client->sock) { @@ -660,8 +635,7 @@ void eventloop() else { /* Check if they're on the clients list */ - for (client=clients; client; client = client->next) - { + SLIST_FOREACH(client, &clients, iter) { if (client->ip.s_addr == from.sin_addr.s_addr) { break; @@ -689,8 +663,7 @@ void eventloop() } } - for (client=clients; client; client = client->next) - { + SLIST_FOREACH(client, &clients, iter) { if (FD_ISSET(client->sock, &readfds)) { int len = receive_message(client->sock, &from, fromstr, @@ -706,7 +679,7 @@ void eventloop() /* Client socket is broken for some reason */ handle_timeout(client); /* The client pointer is now invalid */ - client = clients; + client = SLIST_FIRST(&clients); if (!client) { break; @@ -723,7 +696,7 @@ void eventloop() if (handle_packet(client, &from, fromstr, &msg)) { /* Client was freed; we have a stale pointer */ - client = clients; + client = SLIST_FIRST(&clients); if (!client) { break; @@ -739,9 +712,9 @@ void eventloop() puts("Shutting down..."); /* Clients is the head of the list, so clients != NULL iff the list isn't * empty. Call it a timeout so that the scripts get run. */ - while (clients) + while (!SLIST_EMPTY(&clients)) { - handle_timeout(clients); + handle_timeout(SLIST_FIRST(&clients)); } } From owner-svn-src-projects@FreeBSD.ORG Mon Aug 9 23:28:23 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CAAC7106566C; Mon, 9 Aug 2010 23:28:23 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 840D78FC0C; Mon, 9 Aug 2010 23:28:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o79NSNCf038735; Mon, 9 Aug 2010 23:28:23 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o79NSNjY038733; Mon, 9 Aug 2010 23:28:23 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <201008092328.o79NSNjY038733@svn.freebsd.org> From: Jeff Roberson Date: Mon, 9 Aug 2010 23:28:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211127 - projects/suj/6/sbin/fsck_ffs X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Aug 2010 23:28:23 -0000 Author: jeff Date: Mon Aug 9 23:28:23 2010 New Revision: 211127 URL: http://svn.freebsd.org/changeset/base/211127 Log: - Specifically mark a constant as unsigned long to quiet a warning only present with an older compiler. Modified: projects/suj/6/sbin/fsck_ffs/suj.c Modified: projects/suj/6/sbin/fsck_ffs/suj.c ============================================================================== --- projects/suj/6/sbin/fsck_ffs/suj.c Mon Aug 9 22:56:10 2010 (r211126) +++ projects/suj/6/sbin/fsck_ffs/suj.c Mon Aug 9 23:28:23 2010 (r211127) @@ -54,7 +54,7 @@ __FBSDID("$FreeBSD$"); #define DOTDOT_OFFSET DIRECTSIZ(1) #define SUJ_HASHSIZE 2048 #define SUJ_HASHMASK (SUJ_HASHSIZE - 1) -#define SUJ_HASH(x) ((x * 2654435761) & SUJ_HASHMASK) +#define SUJ_HASH(x) ((x * 2654435761UL) & SUJ_HASHMASK) struct suj_seg { TAILQ_ENTRY(suj_seg) ss_next; From owner-svn-src-projects@FreeBSD.ORG Mon Aug 9 23:29:37 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B530F1065676; Mon, 9 Aug 2010 23:29:37 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8A5518FC0C; Mon, 9 Aug 2010 23:29:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o79NTbkl039064; Mon, 9 Aug 2010 23:29:37 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o79NTbdf039060; Mon, 9 Aug 2010 23:29:37 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <201008092329.o79NTbdf039060@svn.freebsd.org> From: Jeff Roberson Date: Mon, 9 Aug 2010 23:29:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211128 - in projects/suj/6/sys/ufs: ffs ufs X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Aug 2010 23:29:37 -0000 Author: jeff Date: Mon Aug 9 23:29:37 2010 New Revision: 211128 URL: http://svn.freebsd.org/changeset/base/211128 Log: - Correct porting errors; p_ru is not always valid in 6, and i_ino was removed incompletely. Modified: projects/suj/6/sys/ufs/ffs/ffs_inode.c projects/suj/6/sys/ufs/ffs/ffs_softdep.c projects/suj/6/sys/ufs/ufs/inode.h Modified: projects/suj/6/sys/ufs/ffs/ffs_inode.c ============================================================================== --- projects/suj/6/sys/ufs/ffs/ffs_inode.c Mon Aug 9 23:28:23 2010 (r211127) +++ projects/suj/6/sys/ufs/ffs/ffs_inode.c Mon Aug 9 23:29:37 2010 (r211128) @@ -599,7 +599,7 @@ ffs_indirtrunc(ip, lbn, dbn, lastbn, lev vp = ITOV(ip); bp = getblk(vp, lbn, (int)fs->fs_bsize, 0, 0, 0); if ((bp->b_flags & B_CACHE) == 0) { - curproc->p_ru->ru_inblock++; /* pay for read */ + curproc->p_stats->p_ru.ru_inblock++; /* pay for read */ bp->b_iocmd = BIO_READ; bp->b_flags &= ~B_INVAL; bp->b_ioflags &= ~BIO_ERROR; Modified: projects/suj/6/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- projects/suj/6/sys/ufs/ffs/ffs_softdep.c Mon Aug 9 23:28:23 2010 (r211127) +++ projects/suj/6/sys/ufs/ffs/ffs_softdep.c Mon Aug 9 23:29:37 2010 (r211128) @@ -873,7 +873,7 @@ static struct jremref *newjremref(struct struct inode *ip, off_t, nlink_t); static struct jaddref *newjaddref(struct inode *, ino_t, off_t, int16_t, uint16_t); -static inline void newinoref(struct inoref *, ino_t, ino_t, off_t, nlink_t, +static void newinoref(struct inoref *, ino_t, ino_t, off_t, nlink_t, uint16_t); static inline struct jsegdep *inoref_jseg(struct inoref *); static struct jmvref *newjmvref(struct inode *, ino_t, off_t, off_t); @@ -3241,7 +3241,7 @@ newjremref(struct dirrem *dirrem, struct return (jremref); } -static inline void +static void newinoref(struct inoref *inoref, ino_t ino, ino_t parent, off_t diroff, nlink_t nlink, uint16_t mode) { Modified: projects/suj/6/sys/ufs/ufs/inode.h ============================================================================== --- projects/suj/6/sys/ufs/ufs/inode.h Mon Aug 9 23:28:23 2010 (r211127) +++ projects/suj/6/sys/ufs/ufs/inode.h Mon Aug 9 23:29:37 2010 (r211128) @@ -83,7 +83,6 @@ struct inode { doff_t i_endoff; /* End of useful stuff in directory. */ doff_t i_diroff; /* Offset in dir, where we found last entry. */ doff_t i_offset; /* Offset of free space in directory. */ - ino_t i_ino; /* Inode number of found directory. */ u_int32_t i_reclen; /* Size of found directory entry. */ union { From owner-svn-src-projects@FreeBSD.ORG Tue Aug 10 13:05:50 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4E82F106566B; Tue, 10 Aug 2010 13:05:50 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3EAA78FC14; Tue, 10 Aug 2010 13:05:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7AD5oq5026826; Tue, 10 Aug 2010 13:05:50 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7AD5oSI026824; Tue, 10 Aug 2010 13:05:50 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201008101305.o7AD5oSI026824@svn.freebsd.org> From: Attilio Rao Date: Tue, 10 Aug 2010 13:05:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211143 - projects/sv/sys/netinet X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Aug 2010 13:05:50 -0000 Author: attilio Date: Tue Aug 10 13:05:49 2010 New Revision: 211143 URL: http://svn.freebsd.org/changeset/base/211143 Log: Fix style. Reported by: bde Modified: projects/sv/sys/netinet/netdump.h Modified: projects/sv/sys/netinet/netdump.h ============================================================================== --- projects/sv/sys/netinet/netdump.h Tue Aug 10 12:58:44 2010 (r211142) +++ projects/sv/sys/netinet/netdump.h Tue Aug 10 13:05:49 2010 (r211143) @@ -29,7 +29,7 @@ */ #ifndef _NETINET_NETDUMP_H_ -#define _NETINET_NETDUMP_H_ +#define _NETINET_NETDUMP_H_ #include @@ -77,4 +77,4 @@ int netdump_break_lock(struct mtx *lock #endif -#endif /* _NETINET_NETDUMP_H_ */ +#endif /* !_NETINET_NETDUMP_H_ */ From owner-svn-src-projects@FreeBSD.ORG Tue Aug 10 13:11:56 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EFD7F1065672; Tue, 10 Aug 2010 13:11:56 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DFFA38FC19; Tue, 10 Aug 2010 13:11:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7ADBuow028236; Tue, 10 Aug 2010 13:11:56 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7ADBuAP028234; Tue, 10 Aug 2010 13:11:56 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201008101311.o7ADBuAP028234@svn.freebsd.org> From: Attilio Rao Date: Tue, 10 Aug 2010 13:11:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211144 - projects/sv/sys/netinet X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Aug 2010 13:11:57 -0000 Author: attilio Date: Tue Aug 10 13:11:56 2010 New Revision: 211144 URL: http://svn.freebsd.org/changeset/base/211144 Log: More style fixes. Modified: projects/sv/sys/netinet/netdump.h Modified: projects/sv/sys/netinet/netdump.h ============================================================================== --- projects/sv/sys/netinet/netdump.h Tue Aug 10 13:05:49 2010 (r211143) +++ projects/sv/sys/netinet/netdump.h Tue Aug 10 13:11:56 2010 (r211144) @@ -44,20 +44,20 @@ #define NETDUMP_DATASIZE 8192 /* Packets payload. */ struct netdump_msg_hdr { - uint32_t type; /* NETDUMP_HERALD, _FINISHED, _VMCORE, _KDH. */ - uint32_t seqno; /* Match acks with msgs. */ - uint64_t offset; /* vmcore offset (bytes). */ - uint32_t len; /* Attached data (bytes). */ - uint8_t pad[4]; /* Pad for parifying 32 and 64 bits. */ + uint32_t type; /* NETDUMP_HERALD, _FINISHED, _VMCORE, _KDH. */ + uint32_t seqno; /* Match acks with msgs. */ + uint64_t offset; /* vmcore offset (bytes). */ + uint32_t len; /* Attached data (bytes). */ + uint8_t pad[4]; /* Pad for parifying 32 and 64 bits. */ }; struct netdump_ack { - uint32_t seqno; /* Match acks with msgs. */ + uint32_t seqno; /* Match acks with msgs. */ }; struct netdump_msg { struct netdump_msg_hdr hdr; - uint8_t data[NETDUMP_DATASIZE]; + uint8_t data[NETDUMP_DATASIZE]; }; #ifdef _KERNEL @@ -65,10 +65,10 @@ struct netdump_msg { struct mtx; struct netdump_methods { - void (*test_get_lock)(struct ifnet *); - int (*break_lock)(struct ifnet *, int *, uint8_t *, u_int); - void (*release_lock)(struct ifnet *); - int (*poll_locked)(struct ifnet *, enum poll_cmd, int); + void (*test_get_lock)(struct ifnet *); + int (*break_lock)(struct ifnet *, int *, uint8_t *, u_int); + void (*release_lock)(struct ifnet *); + int (*poll_locked)(struct ifnet *, enum poll_cmd, int); }; int netdump_break_lock(struct mtx *lock, const char *name, From owner-svn-src-projects@FreeBSD.ORG Tue Aug 10 13:36:52 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C5F321065672; Tue, 10 Aug 2010 13:36:52 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B5EF08FC13; Tue, 10 Aug 2010 13:36:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7ADaqFl033854; Tue, 10 Aug 2010 13:36:52 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7ADaqNe033852; Tue, 10 Aug 2010 13:36:52 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201008101336.o7ADaqNe033852@svn.freebsd.org> From: Attilio Rao Date: Tue, 10 Aug 2010 13:36:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211145 - projects/sv/usr.sbin/netdumpsrv X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Aug 2010 13:36:52 -0000 Author: attilio Date: Tue Aug 10 13:36:52 2010 New Revision: 211145 URL: http://svn.freebsd.org/changeset/base/211145 Log: Use calloc where appropriate. Modified: projects/sv/usr.sbin/netdumpsrv/netdump_server.c Modified: projects/sv/usr.sbin/netdumpsrv/netdump_server.c ============================================================================== --- projects/sv/usr.sbin/netdumpsrv/netdump_server.c Tue Aug 10 13:11:56 2010 (r211144) +++ projects/sv/usr.sbin/netdumpsrv/netdump_server.c Tue Aug 10 13:36:52 2010 (r211145) @@ -88,13 +88,12 @@ struct netdump_client * alloc_client(str struct hostent *hp; int i, fd, bufsz; - client = malloc(sizeof(*client)); + client = calloc(1, sizeof(*client)); if (!client) { - perror("malloc"); + perror("calloc"); return NULL; } - bzero(client, sizeof(*client)); bcopy(ip, &client->ip, sizeof(*ip)); client->corefd = -1; client->sock = -1; From owner-svn-src-projects@FreeBSD.ORG Wed Aug 11 04:56:00 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 02367106566C; Wed, 11 Aug 2010 04:56:00 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E6FB08FC1D; Wed, 11 Aug 2010 04:55:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7B4txKS042620; Wed, 11 Aug 2010 04:55:59 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7B4txR9042619; Wed, 11 Aug 2010 04:55:59 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <201008110455.o7B4txR9042619@svn.freebsd.org> From: Jeff Roberson Date: Wed, 11 Aug 2010 04:55:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211161 - projects/suj/6/sys/ufs/ufs X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Aug 2010 04:56:00 -0000 Author: jeff Date: Wed Aug 11 04:55:58 2010 New Revision: 211161 URL: http://svn.freebsd.org/changeset/base/211161 Log: - Somehow my last commit omitted this change. Reported by: Mark Saad Modified: projects/suj/6/sys/ufs/ufs/ufs_lookup.c Modified: projects/suj/6/sys/ufs/ufs/ufs_lookup.c ============================================================================== --- projects/suj/6/sys/ufs/ufs/ufs_lookup.c Wed Aug 11 03:08:03 2010 (r211160) +++ projects/suj/6/sys/ufs/ufs/ufs_lookup.c Wed Aug 11 04:55:58 2010 (r211161) @@ -591,7 +591,7 @@ found: */ pdp = vdp; if (flags & ISDOTDOT) { - saved_ino = dp->i_ino; + saved_ino = ino; VOP_UNLOCK(pdp, 0, td); /* race to get the inode */ error = VFS_VGET(pdp->v_mount, saved_ino, cnp->cn_lkflags, &tdp); @@ -599,11 +599,11 @@ found: if (error) return (error); *vpp = tdp; - } else if (dp->i_number == dp->i_ino) { + } else if (dp->i_number == ino) { VREF(vdp); /* we want ourself, ie "." */ *vpp = vdp; } else { - error = VFS_VGET(pdp->v_mount, dp->i_ino, + error = VFS_VGET(pdp->v_mount, ino, cnp->cn_lkflags, &tdp); if (error) return (error); From owner-svn-src-projects@FreeBSD.ORG Wed Aug 11 22:44:10 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 88D54106566C; Wed, 11 Aug 2010 22:44:10 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 743A28FC0C; Wed, 11 Aug 2010 22:44:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7BMiABW094066; Wed, 11 Aug 2010 22:44:10 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7BMiA05094058; Wed, 11 Aug 2010 22:44:10 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <201008112244.o7BMiA05094058@svn.freebsd.org> From: Jeff Roberson Date: Wed, 11 Aug 2010 22:44:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211195 - in projects/ofed/head/contrib/ofed/management: infiniband-diags/src libibcommon/include/infiniband libibcommon/src libibumad/include/infiniband libibumad/src X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Aug 2010 22:44:10 -0000 Author: jeff Date: Wed Aug 11 22:44:10 2010 New Revision: 211195 URL: http://svn.freebsd.org/changeset/base/211195 Log: - Change ib libs from using sysfs to sysctl. This is mostly a trivial replacement of / with . and open with sysctl. - Implement a scandir() replacement for sysctl. This was quite complex as sysctl does not return nodes as unique items and does a depth first traversal. - Adjust some paths in umad.h. - Other minor porting, #ifdef HAVE_CONFIG_H wrapping, and missing includes, etc. Sponsored by: Isilon Systems, iX Systems, and Panasas. Modified: projects/ofed/head/contrib/ofed/management/infiniband-diags/src/ibaddr.c projects/ofed/head/contrib/ofed/management/infiniband-diags/src/ibdiag_common.c projects/ofed/head/contrib/ofed/management/libibcommon/include/infiniband/common.h projects/ofed/head/contrib/ofed/management/libibcommon/src/libibcommon.map projects/ofed/head/contrib/ofed/management/libibcommon/src/sysfs.c projects/ofed/head/contrib/ofed/management/libibumad/include/infiniband/umad.h projects/ofed/head/contrib/ofed/management/libibumad/src/umad.c Modified: projects/ofed/head/contrib/ofed/management/infiniband-diags/src/ibaddr.c ============================================================================== --- projects/ofed/head/contrib/ofed/management/infiniband-diags/src/ibaddr.c Wed Aug 11 22:10:37 2010 (r211194) +++ projects/ofed/head/contrib/ofed/management/infiniband-diags/src/ibaddr.c Wed Aug 11 22:44:10 2010 (r211195) @@ -46,6 +46,8 @@ #include #include +#include + #include "ibdiag_common.h" char *argv0 = "ibaddr"; Modified: projects/ofed/head/contrib/ofed/management/infiniband-diags/src/ibdiag_common.c ============================================================================== --- projects/ofed/head/contrib/ofed/management/infiniband-diags/src/ibdiag_common.c Wed Aug 11 22:10:37 2010 (r211194) +++ projects/ofed/head/contrib/ofed/management/infiniband-diags/src/ibdiag_common.c Wed Aug 11 22:44:10 2010 (r211195) @@ -45,7 +45,9 @@ #include #include #include +#ifdef HAVE_CONFIG_H #include +#endif #include "ibdiag_common.h" Modified: projects/ofed/head/contrib/ofed/management/libibcommon/include/infiniband/common.h ============================================================================== --- projects/ofed/head/contrib/ofed/management/libibcommon/include/infiniband/common.h Wed Aug 11 22:10:37 2010 (r211194) +++ projects/ofed/head/contrib/ofed/management/libibcommon/include/infiniband/common.h Wed Aug 11 22:44:10 2010 (r211195) @@ -36,6 +36,7 @@ #include #include #include +#include #include #include @@ -127,6 +128,9 @@ int sys_read_guid(char *dir_name, char * int sys_read_gid(char *dir_name, char *file_name, uint8_t *gid); int sys_read_uint64(char *dir_name, char *file_name, uint64_t *u); int sys_read_uint(char *dir_name, char *file_name, unsigned *u); +int sys_scandir(const char *dirname, struct dirent ***namelist, + int (*select)(const struct dirent *), + int (*compar)(const struct dirent **, const struct dirent **)); /* stack.c */ void stack_dump(void); Modified: projects/ofed/head/contrib/ofed/management/libibcommon/src/libibcommon.map ============================================================================== --- projects/ofed/head/contrib/ofed/management/libibcommon/src/libibcommon.map Wed Aug 11 22:10:37 2010 (r211194) +++ projects/ofed/head/contrib/ofed/management/libibcommon/src/libibcommon.map Wed Aug 11 22:44:10 2010 (r211195) @@ -7,6 +7,7 @@ IBCOMMON_1.0 { sys_read_string; sys_read_uint; sys_read_uint64; + sys_scandir; getcurrenttime; fhash; logmsg; Modified: projects/ofed/head/contrib/ofed/management/libibcommon/src/sysfs.c ============================================================================== --- projects/ofed/head/contrib/ofed/management/libibcommon/src/sysfs.c Wed Aug 11 22:10:37 2010 (r211194) +++ projects/ofed/head/contrib/ofed/management/libibcommon/src/sysfs.c Wed Aug 11 22:44:10 2010 (r211195) @@ -57,6 +57,9 @@ #include #include +#include +#include + #include "common.h" static int @@ -73,26 +76,23 @@ int sys_read_string(char *dir_name, char *file_name, char *str, int max_len) { char path[256], *s; - int fd, r; + size_t len; snprintf(path, sizeof(path), "%s/%s", dir_name, file_name); - if ((fd = open(path, O_RDONLY)) < 0) - return ret_code(); + for (s = &path[0]; *s != '\0'; s++) + if (*s == '/') + *s = '.'; - if ((r = read(fd, str, max_len)) < 0) { - int e = errno; - close(fd); - errno = e; + len = max_len; + if (sysctlbyname(&path[1], str, &len, NULL, 0) == -1) return ret_code(); - } - str[(r < max_len) ? r : max_len - 1] = 0; + str[(len < max_len) ? len : max_len - 1] = 0; if ((s = strrchr(str, '\n'))) *s = 0; - close(fd); return 0; } @@ -130,7 +130,7 @@ sys_read_gid(char *dir_name, char *file_ return r; for (s = buf, i = 0 ; i < 8; i++) { - if (!(str = strsep(&s, ": \t\n"))) + if (!(str = strsep(&s, ": \t\n"))) return -EINVAL; ugid[i] = htons(strtoul(str, 0, 16) & 0xffff); } @@ -165,3 +165,130 @@ sys_read_uint(char *dir_name, char *file return 0; } + +#define DIRECTSIZ(namlen) \ + (((uintptr_t)&((struct dirent *)0)->d_name + \ + ((namlen)+1)*sizeof(((struct dirent *)0)->d_name[0]) + 3) & ~3) + +int +sys_scandir(const char *dirname, struct dirent ***namelist, + int (*select)(const struct dirent *), + int (*compar)(const struct dirent **, const struct dirent **)) +{ + struct dirent **names; + struct dirent **names2; + struct dirent *dp; + char name[1024]; + int lsname[22]; + int chname[22]; + int name2[22]; + int oid[22]; + char *s; + size_t n1, n2; + size_t len, oidlen, namlen; + int cnt, max; + int err; + int i; + + *namelist = NULL; + /* Skip the leading / */ + strncpy(name, &dirname[1], sizeof(name)); + for (s = &name[0]; *s != '\0'; s++) + if (*s == '/') + *s = '.'; + /* + * Resolve the path. + */ + len = sizeof(oid) / sizeof(int); + namlen = strlen(name) + 1; + if (sysctlnametomib(name, oid, &len) != 0) + return (-errno); + lsname[0] = 0; /* Root */ + lsname[1] = 2; /* Get next */ + memcpy(lsname+2, oid, len * sizeof(int)); + n1 = 2 + len; + oidlen = len; + /* + * Setup the return list of dirents. + */ + cnt = 0; + max = 64; + names = malloc(max * sizeof(void *)); + if (names == NULL) + return (-ENOMEM); + + for (;;) { + n2 = sizeof(name2); + if (sysctl(lsname, n1, name2, &n2, 0, 0) < 0) { + if (errno == ENOENT) + break; + goto errout; + } + n2 /= sizeof(int); + if (n2 < oidlen) + break; + for (i = 0; i < oidlen; i++) + if (name2[i] != oid[i]) + goto out; + chname[0] = 0; /* root */ + chname[1] = 1; /* oid name */ + memcpy(chname + 2, name2, n2 * sizeof(int)); + memcpy(lsname + 2, name2, n2 * sizeof(int)); + n1 = 2 + n2; + /* + * scandir() is not supposed to go deeper than the requested + * directory but sysctl also doesn't return a node for + * 'subdirectories' so we have to find a file in the subdir + * and then truncate the name to report it. + */ + if (n2 > oidlen + 1) { + /* Skip to the next name after this one. */ + n1 = 2 + oidlen + 1; + lsname[n1 - 1]++; + } + len = sizeof(name); + if (sysctl(chname, n2 + 2, name, &len, 0, 0) < 0) + goto errout; + if (len <= 0 || len < namlen) + goto out; + s = name + namlen; + /* Just keep the first level name. */ + if (strchr(s, '.')) + *strchr(s, '.') = '\0'; + len = strlen(s) + 1; + dp = malloc(DIRECTSIZ(len)); + dp->d_reclen = DIRECTSIZ(len); + dp->d_namlen = len; + memcpy(&dp->d_name, s, len); + if (select && !select(dp)) { + free(dp); + continue; + } + if (cnt == max) { + max *= 2; + names2 = realloc(names, max * sizeof(void *)); + if (names2 == NULL) { + errno = ENOMEM; + free(dp); + goto errout; + } + names = names2; + } + names[cnt++] = dp; + } +out: + if (cnt && compar) + qsort(names, cnt, sizeof(struct dirent *), + (int (*)(const void *, const void *))compar); + + *namelist = names; + + return (cnt); + +errout: + err = errno; + for (i = 0; i < cnt; i++) + free(names[i]); + free(names); + return (-err); +} Modified: projects/ofed/head/contrib/ofed/management/libibumad/include/infiniband/umad.h ============================================================================== --- projects/ofed/head/contrib/ofed/management/libibumad/include/infiniband/umad.h Wed Aug 11 22:10:37 2010 (r211194) +++ projects/ofed/head/contrib/ofed/management/libibumad/include/infiniband/umad.h Wed Aug 11 22:44:10 2010 (r211195) @@ -81,9 +81,8 @@ typedef struct ib_user_mad { #define IB_IOCTL_MAGIC 0x1b -#define IB_USER_MAD_REGISTER_AGENT _IOWR(IB_IOCTL_MAGIC, 1, \ - struct ib_user_mad_reg_req) -#define IB_USER_MAD_UNREGISTER_AGENT _IOW(IB_IOCTL_MAGIC, 2, uint32_t) +#define IB_USER_MAD_REGISTER_AGENT _IO(IB_IOCTL_MAGIC, 1) +#define IB_USER_MAD_UNREGISTER_AGENT _IO(IB_IOCTL_MAGIC, 2) #define IB_USER_MAD_ENABLE_PKEY _IO(IB_IOCTL_MAGIC, 3) #define UMAD_CA_NAME_LEN 20 @@ -98,7 +97,7 @@ typedef struct ib_user_mad { #define UMAD_MAX_PORTS 64 -#define UMAD_DEV_DIR "/dev/infiniband" +#define UMAD_DEV_DIR "/dev" #define SYS_CA_PORTS_DIR "ports" Modified: projects/ofed/head/contrib/ofed/management/libibumad/src/umad.c ============================================================================== --- projects/ofed/head/contrib/ofed/management/libibumad/src/umad.c Wed Aug 11 22:10:37 2010 (r211194) +++ projects/ofed/head/contrib/ofed/management/libibumad/src/umad.c Wed Aug 11 22:44:10 2010 (r211195) @@ -79,7 +79,7 @@ typedef struct ib_user_mad_reg_req { #define TRACE if (umaddebug) IBWARN #define DEBUG if (umaddebug) IBWARN -int umaddebug = 0; +int umaddebug = 1; #define UMAD_DEV_FILE_SZ 256 @@ -163,7 +163,7 @@ get_port(char *ca_name, char *dir, int p memcpy(&port->port_guid, gid + 8, sizeof port->port_guid); snprintf(port_dir + len, sizeof(port_dir) - len, "/pkeys"); - ret = scandir(port_dir, &namelist, check_for_digit_name, NULL); + ret = sys_scandir(port_dir, &namelist, check_for_digit_name, NULL); if (ret <= 0) { IBWARN("no pkeys found for %s:%u (at dir %s)...", port->ca_name, port->portnum, port_dir); @@ -346,7 +346,9 @@ resolve_ca_name(char *ca_name, int *best static int get_ca(char *ca_name, umad_ca_t *ca) { +#ifdef __linux__ DIR *dir; +#endif char dir_name[256]; struct dirent **namelist; int r, i, ret; @@ -376,10 +378,12 @@ get_ca(char *ca_name, umad_ca_t *ca) snprintf(dir_name, sizeof(dir_name), "%s/%s/%s", SYS_INFINIBAND, ca->ca_name, SYS_CA_PORTS_DIR); +#ifdef __linux__ if (!(dir = opendir(dir_name))) return -ENOENT; +#endif - if ((r = scandir(dir_name, &namelist, 0, alphasort)) < 0) { + if ((r = sys_scandir(dir_name, &namelist, 0, alphasort)) < 0) { ret = errno < 0 ? errno : -EIO; goto error; } @@ -416,7 +420,9 @@ get_ca(char *ca_name, umad_ca_t *ca) free(namelist[i]); free(namelist); +#ifdef __linux__ closedir(dir); +#endif put_ca(ca); return 0; @@ -425,7 +431,9 @@ clean: free(namelist[i]); free(namelist); error: +#ifdef __linux__ closedir(dir); +#endif release_ca(ca); return ret; @@ -437,7 +445,7 @@ umad_id_to_dev(int umad_id, char *dev, u char path[256]; int r; - snprintf(path, sizeof(path), SYS_INFINIBAND_MAD "/umad%d/", umad_id); + snprintf(path, sizeof(path), SYS_INFINIBAND_MAD "/umad%d", umad_id); if ((r = sys_read_string(path, SYS_IB_MAD_DEV, dev, UMAD_CA_NAME_LEN)) < 0) return r; @@ -520,7 +528,7 @@ umad_get_cas_names(char cas[][UMAD_CA_NA TRACE("max %d", max); - n = scandir(SYS_INFINIBAND, &namelist, 0, alphasort); + n = sys_scandir(SYS_INFINIBAND, &namelist, NULL, alphasort); if (n > 0) { for (i = 0; i < n; i++) { if (strcmp(namelist[i]->d_name, ".") && From owner-svn-src-projects@FreeBSD.ORG Wed Aug 11 23:56:37 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D61251065670; Wed, 11 Aug 2010 23:56:37 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C39138FC17; Wed, 11 Aug 2010 23:56:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7BNubUT010317; Wed, 11 Aug 2010 23:56:37 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7BNubKC010310; Wed, 11 Aug 2010 23:56:37 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <201008112356.o7BNubKC010310@svn.freebsd.org> From: Jeff Roberson Date: Wed, 11 Aug 2010 23:56:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211198 - in projects/ofed/head/contrib/ofed/management: infiniband-diags/src opensm/complib opensm/include/complib X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Aug 2010 23:56:37 -0000 Author: jeff Date: Wed Aug 11 23:56:37 2010 New Revision: 211198 URL: http://svn.freebsd.org/changeset/base/211198 Log: - Use strdup() rather than strdupa(). Leaking one copy of argv[0] is not a problem. - Define bswap_16 and bswap_32 via machine/byteorder.h - Define the wordsize in a somewhat gross way. It's used in if defines so it can be based on sizeof(). Sponsored by: Isilon Systems, iX Systems, and Panasas. Modified: projects/ofed/head/contrib/ofed/management/infiniband-diags/src/smpdump.c projects/ofed/head/contrib/ofed/management/opensm/complib/cl_nodenamemap.c projects/ofed/head/contrib/ofed/management/opensm/complib/cl_thread.c projects/ofed/head/contrib/ofed/management/opensm/include/complib/cl_byteswap.h projects/ofed/head/contrib/ofed/management/opensm/include/complib/cl_debug_osd.h projects/ofed/head/contrib/ofed/management/opensm/include/complib/cl_types.h Modified: projects/ofed/head/contrib/ofed/management/infiniband-diags/src/smpdump.c ============================================================================== --- projects/ofed/head/contrib/ofed/management/infiniband-diags/src/smpdump.c Wed Aug 11 23:22:53 2010 (r211197) +++ projects/ofed/head/contrib/ofed/management/infiniband-diags/src/smpdump.c Wed Aug 11 23:56:37 2010 (r211198) @@ -295,7 +295,7 @@ main(int argc, char *argv[]) usage(); if (mgmt_class == CLASS_SUBN_DIRECTED_ROUTE && - str2DRPath(strdupa(argv[0]), &path) < 0) + str2DRPath(strdup(argv[0]), &path) < 0) IBPANIC("bad path str '%s'", argv[0]); if (mgmt_class == CLASS_SUBN_LID_ROUTE) Modified: projects/ofed/head/contrib/ofed/management/opensm/complib/cl_nodenamemap.c ============================================================================== --- projects/ofed/head/contrib/ofed/management/opensm/complib/cl_nodenamemap.c Wed Aug 11 23:22:53 2010 (r211197) +++ projects/ofed/head/contrib/ofed/management/opensm/complib/cl_nodenamemap.c Wed Aug 11 23:56:37 2010 (r211198) @@ -42,7 +42,9 @@ #include #include #include +#ifdef HAVE_CONFIG_H #include +#endif #include Modified: projects/ofed/head/contrib/ofed/management/opensm/complib/cl_thread.c ============================================================================== --- projects/ofed/head/contrib/ofed/management/opensm/complib/cl_thread.c Wed Aug 11 23:22:53 2010 (r211197) +++ projects/ofed/head/contrib/ofed/management/opensm/complib/cl_thread.c Wed Aug 11 23:56:37 2010 (r211198) @@ -39,7 +39,6 @@ #include #include -#include #include /* @@ -122,7 +121,7 @@ int cl_proc_count(void) { uint32_t ret; - ret = get_nprocs(); + ret = sysconf(_SC_NPROCESSORS_ONLN); if (!ret) return 1; /* Workaround for PPC where get_nprocs() returns 0 */ Modified: projects/ofed/head/contrib/ofed/management/opensm/include/complib/cl_byteswap.h ============================================================================== --- projects/ofed/head/contrib/ofed/management/opensm/include/complib/cl_byteswap.h Wed Aug 11 23:22:53 2010 (r211197) +++ projects/ofed/head/contrib/ofed/management/opensm/include/complib/cl_byteswap.h Wed Aug 11 23:56:37 2010 (r211198) @@ -86,6 +86,11 @@ BEGIN_C_DECLS * ntoh32, hton32 * ntoh64, hton64 */ +#include +#define __BYTE_ORDER _BYTE_ORDER +#define bswap_16 __bswap16 +#define bswap_32 __bswap32 + #ifndef __BYTE_ORDER #error "__BYTE_ORDER macro undefined. Missing in endian.h?" #endif Modified: projects/ofed/head/contrib/ofed/management/opensm/include/complib/cl_debug_osd.h ============================================================================== --- projects/ofed/head/contrib/ofed/management/opensm/include/complib/cl_debug_osd.h Wed Aug 11 23:22:53 2010 (r211197) +++ projects/ofed/head/contrib/ofed/management/opensm/include/complib/cl_debug_osd.h Wed Aug 11 23:56:37 2010 (r211198) @@ -42,7 +42,6 @@ #define _CL_DEBUG_OSD_H_ #include -#include #ifdef __cplusplus # define BEGIN_C_DECLS extern "C" { Modified: projects/ofed/head/contrib/ofed/management/opensm/include/complib/cl_types.h ============================================================================== --- projects/ofed/head/contrib/ofed/management/opensm/include/complib/cl_types.h Wed Aug 11 23:22:53 2010 (r211197) +++ projects/ofed/head/contrib/ofed/management/opensm/include/complib/cl_types.h Wed Aug 11 23:56:37 2010 (r211198) @@ -60,6 +60,14 @@ typedef uint16_t net16_t; typedef uint32_t net32_t; typedef uint64_t net64_t; +#ifndef __WORDSIZE +#ifdef __LP64__ +#define __WORDSIZE 64 +#else +#define __WORDSIZE 32 +#endif +#endif + /* explicit cast of void* to uint32_t */ #ifndef ASSERT_VOIDP2UINTN #if __WORDSIZE == 64 From owner-svn-src-projects@FreeBSD.ORG Wed Aug 11 23:58:17 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0A8671065674; Wed, 11 Aug 2010 23:58:17 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D30C88FC0A; Wed, 11 Aug 2010 23:58:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7BNwGlL010732; Wed, 11 Aug 2010 23:58:16 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7BNwGe4010730; Wed, 11 Aug 2010 23:58:16 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <201008112358.o7BNwGe4010730@svn.freebsd.org> From: Jeff Roberson Date: Wed, 11 Aug 2010 23:58:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211199 - projects/ofed/head/contrib/ofed/management/infiniband-diags/include X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Aug 2010 23:58:17 -0000 Author: jeff Date: Wed Aug 11 23:58:16 2010 New Revision: 211199 URL: http://svn.freebsd.org/changeset/base/211199 Log: - Manually generate the ibdiag version number. Sponsored by: Isilon Systems, iX Systems, and Panasas. Added: projects/ofed/head/contrib/ofed/management/infiniband-diags/include/ibdiag_version.h Added: projects/ofed/head/contrib/ofed/management/infiniband-diags/include/ibdiag_version.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/ofed/head/contrib/ofed/management/infiniband-diags/include/ibdiag_version.h Wed Aug 11 23:58:16 2010 (r211199) @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2008 Voltaire Inc. All rights reserved. + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU + * General Public License (GPL) Version 2, available from the file + * COPYING in the main directory of this source tree, or the + * OpenIB.org BSD license below: + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#ifndef _IBDIAG_VERSION_H_ +#define _IBDIAG_VERSION_H_ + +#define IBDIAG_VERSION "1.4.4" + +#endif /* _IBDIAG_VERSION_H_ */ From owner-svn-src-projects@FreeBSD.ORG Wed Aug 11 23:59:21 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F1EC2106566C; Wed, 11 Aug 2010 23:59:21 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DD7308FC1D; Wed, 11 Aug 2010 23:59:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7BNxL4a011016; Wed, 11 Aug 2010 23:59:21 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7BNxL3v010993; Wed, 11 Aug 2010 23:59:21 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <201008112359.o7BNxL3v010993@svn.freebsd.org> From: Jeff Roberson Date: Wed, 11 Aug 2010 23:59:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211200 - in projects/ofed/head/contrib/ofed: . include include/infiniband usr.bin usr.bin/ibaddr usr.bin/ibnetdiscover usr.bin/ibping usr.bin/ibportstate usr.bin/ibroute usr.bin/ibsend... X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Aug 2010 23:59:22 -0000 Author: jeff Date: Wed Aug 11 23:59:21 2010 New Revision: 211200 URL: http://svn.freebsd.org/changeset/base/211200 Log: - Add Makefiles for basic infiniband management utilities, libraries, and includes. Sponsored by: Isilon Systems, iX Systems, and Panasas. Added: projects/ofed/head/contrib/ofed/Makefile projects/ofed/head/contrib/ofed/include/ projects/ofed/head/contrib/ofed/include/Makefile projects/ofed/head/contrib/ofed/include/infiniband/ projects/ofed/head/contrib/ofed/include/infiniband/Makefile projects/ofed/head/contrib/ofed/usr.bin/ projects/ofed/head/contrib/ofed/usr.bin/Makefile projects/ofed/head/contrib/ofed/usr.bin/Makefile.inc projects/ofed/head/contrib/ofed/usr.bin/ibaddr/ projects/ofed/head/contrib/ofed/usr.bin/ibaddr/Makefile projects/ofed/head/contrib/ofed/usr.bin/ibnetdiscover/ projects/ofed/head/contrib/ofed/usr.bin/ibnetdiscover/Makefile projects/ofed/head/contrib/ofed/usr.bin/ibping/ projects/ofed/head/contrib/ofed/usr.bin/ibping/Makefile projects/ofed/head/contrib/ofed/usr.bin/ibportstate/ projects/ofed/head/contrib/ofed/usr.bin/ibportstate/Makefile projects/ofed/head/contrib/ofed/usr.bin/ibroute/ projects/ofed/head/contrib/ofed/usr.bin/ibroute/Makefile projects/ofed/head/contrib/ofed/usr.bin/ibsendtrap/ projects/ofed/head/contrib/ofed/usr.bin/ibsendtrap/Makefile projects/ofed/head/contrib/ofed/usr.bin/ibstat/ projects/ofed/head/contrib/ofed/usr.bin/ibstat/Makefile projects/ofed/head/contrib/ofed/usr.bin/ibsysstat/ projects/ofed/head/contrib/ofed/usr.bin/ibsysstat/Makefile projects/ofed/head/contrib/ofed/usr.bin/ibtracert/ projects/ofed/head/contrib/ofed/usr.bin/ibtracert/Makefile projects/ofed/head/contrib/ofed/usr.bin/perfquery/ projects/ofed/head/contrib/ofed/usr.bin/perfquery/Makefile projects/ofed/head/contrib/ofed/usr.bin/saquery/ projects/ofed/head/contrib/ofed/usr.bin/saquery/Makefile projects/ofed/head/contrib/ofed/usr.bin/sminfo/ projects/ofed/head/contrib/ofed/usr.bin/sminfo/Makefile projects/ofed/head/contrib/ofed/usr.bin/smpdump/ projects/ofed/head/contrib/ofed/usr.bin/smpdump/Makefile projects/ofed/head/contrib/ofed/usr.bin/smpquery/ projects/ofed/head/contrib/ofed/usr.bin/smpquery/Makefile projects/ofed/head/contrib/ofed/usr.bin/vendstat/ projects/ofed/head/contrib/ofed/usr.bin/vendstat/Makefile projects/ofed/head/contrib/ofed/usr.lib/Makefile projects/ofed/head/contrib/ofed/usr.lib/libosmcomp/ projects/ofed/head/contrib/ofed/usr.lib/libosmcomp/Makefile Added: projects/ofed/head/contrib/ofed/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/ofed/head/contrib/ofed/Makefile Wed Aug 11 23:59:21 2010 (r211200) @@ -0,0 +1,5 @@ +.include + +SUBDIR = include usr.lib usr.bin + +.include Added: projects/ofed/head/contrib/ofed/include/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/ofed/head/contrib/ofed/include/Makefile Wed Aug 11 23:59:21 2010 (r211200) @@ -0,0 +1,5 @@ +.include + +SUBDIR = infiniband + +.include Added: projects/ofed/head/contrib/ofed/include/infiniband/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/ofed/head/contrib/ofed/include/infiniband/Makefile Wed Aug 11 23:59:21 2010 (r211200) @@ -0,0 +1,49 @@ +.include + +INCS= +IBVERBS= ../../libibverbs/include/infiniband +VERBINCS= ${IBVERBS}/arch.h ${IBVERBS}/driver.h ${IBVERBS}/kern-abi.h +VERBINCS+= ${IBVERBS}/marshall.h ${IBVERBS}/opcode.h +VERBINCS+= ${IBVERBS}/sa-kern-abi.h ${IBVERBS}/sa.h ${IBVERBS}/verbs.h +VERBINCSDIR= ${INCLUDEDIR}/infiniband + +IBCOMMON= ../../management/libibcommon/include/infiniband +COMMONINCS= ${IBCOMMON}/common.h +COMMONINCSDIR= ${INCLUDEDIR}/infiniband + +IBMAD= ../../management/libibmad/include/infiniband +MADINCS= ${IBMAD}/mad.h +MADINCSDIR= ${INCLUDEDIR}/infiniband + +IBUMAD= ../../management/libibumad/include/infiniband +UMADINCS= ${IBUMAD}/umad.h +UMADINCSDIR= ${INCLUDEDIR}/infiniband + +COMPLIB= ../../management/opensm/include/complib +COMPLIBINCS= ${COMPLIB}/cl_atomic.h ${COMPLIB}/cl_atomic_osd.h +COMPLIBINCS+= ${COMPLIB}/cl_byteswap.h ${COMPLIB}/cl_byteswap_osd.h +COMPLIBINCS+= ${COMPLIB}/cl_comppool.h ${COMPLIB}/cl_debug.h +COMPLIBINCS+= ${COMPLIB}/cl_debug_osd.h ${COMPLIB}/cl_dispatcher.h +COMPLIBINCS+= ${COMPLIB}/cl_event.h ${COMPLIB}/cl_event_osd.h +COMPLIBINCS+= ${COMPLIB}/cl_event_wheel.h ${COMPLIB}/cl_fleximap.h +COMPLIBINCS+= ${COMPLIB}/cl_list.h ${COMPLIB}/cl_log.h +COMPLIBINCS+= ${COMPLIB}/cl_map.h ${COMPLIB}/cl_math.h +COMPLIBINCS+= ${COMPLIB}/cl_nodenamemap.h ${COMPLIB}/cl_packoff.h +COMPLIBINCS+= ${COMPLIB}/cl_packon.h ${COMPLIB}/cl_passivelock.h +COMPLIBINCS+= ${COMPLIB}/cl_pool.h ${COMPLIB}/cl_ptr_vector.h +COMPLIBINCS+= ${COMPLIB}/cl_qcomppool.h ${COMPLIB}/cl_qlist.h +COMPLIBINCS+= ${COMPLIB}/cl_qmap.h ${COMPLIB}/cl_qpool.h +COMPLIBINCS+= ${COMPLIB}/cl_spinlock.h ${COMPLIB}/cl_spinlock_osd.h +COMPLIBINCS+= ${COMPLIB}/cl_thread.h ${COMPLIB}/cl_thread_osd.h +COMPLIBINCS+= ${COMPLIB}/cl_threadpool.h ${COMPLIB}/cl_timer.h +COMPLIBINCS+= ${COMPLIB}/cl_timer_osd.h ${COMPLIB}/cl_types.h +COMPLIBINCS+= ${COMPLIB}/cl_types_osd.h ${COMPLIB}/cl_vector.h +COMPLIBINCSDIR= ${INCLUDEDIR}/infiniband/complib + +IBADIR= ../../management/opensm/include/iba +IBAINCS= ${IBADIR}/ib_cm_types.h ${IBADIR}/ib_types.h +IBAINCSDIR= ${INCLUDEDIR}/infiniband/iba + +INCSGROUPS= INCS VERBINCS COMMONINCS MADINCS UMADINCS COMPLIBINCS IBAINCS + +.include Added: projects/ofed/head/contrib/ofed/usr.bin/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/ofed/head/contrib/ofed/usr.bin/Makefile Wed Aug 11 23:59:21 2010 (r211200) @@ -0,0 +1,8 @@ +.include + +SUBDIR = ibaddr ibnetdiscover ibping ibportstate ibroute ibsendtrap ibstat +SUBDIR += ibsysstat ibtracert perfquery +# saquery +SUBDIR += sminfo smpdump smpquery vendstat + +.include Added: projects/ofed/head/contrib/ofed/usr.bin/Makefile.inc ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/ofed/head/contrib/ofed/usr.bin/Makefile.inc Wed Aug 11 23:59:21 2010 (r211200) @@ -0,0 +1,3 @@ +OFEDSYS= ../../../../sys/ofed +DIAGPATH= ${.CURDIR}/../../management/infiniband-diags +BINDIR?= /usr/bin Added: projects/ofed/head/contrib/ofed/usr.bin/ibaddr/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/ofed/head/contrib/ofed/usr.bin/ibaddr/Makefile Wed Aug 11 23:59:21 2010 (r211200) @@ -0,0 +1,14 @@ +# $FreeBSD$ + +.include "../Makefile.inc" +.PATH: ${DIAGPATH}/src ${DIAGPATH}/man + +PROG= ibaddr +SRCS= ibaddr.c ibdiag_common.c +LDADD= -libumad -libcommon -libmad +CFLAGS+= -I${DIAGPATH}/include -I${OFEDSYS}/include +MAN= ibaddr.8 + +WARNS?= 1 + +.include Added: projects/ofed/head/contrib/ofed/usr.bin/ibnetdiscover/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/ofed/head/contrib/ofed/usr.bin/ibnetdiscover/Makefile Wed Aug 11 23:59:21 2010 (r211200) @@ -0,0 +1,15 @@ +# $FreeBSD$ + +.include "../Makefile.inc" +.PATH: ${DIAGPATH}/src ${DIAGPATH}/man + +PROG= ibnetdiscover +SRCS= ibnetdiscover.c grouping.c ibdiag_common.c +LDADD= -libumad -libcommon -libmad -losmcomp +CFLAGS+= -I${DIAGPATH}/include -I${OFEDSYS}/include -I/usr/include/infiniband +CFLAGS+= -pthread +MAN= ibnetdiscover.8 + +WARNS?= 1 + +.include Added: projects/ofed/head/contrib/ofed/usr.bin/ibping/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/ofed/head/contrib/ofed/usr.bin/ibping/Makefile Wed Aug 11 23:59:21 2010 (r211200) @@ -0,0 +1,14 @@ +# $FreeBSD$ + +.include "../Makefile.inc" +.PATH: ${DIAGPATH}/src ${DIAGPATH}/man + +PROG= ibping +SRCS= ibping.c ibdiag_common.c +LDADD= -libumad -libcommon -libmad +CFLAGS+= -I${DIAGPATH}/include -I${OFEDSYS}/include +MAN= ibping.8 + +WARNS?= 1 + +.include Added: projects/ofed/head/contrib/ofed/usr.bin/ibportstate/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/ofed/head/contrib/ofed/usr.bin/ibportstate/Makefile Wed Aug 11 23:59:21 2010 (r211200) @@ -0,0 +1,14 @@ +# $FreeBSD$ + +.include "../Makefile.inc" +.PATH: ${DIAGPATH}/src ${DIAGPATH}/man + +PROG= ibportstate +SRCS= ibportstate.c ibdiag_common.c +LDADD= -libumad -libcommon -libmad +CFLAGS+= -I${DIAGPATH}/include -I${OFEDSYS}/include +MAN= ibportstate.8 + +WARNS?= 1 + +.include Added: projects/ofed/head/contrib/ofed/usr.bin/ibroute/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/ofed/head/contrib/ofed/usr.bin/ibroute/Makefile Wed Aug 11 23:59:21 2010 (r211200) @@ -0,0 +1,15 @@ +# $FreeBSD$ + +.include "../Makefile.inc" +.PATH: ${DIAGPATH}/src ${DIAGPATH}/man + +PROG= ibroute +SRCS= ibroute.c ibdiag_common.c +LDADD= -libumad -libcommon -libmad -losmcomp +CFLAGS+= -I${DIAGPATH}/include -I${OFEDSYS}/include -I/usr/include/infiniband +CFLAGS+= -pthread +MAN= ibroute.8 + +WARNS?= 1 + +.include Added: projects/ofed/head/contrib/ofed/usr.bin/ibsendtrap/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/ofed/head/contrib/ofed/usr.bin/ibsendtrap/Makefile Wed Aug 11 23:59:21 2010 (r211200) @@ -0,0 +1,14 @@ +# $FreeBSD$ + +.include "../Makefile.inc" +.PATH: ${DIAGPATH}/src ${DIAGPATH}/man + +PROG= ibsendtrap +SRCS= ibsendtrap.c ibdiag_common.c +LDADD= -libumad -libcommon -libmad +CFLAGS+= -I${DIAGPATH}/include -I${OFEDSYS}/include -I/usr/include/infiniband +NO_MAN= true + +WARNS?= 1 + +.include Added: projects/ofed/head/contrib/ofed/usr.bin/ibstat/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/ofed/head/contrib/ofed/usr.bin/ibstat/Makefile Wed Aug 11 23:59:21 2010 (r211200) @@ -0,0 +1,14 @@ +# $FreeBSD$ + +.include "../Makefile.inc" +.PATH: ${DIAGPATH}/src ${DIAGPATH}/man + +PROG= ibstat +SRCS= ibstat.c +LDADD= -libumad -libcommon +CFLAGS+= -I${DIAGPATH}/include -I${OFEDSYS}/include +MAN= ibstat.8 + +WARNS?= 1 + +.include Added: projects/ofed/head/contrib/ofed/usr.bin/ibsysstat/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/ofed/head/contrib/ofed/usr.bin/ibsysstat/Makefile Wed Aug 11 23:59:21 2010 (r211200) @@ -0,0 +1,14 @@ +# $FreeBSD$ + +.include "../Makefile.inc" +.PATH: ${DIAGPATH}/src ${DIAGPATH}/man + +PROG= ibsysstat +SRCS= ibsysstat.c ibdiag_common.c +LDADD= -libumad -libcommon -libmad +CFLAGS+= -I${DIAGPATH}/include -I${OFEDSYS}/include +MAN= ibsysstat.8 + +WARNS?= 1 + +.include Added: projects/ofed/head/contrib/ofed/usr.bin/ibtracert/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/ofed/head/contrib/ofed/usr.bin/ibtracert/Makefile Wed Aug 11 23:59:21 2010 (r211200) @@ -0,0 +1,15 @@ +# $FreeBSD$ + +.include "../Makefile.inc" +.PATH: ${DIAGPATH}/src ${DIAGPATH}/man + +PROG= ibtracert +SRCS= ibtracert.c ibdiag_common.c +LDADD= -libumad -libcommon -libmad -losmcomp +CFLAGS+= -I${DIAGPATH}/include -I${OFEDSYS}/include -I/usr/include/infiniband +CFLAGS+= -pthread +MAN= ibtracert.8 + +WARNS?= 1 + +.include Added: projects/ofed/head/contrib/ofed/usr.bin/perfquery/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/ofed/head/contrib/ofed/usr.bin/perfquery/Makefile Wed Aug 11 23:59:21 2010 (r211200) @@ -0,0 +1,14 @@ +# $FreeBSD$ + +.include "../Makefile.inc" +.PATH: ${DIAGPATH}/src ${DIAGPATH}/man + +PROG= perfquery +SRCS= perfquery.c ibdiag_common.c +LDADD= -libumad -libcommon -libmad +CFLAGS+= -I${DIAGPATH}/include -I${OFEDSYS}/include +MAN= perfquery.8 + +WARNS?= 1 + +.include Added: projects/ofed/head/contrib/ofed/usr.bin/saquery/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/ofed/head/contrib/ofed/usr.bin/saquery/Makefile Wed Aug 11 23:59:21 2010 (r211200) @@ -0,0 +1,16 @@ +# $FreeBSD$ + +.include "../Makefile.inc" +.PATH: ${DIAGPATH}/src ${DIAGPATH}/man + +PROG= saquery +SRCS= saquery.c ibdiag_common.c +LDADD= -libumad -libcommon -libmad -losmcomp +CFLAGS+= -I${DIAGPATH}/include -I${OFEDSYS}/include -I/usr/include/infiniband +CFLAGS+= -DOSM_VENDOR_INTF_OPENIB -DVENDOR_RMPP_SUPPORT -DDUAL_SIDED_RMPP +CFLAGS+= -pthread +MAN= saquery.8 + +WARNS?= 1 + +.include Added: projects/ofed/head/contrib/ofed/usr.bin/sminfo/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/ofed/head/contrib/ofed/usr.bin/sminfo/Makefile Wed Aug 11 23:59:21 2010 (r211200) @@ -0,0 +1,14 @@ +# $FreeBSD$ + +.include "../Makefile.inc" +.PATH: ${DIAGPATH}/src ${DIAGPATH}/man + +PROG= sminfo +SRCS= sminfo.c ibdiag_common.c +LDADD= -libumad -libcommon -libmad +CFLAGS+= -I${DIAGPATH}/include -I${OFEDSYS}/include +MAN= sminfo.8 + +WARNS?= 1 + +.include Added: projects/ofed/head/contrib/ofed/usr.bin/smpdump/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/ofed/head/contrib/ofed/usr.bin/smpdump/Makefile Wed Aug 11 23:59:21 2010 (r211200) @@ -0,0 +1,14 @@ +# $FreeBSD$ + +.include "../Makefile.inc" +.PATH: ${DIAGPATH}/src ${DIAGPATH}/man + +PROG= smpdump +SRCS= smpdump.c +LDADD= -libumad -libcommon -libmad +CFLAGS+= -I${DIAGPATH}/include -I${OFEDSYS}/include +MAN= smpdump.8 + +WARNS?= 1 + +.include Added: projects/ofed/head/contrib/ofed/usr.bin/smpquery/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/ofed/head/contrib/ofed/usr.bin/smpquery/Makefile Wed Aug 11 23:59:21 2010 (r211200) @@ -0,0 +1,15 @@ +# $FreeBSD$ + +.include "../Makefile.inc" +.PATH: ${DIAGPATH}/src ${DIAGPATH}/man + +PROG= smpquery +SRCS= smpquery.c ibdiag_common.c +LDADD= -libumad -libcommon -libmad -losmcomp +CFLAGS+= -I${DIAGPATH}/include -I${OFEDSYS}/include -I/usr/include/infiniband/ +CFLAGS+= -pthread +MAN= smpquery.8 + +WARNS?= 1 + +.include Added: projects/ofed/head/contrib/ofed/usr.bin/vendstat/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/ofed/head/contrib/ofed/usr.bin/vendstat/Makefile Wed Aug 11 23:59:21 2010 (r211200) @@ -0,0 +1,14 @@ +# $FreeBSD$ + +.include "../Makefile.inc" +.PATH: ${DIAGPATH}/src ${DIAGPATH}/man + +PROG= vendstat +SRCS= vendstat.c ibdiag_common.c +LDADD= -libumad -libcommon -libmad +CFLAGS+= -I${DIAGPATH}/include -I${OFEDSYS}/include +MAN= vendstat.8 + +WARNS?= 1 + +.include Added: projects/ofed/head/contrib/ofed/usr.lib/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/ofed/head/contrib/ofed/usr.lib/Makefile Wed Aug 11 23:59:21 2010 (r211200) @@ -0,0 +1,5 @@ +.include + +SUBDIR = libibcommon libibmad libibumad libibverbs libmlx4 libmthca libosmcomp + +.include Added: projects/ofed/head/contrib/ofed/usr.lib/libosmcomp/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/ofed/head/contrib/ofed/usr.lib/libosmcomp/Makefile Wed Aug 11 23:59:21 2010 (r211200) @@ -0,0 +1,25 @@ +# $FreeBSD$ + +SHLIBDIR?= /usr/lib + +.include + +COMPLIBDIR= ../../management/opensm/complib +OFEDSYS= ../../../../sys/ofed + +.PATH: ${COMPLIBDIR} + +LIB= osmcomp +SHLIB_MAJOR= 1 +NO_PROFILE= + +SRCS= cl_complib.c cl_dispatcher.c cl_event.c cl_event_wheel.c cl_list.c +SRCS+= cl_log.c cl_map.c cl_pool.c cl_ptr_vector.c cl_spinlock.c +SRCS+= cl_statustext.c cl_thread.c cl_threadpool.c cl_timer.c cl_vector.c +SRCS+= ib_statustext.c cl_nodenamemap.c + +CFLAGS+= -I${.CURDIR} -I/usr/include/infiniband -I{OFEDSYS}/include + +VERSION_MAP= ${COMPLIBDIR}/libosmcomp.map + +.include From owner-svn-src-projects@FreeBSD.ORG Thu Aug 12 00:55:35 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 61CB51065677; Thu, 12 Aug 2010 00:55:35 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4D24C8FC14; Thu, 12 Aug 2010 00:55:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7C0tZLq023592; Thu, 12 Aug 2010 00:55:35 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7C0tZK2023585; Thu, 12 Aug 2010 00:55:35 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <201008120055.o7C0tZK2023585@svn.freebsd.org> From: Jeff Roberson Date: Thu, 12 Aug 2010 00:55:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211203 - in projects/ofed/head/contrib/ofed: include/infiniband management/opensm/include/complib management/opensm/include/opensm management/opensm/man management/opensm/opensm usr.bi... X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Aug 2010 00:55:35 -0000 Author: jeff Date: Thu Aug 12 00:55:35 2010 New Revision: 211203 URL: http://svn.freebsd.org/changeset/base/211203 Log: - Add bmake files for opensm, libosmvendor, and libopensm. - Do some minor porting to point at byteorder and include sys/socket.h where missing for AF_INET6. - Manually define an osm_config.h, this likely is incomplete. Sponsored by: Isilon Systems, iX Systems, and Panasas. Added: projects/ofed/head/contrib/ofed/management/opensm/include/opensm/osm_config.h projects/ofed/head/contrib/ofed/management/opensm/include/opensm/osm_version.h projects/ofed/head/contrib/ofed/management/opensm/man/opensm.8 projects/ofed/head/contrib/ofed/usr.bin/opensm/ projects/ofed/head/contrib/ofed/usr.bin/opensm/Makefile projects/ofed/head/contrib/ofed/usr.lib/libopensm/ projects/ofed/head/contrib/ofed/usr.lib/libopensm/Makefile projects/ofed/head/contrib/ofed/usr.lib/libosmvendor/ projects/ofed/head/contrib/ofed/usr.lib/libosmvendor/Makefile Modified: projects/ofed/head/contrib/ofed/include/infiniband/Makefile projects/ofed/head/contrib/ofed/management/opensm/include/complib/cl_byteswap.h projects/ofed/head/contrib/ofed/management/opensm/opensm/osm_helper.c projects/ofed/head/contrib/ofed/management/opensm/opensm/osm_inform.c projects/ofed/head/contrib/ofed/management/opensm/opensm/osm_prtn_config.c projects/ofed/head/contrib/ofed/management/opensm/opensm/osm_sa_informinfo.c projects/ofed/head/contrib/ofed/management/opensm/opensm/osm_sa_mcmember_record.c projects/ofed/head/contrib/ofed/management/opensm/opensm/osm_sa_path_record.c projects/ofed/head/contrib/ofed/usr.bin/Makefile projects/ofed/head/contrib/ofed/usr.lib/libosmcomp/Makefile Modified: projects/ofed/head/contrib/ofed/include/infiniband/Makefile ============================================================================== --- projects/ofed/head/contrib/ofed/include/infiniband/Makefile Thu Aug 12 00:20:46 2010 (r211202) +++ projects/ofed/head/contrib/ofed/include/infiniband/Makefile Thu Aug 12 00:55:35 2010 (r211203) @@ -44,6 +44,57 @@ IBADIR= ../../management/opensm/include IBAINCS= ${IBADIR}/ib_cm_types.h ${IBADIR}/ib_types.h IBAINCSDIR= ${INCLUDEDIR}/infiniband/iba +OPENSM= ../../management/opensm/include/opensm + +OPENSMINCS= ${OPENSM}/osm_attrib_req.h ${OPENSM}/osm_base.h +OPENSMINCS+= ${OPENSM}/osm_config.h ${OPENSM}/osm_console.h +OPENSMINCS+= ${OPENSM}/osm_console_io.h ${OPENSM}/osm_db.h +OPENSMINCS+= ${OPENSM}/osm_db_pack.h ${OPENSM}/osm_errors.h +OPENSMINCS+= ${OPENSM}/osm_event_plugin.h ${OPENSM}/osm_helper.h +OPENSMINCS+= ${OPENSM}/osm_inform.h ${OPENSM}/osm_lid_mgr.h +OPENSMINCS+= ${OPENSM}/osm_log.h ${OPENSM}/osm_mad_pool.h +OPENSMINCS+= ${OPENSM}/osm_madw.h ${OPENSM}/osm_mcast_tbl.h +OPENSMINCS+= ${OPENSM}/osm_mcm_info.h ${OPENSM}/osm_mcm_port.h +OPENSMINCS+= ${OPENSM}/osm_msgdef.h ${OPENSM}/osm_mtree.h +OPENSMINCS+= ${OPENSM}/osm_multicast.h ${OPENSM}/osm_node.h +OPENSMINCS+= ${OPENSM}/osm_opensm.h ${OPENSM}/osm_partition.h +OPENSMINCS+= ${OPENSM}/osm_path.h ${OPENSM}/osm_perfmgr.h +OPENSMINCS+= ${OPENSM}/osm_perfmgr_db.h ${OPENSM}/osm_pkey.h +OPENSMINCS+= ${OPENSM}/osm_pkey_mgr.h ${OPENSM}/osm_port.h +OPENSMINCS+= ${OPENSM}/osm_port_profile.h ${OPENSM}/osm_prefix_route.h +OPENSMINCS+= ${OPENSM}/osm_qos_policy.h ${OPENSM}/osm_remote_sm.h +OPENSMINCS+= ${OPENSM}/osm_router.h ${OPENSM}/osm_sa.h +OPENSMINCS+= ${OPENSM}/osm_sa_mad_ctrl.h ${OPENSM}/osm_service.h +OPENSMINCS+= ${OPENSM}/osm_sm.h ${OPENSM}/osm_sm_mad_ctrl.h +OPENSMINCS+= ${OPENSM}/osm_stats.h ${OPENSM}/osm_subnet.h +OPENSMINCS+= ${OPENSM}/osm_switch.h ${OPENSM}/osm_ucast_cache.h +OPENSMINCS+= ${OPENSM}/osm_ucast_mgr.h ${OPENSM}/osm_version.h +OPENSMINCS+= ${OPENSM}/osm_vl15intf.h ${OPENSM}/st.h +OPENSMINCSDIR= ${INCLUDEDIR}/infiniband/opensm + +VENDOR= ../../management/opensm/include/vendor +VENDORINCS= ${VENDOR}/osm_mtl_bind.h ${VENDOR}/osm_pkt_randomizer.h +VENDORINCS+= ${VENDOR}/osm_ts_useraccess.h ${VENDOR}/osm_umadt.h +VENDORINCS+= ${VENDOR}/osm_vendor.h ${VENDOR}/osm_vendor_al.h +VENDORINCS+= ${VENDOR}/osm_vendor_api.h ${VENDOR}/osm_vendor_ibumad.h +VENDORINCS+= ${VENDOR}/osm_vendor_mlx.h ${VENDOR}/osm_vendor_mlx_defs.h +VENDORINCS+= ${VENDOR}/osm_vendor_mlx_dispatcher.h +VENDORINCS+= ${VENDOR}/osm_vendor_mlx_hca.h +VENDORINCS+= ${VENDOR}/osm_vendor_mlx_inout.h +VENDORINCS+= ${VENDOR}/osm_vendor_mlx_rmpp_ctx.h +VENDORINCS+= ${VENDOR}/osm_vendor_mlx_sar.h ${VENDOR}/osm_vendor_mlx_sender.h +VENDORINCS+= ${VENDOR}/osm_vendor_mlx_svc.h +VENDORINCS+= ${VENDOR}/osm_vendor_mlx_transport.h +VENDORINCS+= ${VENDOR}/osm_vendor_mlx_transport_anafa.h +VENDORINCS+= ${VENDOR}/osm_vendor_mlx_txn.h +VENDORINCS+= ${VENDOR}/osm_vendor_mtl.h ${VENDOR}/osm_vendor_mtl_hca_guid.h +VENDORINCS+= ${VENDOR}/osm_vendor_mtl_transaction_mgr.h +VENDORINCS+= ${VENDOR}/osm_vendor_sa_api.h +VENDORINCS+= ${VENDOR}/osm_vendor_test.h ${VENDOR}/osm_vendor_ts.h +VENDORINCS+= ${VENDOR}/osm_vendor_umadt.h +VENDORINCSDIR= ${INCLUDEDIR}/infiniband/vendor + INCSGROUPS= INCS VERBINCS COMMONINCS MADINCS UMADINCS COMPLIBINCS IBAINCS +INCSGROUPS+= OPENSMINCS VENDORINCS .include Modified: projects/ofed/head/contrib/ofed/management/opensm/include/complib/cl_byteswap.h ============================================================================== --- projects/ofed/head/contrib/ofed/management/opensm/include/complib/cl_byteswap.h Thu Aug 12 00:20:46 2010 (r211202) +++ projects/ofed/head/contrib/ofed/management/opensm/include/complib/cl_byteswap.h Thu Aug 12 00:55:35 2010 (r211203) @@ -86,10 +86,11 @@ BEGIN_C_DECLS * ntoh32, hton32 * ntoh64, hton64 */ -#include +#include #define __BYTE_ORDER _BYTE_ORDER -#define bswap_16 __bswap16 -#define bswap_32 __bswap32 +#define bswap_16 bswap16 +#define bswap_32 bswap32 +#define bswap_64 bswap64 #ifndef __BYTE_ORDER #error "__BYTE_ORDER macro undefined. Missing in endian.h?" Added: projects/ofed/head/contrib/ofed/management/opensm/include/opensm/osm_config.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/ofed/head/contrib/ofed/management/opensm/include/opensm/osm_config.h Thu Aug 12 00:55:35 2010 (r211203) @@ -0,0 +1,64 @@ +/* include/osm_config.h.in + * + * Defines various OpenSM configuration parameters to be used by various + * plugins and third party tools. + * + * NOTE: Defines used in header files MUST be included here to ensure plugin + * compatibility. + */ + +#ifndef _OSM_CONFIG_H_ +#define _OSM_CONFIG_H_ + +/* define 1 if OpenSM build is in a debug mode */ +#undef OSM_DEBUG + +/* Define as 1 if you want Dual Sided RMPP Support */ +#undef DUAL_SIDED_RMPP + +/* Define as 1 if you want to enable a console on a socket connection */ +#undef ENABLE_OSM_CONSOLE_SOCKET + +/* Define as 1 if you want to enable the event plugin */ +#undef ENABLE_OSM_DEFAULT_EVENT_PLUGIN + +/* Define as 1 if you want to enable the performance manager */ +#undef ENABLE_OSM_PERF_MGR + +/* Define as 1 if you want to enable the performance manager profiling code */ +#undef ENABLE_OSM_PERF_MGR_PROFILE + +/* Define a default node name map file */ +#undef HAVE_DEFAULT_NODENAME_MAP + +/* Define a default OpenSM config file */ +#undef HAVE_DEFAULT_OPENSM_CONFIG_FILE + +/* Define a Partition config file */ +#undef HAVE_DEFAULT_PARTITION_CONFIG_FILE + +/* Define a Prefix Routes config file */ +#undef HAVE_DEFAULT_PREFIX_ROUTES_FILE + +/* Define a QOS policy config file */ +#undef HAVE_DEFAULT_QOS_POLICY_FILE + +/* Define OpenSM config directory */ +#define OPENSM_CONFIG_DIR "/etc/opensm" + +/* Define as 1 for vapi vendor */ +#undef OSM_VENDOR_INTF_MTL + +/* Define as 1 for OpenIB vendor */ +#define OSM_VENDOR_INTF_OPENIB 1 + +/* Define as 1 for sim vendor */ +#undef OSM_VENDOR_INTF_SIM + +/* Define as 1 for ts vendor */ +#undef OSM_VENDOR_INTF_TS + +/* Define as 1 if you want Vendor RMPP Support */ +#undef VENDOR_RMPP_SUPPORT + +#endif /* _OSM_CONFIG_H_ */ Added: projects/ofed/head/contrib/ofed/management/opensm/include/opensm/osm_version.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/ofed/head/contrib/ofed/management/opensm/include/opensm/osm_version.h Thu Aug 12 00:55:35 2010 (r211203) @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved. + * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. + * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU + * General Public License (GPL) Version 2, available from the file + * COPYING in the main directory of this source tree, or the + * OpenIB.org BSD license below: + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#ifndef _OSM_VERSION_H_ +#define _OSM_VERSION_H_ + +/****s* OpenSM: Base/OSM_VERSION +* NAME +* OSM_VERSION +* +* DESCRIPTION +* The version string for OpenSM +* +* SYNOPSIS +*/ +#define OSM_VERSION "OpenSM 3.3.1" +/********/ + +#endif /* _OSM_VERSION_H_ */ Added: projects/ofed/head/contrib/ofed/management/opensm/man/opensm.8 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/ofed/head/contrib/ofed/management/opensm/man/opensm.8 Thu Aug 12 00:55:35 2010 (r211203) @@ -0,0 +1,1012 @@ +.TH OPENSM 8 "June 13, 2008" "OpenIB" "OpenIB Management" + +.SH NAME +opensm \- InfiniBand subnet manager and administration (SM/SA) + +.SH SYNOPSIS +.B opensm +[\-\-version]] +[\-F | \-\-config ] +[\-c(reate-config) ] +[\-g(uid) ] +[\-l(mc) ] +[\-p(riority) ] +[\-smkey ] +[\-r(eassign_lids)] +[\-R | \-\-routing_engine ] +[\-A | \-\-ucast_cache] +[\-z | \-\-connect_roots] +[\-M | \-\-lid_matrix_file ] +[\-U | \-\-lfts_file ] +[\-S | \-\-sadb_file ] +[\-a | \-\-root_guid_file ] +[\-u | \-\-cn_guid_file ] +[\-X | \-\-guid_routing_order_file ] +[\-m | \-\-ids_guid_file ] +[\-o(nce)] +[\-s(weep) ] +[\-t(imeout) ] +[\-maxsmps ] +[\-console [off | local | socket | loopback]] +[\-console-port ] +[\-i(gnore-guids) ] +[\-f | \-\-log_file ] +[\-L | \-\-log_limit ] [\-e(rase_log_file)] +[\-P(config) ] +[\-N | \-\-no_part_enforce] +[\-Q | \-\-qos [\-Y | \-\-qos_policy_file ]] +[\-y | \-\-stay_on_fatal] +[\-B | \-\-daemon] +[\-I | \-\-inactive] +[\-\-perfmgr] +[\-\-perfmgr_sweep_time_s ] +[\-\-prefix_routes_file ] +[\-\-consolidate_ipv6_snm_req] +[\-v(erbose)] [\-V] [\-D ] [\-d(ebug) ] +[\-h(elp)] [\-?] + +.SH DESCRIPTION +.PP +opensm is an InfiniBand compliant Subnet Manager and Administration, +and runs on top of OpenIB. + +opensm provides an implementation of an InfiniBand Subnet Manager and +Administration. Such a software entity is required to run for in order +to initialize the InfiniBand hardware (at least one per each +InfiniBand subnet). + +opensm also now contains an experimental version of a performance +manager as well. + +opensm defaults were designed to meet the common case usage on clusters with up to a few hundred nodes. Thus, in this default mode, opensm will scan the IB +fabric, initialize it, and sweep occasionally for changes. + +opensm attaches to a specific IB port on the local machine and configures only +the fabric connected to it. (If the local machine has other IB ports, +opensm will ignore the fabrics connected to those other ports). If no port is +specified, it will select the first "best" available port. + +opensm can present the available ports and prompt for a port number to +attach to. + +By default, the run is logged to two files: /var/log/messages and /var/log/opensm.log. +The first file will register only general major events, whereas the second +will include details of reported errors. All errors reported in this second +file should be treated as indicators of IB fabric health issues. +(Note that when a fatal and non-recoverable error occurs, opensm will exit.) +Both log files should include the message "SUBNET UP" if opensm was able to +setup the subnet correctly. + +.SH OPTIONS + +.PP +.TP +\fB\-\-version\fR +Prints OpenSM version and exits. +.TP +\fB\-F\fR, \fB\-\-config\fR +The name of the OpenSM config file. When not specified +\fB\% @OPENSM_CONFIG_DIR@/@OPENSM_CONFIG_FILE@\fP will be used (if exists). +.TP +\fB\-c\fR, \fB\-\-create-config\fR +OpenSM will dump its configuration to the specified file and exit. +This is a way to generate OpenSM configuration file template. +.TP +\fB\-g\fR, \fB\-\-guid\fR +This option specifies the local port GUID value +with which OpenSM should bind. OpenSM may be +bound to 1 port at a time. +If GUID given is 0, OpenSM displays a list +of possible port GUIDs and waits for user input. +Without -g, OpenSM tries to use the default port. +.TP +\fB\-l\fR, \fB\-\-lmc\fR +This option specifies the subnet's LMC value. +The number of LIDs assigned to each port is 2^LMC. +The LMC value must be in the range 0-7. +LMC values > 0 allow multiple paths between ports. +LMC values > 0 should only be used if the subnet +topology actually provides multiple paths between +ports, i.e. multiple interconnects between switches. +Without -l, OpenSM defaults to LMC = 0, which allows +one path between any two ports. +.TP +\fB\-p\fR, \fB\-\-priority\fR +This option specifies the SM\'s PRIORITY. +This will effect the handover cases, where master +is chosen by priority and GUID. Range goes from 0 +(default and lowest priority) to 15 (highest). +.TP +\fB\-smkey\fR +This option specifies the SM\'s SM_Key (64 bits). +This will effect SM authentication. +Note that OpenSM version 3.2.1 and below used the default value '1' +in a host byte order, it is fixed now but you may need this option to +interoperate with old OpenSM running on a little endian machine. +.TP +\fB\-r\fR, \fB\-\-reassign_lids\fR +This option causes OpenSM to reassign LIDs to all +end nodes. Specifying -r on a running subnet +may disrupt subnet traffic. +Without -r, OpenSM attempts to preserve existing +LID assignments resolving multiple use of same LID. +.TP +\fB\-R\fR, \fB\-\-routing_engine\fR +This option chooses routing engine(s) to use instead of Min Hop +algorithm (default). Multiple routing engines can be specified +separated by commas so that specific ordering of routing algorithms +will be tried if earlier routing engines fail. +Supported engines: minhop, updn, file, ftree, lash, dor +.TP +\fB\-A\fR, \fB\-\-ucast_cache\fR +This option enables unicast routing cache and prevents routing +recalculation (which is a heavy task in a large cluster) when +there was no topology change detected during the heavy sweep, or +when the topology change does not require new routing calculation, +e.g. when one or more CAs/RTRs/leaf switches going down, or one or +more of these nodes coming back after being down. +A very common case that is handled by the unicast routing cache +is host reboot, which otherwise would cause two full routing +recalculations: one when the host goes down, and the other when +the host comes back online. +.TP +\fB\-z\fR, \fB\-\-connect_roots\fR +This option enforces a routing engine (currently up/down +only) to make connectivity between root switches and in +this way to be fully IBA complaint. In many cases this can +violate "pure" deadlock free algorithm, so use it carefully. +.TP +\fB\-M\fR, \fB\-\-lid_matrix_file\fR +This option specifies the name of the lid matrix dump file +from where switch lid matrices (min hops tables will be +loaded. +.TP +\fB\-U\fR, \fB\-\-lfts_file\fR +This option specifies the name of the LFTs file +from where switch forwarding tables will be loaded. +.TP +\fB\-S\fR, \fB\-\-sadb_file\fR +This option specifies the name of the SA DB dump file +from where SA database will be loaded. +.TP +\fB\-a\fR, \fB\-\-root_guid_file\fR +Set the root nodes for the Up/Down or Fat-Tree routing +algorithm to the guids provided in the given file (one to a line). +.TP +\fB\-u\fR, \fB\-\-cn_guid_file\fR +Set the compute nodes for the Fat-Tree routing algorithm +to the guids provided in the given file (one to a line). +.TP +\fB\-m\fR, \fB\-\-ids_guid_file\fR +Name of the map file with set of the IDs which will be used +by Up/Down routing algorithm instead of node GUIDs +(format: per line). +.TP +\fB\-X\fR, \fB\-\-guid_routing_order_file\fR +Set the order port guids will be routed for the MinHop +and Up/Down routing algorithms to the guids provided in the +given file (one to a line). +.TP +\fB\-o\fR, \fB\-\-once\fR +This option causes OpenSM to configure the subnet +once, then exit. Ports remain in the ACTIVE state. +.TP +\fB\-s\fR, \fB\-\-sweep\fR +This option specifies the number of seconds between +subnet sweeps. Specifying -s 0 disables sweeping. +Without -s, OpenSM defaults to a sweep interval of +10 seconds. +.TP +\fB\-t\fR, \fB\-\-timeout\fR +This option specifies the time in milliseconds +used for transaction timeouts. +Specifying -t 0 disables timeouts. +Without -t, OpenSM defaults to a timeout value of +200 milliseconds. +.TP +\fB\-maxsmps\fR +This option specifies the number of VL15 SMP MADs +allowed on the wire at any one time. +Specifying -maxsmps 0 allows unlimited outstanding +SMPs. +Without -maxsmps, OpenSM defaults to a maximum of +4 outstanding SMPs. +.TP +\fB\-console [off | local | socket | loopback]\fR +This option brings up the OpenSM console (default off). +Note that the socket and loopback options will only be available +if OpenSM was built with --enable-console-socket. +.TP +\fB\-console-port\fR +Specify an alternate telnet port for the socket console (default 10000). +Note that this option only appears if OpenSM was built with +--enable-console-socket. +.TP +\fB\-i\fR, \fB\-ignore-guids\fR +This option provides the means to define a set of ports +(by node guid and port number) that will be ignored by the link load +equalization algorithm. +.TP +\fB\-x\fR, \fB\-\-honor_guid2lid\fR +This option forces OpenSM to honor the guid2lid file, +when it comes out of Standby state, if such file exists +under OSM_CACHE_DIR, and is valid. +By default, this is FALSE. +.TP +\fB\-f\fR, \fB\-\-log_file\fR +This option defines the log to be the given file. +By default, the log goes to /var/log/opensm.log. +For the log to go to standard output use -f stdout. +.TP +\fB\-L\fR, \fB\-\-log_limit\fR +This option defines maximal log file size in MB. When +specified the log file will be truncated upon reaching +this limit. +.TP +\fB\-e\fR, \fB\-\-erase_log_file\fR +This option will cause deletion of the log file +(if it previously exists). By default, the log file +is accumulative. +.TP +\fB\-P\fR, \fB\-\-Pconfig\fR +This option defines the optional partition configuration file. +The default name is \fB\%@OPENSM_CONFIG_DIR@/@PARTITION_CONFIG_FILE@\fP. +.TP +\fB\-\-prefix_routes_file\fR +Prefix routes control how the SA responds to path record queries for +off-subnet DGIDs. By default, the SA fails such queries. The +.B PREFIX ROUTES +section below describes the format of the configuration file. +The default path is \fB\%@OPENSM_CONFIG_DIR@/prefix\-routes.conf\fP. +.TP +\fB\-Q\fR, \fB\-\-qos\fR +This option enables QoS setup. It is disabled by default. +.TP +\fB\-Y\fR, \fB\-\-qos_policy_file\fR +This option defines the optional QoS policy file. The default +name is \fB\%@OPENSM_CONFIG_DIR@/@QOS_POLICY_FILE@\fP. +.TP +\fB\-N\fR, \fB\-\-no_part_enforce\fR +This option disables partition enforcement on switch external ports. +.TP +\fB\-y\fR, \fB\-\-stay_on_fatal\fR +This option will cause SM not to exit on fatal initialization +issues: if SM discovers duplicated guids or a 12x link with +lane reversal badly configured. +By default, the SM will exit on these errors. +.TP +\fB\-B\fR, \fB\-\-daemon\fR +Run in daemon mode - OpenSM will run in the background. +.TP +\fB\-I\fR, \fB\-\-inactive\fR +Start SM in inactive rather than init SM state. This +option can be used in conjunction with the perfmgr so as to +run a standalone performance manager without SM/SA. However, +this is NOT currently implemented in the performance manager. +.TP +\fB\-perfmgr\fR +Enable the perfmgr. Only takes effect if --enable-perfmgr was specified at +configure time. +.TP +\fB\-perfmgr_sweep_time_s\fR +Specify the sweep time for the performance manager in seconds +(default is 180 seconds). Only takes +effect if --enable-perfmgr was specified at configure time. +.TP +.BI --consolidate_ipv6_snm_req +Consolidate IPv6 Solicited Node Multicast group join requests into one +multicast group per MGID PKey. +.TP +\fB\-v\fR, \fB\-\-verbose\fR +This option increases the log verbosity level. +The -v option may be specified multiple times +to further increase the verbosity level. +See the -D option for more information about +log verbosity. +.TP +\fB\-V\fR +This option sets the maximum verbosity level and +forces log flushing. +The -V option is equivalent to \'-D 0xFF -d 2\'. +See the -D option for more information about +log verbosity. +.TP +\fB\-D\fR +This option sets the log verbosity level. +A flags field must follow the -D option. +A bit set/clear in the flags enables/disables a +specific log level as follows: + + BIT LOG LEVEL ENABLED + ---- ----------------- + 0x01 - ERROR (error messages) + 0x02 - INFO (basic messages, low volume) + 0x04 - VERBOSE (interesting stuff, moderate volume) + 0x08 - DEBUG (diagnostic, high volume) + 0x10 - FUNCS (function entry/exit, very high volume) + 0x20 - FRAMES (dumps all SMP and GMP frames) + 0x40 - ROUTING (dump FDB routing information) + 0x80 - currently unused. + +Without -D, OpenSM defaults to ERROR + INFO (0x3). +Specifying -D 0 disables all messages. +Specifying -D 0xFF enables all messages (see -V). +High verbosity levels may require increasing +the transaction timeout with the -t option. +.TP +\fB\-d\fR, \fB\-\-debug\fR +This option specifies a debug option. +These options are not normally needed. +The number following -d selects the debug +option to enable as follows: + + OPT Description + --- ----------------- + -d0 - Ignore other SM nodes + -d1 - Force single threaded dispatching + -d2 - Force log flushing after each log message + -d3 - Disable multicast support +.TP +\fB\-h\fR, \fB\-\-help\fR +Display this usage info then exit. +.TP +\fB\-?\fR +Display this usage info then exit. + +.SH ENVIRONMENT VARIABLES +.PP +The following environment variables control opensm behavior: + +OSM_TMP_DIR - controls the directory in which the temporary files generated by +opensm are created. These files are: opensm-subnet.lst, opensm.fdbs, and +opensm.mcfdbs. By default, this directory is /var/log. + +OSM_CACHE_DIR - opensm stores certain data to the disk such that subsequent +runs are consistent. The default directory used is /var/cache/opensm. +The following file is included in it: + + guid2lid - stores the LID range assigned to each GUID + +.SH NOTES +.PP +When opensm receives a HUP signal, it starts a new heavy sweep as if a trap was received or a topology change was found. +.PP +Also, SIGUSR1 can be used to trigger a reopen of /var/log/opensm.log for +logrotate purposes. + +.SH PARTITION CONFIGURATION +.PP +The default name of OpenSM partitions configuration file is +\fB\%@OPENSM_CONFIG_DIR@/@PARTITION_CONFIG_FILE@\fP. The default may be changed by using +--Pconfig (-P) option with OpenSM. + +The default partition will be created by OpenSM unconditionally even +when partition configuration file does not exist or cannot be accessed. + +The default partition has P_Key value 0x7fff. OpenSM\'s port will have +full membership in default partition. All other end ports will have +partial membership. + +File Format + +Comments: + +Line content followed after \'#\' character is comment and ignored by +parser. + +General file format: + +: ; + +Partition Definition: + +[PartitionName][=PKey][,flag[=value]][,defmember=full|limited] + + PartitionName - string, will be used with logging. When omitted + empty string will be used. + PKey - P_Key value for this partition. Only low 15 bits will + be used. When omitted will be autogenerated. + flag - used to indicate IPoIB capability of this partition. + defmember=full|limited - specifies default membership for port guid + list. Default is limited. + +Currently recognized flags are: + + ipoib - indicates that this partition may be used for IPoIB, as + result IPoIB capable MC group will be created. + rate= - specifies rate for this IPoIB MC group + (default is 3 (10GBps)) + mtu= - specifies MTU for this IPoIB MC group + (default is 4 (2048)) + sl= - specifies SL for this IPoIB MC group + (default is 0) + scope= - specifies scope for this IPoIB MC group + (default is 2 (link local)). Multiple scope settings + are permitted for a partition. + +Note that values for rate, mtu, and scope should be specified as +defined in the IBTA specification (for example, mtu=4 for 2048). + +PortGUIDs list: + + PortGUID - GUID of partition member EndPort. Hexadecimal + numbers should start from 0x, decimal numbers + are accepted too. + full or limited - indicates full or limited membership for this + port. When omitted (or unrecognized) limited + membership is assumed. + +There are two useful keywords for PortGUID definition: + + - 'ALL' means all end ports in this subnet. + - 'SELF' means subnet manager's port. + +Empty list means no ports in this partition. + +Notes: + +White space is permitted between delimiters ('=', ',',':',';'). + +The line can be wrapped after ':' followed after Partition Definition and +between. + +PartitionName does not need to be unique, PKey does need to be unique. +If PKey is repeated then those partition configurations will be merged +and first PartitionName will be used (see also next note). + +It is possible to split partition configuration in more than one +definition, but then PKey should be explicitly specified (otherwise +different PKey values will be generated for those definitions). + +Examples: + + Default=0x7fff : ALL, SELF=full ; + + NewPartition , ipoib : 0x123456=full, 0x3456789034=limi, 0x2134af2306 ; + + YetAnotherOne = 0x300 : SELF=full ; + YetAnotherOne = 0x300 : ALL=limited ; + + ShareIO = 0x80 , defmember=full : 0x123451, 0x123452; + # 0x123453, 0x123454 will be limited + ShareIO = 0x80 : 0x123453, 0x123454, 0x123455=full; + # 0x123456, 0x123457 will be limited + ShareIO = 0x80 : defmember=limited : 0x123456, 0x123457, 0x123458=full; + ShareIO = 0x80 , defmember=full : 0x123459, 0x12345a; + ShareIO = 0x80 , defmember=full : 0x12345b, 0x12345c=limited, 0x12345d; + + +Note: + +The following rule is equivalent to how OpenSM used to run prior to the +partition manager: + + Default=0x7fff,ipoib:ALL=full; + +.SH QOS CONFIGURATION +.PP +There are a set of QoS related low-level configuration parameters. +All these parameter names are prefixed by "qos_" string. Here is a full +list of these parameters: + + qos_max_vls - The maximum number of VLs that will be on the subnet + qos_high_limit - The limit of High Priority component of VL + Arbitration table (IBA 7.6.9) + qos_vlarb_low - Low priority VL Arbitration table (IBA 7.6.9) + template + qos_vlarb_high - High priority VL Arbitration table (IBA 7.6.9) + template + Both VL arbitration templates are pairs of + VL and weight + qos_sl2vl - SL2VL Mapping table (IBA 7.6.6) template. It is + a list of VLs corresponding to SLs 0-15 (Note + that VL15 used here means drop this SL) + +Typical default values (hard-coded in OpenSM initialization) are: + + qos_max_vls 15 + qos_high_limit 0 + qos_vlarb_low 0:0,1:4,2:4,3:4,4:4,5:4,6:4,7:4,8:4,9:4,10:4,11:4,12:4,13:4,14:4 + qos_vlarb_high 0:4,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0,9:0,10:0,11:0,12:0,13:0,14:0 + qos_sl2vl 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,7 + +The syntax is compatible with rest of OpenSM configuration options and +values may be stored in OpenSM config file (cached options file). + +In addition to the above, we may define separate QoS configuration +parameters sets for various target types. As targets, we currently support +CAs, routers, switch external ports, and switch's enhanced port 0. The +names of such specialized parameters are prefixed by "qos__" +string. Here is a full list of the currently supported sets: + + qos_ca_ - QoS configuration parameters set for CAs. + qos_rtr_ - parameters set for routers. + qos_sw0_ - parameters set for switches' port 0. + qos_swe_ - parameters set for switches' external ports. + +Examples: + qos_sw0_max_vls=2 + qos_ca_sl2vl=0,1,2,3,5,5,5,12,12,0, + qos_swe_high_limit=0 + +.SH PREFIX ROUTES +.PP +Prefix routes control how the SA responds to path record queries for +off-subnet DGIDs. By default, the SA fails such queries. +Note that IBA does not specify how the SA should obtain off-subnet path +record information. +The prefix routes configuration is meant as a stop-gap until the +specification is completed. +.PP +Each line in the configuration file is a 64-bit prefix followed by a +64-bit GUID, separated by white space. +The GUID specifies the router port on the local subnet that will +handle the prefix. +Blank lines are ignored, as is anything between a \fB#\fP character +and the end of the line. +The prefix and GUID are both in hex, the leading 0x is optional. +Either, or both, can be wild-carded by specifying an +asterisk instead of an explicit prefix or GUID. +.PP +When responding to a path record query for an off-subnet DGID, +opensm searches for the first prefix match in the configuration file. +Therefore, the order of the lines in the configuration file is important: +a wild-carded prefix at the beginning of the configuration file renders +all subsequent lines useless. +If there is no match, then opensm fails the query. +It is legal to repeat prefixes in the configuration file, +opensm will return the path to the first available matching router. +A configuration file with a single line where both prefix and GUID +are wild-carded means that a path record query specifying any +off-subnet DGID should return a path to the first available router. +This configuration yields the same behaviour formerly achieved by +compiling opensm with -DROUTER_EXP. + +.SH ROUTING +.PP +OpenSM now offers five routing engines: + +1. Min Hop Algorithm - based on the minimum hops to each node where the +path length is optimized. + +2. UPDN Unicast routing algorithm - also based on the minimum hops to each +node, but it is constrained to ranking rules. This algorithm should be chosen +if the subnet is not a pure Fat Tree, and deadlock may occur due to a +loop in the subnet. + +3. Fat Tree Unicast routing algorithm - this algorithm optimizes routing +for congestion-free "shift" communication pattern. +It should be chosen if a subnet is a symmetrical or almost symmetrical +fat-tree of various types, not just K-ary-N-Trees: non-constant K, not +fully staffed, any Constant Bisectional Bandwidth (CBB) ratio. +Similar to UPDN, Fat Tree routing is constrained to ranking rules. + +4. LASH unicast routing algorithm - uses Infiniband virtual layers +(SL) to provide deadlock-free shortest-path routing while also +distributing the paths between layers. LASH is an alternative +deadlock-free topology-agnostic routing algorithm to the non-minimal +UPDN algorithm avoiding the use of a potentially congested root node. + +5. DOR Unicast routing algorithm - based on the Min Hop algorithm, but +avoids port equalization except for redundant links between the same +two switches. This provides deadlock free routes for hypercubes when +the fabric is cabled as a hypercube and for meshes when cabled as a +mesh (see details below). + +OpenSM also supports a file method which +can load routes from a table. See \'Modular Routing Engine\' for more +information on this. + +The basic routing algorithm is comprised of two stages: + +1. MinHop matrix calculation + How many hops are required to get from each port to each LID ? + The algorithm to fill these tables is different if you run standard +(min hop) or Up/Down. + For standard routing, a "relaxation" algorithm is used to propagate +min hop from every destination LID through neighbor switches + For Up/Down routing, a BFS from every target is used. The BFS tracks link +direction (up or down) and avoid steps that will perform up after a down +step was used. + +2. Once MinHop matrices exist, each switch is visited and for each target LID a +decision is made as to what port should be used to get to that LID. + This step is common to standard and Up/Down routing. Each port has a +counter counting the number of target LIDs going through it. + When there are multiple alternative ports with same MinHop to a LID, +the one with less previously assigned ports is selected. + If LMC > 0, more checks are added: Within each group of LIDs assigned to +same target port, + a. use only ports which have same MinHop + b. first prefer the ones that go to different systemImageGuid (then +the previous LID of the same LMC group) + c. if none - prefer those which go through another NodeGuid + d. fall back to the number of paths method (if all go to same node). + +Effect of Topology Changes + +OpenSM will preserve existing routing in any case where there is no change in +the fabric switches unless the -r (--reassign_lids) option is specified. + +-r +.br +--reassign_lids + This option causes OpenSM to reassign LIDs to all + end nodes. Specifying -r on a running subnet + may disrupt subnet traffic. + Without -r, OpenSM attempts to preserve existing + LID assignments resolving multiple use of same LID. + +If a link is added or removed, OpenSM does not recalculate +the routes that do not have to change. A route has to change +if the port is no longer UP or no longer the MinHop. When routing changes +are performed, the same algorithm for balancing the routes is invoked. + +In the case of using the file based routing, any topology changes are +currently ignored The 'file' routing engine just loads the LFTs from the file +specified, with no reaction to real topology. Obviously, this will not be able +to recheck LIDs (by GUID) for disconnected nodes, and LFTs for non-existent +switches will be skipped. Multicast is not affected by 'file' routing engine +(this uses min hop tables). + + +Min Hop Algorithm + +The Min Hop algorithm is invoked by default if no routing algorithm is +specified. It can also be invoked by specifying '-R minhop'. + +The Min Hop algorithm is divided into two stages: computation of +min-hop tables on every switch and LFT output port assignment. Link +subscription is also equalized with the ability to override based on +port GUID. The latter is supplied by: + +-i +.br +-ignore-guids + This option provides the means to define a set of ports + (by guid) that will be ignored by the link load + equalization algorithm. Note that only endports (CA, + switch port 0, and router ports) and not switch external + ports are supported. + +LMC awareness routes based on (remote) system or switch basis. + + +Purpose of UPDN Algorithm + +The UPDN algorithm is designed to prevent deadlocks from occurring in loops +of the subnet. A loop-deadlock is a situation in which it is no longer +possible to send data between any two hosts connected through the loop. As +such, the UPDN routing algorithm should be used if the subnet is not a pure +Fat Tree, and one of its loops may experience a deadlock (due, for example, +to high pressure). + +The UPDN algorithm is based on the following main stages: + +1. Auto-detect root nodes - based on the CA hop length from any switch in +the subnet, a statistical histogram is built for each switch (hop num vs +number of occurrences). If the histogram reflects a specific column (higher +than others) for a certain node, then it is marked as a root node. Since +the algorithm is statistical, it may not find any root nodes. The list of +the root nodes found by this auto-detect stage is used by the ranking +process stage. + + Note 1: The user can override the node list manually. + Note 2: If this stage cannot find any root nodes, and the user did + not specify a guid list file, OpenSM defaults back to the + Min Hop routing algorithm. + +2. Ranking process - All root switch nodes (found in stage 1) are assigned +a rank of 0. Using the BFS algorithm, the rest of the switch nodes in the +subnet are ranked incrementally. This ranking aids in the process of enforcing +rules that ensure loop-free paths. + +3. Min Hop Table setting - after ranking is done, a BFS algorithm is run from +each (CA or switch) node in the subnet. During the BFS process, the FDB table +of each switch node traversed by BFS is updated, in reference to the starting +node, based on the ranking rules and guid values. + +At the end of the process, the updated FDB tables ensure loop-free paths +through the subnet. + +Note: Up/Down routing does not allow LID routing communication between +switches that are located inside spine "switch systems". +The reason is that there is no way to allow a LID route between them +that does not break the Up/Down rule. +One ramification of this is that you cannot run SM on switches other +than the leaf switches of the fabric. + + +UPDN Algorithm Usage + +Activation through OpenSM + +Use '-R updn' option (instead of old '-u') to activate the UPDN algorithm. +Use '-a ' for adding an UPDN guid file that contains the +root nodes for ranking. +If the `-a' option is not used, OpenSM uses its auto-detect root nodes +algorithm. + +Notes on the guid list file: + +1. A valid guid file specifies one guid in each line. Lines with an invalid +format will be discarded. +.br +2. The user should specify the root switch guids. However, it is also +possible to specify CA guids; OpenSM will use the guid of the switch (if +it exists) that connects the CA to the subnet as a root node. + + +Fat-tree Routing Algorithm + +The fat-tree algorithm optimizes routing for "shift" communication pattern. +It should be chosen if a subnet is a symmetrical or almost symmetrical +fat-tree of various types. +It supports not just K-ary-N-Trees, by handling for non-constant K, +cases where not all leafs (CAs) are present, any CBB ratio. +As in UPDN, fat-tree also prevents credit-loop-deadlocks. + +If the root guid file is not provided ('-a' or '--root_guid_file' options), +the topology has to be pure fat-tree that complies with the following rules: + - Tree rank should be between two and eight (inclusively) + - Switches of the same rank should have the same number + of UP-going port groups*, unless they are root switches, + in which case the shouldn't have UP-going ports at all. + - Switches of the same rank should have the same number + of DOWN-going port groups, unless they are leaf switches. + - Switches of the same rank should have the same number + of ports in each UP-going port group. + - Switches of the same rank should have the same number + of ports in each DOWN-going port group. + - All the CAs have to be at the same tree level (rank). + +If the root guid file is provided, the topology doesn't have to be pure +fat-tree, and it should only comply with the following rules: + - Tree rank should be between two and eight (inclusively) + - All the Compute Nodes** have to be at the same tree level (rank). + Note that non-compute node CAs are allowed here to be at different + tree ranks. + +* ports that are connected to the same remote switch are referenced as +\'port group\'. + +** list of compute nodes (CNs) can be specified by \'-u\' or \'--cn_guid_file\' +OpenSM options. + +Topologies that do not comply cause a fallback to min hop routing. +Note that this can also occur on link failures which cause the topology +to no longer be "pure" fat-tree. + +Note that although fat-tree algorithm supports trees with non-integer CBB +ratio, the routing will not be as balanced as in case of integer CBB ratio. +In addition to this, although the algorithm allows leaf switches to have any +number of CAs, the closer the tree is to be fully populated, the more +effective the "shift" communication pattern will be. +In general, even if the root list is provided, the closer the topology to a +pure and symmetrical fat-tree, the more optimal the routing will be. + +The algorithm also dumps compute node ordering file (opensm-ftree-ca-order.dump) +in the same directory where the OpenSM log resides. This ordering file provides +the CN order that may be used to create efficient communication pattern, that +will match the routing tables. + +Activation through OpenSM + +Use '-R ftree' option to activate the fat-tree algorithm. +Use '-a ' to provide root nodes for ranking. If the `-a' option +is not used, routing algorithm will detect roots automatically. +Use '-u ' to provide the list of compute nodes. If the `-u' option +is not used, all the CAs are considered as compute nodes. *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-projects@FreeBSD.ORG Thu Aug 12 15:05:42 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5D1231065670; Thu, 12 Aug 2010 15:05:42 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4C5F08FC0A; Thu, 12 Aug 2010 15:05:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7CF5g7o013878; Thu, 12 Aug 2010 15:05:42 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7CF5gea013876; Thu, 12 Aug 2010 15:05:42 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201008121505.o7CF5gea013876@svn.freebsd.org> From: Attilio Rao Date: Thu, 12 Aug 2010 15:05:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211223 - projects/sv/usr.sbin/netdumpsrv X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Aug 2010 15:05:42 -0000 Author: attilio Date: Thu Aug 12 15:05:41 2010 New Revision: 211223 URL: http://svn.freebsd.org/changeset/base/211223 Log: - Add a couple of fix-up tags - Rename client_ipstr into client_ntoa and implement it in a more 'compliant' way. Modified: projects/sv/usr.sbin/netdumpsrv/netdump_server.c Modified: projects/sv/usr.sbin/netdumpsrv/netdump_server.c ============================================================================== --- projects/sv/usr.sbin/netdumpsrv/netdump_server.c Thu Aug 12 14:16:57 2010 (r211222) +++ projects/sv/usr.sbin/netdumpsrv/netdump_server.c Thu Aug 12 15:05:41 2010 (r211223) @@ -52,6 +52,8 @@ /* Host name length (keep at least as big as INET_ADDRSTRLEN) */ #define MAXHOSTNAMELEN 256 +#define client_ntoa(cl) inet_ntoa((cl)->ip) + struct netdump_client { SLIST_ENTRY(netdump_client) iter; @@ -76,11 +78,6 @@ struct in_addr bindip; struct pidfh *pfh; int sock; -char * client_ipstr(struct netdump_client *client) -{ - return addr2ascii(AF_INET, &client->ip, sizeof(client->ip), NULL); -} - struct netdump_client * alloc_client(struct in_addr *ip) { struct sockaddr_in saddr; @@ -99,7 +96,7 @@ struct netdump_client * alloc_client(str client->sock = -1; client->last_msg = now; - /* Get the hostname */ + /* XXX: To be replaced by getnameinfo(). Get the hostname */ if ((hp = gethostbyaddr((const char *)ip, sizeof(*ip), AF_INET)) == NULL || !hp->h_name || strlen(hp->h_name) == 0) { @@ -157,7 +154,7 @@ struct netdump_client * alloc_client(str free(client); return NULL; } - bufsz=131072; /* Enough to hold approx twice the chunk size. Should be + bufsz=131072; /* XXX: Enough to hold approx twice the chunk size. Should be * plenty for any 1 client. */ if (setsockopt(client->sock, SOL_SOCKET, SO_RCVBUF, &bufsz, sizeof(bufsz))) { @@ -191,6 +188,7 @@ struct netdump_client * alloc_client(str { perror("fdopen"); close(fd); + /* XXX */ unlink(client->infofilename); continue; } @@ -220,7 +218,7 @@ struct netdump_client * alloc_client(str if (!client->infofile || client->corefd == -1) { fprintf(stderr, "Can't create output files for new client %s [%s]\n", - client->hostname, client_ipstr(client)); + client->hostname, client_ntoa(client)); if (client->infofile) { fclose(client->infofile); @@ -267,7 +265,7 @@ void exec_handler(struct netdump_client { close(sock); pidfile_close(pfh); - execl(handler_script, handler_script, reason, client_ipstr(client), + execl(handler_script, handler_script, reason, client_ntoa(client), client->hostname, client->infofilename, client->corefilename, NULL); perror("execl"); @@ -277,7 +275,7 @@ void exec_handler(struct netdump_client void handle_timeout(struct netdump_client *client) { - printf("Client %s timed out\n", client_ipstr(client)); + printf("Client %s timed out\n", client_ntoa(client)); fputs("Dump incomplete: client timed out\n", client->infofile); exec_handler(client, "timeout"); free_client(client); @@ -362,10 +360,10 @@ int handle_herald(struct sockaddr_in *fr } fprintf(client->infofile, "Dump from %s [%s]\n", client->hostname, - client_ipstr(client)); + client_ntoa(client)); printf("New dump from client %s [%s] (to %s)\n", client->hostname, - client_ipstr(client), client->corefilename); + client_ntoa(client), client->corefilename); send_ack(client, msg); @@ -392,7 +390,7 @@ int handle_kdh(struct netdump_client *cl if (msg->hdr.len < sizeof(struct kerneldumpheader)) { fprintf(stderr, "Bad KDH from %s [%s]: packet too small\n", - client->hostname, client_ipstr(client)); + client->hostname, client_ntoa(client)); fputs("Bad KDH: packet too small\n", f); fflush(f); send_ack(client, msg); @@ -423,7 +421,7 @@ int handle_kdh(struct netdump_client *cl fflush(f); fprintf(stdout, "(KDH from %s [%s])", client->hostname, - client_ipstr(client)); + client_ntoa(client)); fflush(stdout); send_ack(client, msg); @@ -450,7 +448,7 @@ int handle_vmcore(struct netdump_client if (pwrite(client->corefd, msg->data, msg->hdr.len, msg->hdr.offset) == -1) { fprintf(stderr, "pwrite (for client %s [%s]): %s\n", client->hostname, - client_ipstr(client), strerror(errno)); + client_ntoa(client), strerror(errno)); fprintf(client->infofile, "Dump unsuccessful: write error at offset %08"PRIx64": %s\n", msg->hdr.offset, strerror(errno)); exec_handler(client, "error"); @@ -472,7 +470,7 @@ int handle_finish(struct netdump_client printf("\nCompleted dump from client %s [%s]\n", client->hostname, - client_ipstr(client)); + client_ntoa(client)); fflush(stdout); fputs("Dump complete\n", client->infofile); From owner-svn-src-projects@FreeBSD.ORG Thu Aug 12 15:12:20 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AF5B910656A6; Thu, 12 Aug 2010 15:12:20 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9F9518FC25; Thu, 12 Aug 2010 15:12:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7CFCKiG015369; Thu, 12 Aug 2010 15:12:20 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7CFCKtq015367; Thu, 12 Aug 2010 15:12:20 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201008121512.o7CFCKtq015367@svn.freebsd.org> From: Attilio Rao Date: Thu, 12 Aug 2010 15:12:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211224 - projects/sv/usr.sbin/netdumpsrv X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Aug 2010 15:12:20 -0000 Author: attilio Date: Thu Aug 12 15:12:20 2010 New Revision: 211224 URL: http://svn.freebsd.org/changeset/base/211224 Log: Remove occurrences of addr2ascii. Just one is left on questionable code that might be stripped away in any case. Modified: projects/sv/usr.sbin/netdumpsrv/netdump_server.c Modified: projects/sv/usr.sbin/netdumpsrv/netdump_server.c ============================================================================== --- projects/sv/usr.sbin/netdumpsrv/netdump_server.c Thu Aug 12 15:05:41 2010 (r211223) +++ projects/sv/usr.sbin/netdumpsrv/netdump_server.c Thu Aug 12 15:12:20 2010 (r211224) @@ -503,8 +503,7 @@ int receive_message(int sock, struct soc return -1; } - snprintf(fromstr, fromstrlen, "%s:%hu", - addr2ascii(AF_INET, &from->sin_addr, sizeof(from->sin_addr), NULL), + snprintf(fromstr, fromstrlen, "%s:%hu", inet_aton(from->sin_addr), ntohs(from->sin_port)); if ((size_t)len < sizeof(struct netdump_msg_hdr)) @@ -756,9 +755,7 @@ int main(int argc, char **argv) fputs("Invalid bind IP specified\n", stderr); return 1; } - printf("Listening on IP %s\n", - addr2ascii(AF_INET, &bindip, - sizeof(bindip), NULL)); + printf("Listening on IP %s\n", inet_aton(bindip)); break; case 2: bindip.s_addr = INADDR_ANY; From owner-svn-src-projects@FreeBSD.ORG Thu Aug 12 15:15:30 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D8501106564A; Thu, 12 Aug 2010 15:15:30 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C88A28FC24; Thu, 12 Aug 2010 15:15:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7CFFU9Z016098; Thu, 12 Aug 2010 15:15:30 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7CFFUqX016096; Thu, 12 Aug 2010 15:15:30 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201008121515.o7CFFUqX016096@svn.freebsd.org> From: Attilio Rao Date: Thu, 12 Aug 2010 15:15:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211225 - projects/sv/usr.sbin/netdumpsrv X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Aug 2010 15:15:30 -0000 Author: attilio Date: Thu Aug 12 15:15:30 2010 New Revision: 211225 URL: http://svn.freebsd.org/changeset/base/211225 Log: Fix the reverse use of inet_aton. Modified: projects/sv/usr.sbin/netdumpsrv/netdump_server.c Modified: projects/sv/usr.sbin/netdumpsrv/netdump_server.c ============================================================================== --- projects/sv/usr.sbin/netdumpsrv/netdump_server.c Thu Aug 12 15:12:20 2010 (r211224) +++ projects/sv/usr.sbin/netdumpsrv/netdump_server.c Thu Aug 12 15:15:30 2010 (r211225) @@ -503,7 +503,7 @@ int receive_message(int sock, struct soc return -1; } - snprintf(fromstr, fromstrlen, "%s:%hu", inet_aton(from->sin_addr), + snprintf(fromstr, fromstrlen, "%s:%hu", inet_ntoa(from->sin_addr), ntohs(from->sin_port)); if ((size_t)len < sizeof(struct netdump_msg_hdr)) @@ -755,7 +755,7 @@ int main(int argc, char **argv) fputs("Invalid bind IP specified\n", stderr); return 1; } - printf("Listening on IP %s\n", inet_aton(bindip)); + printf("Listening on IP %s\n", inet_ntoa(bindip)); break; case 2: bindip.s_addr = INADDR_ANY; From owner-svn-src-projects@FreeBSD.ORG Thu Aug 12 15:46:16 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0FD6510656A9; Thu, 12 Aug 2010 15:46:16 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 003568FC1F; Thu, 12 Aug 2010 15:46:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7CFkFVb022976; Thu, 12 Aug 2010 15:46:15 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7CFkF2o022974; Thu, 12 Aug 2010 15:46:15 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201008121546.o7CFkF2o022974@svn.freebsd.org> From: Attilio Rao Date: Thu, 12 Aug 2010 15:46:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211227 - projects/sv/usr.sbin/netdumpsrv X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Aug 2010 15:46:16 -0000 Author: attilio Date: Thu Aug 12 15:46:15 2010 New Revision: 211227 URL: http://svn.freebsd.org/changeset/base/211227 Log: More ntoa/aton cleanups. Modified: projects/sv/usr.sbin/netdumpsrv/netdump_server.c Modified: projects/sv/usr.sbin/netdumpsrv/netdump_server.c ============================================================================== --- projects/sv/usr.sbin/netdumpsrv/netdump_server.c Thu Aug 12 15:29:07 2010 (r211226) +++ projects/sv/usr.sbin/netdumpsrv/netdump_server.c Thu Aug 12 15:46:15 2010 (r211227) @@ -749,13 +749,13 @@ int main(int argc, char **argv) return 1; } case 3: - if (ascii2addr(AF_INET, argv[2], &bindip) == -1) + if (!inet_aton(argv[2], &bindip)) { pidfile_remove(pfh); fputs("Invalid bind IP specified\n", stderr); return 1; } - printf("Listening on IP %s\n", inet_ntoa(bindip)); + printf("Listening on IP %s\n", argv[2]); break; case 2: bindip.s_addr = INADDR_ANY; From owner-svn-src-projects@FreeBSD.ORG Thu Aug 12 20:03:31 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 86137106566C; Thu, 12 Aug 2010 20:03:31 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 75CBB8FC1C; Thu, 12 Aug 2010 20:03:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7CK3VVl080595; Thu, 12 Aug 2010 20:03:31 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7CK3Vr5080593; Thu, 12 Aug 2010 20:03:31 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201008122003.o7CK3Vr5080593@svn.freebsd.org> From: Attilio Rao Date: Thu, 12 Aug 2010 20:03:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211237 - projects/sv/usr.sbin/netdumpsrv X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Aug 2010 20:03:31 -0000 Author: attilio Date: Thu Aug 12 20:03:31 2010 New Revision: 211237 URL: http://svn.freebsd.org/changeset/base/211237 Log: Avoid use of bogus ntohll(). Modified: projects/sv/usr.sbin/netdumpsrv/netdump_server.c Modified: projects/sv/usr.sbin/netdumpsrv/netdump_server.c ============================================================================== --- projects/sv/usr.sbin/netdumpsrv/netdump_server.c Thu Aug 12 19:50:40 2010 (r211236) +++ projects/sv/usr.sbin/netdumpsrv/netdump_server.c Thu Aug 12 20:03:31 2010 (r211237) @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -516,7 +517,7 @@ int receive_message(int sock, struct soc /* Convert byte order */ msg->hdr.type = ntohl(msg->hdr.type); msg->hdr.seqno = ntohl(msg->hdr.seqno); - msg->hdr.offset = ntohll(msg->hdr.offset); + msg->hdr.offset = be64toh(msg->hdr.offset); msg->hdr.len = ntohl(msg->hdr.len); if ((size_t)len < sizeof(struct netdump_msg_hdr) + msg->hdr.len) From owner-svn-src-projects@FreeBSD.ORG Thu Aug 12 20:04:11 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 60D6C10656A7; Thu, 12 Aug 2010 20:04:11 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5097D8FC16; Thu, 12 Aug 2010 20:04:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7CK4Bjv080797; Thu, 12 Aug 2010 20:04:11 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7CK4BoQ080795; Thu, 12 Aug 2010 20:04:11 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201008122004.o7CK4BoQ080795@svn.freebsd.org> From: Attilio Rao Date: Thu, 12 Aug 2010 20:04:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211238 - projects/sv/usr.sbin/netdumpsrv X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Aug 2010 20:04:11 -0000 Author: attilio Date: Thu Aug 12 20:04:11 2010 New Revision: 211238 URL: http://svn.freebsd.org/changeset/base/211238 Log: Avoid occurrence that will need to be reworked/axed by killing temporarilly. Modified: projects/sv/usr.sbin/netdumpsrv/netdump_server.c Modified: projects/sv/usr.sbin/netdumpsrv/netdump_server.c ============================================================================== --- projects/sv/usr.sbin/netdumpsrv/netdump_server.c Thu Aug 12 20:03:31 2010 (r211237) +++ projects/sv/usr.sbin/netdumpsrv/netdump_server.c Thu Aug 12 20:04:11 2010 (r211238) @@ -101,8 +101,10 @@ struct netdump_client * alloc_client(str if ((hp = gethostbyaddr((const char *)ip, sizeof(*ip), AF_INET)) == NULL || !hp->h_name || strlen(hp->h_name) == 0) { +#if 0 /* Can't resolve; use IP */ addr2ascii(AF_INET, ip, sizeof(*ip), client->hostname); +#endif } else { From owner-svn-src-projects@FreeBSD.ORG Thu Aug 12 20:05:01 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6F3D110656A7; Thu, 12 Aug 2010 20:05:01 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 585C88FC08; Thu, 12 Aug 2010 20:05:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7CK519s080998; Thu, 12 Aug 2010 20:05:01 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7CK51Ki080997; Thu, 12 Aug 2010 20:05:01 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201008122005.o7CK51Ki080997@svn.freebsd.org> From: Attilio Rao Date: Thu, 12 Aug 2010 20:05:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211239 - projects/sv/usr.sbin/netdumpsrv X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Aug 2010 20:05:01 -0000 Author: attilio Date: Thu Aug 12 20:05:01 2010 New Revision: 211239 URL: http://svn.freebsd.org/changeset/base/211239 Log: Temporarilly (before to re-sort appropriately all the headers) fix compilation by moving down the libutil header. Modified: projects/sv/usr.sbin/netdumpsrv/netdump_server.c Modified: projects/sv/usr.sbin/netdumpsrv/netdump_server.c ============================================================================== --- projects/sv/usr.sbin/netdumpsrv/netdump_server.c Thu Aug 12 20:04:11 2010 (r211238) +++ projects/sv/usr.sbin/netdumpsrv/netdump_server.c Thu Aug 12 20:05:01 2010 (r211239) @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include @@ -45,6 +44,7 @@ #include #include #include +#include /* How many dumps to allow per IP before they need to be cleaned out */ #define MAX_DUMPS 256 From owner-svn-src-projects@FreeBSD.ORG Thu Aug 12 20:09:23 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 390051065694; Thu, 12 Aug 2010 20:09:23 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 283338FC0A; Thu, 12 Aug 2010 20:09:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7CK9NWL082044; Thu, 12 Aug 2010 20:09:23 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7CK9N3T082042; Thu, 12 Aug 2010 20:09:23 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201008122009.o7CK9N3T082042@svn.freebsd.org> From: Attilio Rao Date: Thu, 12 Aug 2010 20:09:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211240 - projects/sv/usr.sbin/netdumpsrv X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Aug 2010 20:09:23 -0000 Author: attilio Date: Thu Aug 12 20:09:22 2010 New Revision: 211240 URL: http://svn.freebsd.org/changeset/base/211240 Log: Declare the prototypes of internal functions (and staticize them) in order to compile with WARNS=3. Modified: projects/sv/usr.sbin/netdumpsrv/netdump_server.c Modified: projects/sv/usr.sbin/netdumpsrv/netdump_server.c ============================================================================== --- projects/sv/usr.sbin/netdumpsrv/netdump_server.c Thu Aug 12 20:05:01 2010 (r211239) +++ projects/sv/usr.sbin/netdumpsrv/netdump_server.c Thu Aug 12 20:09:22 2010 (r211240) @@ -79,7 +79,33 @@ struct in_addr bindip; struct pidfh *pfh; int sock; -struct netdump_client * alloc_client(struct in_addr *ip) +static struct netdump_client *alloc_client(struct in_addr *ip); +static void eventloop(void); +static void exec_handler(struct netdump_client *client, + const char *reason); +static void free_client(struct netdump_client *client); +static int handle_finish(struct netdump_client *client, + struct netdump_msg *msg); +static int handle_herald(struct sockaddr_in *from, + struct netdump_client *client, + struct netdump_msg *msg); +static int handle_kdh(struct netdump_client *client, + struct netdump_msg *msg); +static int handle_packet(struct netdump_client *client, + struct sockaddr_in *from, const char *fromstr, + struct netdump_msg *msg); +static void handle_timeout(struct netdump_client *client); +static int handle_vmcore(struct netdump_client *client, + struct netdump_msg *msg); +static int receive_message(int sock, struct sockaddr_in *from, + char *fromstr, size_t fromstrlen, + struct netdump_msg *msg); +static void send_ack(struct netdump_client *client, + struct netdump_msg *msg); +static void signal_shutdown(int sig); +static void timeout_clients(void); + +static struct netdump_client *alloc_client(struct in_addr *ip) { struct sockaddr_in saddr; struct netdump_client *client; @@ -241,7 +267,7 @@ struct netdump_client * alloc_client(str return client; } -void free_client(struct netdump_client *client) +static void free_client(struct netdump_client *client) { /* Remove from the list */ SLIST_REMOVE(&clients, client, netdump_client, iter); @@ -251,7 +277,7 @@ void free_client(struct netdump_client * free(client); } -void exec_handler(struct netdump_client *client, const char *reason) +static void exec_handler(struct netdump_client *client, const char *reason) { int pid=fork(); @@ -276,7 +302,7 @@ void exec_handler(struct netdump_client } } -void handle_timeout(struct netdump_client *client) +static void handle_timeout(struct netdump_client *client) { printf("Client %s timed out\n", client_ntoa(client)); fputs("Dump incomplete: client timed out\n", client->infofile); @@ -284,7 +310,7 @@ void handle_timeout(struct netdump_clien free_client(client); } -void timeout_clients() +static void timeout_clients() { static time_t last_timeout_check; struct netdump_client *client, *tmp; @@ -306,7 +332,7 @@ void timeout_clients() } } -void send_ack(struct netdump_client *client, struct netdump_msg *msg) +static void send_ack(struct netdump_client *client, struct netdump_msg *msg) { struct netdump_ack ack; int tryagain; @@ -335,8 +361,8 @@ void send_ack(struct netdump_client *cli while (tryagain); } -int handle_herald(struct sockaddr_in *from, struct netdump_client *client, - struct netdump_msg *msg) +static int handle_herald(struct sockaddr_in *from, + struct netdump_client *client, struct netdump_msg *msg) { int freed_client=0; @@ -373,7 +399,7 @@ int handle_herald(struct sockaddr_in *fr return freed_client; } -int handle_kdh(struct netdump_client *client, struct netdump_msg *msg) +static int handle_kdh(struct netdump_client *client, struct netdump_msg *msg) { struct kerneldumpheader *h=(void *)msg->data; uint64_t dumplen; @@ -432,7 +458,7 @@ int handle_kdh(struct netdump_client *cl return 0; } -int handle_vmcore(struct netdump_client *client, struct netdump_msg *msg) +static int handle_vmcore(struct netdump_client *client, struct netdump_msg *msg) { if (!client) { @@ -464,7 +490,7 @@ int handle_vmcore(struct netdump_client return 0; } -int handle_finish(struct netdump_client *client, struct netdump_msg *msg) +static int handle_finish(struct netdump_client *client, struct netdump_msg *msg) { if (!client) { @@ -487,7 +513,7 @@ int handle_finish(struct netdump_client } -int receive_message(int sock, struct sockaddr_in *from, char *fromstr, +static int receive_message(int sock, struct sockaddr_in *from, char *fromstr, size_t fromstrlen, struct netdump_msg *msg) { socklen_t fromlen; @@ -532,8 +558,8 @@ int receive_message(int sock, struct soc return len; } -int handle_packet(struct netdump_client *client, struct sockaddr_in *from, - const char *fromstr, struct netdump_msg *msg) +static int handle_packet(struct netdump_client *client, + struct sockaddr_in *from, const char *fromstr, struct netdump_msg *msg) { int freed_client; @@ -565,7 +591,7 @@ int handle_packet(struct netdump_client return freed_client; } -void eventloop() +static void eventloop() { struct netdump_msg msg; @@ -717,7 +743,7 @@ void eventloop() } } -void signal_shutdown(int sig) +static void signal_shutdown(int sig) { do_shutdown=1; } From owner-svn-src-projects@FreeBSD.ORG Thu Aug 12 22:16:38 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1CC7D1065672; Thu, 12 Aug 2010 22:16:38 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0B9498FC20; Thu, 12 Aug 2010 22:16:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7CMGb0s010602; Thu, 12 Aug 2010 22:16:37 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7CMGbBe010599; Thu, 12 Aug 2010 22:16:37 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <201008122216.o7CMGbBe010599@svn.freebsd.org> From: Jeff Roberson Date: Thu, 12 Aug 2010 22:16:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211245 - in projects/ofed/head/contrib/ofed/usr.bin: . saquery X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Aug 2010 22:16:38 -0000 Author: jeff Date: Thu Aug 12 22:16:37 2010 New Revision: 211245 URL: http://svn.freebsd.org/changeset/base/211245 Log: - Enable saquery in the build now that opensm libraries are building. Sponsored by: Isilon Systems, iX Systems, and Panasas. Modified: projects/ofed/head/contrib/ofed/usr.bin/Makefile projects/ofed/head/contrib/ofed/usr.bin/saquery/Makefile Modified: projects/ofed/head/contrib/ofed/usr.bin/Makefile ============================================================================== --- projects/ofed/head/contrib/ofed/usr.bin/Makefile Thu Aug 12 21:21:50 2010 (r211244) +++ projects/ofed/head/contrib/ofed/usr.bin/Makefile Thu Aug 12 22:16:37 2010 (r211245) @@ -1,8 +1,7 @@ .include SUBDIR = ibaddr ibnetdiscover ibping ibportstate ibroute ibsendtrap ibstat -SUBDIR += ibsysstat ibtracert opensm perfquery -# saquery +SUBDIR += ibsysstat ibtracert opensm perfquery saquery SUBDIR += sminfo smpdump smpquery vendstat .include Modified: projects/ofed/head/contrib/ofed/usr.bin/saquery/Makefile ============================================================================== --- projects/ofed/head/contrib/ofed/usr.bin/saquery/Makefile Thu Aug 12 21:21:50 2010 (r211244) +++ projects/ofed/head/contrib/ofed/usr.bin/saquery/Makefile Thu Aug 12 22:16:37 2010 (r211245) @@ -5,7 +5,7 @@ PROG= saquery SRCS= saquery.c ibdiag_common.c -LDADD= -libumad -libcommon -libmad -losmcomp +LDADD= -libumad -libcommon -libmad -losmcomp -losmvendor -lopensm CFLAGS+= -I${DIAGPATH}/include -I${OFEDSYS}/include -I/usr/include/infiniband CFLAGS+= -DOSM_VENDOR_INTF_OPENIB -DVENDOR_RMPP_SUPPORT -DDUAL_SIDED_RMPP CFLAGS+= -pthread From owner-svn-src-projects@FreeBSD.ORG Fri Aug 13 03:03:37 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 74DCD106566C; Fri, 13 Aug 2010 03:03:37 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 49FE98FC1D; Fri, 13 Aug 2010 03:03:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7D33b4K074047; Fri, 13 Aug 2010 03:03:37 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7D33bYt074046; Fri, 13 Aug 2010 03:03:37 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <201008130303.o7D33bYt074046@svn.freebsd.org> From: Jeff Roberson Date: Fri, 13 Aug 2010 03:03:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211253 - projects/ofed/head/sys/ofed/include/linux X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Aug 2010 03:03:37 -0000 Author: jeff Date: Fri Aug 13 03:03:36 2010 New Revision: 211253 URL: http://svn.freebsd.org/changeset/base/211253 Log: - Correct the sense of the bitmap in idr_remove() - Add initialization via sysinit for statically defined irs. Sponsored by: Isilon Systems, iX Systems, and Panasas. Modified: projects/ofed/head/sys/ofed/include/linux/idr.h projects/ofed/head/sys/ofed/include/linux/linux_idr.c Modified: projects/ofed/head/sys/ofed/include/linux/idr.h ============================================================================== --- projects/ofed/head/sys/ofed/include/linux/idr.h Fri Aug 13 00:45:30 2010 (r211252) +++ projects/ofed/head/sys/ofed/include/linux/idr.h Fri Aug 13 03:03:36 2010 (r211253) @@ -29,6 +29,8 @@ #ifndef _LINUX_IDR_H_ #define _LINUX_IDR_H_ +#include + #define IDR_BITS 5 #define IDR_SIZE (1 << IDR_BITS) #define IDR_MASK (IDR_SIZE - 1) @@ -44,13 +46,16 @@ struct idr_layer { }; struct idr { + struct mtx lock; struct idr_layer *top; struct idr_layer *free; int layers; - struct mtx lock; }; -#define DEFINE_IDR(name) struct idr name +#define DEFINE_IDR(name) \ + struct idr name; \ + SYSINIT(name##_idr_sysinit, SI_SUB_DRIVERS, SI_ORDER_FIRST, \ + idr_init, &(name)); void *idr_find(struct idr *idp, int id); int idr_pre_get(struct idr *idp, gfp_t gfp_mask); Modified: projects/ofed/head/sys/ofed/include/linux/linux_idr.c ============================================================================== --- projects/ofed/head/sys/ofed/include/linux/linux_idr.c Fri Aug 13 00:45:30 2010 (r211252) +++ projects/ofed/head/sys/ofed/include/linux/linux_idr.c Fri Aug 13 03:03:36 2010 (r211253) @@ -142,7 +142,7 @@ idr_remove(struct idr *idr, int id) * We could make this non-fatal and unwind but linux dumps a stack * and a warning so I don't think it's necessary. */ - if (il == NULL || (il->bitmap & (1 << idx)) == 0) + if (il == NULL || (il->bitmap & (1 << idx)) != 0) panic("idr_remove: Item %d not allocated (%p, %p)\n", id, idr, il); il->ary[idx] = NULL; @@ -173,7 +173,7 @@ idr_replace(struct idr *idr, void *ptr, /* * Replace still returns an error if the item was not allocated. */ - if (il != NULL && (il->bitmap & (1 << idx)) == 0) { + if (il != NULL && (il->bitmap & (1 << idx)) != 0) { res = il->ary[idx]; il->ary[idx] = ptr; } From owner-svn-src-projects@FreeBSD.ORG Fri Aug 13 03:04:01 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3A95E10656A4; Fri, 13 Aug 2010 03:04:01 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2A07E8FC0A; Fri, 13 Aug 2010 03:04:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7D341HH074152; Fri, 13 Aug 2010 03:04:01 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7D341W8074150; Fri, 13 Aug 2010 03:04:01 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <201008130304.o7D341W8074150@svn.freebsd.org> From: Jeff Roberson Date: Fri, 13 Aug 2010 03:04:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211254 - projects/ofed/head/sys/ofed/include/linux X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Aug 2010 03:04:01 -0000 Author: jeff Date: Fri Aug 13 03:04:00 2010 New Revision: 211254 URL: http://svn.freebsd.org/changeset/base/211254 Log: - Correct the value of 'device' and add 'vendor' to the pci_dev structure. Sponsored by: Isilon Systems, iX Systems, and Panasas. Modified: projects/ofed/head/sys/ofed/include/linux/pci.h Modified: projects/ofed/head/sys/ofed/include/linux/pci.h ============================================================================== --- projects/ofed/head/sys/ofed/include/linux/pci.h Fri Aug 13 03:03:36 2010 (r211253) +++ projects/ofed/head/sys/ofed/include/linux/pci.h Fri Aug 13 03:04:00 2010 (r211254) @@ -108,6 +108,7 @@ struct pci_dev { struct pci_driver *pdrv; uint64_t dma_mask; uint16_t device; + uint16_t vendor; unsigned int irq; }; @@ -377,7 +378,8 @@ linux_pci_attach(device_t dev) pdev = device_get_softc(dev); pdev->dev.parent = &linux_rootdev; pdev->dev.bsddev = dev; - pdev->device = device_get_unit(dev); + pdev->device = id->device; + pdev->vendor = id->vendor; pdev->dev.dma_mask = &pdev->dma_mask; pdev->pdrv = pdrv; kobject_init(&pdev->dev.kobj, &dev_ktype); From owner-svn-src-projects@FreeBSD.ORG Fri Aug 13 03:04:41 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 411BB1065679; Fri, 13 Aug 2010 03:04:41 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 30AE28FC1B; Fri, 13 Aug 2010 03:04:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7D34fbt074352; Fri, 13 Aug 2010 03:04:41 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7D34fe0074350; Fri, 13 Aug 2010 03:04:41 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <201008130304.o7D34fe0074350@svn.freebsd.org> From: Jeff Roberson Date: Fri, 13 Aug 2010 03:04:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211255 - projects/ofed/head/sys/ofed/include/rdma X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Aug 2010 03:04:41 -0000 Author: jeff Date: Fri Aug 13 03:04:40 2010 New Revision: 211255 URL: http://svn.freebsd.org/changeset/base/211255 Log: - Use correct ioctl values, linux does not assume the upper layer copies in arguments. Sponsored by: Isilon Systems, iX Systems, and Panasas. Modified: projects/ofed/head/sys/ofed/include/rdma/ib_user_mad.h Modified: projects/ofed/head/sys/ofed/include/rdma/ib_user_mad.h ============================================================================== --- projects/ofed/head/sys/ofed/include/rdma/ib_user_mad.h Fri Aug 13 03:04:00 2010 (r211254) +++ projects/ofed/head/sys/ofed/include/rdma/ib_user_mad.h Fri Aug 13 03:04:40 2010 (r211255) @@ -193,10 +193,9 @@ struct ib_user_mad_reg_req { #define IB_IOCTL_MAGIC 0x1b -#define IB_USER_MAD_REGISTER_AGENT _IOWR(IB_IOCTL_MAGIC, 1, \ - struct ib_user_mad_reg_req) +#define IB_USER_MAD_REGISTER_AGENT _IO(IB_IOCTL_MAGIC, 1) -#define IB_USER_MAD_UNREGISTER_AGENT _IOW(IB_IOCTL_MAGIC, 2, __u32) +#define IB_USER_MAD_UNREGISTER_AGENT _IO(IB_IOCTL_MAGIC, 2) #define IB_USER_MAD_ENABLE_PKEY _IO(IB_IOCTL_MAGIC, 3) From owner-svn-src-projects@FreeBSD.ORG Fri Aug 13 03:05:27 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 448C31065672; Fri, 13 Aug 2010 03:05:27 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 340818FC17; Fri, 13 Aug 2010 03:05:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7D35Rxl074557; Fri, 13 Aug 2010 03:05:27 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7D35RkI074555; Fri, 13 Aug 2010 03:05:27 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <201008130305.o7D35RkI074555@svn.freebsd.org> From: Jeff Roberson Date: Fri, 13 Aug 2010 03:05:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211256 - projects/ofed/head/sys/ofed/include/rdma X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Aug 2010 03:05:27 -0000 Author: jeff Date: Fri Aug 13 03:05:26 2010 New Revision: 211256 URL: http://svn.freebsd.org/changeset/base/211256 Log: - Use FreeBSD's baudrate definitions from the interface pointer. Sponsored by: Isilon Systems, iX Systems, and Panasas. Modified: projects/ofed/head/sys/ofed/include/rdma/ib_addr.h Modified: projects/ofed/head/sys/ofed/include/rdma/ib_addr.h ============================================================================== --- projects/ofed/head/sys/ofed/include/rdma/ib_addr.h Fri Aug 13 03:04:40 2010 (r211255) +++ projects/ofed/head/sys/ofed/include/rdma/ib_addr.h Fri Aug 13 03:05:26 2010 (r211256) @@ -151,16 +151,16 @@ static inline void iboe_mac_vlan_to_ll(u static inline void iboe_addr_get_sgid(struct rdma_dev_addr *dev_addr, union ib_gid *gid) { - struct net_device *dev; u16 vid = 0; +#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) + struct net_device *dev; dev = dev_get_by_index(&init_net, dev_addr->bound_dev_if); if (dev) { -#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) vid = vlan_dev_vlan_id(dev); -#endif dev_put(dev); } +#endif iboe_mac_vlan_to_ll(gid, dev_addr->src_dev_addr, vid); } @@ -212,6 +212,7 @@ static inline enum ib_mtu iboe_get_mtu(i return 0; } +#ifdef __linux__ static inline int iboe_get_rate(struct net_device *dev) { struct ethtool_cmd cmd; @@ -231,6 +232,21 @@ static inline int iboe_get_rate(struct n else return IB_RATE_PORT_CURRENT; } +#else +static inline int iboe_get_rate(struct net_device *dev) +{ + if (dev->if_baudrate >= IF_Gbps(40ULL)) + return IB_RATE_40_GBPS; + else if (dev->if_baudrate >= IF_Gbps(30ULL)) + return IB_RATE_30_GBPS; + else if (dev->if_baudrate >= IF_Gbps(20ULL)) + return IB_RATE_20_GBPS; + else if (dev->if_baudrate >= IF_Gbps(10ULL)) + return IB_RATE_10_GBPS; + else + return IB_RATE_PORT_CURRENT; +} +#endif static inline int rdma_link_local_addr(struct in6_addr *addr) { From owner-svn-src-projects@FreeBSD.ORG Fri Aug 13 03:06:10 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 232701065697; Fri, 13 Aug 2010 03:06:10 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 12D898FC18; Fri, 13 Aug 2010 03:06:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7D369fS074757; Fri, 13 Aug 2010 03:06:09 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7D369Bo074755; Fri, 13 Aug 2010 03:06:09 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <201008130306.o7D369Bo074755@svn.freebsd.org> From: Jeff Roberson Date: Fri, 13 Aug 2010 03:06:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211257 - projects/ofed/head/sys/ofed/include/rdma X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Aug 2010 03:06:10 -0000 Author: jeff Date: Fri Aug 13 03:06:09 2010 New Revision: 211257 URL: http://svn.freebsd.org/changeset/base/211257 Log: - Always assume umem is compiled in if infiniband is. - Add another parameter to the umem structure for freebsd. We want to know the starting vaddr to undo the mlock(). Sponsored by: Isilon Systems, iX Systems, and Panasas. Modified: projects/ofed/head/sys/ofed/include/rdma/ib_umem.h Modified: projects/ofed/head/sys/ofed/include/rdma/ib_umem.h ============================================================================== --- projects/ofed/head/sys/ofed/include/rdma/ib_umem.h Fri Aug 13 03:05:26 2010 (r211256) +++ projects/ofed/head/sys/ofed/include/rdma/ib_umem.h Fri Aug 13 03:06:09 2010 (r211257) @@ -48,8 +48,12 @@ struct ib_umem { int writable; int hugetlb; struct list_head chunk_list; +#ifdef __linux__ struct work_struct work; struct mm_struct *mm; +#else + unsigned long start; +#endif unsigned long diff; }; @@ -61,25 +65,9 @@ struct ib_umem_chunk { struct scatterlist page_list[0]; }; -#ifdef CONFIG_INFINIBAND_USER_MEM - struct ib_umem *ib_umem_get(struct ib_ucontext *context, unsigned long addr, size_t size, int access, int dmasync); void ib_umem_release(struct ib_umem *umem); int ib_umem_page_count(struct ib_umem *umem); -#else /* CONFIG_INFINIBAND_USER_MEM */ - -#include - -static inline struct ib_umem *ib_umem_get(struct ib_ucontext *context, - unsigned long addr, size_t size, - int access, int dmasync) { - return ERR_PTR(-EINVAL); -} -static inline void ib_umem_release(struct ib_umem *umem) { } -static inline int ib_umem_page_count(struct ib_umem *umem) { return 0; } - -#endif /* CONFIG_INFINIBAND_USER_MEM */ - #endif /* IB_UMEM_H */ From owner-svn-src-projects@FreeBSD.ORG Fri Aug 13 03:08:39 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 513DD106567A; Fri, 13 Aug 2010 03:08:39 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3DD948FC1C; Fri, 13 Aug 2010 03:08:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7D38dtO075334; Fri, 13 Aug 2010 03:08:39 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7D38dv6075317; Fri, 13 Aug 2010 03:08:39 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <201008130308.o7D38dv6075317@svn.freebsd.org> From: Jeff Roberson Date: Fri, 13 Aug 2010 03:08:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211258 - in projects/ofed/head/sys/ofed/drivers: infiniband/core infiniband/hw/mlx4 infiniband/hw/mthca infiniband/ulp/sdp infiniband/ulp/srpt net/mlx4 X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Aug 2010 03:08:39 -0000 Author: jeff Date: Fri Aug 13 03:08:38 2010 New Revision: 211258 URL: http://svn.freebsd.org/changeset/base/211258 Log: Commit changes to the linux code to work with the wrapper layer. - Define our own umem. - iounmap becomes pmap_unmapdev and requires a size argument. We cannot determine the size from the address and must track it seperately. - Some ipoib related address code is #ifdef'd - Some minor changes required for things not statically known at compile time on BSD such as HZ and ilog2 results. Sponsored by: Isilon Systems, iX Systems, and Panasas. Modified: projects/ofed/head/sys/ofed/drivers/infiniband/core/addr.c projects/ofed/head/sys/ofed/drivers/infiniband/core/cm.c projects/ofed/head/sys/ofed/drivers/infiniband/core/cma.c projects/ofed/head/sys/ofed/drivers/infiniband/core/device.c projects/ofed/head/sys/ofed/drivers/infiniband/core/notice.c projects/ofed/head/sys/ofed/drivers/infiniband/core/sa_query.c projects/ofed/head/sys/ofed/drivers/infiniband/core/sysfs.c projects/ofed/head/sys/ofed/drivers/infiniband/core/ucm.c projects/ofed/head/sys/ofed/drivers/infiniband/core/ucma.c projects/ofed/head/sys/ofed/drivers/infiniband/core/umem.c projects/ofed/head/sys/ofed/drivers/infiniband/core/user_mad.c projects/ofed/head/sys/ofed/drivers/infiniband/core/uverbs.h projects/ofed/head/sys/ofed/drivers/infiniband/core/uverbs_cmd.c projects/ofed/head/sys/ofed/drivers/infiniband/core/uverbs_main.c projects/ofed/head/sys/ofed/drivers/infiniband/hw/mlx4/main.c projects/ofed/head/sys/ofed/drivers/infiniband/hw/mlx4/mlx4_ib.h projects/ofed/head/sys/ofed/drivers/infiniband/hw/mlx4/mr.c projects/ofed/head/sys/ofed/drivers/infiniband/hw/mlx4/qp.c projects/ofed/head/sys/ofed/drivers/infiniband/hw/mlx4/srq.c projects/ofed/head/sys/ofed/drivers/infiniband/hw/mlx4/wc.h projects/ofed/head/sys/ofed/drivers/infiniband/hw/mthca/mthca_av.c projects/ofed/head/sys/ofed/drivers/infiniband/hw/mthca/mthca_catas.c projects/ofed/head/sys/ofed/drivers/infiniband/hw/mthca/mthca_cmd.c projects/ofed/head/sys/ofed/drivers/infiniband/hw/mthca/mthca_dev.h projects/ofed/head/sys/ofed/drivers/infiniband/hw/mthca/mthca_eq.c projects/ofed/head/sys/ofed/drivers/infiniband/hw/mthca/mthca_main.c projects/ofed/head/sys/ofed/drivers/infiniband/hw/mthca/mthca_memfree.c projects/ofed/head/sys/ofed/drivers/infiniband/hw/mthca/mthca_mr.c projects/ofed/head/sys/ofed/drivers/infiniband/hw/mthca/mthca_provider.c projects/ofed/head/sys/ofed/drivers/infiniband/hw/mthca/mthca_reset.c projects/ofed/head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c projects/ofed/head/sys/ofed/drivers/infiniband/ulp/srpt/ib_srpt.c projects/ofed/head/sys/ofed/drivers/net/mlx4/alloc.c projects/ofed/head/sys/ofed/drivers/net/mlx4/catas.c projects/ofed/head/sys/ofed/drivers/net/mlx4/cmd.c projects/ofed/head/sys/ofed/drivers/net/mlx4/en_resources.c projects/ofed/head/sys/ofed/drivers/net/mlx4/eq.c projects/ofed/head/sys/ofed/drivers/net/mlx4/fw.h projects/ofed/head/sys/ofed/drivers/net/mlx4/icm.h projects/ofed/head/sys/ofed/drivers/net/mlx4/main.c projects/ofed/head/sys/ofed/drivers/net/mlx4/mlx4.h projects/ofed/head/sys/ofed/drivers/net/mlx4/mr.c projects/ofed/head/sys/ofed/drivers/net/mlx4/reset.c projects/ofed/head/sys/ofed/drivers/net/mlx4/srq.c Modified: projects/ofed/head/sys/ofed/drivers/infiniband/core/addr.c ============================================================================== --- projects/ofed/head/sys/ofed/drivers/infiniband/core/addr.c Fri Aug 13 03:06:09 2010 (r211257) +++ projects/ofed/head/sys/ofed/drivers/infiniband/core/addr.c Fri Aug 13 03:08:38 2010 (r211258) @@ -65,7 +65,7 @@ static void process_req(struct work_stru static DEFINE_MUTEX(lock); static LIST_HEAD(req_list); -static DECLARE_DELAYED_WORK(work, process_req); +static struct delayed_work work; static struct workqueue_struct *addr_wq; void rdma_addr_register_client(struct rdma_addr_client *client) @@ -88,6 +88,7 @@ void rdma_addr_unregister_client(struct } EXPORT_SYMBOL(rdma_addr_unregister_client); +#ifdef __linux__ int rdma_copy_addr(struct rdma_dev_addr *dev_addr, struct net_device *dev, const unsigned char *dst_dev_addr) { @@ -99,6 +100,20 @@ int rdma_copy_addr(struct rdma_dev_addr dev_addr->bound_dev_if = dev->ifindex; return 0; } +#else +int rdma_copy_addr(struct rdma_dev_addr *dev_addr, struct ifnet *dev, + const unsigned char *dst_dev_addr) +{ + dev_addr->dev_type = dev->if_type; + memcpy(dev_addr->src_dev_addr, IF_LLADDR(dev), MAX_ADDR_LEN); + memcpy(dev_addr->broadcast, __DECONST(char *, dev->if_broadcastaddr), + MAX_ADDR_LEN); + if (dst_dev_addr) + memcpy(dev_addr->dst_dev_addr, dst_dev_addr, MAX_ADDR_LEN); + dev_addr->bound_dev_if = dev->if_index; + return 0; +} +#endif EXPORT_SYMBOL(rdma_copy_addr); int rdma_translate_ip(struct sockaddr *addr, struct rdma_dev_addr *dev_addr) @@ -176,6 +191,7 @@ static void queue_req(struct addr_req *r mutex_unlock(&lock); } +#ifdef __linux__ static int addr4_resolve(struct sockaddr_in *src_in, struct sockaddr_in *dst_in, struct rdma_dev_addr *addr) @@ -293,6 +309,23 @@ static int addr6_resolve(struct sockaddr } #endif +#else + +static int addr6_resolve(struct sockaddr_in6 *src_in, + struct sockaddr_in6 *dst_in, + struct rdma_dev_addr *addr) +{ + return -EADDRNOTAVAIL; +} + +static int addr4_resolve(struct sockaddr_in *src_in, + struct sockaddr_in *dst_in, + struct rdma_dev_addr *addr) +{ + /* XXX This will have to be filled in after ipoib is functional. */ + return -EADDRNOTAVAIL; +} + static int addr_resolve(struct sockaddr *src_in, struct sockaddr *dst_in, struct rdma_dev_addr *addr) @@ -305,6 +338,8 @@ static int addr_resolve(struct sockaddr (struct sockaddr_in6 *) dst_in, addr); } +#endif + static void process_req(struct work_struct *work) { struct addr_req *req, *temp_req; @@ -418,6 +453,7 @@ void rdma_addr_cancel(struct rdma_dev_ad } EXPORT_SYMBOL(rdma_addr_cancel); +#ifdef __linux__ static int netevent_callback(struct notifier_block *self, unsigned long event, void *ctx) { @@ -434,20 +470,26 @@ static int netevent_callback(struct noti static struct notifier_block nb = { .notifier_call = netevent_callback }; +#endif static int addr_init(void) { + INIT_DELAYED_WORK(&work, process_req); addr_wq = create_singlethread_workqueue("ib_addr"); if (!addr_wq) return -ENOMEM; +#ifdef __linux__ register_netevent_notifier(&nb); +#endif return 0; } static void addr_cleanup(void) { +#ifdef __linux__ unregister_netevent_notifier(&nb); +#endif destroy_workqueue(addr_wq); } Modified: projects/ofed/head/sys/ofed/drivers/infiniband/core/cm.c ============================================================================== --- projects/ofed/head/sys/ofed/drivers/infiniband/core/cm.c Fri Aug 13 03:06:09 2010 (r211257) +++ projects/ofed/head/sys/ofed/drivers/infiniband/core/cm.c Fri Aug 13 03:08:38 2010 (r211258) @@ -3890,6 +3890,6 @@ static void __exit ib_cm_cleanup(void) idr_destroy(&cm.local_id_table); } -module_init(ib_cm_init); +module_init_order(ib_cm_init, SI_ORDER_SECOND); module_exit(ib_cm_cleanup); Modified: projects/ofed/head/sys/ofed/drivers/infiniband/core/cma.c ============================================================================== --- projects/ofed/head/sys/ofed/drivers/infiniband/core/cma.c Fri Aug 13 03:06:09 2010 (r211257) +++ projects/ofed/head/sys/ofed/drivers/infiniband/core/cma.c Fri Aug 13 03:08:38 2010 (r211258) @@ -1679,6 +1679,7 @@ out: kfree(work); } +#ifdef __linux__ static void cma_ndev_work_handler(struct work_struct *_work) { struct cma_ndev_work *work = container_of(_work, struct cma_ndev_work, work); @@ -1702,6 +1703,7 @@ out: rdma_destroy_id(&id_priv->id); kfree(work); } +#endif static int cma_resolve_ib_route(struct rdma_id_private *id_priv, int timeout_ms) { @@ -1833,7 +1835,11 @@ static int cma_resolve_iboe_route(struct route->path_rec->mtu_selector = IB_SA_EQ; route->path_rec->sl = tos_to_sl(id_priv->tos); +#ifdef __linux__ route->path_rec->mtu = iboe_get_mtu(ndev->mtu); +#else + route->path_rec->mtu = iboe_get_mtu(ndev->if_mtu); +#endif route->path_rec->rate_selector = IB_SA_EQ; route->path_rec->rate = iboe_get_rate(ndev); dev_put(ndev); @@ -2184,8 +2190,10 @@ static int cma_use_port(struct idr *ps, sin = (struct sockaddr_in *) &id_priv->id.route.addr.src_addr; snum = ntohs(sin->sin_port); +#ifdef __linux__ if (snum < PROT_SOCK && !capable(CAP_NET_BIND_SERVICE)) return -EACCES; +#endif bind_list = idr_find(ps, snum); if (!bind_list) @@ -2220,15 +2228,21 @@ static int cma_get_tcp_port(struct rdma_ ret = sock_create_kern(AF_INET, SOCK_STREAM, IPPROTO_TCP, &sock); if (ret) return ret; +#ifdef __linux__ ret = sock->ops->bind(sock, (struct sockaddr *) &id_priv->id.route.addr.src_addr, ip_addr_size((struct sockaddr *) &id_priv->id.route.addr.src_addr)); +#else + ret = -sobind(sock, + (struct sockaddr *)&id_priv->id.route.addr.src_addr, + curthread); +#endif if (ret) { sock_release(sock); return ret; } size = ip_addr_size((struct sockaddr *) &id_priv->id.route.addr.src_addr); - ret = sock->ops->getname(sock, + ret = sock_getname(sock, (struct sockaddr *) &id_priv->id.route.addr.src_addr, &size, 0); if (ret) { @@ -3046,7 +3060,11 @@ static int cma_iboe_join_multicast(struc mc->multicast.ib->rec.rate = iboe_get_rate(ndev); mc->multicast.ib->rec.hop_limit = 1; +#ifdef __linux__ mc->multicast.ib->rec.mtu = iboe_get_mtu(ndev->mtu); +#else + mc->multicast.ib->rec.mtu = iboe_get_mtu(ndev->if_mtu); +#endif dev_put(ndev); if (!mc->multicast.ib->rec.mtu) { err = -EINVAL; @@ -3158,6 +3176,7 @@ void rdma_leave_multicast(struct rdma_cm } EXPORT_SYMBOL(rdma_leave_multicast); +#ifdef __linux__ static int cma_netdev_change(struct net_device *ndev, struct rdma_id_private *id_priv) { struct rdma_dev_addr *dev_addr; @@ -3216,6 +3235,7 @@ out: static struct notifier_block cma_nb = { .notifier_call = cma_netdev_callback }; +#endif static void cma_add_one(struct ib_device *device) { @@ -3325,7 +3345,9 @@ static int cma_init(void) ib_sa_register_client(&sa_client); rdma_addr_register_client(&addr_client); +#ifdef __linux__ register_netdevice_notifier(&cma_nb); +#endif ret = ib_register_client(&cma_client); if (ret) @@ -3333,7 +3355,9 @@ static int cma_init(void) return 0; err: +#ifdef __linux__ unregister_netdevice_notifier(&cma_nb); +#endif rdma_addr_unregister_client(&addr_client); ib_sa_unregister_client(&sa_client); destroy_workqueue(cma_wq); @@ -3343,7 +3367,9 @@ err: static void cma_cleanup(void) { ib_unregister_client(&cma_client); +#ifdef __linux__ unregister_netdevice_notifier(&cma_nb); +#endif rdma_addr_unregister_client(&addr_client); ib_sa_unregister_client(&sa_client); destroy_workqueue(cma_wq); Modified: projects/ofed/head/sys/ofed/drivers/infiniband/core/device.c ============================================================================== --- projects/ofed/head/sys/ofed/drivers/infiniband/core/device.c Fri Aug 13 03:06:09 2010 (r211257) +++ projects/ofed/head/sys/ofed/drivers/infiniband/core/device.c Fri Aug 13 03:08:38 2010 (r211258) @@ -100,7 +100,7 @@ static int ib_device_check_mandatory(str int i; for (i = 0; i < ARRAY_SIZE(mandatory_table); ++i) { - if (!*(void **) ((void *) device + mandatory_table[i].offset)) { + if (!*(void **) ((u_char *) device + mandatory_table[i].offset)) { printk(KERN_WARNING "Device %s is missing mandatory function %s\n", device->name, mandatory_table[i].name); return -EINVAL; Modified: projects/ofed/head/sys/ofed/drivers/infiniband/core/notice.c ============================================================================== --- projects/ofed/head/sys/ofed/drivers/infiniband/core/notice.c Fri Aug 13 03:06:09 2010 (r211257) +++ projects/ofed/head/sys/ofed/drivers/infiniband/core/notice.c Fri Aug 13 03:08:38 2010 (r211258) @@ -669,7 +669,7 @@ static void inform_add_one(struct ib_dev if (rdma_node_get_transport(device->node_type) != RDMA_TRANSPORT_IB) return; - dev = kmalloc(sizeof *dev + device->phys_port_cnt * sizeof *port, + dev = kzalloc(sizeof *dev + device->phys_port_cnt * sizeof *port, GFP_KERNEL); if (!dev) return; Modified: projects/ofed/head/sys/ofed/drivers/infiniband/core/sa_query.c ============================================================================== --- projects/ofed/head/sys/ofed/drivers/infiniband/core/sa_query.c Fri Aug 13 03:06:09 2010 (r211257) +++ projects/ofed/head/sys/ofed/drivers/infiniband/core/sa_query.c Fri Aug 13 03:08:38 2010 (r211258) @@ -1474,5 +1474,5 @@ static void __exit ib_sa_cleanup(void) idr_destroy(&query_idr); } -module_init(ib_sa_init); +module_init_order(ib_sa_init, SI_ORDER_SECOND); module_exit(ib_sa_cleanup); Modified: projects/ofed/head/sys/ofed/drivers/infiniband/core/sysfs.c ============================================================================== --- projects/ofed/head/sys/ofed/drivers/infiniband/core/sysfs.c Fri Aug 13 03:06:09 2010 (r211257) +++ projects/ofed/head/sys/ofed/drivers/infiniband/core/sysfs.c Fri Aug 13 03:08:38 2010 (r211258) @@ -265,12 +265,15 @@ static ssize_t show_port_gid(struct ib_p container_of(attr, struct port_table_attribute, attr); union ib_gid gid; ssize_t ret; + u16 *raw; ret = ib_query_gid(p->ibdev, p->port_num, tab_attr->index, &gid); if (ret) return ret; - return sprintf(buf, "%pI6\n", gid.raw); + raw = (u16 *)gid.raw; + return sprintf(buf, "%.4x:%.4x:%.4x:%.4x:%.4x:%.4x:%.4x:%.4x\n", + raw[0], raw[1], raw[2], raw[3], raw[4], raw[5], raw[6], raw[7]); } static ssize_t show_port_pkey(struct ib_port *p, struct port_attribute *attr, @@ -439,6 +442,7 @@ static void ib_device_release(struct dev kfree(dev); } +#ifdef __linux__ static int ib_device_uevent(struct device *device, struct kobj_uevent_env *env) { @@ -453,6 +457,7 @@ static int ib_device_uevent(struct devic return 0; } +#endif static struct attribute ** alloc_group_attrs(ssize_t (*show)(struct ib_port *, @@ -545,7 +550,9 @@ static int add_port(struct ib_device *de list_add_tail(&p->kobj.entry, &device->port_list); +#ifdef __linux__ kobject_uevent(&p->kobj, KOBJ_ADD); +#endif return 0; err_free_pkey: @@ -658,7 +665,9 @@ static struct device_attribute *ib_class static struct class ib_class = { .name = "infiniband", .dev_release = ib_device_release, +#ifdef __linux__ .dev_uevent = ib_device_uevent, +#endif }; /* Show a given an attribute in the statistics group */ @@ -666,7 +675,7 @@ static ssize_t show_protocol_stat(const struct device_attribute *attr, char *buf, unsigned offset) { - struct ib_device *dev = container_of(device, struct ib_device, dev); + struct ib_device *dev = container_of(__DECONST(struct device *, device), struct ib_device, dev); union rdma_protocol_stats stats; ssize_t ret; Modified: projects/ofed/head/sys/ofed/drivers/infiniband/core/ucm.c ============================================================================== --- projects/ofed/head/sys/ofed/drivers/infiniband/core/ucm.c Fri Aug 13 03:06:09 2010 (r211257) +++ projects/ofed/head/sys/ofed/drivers/infiniband/core/ucm.c Fri Aug 13 03:08:38 2010 (r211258) @@ -380,6 +380,8 @@ static int ib_ucm_event_handler(struct i list_add_tail(&uevent->file_list, &ctx->file->events); list_add_tail(&uevent->ctx_list, &ctx->events); wake_up_interruptible(&ctx->file->poll_wait); + if (ctx->file->filp) + selwakeup(&ctx->file->filp->f_selinfo); mutex_unlock(&ctx->file->file_mutex); return 0; @@ -1165,7 +1167,7 @@ static int ib_ucm_open(struct inode *ino { struct ib_ucm_file *file; - file = kmalloc(sizeof(*file), GFP_KERNEL); + file = kzalloc(sizeof(*file), GFP_KERNEL); if (!file) return -ENOMEM; @@ -1177,7 +1179,7 @@ static int ib_ucm_open(struct inode *ino filp->private_data = file; file->filp = filp; - file->device = container_of(inode->i_cdev, struct ib_ucm_device, cdev); + file->device = container_of(inode->i_cdev->si_drv1, struct ib_ucm_device, cdev); return 0; } @@ -1342,5 +1344,5 @@ static void __exit ib_ucm_cleanup(void) idr_destroy(&ctx_id_table); } -module_init(ib_ucm_init); +module_init_order(ib_ucm_init, SI_ORDER_THIRD); module_exit(ib_ucm_cleanup); Modified: projects/ofed/head/sys/ofed/drivers/infiniband/core/ucma.c ============================================================================== --- projects/ofed/head/sys/ofed/drivers/infiniband/core/ucma.c Fri Aug 13 03:06:09 2010 (r211257) +++ projects/ofed/head/sys/ofed/drivers/infiniband/core/ucma.c Fri Aug 13 03:08:38 2010 (r211258) @@ -284,6 +284,8 @@ static int ucma_event_handler(struct rdm list_add_tail(&uevent->list, &ctx->file->event_list); wake_up_interruptible(&ctx->file->poll_wait); + if (ctx->file->filp) + selwakeup(&ctx->file->filp->f_selinfo); out: mutex_unlock(&ctx->file->mut); return ret; @@ -585,20 +587,22 @@ static void ucma_copy_iboe_route(struct struct rdma_route *route) { struct rdma_dev_addr *dev_addr; +#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) struct net_device *dev; +#endif u16 vid = 0; resp->num_paths = route->num_paths; switch (route->num_paths) { case 0: dev_addr = &route->addr.dev_addr; +#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) dev = dev_get_by_index(&init_net, dev_addr->bound_dev_if); if (dev) { -#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) vid = vlan_dev_vlan_id(dev); -#endif dev_put(dev); } +#endif iboe_mac_vlan_to_ll((union ib_gid *) &resp->ib_route[0].dgid, dev_addr->dst_dev_addr, vid); @@ -1250,7 +1254,7 @@ static int ucma_open(struct inode *inode { struct ucma_file *file; - file = kmalloc(sizeof *file, GFP_KERNEL); + file = kzalloc(sizeof *file, GFP_KERNEL); if (!file) return -ENOMEM; Modified: projects/ofed/head/sys/ofed/drivers/infiniband/core/umem.c ============================================================================== --- projects/ofed/head/sys/ofed/drivers/infiniband/core/umem.c Fri Aug 13 03:06:09 2010 (r211257) +++ projects/ofed/head/sys/ofed/drivers/infiniband/core/umem.c Fri Aug 13 03:08:38 2010 (r211258) @@ -35,9 +35,20 @@ #include #include #include +#ifdef __linux__ #include +#endif #include +#include +#include +#include + +#include +#include +#include + + #include "uverbs.h" static int allow_weak_ordering; @@ -108,11 +119,12 @@ static void __ib_umem_release(struct ib_ ib_dma_unmap_sg_attrs(dev, chunk->page_list, chunk->nents, DMA_BIDIRECTIONAL, &chunk->attrs); for (i = 0; i < chunk->nents; ++i) { +#ifdef __linux__ struct page *page = sg_page(&chunk->page_list[i]); - if (umem->writable && dirty) set_page_dirty_lock(page); put_page(page); +#endif } kfree(chunk); @@ -130,6 +142,7 @@ static void __ib_umem_release(struct ib_ struct ib_umem *ib_umem_get(struct ib_ucontext *context, unsigned long addr, size_t size, int access, int dmasync) { +#ifdef __linux__ struct ib_umem *umem; struct page **page_list; struct vm_area_struct **vma_list; @@ -148,7 +161,6 @@ struct ib_umem *ib_umem_get(struct ib_uc else if (allow_weak_ordering) dma_set_attr(DMA_ATTR_WEAK_ORDERING, &attrs); - if (!can_do_mlock()) return ERR_PTR(-EPERM); @@ -203,6 +215,7 @@ struct ib_umem *ib_umem_get(struct ib_uc cur_base = addr & PAGE_MASK; ret = 0; + while (npages) { ret = get_user_pages(current, current->mm, cur_base, min_t(unsigned long, npages, @@ -271,9 +284,127 @@ out: free_page((unsigned long) page_list); return ret < 0 ? ERR_PTR(ret) : umem; +#else + struct ib_umem *umem; + struct ib_umem_chunk *chunk; + struct proc *proc; + pmap_t pmap; + vm_offset_t end, last, start; + vm_size_t npages; + int error; + int ents; + int ret; + int i; + DEFINE_DMA_ATTRS(attrs); + + error = priv_check(curthread, PRIV_VM_MLOCK); + if (error) + return ERR_PTR(-error); + + last = addr + size; + start = addr & PAGE_MASK; /* Use the linux PAGE_MASK definition. */ + end = roundup2(last, PAGE_SIZE); /* Use PAGE_MASK safe operation. */ + if (last < addr || end < addr) + return ERR_PTR(-EINVAL); + npages = atop(end - start); + if (npages > vm_page_max_wired) + return ERR_PTR(-ENOMEM); + umem = kzalloc(sizeof *umem, GFP_KERNEL); + if (!umem) + return ERR_PTR(-ENOMEM); + proc = curthread->td_proc; + PROC_LOCK(proc); + if (ptoa(npages + + pmap_wired_count(vm_map_pmap(&proc->p_vmspace->vm_map))) > + lim_cur(proc, RLIMIT_MEMLOCK)) { + PROC_UNLOCK(proc); + kfree(umem); + return ERR_PTR(-ENOMEM); + } + PROC_UNLOCK(proc); + if (npages + cnt.v_wire_count > vm_page_max_wired) { + kfree(umem); + return ERR_PTR(-EAGAIN); + } + error = vm_map_wire(&proc->p_vmspace->vm_map, start, end, + VM_MAP_WIRE_USER | VM_MAP_WIRE_NOHOLES); + if (error != KERN_SUCCESS) { + kfree(umem); + return ERR_PTR(-ENOMEM); + } + + umem->context = context; + umem->length = size; + umem->offset = addr & ~PAGE_MASK; + umem->page_size = PAGE_SIZE; + umem->start = addr; + /* + * We ask for writable memory if any access flags other than + * "remote read" are set. "Local write" and "remote write" + * obviously require write access. "Remote atomic" can do + * things like fetch and add, which will modify memory, and + * "MW bind" can change permissions by binding a window. + */ + umem->writable = !!(access & ~IB_ACCESS_REMOTE_READ); + umem->hugetlb = 0; + INIT_LIST_HEAD(&umem->chunk_list); + + pmap = vm_map_pmap(&proc->p_vmspace->vm_map); + ret = 0; + while (npages) { + ents = min_t(int, npages, IB_UMEM_MAX_PAGE_CHUNK); + chunk = kmalloc(sizeof(*chunk) + + (sizeof(struct scatterlist) * ents), + GFP_KERNEL); + if (!chunk) { + ret = -ENOMEM; + goto out; + } + + chunk->attrs = attrs; + chunk->nents = ents; + sg_init_table(&chunk->page_list[0], ents); + for (i = 0; i < chunk->nents; ++i) { + vm_paddr_t pa; + + pa = pmap_extract(pmap, start); + if (pa == 0) { + ret = -ENOMEM; + kfree(chunk); + goto out; + } + sg_set_page(&chunk->page_list[i], PHYS_TO_VM_PAGE(pa), + PAGE_SIZE, 0); + npages--; + start += PAGE_SIZE; + } + + chunk->nmap = ib_dma_map_sg_attrs(context->device, + &chunk->page_list[0], + chunk->nents, + DMA_BIDIRECTIONAL, + &attrs); + if (chunk->nmap != chunk->nents) { + kfree(chunk); + ret = -ENOMEM; + goto out; + } + + list_add_tail(&chunk->list, &umem->chunk_list); + } + +out: + if (ret < 0) { + __ib_umem_release(context->device, umem, 0); + kfree(umem); + } + + return ret < 0 ? ERR_PTR(ret) : umem; +#endif } EXPORT_SYMBOL(ib_umem_get); +#ifdef __linux__ static void ib_umem_account(struct work_struct *work) { struct ib_umem *umem = container_of(work, struct ib_umem, work); @@ -284,6 +415,7 @@ static void ib_umem_account(struct work_ mmput(umem->mm); kfree(umem); } +#endif /** * ib_umem_release - release memory pinned with ib_umem_get @@ -291,6 +423,7 @@ static void ib_umem_account(struct work_ */ void ib_umem_release(struct ib_umem *umem) { +#ifdef __linux__ struct ib_ucontext *context = umem->context; struct mm_struct *mm; unsigned long diff; @@ -328,6 +461,29 @@ void ib_umem_release(struct ib_umem *ume current->mm->locked_vm -= diff; up_write(&mm->mmap_sem); mmput(mm); +#else + vm_offset_t addr, end, last, start; + vm_size_t size; + int error; + + __ib_umem_release(umem->context->device, umem, 1); + + if (umem->context->closing) { + kfree(umem); + return; + } + error = priv_check(curthread, PRIV_VM_MUNLOCK); + if (error) + return; + addr = umem->start; + size = umem->length; + last = addr + size; + start = addr & PAGE_MASK; /* Use the linux PAGE_MASK definition. */ + end = roundup2(last, PAGE_SIZE); /* Use PAGE_MASK safe operation. */ + vm_map_unwire(&curthread->td_proc->p_vmspace->vm_map, start, end, + VM_MAP_WIRE_USER | VM_MAP_WIRE_NOHOLES); + +#endif kfree(umem); } EXPORT_SYMBOL(ib_umem_release); Modified: projects/ofed/head/sys/ofed/drivers/infiniband/core/user_mad.c ============================================================================== --- projects/ofed/head/sys/ofed/drivers/infiniband/core/user_mad.c Fri Aug 13 03:06:09 2010 (r211257) +++ projects/ofed/head/sys/ofed/drivers/infiniband/core/user_mad.c Fri Aug 13 03:08:38 2010 (r211258) @@ -678,7 +678,7 @@ found: file->already_used = 1; if (!file->use_pkey_index) { printk(KERN_WARNING "user_mad: process %s did not enable " - "P_Key index support.\n", current->comm); + "P_Key index support.\n", curproc->p_comm); printk(KERN_WARNING "user_mad: Documentation/infiniband/user_mad.txt " "has info on the new ABI.\n"); } Modified: projects/ofed/head/sys/ofed/drivers/infiniband/core/uverbs.h ============================================================================== --- projects/ofed/head/sys/ofed/drivers/infiniband/core/uverbs.h Fri Aug 13 03:06:09 2010 (r211257) +++ projects/ofed/head/sys/ofed/drivers/infiniband/core/uverbs.h Fri Aug 13 03:08:38 2010 (r211258) @@ -79,6 +79,7 @@ struct ib_uverbs_device { struct ib_uverbs_event_file { struct kref ref; + struct file *filp; struct ib_uverbs_file *uverbs_file; spinlock_t lock; wait_queue_head_t poll_wait; Modified: projects/ofed/head/sys/ofed/drivers/infiniband/core/uverbs_cmd.c ============================================================================== --- projects/ofed/head/sys/ofed/drivers/infiniband/core/uverbs_cmd.c Fri Aug 13 03:06:09 2010 (r211257) +++ projects/ofed/head/sys/ofed/drivers/infiniband/core/uverbs_cmd.c Fri Aug 13 03:08:38 2010 (r211258) @@ -498,7 +498,7 @@ ssize_t ib_uverbs_alloc_pd(struct ib_uve (unsigned long) cmd.response + sizeof resp, in_len - sizeof cmd, out_len - sizeof resp); - uobj = kmalloc(sizeof *uobj, GFP_KERNEL); + uobj = kzalloc(sizeof *uobj, GFP_KERNEL); if (!uobj) return -ENOMEM; @@ -619,7 +619,7 @@ ssize_t ib_uverbs_reg_mr(struct ib_uverb !(cmd.access_flags & IB_ACCESS_LOCAL_WRITE)) return -EINVAL; - uobj = kmalloc(sizeof *uobj, GFP_KERNEL); + uobj = kzalloc(sizeof *uobj, GFP_KERNEL); if (!uobj) return -ENOMEM; @@ -779,7 +779,7 @@ ssize_t ib_uverbs_create_cq(struct ib_uv if (cmd.comp_vector >= file->device->num_comp_vectors) return -EINVAL; - obj = kmalloc(sizeof *obj, GFP_KERNEL); + obj = kzalloc(sizeof *obj, GFP_KERNEL); if (!obj) return -ENOMEM; @@ -1057,7 +1057,7 @@ ssize_t ib_uverbs_create_qp(struct ib_uv (unsigned long) cmd.response + sizeof resp, in_len - sizeof cmd, out_len - sizeof resp); - obj = kmalloc(sizeof *obj, GFP_KERNEL); + obj = kzalloc(sizeof *obj, GFP_KERNEL); if (!obj) return -ENOMEM; @@ -1784,7 +1784,7 @@ ssize_t ib_uverbs_create_ah(struct ib_uv if (copy_from_user(&cmd, buf, sizeof cmd)) return -EFAULT; - uobj = kmalloc(sizeof *uobj, GFP_KERNEL); + uobj = kzalloc(sizeof *uobj, GFP_KERNEL); if (!uobj) return -ENOMEM; @@ -2031,7 +2031,7 @@ ssize_t ib_uverbs_create_srq(struct ib_u (unsigned long) cmd.response + sizeof resp, in_len - sizeof cmd, out_len - sizeof resp); - obj = kmalloc(sizeof *obj, GFP_KERNEL); + obj = kzalloc(sizeof *obj, GFP_KERNEL); if (!obj) return -ENOMEM; @@ -2137,7 +2137,7 @@ ssize_t ib_uverbs_create_xrc_srq(struct (unsigned long) cmd.response + sizeof resp, in_len - sizeof cmd, out_len - sizeof resp); - obj = kmalloc(sizeof *obj, GFP_KERNEL); + obj = kzalloc(sizeof *obj, GFP_KERNEL); if (!obj) return -ENOMEM; @@ -2507,7 +2507,7 @@ ssize_t ib_uverbs_open_xrc_domain(struct } } - xrcd_uobj = kmalloc(sizeof *xrcd_uobj, GFP_KERNEL); + xrcd_uobj = kzalloc(sizeof *xrcd_uobj, GFP_KERNEL); if (!xrcd_uobj) { ret = -ENOMEM; goto err_table_mutex_unlock; Modified: projects/ofed/head/sys/ofed/drivers/infiniband/core/uverbs_main.c ============================================================================== --- projects/ofed/head/sys/ofed/drivers/infiniband/core/uverbs_main.c Fri Aug 13 03:06:09 2010 (r211257) +++ projects/ofed/head/sys/ofed/drivers/infiniband/core/uverbs_main.c Fri Aug 13 03:08:38 2010 (r211258) @@ -120,7 +120,9 @@ static ssize_t (*uverbs_cmd_table[])(str [IB_USER_VERBS_CMD_GET_ETH_L2_ADDR] = ib_uverbs_get_eth_l2_addr, }; +#ifdef __linux__ static struct vfsmount *uverbs_event_mnt; +#endif static void ib_uverbs_add_one(struct ib_device *device); static void ib_uverbs_remove_one(struct ib_device *device); @@ -359,6 +361,7 @@ static unsigned int ib_uverbs_event_poll unsigned int pollflags = 0; struct ib_uverbs_event_file *file = filp->private_data; + file->filp = filp; poll_wait(filp, &file->poll_wait, wait); spin_lock_irq(&file->lock); @@ -369,12 +372,14 @@ static unsigned int ib_uverbs_event_poll return pollflags; } +#ifdef __linux__ static int ib_uverbs_event_fasync(int fd, struct file *filp, int on) { struct ib_uverbs_event_file *file = filp->private_data; return fasync_helper(fd, filp, on, &file->async_queue); } +#endif static int ib_uverbs_event_close(struct inode *inode, struct file *filp) { @@ -404,7 +409,9 @@ static const struct file_operations uver .read = ib_uverbs_event_read, .poll = ib_uverbs_event_poll, .release = ib_uverbs_event_close, +#ifdef __linux__ .fasync = ib_uverbs_event_fasync +#endif }; void ib_uverbs_comp_handler(struct ib_cq *cq, void *cq_context) @@ -439,7 +446,12 @@ void ib_uverbs_comp_handler(struct ib_cq spin_unlock_irqrestore(&file->lock, flags); wake_up_interruptible(&file->poll_wait); + if (file->filp) + selwakeup(&file->filp->f_selinfo); +#ifdef __linux__ + /* funsetown ? */ kill_fasync(&file->async_queue, SIGIO, POLL_IN); +#endif } static void ib_uverbs_async_handler(struct ib_uverbs_file *file, @@ -472,7 +484,12 @@ static void ib_uverbs_async_handler(stru spin_unlock_irqrestore(&file->async_file->lock, flags); wake_up_interruptible(&file->async_file->poll_wait); + if (file->async_file->filp) + selwakeup(&file->async_file->filp->f_selinfo); +#ifdef __linux__ + /* funsetown? */ kill_fasync(&file->async_file->async_queue, SIGIO, POLL_IN); +#endif } void ib_uverbs_cq_event_handler(struct ib_event *event, void *context_ptr) @@ -533,7 +550,7 @@ struct file *ib_uverbs_alloc_event_file( struct file *filp; int ret; - ev_file = kmalloc(sizeof *ev_file, GFP_KERNEL); + ev_file = kzalloc(sizeof *ev_file, GFP_KERNEL); if (!ev_file) return ERR_PTR(-ENOMEM); @@ -546,6 +563,7 @@ struct file *ib_uverbs_alloc_event_file( ev_file->is_async = is_async; ev_file->is_closed = 0; +#ifdef __linux__ *fd = get_unused_fd(); if (*fd < 0) { ret = *fd; @@ -564,12 +582,28 @@ struct file *ib_uverbs_alloc_event_file( goto err_fd; } +#else + filp = kzalloc(sizeof(*filp), GFP_KERNEL); + if (filp == NULL) { + ret = -ENOMEM; + goto err; + } + filp->f_op = &uverbs_event_fops; + ret = falloc(curthread, &filp->_file, fd); + if (ret) { + ret = -ret; + goto err; + } + finit(filp->_file, FREAD, DTYPE_DEV, filp, &badfileops); +#endif filp->private_data = ev_file; return filp; +#ifdef __linux__ err_fd: put_unused_fd(*fd); +#endif err: kfree(ev_file); @@ -677,7 +711,7 @@ static int ib_uverbs_open(struct inode * goto err; } - file = kmalloc(sizeof *file, GFP_KERNEL); + file = kzalloc(sizeof *file, GFP_KERNEL); if (!file) { ret = -ENOMEM; goto err_module; @@ -766,6 +800,46 @@ static ssize_t show_abi_version(struct c } static CLASS_ATTR(abi_version, S_IRUGO, show_abi_version, NULL); +#include + +static ssize_t +show_dev_device(struct device *device, struct device_attribute *attr, char *buf) +{ + struct ib_uverbs_device *dev = dev_get_drvdata(device); + + if (!dev) + return -ENODEV; + + return sprintf(buf, "0x%04x\n", + ((struct pci_dev *)dev->ib_dev->dma_device)->device); +} +static DEVICE_ATTR(device, S_IRUGO, show_dev_device, NULL); + +static ssize_t +show_dev_vendor(struct device *device, struct device_attribute *attr, char *buf) +{ + struct ib_uverbs_device *dev = dev_get_drvdata(device); + + if (!dev) + return -ENODEV; + + return sprintf(buf, "0x%04x\n", + ((struct pci_dev *)dev->ib_dev->dma_device)->vendor); +} +static DEVICE_ATTR(vendor, S_IRUGO, show_dev_vendor, NULL); + +struct attribute *device_attrs[] = +{ + &dev_attr_device.attr, + &dev_attr_vendor.attr, + NULL +}; + +static struct attribute_group device_group = { + .name = "device", + .attrs = device_attrs +}; + static void ib_uverbs_add_one(struct ib_device *device) { struct ib_uverbs_device *uverbs_dev; @@ -811,6 +885,8 @@ static void ib_uverbs_add_one(struct ib_ goto err_class; if (device_create_file(uverbs_dev->dev, &dev_attr_abi_version)) goto err_class; + if (sysfs_create_group(&uverbs_dev->dev->kobj, &device_group)) + goto err_class; spin_lock(&map_lock); dev_table[uverbs_dev->devnum] = uverbs_dev; @@ -855,7 +931,7 @@ static void ib_uverbs_remove_one(struct wait_for_completion(&uverbs_dev->comp); kfree(uverbs_dev); } - +#ifdef __linux__ static int uverbs_event_get_sb(struct file_system_type *fs_type, int flags, const char *dev_name, void *data, struct vfsmount *mnt) @@ -870,6 +946,7 @@ static struct file_system_type uverbs_ev .get_sb = uverbs_event_get_sb, .kill_sb = kill_litter_super }; +#endif static int __init ib_uverbs_init(void) { @@ -897,6 +974,7 @@ static int __init ib_uverbs_init(void) goto out_class; } +#ifdef __linux__ ret = register_filesystem(&uverbs_event_fs); if (ret) { printk(KERN_ERR "user_verbs: couldn't register infinibandeventfs\n"); @@ -909,6 +987,7 @@ static int __init ib_uverbs_init(void) printk(KERN_ERR "user_verbs: couldn't mount infinibandeventfs\n"); goto out_fs; } +#endif ret = ib_register_client(&uverbs_client); if (ret) { @@ -919,10 +998,12 @@ static int __init ib_uverbs_init(void) return 0; out_mnt: +#ifdef __linux__ mntput(uverbs_event_mnt); out_fs: unregister_filesystem(&uverbs_event_fs); +#endif out_class: class_destroy(uverbs_class); @@ -937,8 +1018,10 @@ out: static void __exit ib_uverbs_cleanup(void) { ib_unregister_client(&uverbs_client); +#ifdef __linux__ mntput(uverbs_event_mnt); unregister_filesystem(&uverbs_event_fs); +#endif class_destroy(uverbs_class); unregister_chrdev_region(IB_UVERBS_BASE_DEV, IB_UVERBS_MAX_DEVICES); idr_destroy(&ib_uverbs_pd_idr); Modified: projects/ofed/head/sys/ofed/drivers/infiniband/hw/mlx4/main.c ============================================================================== --- projects/ofed/head/sys/ofed/drivers/infiniband/hw/mlx4/main.c Fri Aug 13 03:06:09 2010 (r211257) +++ projects/ofed/head/sys/ofed/drivers/infiniband/hw/mlx4/main.c Fri Aug 13 03:08:38 2010 (r211258) @@ -61,7 +61,7 @@ MODULE_VERSION(DRV_VERSION); #ifdef CONFIG_MLX4_DEBUG -int mlx4_ib_debug_level = 0; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-projects@FreeBSD.ORG Fri Aug 13 03:09:08 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 77276106564A; Fri, 13 Aug 2010 03:09:08 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5B17E8FC18; Fri, 13 Aug 2010 03:09:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7D398xp075473; Fri, 13 Aug 2010 03:09:08 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7D398ZV075471; Fri, 13 Aug 2010 03:09:08 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <201008130309.o7D398ZV075471@svn.freebsd.org> From: Jeff Roberson Date: Fri, 13 Aug 2010 03:09:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211259 - projects/ofed/head/sys/conf X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Aug 2010 03:09:08 -0000 Author: jeff Date: Fri Aug 13 03:09:08 2010 New Revision: 211259 URL: http://svn.freebsd.org/changeset/base/211259 Log: - Re-enable some disabled files. Sponsored by: Isilon Systems, iX Systems, and Panasas. Modified: projects/ofed/head/sys/conf/files Modified: projects/ofed/head/sys/conf/files ============================================================================== --- projects/ofed/head/sys/conf/files Fri Aug 13 03:08:38 2010 (r211258) +++ projects/ofed/head/sys/conf/files Fri Aug 13 03:09:08 2010 (r211259) @@ -2666,13 +2666,19 @@ ofed/include/linux/linux_idr.c optiona ofed/include/linux/linux_radix.c optional infiniband \ no-depend compile-with "${OFED_C}" ofed/drivers/infiniband/core/addr.c optional infiniband \ - compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/" + no-depend \ + compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/" ofed/drivers/infiniband/core/agent.c optional infiniband \ no-depend \ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/" ofed/drivers/infiniband/core/cache.c optional infiniband \ no-depend \ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/" +# XXX Mad.c must be ordered before cm.c for sysinit sets to occur in +# the correct order. +ofed/drivers/infiniband/core/mad.c optional infiniband \ + no-depend \ + compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/" ofed/drivers/infiniband/core/cm.c optional infiniband \ no-depend \ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/" @@ -2691,9 +2697,6 @@ ofed/drivers/infiniband/core/iwcm.c opt ofed/drivers/infiniband/core/local_sa.c optional infiniband \ no-depend \ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/" -ofed/drivers/infiniband/core/mad.c optional infiniband \ - no-depend \ - compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/" ofed/drivers/infiniband/core/mad_rmpp.c optional infiniband \ no-depend \ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/" @@ -2712,9 +2715,9 @@ ofed/drivers/infiniband/core/sa_query.c ofed/drivers/infiniband/core/smi.c optional infiniband \ no-depend \ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/" -#ofed/drivers/infiniband/core/sysfs.c optional infiniband \ -# no-depend \ -# compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/" +ofed/drivers/infiniband/core/sysfs.c optional infiniband \ + no-depend \ + compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/" ofed/drivers/infiniband/core/ucm.c optional infiniband \ no-depend \ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/" @@ -2724,9 +2727,9 @@ ofed/drivers/infiniband/core/ucma.c opt ofed/drivers/infiniband/core/ud_header.c optional infiniband \ no-depend \ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/" -#ofed/drivers/infiniband/core/umem.c optional infiniband \ -# no-depend \ -# compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/" +ofed/drivers/infiniband/core/umem.c optional infiniband \ + no-depend \ + compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/" ofed/drivers/infiniband/core/user_mad.c optional infiniband \ no-depend \ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/" From owner-svn-src-projects@FreeBSD.ORG Fri Aug 13 03:10:48 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DE33B1065673; Fri, 13 Aug 2010 03:10:48 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CDC328FC17; Fri, 13 Aug 2010 03:10:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7D3AmUC075873; Fri, 13 Aug 2010 03:10:48 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7D3Amdo075871; Fri, 13 Aug 2010 03:10:48 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <201008130310.o7D3Amdo075871@svn.freebsd.org> From: Jeff Roberson Date: Fri, 13 Aug 2010 03:10:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211260 - projects/ofed/head/sys/ofed/include/linux/mlx4 X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Aug 2010 03:10:49 -0000 Author: jeff Date: Fri Aug 13 03:10:48 2010 New Revision: 211260 URL: http://svn.freebsd.org/changeset/base/211260 Log: - Just check the direct buf pointer against NULL rather than assuming it will be set for 64bit systems. This works in more cases. On BSD we may not allocate a direct map for a large non-contiguous region to avoid the vm address space allocator expense. Sponsored by: Isilon Systems, iX Systems, and Panasas. Modified: projects/ofed/head/sys/ofed/include/linux/mlx4/device.h Modified: projects/ofed/head/sys/ofed/include/linux/mlx4/device.h ============================================================================== --- projects/ofed/head/sys/ofed/include/linux/mlx4/device.h Fri Aug 13 03:09:08 2010 (r211259) +++ projects/ofed/head/sys/ofed/include/linux/mlx4/device.h Fri Aug 13 03:10:48 2010 (r211260) @@ -497,7 +497,7 @@ int mlx4_buf_alloc(struct mlx4_dev *dev, void mlx4_buf_free(struct mlx4_dev *dev, int size, struct mlx4_buf *buf); static inline void *mlx4_buf_offset(struct mlx4_buf *buf, int offset) { - if (BITS_PER_LONG == 64 || buf->nbufs == 1) + if (buf->direct.buf != NULL) return buf->direct.buf + offset; else return buf->page_list[offset >> PAGE_SHIFT].buf + From owner-svn-src-projects@FreeBSD.ORG Fri Aug 13 03:11:34 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 49F981065696; Fri, 13 Aug 2010 03:11:34 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 383A38FC16; Fri, 13 Aug 2010 03:11:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7D3BYrI076236; Fri, 13 Aug 2010 03:11:34 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7D3BYah076233; Fri, 13 Aug 2010 03:11:34 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <201008130311.o7D3BYah076233@svn.freebsd.org> From: Jeff Roberson Date: Fri, 13 Aug 2010 03:11:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211261 - in projects/ofed/head/sys: kern sys X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Aug 2010 03:11:34 -0000 Author: jeff Date: Fri Aug 13 03:11:33 2010 New Revision: 211261 URL: http://svn.freebsd.org/changeset/base/211261 Log: - Expose devclass_add_driver and devclass_delete_driver for use in the linux wrappers. Sponsored by: Isilon Systems, iX Systems, and Panasas. Modified: projects/ofed/head/sys/kern/subr_bus.c projects/ofed/head/sys/sys/bus.h Modified: projects/ofed/head/sys/kern/subr_bus.c ============================================================================== --- projects/ofed/head/sys/kern/subr_bus.c Fri Aug 13 03:10:48 2010 (r211260) +++ projects/ofed/head/sys/kern/subr_bus.c Fri Aug 13 03:11:33 2010 (r211261) @@ -1058,7 +1058,7 @@ devclass_driver_added(devclass_t dc, dri * @param dc the devclass to edit * @param driver the driver to register */ -static int +int devclass_add_driver(devclass_t dc, driver_t *driver, int pass, devclass_t *dcp) { driverlink_t dl; @@ -1120,7 +1120,7 @@ devclass_add_driver(devclass_t dc, drive * @param dc the devclass to edit * @param driver the driver to unregister */ -static int +int devclass_delete_driver(devclass_t busclass, driver_t *driver) { devclass_t dc = devclass_find(driver->name); Modified: projects/ofed/head/sys/sys/bus.h ============================================================================== --- projects/ofed/head/sys/sys/bus.h Fri Aug 13 03:10:48 2010 (r211260) +++ projects/ofed/head/sys/sys/bus.h Fri Aug 13 03:11:33 2010 (r211261) @@ -457,7 +457,10 @@ void device_verbose(device_t dev); /* * Access functions for devclass. */ +int devclass_add_driver(devclass_t dc, driver_t *driver, + int pass, devclass_t *dcp); devclass_t devclass_create(const char *classname); +int devclass_delete_driver(devclass_t busclass, driver_t *driver); devclass_t devclass_find(const char *classname); const char *devclass_get_name(devclass_t dc); device_t devclass_get_device(devclass_t dc, int unit); From owner-svn-src-projects@FreeBSD.ORG Fri Aug 13 03:12:43 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1D2B91065675; Fri, 13 Aug 2010 03:12:43 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0D0848FC08; Fri, 13 Aug 2010 03:12:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7D3CggK076570; Fri, 13 Aug 2010 03:12:42 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7D3Cgq0076568; Fri, 13 Aug 2010 03:12:42 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <201008130312.o7D3Cgq0076568@svn.freebsd.org> From: Jeff Roberson Date: Fri, 13 Aug 2010 03:12:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211262 - projects/ofed/head/sys/sys X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Aug 2010 03:12:43 -0000 Author: jeff Date: Fri Aug 13 03:12:42 2010 New Revision: 211262 URL: http://svn.freebsd.org/changeset/base/211262 Log: - Add a "DEV" filetype for use with uverbs. uverbs constructs a special fd after a device ioctl and returns it to the user. Sponsored by: Isilon Systems, iX Systems, and Panasas. Modified: projects/ofed/head/sys/sys/file.h Modified: projects/ofed/head/sys/sys/file.h ============================================================================== --- projects/ofed/head/sys/sys/file.h Fri Aug 13 03:11:33 2010 (r211261) +++ projects/ofed/head/sys/sys/file.h Fri Aug 13 03:12:42 2010 (r211262) @@ -63,6 +63,7 @@ struct socket; #define DTYPE_SHM 8 /* swap-backed shared memory */ #define DTYPE_SEM 9 /* posix semaphore */ #define DTYPE_PTS 10 /* pseudo teletype master device */ +#define DTYPE_DEV 11 /* Device specific fd type */ #ifdef _KERNEL From owner-svn-src-projects@FreeBSD.ORG Fri Aug 13 03:13:35 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1631E10656A5; Fri, 13 Aug 2010 03:13:35 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 05E298FC1E; Fri, 13 Aug 2010 03:13:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7D3DYhT076843; Fri, 13 Aug 2010 03:13:34 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7D3DYTR076840; Fri, 13 Aug 2010 03:13:34 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <201008130313.o7D3DYTR076840@svn.freebsd.org> From: Jeff Roberson Date: Fri, 13 Aug 2010 03:13:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211263 - in projects/ofed/head/sys: kern sys X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Aug 2010 03:13:35 -0000 Author: jeff Date: Fri Aug 13 03:13:34 2010 New Revision: 211263 URL: http://svn.freebsd.org/changeset/base/211263 Log: - Add a sx_init_flags similar to mtx_init flags as well as SX_SYSINIT_FLAGS Sponsored by: Isilon Systems, iX Systems, and Panasas. Modified: projects/ofed/head/sys/kern/kern_sx.c projects/ofed/head/sys/sys/sx.h Modified: projects/ofed/head/sys/kern/kern_sx.c ============================================================================== --- projects/ofed/head/sys/kern/kern_sx.c Fri Aug 13 03:12:42 2010 (r211262) +++ projects/ofed/head/sys/kern/kern_sx.c Fri Aug 13 03:13:34 2010 (r211263) @@ -195,7 +195,7 @@ sx_sysinit(void *arg) { struct sx_args *sargs = arg; - sx_init(sargs->sa_sx, sargs->sa_desc); + sx_init_flags(sargs->sa_sx, sargs->sa_desc, sargs->sa_flags); } void Modified: projects/ofed/head/sys/sys/sx.h ============================================================================== --- projects/ofed/head/sys/sys/sx.h Fri Aug 13 03:12:42 2010 (r211262) +++ projects/ofed/head/sys/sys/sx.h Fri Aug 13 03:13:34 2010 (r211263) @@ -118,18 +118,22 @@ int sx_chain(struct thread *td, struct t struct sx_args { struct sx *sa_sx; const char *sa_desc; + int sa_flags; }; -#define SX_SYSINIT(name, sxa, desc) \ +#define SX_SYSINIT_FLAGS(name, sxa, desc, flags) \ static struct sx_args name##_args = { \ (sxa), \ - (desc) \ + (desc), \ + (flags) \ }; \ SYSINIT(name##_sx_sysinit, SI_SUB_LOCK, SI_ORDER_MIDDLE, \ sx_sysinit, &name##_args); \ SYSUNINIT(name##_sx_sysuninit, SI_SUB_LOCK, SI_ORDER_MIDDLE, \ sx_destroy, (sxa)) +#define SX_SYSINIT(name, sxa, desc) SX_SYSINIT_FLAGS(name, sxa, desc, 0) + /* * Full lock operations that are suitable to be inlined in non-debug kernels. * If the lock can't be acquired or released trivially then the work is From owner-svn-src-projects@FreeBSD.ORG Fri Aug 13 03:14:09 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1C8A5106564A; Fri, 13 Aug 2010 03:14:09 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0C6B08FC12; Fri, 13 Aug 2010 03:14:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7D3E8nI077013; Fri, 13 Aug 2010 03:14:08 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7D3E8S1077011; Fri, 13 Aug 2010 03:14:08 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <201008130314.o7D3E8S1077011@svn.freebsd.org> From: Jeff Roberson Date: Fri, 13 Aug 2010 03:14:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211264 - projects/ofed/head/sys/vm X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Aug 2010 03:14:09 -0000 Author: jeff Date: Fri Aug 13 03:14:08 2010 New Revision: 211264 URL: http://svn.freebsd.org/changeset/base/211264 Log: - expose uma_align_cache for use in the linux wrappers. Sponsored by: Isilon Systems, iX Systems, and Panasas. Modified: projects/ofed/head/sys/vm/uma_core.c Modified: projects/ofed/head/sys/vm/uma_core.c ============================================================================== --- projects/ofed/head/sys/vm/uma_core.c Fri Aug 13 03:13:34 2010 (r211263) +++ projects/ofed/head/sys/vm/uma_core.c Fri Aug 13 03:14:08 2010 (r211264) @@ -112,7 +112,7 @@ static uma_zone_t slabrefzone; /* With r static uma_zone_t hashzone; /* The boot-time adjusted value for cache line alignment. */ -static int uma_align_cache = 64 - 1; +int uma_align_cache = 64 - 1; static MALLOC_DEFINE(M_UMAHASH, "UMAHash", "UMA Hash Buckets"); From owner-svn-src-projects@FreeBSD.ORG Fri Aug 13 03:15:02 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 85A16106566C; Fri, 13 Aug 2010 03:15:02 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 746808FC08; Fri, 13 Aug 2010 03:15:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7D3F221077244; Fri, 13 Aug 2010 03:15:02 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7D3F2Yh077220; Fri, 13 Aug 2010 03:15:02 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <201008130315.o7D3F2Yh077220@svn.freebsd.org> From: Jeff Roberson Date: Fri, 13 Aug 2010 03:15:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211265 - in projects/ofed/head/sys: dev/hptmv kern sys X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Aug 2010 03:15:02 -0000 Author: jeff Date: Fri Aug 13 03:15:02 2010 New Revision: 211265 URL: http://svn.freebsd.org/changeset/base/211265 Log: - Change sysctl arg2 to a intptr_t preserving the sign and expanding the size so it can optionally hold a pointer. Sponsored by: Isilon Systems, iX Systems, and Panasas. Modified: projects/ofed/head/sys/dev/hptmv/hptproc.c projects/ofed/head/sys/kern/kern_jail.c projects/ofed/head/sys/kern/kern_sysctl.c projects/ofed/head/sys/sys/jail.h projects/ofed/head/sys/sys/sysctl.h Modified: projects/ofed/head/sys/dev/hptmv/hptproc.c ============================================================================== --- projects/ofed/head/sys/dev/hptmv/hptproc.c Fri Aug 13 03:14:08 2010 (r211264) +++ projects/ofed/head/sys/dev/hptmv/hptproc.c Fri Aug 13 03:15:02 2010 (r211265) @@ -51,8 +51,8 @@ int hpt_rescan_all(void); static char hptproc_buffer[256]; extern char DRIVER_VERSION[]; -#define FORMAL_HANDLER_ARGS struct sysctl_oid *oidp, void *arg1, int arg2, \ - struct sysctl_req *req +#define FORMAL_HANDLER_ARGS struct sysctl_oid *oidp, void *arg1, \ + intptr_t arg2, struct sysctl_req *req #define REAL_HANDLER_ARGS oidp, arg1, arg2, req typedef struct sysctl_req HPT_GET_INFO; Modified: projects/ofed/head/sys/kern/kern_jail.c ============================================================================== --- projects/ofed/head/sys/kern/kern_jail.c Fri Aug 13 03:14:08 2010 (r211264) +++ projects/ofed/head/sys/kern/kern_jail.c Fri Aug 13 03:15:02 2010 (r211265) @@ -4166,7 +4166,7 @@ sysctl_jail_param(SYSCTL_HANDLER_ARGS) i = 0; return (SYSCTL_OUT(req, &i, sizeof(i))); case CTLTYPE_STRING: - snprintf(numbuf, sizeof(numbuf), "%d", arg2); + snprintf(numbuf, sizeof(numbuf), "%jd", arg2); return (sysctl_handle_string(oidp, numbuf, sizeof(numbuf), req)); case CTLTYPE_STRUCT: Modified: projects/ofed/head/sys/kern/kern_sysctl.c ============================================================================== --- projects/ofed/head/sys/kern/kern_sysctl.c Fri Aug 13 03:14:08 2010 (r211264) +++ projects/ofed/head/sys/kern/kern_sysctl.c Fri Aug 13 03:15:02 2010 (r211265) @@ -364,6 +364,27 @@ sysctl_remove_oid(struct sysctl_oid *oid return (error); } +int +sysctl_remove_name(struct sysctl_oid *parent, const char *name, + int del, int recurse) +{ + struct sysctl_oid *p; + int error; + + error = ENOENT; + SYSCTL_XLOCK(); + SLIST_FOREACH(p, SYSCTL_CHILDREN(parent), oid_link) { + if (strcmp(p->oid_name, name) == 0) { + error = sysctl_remove_oid_locked(p, del, recurse); + break; + } + } + SYSCTL_XUNLOCK(); + + return (error); +} + + static int sysctl_remove_oid_locked(struct sysctl_oid *oidp, int del, int recurse) { @@ -417,14 +438,13 @@ sysctl_remove_oid_locked(struct sysctl_o } return (0); } - /* * Create new sysctls at run time. * clist may point to a valid context initialized with sysctl_ctx_init(). */ struct sysctl_oid * sysctl_add_oid(struct sysctl_ctx_list *clist, struct sysctl_oid_list *parent, - int number, const char *name, int kind, void *arg1, int arg2, + int number, const char *name, int kind, void *arg1, intptr_t arg2, int (*handler)(SYSCTL_HANDLER_ARGS), const char *fmt, const char *descr) { struct sysctl_oid *oidp; @@ -468,6 +488,7 @@ sysctl_add_oid(struct sysctl_ctx_list *c SYSCTL_CHILDREN_SET(oidp, malloc(sizeof(struct sysctl_oid_list), M_SYSCTLOID, M_WAITOK)); SLIST_INIT(SYSCTL_CHILDREN(oidp)); + oidp->oid_arg2 = arg2; } else { oidp->oid_arg1 = arg1; oidp->oid_arg2 = arg2; Modified: projects/ofed/head/sys/sys/jail.h ============================================================================== --- projects/ofed/head/sys/sys/jail.h Fri Aug 13 03:14:08 2010 (r211264) +++ projects/ofed/head/sys/sys/jail.h Fri Aug 13 03:15:02 2010 (r211265) @@ -379,7 +379,7 @@ int prison_check_af(struct ucred *cred, int prison_if(struct ucred *cred, struct sockaddr *sa); char *prison_name(struct prison *, struct prison *); int prison_priv_check(struct ucred *cred, int priv); -int sysctl_jail_param(struct sysctl_oid *, void *, int , struct sysctl_req *); +int sysctl_jail_param(SYSCTL_HANDLER_ARGS); #endif /* _KERNEL */ #endif /* !_SYS_JAIL_H_ */ Modified: projects/ofed/head/sys/sys/sysctl.h ============================================================================== --- projects/ofed/head/sys/sys/sysctl.h Fri Aug 13 03:14:08 2010 (r211264) +++ projects/ofed/head/sys/sys/sysctl.h Fri Aug 13 03:15:02 2010 (r211265) @@ -114,8 +114,8 @@ struct ctlname { #define CTL_AUTO_START 0x100 #ifdef _KERNEL -#define SYSCTL_HANDLER_ARGS struct sysctl_oid *oidp, void *arg1, int arg2, \ - struct sysctl_req *req +#define SYSCTL_HANDLER_ARGS struct sysctl_oid *oidp, void *arg1, \ + intptr_t arg2, struct sysctl_req *req /* definitions for sysctl_req 'lock' member */ #define REQ_UNLOCKED 0 /* not locked and not wired */ @@ -158,7 +158,7 @@ struct sysctl_oid { int oid_number; u_int oid_kind; void *oid_arg1; - int oid_arg2; + intptr_t oid_arg2; const char *oid_name; int (*oid_handler)(SYSCTL_HANDLER_ARGS); const char *oid_fmt; @@ -679,9 +679,11 @@ extern char kern_ident[]; /* Dynamic oid handling */ struct sysctl_oid *sysctl_add_oid(struct sysctl_ctx_list *clist, struct sysctl_oid_list *parent, int nbr, const char *name, - int kind, void *arg1, int arg2, + int kind, void *arg1, intptr_t arg2, int (*handler) (SYSCTL_HANDLER_ARGS), const char *fmt, const char *descr); +int sysctl_remove_name(struct sysctl_oid *parent, const char *name, int del, + int recurse); void sysctl_rename_oid(struct sysctl_oid *oidp, const char *name); int sysctl_move_oid(struct sysctl_oid *oidp, struct sysctl_oid_list *parent); From owner-svn-src-projects@FreeBSD.ORG Fri Aug 13 03:15:42 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 16CA61065694; Fri, 13 Aug 2010 03:15:42 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F01EB8FC0A; Fri, 13 Aug 2010 03:15:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7D3Ff18077428; Fri, 13 Aug 2010 03:15:41 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7D3Ff5w077426; Fri, 13 Aug 2010 03:15:41 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <201008130315.o7D3Ff5w077426@svn.freebsd.org> From: Jeff Roberson Date: Fri, 13 Aug 2010 03:15:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211266 - projects/ofed/head/sys/amd64/include X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Aug 2010 03:15:42 -0000 Author: jeff Date: Fri Aug 13 03:15:41 2010 New Revision: 211266 URL: http://svn.freebsd.org/changeset/base/211266 Log: - Allow endian related macros to do compile time conversion of constants. Sponsored by: Isilon Systems, iX Systems, and Panasas. Modified: projects/ofed/head/sys/amd64/include/endian.h Modified: projects/ofed/head/sys/amd64/include/endian.h ============================================================================== --- projects/ofed/head/sys/amd64/include/endian.h Fri Aug 13 03:15:02 2010 (r211265) +++ projects/ofed/head/sys/amd64/include/endian.h Fri Aug 13 03:15:41 2010 (r211266) @@ -69,10 +69,16 @@ extern "C" { #if defined(__GNUCLIKE_ASM) && defined(__GNUCLIKE_BUILTIN_CONSTANT_P) -#define __byte_swap_int_var(x) \ -__extension__ ({ register __uint32_t __X = (x); \ - __asm ("bswap %0" : "+r" (__X)); \ - __X; }) +static inline __uint32_t +__byte_swap_int_var(__uint32_t x) +{ + register __uint32_t _x; + + + _x = x; + __asm ("bswap %0" : "+r" (_x)); + return (_x); +} #ifdef __OPTIMIZE__ @@ -81,60 +87,47 @@ __extension__ ({ register __uint32_t __X (((x) & 0x00ff0000) >> 8) | \ (((x) & 0x0000ff00) << 8) | \ (((x) & 0x000000ff) << 24)) -#define __byte_swap_int(x) (__builtin_constant_p(x) ? \ +#define __bswap32(x) (__builtin_constant_p(x) ? \ __byte_swap_int_const(x) : __byte_swap_int_var(x)) #else /* __OPTIMIZE__ */ -#define __byte_swap_int(x) __byte_swap_int_var(x) +#define __bswap32(x) __byte_swap_int_var(x) #endif /* __OPTIMIZE__ */ -#define __byte_swap_long_var(x) \ -__extension__ ({ register __uint64_t __X = (x); \ - __asm ("bswap %0" : "+r" (__X)); \ - __X; }) +static inline __uint64_t +__byte_swap_long_var(__uint64_t x) +{ + register __uint64_t _x; + + _x = x; + __asm ("bswap %0" : "+r" (_x)); + return (_x); +} #ifdef __OPTIMIZE__ #define __byte_swap_long_const(x) \ - (((x >> 56) | \ - ((x >> 40) & 0xff00) | \ - ((x >> 24) & 0xff0000) | \ - ((x >> 8) & 0xff000000) | \ - ((x << 8) & (0xfful << 32)) | \ - ((x << 24) & (0xfful << 40)) | \ - ((x << 40) & (0xfful << 48)) | \ - ((x << 56)))) + ((__uint64_t)(((__uint64_t)x >> 56) | \ + (((__uint64_t)x >> 40) & 0xff00) | \ + (((__uint64_t)x >> 24) & 0xff0000) | \ + (((__uint64_t)x >> 8) & 0xff000000) | \ + (((__uint64_t)x << 8) & (0xfful << 32)) | \ + (((__uint64_t)x << 24) & (0xfful << 40)) | \ + (((__uint64_t)x << 40) & (0xfful << 48)) | \ + (((__uint64_t)x << 56)))) -#define __byte_swap_long(x) (__builtin_constant_p(x) ? \ +#define __bswap64(x) (__builtin_constant_p(x) ? \ __byte_swap_long_const(x) : __byte_swap_long_var(x)) #else /* __OPTIMIZE__ */ -#define __byte_swap_long(x) __byte_swap_long_var(x) +#define __bswap64(x) __byte_swap_long_var(x) #endif /* __OPTIMIZE__ */ -static __inline __uint64_t -__bswap64(__uint64_t _x) -{ - - return (__byte_swap_long(_x)); -} - -static __inline __uint32_t -__bswap32(__uint32_t _x) -{ - - return (__byte_swap_int(_x)); -} - -static __inline __uint16_t -__bswap16(__uint16_t _x) -{ - return (_x << 8 | _x >> 8); -} +#define __bswap16(_x) (__uint16_t)((_x) << 8 | (_x) >> 8) #define __htonl(x) __bswap32(x) #define __htons(x) __bswap16(x) From owner-svn-src-projects@FreeBSD.ORG Fri Aug 13 03:16:11 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A4B2710656AC; Fri, 13 Aug 2010 03:16:11 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 94ABA8FC1B; Fri, 13 Aug 2010 03:16:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7D3GBZF077566; Fri, 13 Aug 2010 03:16:11 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7D3GBKv077564; Fri, 13 Aug 2010 03:16:11 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <201008130316.o7D3GBKv077564@svn.freebsd.org> From: Jeff Roberson Date: Fri, 13 Aug 2010 03:16:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211267 - projects/ofed/head/sys/amd64/conf X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Aug 2010 03:16:11 -0000 Author: jeff Date: Fri Aug 13 03:16:11 2010 New Revision: 211267 URL: http://svn.freebsd.org/changeset/base/211267 Log: - Add ofed to GENERIC for now. Sponsored by: Isilon Systems, iX Systems, and Panasas. Modified: projects/ofed/head/sys/amd64/conf/GENERIC Modified: projects/ofed/head/sys/amd64/conf/GENERIC ============================================================================== --- projects/ofed/head/sys/amd64/conf/GENERIC Fri Aug 13 03:15:41 2010 (r211266) +++ projects/ofed/head/sys/amd64/conf/GENERIC Fri Aug 13 03:16:11 2010 (r211267) @@ -87,6 +87,11 @@ device cpufreq device acpi device pci +# Infiniband Bus and drivers +device infiniband +device mlx4 +device mthca + # Floppy drives device fdc From owner-svn-src-projects@FreeBSD.ORG Fri Aug 13 03:17:03 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A8796106564A; Fri, 13 Aug 2010 03:17:03 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 982618FC1A; Fri, 13 Aug 2010 03:17:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7D3H3Bt077803; Fri, 13 Aug 2010 03:17:03 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7D3H3uh077801; Fri, 13 Aug 2010 03:17:03 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <201008130317.o7D3H3uh077801@svn.freebsd.org> From: Jeff Roberson Date: Fri, 13 Aug 2010 03:17:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211268 - projects/ofed/head/sys/ofed/include/linux X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Aug 2010 03:17:03 -0000 Author: jeff Date: Fri Aug 13 03:17:03 2010 New Revision: 211268 URL: http://svn.freebsd.org/changeset/base/211268 Log: - Fix the try_get_module() return value to always be successful. - Add some temporary debugging for module startup order. Sponsored by: Isilon Systems, iX Systems, and Panasas. Modified: projects/ofed/head/sys/ofed/include/linux/module.h Modified: projects/ofed/head/sys/ofed/include/linux/module.h ============================================================================== --- projects/ofed/head/sys/ofed/include/linux/module.h Fri Aug 13 03:16:11 2010 (r211267) +++ projects/ofed/head/sys/ofed/include/linux/module.h Fri Aug 13 03:17:03 2010 (r211268) @@ -44,21 +44,41 @@ #define EXPORT_SYMBOL(name) #define EXPORT_SYMBOL_GPL(name) +#include + +static inline void +_module_run(void *arg) +{ + char name[1024]; + caddr_t pc; + void (*fn)(void); + long offset; + + pc = (caddr_t)arg; + if (linker_search_symbol_name(pc, name, sizeof(name), &offset) != 0) + printf("Running ??? (%p)\n", pc); + else + printf("Running %s (%p)\n", name, pc); + + fn = arg; + fn(); +} + #define module_init(fn) \ - SYSINIT(fn, SI_SUB_RUN_SCHEDULER, SI_ORDER_FIRST, (fn), NULL) + SYSINIT(fn, SI_SUB_RUN_SCHEDULER, SI_ORDER_FIRST, _module_run, (fn)) /* * XXX This is a freebsdism designed to work around not having a module * load order resolver built in. */ #define module_init_order(fn, order) \ - SYSINIT(fn, SI_SUB_RUN_SCHEDULER, (order), (fn), NULL) + SYSINIT(fn, SI_SUB_RUN_SCHEDULER, (order), _module_run, (fn)) #define module_exit(fn) \ - SYSUNINIT(fn, SI_SUB_RUN_SCHEDULER, SI_ORDER_FIRST, (fn), NULL) + SYSUNINIT(fn, SI_SUB_RUN_SCHEDULER, SI_ORDER_FIRST, _module_run, (fn)) #define module_get(module) #define module_put(module) -#define try_module_get(module) 0 +#define try_module_get(module) 1 #endif /* _LINUX_MODULE_H_ */ From owner-svn-src-projects@FreeBSD.ORG Fri Aug 13 03:17:34 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 330691065695; Fri, 13 Aug 2010 03:17:34 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2329F8FC2A; Fri, 13 Aug 2010 03:17:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7D3HYXU077937; Fri, 13 Aug 2010 03:17:34 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7D3HYAX077935; Fri, 13 Aug 2010 03:17:34 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <201008130317.o7D3HYAX077935@svn.freebsd.org> From: Jeff Roberson Date: Fri, 13 Aug 2010 03:17:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211269 - projects/ofed/head/sys/netinet X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Aug 2010 03:17:34 -0000 Author: jeff Date: Fri Aug 13 03:17:33 2010 New Revision: 211269 URL: http://svn.freebsd.org/changeset/base/211269 Log: - Fix a bug that is certainly fixed in current already so that others don't run into it while testing this branch. Modified: projects/ofed/head/sys/netinet/ip_var.h Modified: projects/ofed/head/sys/netinet/ip_var.h ============================================================================== --- projects/ofed/head/sys/netinet/ip_var.h Fri Aug 13 03:17:03 2010 (r211268) +++ projects/ofed/head/sys/netinet/ip_var.h Fri Aug 13 03:17:33 2010 (r211269) @@ -307,8 +307,7 @@ extern int (*ip_dn_io_ptr)(struct mbuf * VNET_DECLARE(int, ip_do_randomid); #define V_ip_do_randomid VNET(ip_do_randomid) -#define ip_newid() ((V_ip_do_randomid != 0) ? ip_randomid() : \ - htons(V_ip_id++)) +#define ip_newid() ip_randomid() #endif /* _KERNEL */ From owner-svn-src-projects@FreeBSD.ORG Fri Aug 13 05:43:09 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B0DCD106566B; Fri, 13 Aug 2010 05:43:09 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9EA138FC19; Fri, 13 Aug 2010 05:43:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7D5h92k010072; Fri, 13 Aug 2010 05:43:09 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7D5h9N8010070; Fri, 13 Aug 2010 05:43:09 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <201008130543.o7D5h9N8010070@svn.freebsd.org> From: Jeff Roberson Date: Fri, 13 Aug 2010 05:43:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211272 - projects/ofed/head/etc/mtree X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Aug 2010 05:43:09 -0000 Author: jeff Date: Fri Aug 13 05:43:09 2010 New Revision: 211272 URL: http://svn.freebsd.org/changeset/base/211272 Log: - Add directories for infiniband includes. Sponsored by: Isilon Systems, iX Systems, and Panasas. Modified: projects/ofed/head/etc/mtree/BSD.include.dist Modified: projects/ofed/head/etc/mtree/BSD.include.dist ============================================================================== --- projects/ofed/head/etc/mtree/BSD.include.dist Fri Aug 13 05:01:44 2010 (r211271) +++ projects/ofed/head/etc/mtree/BSD.include.dist Fri Aug 13 05:43:09 2010 (r211272) @@ -197,6 +197,16 @@ .. gssapi .. + infiniband + complib + .. + iba + .. + opensm + .. + vendor + .. + .. isofs cd9660 .. From owner-svn-src-projects@FreeBSD.ORG Fri Aug 13 05:45:36 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8875F1065696; Fri, 13 Aug 2010 05:45:36 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 752978FC15; Fri, 13 Aug 2010 05:45:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7D5jajL010649; Fri, 13 Aug 2010 05:45:36 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7D5jaiN010646; Fri, 13 Aug 2010 05:45:36 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <201008130545.o7D5jaiN010646@svn.freebsd.org> From: Jeff Roberson Date: Fri, 13 Aug 2010 05:45:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211273 - in projects/ofed/head/contrib/ofed/management: infiniband-diags/src opensm/include/opensm X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Aug 2010 05:45:36 -0000 Author: jeff Date: Fri Aug 13 05:45:36 2010 New Revision: 211273 URL: http://svn.freebsd.org/changeset/base/211273 Log: - Update the osm_config.h to match the one generated by configure. - Add a missing include to saquery. Sponsored by: Isilon Systems, iX Systems, and Panasas. Modified: projects/ofed/head/contrib/ofed/management/infiniband-diags/src/saquery.c projects/ofed/head/contrib/ofed/management/opensm/include/opensm/osm_config.h Modified: projects/ofed/head/contrib/ofed/management/infiniband-diags/src/saquery.c ============================================================================== --- projects/ofed/head/contrib/ofed/management/infiniband-diags/src/saquery.c Fri Aug 13 05:43:09 2010 (r211272) +++ projects/ofed/head/contrib/ofed/management/infiniband-diags/src/saquery.c Fri Aug 13 05:45:36 2010 (r211273) @@ -56,6 +56,8 @@ #include #include +#include + #include "ibdiag_common.h" struct query_cmd { Modified: projects/ofed/head/contrib/ofed/management/opensm/include/opensm/osm_config.h ============================================================================== --- projects/ofed/head/contrib/ofed/management/opensm/include/opensm/osm_config.h Fri Aug 13 05:43:09 2010 (r211272) +++ projects/ofed/head/contrib/ofed/management/opensm/include/opensm/osm_config.h Fri Aug 13 05:45:36 2010 (r211273) @@ -1,3 +1,4 @@ +/* include/opensm/osm_config.h. Generated from osm_config.h.in by configure. */ /* include/osm_config.h.in * * Defines various OpenSM configuration parameters to be used by various @@ -8,57 +9,57 @@ */ #ifndef _OSM_CONFIG_H_ -#define _OSM_CONFIG_H_ +#define _OSM_CONFIG_H_ 1 /* define 1 if OpenSM build is in a debug mode */ -#undef OSM_DEBUG +/* #undef OSM_DEBUG */ /* Define as 1 if you want Dual Sided RMPP Support */ -#undef DUAL_SIDED_RMPP +#define DUAL_SIDED_RMPP 1 /* Define as 1 if you want to enable a console on a socket connection */ -#undef ENABLE_OSM_CONSOLE_SOCKET +/* #undef ENABLE_OSM_CONSOLE_SOCKET */ /* Define as 1 if you want to enable the event plugin */ -#undef ENABLE_OSM_DEFAULT_EVENT_PLUGIN +/* #undef ENABLE_OSM_DEFAULT_EVENT_PLUGIN */ /* Define as 1 if you want to enable the performance manager */ -#undef ENABLE_OSM_PERF_MGR +/* #undef ENABLE_OSM_PERF_MGR */ /* Define as 1 if you want to enable the performance manager profiling code */ -#undef ENABLE_OSM_PERF_MGR_PROFILE +/* #undef ENABLE_OSM_PERF_MGR_PROFILE */ /* Define a default node name map file */ -#undef HAVE_DEFAULT_NODENAME_MAP +#define HAVE_DEFAULT_NODENAME_MAP "/usr/local/etc/opensm/ib-node-name-map" /* Define a default OpenSM config file */ -#undef HAVE_DEFAULT_OPENSM_CONFIG_FILE +#define HAVE_DEFAULT_OPENSM_CONFIG_FILE "/usr/local/etc/opensm/opensm.conf" /* Define a Partition config file */ -#undef HAVE_DEFAULT_PARTITION_CONFIG_FILE +#define HAVE_DEFAULT_PARTITION_CONFIG_FILE "/usr/local/etc/opensm/partitions.conf" /* Define a Prefix Routes config file */ -#undef HAVE_DEFAULT_PREFIX_ROUTES_FILE +#define HAVE_DEFAULT_PREFIX_ROUTES_FILE "/usr/local/etc/opensm/prefix-routes.conf" /* Define a QOS policy config file */ -#undef HAVE_DEFAULT_QOS_POLICY_FILE +#define HAVE_DEFAULT_QOS_POLICY_FILE "/usr/local/etc/opensm/qos-policy.conf" /* Define OpenSM config directory */ -#define OPENSM_CONFIG_DIR "/etc/opensm" +#define OPENSM_CONFIG_DIR "/usr/local/etc/opensm" /* Define as 1 for vapi vendor */ -#undef OSM_VENDOR_INTF_MTL +/* #undef OSM_VENDOR_INTF_MTL */ /* Define as 1 for OpenIB vendor */ -#define OSM_VENDOR_INTF_OPENIB 1 +#define OSM_VENDOR_INTF_OPENIB 1 /* Define as 1 for sim vendor */ -#undef OSM_VENDOR_INTF_SIM +/* #undef OSM_VENDOR_INTF_SIM */ /* Define as 1 for ts vendor */ -#undef OSM_VENDOR_INTF_TS +/* #undef OSM_VENDOR_INTF_TS */ /* Define as 1 if you want Vendor RMPP Support */ -#undef VENDOR_RMPP_SUPPORT +#define VENDOR_RMPP_SUPPORT 1 #endif /* _OSM_CONFIG_H_ */ From owner-svn-src-projects@FreeBSD.ORG Fri Aug 13 05:46:37 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 73592106566B; Fri, 13 Aug 2010 05:46:37 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 605528FC13; Fri, 13 Aug 2010 05:46:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7D5kbOm010915; Fri, 13 Aug 2010 05:46:37 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7D5kbak010911; Fri, 13 Aug 2010 05:46:37 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <201008130546.o7D5kbak010911@svn.freebsd.org> From: Jeff Roberson Date: Fri, 13 Aug 2010 05:46:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211274 - projects/ofed/head/contrib/ofed/libibverbs/src X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Aug 2010 05:46:37 -0000 Author: jeff Date: Fri Aug 13 05:46:37 2010 New Revision: 211274 URL: http://svn.freebsd.org/changeset/base/211274 Log: - Update paths and sysfs access to account for sysctl and freebsd device paths. Sponsored by: Isilon Systems, iX Systems, and Panasas. Modified: projects/ofed/head/contrib/ofed/libibverbs/src/device.c projects/ofed/head/contrib/ofed/libibverbs/src/init.c projects/ofed/head/contrib/ofed/libibverbs/src/sysfs.c Modified: projects/ofed/head/contrib/ofed/libibverbs/src/device.c ============================================================================== --- projects/ofed/head/contrib/ofed/libibverbs/src/device.c Fri Aug 13 05:45:36 2010 (r211273) +++ projects/ofed/head/contrib/ofed/libibverbs/src/device.c Fri Aug 13 05:46:37 2010 (r211274) @@ -128,7 +128,7 @@ struct ibv_context *__ibv_open_device(st int cmd_fd; struct ibv_context *context; - if (asprintf(&devpath, "/dev/infiniband/%s", device->dev_name) < 0) + if (asprintf(&devpath, "/dev/%s", device->dev_name) < 0) return NULL; /* Modified: projects/ofed/head/contrib/ofed/libibverbs/src/init.c ============================================================================== --- projects/ofed/head/contrib/ofed/libibverbs/src/init.c Fri Aug 13 05:45:36 2010 (r211273) +++ projects/ofed/head/contrib/ofed/libibverbs/src/init.c Fri Aug 13 05:46:37 2010 (r211274) @@ -79,6 +79,7 @@ static struct ibv_driver *head_driver, * static int find_sysfs_devs(void) { +#ifdef __linux__ char class_path[IBV_SYSFS_PATH_MAX]; DIR *class_dir; struct dirent *dent; @@ -151,6 +152,57 @@ static int find_sysfs_devs(void) closedir(class_dir); return ret; +#else + char class_path[IBV_SYSFS_PATH_MAX]; + struct ibv_sysfs_dev *sysfs_dev = NULL; + char value[8]; + int ret = 0; + int i; + + snprintf(class_path, sizeof class_path, "%s/class/infiniband_verbs", + ibv_get_sysfs_path()); + + for (i = 0; i < 256; i++) { + if (!sysfs_dev) + sysfs_dev = malloc(sizeof *sysfs_dev); + if (!sysfs_dev) { + ret = ENOMEM; + goto out; + } + + snprintf(sysfs_dev->sysfs_path, sizeof sysfs_dev->sysfs_path, + "%s/uverbs%d", class_path, i); + + snprintf(sysfs_dev->sysfs_name, sizeof sysfs_dev->sysfs_name, + "uverbs%d", i); + + if (ibv_read_sysfs_file(sysfs_dev->sysfs_path, "ibdev", + sysfs_dev->ibdev_name, + sizeof sysfs_dev->ibdev_name) < 0) + continue; + + snprintf(sysfs_dev->ibdev_path, sizeof sysfs_dev->ibdev_path, + "/dev/%s", sysfs_dev->ibdev_name); + + sysfs_dev->next = sysfs_dev_list; + sysfs_dev->have_driver = 0; + if (ibv_read_sysfs_file(sysfs_dev->sysfs_path, "abi_version", + value, sizeof value) > 0) + sysfs_dev->abi_ver = strtol(value, NULL, 10); + else + sysfs_dev->abi_ver = 0; + + sysfs_dev_list = sysfs_dev; + sysfs_dev = NULL; + } + + out: + if (sysfs_dev) + free(sysfs_dev); + + return ret; + +#endif } void ibv_register_driver(const char *name, ibv_driver_init_func init_func) @@ -333,13 +385,19 @@ static struct ibv_device *try_driver(str struct ibv_sysfs_dev *sysfs_dev) { struct ibv_device *dev; + char *path; char value[8]; dev = driver->init_func(sysfs_dev->sysfs_path, sysfs_dev->abi_ver); if (!dev) return NULL; - if (ibv_read_sysfs_file(sysfs_dev->ibdev_path, "node_type", value, sizeof value) < 0) { + if (asprintf(&path, "/sys/class/infiniband/%s", + strrchr(sysfs_dev->ibdev_path, '/')+1) < 0) { + dev->node_type = IBV_NODE_UNKNOWN; + goto out; + } + if (ibv_read_sysfs_file(path, "node_type", value, sizeof value) < 0) { fprintf(stderr, PFX "Warning: no node_type attr under %s.\n", sysfs_dev->ibdev_path); dev->node_type = IBV_NODE_UNKNOWN; @@ -348,6 +406,8 @@ static struct ibv_device *try_driver(str if (dev->node_type < IBV_NODE_CA || dev->node_type > IBV_NODE_RNIC) dev->node_type = IBV_NODE_UNKNOWN; } + free(path); +out: switch (dev->node_type) { case IBV_NODE_CA: Modified: projects/ofed/head/contrib/ofed/libibverbs/src/sysfs.c ============================================================================== --- projects/ofed/head/contrib/ofed/libibverbs/src/sysfs.c Fri Aug 13 05:45:36 2010 (r211273) +++ projects/ofed/head/contrib/ofed/libibverbs/src/sysfs.c Fri Aug 13 05:46:37 2010 (r211274) @@ -42,6 +42,8 @@ #include #include +#include + #include "ibverbs.h" static char *sysfs_path; @@ -78,22 +80,21 @@ const char *ibv_get_sysfs_path(void) int ibv_read_sysfs_file(const char *dir, const char *file, char *buf, size_t size) { - char *path; + char *path, *s; int fd; - int len; + size_t len; if (asprintf(&path, "%s/%s", dir, file) < 0) return -1; - fd = open(path, O_RDONLY); - if (fd < 0) { - free(path); - return -1; - } + for (s = &path[0]; *s != '\0'; s++) + if (*s == '/') + *s = '.'; - len = read(fd, buf, size); + len = size; + if (sysctlbyname(&path[1], buf, &len, NULL, 0) == -1) + return -1; - close(fd); free(path); if (len > 0 && buf[len - 1] == '\n') From owner-svn-src-projects@FreeBSD.ORG Fri Aug 13 06:03:54 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D45CF1065673; Fri, 13 Aug 2010 06:03:54 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C22318FC14; Fri, 13 Aug 2010 06:03:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7D63sWE014751; Fri, 13 Aug 2010 06:03:54 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7D63s0N014749; Fri, 13 Aug 2010 06:03:54 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <201008130603.o7D63s0N014749@svn.freebsd.org> From: Jeff Roberson Date: Fri, 13 Aug 2010 06:03:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211275 - projects/ofed/head/etc/mtree X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Aug 2010 06:03:54 -0000 Author: jeff Date: Fri Aug 13 06:03:54 2010 New Revision: 211275 URL: http://svn.freebsd.org/changeset/base/211275 Log: - Add a cache directory for opensm Sponsored by: Isilon Systems, iX Systems, and Panasas. Modified: projects/ofed/head/etc/mtree/BSD.var.dist Modified: projects/ofed/head/etc/mtree/BSD.var.dist ============================================================================== --- projects/ofed/head/etc/mtree/BSD.var.dist Fri Aug 13 05:46:37 2010 (r211274) +++ projects/ofed/head/etc/mtree/BSD.var.dist Fri Aug 13 06:03:54 2010 (r211275) @@ -22,6 +22,8 @@ /set gname=wheel backups .. + cache + .. crash .. cron From owner-svn-src-projects@FreeBSD.ORG Fri Aug 13 14:10:26 2010 Return-Path: Delivered-To: svn-src-projects@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B1C101065675; Fri, 13 Aug 2010 14:10:26 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail02.syd.optusnet.com.au (mail02.syd.optusnet.com.au [211.29.132.183]) by mx1.freebsd.org (Postfix) with ESMTP id 31CD08FC0A; Fri, 13 Aug 2010 14:10:25 +0000 (UTC) Received: from c122-106-147-41.carlnfd1.nsw.optusnet.com.au (c122-106-147-41.carlnfd1.nsw.optusnet.com.au [122.106.147.41]) by mail02.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id o7DEAMpg029071 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 14 Aug 2010 00:10:23 +1000 Date: Sat, 14 Aug 2010 00:10:22 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Jeff Roberson In-Reply-To: <201008130315.o7D3Ff5w077426@svn.freebsd.org> Message-ID: <20100813222107.C12891@delplex.bde.org> References: <201008130315.o7D3Ff5w077426@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-projects@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r211266 - projects/ofed/head/sys/amd64/include X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Aug 2010 14:10:26 -0000 On Fri, 13 Aug 2010, Jeff Roberson wrote: > Log: > - Allow endian related macros to do compile time conversion of constants. Er, they already did, at least for non-broken compilers: % #include % % unsigned long long % foo() % { % return (__bswap64(0x1000000000000000ULL) + % __bswap32(0x20000000) + % __bswap16(0x4000)); % } On amd64, when compiled by gcc-3.3.3 through gcc-4.2.1 -O, this evaluates everything at compile time to the expected return value of 0x70, while with gcc -O0 it correctly evaluates nothing at compile time and emits calls to the 3 bswap() functions. The -O0 case is unimportant but it is better for it to make the function calls so that you can put breakpoints in the calls. I think this commit breaks the behaviour with -O0 gby changing all the inline functions to macros. I think cognet@ has cleaner diffs for this. The constant part should be entirely MI, but is now a tangle of idefs not even duplicated ad nauseum. IIRC, the only unfinished detail in these diffs is that the ifdef tangle threatens to becomes worse and wasn't completely unraveled. > Modified: projects/ofed/head/sys/amd64/include/endian.h > ============================================================================== > --- projects/ofed/head/sys/amd64/include/endian.h Fri Aug 13 03:15:02 2010 (r211265) > +++ projects/ofed/head/sys/amd64/include/endian.h Fri Aug 13 03:15:41 2010 (r211266) > @@ -69,10 +69,16 @@ extern "C" { > > #if defined(__GNUCLIKE_ASM) && defined(__GNUCLIKE_BUILTIN_CONSTANT_P) > > -#define __byte_swap_int_var(x) \ > -__extension__ ({ register __uint32_t __X = (x); \ > - __asm ("bswap %0" : "+r" (__X)); \ > - __X; }) > +static inline __uint32_t > +__byte_swap_int_var(__uint32_t x) `x' is in the application namespace, so it cannot be used as a function parameter or variable name in a central header like this. > +{ > + register __uint32_t _x; > + > + Extra blank line. > + _x = x; Converting x to a variable whose name should have been x's all along doesn't fix the namespace pollution. > + __asm ("bswap %0" : "+r" (_x)); > + return (_x); > +} The formatting of the macro is bad, but the macro is good for avoiding namespace pollution. The extra variable also makes no sense except the macro, since in the macro it is needed to convert the parameter, while in the function that conversion has already been done by the function call protocol. > @@ -81,60 +87,47 @@ __extension__ ({ register __uint32_t __X > (((x) & 0x00ff0000) >> 8) | \ > (((x) & 0x0000ff00) << 8) | \ > (((x) & 0x000000ff) << 24)) > -#define __byte_swap_int(x) (__builtin_constant_p(x) ? \ > +#define __bswap32(x) (__builtin_constant_p(x) ? \ > __byte_swap_int_const(x) : __byte_swap_int_var(x)) > > #else /* __OPTIMIZE__ */ > > -#define __byte_swap_int(x) __byte_swap_int_var(x) > +#define __bswap32(x) __byte_swap_int_var(x) > > #endif /* __OPTIMIZE__ */ > > -#define __byte_swap_long_var(x) \ > -__extension__ ({ register __uint64_t __X = (x); \ > - __asm ("bswap %0" : "+r" (__X)); \ > - __X; }) > +static inline __uint64_t > +__byte_swap_long_var(__uint64_t x) > +{ > + register __uint64_t _x; > + > + _x = x; > + __asm ("bswap %0" : "+r" (_x)); > + return (_x); > +} As above, except there is no extra blank line. > > #ifdef __OPTIMIZE__ > > #define __byte_swap_long_const(x) \ > - (((x >> 56) | \ > - ((x >> 40) & 0xff00) | \ > - ((x >> 24) & 0xff0000) | \ > - ((x >> 8) & 0xff000000) | \ > - ((x << 8) & (0xfful << 32)) | \ > - ((x << 24) & (0xfful << 40)) | \ > - ((x << 40) & (0xfful << 48)) | \ > - ((x << 56)))) > + ((__uint64_t)(((__uint64_t)x >> 56) | \ > + (((__uint64_t)x >> 40) & 0xff00) | \ > + (((__uint64_t)x >> 24) & 0xff0000) | \ > + (((__uint64_t)x >> 8) & 0xff000000) | \ > + (((__uint64_t)x << 8) & (0xfful << 32)) | \ > + (((__uint64_t)x << 24) & (0xfful << 40)) | \ > + (((__uint64_t)x << 40) & (0xfful << 48)) | \ > + (((__uint64_t)x << 56)))) That sure is ugly, and still quite broken, since all the x's in it are missing parentheses. Style bugs in it include: - casting to __uint64_t is excessive. This function logically acts on u_longs, though its name says plain long. The literal constants already use a UL suffix (written as ul so it is harder to read). - casting for the right shifts is mostly not needed. Except for the shift by 56, any replicated sign bit is stripped by the mask. Here is a clean version of the above: % static __inline __uint64_t % __bswap64(__uint64_t _x) % { % % return ((_x >> 56) | ((_x >> 40) & 0xff00) | ((_x >> 24) & 0xff0000) | % ((_x >> 8) & 0xff000000) | ((_x << 8) & ((__uint64_t)0xff << 32)) | % ((_x << 24) & ((__uint64_t)0xff << 40)) | % ((_x << 40) & ((__uint64_t)0xff << 48)) | ((_x << 56))); % } i386 already has precisely this. The main point here is that this inline function works right for constants (it evaluates the inline at compile time, but only when optimizing), so if you get out of the compiler's way by not confusing it and you with an ifdef tangle, then this version will just work for both constants and variables. This is what already happens on i386. But on amd64 there is a complication: gcc is still too stupid to automatically convert the above into a single bswap instruction if _x is a variable, and since we want to use a single bswap instruction if possible then we have to write an asm with the bswap, and use an ifdef tangle to select... Secondary points: a function is much easier to use than a macro here, since the expression must reference the parameter many times and it is easier to spell the parameter as _x than as ((__uint64_t)(_x)). This depends on converting the parameter to a single identifier of the correct type. ANy macro version should do the same, using a temporary variable and a statment- expression, like some macros in this file used to do. This depends on gcc working right for constants that are converted to temporary variables, just like it does for inline functions with constant args. Cleanup points: the above __bswap64() is MI. It shouldn't be duplicated (or copied with errors like the amd64 macro version) into many MD files. But MD files need to be able to override it, hopefully without a very large ifdef tangle. > ... > -static __inline __uint16_t > -__bswap16(__uint16_t _x) > -{ > - return (_x << 8 | _x >> 8); > -} > +#define __bswap16(_x) (__uint16_t)((_x) << 8 | (_x) >> 8) This is less than backwards: - the macro version is broken, like __byte_swap_long_const(x) was, since it is missing conversions of the parameter to uint16_t. The parameter should have type uint16_t, but the strictness of this requirement is not clear. A bogus parameter of (int16_t)0x8000 now gives 0xff80 after replication of the sign bit by the right shift, instead of the expected value of 0x80. Casting the final value to uint16_t only prevents 16 more bits of replcation by sign extension ((int16_t)0x8000 -> (int)0xffff80000 right shifts to (int)0xffffff80). - the inline function version already worked perfectly for both constants and variables, just like the inline 64-bit version works perfectly for both constants and variables on arches that don't have a better single instruction like bswap. - the parameter needed to be named _x in the inline function to avoid namespace pollution. Macro parameters are in their own namespace, so naming them with leading underscores is just an obfuscation. Further investigation shows that rev.1.9 of amd64 endian.h by ed@ submitted by Cristoph Mallon cleaned up __bswap16() to use the inline function in C in all cases, instead of using an inline function with asm for non-constants, a macro like the new one above for constants (but without the sign extension bugs), and horrible ifdefs to join the macros. So for __bswap16() it became exactly like I want, except amd64 wants an MI __bswap16() whioch shouldn't be implemented here. Bruce From owner-svn-src-projects@FreeBSD.ORG Fri Aug 13 15:25:36 2010 Return-Path: Delivered-To: svn-src-projects@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DEE5A106566C; Fri, 13 Aug 2010 15:25:36 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from fallbackmx07.syd.optusnet.com.au (fallbackmx07.syd.optusnet.com.au [211.29.132.9]) by mx1.freebsd.org (Postfix) with ESMTP id 5C04D8FC16; Fri, 13 Aug 2010 15:25:35 +0000 (UTC) Received: from mail04.syd.optusnet.com.au (mail04.syd.optusnet.com.au [211.29.132.185]) by fallbackmx07.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id o7DCHSPH028150; Fri, 13 Aug 2010 22:17:28 +1000 Received: from c122-106-147-41.carlnfd1.nsw.optusnet.com.au (c122-106-147-41.carlnfd1.nsw.optusnet.com.au [122.106.147.41]) by mail04.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id o7DCHOed026217 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 13 Aug 2010 22:17:25 +1000 Date: Fri, 13 Aug 2010 22:17:24 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Jeff Roberson In-Reply-To: <201008130315.o7D3F2Yh077220@svn.freebsd.org> Message-ID: <20100813221511.R12886@delplex.bde.org> References: <201008130315.o7D3F2Yh077220@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-projects@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r211265 - in projects/ofed/head/sys: dev/hptmv kern sys X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Aug 2010 15:25:37 -0000 On Fri, 13 Aug 2010, Jeff Roberson wrote: > Log: > - Change sysctl arg2 to a intptr_t preserving the sign and expanding the > size so it can optionally hold a pointer. > Modified: projects/ofed/head/sys/kern/kern_jail.c > ============================================================================== > --- projects/ofed/head/sys/kern/kern_jail.c Fri Aug 13 03:14:08 2010 (r211264) > +++ projects/ofed/head/sys/kern/kern_jail.c Fri Aug 13 03:15:02 2010 (r211265) > @@ -4166,7 +4166,7 @@ sysctl_jail_param(SYSCTL_HANDLER_ARGS) > i = 0; > return (SYSCTL_OUT(req, &i, sizeof(i))); > case CTLTYPE_STRING: > - snprintf(numbuf, sizeof(numbuf), "%d", arg2); > + snprintf(numbuf, sizeof(numbuf), "%jd", arg2); > return > (sysctl_handle_string(oidp, numbuf, sizeof(numbuf), req)); > case CTLTYPE_STRUCT: > intptr_t is logically different from intmax_t, and is physically different on all 32-bit arches. Bruce From owner-svn-src-projects@FreeBSD.ORG Fri Aug 13 22:39:11 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A6E6C1065697; Fri, 13 Aug 2010 22:39:11 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 961288FC15; Fri, 13 Aug 2010 22:39:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7DMdB2E009260; Fri, 13 Aug 2010 22:39:11 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7DMdB7i009258; Fri, 13 Aug 2010 22:39:11 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <201008132239.o7DMdB7i009258@svn.freebsd.org> From: Jeff Roberson Date: Fri, 13 Aug 2010 22:39:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211293 - projects/ofed/head/sys/amd64/include X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Aug 2010 22:39:11 -0000 Author: jeff Date: Fri Aug 13 22:39:11 2010 New Revision: 211293 URL: http://svn.freebsd.org/changeset/base/211293 Log: - Provide a const testing wrapper for bswap16. - Use __inline to avoid compile problems with stricter compiler settings. Modified: projects/ofed/head/sys/amd64/include/endian.h Modified: projects/ofed/head/sys/amd64/include/endian.h ============================================================================== --- projects/ofed/head/sys/amd64/include/endian.h Fri Aug 13 22:08:42 2010 (r211292) +++ projects/ofed/head/sys/amd64/include/endian.h Fri Aug 13 22:39:11 2010 (r211293) @@ -69,7 +69,7 @@ extern "C" { #if defined(__GNUCLIKE_ASM) && defined(__GNUCLIKE_BUILTIN_CONSTANT_P) -static inline __uint32_t +static __inline __uint32_t __byte_swap_int_var(__uint32_t x) { register __uint32_t _x; @@ -96,7 +96,7 @@ __byte_swap_int_var(__uint32_t x) #endif /* __OPTIMIZE__ */ -static inline __uint64_t +static __inline __uint64_t __byte_swap_long_var(__uint64_t x) { register __uint64_t _x; @@ -127,7 +127,16 @@ __byte_swap_long_var(__uint64_t x) #endif /* __OPTIMIZE__ */ -#define __bswap16(_x) (__uint16_t)((_x) << 8 | (_x) >> 8) +#define __byte_swap_short_const(_x) (__uint16_t)((_x) << 8 | (_x) >> 8) + +static __inline __uint16_t +__byte_swap_short_var(__uint16_t x) +{ + return __byte_swap_short_const(x); +} + +#define __bswap16(x) (__builtin_constant_p(x) ? \ + __byte_swap_short_const(x) : __byte_swap_short_var(x)) #define __htonl(x) __bswap32(x) #define __htons(x) __bswap16(x) From owner-svn-src-projects@FreeBSD.ORG Sat Aug 14 22:35:20 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EFB23106567A; Sat, 14 Aug 2010 22:35:20 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DF6B18FC08; Sat, 14 Aug 2010 22:35:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7EMZKuS040869; Sat, 14 Aug 2010 22:35:20 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7EMZKv0040867; Sat, 14 Aug 2010 22:35:20 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <201008142235.o7EMZKv0040867@svn.freebsd.org> From: Jeff Roberson Date: Sat, 14 Aug 2010 22:35:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211320 - projects/ofed/head/sys/amd64/include X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Aug 2010 22:35:21 -0000 Author: jeff Date: Sat Aug 14 22:35:20 2010 New Revision: 211320 URL: http://svn.freebsd.org/changeset/base/211320 Log: - One more endian bug; cast the results of byte_swap_*_const() to the expected result type. Sometimes wider types are passed in but should not be produced. Modified: projects/ofed/head/sys/amd64/include/endian.h Modified: projects/ofed/head/sys/amd64/include/endian.h ============================================================================== --- projects/ofed/head/sys/amd64/include/endian.h Sat Aug 14 22:28:07 2010 (r211319) +++ projects/ofed/head/sys/amd64/include/endian.h Sat Aug 14 22:35:20 2010 (r211320) @@ -83,7 +83,7 @@ __byte_swap_int_var(__uint32_t x) #ifdef __OPTIMIZE__ #define __byte_swap_int_const(x) \ - ((((x) & 0xff000000) >> 24) | \ + (__uint32_t)((((x) & 0xff000000) >> 24) | \ (((x) & 0x00ff0000) >> 8) | \ (((x) & 0x0000ff00) << 8) | \ (((x) & 0x000000ff) << 24)) @@ -109,7 +109,7 @@ __byte_swap_long_var(__uint64_t x) #ifdef __OPTIMIZE__ #define __byte_swap_long_const(x) \ - ((__uint64_t)(((__uint64_t)x >> 56) | \ + (__uint64_t)((((__uint64_t)x >> 56) | \ (((__uint64_t)x >> 40) & 0xff00) | \ (((__uint64_t)x >> 24) & 0xff0000) | \ (((__uint64_t)x >> 8) & 0xff000000) | \