Commit 7bf9e881 authored by Arun Gopalakrishnan's avatar Arun Gopalakrishnan Committed by Hari Kanigeri

Syslink IPC ListMP, messageQ aligned with 2_00_00_08

This patch can be used to sync with the syslink drop 2.0.0.8 for
ListMP/ListMP Shared Mem and MessageQ Transport SHM modules

The changes are limited to
1.      parameter name changes
2.      error code changes
3.      addition of error function in MessageQ Transport SHM

No major functional change in any of the functions in above
modules.
Signed-off-by: default avatarArun M G <arunmg@ti.com>
parent 342bddba
...@@ -150,7 +150,7 @@ struct listmp_elem { ...@@ -150,7 +150,7 @@ struct listmp_elem {
struct listmp_params { struct listmp_params {
bool cache_flag; bool cache_flag;
/*!< Set to 1 by the open() call. No one else should touch this! */ /*!< Set to 1 by the open() call. No one else should touch this! */
struct mutex *lock_handle; struct mutex *gate;
/*!< Lock used for critical region management of the list */ /*!< Lock used for critical region management of the list */
void *shared_addr; void *shared_addr;
/*!< shared memory address */ /*!< shared memory address */
...@@ -158,7 +158,7 @@ struct listmp_params { ...@@ -158,7 +158,7 @@ struct listmp_params {
/*!< shared memory size */ /*!< shared memory size */
char *name; char *name;
/*!< Name of the object */ /*!< Name of the object */
int resourceId; int resource_id;
/*!< /*!<
* resourceId Specifies the resource id number. * resourceId Specifies the resource id number.
* Parameter is used only when type is set to Fast List * Parameter is used only when type is set to Fast List
......
...@@ -168,7 +168,7 @@ struct listmp_sharedmemory_cmd_args { ...@@ -168,7 +168,7 @@ struct listmp_sharedmemory_cmd_args {
struct listmp_params *params; struct listmp_params *params;
u32 name_len; u32 name_len;
u32 shared_addr_srptr; u32 shared_addr_srptr;
void *knl_lock_handle; void *knl_gate;
} create; } create;
struct { struct {
...@@ -180,7 +180,7 @@ struct listmp_sharedmemory_cmd_args { ...@@ -180,7 +180,7 @@ struct listmp_sharedmemory_cmd_args {
struct listmp_params *params; struct listmp_params *params;
u32 name_len; u32 name_len;
u32 shared_addr_srptr; u32 shared_addr_srptr;
void *knl_lock_handle; void *knl_gate;
} open; } open;
struct { struct {
......
...@@ -120,6 +120,13 @@ ...@@ -120,6 +120,13 @@
#define MESSAGEQ_TRANSPORTSHM_E_HANDLE \ #define MESSAGEQ_TRANSPORTSHM_E_HANDLE \
MESSAGEQ_TRANSPORTSHM_MAKE_FAILURE(8) MESSAGEQ_TRANSPORTSHM_MAKE_FAILURE(8)
/*!
* @def MESSAGEQTRANSPORTSHM_E_NOTSUPPORTED
* @brief The specified operation is not supported.
*/
#define MESSAGEQTRANSPORTSHM_E_NOTSUPPORTED \
MESSAGEQ_TRANSPORTSHM_MAKE_FAILURE(9)
/*! /*!
* @def MESSAGEQ_TRANSPORTSHM_SUCCESS * @def MESSAGEQ_TRANSPORTSHM_SUCCESS
* @brief Operation successful. * @brief Operation successful.
...@@ -140,12 +147,45 @@ ...@@ -140,12 +147,45 @@
* Structures & Enums * Structures & Enums
* ============================================================================= * =============================================================================
*/ */
/*!
* @brief Structure defining the reason for error function being called
*/
enum MessageQTransportShm_Reason {
MessageQTransportShm_Reason_FAILEDPUT,
/*!< Failed to send the message. */
MessageQTransportShm_Reason_INTERNALERR,
/*!< An internal error occurred in the transport */
MessageQTransportShm_Reason_PHYSICALERR,
/*!< An error occurred in the physical link in the transport */
MessageQTransportShm_Reason_FAILEDALLOC
/*!< Failed to allocate a message. */
};
/*!
* @brief transport error callback function.
*
* First parameter: Why the error function is being called.
*
* Second parameter: Handle of transport that had the error. NULL denotes
* that it is a system error, not a specific transport.
*
* Third parameter: Pointer to the message. This is only valid for
* #MessageQTransportShm_Reason_FAILEDPUT.
*
* Fourth parameter: Transport specific information. Refer to individual
* transports for more details.
*/
/*! /*!
* @brief Module configuration structure. * @brief Module configuration structure.
*/ */
struct messageq_transportshm_config { struct messageq_transportshm_config {
u32 reserved; void (*err_fxn)(enum MessageQTransportShm_Reason reason,
/*!< Reserved value */ void *handle,
void *msg,
u32 info);
/*!< Asynchronous error function for the transport module */
}; };
/*! /*!
...@@ -153,6 +193,8 @@ struct messageq_transportshm_config { ...@@ -153,6 +193,8 @@ struct messageq_transportshm_config {
* instances. * instances.
*/ */
struct messageq_transportshm_params { struct messageq_transportshm_params {
u32 priority;
/*!< Priority of messages supported by this transport */
void *gate; void *gate;
/*!< Gate used for critical region management of the shared memory */ /*!< Gate used for critical region management of the shared memory */
void *shared_addr; void *shared_addr;
...@@ -165,8 +207,6 @@ struct messageq_transportshm_params { ...@@ -165,8 +207,6 @@ struct messageq_transportshm_params {
/*!< Notify event number to be used by the transport */ /*!< Notify event number to be used by the transport */
void *notify_driver; void *notify_driver;
/*!< Notify driver to be used by the transport */ /*!< Notify driver to be used by the transport */
u32 priority;
/*!< Priority of messages supported by this transport */
}; };
/*! /*!
...@@ -186,6 +226,7 @@ enum messageq_transportshm_status { ...@@ -186,6 +226,7 @@ enum messageq_transportshm_status {
*/ */
}; };
/* ============================================================================= /* =============================================================================
* APIs called by applications * APIs called by applications
* ============================================================================= * =============================================================================
...@@ -195,7 +236,7 @@ enum messageq_transportshm_status { ...@@ -195,7 +236,7 @@ enum messageq_transportshm_status {
void messageq_transportshm_get_config(struct messageq_transportshm_config *cfg); void messageq_transportshm_get_config(struct messageq_transportshm_config *cfg);
/* Function to setup the MessageQTransportShm module. */ /* Function to setup the MessageQTransportShm module. */
int messageq_transportshm_setup(struct messageq_transportshm_config *cfg); int messageq_transportshm_setup(const struct messageq_transportshm_config *cfg);
/* Function to destroy the MessageQTransportShm module. */ /* Function to destroy the MessageQTransportShm module. */
int messageq_transportshm_destroy(void); int messageq_transportshm_destroy(void);
...@@ -215,6 +256,15 @@ int messageq_transportshm_delete(void **mqtshm_handleptr); ...@@ -215,6 +256,15 @@ int messageq_transportshm_delete(void **mqtshm_handleptr);
u32 messageq_transportshm_shared_mem_req(const u32 messageq_transportshm_shared_mem_req(const
struct messageq_transportshm_params *params); struct messageq_transportshm_params *params);
/* Set the asynchronous error function for the transport module */
void messageq_transportshm_set_err_fxn(
void (*err_fxn)(
enum MessageQTransportShm_Reason reason,
void *handle,
void *msg,
u32 info));
/* ============================================================================= /* =============================================================================
* APIs called internally by MessageQ module. * APIs called internally by MessageQ module.
* ============================================================================= * =============================================================================
...@@ -223,7 +273,7 @@ u32 messageq_transportshm_shared_mem_req(const ...@@ -223,7 +273,7 @@ u32 messageq_transportshm_shared_mem_req(const
int messageq_transportshm_put(void *mqtshm_handle, void *msg); int messageq_transportshm_put(void *mqtshm_handle, void *msg);
/* Control Function */ /* Control Function */
bool messageq_transportshm_control(void *mqtshm_handle, u32 cmd, int messageq_transportshm_control(void *mqtshm_handle, u32 cmd,
u32 *cmd_arg); u32 *cmd_arg);
/* Get current status of the MessageQTransportShm */ /* Get current status of the MessageQTransportShm */
......
...@@ -109,7 +109,7 @@ struct listmp_sharedmemory_module_object { ...@@ -109,7 +109,7 @@ struct listmp_sharedmemory_module_object {
/*!< Handle to the local NameServer used for storing GP objects */ /*!< Handle to the local NameServer used for storing GP objects */
struct list_head obj_list; struct list_head obj_list;
/*!< List holding created listmp_sharedmemory objects */ /*!< List holding created listmp_sharedmemory objects */
struct mutex *lock_handle; struct mutex *local_gate;
/*!< Handle to lock for protecting obj_list */ /*!< Handle to lock for protecting obj_list */
struct listmp_config cfg; struct listmp_config cfg;
/*!< Current config values */ /*!< Current config values */
...@@ -131,7 +131,7 @@ struct listmp_sharedmemory_module_object listmp_sharedmemory_state = { ...@@ -131,7 +131,7 @@ struct listmp_sharedmemory_module_object listmp_sharedmemory_state = {
.default_inst_params.shared_addr = 0, .default_inst_params.shared_addr = 0,
.default_inst_params.shared_addr_size = 0, .default_inst_params.shared_addr_size = 0,
.default_inst_params.name = NULL, .default_inst_params.name = NULL,
.default_inst_params.lock_handle = NULL, .default_inst_params.gate = NULL,
.default_inst_params.list_type = listmp_type_SHARED}; .default_inst_params.list_type = listmp_type_SHARED};
/*! /*!
...@@ -272,19 +272,19 @@ int listmp_sharedmemory_setup(struct listmp_config *config) ...@@ -272,19 +272,19 @@ int listmp_sharedmemory_setup(struct listmp_config *config)
/* Construct the list object */ /* Construct the list object */
INIT_LIST_HEAD(&listmp_sharedmemory_state.obj_list); INIT_LIST_HEAD(&listmp_sharedmemory_state.obj_list);
/* Create a lock for protecting list object */ /* Create a lock for protecting list object */
listmp_sharedmemory_state.lock_handle = \ listmp_sharedmemory_state.local_gate = \
kmalloc(sizeof(struct mutex), GFP_KERNEL); kmalloc(sizeof(struct mutex), GFP_KERNEL);
if (listmp_sharedmemory_state.lock_handle == NULL) { if (listmp_sharedmemory_state.local_gate == NULL) {
gt_2trace(listmpshm_debugmask, gt_2trace(listmpshm_debugmask,
GT_4CLASS, GT_4CLASS,
"ListMPSharedmemsetup", "ListMPSharedmemsetup",
LISTMPSHAREDMEMORY_E_FAIL, LISTMPSHAREDMEMORY_E_FAIL,
"Failed to create the lock_handle!"); "Failed to create the local_gate!");
status = -ENOMEM; status = -ENOMEM;
goto clean_nameserver; goto clean_nameserver;
} }
mutex_init(listmp_sharedmemory_state.lock_handle); mutex_init(listmp_sharedmemory_state.local_gate);
/* Copy the cfg */ /* Copy the cfg */
memcpy(&listmp_sharedmemory_state.cfg, config, memcpy(&listmp_sharedmemory_state.cfg, config,
sizeof(struct listmp_config)); sizeof(struct listmp_config));
...@@ -366,8 +366,8 @@ int listmp_sharedmemory_destroy(void) ...@@ -366,8 +366,8 @@ int listmp_sharedmemory_destroy(void)
/* Destruct the list object */ /* Destruct the list object */
list_del(&listmp_sharedmemory_state.obj_list); list_del(&listmp_sharedmemory_state.obj_list);
/* Delete the list lock */ /* Delete the list lock */
kfree(listmp_sharedmemory_state.lock_handle); kfree(listmp_sharedmemory_state.local_gate);
listmp_sharedmemory_state.lock_handle = NULL; listmp_sharedmemory_state.local_gate = NULL;
memset(&listmp_sharedmemory_state.cfg, 0, memset(&listmp_sharedmemory_state.cfg, 0,
sizeof(struct listmp_config)); sizeof(struct listmp_config));
/* Decrease the refCount */ /* Decrease the refCount */
...@@ -525,9 +525,9 @@ int listmp_sharedmemory_delete(listmp_sharedmemory_handle *listmp_handleptr) ...@@ -525,9 +525,9 @@ int listmp_sharedmemory_delete(listmp_sharedmemory_handle *listmp_handleptr)
/* Remove from the local list */ /* Remove from the local list */
key = mutex_lock_interruptible( key = mutex_lock_interruptible(
listmp_sharedmemory_state.lock_handle); listmp_sharedmemory_state.local_gate);
list_del(&obj->list_elem); list_del(&obj->list_elem);
mutex_unlock(listmp_sharedmemory_state.lock_handle); mutex_unlock(listmp_sharedmemory_state.local_gate);
if (likely(params->name != NULL)) { if (likely(params->name != NULL)) {
/* Free memory for the name */ /* Free memory for the name */
...@@ -644,14 +644,14 @@ int listmp_sharedmemory_open(listmp_sharedmemory_handle *listmp_handleptr, ...@@ -644,14 +644,14 @@ int listmp_sharedmemory_open(listmp_sharedmemory_handle *listmp_handleptr,
if (((struct listmp_sharedmemory_obj *)elem)->params.shared_addr if (((struct listmp_sharedmemory_obj *)elem)->params.shared_addr
== params->shared_addr) { == params->shared_addr) {
key = mutex_lock_interruptible( key = mutex_lock_interruptible(
listmp_sharedmemory_state.lock_handle); listmp_sharedmemory_state.local_gate);
if (((struct listmp_sharedmemory_obj *)elem) if (((struct listmp_sharedmemory_obj *)elem)
->owner->proc_id ->owner->proc_id
== multiproc_get_id(NULL)) == multiproc_get_id(NULL))
((struct listmp_sharedmemory_obj *)elem) ((struct listmp_sharedmemory_obj *)elem)
->owner->open_count++; ->owner->open_count++;
mutex_unlock( mutex_unlock(
listmp_sharedmemory_state.lock_handle); listmp_sharedmemory_state.local_gate);
*listmp_handleptr = \ *listmp_handleptr = \
(((struct listmp_sharedmemory_obj *) (((struct listmp_sharedmemory_obj *)
elem)->top); elem)->top);
...@@ -663,14 +663,14 @@ int listmp_sharedmemory_open(listmp_sharedmemory_handle *listmp_handleptr, ...@@ -663,14 +663,14 @@ int listmp_sharedmemory_open(listmp_sharedmemory_handle *listmp_handleptr,
if (strcmp(((struct listmp_sharedmemory_obj *)elem) if (strcmp(((struct listmp_sharedmemory_obj *)elem)
->params.name, params->name) == 0) { ->params.name, params->name) == 0) {
key = mutex_lock_interruptible( key = mutex_lock_interruptible(
listmp_sharedmemory_state.lock_handle); listmp_sharedmemory_state.local_gate);
if (((struct listmp_sharedmemory_obj *)elem) if (((struct listmp_sharedmemory_obj *)elem)
->owner->proc_id ->owner->proc_id
== multiproc_get_id(NULL)) == multiproc_get_id(NULL))
((struct listmp_sharedmemory_obj *)elem) ((struct listmp_sharedmemory_obj *)elem)
->owner->open_count++; ->owner->open_count++;
mutex_unlock( mutex_unlock(
listmp_sharedmemory_state.lock_handle); listmp_sharedmemory_state.local_gate);
*listmp_handleptr = \ *listmp_handleptr = \
(((struct listmp_sharedmemory_obj *) (((struct listmp_sharedmemory_obj *)
elem)->top); elem)->top);
...@@ -756,7 +756,7 @@ int listmp_sharedmemory_close(listmp_sharedmemory_handle listmp_handle) ...@@ -756,7 +756,7 @@ int listmp_sharedmemory_close(listmp_sharedmemory_handle listmp_handle)
} }
key = mutex_lock_interruptible( key = mutex_lock_interruptible(
listmp_sharedmemory_state.lock_handle); listmp_sharedmemory_state.local_gate);
if (obj->owner->proc_id == multiproc_get_id(NULL)) if (obj->owner->proc_id == multiproc_get_id(NULL))
(obj)->owner->open_count--; (obj)->owner->open_count--;
...@@ -776,7 +776,7 @@ int listmp_sharedmemory_close(listmp_sharedmemory_handle listmp_handle) ...@@ -776,7 +776,7 @@ int listmp_sharedmemory_close(listmp_sharedmemory_handle listmp_handle)
handle = NULL; handle = NULL;
} }
mutex_unlock(listmp_sharedmemory_state.lock_handle); mutex_unlock(listmp_sharedmemory_state.local_gate);
exit: exit:
gt_1trace(listmpshm_debugmask, GT_LEAVE, "listmp_sharedmemory_close", gt_1trace(listmpshm_debugmask, GT_LEAVE, "listmp_sharedmemory_close",
...@@ -817,8 +817,8 @@ bool listmp_sharedmemory_empty(listmp_sharedmemory_handle listmp_handle) ...@@ -817,8 +817,8 @@ bool listmp_sharedmemory_empty(listmp_sharedmemory_handle listmp_handle)
handle = (listmp_sharedmemory_object *)listmp_handle; handle = (listmp_sharedmemory_object *)listmp_handle;
obj = (struct listmp_sharedmemory_obj *) handle->obj; obj = (struct listmp_sharedmemory_obj *) handle->obj;
if (obj->params.lock_handle != NULL) { if (obj->params.gate != NULL) {
retval = gatepeterson_enter(obj->params.lock_handle); retval = gatepeterson_enter(obj->params.gate);
if (retval < 0) { if (retval < 0) {
status = -EINVAL; status = -EINVAL;
goto exit; goto exit;
...@@ -832,8 +832,8 @@ bool listmp_sharedmemory_empty(listmp_sharedmemory_handle listmp_handle) ...@@ -832,8 +832,8 @@ bool listmp_sharedmemory_empty(listmp_sharedmemory_handle listmp_handle)
if (obj->listmp_elem->next == sharedHead) if (obj->listmp_elem->next == sharedHead)
is_empty = true; is_empty = true;
if (obj->params.lock_handle != NULL) if (obj->params.gate != NULL)
gatepeterson_leave(obj->params.lock_handle, 0); gatepeterson_leave(obj->params.gate, 0);
exit: exit:
gt_1trace(listmpshm_debugmask, GT_LEAVE, "listmp_sharedmemory_empty", gt_1trace(listmpshm_debugmask, GT_LEAVE, "listmp_sharedmemory_empty",
...@@ -873,8 +873,8 @@ void *listmp_sharedmemory_get_head(listmp_sharedmemory_handle listmp_handle) ...@@ -873,8 +873,8 @@ void *listmp_sharedmemory_get_head(listmp_sharedmemory_handle listmp_handle)
handle = (listmp_sharedmemory_object *)listmp_handle; handle = (listmp_sharedmemory_object *)listmp_handle;
obj = (struct listmp_sharedmemory_obj *) handle->obj; obj = (struct listmp_sharedmemory_obj *) handle->obj;
if (obj->params.lock_handle != NULL) { if (obj->params.gate != NULL) {
retval = gatepeterson_enter(obj->params.lock_handle); retval = gatepeterson_enter(obj->params.gate);
if (retval < 0) if (retval < 0)
goto exit; goto exit;
} }
...@@ -900,8 +900,8 @@ void *listmp_sharedmemory_get_head(listmp_sharedmemory_handle listmp_handle) ...@@ -900,8 +900,8 @@ void *listmp_sharedmemory_get_head(listmp_sharedmemory_handle listmp_handle)
localNext->prev = sharedHead; localNext->prev = sharedHead;
} }
if (obj->params.lock_handle != NULL) if (obj->params.gate != NULL)
gatepeterson_leave(obj->params.lock_handle, 0); gatepeterson_leave(obj->params.gate, 0);
exit: exit:
gt_1trace(listmpshm_debugmask, GT_LEAVE, "listmp_sharedmemory_get_head", gt_1trace(listmpshm_debugmask, GT_LEAVE, "listmp_sharedmemory_get_head",
...@@ -947,8 +947,8 @@ void *listmp_sharedmemory_get_tail(listmp_sharedmemory_handle listmp_handle) ...@@ -947,8 +947,8 @@ void *listmp_sharedmemory_get_tail(listmp_sharedmemory_handle listmp_handle)
handle = (listmp_sharedmemory_object *)listmp_handle; handle = (listmp_sharedmemory_object *)listmp_handle;
obj = (struct listmp_sharedmemory_obj *) handle->obj; obj = (struct listmp_sharedmemory_obj *) handle->obj;
if (obj->params.lock_handle != NULL) { if (obj->params.gate != NULL) {
retval = gatepeterson_enter(obj->params.lock_handle); retval = gatepeterson_enter(obj->params.gate);
if (retval < 0) if (retval < 0)
goto exit; goto exit;
} }
...@@ -970,8 +970,8 @@ void *listmp_sharedmemory_get_tail(listmp_sharedmemory_handle listmp_handle) ...@@ -970,8 +970,8 @@ void *listmp_sharedmemory_get_tail(listmp_sharedmemory_handle listmp_handle)
localPrev->next = sharedHead; localPrev->next = sharedHead;
} }
if (obj->params.lock_handle != NULL) if (obj->params.gate != NULL)
gatepeterson_leave(obj->params.lock_handle, 0); gatepeterson_leave(obj->params.gate, 0);
exit: exit:
gt_1trace(listmpshm_debugmask, GT_LEAVE, "listmp_sharedmemory_get_tail", gt_1trace(listmpshm_debugmask, GT_LEAVE, "listmp_sharedmemory_get_tail",
...@@ -1019,8 +1019,8 @@ int listmp_sharedmemory_put_head(listmp_sharedmemory_handle listmp_handle, ...@@ -1019,8 +1019,8 @@ int listmp_sharedmemory_put_head(listmp_sharedmemory_handle listmp_handle,
sharedHead = (struct listmp_elem *)sharedregion_get_srptr( sharedHead = (struct listmp_elem *)sharedregion_get_srptr(
(void *)obj->listmp_elem, obj->index); (void *)obj->listmp_elem, obj->index);
if (obj->params.lock_handle != NULL) { if (obj->params.gate != NULL) {
retval = gatepeterson_enter(obj->params.lock_handle); retval = gatepeterson_enter(obj->params.gate);
if (retval < 0) { if (retval < 0) {
status = -EINVAL; status = -EINVAL;
goto exit; goto exit;
...@@ -1034,8 +1034,8 @@ int listmp_sharedmemory_put_head(listmp_sharedmemory_handle listmp_handle, ...@@ -1034,8 +1034,8 @@ int listmp_sharedmemory_put_head(listmp_sharedmemory_handle listmp_handle,
localNextElem->prev = sharedElem; localNextElem->prev = sharedElem;
obj->listmp_elem->next = sharedElem; obj->listmp_elem->next = sharedElem;
if (obj->params.lock_handle != NULL) if (obj->params.gate != NULL)
gatepeterson_leave(obj->params.lock_handle, 0); gatepeterson_leave(obj->params.gate, 0);
exit: exit:
gt_1trace(listmpshm_debugmask, GT_LEAVE, "listmp_sharedmemory_put_head", gt_1trace(listmpshm_debugmask, GT_LEAVE, "listmp_sharedmemory_put_head",
...@@ -1087,8 +1087,8 @@ int listmp_sharedmemory_put_tail(listmp_sharedmemory_handle listmp_handle, ...@@ -1087,8 +1087,8 @@ int listmp_sharedmemory_put_tail(listmp_sharedmemory_handle listmp_handle,
((void *)obj->listmp_elem, ((void *)obj->listmp_elem,
obj->index); obj->index);
if (obj->params.lock_handle != NULL) { if (obj->params.gate != NULL) {
retval = gatepeterson_enter(obj->params.lock_handle); retval = gatepeterson_enter(obj->params.gate);
if (retval < 0) { if (retval < 0) {
status = -EINVAL; status = -EINVAL;
goto exit; goto exit;
...@@ -1102,8 +1102,8 @@ int listmp_sharedmemory_put_tail(listmp_sharedmemory_handle listmp_handle, ...@@ -1102,8 +1102,8 @@ int listmp_sharedmemory_put_tail(listmp_sharedmemory_handle listmp_handle,
localPrevElem->next = sharedElem; localPrevElem->next = sharedElem;
obj->listmp_elem->prev = sharedElem; obj->listmp_elem->prev = sharedElem;
if (obj->params.lock_handle != NULL) if (obj->params.gate != NULL)
gatepeterson_leave(obj->params.lock_handle, 0); gatepeterson_leave(obj->params.gate, 0);
exit: exit:
gt_1trace(listmpshm_debugmask, GT_LEAVE, "listmp_sharedmemory_put_tail", gt_1trace(listmpshm_debugmask, GT_LEAVE, "listmp_sharedmemory_put_tail",
...@@ -1148,8 +1148,8 @@ int listmp_sharedmemory_insert(listmp_sharedmemory_handle listmp_handle, ...@@ -1148,8 +1148,8 @@ int listmp_sharedmemory_insert(listmp_sharedmemory_handle listmp_handle,
handle = (listmp_sharedmemory_object *)listmp_handle; handle = (listmp_sharedmemory_object *)listmp_handle;
obj = (struct listmp_sharedmemory_obj *) handle->obj; obj = (struct listmp_sharedmemory_obj *) handle->obj;
if (obj->params.lock_handle != NULL) { if (obj->params.gate != NULL) {
retval = gatepeterson_enter(obj->params.lock_handle); retval = gatepeterson_enter(obj->params.gate);
if (retval < 0) { if (retval < 0) {
status = -EINVAL; status = -EINVAL;
goto exit; goto exit;
...@@ -1178,8 +1178,8 @@ int listmp_sharedmemory_insert(listmp_sharedmemory_handle listmp_handle, ...@@ -1178,8 +1178,8 @@ int listmp_sharedmemory_insert(listmp_sharedmemory_handle listmp_handle,
localPrevElem->next = sharedNewElem; localPrevElem->next = sharedNewElem;
cur_elem->prev = sharedNewElem; cur_elem->prev = sharedNewElem;
if (obj->params.lock_handle != NULL) if (obj->params.gate != NULL)
gatepeterson_leave(obj->params.lock_handle, 0); gatepeterson_leave(obj->params.gate, 0);
exit: exit:
gt_1trace(listmpshm_debugmask, GT_LEAVE, "listmp_sharedmemory_insert", gt_1trace(listmpshm_debugmask, GT_LEAVE, "listmp_sharedmemory_insert",
...@@ -1221,8 +1221,8 @@ int listmp_sharedmemory_remove(listmp_sharedmemory_handle listmp_handle, ...@@ -1221,8 +1221,8 @@ int listmp_sharedmemory_remove(listmp_sharedmemory_handle listmp_handle,
handle = (listmp_sharedmemory_object *)listmp_handle; handle = (listmp_sharedmemory_object *)listmp_handle;
obj = (struct listmp_sharedmemory_obj *) handle->obj; obj = (struct listmp_sharedmemory_obj *) handle->obj;
if (obj->params.lock_handle != NULL) { if (obj->params.gate != NULL) {
retval = gatepeterson_enter(obj->params.lock_handle); retval = gatepeterson_enter(obj->params.gate);
if (retval < 0) { if (retval < 0) {
status = -EINVAL; status = -EINVAL;
goto exit; goto exit;
...@@ -1235,8 +1235,8 @@ int listmp_sharedmemory_remove(listmp_sharedmemory_handle listmp_handle, ...@@ -1235,8 +1235,8 @@ int listmp_sharedmemory_remove(listmp_sharedmemory_handle listmp_handle,
localPrevElem->next = elem->next; localPrevElem->next = elem->next;
localNextElem->prev = elem->prev; localNextElem->prev = elem->prev;
if (obj->params.lock_handle != NULL) if (obj->params.gate != NULL)
gatepeterson_leave(obj->params.lock_handle, 0); gatepeterson_leave(obj->params.gate, 0);
exit: exit:
gt_1trace(listmpshm_debugmask, GT_LEAVE, "listmp_sharedmemory_remove", gt_1trace(listmpshm_debugmask, GT_LEAVE, "listmp_sharedmemory_remove",
...@@ -1271,8 +1271,8 @@ void *listmp_sharedmemory_next(listmp_sharedmemory_handle listmp_handle, ...@@ -1271,8 +1271,8 @@ void *listmp_sharedmemory_next(listmp_sharedmemory_handle listmp_handle,
handle = (listmp_sharedmemory_object *)listmp_handle; handle = (listmp_sharedmemory_object *)listmp_handle;
obj = (struct listmp_sharedmemory_obj *) handle->obj; obj = (struct listmp_sharedmemory_obj *) handle->obj;
if (obj->params.lock_handle != NULL) { if (obj->params.gate != NULL) {
retval = gatepeterson_enter(obj->params.lock_handle); retval = gatepeterson_enter(obj->params.gate);
if (retval < 0) if (retval < 0)
goto exit; goto exit;
} }
...@@ -1288,8 +1288,8 @@ void *listmp_sharedmemory_next(listmp_sharedmemory_handle listmp_handle, ...@@ -1288,8 +1288,8 @@ void *listmp_sharedmemory_next(listmp_sharedmemory_handle listmp_handle,
/*! @retval NULL if list is empty */ /*! @retval NULL if list is empty */
if (retElem == (struct listmp_elem *)obj->listmp_elem) if (retElem == (struct listmp_elem *)obj->listmp_elem)
retElem = NULL; retElem = NULL;
if (obj->params.lock_handle != NULL) if (obj->params.gate != NULL)
gatepeterson_leave(obj->params.lock_handle, 0); gatepeterson_leave(obj->params.gate, 0);
exit: exit:
gt_1trace(listmpshm_debugmask, GT_LEAVE, "listmp_sharedmemory_next", gt_1trace(listmpshm_debugmask, GT_LEAVE, "listmp_sharedmemory_next",
...@@ -1323,8 +1323,8 @@ void *listmp_sharedmemory_prev(listmp_sharedmemory_handle listmp_handle, ...@@ -1323,8 +1323,8 @@ void *listmp_sharedmemory_prev(listmp_sharedmemory_handle listmp_handle,
handle = (listmp_sharedmemory_object *)listmp_handle; handle = (listmp_sharedmemory_object *)listmp_handle;
obj = (struct listmp_sharedmemory_obj *) handle->obj; obj = (struct listmp_sharedmemory_obj *) handle->obj;
if (obj->params.lock_handle != NULL) { if (obj->params.gate != NULL) {
retval = gatepeterson_enter(obj->params.lock_handle); retval = gatepeterson_enter(obj->params.gate);
if (retval < 0) if (retval < 0)
goto exit; goto exit;
} }
...@@ -1342,8 +1342,8 @@ void *listmp_sharedmemory_prev(listmp_sharedmemory_handle listmp_handle, ...@@ -1342,8 +1342,8 @@ void *listmp_sharedmemory_prev(listmp_sharedmemory_handle listmp_handle,
if (retElem == (struct listmp_elem *)(obj->listmp_elem)) if (retElem == (struct listmp_elem *)(obj->listmp_elem))
retElem = NULL; retElem = NULL;
if (obj->params.lock_handle != NULL) if (obj->params.gate != NULL)
gatepeterson_leave(obj->params.lock_handle, 0); gatepeterson_leave(obj->params.gate, 0);
exit: exit:
gt_1trace(listmpshm_debugmask, GT_LEAVE, "listmp_sharedmemory_prev", gt_1trace(listmpshm_debugmask, GT_LEAVE, "listmp_sharedmemory_prev",
...@@ -1476,11 +1476,11 @@ listmp_sharedmemory_handle _listmp_sharedmemory_create( ...@@ -1476,11 +1476,11 @@ listmp_sharedmemory_handle _listmp_sharedmemory_create(
/* Put in the local list */ /* Put in the local list */
key = mutex_lock_interruptible( key = mutex_lock_interruptible(
listmp_sharedmemory_state.lock_handle); listmp_sharedmemory_state.local_gate);
INIT_LIST_HEAD(&obj->list_elem); INIT_LIST_HEAD(&obj->list_elem);
list_add_tail((&obj->list_elem), list_add_tail((&obj->list_elem),
&listmp_sharedmemory_state.obj_list); &listmp_sharedmemory_state.obj_list);
mutex_unlock(listmp_sharedmemory_state.lock_handle); mutex_unlock(listmp_sharedmemory_state.local_gate);
if (create_flag == true) { if (create_flag == true) {
...@@ -1505,9 +1505,9 @@ listmp_sharedmemory_handle _listmp_sharedmemory_create( ...@@ -1505,9 +1505,9 @@ listmp_sharedmemory_handle _listmp_sharedmemory_create(
if (status < 0) { if (status < 0) {
/* Remove from the local list */ /* Remove from the local list */
key = mutex_lock_interruptible( key = mutex_lock_interruptible(
listmp_sharedmemory_state.lock_handle); listmp_sharedmemory_state.local_gate);
list_del(&obj->list_elem); list_del(&obj->list_elem);
mutex_unlock(listmp_sharedmemory_state.lock_handle); mutex_unlock(listmp_sharedmemory_state.local_gate);
if (likely(listmp_sharedmemory_state.cfg.use_name_server if (likely(listmp_sharedmemory_state.cfg.use_name_server
== true)) { == true)) {
......
...@@ -178,8 +178,8 @@ static inline int listmp_sharedmemory_ioctl_create( ...@@ -178,8 +178,8 @@ static inline int listmp_sharedmemory_ioctl_create(
if (unlikely(params.shared_addr == NULL)) if (unlikely(params.shared_addr == NULL))
goto free_name; goto free_name;
/* Update lock_handle in params. */ /* Update gate in params. */
params.lock_handle = cargs->args.create.knl_lock_handle; params.gate = cargs->args.create.knl_gate;
cargs->args.create.listmp_handle = listmp_sharedmemory_create(&params); cargs->args.create.listmp_handle = listmp_sharedmemory_create(&params);
size = copy_to_user(cargs->args.create.params, &params, size = copy_to_user(cargs->args.create.params, &params,
...@@ -256,8 +256,8 @@ static inline int listmp_sharedmemory_ioctl_open( ...@@ -256,8 +256,8 @@ static inline int listmp_sharedmemory_ioctl_open(
if (unlikely(params.shared_addr == NULL)) if (unlikely(params.shared_addr == NULL))
goto free_name; goto free_name;
/* Update lock_handle in params. */ /* Update gate in params. */
params.lock_handle = cargs->args.open.knl_lock_handle; params.gate = cargs->args.open.knl_gate;
status = listmp_sharedmemory_open(&listmp_handle, &params); status = listmp_sharedmemory_open(&listmp_handle, &params);
if (status) if (status)
goto free_name; goto free_name;
......
...@@ -124,7 +124,7 @@ struct messageq_transportshm_object { ...@@ -124,7 +124,7 @@ struct messageq_transportshm_object {
*/ */
static struct messageq_transportshm_moduleobject messageq_transportshm_state = { static struct messageq_transportshm_moduleobject messageq_transportshm_state = {
.gate_handle = NULL, .gate_handle = NULL,
.def_cfg.reserved = 0, .def_cfg.err_fxn = 0,
.def_inst_params.gate = NULL, .def_inst_params.gate = NULL,
.def_inst_params.shared_addr = 0x0, .def_inst_params.shared_addr = 0x0,
.def_inst_params.shared_addr_size = 0x0, .def_inst_params.shared_addr_size = 0x0,
...@@ -206,7 +206,7 @@ exit: ...@@ -206,7 +206,7 @@ exit:
* messageq_transportshm_setup with NULL parameters. The default * messageq_transportshm_setup with NULL parameters. The default
* parameters would get automatically used. * parameters would get automatically used.
*/ */
int messageq_transportshm_setup(struct messageq_transportshm_config *cfg) int messageq_transportshm_setup(const struct messageq_transportshm_config *cfg)
{ {
int status = MESSAGEQ_TRANSPORTSHM_SUCCESS; int status = MESSAGEQ_TRANSPORTSHM_SUCCESS;
struct messageq_transportshm_config tmpCfg; struct messageq_transportshm_config tmpCfg;
...@@ -445,7 +445,7 @@ void *messageq_transportshm_create(u16 proc_id, ...@@ -445,7 +445,7 @@ void *messageq_transportshm_create(u16 proc_id,
(2 * MESSAGEQ_TRANSPORTSHM_CACHESIZE)); (2 * MESSAGEQ_TRANSPORTSHM_CACHESIZE));
listmp_params[0].shared_addr_size = \ listmp_params[0].shared_addr_size = \
listmp_sharedmemory_shared_memreq(&(listmp_params[0])); listmp_sharedmemory_shared_memreq(&(listmp_params[0]));
listmp_params[0].lock_handle = params->gate; listmp_params[0].gate = params->gate;
listmp_params[0].name = NULL; listmp_params[0].name = NULL;
listmp_params[0].list_type = listmp_type_SHARED; listmp_params[0].list_type = listmp_type_SHARED;
...@@ -457,7 +457,7 @@ void *messageq_transportshm_create(u16 proc_id, ...@@ -457,7 +457,7 @@ void *messageq_transportshm_create(u16 proc_id,
listmp_sharedmemory_shared_memreq(&(listmp_params[1])); listmp_sharedmemory_shared_memreq(&(listmp_params[1]));
listmp_params[1].name = NULL; listmp_params[1].name = NULL;
listmp_params[1].list_type = listmp_type_SHARED; listmp_params[1].list_type = listmp_type_SHARED;
listmp_params[1].lock_handle = params->gate; listmp_params[1].gate = params->gate;
handle->my_listmp_handle = listmp_sharedmemory_create handle->my_listmp_handle = listmp_sharedmemory_create
(&(listmp_params[my_index])); (&(listmp_params[my_index]));
...@@ -680,7 +680,7 @@ exit: ...@@ -680,7 +680,7 @@ exit:
* Purpose: * Purpose:
* Control Function * Control Function
*/ */
bool messageq_transportshm_control(void *mqtshm_handle, u32 cmd, u32 *cmdArg) int messageq_transportshm_control(void *mqtshm_handle, u32 cmd, u32 *cmdArg)
{ {
gt_3trace(mqtshm_debugmask, GT_ENTER, "messageq_transportshm_control", gt_3trace(mqtshm_debugmask, GT_ENTER, "messageq_transportshm_control",
mqtshm_handle, cmd, cmdArg); mqtshm_handle, cmd, cmdArg);
...@@ -688,8 +688,8 @@ bool messageq_transportshm_control(void *mqtshm_handle, u32 cmd, u32 *cmdArg) ...@@ -688,8 +688,8 @@ bool messageq_transportshm_control(void *mqtshm_handle, u32 cmd, u32 *cmdArg)
BUG_ON(mqtshm_handle == NULL); BUG_ON(mqtshm_handle == NULL);
gt_1trace(mqtshm_debugmask, GT_LEAVE, "messageq_transportshm_control", gt_1trace(mqtshm_debugmask, GT_LEAVE, "messageq_transportshm_control",
false); MESSAGEQTRANSPORTSHM_E_NOTSUPPORTED);
return false; return MESSAGEQTRANSPORTSHM_E_NOTSUPPORTED;
} }
/* /*
...@@ -784,3 +784,31 @@ exit: ...@@ -784,3 +784,31 @@ exit:
gt_0trace(mqtshm_debugmask, GT_LEAVE, gt_0trace(mqtshm_debugmask, GT_LEAVE,
"messageq_transportshm_notifyFxn"); "messageq_transportshm_notifyFxn");
} }
/*
* ======== messageq_transportshm_delete ========
* Purpose:
* This will set the asynchronous error function for the transport module
*/
void messageq_transportshm_set_err_fxn(
void (*err_fxn)(
enum MessageQTransportShm_Reason reason,
void *handle,
void *msg,
u32 info))
{
u32 key;
key = mutex_lock_interruptible(messageq_transportshm_state.gate_handle);
if (key < 0)
goto exit;
messageq_transportshm_state.cfg.err_fxn = err_fxn;
mutex_unlock(messageq_transportshm_state.gate_handle);
exit:
return;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment