Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /* SPDX-License-Identifier: GPL-2.0-only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * Copyright (C) 2010 Felix Fietkau <nbd@openwrt.org>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) #ifndef __RC_MINSTREL_HT_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) #define __RC_MINSTREL_HT_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)  * The number of streams can be changed to 2 to reduce code
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11)  * size and memory footprint.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #define MINSTREL_MAX_STREAMS		4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #define MINSTREL_HT_STREAM_GROUPS	4 /* BW(=2) * SGI(=2) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #define MINSTREL_VHT_STREAM_GROUPS	6 /* BW(=3) * SGI(=2) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) #define MINSTREL_HT_GROUPS_NB	(MINSTREL_MAX_STREAMS *		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) 				 MINSTREL_HT_STREAM_GROUPS)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) #define MINSTREL_VHT_GROUPS_NB	(MINSTREL_MAX_STREAMS *		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) 				 MINSTREL_VHT_STREAM_GROUPS)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) #define MINSTREL_CCK_GROUPS_NB	1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) #define MINSTREL_GROUPS_NB	(MINSTREL_HT_GROUPS_NB +	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 				 MINSTREL_VHT_GROUPS_NB +	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 				 MINSTREL_CCK_GROUPS_NB)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) #define MINSTREL_HT_GROUP_0	0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) #define MINSTREL_CCK_GROUP	(MINSTREL_HT_GROUP_0 + MINSTREL_HT_GROUPS_NB)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) #define MINSTREL_VHT_GROUP_0	(MINSTREL_CCK_GROUP + 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) #define MCS_GROUP_RATES		10
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) struct mcs_group {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 	u16 flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 	u8 streams;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 	u8 shift;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 	u8 bw;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 	u16 duration[MCS_GROUP_RATES];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) extern const struct mcs_group minstrel_mcs_groups[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) struct minstrel_mcs_group_data {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 	u8 index;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 	u8 column;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 	/* sorted rate set within a MCS group*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	u16 max_group_tp_rate[MAX_THR_RATES];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	u16 max_group_prob_rate;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	/* MCS rate statistics */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	struct minstrel_rate_stats rates[MCS_GROUP_RATES];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) enum minstrel_sample_mode {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	MINSTREL_SAMPLE_IDLE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	MINSTREL_SAMPLE_ACTIVE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	MINSTREL_SAMPLE_PENDING,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) struct minstrel_ht_sta {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	struct ieee80211_sta *sta;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	/* ampdu length (average, per sampling interval) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	unsigned int ampdu_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	unsigned int ampdu_packets;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	/* ampdu length (EWMA) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	unsigned int avg_ampdu_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 	/* overall sorted rate set */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	u16 max_tp_rate[MAX_THR_RATES];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	u16 max_prob_rate;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	/* time of last status update */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	unsigned long last_stats_update;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	/* overhead time in usec for each frame */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	unsigned int overhead;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	unsigned int overhead_rtscts;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 	unsigned int total_packets_last;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 	unsigned int total_packets_cur;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 	unsigned int total_packets;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	unsigned int sample_packets;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	/* tx flags to add for frames for this sta */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	u32 tx_flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 	u8 sample_wait;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	u8 sample_tries;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 	u8 sample_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	u8 sample_slow;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	enum minstrel_sample_mode sample_mode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 	u16 sample_rate;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 	/* current MCS group to be sampled */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	u8 sample_group;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 	u8 cck_supported;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	u8 cck_supported_short;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	/* Bitfield of supported MCS rates of all groups */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	u16 supported[MINSTREL_GROUPS_NB];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	/* MCS rate group info and statistics */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	struct minstrel_mcs_group_data groups[MINSTREL_GROUPS_NB];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) struct minstrel_ht_sta_priv {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 		struct minstrel_ht_sta ht;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 		struct minstrel_sta_info legacy;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 	};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	void *ratelist;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	void *sample_table;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	bool is_ht;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) void minstrel_ht_add_sta_debugfs(void *priv, void *priv_sta, struct dentry *dir);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) int minstrel_ht_get_tp_avg(struct minstrel_ht_sta *mi, int group, int rate,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 			   int prob_avg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) #endif