@@ -13,6 +13,10 @@ static enum hal_tcl_encap_type
1313ath11k_dp_tx_get_encap_type (struct ath11k_vif * arvif , struct sk_buff * skb )
1414{
1515 struct ieee80211_tx_info * tx_info = IEEE80211_SKB_CB (skb );
16+ struct ath11k_base * ab = arvif -> ar -> ab ;
17+
18+ if (test_bit (ATH11K_FLAG_RAW_MODE , & ab -> dev_flags ))
19+ return HAL_TCL_ENCAP_TYPE_RAW ;
1620
1721 if (tx_info -> control .flags & IEEE80211_TX_CTRL_HW_80211_ENCAP )
1822 return HAL_TCL_ENCAP_TYPE_ETHERNET ;
@@ -79,6 +83,7 @@ int ath11k_dp_tx(struct ath11k *ar, struct ath11k_vif *arvif,
7983 struct ath11k_dp * dp = & ab -> dp ;
8084 struct hal_tx_info ti = {0 };
8185 struct ieee80211_tx_info * info = IEEE80211_SKB_CB (skb );
86+ struct ieee80211_key_conf * key = info -> control .hw_key ;
8287 struct ath11k_skb_cb * skb_cb = ATH11K_SKB_CB (skb );
8388 struct hal_srng * tcl_ring ;
8489 struct ieee80211_hdr * hdr = (void * )skb -> data ;
@@ -142,11 +147,17 @@ int ath11k_dp_tx(struct ath11k *ar, struct ath11k_vif *arvif,
142147 ti .encap_type = ath11k_dp_tx_get_encap_type (arvif , skb );
143148 ti .meta_data_flags = arvif -> tcl_metadata ;
144149
145- if (info -> control .hw_key )
146- ti .encrypt_type =
147- ath11k_dp_tx_get_encrypt_type (info -> control .hw_key -> cipher );
148- else
149- ti .encrypt_type = HAL_ENCRYPT_TYPE_OPEN ;
150+ if (ti .encap_type == HAL_TCL_ENCAP_TYPE_RAW ) {
151+ if (key ) {
152+ ti .encrypt_type =
153+ ath11k_dp_tx_get_encrypt_type (key -> cipher );
154+
155+ if (ieee80211_has_protected (hdr -> frame_control ))
156+ skb_put (skb , IEEE80211_CCMP_MIC_LEN );
157+ } else {
158+ ti .encrypt_type = HAL_ENCRYPT_TYPE_OPEN ;
159+ }
160+ }
150161
151162 ti .addr_search_flags = arvif -> hal_addr_search_flags ;
152163 ti .search_type = arvif -> search_type ;
@@ -156,7 +167,8 @@ int ath11k_dp_tx(struct ath11k *ar, struct ath11k_vif *arvif,
156167 ti .bss_ast_hash = arvif -> ast_hash ;
157168 ti .dscp_tid_tbl_idx = 0 ;
158169
159- if (skb -> ip_summed == CHECKSUM_PARTIAL ) {
170+ if (skb -> ip_summed == CHECKSUM_PARTIAL &&
171+ ti .encap_type != HAL_TCL_ENCAP_TYPE_RAW ) {
160172 ti .flags0 |= FIELD_PREP (HAL_TCL_DATA_CMD_INFO1_IP4_CKSUM_EN , 1 ) |
161173 FIELD_PREP (HAL_TCL_DATA_CMD_INFO1_UDP4_CKSUM_EN , 1 ) |
162174 FIELD_PREP (HAL_TCL_DATA_CMD_INFO1_UDP6_CKSUM_EN , 1 ) |
@@ -176,10 +188,11 @@ int ath11k_dp_tx(struct ath11k *ar, struct ath11k_vif *arvif,
176188 ath11k_dp_tx_encap_nwifi (skb );
177189 break ;
178190 case HAL_TCL_ENCAP_TYPE_RAW :
179- /* TODO: for CHECKSUM_PARTIAL case in raw mode, HW checksum offload
180- * is not applicable, hence manual checksum calculation using
181- * skb_checksum_help() is needed
182- */
191+ if (!test_bit (ATH11K_FLAG_RAW_MODE , & ab -> dev_flags )) {
192+ ret = - EINVAL ;
193+ goto fail_remove_idr ;
194+ }
195+ break ;
183196 case HAL_TCL_ENCAP_TYPE_ETHERNET :
184197 /* no need to encap */
185198 break ;
@@ -242,6 +255,9 @@ int ath11k_dp_tx(struct ath11k *ar, struct ath11k_vif *arvif,
242255
243256 spin_unlock_bh (& tcl_ring -> lock );
244257
258+ ath11k_dbg_dump (ab , ATH11K_DBG_DP_TX , NULL , "dp tx msdu: " ,
259+ skb -> data , skb -> len );
260+
245261 atomic_inc (& ar -> dp .num_tx_pending );
246262
247263 return 0 ;
@@ -352,7 +368,6 @@ ath11k_dp_tx_process_htt_tx_complete(struct ath11k_base *ab,
352368
353369 wbm_status = FIELD_GET (HTT_TX_WBM_COMP_INFO0_STATUS ,
354370 status_desc -> info0 );
355-
356371 switch (wbm_status ) {
357372 case HAL_WBM_REL_HTT_TX_COMP_STATUS_OK :
358373 case HAL_WBM_REL_HTT_TX_COMP_STATUS_DROP :
0 commit comments