diff options
| author | Manikandan Mohan <manikand@codeaurora.org> | 2017-09-20 18:14:16 -0700 |
|---|---|---|
| committer | snandini <snandini@codeaurora.org> | 2017-11-16 05:03:15 -0800 |
| commit | 6eeaedd0b633f100593abc3e9e0c45b53e45ce00 (patch) | |
| tree | 77f819f44253d2766747326fc367bda1407cb36c /core/utils | |
| parent | 654364e44758f8c95f39bdaf25d9a9c247bef973 (diff) | |
qcacld-3.0: Fix compilation for multiple driver module generation
Qcacld supports multiple driver modules instance generation with
different file names and Kbuild options. Fix driver load time and
compilation errors on this feature.
Change-Id: I78f6771d1a215ac8193bfd51eefc6d8c5a2594a6
CRs-fixed: 2142715
Diffstat (limited to 'core/utils')
| -rw-r--r-- | core/utils/nlink/src/wlan_nlink_srv.c | 180 |
1 files changed, 101 insertions, 79 deletions
diff --git a/core/utils/nlink/src/wlan_nlink_srv.c b/core/utils/nlink/src/wlan_nlink_srv.c index 25ff46ce851b..1d3bb1b63725 100644 --- a/core/utils/nlink/src/wlan_nlink_srv.c +++ b/core/utils/nlink/src/wlan_nlink_srv.c @@ -263,105 +263,38 @@ inline int nl_srv_is_initialized(void) * and the diagnotics netlink socket will not be available since this * diagnostics netlink socket can only be exposed by one instance of the driver. */ -#elif !defined(MULTI_IF_NAME) - -#ifdef CNSS_GENL +#elif defined(CNSS_GENL) #include <qdf_mem.h> #include <wlan_nlink_common.h> #include <net/genetlink.h> #include <net/cnss_nl.h> -#endif - -/* Global variables */ -static DEFINE_MUTEX(nl_srv_sem); -static struct sock *nl_srv_sock; -static nl_srv_msg_callback nl_srv_msg_handler[NLINK_MAX_CALLBACKS]; - -/* Forward declaration */ -static void nl_srv_rcv(struct sk_buff *sk); -static void nl_srv_rcv_skb(struct sk_buff *skb); -static void nl_srv_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh); -/* - * Initialize the netlink service. - * Netlink service is usable after this. - */ +/* For CNSS_GENL netlink sockets will be initialized by CNSS Kernel Module */ int nl_srv_init(void *wiphy) { - int retcode = 0; - struct netlink_kernel_cfg cfg = { - .groups = WLAN_NLINK_MCAST_GRP_ID, - .input = nl_srv_rcv - }; - - nl_srv_sock = netlink_kernel_create(&init_net, WLAN_NLINK_PROTO_FAMILY, - &cfg); - - if (nl_srv_sock != NULL) { - memset(nl_srv_msg_handler, 0, sizeof(nl_srv_msg_handler)); - } else { - QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR, - "NLINK: netlink_kernel_create failed"); - retcode = -ECONNREFUSED; - } - return retcode; + return 0; } -/* - * Deinit the netlink service. - * Netlink service is unusable after this. - */ void nl_srv_exit(void) { - if (nl_srv_is_initialized() == 0) - netlink_kernel_release(nl_srv_sock); +} - nl_srv_sock = NULL; +int nl_srv_is_initialized(void) +{ + return 0; } -/* - * Register a message handler for a specified module. - * Each module (e.g. WLAN_NL_MSG_BTC )will register a - * handler to handle messages addressed to it. - */ +/* Not implemented by CNSS kernel module */ int nl_srv_register(tWlanNlModTypes msg_type, nl_srv_msg_callback msg_handler) { - int retcode = 0; - - if ((msg_type >= WLAN_NL_MSG_BASE) && (msg_type < WLAN_NL_MSG_MAX) && - msg_handler != NULL) { - nl_srv_msg_handler[msg_type - WLAN_NL_MSG_BASE] = msg_handler; - } else { - QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_WARN, - "NLINK: nl_srv_register failed for msg_type %d", - msg_type); - retcode = -EINVAL; - } - - return retcode; + return 0; } -/* - * Unregister the message handler for a specified module. - */ int nl_srv_unregister(tWlanNlModTypes msg_type, nl_srv_msg_callback msg_handler) { - int retcode = 0; - - if ((msg_type >= WLAN_NL_MSG_BASE) && (msg_type < WLAN_NL_MSG_MAX) && - (nl_srv_msg_handler[msg_type - WLAN_NL_MSG_BASE] == msg_handler)) { - nl_srv_msg_handler[msg_type - WLAN_NL_MSG_BASE] = NULL; - } else { - QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_WARN, - "NLINK: nl_srv_unregister failed for msg_type %d", - msg_type); - retcode = -EINVAL; - } - - return retcode; + return 0; } -#ifdef CNSS_GENL /** * nl80211hdr_put() - API to fill genlmsg header * @skb: Sk buffer @@ -548,7 +481,97 @@ int nl_srv_ucast(struct sk_buff *skb, int dst_pid, int flag, dev_kfree_skb(skb); return 0; } -#else + +#elif !defined(MULTI_IF_NAME) + +/* Global variables */ +static DEFINE_MUTEX(nl_srv_sem); +static struct sock *nl_srv_sock; +static nl_srv_msg_callback nl_srv_msg_handler[NLINK_MAX_CALLBACKS]; + +/* Forward declaration */ +static void nl_srv_rcv(struct sk_buff *sk); +static void nl_srv_rcv_skb(struct sk_buff *skb); +static void nl_srv_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh); + +/* + * Initialize the netlink service. + * Netlink service is usable after this. + */ +int nl_srv_init(void *wiphy) +{ + int retcode = 0; + struct netlink_kernel_cfg cfg = { + .groups = WLAN_NLINK_MCAST_GRP_ID, + .input = nl_srv_rcv + }; + + nl_srv_sock = netlink_kernel_create(&init_net, WLAN_NLINK_PROTO_FAMILY, + &cfg); + + if (nl_srv_sock != NULL) { + memset(nl_srv_msg_handler, 0, sizeof(nl_srv_msg_handler)); + } else { + QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR, + "NLINK: netlink_kernel_create failed"); + retcode = -ECONNREFUSED; + } + return retcode; +} + +/* + * Deinit the netlink service. + * Netlink service is unusable after this. + */ +void nl_srv_exit(void) +{ + if (nl_srv_is_initialized() == 0) + netlink_kernel_release(nl_srv_sock); + + nl_srv_sock = NULL; +} + +/* + * Register a message handler for a specified module. + * Each module (e.g. WLAN_NL_MSG_BTC )will register a + * handler to handle messages addressed to it. + */ +int nl_srv_register(tWlanNlModTypes msg_type, nl_srv_msg_callback msg_handler) +{ + int retcode = 0; + + if ((msg_type >= WLAN_NL_MSG_BASE) && (msg_type < WLAN_NL_MSG_MAX) && + msg_handler != NULL) { + nl_srv_msg_handler[msg_type - WLAN_NL_MSG_BASE] = msg_handler; + } else { + QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_WARN, + "NLINK: nl_srv_register failed for msg_type %d", + msg_type); + retcode = -EINVAL; + } + + return retcode; +} + +/* + * Unregister the message handler for a specified module. + */ +int nl_srv_unregister(tWlanNlModTypes msg_type, nl_srv_msg_callback msg_handler) +{ + int retcode = 0; + + if ((msg_type >= WLAN_NL_MSG_BASE) && (msg_type < WLAN_NL_MSG_MAX) && + (nl_srv_msg_handler[msg_type - WLAN_NL_MSG_BASE] == msg_handler)) { + nl_srv_msg_handler[msg_type - WLAN_NL_MSG_BASE] = NULL; + } else { + QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_WARN, + "NLINK: nl_srv_unregister failed for msg_type %d", + msg_type); + retcode = -EINVAL; + } + + return retcode; +} /* * Unicast the message to the process in user space identfied @@ -601,7 +624,6 @@ int nl_srv_bcast(struct sk_buff *skb) dev_kfree_skb(skb); return err; } -#endif /* * Processes the Netlink socket input queue. |
