Whamcloud - gitweb
LU-1346 gnilnd: remove libcfs abstractions
[fs/lustre-release.git] / lnet / klnds / ralnd / ralnd.h
index 9d6fcab..bfc863f 100644 (file)
@@ -26,6 +26,8 @@
 /*
  * Copyright (c) 2004, 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/
@@ -36,9 +38,6 @@
  * Author: Eric Barton <eric@bartonsoftware.com>
  */
 
-#ifndef AUTOCONF_INCLUDED
-#include <linux/config.h>
-#endif
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/mm.h>
@@ -48,7 +47,6 @@
 #include <linux/unistd.h>
 #include <linux/uio.h>
 
-#include <asm/system.h>
 #include <asm/uaccess.h>
 #include <asm/io.h>
 
@@ -100,65 +98,65 @@ typedef struct
         int              *kra_max_immediate;    /* immediate payload breakpoint */
 
 #if CONFIG_SYSCTL && !CFS_SYSFS_MODULE_PARM
-        cfs_sysctl_table_header_t *kra_sysctl;  /* sysctl interface */
+       struct ctl_table_header *kra_sysctl;  /* sysctl interface */
 #endif
 } kra_tunables_t;
 
 typedef struct
 {
-        RAP_PVOID              rad_handle;    /* device handle */
-        RAP_PVOID              rad_fma_cqh;   /* FMA completion queue handle */
-        RAP_PVOID              rad_rdma_cqh;  /* rdma completion queue handle */
-        int                    rad_id;        /* device id */
-        int                    rad_idx;       /* index in kra_devices */
-        int                    rad_ready;     /* set by device callback */
-        cfs_list_t             rad_ready_conns;/* connections ready to tx/rx */
-        cfs_list_t             rad_new_conns; /* new connections to complete */
-        cfs_waitq_t            rad_waitq;     /* scheduler waits here */
-        cfs_spinlock_t         rad_lock;      /* serialise */
-        void                  *rad_scheduler; /* scheduling thread */
-        unsigned int           rad_nphysmap;  /* # phys mappings */
-        unsigned int           rad_nppphysmap;/* # phys pages mapped */
-        unsigned int           rad_nvirtmap;  /* # virt mappings */
-        unsigned long          rad_nobvirtmap;/* # virt bytes mapped */
+       RAP_PVOID              rad_handle;    /* device handle */
+       RAP_PVOID              rad_fma_cqh;   /* FMA completion queue handle */
+       RAP_PVOID              rad_rdma_cqh;  /* rdma completion queue handle */
+       int                    rad_id;        /* device id */
+       int                    rad_idx;       /* index in kra_devices */
+       int                    rad_ready;     /* set by device callback */
+       cfs_list_t             rad_ready_conns;/* connections ready to tx/rx */
+       cfs_list_t             rad_new_conns; /* new connections to complete */
+       wait_queue_head_t      rad_waitq;     /* scheduler waits here */
+       spinlock_t             rad_lock;        /* serialise */
+       void                   *rad_scheduler; /* scheduling thread */
+       unsigned int           rad_nphysmap;  /* # phys mappings */
+       unsigned int           rad_nppphysmap;/* # phys pages mapped */
+       unsigned int           rad_nvirtmap;  /* # virt mappings */
+       unsigned long          rad_nobvirtmap;/* # virt bytes mapped */
 } kra_device_t;
 
 typedef struct
 {
-        int               kra_init;            /* initialisation state */
-        int               kra_shutdown;        /* shut down? */
-        cfs_atomic_t      kra_nthreads;        /* # live threads */
-        lnet_ni_t        *kra_ni;              /* _the_ nal instance */
-
-        kra_device_t      kra_devices[RANAL_MAXDEVS]; /* device/ptag/cq */
-        int               kra_ndevs;           /* # devices */
-
-        cfs_rwlock_t      kra_global_lock;     /* stabilize peer/conn ops */
-
-        cfs_list_t       *kra_peers;           /* hash table of all my known peers */
-        int               kra_peer_hash_size;  /* size of kra_peers */
-        cfs_atomic_t      kra_npeers;          /* # peers extant */
-        int               kra_nonewpeers;      /* prevent new peers */
-
-        cfs_list_t       *kra_conns;           /* conns hashed by cqid */
-        int               kra_conn_hash_size;  /* size of kra_conns */
-        __u64             kra_peerstamp;       /* when I started up */
-        __u64             kra_connstamp;       /* conn stamp generator */
-        int               kra_next_cqid;       /* cqid generator */
-        cfs_atomic_t      kra_nconns;          /* # connections extant */
-
-        long              kra_new_min_timeout; /* minimum timeout on any new conn */
-        cfs_waitq_t       kra_reaper_waitq;    /* reaper sleeps here */
-        cfs_spinlock_t    kra_reaper_lock;     /* serialise */
-
-        cfs_list_t        kra_connd_peers;     /* peers waiting for a connection */
-        cfs_list_t        kra_connd_acceptq;   /* accepted sockets to handshake */
-        cfs_waitq_t       kra_connd_waitq;     /* connection daemons sleep here */
-        cfs_spinlock_t    kra_connd_lock;      /* serialise */
-
-        cfs_list_t        kra_idle_txs;        /* idle tx descriptors */
-        __u64             kra_next_tx_cookie;  /* RDMA completion cookie */
-        cfs_spinlock_t    kra_tx_lock;         /* serialise */
+       int               kra_init;            /* initialisation state */
+       int               kra_shutdown;        /* shut down? */
+       cfs_atomic_t      kra_nthreads;        /* # live threads */
+       lnet_ni_t        *kra_ni;              /* _the_ nal instance */
+
+       kra_device_t      kra_devices[RANAL_MAXDEVS]; /* device/ptag/cq */
+       int               kra_ndevs;           /* # devices */
+
+       rwlock_t          kra_global_lock;      /* stabilize peer/conn ops */
+
+       cfs_list_t       *kra_peers;           /* hash table of all my known peers */
+       int               kra_peer_hash_size;  /* size of kra_peers */
+       cfs_atomic_t      kra_npeers;          /* # peers extant */
+       int               kra_nonewpeers;      /* prevent new peers */
+
+       cfs_list_t       *kra_conns;           /* conns hashed by cqid */
+       int               kra_conn_hash_size;  /* size of kra_conns */
+       __u64             kra_peerstamp;       /* when I started up */
+       __u64             kra_connstamp;       /* conn stamp generator */
+       int               kra_next_cqid;       /* cqid generator */
+       cfs_atomic_t      kra_nconns;          /* # connections extant */
+
+       long              kra_new_min_timeout; /* minimum timeout on any new conn */
+       wait_queue_head_t       kra_reaper_waitq;    /* reaper sleeps here */
+       spinlock_t        kra_reaper_lock;     /* serialise */
+
+       cfs_list_t        kra_connd_peers;     /* peers waiting for a connection */
+       cfs_list_t        kra_connd_acceptq;   /* accepted sockets to handshake */
+       wait_queue_head_t       kra_connd_waitq;     /* connection daemons sleep here */
+       spinlock_t        kra_connd_lock;       /* serialise */
+
+       cfs_list_t        kra_idle_txs;        /* idle tx descriptors */
+       __u64             kra_next_tx_cookie;  /* RDMA completion cookie */
+       spinlock_t        kra_tx_lock;          /* serialise */
 } kra_data_t;
 
 #define RANAL_INIT_NOTHING         0
