Annotation of XNU/osfmk/mach/kkt_request.h, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
                      3:  *
                      4:  * @APPLE_LICENSE_HEADER_START@
                      5:  * 
                      6:  * The contents of this file constitute Original Code as defined in and
                      7:  * are subject to the Apple Public Source License Version 1.1 (the
                      8:  * "License").  You may not use this file except in compliance with the
                      9:  * License.  Please obtain a copy of the License at
                     10:  * http://www.apple.com/publicsource and read it before using this file.
                     11:  * 
                     12:  * This Original Code and all software distributed under the License are
                     13:  * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
                     14:  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
                     15:  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
                     16:  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
                     17:  * License for the specific language governing rights and limitations
                     18:  * under the License.
                     19:  * 
                     20:  * @APPLE_LICENSE_HEADER_END@
                     21:  */
                     22: /*
                     23:  * @OSF_FREE_COPYRIGHT@
                     24:  * 
                     25:  */
                     26: /*
                     27:  * HISTORY
                     28:  * 
                     29:  * Revision 1.1.1.1  1998/09/22 21:05:30  wsanchez
                     30:  * Import of Mac OS X kernel (~semeria)
                     31:  *
                     32:  * Revision 1.2  1998/04/29 17:36:39  mburg
                     33:  * MK7.3 merger
                     34:  *
                     35:  * Revision 1.1.37.1  1998/02/03  09:32:57  gdt
                     36:  *     Merge up to MK7.3
                     37:  *     [1998/02/03  09:17:05  gdt]
                     38:  *
                     39:  * Revision 1.1.34.1  1997/02/17  11:24:51  ferranti
                     40:  *     Removed handling of physical buffers for DIPC introduced during
                     41:  *     the port on HP_PA platform.
                     42:  *     [1997/02/17  11:16:56  ferranti]
                     43:  * 
                     44:  * Revision 1.1.13.5  1996/07/31  09:57:12  paire
                     45:  *     Merged with nmk20b7_shared (1.1.27.2 -> 1.1.27.1)
                     46:  *     [96/06/10            paire]
                     47:  * 
                     48:  * Revision 1.1.27.2  1996/07/30  15:15:27  ferranti
                     49:  *     Use virtual memory buffers (io_scatter) for SCSI NORMA
                     50:  *     clusters. Changed ios_phys_addr field of kkt_sglist
                     51:  *     struct into ios_address.
                     52:  *     [1996/07/30  15:12:57  ferranti]
                     53:  * 
                     54:  * Revision 1.1.27.1  1996/05/10  16:38:38  ferranti
                     55:  *     Modified kkt_sglist_t structure in order to record
                     56:  *     in the ios_phys_address field both physical memory
                     57:  *     or virtual memory buffers. The ios_is_phys field
                     58:  *     making the difference.
                     59:  *     [1996/05/10  16:24:33  ferranti]
                     60:  * 
                     61:  * Revision 1.1.35.1  1997/06/17  03:00:59  devrcs
                     62:  *     Activate uid node incarnation.
                     63:  *     [1996/09/11  20:08:24  watkins]
                     64:  * 
                     65:  *     Merge with rt3_merge.
                     66:  *     [1996/03/25  17:34:47  watkins]
                     67:  * 
                     68:  * Revision 1.1.22.2  1996/03/21  19:16:33  watkins
                     69:  *     Add kkt channel for rt rpc service.
                     70:  * 
                     71:  * Revision 1.1.13.4  1995/06/13  18:19:47  sjs
                     72:  *     Merge from flipc_shared.
                     73:  *     [95/05/22            sjs]
                     74:  * 
                     75:  * Revision 1.1.13.2  1995/05/15  18:08:36  rwd
                     76:  *     Add CHAN_DEVICE_KT.
                     77:  *     [95/04/10            rwd]
                     78:  * 
                     79:  * Revision 1.1.10.4  1995/01/06  15:39:19  rwd
                     80:  *     Merged up to dipc_b2
                     81:  *     [1995/01/05  20:16:59  rwd]
                     82:  * 
                     83:  * Revision 1.1.10.3  1994/12/12  19:04:43  rwd
                     84:  *     Merged with changes from 1.1.10.2
                     85:  *     [1994/12/12  19:03:29  rwd]
                     86:  * 
                     87:  *     Define KKT_MIN_ERRNO and KKT_MAX_ERRNO.
                     88:  *     [94/12/12            rwd]
                     89:  * 
                     90:  * Revision 1.1.10.2  1994/12/12  17:46:32  randys
                     91:  *     Added channel for use by FLIPC
                     92:  *     [1994/12/12  05:14:58  randys]
                     93:  * 
                     94:  * Revision 1.1.10.1  1994/12/09  15:46:33  rwd
                     95:  *     Pulled from dipc2_shared
                     96:  *     [1994/12/08  18:52:39  rwd]
                     97:  * 
                     98:  * Revision 1.1.6.9  1994/12/06  20:12:58  alanl
                     99:  *     Add KKT_NODE_SELF and KKT_NODE_IS_VALID prototypes.
                    100:  *     [94/12/05            rwd]
                    101:  * 
                    102:  * Revision 1.1.6.10  1994/12/27  21:10:02  mmp
                    103:  *     Add thread_context arg to kkt callback typedef.
                    104:  *     [1994/12/24  03:25:04  mmp]
                    105:  * 
                    106:  * Revision 1.1.6.9  1994/12/06  20:12:58  alanl
                    107:  *     Add KKT_NODE_SELF and KKT_NODE_IS_VALID prototypes.
                    108:  *     [94/12/05            rwd]
                    109:  * 
                    110:  * Revision 1.1.6.8  1994/11/09  03:42:14  alanl
                    111:  *     DIPC and KKT restructuring for transports that provide
                    112:  *     their own threads.  (w/travos)
                    113:  *     [94/11/02            alanl]
                    114:  * 
                    115:  * Revision 1.1.6.7  1994/10/28  18:59:42  rwd
                    116:  *     Add kkt_bootstrap_init prototype.
                    117:  *     [94/10/28            rwd]
                    118:  * 
                    119:  * Revision 1.1.6.6  1994/10/05  22:09:09  alanl
                    120:  *     Revamped implementation error code and specification until they
                    121:  *     are largely in agreement.
                    122:  *     [94/10/05            alanl]
                    123:  * 
                    124:  *     Rationalized KKT_HANDLE_ABORT error passing conventions.
                    125:  *     Callbacks always receive KKT_SUCCESS, KKT_ABORT or a KKT
                    126:  *     transport error.  Handles have an opaque error argument
                    127:  *     recording the "reason" supplied by the caller of
                    128:  *     KKT_HANDLE_ABORT.  The caller's error space thus does not
                    129:  *     conflict with the KKT error space.
                    130:  *     [94/10/03            alanl]
                    131:  * 
                    132:  * Revision 1.1.6.5  1994/09/29  13:34:40  rwd
                    133:  *     Remove unncessary receiver argument from KKT_HANDLE_ABORT.
                    134:  *     [94/09/29            rwd]
                    135:  * 
                    136:  * Revision 1.1.6.4  1994/09/28  15:55:05  alanl
                    137:  *     Defined new error codes, KKT_ENDPOINT_DEAD and
                    138:  *     KKT_MKMSG_DESTROYED, to use in conjunction with
                    139:  *     KKT_HANDLE_ABORT.  Because ABORT invokes callbacks and
                    140:  *     supplies them with a "reason" argument, callbacks must
                    141:  *     use the same error code space that contains KKT_SUCCESS.
                    142:  *     [94/09/23            alanl]
                    143:  * 
                    144:  * Revision 1.1.6.3  1994/08/11  14:43:23  rwd
                    145:  *     Prototype pointers to functions.
                    146:  *     [94/08/09            rwd]
                    147:  * 
                    148:  * Revision 1.1.6.2  1994/08/05  19:42:32  mmp
                    149:  *     Added new scatter/gather bit to interface
                    150:  *     [94/07/22            rwd]
                    151:  * 
                    152:  * Revision 1.1.6.1  1994/08/04  02:27:42  mmp
                    153:  *     Brought forward from dipc_shared.
                    154:  *     [1994/08/03  20:38:49  mmp]
                    155:  * 
                    156:  * Revision 1.1.2.14  1994/07/18  19:25:31  rwd
                    157:  *     Merged with changes from 1.1.2.13
                    158:  *     [1994/07/18  19:24:35  rwd]
                    159:  * 
                    160:  *     Fix malloc in KKT_CHANNEL_INIT and KKT_RPC_INIT.  Fix KKT_RPC_REPLY.
                    161:  *     [94/07/08            rwd]
                    162:  * 
                    163:  * Revision 1.1.2.13  1994/07/13  20:19:59  sjs
                    164:  *     Added new channel for raw testing of transport interfaces.
                    165:  *     [94/07/13            sjs]
                    166:  * 
                    167:  * Revision 1.1.2.12  1994/07/08  01:58:49  alanl
                    168:  *     Add prototypes and some comments for
                    169:  *     KKT interfaces.
                    170:  *     [1994/07/08  01:56:46  alanl]
                    171:  * 
                    172:  * Revision 1.1.2.11  1994/06/14  13:23:28  rwd
                    173:  *     Remove typedefs to kkt_types.h
                    174:  *     [94/06/10            rwd]
                    175:  * 
                    176:  * Revision 1.1.2.10  1994/06/09  14:40:12  rwd
                    177:  *     Merged with changes from 1.1.2.9
                    178:  *     [1994/06/09  14:37:51  rwd]
                    179:  * 
                    180:  *     Add comment in #endif
                    181:  *     [94/06/06            rwd]
                    182:  * 
                    183:  * Revision 1.1.2.9  1994/06/08  15:56:00  sjs
                    184:  *     Fixed #endif to be ANSII compliant.
                    185:  *     [94/06/08            sjs]
                    186:  * 
                    187:  * Revision 1.1.2.8  1994/05/20  18:33:38  alanl
                    188:  *     Added CHAN_DIPC_MIGRATION
                    189:  *     [94/05/17            rwd]
                    190:  * 
                    191:  * Revision 1.1.2.7  1994/05/17  16:08:08  mmp
                    192:  *     Added CHAN_DIPC_RPC_INTR.
                    193:  *     Changed the buf field in struct rpc_buf to buff to match both
                    194:  *     the spec and the similar field in struct transmit.
                    195:  *     [1994/05/17  16:07:17  mmp]
                    196:  * 
                    197:  * Revision 1.1.2.6  1994/05/16  20:11:31  sjs
                    198:  *     Added error codes, new channel designator.
                    199:  *     [94/05/16            sjs]
                    200:  * 
                    201:  * Revision 1.1.2.5  1994/05/13  16:23:52  sjs
                    202:  *     Added rpc_buf definitions.
                    203:  *     [94/05/13            sjs]
                    204:  * 
                    205:  * Revision 1.1.2.4  1994/05/11  18:49:10  mmp
                    206:  *     added channel_t typedef and channel declarations (moved here from kkt.h).
                    207:  *     [1994/05/11  18:48:32  mmp]
                    208:  * 
                    209:  * Revision 1.1.2.3  1994/04/29  19:59:26  sjs
                    210:  *     Merged with changes from 1.1.2.2
                    211:  *     [1994/04/29  19:59:05  sjs]
                    212:  * 
                    213:  *     Added transmit and endpoint structures, added correct
                    214:  *     platform specific include file.  More error codes.
                    215:  *     [94/04/13            sjs]
                    216:  * 
                    217:  * Revision 1.1.2.2  1994/04/20  18:44:10  alanl
                    218:  *     Replace temporary kkt dipc.h with permanent one.
                    219:  *     File resides in mach/, not dipc/, so the ifdef
                    220:  *     should refer to MACH instead of DIPC.
                    221:  *     [1994/04/20  18:31:19  alanl]
                    222:  * 
                    223:  * Revision 1.1.2.1  1994/03/25  14:54:38  sjs
                    224:  *     Initial revision.
                    225:  *     [1994/03/25  14:53:43  sjs]
                    226:  * 
                    227:  * $EndLog$
                    228:  */
                    229: 
                    230: /*
                    231:  * KKT machine independent request parameters
                    232:  */
                    233: 
                    234: #ifndef        _DIPC_KKT_REQUEST_H_
                    235: #define        _DIPC_KKT_REQUEST_H_
                    236: 
                    237: #include <mach/mach_types.h>
                    238: #include <mach/error.h>
                    239: #include <mach/boolean.h>
                    240: #include <mach/vm_prot.h>
                    241: #include <kern/assert.h>
                    242: #include <mach_kdb.h>
                    243: #include <mach/kkt_types.h>
                    244: #include <machine/kkt.h>
                    245: #include <device/io_scatter.h>
                    246: 
                    247: 
                    248: /*
                    249:  *     KKT exports an SPL level at which callbacks will happen
                    250:  *     from KKT to a client.  The client needs to know this
                    251:  *     level for synchronizing access to data structures shared
                    252:  *     between callbacks and thread context operations.
                    253:  *
                    254:  *     This spl level is referred to as splkkt, and may be
                    255:  *     used in the traditional fashion, e.g.,
                    256:  *             s = splkkt();
                    257:  *             ...
                    258:  *             splx(s);
                    259:  *
                    260:  *     The definition comes from machine/kkt.h.
                    261:  */
                    262: 
                    263: 
                    264: /*
                    265:  * A transport request comes in two pieces: half of it is a
                    266:  * type designator, and half of it is the status of the
                    267:  * operation (and may be unnecessary, let's see).
                    268:  */
                    269: typedef struct transport_request {
                    270:        short           type;
                    271:        short           status;
                    272: } tran_req;
                    273: 
                    274: /*
                    275:  * Valid transport request types
                    276:  */
                    277: #define        REQUEST_SEND    0x001
                    278: #define        REQUEST_RECV    0x002
                    279: #define REQUEST_COMMANDS (REQUEST_SEND|REQUEST_RECV)
                    280: #define        REQUEST_SG      0x100
                    281: 
                    282: typedef io_scatter_t kkt_sglist_t;
                    283: 
                    284: /*
                    285:  * Primary request block.  Allocated by the user and handed to 
                    286:  * KKT_REQUEST.
                    287:  */
                    288: typedef        struct request_block    *request_block_t;
                    289: typedef        unsigned int            request_t;
                    290: typedef        kern_return_t           kkt_return_t;
                    291: typedef unsigned int           channel_t;
                    292: 
                    293: 
                    294: typedef void (*kkt_callback_t)(
                    295:                        kkt_return_t,
                    296:                        handle_t,
                    297:                        request_block_t,
                    298:                        boolean_t);
                    299: 
                    300: 
                    301: struct request_block {
                    302:        unsigned int    request_type;
                    303:        union {
                    304:                vm_offset_t     address;
                    305:                kkt_sglist_t    list;
                    306:        } data;         
                    307:        vm_size_t       data_length;
                    308:        kkt_callback_t  callback;
                    309:        unsigned int    args[2];
                    310:        request_block_t next;
                    311:        transport_t     transport;
                    312: };
                    313: 
                    314: #define        NULL_REQUEST    (request_block_t)0
                    315: 
                    316: /*
                    317:  * Error codes
                    318:  */
                    319: #define        KKTSUB          9
                    320: #define        KKTERR(errno)   (err_kern | err_sub(KKTSUB) | errno)
                    321: 
                    322: #define KKT_MIN_ERRNO          KKTERR(0)    /* MIN ERRNO */
                    323: #define        KKT_SUCCESS             KKTERR(0)    /* operation succeeded */
                    324: #define        KKT_DATA_RECEIVED       KKTERR(1)    /* data received immediately,
                    325:                                                ...no callback forthcoming */
                    326: #define        KKT_DATA_SENT           KKTERR(2)    /* data sent immediately, no
                    327:                                                ...callback forthcoming */
                    328: #define        KKT_ERROR               KKTERR(3)    /* vague:  probably a lower-level
                    329:                                                ...transport error */
                    330: #define        KKT_ABORT               KKTERR(4)    /* operation was aborted, handle
                    331:                                                ...has aborted or is aborting */
                    332: #define        KKT_INVALID_ARGUMENT    KKTERR(5)    /* bad argument or range error */
                    333: #define        KKT_INVALID_HANDLE      KKTERR(6)    /* illegal handle value */
                    334: #define        KKT_NODE_DOWN           KKTERR(7)    /* can't reach node */
                    335: #define        KKT_RESOURCE_SHORTAGE   KKTERR(8)    /* requested or required resource
                    336:                                                ...can't be allocated */
                    337: #define        KKT_NODE_PRESENT        KKTERR(9)    /* node already in map */
                    338: #define        KKT_MAP_EMPTY           KKTERR(10)   /* no nodes left in map */
                    339: #define        KKT_INVALID_REQUEST     KKTERR(11)   /* illegal operation requested */
                    340: #define        KKT_RELEASE             KKTERR(12)   /* resources no longer in use,
                    341:                                                ...caller can free at will */
                    342: #define KKT_INVALID_CHANNEL    KKTERR(13)   /* illegal channel specifier */
                    343: #define        KKT_HANDLE_BUSY         KKTERR(14)   /* connection is active */
                    344: #define        KKT_HANDLE_UNUSED       KKTERR(15)   /* handle is unconnected */
                    345: #define        KKT_HANDLE_MIGRATED     KKTERR(16)   /* handle already migrated */
                    346: #define        KKT_CHANNEL_IN_USE      KKTERR(17)   /* channel already exists */
                    347: #define        KKT_HANDLE_TYPE         KKTERR(18)   /* handle is of wrong type,
                    348:                                                ...possibly aborted */
                    349: #define        KKT_INVALID_NODE        KKTERR(19)   /* no such node */
                    350: #define KKT_MAX_ERRNO          KKTERR(19)   /* MAX ERRNO */
                    351: 
                    352: 
                    353: struct rpc_buf {
                    354:        unsigned int            *ulink;         /* user available field */
                    355:        handle_t                handle;         /* RPC handle */
                    356:        unsigned int            buff[1];        /* variable sized buffer */
                    357: };
                    358: 
                    359: typedef struct rpc_buf *rpc_buf_t;
                    360: 
                    361: /* channel declarations */
                    362: #define CHAN_KKT               0       /* KKT internal channel */
                    363: #define CHAN_USER_KMSG         1       /* user kmsg channel */
                    364: #define CHAN_DIPC_RPC          2       /* dipc rpc, thread delivery */
                    365: #define CHAN_DIPC_RPC_INTR     3       /* dipc rpc, interrupt delivery */
                    366: #define CHAN_TEST_KMSG         4       /* kkt test channel */
                    367: #define CHAN_TEST_RPC          5       /* kkt rpc test channel */
                    368: #define CHAN_DIPC_MIGRATION    6       /* dipc migration threads */
                    369: #define CHAN_RESERVE_TEST      7       /* Raw RPC/RDMA testing */
                    370: #define CHAN_FLIPC             8       /* FLIPC channel */
                    371: #define CHAN_DEVICE_KT         9       /* KKT "kt" ethernet device */
                    372: #define CHAN_MACH_RPC          10      /* mach rpc service */
                    373: 
                    374: /*
                    375:  *     KKT properties.  This is configuration information
                    376:  *     exported from KKT at run-time.
                    377:  */
                    378: typedef enum kkt_upcall {
                    379:        KKT_THREAD_UPCALLS,             /* all upcalls happen in thread context */
                    380:        KKT_INTERRUPT_UPCALLS,          /* all upcalls happen in interrupt context */
                    381:        KKT_MIXED_UPCALLS               /* upcalls can happen in EITHER context */
                    382: } kkt_upcall_t;
                    383: 
                    384: typedef struct kkt_properties {
                    385:        /*
                    386:         *      How does KKT invoke client services during upcalls?
                    387:         */
                    388:        kkt_upcall_t    kkt_upcall_methods;
                    389:        /*
                    390:         *      Total number of *usable* bytes that a client can
                    391:         *      fit into an inline KKT buffer during an RPC.
                    392:         *      When sending data via KKT_SEND_CONNECT, KKT may
                    393:         *      be able to optimize the send by cramming the
                    394:         *      inline data into an RPC buffer (but specifying
                    395:         *      larger amounts of inline data still works).
                    396:         */
                    397:        vm_size_t       kkt_buffer_size;
                    398: } kkt_properties_t;
                    399: 
                    400: 
                    401: /*
                    402:  *     KKT interfaces.
                    403:  *
                    404:  *     Refer to the document, "Kernel to Kernel Transport Interface
                    405:  *     for the Mach Kernel", Open Software Foundation Research
                    406:  *     Institute, 1994.
                    407:  */
                    408: 
                    409: typedef void (*kkt_channel_deliver_t)(channel_t, handle_t, endpoint_t *,
                    410:                                      vm_size_t, boolean_t, boolean_t);
                    411: typedef        void (*kkt_rpc_deliver_t)(channel_t, rpc_buf_t, boolean_t);
                    412: typedef        void *(*kkt_malloc_t)(channel_t, vm_size_t);
                    413: typedef void (*kkt_free_t)(channel_t, vm_offset_t, vm_size_t);
                    414: typedef void (*kkt_error_t)(kkt_return_t, handle_t, request_block_t);
                    415: 
                    416: void kkt_bootstrap_init(void);
                    417: 
                    418: /*
                    419:  *     Set up a general communications path, called a
                    420:  *     channel, which has a defined set of resources
                    421:  *     and operations.  The resources include buffers
                    422:  *     for sending and receiving operations.  The
                    423:  *     operations include upcalls from KKT to the
                    424:  *     client code.
                    425:  *
                    426:  *     Individual communications endpoints, or handles,
                    427:  *     are allocated in the context of a channel.
                    428:  *
                    429:  *     channel         identifier specified by caller
                    430:  *                     ("channel name")
                    431:  *     senders         number of sending buffers
                    432:  *     receivers       number of receiving buffers
                    433:  *     (*deliver)()    upcall for incoming data
                    434:  *     (*malloc)()     upcall when KKT needs memory
                    435:  *     (*free)()       upcall to free (*malloc)()'d memory
                    436:  */
                    437: kkt_return_t   KKT_CHANNEL_INIT(
                    438:                        channel_t       channel,
                    439:                        unsigned int    senders,
                    440:                        unsigned int    receivers,
                    441:                        kkt_channel_deliver_t deliver,
                    442:                        kkt_malloc_t    malloc,
                    443:                        kkt_free_t      free);
                    444: 
                    445: /*
                    446:  *     Allocate a handle within a channel.  A handle
                    447:  *     is a connection endpoint; both receiver and
                    448:  *     sender must have a handle in order to communicate.
                    449:  *     A handle is not associated with a node at this time.
                    450:  *     Requesting a handle may be thought of as requesting
                    451:  *     a class of service -- and possibly having to wait
                    452:  *     until resources become available.
                    453:  *
                    454:  *     channel         channel name
                    455:  *     uhandle         handle returned from KKT to caller
                    456:  *     (*error)()      upcall if transmission error encountered
                    457:  *     wait            TRUE=block awaiting handle availability
                    458:  *     must_request    TRUE=data flows only on receiver request
                    459:  *                     (i.e., receiver-pull); FALSE=transport
                    460:  *                     may optimize (possibly do sender-push)
                    461:  */
                    462: kkt_return_t   KKT_HANDLE_ALLOC(
                    463:                        channel_t       channel,
                    464:                        handle_t        *uhandle,
                    465:                        kkt_error_t     error,
                    466:                        boolean_t       wait,
                    467:                        boolean_t       must_request);
                    468: 
                    469: /*
                    470:  *     Free up a handle.
                    471:  */
                    472: kkt_return_t   KKT_HANDLE_FREE(
                    473:                        handle_t        handle);
                    474: 
                    475: /*
                    476:  *     Initiate arbitrary-length kernel-to-kernel
                    477:  *     data transfer.  The sender blocks until the
                    478:  *     receiver responds.  This call causes a (*deliver)()
                    479:  *     upcall on the receiver's channel.
                    480:  *
                    481:  *     handle          KKT-level communications endpoint
                    482:  *     node            destination for data
                    483:  *     endpoint        client-code's communications endpoint
                    484:  *     request         initial data to move
                    485:  *     more            hint as to whether more data will follow
                    486:  *     *ret            return values from KKT_CONNECT_REPLY
                    487:  */
                    488: kkt_return_t   KKT_SEND_CONNECT(
                    489:                        handle_t        handle,
                    490:                        node_name       node,
                    491:                        endpoint_t      *endpoint,
                    492:                        request_block_t request,
                    493:                        boolean_t       more,
                    494:                        kern_return_t   *ret);
                    495: 
                    496: /*
                    497:  *     Respond to KKT_SEND_CONNECT.
                    498:  *
                    499:  *     handle          KKT handle
                    500:  *     status          user-defined success/error indicator
                    501:  *     substatus       user-defined success/error indicator
                    502:  */
                    503: kkt_return_t   KKT_CONNECT_REPLY(
                    504:                        handle_t        handle,
                    505:                        kern_return_t   status,
                    506:                        kern_return_t   substatus);
                    507: 
                    508: /*
                    509:  *     Enqueue a request block on the handle.  Initiate
                    510:  *     transmission if necessary, otherwise, transmit
                    511:  *     the data when the opportunity arises.
                    512:  *
                    513:  *     handle          KKT handle
                    514:  *     request         request block describing data to be transferred
                    515:  */
                    516: kkt_return_t   KKT_REQUEST(
                    517:                        handle_t        handle,
                    518:                        request_block_t request);
                    519: 
                    520: /*
                    521:  *     Copy the entire RPC buffer contents into the
                    522:  *     caller's buffer.  The buffer and size are
                    523:  *     inferred from the handle; the caller takes
                    524:  *     responsibility for supplying a region large
                    525:  *     enough to contain the data to be copied.
                    526:  */
                    527: kkt_return_t   KKT_COPYOUT_RECV_BUFFER(
                    528:                        handle_t        handle,
                    529:                        char            *dest);
                    530: 
                    531: /*
                    532:  *     Abort ongoing operations on the specified handle.
                    533:  *     This need should rarely arise.
                    534:  *
                    535:  *     handle          KKT handle
                    536:  *     reason          status information to be supplied to
                    537:  *                     any parties currently involved in a
                    538:  *                     data transfer or otherwise somehow
                    539:  *                     using this handle
                    540:  */
                    541: kkt_return_t   KKT_HANDLE_ABORT(
                    542:                        handle_t        handle,
                    543:                        kern_return_t   reason);
                    544: 
                    545: /*
                    546:  *     Obtain status information on a handle.
                    547:  *
                    548:  *     handle          KKT handle
                    549:  *     info            Whatever information KKT can
                    550:  *                     supply about a handle
                    551:  */
                    552: kkt_return_t   KKT_HANDLE_INFO(
                    553:                        handle_t        handle,
                    554:                        handle_info_t   info);
                    555: 
                    556: /*
                    557:  *     Move the state associated with old_handle on
                    558:  *     node *node* to new_handle.  The new_handle
                    559:  *     must have already been created as a valid handle
                    560:  *     prior to invoking this call.
                    561:  *
                    562:  *     node            node from which handle is migrating
                    563:  *     old_handle      identifier of handle on node *node*
                    564:  *     new_handle      valid handle on current node
                    565:  */
                    566: kkt_return_t   KKT_HANDLE_MIGRATE(
                    567:                        node_name       node,
                    568:                        int             old_handle,
                    569:                        handle_t        new_handle);
                    570: 
                    571: /*
                    572:  *     Allocate a map capable of tracking nodes
                    573:  *     within a KKT/NORMA domain.  This map need
                    574:  *     not be dense.  For instance, an Ethernet-
                    575:  *     based cluster may use sparse node names
                    576:  *     based on IP addresses.  A node map may be
                    577:  *     dynamic, i.e., adding a node to a map may
                    578:  *     require dynamic memory allocation.  For
                    579:  *     this reason, we define a "fallback" map;
                    580:  *     such a map is allocated with sufficient
                    581:  *     resources to track every node in the domain.
                    582:  *     (A fallback map is necessary when a node is
                    583:  *     very low on memory and has no other way to
                    584:  *     remember what is going on.)
                    585:  *
                    586:  *     map             pointer to a map created by KKT
                    587:  *     full            TRUE=caller requests creation of
                    588:  *                     a fallback map
                    589:  */
                    590: kkt_return_t   KKT_MAP_ALLOC(
                    591:                        node_map_t      *map,
                    592:                        boolean_t       full);
                    593: 
                    594: /*
                    595:  *     Destroy a map.  The map need not be empty.
                    596:  *     There is no concept of a reference-counted
                    597:  *     map, so destruction takes place immediately.
                    598:  */
                    599: kkt_return_t   KKT_MAP_FREE(
                    600:                        node_map_t      map);
                    601: 
                    602: /*
                    603:  *     Add a node to a map.  This call may block
                    604:  *     for memory allocation unless the map is
                    605:  *     known to be a fallback map.
                    606:  *
                    607:  *     map             KKT node map
                    608:  *     node            node to add to map (returns
                    609:  *                     error if node already in map)
                    610:  */
                    611: kkt_return_t   KKT_ADD_NODE(
                    612:                        node_map_t      map,
                    613:                        node_name       node);
                    614: 
                    615: /*
                    616:  *     Remove the next node from a map.  The caller
                    617:  *     does not specify the node to be removed;
                    618:  *     rather, KKT returns the node_name of the
                    619:  *     next node in the map.
                    620:  *
                    621:  *     map             KKT node map
                    622:  *     node            name of node removed from map
                    623:  */
                    624: kkt_return_t   KKT_REMOVE_NODE(
                    625:                        node_map_t      map,
                    626:                        node_name       *node);
                    627: 
                    628: kkt_return_t   KKT_RPC_INIT(
                    629:                        channel_t       channel,
                    630:                        unsigned int    senders,
                    631:                        unsigned int    receivers,
                    632:                        kkt_rpc_deliver_t deliver,
                    633:                        kkt_malloc_t    malloc,
                    634:                        kkt_free_t      free,
                    635:                        unsigned int    max_send_size);
                    636: 
                    637: kkt_return_t   KKT_RPC_HANDLE_ALLOC(
                    638:                        channel_t       channel,
                    639:                        handle_t        *uhandle,
                    640:                        vm_size_t       size);
                    641: 
                    642: kkt_return_t   KKT_RPC_HANDLE_BUF(
                    643:                        handle_t        handle,
                    644:                        void            **userbuf);
                    645: 
                    646: kkt_return_t   KKT_RPC_HANDLE_FREE(
                    647:                        handle_t        handle);
                    648: 
                    649: kkt_return_t   KKT_RPC(
                    650:                        node_name       node,
                    651:                        handle_t        handle);
                    652: 
                    653: kkt_return_t   KKT_RPC_REPLY(
                    654:                        handle_t        handle);
                    655: 
                    656: kkt_return_t   KKT_PROPERTIES(
                    657:                        kkt_properties_t *prop);
                    658: 
                    659: node_name      KKT_NODE_SELF(void);
                    660: 
                    661: boolean_t      KKT_NODE_IS_VALID(node_name node);
                    662: 
                    663: kkt_return_t   KKT_NODE_INCARN(node_name node, unsigned int *incarn);
                    664: 
                    665: #endif /* _DIPC_KKT_REQUEST_H_ */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.