Commit f7f0de9d authored by Suman Anna's avatar Suman Anna Committed by Hari Kanigeri

SYSLINK: ipc - fixes in nameserver_remotenotify callback

This patch fixes the issues found in nameserver_remotenotify
callback function. The following changes are made in this patch.
	- nameservet_get_local function returns the length of
		the name matched on success. Previously it was
		returning NULL.
	- nameserver_remotenotify_cbck function is corrected to
		not prematurely exit if a name is not found in
		the local nameserver table. Correction has also
		been made to send a request status value so
		that the remote core thread is not blocked.
Signed-off-by: default avatarSuman Anna <s-anna@ti.com>
parent 0b4254c7
...@@ -767,13 +767,16 @@ int nameserver_get_local(void *handle, const char *name, ...@@ -767,13 +767,16 @@ int nameserver_get_local(void *handle, const char *name,
goto error; goto error;
} }
if (entry->len >= length) if (entry->len >= length) {
memcpy(buffer, entry->buf, length); memcpy(buffer, entry->buf, length);
else retval = length;
} else {
memcpy(buffer, entry->buf, entry->len); memcpy(buffer, entry->buf, entry->len);
retval = entry->len;
}
mutex_unlock(temp_obj->gate_handle); mutex_unlock(temp_obj->gate_handle);
return 0; return retval;
error: error:
mutex_unlock(temp_obj->gate_handle); mutex_unlock(temp_obj->gate_handle);
......
...@@ -277,7 +277,7 @@ void nameserver_remotenotify_callback(u16 proc_id, u32 event_no, ...@@ -277,7 +277,7 @@ void nameserver_remotenotify_callback(u16 proc_id, u32 event_no,
void *nshandle = NULL; void *nshandle = NULL;
u32 value; u32 value;
u32 key; u32 key;
s32 retval; s32 retval = 0;
BUG_ON(arg == NULL); BUG_ON(arg == NULL);
proc_count = multiproc_get_max_processors(); proc_count = multiproc_get_max_processors();
...@@ -294,18 +294,18 @@ void nameserver_remotenotify_callback(u16 proc_id, u32 event_no, ...@@ -294,18 +294,18 @@ void nameserver_remotenotify_callback(u16 proc_id, u32 event_no,
/* This is a request */ /* This is a request */
nshandle = nameserver_get_handle( nshandle = nameserver_get_handle(
handle->msg[1 - offset]->instance_name); handle->msg[1 - offset]->instance_name);
if (nshandle == NULL) if (nshandle != NULL)
goto exit; /* Search for the NameServer entry */
retval = nameserver_get_local(nshandle,
/* Search for the NameServer entry */ handle->msg[1 - offset]->name, &value,
retval = nameserver_get_local(nshandle, handle->msg[1 - offset]->name, handle->msg[1 - offset]->value_len);
&value, handle->msg[1 - offset]->value_len);
if (retval != 0)
goto exit;
key = gatepeterson_enter(handle->params.gate); key = gatepeterson_enter(handle->params.gate);
handle->msg[1 - offset]->request_status = true; /* If retval != 0 then an entry was found */
handle->msg[1 - offset]->value = value; if (retval > 0) {
handle->msg[1 - offset]->request_status = true;
handle->msg[1 - offset]->value = value;
}
/* Send a response back */ /* Send a response back */
handle->msg[1 - offset]->response = true; handle->msg[1 - offset]->response = true;
handle->msg[1 - offset]->request = false; handle->msg[1 - offset]->request = false;
......
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