msm: ipc: Update server lookup operation to return complete information

QMI Server lookup returns only node_id and port_id. This information is
not sufficient when the QMI clients look for a specific instance of a
service. Hence the server lookup routine returns the instance ID along
with the server address information.

Change-Id: I644e6c8bb9dc3108c0198b7779ef277aa65f7bc5
Signed-off-by: Karthikeyan Ramasubramanian <kramasub@codeaurora.org>
This commit is contained in:
Karthikeyan Ramasubramanian
2012-06-12 14:25:13 -06:00
committed by Stephen Boyd
parent b657cc0ec7
commit 2e378e8de8
4 changed files with 29 additions and 18 deletions

View File

@@ -2023,7 +2023,7 @@ int msm_ipc_router_bind_control_port(struct msm_ipc_port *port_ptr)
}
int msm_ipc_router_lookup_server_name(struct msm_ipc_port_name *srv_name,
struct msm_ipc_port_addr *srv_addr,
struct msm_ipc_server_info *srv_info,
int num_entries_in_array,
uint32_t lookup_mask)
{
@@ -2036,8 +2036,8 @@ int msm_ipc_router_lookup_server_name(struct msm_ipc_port_name *srv_name,
return -EINVAL;
}
if (num_entries_in_array && !srv_addr) {
pr_err("%s: srv_addr NULL\n", __func__);
if (num_entries_in_array && !srv_info) {
pr_err("%s: srv_info NULL\n", __func__);
return -EINVAL;
}
@@ -2054,10 +2054,14 @@ int msm_ipc_router_lookup_server_name(struct msm_ipc_port_name *srv_name,
list_for_each_entry(server_port,
&server->server_port_list, list) {
if (i < num_entries_in_array) {
srv_addr[i].node_id =
srv_info[i].node_id =
server_port->server_addr.node_id;
srv_addr[i].port_id =
srv_info[i].port_id =
server_port->server_addr.port_id;
srv_info[i].service =
server->name.service;
srv_info[i].instance =
server->name.instance;
}
i++;
}

View File

@@ -185,7 +185,7 @@ int msm_ipc_router_read(struct msm_ipc_port *port_ptr,
int msm_ipc_router_get_curr_pkt_size(struct msm_ipc_port *port_ptr);
int msm_ipc_router_bind_control_port(struct msm_ipc_port *port_ptr);
int msm_ipc_router_lookup_server_name(struct msm_ipc_port_name *srv_name,
struct msm_ipc_port_addr *port_addr,
struct msm_ipc_server_info *srv_info,
int num_entries_in_array,
uint32_t lookup_mask);
int msm_ipc_router_close_port(struct msm_ipc_port *port_ptr);

View File

@@ -367,8 +367,8 @@ static int msm_ipc_router_ioctl(struct socket *sock,
struct sock *sk = sock->sk;
struct msm_ipc_port *port_ptr;
struct server_lookup_args server_arg;
struct msm_ipc_port_addr *port_addr = NULL;
unsigned int n, port_addr_sz = 0;
struct msm_ipc_server_info *srv_info = NULL;
unsigned int n, srv_info_sz = 0;
int ret;
if (!sk)
@@ -409,33 +409,33 @@ static int msm_ipc_router_ioctl(struct socket *sock,
break;
}
if (server_arg.num_entries_in_array) {
port_addr_sz = server_arg.num_entries_in_array *
sizeof(*port_addr);
port_addr = kmalloc(port_addr_sz, GFP_KERNEL);
if (!port_addr) {
srv_info_sz = server_arg.num_entries_in_array *
sizeof(*srv_info);
srv_info = kmalloc(srv_info_sz, GFP_KERNEL);
if (!srv_info) {
ret = -ENOMEM;
break;
}
}
ret = msm_ipc_router_lookup_server_name(&server_arg.port_name,
port_addr, server_arg.num_entries_in_array,
srv_info, server_arg.num_entries_in_array,
server_arg.lookup_mask);
if (ret < 0) {
pr_err("%s: Server not found\n", __func__);
ret = -ENODEV;
kfree(port_addr);
kfree(srv_info);
break;
}
server_arg.num_entries_found = ret;
ret = copy_to_user((void *)arg, &server_arg,
sizeof(server_arg));
if (port_addr_sz) {
if (srv_info_sz) {
ret = copy_to_user((void *)(arg + sizeof(server_arg)),
port_addr, port_addr_sz);
srv_info, srv_info_sz);
if (ret)
ret = -EFAULT;
kfree(port_addr);
kfree(srv_info);
}
break;

View File

@@ -62,12 +62,19 @@ struct sockaddr_msm_ipc {
#define IPC_ROUTER_IOCTL_BIND_CONTROL_PORT \
_IOR(IPC_ROUTER_IOCTL_MAGIC, 4, unsigned int)
struct msm_ipc_server_info {
uint32_t node_id;
uint32_t port_id;
uint32_t service;
uint32_t instance;
};
struct server_lookup_args {
struct msm_ipc_port_name port_name;
int num_entries_in_array;
int num_entries_found;
uint32_t lookup_mask;
struct msm_ipc_port_addr port_addr[0];
struct msm_ipc_server_info srv_info[0];
};
#endif