+static void
+format_odp_sample_action(struct ds *ds, const struct nlattr *attr)
+{
+ static const struct nl_policy ovs_sample_policy[] = {
+ [OVS_SAMPLE_ATTR_PROBABILITY] = { .type = NL_A_U32 },
+ [OVS_SAMPLE_ATTR_ACTIONS] = { .type = NL_A_NESTED }
+ };
+ struct nlattr *a[ARRAY_SIZE(ovs_sample_policy)];
+ double percentage;
+ const struct nlattr *nla_acts;
+ int len;
+
+ ds_put_cstr(ds, "sample");
+
+ if (!nl_parse_nested(attr, ovs_sample_policy, a, ARRAY_SIZE(a))) {
+ ds_put_cstr(ds, "(error)");
+ return;
+ }
+
+ percentage = (100.0 * nl_attr_get_u32(a[OVS_SAMPLE_ATTR_PROBABILITY])) /
+ UINT32_MAX;
+
+ ds_put_format(ds, "(sample=%.1f%%,", percentage);
+
+ ds_put_cstr(ds, "actions(");
+ nla_acts = nl_attr_get(a[OVS_SAMPLE_ATTR_ACTIONS]);
+ len = nl_attr_get_size(a[OVS_SAMPLE_ATTR_ACTIONS]);
+ format_odp_actions(ds, nla_acts, len);
+ ds_put_format(ds, "))");
+}
+