summaryrefslogtreecommitdiff
path: root/ofproto
diff options
context:
space:
mode:
authorAnju Thomas <anju.thomas@ericsson.com>2019-12-18 05:48:12 +0100
committerIlya Maximets <i.maximets@ovn.org>2020-01-07 17:01:42 +0100
commita13a0209750c424556189796061c40d08c689467 (patch)
tree32b4f84fdc418f497b25a41828dd7788aa0f20d8 /ofproto
parent924d94a695a6ca54b83d4bd42ec196ba53947c6d (diff)
downloadopenvswitch-a13a0209750c424556189796061c40d08c689467.tar.gz
userspace: Improved packet drop statistics.
Currently OVS maintains explicit packet drop/error counters only on port level. Packets that are dropped as part of normal OpenFlow processing are counted in flow stats of “drop” flows or as table misses in table stats. These can only be interpreted by controllers that know the semantics of the configured OpenFlow pipeline. Without that knowledge, it is impossible for an OVS user to obtain e.g. the total number of packets dropped due to OpenFlow rules. Furthermore, there are numerous other reasons for which packets can be dropped by OVS slow path that are not related to the OpenFlow pipeline. The generated datapath flow entries include a drop action to avoid further expensive upcalls to the slow path, but subsequent packets dropped by the datapath are not accounted anywhere. Finally, the datapath itself drops packets in certain error situations. Also, these drops are today not accounted for.This makes it difficult for OVS users to monitor packet drop in an OVS instance and to alert a management system in case of a unexpected increase of such drops. Also OVS trouble-shooters face difficulties in analysing packet drops. With this patch we implement following changes to address the issues mentioned above. 1. Identify and account all the silent packet drop scenarios 2. Display these drops in ovs-appctl coverage/show Co-authored-by: Rohith Basavaraja <rohith.basavaraja@gmail.com> Co-authored-by: Keshav Gupta <keshugupta1@gmail.com> Signed-off-by: Anju Thomas <anju.thomas@ericsson.com> Signed-off-by: Rohith Basavaraja <rohith.basavaraja@gmail.com> Signed-off-by: Keshav Gupta <keshugupta1@gmail.com> Acked-by: Eelco Chaudron <echaudro@redhat.com Acked-by: Ben Pfaff <blp@ovn.org> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Diffstat (limited to 'ofproto')
-rw-r--r--ofproto/ofproto-dpif-ipfix.c1
-rw-r--r--ofproto/ofproto-dpif-sflow.c1
-rw-r--r--ofproto/ofproto-dpif-xlate.c33
-rw-r--r--ofproto/ofproto-dpif-xlate.h13
-rw-r--r--ofproto/ofproto-dpif.c10
-rw-r--r--ofproto/ofproto-dpif.h8
6 files changed, 51 insertions, 15 deletions
diff --git a/ofproto/ofproto-dpif-ipfix.c b/ofproto/ofproto-dpif-ipfix.c
index b8bd1b814..b413768ef 100644
--- a/ofproto/ofproto-dpif-ipfix.c
+++ b/ofproto/ofproto-dpif-ipfix.c
@@ -3016,6 +3016,7 @@ dpif_ipfix_read_actions(const struct flow *flow,
case OVS_ACTION_ATTR_POP_NSH:
case OVS_ACTION_ATTR_CHECK_PKT_LEN:
case OVS_ACTION_ATTR_UNSPEC:
+ case OVS_ACTION_ATTR_DROP:
case __OVS_ACTION_ATTR_MAX:
default:
break;
diff --git a/ofproto/ofproto-dpif-sflow.c b/ofproto/ofproto-dpif-sflow.c
index 9abaab61b..f9ea47a2f 100644
--- a/ofproto/ofproto-dpif-sflow.c
+++ b/ofproto/ofproto-dpif-sflow.c
@@ -1224,6 +1224,7 @@ dpif_sflow_read_actions(const struct flow *flow,
case OVS_ACTION_ATTR_POP_NSH:
case OVS_ACTION_ATTR_UNSPEC:
case OVS_ACTION_ATTR_CHECK_PKT_LEN:
+ case OVS_ACTION_ATTR_DROP:
case __OVS_ACTION_ATTR_MAX:
default:
break;
diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c
index 1c7269317..4407f9c97 100644
--- a/ofproto/ofproto-dpif-xlate.c
+++ b/ofproto/ofproto-dpif-xlate.c
@@ -445,6 +445,12 @@ const char *xlate_strerror(enum xlate_error error)
return "Invalid tunnel metadata";
case XLATE_UNSUPPORTED_PACKET_TYPE:
return "Unsupported packet type";
+ case XLATE_CONGESTION_DROP:
+ return "Congestion Drop";
+ case XLATE_FORWARDING_DISABLED:
+ return "Forwarding is disabled";
+ case XLATE_MAX:
+ break;
}
return "Unknown error";
}
@@ -6010,6 +6016,12 @@ put_ct_label(const struct flow *flow, struct ofpbuf *odp_actions,
}
static void
+put_drop_action(struct ofpbuf *odp_actions, enum xlate_error error)
+{
+ nl_msg_put_u32(odp_actions, OVS_ACTION_ATTR_DROP, error);
+}
+
+static void
put_ct_helper(struct xlate_ctx *ctx,
struct ofpbuf *odp_actions, struct ofpact_conntrack *ofc)
{
@@ -7646,8 +7658,9 @@ xlate_actions(struct xlate_in *xin, struct xlate_out *xout)
compose_ipfix_action(&ctx, ODPP_NONE);
}
size_t sample_actions_len = ctx.odp_actions->size;
+ bool ecn_drop = !tnl_process_ecn(flow);
- if (tnl_process_ecn(flow)
+ if (!ecn_drop
&& (!in_port || may_receive(in_port, &ctx))) {
const struct ofpact *ofpacts;
size_t ofpacts_len;
@@ -7679,6 +7692,7 @@ xlate_actions(struct xlate_in *xin, struct xlate_out *xout)
ctx.odp_actions->size = sample_actions_len;
ctx_cancel_freeze(&ctx);
ofpbuf_clear(&ctx.action_set);
+ ctx.error = XLATE_FORWARDING_DISABLED;
}
if (!ctx.freezing) {
@@ -7687,6 +7701,8 @@ xlate_actions(struct xlate_in *xin, struct xlate_out *xout)
if (ctx.freezing) {
finish_freezing(&ctx);
}
+ } else if (ecn_drop) {
+ ctx.error = XLATE_CONGESTION_DROP;
}
/* Output only fully processed packets. */
@@ -7792,6 +7808,21 @@ exit:
ofpbuf_clear(xin->odp_actions);
}
}
+
+ /* Install drop action if datapath supports explicit drop action. */
+ if (xin->odp_actions && !xin->odp_actions->size &&
+ ovs_explicit_drop_action_supported(ctx.xbridge->ofproto)) {
+ put_drop_action(xin->odp_actions, ctx.error);
+ }
+
+ /* Since congestion drop and forwarding drop are not exactly
+ * translation error, we are resetting the translation error.
+ */
+ if (ctx.error == XLATE_CONGESTION_DROP ||
+ ctx.error == XLATE_FORWARDING_DISABLED) {
+ ctx.error = XLATE_OK;
+ }
+
return ctx.error;
}
diff --git a/ofproto/ofproto-dpif-xlate.h b/ofproto/ofproto-dpif-xlate.h
index f97c7c0f4..3426a27b2 100644
--- a/ofproto/ofproto-dpif-xlate.h
+++ b/ofproto/ofproto-dpif-xlate.h
@@ -206,19 +206,6 @@ int xlate_lookup(const struct dpif_backer *, const struct flow *,
struct dpif_sflow **, struct netflow **,
ofp_port_t *ofp_in_port);
-enum xlate_error {
- XLATE_OK = 0,
- XLATE_BRIDGE_NOT_FOUND,
- XLATE_RECURSION_TOO_DEEP,
- XLATE_TOO_MANY_RESUBMITS,
- XLATE_STACK_TOO_DEEP,
- XLATE_NO_RECIRCULATION_CONTEXT,
- XLATE_RECIRCULATION_CONFLICT,
- XLATE_TOO_MANY_MPLS_LABELS,
- XLATE_INVALID_TUNNEL_METADATA,
- XLATE_UNSUPPORTED_PACKET_TYPE,
-};
-
const char *xlate_strerror(enum xlate_error error);
enum xlate_error xlate_actions(struct xlate_in *, struct xlate_out *);
diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
index d298e17cf..f782f865f 100644
--- a/ofproto/ofproto-dpif.c
+++ b/ofproto/ofproto-dpif.c
@@ -860,6 +860,12 @@ ovs_native_tunneling_is_on(struct ofproto_dpif *ofproto)
&& atomic_count_get(&ofproto->backer->tnl_count);
}
+bool
+ovs_explicit_drop_action_supported(struct ofproto_dpif *ofproto)
+{
+ return ofproto->backer->rt_support.explicit_drop_action;
+}
+
/* Tests whether 'backer''s datapath supports recirculation. Only newer
* datapaths support OVS_KEY_ATTR_RECIRC_ID in keys. We need to disable some
* features on older datapaths that don't support this feature.
@@ -1572,6 +1578,8 @@ check_support(struct dpif_backer *backer)
backer->rt_support.max_hash_alg = check_max_dp_hash_alg(backer);
backer->rt_support.check_pkt_len = check_check_pkt_len(backer);
backer->rt_support.ct_timeout = check_ct_timeout_policy(backer);
+ backer->rt_support.explicit_drop_action =
+ dpif_supports_explicit_drop_action(backer->dpif);
/* Flow fields. */
backer->rt_support.odp.ct_state = check_ct_state(backer);
@@ -5553,6 +5561,8 @@ get_datapath_cap(const char *datapath_type, struct smap *cap)
smap_add_format(cap, "max_hash_alg", "%"PRIuSIZE, s.max_hash_alg);
smap_add(cap, "check_pkt_len", s.check_pkt_len ? "true" : "false");
smap_add(cap, "ct_timeout", s.ct_timeout ? "true" : "false");
+ smap_add(cap, "explicit_drop_action",
+ s.explicit_drop_action ? "true" :"false");
}
/* Gets timeout policy name in 'backer' based on 'zone', 'dl_type' and
diff --git a/ofproto/ofproto-dpif.h b/ofproto/ofproto-dpif.h
index afdba0d49..c9d5df34b 100644
--- a/ofproto/ofproto-dpif.h
+++ b/ofproto/ofproto-dpif.h
@@ -199,7 +199,11 @@ struct group_dpif *group_dpif_lookup(struct ofproto_dpif *,
\
/* True if the datapath supports OVS_CT_ATTR_TIMEOUT in \
* OVS_ACTION_ATTR_CT action. */ \
- DPIF_SUPPORT_FIELD(bool, ct_timeout, "Conntrack timeout policy")
+ DPIF_SUPPORT_FIELD(bool, ct_timeout, "Conntrack timeout policy") \
+ \
+ /* True if the datapath supports explicit drop action. */ \
+ DPIF_SUPPORT_FIELD(bool, explicit_drop_action, "Explicit Drop action")
+
/* Stores the various features which the corresponding backer supports. */
struct dpif_backer_support {
@@ -382,4 +386,6 @@ bool ofproto_dpif_ct_zone_timeout_policy_get_name(
const struct dpif_backer *backer, uint16_t zone, uint16_t dl_type,
uint8_t nw_proto, char **tp_name, bool *unwildcard);
+bool ovs_explicit_drop_action_supported(struct ofproto_dpif *);
+
#endif /* ofproto-dpif.h */