Skip to contentSkip to conversation

net: ipa: three bug fixes

PATCH In review Alex Elder 2 participants 5 messages Jun 30, 2020

Subsystems (3)
lore
Share & tools
lore

Alex Elder

author
#0 lore raw

v2 cover net: ipa: three bug fixes

This series contains three bug fixes for the Qualcomm IPA driver. In practice these bugs are unlikke.y to be harmful, but they do represent incorrect code.

Version 2 adds "Fixes" tags to two of the patches and fixes a typo in one (found by checkpatch.pl).

-Alex

Alex Elder (3):
net: ipa: always check for stopped channel
net: ipa: no checksum offload for SDM845 LAN RX
net: ipa: introduce ipa_cmd_tag_process()

 drivers/net/ipa/gsi.c             | 16 +++++++---------
 drivers/net/ipa/ipa_cmd.c         | 15 +++++++++++++++
 drivers/net/ipa/ipa_cmd.h         |  8 ++++++++
 drivers/net/ipa/ipa_data-sdm845.c |  1 -
 drivers/net/ipa/ipa_endpoint.c    |  2 ++
 5 files changed, 32 insertions(+), 10 deletions(-)
Signature · 1 line
2.25.1
author
#1 lore raw

PATCH v2 1/3 net: ipa: always check for stopped channel

In gsi_channel_stop(), there's a check to see if the channel might have entered STOPPED state since a previous call, which might have timed out before stopping completed.

That check actually belongs in gsi_channel_stop_command(), which is called repeatedly by gsi_channel_stop() for RX channels.

Fixes 650d1603825d ("soc: qcom: ipa: the generic software interface")

---
v2: Added "Fixes" tag.

 drivers/net/ipa/gsi.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)
drivers/net/ipa/gsi.c +7 -9
index 55226b264e3c..ac7e5a04c8ac 100644
@@ -500,6 +500,13 @@ static int gsi_channel_stop_command(struct gsi_channel *channel)
 	int ret;
 
 	state = gsi_channel_state(channel);
+
+	/* Channel could have entered STOPPED state since last call
+	 * if it timed out.  If so, we're done.
+	 */
+	if (state == GSI_CHANNEL_STATE_STOPPED)
+		return 0;
+
 	if (state != GSI_CHANNEL_STATE_STARTED &&
 	    state != GSI_CHANNEL_STATE_STOP_IN_PROC)
 		return -EINVAL;
