Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 38115398 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: ipa4: add wigig tethering stats"

parents 7ece8a38 c61160b7
Loading
Loading
Loading
Loading
+48 −5
Original line number Diff line number Diff line
@@ -43,6 +43,9 @@ int ipa_hw_stats_init(void)
			teth_stats_init->prod_mask |=
			IPA_CLIENT_BIT_32(IPA_CLIENT_WLAN1_PROD);

		teth_stats_init->prod_mask |=
			IPA_CLIENT_BIT_32(IPA_CLIENT_WIGIG_PROD);

		if (IPA_CLIENT_BIT_32(IPA_CLIENT_MHI_PRIME_TETH_PROD)) {
			ep_index = ipa3_get_ep_mapping(
				IPA_CLIENT_MHI_PRIME_TETH_PROD);
@@ -60,6 +63,15 @@ int ipa_hw_stats_init(void)
			else
				teth_stats_init->dst_ep_mask[ep_index] |=
				IPA_CLIENT_BIT_32(IPA_CLIENT_WLAN1_CONS);

			teth_stats_init->dst_ep_mask[ep_index] |=
				IPA_CLIENT_BIT_32(IPA_CLIENT_WIGIG1_CONS);
			teth_stats_init->dst_ep_mask[ep_index] |=
				IPA_CLIENT_BIT_32(IPA_CLIENT_WIGIG2_CONS);
			teth_stats_init->dst_ep_mask[ep_index] |=
				IPA_CLIENT_BIT_32(IPA_CLIENT_WIGIG3_CONS);
			teth_stats_init->dst_ep_mask[ep_index] |=
				IPA_CLIENT_BIT_32(IPA_CLIENT_WIGIG4_CONS);
		}
	} else {
		teth_stats_init->prod_mask = (
@@ -73,6 +85,9 @@ int ipa_hw_stats_init(void)
			teth_stats_init->prod_mask |=
			IPA_CLIENT_BIT_32(IPA_CLIENT_WLAN1_PROD);

		teth_stats_init->prod_mask |=
			IPA_CLIENT_BIT_32(IPA_CLIENT_WIGIG_PROD);

		if (IPA_CLIENT_BIT_32(IPA_CLIENT_Q6_WAN_PROD)) {
			ep_index = ipa3_get_ep_mapping(IPA_CLIENT_Q6_WAN_PROD);
			if (ep_index == -1) {
@@ -89,6 +104,15 @@ int ipa_hw_stats_init(void)
			else
				teth_stats_init->dst_ep_mask[ep_index] |=
				IPA_CLIENT_BIT_32(IPA_CLIENT_WLAN1_CONS);

			teth_stats_init->dst_ep_mask[ep_index] |=
				IPA_CLIENT_BIT_32(IPA_CLIENT_WIGIG1_CONS);
			teth_stats_init->dst_ep_mask[ep_index] |=
				IPA_CLIENT_BIT_32(IPA_CLIENT_WIGIG2_CONS);
			teth_stats_init->dst_ep_mask[ep_index] |=
				IPA_CLIENT_BIT_32(IPA_CLIENT_WIGIG3_CONS);
			teth_stats_init->dst_ep_mask[ep_index] |=
				IPA_CLIENT_BIT_32(IPA_CLIENT_WIGIG4_CONS);
		}
	}

@@ -100,7 +124,7 @@ int ipa_hw_stats_init(void)
			return -EINVAL;
		}
		/* enable addtional pipe monitoring for pcie modem */
		if (ipa3_ctx->ipa_hw_type >= IPA_HW_v4_1)
		if (ipa3_ctx->platform_type == IPA_PLAT_TYPE_APQ)
			teth_stats_init->dst_ep_mask[ep_index] =
				(IPA_CLIENT_BIT_32(
					IPA_CLIENT_Q6_WAN_CONS) |
@@ -118,8 +142,8 @@ int ipa_hw_stats_init(void)
			kfree(teth_stats_init);
			return -EINVAL;
		}
		/* enable addtional pipe monitoring for pcie modem*/
		if (ipa3_ctx->ipa_hw_type >= IPA_HW_v4_1)
		/* enable additional pipe monitoring for pcie modem*/
		if (ipa3_ctx->platform_type == IPA_PLAT_TYPE_APQ)
			teth_stats_init->dst_ep_mask[ep_index] =
				(IPA_CLIENT_BIT_32(IPA_CLIENT_Q6_WAN_CONS) |
				IPA_CLIENT_BIT_32(
@@ -136,8 +160,8 @@ int ipa_hw_stats_init(void)
			kfree(teth_stats_init);
			return -EINVAL;
		}
		/* enable addtional pipe monitoring for pcie modem*/
		if (ipa3_ctx->ipa_hw_type >= IPA_HW_v4_1)
		/* enable additional pipe monitoring for pcie modem*/
		if (ipa3_ctx->platform_type == IPA_PLAT_TYPE_APQ)
			teth_stats_init->dst_ep_mask[ep_index] =
				(IPA_CLIENT_BIT_32(IPA_CLIENT_Q6_WAN_CONS) |
				IPA_CLIENT_BIT_32(
@@ -147,6 +171,25 @@ int ipa_hw_stats_init(void)
				IPA_CLIENT_BIT_32(IPA_CLIENT_Q6_WAN_CONS);
	}

	if (IPA_CLIENT_BIT_32(IPA_CLIENT_WIGIG_PROD)) {
		ep_index = ipa3_get_ep_mapping(IPA_CLIENT_WIGIG_PROD);
		if (ep_index == -1) {
			IPAERR("Invalid client.\n");
			kfree(teth_stats_init);
			return -EINVAL;
		}
		/* enable additional pipe monitoring for pcie modem */
		if (ipa3_ctx->platform_type == IPA_PLAT_TYPE_APQ)
			teth_stats_init->dst_ep_mask[ep_index] =
			(IPA_CLIENT_BIT_32(
				IPA_CLIENT_Q6_WAN_CONS) |
				IPA_CLIENT_BIT_32(
					IPA_CLIENT_MHI_PRIME_TETH_CONS));
		else
			teth_stats_init->dst_ep_mask[ep_index] =
			IPA_CLIENT_BIT_32(IPA_CLIENT_Q6_WAN_CONS);
	}


	ret = ipa_init_teth_stats(teth_stats_init);
	if (ret != 0)
+82 −1
Original line number Diff line number Diff line
@@ -3392,10 +3392,29 @@ static int rmnet_ipa3_query_tethering_stats_modem(
	return 0;
}

static inline enum ipa_client_type rmnet_ipa3_get_wigig_cons(int idx)
{
	switch (idx) {
	case 0:
		return IPA_CLIENT_WIGIG1_CONS;
	case 1:
		return IPA_CLIENT_WIGIG2_CONS;
	case 2:
		return IPA_CLIENT_WIGIG3_CONS;
	case 3:
		return IPA_CLIENT_WIGIG4_CONS;
	default:
		IPAWANERR("invalid index %d\n", idx);
		return IPA_CLIENT_MAX;
	}
}

static int rmnet_ipa3_query_tethering_stats_hw(
	struct wan_ioctl_query_tether_stats *data, bool reset)
{
	int rc = 0, index = 0;
#define MAX_WIGIG_CLIENTS 4

	int rc = 0, index = 0, i = 0;
	struct ipa_quota_stats_all *con_stats;
	enum ipa_client_type wlan_client;

@@ -3450,6 +3469,21 @@ static int rmnet_ipa3_query_tethering_stats_hw(
	con_stats->client[IPA_CLIENT_USB_CONS].num_ipv6_pkts,
	con_stats->client[IPA_CLIENT_USB_CONS].num_ipv6_bytes);

	for (i = 0; i < MAX_WIGIG_CLIENTS; i++) {
		enum ipa_client_type wigig_client =
			rmnet_ipa3_get_wigig_cons(i);

		if (wigig_client > IPA_CLIENT_WIGIG4_CONS)
			break;

		IPAWANDBG("wigig%d: v4_rx_p(%d) b(%lld) v6_rx_p(%d) b(%lld)\n",
			i + 1,
			con_stats->client[wigig_client].num_ipv4_pkts,
			con_stats->client[wigig_client].num_ipv4_bytes,
			con_stats->client[wigig_client].num_ipv6_pkts,
			con_stats->client[wigig_client].num_ipv6_bytes);
	}

	/* update the DL stats */
	data->ipv4_rx_packets =
		con_stats->client[wlan_client].num_ipv4_pkts +
@@ -3464,6 +3498,23 @@ static int rmnet_ipa3_query_tethering_stats_hw(
		con_stats->client[wlan_client].num_ipv6_bytes +
			con_stats->client[IPA_CLIENT_USB_CONS].num_ipv6_bytes;

	for (i = 0; i < MAX_WIGIG_CLIENTS; i++) {
		enum ipa_client_type wigig_client =
			rmnet_ipa3_get_wigig_cons(i);

		if (wigig_client > IPA_CLIENT_WIGIG4_CONS)
			break;

		data->ipv4_rx_packets +=
			con_stats->client[wigig_client].num_ipv4_pkts;
		data->ipv6_rx_packets +=
			con_stats->client[wigig_client].num_ipv6_pkts;
		data->ipv4_rx_bytes +=
			con_stats->client[wigig_client].num_ipv4_bytes;
		data->ipv6_rx_bytes +=
			con_stats->client[wigig_client].num_ipv6_bytes;
	}

	IPAWANDBG("v4_rx_p(%lu) v6_rx_p(%lu) v4_rx_b(%lu) v6_rx_b(%lu)\n",
		(unsigned long) data->ipv4_rx_packets,
		(unsigned long) data->ipv6_rx_packets,
@@ -3537,6 +3588,36 @@ static int rmnet_ipa3_query_tethering_stats_hw(
	data->ipv6_tx_bytes +=
		con_stats->client[index].num_ipv6_bytes;

	/* query WIGIG UL stats */
	memset(con_stats, 0, sizeof(struct ipa_quota_stats_all));
	rc = ipa_query_teth_stats(IPA_CLIENT_WIGIG_PROD, con_stats, reset);
	if (rc) {
		IPAERR("IPA_CLIENT_WIGIG_PROD query failed %d\n", rc);
		kfree(con_stats);
		return rc;
	}

	if (rmnet_ipa3_ctx->ipa_config_is_apq)
		index = IPA_CLIENT_MHI_PRIME_TETH_CONS;
	else
		index = IPA_CLIENT_Q6_WAN_CONS;

	IPAWANDBG("wigig: v4_tx_p(%d) b(%lld) v6_tx_p(%d) b(%lld)\n",
		con_stats->client[index].num_ipv4_pkts,
		con_stats->client[index].num_ipv4_bytes,
		con_stats->client[index].num_ipv6_pkts,
		con_stats->client[index].num_ipv6_bytes);

	/* update the WIGIG UL stats */
	data->ipv4_tx_packets +=
		con_stats->client[index].num_ipv4_pkts;
	data->ipv6_tx_packets +=
		con_stats->client[index].num_ipv6_pkts;
	data->ipv4_tx_bytes +=
		con_stats->client[index].num_ipv4_bytes;
	data->ipv6_tx_bytes +=
		con_stats->client[index].num_ipv6_bytes;

	IPAWANDBG("v4_tx_p(%lu) v6_tx_p(%lu) v4_tx_b(%lu) v6_tx_b(%lu)\n",
		(unsigned long) data->ipv4_tx_packets,
		(unsigned long) data->ipv6_tx_packets,