[ovs-dev] [PATCH v2] [OVN-northd] Rename nbs/nbr port names to nbsp/nbrp

Hui Kang hkang.sunysb at gmail.com
Tue Jul 19 14:16:54 UTC 2016


These variables indicate ports in nb switches or routers.

Signed-off-by: Hui Kang <kangh at us.ibm.com>

--
v1->v2:
- modify commit message
---
 ovn/northd/ovn-northd.c | 196 ++++++++++++++++++++++++------------------------
 1 file changed, 98 insertions(+), 98 deletions(-)

diff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c
index 1599e18..5bc5408 100644
--- a/ovn/northd/ovn-northd.c
+++ b/ovn/northd/ovn-northd.c
@@ -486,9 +486,9 @@ struct ovn_port {
     char *key;                  /* nbs->name, nbr->name, sb->logical_port. */
     char *json_key;             /* 'key', quoted for use in JSON. */
 
-    const struct nbrec_logical_switch_port *nbs; /* May be NULL. */
-    const struct nbrec_logical_router_port *nbr; /* May be NULL. */
-    const struct sbrec_port_binding *sb;         /* May be NULL. */
+    const struct nbrec_logical_switch_port *nbsp; /* May be NULL. */
+    const struct nbrec_logical_router_port *nbrp; /* May be NULL. */
+    const struct sbrec_port_binding *sb;          /* May be NULL. */
 
     /* Logical router port data. */
     ovs_be32 ip, mask;          /* 192.168.10.123/24. */
@@ -504,8 +504,8 @@ struct ovn_port {
 
 static struct ovn_port *
 ovn_port_create(struct hmap *ports, const char *key,
-                const struct nbrec_logical_switch_port *nbs,
-                const struct nbrec_logical_router_port *nbr,
+                const struct nbrec_logical_switch_port *nbsp,
+                const struct nbrec_logical_router_port *nbrp,
                 const struct sbrec_port_binding *sb)
 {
     struct ovn_port *op = xzalloc(sizeof *op);
@@ -516,8 +516,8 @@ ovn_port_create(struct hmap *ports, const char *key,
 
     op->key = xstrdup(key);
     op->sb = sb;
-    op->nbs = nbs;
-    op->nbr = nbr;
+    op->nbsp = nbsp;
+    op->nbrp = nbrp;
     hmap_insert(ports, &op->key_node, hash_string(op->key, 0));
     return op;
 }
@@ -578,21 +578,21 @@ join_logical_ports(struct northd_context *ctx,
     HMAP_FOR_EACH (od, key_node, datapaths) {
         if (od->nbs) {
             for (size_t i = 0; i < od->nbs->n_ports; i++) {
-                const struct nbrec_logical_switch_port *nbs = od->nbs->ports[i];
-                struct ovn_port *op = ovn_port_find(ports, nbs->name);
+                const struct nbrec_logical_switch_port *nbsp = od->nbs->ports[i];
+                struct ovn_port *op = ovn_port_find(ports, nbsp->name);
                 if (op) {
-                    if (op->nbs || op->nbr) {
+                    if (op->nbsp || op->nbrp) {
                         static struct vlog_rate_limit rl
                             = VLOG_RATE_LIMIT_INIT(5, 1);
                         VLOG_WARN_RL(&rl, "duplicate logical port %s",
-                                     nbs->name);
+                                     nbsp->name);
                         continue;
                     }
-                    op->nbs = nbs;
+                    op->nbsp = nbsp;
                     ovs_list_remove(&op->list);
                     ovs_list_push_back(both, &op->list);
                 } else {
-                    op = ovn_port_create(ports, nbs->name, nbs, NULL, NULL);
+                    op = ovn_port_create(ports, nbsp->name, nbsp, NULL, NULL);
                     ovs_list_push_back(nb_only, &op->list);
                 }
 
@@ -600,41 +600,41 @@ join_logical_ports(struct northd_context *ctx,
             }
         } else {
             for (size_t i = 0; i < od->nbr->n_ports; i++) {
-                const struct nbrec_logical_router_port *nbr
+                const struct nbrec_logical_router_port *nbrp
                     = od->nbr->ports[i];
 
                 struct eth_addr mac;
-                if (!eth_addr_from_string(nbr->mac, &mac)) {
+                if (!eth_addr_from_string(nbrp->mac, &mac)) {
                     static struct vlog_rate_limit rl
                         = VLOG_RATE_LIMIT_INIT(5, 1);
-                    VLOG_WARN_RL(&rl, "bad 'mac' %s", nbr->mac);
+                    VLOG_WARN_RL(&rl, "bad 'mac' %s", nbrp->mac);
                     continue;
                 }
 
                 ovs_be32 ip, mask;
-                char *error = ip_parse_masked(nbr->network, &ip, &mask);
+                char *error = ip_parse_masked(nbrp->network, &ip, &mask);
                 if (error || mask == OVS_BE32_MAX || !ip_is_cidr(mask)) {
                     static struct vlog_rate_limit rl
                         = VLOG_RATE_LIMIT_INIT(5, 1);
-                    VLOG_WARN_RL(&rl, "bad 'network' %s", nbr->network);
+                    VLOG_WARN_RL(&rl, "bad 'network' %s", nbrp->network);
                     free(error);
                     continue;
                 }
 
-                struct ovn_port *op = ovn_port_find(ports, nbr->name);
+                struct ovn_port *op = ovn_port_find(ports, nbrp->name);
                 if (op) {
-                    if (op->nbs || op->nbr) {
+                    if (op->nbsp || op->nbrp) {
                         static struct vlog_rate_limit rl
                             = VLOG_RATE_LIMIT_INIT(5, 1);
                         VLOG_WARN_RL(&rl, "duplicate logical router port %s",
-                                     nbr->name);
+                                     nbrp->name);
                         continue;
                     }
-                    op->nbr = nbr;
+                    op->nbrp = nbrp;
                     ovs_list_remove(&op->list);
                     ovs_list_push_back(both, &op->list);
                 } else {
-                    op = ovn_port_create(ports, nbr->name, NULL, nbr, NULL);
+                    op = ovn_port_create(ports, nbrp->name, NULL, nbrp, NULL);
                     ovs_list_push_back(nb_only, &op->list);
                 }
 
@@ -665,14 +665,14 @@ join_logical_ports(struct northd_context *ctx,
      * to their peers. */
     struct ovn_port *op;
     HMAP_FOR_EACH (op, key_node, ports) {
-        if (op->nbs && !strcmp(op->nbs->type, "router")) {
-            const char *peer_name = smap_get(&op->nbs->options, "router-port");
+        if (op->nbsp && !strcmp(op->nbsp->type, "router")) {
+            const char *peer_name = smap_get(&op->nbsp->options, "router-port");
             if (!peer_name) {
                 continue;
             }
 
             struct ovn_port *peer = ovn_port_find(ports, peer_name);
-            if (!peer || !peer->nbr) {
+            if (!peer || !peer->nbrp) {
                 continue;
             }
 
@@ -682,8 +682,8 @@ join_logical_ports(struct northd_context *ctx,
                 op->od->router_ports,
                 sizeof *op->od->router_ports * (op->od->n_router_ports + 1));
             op->od->router_ports[op->od->n_router_ports++] = op;
-        } else if (op->nbr && op->nbr->peer) {
-            op->peer = ovn_port_find(ports, op->nbr->peer);
+        } else if (op->nbrp && op->nbrp->peer) {
+            op->peer = ovn_port_find(ports, op->nbrp->peer);
         }
     }
 }
@@ -692,7 +692,7 @@ static void
 ovn_port_update_sbrec(const struct ovn_port *op)
 {
     sbrec_port_binding_set_datapath(op->sb, op->od->sb);
-    if (op->nbr) {
+    if (op->nbrp) {
         /* If the router is for l3 gateway, it resides on a chassis
          * and its port type is "gateway". */
         const char *chassis = smap_get(&op->od->nbr->options, "chassis");
@@ -716,9 +716,9 @@ ovn_port_update_sbrec(const struct ovn_port *op)
         sbrec_port_binding_set_tag(op->sb, NULL, 0);
         sbrec_port_binding_set_mac(op->sb, NULL, 0);
     } else {
-        if (strcmp(op->nbs->type, "router")) {
-            sbrec_port_binding_set_type(op->sb, op->nbs->type);
-            sbrec_port_binding_set_options(op->sb, &op->nbs->options);
+        if (strcmp(op->nbsp->type, "router")) {
+            sbrec_port_binding_set_type(op->sb, op->nbsp->type);
+            sbrec_port_binding_set_options(op->sb, &op->nbsp->options);
         } else {
             const char *chassis = NULL;
             if (op->peer && op->peer->od && op->peer->od->nbr) {
@@ -733,7 +733,7 @@ ovn_port_update_sbrec(const struct ovn_port *op)
                 sbrec_port_binding_set_type(op->sb, "patch");
             }
 
-            const char *router_port = smap_get(&op->nbs->options,
+            const char *router_port = smap_get(&op->nbsp->options,
                                                "router-port");
             if (!router_port) {
                 router_port = "<error>";
@@ -747,10 +747,10 @@ ovn_port_update_sbrec(const struct ovn_port *op)
             sbrec_port_binding_set_options(op->sb, &new);
             smap_destroy(&new);
         }
-        sbrec_port_binding_set_parent_port(op->sb, op->nbs->parent_name);
-        sbrec_port_binding_set_tag(op->sb, op->nbs->tag, op->nbs->n_tag);
-        sbrec_port_binding_set_mac(op->sb, (const char **) op->nbs->addresses,
-                                   op->nbs->n_addresses);
+        sbrec_port_binding_set_parent_port(op->sb, op->nbsp->parent_name);
+        sbrec_port_binding_set_tag(op->sb, op->nbsp->tag, op->nbsp->n_tag);
+        sbrec_port_binding_set_mac(op->sb, (const char **) op->nbsp->addresses,
+                                   op->nbsp->n_addresses);
     }
 }
 
@@ -1104,12 +1104,12 @@ build_port_security_ipv6_flow(
 static void
 build_port_security_nd(struct ovn_port *op, struct hmap *lflows)
 {
-    for (size_t i = 0; i < op->nbs->n_port_security; i++) {
+    for (size_t i = 0; i < op->nbsp->n_port_security; i++) {
         struct lport_addresses ps;
-        if (!extract_lsp_addresses(op->nbs->port_security[i], &ps, true)) {
+        if (!extract_lsp_addresses(op->nbsp->port_security[i], &ps, true)) {
             static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 1);
             VLOG_INFO_RL(&rl, "invalid syntax '%s' in port security. No MAC"
-                         " address found", op->nbs->port_security[i]);
+                         " address found", op->nbsp->port_security[i]);
             continue;
         }
 
@@ -1199,9 +1199,9 @@ build_port_security_ip(enum ovn_pipeline pipeline, struct ovn_port *op,
         stage = S_SWITCH_OUT_PORT_SEC_IP;
     }
 
-    for (size_t i = 0; i < op->nbs->n_port_security; i++) {
+    for (size_t i = 0; i < op->nbsp->n_port_security; i++) {
         struct lport_addresses ps;
-        if (!extract_lsp_addresses(op->nbs->port_security[i], &ps, true)) {
+        if (!extract_lsp_addresses(op->nbsp->port_security[i], &ps, true)) {
             continue;
         }
 
@@ -1350,7 +1350,7 @@ build_acls(struct ovn_datapath *od, struct hmap *lflows, struct hmap *ports)
      * defragmentation, in order to match L4 headers. */
     if (has_stateful) {
         HMAP_FOR_EACH (op, key_node, ports) {
-            if (op->od == od && !strcmp(op->nbs->type, "router")) {
+            if (op->od == od && !strcmp(op->nbsp->type, "router")) {
                 /* Can't use ct() for router ports. Consider the
                  * following configuration: lp1(10.0.0.2) on
                  * hostA--ls1--lr0--ls2--lp2(10.0.1.2) on hostB, For a
@@ -1524,11 +1524,11 @@ build_lswitch_flows(struct hmap *datapaths, struct hmap *ports,
      */
     struct ovn_port *op;
     HMAP_FOR_EACH (op, key_node, ports) {
-        if (!op->nbs) {
+        if (!op->nbsp) {
             continue;
         }
 
-        if (!lsp_is_enabled(op->nbs)) {
+        if (!lsp_is_enabled(op->nbsp)) {
             /* Drop packets from disabled logical ports (since logical flow
              * tables are default-drop). */
             continue;
@@ -1537,13 +1537,13 @@ build_lswitch_flows(struct hmap *datapaths, struct hmap *ports,
         struct ds match = DS_EMPTY_INITIALIZER;
         ds_put_format(&match, "inport == %s", op->json_key);
         build_port_security_l2(
-            "eth.src", op->nbs->port_security, op->nbs->n_port_security,
+            "eth.src", op->nbsp->port_security, op->nbsp->n_port_security,
             &match);
         ovn_lflow_add(lflows, op->od, S_SWITCH_IN_PORT_SEC_L2, 50,
                       ds_cstr(&match), "next;");
         ds_destroy(&match);
 
-        if (op->nbs->n_port_security) {
+        if (op->nbsp->n_port_security) {
             build_port_security_ip(P_IN, op, lflows);
             build_port_security_nd(op, lflows);
         }
@@ -1563,11 +1563,11 @@ build_lswitch_flows(struct hmap *datapaths, struct hmap *ports,
     /* Ingress table 3: ARP responder, skip requests coming from localnet ports.
      * (priority 100). */
     HMAP_FOR_EACH (op, key_node, ports) {
-        if (!op->nbs) {
+        if (!op->nbsp) {
             continue;
         }
 
-        if (!strcmp(op->nbs->type, "localnet")) {
+        if (!strcmp(op->nbsp->type, "localnet")) {
             char *match = xasprintf("inport == %s", op->json_key);
             ovn_lflow_add(lflows, op->od, S_SWITCH_IN_ARP_RSP, 100,
                           match, "next;");
@@ -1578,7 +1578,7 @@ build_lswitch_flows(struct hmap *datapaths, struct hmap *ports,
     /* Ingress table 5: ARP responder, reply for known IPs.
      * (priority 50). */
     HMAP_FOR_EACH (op, key_node, ports) {
-        if (!op->nbs) {
+        if (!op->nbsp) {
             continue;
         }
 
@@ -1587,13 +1587,13 @@ build_lswitch_flows(struct hmap *datapaths, struct hmap *ports,
          *  - port is up or
          *  - port type is router
          */
-        if (!lsp_is_up(op->nbs) && strcmp(op->nbs->type, "router")) {
+        if (!lsp_is_up(op->nbsp) && strcmp(op->nbsp->type, "router")) {
             continue;
         }
 
-        for (size_t i = 0; i < op->nbs->n_addresses; i++) {
+        for (size_t i = 0; i < op->nbsp->n_addresses; i++) {
             struct lport_addresses laddrs;
-            if (!extract_lsp_addresses(op->nbs->addresses[i], &laddrs,
+            if (!extract_lsp_addresses(op->nbsp->addresses[i], &laddrs,
                                        false)) {
                 continue;
             }
@@ -1638,11 +1638,11 @@ build_lswitch_flows(struct hmap *datapaths, struct hmap *ports,
     /* Ingress table 6: Destination lookup, broadcast and multicast handling
      * (priority 100). */
     HMAP_FOR_EACH (op, key_node, ports) {
-        if (!op->nbs) {
+        if (!op->nbsp) {
             continue;
         }
 
-        if (lsp_is_enabled(op->nbs)) {
+        if (lsp_is_enabled(op->nbsp)) {
             ovn_multicast_add(mcgroups, &mc_flood, op);
         }
     }
@@ -1657,14 +1657,14 @@ build_lswitch_flows(struct hmap *datapaths, struct hmap *ports,
 
     /* Ingress table 6: Destination lookup, unicast handling (priority 50), */
     HMAP_FOR_EACH (op, key_node, ports) {
-        if (!op->nbs) {
+        if (!op->nbsp) {
             continue;
         }
 
-        for (size_t i = 0; i < op->nbs->n_addresses; i++) {
+        for (size_t i = 0; i < op->nbsp->n_addresses; i++) {
             struct eth_addr mac;
 
-            if (eth_addr_from_string(op->nbs->addresses[i], &mac)) {
+            if (eth_addr_from_string(op->nbsp->addresses[i], &mac)) {
                 struct ds match, actions;
 
                 ds_init(&match);
@@ -1677,8 +1677,8 @@ build_lswitch_flows(struct hmap *datapaths, struct hmap *ports,
                               ds_cstr(&match), ds_cstr(&actions));
                 ds_destroy(&actions);
                 ds_destroy(&match);
-            } else if (!strcmp(op->nbs->addresses[i], "unknown")) {
-                if (lsp_is_enabled(op->nbs)) {
+            } else if (!strcmp(op->nbsp->addresses[i], "unknown")) {
+                if (lsp_is_enabled(op->nbsp)) {
                     ovn_multicast_add(mcgroups, &mc_unknown, op);
                     op->od->has_unknown = true;
                 }
@@ -1687,7 +1687,7 @@ build_lswitch_flows(struct hmap *datapaths, struct hmap *ports,
 
                 VLOG_INFO_RL(&rl,
                              "%s: invalid syntax '%s' in addresses column",
-                             op->nbs->name, op->nbs->addresses[i]);
+                             op->nbsp->name, op->nbsp->addresses[i]);
             }
         }
     }
@@ -1727,15 +1727,15 @@ build_lswitch_flows(struct hmap *datapaths, struct hmap *ports,
      * Priority 150 rules drop packets to disabled logical ports, so that they
      * don't even receive multicast or broadcast packets. */
     HMAP_FOR_EACH (op, key_node, ports) {
-        if (!op->nbs) {
+        if (!op->nbsp) {
             continue;
         }
 
         struct ds match = DS_EMPTY_INITIALIZER;
         ds_put_format(&match, "outport == %s", op->json_key);
-        if (lsp_is_enabled(op->nbs)) {
-            build_port_security_l2("eth.dst", op->nbs->port_security,
-                                   op->nbs->n_port_security, &match);
+        if (lsp_is_enabled(op->nbsp)) {
+            build_port_security_l2("eth.dst", op->nbsp->port_security,
+                                   op->nbsp->n_port_security, &match);
             ovn_lflow_add(lflows, op->od, S_SWITCH_OUT_PORT_SEC_L2, 50,
                           ds_cstr(&match), "output;");
         } else {
@@ -1745,7 +1745,7 @@ build_lswitch_flows(struct hmap *datapaths, struct hmap *ports,
 
         ds_destroy(&match);
 
-        if (op->nbs->n_port_security) {
+        if (op->nbsp->n_port_security) {
             build_port_security_ip(P_OUT, op, lflows);
         }
     }
@@ -1878,11 +1878,11 @@ build_lrouter_flows(struct hmap *datapaths, struct hmap *ports,
     /* Logical router ingress table 0: match (priority 50). */
     struct ovn_port *op;
     HMAP_FOR_EACH (op, key_node, ports) {
-        if (!op->nbr) {
+        if (!op->nbrp) {
             continue;
         }
 
-        if (!lrport_is_enabled(op->nbr)) {
+        if (!lrport_is_enabled(op->nbrp)) {
             /* Drop packets from disabled logical ports (since logical flow
              * tables are default-drop). */
             continue;
@@ -1941,7 +1941,7 @@ build_lrouter_flows(struct hmap *datapaths, struct hmap *ports,
     }
 
     HMAP_FOR_EACH (op, key_node, ports) {
-        if (!op->nbr) {
+        if (!op->nbrp) {
             continue;
         }
 
@@ -2216,7 +2216,7 @@ build_lrouter_flows(struct hmap *datapaths, struct hmap *ports,
      * next-hop IP address (leaving ip4.dst, the packet’s final destination,
      * unchanged), and advances to the next table for ARP resolution. */
     HMAP_FOR_EACH (op, key_node, ports) {
-        if (!op->nbr) {
+        if (!op->nbrp) {
             continue;
         }
 
@@ -2248,7 +2248,7 @@ build_lrouter_flows(struct hmap *datapaths, struct hmap *ports,
      * resolves the IP address in reg0 into an output port in outport and an
      * Ethernet address in eth.dst. */
     HMAP_FOR_EACH (op, key_node, ports) {
-        if (op->nbr) {
+        if (op->nbrp) {
             /* This is a logical router port. If next-hop IP address in 'reg0'
              * matches ip address of this router port, then the packet is
              * intended to eventually be sent to this logical port. Set the
@@ -2256,8 +2256,8 @@ build_lrouter_flows(struct hmap *datapaths, struct hmap *ports,
              *
              * The packet is still in peer's logical pipeline. So the match
              * should be on peer's outport. */
-            if (op->nbr->peer) {
-                struct ovn_port *peer = ovn_port_find(ports, op->nbr->peer);
+            if (op->nbrp->peer) {
+                struct ovn_port *peer = ovn_port_find(ports, op->nbrp->peer);
                 if (!peer) {
                     continue;
                 }
@@ -2274,16 +2274,16 @@ build_lrouter_flows(struct hmap *datapaths, struct hmap *ports,
                 free(actions);
                 free(match);
             }
-        } else if (op->od->n_router_ports && strcmp(op->nbs->type, "router")) {
+        } else if (op->od->n_router_ports && strcmp(op->nbsp->type, "router")) {
             /* This is a logical switch port that backs a VM or a container.
              * Extract its addresses. For each of the address, go through all
              * the router ports attached to the switch (to which this port
              * connects) and if the address in question is reachable from the
              * router port, add an ARP entry in that router's pipeline. */
 
-            for (size_t i = 0; i < op->nbs->n_addresses; i++) {
+            for (size_t i = 0; i < op->nbsp->n_addresses; i++) {
                 struct lport_addresses laddrs;
-                if (!extract_lsp_addresses(op->nbs->addresses[i], &laddrs,
+                if (!extract_lsp_addresses(op->nbsp->addresses[i], &laddrs,
                                            false)) {
                     continue;
                 }
@@ -2295,7 +2295,7 @@ build_lrouter_flows(struct hmap *datapaths, struct hmap *ports,
                          * Logical_Switch_Port is connected to, as
                          * 'peer'. */
                         const char *peer_name = smap_get(
-                            &op->od->router_ports[j]->nbs->options,
+                            &op->od->router_ports[j]->nbsp->options,
                             "router-port");
                         if (!peer_name) {
                             continue;
@@ -2303,7 +2303,7 @@ build_lrouter_flows(struct hmap *datapaths, struct hmap *ports,
 
                         struct ovn_port *peer
                             = ovn_port_find(ports, peer_name);
-                        if (!peer || !peer->nbr) {
+                        if (!peer || !peer->nbrp) {
                             continue;
                         }
 
@@ -2329,7 +2329,7 @@ build_lrouter_flows(struct hmap *datapaths, struct hmap *ports,
 
                 free(laddrs.ipv4_addrs);
             }
-        } else if (!strcmp(op->nbs->type, "router")) {
+        } else if (!strcmp(op->nbsp->type, "router")) {
             /* This is a logical switch port that connects to a router. */
 
             /* The peer of this switch port is the router port for which
@@ -2337,24 +2337,24 @@ build_lrouter_flows(struct hmap *datapaths, struct hmap *ports,
              * ARP entries for all the other router ports connected to
              * the switch in question. */
 
-            const char *peer_name = smap_get(&op->nbs->options,
+            const char *peer_name = smap_get(&op->nbsp->options,
                                              "router-port");
             if (!peer_name) {
                 continue;
             }
 
             struct ovn_port *peer = ovn_port_find(ports, peer_name);
-            if (!peer || !peer->nbr || !peer->ip) {
+            if (!peer || !peer->nbrp || !peer->ip) {
                 continue;
             }
 
             for (size_t j = 0; j < op->od->n_router_ports; j++) {
                 const char *router_port_name = smap_get(
-                                    &op->od->router_ports[j]->nbs->options,
+                                    &op->od->router_ports[j]->nbsp->options,
                                     "router-port");
                 struct ovn_port *router_port = ovn_port_find(ports,
                                                              router_port_name);
-                if (!router_port || !router_port->nbr || !router_port->ip) {
+                if (!router_port || !router_port->nbrp || !router_port->ip) {
                     continue;
                 }
 
@@ -2413,11 +2413,11 @@ build_lrouter_flows(struct hmap *datapaths, struct hmap *ports,
      *
      * Priority 100 rules deliver packets to enabled logical ports. */
     HMAP_FOR_EACH (op, key_node, ports) {
-        if (!op->nbr) {
+        if (!op->nbrp) {
             continue;
         }
 
-        if (!lrport_is_enabled(op->nbr)) {
+        if (!lrport_is_enabled(op->nbrp)) {
             /* Drop packets to disabled logical ports (since logical flow
              * tables are default-drop). */
             continue;
@@ -2555,45 +2555,45 @@ ovnsb_db_run(struct northd_context *ctx)
     }
     struct hmap lports_hmap;
     const struct sbrec_port_binding *sb;
-    const struct nbrec_logical_switch_port *nb;
+    const struct nbrec_logical_switch_port *nbsp;
 
     struct lport_hash_node {
         struct hmap_node node;
-        const struct nbrec_logical_switch_port *nb;
+        const struct nbrec_logical_switch_port *nbsp;
     } *hash_node;
 
     hmap_init(&lports_hmap);
 
-    NBREC_LOGICAL_SWITCH_PORT_FOR_EACH(nb, ctx->ovnnb_idl) {
+    NBREC_LOGICAL_SWITCH_PORT_FOR_EACH(nbsp, ctx->ovnnb_idl) {
         hash_node = xzalloc(sizeof *hash_node);
-        hash_node->nb = nb;
-        hmap_insert(&lports_hmap, &hash_node->node, hash_string(nb->name, 0));
+        hash_node->nbsp = nbsp;
+        hmap_insert(&lports_hmap, &hash_node->node, hash_string(nbsp->name, 0));
     }
 
     SBREC_PORT_BINDING_FOR_EACH(sb, ctx->ovnsb_idl) {
-        nb = NULL;
+        nbsp = NULL;
         HMAP_FOR_EACH_WITH_HASH(hash_node, node,
                                 hash_string(sb->logical_port, 0),
                                 &lports_hmap) {
-            if (!strcmp(sb->logical_port, hash_node->nb->name)) {
-                nb = hash_node->nb;
+            if (!strcmp(sb->logical_port, hash_node->nbsp->name)) {
+                nbsp = hash_node->nbsp;
                 break;
             }
         }
 
-        if (!nb) {
+        if (!nbsp) {
             /* The logical port doesn't exist for this port binding.  This can
              * happen under normal circumstances when ovn-northd hasn't gotten
              * around to pruning the Port_Binding yet. */
             continue;
         }
 
-        if (sb->chassis && (!nb->up || !*nb->up)) {
+        if (sb->chassis && (!nbsp->up || !*nbsp->up)) {
             bool up = true;
-            nbrec_logical_switch_port_set_up(nb, &up, 1);
-        } else if (!sb->chassis && (!nb->up || *nb->up)) {
+            nbrec_logical_switch_port_set_up(nbsp, &up, 1);
+        } else if (!sb->chassis && (!nbsp->up || *nbsp->up)) {
             bool up = false;
-            nbrec_logical_switch_port_set_up(nb, &up, 1);
+            nbrec_logical_switch_port_set_up(nbsp, &up, 1);
         }
     }
 
-- 
1.9.1




More information about the dev mailing list