From: Eli Britstein <el...@nvidia.com>

Upon tunnel output failure, due to routing failure for example, add a
tunnel-void action. This action does not do anything, but it appears in
the dp-flows for better visibility for that case.

Signed-off-by: Eli Britstein <el...@nvidia.com>
Acked-by: Roi Dayan <r...@nvidia.com>
---
 include/linux/openvswitch.h  | 1 +
 lib/dpif-netdev.c            | 1 +
 lib/dpif.c                   | 1 +
 lib/odp-execute.c            | 6 ++++++
 lib/odp-util.c               | 4 ++++
 ofproto/ofproto-dpif-ipfix.c | 1 +
 ofproto/ofproto-dpif-sflow.c | 1 +
 ofproto/ofproto-dpif-xlate.c | 3 +++
 8 files changed, 18 insertions(+)

diff --git a/include/linux/openvswitch.h b/include/linux/openvswitch.h
index 12c25d380d7d..2a670afc85b4 100644
--- a/include/linux/openvswitch.h
+++ b/include/linux/openvswitch.h
@@ -1119,6 +1119,7 @@ enum ovs_action_attr {
 #ifndef __KERNEL__
        OVS_ACTION_ATTR_TUNNEL_PUSH,   /* struct ovs_action_push_tnl*/
        OVS_ACTION_ATTR_TUNNEL_POP,    /* u32 port number. */
+       OVS_ACTION_ATTR_TUNNEL_VOID,      /* No argument. */
        OVS_ACTION_ATTR_LB_OUTPUT,     /* u32 bond-id. */
 #endif
        __OVS_ACTION_ATTR_MAX,        /* Nothing past this will be accepted
diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 87d69c46d5e0..ba75ed16dc50 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -9495,6 +9495,7 @@ dp_execute_cb(void *aux_, struct dp_packet_batch 
*packets_,
     case OVS_ACTION_ATTR_ADD_MPLS:
     case OVS_ACTION_ATTR_DEC_TTL:
     case OVS_ACTION_ATTR_PSAMPLE:
+    case OVS_ACTION_ATTR_TUNNEL_VOID:
     case __OVS_ACTION_ATTR_MAX:
         OVS_NOT_REACHED();
     }
diff --git a/lib/dpif.c b/lib/dpif.c
index a064f717f1a6..2267eceb17fe 100644
--- a/lib/dpif.c
+++ b/lib/dpif.c
@@ -1292,6 +1292,7 @@ dpif_execute_helper_cb(void *aux_, struct dp_packet_batch 
*packets_,
     case OVS_ACTION_ATTR_DROP:
     case OVS_ACTION_ATTR_ADD_MPLS:
     case OVS_ACTION_ATTR_DEC_TTL:
+    case OVS_ACTION_ATTR_TUNNEL_VOID:
     case __OVS_ACTION_ATTR_MAX:
         OVS_NOT_REACHED();
     }
diff --git a/lib/odp-execute.c b/lib/odp-execute.c
index 15577d5394fa..d114d3aa3351 100644
--- a/lib/odp-execute.c
+++ b/lib/odp-execute.c
@@ -838,6 +838,7 @@ requires_datapath_assistance(const struct nlattr *a)
     case OVS_ACTION_ATTR_CHECK_PKT_LEN:
     case OVS_ACTION_ATTR_ADD_MPLS:
     case OVS_ACTION_ATTR_DEC_TTL:
+    case OVS_ACTION_ATTR_TUNNEL_VOID:
     case OVS_ACTION_ATTR_DROP:
         return false;
 
@@ -1242,6 +1243,11 @@ odp_execute_actions(void *dp, struct dp_packet_batch 
*batch, bool steal,
             dp_packet_delete_batch(batch, steal);
             return;
         }
+
+        case OVS_ACTION_ATTR_TUNNEL_VOID:
+            /* Do nothing. */
+            break;
+
         case OVS_ACTION_ATTR_OUTPUT:
         case OVS_ACTION_ATTR_LB_OUTPUT:
         case OVS_ACTION_ATTR_TUNNEL_PUSH:
diff --git a/lib/odp-util.c b/lib/odp-util.c
index ee186820200b..2101c5ac3f22 100644
--- a/lib/odp-util.c
+++ b/lib/odp-util.c
@@ -123,6 +123,7 @@ odp_action_len(uint16_t type)
     case OVS_ACTION_ATTR_TRUNC: return sizeof(struct ovs_action_trunc);
     case OVS_ACTION_ATTR_TUNNEL_PUSH: return ATTR_LEN_VARIABLE;
     case OVS_ACTION_ATTR_TUNNEL_POP: return sizeof(uint32_t);
+    case OVS_ACTION_ATTR_TUNNEL_VOID: return ATTR_LEN_VARIABLE;
     case OVS_ACTION_ATTR_METER: return sizeof(uint32_t);
     case OVS_ACTION_ATTR_USERSPACE: return ATTR_LEN_VARIABLE;
     case OVS_ACTION_ATTR_PUSH_VLAN: return sizeof(struct ovs_action_push_vlan);
@@ -1215,6 +1216,9 @@ format_odp_action(struct ds *ds, const struct nlattr *a,
     case OVS_ACTION_ATTR_TUNNEL_PUSH:
         format_odp_tnl_push_action(ds, a, portno_names);
         break;
+    case OVS_ACTION_ATTR_TUNNEL_VOID:
+        ds_put_cstr(ds, "tnl_void");
+        break;
     case OVS_ACTION_ATTR_USERSPACE:
         format_odp_userspace_action(ds, a, portno_names);
         break;
diff --git a/ofproto/ofproto-dpif-ipfix.c b/ofproto/ofproto-dpif-ipfix.c
index 7f10b87a7984..93e542b9d9e0 100644
--- a/ofproto/ofproto-dpif-ipfix.c
+++ b/ofproto/ofproto-dpif-ipfix.c
@@ -3137,6 +3137,7 @@ dpif_ipfix_read_actions(const struct flow *flow,
         case OVS_ACTION_ATTR_UNSPEC:
         case OVS_ACTION_ATTR_DROP:
         case OVS_ACTION_ATTR_ADD_MPLS:
+        case OVS_ACTION_ATTR_TUNNEL_VOID:
         case OVS_ACTION_ATTR_DEC_TTL:
         case OVS_ACTION_ATTR_PSAMPLE:
         case __OVS_ACTION_ATTR_MAX:
diff --git a/ofproto/ofproto-dpif-sflow.c b/ofproto/ofproto-dpif-sflow.c
index fb12cf41927b..fba17bcd3820 100644
--- a/ofproto/ofproto-dpif-sflow.c
+++ b/ofproto/ofproto-dpif-sflow.c
@@ -1236,6 +1236,7 @@ dpif_sflow_read_actions(const struct flow *flow,
         case OVS_ACTION_ATTR_CHECK_PKT_LEN:
         case OVS_ACTION_ATTR_DROP:
         case OVS_ACTION_ATTR_ADD_MPLS:
+        case OVS_ACTION_ATTR_TUNNEL_VOID:
         case OVS_ACTION_ATTR_DEC_TTL:
         case OVS_ACTION_ATTR_PSAMPLE:
         case __OVS_ACTION_ATTR_MAX:
diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c
index 416d996a79f3..34e3fa244887 100644
--- a/ofproto/ofproto-dpif-xlate.c
+++ b/ofproto/ofproto-dpif-xlate.c
@@ -3897,6 +3897,7 @@ native_tunnel_output(struct xlate_ctx *ctx, const struct 
xport *xport,
     err = tnl_route_lookup_flow(ctx, flow, &d_ip6, &s_ip6, &out_dev);
     if (err) {
         COVERAGE_INC(xlate_actions_tnl_void);
+        nl_msg_put_u32(ctx->odp_actions, OVS_ACTION_ATTR_TUNNEL_VOID, 0);
         xlate_report(ctx, OFT_WARN, "native tunnel routing failed");
         return err;
     }
@@ -3908,6 +3909,7 @@ native_tunnel_output(struct xlate_ctx *ctx, const struct 
xport *xport,
     /* Use mac addr of bridge port of the peer. */
     err = netdev_get_etheraddr(out_dev->netdev, &smac);
     if (err) {
+        nl_msg_put_u32(ctx->odp_actions, OVS_ACTION_ATTR_TUNNEL_VOID, 0);
         COVERAGE_INC(xlate_actions_tnl_void);
         xlate_report(ctx, OFT_WARN,
                      "tunnel output device lacks Ethernet address");
@@ -3923,6 +3925,7 @@ native_tunnel_output(struct xlate_ctx *ctx, const struct 
xport *xport,
     if (err) {
         struct in6_addr nh_s_ip6 = in6addr_any;
 
+        nl_msg_put_u32(ctx->odp_actions, OVS_ACTION_ATTR_TUNNEL_VOID, 0);
         COVERAGE_INC(xlate_actions_tnl_void);
         xlate_report(ctx, OFT_DETAIL,
                      "neighbor cache miss for %s on bridge %s, "
-- 
2.21.0

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to