X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lnet%2Fklnds%2Fqswlnd%2Fqswlnd.c;h=d4b543c251ef2a9191ad45d735a12d671650419c;hp=79986c132cf5508854c0062bb85b9333b86adc88;hb=bfb38a047e0fc12e68a7aa3a2d2ec7a6e9d696ed;hpb=e84e89c90bfbe7a9e3bcfc9cdadb79dd9ee6c11b diff --git a/lnet/klnds/qswlnd/qswlnd.c b/lnet/klnds/qswlnd/qswlnd.c index 79986c1..d4b543c 100644 --- a/lnet/klnds/qswlnd/qswlnd.c +++ b/lnet/klnds/qswlnd/qswlnd.c @@ -1,22 +1,39 @@ /* - * 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. + */ +/* + * 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 +55,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); + cfs_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 +75,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); + + cfs_spin_unlock_irqrestore (&kqswnal_data.kqn_idletxd_lock, flags); return (rc); } @@ -82,14 +100,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); } @@ -118,15 +136,15 @@ kqswnal_shutdown(lnet_ni_t *ni) /**********************************************************************/ /* Signal the start of shutdown... */ - spin_lock_irqsave(&kqswnal_data.kqn_idletxd_lock, flags); + cfs_spin_lock_irqsave(&kqswnal_data.kqn_idletxd_lock, flags); kqswnal_data.kqn_shuttingdown = 1; - spin_unlock_irqrestore(&kqswnal_data.kqn_idletxd_lock, flags); + cfs_spin_unlock_irqrestore(&kqswnal_data.kqn_idletxd_lock, flags); /**********************************************************************/ /* wait for sends that have allocated a tx desc to launch or give up */ - while (atomic_read (&kqswnal_data.kqn_pending_txs) != 0) { + while (cfs_atomic_read (&kqswnal_data.kqn_pending_txs) != 0) { CDEBUG(D_NET, "waiting for %d pending sends\n", - atomic_read (&kqswnal_data.kqn_pending_txs)); + cfs_atomic_read (&kqswnal_data.kqn_pending_txs)); cfs_pause(cfs_time_seconds(1)); } @@ -149,16 +167,16 @@ 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 */ kqswnal_data.kqn_shuttingdown = 2; - wake_up_all (&kqswnal_data.kqn_sched_waitq); + cfs_waitq_broadcast (&kqswnal_data.kqn_sched_waitq); - while (atomic_read (&kqswnal_data.kqn_nthreads) != 0) { + while (cfs_atomic_read (&kqswnal_data.kqn_nthreads) != 0) { CDEBUG(D_NET, "waiting for %d threads to terminate\n", - atomic_read (&kqswnal_data.kqn_nthreads)); + cfs_atomic_read (&kqswnal_data.kqn_nthreads)); cfs_pause(cfs_time_seconds(1)); } @@ -167,9 +185,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 @@ -232,7 +250,7 @@ kqswnal_shutdown(lnet_ni_t *ni) /* resets flags, pointers to NULL etc */ memset(&kqswnal_data, 0, sizeof (kqswnal_data)); - CDEBUG (D_MALLOC, "done kmem %d\n", atomic_read(&libcfs_kmemory)); + CDEBUG (D_MALLOC, "done kmem %d\n", cfs_atomic_read(&libcfs_kmemory)); PORTAL_MODULE_UNUSE; } @@ -249,12 +267,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,13 +280,13 @@ 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)); + CDEBUG (D_MALLOC, "start kmem %d\n", cfs_atomic_read(&libcfs_kmemory)); /* ensure all pointers NULL etc */ memset (&kqswnal_data, 0, sizeof (kqswnal_data)); @@ -284,16 +296,16 @@ 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); + cfs_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); - init_waitqueue_head (&kqswnal_data.kqn_sched_waitq); + cfs_spin_lock_init (&kqswnal_data.kqn_sched_lock); + cfs_waitq_init (&kqswnal_data.kqn_sched_waitq); /* pointers/lists/locks initialised */ kqswnal_data.kqn_init = KQN_INIT_DATA; @@ -419,12 +431,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); } /**********************************************************************/ @@ -511,7 +523,7 @@ kqswnal_startup (lnet_ni_t *ni) /**********************************************************************/ /* Spawn scheduling threads */ - for (i = 0; i < num_online_cpus(); i++) { + for (i = 0; i < cfs_num_online_cpus(); i++) { rc = kqswnal_thread_start (kqswnal_scheduler, NULL); if (rc != 0) { @@ -544,7 +556,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");