wrsm_transport.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2001 by Sun Microsystems, Inc.
* All rights reserved.
*/
#ifndef _WRSM_TRANSPORT_H
#define _WRSM_TRANSPORT_H
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/wrsm_common.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* WRSM_TL_VERSION - If any message formats change, this constant must
* change in the next release, to ensure that imcompatible drivers
* recognize the version skew.
*/
#define WRSM_TL_VERSION 0x1
/*
* Messagetypes
* When you add a message here, remember to add it to fuction
* messagetypes2string in wrsm_tl.c.
*/
enum {
/* Common message types */
/* Config message types */
/* Multihop message types */
/* Session message types */
/* RSMPI Segment message types */
/* RSMPI Interrupt message types */
/* RSMPI Barrier message types */
/* RSMAPI Segment message types */
/* RSMAPI Interrupt message types */
/* RSMAPI Barrier message types */
};
typedef uint8_t wrsm_message_type_t;
/*
* Format of messages
*/
#define WRSM_TL_MSG_SIZE (WRSM_CACHELINE_SIZE)
typedef uint32_t wrsm_messageid_t;
typedef uint8_t wrsm_version_t;
typedef uint8_t wrsm_sessionid_t;
#define SESS_ID_INVALID 0
typedef struct wrsm_message_header {
#define WRSM_MESSAGE_BODY_SIZE (WRSM_TL_MSG_SIZE - \
sizeof (wrsm_message_header_t))
/*
* An object of type wrsm_message_t must be 64-byte aligned. The user can
* cast the body to message-specific structures.
*/
typedef struct wrsm_message {
/*
* The following type may be allocated on the stack, it has the
* right size for the wrsm message, optimal aignment for wrsm_blkread/blkwrite
* and can be casted into either wrsm_message_t type or wrsm_smallput_msg.
* The wrsm_message_t requires 32 bit allignment, the wrsm_raw_message
* is declared as an array of uint64_t - giving it 8 byte alignment
*/
/*
* Definition of the user's message handler function. rxhandler is called
* when a given message type is received. Returns boolean to indicate
* if the message was successfully processed. For datagrams, the return
* value is ignored. For RPC messages, this function is called before the
* thread calling rpc() is awakened, so returning FALSE will result in the
* message being ignored, and the pending thread will eventually timeout.
* The message buffer will be allcoated and freed by the transport, and
* should not be freed by the user.
*/
/*
* Definition of the user's message handler function. txhandler is used for
* formatting any transmit messages. Returns boolean to indicate if the
* message was successfully processed. Returning FALSE will cause the
* message to be discarded without being sent to the remote node (used,
* for example, if a session cannot be established with the remote cnode).
* The message buffer will be allcoated and freed by the
* transport, and should not be freed by the user.
*/
/*
* Transport functions
*
* The following functions return 0 for success.
*/
/* Initializes the transport for a specific RSM network */
/* Cleans-up the transport for a specific RSM network */
/* Informs the transport that a new cnode is part of the config */
/* Informs the transport that a cnode is no longer part of config */
/* Informs the transport that a cnode is reachable */
/* Informs the transport that a cnode is no longer reachable */
/* Adds user-defined handlers for a specific message type */
/* Sends a datagram. Caller must allocate and free msg buffer. */
/*
* Sends a message, waits for a response. If successful (return code is 0),
* the response structure will contain the message from the remote node.
* The caller must allocate and free both the msg and response buffer.
* The caller may use the same message buffer for both the msg and response,
* and the response will overwrite the original message.
*/
/*
* Response to an rpc message, called by a receive message handler. The
* orig_msg must be an unmodified version of the message buffer provided
* to the receive message handler. The caller must allocate and free the
* response buffer.
*/
/*
* The macro WRSM_TL_DUMP_MESSAGE dumps the contents of a message to the
* console for debugging. If DEBUG is not defined, the macro results in
* no code being generated.
*/
#ifdef DEBUG
#else
#endif /* DEBUG */
/*
* Standard handler functions
*/
#define WRSM_TL_NO_HANDLER NULL
/*
* Adds the session id to the message header. If there is currently no
* session with the destination node, it will attempt to establish a new
* session.
*/
wrsm_message_t *);
/* Validates the session id for an incoming rpc response. */
#ifdef __cplusplus
}
#endif
#endif /* _WRSM_TRANSPORT_H */