ath11k: cleanup in rx data path
PATCH 1/1 ath11k: cleanup in rx data path
Removed all unused function definition from dp_rx. Moved all non exposed API inside the dp_rx. Removed inline attribute and let the compiler handle the optimization.
Signed-off-by Karthikeyan Periyasamy <[email protected]>
--- drivers/net/wireless/ath/ath11k/dp_rx.c | 310 ++++++++++++++++++++++++++++---- drivers/net/wireless/ath/ath11k/dp_rx.h | 307 ------------------------------- 2 files changed, 274 insertions(+), 343 deletions(-)
drivers/net/wireless/ath/ath11k/dp_rx.c +274 -36
@@ -12,6 +12,255 @@#include "hal_rx.h" #include "dp_tx.h" +static u8 *ath11k_dp_rx_h_80211_hdr (u8 *desc) +{ +struct hal_rx_desc *rxd = (struct hal_rx_desc *)desc; + +return rxd->hdr_status; +} + +static enum hal_encrypt_type ath11k_dp_rx_h_mpdu_start_enctype (u8 *desc) +{ +struct hal_rx_desc *rxd = (struct hal_rx_desc *)desc; + +if (!(__le32_to_cpu (rxd->mpdu_start.info1) & +RX_MPDU_START_INFO1_ENCRYPT_INFO_VALID )) +return HAL_ENCRYPT_TYPE_OPEN ; + +return FIELD_GET (RX_MPDU_START_INFO2_ENC_TYPE , +__le32_to_cpu (rxd->mpdu_start.info2)); +} + +static u8 ath11k_dp_rx_h_mpdu_start_decap_type (u8 *desc) +{ +struct hal_rx_desc *rxd = (struct hal_rx_desc *)desc; + +return FIELD_GET (RX_MPDU_START_INFO5_DECAP_TYPE , +__le32_to_cpu (rxd->mpdu_start.info5)); +} + +static bool ath11k_dp_rx_h_attn_msdu_done (u8 *desc) +{ +struct hal_rx_desc *rxd = (struct hal_rx_desc *)desc; + +return !!FIELD_GET (RX_ATTENTION_INFO2_MSDU_DONE , +__le32_to_cpu (rxd->attention.info2)); +} + +static bool ath11k_dp_rx_h_attn_first_mpdu (u8 *desc) +{ +struct hal_rx_desc *rxd = (struct hal_rx_desc *)desc; + +return !!FIELD_GET (RX_ATTENTION_INFO1_FIRST_MPDU , +__le32_to_cpu (rxd->attention.info1)); +} + +static bool ath11k_dp_rx_h_attn_l4_cksum_fail (u8 *desc) +{ +struct hal_rx_desc *rxd = (struct hal_rx_desc *)desc; + +return !!FIELD_GET (RX_ATTENTION_INFO1_TCP_UDP_CKSUM_FAIL , +__le32_to_cpu (rxd->attention.info1)); +} + +static bool ath11k_dp_rx_h_attn_ip_cksum_fail (u8 *desc) +{ +struct hal_rx_desc *rxd = (struct hal_rx_desc *)desc; + +return !!FIELD_GET (RX_ATTENTION_INFO1_IP_CKSUM_FAIL , +__le32_to_cpu (rxd->attention.info1)); +} + +static bool ath11k_dp_rx_h_attn_is_decrypted (u8 *desc) +{ +struct hal_rx_desc *rxd = (struct hal_rx_desc *)desc; + +return (FIELD_GET (RX_ATTENTION_INFO2_DCRYPT_STATUS_CODE , +__le32_to_cpu (rxd->attention.info2)) == +RX_DESC_DECRYPT_STATUS_CODE_OK ); +} + +static u32 ath11k_dp_rx_h_attn_mpdu_err (u8 *desc) +{ +struct hal_rx_desc *rxd = (struct hal_rx_desc *)desc; +u32 info =__le32_to_cpu (rxd->attention.info1); +u32 errmap =0 ; + +if (info &RX_ATTENTION_INFO1_FCS_ERR ) + errmap |=DP_RX_MPDU_ERR_FCS ; + +if (info &RX_ATTENTION_INFO1_DECRYPT_ERR ) + errmap |=DP_RX_MPDU_ERR_DECRYPT ; + +if (info &RX_ATTENTION_INFO1_TKIP_MIC_ERR ) + errmap |=DP_RX_MPDU_ERR_TKIP_MIC ; + +if (info &RX_ATTENTION_INFO1_A_MSDU_ERROR ) + errmap |=DP_RX_MPDU_ERR_AMSDU_ERR ; + +if (info &RX_ATTENTION_INFO1_OVERFLOW_ERR ) + errmap |=DP_RX_MPDU_ERR_OVERFLOW ; + +if (info &RX_ATTENTION_INFO1_MSDU_LEN_ERR ) + errmap |=DP_RX_MPDU_ERR_MSDU_LEN ; + +if (info &RX_ATTENTION_INFO1_MPDU_LEN_ERR ) + errmap |=DP_RX_MPDU_ERR_MPDU_LEN ; + +return errmap; +} + +static u16 ath11k_dp_rx_h_msdu_start_msdu_len (u8 *desc) +{ +struct hal_rx_desc *rxd = (struct hal_rx_desc *)desc; + +return FIELD_GET (RX_MSDU_START_INFO1_MSDU_LENGTH , +__le32_to_cpu (rxd->msdu_start.info1)); +} + +static u8 ath11k_dp_rx_h_msdu_start_sgi (u8 *desc) +{ +struct hal_rx_desc *rxd = (struct hal_rx_desc *)desc; + +return FIELD_GET (RX_MSDU_START_INFO3_SGI , +__le32_to_cpu (rxd->msdu_start.info3)); +} + +static u8 ath11k_dp_rx_h_msdu_start_rate_mcs (u8 *desc) +{ +struct hal_rx_desc *rxd = (struct hal_rx_desc *)desc; + +return FIELD_GET (RX_MSDU_START_INFO3_RATE_MCS , +__le32_to_cpu (rxd->msdu_start.info3)); +} + +static u8 ath11k_dp_rx_h_msdu_start_rx_bw (u8 *desc) +{ +struct hal_rx_desc *rxd = (struct hal_rx_desc *)desc; + +return FIELD_GET (RX_MSDU_START_INFO3_RECV_BW , +__le32_to_cpu (rxd->msdu_start.info3)); +} + +static u8 ath11k_dp_rx_h_msdu_start_rssi (u8 *desc) +{ +struct hal_rx_desc *rxd = (struct hal_rx_desc *)desc; + +return FIELD_GET (RX_MSDU_START_INFO3_USER_RSSI , +__le32_to_cpu (rxd->msdu_start.info3)); +} + +static u32 ath11k_dp_rx_h_msdu_start_freq (u8 *desc) +{ +struct hal_rx_desc *rxd = (struct hal_rx_desc *)desc; + +return __le32_to_cpu (rxd->msdu_start.phy_meta_data); +} + +static u8 ath11k_dp_rx_h_msdu_start_pkt_type (u8 *desc) +{ +struct hal_rx_desc *rxd = (struct hal_rx_desc *)desc; + +return FIELD_GET (RX_MSDU_START_INFO3_PKT_TYPE , +__le32_to_cpu (rxd->msdu_start.info3)); +} + +static u8 ath11k_dp_rx_h_msdu_start_nss (u8 *desc) +{ +struct hal_rx_desc *rxd = (struct hal_rx_desc *)desc; +u8 mimo_ss_bitmap =FIELD_GET (RX_MSDU_START_INFO3_MIMO_SS_BITMAP , +__le32_to_cpu (rxd->msdu_start.info3)); + +return hweight8 (mimo_ss_bitmap); +} + +static u8 ath11k_dp_rx_h_msdu_end_l3pad (u8 *desc) +{ +struct hal_rx_desc *rxd = (struct hal_rx_desc *)desc; + +return FIELD_GET (RX_MSDU_END_INFO2_L3_HDR_PADDING , +__le32_to_cpu (rxd->msdu_end.info2)); +} + +static bool ath11k_dp_rx_h_msdu_end_first_msdu (u8 *desc) +{ +struct hal_rx_desc *rxd = (struct hal_rx_desc *)desc; + +return !!FIELD_GET (RX_MSDU_END_INFO2_FIRST_MSDU , +__le32_to_cpu (rxd->msdu_end.info2)); +} + +static bool ath11k_dp_rx_h_msdu_end_last_msdu (u8 *desc) +{ +struct hal_rx_desc *rxd = (struct hal_rx_desc *)desc; + +return !!FIELD_GET (RX_MSDU_END_INFO2_LAST_MSDU , +__le32_to_cpu (rxd->msdu_end.info2)); +} + +static void ath11k_dp_rx_desc_end_tlv_copy (u8 *first,u8 *last) +{ +struct hal_rx_desc *fdesc = (struct hal_rx_desc *)first; +struct hal_rx_desc *ldesc = (struct hal_rx_desc *)last; + +memcpy ((u8 *)&fdesc->msdu_end, (u8 *)&ldesc->msdu_end, +sizeof (struct rx_msdu_end )); +memcpy ((u8 *)&fdesc->attention, (u8 *)&ldesc->attention, +sizeof (struct rx_attention )); +memcpy ((u8 *)&fdesc->mpdu_end, (u8 *)&ldesc->mpdu_end, +sizeof (struct rx_mpdu_end )); +} + +static u32 ath11k_dp_rxdesc_get_mpdulen_err (void *hw_desc_addr) +{ +struct hal_rx_desc *rx_desc = (struct hal_rx_desc *)hw_desc_addr; +struct rx_attention *rx_attn; + + rx_attn = &rx_desc->attention; + +return FIELD_GET (RX_ATTENTION_INFO1_MPDU_LEN_ERR , +__le32_to_cpu (rx_attn->info1)); +} + +static u32 ath11k_dp_rxdesc_get_decap_format (void *hw_desc_addr) +{ +struct hal_rx_desc *rx_desc = (struct hal_rx_desc *)hw_desc_addr; +struct rx_msdu_start *rx_msdu_start; + + rx_msdu_start = &rx_desc->msdu_start; + +return FIELD_GET (RX_MSDU_START_INFO2_DECAP_FORMAT , +__le32_to_cpu (rx_msdu_start->info2)); +} + +static u8 *ath11k_dp_rxdesc_get_80211hdr (void *hw_desc_addr) +{ +struct hal_rx_desc *rx_desc = (struct hal_rx_desc *)hw_desc_addr; +u8 *rx_pkt_hdr; + + rx_pkt_hdr = &rx_desc->msdu_payload[0 ]; + +return rx_pkt_hdr; +} + +static bool ath11k_dp_rxdesc_mpdu_valid (void *hw_desc_addr) +{ +struct hal_rx_desc *rx_desc = (struct hal_rx_desc *)hw_desc_addr; +u32 tlv_tag; + + tlv_tag =FIELD_GET (HAL_TLV_HDR_TAG , +__le32_to_cpu (rx_desc->mpdu_start_tag)); + +return tlv_tag ==HAL_RX_MPDU_START ? true : false; +} + +static u32 ath11k_dp_rxdesc_get_ppduid (void *hw_desc_addr) +{ +struct hal_rx_desc *rx_desc = (struct hal_rx_desc *)hw_desc_addr; + +return __le16_to_cpu (rx_desc->mpdu_start.phy_ppdu_id); +} +/* Returns number of Rx buffers replenished */ int ath11k_dp_rxbufs_replenish(struct ath11k_base *ab, int mac_id, struct dp_rxdma_ring *rx_ring,
@@ -652,8 +901,8 @@ int ath11k_dp_rx_ampdu_stop(struct ath11k *ar,return ret; } -static inline int ath11k_get_ppdu_user_index (struct htt_ppdu_stats *ppdu_stats, -u16 peer_id) +static int ath11k_get_ppdu_user_index (struct htt_ppdu_stats *ppdu_stats, +u16 peer_id) {int i;
@@ -790,7 +1039,7 @@ int ath11k_dp_htt_tlv_iter(struct ath11k_base *ab, const void *ptr, size_t len,return 0 ; } -static inline u8 ath11k_bw_to_mac80211_bw (u8 bw) +static u8 ath11k_bw_to_mac80211_bw (u8 bw) {u8 ret =0 ;
@@ -812,7 +1061,7 @@ static inline u8 ath11k_bw_to_mac80211_bw(u8 bw)return ret; } -static inline u32 ath11k_bw_to_mac80211_bwflags (u8 bw) +static u32 ath11k_bw_to_mac80211_bwflags (u8 bw) {u32 bwflags =0 ;
@@ -1027,7 +1276,8 @@ struct htt_ppdu_stats_info *ath11k_dp_htt_get_ppdu_desc(struct ath11k *ar, }static int ath11k_htt_pull_ppdu_stats (struct ath11k_base *ab, -struct sk_buff *skb) { +struct sk_buff *skb) +{u8 *data = (u8 *)skb->data;struct htt_ppdu_stats_info *ppdu_info;struct ath11k *ar;
@@ -1064,8 +1314,7 @@ static int ath11k_htt_pull_ppdu_stats(struct ath11k_base *ab,return 0 ; } -static void ath11k_htt_pktlog (struct ath11k_base *ab, -struct sk_buff *skb) +static void ath11k_htt_pktlog (struct ath11k_base *ab,struct sk_buff *skb) {u32 *data = (u32 *)skb->data, len;struct ath11k *ar;
@@ -3235,17 +3484,7 @@ int ath11k_dp_rx_pdev_alloc(struct ath11k_base *ab, int mac_id)return 0 ; } -static inline bool ath11k_get_rx_status_done (u8 *rx_tlv) -{ -struct hal_tlv_hdr *thdr = (struct hal_tlv_hdr *)rx_tlv; -u32 tlv_tag; - - tlv_tag =FIELD_GET (HAL_TLV_HDR_TAG , thdr->tl); - -return (tlv_tag ==HAL_RX_STATUS_BUFFER_DONE ); -} - -static inline void ath11k_dp_mon_set_frag_len (u32 *total_len,u32 *frag_len) +static void ath11k_dp_mon_set_frag_len (u32 *total_len,u32 *frag_len) {if (*total_len >= (DP_RX_BUFFER_SIZE -sizeof (struct hal_rx_desc ))) { *frag_len =DP_RX_BUFFER_SIZE -sizeof (struct hal_rx_desc );
@@ -3256,7 +3495,7 @@ static inline void ath11k_dp_mon_set_frag_len(u32 *total_len, u32 *frag_len) } } -static inline +static int ath11k_dp_rx_monitor_link_desc_return (struct ath11k *ar,void *p_last_buf_addr_info,u8 mac_id)
@@ -3289,7 +3528,7 @@ int ath11k_dp_rx_monitor_link_desc_return(struct ath11k *ar,return ret; } -static inline +static void ath11k_dp_rx_mon_next_link_desc_get (void *rx_msdu_link_desc,dma_addr_t *paddr,u32 *sw_cookie,void **pp_buf_addr_info)
@@ -3306,7 +3545,7 @@ void ath11k_dp_rx_mon_next_link_desc_get(void *rx_msdu_link_desc, *pp_buf_addr_info = (void *)buf_addr_info; } -static inline int ath11k_dp_pkt_set_pktlen (struct sk_buff *skb,u32 len) +static int ath11k_dp_pkt_set_pktlen (struct sk_buff *skb,u32 len) {if (skb->len > len) {skb_trim (skb, len);
@@ -3324,11 +3563,10 @@ static inline int ath11k_dp_pkt_set_pktlen(struct sk_buff *skb, u32 len)return 0 ; } -static inline void -ath11k_hal_rx_msdu_list_get (struct ath11k *ar, -void *msdu_link_desc, -struct hal_rx_msdu_list *msdu_list, -u16 *num_msdus) +static void ath11k_hal_rx_msdu_list_get (struct ath11k *ar, +void *msdu_link_desc, +struct hal_rx_msdu_list *msdu_list, +u16 *num_msdus) {struct hal_rx_msdu_details *msdu_details =NULL ;struct rx_msdu_desc *msdu_desc_info =NULL ;
@@ -3368,8 +3606,8 @@ static inline int ath11k_dp_pkt_set_pktlen(struct sk_buff *skb, u32 len) *num_msdus = i; } -static inline u32 ath11k_dp_rx_mon_comp_ppduid (u32 msdu_ppdu_id,u32 *ppdu_id, -u32 *rx_bufs_used) +static u32 ath11k_dp_rx_mon_comp_ppduid (u32 msdu_ppdu_id,u32 *ppdu_id, +u32 *rx_bufs_used) {u32 ret =0 ;
@@ -3389,9 +3627,9 @@ static inline u32 ath11k_dp_rx_mon_comp_ppduid(u32 msdu_ppdu_id, u32 *ppdu_id,return ret; } -static inline void ath11k_dp_mon_get_buf_len (struct hal_rx_msdu_desc_info *info, -bool *is_frag,u32 *total_len, -u32 *frag_len,u32 *msdu_cnt) +static void ath11k_dp_mon_get_buf_len (struct hal_rx_msdu_desc_info *info, +bool *is_frag,u32 *total_len, +u32 *frag_len,u32 *msdu_cnt) {if (info->msdu_flags &RX_MSDU_DESC_INFO0_MSDU_CONTINUATION ) {if (!*is_frag) {
@@ -3584,7 +3822,7 @@ static inline void ath11k_dp_mon_get_buf_len(struct hal_rx_msdu_desc_info *info,return rx_bufs_used; } -static inline void ath11k_dp_rx_msdus_set_payload (struct sk_buff *msdu) +static void ath11k_dp_rx_msdus_set_payload (struct sk_buff *msdu) {u32 rx_pkt_offset, l2_hdr_offset;
@@ -3593,7 +3831,7 @@ static inline void ath11k_dp_rx_msdus_set_payload(struct sk_buff *msdu)skb_pull (msdu, rx_pkt_offset + l2_hdr_offset); } -static inline struct sk_buff * +static struct sk_buff * ath11k_dp_rx_mon_merg_msdus(struct ath11k *ar, u32 mac_id, struct sk_buff *head_msdu, struct sk_buff *last_msdu,
@@ -3818,9 +4056,9 @@ static void ath11k_dp_rx_mon_dest_process(struct ath11k *ar, u32 quota, } } -static inline void ath11k_dp_rx_mon_status_process_tlv (struct ath11k *ar, -u32 quota, -struct napi_struct *napi) +static void ath11k_dp_rx_mon_status_process_tlv (struct ath11k *ar, +u32 quota, +struct napi_struct *napi) {struct ath11k_pdev_dp *dp = &ar->dp;struct ath11k_mon_data *pmon = (struct ath11k_mon_data *)&dp->mon_data;
drivers/net/wireless/ath/ath11k/dp_rx.h +0 -307
313 lines not on this page · raw message
Signature · 7 lines
1.9.1 _______________________________________________ ath11k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath11k
Quoted 6 lines · Karthikeyan Periyasamy
Removed all unused function definition from
dp_rx. Moved all non exposed API inside thedp_rx. Removed inline attribute and let the compiler handle the optimization.Signed-off-by Karthikeyan Periyasamy <[email protected]>
Failed to apply:
error: patch failed: drivers/net/wireless/ath/ath11k/dp_rx.c:1064
error: drivers/net/wireless/ath/ath11k/dp_rx.c: patch does not apply stg import: Diff does not apply cleanly
Patch set to Changes Requested.
Signature · 9 lines
https://patchwork.kernel.org/patch/10984581/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches _______________________________________________ ath11k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath11k