Преглед на файлове

ipa: Add support to notify wan upstream iface info

Netmgr requires upstream iface info whenever tethering is
enabled to toggle RSB advanced feature on/off for the
respective upstream iface. Make changes to give provision
to get upstream iface whenever tethering is enabled and
post a uevent.

Change-Id: I841e334fa9000dd5a0f0cc4fce52c5432f67cba8
Signed-off-by: Chaitanya Pratapa <[email protected]>
Chaitanya Pratapa преди 4 години
родител
ревизия
ec886de69e
променени са 1 файла, в които са добавени 44 реда и са изтрити 0 реда
  1. 44 0
      drivers/platform/msm/ipa/ipa_v3/rmnet_ipa.c

+ 44 - 0
drivers/platform/msm/ipa/ipa_v3/rmnet_ipa.c

@@ -64,6 +64,7 @@ enum ipa_ap_ingress_ep_enum {
 #define IPA_QUOTA_REACH_ALERT_MAX_SIZE 64
 #define IPA_QUOTA_REACH_IF_NAME_MAX_SIZE 64
 #define IPA_UEVENT_NUM_EVNP 4 /* number of event pointers */
+#define IPA_UPSTREAM_ALERT_MAX_SIZE 64
 
 #define IPA_NETDEV() \
 	((rmnet_ipa3_ctx && rmnet_ipa3_ctx->wwan_priv) ? \
@@ -2184,6 +2185,12 @@ int ipa3_wwan_set_modem_state(struct wan_ioctl_notify_wan_state *state)
 {
 	uint32_t bw_mbps = 0;
 	int ret = 0;
+	char alert_msg[IPA_UPSTREAM_ALERT_MAX_SIZE];
+	char wan_iface[IPA_UPSTREAM_ALERT_MAX_SIZE];
+	char wan_state[IPA_UPSTREAM_ALERT_MAX_SIZE];
+	char *envp[IPA_UEVENT_NUM_EVNP] = {
+		alert_msg, wan_iface, wan_state, NULL};
+	int res;
 
 	if (!state)
 		return -EINVAL;
@@ -2211,6 +2218,43 @@ int ipa3_wwan_set_modem_state(struct wan_ioctl_notify_wan_state *state)
 		}
 		ret = ipa_pm_deactivate_sync(rmnet_ipa3_ctx->q6_teth_pm_hdl);
 	}
+
+	/* Send upstream state uevent if RSC/RSB is enabled. */
+	if (IPA_NETDEV() && (IPA_NETDEV()->features & NETIF_F_GRO_HW)) {
+		res = snprintf(alert_msg, IPA_UPSTREAM_ALERT_MAX_SIZE,
+			"ALERT_NAME=%s", "upstreamEvent");
+
+		if ((res >= IPA_UPSTREAM_ALERT_MAX_SIZE) || (res < 0)) {
+			IPAWANERR("alert message invalid (%d)", res);
+		} else {
+			state->upstreamIface[IFNAMSIZ - 1] = '\0';
+			res = snprintf(wan_iface,
+				IPA_UPSTREAM_ALERT_MAX_SIZE,
+				"UPSTREAM=%s", state->upstreamIface);
+			if ((res >= IPA_UPSTREAM_ALERT_MAX_SIZE) ||
+				(res < 0)) {
+				IPAWANERR("Iface name invalid (%d)", res);
+			} else {
+				res = snprintf(wan_state,
+					IPA_UPSTREAM_ALERT_MAX_SIZE,
+					"STATE=%s",
+					(state->up ? "UP" : "DOWN"));
+				if ((res >= IPA_UPSTREAM_ALERT_MAX_SIZE) ||
+					(res < 0)) {
+					IPAWANERR("Iface state invalid (%d)",
+						res);
+				} else {
+					IPAWANERR("nlmsg: <%s> <%s> <%s>\n",
+						alert_msg, wan_iface, wan_state);
+					if (IPA_NETDEV())
+						kobject_uevent_env(
+						&(IPA_NETDEV()->dev.kobj),
+						KOBJ_CHANGE, envp);
+				}
+			}
+		}
+	}
+
 	return ret;
 }