X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lnet%2Fklnds%2Fqswlnd%2Fqswlnd.c;h=fa8e8f45e13ebaaa6f2e0f4055198531318e0a13;hp=79986c132cf5508854c0062bb85b9333b86adc88;hb=cc29ab50d271f62f540e71e23d041d2e414c2397;hpb=e84e89c90bfbe7a9e3bcfc9cdadb79dd9ee6c11b diff --git a/lnet/klnds/qswlnd/qswlnd.c b/lnet/klnds/qswlnd/qswlnd.c index 79986c1..fa8e8f4 100644 --- a/lnet/klnds/qswlnd/qswlnd.c +++ b/lnet/klnds/qswlnd/qswlnd.c @@ -1,22 +1,41 @@ /* - * Copyright (C) 2002-2004 Cluster File Systems, Inc. - * Author: Eric Barton + * GPL HEADER START * - * This file is part of Portals, http://www.lustre.org + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Portals 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. * - * Portals 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 Portals; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * 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 (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Use is subject to license terms. + * + * Copyright (c) 2012, Intel Corporation. + */ +/* + * This file is part of Lustre, http://www.lustre.org/ + * Lustre is a trademark of Sun Microsystems, Inc. + * + * lnet/klnds/qswlnd/qswlnd.c + * + * Author: Eric Barton */ #include "qswlnd.h" @@ -38,19 +57,19 @@ int kqswnal_get_tx_desc (struct libcfs_ioctl_data *data) { unsigned long flags; - struct list_head *tmp; + cfs_list_t *tmp; kqswnal_tx_t *ktx; lnet_hdr_t *hdr; int index = data->ioc_count; int rc = -ENOENT; - spin_lock_irqsave (&kqswnal_data.kqn_idletxd_lock, flags); + spin_lock_irqsave(&kqswnal_data.kqn_idletxd_lock, flags); - list_for_each (tmp, &kqswnal_data.kqn_activetxds) { + cfs_list_for_each (tmp, &kqswnal_data.kqn_activetxds) { if (index-- != 0) continue; - ktx = list_entry (tmp, kqswnal_tx_t, ktx_list); + ktx = cfs_list_entry (tmp, kqswnal_tx_t, ktx_list); hdr = (lnet_hdr_t *)ktx->ktx_buffer; data->ioc_count = le32_to_cpu(hdr->payload_length); @@ -58,13 +77,14 @@ kqswnal_get_tx_desc (struct libcfs_ioctl_data *data) data->ioc_u64[0] = ktx->ktx_nid; data->ioc_u32[0] = le32_to_cpu(hdr->type); data->ioc_u32[1] = ktx->ktx_launcher; - data->ioc_flags = (list_empty (&ktx->ktx_schedlist) ? 0 : 1) | - (ktx->ktx_state << 2); + data->ioc_flags = + (cfs_list_empty (&ktx->ktx_schedlist) ? 0 : 1) | + (ktx->ktx_state << 2); rc = 0; break; } - - spin_unlock_irqrestore (&kqswnal_data.kqn_idletxd_lock, flags); + + spin_unlock_irqrestore(&kqswnal_data.kqn_idletxd_lock, flags); return (rc); } @@ -82,14 +102,14 @@ kqswnal_ctl (lnet_ni_t *ni, unsigned int cmd, void *arg) case IOC_LIBCFS_REGISTER_MYNID: if (data->ioc_nid == ni->ni_nid) return 0; - + LASSERT (LNET_NIDNET(data->ioc_nid) == LNET_NIDNET(ni->ni_nid)); CERROR("obsolete IOC_LIBCFS_REGISTER_MYNID for %s(%s)\n", libcfs_nid2str(data->ioc_nid), libcfs_nid2str(ni->ni_nid)); return 0; - + default: return (-EINVAL); } @@ -149,7 +169,7 @@ kqswnal_shutdown(lnet_ni_t *ni) /* NB ep_free_xmtr() returns only after all outstanding transmits * have called their callback... */ - LASSERT(list_empty(&kqswnal_data.kqn_activetxds)); + LASSERT(cfs_list_empty(&kqswnal_data.kqn_activetxds)); /**********************************************************************/ /* flag threads to terminate, wake them and wait for them to die */ @@ -167,9 +187,9 @@ kqswnal_shutdown(lnet_ni_t *ni) * I control the horizontals and the verticals... */ - LASSERT (list_empty (&kqswnal_data.kqn_readyrxds)); - LASSERT (list_empty (&kqswnal_data.kqn_donetxds)); - LASSERT (list_empty (&kqswnal_data.kqn_delayedtxds)); + LASSERT (cfs_list_empty (&kqswnal_data.kqn_readyrxds)); + LASSERT (cfs_list_empty (&kqswnal_data.kqn_donetxds)); + LASSERT (cfs_list_empty (&kqswnal_data.kqn_delayedtxds)); /**********************************************************************/ /* Unmap message buffers and free all descriptors and buffers @@ -234,7 +254,7 @@ kqswnal_shutdown(lnet_ni_t *ni) CDEBUG (D_MALLOC, "done kmem %d\n", atomic_read(&libcfs_kmemory)); - PORTAL_MODULE_UNUSE; + module_put(THIS_MODULE); } int @@ -249,12 +269,6 @@ kqswnal_startup (lnet_ni_t *ni) LASSERT (ni->ni_lnd == &the_kqswlnd); -#if KQSW_CKSUM - if (the_lnet.ln_ptlcompat != 0) { - CERROR("Checksumming version not portals compatible\n"); - return -ENODEV; - } -#endif /* Only 1 instance supported */ if (kqswnal_data.kqn_init != KQN_INIT_NOTHING) { CERROR ("Only 1 instance supported\n"); @@ -268,10 +282,10 @@ kqswnal_startup (lnet_ni_t *ni) if (*kqswnal_tunables.kqn_credits >= *kqswnal_tunables.kqn_ntxmsgs) { - LCONSOLE_ERROR(0x12e, "Configuration error: please set " - "ntxmsgs(%d) > credits(%d)\n", - *kqswnal_tunables.kqn_ntxmsgs, - *kqswnal_tunables.kqn_credits); + LCONSOLE_ERROR_MSG(0x12e, "Configuration error: please set " + "ntxmsgs(%d) > credits(%d)\n", + *kqswnal_tunables.kqn_ntxmsgs, + *kqswnal_tunables.kqn_credits); } CDEBUG (D_MALLOC, "start kmem %d\n", atomic_read(&libcfs_kmemory)); @@ -284,20 +298,20 @@ kqswnal_startup (lnet_ni_t *ni) ni->ni_peertxcredits = *kqswnal_tunables.kqn_peercredits; ni->ni_maxtxcredits = *kqswnal_tunables.kqn_credits; - INIT_LIST_HEAD (&kqswnal_data.kqn_idletxds); - INIT_LIST_HEAD (&kqswnal_data.kqn_activetxds); - spin_lock_init (&kqswnal_data.kqn_idletxd_lock); + CFS_INIT_LIST_HEAD (&kqswnal_data.kqn_idletxds); + CFS_INIT_LIST_HEAD (&kqswnal_data.kqn_activetxds); + spin_lock_init(&kqswnal_data.kqn_idletxd_lock); - INIT_LIST_HEAD (&kqswnal_data.kqn_delayedtxds); - INIT_LIST_HEAD (&kqswnal_data.kqn_donetxds); - INIT_LIST_HEAD (&kqswnal_data.kqn_readyrxds); + CFS_INIT_LIST_HEAD (&kqswnal_data.kqn_delayedtxds); + CFS_INIT_LIST_HEAD (&kqswnal_data.kqn_donetxds); + CFS_INIT_LIST_HEAD (&kqswnal_data.kqn_readyrxds); - spin_lock_init (&kqswnal_data.kqn_sched_lock); + spin_lock_init(&kqswnal_data.kqn_sched_lock); init_waitqueue_head (&kqswnal_data.kqn_sched_waitq); /* pointers/lists/locks initialised */ kqswnal_data.kqn_init = KQN_INIT_DATA; - PORTAL_MODULE_USE; + try_module_get(THIS_MODULE); kqswnal_data.kqn_ep = ep_system(); if (kqswnal_data.kqn_ep == NULL) { @@ -419,12 +433,12 @@ kqswnal_startup (lnet_ni_t *ni) ktx->ktx_basepage = basepage + premapped_pages; /* message mapping starts here */ ktx->ktx_npages = KQSW_NTXMSGPAGES - premapped_pages; /* for this many pages */ - INIT_LIST_HEAD (&ktx->ktx_schedlist); + CFS_INIT_LIST_HEAD (&ktx->ktx_schedlist); ktx->ktx_state = KTX_IDLE; ktx->ktx_rail = -1; /* unset rail */ - list_add_tail (&ktx->ktx_list, &kqswnal_data.kqn_idletxds); + cfs_list_add_tail (&ktx->ktx_list, &kqswnal_data.kqn_idletxds); } /**********************************************************************/ @@ -512,7 +526,8 @@ kqswnal_startup (lnet_ni_t *ni) /**********************************************************************/ /* Spawn scheduling threads */ for (i = 0; i < num_online_cpus(); i++) { - rc = kqswnal_thread_start (kqswnal_scheduler, NULL); + rc = kqswnal_thread_start(kqswnal_scheduler, NULL, + "kqswnal_sched"); if (rc != 0) { CERROR ("failed to spawn scheduling thread: %d\n", rc); @@ -544,7 +559,7 @@ kqswnal_initialise (void) return (0); } -MODULE_AUTHOR("Cluster File Systems, Inc. "); +MODULE_AUTHOR("Sun Microsystems, Inc. "); MODULE_DESCRIPTION("Kernel Quadrics/Elan LND v1.01"); MODULE_LICENSE("GPL");