Whamcloud - gitweb
b=14425
[fs/lustre-release.git] / lnet / klnds / ptllnd / ptllnd.h
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  * Copyright (C) 2005 Cluster File Systems, Inc. All rights reserved.
5  *   Author: PJ Kirner <pjkirner@clusterfs.com>
6  *
7  *   This file is part of the Lustre file system, http://www.lustre.org
8  *   Lustre is a trademark of Cluster File Systems, Inc.
9  *
10  *   This file is confidential source code owned by Cluster File Systems.
11  *   No viewing, modification, compilation, redistribution, or any other
12  *   form of use is permitted except through a signed license agreement.
13  *
14  *   If you have not signed such an agreement, then you have no rights to
15  *   this file.  Please destroy it immediately and contact CFS.
16  *
17  */
18
19 #ifndef EXPORT_SYMTAB
20 # define EXPORT_SYMTAB
21 #endif
22 #ifndef AUTOCONF_INCLUDED
23 #include <linux/config.h>
24 #endif
25 #include <linux/module.h>
26 #include <linux/kernel.h>
27 #include <linux/mm.h>
28 #include <linux/string.h>
29 #include <linux/stat.h>
30 #include <linux/errno.h>
31 #include <linux/smp_lock.h>
32 #include <linux/unistd.h>
33 #include <linux/uio.h>
34
35 #include <asm/system.h>
36 #include <asm/uaccess.h>
37 #include <asm/io.h>
38
39 #include <linux/init.h>
40 #include <linux/fs.h>
41 #include <linux/file.h>
42 #include <linux/stat.h>
43 #include <linux/list.h>
44 #include <linux/kmod.h>
45 #include <linux/sysctl.h>
46 #include <linux/random.h>
47
48 #include <net/sock.h>
49 #include <linux/in.h>
50
51
52 #define DEBUG_SUBSYSTEM S_LND
53
54 #include <libcfs/kp30.h>
55 #include <lnet/lnet.h>
56 #include <lnet/lib-lnet.h>
57 #include <portals/p30.h>
58 #ifdef CRAY_XT3
59 #include <portals/ptltrace.h>
60 #endif
61 #include <lnet/ptllnd.h>        /* Depends on portals/p30.h */
62
63 /*
64  * Define this to enable console debug logging
65  * and simulation
66  */
67 //#define PJK_DEBUGGING
68
69 #ifdef CONFIG_SMP
70 # define PTLLND_N_SCHED         num_online_cpus()   /* # schedulers */
71 #else
72 # define PTLLND_N_SCHED         1                   /* # schedulers */
73 #endif
74
75 #define PTLLND_CREDIT_HIGHWATER ((*kptllnd_tunables.kptl_peercredits)-1)
76   /* when eagerly to return credits */
77
78 typedef struct
79 {
80         int             *kptl_ntx;              /* # tx descs to pre-allocate */
81         int             *kptl_max_nodes;        /* max # nodes all talking to me */
82         int             *kptl_max_procs_per_node; /* max # processes per node */
83         int             *kptl_checksum;         /* checksum kptl_msg_t? */
84         int             *kptl_timeout;          /* comms timeout (seconds) */
85         int             *kptl_portal;           /* portal number */
86         int             *kptl_pid;              /* portals PID (self + kernel peers) */
87         int             *kptl_rxb_npages;       /* number of pages for rx buffer */
88         int             *kptl_rxb_nspare;       /* number of spare rx buffers */
89         int             *kptl_credits;          /* number of credits */
90         int             *kptl_peercredits;      /* number of credits */
91         int             *kptl_max_msg_size;     /* max immd message size*/
92         int             *kptl_peer_hash_table_size; /* # slots in peer hash table */
93         int             *kptl_reschedule_loops; /* scheduler yield loops */
94         int             *kptl_ack_puts;         /* make portals ack PUTs */
95 #ifdef CRAY_XT3
96         int             *kptl_ptltrace_on_timeout; /* dump pltrace on timeout? */
97         char           **kptl_ptltrace_basename;  /* ptltrace dump file basename */
98 #endif
99 #ifdef PJK_DEBUGGING
100         int             *kptl_simulation_bitmap;/* simulation bitmap */
101 #endif
102
103 #if defined(CONFIG_SYSCTL) && !CFS_SYSFS_MODULE_PARM
104         cfs_sysctl_table_header_t *kptl_sysctl; /* sysctl interface */
105 #endif
106 } kptl_tunables_t;
107
108 #include "lnet/ptllnd_wire.h"
109
110 /***********************************************************************/
111
112 typedef struct kptl_data kptl_data_t;
113 typedef struct kptl_rx_buffer kptl_rx_buffer_t;
114 typedef struct kptl_peer kptl_peer_t;
115
116 typedef struct {
117         char      eva_type;
118 } kptl_eventarg_t;
119
120 #define PTLLND_EVENTARG_TYPE_MSG    0x1
121 #define PTLLND_EVENTARG_TYPE_RDMA   0x2
122 #define PTLLND_EVENTARG_TYPE_BUF    0x3
123
124 typedef struct kptl_rx                          /* receive message */
125 {
126         struct list_head        rx_list;        /* queue for attention */
127         kptl_rx_buffer_t       *rx_rxb;         /* the rx buffer pointer */
128         kptl_msg_t             *rx_msg;         /* received message */
129         int                     rx_nob;         /* received message size */
130         unsigned long           rx_treceived;   /* time received */
131         ptl_process_id_t        rx_initiator;   /* sender's address */
132 #ifdef CRAY_XT3
133         ptl_uid_t               rx_uid;         /* sender's uid */
134 #endif
135         kptl_peer_t            *rx_peer;        /* pointer to peer */
136         char                    rx_space[0];    /* copy of incoming request */
137 } kptl_rx_t;
138
139 #define PTLLND_POSTRX_DONT_POST    0            /* don't post */
140 #define PTLLND_POSTRX_NO_CREDIT    1            /* post: no credits */
141 #define PTLLND_POSTRX_PEER_CREDIT  2            /* post: give peer back 1 credit */
142
143 typedef struct kptl_rx_buffer_pool
144 {
145         spinlock_t              rxbp_lock;
146         struct list_head        rxbp_list;      /* all allocated buffers */
147         int                     rxbp_count;     /* # allocated buffers */
148         int                     rxbp_reserved;  /* # requests to buffer */
149         int                     rxbp_shutdown;  /* shutdown flag */
150 } kptl_rx_buffer_pool_t;
151
152 struct kptl_rx_buffer
153 {
154         kptl_rx_buffer_pool_t  *rxb_pool;
155         struct list_head        rxb_list;       /* for the rxb_pool list */
156         struct list_head        rxb_repost_list;/* for the kptl_sched_rxbq list */
157         int                     rxb_posted:1;   /* on the net */
158         int                     rxb_idle:1;     /* all done */
159         kptl_eventarg_t         rxb_eventarg;   /* event->md.user_ptr */
160         int                     rxb_refcount;   /* reference count */
161         ptl_handle_md_t         rxb_mdh;        /* the portals memory descriptor (MD) handle */
162         char                   *rxb_buffer;     /* the buffer */
163
164 };
165
166 enum kptl_tx_type
167 {
168         TX_TYPE_RESERVED                = 0,
169         TX_TYPE_SMALL_MESSAGE           = 1,
170         TX_TYPE_PUT_REQUEST             = 2,
171         TX_TYPE_GET_REQUEST             = 3,
172         TX_TYPE_PUT_RESPONSE            = 4,
173         TX_TYPE_GET_RESPONSE            = 5,
174 };
175
176 typedef union {
177 #ifdef _USING_LUSTRE_PORTALS_
178         struct iovec iov[PTL_MD_MAX_IOV];
179         lnet_kiov_t kiov[PTL_MD_MAX_IOV];
180 #else
181         ptl_md_iovec_t iov[PTL_MD_MAX_IOV];
182 #endif
183 } kptl_fragvec_t;
184
185 typedef struct kptl_tx                           /* transmit message */
186 {
187         struct list_head        tx_list;      /* queue on idle_txs etc */
188         atomic_t                tx_refcount;  /* reference count*/
189         enum kptl_tx_type       tx_type;      /* small msg/{put,get}{req,resp} */
190         int                     tx_active:1;  /* queued on the peer */
191         int                     tx_idle:1;    /* on the free list */
192         int                     tx_acked:1;   /* portals ACK wanted (for debug only) */
193         kptl_eventarg_t         tx_msg_eventarg; /* event->md.user_ptr */
194         kptl_eventarg_t         tx_rdma_eventarg; /* event->md.user_ptr */
195         int                     tx_status;    /* the status of this tx descriptor */
196         ptl_handle_md_t         tx_rdma_mdh;  /* RDMA buffer */
197         ptl_handle_md_t         tx_msg_mdh;   /* the portals MD handle for the initial message */
198         lnet_msg_t             *tx_lnet_msg;  /* LNET message to finalize */
199         lnet_msg_t             *tx_lnet_replymsg; /* LNET reply message to finalize */
200         kptl_msg_t             *tx_msg;       /* the message data */
201         kptl_peer_t            *tx_peer;      /* the peer this is waiting on */
202         unsigned long           tx_deadline;  /* deadline */
203         unsigned long           tx_tposted;   /* time posted */
204         ptl_md_t                tx_rdma_md;   /* rdma descriptor */
205         kptl_fragvec_t         *tx_frags;     /* buffer fragments */
206 } kptl_tx_t;
207
208 enum kptllnd_peer_state
209 {
210         PEER_STATE_UNINITIALIZED        = 0,
211         PEER_STATE_ALLOCATED            = 1,
212         PEER_STATE_WAITING_HELLO        = 2,
213         PEER_STATE_ACTIVE               = 3,
214         PEER_STATE_CLOSING              = 4,
215         PEER_STATE_ZOMBIE               = 5,
216 };
217
218 struct kptl_peer
219 {
220         struct list_head        peer_list;
221         atomic_t                peer_refcount;          /* The current refrences */
222         enum kptllnd_peer_state peer_state;
223         spinlock_t              peer_lock;              /* serialize */
224         struct list_head        peer_noops;             /* PTLLND_MSG_TYPE_NOOP txs */
225         struct list_head        peer_sendq;             /* txs waiting for mh handles */
226         struct list_head        peer_activeq;           /* txs awaiting completion */
227         lnet_process_id_t       peer_id;                /* Peer's LNET id */
228         ptl_process_id_t        peer_ptlid;             /* Peer's portals id */
229         __u64                   peer_incarnation;       /* peer's incarnation */
230         __u64                   peer_myincarnation;     /* my incarnation at HELLO */
231         int                     peer_sent_hello;        /* have I sent HELLO? */
232         int                     peer_credits;           /* number of send credits */
233         int                     peer_outstanding_credits;/* number of peer credits to return */
234         int                     peer_sent_credits;      /* #msg buffers posted for peer */
235         int                     peer_max_msg_size;      /* peer's rx buffer size */
236         int                     peer_error;             /* errno on closing this peer */
237         int                     peer_retry_noop;        /* need to retry returning credits */
238         int                     peer_check_stamp;       /* watchdog check stamp */
239         cfs_time_t              peer_last_alive;        /* when (in jiffies) I was last alive */
240         __u64                   peer_next_matchbits;    /* Next value to register RDMA from peer */
241         __u64                   peer_last_matchbits_seen; /* last matchbits used to RDMA to peer */
242 };
243
244 struct kptl_data
245 {
246         int                     kptl_init;             /* initialisation state */
247         volatile int            kptl_shutdown;         /* shut down? */
248         atomic_t                kptl_nthreads;         /* # live threads */
249         lnet_ni_t              *kptl_ni;               /* _the_ LND instance */
250         ptl_handle_ni_t         kptl_nih;              /* network inteface handle */
251         ptl_process_id_t        kptl_portals_id;       /* Portals ID of interface */
252         __u64                   kptl_incarnation;      /* which one am I */
253         ptl_handle_eq_t         kptl_eqh;              /* Event Queue (EQ) */
254
255         spinlock_t              kptl_sched_lock;       /* serialise... */
256         wait_queue_head_t       kptl_sched_waitq;      /* schedulers sleep here */
257         struct list_head        kptl_sched_txq;        /* tx requiring attention */
258         struct list_head        kptl_sched_rxq;        /* rx requiring attention */
259         struct list_head        kptl_sched_rxbq;       /* rxb requiring reposting */
260
261         wait_queue_head_t       kptl_watchdog_waitq;   /* watchdog sleeps here */
262
263         kptl_rx_buffer_pool_t   kptl_rx_buffer_pool;   /* rx buffer pool */
264         cfs_mem_cache_t*        kptl_rx_cache;         /* rx descripter cache */
265
266         atomic_t                kptl_ntx;              /* # tx descs allocated */
267         spinlock_t              kptl_tx_lock;          /* serialise idle tx list*/
268         struct list_head        kptl_idle_txs;         /* idle tx descriptors */
269
270         rwlock_t                kptl_peer_rw_lock;     /* lock for peer table */
271         struct list_head       *kptl_peers;            /* hash table of all my known peers */
272         struct list_head        kptl_closing_peers;    /* peers being closed */
273         struct list_head        kptl_zombie_peers;     /* peers waiting for refs to drain */
274         int                     kptl_peer_hash_size;   /* size of kptl_peers */
275         int                     kptl_npeers;           /* # peers extant */
276         int                     kptl_n_active_peers;   /* # active peers */
277         int                     kptl_expected_peers;   /* # peers I can buffer HELLOs from */
278
279         kptl_msg_t             *kptl_nak_msg;          /* common NAK message */
280         spinlock_t              kptl_ptlid2str_lock;   /* serialise str ops */
281 };
282
283 enum 
284 {
285         PTLLND_INIT_NOTHING = 0,
286         PTLLND_INIT_DATA,
287         PTLLND_INIT_ALL,
288 };
289
290 extern kptl_tunables_t  kptllnd_tunables;
291 extern kptl_data_t      kptllnd_data;
292
293 static inline lnet_nid_t 
294 kptllnd_ptl2lnetnid(ptl_nid_t ptl_nid)
295 {
296 #ifdef _USING_LUSTRE_PORTALS_
297         return LNET_MKNID(LNET_NIDNET(kptllnd_data.kptl_ni->ni_nid), 
298                           LNET_NIDADDR(ptl_nid));
299 #else
300         return LNET_MKNID(LNET_NIDNET(kptllnd_data.kptl_ni->ni_nid), 
301                           ptl_nid);
302 #endif
303 }
304
305 static inline ptl_nid_t 
306 kptllnd_lnet2ptlnid(lnet_nid_t lnet_nid)
307 {
308 #ifdef _USING_LUSTRE_PORTALS_
309         return LNET_MKNID(LNET_NIDNET(kptllnd_data.kptl_portals_id.nid),
310                           LNET_NIDADDR(lnet_nid));
311 #else
312         return LNET_NIDADDR(lnet_nid);
313 #endif
314 }
315
316 int  kptllnd_startup(lnet_ni_t *ni);
317 void kptllnd_shutdown(lnet_ni_t *ni);
318 int  kptllnd_ctl(lnet_ni_t *ni, unsigned int cmd, void *arg);
319 int  kptllnd_send(lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg);
320 int  kptllnd_recv(lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg,
321                   int delayed, unsigned int niov, 
322                   struct iovec *iov, lnet_kiov_t *kiov,
323                   unsigned int offset, unsigned int mlen, unsigned int rlen);
324 int  kptllnd_eager_recv(struct lnet_ni *ni, void *private, 
325                         lnet_msg_t *msg, void **new_privatep);
326 void kptllnd_eq_callback(ptl_event_t *evp);
327 int  kptllnd_scheduler(void *arg);
328 int  kptllnd_watchdog(void *arg);
329 int  kptllnd_thread_start(int (*fn)(void *arg), void *arg);
330 int  kptllnd_tunables_init(void);
331 void kptllnd_tunables_fini(void);
332
333 const char *kptllnd_evtype2str(int evtype);
334 const char *kptllnd_msgtype2str(int msgtype);
335 const char *kptllnd_errtype2str(int errtype);
336
337 static inline void *
338 kptllnd_eventarg2obj (kptl_eventarg_t *eva)
339 {
340         switch (eva->eva_type) {
341         default:
342                 LBUG();
343         case PTLLND_EVENTARG_TYPE_BUF:
344                 return list_entry(eva, kptl_rx_buffer_t, rxb_eventarg);
345         case PTLLND_EVENTARG_TYPE_RDMA:
346                 return list_entry(eva, kptl_tx_t, tx_rdma_eventarg);
347         case PTLLND_EVENTARG_TYPE_MSG:
348                 return list_entry(eva, kptl_tx_t, tx_msg_eventarg);
349         }
350 }
351
352 /*
353  * RX BUFFER SUPPORT FUNCTIONS
354  */
355 void kptllnd_rx_buffer_pool_init(kptl_rx_buffer_pool_t *rxbp);
356 void kptllnd_rx_buffer_pool_fini(kptl_rx_buffer_pool_t *rxbp);
357 int  kptllnd_rx_buffer_pool_reserve(kptl_rx_buffer_pool_t *rxbp, int count);
358 void kptllnd_rx_buffer_pool_unreserve(kptl_rx_buffer_pool_t *rxbp, int count);
359 void kptllnd_rx_buffer_callback(ptl_event_t *ev);
360 void kptllnd_rx_buffer_post(kptl_rx_buffer_t *rxb);
361
362 static inline int
363 kptllnd_rx_buffer_size(void)
364 {
365         return PAGE_SIZE * (*kptllnd_tunables.kptl_rxb_npages);
366 }
367
368 static inline void
369 kptllnd_rx_buffer_addref(kptl_rx_buffer_t *rxb)
370 {
371         unsigned long flags;
372         
373         spin_lock_irqsave(&rxb->rxb_pool->rxbp_lock, flags);
374         rxb->rxb_refcount++;
375         spin_unlock_irqrestore(&rxb->rxb_pool->rxbp_lock, flags);
376 }
377
378 static inline void
379 kptllnd_rx_buffer_decref_locked(kptl_rx_buffer_t *rxb)
380 {
381         if (--(rxb->rxb_refcount) == 0) {
382                 spin_lock(&kptllnd_data.kptl_sched_lock);
383         
384                 list_add_tail(&rxb->rxb_repost_list,
385                               &kptllnd_data.kptl_sched_rxbq);
386                 wake_up(&kptllnd_data.kptl_sched_waitq);
387
388                 spin_unlock(&kptllnd_data.kptl_sched_lock);
389         }
390 }
391
392 static inline void
393 kptllnd_rx_buffer_decref(kptl_rx_buffer_t *rxb)
394 {
395         unsigned long flags;
396         int           count;
397         
398         spin_lock_irqsave(&rxb->rxb_pool->rxbp_lock, flags);
399         count = --(rxb->rxb_refcount);
400         spin_unlock_irqrestore(&rxb->rxb_pool->rxbp_lock, flags);
401
402         if (count == 0)
403                 kptllnd_rx_buffer_post(rxb);
404 }
405
406 /*
407  * RX SUPPORT FUNCTIONS
408  */
409 void kptllnd_rx_parse(kptl_rx_t *rx);
410 void kptllnd_rx_done(kptl_rx_t *rx, int post_credit);
411
412 /*
413  * PEER SUPPORT FUNCTIONS
414  */
415 int kptllnd_get_peer_info(int index,
416                           lnet_process_id_t *id, 
417                           int *state, int *sent_hello,
418                           int *refcount, __u64 *incarnation,
419                           __u64 *next_matchbits, __u64 *last_matchbits_seen,
420                           int *nsendq, int *nactiveq,
421                           int *credits, int *outstanding_credits);
422 void kptllnd_peer_destroy(kptl_peer_t *peer);
423 int  kptllnd_peer_del(lnet_process_id_t id);
424 void kptllnd_peer_close_locked(kptl_peer_t *peer, int why);
425 void kptllnd_peer_close(kptl_peer_t *peer, int why);
426 void kptllnd_handle_closing_peers(void);
427 int  kptllnd_peer_connect(kptl_tx_t *tx, lnet_nid_t nid);
428 void kptllnd_peer_check_sends(kptl_peer_t *peer);
429 void kptllnd_peer_check_bucket(int idx, int stamp);
430 void kptllnd_tx_launch(kptl_peer_t *peer, kptl_tx_t *tx, int nfrag);
431 int  kptllnd_find_target(kptl_peer_t **peerp, lnet_process_id_t target);
432 kptl_peer_t *kptllnd_peer_handle_hello(ptl_process_id_t initiator,
433                                        kptl_msg_t *msg);
434 kptl_peer_t *kptllnd_id2peer_locked(lnet_process_id_t id);
435 void kptllnd_peer_alive(kptl_peer_t *peer);
436
437 static inline void
438 kptllnd_peer_addref (kptl_peer_t *peer)
439 {
440         atomic_inc(&peer->peer_refcount);
441 }
442
443 static inline void
444 kptllnd_peer_decref (kptl_peer_t *peer)
445 {
446         if (atomic_dec_and_test(&peer->peer_refcount))
447                 kptllnd_peer_destroy(peer);
448 }
449
450 static inline void
451 kptllnd_set_tx_peer(kptl_tx_t *tx, kptl_peer_t *peer) 
452 {
453         LASSERT (tx->tx_peer == NULL);
454         
455         kptllnd_peer_addref(peer);
456         tx->tx_peer = peer;
457 }
458
459 static inline struct list_head *
460 kptllnd_nid2peerlist(lnet_nid_t nid)
461 {
462         unsigned int hash = ((unsigned int)nid) %
463                             kptllnd_data.kptl_peer_hash_size;
464
465         return &kptllnd_data.kptl_peers[hash];
466 }
467
468 static inline kptl_peer_t *
469 kptllnd_id2peer(lnet_process_id_t id)
470 {
471         kptl_peer_t   *peer;
472         unsigned long  flags;
473
474         read_lock_irqsave(&kptllnd_data.kptl_peer_rw_lock, flags);
475         peer = kptllnd_id2peer_locked(id);
476         read_unlock_irqrestore(&kptllnd_data.kptl_peer_rw_lock, flags);
477
478         return peer;
479 }
480
481 static inline int
482 kptllnd_reserve_buffers(int n)
483 {
484         return kptllnd_rx_buffer_pool_reserve(&kptllnd_data.kptl_rx_buffer_pool,
485                                               n);
486 }
487
488 static inline int
489 kptllnd_peer_reserve_buffers(void)
490 {
491         return kptllnd_reserve_buffers(*kptllnd_tunables.kptl_peercredits);
492 }
493
494 static inline void
495 kptllnd_peer_unreserve_buffers(void)
496 {
497         kptllnd_rx_buffer_pool_unreserve(&kptllnd_data.kptl_rx_buffer_pool,
498                                          *kptllnd_tunables.kptl_peercredits);
499 }
500
501 /*
502  * TX SUPPORT FUNCTIONS
503  */
504 int  kptllnd_setup_tx_descs(void);
505 void kptllnd_cleanup_tx_descs(void);
506 void kptllnd_tx_fini(kptl_tx_t *tx);
507 kptl_tx_t *kptllnd_get_idle_tx(enum kptl_tx_type purpose);
508 void kptllnd_tx_callback(ptl_event_t *ev);
509 const char *kptllnd_tx_typestr(int type);
510
511 static inline void
512 kptllnd_tx_addref(kptl_tx_t *tx)
513 {
514         atomic_inc(&tx->tx_refcount);
515 }
516
517 static inline void 
518 kptllnd_tx_decref(kptl_tx_t *tx)
519 {
520         LASSERT (!in_interrupt());        /* Thread context only */
521
522         if (atomic_dec_and_test(&tx->tx_refcount))
523                 kptllnd_tx_fini(tx);
524 }
525
526 /*
527  * MESSAGE SUPPORT FUNCTIONS
528  */
529 void kptllnd_init_msg(kptl_msg_t *msg, int type, int body_nob);
530 void kptllnd_msg_pack(kptl_msg_t *msg, kptl_peer_t *peer);
531 int  kptllnd_msg_unpack(kptl_msg_t *msg, int nob);
532
533 /*
534  * MISC SUPPORT FUNCTIONS
535  */
536 void kptllnd_init_rdma_md(kptl_tx_t *tx, unsigned int niov,
537                           struct iovec *iov, lnet_kiov_t *kiov,
538                           unsigned int offset, unsigned int nob);
539 char *kptllnd_ptlid2str(ptl_process_id_t id);
540
541 void kptllnd_init_ptltrace(void);
542 void kptllnd_dump_ptltrace(void);
543
544 #ifdef PJK_DEBUGGING
545 #define SIMULATION_FAIL_TX_PUT_ALLOC   0       /* 0x00000001 */
546 #define SIMULATION_FAIL_TX_GET_ALLOC   1       /* 0x00000002 */
547 #define SIMULATION_FAIL_TX             2       /* 0x00000004 */
548 #define SIMULATION_FAIL_RX_ALLOC       3       /* 0x00000008 */
549
550 #define IS_SIMULATION_ENABLED(x) \
551         (((*kptllnd_tunables.kptl_simulation_bitmap) & 1<< SIMULATION_##x) != 0)
552 #else
553 #define IS_SIMULATION_ENABLED(x)       0
554 #endif
555