Calling dpif_probe_feature() should return if supported or not
without relation to the dpif name.

Signed-off-by: Roi Dayan <r...@nvidia.com>
Reviewed-by: Eli Britstein <el...@nvidia.com>
---
 lib/dpif.c             | 10 ----------
 lib/dpif.h             |  1 -
 ofproto/ofproto-dpif.c | 38 ++++++++++++++++++++++++++++++++++++--
 3 files changed, 36 insertions(+), 13 deletions(-)

diff --git a/lib/dpif.c b/lib/dpif.c
index 35c1e2730dc1..0f6b1cb57fcb 100644
--- a/lib/dpif.c
+++ b/lib/dpif.c
@@ -1930,16 +1930,6 @@ log_flow_get_message(const struct dpif *dpif,
     }
 }
 
-bool
-dpif_supports_lb_output_action(const struct dpif *dpif)
-{
-    /*
-     * Balance-tcp optimization is currently supported in netdev
-     * datapath only.
-     */
-    return dpif_is_netdev(dpif);
-}
-
 /* Meters */
 void
 dpif_meter_get_features(const struct dpif *dpif,
diff --git a/lib/dpif.h b/lib/dpif.h
index b41aa909a9f9..5c682f4abd3d 100644
--- a/lib/dpif.h
+++ b/lib/dpif.h
@@ -917,7 +917,6 @@ int dpif_meter_del(struct dpif *, ofproto_meter_id meter_id,
 int dpif_bond_add(struct dpif *, uint32_t bond_id, odp_port_t *member_map);
 int dpif_bond_del(struct dpif *, uint32_t bond_id);
 int dpif_bond_stats_get(struct dpif *, uint32_t bond_id, uint64_t *n_bytes);
-bool dpif_supports_lb_output_action(const struct dpif *);
 
 
 /* Cache */
diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
index 2aefbd7e5c2a..498a29947ddf 100644
--- a/ofproto/ofproto-dpif.c
+++ b/ofproto/ofproto-dpif.c
@@ -1426,6 +1426,41 @@ check_tnl_pop_action(struct dpif_backer *backer)
     return supported;
 }
 
+/* Tests whether backer's datapath supports the
+ * OVS_ACTION_ATTR_LB_OUTPUT action. */
+static bool
+check_lb_output_action(struct dpif_backer *backer)
+{
+    uint8_t actbuf[NL_A_U32_SIZE];
+    struct odputil_keybuf keybuf;
+    struct ofpbuf actions;
+    struct ofpbuf key;
+    bool supported;
+
+    struct flow flow = {
+        .dl_type = CONSTANT_HTONS(0x1234), /* bogus */
+    };
+    struct odp_flow_key_parms odp_parms = {
+        .flow = &flow,
+        .probe = true,
+    };
+
+    ofpbuf_use_stack(&key, &keybuf, sizeof keybuf);
+    odp_flow_key_from_flow(&odp_parms, &key);
+
+    ofpbuf_use_stack(&actions, &actbuf, sizeof actbuf);
+    nl_msg_put_u32(&actions, OVS_ACTION_ATTR_LB_OUTPUT, 0);
+
+    supported = dpif_probe_feature(backer->dpif, "lb_output", &key, &actions,
+                                   NULL);
+
+    VLOG_INFO("%s: Datapath %s lb_output action",
+              dpif_name(backer->dpif),
+              (supported) ? "supports" : "does not support");
+
+    return supported;
+}
+
 /* Tests whether backer's datapath supports the OVS_ACTION_ATTR_DROP action. */
 static bool
 check_drop_action(struct dpif_backer *backer)
@@ -1770,8 +1805,7 @@ check_support(struct dpif_backer *backer)
     backer->rt_support.ct_timeout = check_ct_timeout_policy(backer);
     atomic_store_relaxed(&backer->rt_support.explicit_drop_action,
                          check_drop_action(backer));
-    backer->rt_support.lb_output_action =
-        dpif_supports_lb_output_action(backer->dpif);
+    backer->rt_support.lb_output_action = check_lb_output_action(backer);
     backer->rt_support.ct_zero_snat = dpif_supports_ct_zero_snat(backer);
     backer->rt_support.add_mpls = check_add_mpls(backer);
     backer->rt_support.psample = check_psample(backer);
-- 
2.21.0

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to