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

Commit dff51d93 authored by Suraj Jaiswal's avatar Suraj Jaiswal
Browse files

net: stmmac: boot KPI optimization



Avoid PHY reset when early Ethernet is enabled to save
atleast 90ms . Also, move Early Eth IP address assignment to
workqueue to save time taken in IP assignment.

Change-Id: Ifd04579894e93761eef2896596101dd17540e6a6
Signed-off-by: default avatarSuraj Jaiswal <jsuraj@codeaurora.org>
parent 11a75d9e
Loading
Loading
Loading
Loading
+15 −12
Original line number Diff line number Diff line
@@ -381,6 +381,13 @@ static int qcom_ethqos_add_ipaddr(struct ip_params *ip_info,
		ETHQOSINFO("Sock is null, unable to assign ipv4 address\n");
		return res;
	}

	if (!net->ipv4.devconf_dflt) {
		ETHQOSERR("ipv4.devconf_dflt is null, schedule wq\n");
		schedule_delayed_work(&pethqos->ipv4_addr_assign_wq,
				      msecs_to_jiffies(1000));
		return res;
	}
	/*For valid Ipv4 address*/
	memset(&ir, 0, sizeof(ir));
	memcpy(&sin->sin_addr.s_addr, &ip_info->ipv4_addr,
@@ -1247,7 +1254,7 @@ static void ethqos_is_ipv4_NW_stack_ready(struct work_struct *work)
	struct net_device *ndev = NULL;
	int ret;

	ETHQOSINFO("\n");
	ETHQOSDBG("\n");
	dwork = container_of(work, struct delayed_work, work);
	ethqos = container_of(dwork, struct qcom_ethqos, ipv4_addr_assign_wq);

@@ -1277,7 +1284,7 @@ static void ethqos_is_ipv6_NW_stack_ready(struct work_struct *work)
	struct net_device *ndev = NULL;
	int ret;

	ETHQOSINFO("\n");
	ETHQOSDBG("\n");
	dwork = container_of(work, struct delayed_work, work);
	ethqos = container_of(dwork, struct qcom_ethqos, ipv6_addr_assign_wq);

@@ -1308,16 +1315,11 @@ static int ethqos_set_early_eth_param(struct stmmac_priv *priv,
		priv->plat->mdio_bus_data->phy_mask =
		 priv->plat->mdio_bus_data->phy_mask | DUPLEX_FULL | SPEED_100;

	priv->early_eth = ethqos->early_eth_enabled;
	qcom_ethqos_add_ipaddr(&pparams, priv->dev);

	if (pparams.is_valid_ipv4_addr) {
		INIT_DELAYED_WORK(&ethqos->ipv4_addr_assign_wq,
				  ethqos_is_ipv4_NW_stack_ready);
		ret = qcom_ethqos_add_ipaddr(&pparams, priv->dev);
		if (ret)
			schedule_delayed_work(&ethqos->ipv4_addr_assign_wq,
					      msecs_to_jiffies(1000));
		schedule_delayed_work(&ethqos->ipv4_addr_assign_wq, 0);
	}

	if (pparams.is_valid_ipv6_addr) {
@@ -1596,6 +1598,7 @@ static int qcom_ethqos_probe(struct platform_device *pdev)
	plat_dat->has_gmac4 = 1;
	plat_dat->pmt = 1;
	plat_dat->tso_en = of_property_read_bool(np, "snps,tso");
	plat_dat->early_eth = ethqos->early_eth_enabled;

	if (of_property_read_bool(pdev->dev.of_node,
				  "emac-core-version")) {
@@ -1785,7 +1788,7 @@ static int __init qcom_ethqos_init_module(void)
{
	int ret = 0;

	ETHQOSINFO("\n");
	ETHQOSDBG("enter\n");

	ret = platform_driver_register(&qcom_ethqos_driver);
	if (ret < 0) {
@@ -1793,18 +1796,18 @@ static int __init qcom_ethqos_init_module(void)
		return ret;
	}

	ETHQOSINFO("\n");
	ETHQOSDBG("Exit\n");

	return ret;
}

static void __exit qcom_ethqos_exit_module(void)
{
	ETHQOSINFO("\n");
	ETHQOSDBG("Enter\n");

	platform_driver_unregister(&qcom_ethqos_driver);

	ETHQOSINFO("\n");
	ETHQOSDBG("Exit\n");
}

/*!
+2 −2
Original line number Diff line number Diff line
@@ -212,7 +212,7 @@ int ethqos_init_pinctrl(struct device *dev)
			return ret;
		}

		ETHQOSINFO("pinctrl_lookup_state %s succeded\n", name);
		ETHQOSDBG("pinctrl_lookup_state %s succeded\n", name);

		ret = pinctrl_select_state(pinctrl, pinctrl_state);
		if (ret) {
@@ -220,7 +220,7 @@ int ethqos_init_pinctrl(struct device *dev)
			return ret;
		}

		ETHQOSINFO("pinctrl_select_state %s succeded\n", name);
		ETHQOSDBG("pinctrl_select_state %s succeded\n", name);
	}

	return ret;
+0 −1
Original line number Diff line number Diff line
@@ -219,7 +219,6 @@ struct stmmac_priv {
	void __iomem *ptpaddr;
	unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)];
	bool boot_kpi;
	bool early_eth;
	bool early_eth_config_set;
#ifdef CONFIG_DEBUG_FS
	struct dentry *dbgfs_dir;
+1 −3
Original line number Diff line number Diff line
@@ -881,7 +881,7 @@ static void stmmac_validate(struct phylink_config *config,
	/* Early ethernet settings to bring up link in 100M,
	 * Auto neg Off with full duplex link.
	 */
	if (priv->early_eth && !priv->early_eth_config_set) {
	if (priv->phydev && priv->plat->early_eth && !priv->early_eth_config_set) {
		priv->phydev->autoneg = AUTONEG_DISABLE;
		priv->phydev->speed = SPEED_100;
		priv->phydev->duplex = DUPLEX_FULL;
@@ -1120,8 +1120,6 @@ static int stmmac_init_phy(struct net_device *dev)
			priv->phydev->irq = PHY_POLL;
		}
	}
	pr_info(" qcom-ethqos: %s early eth setting stmmac init\n",
		__func__);

	return ret;
}
+1 −1
Original line number Diff line number Diff line
@@ -269,7 +269,7 @@ int stmmac_mdio_reset(struct mii_bus *bus)
#ifdef CONFIG_DWMAC_QCOM_ETHQOS
	active_high = false;
#endif
	if (priv->early_eth)
	if (priv->plat->early_eth)
		return 0;

#ifdef CONFIG_OF
Loading