From b673dae57f82772c32912bc0293ee7578f342c7b Mon Sep 17 00:00:00 2001 From: Sourav Mohapatra Date: Thu, 2 Jan 2020 10:49:15 +0530 Subject: [PATCH] qcacmn: Remove unused PTT sock code for non CNSS_GENL Currently, the code present to take care of the PTT msgs in case of non-CNSS_GENL is not being used. Thus, cleanup the path for the same. Change-Id: I310ace0e04448b21e46b0f39efb3c33bce0a4d65 CRs-Fixed: 2559499 --- utils/ptt/inc/wlan_ptt_sock_svc.h | 14 ++--- utils/ptt/src/wlan_ptt_sock_svc.c | 99 +------------------------------ 2 files changed, 5 insertions(+), 108 deletions(-) diff --git a/utils/ptt/inc/wlan_ptt_sock_svc.h b/utils/ptt/inc/wlan_ptt_sock_svc.h index 972dabb07507..4aded38fef35 100644 --- a/utils/ptt/inc/wlan_ptt_sock_svc.h +++ b/utils/ptt/inc/wlan_ptt_sock_svc.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2018,2020 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -87,7 +87,7 @@ * Length : 4 bytes [LEN_PAYLOAD] * Payload : LEN_PAYLOAD bytes */ -#ifdef PTT_SOCK_SVC_ENABLE +#if defined(PTT_SOCK_SVC_ENABLE) && defined(CNSS_GENL) /** * ptt_sock_activate_svc() - API to register PTT/PUMAC command handlers * @@ -105,23 +105,17 @@ void ptt_sock_activate_svc(void); * Return: None */ void ptt_sock_deactivate_svc(void); -int ptt_sock_send_msg_to_app(tAniHdr *wmsg, int radio, int src_mod, int pid); + #else static inline void ptt_sock_activate_svc(void) { } - static inline void ptt_sock_deactivate_svc(void) { } - -static inline int ptt_sock_send_msg_to_app(tAniHdr *wmsg, int radio, - int src_mod, int pid) -{ - return 0; -} #endif +int ptt_sock_send_msg_to_app(tAniHdr *wmsg, int radio, int src_mod, int pid); /* * Format of message exchanged between the PTT Socket App in userspace and the * WLAN Driver, in either direction. Each msg will begin with this header and diff --git a/utils/ptt/src/wlan_ptt_sock_svc.c b/utils/ptt/src/wlan_ptt_sock_svc.c index 4b8d54de2198..be58621e178c 100644 --- a/utils/ptt/src/wlan_ptt_sock_svc.c +++ b/utils/ptt/src/wlan_ptt_sock_svc.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2020 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -33,10 +33,6 @@ #ifdef CNSS_GENL #include #include -#else - -/** ptt Process ID */ -static int32_t ptt_pid = INVALID_PID; #endif #define PTT_SOCK_DEBUG @@ -169,84 +165,6 @@ int ptt_sock_send_msg_to_app(tAniHdr *wmsg, int radio, int src_mod, int pid) return err; } -#ifndef CNSS_GENL -/* - * Process tregisteration request and send registration response messages - * to the PTT Socket App in user space - */ -static void ptt_sock_proc_reg_req(tAniHdr *wmsg, int radio) -{ - struct sAniAppRegReq *reg_req; - struct sAniNlAppRegRsp rspmsg; - - reg_req = (struct sAniAppRegReq *) (wmsg + 1); - memset((char *)&rspmsg, 0, sizeof(rspmsg)); - /* send reg response message to the application */ - rspmsg.ret = ANI_NL_MSG_OK; - rspmsg.regReq.type = reg_req->type; - /*Save the pid */ - ptt_pid = reg_req->pid; - rspmsg.regReq.pid = reg_req->pid; - rspmsg.wniHdr.type = cpu_to_be16(ANI_MSG_APP_REG_RSP); - rspmsg.wniHdr.length = cpu_to_be16(sizeof(rspmsg)); - if (ptt_sock_send_msg_to_app((tAniHdr *) &rspmsg.wniHdr, radio, - ANI_NL_MSG_PUMAC, ptt_pid) < 0) { - PTT_TRACE(QDF_TRACE_LEVEL_INFO, - "%s: Error sending ANI_MSG_APP_REG_RSP to pid[%d]\n", - __func__, ptt_pid); - } -} - -/* - * Process all the messages from the PTT Socket App in user space - */ -static void ptt_proc_pumac_msg(struct sk_buff *skb, tAniHdr *wmsg, int radio) -{ - u16 ani_msg_type = be16_to_cpu(wmsg->type); - - switch (ani_msg_type) { - case ANI_MSG_APP_REG_REQ: - PTT_TRACE(QDF_TRACE_LEVEL_INFO, - "%s: Received ANI_MSG_APP_REG_REQ [0x%X]\n", __func__, - ani_msg_type); - ptt_sock_proc_reg_req(wmsg, radio); - break; - default: - PTT_TRACE(QDF_TRACE_LEVEL_ERROR, - "%s: Received Unknown Msg Type[0x%X]\n", __func__, - ani_msg_type); - break; - } -} - -/* - * Process all the Netlink messages from PTT Socket app in user space - */ -static int ptt_sock_rx_nlink_msg(struct sk_buff *skb) -{ - tAniNlHdr *wnl; - int radio; - int type; - - wnl = (tAniNlHdr *) skb->data; - radio = wnl->radio; - type = wnl->nlh.nlmsg_type; - switch (type) { - case ANI_NL_MSG_PUMAC: /* Message from the PTT socket APP */ - PTT_TRACE(QDF_TRACE_LEVEL_INFO, - "%s: Received ANI_NL_MSG_PUMAC Msg [0x%X]\n", - __func__, type); - ptt_proc_pumac_msg(skb, &wnl->wmsg, radio); - break; - default: - PTT_TRACE(QDF_TRACE_LEVEL_ERROR, "%s: Unknown NL Msg [0x%X]\n", - __func__, type); - break; - } - return 0; -} -#endif - #ifdef CNSS_GENL /** * ptt_cmd_handler() - Handler function for PTT commands @@ -327,20 +245,5 @@ void ptt_sock_deactivate_svc(void) deregister_cld_cmd_cb(ANI_NL_MSG_PTT); deregister_cld_cmd_cb(ANI_NL_MSG_PUMAC); } -#else - -void ptt_sock_activate_svc(void) -{ - ptt_pid = INVALID_PID; - nl_srv_register(ANI_NL_MSG_PUMAC, ptt_sock_rx_nlink_msg); - nl_srv_register(ANI_NL_MSG_PTT, ptt_sock_rx_nlink_msg); -} - -void ptt_sock_deactivate_svc(void) -{ - nl_srv_unregister(ANI_NL_MSG_PTT, ptt_sock_rx_nlink_msg); - nl_srv_unregister(ANI_NL_MSG_PUMAC, ptt_sock_rx_nlink_msg); - ptt_pid = INVALID_PID; -} #endif #endif /* PTT_SOCK_SVC_ENABLE */