|
@@ -20,9 +20,16 @@
|
|
|
#include <os_if_spectral_netlink.h>
|
|
|
#include <spectral_cmn_api_i.h>
|
|
|
#include <spectral_defs_i.h>
|
|
|
+#include <wlan_nlink_srv.h>
|
|
|
+#include <wlan_nlink_common.h>
|
|
|
+#ifdef CNSS_GENL
|
|
|
+#include <net/cnss_nl.h>
|
|
|
+#endif
|
|
|
|
|
|
struct sock *os_if_spectral_nl_sock;
|
|
|
+#ifndef CNSS_GENL
|
|
|
static atomic_t spectral_nl_users = ATOMIC_INIT(0);
|
|
|
+#endif
|
|
|
|
|
|
#if (KERNEL_VERSION(2, 6, 31) > LINUX_VERSION_CODE)
|
|
|
void
|
|
@@ -39,6 +46,7 @@ os_if_spectral_nl_data_ready(struct sk_buff *skb)
|
|
|
}
|
|
|
#endif /* VERSION */
|
|
|
|
|
|
+#ifndef CNSS_GENL
|
|
|
/**
|
|
|
* os_if_spectral_init_nl_cfg() - Initialize netlink kernel
|
|
|
* configuration parameters
|
|
@@ -62,7 +70,6 @@ os_if_spectral_init_nl_cfg(struct netlink_kernel_cfg *cfg)
|
|
|
{
|
|
|
}
|
|
|
#endif
|
|
|
-
|
|
|
/**
|
|
|
* os_if_spectral_create_nl_sock() - Create Netlink socket
|
|
|
* @cfg : Pointer to netlink_kernel_cfg
|
|
@@ -200,15 +207,21 @@ os_if_spectral_destroy_netlink(struct wlan_objmgr_pdev *pdev)
|
|
|
}
|
|
|
return 0;
|
|
|
}
|
|
|
+#else
|
|
|
+
|
|
|
+static int
|
|
|
+os_if_spectral_init_nl(struct wlan_objmgr_pdev *pdev)
|
|
|
+{
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+static int
|
|
|
+os_if_spectral_destroy_netlink(struct wlan_objmgr_pdev *pdev)
|
|
|
+{
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+#endif
|
|
|
|
|
|
-/**
|
|
|
- * os_if_spectral_prep_skb() - Prepare socket buffer
|
|
|
- * @pdev : Pointer to pdev
|
|
|
- *
|
|
|
- * Prepare socket buffer to send the data to application layer
|
|
|
- *
|
|
|
- * Return: NLMSG_DATA of the created skb or NULL if no memory
|
|
|
- */
|
|
|
void *
|
|
|
os_if_spectral_prep_skb(struct wlan_objmgr_pdev *pdev)
|
|
|
{
|
|
@@ -249,6 +262,7 @@ os_if_spectral_prep_skb(struct wlan_objmgr_pdev *pdev)
|
|
|
NLMSG_SPACE(sizeof(struct spectral_samp_msg));
|
|
|
spectral_nlh->nlmsg_pid = 0;
|
|
|
spectral_nlh->nlmsg_flags = 0;
|
|
|
+ spectral_nlh->nlmsg_type = WLAN_NL_MSG_SPECTRAL_SCAN;
|
|
|
|
|
|
return NLMSG_DATA(spectral_nlh);
|
|
|
}
|
|
@@ -285,6 +299,7 @@ os_if_init_spectral_skb_pid_portid(struct sk_buff *skb)
|
|
|
}
|
|
|
#endif
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* os_if_spectral_nl_unicast_msg() - Sends unicast Spectral message to user
|
|
|
* space
|
|
@@ -292,6 +307,7 @@ os_if_init_spectral_skb_pid_portid(struct sk_buff *skb)
|
|
|
*
|
|
|
* Return: void
|
|
|
*/
|
|
|
+#ifndef CNSS_GENL
|
|
|
static int
|
|
|
os_if_spectral_nl_unicast_msg(struct wlan_objmgr_pdev *pdev)
|
|
|
{
|
|
@@ -334,7 +350,43 @@ os_if_spectral_nl_unicast_msg(struct wlan_objmgr_pdev *pdev)
|
|
|
|
|
|
return status;
|
|
|
}
|
|
|
+#else
|
|
|
+
|
|
|
+static int
|
|
|
+os_if_spectral_nl_unicast_msg(struct wlan_objmgr_pdev *pdev)
|
|
|
+{
|
|
|
+ struct pdev_spectral *ps = NULL;
|
|
|
+ int status;
|
|
|
+
|
|
|
+ if (!pdev) {
|
|
|
+ spectral_err("PDEV is NULL!");
|
|
|
+ return -EINVAL;
|
|
|
+ }
|
|
|
+
|
|
|
+ ps = wlan_objmgr_pdev_get_comp_private_obj(pdev,
|
|
|
+ WLAN_UMAC_COMP_SPECTRAL);
|
|
|
+ if (!ps) {
|
|
|
+ spectral_err("PDEV SPECTRAL object is NULL!");
|
|
|
+ return -EINVAL;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!ps->skb) {
|
|
|
+ spectral_err("Socket buffer is null");
|
|
|
+ return -EINVAL;
|
|
|
+ }
|
|
|
+
|
|
|
+ spectral_debug("spectral unicast message");
|
|
|
+ os_if_init_spectral_skb_pid_portid(ps->skb);
|
|
|
+
|
|
|
+ status = nl_srv_ucast(ps->skb, ps->spectral_pid, MSG_DONTWAIT,
|
|
|
+ WLAN_NL_MSG_SPECTRAL_SCAN, CLD80211_MCGRP_OEM_MSGS);
|
|
|
+ if (status < 0)
|
|
|
+ spectral_err("failed to send to spectral scan app");
|
|
|
+
|
|
|
+ return status;
|
|
|
+}
|
|
|
|
|
|
+#endif
|
|
|
/**
|
|
|
* os_if_spectral_nl_bcast_msg() - Sends broadcast Spectral message to user
|
|
|
* space
|