NetworkManager/src/core/nm-rfkill-manager.h
Emmanuel Grumbach 9c4fbbe1b8 rfkill: query the hardware rfkill reason from udev
The kernel may add a reason for hardware rfkill. Make the NetworkManager
able eto fetch it and parse it.
For now, no action will be taken upon the new reasons.

The different reasons that the kernel can expose are either the radio
was switched off by a hardware rfkill switch. This reason is adveritsed
by bit 0 in the bitmap returned by RFKILL_STATE_REASON udev property.
This is the rfkill that existed until now.

The new reason is mapped to bit 1 and teaches the user space that the
wifi device is currently used by the CSME firmware on the platform. In
that case, the NetworkManager can ask CSME (through the iwlmei kernel
module) what BSSID the CSME firmware is associated to. Once the
NetworkManager gets to the conclusion is has the credentials to connect
to that very same AP, it can request the wifi device and the CSME
firmware will allow the host to take the ownership on the device. CSME
will give 3 seconds to the host to get an IP or it'll take the device
back. In order to complete all the process until we get the DHCP ACK
within 3 seconds, the NetworkManager will need to optimize the scan and
limit the scan to that specific BSSID on that specific channel.

All this flow is not implemented yet, but the first step is to identify
that the device is not owned by the host.
2022-02-24 23:04:48 +02:00

57 lines
2.1 KiB
C

/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
* Copyright (C) 2007 - 2008 Novell, Inc.
* Copyright (C) 2007 - 2013 Red Hat, Inc.
*/
#ifndef __NM_RFKILL_MANAGER_H__
#define __NM_RFKILL_MANAGER_H__
typedef enum {
NM_RFKILL_STATE_UNBLOCKED = 0,
NM_RFKILL_STATE_SOFT_BLOCKED = 1,
NM_RFKILL_STATE_HARD_BLOCKED = 2,
/* NM_RFKILL_STATE_HARD_BLOCKED_OS_NOT_OWNER means that the CSME firmware
* is currently controlling the device. This feature is implmented on Intel
* wifi devices only.
* The NetworkManager can get ownership on the device, but it requires to
* first ask ownership through the iwlmei kernel module.
*/
NM_RFKILL_STATE_HARD_BLOCKED_OS_NOT_OWNER = 3,
} NMRfkillState;
typedef enum {
NM_RFKILL_TYPE_WLAN = 0,
NM_RFKILL_TYPE_WWAN = 1,
/* UNKNOWN and MAX should always be 1 more than
* the last rfkill type since NM_RFKILL_TYPE_MAX is
* used as an array size.
*/
NM_RFKILL_TYPE_UNKNOWN, /* KEEP LAST */
NM_RFKILL_TYPE_MAX = NM_RFKILL_TYPE_UNKNOWN,
} NMRfkillType;
const char *nm_rfkill_type_to_string(NMRfkillType rtype);
#define NM_TYPE_RFKILL_MANAGER (nm_rfkill_manager_get_type())
#define NM_RFKILL_MANAGER(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj), NM_TYPE_RFKILL_MANAGER, NMRfkillManager))
#define NM_RFKILL_MANAGER_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass), NM_TYPE_RFKILL_MANAGER, NMRfkillManagerClass))
#define NM_IS_RFKILL_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), NM_TYPE_RFKILL_MANAGER))
#define NM_IS_RFKILL_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), NM_TYPE_RFKILL_MANAGER))
#define NM_RFKILL_MANAGER_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS((obj), NM_TYPE_RFKILL_MANAGER, NMRfkillManagerClass))
#define NM_RFKILL_MANAGER_SIGNAL_RFKILL_CHANGED "rfkill-changed"
typedef struct _NMRfkillManagerClass NMRfkillManagerClass;
GType nm_rfkill_manager_get_type(void);
NMRfkillManager *nm_rfkill_manager_new(void);
NMRfkillState nm_rfkill_manager_get_rfkill_state(NMRfkillManager *manager, NMRfkillType rtype);
#endif /* __NM_RFKILL_MANAGER_H__ */