Re: [ovs-dev] [PATCH 1/3] ovn-northd: Simplify struct ovn_port_group.
Acked-by: Mark Michelson On 08/06/2018 10:44 PM, Han Zhou wrote: Remove the redundant members that's already in nb_pg. Signed-off-by: Han Zhou --- ovn/northd/ovn-northd.c | 12 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c index 067d52d..d2a777f 100644 --- a/ovn/northd/ovn-northd.c +++ b/ovn/northd/ovn-northd.c @@ -3027,8 +3027,6 @@ struct ovn_port_group { struct uuid key;/* nb_pg->header_.uuid. */ const struct nbrec_port_group *nb_pg; struct hmap nb_lswitches; /* NB lswitches related to the port group */ -size_t n_acls; /* Number of ACLs applied to the port group */ -struct nbrec_acl **acls;/* ACLs applied to the port group */ }; static void @@ -3068,8 +3066,8 @@ has_stateful_acl(struct ovn_datapath *od, struct hmap *port_groups) struct ovn_port_group *pg; HMAP_FOR_EACH (pg, key_node, port_groups) { if (ovn_port_group_ls_find(pg, >nbs->header_.uuid)) { -for (size_t i = 0; i < pg->n_acls; i++) { -struct nbrec_acl *acl = pg->acls[i]; +for (size_t i = 0; i < pg->nb_pg->n_acls; i++) { +struct nbrec_acl *acl = pg->nb_pg->acls[i]; if (!strcmp(acl->action, "allow-related")) { return true; } @@ -3558,8 +3556,6 @@ ovn_port_group_create(struct hmap *pgs, struct ovn_port_group *pg = xzalloc(sizeof *pg); pg->key = nb_pg->header_.uuid; pg->nb_pg = nb_pg; -pg->n_acls = nb_pg->n_acls; -pg->acls = nb_pg->acls; hmap_init(>nb_lswitches); hmap_insert(pgs, >key_node, uuid_hash(>key)); return pg; @@ -3723,8 +3719,8 @@ build_acls(struct ovn_datapath *od, struct hmap *lflows, struct ovn_port_group *pg; HMAP_FOR_EACH (pg, key_node, port_groups) { if (ovn_port_group_ls_find(pg, >nbs->header_.uuid)) { -for (size_t i = 0; i < pg->n_acls; i++) { -consider_acl(lflows, od, pg->acls[i], has_stateful); +for (size_t i = 0; i < pg->nb_pg->n_acls; i++) { +consider_acl(lflows, od, pg->nb_pg->acls[i], has_stateful); } } } ___ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev
[ovs-dev] [PATCH 1/3] ovn-northd: Simplify struct ovn_port_group.
Remove the redundant members that's already in nb_pg. Signed-off-by: Han Zhou --- ovn/northd/ovn-northd.c | 12 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c index 067d52d..d2a777f 100644 --- a/ovn/northd/ovn-northd.c +++ b/ovn/northd/ovn-northd.c @@ -3027,8 +3027,6 @@ struct ovn_port_group { struct uuid key;/* nb_pg->header_.uuid. */ const struct nbrec_port_group *nb_pg; struct hmap nb_lswitches; /* NB lswitches related to the port group */ -size_t n_acls; /* Number of ACLs applied to the port group */ -struct nbrec_acl **acls;/* ACLs applied to the port group */ }; static void @@ -3068,8 +3066,8 @@ has_stateful_acl(struct ovn_datapath *od, struct hmap *port_groups) struct ovn_port_group *pg; HMAP_FOR_EACH (pg, key_node, port_groups) { if (ovn_port_group_ls_find(pg, >nbs->header_.uuid)) { -for (size_t i = 0; i < pg->n_acls; i++) { -struct nbrec_acl *acl = pg->acls[i]; +for (size_t i = 0; i < pg->nb_pg->n_acls; i++) { +struct nbrec_acl *acl = pg->nb_pg->acls[i]; if (!strcmp(acl->action, "allow-related")) { return true; } @@ -3558,8 +3556,6 @@ ovn_port_group_create(struct hmap *pgs, struct ovn_port_group *pg = xzalloc(sizeof *pg); pg->key = nb_pg->header_.uuid; pg->nb_pg = nb_pg; -pg->n_acls = nb_pg->n_acls; -pg->acls = nb_pg->acls; hmap_init(>nb_lswitches); hmap_insert(pgs, >key_node, uuid_hash(>key)); return pg; @@ -3723,8 +3719,8 @@ build_acls(struct ovn_datapath *od, struct hmap *lflows, struct ovn_port_group *pg; HMAP_FOR_EACH (pg, key_node, port_groups) { if (ovn_port_group_ls_find(pg, >nbs->header_.uuid)) { -for (size_t i = 0; i < pg->n_acls; i++) { -consider_acl(lflows, od, pg->acls[i], has_stateful); +for (size_t i = 0; i < pg->nb_pg->n_acls; i++) { +consider_acl(lflows, od, pg->nb_pg->acls[i], has_stateful); } } } -- 2.1.0 ___ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev