1*5113495bSYour Name /* 2*5113495bSYour Name * Copyright (c) 2012-2017, 2019-2020 The Linux Foundation. All rights reserved. 3*5113495bSYour Name * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. 4*5113495bSYour Name * 5*5113495bSYour Name * Permission to use, copy, modify, and/or distribute this software for 6*5113495bSYour Name * any purpose with or without fee is hereby granted, provided that the 7*5113495bSYour Name * above copyright notice and this permission notice appear in all 8*5113495bSYour Name * copies. 9*5113495bSYour Name * 10*5113495bSYour Name * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 11*5113495bSYour Name * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED 12*5113495bSYour Name * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE 13*5113495bSYour Name * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 14*5113495bSYour Name * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 15*5113495bSYour Name * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 16*5113495bSYour Name * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 17*5113495bSYour Name * PERFORMANCE OF THIS SOFTWARE. 18*5113495bSYour Name */ 19*5113495bSYour Name 20*5113495bSYour Name /****************************************************************************** 21*5113495bSYour Name * wlan_nlink_srv.h 22*5113495bSYour Name * 23*5113495bSYour Name * wlan_nlink_srv is used to RX/TX Netlink messages from user space to kernel 24*5113495bSYour Name * modules and vice versa. Kernel modules must register a message handler for a 25*5113495bSYour Name * message type so that the wlan_nlink_srv can invoke the corresponding msg handler 26*5113495bSYour Name * whenever a Netlink message of a particular type has been received from an 27*5113495bSYour Name * application. In the opposite direction, wlan_nlink_srv provides a mechanism 28*5113495bSYour Name * which kernel modules can use to send Netlink messages to applications. 29*5113495bSYour Name * 30*5113495bSYour Name ******************************************************************************/ 31*5113495bSYour Name 32*5113495bSYour Name #ifndef WLAN_NLINK_SRV_H 33*5113495bSYour Name #define WLAN_NLINK_SRV_H 34*5113495bSYour Name 35*5113495bSYour Name #include <linux/skbuff.h> 36*5113495bSYour Name #include <net/netlink.h> 37*5113495bSYour Name #include <wlan_nlink_common.h> 38*5113495bSYour Name 39*5113495bSYour Name #define INVALID_PID -1 40*5113495bSYour Name #define NLINK_MAX_CALLBACKS (WLAN_NL_MSG_MAX - WLAN_NL_MSG_BASE) 41*5113495bSYour Name 42*5113495bSYour Name typedef int (*nl_srv_msg_callback)(struct sk_buff *skb); 43*5113495bSYour Name 44*5113495bSYour Name /** 45*5113495bSYour Name * cld80211_oem_send_reply() - API to send cld80211 msg 46*5113495bSYour Name * @skb: Sk buffer 47*5113495bSYour Name * @hdr: nl80211hdr pointer 48*5113495bSYour Name * @nest: pointer of vendor nested attribute 49*5113495bSYour Name * @flags: Flags 50*5113495bSYour Name * 51*5113495bSYour Name * API to send cld80211 msg to applications 52*5113495bSYour Name * 53*5113495bSYour Name * Return: None 54*5113495bSYour Name */ 55*5113495bSYour Name void cld80211_oem_send_reply(struct sk_buff *msg, void *hdr, 56*5113495bSYour Name struct nlattr *nest, int flags); 57*5113495bSYour Name 58*5113495bSYour Name /** 59*5113495bSYour Name * nl80211hdr_put() - API to allocate skb for cld80211 msg 60*5113495bSYour Name * @hdr: nl80211hdr pointer 61*5113495bSYour Name * @portid: Port ID 62*5113495bSYour Name * @nest: pointer of vendor nested attribute 63*5113495bSYour Name * @flags: Flags 64*5113495bSYour Name * 65*5113495bSYour Name * API to allocate skb for cld80211 msg 66*5113495bSYour Name * 67*5113495bSYour Name * Return: Pointer to skbuff 68*5113495bSYour Name */ 69*5113495bSYour Name 70*5113495bSYour Name struct sk_buff * 71*5113495bSYour Name cld80211_oem_rsp_alloc_skb(uint32_t portid, void **hdr, struct nlattr **nest, 72*5113495bSYour Name int *flags); 73*5113495bSYour Name int nl_srv_init(void *wiphy, int proto); 74*5113495bSYour Name void nl_srv_exit(void); 75*5113495bSYour Name int nl_srv_register(tWlanNlModTypes msg_type, nl_srv_msg_callback msg_handler); 76*5113495bSYour Name int nl_srv_unregister(tWlanNlModTypes msg_type, 77*5113495bSYour Name nl_srv_msg_callback msg_handler); 78*5113495bSYour Name 79*5113495bSYour Name #ifdef CNSS_GENL 80*5113495bSYour Name int nl_srv_ucast(struct sk_buff *skb, int dst_pid, int flag, 81*5113495bSYour Name int app_id, int mcgroup_id); 82*5113495bSYour Name int nl_srv_bcast(struct sk_buff *skb, int mcgroup_id, int app_id); 83*5113495bSYour Name 84*5113495bSYour Name /** 85*5113495bSYour Name * nl80211hdr_put() - API to fill genlmsg header 86*5113495bSYour Name * @skb: Sk buffer 87*5113495bSYour Name * @portid: Port ID 88*5113495bSYour Name * @seq: Sequence number 89*5113495bSYour Name * @flags: Flags 90*5113495bSYour Name * @cmd: Command id 91*5113495bSYour Name * 92*5113495bSYour Name * API to fill genl message header for broadcast events to user space 93*5113495bSYour Name * 94*5113495bSYour Name * Return: Pointer to user specific header/payload 95*5113495bSYour Name */ 96*5113495bSYour Name void *nl80211hdr_put(struct sk_buff *skb, uint32_t portid, 97*5113495bSYour Name uint32_t seq, int flags, uint8_t cmd); 98*5113495bSYour Name #else 99*5113495bSYour Name int nl_srv_ucast(struct sk_buff *skb, int dst_pid, int flag); 100*5113495bSYour Name int nl_srv_bcast(struct sk_buff *skb); 101*5113495bSYour Name #endif 102*5113495bSYour Name 103*5113495bSYour Name int nl_srv_is_initialized(void); 104*5113495bSYour Name void nl_srv_ucast_oem(struct sk_buff *skb, int dst_pid, int flag); 105*5113495bSYour Name 106*5113495bSYour Name #endif 107