Skip to contentSkip to conversation

net: ipa: three bug fixes

PATCH Applied Alex Elder 2 participants 5 messages May 12, 2022 – May 13, 2022

Subsystems (4)
lore
Share & tools
lore
author
#1 lore raw

PATCH 1/3 net: ipa: certain dropped packets aren't accounted for

In reply to Alex Elder

If an RX endpoint receives packets containing status headers, and a packet in the buffer is not dropped, ipa_endpoint_skb_copy() is responsible for wrapping the packet data in an SKB and forwarding it to ipa_modem_skb_rx() for further processing.

If ipa_endpoint_skb_copy() gets a null pointer from build_skb(), it just returns early. But in the process it doesn't record that as a dropped packet in the network device statistics.

Instead, call ipa_modem_skb_rx() whether or not the SKB pointer is NULL; that function ensures the statistics are properly updated.

Fixes 1b65bbcc9a710 ("net: ipa: skip SKB copy if no netdev")
---
 drivers/net/ipa/ipa_endpoint.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/net/ipa/ipa_endpoint.c +6 -7
index 888e94278a84f..cea7b2e2ce969 100644
@@ -1150,13 +1150,12 @@ static void ipa_endpoint_skb_copy(struct ipa_endpoint *endpoint,
 		return;
 
 	skb = __dev_alloc_skb(len, GFP_ATOMIC);
-	if (!skb)
-		return;
-
-	/* Copy the data into the socket buffer and receive it */
-	skb_put(skb, len);
-	memcpy(skb->data, data, len);
-	skb->truesize += extra;
+	if (skb) {
+		/* Copy the data into the socket buffer and receive it */
+		skb_put(skb, len);
+		memcpy(skb->data, data, len);
+		skb->truesize += extra;
+	}
 
 	ipa_modem_skb_rx(endpoint->netdev, skb);
 }
Signature · 1 line
2.32.0

Alex Elder

author
#0 lore raw

cover net: ipa: three bug fixes

This series contains three somewhat unrelated minor bug fixes.

-Alex

Alex Elder (3):
net: ipa: certain dropped packets aren't accounted for
net: ipa: record proper RX transaction count
net: ipa: get rid of a duplicate initialization

 drivers/net/ipa/gsi.c          |  6 ++++--
 drivers/net/ipa/ipa_endpoint.c | 13 ++++++-------
 drivers/net/ipa/ipa_qmi.c      |  2 +-
 3 files changed, 11 insertions(+), 10 deletions(-)
Signature · 1 line
2.32.0
author
#3 lore raw

PATCH 3/3 net: ipa: get rid of a duplicate initialization

In ipa_qmi_ready(), the "ipa" local variable is set when initialized, but then set again just before it's first used. One or the other is enough, so get rid of the first one.

References: https://lore.kernel.org/lkml/[email protected]/

Fixes 530f9216a953 ("soc: qcom: ipa: AP/modem communications")
---
 drivers/net/ipa/ipa_qmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ipa/ipa_qmi.c +1 -1
index 90f3aec55b365..ec010cf2e816a 100644
@@ -125,7 +125,7 @@ static void ipa_qmi_indication(struct ipa_qmi *ipa_qmi)
  */
 static void ipa_qmi_ready(struct ipa_qmi *ipa_qmi)
 {
-	struct ipa *ipa = container_of(ipa_qmi, struct ipa, qmi);
+	struct ipa *ipa;
 	int ret;
 
 	/* We aren't ready until the modem and microcontroller are */
Signature · 1 line
2.32.0
author
#2 lore raw

PATCH 2/3 net: ipa: record proper RX transaction count

In reply to Alex Elder

Each time we are notified that some number of transactions on an RX channel has completed, we record the number of bytes that have been transferred since the previous notification. We also track the number of transactions completed, but that is not currently being calculated correctly; we're currently counting the number of such notifications, but each notification can represent many transaction completions. Fix this.

Fixes 650d1603825d8 ("soc: qcom: ipa: the generic software interface")
---
 drivers/net/ipa/gsi.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/ipa/gsi.c +4 -2
index bc981043cc808..a701178a1d139 100644
@@ -1367,9 +1367,10 @@ static void gsi_evt_ring_rx_update(struct gsi_evt_ring *evt_ring, u32 index)
 	struct gsi_event *event_done;
 	struct gsi_event *event;
 	struct gsi_trans *trans;
+	u32 trans_count = 0;
 	u32 byte_count = 0;
-	u32 old_index;
 	u32 event_avail;
+	u32 old_index;
 
 	trans_info = &channel->trans_info;
 
@@ -1390,6 +1391,7 @@ static void gsi_evt_ring_rx_update(struct gsi_evt_ring *evt_ring, u32 index)
 	do {
 		trans->len = __le16_to_cpu(event->len);
 		byte_count += trans->len;
+		trans_count++;
 
 		/* Move on to the next event and transaction */
 		if (--event_avail)
@@ -1401,7 +1403,7 @@ static void gsi_evt_ring_rx_update(struct gsi_evt_ring *evt_ring, u32 index)
 
 	/* We record RX bytes when they are received */
 	channel->byte_count += byte_count;
-	channel->trans_count++;
+	channel->trans_count += trans_count;
 }
 
 /* Initialize a ring, including allocating DMA memory for its entries */
Signature · 1 line
2.32.0
#4 lore raw
In reply to Alex Elder
This series was applied to netdev/net.git (master) by David S. Miller <[email protected]>:

Hello:

This series was applied to netdev/net.git (master) by David S. Miller <[email protected]>:

Quoted 10 lines · On Thu, 12 May 2022 10:10:30 -0500 you wrote:

This series contains three somewhat unrelated minor bug fixes.

-Alex

Alex Elder (3):
net: ipa: certain dropped packets aren't accounted for
net: ipa: record proper RX transaction count
net: ipa: get rid of a duplicate initialization

[...]

Here is the summary with links:
- [net,1/3] net: ipa: certain dropped packets aren't accounted for

    https://git.kernel.org/netdev/net/c/30b338ff7998
  - [net,2/3] net: ipa: record proper RX transaction count
    https://git.kernel.org/netdev/net/c/d8290cbe1111
  - [net,3/3] net: ipa: get rid of a duplicate initialization
    https://git.kernel.org/netdev/net/c/8d017efb1eaa

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html