/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */1/*2* Copyright (C) 2024 Intel Corporation3*/4#ifndef __iwl_agg_h__5#define __iwl_agg_h__67#include "mld.h"8#include "fw/api/rx.h"910/**11* struct iwl_mld_reorder_buffer - per ra/tid/queue reorder buffer12* @head_sn: reorder window head sequence number13* @num_stored: number of MPDUs stored in the buffer14* @queue: queue of this reorder buffer15* @valid: true if reordering is valid for this queue16*/17struct iwl_mld_reorder_buffer {18u16 head_sn;19u16 num_stored;20int queue;21bool valid;22} ____cacheline_aligned_in_smp;2324/**25* struct iwl_mld_reorder_buf_entry - reorder buffer entry per-queue/per-seqno26* @frames: list of skbs stored. a list is necessary because in an A-MSDU,27* all sub-frames share the same sequence number, so they are stored28* together in the same list.29*/30struct iwl_mld_reorder_buf_entry {31struct sk_buff_head frames;32}33#ifndef __CHECKER__34/* sparse doesn't like this construct: "bad integer constant expression" */35__aligned(roundup_pow_of_two(sizeof(struct sk_buff_head)))36#endif37;3839/**40* struct iwl_mld_baid_data - Block Ack session data41* @rcu_head: RCU head for freeing this data42* @sta_mask: station mask for the BAID43* @tid: tid of the session44* @baid: baid of the session45* @buf_size: the reorder buffer size as set by the last ADDBA request46* @entries_per_queue: number of buffers per queue, this actually gets47* aligned up to avoid cache line sharing between queues48* @timeout: the timeout value specified in the ADDBA request.49* @last_rx_timestamp: timestamp of the last received packet (in jiffies). This50* value is updated only when the configured @timeout has passed since51* the last update to minimize cache bouncing between RX queues.52* @session_timer: timer is set to expire after 2 * @timeout (since we want53* to minimize the cache bouncing by updating @last_rx_timestamp only once54* after @timeout has passed). If no packets are received within this55* period, it informs mac80211 to initiate delBA flow, terminating the56* BA session.57* @rcu_ptr: BA data RCU protected access58* @mld: mld pointer, needed for timer context59* @reorder_buf: reorder buffer, allocated per queue60* @entries: data61*/62struct iwl_mld_baid_data {63struct rcu_head rcu_head;64u32 sta_mask;65u8 tid;66u8 baid;67u16 buf_size;68u16 entries_per_queue;69u16 timeout;70struct timer_list session_timer;71unsigned long last_rx_timestamp;72struct iwl_mld_baid_data __rcu **rcu_ptr;73struct iwl_mld *mld;74struct iwl_mld_reorder_buffer reorder_buf[IWL_MAX_RX_HW_QUEUES];75struct iwl_mld_reorder_buf_entry entries[] ____cacheline_aligned_in_smp;76};7778/**79* struct iwl_mld_delba_data - RX queue sync data for %IWL_MLD_RXQ_NOTIF_DEL_BA80*81* @baid: Block Ack id, used to identify the BA session to be removed82*/83struct iwl_mld_delba_data {84u32 baid;85} __packed;8687/**88* enum iwl_mld_reorder_result - Possible return values for iwl_mld_reorder()89* indicating how the caller should handle the skb based on the result.90*91* @IWL_MLD_PASS_SKB: skb should be passed to upper layer.92* @IWL_MLD_BUFFERED_SKB: skb has been buffered, don't pass it to upper layer.93* @IWL_MLD_DROP_SKB: skb should be dropped and freed by the caller.94*/95enum iwl_mld_reorder_result {96IWL_MLD_PASS_SKB,97IWL_MLD_BUFFERED_SKB,98IWL_MLD_DROP_SKB99};100101int iwl_mld_ampdu_rx_start(struct iwl_mld *mld, struct ieee80211_sta *sta,102int tid, u16 ssn, u16 buf_size, u16 timeout);103int iwl_mld_ampdu_rx_stop(struct iwl_mld *mld, struct ieee80211_sta *sta,104int tid);105106enum iwl_mld_reorder_result107iwl_mld_reorder(struct iwl_mld *mld, struct napi_struct *napi,108int queue, struct ieee80211_sta *sta,109struct sk_buff *skb, struct iwl_rx_mpdu_desc *desc);110111void iwl_mld_handle_frame_release_notif(struct iwl_mld *mld,112struct napi_struct *napi,113struct iwl_rx_packet *pkt, int queue);114void iwl_mld_handle_bar_frame_release_notif(struct iwl_mld *mld,115struct napi_struct *napi,116struct iwl_rx_packet *pkt,117int queue);118119void iwl_mld_del_ba(struct iwl_mld *mld, int queue,120struct iwl_mld_delba_data *data);121122int iwl_mld_update_sta_baids(struct iwl_mld *mld,123u32 old_sta_mask,124u32 new_sta_mask);125126#endif /* __iwl_agg_h__ */127128129