>From Open vSwitch 2.10 onwards, dp_hash is the default selection method for select groups. When this method is used, packet recirculation occurs to compute the hash at the datapath level. Previously, this case was logged as "no live bucket", which was misleading.
Reported-at: https://mail.openvswitch.org/pipermail/ovs-discuss/2023-December/052860.html Signed-off-by: Alexandra Rukomoinikova <[email protected]> --- ofproto/ofproto-dpif-xlate.c | 26 +++++++++++++++++++++----- tests/ofproto-dpif.at | 31 +++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 5 deletions(-) diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c index 2c8197fb7..7437c077a 100644 --- a/ofproto/ofproto-dpif-xlate.c +++ b/ofproto/ofproto-dpif-xlate.c @@ -4973,7 +4973,8 @@ pick_hash_fields_select_group(struct xlate_ctx *ctx, struct group_dpif *group) } static struct ofputil_bucket * -pick_dp_hash_select_group(struct xlate_ctx *ctx, struct group_dpif *group) +pick_dp_hash_select_group(struct xlate_ctx *ctx, struct group_dpif *group, + bool *is_dp_hash_recirc) { uint32_t dp_hash = ctx->xin->flow.dp_hash; @@ -4988,6 +4989,7 @@ pick_dp_hash_select_group(struct xlate_ctx *ctx, struct group_dpif *group) hash_alg = OVS_HASH_ALG_L4; } ctx_trigger_recirculate_with_hash(ctx, hash_alg, group->hash_basis); + *is_dp_hash_recirc = true; return NULL; } else { uint32_t hash_mask = group->hash_mask; @@ -5011,7 +5013,8 @@ pick_dp_hash_select_group(struct xlate_ctx *ctx, struct group_dpif *group) } static struct ofputil_bucket * -pick_select_group(struct xlate_ctx *ctx, struct group_dpif *group) +pick_select_group(struct xlate_ctx *ctx, struct group_dpif *group, + bool *is_dp_hash_recirc) { /* Select groups may access flow keys beyond L2 in order to * select a bucket. Recirculate as appropriate to make this possible. @@ -5029,7 +5032,7 @@ pick_select_group(struct xlate_ctx *ctx, struct group_dpif *group) return pick_hash_fields_select_group(ctx, group); break; case SEL_METHOD_DP_HASH: - return pick_dp_hash_select_group(ctx, group); + return pick_dp_hash_select_group(ctx, group, is_dp_hash_recirc); break; default: /* Parsing of groups ensures this never happens */ @@ -5039,6 +5042,18 @@ pick_select_group(struct xlate_ctx *ctx, struct group_dpif *group) return NULL; } +static void +xlate_group_action_report(struct xlate_ctx *ctx, + bool is_dp_hash_recirc) +{ + if (is_dp_hash_recirc) { + xlate_report(ctx, OFT_DETAIL, + "selection method in use: dp_hash, recirculating"); + } else { + xlate_report(ctx, OFT_DETAIL, "no live bucket"); + } +} + static void xlate_group_action__(struct xlate_ctx *ctx, struct group_dpif *group, bool is_last_action) @@ -5053,8 +5068,9 @@ xlate_group_action__(struct xlate_ctx *ctx, struct group_dpif *group, xlate_group_stats(ctx, group, NULL); } else { struct ofputil_bucket *bucket; + bool is_dp_hash_recirc = false; if (group->up.type == OFPGT11_SELECT) { - bucket = pick_select_group(ctx, group); + bucket = pick_select_group(ctx, group, &is_dp_hash_recirc); } else if (group->up.type == OFPGT11_FF) { bucket = pick_ff_group(ctx, group); } else { @@ -5067,7 +5083,7 @@ xlate_group_action__(struct xlate_ctx *ctx, struct group_dpif *group, xlate_group_bucket(ctx, bucket, is_last_action); xlate_group_stats(ctx, group, bucket); } else { - xlate_report(ctx, OFT_DETAIL, "no live bucket"); + xlate_group_action_report(ctx, is_dp_hash_recirc); if (ctx->xin->xcache) { ofproto_group_unref(&group->up); } diff --git a/tests/ofproto-dpif.at b/tests/ofproto-dpif.at index 7ebbee56d..794e3b06a 100644 --- a/tests/ofproto-dpif.at +++ b/tests/ofproto-dpif.at @@ -13328,3 +13328,34 @@ AT_CHECK([ovs-appctl coverage/read-counter revalidate_missing_dp_flow], [0], OVS_VSWITCHD_STOP(["/failed to flow_del (No such file or directory)/d"]) AT_CLEANUP + + +AT_SETUP([ofproto-dpif - dp_hash action tracing]) +OVS_VSWITCHD_START +add_of_ports br0 1 2 + +AT_CHECK([ovs-ofctl -O OpenFlow15 add-group br0 \ + 'group_id=1,type=select,bucket=bucket_id:0,weight:10,actions=output:p1']) + +AT_CHECK([ovs-ofctl -O OpenFlow15 add-flow br0 \ + 'in_port=3,dl_src=de:9c:43:99:7c:46,dl_dst=ce:5c:1e:cd:2b:12,actions=group:1']) + +AT_CHECK([ovs-appctl ofproto/trace br0 \ + in_port=3,tcp,dl_src=de:9c:43:99:7c:46,dl_dst=ce:5c:1e:cd:2b:12,nw_src=10.2.0.2,nw_dst=10.2.0.3 | sed -n '7p'], [0], [dnl + -> selection method in use: dp_hash, recirculating +]) + +AT_CHECK([ovs-ofctl -O OpenFlow15 add-group br0 \ + 'group_id=2,type=select,selection_method=dp_hash']) + +AT_CHECK([ovs-ofctl -O OpenFlow15 add-flow br0 \ + 'in_port=4,dl_src=de:9c:43:99:7c:46,dl_dst=ce:5c:1e:cd:2b:12,actions=group:2']) + +AT_CHECK([ovs-appctl ofproto/trace br0 \ + in_port=4,tcp,dl_src=de:9c:43:99:7c:46,dl_dst=ce:5c:1e:cd:2b:12,nw_src=10.2.0.2,nw_dst=10.2.0.3 | sed -n '7p'], [0], [dnl + -> no live bucket +]) + + +OVS_VSWITCHD_STOP +AT_CLEANUP -- 2.48.1 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
