linux/drivers/net/wireless/intel/iwlwifi/mld/session-protect.h
Miri Korenblit d1e879ec60 wifi: iwlwifi: add iwlmld sub-driver
iwlwifi is the driver of all Intel wifi devices since 2008.
Since then, the hardware has changed a lot, but the firmware
API has changed even more. The need to keep one driver that
supports all those different APIs led us to introduce a new
architecture circa 2012 which allowed us to keep the same
interface to the hardware (DMAs, Tx queues, etc...) with a
new layer to implement the mid-layer between mac80211 and
the firmware. The first component is called the 'transport'
and the latter is called 'operation_mode' a.k.a  op_mode.

In 2013 we took advantage of the new architecture to
introduce iwlmvm which allowed us to implement the, then,
new firmware API. This op_mode supports 7260 and up, those
devices supports support at least VHT.

Since then, wifi evolved and so did the firmware. It became
much bigger and took a lot of functionality from the driver.
It became increasingly hard to keep the same op_mode for the
newest devices and we experienced frequent regressions on
older devices. In order to avoid those regressions and keep
the code maintainable, we decided it was about time to start
a new op_mode.

iwlmld is a new op_mode that supports BE200 or newer if the
firmware being used is 97.ucode or newer. If the user has
an older devices or BE200 with .96.ucode, iwlmvm will be
loaded. Of course, this op_mode selection is seamless.

All the features supported in iwlmvm are supported in
iwlmld besides a few seldom used use cases: injection and
Hotspot 2.0. Those are under work.

A few points about the implementation:
 * iwlmld doesn't have any mutexes, it relies on the
   wiphy_lock
 * iwlmld is more "resource oriented": stations, links and
   interfaces are allocated and freed only after all the
   relevant flows are completed.
 * Firmware notifications' sizes are validated in a more
   structured way.

We would love to see this new op_mode merged in 6.15. The
firmware for this new driver (.97.ucode) is not yet publicly
available but it'll be sent very soon.
People eager to get an early version of this firmware can
contact Emmanuel at:
emmanuel.grumbach@intel.com

I've listed the people who directly contributed
code, but many others from various teams have
contributed in other ways.

Co-developed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Co-developed-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Co-developed-by: Daniel Gabay <daniel.gabay@intel.com>
Signed-off-by: Daniel Gabay <daniel.gabay@intel.com>
Co-developed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Co-developed-by: Anjaneyulu <pagadala.yesu.anjaneyulu@intel.com>
Signed-off-by: Anjaneyulu <pagadala.yesu.anjaneyulu@intel.com>
Co-developed-by: Yedidya Benshimol <yedidya.ben.shimol@intel.com>
Signed-off-by: Yedidya Benshimol <yedidya.ben.shimol@intel.com>
Co-developed-by: Benjamin Berg <benjamin.berg@intel.com>
Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Co-developed-by: Shaul Triebitz <shaul.triebitz@intel.com>
Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://lore.kernel.org/linux-wireless/20250216094321.537988-1-miriam.rachel.korenblit@intel.com/
[fix Kconfig, fix api/phy.h includes, SPDX tag and coding
 style issues, duplicated includes per 0-day robot]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2025-03-05 09:42:03 +01:00

102 lines
3.3 KiB
C

/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
/*
* Copyright (C) 2024-2025 Intel Corporation
*/
#ifndef __session_protect_h__
#define __session_protect_h__
#include "mld.h"
#include "hcmd.h"
#include <net/mac80211.h>
#include "fw/api/mac-cfg.h"
/**
* DOC: session protection
*
* Session protection is an API from the firmware that allows the driver to
* request time on medium. This is needed before the association when we need
* to be on medium for the association frame exchange. Once we configure the
* firmware as 'associated', the firmware will allocate time on medium without
* needed a session protection.
*
* TDLS discover uses this API as well even after association to ensure that
* other activities internal to the firmware will not interrupt our presence
* on medium.
*/
/**
* struct iwl_mld_session_protect - session protection parameters
* @end_jiffies: expected end_jiffies of current session protection.
* 0 if not active
* @duration: the duration in tu of current session
* @session_requested: A session protection command was sent and wasn't yet
* answered
*/
struct iwl_mld_session_protect {
unsigned long end_jiffies;
u32 duration;
bool session_requested;
};
#define IWL_MLD_SESSION_PROTECTION_ASSOC_TIME_MS 900
#define IWL_MLD_SESSION_PROTECTION_MIN_TIME_MS 400
/**
* iwl_mld_handle_session_prot_notif - handles %SESSION_PROTECTION_NOTIF
* @mld: the mld component
* @pkt: the RX packet containing the notification
*/
void iwl_mld_handle_session_prot_notif(struct iwl_mld *mld,
struct iwl_rx_packet *pkt);
/**
* iwl_mld_schedule_session_protection - schedule a session protection
* @mld: the mld component
* @vif: the virtual interface for which the protection issued
* @duration: the requested duration of the protection
* @min_duration: the minimum duration of the protection
* @link_id: The link to schedule a session protection for
*/
void iwl_mld_schedule_session_protection(struct iwl_mld *mld,
struct ieee80211_vif *vif,
u32 duration, u32 min_duration,
int link_id);
/**
* iwl_mld_start_session_protection - start a session protection
* @mld: the mld component
* @vif: the virtual interface for which the protection issued
* @duration: the requested duration of the protection
* @min_duration: the minimum duration of the protection
* @link_id: The link to schedule a session protection for
* @timeout: timeout for waiting
*
* This schedules the session protection, and waits for it to start
* (with timeout)
*
* Returns: 0 if successful, error code otherwise
*/
int iwl_mld_start_session_protection(struct iwl_mld *mld,
struct ieee80211_vif *vif,
u32 duration, u32 min_duration,
int link_id, unsigned long timeout);
/**
* iwl_mld_cancel_session_protection - cancel the session protection.
* @mld: the mld component
* @vif: the virtual interface for which the session is issued
* @link_id: cancel the session protection for given link
*
* This functions cancels the session protection which is an act of good
* citizenship. If it is not needed any more it should be canceled because
* the other mac contexts wait for the medium during that time.
*
* Returns: 0 if successful, error code otherwise
*
*/
int iwl_mld_cancel_session_protection(struct iwl_mld *mld,
struct ieee80211_vif *vif,
int link_id);
#endif /* __session_protect_h__ */