X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lnet%2Fklnds%2Fopeniblnd%2Fopeniblnd.c;h=5c3dc505ddaae089eb4192f2ea0ca49079ad0e56;hb=b2903c1ae5fa353103223d997462a436ed5bb181;hp=3850d7e44622b6cbdac34cc3d51458c543ac4281;hpb=751d79d445a70980710e57365bfa01487fe54a15;p=fs%2Flustre-release.git diff --git a/lnet/klnds/openiblnd/openiblnd.c b/lnet/klnds/openiblnd/openiblnd.c index 3850d7e..5c3dc50 100644 --- a/lnet/klnds/openiblnd/openiblnd.c +++ b/lnet/klnds/openiblnd/openiblnd.c @@ -1,24 +1,41 @@ /* -*- 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 + * 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 */ #include "openiblnd.h" @@ -72,8 +89,7 @@ kibnal_pack_msg(kib_msg_t *msg, int version, int credits, 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; @@ -317,8 +333,7 @@ kibnal_make_svcqry (kib_conn_t *conn) 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", @@ -329,7 +344,7 @@ kibnal_make_svcqry (kib_conn_t *conn) 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), @@ -383,53 +398,23 @@ kibnal_handle_svcqry (struct socket *sock) 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 */ @@ -437,13 +422,13 @@ kibnal_handle_svcqry (struct socket *sock) 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 && @@ -460,7 +445,7 @@ kibnal_handle_svcqry (struct socket *sock) 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; } @@ -478,8 +463,7 @@ kibnal_handle_svcqry (struct socket *sock) 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), @@ -506,7 +490,6 @@ kibnal_handle_svcqry (struct socket *sock) /* 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: @@ -786,6 +769,10 @@ kibnal_add_persistent_peer (lnet_nid_t nid, __u32 ip, int port) 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); @@ -984,12 +971,12 @@ kibnal_create_conn (void) } } - /* 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, @@ -1876,7 +1863,7 @@ kibnal_module_init (void) return (0); } -MODULE_AUTHOR("Cluster File Systems, Inc. "); +MODULE_AUTHOR("Sun Microsystems, Inc. "); #ifdef USING_TSAPI MODULE_DESCRIPTION("Kernel Cisco IB LND v1.00"); #else @@ -1886,4 +1873,3 @@ MODULE_LICENSE("GPL"); module_init(kibnal_module_init); module_exit(kibnal_module_fini); -