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

Commit 7022387c authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: ipa: support aggregated ipa stats query"

parents 23550e79 2ce73580
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -85,7 +85,10 @@ const char *ipa_event_name[] = {
	__stringify(ADD_VLAN_IFACE),
	__stringify(DEL_VLAN_IFACE),
	__stringify(ADD_L2TP_VLAN_MAPPING),
	__stringify(DEL_L2TP_VLAN_MAPPING)
	__stringify(DEL_L2TP_VLAN_MAPPING),
	__stringify(IPA_QUOTA_REACH),
	__stringify(IPA_SSR_BEFORE_SHUTDOWN),
	__stringify(IPA_SSR_AFTER_POWERUP),
};

const char *ipa_hdr_l2_type_name[] = {
+3 −0
Original line number Diff line number Diff line
@@ -176,6 +176,9 @@ int rmnet_ipa_set_tether_client_pipe(struct wan_ioctl_set_tether_client_pipe
int rmnet_ipa_query_tethering_stats(struct wan_ioctl_query_tether_stats *data,
	bool reset);

int rmnet_ipa_query_tethering_stats_all(
	struct wan_ioctl_query_tether_stats_all *data);

int ipa_qmi_get_data_stats(struct ipa_get_data_stats_req_msg_v01 *req,
	struct ipa_get_data_stats_resp_msg_v01 *resp);

+1 −1
Original line number Diff line number Diff line
@@ -962,7 +962,7 @@ int ipa2_get_ep_mapping(enum ipa_client_type client)

void ipa2_set_client(int index, enum ipacm_client_enum client, bool uplink)
{
	if (client >= IPACM_CLIENT_MAX || client < IPACM_CLIENT_USB) {
	if (client > IPACM_CLIENT_MAX || client < IPACM_CLIENT_USB) {
		IPAERR("Bad client number! client =%d\n", client);
	} else if (index >= IPA_MAX_NUM_PIPES || index < 0) {
		IPAERR("Bad pipe index! index =%d\n", index);
+70 −0
Original line number Diff line number Diff line
@@ -2270,6 +2270,29 @@ static struct platform_driver rmnet_ipa_driver = {
	.remove = ipa_wwan_remove,
};

/**
* rmnet_ipa_send_ssr_notification(bool ssr_done) - send SSR notification
*
* This function sends the SSR notification before modem shutdown and
* after_powerup from SSR framework, to user-space module
*/
static void rmnet_ipa_send_ssr_notification(bool ssr_done)
{
	struct ipa_msg_meta msg_meta;
	int rc;

	memset(&msg_meta, 0, sizeof(struct ipa_msg_meta));
	if (ssr_done)
		msg_meta.msg_type = IPA_SSR_AFTER_POWERUP;
	else
		msg_meta.msg_type = IPA_SSR_BEFORE_SHUTDOWN;
	rc = ipa_send_msg(&msg_meta, NULL, NULL);
	if (rc) {
		IPAWANERR("ipa_send_msg failed: %d\n", rc);
		return;
	}
}

static int ssr_notifier_cb(struct notifier_block *this,
			   unsigned long code,
			   void *data)
@@ -2277,6 +2300,8 @@ static int ssr_notifier_cb(struct notifier_block *this,
	if (ipa_rmnet_ctx.ipa_rmnet_ssr) {
		if (SUBSYS_BEFORE_SHUTDOWN == code) {
			pr_info("IPA received MPSS BEFORE_SHUTDOWN\n");
			/* send SSR before-shutdown notification to IPACM */
			rmnet_ipa_send_ssr_notification(false);
			atomic_set(&is_ssr, 1);
			ipa_q6_pre_shutdown_cleanup();
			if (ipa_netdevs[0])
@@ -2452,6 +2477,25 @@ static void rmnet_ipa_get_network_stats_and_update(void)
	}
}

/**
* rmnet_ipa_send_quota_reach_ind() - send quota_reach notification from
* IPA Modem
* This function sends the quota_reach indication from the IPA Modem driver
* via QMI, to user-space module
*/
static void rmnet_ipa_send_quota_reach_ind(void)
{
	struct ipa_msg_meta msg_meta;
	int rc;

	memset(&msg_meta, 0, sizeof(struct ipa_msg_meta));
	msg_meta.msg_type = IPA_QUOTA_REACH;
	rc = ipa_send_msg(&msg_meta, NULL, NULL);
	if (rc) {
		IPAWANERR("ipa_send_msg failed: %d\n", rc);
		return;
	}
}
/**
 * rmnet_ipa_poll_tethering_stats() - Tethering stats polling IOCTL handler
 * @data - IOCTL data
@@ -2748,6 +2792,28 @@ int rmnet_ipa_query_tethering_stats(struct wan_ioctl_query_tether_stats *data,
	return 0;
}

int rmnet_ipa_query_tethering_stats_all(
	struct wan_ioctl_query_tether_stats_all *data)
{
	struct wan_ioctl_query_tether_stats tether_stats;
	int rc = 0;

	memset(&tether_stats, 0, sizeof(struct wan_ioctl_query_tether_stats));

	tether_stats.ipa_client = data->ipa_client;
	rc = rmnet_ipa_query_tethering_stats(
		&tether_stats, data->reset_stats);
	if (rc) {
		IPAWANERR("modem WAN_IOC_QUERY_TETHER_STATS failed\n");
		return rc;
	}
	data->tx_bytes = tether_stats.ipv4_tx_bytes
			+ tether_stats.ipv6_tx_bytes;
	data->rx_bytes = tether_stats.ipv4_rx_bytes
			+ tether_stats.ipv6_rx_bytes;
	return rc;
}

/**
 * ipa_broadcast_quota_reach_ind() - Send Netlink broadcast on Quota
 * @mux_id - The MUX ID on which the quota has been reached
@@ -2798,6 +2864,7 @@ void ipa_broadcast_quota_reach_ind(u32 mux_id)
	IPAWANERR("putting nlmsg: <%s> <%s> <%s>\n",
		alert_msg, iface_name_l, iface_name_m);
	kobject_uevent_env(&(ipa_netdevs[0]->dev.kobj), KOBJ_CHANGE, envp);
	rmnet_ipa_send_quota_reach_ind();
}

/**
@@ -2822,6 +2889,9 @@ void ipa_q6_handshake_complete(bool ssr_bootup)
		 */
		ipa2_proxy_clk_unvote();

		/* send SSR power-up notification to IPACM */
		rmnet_ipa_send_ssr_notification(true);

		/*
		 * It is required to recover the network stats after
		 * SSR recovery
+29 −0
Original line number Diff line number Diff line
@@ -47,6 +47,9 @@
#define WAN_IOC_QUERY_DL_FILTER_STATS32 _IOWR(WAN_IOC_MAGIC, \
		WAN_IOCTL_QUERY_DL_FILTER_STATS, \
		compat_uptr_t)
#define WAN_IOC_QUERY_TETHER_STATS_ALL32 _IOWR(WAN_IOC_MAGIC, \
		WAN_IOCTL_QUERY_TETHER_STATS_ALL, \
		compat_uptr_t)
#endif

static unsigned int dev_num = 1;
@@ -238,6 +241,32 @@ static long wan_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
		}
		break;

	case WAN_IOC_QUERY_TETHER_STATS_ALL:
		IPAWANDBG_LOW("got WAN_IOC_QUERY_TETHER_STATS_ALL :>>>\n");
		pyld_sz = sizeof(struct wan_ioctl_query_tether_stats_all);
		param = kzalloc(pyld_sz, GFP_KERNEL);
		if (!param) {
			retval = -ENOMEM;
			break;
		}
		if (copy_from_user(param, (const void __user *)arg, pyld_sz)) {
			retval = -EFAULT;
			break;
		}

		if (rmnet_ipa_query_tethering_stats_all(
			(struct wan_ioctl_query_tether_stats_all *)param)) {
			IPAWANERR("WAN_IOC_QUERY_TETHER_STATS failed\n");
			retval = -EFAULT;
			break;
		}

		if (copy_to_user((void __user *)arg, param, pyld_sz)) {
			retval = -EFAULT;
			break;
		}
		break;

	case WAN_IOC_RESET_TETHER_STATS:
		IPAWANDBG_LOW("got WAN_IOC_RESET_TETHER_STATS :>>>\n");
		pyld_sz = sizeof(struct wan_ioctl_reset_tether_stats);
Loading