1 /* SPDX-License-Identifier: BSD-3-Clause-Clear */
2 /*
3  * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
4  */
5 #ifndef ATH11K_DP_RX_H
6 #define ATH11K_DP_RX_H
7 
8 #include "core.h"
9 #include "rx_desc.h"
10 #include "debug.h"
11 
12 #define DP_RX_MPDU_ERR_FCS			BIT(0)
13 #define DP_RX_MPDU_ERR_DECRYPT			BIT(1)
14 #define DP_RX_MPDU_ERR_TKIP_MIC			BIT(2)
15 #define DP_RX_MPDU_ERR_AMSDU_ERR		BIT(3)
16 #define DP_RX_MPDU_ERR_OVERFLOW			BIT(4)
17 #define DP_RX_MPDU_ERR_MSDU_LEN			BIT(5)
18 #define DP_RX_MPDU_ERR_MPDU_LEN			BIT(6)
19 #define DP_RX_MPDU_ERR_UNENCRYPTED_FRAME	BIT(7)
20 
21 enum dp_rx_decap_type {
22 	DP_RX_DECAP_TYPE_RAW,
23 	DP_RX_DECAP_TYPE_NATIVE_WIFI,
24 	DP_RX_DECAP_TYPE_ETHERNET2_DIX,
25 	DP_RX_DECAP_TYPE_8023,
26 };
27 
28 struct ath11k_dp_amsdu_subframe_hdr {
29 	u8 dst[ETH_ALEN];
30 	u8 src[ETH_ALEN];
31 	__be16 len;
32 } __packed;
33 
34 struct ath11k_dp_rfc1042_hdr {
35 	u8 llc_dsap;
36 	u8 llc_ssap;
37 	u8 llc_ctrl;
38 	u8 snap_oui[3];
39 	__be16 snap_type;
40 } __packed;
41 
42 int ath11k_dp_rx_ampdu_start(struct ath11k *ar,
43 			     struct ieee80211_ampdu_params *params);
44 int ath11k_dp_rx_ampdu_stop(struct ath11k *ar,
45 			    struct ieee80211_ampdu_params *params);
46 void ath11k_peer_rx_tid_cleanup(struct ath11k *ar, struct ath11k_peer *peer);
47 int ath11k_peer_rx_tid_setup(struct ath11k *ar, const u8 *peer_mac, int vdev_id,
48 			     u8 tid, u32 ba_win_sz, u16 ssn);
49 void ath11k_dp_htt_htc_t2h_msg_handler(struct ath11k_base *ab,
50 				       struct sk_buff *skb);
51 int ath11k_dp_pdev_reo_setup(struct ath11k_base *ab);
52 void ath11k_dp_pdev_reo_cleanup(struct ath11k_base *ab);
53 int ath11k_dp_rx_pdev_alloc(struct ath11k_base *ab, int pdev_idx);
54 void ath11k_dp_rx_pdev_free(struct ath11k_base *ab, int pdev_idx);
55 void ath11k_dp_reo_cmd_list_cleanup(struct ath11k_base *ab);
56 void ath11k_dp_process_reo_status(struct ath11k_base *ab);
57 int ath11k_dp_process_rxdma_err(struct ath11k_base *ab, int mac_id, int budget);
58 int ath11k_dp_rx_process_wbm_err(struct ath11k_base *ab,
59 				 struct napi_struct *napi, int budget);
60 int ath11k_dp_process_rx_err(struct ath11k_base *ab, struct napi_struct *napi,
61 			     int budget);
62 int ath11k_dp_process_rx(struct ath11k_base *ab, int mac_id,
63 			 struct napi_struct *napi, struct sk_buff_head *pending_q,
64 			 int budget);
65 int ath11k_dp_rxbufs_replenish(struct ath11k_base *ab, int mac_id,
66 			       struct dp_rxdma_ring *rx_ring,
67 			       int req_entries,
68 			       enum hal_rx_buf_return_buf_manager mgr,
69 			       gfp_t gfp);
70 int ath11k_dp_htt_tlv_iter(struct ath11k_base *ab, const void *ptr, size_t len,
71 			   int (*iter)(struct ath11k_base *ar, u16 tag, u16 len,
72 				       const void *ptr, void *data),
73 			   void *data);
74 int ath11k_dp_rx_process_mon_rings(struct ath11k_base *ab, int mac_id,
75 				   struct napi_struct *napi, int budget);
76 int ath11k_dp_rx_process_mon_status(struct ath11k_base *ab, int mac_id,
77 				    struct napi_struct *napi, int budget);
78 int ath11k_dp_rx_mon_status_bufs_replenish(struct ath11k_base *ab, int mac_id,
79 					   struct dp_rxdma_ring *rx_ring,
80 					   int req_entries,
81 					   enum hal_rx_buf_return_buf_manager mgr,
82 					   gfp_t gfp);
83 int ath11k_dp_rx_pdev_mon_detach(struct ath11k *ar);
84 int ath11k_dp_rx_pdev_mon_attach(struct ath11k *ar);
85 
86 #endif /* ATH11K_DP_RX_H */
87