/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
* vim:expandtab:shiftwidth=8:tabstop=8:
*
- * Copyright (C) 2004 Cluster File Systems, Inc.
- * Author: Eric Barton <eric@bartonsoftware.com>
+ * GPL HEADER START
*
- * This file is part of Lustre, http://www.lustre.org.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Lustre is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 only,
+ * as published by the Free Software Foundation.
*
- * Lustre is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License version 2 for more details (a copy is included
+ * in the LICENSE file that accompanied this code).
*
- * You should have received a copy of the GNU General Public License
- * along with Lustre; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU General Public License
+ * version 2 along with this program; If not, see
+ * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
*
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ * GPL HEADER END
+ */
+/*
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved
+ * Use is subject to license terms.
+ */
+/*
+ * This file is part of Lustre, http://www.lustre.org/
+ * Lustre is a trademark of Sun Microsystems, Inc.
+ *
+ * lnet/klnds/openiblnd/openiblnd.c
+ *
+ * Author: Eric Barton <eric@bartonsoftware.com>
*/
#include "openiblnd.h"
msg->ibm_credits = credits;
/* ibm_nob */
msg->ibm_cksum = 0;
- msg->ibm_srcnid = lnet_ptlcompat_srcnid(kibnal_data.kib_ni->ni_nid,
- dstnid);
+ msg->ibm_srcnid = kibnal_data.kib_ni->ni_nid;
msg->ibm_srcstamp = kibnal_data.kib_incarnation;
msg->ibm_dstnid = dstnid;
msg->ibm_dststamp = dststamp;
goto out;
}
- if (!lnet_ptlcompat_matchnid(kibnal_data.kib_ni->ni_nid,
- msg->ibm_dstnid) ||
+ if (kibnal_data.kib_ni->ni_nid != msg->ibm_dstnid ||
msg->ibm_dststamp != kibnal_data.kib_incarnation) {
CERROR("Unexpected dst NID/stamp %s/"LPX64" from "
"%s at %u.%u.%u.%u/%d\n",
goto out;
}
- if (!lnet_ptlcompat_matchnid(peer->ibp_nid, msg->ibm_srcnid)) {
+ if (peer->ibp_nid != msg->ibm_srcnid) {
CERROR("Unexpected src NID %s from %s at %u.%u.%u.%u/%d\n",
libcfs_nid2str(msg->ibm_srcnid),
libcfs_nid2str(peer->ibp_nid),
if (msg->ibm_magic != IBNAL_MSG_MAGIC &&
msg->ibm_magic != __swab32(IBNAL_MSG_MAGIC)) {
/* Unexpected magic! */
- if (the_lnet.ln_ptlcompat == 0) {
- if (msg->ibm_magic == LNET_PROTO_MAGIC ||
- msg->ibm_magic == __swab32(LNET_PROTO_MAGIC)) {
- /* future protocol version compatibility!
- * When LNET unifies protocols over all LNDs,
- * the first thing sent will be a version
- * query. I send back a reply in my current
- * protocol to tell her I'm "old" */
- kibnal_init_msg(msg, 0, 0);
- kibnal_pack_msg(msg, IBNAL_MSG_VERSION, 0,
- LNET_NID_ANY, 0);
- reject = 1;
- goto reply;
- }
-
- CERROR ("Bad magic(1) %#08x (%#08x expected) from "
- "%u.%u.%u.%u/%d\n", msg->ibm_magic,
- IBNAL_MSG_MAGIC, HIPQUAD(peer_ip), peer_port);
- goto out;
+ if (msg->ibm_magic == LNET_PROTO_MAGIC ||
+ msg->ibm_magic == __swab32(LNET_PROTO_MAGIC)) {
+ /* future protocol version compatibility! When LNET
+ * unifies protocols over all LNDs, the first thing
+ * sent will be a version query. I send back a reply
+ * in my current protocol to tell her I'm "old" */
+ kibnal_init_msg(msg, 0, 0);
+ kibnal_pack_msg(msg, IBNAL_MSG_VERSION, 0,
+ LNET_NID_ANY, 0);
+ reject = 1;
+ goto reply;
}
- /* When portals compatibility is set, I may be passed a new
- * connection "blindly" by the acceptor, and I have to
- * determine if my peer has sent an acceptor connection request
- * or not. */
- rc = lnet_accept(kibnal_data.kib_ni, sock, msg->ibm_magic);
- if (rc != 0)
- goto out;
-
- /* It was an acceptor connection request!
- * Now I should see my magic... */
- rc = libcfs_sock_read(sock, &msg->ibm_magic,
- sizeof(msg->ibm_magic),
- lnet_acceptor_timeout());
- if (rc != 0) {
- CERROR("Error %d receiving svcqry(2) from %u.%u.%u.%u/%d\n",
- rc, HIPQUAD(peer_ip), peer_port);
- goto out;
- }
-
- if (msg->ibm_magic != IBNAL_MSG_MAGIC &&
- msg->ibm_magic != __swab32(IBNAL_MSG_MAGIC)) {
- CERROR ("Bad magic(2) %#08x (%#08x expected) from "
- "%u.%u.%u.%u/%d\n", msg->ibm_magic,
- IBNAL_MSG_MAGIC, HIPQUAD(peer_ip), peer_port);
- goto out;
- }
+ CERROR ("Bad magic(1) %#08x (%#08x expected) from "
+ "%u.%u.%u.%u/%d\n", msg->ibm_magic,
+ IBNAL_MSG_MAGIC, HIPQUAD(peer_ip), peer_port);
+ goto out;
}
/* Now check version */
rc = libcfs_sock_read(sock, &msg->ibm_version, sizeof(msg->ibm_version),
lnet_acceptor_timeout());
if (rc != 0) {
- CERROR("Error %d receiving svcqry(3) from %u.%u.%u.%u/%d\n",
+ CERROR("Error %d receiving svcqry(2) from %u.%u.%u.%u/%d\n",
rc, HIPQUAD(peer_ip), peer_port);
goto out;
}
version = (msg->ibm_magic == IBNAL_MSG_MAGIC) ?
- msg->ibm_version : __swab32(msg->ibm_version);
+ msg->ibm_version : __swab16(msg->ibm_version);
/* Peer is a different protocol version: reply in my current protocol
* to tell her I'm "old" */
if (version != IBNAL_MSG_VERSION &&
offsetof(kib_msg_t, ibm_type),
lnet_acceptor_timeout());
if (rc != 0) {
- CERROR("Error %d receiving svcqry(4) from %u.%u.%u.%u/%d\n",
+ CERROR("Error %d receiving svcqry(3) from %u.%u.%u.%u/%d\n",
rc, HIPQUAD(peer_ip), peer_port);
goto out;
}
goto out;
}
- if (!lnet_ptlcompat_matchnid(kibnal_data.kib_ni->ni_nid,
- msg->ibm_dstnid)) {
+ if (kibnal_data.kib_ni->ni_nid != msg->ibm_dstnid) {
CERROR("Unexpected dstnid %s: expected %s from %u.%u.%u.%u/%d\n",
libcfs_nid2str(msg->ibm_dstnid),
libcfs_nid2str(kibnal_data.kib_ni->ni_nid),
/* Only complain if we're not rejecting */
CERROR("Error %d replying to svcqry from %u.%u.%u.%u/%d\n",
rc, HIPQUAD(peer_ip), peer_port);
- goto out;
}
out:
write_lock_irqsave (&kibnal_data.kib_global_lock, flags);
+ /* I'm always called with a reference on kibnal_data.kib_ni
+ * so shutdown can't have started */
+ LASSERT (kibnal_data.kib_nonewpeers == 0);
+
peer2 = kibnal_find_peer_locked (nid);
if (peer2 != NULL) {
kibnal_peer_decref(peer);
}
}
- /* We can post up to IBLND_MSG_QUEUE_SIZE immediate/req messages and
- * the same # of ack/nak/rdma+done messages */
+ /* We can post up to IBNAL_RX_MSGS, which may also include an
+ * additional RDMA work item */
params.qp_create = (struct ib_qp_create_param) {
.limit = {
- .max_outstanding_send_request = 3 * IBNAL_MSG_QUEUE_SIZE,
+ .max_outstanding_send_request = 2 * IBNAL_RX_MSGS,
.max_outstanding_receive_request = IBNAL_RX_MSGS,
.max_send_gather_element = 1,
.max_receive_scatter_element = 1,
snprintf(ipif_name, sizeof(ipif_name), "%s%d",
*kibnal_tunables.kib_ipif_basename, i);
- if (strlen(ipif_name) == sizeof(ipif_name - 1)) {
+ if (strlen(ipif_name) == sizeof(ipif_name) - 1) {
CERROR("IPoIB interface name %s truncated\n", ipif_name);
return -EINVAL;
}
return (0);
}
-MODULE_AUTHOR("Cluster File Systems, Inc. <info@clusterfs.com>");
+MODULE_AUTHOR("Sun Microsystems, Inc. <http://www.lustre.org/>");
#ifdef USING_TSAPI
MODULE_DESCRIPTION("Kernel Cisco IB LND v1.00");
#else
module_init(kibnal_module_init);
module_exit(kibnal_module_fini);
-