@@ -789,20 +796,11 @@ int gsi_channel_start(struct gsi *gsi, u32 channel_id)
 int gsi_channel_stop(struct gsi *gsi, u32 channel_id)
 {
 	struct gsi_channel *channel = &gsi->channel[channel_id];
-	enum gsi_channel_state state;
 	u32 retries;
 	int ret;
 
 	gsi_channel_freeze(channel);
 
-	/* Channel could have entered STOPPED state since last call if the
-	 * STOP command timed out.  We won't stop a channel if stopping it
-	 * was successful previously (so we still want the freeze above).
-	 */
-	state = gsi_channel_state(channel);
-	if (state == GSI_CHANNEL_STATE_STOPPED)
-		return 0;
-
 	/* RX channels might require a little time to enter STOPPED state */
 	retries = channel->toward_ipa ? 0 : GSI_CHANNEL_STOP_RX_RETRIES;
 
Signature · 1 line
2.25.1
author
#2 lore raw

PATCH v2 2/3 net: ipa: no checksum offload for SDM845 LAN RX

In reply to Alex Elder

The AP LAN RX endpoint should not have download checksum offload enabled.

The receive handler does properly accommodate the trailer that's added by the hardware, but we ignore it.

Fixes 1ed7d0c0fdba ("soc: qcom: ipa: configuration data")

---
v2: Fixed typo in description, and added "Fixes" tag.

 drivers/net/ipa/ipa_data-sdm845.c | 1 -
 1 file changed, 1 deletion(-)
drivers/net/ipa/ipa_data-sdm845.c +0 -1
index 52d4b84e0dac..de2768d71ab5 100644
@@ -44,7 +44,6 @@ static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = {
 		.endpoint = {
 			.seq_type	= IPA_SEQ_INVALID,
 			.config = {
-				.checksum	= true,
 				.aggregation	= true,
 				.status_enable	= true,
 				.rx = {
Signature · 1 line
2.25.1
author
#3 lore raw

PATCH v2 3/3 net: ipa: introduce ipa_cmd_tag_process()

In reply to Alex Elder

Create a new function ipa_cmd_tag_process() that simply allocates a transaction, adds a tag process command to it to clear the hardware pipeline, and commits the transaction.

Call it in from ipa_endpoint_suspend(), after suspending the modem endpoints but before suspending the AP command TX and AP LAN RX endpoints (which are used by the tag sequence).

---
v2: No change from v1.

 drivers/net/ipa/ipa_cmd.c      | 15 +++++++++++++++
 drivers/net/ipa/ipa_cmd.h      |  8 ++++++++
 drivers/net/ipa/ipa_endpoint.c |  2 ++
 3 files changed, 25 insertions(+)
drivers/net/ipa/ipa_cmd.c +15 -0
index c9ab865e7290..d92dd3f09b73 100644
@@ -586,6 +586,21 @@ u32 ipa_cmd_tag_process_count(void)
 	return 4;
 }
 
+void ipa_cmd_tag_process(struct ipa *ipa)
+{
+	u32 count = ipa_cmd_tag_process_count();
+	struct gsi_trans *trans;
+
+	trans = ipa_cmd_trans_alloc(ipa, count);
+	if (trans) {
+		ipa_cmd_tag_process_add(trans);
+		gsi_trans_commit_wait(trans);
+	} else {
+		dev_err(&ipa->pdev->dev,
+			"error allocating %u entry tag transaction\n", count);
+	}
+}
+
 static struct ipa_cmd_info *
 ipa_cmd_info_alloc(struct ipa_endpoint *endpoint, u32 tre_count)
 {
drivers/net/ipa/ipa_cmd.h +8 -0
index e440aa69c8b5..1a646e0264a0 100644
@@ -171,6 +171,14 @@ void ipa_cmd_tag_process_add(struct gsi_trans *trans);
  */
 u32 ipa_cmd_tag_process_count(void);
 
+/**
+ * ipa_cmd_tag_process() - Perform a tag process
+ *
+ * @Return:	The number of elements to allocate in a transaction
+ *		to hold tag process commands
+ */
+void ipa_cmd_tag_process(struct ipa *ipa);
+
 /**
  * ipa_cmd_trans_alloc() - Allocate a transaction for the command TX endpoint
  * @ipa:	IPA pointer
drivers/net/ipa/ipa_endpoint.c +2 -0
index 9f50d0d11704..9e58e495d373 100644
@@ -1450,6 +1450,8 @@ void ipa_endpoint_suspend(struct ipa *ipa)
 	if (ipa->modem_netdev)
 		ipa_modem_suspend(ipa->modem_netdev);
 
+	ipa_cmd_tag_process(ipa);
+
 	ipa_endpoint_suspend_one(ipa->name_map[IPA_ENDPOINT_AP_LAN_RX]);
 	ipa_endpoint_suspend_one(ipa->name_map[IPA_ENDPOINT_AP_COMMAND_TX]);
 }
Signature · 1 line
2.25.1
maintainer
#4 lore raw
In reply to Alex Elder

From: Alex Elder <[email protected]>
Date: Tue, 30 Jun 2020 07:44:41 -0500

Quoted 6 lines

This series contains three bug fixes for the Qualcomm IPA driver. In practice these bugs are unlikke.y to be harmful, but they do represent incorrect code.

Version 2 adds "Fixes" tags to two of the patches and fixes a typo in one (found by checkpatch.pl).

Series applied and queued up for v5.7 -stable, thanks.