netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v2 1/2] openvswitch: Fix double reporting of drops in dropwatch
@ 2022-08-17 15:06 Mike Pattrick
  2022-08-17 15:06 ` [PATCH net-next v2 2/2] openvswitch: Fix overreporting " Mike Pattrick
  2022-08-22 13:00 ` [PATCH net-next v2 1/2] openvswitch: Fix double reporting " patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Mike Pattrick @ 2022-08-17 15:06 UTC (permalink / raw)
  To: netdev
  Cc: mkp, Pravin B Shelar, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, dev, linux-kernel

Frames sent to userspace can be reported as dropped in
ovs_dp_process_packet, however, if they are dropped in the netlink code
then netlink_attachskb will report the same frame as dropped.

This patch checks for error codes which indicate that the frame has
already been freed.

Signed-off-by: Mike Pattrick <mkp@redhat.com>
Link: https://bugzilla.redhat.com/show_bug.cgi?id=2109946
---
Changes in v2:
 - Corrected bugzilla link
---
 net/openvswitch/datapath.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index 7e8a39a35627..ca22aa73c6e0 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -252,10 +252,17 @@ void ovs_dp_process_packet(struct sk_buff *skb, struct sw_flow_key *key)
 
 		upcall.mru = OVS_CB(skb)->mru;
 		error = ovs_dp_upcall(dp, skb, key, &upcall, 0);
-		if (unlikely(error))
-			kfree_skb(skb);
-		else
+		switch (error) {
+		case 0:
+		case -EAGAIN:
+		case -ERESTARTSYS:
+		case -EINTR:
 			consume_skb(skb);
+			break;
+		default:
+			kfree_skb(skb);
+			break;
+		}
 		stats_counter = &stats->n_missed;
 		goto out;
 	}
-- 
2.31.1


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

* [PATCH net-next v2 2/2] openvswitch: Fix overreporting of drops in dropwatch
  2022-08-17 15:06 [PATCH net-next v2 1/2] openvswitch: Fix double reporting of drops in dropwatch Mike Pattrick
@ 2022-08-17 15:06 ` Mike Pattrick
  2022-08-22 13:00 ` [PATCH net-next v2 1/2] openvswitch: Fix double reporting " patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Mike Pattrick @ 2022-08-17 15:06 UTC (permalink / raw)
  To: netdev
  Cc: mkp, Pravin B Shelar, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, dev, linux-kernel

Currently queue_userspace_packet will call kfree_skb for all frames,
whether or not an error occurred. This can result in a single dropped
frame being reported as multiple drops in dropwatch. This functions
caller may also call kfree_skb in case of an error. This patch will
consume the skbs instead and allow caller's to use kfree_skb.

Signed-off-by: Mike Pattrick <mkp@redhat.com>
Link: https://bugzilla.redhat.com/show_bug.cgi?id=2109957
---
Changes in v2:
 - Corrected bugzilla link
---
 net/openvswitch/datapath.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index ca22aa73c6e0..45f9a7b3410e 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -558,8 +558,9 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb,
 out:
 	if (err)
 		skb_tx_error(skb);
-	kfree_skb(user_skb);
-	kfree_skb(nskb);
+	consume_skb(user_skb);
+	consume_skb(nskb);
+
 	return err;
 }
 
-- 
2.31.1


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

* Re: [PATCH net-next v2 1/2] openvswitch: Fix double reporting of drops in dropwatch
  2022-08-17 15:06 [PATCH net-next v2 1/2] openvswitch: Fix double reporting of drops in dropwatch Mike Pattrick
  2022-08-17 15:06 ` [PATCH net-next v2 2/2] openvswitch: Fix overreporting " Mike Pattrick
@ 2022-08-22 13:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-08-22 13:00 UTC (permalink / raw)
  To: Mike Pattrick
  Cc: netdev, pshelar, davem, edumazet, kuba, pabeni, dev, linux-kernel

Hello:

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

On Wed, 17 Aug 2022 11:06:34 -0400 you wrote:
> Frames sent to userspace can be reported as dropped in
> ovs_dp_process_packet, however, if they are dropped in the netlink code
> then netlink_attachskb will report the same frame as dropped.
> 
> This patch checks for error codes which indicate that the frame has
> already been freed.
> 
> [...]

Here is the summary with links:
  - [net-next,v2,1/2] openvswitch: Fix double reporting of drops in dropwatch
    https://git.kernel.org/netdev/net-next/c/1100248a5c5c
  - [net-next,v2,2/2] openvswitch: Fix overreporting of drops in dropwatch
    https://git.kernel.org/netdev/net-next/c/c21ab2afa2c6

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] 3+ messages in thread

end of thread, other threads:[~2022-08-22 13:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-17 15:06 [PATCH net-next v2 1/2] openvswitch: Fix double reporting of drops in dropwatch Mike Pattrick
2022-08-17 15:06 ` [PATCH net-next v2 2/2] openvswitch: Fix overreporting " Mike Pattrick
2022-08-22 13:00 ` [PATCH net-next v2 1/2] openvswitch: Fix double reporting " 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).