From patchwork Tue Jan 30 19:22:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 13537880 Received: from mail-io1-f49.google.com (mail-io1-f49.google.com [209.85.166.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 977367AE60 for ; Tue, 30 Jan 2024 19:23:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706642592; cv=none; b=DYqLoaYYngOBT+2QJJhwyb7ZjodVSyMH31oWUMCoc+4xtRrLevbygUIh3p26jp5WDSOvjPl3QRaa3lc7dtsy1al6DwAwrzy9i4y84xSNwpizEbYXjnrxU+nMhYTg0zw4ITVvi72qh4mrOrlo4NiHsBosYUs77WariU1zMjjXzkU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706642592; c=relaxed/simple; bh=Y2XYalvyDF0LSGy+Ssi1gO1ShePw9aqEjMk9LIb7/dk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=NSv18Mv7LMl2ZWcklvC5Bw3LO+BCXxH7u+FbTLl5638xdcmEJNCU2EproW5/3M7dyIgWi5QkM4FG7ug5U1Y/bPnCx5oAEbwFxBOCfHzIEPSayPmZpxPpx5x+eL3r5NcDhfOMbyf3FULB2YOH9NamWdbw1PwnAuOI0AtmBs1r0HY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=Czldj+uX; arc=none smtp.client-ip=209.85.166.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Czldj+uX" Received: by mail-io1-f49.google.com with SMTP id ca18e2360f4ac-7bfd5570ed0so122128039f.2 for ; Tue, 30 Jan 2024 11:23:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706642590; x=1707247390; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0Nt9gsHgFMlaiKN5ea39BAFtn18uNvSPnFNNqT/KSks=; b=Czldj+uXX2VbHJZf2+Zt0x28FYAWXvA5tSkb1Jw4rv4w59eVuFaMacBjkB7Pr74oh0 YtRnlulGTWC+lZpdjG+Joye/3S1BgcDkO6pcbQb7TPMUaFCq7XcrXFOpLF4Hcuy8RC+E SrQ716zlJN1CehSfLAAxkmjW+sg0DYVvDK96C8RKUSlUFGbJ4DcdiJm9noMbuOK5CkBH juBf/RUoiGdp3gVA/24NKTq+n8qCW8KEhhIXqaw2IuZqJuF5S/WTnPjcie2PY6X5sF4L JyQtALif/pqY+h5qym/2wwaMlGaQgy01NijGVP70S+Z8jBCk3opzbuJQO8UrGn4JXfbQ NYfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706642590; x=1707247390; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0Nt9gsHgFMlaiKN5ea39BAFtn18uNvSPnFNNqT/KSks=; b=anhwPg6h+7XB0wfqegfXDxh4R+wSBcOkgBqEAyP97Ts6/n1KpvsZHtaHYL20McuDyW sjpsp68FoShmNReUHW6PszjEKlEz4a5pnpHGjWICWOmMQjrnGD91zqRycHlfoSWHxFQ6 x5wBH2HyM4nBaxY2LAs0i9+UJtcHop8TIaV4B2lHQmpgnOBfFjwumqRtN739lmrSYDcL gNVwa5On/4EOT5KG5EyHzgBPDl9BNAwMj+Ucnb6Ge8gJKkSCe95jWtk5A4J/3d1DbnMT xz37mGljzy7rAzNIicN5Hkt2zenV1v9hqP/ZW536vsxHKljGaynileMs+1GxwTCdf4ZC 6I/w== X-Gm-Message-State: AOJu0YxETdJDBjxZrZ9owvgoeJK1svuiTvyVa5K2iQWa1TFB4bKPZrvI TMhfBX0BdlLFYTHRxHsdq5/s5tuIPrNWUxX25SqlSbLu8c2icFirCB2xIJkak/o= X-Google-Smtp-Source: AGHT+IEU2PbnQQI+R4Qm7rBHo4FAbpAqDDFj+7F6iVI1GVHdEr+lP+XFz6AvY9uUmD0GBcaFAoBrrw== X-Received: by 2002:a92:c106:0:b0:363:8727:dddf with SMTP id p6-20020a92c106000000b003638727dddfmr124649ile.7.1706642589735; Tue, 30 Jan 2024 11:23:09 -0800 (PST) Received: from localhost.localdomain (c-98-61-227-136.hsd1.mn.comcast.net. [98.61.227.136]) by smtp.gmail.com with ESMTPSA id t18-20020a92c912000000b003637871ec98sm2157762ilp.27.2024.01.30.11.23.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 11:23:09 -0800 (PST) From: Alex Elder To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: mka@chromium.org, andersson@kernel.org, quic_cpratapa@quicinc.com, quic_avuyyuru@quicinc.com, quic_jponduru@quicinc.com, quic_subashab@quicinc.com, elder@kernel.org, netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 1/7] net: ipa: stash modem TX and RX endpoints Date: Tue, 30 Jan 2024 13:22:58 -0600 Message-Id: <20240130192305.250915-2-elder@linaro.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240130192305.250915-1-elder@linaro.org> References: <20240130192305.250915-1-elder@linaro.org> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Rather than repeatedly looking up the endpoints in the name map, save the modem TX and RX endpoint pointers in the netdev private area. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_modem.c | 49 +++++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 19 deletions(-) diff --git a/drivers/net/ipa/ipa_modem.c b/drivers/net/ipa/ipa_modem.c index 423422a2a445f..a6f6cd149c1b6 100644 --- a/drivers/net/ipa/ipa_modem.c +++ b/drivers/net/ipa/ipa_modem.c @@ -39,10 +39,14 @@ enum ipa_modem_state { /** * struct ipa_priv - IPA network device private data * @ipa: IPA pointer + * @tx: Transmit endpoint pointer + * @rx: Receive endpoint pointer * @work: Work structure used to wake the modem netdev TX queue */ struct ipa_priv { struct ipa *ipa; + struct ipa_endpoint *tx; + struct ipa_endpoint *rx; struct work_struct work; }; @@ -59,11 +63,11 @@ static int ipa_open(struct net_device *netdev) if (ret < 0) goto err_power_put; - ret = ipa_endpoint_enable_one(ipa->name_map[IPA_ENDPOINT_AP_MODEM_TX]); + ret = ipa_endpoint_enable_one(priv->tx); if (ret) goto err_power_put; - ret = ipa_endpoint_enable_one(ipa->name_map[IPA_ENDPOINT_AP_MODEM_RX]); + ret = ipa_endpoint_enable_one(priv->rx); if (ret) goto err_disable_tx; @@ -75,7 +79,7 @@ static int ipa_open(struct net_device *netdev) return 0; err_disable_tx: - ipa_endpoint_disable_one(ipa->name_map[IPA_ENDPOINT_AP_MODEM_TX]); + ipa_endpoint_disable_one(priv->tx); err_power_put: pm_runtime_put_noidle(dev); @@ -97,8 +101,8 @@ static int ipa_stop(struct net_device *netdev) netif_stop_queue(netdev); - ipa_endpoint_disable_one(ipa->name_map[IPA_ENDPOINT_AP_MODEM_RX]); - ipa_endpoint_disable_one(ipa->name_map[IPA_ENDPOINT_AP_MODEM_TX]); + ipa_endpoint_disable_one(priv->rx); + ipa_endpoint_disable_one(priv->tx); out_power_put: pm_runtime_mark_last_busy(dev); (void)pm_runtime_put_autosuspend(dev); @@ -233,14 +237,14 @@ static void ipa_modem_netdev_setup(struct net_device *netdev) */ void ipa_modem_suspend(struct net_device *netdev) { - struct ipa_priv *priv = netdev_priv(netdev); - struct ipa *ipa = priv->ipa; + struct ipa_priv *priv; if (!(netdev->flags & IFF_UP)) return; - ipa_endpoint_suspend_one(ipa->name_map[IPA_ENDPOINT_AP_MODEM_RX]); - ipa_endpoint_suspend_one(ipa->name_map[IPA_ENDPOINT_AP_MODEM_TX]); + priv = netdev_priv(netdev); + ipa_endpoint_suspend_one(priv->rx); + ipa_endpoint_suspend_one(priv->tx); } /** @@ -268,14 +272,14 @@ static void ipa_modem_wake_queue_work(struct work_struct *work) */ void ipa_modem_resume(struct net_device *netdev) { - struct ipa_priv *priv = netdev_priv(netdev); - struct ipa *ipa = priv->ipa; + struct ipa_priv *priv; 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]); + priv = netdev_priv(netdev); + ipa_endpoint_resume_one(priv->tx); + ipa_endpoint_resume_one(priv->rx); /* Arrange for the TX queue to be restarted */ (void)queue_pm_work(&priv->work); @@ -306,16 +310,21 @@ int ipa_modem_start(struct ipa *ipa) SET_NETDEV_DEV(netdev, &ipa->pdev->dev); priv = netdev_priv(netdev); priv->ipa = ipa; + priv->tx = ipa->name_map[IPA_ENDPOINT_AP_MODEM_TX]; + priv->rx = ipa->name_map[IPA_ENDPOINT_AP_MODEM_RX]; INIT_WORK(&priv->work, ipa_modem_wake_queue_work); - ipa->name_map[IPA_ENDPOINT_AP_MODEM_TX]->netdev = netdev; - ipa->name_map[IPA_ENDPOINT_AP_MODEM_RX]->netdev = netdev; + + priv->tx->netdev = netdev; + priv->rx->netdev = netdev; + ipa->modem_netdev = netdev; ret = register_netdev(netdev); if (ret) { ipa->modem_netdev = NULL; - ipa->name_map[IPA_ENDPOINT_AP_MODEM_RX]->netdev = NULL; - ipa->name_map[IPA_ENDPOINT_AP_MODEM_TX]->netdev = NULL; + priv->rx->netdev = NULL; + priv->tx->netdev = NULL; + free_netdev(netdev); } @@ -355,9 +364,11 @@ int ipa_modem_stop(struct ipa *ipa) if (netdev->flags & IFF_UP) (void)ipa_stop(netdev); unregister_netdev(netdev); + ipa->modem_netdev = NULL; - ipa->name_map[IPA_ENDPOINT_AP_MODEM_RX]->netdev = NULL; - ipa->name_map[IPA_ENDPOINT_AP_MODEM_TX]->netdev = NULL; + priv->rx->netdev = NULL; + priv->tx->netdev = NULL; + free_netdev(netdev); } From patchwork Tue Jan 30 19:22:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 13537881 Received: from mail-il1-f171.google.com (mail-il1-f171.google.com [209.85.166.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B141C7AE70 for ; Tue, 30 Jan 2024 19:23:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706642594; cv=none; b=b9ZRkNEyS0rKmVMGzR+NsHyuDmwgtH+OStTs3Gw14HBDEx5ITNt1eYWNzanZsowt8FrcsbB0VrzWih93IkzwShdd7SRsa3TZ0lem1DtannZPcvhftQVGSuLOm8XGz6kwTf+4wzmFverouN6GODBAY33PhgJlExzLQQI+Yol/4NE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706642594; c=relaxed/simple; bh=g9izfX6XgkZla6GTE2GxGyabzh6/fiFAQsmyv6knGrk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=TteK1TmMDfljySFEQxtYvw0qyPMmpHI4c2FIJnmE7Ddvu/xw6Ce4gSMJQNHQAhj/LGW+zTHlXuUQGtR9eOtP3q0sYUfbuWqAfEyvrN21aJM68SfZnVTG0Ev7CP5tr/E9almlG0rtdW9f6zqxKSIeMvlG6sq0weZnH2hrzUxMRyQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=alEOnOmq; arc=none smtp.client-ip=209.85.166.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="alEOnOmq" Received: by mail-il1-f171.google.com with SMTP id e9e14a558f8ab-3637f958e9dso5290595ab.1 for ; Tue, 30 Jan 2024 11:23:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706642591; x=1707247391; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=cxd3mG2/1IddsNcldBuZY2JUAVRlavlzaQzhHM61Xz0=; b=alEOnOmqjq1UULa2rY1Ay3VoibWPMNt5+gle6uBMCq2jUOFAZs6sZWQX4/GKZxt+4Y EhmwJDpiqNwcx7XEXZefQ3IGHOMF6YTplA1OeZdi61dydNHw12/R6XvlV5oM38nzQd/R fRlHsBcY1BQCwUS7Pf4P4y7JJrwVOu8+dSubYHdFn6Ftz5YsI2pvMoMFd17ewb+AHD/8 7T9HFvJGKhfqh24D8Tn8dumdVL5yiAKhTlI4c7PbdYdXaH//KslnVA7aKQL8EBU1Q+ZM 2kf4irW3yo0vO8+6C8xJ3rWOK3quDVj6KLzSOiK4I00Kzp6Fxjs5GXCNhh91WBInD97t oIGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706642591; x=1707247391; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cxd3mG2/1IddsNcldBuZY2JUAVRlavlzaQzhHM61Xz0=; b=m9DS8vS9KmQb8zyz1R4Iythr5DZYWlE8eX5C+eX2k8OoD3P3iLIzjp7K4+6KKBL4hj xWWWqTpT+Z+C+KcowNFtvyISCKJ7rrHVjnXspxF6PKep3QLyND8JNQtQ63NvzQ6NLFnZ 6FjA4N5KA0Jmi6PTa6lg1zmLxkaCqk/ZPvZt48jKYh7XBI8T5+IhI84mdKV0oa1x2Lor Okfit0BvVl4tH1Rj5vx+ah2vYFbhsR6Z70wU9vZ8hWobqm0Wid4dDsXbucj+KqJbpdhb w1M2YSyilnvIugrphTuu6eddCj40nufzD6TXL+xC8a2HvRFmTkpCzQRohlgrIdR11jR0 Fj6Q== X-Gm-Message-State: AOJu0YzeQ5dXzNmTwCpy0u9lLgvzyP2pa2WvfqYPa9Ko1rwOWaZOHOkw 55HDug06epeoedkamsEe+PvE6RVnHqrT3GFAHXZYCsJXhecdSwj2DToUSLsKnY8= X-Google-Smtp-Source: AGHT+IGTUT9Kd1uV0mrMasfE8zaevyiOyeAx68UVu3kMYHDIRVhqc81BZ423aoLmlOF8LIrSsiUJOg== X-Received: by 2002:a92:2908:0:b0:363:812d:d6a6 with SMTP id l8-20020a922908000000b00363812dd6a6mr5290596ilg.3.1706642590790; Tue, 30 Jan 2024 11:23:10 -0800 (PST) Received: from localhost.localdomain (c-98-61-227-136.hsd1.mn.comcast.net. [98.61.227.136]) by smtp.gmail.com with ESMTPSA id t18-20020a92c912000000b003637871ec98sm2157762ilp.27.2024.01.30.11.23.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 11:23:10 -0800 (PST) From: Alex Elder To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: mka@chromium.org, andersson@kernel.org, quic_cpratapa@quicinc.com, quic_avuyyuru@quicinc.com, quic_jponduru@quicinc.com, quic_subashab@quicinc.com, elder@kernel.org, netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 2/7] net: ipa: begin simplifying TX queue stop Date: Tue, 30 Jan 2024 13:22:59 -0600 Message-Id: <20240130192305.250915-3-elder@linaro.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240130192305.250915-1-elder@linaro.org> References: <20240130192305.250915-1-elder@linaro.org> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 There are a number of flags used in the IPA driver to attempt to manage race conditions that can occur between runtime resume and netdev transmit. If we disable TX before requesting power, we can avoid these races entirely, simplifying things considerably. This patch implements the main change, disabling transmit always in the net_device->ndo_start_xmit() callback, then re-enabling it again whenever we find power is active (or when we drop the skb). The patches that follow will refactor the "old" code to the point that most of it can be eliminated. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_modem.c | 41 +++++++++++++++++++++++----------- drivers/net/ipa/ipa_power.c | 44 ++++++++++++++++++++++--------------- 2 files changed, 54 insertions(+), 31 deletions(-) diff --git a/drivers/net/ipa/ipa_modem.c b/drivers/net/ipa/ipa_modem.c index a6f6cd149c1b6..c7a0b167c4326 100644 --- a/drivers/net/ipa/ipa_modem.c +++ b/drivers/net/ipa/ipa_modem.c @@ -110,13 +110,16 @@ static int ipa_stop(struct net_device *netdev) return 0; } -/** ipa_start_xmit() - Transmits an skb. - * @skb: skb to be transmitted - * @dev: network device +/** ipa_start_xmit() - Transmit an skb + * @skb: Socket buffer to be transmitted + * @netdev: Network device * - * Return codes: - * NETDEV_TX_OK: Success - * NETDEV_TX_BUSY: Error while transmitting the skb. Try again later + * Return: NETDEV_TX_OK if successful (or dropped), NETDEV_TX_BUSY otherwise + + * Normally NETDEV_TX_OK indicates the buffer was successfully transmitted. + * If the buffer has an unexpected protocol or its size is out of range it + * is quietly dropped, returning NETDEV_TX_OK. NETDEV_TX_BUSY indicates + * the buffer cannot be sent at this time and should retried later. */ static netdev_tx_t ipa_start_xmit(struct sk_buff *skb, struct net_device *netdev) @@ -136,7 +139,25 @@ ipa_start_xmit(struct sk_buff *skb, struct net_device *netdev) if (endpoint->config.qmap && skb->protocol != htons(ETH_P_MAP)) goto err_drop_skb; - /* The hardware must be powered for us to transmit */ + /* The hardware must be powered for us to transmit, so if we're not + * ready we want the network stack to stop queueing until power is + * ACTIVE. Once runtime resume has completed, we inform the network + * stack it's OK to try transmitting again. + * + * We learn from pm_runtime_get() whether the hardware is powered. + * If it was not, powering up is either started or already underway. + * And in that case we want to disable queueing, expecting it to be + * re-enabled once power is ACTIVE. But runtime PM and network + * transmit run concurrently, and if we're not careful the requests + * to stop and start queueing could occur in the wrong order. + * + * For that reason we *always* stop queueing here, *before* the call + * to pm_runtime_get(). If we determine here that power is ACTIVE, + * we restart queueing before transmitting the SKB. Otherwise + * queueing will eventually be enabled after resume completes. + */ + ipa_power_modem_queue_stop(ipa); + dev = &ipa->pdev->dev; ret = pm_runtime_get(dev); if (ret < 1) { @@ -147,12 +168,6 @@ ipa_start_xmit(struct sk_buff *skb, struct net_device *netdev) goto err_drop_skb; } - /* No power (yet). Stop the network stack from transmitting - * until we're resumed; ipa_modem_resume() arranges for the - * TX queue to be started again. - */ - ipa_power_modem_queue_stop(ipa); - pm_runtime_put_noidle(dev); return NETDEV_TX_BUSY; diff --git a/drivers/net/ipa/ipa_power.c b/drivers/net/ipa/ipa_power.c index e223886123cea..f1802448ff447 100644 --- a/drivers/net/ipa/ipa_power.c +++ b/drivers/net/ipa/ipa_power.c @@ -233,28 +233,32 @@ void ipa_power_suspend_handler(struct ipa *ipa, enum ipa_irq_id irq_id) ipa_interrupt_suspend_clear_all(ipa->interrupt); } -/* The next few functions coordinate stopping and starting the modem +/* The next few functions are used when stopping and starting the modem * network device transmit queue. * - * Transmit can be running concurrent with power resume, and there's a - * chance the resume completes before the transmit path stops the queue, - * leaving the queue in a stopped state. The next two functions are used - * to avoid this: ipa_power_modem_queue_stop() is used by ipa_start_xmit() - * to conditionally stop the TX queue; and ipa_power_modem_queue_start() - * is used by ipa_runtime_resume() to conditionally restart it. + * Transmit can run concurrent with power resume. When transmitting, + * we disable further transmits until we can determine whether power + * is ACTIVE. If it is, future transmits are re-enabled and the buffer + * gets sent (or dropped). If power is not ACTIVE, it will eventually + * be, and transmits stay disabled until after it is. * - * Two flags and a spinlock are used. If the queue is stopped, the STOPPED - * power flag is set. And if the queue is started, the STARTED flag is set. - * The queue is only started on resume if the STOPPED flag is set. And the - * queue is only started in ipa_start_xmit() if the STARTED flag is *not* - * set. As a result, the queue remains operational if the two activites - * happen concurrently regardless of the order they complete. The spinlock - * ensures the flag and TX queue operations are done atomically. + * Two flags and a spinlock are used when managing this. If the queue + * is stopped, the STOPPED power flag is set. And if the queue is + * started, the STARTED flag is set. * * The first function stops the modem netdev transmit queue, but only if - * the STARTED flag is *not* set. That flag is cleared if it was set. - * If the queue is stopped, the STOPPED flag is set. This is called only - * from the power ->runtime_resume operation. + * the STARTED flag is *not* set. This previously avoided a race where + * the TX path stops further transmits after power has become ACTIVE. + * The STARTED flag is cleared by this function. + * + * The second function starts the transmit queue, but only if the + * STOPPED flag is set. This avoids enabling transmits repeatedly + * immediately after power has become ACTIVE (not really a big deal). + * If the STOPPED flag was set, it is cleared and the STARTED flag + * is set by this function. + * + * The third function enables transmits again and clears the STARTED + * flag in case it was set, to return it to initial state. */ void ipa_power_modem_queue_stop(struct ipa *ipa) { @@ -291,9 +295,13 @@ void ipa_power_modem_queue_wake(struct ipa *ipa) spin_unlock_irqrestore(&power->spinlock, flags); } -/* This function clears the STARTED flag once the TX queue is operating */ +/* This function is run after power has become ACTIVE. It enables transmits + * again clears the STARTED flag to indicate the TX queue is operating and + * can be stopped again if necessary. + */ void ipa_power_modem_queue_active(struct ipa *ipa) { + netif_wake_queue(ipa->modem_netdev); clear_bit(IPA_POWER_FLAG_STARTED, ipa->power->flags); } From patchwork Tue Jan 30 19:23:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 13537882 Received: from mail-il1-f177.google.com (mail-il1-f177.google.com [209.85.166.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C2B1669D36 for ; Tue, 30 Jan 2024 19:23:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706642595; cv=none; b=BCJ5D7sZC9kuuZH7CbfUhMc7y7BoTw9fAxIrnJjCLFp5jX8rIEYcGqwL8SzUY1BeOyPe9TuL9gzlcNo53gGTpotgbChDETY1zbwhuefpoqKmEka8qJyxjOHSu19VHj4/QKt2GAhK+0HuAGfy1wJYjv/Z9ylTVJ6dCrRLg8TRgLM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706642595; c=relaxed/simple; bh=+TnzQfnLit0kpSjAguftgCxyhTjNa9IGaEhYrQvVloA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Mn+8ZP/f/vecRgMZBfjWWHJPRZjD6pAe3bLF/wfBukAfQRewvjK5FjPPhIxJ3ILjdLVCCNE1iUBaIeBt7YnZNmRn3uRDw8LzqC0nUukUaVN/EGg4c52CtGqPDM0u2EYi4LYFzVcf63lBx3BhNmEgQ6pSokKWwLe0y/oGQIM7ob0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=x/wj4MW6; arc=none smtp.client-ip=209.85.166.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="x/wj4MW6" Received: by mail-il1-f177.google.com with SMTP id e9e14a558f8ab-363903480c1so2486155ab.2 for ; Tue, 30 Jan 2024 11:23:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706642592; x=1707247392; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=gRMkk2KHFWeOmMb+2gZlOcKHN2kce40ZjY+dNp3h38Y=; b=x/wj4MW6DlY8ceXbKfBp/vt4Amf6nK+TVemlKnZ+WnqgzNcXWfvhi+7XP3xX9bGkTq rHvVK75ona8Aw2kG9ps9QYxMz8Z/KOyNlwz62onDItIDOfl3l8Di7nDO01KaLtoYqTA6 7c6tpKEtJ+JHN+IRpofK8bZf2yH8V3xsWGVIJ3/95vEgTs4Eo95wWngyr+Bw5nmHf0p4 mUOd2MEdPXrkdQeWNelcQiq5DGGC4Fpi2DgLNy5i3Va8ZaDlzchWS+L9TB7OmdyxyDhN m7AcPNxKM3PBbj/5eYkcy97ppldj3MB/RqQv+Arp2ZmydFyPbyLEwbYeNeZ+dFx2vdLB E/6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706642592; x=1707247392; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gRMkk2KHFWeOmMb+2gZlOcKHN2kce40ZjY+dNp3h38Y=; b=Jqu2R+bMl4tL+2MFQxNiYW3FSGN92Eq/dHhLUzmbDbNaBKzYpiAz5c53P3raSkFLX3 vW/nkC4ETNFuoT+CL343puIyGOGH/in7758eDFBKXx60p2sZ1r2bZtkkb10dkYeCAIpe /a3KvJfDOTazW9PK7cv+2lVNEZLVYATfw/mbGt4hppluT8f1viANkMjtfiXfgWbbLS0w wmD23WTvUzSfJRkwAUoCytVLLqV2vKANVSa6RWPSfGwiOMradDvdAWX6iaSQdA9cOzOB 4ejWyWVkGZtWggNOsWLnYDr06fb7lupTqchn9jKuAp1XdXUV8JrHO2UQPTUFm0tlmWV+ L1GQ== X-Gm-Message-State: AOJu0YzytF61cFCxHzXXu2Pnp8iyx+tWNC3fn3TmFJrX7ZxPopqooNxO 6oe+xMxdb81n+IGPc5Vjmp58gDqzckJfCsoTHy9iIi6NI0jpqkEm2mnP0faT08U= X-Google-Smtp-Source: AGHT+IFBCPhWifq/hB72NH7fMlf1IbxU0SNJ2rl6hg87kUWODVt1tKwFzOs63eRcZ384nMGuRTzgpA== X-Received: by 2002:a05:6e02:1d15:b0:362:8bdf:45cc with SMTP id i21-20020a056e021d1500b003628bdf45ccmr10985092ila.17.1706642591823; Tue, 30 Jan 2024 11:23:11 -0800 (PST) Received: from localhost.localdomain (c-98-61-227-136.hsd1.mn.comcast.net. [98.61.227.136]) by smtp.gmail.com with ESMTPSA id t18-20020a92c912000000b003637871ec98sm2157762ilp.27.2024.01.30.11.23.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 11:23:11 -0800 (PST) From: Alex Elder To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: mka@chromium.org, andersson@kernel.org, quic_cpratapa@quicinc.com, quic_avuyyuru@quicinc.com, quic_jponduru@quicinc.com, quic_subashab@quicinc.com, elder@kernel.org, netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 3/7] net: ipa: kill the STARTED IPA power flag Date: Tue, 30 Jan 2024 13:23:00 -0600 Message-Id: <20240130192305.250915-4-elder@linaro.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240130192305.250915-1-elder@linaro.org> References: <20240130192305.250915-1-elder@linaro.org> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 A transmit on the modem netdev can only complete if the IPA hardware is powered. Currently, if a transmit request arrives when the hardware was not powered, further transmits are be stopped to allow power-up to complete. Once power-up completes, transmits are once again enabled. Runtime resume can complete at the same time a transmit request is being handled, and previously there was a race between stopping and restarting transmits. The STARTED flag was used to ensure the stop request in the transmit path was skipped if the start request in the runtime resume path had already occurred. Now, the queue is *always* stopped in the transmit path, *before* determining whether power is ACTIVE. If power is found to already be active (or if the socket buffer is gets dropped), transmit is re-enabled. Otherwise it will (always) be enabled after runtime resume completes. The race between transmit and runtime resume no longer exists, so there is no longer any need to maintain the STARTED flag. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_power.c | 47 +++++++++++-------------------------- 1 file changed, 14 insertions(+), 33 deletions(-) diff --git a/drivers/net/ipa/ipa_power.c b/drivers/net/ipa/ipa_power.c index f1802448ff447..509c9bfa648e7 100644 --- a/drivers/net/ipa/ipa_power.c +++ b/drivers/net/ipa/ipa_power.c @@ -39,14 +39,12 @@ * @IPA_POWER_FLAG_RESUMED: Whether resume from suspend has been signaled * @IPA_POWER_FLAG_SYSTEM: Hardware is system (not runtime) suspended * @IPA_POWER_FLAG_STOPPED: Modem TX is disabled by ipa_start_xmit() - * @IPA_POWER_FLAG_STARTED: Modem TX was enabled by ipa_runtime_resume() * @IPA_POWER_FLAG_COUNT: Number of defined power flags */ enum ipa_power_flag { IPA_POWER_FLAG_RESUMED, IPA_POWER_FLAG_SYSTEM, IPA_POWER_FLAG_STOPPED, - IPA_POWER_FLAG_STARTED, IPA_POWER_FLAG_COUNT, /* Last; not a flag */ }; @@ -64,7 +62,7 @@ struct ipa_power { struct device *dev; struct clk *core; struct qmp *qmp; - spinlock_t spinlock; /* used with STOPPED/STARTED power flags */ + spinlock_t spinlock; /* used with STOPPED power flag */ DECLARE_BITMAP(flags, IPA_POWER_FLAG_COUNT); u32 interconnect_count; struct icc_bulk_data interconnect[] __counted_by(interconnect_count); @@ -242,23 +240,16 @@ void ipa_power_suspend_handler(struct ipa *ipa, enum ipa_irq_id irq_id) * gets sent (or dropped). If power is not ACTIVE, it will eventually * be, and transmits stay disabled until after it is. * - * Two flags and a spinlock are used when managing this. If the queue - * is stopped, the STOPPED power flag is set. And if the queue is - * started, the STARTED flag is set. + * A flag and a spinlock are used when managing this. If the queue gets + * stopped, the STOPPED power flag is set. * - * The first function stops the modem netdev transmit queue, but only if - * the STARTED flag is *not* set. This previously avoided a race where - * the TX path stops further transmits after power has become ACTIVE. - * The STARTED flag is cleared by this function. + * The first function stops the modem netdev transmit queue. The second + * function starts the transmit queue, but only if the STOPPED flag is + * set. This avoids enabling transmits repeatedly immediately after + * power has become ACTIVE (not really a big deal). If the STOPPED flag + * was set, it is cleared by this function. * - * The second function starts the transmit queue, but only if the - * STOPPED flag is set. This avoids enabling transmits repeatedly - * immediately after power has become ACTIVE (not really a big deal). - * If the STOPPED flag was set, it is cleared and the STARTED flag - * is set by this function. - * - * The third function enables transmits again and clears the STARTED - * flag in case it was set, to return it to initial state. + * The third function just enables transmits again. */ void ipa_power_modem_queue_stop(struct ipa *ipa) { @@ -267,18 +258,14 @@ void ipa_power_modem_queue_stop(struct ipa *ipa) spin_lock_irqsave(&power->spinlock, flags); - if (!__test_and_clear_bit(IPA_POWER_FLAG_STARTED, power->flags)) { - netif_stop_queue(ipa->modem_netdev); - __set_bit(IPA_POWER_FLAG_STOPPED, power->flags); - } + netif_stop_queue(ipa->modem_netdev); + __set_bit(IPA_POWER_FLAG_STOPPED, power->flags); spin_unlock_irqrestore(&power->spinlock, flags); } /* This function starts the modem netdev transmit queue, but only if the - * STOPPED flag is set. That flag is cleared if it was set. If the queue - * was restarted, the STARTED flag is set; this allows ipa_start_xmit() - * to skip stopping the queue in the event of a race. + * STOPPED flag is set. That flag is cleared if it was set. */ void ipa_power_modem_queue_wake(struct ipa *ipa) { @@ -287,22 +274,16 @@ void ipa_power_modem_queue_wake(struct ipa *ipa) spin_lock_irqsave(&power->spinlock, flags); - if (__test_and_clear_bit(IPA_POWER_FLAG_STOPPED, power->flags)) { - __set_bit(IPA_POWER_FLAG_STARTED, power->flags); + if (__test_and_clear_bit(IPA_POWER_FLAG_STOPPED, power->flags)) netif_wake_queue(ipa->modem_netdev); - } spin_unlock_irqrestore(&power->spinlock, flags); } -/* This function is run after power has become ACTIVE. It enables transmits - * again clears the STARTED flag to indicate the TX queue is operating and - * can be stopped again if necessary. - */ +/* This function enables transmits again after power has become ACTIVE. */ void ipa_power_modem_queue_active(struct ipa *ipa) { netif_wake_queue(ipa->modem_netdev); - clear_bit(IPA_POWER_FLAG_STARTED, ipa->power->flags); } static int ipa_power_retention_init(struct ipa_power *power) From patchwork Tue Jan 30 19:23:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 13537883 Received: from mail-il1-f179.google.com (mail-il1-f179.google.com [209.85.166.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AA0DF71B25 for ; Tue, 30 Jan 2024 19:23:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706642595; cv=none; b=ovveMbuVt19OcxiTfRarXyn155/ZZ6C0AxoHF+vr3qrK3chUgrsiQicAFDca7866E65yIrMhvrkguDrdnWhXYW0jWD4EAGOafAoloJ8+ao+EbRKr0erl927W4w17yN3rIl8vLUz7CFEwlM4fz4/zxE08v3jp+YFldpunUMVhXnI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706642595; c=relaxed/simple; bh=nBJpHsdQ/PLwncdh5oQiwPfYan8A1R4ddZJ4gykm4nY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=HKdyDi0GAHvwrDpNwCtMV71DAMN50dO6v3M0LxzV/e3MrpHCBCpzV8oMT8X5lMwRLiYZAVf3Ht1DVAwc5RYDgomrn7Ck5Sx7OeXQy5Jrus6d/84EYOVDK6aEUFpomOdWtsdKI/YcIa8fDfyFUjFMTpNQJle9JTC4SuwanEaOQvw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=lICQHIZi; arc=none smtp.client-ip=209.85.166.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="lICQHIZi" Received: by mail-il1-f179.google.com with SMTP id e9e14a558f8ab-36383448c6eso5303525ab.1 for ; Tue, 30 Jan 2024 11:23:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706642593; x=1707247393; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=hjwvzGl2HlTyZtAJD2vY621i90e6UJd/mQdml33OvUM=; b=lICQHIZig3+fSeVboMCLkQwXquMjbxqyApMtAyhC6EYIahyqAssOxc3l5Xh82+Y/7h viNq9c9F/R9D3wxo+pKIjoxlTwT5/UmsMwf2gBpe7GSHx0Er4TOI+ki5vdxHKAbBJfAk 0x9oNPWSBln5AUQ7ealW42kVP2UWMtdtcAZqX2M4NAnAjbeIcrIZST+KFWLcIJ3imB1k VW0QgfCks1l5Dm1n8uo41OHJ0XbiyJUw+38Fwsqy4ul4Ya2q42fVvZ3FCdv4Qn+pioLJ FMbS8A9Kd1Wk0kU3BmssK1rVSL9atWPSILEmS0e/RzJtqCgfwVpvZTgf5ww4Tll8ka+M Wl7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706642593; x=1707247393; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hjwvzGl2HlTyZtAJD2vY621i90e6UJd/mQdml33OvUM=; b=QeDsXerLEWizb5RRhZLXa1Lhnm849BC03VVL3n1dB4x3B4W/dAHHr8MH3pLAHyEpcg /UqK+zX+inPuWtBO2YnPOhDGVbHGvUI/Wlq1e+D2XAt+5Rnba8mPVgPosX3DH0iL7JjI 3O8aeWLaqjYbVl6P8c5RXdMyqYc6cVj3H+x1WtW03yY+8vkxw3cJ7C3Cn7IdYFoLnGbE rLwZr5bEE19M5c6PQejbHnGcbr1avDAUi9lSv7jkrIh8Qe/14bljvGPcSDbeV7G3Fist 9cz7ZFQuLyW3WGc4jU0/b/V3FLi9g3pKOFuTRdh34ueS8oBWRJ16OwyVKUBeJ3dk4Ym0 xmhA== X-Gm-Message-State: AOJu0Yw0/CZ+RrXv6/3T4lhXehaJuXVGkHhiFwuGFItT7uhf+iii27YH AKngeC/5m6jY8iDznHFvVog484VAAFdaYOxQGYMn/gHJDtQJF+jExsSm7wljKkU= X-Google-Smtp-Source: AGHT+IEEX08JSTKu1bQZHUgKqSTuLLdfpg9wF1yF0CU6s0PUBv8oh0/fdbjHbtKISFkFj5XV4vrJmg== X-Received: by 2002:a05:6e02:1c26:b0:363:851d:3ba9 with SMTP id m6-20020a056e021c2600b00363851d3ba9mr5433418ilh.7.1706642592895; Tue, 30 Jan 2024 11:23:12 -0800 (PST) Received: from localhost.localdomain (c-98-61-227-136.hsd1.mn.comcast.net. [98.61.227.136]) by smtp.gmail.com with ESMTPSA id t18-20020a92c912000000b003637871ec98sm2157762ilp.27.2024.01.30.11.23.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 11:23:12 -0800 (PST) From: Alex Elder To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: mka@chromium.org, andersson@kernel.org, quic_cpratapa@quicinc.com, quic_avuyyuru@quicinc.com, quic_jponduru@quicinc.com, quic_subashab@quicinc.com, elder@kernel.org, netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 4/7] net: ipa: kill the IPA power STOPPED flag Date: Tue, 30 Jan 2024 13:23:01 -0600 Message-Id: <20240130192305.250915-5-elder@linaro.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240130192305.250915-1-elder@linaro.org> References: <20240130192305.250915-1-elder@linaro.org> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Currently the STOPPED IPA power flag is used to indicate that the transmit queue has been stopped. Previously this was used to avoid setting the STARTED flag unless the queue had already been stopped. It meant transmit queuing would be enabled on resume if it was stopped by the transmit path--and if so, it ensured it only got enabled once. We only stop the transmit queue in the transmit path. The STARTED flag has been removed, and it causes no real harm to enable transmits when they're already enabled. So we can get rid of the STOPPED flag and call netif_wake_queue() unconditionally. This makes the IPA power spinlock unnecessary, so it can be removed as well. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_power.c | 40 +++++-------------------------------- 1 file changed, 5 insertions(+), 35 deletions(-) diff --git a/drivers/net/ipa/ipa_power.c b/drivers/net/ipa/ipa_power.c index 509c9bfa648e7..e615473d23805 100644 --- a/drivers/net/ipa/ipa_power.c +++ b/drivers/net/ipa/ipa_power.c @@ -38,13 +38,11 @@ * enum ipa_power_flag - IPA power flags * @IPA_POWER_FLAG_RESUMED: Whether resume from suspend has been signaled * @IPA_POWER_FLAG_SYSTEM: Hardware is system (not runtime) suspended - * @IPA_POWER_FLAG_STOPPED: Modem TX is disabled by ipa_start_xmit() * @IPA_POWER_FLAG_COUNT: Number of defined power flags */ enum ipa_power_flag { IPA_POWER_FLAG_RESUMED, IPA_POWER_FLAG_SYSTEM, - IPA_POWER_FLAG_STOPPED, IPA_POWER_FLAG_COUNT, /* Last; not a flag */ }; @@ -53,7 +51,6 @@ enum ipa_power_flag { * @dev: IPA device pointer * @core: IPA core clock * @qmp: QMP handle for AOSS communication - * @spinlock: Protects modem TX queue enable/disable * @flags: Boolean state flags * @interconnect_count: Number of elements in interconnect[] * @interconnect: Interconnect array @@ -62,7 +59,6 @@ struct ipa_power { struct device *dev; struct clk *core; struct qmp *qmp; - spinlock_t spinlock; /* used with STOPPED power flag */ DECLARE_BITMAP(flags, IPA_POWER_FLAG_COUNT); u32 interconnect_count; struct icc_bulk_data interconnect[] __counted_by(interconnect_count); @@ -240,47 +236,22 @@ void ipa_power_suspend_handler(struct ipa *ipa, enum ipa_irq_id irq_id) * gets sent (or dropped). If power is not ACTIVE, it will eventually * be, and transmits stay disabled until after it is. * - * A flag and a spinlock are used when managing this. If the queue gets - * stopped, the STOPPED power flag is set. - * * The first function stops the modem netdev transmit queue. The second - * function starts the transmit queue, but only if the STOPPED flag is - * set. This avoids enabling transmits repeatedly immediately after - * power has become ACTIVE (not really a big deal). If the STOPPED flag - * was set, it is cleared by this function. - * - * The third function just enables transmits again. + * function starts the transmit queue and is used in the power resume + * path after power has become ACTIVE. The third function also enables + * transmits again, and is used by ipa_start_xmit() once it knows power + * is active. */ void ipa_power_modem_queue_stop(struct ipa *ipa) { - struct ipa_power *power = ipa->power; - unsigned long flags; - - spin_lock_irqsave(&power->spinlock, flags); - netif_stop_queue(ipa->modem_netdev); - __set_bit(IPA_POWER_FLAG_STOPPED, power->flags); - - spin_unlock_irqrestore(&power->spinlock, flags); } -/* This function starts the modem netdev transmit queue, but only if the - * STOPPED flag is set. That flag is cleared if it was set. - */ void ipa_power_modem_queue_wake(struct ipa *ipa) { - struct ipa_power *power = ipa->power; - unsigned long flags; - - spin_lock_irqsave(&power->spinlock, flags); - - if (__test_and_clear_bit(IPA_POWER_FLAG_STOPPED, power->flags)) - netif_wake_queue(ipa->modem_netdev); - - spin_unlock_irqrestore(&power->spinlock, flags); + netif_wake_queue(ipa->modem_netdev); } -/* This function enables transmits again after power has become ACTIVE. */ void ipa_power_modem_queue_active(struct ipa *ipa) { netif_wake_queue(ipa->modem_netdev); @@ -374,7 +345,6 @@ ipa_power_init(struct device *dev, const struct ipa_power_data *data) } power->dev = dev; power->core = clk; - spin_lock_init(&power->spinlock); power->interconnect_count = data->interconnect_count; ret = ipa_interconnect_init(power, data->interconnect_data); From patchwork Tue Jan 30 19:23:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 13537884 Received: from mail-il1-f177.google.com (mail-il1-f177.google.com [209.85.166.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E36FF71B50 for ; Tue, 30 Jan 2024 19:23:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706642596; cv=none; b=Dyp47Couj1YPIdVTjbkIR7HUJN++3qNNT5KnTABpNoOdVGwjrymjneqs4L4ajIb4UVx7RhCY2epkuKE4N3QUbbsHJpe1LA81r0Xpdv144ZfIJQ4AxXXAQVcWKFpKXTIA5H9nz0CF739ji/1pql2UTeVcwbfTmvq0AQ9qN2dOOEE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706642596; c=relaxed/simple; bh=jBO1cJLAzJvxydUlAaWg5DMbUYAHb2xvJeVHkg5712o=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=HXljD1WPeeek+47/6tOeRxgC3iNqFZDrxIvmjvLO9ahKMgCzQplb1LAqYnQReGDv++l4xiG83KmP9yPoQKS/3EknZLHKBywh0jbcaqwpK4E9FRQlBUIc1hpyFTDj1ewfVMVN2YVyLblL+QGZ7dAG4rfVah0maXtTmNbRny3SQuw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=E3cq155t; arc=none smtp.client-ip=209.85.166.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="E3cq155t" Received: by mail-il1-f177.google.com with SMTP id e9e14a558f8ab-3638e3ace68so3415725ab.2 for ; Tue, 30 Jan 2024 11:23:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706642594; x=1707247394; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=gOhxvtNzhkLmYjC1tnizOtWKQi1p2qd3Rj843Voiz6E=; b=E3cq155tGSp9HDJ4BhL+90QiqMfSGYpisq3g0id/AUpYfV1wsNWvEFHb2gMQ6QGGD/ QVnTRuAlVnvauJ3OW9RTxwIWCew2idoLcVd4zLhW5S7kn4I6cN0Csjes/PZLXYqEOi6/ rtCiHIF94MiA/Not3W+saLFvMckQepncBr+1rjUp/G45yMEDMy9FrSbEQ0lIYxdbxrPF CVGphRGS1LW+KKN3I4YeenvdZMUV9JUux10KKwShFku/D9WmfveqOD6n4seEhXzwm+df YE7sr3Qi2fH8oWTZdXVG5XeIikFxy0AOrkNfxPbFJUgBjf1/coV/shCVS41Qa7aczWZF 4hhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706642594; x=1707247394; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gOhxvtNzhkLmYjC1tnizOtWKQi1p2qd3Rj843Voiz6E=; b=ZiLa62Ix+XqM8IF8TILzG1vfNSHdnso3sV4Ulkblr+Eekj3Eza0/dJ/jZPVF03dSxz NWWJcnP3kFGmPERcJ9VFpT69EWsSMQjYm5WXcSxaMN9le04Ck0tnLVeN3/8xVu2eAI4H XzEjqZ1Tz4PHsKi+1TJZLz0IOAh0cxDMfL+jo0yb1ZQe2FPgWuw/VRBhRhtjoeNRvwgh NZKPlH7NzGCYf4kRgV8n3RwfZ49YqH7ayOw04o94A3OjM+7O8DJwW9sYRkJlzA9yDJ2a cVTzLY8IwF6XfUu7UAR6/djV1cv1U8QuRK+jpvUQkHbLNuA4SyFCpbm/hZTnoO85XCdQ BQ2g== X-Gm-Message-State: AOJu0Yxo3o00OXl7NViYfti3RKZtVdB2wtJG49FpE6Egi2L6PTWKK9kZ B4TpQJM9586I6flvPXkkuWTNM8kbjaef9YD3SxIOdCeU0/GYXxTwlbMMXcXQtjo= X-Google-Smtp-Source: AGHT+IFLEQJ0CbPE//J6M61ZPnMP8knVS5QrP9l2/1ejcnf+kamfDvPrxUNK02FIKmDuP7TOTr3MjA== X-Received: by 2002:a05:6e02:1c03:b0:363:8727:ddd1 with SMTP id l3-20020a056e021c0300b003638727ddd1mr5281023ilh.13.1706642593982; Tue, 30 Jan 2024 11:23:13 -0800 (PST) Received: from localhost.localdomain (c-98-61-227-136.hsd1.mn.comcast.net. [98.61.227.136]) by smtp.gmail.com with ESMTPSA id t18-20020a92c912000000b003637871ec98sm2157762ilp.27.2024.01.30.11.23.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 11:23:13 -0800 (PST) From: Alex Elder To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: mka@chromium.org, andersson@kernel.org, quic_cpratapa@quicinc.com, quic_avuyyuru@quicinc.com, quic_jponduru@quicinc.com, quic_subashab@quicinc.com, elder@kernel.org, netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 5/7] net: ipa: kill ipa_power_modem_queue_stop() Date: Tue, 30 Jan 2024 13:23:02 -0600 Message-Id: <20240130192305.250915-6-elder@linaro.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240130192305.250915-1-elder@linaro.org> References: <20240130192305.250915-1-elder@linaro.org> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 All ipa_power_modem_queue_stop() does now is call netif_stop_queue(). Just call netif_stop_queue() in the one place it's needed, and get rid of ipa_power_modem_queue_stop(). Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_modem.c | 2 +- drivers/net/ipa/ipa_power.c | 16 +++++----------- drivers/net/ipa/ipa_power.h | 6 ------ 3 files changed, 6 insertions(+), 18 deletions(-) diff --git a/drivers/net/ipa/ipa_modem.c b/drivers/net/ipa/ipa_modem.c index c7a0b167c4326..08e1202f12863 100644 --- a/drivers/net/ipa/ipa_modem.c +++ b/drivers/net/ipa/ipa_modem.c @@ -156,7 +156,7 @@ ipa_start_xmit(struct sk_buff *skb, struct net_device *netdev) * we restart queueing before transmitting the SKB. Otherwise * queueing will eventually be enabled after resume completes. */ - ipa_power_modem_queue_stop(ipa); + netif_stop_queue(netdev); dev = &ipa->pdev->dev; ret = pm_runtime_get(dev); diff --git a/drivers/net/ipa/ipa_power.c b/drivers/net/ipa/ipa_power.c index e615473d23805..812359c7977da 100644 --- a/drivers/net/ipa/ipa_power.c +++ b/drivers/net/ipa/ipa_power.c @@ -227,7 +227,7 @@ void ipa_power_suspend_handler(struct ipa *ipa, enum ipa_irq_id irq_id) ipa_interrupt_suspend_clear_all(ipa->interrupt); } -/* The next few functions are used when stopping and starting the modem +/* The next two functions are used when stopping and starting the modem * network device transmit queue. * * Transmit can run concurrent with power resume. When transmitting, @@ -236,17 +236,11 @@ void ipa_power_suspend_handler(struct ipa *ipa, enum ipa_irq_id irq_id) * gets sent (or dropped). If power is not ACTIVE, it will eventually * be, and transmits stay disabled until after it is. * - * The first function stops the modem netdev transmit queue. The second - * function starts the transmit queue and is used in the power resume - * path after power has become ACTIVE. The third function also enables - * transmits again, and is used by ipa_start_xmit() once it knows power - * is active. + * The first function starts the transmit queue and is used in the power + * resume path after power has become ACTIVE. The second function also + * enables transmits again, and is used by ipa_start_xmit() once it + * knows power is active. */ -void ipa_power_modem_queue_stop(struct ipa *ipa) -{ - netif_stop_queue(ipa->modem_netdev); -} - void ipa_power_modem_queue_wake(struct ipa *ipa) { netif_wake_queue(ipa->modem_netdev); diff --git a/drivers/net/ipa/ipa_power.h b/drivers/net/ipa/ipa_power.h index 3a4c59ea1222b..f51653399a07d 100644 --- a/drivers/net/ipa/ipa_power.h +++ b/drivers/net/ipa/ipa_power.h @@ -23,12 +23,6 @@ extern const struct dev_pm_ops ipa_pm_ops; */ u32 ipa_core_clock_rate(struct ipa *ipa); -/** - * ipa_power_modem_queue_stop() - Possibly stop the modem netdev TX queue - * @ipa: IPA pointer - */ -void ipa_power_modem_queue_stop(struct ipa *ipa); - /** * ipa_power_modem_queue_wake() - Possibly wake the modem netdev TX queue * @ipa: IPA pointer From patchwork Tue Jan 30 19:23:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 13537885 Received: from mail-io1-f49.google.com (mail-io1-f49.google.com [209.85.166.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E4845762D9 for ; Tue, 30 Jan 2024 19:23:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706642597; cv=none; b=Sh37JsK4z99pX4H7jQZjibP0r0v+ByX6028g8aHVrR2O8WzO8xlDcA+8Oq18Mm/LBwjDIc2Y2+vJ0AWt+rtBKR1sJ2FEvnHAImuqFlC7T7eErIlBoAYr2d0tpCVg2LZW1/54rvaDBEaabeSvqO++tfs3BRsfB4j44auFLJWW5wk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706642597; c=relaxed/simple; bh=+FFIhfz+wht4oy3l8eUjZbOK8wsGYZs+xBRBM4HyGT4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ArS+zU6OH+QYEVMCfVwxwvNnXQtonbYX02aHO5vZAigqvC6Pizp3sAOEdfva5jTAf3nd3kCYGQNsTLt5S3WHKS7Fa7lKRKtxk5fpfKEzqpscmKwm+8GtsWj66drzTUKv0BqJEByTYnc13mdN5Ii7R9tEWEEXyaf3PsVtPiHWBAQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=fr0FtgQW; arc=none smtp.client-ip=209.85.166.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="fr0FtgQW" Received: by mail-io1-f49.google.com with SMTP id ca18e2360f4ac-7ba9f1cfe94so4377739f.1 for ; Tue, 30 Jan 2024 11:23:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706642595; x=1707247395; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=OFNwh/INCdzrt9jHygu6RrRsOD2iFwLpFavhX93NdeY=; b=fr0FtgQWDHEPW8kNK6BHjKKi8jzYClvXuitu2oed7ODxu+6te08K9O/PNLvPX8avOT 1lRPMHojtqxP1sZewx1IJQDACkVYPyg5uPQHtF6IvWSv/70bY+Ts65481gA8ihYrh7Rj BJ49A68MshUHWGTfbgMKomgrADRMJyJuURl2VkLrNYHnQhehFtL2kP8LOkwB1UF9NdQB P7rhtTD9BKESjkj9EJUzgtfglqd/FhaVGU+ToUg3vc1+vooIH661kAf9AYXxB1b06VPC E8ypoepiUGcdJaDu5ojLwKD9QsSTfGWkp/vYpbv0DejYSF4nD5lZ4TTDCRkFh+S+20b0 SV6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706642595; x=1707247395; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OFNwh/INCdzrt9jHygu6RrRsOD2iFwLpFavhX93NdeY=; b=f4C2AQNtidrRnJsE5N0WBjpXGAScRpRtPtSPBGvyddtWmA2hTxnAItKa2zeP+hMTYT Nhn4kHb420WjhgclO+VR6pb318oKcwqXiUd02BQqpVR7jOzjbBAmHks1TVQMJ21F5UvB DQK7SGJRU/jGPrs5bJvGhpbFcSHBl8LFT6OyZB/y0HUzVuU8sq0YGj2mdFq2bekg+yeH kSavAU75w3xueD2um1l3AmMVlpOcO2I82RWGu6+tucQGzEZSDazPwqbPxY5UwAkj9vFh IILU0u/V6BbaGPyclDx4cQLXtqJ5TDMpdQ+wTK1N6DJCs4NVZjUGTka2wWtW+CTXV/xQ x5XA== X-Gm-Message-State: AOJu0YzBmbtTFn+ip11Tz4MBug27bsWVv9Tx4P8l6io+0wVOZsw7mAmc dS95ZLls7EU6tXiSTyse1VGXilcVp2j4gvn0oCsGmnd1nP/g59SCI/ppnoiz5ac= X-Google-Smtp-Source: AGHT+IGP1g36KE5GUEDOa7/UU/iZU4CYUrtPGHdO6oAyW2nko+/0uASnekl2k0ybQr3KQ0knQ0sRqg== X-Received: by 2002:a92:d6d2:0:b0:363:78a6:9fea with SMTP id z18-20020a92d6d2000000b0036378a69feamr1659639ilp.11.1706642595057; Tue, 30 Jan 2024 11:23:15 -0800 (PST) Received: from localhost.localdomain (c-98-61-227-136.hsd1.mn.comcast.net. [98.61.227.136]) by smtp.gmail.com with ESMTPSA id t18-20020a92c912000000b003637871ec98sm2157762ilp.27.2024.01.30.11.23.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 11:23:14 -0800 (PST) From: Alex Elder To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: mka@chromium.org, andersson@kernel.org, quic_cpratapa@quicinc.com, quic_avuyyuru@quicinc.com, quic_jponduru@quicinc.com, quic_subashab@quicinc.com, elder@kernel.org, netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 6/7] net: ipa: kill ipa_power_modem_queue_active() Date: Tue, 30 Jan 2024 13:23:03 -0600 Message-Id: <20240130192305.250915-7-elder@linaro.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240130192305.250915-1-elder@linaro.org> References: <20240130192305.250915-1-elder@linaro.org> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 All ipa_power_modem_queue_active() does now is call netif_wake_queue(). Just call netif_wake_queue() in the two places it's needed, and get rid of ipa_power_modem_queue_active(). Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_modem.c | 4 ++-- drivers/net/ipa/ipa_power.c | 19 ++++--------------- drivers/net/ipa/ipa_power.h | 6 ------ 3 files changed, 6 insertions(+), 23 deletions(-) diff --git a/drivers/net/ipa/ipa_modem.c b/drivers/net/ipa/ipa_modem.c index 08e1202f12863..0c298060468eb 100644 --- a/drivers/net/ipa/ipa_modem.c +++ b/drivers/net/ipa/ipa_modem.c @@ -163,7 +163,7 @@ ipa_start_xmit(struct sk_buff *skb, struct net_device *netdev) if (ret < 1) { /* If a resume won't happen, just drop the packet */ if (ret < 0 && ret != -EINPROGRESS) { - ipa_power_modem_queue_active(ipa); + netif_wake_queue(netdev); pm_runtime_put_noidle(dev); goto err_drop_skb; } @@ -173,7 +173,7 @@ ipa_start_xmit(struct sk_buff *skb, struct net_device *netdev) return NETDEV_TX_BUSY; } - ipa_power_modem_queue_active(ipa); + netif_wake_queue(netdev); ret = ipa_endpoint_skb_tx(endpoint, skb); diff --git a/drivers/net/ipa/ipa_power.c b/drivers/net/ipa/ipa_power.c index 812359c7977da..fd2abce043fa5 100644 --- a/drivers/net/ipa/ipa_power.c +++ b/drivers/net/ipa/ipa_power.c @@ -227,30 +227,19 @@ void ipa_power_suspend_handler(struct ipa *ipa, enum ipa_irq_id irq_id) ipa_interrupt_suspend_clear_all(ipa->interrupt); } -/* The next two functions are used when stopping and starting the modem - * network device transmit queue. - * - * Transmit can run concurrent with power resume. When transmitting, +/* Transmit can run concurrent with power resume. When transmitting, * we disable further transmits until we can determine whether power * is ACTIVE. If it is, future transmits are re-enabled and the buffer * gets sent (or dropped). If power is not ACTIVE, it will eventually - * be, and transmits stay disabled until after it is. - * - * The first function starts the transmit queue and is used in the power - * resume path after power has become ACTIVE. The second function also - * enables transmits again, and is used by ipa_start_xmit() once it - * knows power is active. + * be, and transmits stay disabled until after it is. This function + * starts the transmit queue and is used in the power resume path after + * power has become ACTIVE. */ void ipa_power_modem_queue_wake(struct ipa *ipa) { netif_wake_queue(ipa->modem_netdev); } -void ipa_power_modem_queue_active(struct ipa *ipa) -{ - netif_wake_queue(ipa->modem_netdev); -} - static int ipa_power_retention_init(struct ipa_power *power) { struct qmp *qmp = qmp_get(power->dev); diff --git a/drivers/net/ipa/ipa_power.h b/drivers/net/ipa/ipa_power.h index f51653399a07d..dcd36a6a718f2 100644 --- a/drivers/net/ipa/ipa_power.h +++ b/drivers/net/ipa/ipa_power.h @@ -29,12 +29,6 @@ u32 ipa_core_clock_rate(struct ipa *ipa); */ void ipa_power_modem_queue_wake(struct ipa *ipa); -/** - * ipa_power_modem_queue_active() - Report modem netdev TX queue active - * @ipa: IPA pointer - */ -void ipa_power_modem_queue_active(struct ipa *ipa); - /** * ipa_power_retention() - Control register retention on power collapse * @ipa: IPA pointer From patchwork Tue Jan 30 19:23:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 13537886 Received: from mail-il1-f182.google.com (mail-il1-f182.google.com [209.85.166.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1D74A7AE5E for ; Tue, 30 Jan 2024 19:23:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706642598; cv=none; b=k8McZwb7T9Xv1BtciOjufXGvicFiiB2cCXNIp/74ikfe04hdhSvYkjbZT315Nkv0CSxd9ta3M4LExa6b0OkrrVwxUPl9NXLzrtW/2FFdAqwSAqSdyher+HNNhyzkYKLHNF8f6CVk1jWpUh3FhztqeeAJNdADfj22OMph1fTD+z8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706642598; c=relaxed/simple; bh=svy2Y/cgyQ7iZi2hQoEHT6Pbe1rIEc4pAjdeVhTs3Xk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Gja3Et81hytD2ljktILchZ+vhTE1PVPpqIdhPdXmN9Z77tNytJIcXGqJtUUwp1U5z34SmG8Arsa1m6wLWPxYAGQMzAvYP4ckVTw7JMc5r7wx0jpqwAVtrQtfEKRJiTeziulDtVO19oGTHhi7kq7S7kPZHcB0kr1p9S3u+ei6Ep0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=QeSnJgc2; arc=none smtp.client-ip=209.85.166.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="QeSnJgc2" Received: by mail-il1-f182.google.com with SMTP id e9e14a558f8ab-3638f07f2a3so2949715ab.2 for ; Tue, 30 Jan 2024 11:23:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706642596; x=1707247396; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=sjtwPzfATFl6gd93BqfU7z6ovF0ULYud2+oCqQjCPeY=; b=QeSnJgc2CqUVatkdfVoNIwshLBxqYad2FXUlpqPdj5n3cfKBKplr7UswjUVL9bNShw 4q2ckUOHvBMsrxyLQnPEz9Nvgu3TQ69SMJTQOONbFez9Wm94qZLP3bTlQl9E5fpukhEe pRM37nfIWLRLuvK0o8qyM/Wce5Hl4B8RLHcAfLGe6IyqedNEShK68P4PMzlzWHMhpl+C ucBO65MiXVLY4NXBag7Z49huPKpOBRD9UzqhBkqEudfwQgzqYvNyY1y7mtaJQi7ExyPL /ms1gnuQfVBWrntDSZ6nP45KJocZ8Sr0aSjKRZ2BDAMflLHeAiOTkRGur4ec5EOvekj7 aYKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706642596; x=1707247396; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sjtwPzfATFl6gd93BqfU7z6ovF0ULYud2+oCqQjCPeY=; b=vTHhD1QqvGQjhfsFWnX/EF8Sz+I26kaapw6epjp7gf/mM0oSc3KEO1uoi6LROccpTw oehhpKpz9JxDuV5Tgb9hlou5ECIIj+p7luLwFkEEDkgEf7obGEMEF3NDWw1bAezU+2BB kCwozZZ5F7zox79/Ujkw3j4XJrYtzlffRa1NpkS7xKBolrszIc0Kw3MGFzEkeVbMa7nk 1VFgCU2PeyeD11H8tzrxfLZl3+W+cbJb/02sAZ6awMmBwyuBBmYgSnQMcpQcqvsX9W+L T/+TbY0dJhdNTkK3ENOqTsMfP/J7td0ySo26WV2r2T7P8FclbT79SRpTKZ7j6NyOsBg7 H5eg== X-Gm-Message-State: AOJu0YxRTc9dPJwNBBe/J8/4IpCUm7n98mHcc3UJlTaGsWys6V42ZKdw KNQRcWTZjkzo5cuE8gi+Tu3Su7PXPrip7SrLkCrPjko/ImMJdozOp0z+bcrbTLk= X-Google-Smtp-Source: AGHT+IGMJFkq2oSExjhyhojj9ERT7X94COzELPYpHP3ZGYxq79rTjtGtAIdVOacbYS0g3wHQy0Dalg== X-Received: by 2002:a05:6e02:eeb:b0:363:90c2:228f with SMTP id j11-20020a056e020eeb00b0036390c2228fmr1764028ilk.27.1706642596134; Tue, 30 Jan 2024 11:23:16 -0800 (PST) Received: from localhost.localdomain (c-98-61-227-136.hsd1.mn.comcast.net. [98.61.227.136]) by smtp.gmail.com with ESMTPSA id t18-20020a92c912000000b003637871ec98sm2157762ilp.27.2024.01.30.11.23.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 11:23:15 -0800 (PST) From: Alex Elder To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: mka@chromium.org, andersson@kernel.org, quic_cpratapa@quicinc.com, quic_avuyyuru@quicinc.com, quic_jponduru@quicinc.com, quic_subashab@quicinc.com, elder@kernel.org, netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 7/7] net: ipa: kill ipa_power_modem_queue_wake() Date: Tue, 30 Jan 2024 13:23:04 -0600 Message-Id: <20240130192305.250915-8-elder@linaro.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240130192305.250915-1-elder@linaro.org> References: <20240130192305.250915-1-elder@linaro.org> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 All ipa_power_modem_queue_wake() does is call netif_wake_queue() on the modem netdev. There is no need to wrap that call in a trivial function (and certainly not one defined in "ipa_power.c"). So get rid of ipa_power_modem_queue_wake(), and replace its one caller with a direct call to netif_wake_queue(). Determine the netdev pointer to use from the private TX endpoint's netdev pointer. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_modem.c | 2 +- drivers/net/ipa/ipa_power.c | 13 ------------- drivers/net/ipa/ipa_power.h | 6 ------ 3 files changed, 1 insertion(+), 20 deletions(-) diff --git a/drivers/net/ipa/ipa_modem.c b/drivers/net/ipa/ipa_modem.c index 0c298060468eb..1d1be92fbebcb 100644 --- a/drivers/net/ipa/ipa_modem.c +++ b/drivers/net/ipa/ipa_modem.c @@ -277,7 +277,7 @@ static void ipa_modem_wake_queue_work(struct work_struct *work) { struct ipa_priv *priv = container_of(work, struct ipa_priv, work); - ipa_power_modem_queue_wake(priv->ipa); + netif_wake_queue(priv->tx->netdev); } /** ipa_modem_resume() - resume callback for runtime_pm diff --git a/drivers/net/ipa/ipa_power.c b/drivers/net/ipa/ipa_power.c index fd2abce043fa5..128a816f65237 100644 --- a/drivers/net/ipa/ipa_power.c +++ b/drivers/net/ipa/ipa_power.c @@ -227,19 +227,6 @@ void ipa_power_suspend_handler(struct ipa *ipa, enum ipa_irq_id irq_id) ipa_interrupt_suspend_clear_all(ipa->interrupt); } -/* Transmit can run concurrent with power resume. When transmitting, - * we disable further transmits until we can determine whether power - * is ACTIVE. If it is, future transmits are re-enabled and the buffer - * gets sent (or dropped). If power is not ACTIVE, it will eventually - * be, and transmits stay disabled until after it is. This function - * starts the transmit queue and is used in the power resume path after - * power has become ACTIVE. - */ -void ipa_power_modem_queue_wake(struct ipa *ipa) -{ - netif_wake_queue(ipa->modem_netdev); -} - static int ipa_power_retention_init(struct ipa_power *power) { struct qmp *qmp = qmp_get(power->dev); diff --git a/drivers/net/ipa/ipa_power.h b/drivers/net/ipa/ipa_power.h index dcd36a6a718f2..718aacf5e2b23 100644 --- a/drivers/net/ipa/ipa_power.h +++ b/drivers/net/ipa/ipa_power.h @@ -23,12 +23,6 @@ extern const struct dev_pm_ops ipa_pm_ops; */ u32 ipa_core_clock_rate(struct ipa *ipa); -/** - * ipa_power_modem_queue_wake() - Possibly wake the modem netdev TX queue - * @ipa: IPA pointer - */ -void ipa_power_modem_queue_wake(struct ipa *ipa); - /** * ipa_power_retention() - Control register retention on power collapse * @ipa: IPA pointer