1 /* 2 * Copyright (c) 2011, 2017-2018 The Linux Foundation. All rights reserved. 3 * 4 * 5 * Permission to use, copy, modify, and/or distribute this software for 6 * any purpose with or without fee is hereby granted, provided that the 7 * above copyright notice and this permission notice appear in all 8 * copies. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 11 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED 12 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE 13 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 14 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 15 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 16 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 17 * PERFORMANCE OF THIS SOFTWARE. 18 */ 19 20 #ifndef _OS_IF_SPECTRAL_NETLINK_H 21 #define _OS_IF_SPECTRAL_NETLINK_H 22 23 #include <net/netlink.h> 24 #include <wlan_objmgr_pdev_obj.h> 25 #include <linux/version.h> 26 #include <linux/module.h> 27 #include <linux/kernel.h> 28 29 /* NETLINK related declarations */ 30 #if (KERNEL_VERSION(2, 6, 31) > LINUX_VERSION_CODE) 31 void os_if_spectral_nl_data_ready(struct sock *sk, int len); 32 #else 33 void os_if_spectral_nl_data_ready(struct sk_buff *skb); 34 #endif /* VERSION CHECK */ 35 36 #ifndef SPECTRAL_NETLINK 37 #define SPECTRAL_NETLINK (NETLINK_GENERIC + 1) 38 #endif 39 #define MAX_SPECTRAL_PAYLOAD 1500 40 41 /* Init's network namespace */ 42 extern struct net init_net; 43 44 /** 45 * os_if_spectral_netlink_init() - Initialize Spectral Netlink data structures 46 * and register the NL handlers with Spectral target_if 47 * @pdev: Pointer to pdev 48 * 49 * Preparing socket buffer and sending Netlink messages to application layer are 50 * defined in os_if layer, they need to be registered with Spectral target_if 51 * 52 * Return: None 53 */ 54 void os_if_spectral_netlink_init(struct wlan_objmgr_pdev *pdev); 55 56 /** 57 * os_if_spectral_prep_skb() - Prepare socket buffer 58 * @pdev : Pointer to pdev 59 * 60 * Prepare socket buffer to send the data to application layer 61 * 62 * Return: NLMSG_DATA of the created skb or NULL if no memory 63 */ 64 void *os_if_spectral_prep_skb(struct wlan_objmgr_pdev *pdev); 65 66 /** 67 * os_if_spectral_netlink_deinit() - De-initialize Spectral Netlink data 68 * structures and de-register the NL handlers from Spectral target_if 69 * @pdev: Pointer to pdev 70 * 71 * Return: None 72 */ 73 void os_if_spectral_netlink_deinit(struct wlan_objmgr_pdev *pdev); 74 #endif /* _OS_IF_SPECTRAL_NETLINK_H */ 75