Browse Source

qcacmn: Use HTT message to disable rx_pkt_header tlv

On low memory platform rx_pkt_header tlv is not subscribed to get a
savings of 128bytes in skb. This is required to reduce the skb size from
4K to 2K on 32-bit platforms. Use HTT_H2T_MSG_TYPE_RX_RING_SELECTION_CFG
message to unsubscribe rx_pkt_header tlv for rxdma ring.

Change-Id: Ie684f1ca1de9c824a869b4e13fd0ee1d068004e7
CRs-Fixed: 2408424
Kiran Venkatappa 6 years ago
parent
commit
07921611b4
4 changed files with 152 additions and 1 deletions
  1. 31 0
      dp/wifi3.0/dp_htt.c
  2. 17 1
      dp/wifi3.0/dp_htt.h
  3. 93 0
      dp/wifi3.0/dp_main.c
  4. 11 0
      hal/wifi3.0/hal_rx.h

+ 31 - 0
dp/wifi3.0/dp_htt.c

@@ -937,6 +937,9 @@ int htt_h2t_rx_ring_cfg(void *htt_soc, int pdev_id, void *hal_srng,
 	HTT_RX_RING_SELECTION_CFG_PKT_TLV_SET(*msg_word,
 		!!(srng_params.flags & HAL_SRNG_DATA_TLV_SWAP));
 
+	HTT_RX_RING_SELECTION_CFG_RX_OFFSETS_VALID_SET(*msg_word,
+						htt_tlv_filter->offset_valid);
+
 	/* word 1 */
 	msg_word++;
 	*msg_word = 0;
@@ -1474,6 +1477,34 @@ int htt_h2t_rx_ring_cfg(void *htt_soc, int pdev_id, void *hal_srng,
 
 	HTT_RX_RING_SELECTION_CFG_TLV_FILTER_IN_FLAG_SET(*msg_word, tlv_filter);
 
+	msg_word++;
+	*msg_word = 0;
+	if (htt_tlv_filter->offset_valid) {
+		HTT_RX_RING_SELECTION_CFG_RX_PACKET_OFFSET_SET(*msg_word,
+					htt_tlv_filter->rx_packet_offset);
+		HTT_RX_RING_SELECTION_CFG_RX_HEADER_OFFSET_SET(*msg_word,
+					htt_tlv_filter->rx_header_offset);
+
+		msg_word++;
+		*msg_word = 0;
+		HTT_RX_RING_SELECTION_CFG_RX_MPDU_END_OFFSET_SET(*msg_word,
+					htt_tlv_filter->rx_mpdu_end_offset);
+		HTT_RX_RING_SELECTION_CFG_RX_MPDU_START_OFFSET_SET(*msg_word,
+					htt_tlv_filter->rx_mpdu_start_offset);
+
+		msg_word++;
+		*msg_word = 0;
+		HTT_RX_RING_SELECTION_CFG_RX_MSDU_END_OFFSET_SET(*msg_word,
+					htt_tlv_filter->rx_msdu_end_offset);
+		HTT_RX_RING_SELECTION_CFG_RX_MSDU_START_OFFSET_SET(*msg_word,
+					htt_tlv_filter->rx_msdu_start_offset);
+
+		msg_word++;
+		*msg_word = 0;
+		HTT_RX_RING_SELECTION_CFG_RX_ATTENTION_OFFSET_SET(*msg_word,
+					htt_tlv_filter->rx_attn_offset);
+	}
+
 	/* "response_required" field should be set if a HTT response message is
 	 * required after setting up the ring.
 	 */

+ 17 - 1
dp/wifi3.0/dp_htt.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2019 The Linux Foundation. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -108,6 +108,14 @@ struct htt_soc {
  * @enable_mgmt: enable/disable MGMT packet
  * @enable_ctrl: enable/disable CTRL packet
  * @enable_data: enable/disable DATA packet
+ * @offset_valid: Flag to indicate if below offsets are valid
+ * @rx_packet_offset: Offset of packet payload
+ * @rx_header_offset: Offset of rx_header tlv
+ * @rx_mpdu_end_offset: Offset of rx_mpdu_end tlv
+ * @rx_mpdu_start_offset: Offset of rx_mpdu_start tlv
+ * @rx_msdu_end_offset: Offset of rx_msdu_end tlv
+ * @rx_msdu_start_offset: Offset of rx_msdu_start tlv
+ * @rx_attn_offset: Offset of rx_attention tlv
  */
 struct htt_rx_ring_tlv_filter {
 	u_int32_t mpdu_start:1,
@@ -135,6 +143,14 @@ struct htt_rx_ring_tlv_filter {
 	u_int16_t md_data_filter;
 	u_int16_t md_mgmt_filter;
 	u_int16_t md_ctrl_filter;
+	bool offset_valid;
+	uint16_t rx_packet_offset;
+	uint16_t rx_header_offset;
+	uint16_t rx_mpdu_end_offset;
+	uint16_t rx_mpdu_start_offset;
+	uint16_t rx_msdu_end_offset;
+	uint16_t rx_msdu_start_offset;
+	uint16_t rx_attn_offset;
 };
 
 /*

+ 93 - 0
dp/wifi3.0/dp_main.c

@@ -4220,6 +4220,85 @@ static QDF_STATUS dp_rxdma_ring_config(struct dp_soc *soc)
 }
 #endif
 
+#ifdef NO_RX_PKT_HDR_TLV
+static QDF_STATUS
+dp_rxdma_ring_sel_cfg(struct dp_soc *soc)
+{
+	int i;
+	int mac_id;
+	struct htt_rx_ring_tlv_filter htt_tlv_filter = {0};
+	QDF_STATUS status = QDF_STATUS_SUCCESS;
+
+	htt_tlv_filter.mpdu_start = 1;
+	htt_tlv_filter.msdu_start = 1;
+	htt_tlv_filter.mpdu_end = 1;
+	htt_tlv_filter.msdu_end = 1;
+	htt_tlv_filter.attention = 1;
+	htt_tlv_filter.packet = 1;
+	htt_tlv_filter.packet_header = 0;
+
+	htt_tlv_filter.ppdu_start = 0;
+	htt_tlv_filter.ppdu_end = 0;
+	htt_tlv_filter.ppdu_end_user_stats = 0;
+	htt_tlv_filter.ppdu_end_user_stats_ext = 0;
+	htt_tlv_filter.ppdu_end_status_done = 0;
+	htt_tlv_filter.enable_fp = 1;
+	htt_tlv_filter.enable_md = 0;
+	htt_tlv_filter.enable_md = 0;
+	htt_tlv_filter.enable_mo = 0;
+
+	htt_tlv_filter.fp_mgmt_filter = 0;
+	htt_tlv_filter.fp_ctrl_filter = FILTER_CTRL_BA_REQ;
+	htt_tlv_filter.fp_data_filter = (FILTER_DATA_UCAST |
+					 FILTER_DATA_MCAST |
+					 FILTER_DATA_DATA);
+	htt_tlv_filter.mo_mgmt_filter = 0;
+	htt_tlv_filter.mo_ctrl_filter = 0;
+	htt_tlv_filter.mo_data_filter = 0;
+	htt_tlv_filter.md_data_filter = 0;
+
+	htt_tlv_filter.offset_valid = true;
+
+	htt_tlv_filter.rx_packet_offset = RX_PKT_TLVS_LEN;
+	/*Not subscribing rx_pkt_header*/
+	htt_tlv_filter.rx_header_offset = 0;
+	htt_tlv_filter.rx_mpdu_start_offset =
+				HAL_RX_PKT_TLV_MPDU_START_OFFSET(soc->hal_soc);
+	htt_tlv_filter.rx_mpdu_end_offset =
+				HAL_RX_PKT_TLV_MPDU_END_OFFSET(soc->hal_soc);
+	htt_tlv_filter.rx_msdu_start_offset =
+				HAL_RX_PKT_TLV_MSDU_START_OFFSET(soc->hal_soc);
+	htt_tlv_filter.rx_msdu_end_offset =
+				HAL_RX_PKT_TLV_MSDU_END_OFFSET(soc->hal_soc);
+	htt_tlv_filter.rx_attn_offset =
+				HAL_RX_PKT_TLV_ATTN_OFFSET(soc->hal_soc);
+
+	for (i = 0; i < MAX_PDEV_CNT; i++) {
+		struct dp_pdev *pdev = soc->pdev_list[i];
+
+		if (!pdev)
+			continue;
+
+		for (mac_id = 0; mac_id < NUM_RXDMA_RINGS_PER_PDEV; mac_id++) {
+			int mac_for_pdev = dp_get_mac_id_for_pdev(mac_id,
+					pdev->pdev_id);
+
+			htt_h2t_rx_ring_cfg(soc->htt_handle, mac_for_pdev,
+					    pdev->rx_refill_buf_ring.hal_srng,
+					    RXDMA_BUF, RX_BUFFER_SIZE,
+					    &htt_tlv_filter);
+		}
+	}
+	return status;
+}
+#else
+static QDF_STATUS
+dp_rxdma_ring_sel_cfg(struct dp_soc *soc)
+{
+	return QDF_STATUS_SUCCESS;
+}
+#endif
+
 /*
  * dp_soc_attach_target_wifi3() - SOC initialization in the target
  * @cdp_soc: Opaque Datapath SOC handle
@@ -4240,6 +4319,12 @@ dp_soc_attach_target_wifi3(struct cdp_soc_t *cdp_soc)
 		return status;
 	}
 
+	status = dp_rxdma_ring_sel_cfg(soc);
+	if (status != QDF_STATUS_SUCCESS) {
+		dp_err("Failed to send htt ring config message to target");
+		return status;
+	}
+
 	DP_STATS_INIT(soc);
 
 	/* initialize work queue for stats processing */
@@ -5708,6 +5793,7 @@ static QDF_STATUS dp_pdev_configure_monitor_rings(struct dp_pdev *pdev)
 	htt_tlv_filter.mo_mgmt_filter = pdev->mo_mgmt_filter;
 	htt_tlv_filter.mo_ctrl_filter = pdev->mo_ctrl_filter;
 	htt_tlv_filter.mo_data_filter = pdev->mo_data_filter;
+	htt_tlv_filter.offset_valid = false;
 
 	for (mac_id = 0; mac_id < NUM_RXDMA_RINGS_PER_PDEV; mac_id++) {
 		int mac_for_pdev = dp_get_mac_id_for_pdev(mac_id, pdev_id);
@@ -5747,6 +5833,7 @@ static QDF_STATUS dp_pdev_configure_monitor_rings(struct dp_pdev *pdev)
 	htt_tlv_filter.mo_mgmt_filter = FILTER_MGMT_ALL;
 	htt_tlv_filter.mo_ctrl_filter = FILTER_CTRL_ALL;
 	htt_tlv_filter.mo_data_filter = FILTER_DATA_ALL;
+	htt_tlv_filter.offset_valid = false;
 
 	for (mac_id = 0; mac_id < NUM_RXDMA_RINGS_PER_PDEV; mac_id++) {
 		int mac_for_pdev = dp_get_mac_id_for_pdev(mac_id,
@@ -5895,6 +5982,7 @@ dp_pdev_set_advance_monitor_filter(struct cdp_pdev *pdev_handle,
 	htt_tlv_filter.mo_mgmt_filter = pdev->mo_mgmt_filter;
 	htt_tlv_filter.mo_ctrl_filter = pdev->mo_ctrl_filter;
 	htt_tlv_filter.mo_data_filter = pdev->mo_data_filter;
+	htt_tlv_filter.offset_valid = false;
 
 	for (mac_id = 0; mac_id < NUM_RXDMA_RINGS_PER_PDEV; mac_id++) {
 		int mac_for_pdev = dp_get_mac_id_for_pdev(mac_id, pdev_id);
@@ -5934,6 +6022,7 @@ dp_pdev_set_advance_monitor_filter(struct cdp_pdev *pdev_handle,
 	htt_tlv_filter.mo_mgmt_filter = FILTER_MGMT_ALL;
 	htt_tlv_filter.mo_ctrl_filter = FILTER_CTRL_ALL;
 	htt_tlv_filter.mo_data_filter = FILTER_DATA_ALL;
+	htt_tlv_filter.offset_valid = false;
 
 	for (mac_id = 0; mac_id < NUM_RXDMA_RINGS_PER_PDEV; mac_id++) {
 		int mac_for_pdev = dp_get_mac_id_for_pdev(mac_id,
@@ -7707,6 +7796,8 @@ dp_ppdu_ring_cfg(struct dp_pdev *pdev)
 	    pdev->soc->hw_nac_monitor_support)
 		htt_tlv_filter.md_data_filter = FILTER_DATA_ALL;
 
+	htt_tlv_filter.offset_valid = false;
+
 	for (mac_id = 0; mac_id < NUM_RXDMA_RINGS_PER_PDEV; mac_id++) {
 		int mac_for_pdev = dp_get_mac_id_for_pdev(mac_id,
 						pdev->pdev_id);
@@ -9991,6 +10082,7 @@ int dp_set_pktlog_wifi3(struct dp_pdev *pdev, uint32_t event,
 				htt_tlv_filter.mo_mgmt_filter = FILTER_MGMT_ALL;
 				htt_tlv_filter.mo_ctrl_filter = FILTER_CTRL_ALL;
 				htt_tlv_filter.mo_data_filter = FILTER_DATA_ALL;
+				htt_tlv_filter.offset_valid = false;
 
 				for (mac_id = 0; mac_id < max_mac_rings;
 								mac_id++) {
@@ -10038,6 +10130,7 @@ int dp_set_pktlog_wifi3(struct dp_pdev *pdev, uint32_t event,
 				htt_tlv_filter.mo_mgmt_filter = FILTER_MGMT_ALL;
 				htt_tlv_filter.mo_ctrl_filter = FILTER_CTRL_ALL;
 				htt_tlv_filter.mo_data_filter = FILTER_DATA_ALL;
+				htt_tlv_filter.offset_valid = false;
 
 				for (mac_id = 0; mac_id < max_mac_rings;
 								mac_id++) {

+ 11 - 0
hal/wifi3.0/hal_rx.h

@@ -671,6 +671,17 @@ static inline uint8_t
 }
 #endif
 
+#define RX_PKT_TLV_OFFSET(field) qdf_offsetof(struct rx_pkt_tlvs, field)
+
+#define HAL_RX_PKT_TLV_MPDU_START_OFFSET(hal_soc) \
+					RX_PKT_TLV_OFFSET(mpdu_start_tlv)
+#define HAL_RX_PKT_TLV_MPDU_END_OFFSET(hal_soc) RX_PKT_TLV_OFFSET(mpdu_end_tlv)
+#define HAL_RX_PKT_TLV_MSDU_START_OFFSET(hal_soc) \
+					RX_PKT_TLV_OFFSET(msdu_start_tlv)
+#define HAL_RX_PKT_TLV_MSDU_END_OFFSET(hal_soc) RX_PKT_TLV_OFFSET(msdu_end_tlv)
+#define HAL_RX_PKT_TLV_ATTN_OFFSET(hal_soc) RX_PKT_TLV_OFFSET(attn_tlv)
+#define HAL_RX_PKT_TLV_PKT_HDR_OFFSET(hal_soc) RX_PKT_TLV_OFFSET(pkt_hdr_tlv)
+
 static inline uint8_t
 *hal_rx_padding0_get(uint8_t *buf)
 {