1*b1906ceaSLachlan Hodges /* SPDX-License-Identifier: GPL-2.0-only */ 2*b1906ceaSLachlan Hodges /* 3*b1906ceaSLachlan Hodges * Copyright (c) 2017-2026 Morse Micro 4*b1906ceaSLachlan Hodges */ 5*b1906ceaSLachlan Hodges 6*b1906ceaSLachlan Hodges #ifndef _MM81X_RC_H_ 7*b1906ceaSLachlan Hodges #define _MM81X_RC_H_ 8*b1906ceaSLachlan Hodges 9*b1906ceaSLachlan Hodges #include <linux/list.h> 10*b1906ceaSLachlan Hodges #include <linux/workqueue.h> 11*b1906ceaSLachlan Hodges #include "core.h" 12*b1906ceaSLachlan Hodges #include "mmrc.h" 13*b1906ceaSLachlan Hodges 14*b1906ceaSLachlan Hodges struct mm81x_vif; 15*b1906ceaSLachlan Hodges 16*b1906ceaSLachlan Hodges #define INIT_MAX_RATES_NUM 4 17*b1906ceaSLachlan Hodges 18*b1906ceaSLachlan Hodges struct mm81x_rc { 19*b1906ceaSLachlan Hodges /* Serialise rate control queue manipulation and timer functions */ 20*b1906ceaSLachlan Hodges spinlock_t lock; 21*b1906ceaSLachlan Hodges struct list_head stas; 22*b1906ceaSLachlan Hodges struct timer_list timer; 23*b1906ceaSLachlan Hodges struct work_struct work; 24*b1906ceaSLachlan Hodges struct mm81x *mors; 25*b1906ceaSLachlan Hodges }; 26*b1906ceaSLachlan Hodges 27*b1906ceaSLachlan Hodges struct mm81x_rc_sta { 28*b1906ceaSLachlan Hodges struct mmrc_table *tb; 29*b1906ceaSLachlan Hodges struct list_head list; 30*b1906ceaSLachlan Hodges unsigned long last_update; 31*b1906ceaSLachlan Hodges }; 32*b1906ceaSLachlan Hodges 33*b1906ceaSLachlan Hodges void mm81x_rc_init(struct mm81x *mors); 34*b1906ceaSLachlan Hodges void mm81x_rc_deinit(struct mm81x *mors); 35*b1906ceaSLachlan Hodges int mm81x_rc_sta_add(struct mm81x *mors, struct ieee80211_vif *vif, 36*b1906ceaSLachlan Hodges struct ieee80211_sta *sta); 37*b1906ceaSLachlan Hodges void mm81x_rc_sta_remove(struct mm81x *mors, struct ieee80211_sta *sta); 38*b1906ceaSLachlan Hodges void mm81x_rc_sta_fill_tx_rates(struct mm81x *mors, 39*b1906ceaSLachlan Hodges struct mm81x_skb_tx_info *tx_info, 40*b1906ceaSLachlan Hodges struct sk_buff *skb, struct ieee80211_sta *sta, 41*b1906ceaSLachlan Hodges int tx_bw, bool rts_allowed); 42*b1906ceaSLachlan Hodges void mm81x_rc_sta_feedback_rates(struct mm81x *mors, struct sk_buff *skb, 43*b1906ceaSLachlan Hodges struct ieee80211_sta *sta, 44*b1906ceaSLachlan Hodges struct mm81x_skb_tx_status *tx_sts, 45*b1906ceaSLachlan Hodges int tx_attempts); 46*b1906ceaSLachlan Hodges void mm81x_rc_sta_state_check(struct mm81x *mors, struct ieee80211_vif *vif, 47*b1906ceaSLachlan Hodges struct ieee80211_sta *sta, 48*b1906ceaSLachlan Hodges enum ieee80211_sta_state old_state, 49*b1906ceaSLachlan Hodges enum ieee80211_sta_state new_state); 50*b1906ceaSLachlan Hodges 51*b1906ceaSLachlan Hodges #endif /* !_MM81X_RC_H_ */ 52