Skip to content

Commit

Permalink
net: ipa: don't suspend/resume modem if not up
Browse files Browse the repository at this point in the history
The modem network device is set up by ipa_modem_start().  But its
TX queue is not actually started and endpoints enabled until it is
opened.

So avoid stopping the modem network device TX queue and disabling
endpoints on suspend or stop unless the netdev is marked UP.  And
skip attempting to resume unless it is UP.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Alex Elder authored and David S. Miller committed Aug 5, 2021
1 parent 1f52247 commit 30c2515
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions drivers/net/ipa/ipa_modem.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,9 @@ void ipa_modem_suspend(struct net_device *netdev)
struct ipa_priv *priv = netdev_priv(netdev);
struct ipa *ipa = priv->ipa;

if (!(netdev->flags & IFF_UP))
return;

netif_stop_queue(netdev);

ipa_endpoint_suspend_one(ipa->name_map[IPA_ENDPOINT_AP_MODEM_RX]);
Expand All @@ -194,6 +197,9 @@ void ipa_modem_resume(struct net_device *netdev)
struct ipa_priv *priv = netdev_priv(netdev);
struct ipa *ipa = priv->ipa;

if (!(netdev->flags & IFF_UP))
return;

ipa_endpoint_resume_one(ipa->name_map[IPA_ENDPOINT_AP_MODEM_TX]);
ipa_endpoint_resume_one(ipa->name_map[IPA_ENDPOINT_AP_MODEM_RX]);

Expand Down Expand Up @@ -265,9 +271,11 @@ int ipa_modem_stop(struct ipa *ipa)
/* Prevent the modem from triggering a call to ipa_setup() */
ipa_smp2p_disable(ipa);

/* Stop the queue and disable the endpoints if it's open */
/* Clean up the netdev and endpoints if it was started */
if (netdev) {
(void)ipa_stop(netdev);
/* If it was opened, stop it first */
if (netdev->flags & IFF_UP)
(void)ipa_stop(netdev);
ipa->name_map[IPA_ENDPOINT_AP_MODEM_RX]->netdev = NULL;
ipa->name_map[IPA_ENDPOINT_AP_MODEM_TX]->netdev = NULL;
ipa->modem_netdev = NULL;
Expand Down

0 comments on commit 30c2515

Please sign in to comment.