Until now, dpif_sflow_read_actions() has ignored actions inside clone.
This means that sflow missed tnl_push actions inside clone, which OVS
now uses to avoid tx recirculation. This commit fixes the problem
by making dpif_sflow_read_actions() recursively process actions inside
clone.
In addition, some sflow data needs to be stored and restored in
ofproto-dpif-xlate when native_tunnel_output() is invoked. Otherwise the
output action of underlay bridge is getting counted too when sFlow is set
on the overlay bridge.
Both bugs are connected to sflows and were introduced by the commit in
the "Fixes:" tag below.
Signed-off-by: Zoltan Balogh <zoltan.balogh@ericsson.com>
CC: Sugesh Chandran <sugesh.chandran@intel.com>
Fixes: 7c12dfc527a5 ("tunneling: Avoid datapath-recirc by combining recirc actions at xlate.")
Signed-off-by: Ben Pfaff <blp@ovn.org>
} else {
dpif_sflow_read_actions(NULL,
nl_attr_get(attr), nl_attr_get_size(attr),
- sflow_actions);
+ sflow_actions, true);
}
break;
case OVS_KEY_ATTR_PRIORITY:
void
dpif_sflow_read_actions(const struct flow *flow,
- const struct nlattr *actions, size_t actions_len,
- struct dpif_sflow_actions *sflow_actions)
+ const struct nlattr *actions, size_t actions_len,
+ struct dpif_sflow_actions *sflow_actions,
+ bool capture_mpls)
{
const struct nlattr *a;
unsigned int left;
return;
}
- if (flow != NULL) {
+ if (flow != NULL && capture_mpls == true) {
/* Make sure the MPLS output stack
* is seeded with the input stack.
*/
* structure to report this.
*/
break;
+ case OVS_ACTION_ATTR_CLONE:
+ if (flow != NULL) {
+ dpif_sflow_read_actions(flow, nl_attr_get(a), nl_attr_get_size(a),
+ sflow_actions, false);
+ }
+ break;
case OVS_ACTION_ATTR_SAMPLE:
- case OVS_ACTION_ATTR_CLONE:
case OVS_ACTION_ATTR_PUSH_NSH:
case OVS_ACTION_ATTR_POP_NSH:
case OVS_ACTION_ATTR_UNSPEC:
void dpif_sflow_read_actions(const struct flow *,
const struct nlattr *actions, size_t actions_len,
- struct dpif_sflow_actions *);
+ struct dpif_sflow_actions *, bool capture_mpls);
void dpif_sflow_received(struct dpif_sflow *, const struct dp_packet *,
const struct flow *, odp_port_t odp_port,
switch (type) {
case SFLOW_UPCALL:
- dpif_sflow_read_actions(flow, actions, actions_len, upcall_data);
+ dpif_sflow_read_actions(flow, actions, actions_len, upcall_data, true);
break;
case FLOW_SAMPLE_UPCALL:
case IPFIX_UPCALL:
char buf_sip6[INET6_ADDRSTRLEN];
char buf_dip6[INET6_ADDRSTRLEN];
+ /* Store sFlow data. */
+ uint32_t sflow_n_outputs = ctx->sflow_n_outputs;
+
/* Structures to backup Ethernet and IP of base_flow. */
struct flow old_base_flow;
struct flow old_flow;
/* Restore the flows after the translation. */
memcpy(&ctx->xin->flow, &old_flow, sizeof ctx->xin->flow);
memcpy(&ctx->base_flow, &old_base_flow, sizeof ctx->base_flow);
+
+ /* Restore sFlow data. */
+ ctx->sflow_n_outputs = sflow_n_outputs;
+
return 0;
}
AT_CHECK([ovs-ofctl add-flow br0 action=normal])
dnl Prime ARP Cache for 1.1.2.92
-AT_CHECK([ovs-appctl netdev-dummy/receive br0 'recirc_id(0),in_port(100),eth(src=f8:bc:12:44:34:b6,dst=ff:ff:ff:ff:ff:ff),eth_type(0x0806),arp(sip=1.1.2.92,tip=1.1.2.88,op=2,sha=f8:bc:12:44:34:b6,tha=00:00:00:00:00:00)'])
+AT_CHECK([ovs-appctl netdev-dummy/receive p0 'recirc_id(0),in_port(1),eth(src=f8:bc:12:44:34:b6,dst=ff:ff:ff:ff:ff:ff),eth_type(0x0806),arp(sip=1.1.2.92,tip=1.1.2.88,op=2,sha=f8:bc:12:44:34:b6,tha=00:00:00:00:00:00)'])
dnl configure sflow on int-br only
ovs-vsctl \