From 53b6970ecd5f254b45484bc2e0b90f28e1da82ec Mon Sep 17 00:00:00 2001 From: Sunil Paidimarri Date: Thu, 9 Jul 2020 21:21:04 -0700 Subject: [PATCH] net: stmmac: Add check for HWTSTAMP_FILTER_ALL filter -HWTSTAMP_FILTER_ALL with ipa enabled not supported. -Add check for above condition to avoid crash. Change-Id: I443122489aa257be5208bdf6260b2b3a9c8096c1 Acked-by: Ning Cai Signed-off-by: Sunil Paidimarri --- drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 8 ++++++++ drivers/net/ethernet/stmicro/stmmac/stmmac.h | 1 + drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 7 +++++++ 3 files changed, 16 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c index b54efdad26d5..da5c40c74ed2 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c @@ -1768,6 +1768,14 @@ static int ethqos_set_early_eth_param(struct stmmac_priv *priv, return ret; } +bool qcom_ethqos_ipa_enabled(void) +{ +#ifdef CONFIG_ETH_IPA_OFFLOAD + return pethqos->ipa_enabled; +#endif + return false; +} + static int qcom_ethqos_probe(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h index 58ccbf8386ea..1d6802ea1b50 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h @@ -194,5 +194,6 @@ int stmmac_dvr_probe(struct device *device, struct stmmac_resources *res); void stmmac_disable_eee_mode(struct stmmac_priv *priv); bool stmmac_eee_init(struct stmmac_priv *priv); +bool qcom_ethqos_ipa_enabled(void); #endif /* __STMMAC_H__ */ diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 828c0d62c43a..8a1a05b60e97 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -539,6 +539,13 @@ static int stmmac_hwtstamp_ioctl(struct net_device *dev, struct ifreq *ifr) sizeof(struct hwtstamp_config))) return -EFAULT; + if (qcom_ethqos_ipa_enabled() && + config.rx_filter == HWTSTAMP_FILTER_ALL) { + netdev_alert(priv->dev, + "No hw timestamping since ipa is enabled\n"); + return -EOPNOTSUPP; + } + netdev_dbg(priv->dev, "%s config flags:0x%x, tx_type:0x%x, rx_filter:0x%x\n", __func__, config.flags, config.tx_type, config.rx_filter);