[PATCH 17/50] wifi: ath12k: add dp_tx.c

Jeff Johnson quic_jjohnson at quicinc.com
Wed Aug 17 16:35:27 PDT 2022


On 8/12/2022 9:09 AM, Kalle Valo wrote:
> From: Kalle Valo <quic_kvalo at quicinc.com>
> 
> (Patches split into one patch per file for easier review, but the final
> commit will be one big patch. See the cover letter for more info.)
> 
> Signed-off-by: Kalle Valo <quic_kvalo at quicinc.com>
> ---
>   drivers/net/wireless/ath/ath12k/dp_tx.c | 1206 +++++++++++++++++++++++++++++++
>   1 file changed, 1206 insertions(+)
> 
> diff --git a/drivers/net/wireless/ath/ath12k/dp_tx.c b/drivers/net/wireless/ath/ath12k/dp_tx.c

snip

> +static struct ath12k_tx_desc_info *ath12k_dp_tx_assign_buffer(struct ath12k_dp *dp,
> +							      u8 pool_id)
> +{
> +	struct ath12k_tx_desc_info *desc = NULL;

nit: initializer always overwritten

> +
> +	spin_lock_bh(&dp->tx_desc_lock[pool_id]);
> +	desc = list_first_entry_or_null(&dp->tx_desc_free_list[pool_id],
> +					struct ath12k_tx_desc_info,
> +					list);

snip

> +int ath12k_dp_tx(struct ath12k *ar, struct ath12k_vif *arvif,
> +		 struct sk_buff *skb)
> +{
> +	struct ath12k_base *ab = ar->ab;
> +	struct ath12k_dp *dp = &ab->dp;
> +	struct hal_tx_info ti = {0};
> +	struct ath12k_tx_desc_info *tx_desc = NULL;
> +	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
> +	struct ath12k_skb_cb *skb_cb = ATH12K_SKB_CB(skb);
> +	struct hal_tcl_data_cmd *hal_tcl_desc;
> +	struct hal_tx_msdu_ext_desc *msg;
> +	struct sk_buff *skb_ext_desc;
> +	struct hal_srng *tcl_ring;
> +	struct ieee80211_hdr *hdr = (void *)skb->data;
> +	struct dp_tx_ring *tx_ring;
> +	u8 pool_id;
> +	u8 hal_ring_id;
> +	int ret;
> +	u8 ring_selector = 0, ring_map = 0;

nit: ring_selector initializer always overwritten

> +	bool tcl_ring_retry;
> +	bool msdu_ext_desc = false;
> +
> +	if (test_bit(ATH12K_FLAG_CRASH_FLUSH, &ar->ab->dev_flags))
> +		return -ESHUTDOWN;
> +
> +	if (!(info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP) &&
> +	    !ieee80211_is_data(hdr->frame_control))
> +		return -ENOTSUPP;
> +
> +	pool_id = skb_get_queue_mapping(skb) & (ATH12K_HW_MAX_QUEUES - 1);
> +
> +	/* Let the default ring selection be based on current processor
> +	 * number, where one of the 3 tcl rings are selected based on
> +	 * the smp_processor_id(). In case that ring
> +	 * is full/busy, we resort to other available rings.
> +	 * If all rings are full, we drop the packet.
> +	 * TODO: Add throttling logic when all rings are full
> +	 */
> +	ring_selector = ab->hw_params->hw_ops->get_ring_selector(skb);

snip

> +int ath12k_dp_tx_htt_monitor_mode_ring_config(struct ath12k *ar, bool reset)
> +{
> +	struct ath12k_base *ab = ar->ab;
> +	int ret = 0;

nit: initializer always overwritten

> +
> +	ret = ath12k_dp_tx_htt_tx_monitor_mode_ring_config(ar, reset);

snip

> +int ath12k_dp_tx_htt_rx_monitor_mode_ring_config(struct ath12k *ar, bool reset)
> +{
> +	struct ath12k_base *ab = ar->ab;
> +	struct ath12k_dp *dp = &ab->dp;
> +	struct htt_rx_ring_tlv_filter tlv_filter = {0};
> +	int ret = 0, ring_id = 0;

nit: both initializers always overwritten

> +
> +	ring_id = dp->rxdma_mon_buf_ring.refill_buf_ring.ring_id;
> +	tlv_filter.offset_valid = false;
> +
> +	if (!reset) {
> +		tlv_filter.rx_filter = HTT_RX_MON_FILTER_TLV_FLAGS_MON_BUF_RING;
> +		tlv_filter.pkt_filter_flags0 =
> +					HTT_RX_MON_FP_MGMT_FILTER_FLAGS0 |
> +					HTT_RX_MON_MO_MGMT_FILTER_FLAGS0;
> +		tlv_filter.pkt_filter_flags1 =
> +					HTT_RX_MON_FP_MGMT_FILTER_FLAGS1 |
> +					HTT_RX_MON_MO_MGMT_FILTER_FLAGS1;
> +		tlv_filter.pkt_filter_flags2 =
> +					HTT_RX_MON_FP_CTRL_FILTER_FLASG2 |
> +					HTT_RX_MON_MO_CTRL_FILTER_FLASG2;
> +		tlv_filter.pkt_filter_flags3 =
> +					HTT_RX_MON_FP_CTRL_FILTER_FLASG3 |
> +					HTT_RX_MON_MO_CTRL_FILTER_FLASG3 |
> +					HTT_RX_MON_FP_DATA_FILTER_FLASG3 |
> +					HTT_RX_MON_MO_DATA_FILTER_FLASG3;
> +	}
> +
> +	if (ab->hw_params->rxdma1_enable) {
> +		ret = ath12k_dp_tx_htt_rx_filter_setup(ar->ab, ring_id, 0,
> +						       HAL_RXDMA_MONITOR_BUF,
> +						       DP_RXDMA_REFILL_RING_SIZE,
> +						       &tlv_filter);
> +		if (ret) {
> +			ath12k_err(ab,
> +				   "failed to setup filter for monitor buf %d\n", ret);
> +			return ret;
> +		}
> +	}
> +
> +	return 0;
> +}

snip

> +int ath12k_dp_tx_htt_tx_monitor_mode_ring_config(struct ath12k *ar, bool reset)
> +{
> +	struct ath12k_base *ab = ar->ab;
> +	struct ath12k_dp *dp = &ab->dp;
> +	struct htt_tx_ring_tlv_filter tlv_filter = {0};
> +	int ret = 0, ring_id = 0;

nit: ring_id initializer always overwritten

> +
> +	ring_id = dp->tx_mon_buf_ring.refill_buf_ring.ring_id;

snip



More information about the ath12k mailing list