netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 0/3] net: ipa: three bug fixes
@ 2022-05-12 15:10 Alex Elder
  2022-05-12 15:10 ` [PATCH net 1/3] net: ipa: certain dropped packets aren't accounted for Alex Elder
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Alex Elder @ 2022-05-12 15:10 UTC (permalink / raw)
  To: davem, kuba, pabeni
  Cc: lkp, mka, evgreen, bjorn.andersson, quic_cpratapa, quic_avuyyuru,
	quic_jponduru, quic_subashab, elder, netdev, linux-arm-msm,
	linux-kernel

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(-)

-- 
2.32.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH net 1/3] net: ipa: certain dropped packets aren't accounted for
  2022-05-12 15:10 [PATCH net 0/3] net: ipa: three bug fixes Alex Elder
@ 2022-05-12 15:10 ` Alex Elder
  2022-05-12 15:10 ` [PATCH net 2/3] net: ipa: record proper RX transaction count Alex Elder
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Alex Elder @ 2022-05-12 15:10 UTC (permalink / raw)
  To: davem, kuba, pabeni
  Cc: lkp, mka, evgreen, bjorn.andersson, quic_cpratapa, quic_avuyyuru,
	quic_jponduru, quic_subashab, elder, netdev, linux-arm-msm,
	linux-kernel

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")
Signed-off-by: Alex Elder <elder@linaro.org>
---
 drivers/net/ipa/ipa_endpoint.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ipa/ipa_endpoint.c b/drivers/net/ipa/ipa_endpoint.c
index 888e94278a84f..cea7b2e2ce969 100644
--- a/drivers/net/ipa/ipa_endpoint.c
+++ b/drivers/net/ipa/ipa_endpoint.c
@@ -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);
 }
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH net 2/3] net: ipa: record proper RX transaction count
  2022-05-12 15:10 [PATCH net 0/3] net: ipa: three bug fixes Alex Elder
  2022-05-12 15:10 ` [PATCH net 1/3] net: ipa: certain dropped packets aren't accounted for Alex Elder
@ 2022-05-12 15:10 ` Alex Elder
  2022-05-12 15:10 ` [PATCH net 3/3] net: ipa: get rid of a duplicate initialization Alex Elder
  2022-05-13 11:50 ` [PATCH net 0/3] net: ipa: three bug fixes patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: Alex Elder @ 2022-05-12 15:10 UTC (permalink / raw)
  To: davem, kuba, pabeni
  Cc: lkp, mka, evgreen, bjorn.andersson, quic_cpratapa, quic_avuyyuru,
	quic_jponduru, quic_subashab, elder, netdev, linux-arm-msm,
	linux-kernel

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")
Signed-off-by: Alex Elder <elder@linaro.org>
---
 drivers/net/ipa/gsi.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c
index bc981043cc808..a701178a1d139 100644
--- a/drivers/net/ipa/gsi.c
+++ b/drivers/net/ipa/gsi.c
@@ -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 */
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH net 3/3] net: ipa: get rid of a duplicate initialization
  2022-05-12 15:10 [PATCH net 0/3] net: ipa: three bug fixes Alex Elder
  2022-05-12 15:10 ` [PATCH net 1/3] net: ipa: certain dropped packets aren't accounted for Alex Elder
  2022-05-12 15:10 ` [PATCH net 2/3] net: ipa: record proper RX transaction count Alex Elder
@ 2022-05-12 15:10 ` Alex Elder
  2022-05-13 11:50 ` [PATCH net 0/3] net: ipa: three bug fixes patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: Alex Elder @ 2022-05-12 15:10 UTC (permalink / raw)
  To: davem, kuba, pabeni
  Cc: lkp, mka, evgreen, bjorn.andersson, quic_cpratapa, quic_avuyyuru,
	quic_jponduru, quic_subashab, elder, netdev, linux-arm-msm,
	linux-kernel

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/200de1bd-0f01-c334-ca18-43eed783dfac@intel.com/
Reported-by: kernel test robot <lkp@intel.com>
Fixes: 530f9216a953 ("soc: qcom: ipa: AP/modem communications")
Signed-off-by: Alex Elder <elder@linaro.org>
---
 drivers/net/ipa/ipa_qmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ipa/ipa_qmi.c b/drivers/net/ipa/ipa_qmi.c
index 90f3aec55b365..ec010cf2e816a 100644
--- a/drivers/net/ipa/ipa_qmi.c
+++ b/drivers/net/ipa/ipa_qmi.c
@@ -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 */
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net 0/3] net: ipa: three bug fixes
  2022-05-12 15:10 [PATCH net 0/3] net: ipa: three bug fixes Alex Elder
                   ` (2 preceding siblings ...)
  2022-05-12 15:10 ` [PATCH net 3/3] net: ipa: get rid of a duplicate initialization Alex Elder
@ 2022-05-13 11:50 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-05-13 11:50 UTC (permalink / raw)
  To: Alex Elder
  Cc: davem, kuba, pabeni, lkp, mka, evgreen, bjorn.andersson,
	quic_cpratapa, quic_avuyyuru, quic_jponduru, quic_subashab,
	elder, netdev, linux-arm-msm, linux-kernel

Hello:

This series was applied to netdev/net.git (master)
by David S. Miller <davem@davemloft.net>:

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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-05-13 11:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-12 15:10 [PATCH net 0/3] net: ipa: three bug fixes Alex Elder
2022-05-12 15:10 ` [PATCH net 1/3] net: ipa: certain dropped packets aren't accounted for Alex Elder
2022-05-12 15:10 ` [PATCH net 2/3] net: ipa: record proper RX transaction count Alex Elder
2022-05-12 15:10 ` [PATCH net 3/3] net: ipa: get rid of a duplicate initialization Alex Elder
2022-05-13 11:50 ` [PATCH net 0/3] net: ipa: three bug fixes patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).