diff options
author | Dmitry Shmidt <dimitrysh@google.com> | 2009-11-10 14:13:56 -0800 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2009-11-10 14:13:56 -0800 |
commit | 1d3e7317c87a5fc1db8b4d3bd1386dee6edb0ea0 (patch) | |
tree | de0edb62b16346ff91bb9d19cd9caa93b9921d98 | |
parent | fbf1144135989f975e29b55c2251dc73b8174702 (diff) | |
parent | 1a02757bda09d2794e0b0c6090e82b8d82e06e5e (diff) | |
download | ti-1d3e7317c87a5fc1db8b4d3bd1386dee6edb0ea0.tar.gz |
am 1a02757b: am 35a4fd40: am 41a0b799: tnetw1271: Add 500 ms expired wakelock to deliver the message (b/2245483)
Merge commit '1a02757bda09d2794e0b0c6090e82b8d82e06e5e'
* commit '1a02757bda09d2794e0b0c6090e82b8d82e06e5e':
tnetw1271: Add 500 ms expired wakelock to deliver the message (b/2245483)
-rw-r--r-- | wilink_6_1/platforms/os/linux/src/ipc_k.c | 93 |
1 files changed, 45 insertions, 48 deletions
diff --git a/wilink_6_1/platforms/os/linux/src/ipc_k.c b/wilink_6_1/platforms/os/linux/src/ipc_k.c index e9c9778..c0b439a 100644 --- a/wilink_6_1/platforms/os/linux/src/ipc_k.c +++ b/wilink_6_1/platforms/os/linux/src/ipc_k.c @@ -65,61 +65,58 @@ TI_UINT32 IPCKernelDeInit (TI_HANDLE hAdapter) /*******************************************************/ TI_INT32 IPC_EventSend(TI_HANDLE hAdapter, TI_UINT8* pEvData, TI_UINT32 EvDataSize) { - struct sk_buff *skb; - int res; - TWlanDrvIfObj *drv = (TWlanDrvIfObj *) hAdapter; - TI_UINT32 realSize = 0; - TI_UINT32 msgSize; - struct nlmsghdr *nlh; - TI_UINT8 *msg; - - /* This event is targetted to the OS process Id 0 is not a valid pId for LINUX*/ - - if ((( IPC_EVENT_PARAMS *) pEvData) ->uProcessID == 0) - { - (( IPC_EVENT_PARAMS *) pEvData) ->pfEventCallback(( IPC_EV_DATA *) pEvData); - return 0; - } - - /* set the payload size */ - msgSize = (( IPC_EV_DATA *) pEvData) ->uBufferSize + offsetof(IPC_EV_DATA,uBuffer); - - /* add the netlink header size */ - realSize = NLMSG_SPACE(msgSize); - - /* allocate the complete message */ - skb = dev_alloc_skb(realSize); - if (!skb) { + struct sk_buff *skb; + int res; + TWlanDrvIfObj *drv = (TWlanDrvIfObj *) hAdapter; + TI_UINT32 realSize = 0; + TI_UINT32 msgSize; + struct nlmsghdr *nlh; + TI_UINT8 *msg; + + os_wake_lock_timeout_enable(drv); + /* This event is targetted to the OS process Id 0 is not a valid pId for LINUX*/ + if (((IPC_EVENT_PARAMS *)pEvData)->uProcessID == 0) + { + ((IPC_EVENT_PARAMS *)pEvData)->pfEventCallback(( IPC_EV_DATA *)pEvData); + return 0; + } + + /* set the payload size */ + msgSize = (( IPC_EV_DATA *) pEvData) ->uBufferSize + offsetof(IPC_EV_DATA,uBuffer); + + /* add the netlink header size */ + realSize = NLMSG_SPACE(msgSize); + + /* allocate the complete message */ + skb = dev_alloc_skb(realSize); + if (!skb) { printk(KERN_ERR "Failed to allocate new skb with size=%u.\n",realSize); return -1; - } - - /* set the netlink header params */ - nlh = NLMSG_PUT(skb, 0, 0, NLMSG_DONE, realSize - sizeof(*nlh)); - - /* get the payload pointer */ - msg = (char *)NLMSG_DATA(nlh); - - /* copy the data to the payload */ - memcpy(msg,pEvData,msgSize); - - NETLINK_CB(skb).pid = 0; /* from kernel */ + } + + /* set the netlink header params */ + nlh = NLMSG_PUT(skb, 0, 0, NLMSG_DONE, realSize - sizeof(*nlh)); + + /* get the payload pointer */ + msg = (char *)NLMSG_DATA(nlh); + + /* copy the data to the payload */ + memcpy(msg,pEvData,msgSize); + + NETLINK_CB(skb).pid = 0; /* from kernel */ #define RTMGRP_LINK 1 - NETLINK_CB(skb).dst_group = RTMGRP_LINK; + NETLINK_CB(skb).dst_group = RTMGRP_LINK; - /* send the message*/ - res = netlink_unicast(drv->wl_sock, skb, (( IPC_EVENT_PARAMS *) pEvData) ->uProcessID, MSG_DONTWAIT); + /* send the message*/ + res = netlink_unicast(drv->wl_sock, skb, (( IPC_EVENT_PARAMS *) pEvData) ->uProcessID, MSG_DONTWAIT); - /* Sanity checks. As far as we're concerned this error is unrecovarable.*/ - if (res >= 0) - { + /* Sanity checks. As far as we're concerned this error is unrecovarable.*/ + if (res >= 0) + { return 0; - } + } nlmsg_failure: - ti_dprintf(TIWLAN_LOG_INFO,"IPC kernel: did not send the netlink message\n"); + ti_dprintf(TIWLAN_LOG_INFO,"IPC kernel: did not send the netlink message\n"); return -1; - } - - |