Merge tag 'JH7110_515_SDK_v3.6.0' into vf2-515-devel
[platform/kernel/linux-starfive.git] / drivers / net / wireless / eswin / ecrnx_bfmer.h
1 /**
2  ******************************************************************************
3  *
4  * @file ecrnx_bfmer.h
5  *
6  * @brief VHT Beamformer function declarations
7  *
8  * Copyright (C) ESWIN 2015-2020
9  *
10  ******************************************************************************
11  */
12
13 #ifndef _ECRNX_BFMER_H_
14 #define _ECRNX_BFMER_H_
15
16 /**
17  * INCLUDE FILES
18  ******************************************************************************
19  */
20
21 #include "ecrnx_defs.h"
22
23 /**
24  * DEFINES
25  ******************************************************************************
26  */
27
28 /// Maximal supported report length (in bytes)
29 #define ECRNX_BFMER_REPORT_MAX_LEN     2048
30
31 /// Size of the allocated report space (twice the maximum report length)
32 #define ECRNX_BFMER_REPORT_SPACE_SIZE  (ECRNX_BFMER_REPORT_MAX_LEN * 2)
33
34 /**
35  * TYPE DEFINITIONS
36  ******************************************************************************
37  */
38
39 /*
40  * Structure used to store a beamforming report.
41  */
42 struct ecrnx_bfmer_report {
43     dma_addr_t dma_addr;    /* Virtual address provided to MAC for
44                                DMA transfer of the Beamforming Report */
45     unsigned int length;    /* Report Length */
46     u8 report[1];           /* Report to be used for VHT TX Beamforming */
47 };
48
49 /**
50  * FUNCTION DECLARATIONS
51  ******************************************************************************
52  */
53
54 /**
55  ******************************************************************************
56  * @brief Allocate memory aiming to contains the Beamforming Report received
57  * from a Beamformee capable capable.
58  * The providing length shall be large enough to contain the VHT Compressed
59  * Beaforming Report and the MU Exclusive part.
60  * It also perform a DMA Mapping providing an address to be provided to the HW
61  * responsible for the DMA transfer of the report.
62  * If successful a struct ecrnx_bfmer_report object is allocated, it's address
63  * is stored in ecrnx_sta->bfm_report.
64  *
65  * @param[in] ecrnx_hw   PHY Information
66  * @param[in] ecrnx_sta  Peer STA Information
67  * @param[in] length    Memory size to be allocated
68  *
69  * @return 0 if operation is successful, else -1.
70  ******************************************************************************
71  */
72 int ecrnx_bfmer_report_add(struct ecrnx_hw *ecrnx_hw, struct ecrnx_sta *ecrnx_sta,
73                           unsigned int length);
74
75 /**
76  ******************************************************************************
77  * @brief Free a previously allocated memory intended to be used for
78  * Beamforming Reports.
79  *
80  * @param[in] ecrnx_hw   PHY Information
81  * @param[in] ecrnx_sta  Peer STA Information
82  *
83  ******************************************************************************
84  */
85 void ecrnx_bfmer_report_del(struct ecrnx_hw *ecrnx_hw, struct ecrnx_sta *ecrnx_sta);
86
87 #ifdef CONFIG_ECRNX_FULLMAC
88 /**
89  ******************************************************************************
90  * @brief Parse a Rx VHT-MCS map in order to deduce the maximum number of
91  * Spatial Streams supported by a beamformee.
92  *
93  * @param[in] vht_capa  Received VHT Capability field.
94  *
95  ******************************************************************************
96  */
97 u8 ecrnx_bfmer_get_rx_nss(const struct ieee80211_vht_cap *vht_capa);
98 #endif /* CONFIG_ECRNX_FULLMAC */
99
100 #endif /* _ECRNX_BFMER_H_ */