- /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- * Copyright (C) 2002-2004 Cluster File Systems, Inc.
- * Author: Eric Barton <eric@bartonsoftware.com>
+/*
+ * 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 <eric@bartonsoftware.com>
*/
#include "qswlnd.h"
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);
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);
}
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);
}
/**********************************************************************/
/* 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));
}
/* 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);
- 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));
}
* 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
/* 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;
+ module_put(THIS_MODULE);
}
int
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");
*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));
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) {
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);
}
/**********************************************************************/
/**********************************************************************/
/* 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);
return (0);
}
-MODULE_AUTHOR("Cluster File Systems, Inc. <info@clusterfs.com>");
+MODULE_AUTHOR("Sun Microsystems, Inc. <http://www.lustre.org/>");
MODULE_DESCRIPTION("Kernel Quadrics/Elan LND v1.01");
MODULE_LICENSE("GPL");