platform: add Intel vendor command to get the device from CSME

This will allow us to let CSME know that we are ready to connect and it
can remove the "OS_NOT_OWNER" rfkill.
This commit is contained in:
Emmanuel Grumbach 2022-02-28 22:28:41 +02:00
parent 526c4b3293
commit 965c55f0da
7 changed files with 58 additions and 0 deletions

View file

@ -8544,6 +8544,14 @@ wifi_get_csme_conn_info(NMPlatform *platform, int ifindex, NMPlatformCsmeConnInf
return nm_wifi_utils_get_csme_conn_info(wifi_data, out_conn_info);
}
static gboolean
wifi_get_device_from_csme(NMPlatform *platform, int ifindex)
{
WIFI_GET_WIFI_DATA_NETNS(wifi_data, platform, ifindex, FALSE);
return nm_wifi_utils_get_device_from_csme(wifi_data);
}
/*****************************************************************************/
static gboolean
@ -9963,6 +9971,7 @@ nm_linux_platform_class_init(NMLinuxPlatformClass *klass)
platform_class->wifi_get_wake_on_wlan = wifi_get_wake_on_wlan;
platform_class->wifi_set_wake_on_wlan = wifi_set_wake_on_wlan;
platform_class->wifi_get_csme_conn_info = wifi_get_csme_conn_info;
platform_class->wifi_get_device_from_csme = wifi_get_device_from_csme;
platform_class->mesh_get_channel = mesh_get_channel;
platform_class->mesh_set_channel = mesh_set_channel;

View file

@ -3073,6 +3073,16 @@ nm_platform_wifi_get_csme_conn_info(NMPlatform *self,
return klass->wifi_get_csme_conn_info(self, ifindex, out_conn_info);
}
gboolean
nm_platform_wifi_get_device_from_csme(NMPlatform *self, int ifindex)
{
_CHECK_SELF(self, klass, FALSE);
g_return_val_if_fail(ifindex > 0, FALSE);
return klass->wifi_get_device_from_csme(self, ifindex);
}
guint32
nm_platform_mesh_get_channel(NMPlatform *self, int ifindex)
{

View file

@ -1215,6 +1215,7 @@ typedef struct {
gboolean (*wifi_get_csme_conn_info)(NMPlatform *self,
int ifindex,
NMPlatformCsmeConnInfo *out_conn_info);
gboolean (*wifi_get_device_from_csme)(NMPlatform *self, int ifindex);
guint32 (*mesh_get_channel)(NMPlatform *self, int ifindex);
gboolean (*mesh_set_channel)(NMPlatform *self, int ifindex, guint32 channel);
@ -2042,6 +2043,7 @@ nm_platform_wifi_set_wake_on_wlan(NMPlatform *self, int ifindex, _NMSettingWirel
gboolean nm_platform_wifi_get_csme_conn_info(NMPlatform *self,
int ifindex,
NMPlatformCsmeConnInfo *out_conn_info);
gboolean nm_platform_wifi_get_device_from_csme(NMPlatform *self, int ifindex);
guint32 nm_platform_mesh_get_channel(NMPlatform *self, int ifindex);
gboolean nm_platform_mesh_set_channel(NMPlatform *self, int ifindex, guint32 channel);

View file

@ -903,6 +903,27 @@ nla_put_failure:
g_return_val_if_reached(FALSE);
}
static gboolean
wifi_nl80211_intel_vnd_get_device_from_csme(NMWifiUtils *data)
{
NMWifiUtilsNl80211 *self = (NMWifiUtilsNl80211 *) data;
nm_auto_nlmsg struct nl_msg *msg = NULL;
int err;
msg = nl80211_alloc_msg(self, NL80211_CMD_VENDOR, 0);
NLA_PUT_U32(msg, NL80211_ATTR_VENDOR_ID, INTEL_OUI);
NLA_PUT_U32(msg, NL80211_ATTR_VENDOR_SUBCMD, IWL_MVM_VENDOR_CMD_HOST_GET_OWNERSHIP);
err = nl80211_send_and_recv(self, msg, NULL, NULL);
if (err < 0)
_LOGD("IWL_MVM_VENDOR_CMD_HOST_GET_OWNERSHIP request failed: %s", nm_strerror(err));
return err >= 0;
nla_put_failure:
g_return_val_if_reached(FALSE);
}
static void
nm_wifi_utils_nl80211_init(NMWifiUtilsNl80211 *self)
{}
@ -928,6 +949,7 @@ nm_wifi_utils_nl80211_class_init(NMWifiUtilsNl80211Class *klass)
wifi_utils_class->set_mesh_channel = wifi_nl80211_set_mesh_channel;
wifi_utils_class->set_mesh_ssid = wifi_nl80211_set_mesh_ssid;
wifi_utils_class->get_csme_conn_info = wifi_nl80211_intel_vnd_get_csme_conn_info;
wifi_utils_class->get_device_from_csme = wifi_nl80211_intel_vnd_get_device_from_csme;
}
NMWifiUtils *

View file

@ -56,6 +56,8 @@ typedef struct {
gboolean (*indicate_addressing_running)(NMWifiUtils *data, gboolean running);
gboolean (*get_csme_conn_info)(NMWifiUtils *data, NMPlatformCsmeConnInfo *out_conn_info);
gboolean (*get_device_from_csme)(NMWifiUtils *data);
} NMWifiUtilsClass;
struct NMWifiUtils {

View file

@ -168,6 +168,17 @@ nm_wifi_utils_get_csme_conn_info(NMWifiUtils *data, NMPlatformCsmeConnInfo *out_
return klass->get_csme_conn_info ? klass->get_csme_conn_info(data, out_conn_info) : FALSE;
}
gboolean
nm_wifi_utils_get_device_from_csme(NMWifiUtils *data)
{
NMWifiUtilsClass *klass;
g_return_val_if_fail(data != NULL, FALSE);
klass = NM_WIFI_UTILS_GET_CLASS(data);
return klass->get_device_from_csme ? klass->get_device_from_csme(data) : FALSE;
}
/* OLPC Mesh-only functions */
guint32

View file

@ -67,6 +67,8 @@ struct _NMPlatformCsmeConnInfo;
gboolean nm_wifi_utils_get_csme_conn_info(NMWifiUtils *data,
struct _NMPlatformCsmeConnInfo *out_conn_info);
gboolean nm_wifi_utils_get_device_from_csme(NMWifiUtils *data);
/* OLPC Mesh-only functions */
guint32 nm_wifi_utils_get_mesh_channel(NMWifiUtils *data);