diff mbox series

[ovs-dev,05/23] datapath: Print error when ovs_execute_actions() fails

Message ID 1597963790-12362-6-git-send-email-gvrose8192@gmail.com
State Superseded
Headers show
Series Add support for Linux kernels up to 5.9.x | expand

Commit Message

Gregory Rose Aug. 20, 2020, 10:49 p.m. UTC
From: Yifeng Sun <pkusunyifeng@gmail.com>

Upstream commit:
    commit aa733660dbd8d9192b8c528ae0f4b84f3fef74e4
    Author: Yifeng Sun <pkusunyifeng@gmail.com>
    Date:   Sun Aug 4 19:56:11 2019 -0700

    openvswitch: Print error when ovs_execute_actions() fails

    Currently in function ovs_dp_process_packet(), return values of
    ovs_execute_actions() are silently discarded. This patch prints out
    an debug message when error happens so as to provide helpful hints
    for debugging.
    Acked-by: Pravin B Shelar <pshelar@ovn.org>

    Signed-off-by: David S. Miller <davem@davemloft.net>

Cc: Yifeng Sun <pkusunyifeng@gmail.com>
Signed-off-by: Greg Rose <gvrose8192@gmail.com>
---
 datapath/datapath.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Comments

Yifeng Sun Aug. 20, 2020, 10:52 p.m. UTC | #1
LGTM, thanks.


Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>

On Thu, Aug 20, 2020 at 3:50 PM Greg Rose <gvrose8192@gmail.com> wrote:

> From: Yifeng Sun <pkusunyifeng@gmail.com>
>
> Upstream commit:
>     commit aa733660dbd8d9192b8c528ae0f4b84f3fef74e4
>     Author: Yifeng Sun <pkusunyifeng@gmail.com>
>     Date:   Sun Aug 4 19:56:11 2019 -0700
>
>     openvswitch: Print error when ovs_execute_actions() fails
>
>     Currently in function ovs_dp_process_packet(), return values of
>     ovs_execute_actions() are silently discarded. This patch prints out
>     an debug message when error happens so as to provide helpful hints
>     for debugging.
>     Acked-by: Pravin B Shelar <pshelar@ovn.org>
>
>     Signed-off-by: David S. Miller <davem@davemloft.net>
>
> Cc: Yifeng Sun <pkusunyifeng@gmail.com>
> Signed-off-by: Greg Rose <gvrose8192@gmail.com>
> ---
>  datapath/datapath.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/datapath/datapath.c b/datapath/datapath.c
> index 2879f24..c8c21d7 100644
> --- a/datapath/datapath.c
> +++ b/datapath/datapath.c
> @@ -240,6 +240,7 @@ void ovs_dp_process_packet(struct sk_buff *skb, struct
> sw_flow_key *key)
>         struct dp_stats_percpu *stats;
>         u64 *stats_counter;
>         u32 n_mask_hit;
> +       int error;
>
>         stats = this_cpu_ptr(dp->stats_percpu);
>
> @@ -248,7 +249,6 @@ void ovs_dp_process_packet(struct sk_buff *skb, struct
> sw_flow_key *key)
>                                          &n_mask_hit);
>         if (unlikely(!flow)) {
>                 struct dp_upcall_info upcall;
> -               int error;
>
>                 memset(&upcall, 0, sizeof(upcall));
>                 upcall.cmd = OVS_PACKET_CMD_MISS;
> @@ -265,7 +265,10 @@ void ovs_dp_process_packet(struct sk_buff *skb,
> struct sw_flow_key *key)
>
>         ovs_flow_stats_update(flow, key->tp.flags, skb);
>         sf_acts = rcu_dereference(flow->sf_acts);
> -       ovs_execute_actions(dp, skb, sf_acts, key);
> +       error = ovs_execute_actions(dp, skb, sf_acts, key);
> +       if (unlikely(error))
> +               net_dbg_ratelimited("ovs: action execution error on
> datapath %s: %d\n",
> +                                                       ovs_dp_name(dp),
> error);
>
>         stats_counter = &stats->n_hit;
>
> --
> 1.8.3.1
>
>
diff mbox series

Patch

diff --git a/datapath/datapath.c b/datapath/datapath.c
index 2879f24..c8c21d7 100644
--- a/datapath/datapath.c
+++ b/datapath/datapath.c
@@ -240,6 +240,7 @@  void ovs_dp_process_packet(struct sk_buff *skb, struct sw_flow_key *key)
 	struct dp_stats_percpu *stats;
 	u64 *stats_counter;
 	u32 n_mask_hit;
+	int error;
 
 	stats = this_cpu_ptr(dp->stats_percpu);
 
@@ -248,7 +249,6 @@  void ovs_dp_process_packet(struct sk_buff *skb, struct sw_flow_key *key)
 					 &n_mask_hit);
 	if (unlikely(!flow)) {
 		struct dp_upcall_info upcall;
-		int error;
 
 		memset(&upcall, 0, sizeof(upcall));
 		upcall.cmd = OVS_PACKET_CMD_MISS;
@@ -265,7 +265,10 @@  void ovs_dp_process_packet(struct sk_buff *skb, struct sw_flow_key *key)
 
 	ovs_flow_stats_update(flow, key->tp.flags, skb);
 	sf_acts = rcu_dereference(flow->sf_acts);
-	ovs_execute_actions(dp, skb, sf_acts, key);
+	error = ovs_execute_actions(dp, skb, sf_acts, key);
+	if (unlikely(error))
+		net_dbg_ratelimited("ovs: action execution error on datapath %s: %d\n",
+							ovs_dp_name(dp), error);
 
 	stats_counter = &stats->n_hit;