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: Suraj Jaiswal <jsuraj@codeaurora.org>
This commit is contained in:
Suraj Jaiswal 2021-02-05 12:37:10 +05:30
commit dff51d939b
6 changed files with 20 additions and 19 deletions

View file

@ -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");
}
/*!

View file

@ -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;

View file

@ -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;

View file

@ -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;
}

View file

@ -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

View file

@ -186,5 +186,6 @@ struct plat_stmmacenet_data {
struct net_device *sb_dev);
unsigned int (*get_plat_tx_coal_frames)
(struct sk_buff *skb);
bool early_eth;
};
#endif