mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 06:15:47 +00:00
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>
This commit is contained in:
committed by
Ilya Maximets
parent
924d94a695
commit
a13a020975
@@ -102,6 +102,17 @@ enum { MAX_METERS = 65536 }; /* Maximum number of meters. */
|
||||
enum { MAX_BANDS = 8 }; /* Maximum number of bands / meter. */
|
||||
enum { N_METER_LOCKS = 64 }; /* Maximum number of meters. */
|
||||
|
||||
COVERAGE_DEFINE(datapath_drop_meter);
|
||||
COVERAGE_DEFINE(datapath_drop_upcall_error);
|
||||
COVERAGE_DEFINE(datapath_drop_lock_error);
|
||||
COVERAGE_DEFINE(datapath_drop_userspace_action_error);
|
||||
COVERAGE_DEFINE(datapath_drop_tunnel_push_error);
|
||||
COVERAGE_DEFINE(datapath_drop_tunnel_pop_error);
|
||||
COVERAGE_DEFINE(datapath_drop_recirc_error);
|
||||
COVERAGE_DEFINE(datapath_drop_invalid_port);
|
||||
COVERAGE_DEFINE(datapath_drop_invalid_tnl_port);
|
||||
COVERAGE_DEFINE(datapath_drop_rx_invalid_packet);
|
||||
|
||||
/* Protects against changes to 'dp_netdevs'. */
|
||||
static struct ovs_mutex dp_netdev_mutex = OVS_MUTEX_INITIALIZER;
|
||||
|
||||
@@ -5770,7 +5781,7 @@ dp_netdev_run_meter(struct dp_netdev *dp, struct dp_packet_batch *packets_,
|
||||
band = &meter->bands[exceeded_band[j]];
|
||||
band->packet_count += 1;
|
||||
band->byte_count += dp_packet_size(packet);
|
||||
|
||||
COVERAGE_INC(datapath_drop_meter);
|
||||
dp_packet_delete(packet);
|
||||
} else {
|
||||
/* Meter accepts packet. */
|
||||
@@ -6520,6 +6531,7 @@ dfc_processing(struct dp_netdev_pmd_thread *pmd,
|
||||
|
||||
if (OVS_UNLIKELY(dp_packet_size(packet) < ETH_HEADER_LEN)) {
|
||||
dp_packet_delete(packet);
|
||||
COVERAGE_INC(datapath_drop_rx_invalid_packet);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -6640,6 +6652,7 @@ handle_packet_upcall(struct dp_netdev_pmd_thread *pmd,
|
||||
put_actions);
|
||||
if (OVS_UNLIKELY(error && error != ENOSPC)) {
|
||||
dp_packet_delete(packet);
|
||||
COVERAGE_INC(datapath_drop_upcall_error);
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -6770,6 +6783,7 @@ fast_path_processing(struct dp_netdev_pmd_thread *pmd,
|
||||
DP_PACKET_BATCH_FOR_EACH (i, packet, packets_) {
|
||||
if (OVS_UNLIKELY(!rules[i])) {
|
||||
dp_packet_delete(packet);
|
||||
COVERAGE_INC(datapath_drop_lock_error);
|
||||
upcall_fail_cnt++;
|
||||
}
|
||||
}
|
||||
@@ -7039,6 +7053,7 @@ dp_execute_userspace_action(struct dp_netdev_pmd_thread *pmd,
|
||||
actions->data, actions->size);
|
||||
} else if (should_steal) {
|
||||
dp_packet_delete(packet);
|
||||
COVERAGE_INC(datapath_drop_userspace_action_error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7053,6 +7068,7 @@ dp_execute_cb(void *aux_, struct dp_packet_batch *packets_,
|
||||
struct dp_netdev *dp = pmd->dp;
|
||||
int type = nl_attr_type(a);
|
||||
struct tx_port *p;
|
||||
uint32_t packet_count, packets_dropped;
|
||||
|
||||
switch ((enum ovs_action_attr)type) {
|
||||
case OVS_ACTION_ATTR_OUTPUT:
|
||||
@@ -7094,6 +7110,9 @@ dp_execute_cb(void *aux_, struct dp_packet_batch *packets_,
|
||||
dp_packet_batch_add(&p->output_pkts, packet);
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
COVERAGE_ADD(datapath_drop_invalid_port,
|
||||
dp_packet_batch_size(packets_));
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -7106,7 +7125,11 @@ dp_execute_cb(void *aux_, struct dp_packet_batch *packets_,
|
||||
break;
|
||||
}
|
||||
dp_packet_batch_apply_cutlen(packets_);
|
||||
push_tnl_action(pmd, a, packets_);
|
||||
packet_count = dp_packet_batch_size(packets_);
|
||||
if (push_tnl_action(pmd, a, packets_)) {
|
||||
COVERAGE_ADD(datapath_drop_tunnel_push_error,
|
||||
packet_count);
|
||||
}
|
||||
return;
|
||||
|
||||
case OVS_ACTION_ATTR_TUNNEL_POP:
|
||||
@@ -7126,7 +7149,14 @@ dp_execute_cb(void *aux_, struct dp_packet_batch *packets_,
|
||||
|
||||
dp_packet_batch_apply_cutlen(packets_);
|
||||
|
||||
packet_count = dp_packet_batch_size(packets_);
|
||||
netdev_pop_header(p->port->netdev, packets_);
|
||||
packets_dropped =
|
||||
packet_count - dp_packet_batch_size(packets_);
|
||||
if (packets_dropped) {
|
||||
COVERAGE_ADD(datapath_drop_tunnel_pop_error,
|
||||
packets_dropped);
|
||||
}
|
||||
if (dp_packet_batch_is_empty(packets_)) {
|
||||
return;
|
||||
}
|
||||
@@ -7141,6 +7171,11 @@ dp_execute_cb(void *aux_, struct dp_packet_batch *packets_,
|
||||
(*depth)--;
|
||||
return;
|
||||
}
|
||||
COVERAGE_ADD(datapath_drop_invalid_tnl_port,
|
||||
dp_packet_batch_size(packets_));
|
||||
} else {
|
||||
COVERAGE_ADD(datapath_drop_recirc_error,
|
||||
dp_packet_batch_size(packets_));
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -7185,6 +7220,8 @@ dp_execute_cb(void *aux_, struct dp_packet_batch *packets_,
|
||||
|
||||
return;
|
||||
}
|
||||
COVERAGE_ADD(datapath_drop_lock_error,
|
||||
dp_packet_batch_size(packets_));
|
||||
break;
|
||||
|
||||
case OVS_ACTION_ATTR_RECIRC:
|
||||
@@ -7208,6 +7245,8 @@ dp_execute_cb(void *aux_, struct dp_packet_batch *packets_,
|
||||
return;
|
||||
}
|
||||
|
||||
COVERAGE_ADD(datapath_drop_recirc_error,
|
||||
dp_packet_batch_size(packets_));
|
||||
VLOG_WARN("Packet dropped. Max recirculation depth exceeded.");
|
||||
break;
|
||||
|
||||
@@ -7365,6 +7404,7 @@ dp_execute_cb(void *aux_, struct dp_packet_batch *packets_,
|
||||
case OVS_ACTION_ATTR_POP_NSH:
|
||||
case OVS_ACTION_ATTR_CT_CLEAR:
|
||||
case OVS_ACTION_ATTR_CHECK_PKT_LEN:
|
||||
case OVS_ACTION_ATTR_DROP:
|
||||
case __OVS_ACTION_ATTR_MAX:
|
||||
OVS_NOT_REACHED();
|
||||
}
|
||||
|
Reference in New Issue
Block a user