[ovs-dev] [RFC ovn 3/6] actions: Rename xxx_lookup_mac to xxx_lookup_mac_bind.

Han Zhou hzhou at ovn.org
Wed Jun 10 19:00:10 UTC 2020


For the functions related to lookup_arp/lookup_nd, renaming them to
avoid confusion, because those functions checks both mac and ip in
mac-bindings. This patch renames them so that a future patch can
add a function that only looks up by ip without confusing names.

This patch also removes the unnecessary OVS_UNUSED for the function
execute_lookup_mac() in ovn-trace.c.

Signed-off-by: Han Zhou <hzhou at ovn.org>
---
 lib/actions.c         | 21 +++++++++++----------
 utilities/ovn-trace.c | 13 +++++++------
 2 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/lib/actions.c b/lib/actions.c
index c506151..22c0e76 100644
--- a/lib/actions.c
+++ b/lib/actions.c
@@ -1847,8 +1847,9 @@ ovnact_put_mac_bind_free(struct ovnact_put_mac_bind *put_mac OVS_UNUSED)
 {
 }
 
-static void format_lookup_mac(const struct ovnact_lookup_mac_bind *lookup_mac,
-                              struct ds *s, const char *name)
+static void format_lookup_mac_bind(
+    const struct ovnact_lookup_mac_bind *lookup_mac,
+    struct ds *s, const char *name)
 {
     expr_field_format(&lookup_mac->dst, s);
     ds_put_format(s, " = %s(", name);
@@ -1864,21 +1865,21 @@ static void
 format_LOOKUP_ARP(const struct ovnact_lookup_mac_bind *lookup_mac,
                          struct ds *s)
 {
-    format_lookup_mac(lookup_mac, s, "lookup_arp");
+    format_lookup_mac_bind(lookup_mac, s, "lookup_arp");
 }
 
 static void
 format_LOOKUP_ND(const struct ovnact_lookup_mac_bind *lookup_mac,
                         struct ds *s)
 {
-    format_lookup_mac(lookup_mac, s, "lookup_nd");
+    format_lookup_mac_bind(lookup_mac, s, "lookup_nd");
 }
 
 static void
-encode_lookup_mac(const struct ovnact_lookup_mac_bind *lookup_mac,
-                  enum mf_field_id ip_field,
-                  const struct ovnact_encode_params *ep,
-                  struct ofpbuf *ofpacts)
+encode_lookup_mac_bind(const struct ovnact_lookup_mac_bind *lookup_mac,
+                       enum mf_field_id ip_field,
+                       const struct ovnact_encode_params *ep,
+                       struct ofpbuf *ofpacts)
 {
     const struct arg args[] = {
         { expr_resolve_field(&lookup_mac->port), MFF_LOG_INPORT },
@@ -1908,7 +1909,7 @@ encode_LOOKUP_ARP(const struct ovnact_lookup_mac_bind *lookup_mac,
                   const struct ovnact_encode_params *ep,
                   struct ofpbuf *ofpacts)
 {
-    encode_lookup_mac(lookup_mac, MFF_REG0, ep, ofpacts);
+    encode_lookup_mac_bind(lookup_mac, MFF_REG0, ep, ofpacts);
 }
 
 static void
@@ -1916,7 +1917,7 @@ encode_LOOKUP_ND(const struct ovnact_lookup_mac_bind *lookup_mac,
                         const struct ovnact_encode_params *ep,
                         struct ofpbuf *ofpacts)
 {
-    encode_lookup_mac(lookup_mac, MFF_XXREG0, ep, ofpacts);
+    encode_lookup_mac_bind(lookup_mac, MFF_XXREG0, ep, ofpacts);
 }
 
 static void
diff --git a/utilities/ovn-trace.c b/utilities/ovn-trace.c
index d7251e7..146560c 100644
--- a/utilities/ovn-trace.c
+++ b/utilities/ovn-trace.c
@@ -1745,10 +1745,10 @@ execute_get_mac_bind(const struct ovnact_get_mac_bind *bind,
 }
 
 static void
-execute_lookup_mac(const struct ovnact_lookup_mac_bind *bind OVS_UNUSED,
-                   const struct ovntrace_datapath *dp OVS_UNUSED,
-                   struct flow *uflow OVS_UNUSED,
-                   struct ovs_list *super OVS_UNUSED)
+execute_lookup_mac_bind(const struct ovnact_lookup_mac_bind *bind,
+                        const struct ovntrace_datapath *dp,
+                        struct flow *uflow,
+                        struct ovs_list *super)
 {
     /* Get logical port number.*/
     struct mf_subfield port_sf = expr_resolve_field(&bind->port);
@@ -2208,11 +2208,12 @@ trace_actions(const struct ovnact *ovnacts, size_t ovnacts_len,
             break;
 
         case OVNACT_LOOKUP_ARP:
-            execute_lookup_mac(ovnact_get_LOOKUP_ARP(a), dp, uflow, super);
+            execute_lookup_mac_bind(ovnact_get_LOOKUP_ARP(a), dp, uflow,
+                                    super);
             break;
 
         case OVNACT_LOOKUP_ND:
-            execute_lookup_mac(ovnact_get_LOOKUP_ND(a), dp, uflow, super);
+            execute_lookup_mac_bind(ovnact_get_LOOKUP_ND(a), dp, uflow, super);
             break;
 
         case OVNACT_PUT_DHCPV4_OPTS:
-- 
2.1.0



More information about the dev mailing list