@@ -312,7 +310,7 @@ typedef struct kra_conn
         unsigned int        rac_close_recvd;   /* I've received CLOSE */
         unsigned int        rac_state;         /* connection state */
         unsigned int        rac_scheduled;     /* being attented to */
-        cfs_spinlock_t      rac_lock;          /* serialise */
+       spinlock_t          rac_lock;           /* serialise */
         kra_device_t       *rac_device;        /* which device */
         RAP_PVOID           rac_rihandle;      /* RA endpoint */
         kra_msg_t          *rac_rxmsg;         /* incoming message (FMA prefix) */
@@ -323,20 +321,19 @@ typedef struct kra_conn
 #define RANAL_CONN_CLOSING         1
 #define RANAL_CONN_CLOSED          2
 
-typedef struct kra_peer
-{
-        cfs_list_t          rap_list;         /* stash on global peer list */
-        cfs_list_t          rap_connd_list;   /* schedule on kra_connd_peers */
-        cfs_list_t          rap_conns;        /* all active connections */
-        cfs_list_t          rap_tx_queue;     /* msgs waiting for a conn */
-        lnet_nid_t          rap_nid;          /* who's on the other end(s) */
-        __u32               rap_ip;           /* IP address of peer */
-        int                 rap_port;         /* port on which peer listens */
-        cfs_atomic_t        rap_refcount;     /* # users */
-        int                 rap_persistence;  /* "known" peer refs */
-        int                 rap_connecting;   /* connection forming */
-        unsigned long       rap_reconnect_time; /* CURRENT_SECONDS when reconnect OK */
-        unsigned long       rap_reconnect_interval; /* exponential backoff */
+typedef struct kra_peer {
+       cfs_list_t          rap_list;         /* stash on global peer list */
+       cfs_list_t          rap_connd_list;   /* schedule on kra_connd_peers */
+       cfs_list_t          rap_conns;        /* all active connections */
+       cfs_list_t          rap_tx_queue;     /* msgs waiting for a conn */
+       lnet_nid_t          rap_nid;          /* who's on the other end(s) */
+       __u32               rap_ip;           /* IP address of peer */
+       int                 rap_port;         /* port on which peer listens */
+       cfs_atomic_t        rap_refcount;     /* # users */
+       int                 rap_persistence;  /* "known" peer refs */
+       int                 rap_connecting;   /* connection forming */
+       unsigned long       rap_reconnect_time; /* get_seconds() when reconnect OK */
+       unsigned long       rap_reconnect_interval; /* exponential backoff */
 } kra_peer_t;
 
 extern kra_data_t      kranal_data;
@@ -441,7 +438,7 @@ int kranal_recv(lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg,
 int kranal_accept(lnet_ni_t *ni, struct socket *sock);
 
 extern void kranal_free_acceptsock (kra_acceptsock_t *ras);
-extern int kranal_listener_procint (cfs_sysctl_table_t *table,
+extern int kranal_listener_procint (struct ctl_table *table,
                                     int write, struct file *filp,
                                     void *buffer, size_t *lenp);
 extern void kranal_update_reaper_timeout (long timeout);
@@ -454,7 +451,7 @@ extern kra_peer_t *kranal_find_peer_locked (lnet_nid_t nid);
 extern void kranal_post_fma (kra_conn_t *conn, kra_tx_t *tx);
 extern int kranal_del_peer (lnet_nid_t nid);
 extern void kranal_device_callback (RAP_INT32 devid, RAP_PVOID arg);
-extern int kranal_thread_start (int(*fn)(void *arg), void *arg);
+extern int kranal_thread_start(int(*fn)(void *arg), void *arg, char *name);
 extern int kranal_connd (void *arg);
 extern int kranal_reaper (void *arg);
 extern int kranal_scheduler (void *arg);