From patchwork Wed Apr 6 14:10:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Adri=C3=A1n_Moreno?= X-Patchwork-Id: 1613968 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=X5wv7SIH; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.137; helo=smtp4.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KYRJC1Bx9z9sFq for ; Thu, 7 Apr 2022 00:11:06 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 5320541849; Wed, 6 Apr 2022 14:11:04 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xodfQT_38E8C; Wed, 6 Apr 2022 14:11:02 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp4.osuosl.org (Postfix) with ESMTPS id B6B93408D7; Wed, 6 Apr 2022 14:11:01 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 7EAB3C0031; Wed, 6 Apr 2022 14:11:01 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id D3D37C0083 for ; Wed, 6 Apr 2022 14:10:59 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id B56F383313 for ; Wed, 6 Apr 2022 14:10:59 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp1.osuosl.org (amavisd-new); dkim=pass (1024-bit key) header.d=redhat.com Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id jba12VxC51DB for ; Wed, 6 Apr 2022 14:10:58 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp1.osuosl.org (Postfix) with ESMTPS id BB5DE83104 for ; Wed, 6 Apr 2022 14:10:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1649254257; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wemYu5V87RvC1EUvgcc2h+0if9oyiG1WYTr/dNFC1Rc=; b=X5wv7SIHZ+OmDZdvXM0JjV5xkchI6sJ3fvNtpCOPi7r2+3CgEIAC1STWn8U88GV6Dfgaw8 Y0G6P5IJMw8Qp74TVaQRpo2kP35/wjn4FRUDIlXO7xfOOiZJvD0prN7FeYgjyWoKkSTvCD V2lLFuDkrCbn4PdbcSZVecCtFk+zUZ8= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-500-L4FzAHVfOoSw53SgANf5bA-1; Wed, 06 Apr 2022 10:10:55 -0400 X-MC-Unique: L4FzAHVfOoSw53SgANf5bA-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1C29891CBE5 for ; Wed, 6 Apr 2022 14:10:55 +0000 (UTC) Received: from amorenoz.users.ipa.redhat.com (unknown [10.39.193.152]) by smtp.corp.redhat.com (Postfix) with ESMTP id 31EE5515A42; Wed, 6 Apr 2022 14:10:54 +0000 (UTC) From: Adrian Moreno To: dev@openvswitch.org Date: Wed, 6 Apr 2022 16:10:39 +0200 Message-Id: <20220406141041.2336574-2-amorenoz@redhat.com> In-Reply-To: <20220406141041.2336574-1-amorenoz@redhat.com> References: <20220406141041.2336574-1-amorenoz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=amorenoz@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Cc: dceara@redhat.com Subject: [ovs-dev] [PATCH ovn 1/3] treewide: bump ovs and fix problematic loops X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" The minimum changes to adapt to new ovs are: - adapt to changes made in inet_parse_active function by passing an extra NULL argument - fix those places where next variable was being used inside *_SAFE iterators since. Now the next variable might not always be safe to use so extra checks are needed. Signed-off-by: Adrian Moreno --- controller/ofctrl.c | 7 ++++++- lib/actions.c | 2 +- lib/expr.c | 31 ++++++++++++++++++------------- lib/ovn-util.c | 2 +- ovs | 2 +- utilities/ovn-nbctl.c | 6 +++--- utilities/ovn-trace.c | 8 +++++--- 7 files changed, 35 insertions(+), 23 deletions(-) diff --git a/controller/ofctrl.c b/controller/ofctrl.c index a7c2d2011..17d40a708 100644 --- a/controller/ofctrl.c +++ b/controller/ofctrl.c @@ -943,7 +943,12 @@ link_installed_to_desired(struct installed_flow *i, struct desired_flow *d) break; } } - ovs_list_insert(&f->installed_ref_list_node, &d->installed_ref_list_node); + if (!f) { + ovs_list_insert(&i->desired_refs, &d->installed_ref_list_node); + } else { + ovs_list_insert(&f->installed_ref_list_node, + &d->installed_ref_list_node); + } d->installed_flow = i; return installed_flow_get_active(i) == d; } diff --git a/lib/actions.c b/lib/actions.c index 7fe80f458..a3cf747db 100644 --- a/lib/actions.c +++ b/lib/actions.c @@ -2440,7 +2440,7 @@ validate_empty_lb_backends(struct action_context *ctx, switch (o->option->code) { case EMPTY_LB_VIP: - if (!inet_parse_active(c->string, 0, &ss, false)) { + if (!inet_parse_active(c->string, 0, &ss, false, NULL)) { lexer_error(ctx->lexer, "Invalid load balancer VIP '%s'", c->string); return; diff --git a/lib/expr.c b/lib/expr.c index 47ef6108e..058390a16 100644 --- a/lib/expr.c +++ b/lib/expr.c @@ -211,16 +211,17 @@ expr_combine(enum expr_type type, struct expr *a, struct expr *b) } static void -expr_insert_andor(struct expr *andor, struct expr *before, struct expr *new) +expr_insert_andor(struct expr *andor, struct ovs_list *before, + struct expr *new) { if (new->type == andor->type) { if (andor->type == EXPR_T_AND) { /* Conjunction junction, what's your function? */ } - ovs_list_splice(&before->node, new->andor.next, &new->andor); + ovs_list_splice(before, new->andor.next, &new->andor); expr_destroy(new); } else { - ovs_list_insert(&before->node, &new->node); + ovs_list_insert(before, &new->node); } } @@ -2101,7 +2102,8 @@ expr_annotate__(struct expr *expr, const struct shash *symtab, expr_destroy(expr); return NULL; } - expr_insert_andor(expr, next, new_sub); + expr_insert_andor(expr, next ? &next->node : &expr->andor, + new_sub); } *errorp = NULL; return expr; @@ -2301,7 +2303,7 @@ expr_evaluate_condition(struct expr *expr, struct expr *e = expr_evaluate_condition(sub, is_chassis_resident, c_aux); e = expr_fix(e); - expr_insert_andor(expr, next, e); + expr_insert_andor(expr, next ? &next->node : &expr->andor, e); } return expr_fix(expr); @@ -2334,7 +2336,8 @@ expr_simplify(struct expr *expr) case EXPR_T_OR: LIST_FOR_EACH_SAFE (sub, next, node, &expr->andor) { ovs_list_remove(&sub->node); - expr_insert_andor(expr, next, expr_simplify(sub)); + expr_insert_andor(expr, next ? &next->node : &expr->andor, + expr_simplify(sub)); } return expr_fix(expr); @@ -2444,12 +2447,13 @@ crush_and_string(struct expr *expr, const struct expr_symbol *symbol) * EXPR_T_OR with EXPR_T_CMP subexpressions. */ struct expr *sub, *next = NULL; LIST_FOR_EACH_SAFE (sub, next, node, &expr->andor) { + struct ovs_list *next_list = next ? &next->node : &expr->andor; ovs_list_remove(&sub->node); struct expr *new = crush_cmps(sub, symbol); switch (new->type) { case EXPR_T_CMP: if (!singleton) { - ovs_list_insert(&next->node, &new->node); + ovs_list_insert(next_list, &new->node); singleton = new; } else { bool match = !strcmp(new->cmp.string, singleton->cmp.string); @@ -2463,7 +2467,7 @@ crush_and_string(struct expr *expr, const struct expr_symbol *symbol) case EXPR_T_AND: OVS_NOT_REACHED(); case EXPR_T_OR: - ovs_list_insert(&next->node, &new->node); + ovs_list_insert(next_list, &new->node); break; case EXPR_T_BOOLEAN: if (!new->boolean) { @@ -2559,7 +2563,7 @@ crush_and_numeric(struct expr *expr, const struct expr_symbol *symbol) case EXPR_T_AND: OVS_NOT_REACHED(); case EXPR_T_OR: - ovs_list_insert(&next->node, &new->node); + ovs_list_insert(next ? &next->node : &expr->andor, &new->node); break; case EXPR_T_BOOLEAN: if (!new->boolean) { @@ -2725,7 +2729,8 @@ crush_or(struct expr *expr, const struct expr_symbol *symbol) * is now a disjunction of cmps over the same symbol. */ LIST_FOR_EACH_SAFE (sub, next, node, &expr->andor) { ovs_list_remove(&sub->node); - expr_insert_andor(expr, next, crush_cmps(sub, symbol)); + expr_insert_andor(expr, next ? &next->node : &expr->andor, + crush_cmps(sub, symbol)); } expr = expr_fix(expr); if (expr->type != EXPR_T_OR) { @@ -2886,8 +2891,7 @@ expr_normalize_and(struct expr *expr) struct expr *a, *b; LIST_FOR_EACH_SAFE (a, b, node, &expr->andor) { - if (&b->node == &expr->andor - || a->type != EXPR_T_CMP || b->type != EXPR_T_CMP + if (!b || a->type != EXPR_T_CMP || b->type != EXPR_T_CMP || a->cmp.symbol != b->cmp.symbol) { continue; } else if (a->cmp.symbol->width @@ -2964,7 +2968,8 @@ expr_normalize_or(struct expr *expr) } expr_destroy(new); } else { - expr_insert_andor(expr, next, new); + expr_insert_andor(expr, next ? &next->node : &expr->andor, + new); } } else { ovs_assert(sub->type == EXPR_T_CMP || diff --git a/lib/ovn-util.c b/lib/ovn-util.c index a6bb5f03e..81f18d6df 100644 --- a/lib/ovn-util.c +++ b/lib/ovn-util.c @@ -735,7 +735,7 @@ ip_address_and_port_from_lb_key(const char *key, char **ip_address, uint16_t *port, int *addr_family) { struct sockaddr_storage ss; - if (!inet_parse_active(key, 0, &ss, false)) { + if (!inet_parse_active(key, 0, &ss, false, NULL)) { static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 1); VLOG_WARN_RL(&rl, "bad ip address or port for load balancer key %s", key); diff --git a/ovs b/ovs index 498cedc48..b16270e69 160000 --- a/ovs +++ b/ovs @@ -1 +1 @@ -Subproject commit 498cedc483f3239c839c55b4d9f2261b61fb6ace +Subproject commit b16270e69b9c72284fe6f0ab186ce17e41d7af7a diff --git a/utilities/ovn-nbctl.c b/utilities/ovn-nbctl.c index 7bcc2c66a..7fcfa50d4 100644 --- a/utilities/ovn-nbctl.c +++ b/utilities/ovn-nbctl.c @@ -2856,7 +2856,7 @@ nbctl_lb_add(struct ctl_context *ctx) } struct sockaddr_storage ss_vip; - if (!inet_parse_active(lb_vip, 0, &ss_vip, false)) { + if (!inet_parse_active(lb_vip, 0, &ss_vip, false, NULL)) { ctl_error(ctx, "%s: should be an IP address (or an IP address " "and a port number with : as a separator).", lb_vip); return; @@ -2886,7 +2886,7 @@ nbctl_lb_add(struct ctl_context *ctx) struct sockaddr_storage ss_dst; if (lb_vip_port) { - if (!inet_parse_active(token, -1, &ss_dst, false)) { + if (!inet_parse_active(token, -1, &ss_dst, false, NULL)) { ctl_error(ctx, "%s: should be an IP address and a port " "number with : as a separator.", token); goto out; @@ -3032,7 +3032,7 @@ lb_info_add_smap(const struct nbrec_load_balancer *lb, const struct smap_node *node = nodes[i]; struct sockaddr_storage ss; - if (!inet_parse_active(node->key, 0, &ss, false)) { + if (!inet_parse_active(node->key, 0, &ss, false, NULL)) { continue; } diff --git a/utilities/ovn-trace.c b/utilities/ovn-trace.c index 4b652828d..9822618ae 100644 --- a/utilities/ovn-trace.c +++ b/utilities/ovn-trace.c @@ -214,7 +214,7 @@ static void parse_lb_option(const char *s) { struct sockaddr_storage ss; - if (!inet_parse_active(s, 0, &ss, false)) { + if (!inet_parse_active(s, 0, &ss, false, NULL)) { ovs_fatal(0, "%s: bad address", s); } @@ -1388,7 +1388,8 @@ ovntrace_node_prune_summary(struct ovs_list *nodes) sub->type == OVNTRACE_NODE_TABLE) { /* Replace 'sub' by its children, if any, */ ovs_list_remove(&sub->node); - ovs_list_splice(&next->node, sub->subs.next, &sub->subs); + ovs_list_splice(next ? &next->node : nodes, sub->subs.next, + &sub->subs); ovntrace_node_destroy(sub); } } @@ -1432,7 +1433,8 @@ ovntrace_node_prune_hard(struct ovs_list *nodes) sub->type == OVNTRACE_NODE_OUTPUT) { /* Replace 'sub' by its children, if any, */ ovs_list_remove(&sub->node); - ovs_list_splice(&next->node, sub->subs.next, &sub->subs); + ovs_list_splice(next ? &next->node : nodes, sub->subs.next, + &sub->subs); ovntrace_node_destroy(sub); } } From patchwork Wed Apr 6 14:10:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Adri=C3=A1n_Moreno?= X-Patchwork-Id: 1613969 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Wa/qx95c; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::133; helo=smtp2.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KYRJC6gJXz9sFs for ; Thu, 7 Apr 2022 00:11:07 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id CF28C40BB4; Wed, 6 Apr 2022 14:11:05 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id W4GWsR81jY0o; Wed, 6 Apr 2022 14:11:04 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp2.osuosl.org (Postfix) with ESMTPS id 3449840B6E; Wed, 6 Apr 2022 14:11:03 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 41AA5C0087; Wed, 6 Apr 2022 14:11:02 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 49CC8C002C for ; Wed, 6 Apr 2022 14:11:01 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 46ABB40424 for ; Wed, 6 Apr 2022 14:11:01 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qSL-W05C8dPb for ; Wed, 6 Apr 2022 14:11:00 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp2.osuosl.org (Postfix) with ESMTPS id A6DCF40B71 for ; Wed, 6 Apr 2022 14:11:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1649254259; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=egIH5qq4Z/RKYxEvT1MEyX/zflimZrFs1BZ0MGY32Zk=; b=Wa/qx95ckfFWQBfXRujqB2SiX5NGxHMnPQd1CTxzrqGm7bQscWtBoYxHBpfXLawDvmb0KX zEkpEQqYBf6AV2BhdhPDizlbINLBf0gCeWiEs27Q3DTn8bYGBwiQH0QxOZR8OZbI42+9Ss 9qAMGrXTKEINdmrMu4is6Y0IeDS4N88= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-470-Ku-xXcAaPXaEG-DZG5eqhA-1; Wed, 06 Apr 2022 10:10:56 -0400 X-MC-Unique: Ku-xXcAaPXaEG-DZG5eqhA-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0FCD0101A52C for ; Wed, 6 Apr 2022 14:10:56 +0000 (UTC) Received: from amorenoz.users.ipa.redhat.com (unknown [10.39.193.152]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5A89D515A43; Wed, 6 Apr 2022 14:10:55 +0000 (UTC) From: Adrian Moreno To: dev@openvswitch.org Date: Wed, 6 Apr 2022 16:10:40 +0200 Message-Id: <20220406141041.2336574-3-amorenoz@redhat.com> In-Reply-To: <20220406141041.2336574-1-amorenoz@redhat.com> References: <20220406141041.2336574-1-amorenoz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=amorenoz@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Cc: dceara@redhat.com Subject: [ovs-dev] [PATCH ovn 2/3] parallel-hmap: rewrite iterator using multivar helpers X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Rewrite the parallel hmap iterator macros using multivariable iterator helpers to avoid undefined behavior. Suggested-by: Dumitru Ceara Signed-off-by: Adrian Moreno --- lib/ovn-parallel-hmap.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/ovn-parallel-hmap.h b/lib/ovn-parallel-hmap.h index 897208ef8..0f7d68770 100644 --- a/lib/ovn-parallel-hmap.h +++ b/lib/ovn-parallel-hmap.h @@ -58,11 +58,11 @@ extern "C" { * ThreadID + step * i as the JOBID parameter. */ -#define HMAP_FOR_EACH_IN_PARALLEL(NODE, MEMBER, JOBID, HMAP) \ - for (INIT_CONTAINER(NODE, hmap_first_in_bucket_num(HMAP, JOBID), MEMBER); \ - (NODE != OBJECT_CONTAINING(NULL, NODE, MEMBER)) \ - || ((NODE = NULL), false); \ - ASSIGN_CONTAINER(NODE, hmap_next_in_bucket(&(NODE)->MEMBER), MEMBER)) +#define HMAP_FOR_EACH_IN_PARALLEL(NODE, MEMBER, JOBID, HMAP) \ + for (INIT_MULTIVAR(NODE, MEMBER, hmap_first_in_bucket_num(HMAP, JOBID), \ + struct hmap_node); \ + CONDITION_MULTIVAR(NODE, MEMBER, ITER_VAR(NODE) != NULL); \ + UPDATE_MULTIVAR(NODE, hmap_next_in_bucket(ITER_VAR(NODE)))) /* We do not have a SAFE version of the macro, because the hash size is not * atomic and hash removal operations would need to be wrapped with From patchwork Wed Apr 6 14:10:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Adri=C3=A1n_Moreno?= X-Patchwork-Id: 1613970 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=UvJ9fIx4; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KYRJR2nR6z9sFq for ; Thu, 7 Apr 2022 00:11:19 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id D782E610EE; Wed, 6 Apr 2022 14:11:14 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Efa6DCPgskNP; Wed, 6 Apr 2022 14:11:10 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp3.osuosl.org (Postfix) with ESMTPS id 87F366110A; Wed, 6 Apr 2022 14:11:09 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 3FD25C0012; Wed, 6 Apr 2022 14:11:09 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 3C4B9C0012 for ; Wed, 6 Apr 2022 14:11:07 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 6F3A240B71 for ; Wed, 6 Apr 2022 14:11:06 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp2.osuosl.org (amavisd-new); dkim=pass (1024-bit key) header.d=redhat.com Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id s8TeXvcgMOf4 for ; Wed, 6 Apr 2022 14:11:02 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp2.osuosl.org (Postfix) with ESMTPS id 74FBD40B82 for ; Wed, 6 Apr 2022 14:11:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1649254261; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9CXIqVZbwjqXcrrC1iAhIuCYNJnTvK7PMRpfJ1fARu8=; b=UvJ9fIx4dux73LzaH/fdun/3yP1nDSYswONJ9c/JYztsikyZltF56V+JEmioGVFKAKfRoj QeuITtYeKmP5MYruCpSy/oolq2RzCczNjnL7ENeQBjzMfU98GeoLZiog7GQ0XWhv5TUT4J rW84gij1mBpfmttY7vvaeLjydojSHV0= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-645-DtXCfzaGPyOGDZx7SoUDSA-1; Wed, 06 Apr 2022 10:10:57 -0400 X-MC-Unique: DtXCfzaGPyOGDZx7SoUDSA-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 71A5E91CBE2 for ; Wed, 6 Apr 2022 14:10:57 +0000 (UTC) Received: from amorenoz.users.ipa.redhat.com (unknown [10.39.193.152]) by smtp.corp.redhat.com (Postfix) with ESMTP id 657DE515A42; Wed, 6 Apr 2022 14:10:56 +0000 (UTC) From: Adrian Moreno To: dev@openvswitch.org Date: Wed, 6 Apr 2022 16:10:41 +0200 Message-Id: <20220406141041.2336574-4-amorenoz@redhat.com> In-Reply-To: <20220406141041.2336574-1-amorenoz@redhat.com> References: <20220406141041.2336574-1-amorenoz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=amorenoz@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Cc: dceara@redhat.com Subject: [ovs-dev] [PATCH ovn 3/3] treewide: remove next variable in _SAFE loops X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Remove the use of the next variable when possible in _SAFE loops. This makes code more readable and less error prone. Signed-off-by: Adrian Moreno --- controller-vtep/binding.c | 4 +- controller-vtep/gateway.c | 4 +- controller-vtep/vtep.c | 4 +- controller/binding.c | 21 +++--- controller/encaps.c | 4 +- controller/if-status.c | 17 ++--- controller/lflow-cache.c | 3 +- controller/lflow-conj-ids.c | 18 +++-- controller/lflow.c | 36 +++++----- controller/ofctrl-seqno.c | 4 +- controller/ofctrl.c | 77 ++++++++++---------- controller/ovn-controller.c | 20 +++--- controller/patch.c | 4 +- controller/physical.c | 4 +- controller/pinctrl.c | 69 +++++++++--------- controller/vif-plug.c | 8 +-- ic/ovn-ic.c | 12 ++-- lib/expr.c | 20 +++--- lib/extend-table.c | 20 +++--- lib/extend-table.h | 4 +- lib/vif-plug-provider.c | 8 +-- northd/northd.c | 139 +++++++++++++++++------------------- northd/ovn-northd-ddlog.c | 4 +- northd/ovn-northd.c | 16 ++--- utilities/ovn-ic-nbctl.c | 4 +- utilities/ovn-ic-sbctl.c | 4 +- utilities/ovn-nbctl.c | 8 +-- utilities/ovn-sbctl.c | 4 +- utilities/ovn-trace.c | 4 +- 29 files changed, 259 insertions(+), 285 deletions(-) diff --git a/controller-vtep/binding.c b/controller-vtep/binding.c index 01d5a16d2..d46a5858d 100644 --- a/controller-vtep/binding.c +++ b/controller-vtep/binding.c @@ -209,8 +209,8 @@ binding_run(struct controller_vtep_ctx *ctx) } } - struct shash_node *iter, *next; - SHASH_FOR_EACH_SAFE (iter, next, &ps_map) { + struct shash_node *iter; + SHASH_FOR_EACH_SAFE (iter, &ps_map) { struct ps *ps = iter->data; struct shash_node *node; diff --git a/controller-vtep/gateway.c b/controller-vtep/gateway.c index 9fbfc0337..2a8714e9a 100644 --- a/controller-vtep/gateway.c +++ b/controller-vtep/gateway.c @@ -135,11 +135,11 @@ revalidate_gateway(struct controller_vtep_ctx *ctx) simap_put(&gw_chassis_map, pswitch->name, gw_reval_seq); } - struct simap_node *iter, *next; + struct simap_node *iter; /* For 'gw_node' in 'gw_chassis_map' whose data is not * 'gw_reval_seq', it means the corresponding physical switch no * longer exist. So, garbage collects them. */ - SIMAP_FOR_EACH_SAFE (iter, next, &gw_chassis_map) { + SIMAP_FOR_EACH_SAFE (iter, &gw_chassis_map) { if (iter->data != gw_reval_seq) { const struct sbrec_chassis *chassis_rec; diff --git a/controller-vtep/vtep.c b/controller-vtep/vtep.c index ecca00b54..784a7e735 100644 --- a/controller-vtep/vtep.c +++ b/controller-vtep/vtep.c @@ -426,8 +426,8 @@ vtep_macs_run(struct ovsdb_idl_txn *vtep_idl_txn, struct shash *ucast_macs_rmts, SHASH_FOR_EACH (node, ucast_macs_rmts) { vteprec_ucast_macs_remote_delete(node->data); } - struct ls_hash_node *iter, *next; - HMAP_FOR_EACH_SAFE (iter, next, hmap_node, &ls_map) { + struct ls_hash_node *iter; + HMAP_FOR_EACH_SAFE (iter, hmap_node, &ls_map) { struct vtep_rec_physical_locator_list_entry *ploc_entry; vtep_update_mmr(vtep_idl_txn, &iter->locators_list, iter->vtep_ls, iter->mmr_ext); diff --git a/controller/binding.c b/controller/binding.c index 4d62b0858..0788f865d 100644 --- a/controller/binding.c +++ b/controller/binding.c @@ -597,15 +597,15 @@ local_binding_data_init(struct local_binding_data *lbinding_data) void local_binding_data_destroy(struct local_binding_data *lbinding_data) { - struct shash_node *node, *next; + struct shash_node *node; - SHASH_FOR_EACH_SAFE (node, next, &lbinding_data->lports) { + SHASH_FOR_EACH_SAFE (node, &lbinding_data->lports) { struct binding_lport *b_lport = node->data; binding_lport_destroy(b_lport); shash_delete(&lbinding_data->lports, node); } - SHASH_FOR_EACH_SAFE (node, next, &lbinding_data->bindings) { + SHASH_FOR_EACH_SAFE (node, &lbinding_data->bindings) { struct local_binding *lbinding = node->data; local_binding_destroy(lbinding, &lbinding_data->lports); shash_delete(&lbinding_data->bindings, node); @@ -2282,8 +2282,7 @@ binding_handle_port_binding_changes(struct binding_ctx_in *b_ctx_in, } struct shash_node *node; - struct shash_node *node_next; - SHASH_FOR_EACH_SAFE (node, node_next, &deleted_container_pbs) { + SHASH_FOR_EACH_SAFE (node, &deleted_container_pbs) { handled = handle_deleted_vif_lport(node->data, LP_CONTAINER, b_ctx_in, b_ctx_out); shash_delete(&deleted_container_pbs, node); @@ -2292,7 +2291,7 @@ binding_handle_port_binding_changes(struct binding_ctx_in *b_ctx_in, } } - SHASH_FOR_EACH_SAFE (node, node_next, &deleted_virtual_pbs) { + SHASH_FOR_EACH_SAFE (node, &deleted_virtual_pbs) { handled = handle_deleted_vif_lport(node->data, LP_VIRTUAL, b_ctx_in, b_ctx_out); shash_delete(&deleted_virtual_pbs, node); @@ -2301,7 +2300,7 @@ binding_handle_port_binding_changes(struct binding_ctx_in *b_ctx_in, } } - SHASH_FOR_EACH_SAFE (node, node_next, &deleted_vif_pbs) { + SHASH_FOR_EACH_SAFE (node, &deleted_vif_pbs) { handled = handle_deleted_vif_lport(node->data, LP_VIF, b_ctx_in, b_ctx_out); shash_delete(&deleted_vif_pbs, node); @@ -2310,13 +2309,13 @@ binding_handle_port_binding_changes(struct binding_ctx_in *b_ctx_in, } } - SHASH_FOR_EACH_SAFE (node, node_next, &deleted_localport_pbs) { + SHASH_FOR_EACH_SAFE (node, &deleted_localport_pbs) { handle_deleted_vif_lport(node->data, LP_LOCALPORT, b_ctx_in, b_ctx_out); shash_delete(&deleted_localport_pbs, node); } - SHASH_FOR_EACH_SAFE (node, node_next, &deleted_other_pbs) { + SHASH_FOR_EACH_SAFE (node, &deleted_other_pbs) { handle_deleted_lport(node->data, b_ctx_in, b_ctx_out); shash_delete(&deleted_other_pbs, node); } @@ -2632,9 +2631,9 @@ local_binding_handle_stale_binding_lports(struct local_binding *lbinding, } bool handled = true; - struct binding_lport *b_lport, *next; + struct binding_lport *b_lport; const struct sbrec_port_binding *pb; - LIST_FOR_EACH_SAFE (b_lport, next, list_node, &lbinding->binding_lports) { + LIST_FOR_EACH_SAFE (b_lport, list_node, &lbinding->binding_lports) { /* Get the lport type again from the pb. Its possible that the * pb type has changed. */ enum en_lport_type pb_lport_type = get_lport_type(b_lport->pb); diff --git a/controller/encaps.c b/controller/encaps.c index 8e6d290c1..ed01b1368 100644 --- a/controller/encaps.c +++ b/controller/encaps.c @@ -442,8 +442,8 @@ encaps_run(struct ovsdb_idl_txn *ovs_idl_txn, } /* Delete any existing OVN tunnels that were not still around. */ - struct shash_node *node, *next_node; - SHASH_FOR_EACH_SAFE (node, next_node, &tc.chassis) { + struct shash_node *node; + SHASH_FOR_EACH_SAFE (node, &tc.chassis) { struct chassis_node *chassis = node->data; ovsrec_bridge_update_ports_delvalue(chassis->bridge, chassis->port); shash_delete(&tc.chassis, node); diff --git a/controller/if-status.c b/controller/if-status.c index fa4c8bd94..dbdf8b66f 100644 --- a/controller/if-status.c +++ b/controller/if-status.c @@ -133,10 +133,9 @@ if_status_mgr_create(void) void if_status_mgr_clear(struct if_status_mgr *mgr) { - struct shash_node *node_next; struct shash_node *node; - SHASH_FOR_EACH_SAFE (node, node_next, &mgr->ifaces) { + SHASH_FOR_EACH_SAFE (node, &mgr->ifaces) { ovs_iface_destroy(mgr, node->data); } ovs_assert(shash_is_empty(&mgr->ifaces)); @@ -255,14 +254,12 @@ if_status_mgr_update(struct if_status_mgr *mgr, } struct shash *bindings = &binding_data->bindings; - struct hmapx_node *node_next; struct hmapx_node *node; /* Move all interfaces that have been confirmed "up" by the binding module, * from OIF_MARK_UP to OIF_INSTALLED. */ - HMAPX_FOR_EACH_SAFE (node, node_next, - &mgr->ifaces_per_state[OIF_MARK_UP]) { + HMAPX_FOR_EACH_SAFE (node, &mgr->ifaces_per_state[OIF_MARK_UP]) { struct ovs_iface *iface = node->data; if (local_binding_is_up(bindings, iface->id)) { @@ -273,8 +270,7 @@ if_status_mgr_update(struct if_status_mgr *mgr, /* Cleanup all interfaces that have been confirmed "down" by the binding * module. */ - HMAPX_FOR_EACH_SAFE (node, node_next, - &mgr->ifaces_per_state[OIF_MARK_DOWN]) { + HMAPX_FOR_EACH_SAFE (node, &mgr->ifaces_per_state[OIF_MARK_DOWN]) { struct ovs_iface *iface = node->data; if (local_binding_is_down(bindings, iface->id)) { @@ -288,8 +284,7 @@ if_status_mgr_update(struct if_status_mgr *mgr, * Move them from OIF_CLAIMED to OIF_INSTALL_FLOWS. */ bool new_ifaces = false; - HMAPX_FOR_EACH_SAFE (node, node_next, - &mgr->ifaces_per_state[OIF_CLAIMED]) { + HMAPX_FOR_EACH_SAFE (node, &mgr->ifaces_per_state[OIF_CLAIMED]) { struct ovs_iface *iface = node->data; ovs_iface_set_state(mgr, iface, OIF_INSTALL_FLOWS); @@ -315,15 +310,13 @@ if_status_mgr_run(struct if_status_mgr *mgr, { struct ofctrl_acked_seqnos *acked_seqnos = ofctrl_acked_seqnos_get(mgr->iface_seq_type_pb_cfg); - struct hmapx_node *node_next; struct hmapx_node *node; /* Move interfaces from state OIF_INSTALL_FLOWS to OIF_MARK_UP if a * notification has been received aabout their flows being installed * in OVS. */ - HMAPX_FOR_EACH_SAFE (node, node_next, - &mgr->ifaces_per_state[OIF_INSTALL_FLOWS]) { + HMAPX_FOR_EACH_SAFE (node, &mgr->ifaces_per_state[OIF_INSTALL_FLOWS]) { struct ovs_iface *iface = node->data; if (!ofctrl_acked_seqnos_contains(acked_seqnos, diff --git a/controller/lflow-cache.c b/controller/lflow-cache.c index 9c3db06e7..9fca2d744 100644 --- a/controller/lflow-cache.c +++ b/controller/lflow-cache.c @@ -108,9 +108,8 @@ lflow_cache_flush(struct lflow_cache *lc) COVERAGE_INC(lflow_cache_flush); for (size_t i = 0; i < LCACHE_T_MAX; i++) { struct lflow_cache_entry *lce; - struct lflow_cache_entry *lce_next; - HMAP_FOR_EACH_SAFE (lce, lce_next, node, &lc->entries[i]) { + HMAP_FOR_EACH_SAFE (lce, node, &lc->entries[i]) { lflow_cache_delete__(lc, lce); } } diff --git a/controller/lflow-conj-ids.c b/controller/lflow-conj-ids.c index 70c6187e9..79bd08cf6 100644 --- a/controller/lflow-conj-ids.c +++ b/controller/lflow-conj-ids.c @@ -220,8 +220,8 @@ lflow_conj_ids_free(struct conj_ids *conj_ids, const struct uuid *lflow_uuid) if (!ltd) { return; } - struct lflow_conj_node *lflow_conj, *next; - LIST_FOR_EACH_SAFE (lflow_conj, next, list_node, <d->dps) { + struct lflow_conj_node *lflow_conj; + LIST_FOR_EACH_SAFE (lflow_conj, list_node, <d->dps) { lflow_conj_ids_free_(conj_ids, lflow_conj); } hmap_remove(&conj_ids->lflow_to_dps, <d->hmap_node); @@ -238,26 +238,24 @@ lflow_conj_ids_init(struct conj_ids *conj_ids) void lflow_conj_ids_destroy(struct conj_ids *conj_ids) { - struct conj_id_node *conj_id_node, *next; - HMAP_FOR_EACH_SAFE (conj_id_node, next, hmap_node, + struct conj_id_node *conj_id_node; + HMAP_FOR_EACH_SAFE (conj_id_node, hmap_node, &conj_ids->conj_id_allocations) { hmap_remove(&conj_ids->conj_id_allocations, &conj_id_node->hmap_node); free(conj_id_node); } hmap_destroy(&conj_ids->conj_id_allocations); - struct lflow_conj_node *lflow_conj, *l_c_next; - HMAP_FOR_EACH_SAFE (lflow_conj, l_c_next, hmap_node, - &conj_ids->lflow_conj_ids) { + struct lflow_conj_node *lflow_conj; + HMAP_FOR_EACH_SAFE (lflow_conj, hmap_node, &conj_ids->lflow_conj_ids) { hmap_remove(&conj_ids->lflow_conj_ids, &lflow_conj->hmap_node); ovs_list_remove(&lflow_conj->list_node); free(lflow_conj); } hmap_destroy(&conj_ids->lflow_conj_ids); - struct lflow_to_dps_node *ltd, *ltd_next; - HMAP_FOR_EACH_SAFE (ltd, ltd_next, hmap_node, - &conj_ids->lflow_to_dps) { + struct lflow_to_dps_node *ltd; + HMAP_FOR_EACH_SAFE (ltd, hmap_node, &conj_ids->lflow_to_dps) { hmap_remove(&conj_ids->lflow_to_dps, <d->hmap_node); free(ltd); } diff --git a/controller/lflow.c b/controller/lflow.c index 5f0374f72..6801348e6 100644 --- a/controller/lflow.c +++ b/controller/lflow.c @@ -220,10 +220,10 @@ lflow_resource_init(struct lflow_resource_ref *lfrr) void lflow_resource_destroy(struct lflow_resource_ref *lfrr) { - struct ref_lflow_node *rlfn, *rlfn_next; - HMAP_FOR_EACH_SAFE (rlfn, rlfn_next, node, &lfrr->ref_lflow_table) { - struct lflow_ref_list_node *lrln, *next; - HMAP_FOR_EACH_SAFE (lrln, next, hmap_node, &rlfn->lflow_uuids) { + struct ref_lflow_node *rlfn; + HMAP_FOR_EACH_SAFE (rlfn, node, &lfrr->ref_lflow_table) { + struct lflow_ref_list_node *lrln; + HMAP_FOR_EACH_SAFE (lrln, hmap_node, &rlfn->lflow_uuids) { ovs_list_remove(&lrln->list_node); hmap_remove(&rlfn->lflow_uuids, &lrln->hmap_node); free(lrln); @@ -233,8 +233,8 @@ lflow_resource_destroy(struct lflow_resource_ref *lfrr) } hmap_destroy(&lfrr->ref_lflow_table); - struct lflow_ref_node *lfrn, *lfrn_next; - HMAP_FOR_EACH_SAFE (lfrn, lfrn_next, node, &lfrr->lflow_ref_table) { + struct lflow_ref_node *lfrn; + HMAP_FOR_EACH_SAFE (lfrn, node, &lfrr->lflow_ref_table) { hmap_remove(&lfrr->lflow_ref_table, &lfrn->node); free(lfrn); } @@ -342,8 +342,8 @@ lflow_resource_destroy_lflow(struct lflow_resource_ref *lfrr, } hmap_remove(&lfrr->lflow_ref_table, &lfrn->node); - struct lflow_ref_list_node *lrln, *next; - LIST_FOR_EACH_SAFE (lrln, next, list_node, &lfrn->lflow_ref_head) { + struct lflow_ref_list_node *lrln; + LIST_FOR_EACH_SAFE (lrln, list_node, &lfrn->lflow_ref_head) { ovs_list_remove(&lrln->list_node); hmap_remove(&lrln->rlfn->lflow_uuids, &lrln->hmap_node); @@ -435,7 +435,7 @@ lflow_handle_changed_flows(struct lflow_ctx_in *l_ctx_in, * lflow_add_flows_for_datapath() may have been called before calling * this function. */ struct hmap flood_remove_nodes = HMAP_INITIALIZER(&flood_remove_nodes); - struct ofctrl_flood_remove_node *ofrn, *next; + struct ofctrl_flood_remove_node *ofrn; SBREC_LOGICAL_FLOW_TABLE_FOR_EACH_TRACKED (lflow, l_ctx_in->logical_flow_table) { if (lflows_processed_find(l_ctx_out->lflows_processed, @@ -485,7 +485,7 @@ lflow_handle_changed_flows(struct lflow_ctx_in *l_ctx_in, l_ctx_in, l_ctx_out); } } - HMAP_FOR_EACH_SAFE (ofrn, next, hmap_node, &flood_remove_nodes) { + HMAP_FOR_EACH_SAFE (ofrn, hmap_node, &flood_remove_nodes) { hmap_remove(&flood_remove_nodes, &ofrn->hmap_node); free(ofrn); } @@ -690,8 +690,8 @@ consider_lflow_for_added_as_ips__( /* Discard the matches unrelated to the added addresses in the AS * 'as_name'. */ - struct expr_match *m, *m_next; - HMAP_FOR_EACH_SAFE (m, m_next, hmap_node, &matches) { + struct expr_match *m; + HMAP_FOR_EACH_SAFE (m, hmap_node, &matches) { if (!m->as_name || strcmp(m->as_name, as_name) || (has_dummy_ip && !memcmp(&m->as_ip, &dummy_ip, sizeof dummy_ip))) { hmap_remove(&matches, &m->hmap_node); @@ -985,7 +985,7 @@ lflow_handle_changed_ref(enum ref_type ref_type, const char *ref_name, struct ovs_list lflows_todo = OVS_LIST_INITIALIZER(&lflows_todo); - struct lflow_ref_list_node *lrln, *lrln_uuid, *lrln_uuid_next; + struct lflow_ref_list_node *lrln, *lrln_uuid; HMAP_FOR_EACH (lrln, hmap_node, &rlfn->lflow_uuids) { if (lflows_processed_find(l_ctx_out->lflows_processed, &lrln->lflow_uuid)) { @@ -1027,7 +1027,7 @@ lflow_handle_changed_ref(enum ref_type ref_type, const char *ref_name, /* Re-parse the related lflows. */ /* Firstly, flood remove the flows from desired flow table. */ struct hmap flood_remove_nodes = HMAP_INITIALIZER(&flood_remove_nodes); - LIST_FOR_EACH_SAFE (lrln_uuid, lrln_uuid_next, list_node, &lflows_todo) { + LIST_FOR_EACH_SAFE (lrln_uuid, list_node, &lflows_todo) { VLOG_DBG("Reprocess lflow "UUID_FMT" for resource type: %d," " name: %s.", UUID_ARGS(&lrln_uuid->lflow_uuid), @@ -1039,7 +1039,7 @@ lflow_handle_changed_ref(enum ref_type ref_type, const char *ref_name, ofctrl_flood_remove_flows(l_ctx_out->flow_table, &flood_remove_nodes); /* Secondly, for each lflow that is actually removed, reprocessing it. */ - struct ofctrl_flood_remove_node *ofrn, *ofrn_next; + struct ofctrl_flood_remove_node *ofrn; HMAP_FOR_EACH (ofrn, hmap_node, &flood_remove_nodes) { lflow_resource_destroy_lflow(l_ctx_out->lfrr, &ofrn->sb_uuid); lflow_conj_ids_free(l_ctx_out->conj_ids, &ofrn->sb_uuid); @@ -1070,7 +1070,7 @@ lflow_handle_changed_ref(enum ref_type ref_type, const char *ref_name, &nd_ra_opts, &controller_event_opts, false, l_ctx_in, l_ctx_out); } - HMAP_FOR_EACH_SAFE (ofrn, ofrn_next, hmap_node, &flood_remove_nodes) { + HMAP_FOR_EACH_SAFE (ofrn, hmap_node, &flood_remove_nodes) { hmap_remove(&flood_remove_nodes, &ofrn->hmap_node); free(ofrn); } @@ -1544,8 +1544,8 @@ lflows_processed_remove(struct hmap *lflows_processed, void lflows_processed_destroy(struct hmap *lflows_processed) { - struct lflow_processed_node *node, *next; - HMAP_FOR_EACH_SAFE (node, next, hmap_node, lflows_processed) { + struct lflow_processed_node *node; + HMAP_FOR_EACH_SAFE (node, hmap_node, lflows_processed) { hmap_remove(lflows_processed, &node->hmap_node); free(node); } diff --git a/controller/ofctrl-seqno.c b/controller/ofctrl-seqno.c index c9334b078..923de478a 100644 --- a/controller/ofctrl-seqno.c +++ b/controller/ofctrl-seqno.c @@ -173,8 +173,8 @@ ofctrl_seqno_update_create(size_t seqno_type, uint64_t new_cfg) void ofctrl_seqno_run(uint64_t flow_cfg) { - struct ofctrl_seqno_update *update, *prev; - LIST_FOR_EACH_SAFE (update, prev, list_node, &ofctrl_seqno_updates) { + struct ofctrl_seqno_update *update; + LIST_FOR_EACH_SAFE (update, list_node, &ofctrl_seqno_updates) { if (flow_cfg < update->flow_cfg) { break; } diff --git a/controller/ofctrl.c b/controller/ofctrl.c index 17d40a708..a7826f1a3 100644 --- a/controller/ofctrl.c +++ b/controller/ofctrl.c @@ -661,8 +661,8 @@ run_S_CLEAR_FLOWS(void) } /* All flow updates are irrelevant now. */ - struct ofctrl_flow_update *fup, *next; - LIST_FOR_EACH_SAFE (fup, next, list_node, &flow_updates) { + struct ofctrl_flow_update *fup; + LIST_FOR_EACH_SAFE (fup, list_node, &flow_updates) { mem_stats.oflow_update_usage -= ofctrl_flow_update_size(fup); ovs_list_remove(&fup->list_node); free(fup); @@ -987,8 +987,8 @@ unlink_installed_to_desired(struct installed_flow *i, struct desired_flow *d) static void unlink_all_refs_for_installed_flow(struct installed_flow *i) { - struct desired_flow *d, *next; - LIST_FOR_EACH_SAFE (d, next, installed_ref_list_node, &i->desired_refs) { + struct desired_flow *d; + LIST_FOR_EACH_SAFE (d, installed_ref_list_node, &i->desired_refs) { unlink_installed_to_desired(i, d); } } @@ -1414,9 +1414,9 @@ ofctrl_remove_flows_for_as_ip(struct ovn_desired_flow_table *flow_table, * sets. */ return false; } - struct sb_flow_ref *sfr, *next; + struct sb_flow_ref *sfr; size_t count = 0; - LIST_FOR_EACH_SAFE (sfr, next, as_ip_flow_list, &itfn->flows) { + LIST_FOR_EACH_SAFE (sfr, as_ip_flow_list, &itfn->flows) { /* If the desired flow is referenced by multiple sb lflows, it * shouldn't have been indexed by address set. */ ovs_assert(ovs_list_is_short(&sfr->sb_list)); @@ -1457,8 +1457,8 @@ remove_flows_from_sb_to_flow(struct ovn_desired_flow_table *flow_table, struct ovs_list to_be_removed = OVS_LIST_INITIALIZER(&to_be_removed); /* Traverse all flows for the given sb_uuid. */ - struct sb_flow_ref *sfr, *next; - LIST_FOR_EACH_SAFE (sfr, next, flow_list, &stf->flows) { + struct sb_flow_ref *sfr; + LIST_FOR_EACH_SAFE (sfr, flow_list, &stf->flows) { ovs_list_remove(&sfr->sb_list); ovs_list_remove(&sfr->flow_list); ovs_list_remove(&sfr->as_ip_flow_list); @@ -1479,12 +1479,11 @@ remove_flows_from_sb_to_flow(struct ovn_desired_flow_table *flow_table, } } - struct sb_addrset_ref *sar, *next_sar; - LIST_FOR_EACH_SAFE (sar, next_sar, list_node, &stf->addrsets) { + struct sb_addrset_ref *sar; + LIST_FOR_EACH_SAFE (sar, list_node, &stf->addrsets) { ovs_list_remove(&sar->list_node); - struct as_ip_to_flow_node *itfn, *itfn_next; - HMAP_FOR_EACH_SAFE (itfn, itfn_next, hmap_node, - &sar->as_ip_to_flow_map) { + struct as_ip_to_flow_node *itfn; + HMAP_FOR_EACH_SAFE (itfn, hmap_node, &sar->as_ip_to_flow_map) { hmap_remove(&sar->as_ip_to_flow_map, &itfn->hmap_node); ovs_assert(ovs_list_is_empty(&itfn->flows)); mem_stats.sb_flow_ref_usage -= sizeof *itfn; @@ -1505,7 +1504,7 @@ remove_flows_from_sb_to_flow(struct ovn_desired_flow_table *flow_table, /* Detach the items in f->references from the sfr.flow_list lists, * so that recursive calls will not mess up the sfr.sb_list list. */ - struct desired_flow *f, *f_next; + struct desired_flow *f; LIST_FOR_EACH (f, list_node, &to_be_removed) { ovs_assert(!ovs_list_is_empty(&f->references)); LIST_FOR_EACH (sfr, sb_list, &f->references) { @@ -1513,8 +1512,8 @@ remove_flows_from_sb_to_flow(struct ovn_desired_flow_table *flow_table, ovs_list_remove(&sfr->as_ip_flow_list); } } - LIST_FOR_EACH_SAFE (f, f_next, list_node, &to_be_removed) { - LIST_FOR_EACH_SAFE (sfr, next, sb_list, &f->references) { + LIST_FOR_EACH_SAFE (f, list_node, &to_be_removed) { + LIST_FOR_EACH_SAFE (sfr, sb_list, &f->references) { if (!flood_remove_find_node(flood_remove_nodes, &sfr->sb_uuid)) { ofctrl_flood_remove_add_node(flood_remove_nodes, &sfr->sb_uuid); @@ -1793,9 +1792,8 @@ ovn_desired_flow_table_clear(struct ovn_desired_flow_table *flow_table) { flow_table->change_tracked = false; - struct desired_flow *f, *f_next; - LIST_FOR_EACH_SAFE (f, f_next, track_list_node, - &flow_table->tracked_flows) { + struct desired_flow *f; + LIST_FOR_EACH_SAFE (f, track_list_node, &flow_table->tracked_flows) { ovs_list_remove(&f->track_list_node); if (f->is_deleted) { if (f->installed_flow) { @@ -1805,9 +1803,8 @@ ovn_desired_flow_table_clear(struct ovn_desired_flow_table *flow_table) } } - struct sb_to_flow *stf, *next; - HMAP_FOR_EACH_SAFE (stf, next, hmap_node, - &flow_table->uuid_flow_table) { + struct sb_to_flow *stf; + HMAP_FOR_EACH_SAFE (stf, hmap_node, &flow_table->uuid_flow_table) { remove_flows_from_sb_to_flow(flow_table, stf, NULL, NULL); } } @@ -1825,14 +1822,14 @@ ovn_desired_flow_table_destroy(struct ovn_desired_flow_table *flow_table) static void ovn_installed_flow_table_clear(void) { - struct installed_flow *f, *next; - HMAP_FOR_EACH_SAFE (f, next, match_hmap_node, &installed_lflows) { + struct installed_flow *f; + HMAP_FOR_EACH_SAFE (f, match_hmap_node, &installed_lflows) { hmap_remove(&installed_lflows, &f->match_hmap_node); unlink_all_refs_for_installed_flow(f); installed_flow_destroy(f); } - HMAP_FOR_EACH_SAFE (f, next, match_hmap_node, &installed_pflows) { + HMAP_FOR_EACH_SAFE (f, match_hmap_node, &installed_pflows) { hmap_remove(&installed_pflows, &f->match_hmap_node); unlink_all_refs_for_installed_flow(f); installed_flow_destroy(f); @@ -2046,8 +2043,8 @@ update_ovs_meter(struct ovn_extend_table_info *entry, static void ofctrl_meter_bands_clear(void) { - struct shash_node *node, *next; - SHASH_FOR_EACH_SAFE (node, next, &meter_bands) { + struct shash_node *node; + SHASH_FOR_EACH_SAFE (node, &meter_bands) { struct meter_band_entry *mb = node->data; shash_delete(&meter_bands, node); free(mb->bands); @@ -2262,8 +2259,8 @@ update_installed_flows_by_compare(struct ovn_desired_flow_table *flow_table, /* Iterate through all of the installed flows. If any of them are no * longer desired, delete them; if any of them should have different * actions, update them. */ - struct installed_flow *i, *next; - HMAP_FOR_EACH_SAFE (i, next, match_hmap_node, installed_flows) { + struct installed_flow *i; + HMAP_FOR_EACH_SAFE (i, match_hmap_node, installed_flows) { unlink_all_refs_for_installed_flow(i); struct desired_flow *d = desired_flow_lookup(flow_table, &i->flow); if (!d) { @@ -2343,8 +2340,8 @@ static void merge_tracked_flows(struct ovn_desired_flow_table *flow_table) { struct hmap deleted_flows = HMAP_INITIALIZER(&deleted_flows); - struct desired_flow *f, *next; - LIST_FOR_EACH_SAFE (f, next, track_list_node, + struct desired_flow *f; + LIST_FOR_EACH_SAFE (f, track_list_node, &flow_table->tracked_flows) { if (f->is_deleted) { /* reuse f->match_hmap_node field since it is already removed from @@ -2379,7 +2376,7 @@ merge_tracked_flows(struct ovn_desired_flow_table *flow_table) ovs_list_init(&f->track_list_node); } } - HMAP_FOR_EACH_SAFE (f, next, match_hmap_node, &deleted_flows) { + HMAP_FOR_EACH_SAFE (f, match_hmap_node, &deleted_flows) { hmap_remove(&deleted_flows, &f->match_hmap_node); } hmap_destroy(&deleted_flows); @@ -2392,8 +2389,8 @@ update_installed_flows_by_track(struct ovn_desired_flow_table *flow_table, struct ovs_list *msgs) { merge_tracked_flows(flow_table); - struct desired_flow *f, *f_next; - LIST_FOR_EACH_SAFE (f, f_next, track_list_node, + struct desired_flow *f; + LIST_FOR_EACH_SAFE (f, track_list_node, &flow_table->tracked_flows) { ovs_list_remove(&f->track_list_node); if (f->is_deleted) { @@ -2638,8 +2635,8 @@ ofctrl_put(struct ovn_desired_flow_table *lflow_table, /* Iterate through the installed groups from previous runs. If they * are not needed delete them. */ - struct ovn_extend_table_info *installed, *next_group; - EXTEND_TABLE_FOR_EACH_INSTALLED (installed, next_group, groups) { + struct ovn_extend_table_info *installed; + EXTEND_TABLE_FOR_EACH_INSTALLED (installed, groups) { /* Delete the group. */ struct ofputil_group_mod gm; enum ofputil_protocol usable_protocols; @@ -2666,8 +2663,8 @@ ofctrl_put(struct ovn_desired_flow_table *lflow_table, /* Iterate through the installed meters from previous runs. If they * are not needed delete them. */ - struct ovn_extend_table_info *m_installed, *next_meter; - EXTEND_TABLE_FOR_EACH_INSTALLED (m_installed, next_meter, meters) { + struct ovn_extend_table_info *m_installed; + EXTEND_TABLE_FOR_EACH_INSTALLED (m_installed, meters) { /* Delete the meter. */ ofctrl_meter_bands_erase(m_installed, &msgs); ovn_extend_table_remove_existing(meters, m_installed); @@ -2698,8 +2695,8 @@ ofctrl_put(struct ovn_desired_flow_table *lflow_table, } /* Track the flow update. */ - struct ofctrl_flow_update *fup, *prev; - LIST_FOR_EACH_REVERSE_SAFE (fup, prev, list_node, &flow_updates) { + struct ofctrl_flow_update *fup; + LIST_FOR_EACH_REVERSE_SAFE (fup, list_node, &flow_updates) { if (req_cfg < fup->req_cfg) { /* This ofctrl_flow_update is for a configuration later than * 'req_cfg'. This should not normally happen, because it diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c index dd52b45bf..93171047c 100644 --- a/controller/ovn-controller.c +++ b/controller/ovn-controller.c @@ -653,7 +653,7 @@ update_ct_zones(const struct shash *binding_lports, struct simap *ct_zones, unsigned long *ct_zone_bitmap, struct shash *pending_ct_zones) { - struct simap_node *ct_zone, *ct_zone_next; + struct simap_node *ct_zone; int scan_start = 1; const char *user; struct sset all_users = SSET_INITIALIZER(&all_users); @@ -687,7 +687,7 @@ update_ct_zones(const struct shash *binding_lports, } /* Delete zones that do not exist in above sset. */ - SIMAP_FOR_EACH_SAFE(ct_zone, ct_zone_next, ct_zones) { + SIMAP_FOR_EACH_SAFE (ct_zone, ct_zones) { if (!sset_contains(&all_users, ct_zone->name)) { VLOG_DBG("removing ct zone %"PRId32" for '%s'", ct_zone->data, ct_zone->name); @@ -723,8 +723,7 @@ update_ct_zones(const struct shash *binding_lports, */ if (bitmap_is_set(unreq_snat_zones, snat_req_node->data)) { struct simap_node *dup; - struct simap_node *next; - SIMAP_FOR_EACH_SAFE (dup, next, ct_zones) { + SIMAP_FOR_EACH_SAFE (dup, ct_zones) { if (dup != snat_req_node && dup->data == snat_req_node->data) { simap_delete(ct_zones, dup); break; @@ -1431,8 +1430,8 @@ en_addr_sets_clear_tracked_data(void *data) struct ed_type_addr_sets *as = data; sset_clear(&as->new); sset_clear(&as->deleted); - struct shash_node *node, *next; - SHASH_FOR_EACH_SAFE (node, next, &as->updated) { + struct shash_node *node; + SHASH_FOR_EACH_SAFE (node, &as->updated) { struct addr_set_diff *asd = node->data; expr_constant_set_destroy(asd->added); free(asd->added); @@ -1602,8 +1601,8 @@ port_group_ssets_delete(struct shash *port_group_ssets, static void port_group_ssets_clear(struct shash *port_group_ssets) { - struct shash_node *node, *next; - SHASH_FOR_EACH_SAFE (node, next, port_group_ssets) { + struct shash_node *node; + SHASH_FOR_EACH_SAFE (node, port_group_ssets) { struct sset *lports = node->data; shash_delete(port_group_ssets, node); sset_destroy(lports); @@ -3976,9 +3975,8 @@ main(int argc, char *argv[]) * (or it did not change anything in the database). */ ct_zones_data = engine_get_data(&en_ct_zones); if (ct_zones_data) { - struct shash_node *iter, *iter_next; - SHASH_FOR_EACH_SAFE (iter, iter_next, - &ct_zones_data->pending) { + struct shash_node *iter; + SHASH_FOR_EACH_SAFE (iter, &ct_zones_data->pending) { struct ct_zone_pending_entry *ctzpe = iter->data; if (ctzpe->state == CT_ZONE_DB_SENT) { shash_delete(&ct_zones_data->pending, iter); diff --git a/controller/patch.c b/controller/patch.c index 0d0d53894..ed831302c 100644 --- a/controller/patch.c +++ b/controller/patch.c @@ -307,8 +307,8 @@ patch_run(struct ovsdb_idl_txn *ovs_idl_txn, /* Now 'existing_ports' only still contains patch ports that exist in the * database but shouldn't. Delete them from the database. */ - struct shash_node *port_node, *port_next_node; - SHASH_FOR_EACH_SAFE (port_node, port_next_node, &existing_ports) { + struct shash_node *port_node; + SHASH_FOR_EACH_SAFE (port_node, &existing_ports) { port = port_node->data; shash_delete(&existing_ports, port_node); remove_port(bridge_table, port); diff --git a/controller/physical.c b/controller/physical.c index 02fcd5ea8..055fa9ee7 100644 --- a/controller/physical.c +++ b/controller/physical.c @@ -437,9 +437,9 @@ populate_remote_chassis_macs(const struct sbrec_chassis *my_chassis, static void free_remote_chassis_macs(void) { - struct remote_chassis_mac *mac, *next_mac; + struct remote_chassis_mac *mac; - HMAP_FOR_EACH_SAFE (mac, next_mac, hmap_node, &remote_chassis_macs) { + HMAP_FOR_EACH_SAFE (mac, hmap_node, &remote_chassis_macs) { hmap_remove(&remote_chassis_macs, &mac->hmap_node); free(mac->chassis_mac); free(mac->chassis_id); diff --git a/controller/pinctrl.c b/controller/pinctrl.c index 25b37ee88..3f4b60852 100644 --- a/controller/pinctrl.c +++ b/controller/pinctrl.c @@ -391,10 +391,10 @@ init_event_table(void) static void empty_lb_backends_event_gc(bool flush) { - struct empty_lb_backends_event *cur_ce, *next_ce; + struct empty_lb_backends_event *cur_ce; long long int now = time_msec(); - HMAP_FOR_EACH_SAFE (cur_ce, next_ce, hmap_node, + HMAP_FOR_EACH_SAFE (cur_ce, hmap_node, &event_table[OVN_EVENT_EMPTY_LB_BACKENDS]) { if ((now < cur_ce->timestamp + EVENT_TIMEOUT) && !flush) { continue; @@ -657,8 +657,8 @@ init_ipv6_prefixd(void) static void destroy_ipv6_prefixd(void) { - struct shash_node *iter, *next; - SHASH_FOR_EACH_SAFE (iter, next, &ipv6_prefixd) { + struct shash_node *iter; + SHASH_FOR_EACH_SAFE (iter, &ipv6_prefixd) { struct ipv6_prefixd_state *pfd = iter->data; free(pfd); shash_delete(&ipv6_prefixd, iter); @@ -1346,8 +1346,7 @@ prepare_ipv6_prefixd(struct ovsdb_idl_txn *ovnsb_idl_txn, peer->datapath->tunnel_key); } - struct shash_node *next; - SHASH_FOR_EACH_SAFE (iter, next, &ipv6_prefixd) { + SHASH_FOR_EACH_SAFE (iter, &ipv6_prefixd) { struct ipv6_prefixd_state *pfd = iter->data; if (pfd->last_used + IPV6_PREFIXD_STALE_TIMEOUT < time_msec()) { if (pfd->uuid.len) { @@ -1412,8 +1411,8 @@ destroy_buffered_packets(struct buffered_packets *bp) static void destroy_buffered_packets_map(void) { - struct buffered_packets *bp, *next; - HMAP_FOR_EACH_SAFE (bp, next, hmap_node, &buffered_packets_map) { + struct buffered_packets *bp; + HMAP_FOR_EACH_SAFE (bp, hmap_node, &buffered_packets_map) { destroy_buffered_packets(bp); hmap_remove(&buffered_packets_map, &bp->hmap_node); free(bp); @@ -1492,10 +1491,10 @@ buffered_send_packets(struct rconn *swconn, struct buffered_packets *bp, static void buffered_packets_map_gc(void) { - struct buffered_packets *cur_qp, *next_qp; + struct buffered_packets *cur_qp; long long int now = time_msec(); - HMAP_FOR_EACH_SAFE (cur_qp, next_qp, hmap_node, &buffered_packets_map) { + HMAP_FOR_EACH_SAFE (cur_qp, hmap_node, &buffered_packets_map) { if (now > cur_qp->timestamp + BUFFER_MAP_TIMEOUT) { destroy_buffered_packets(cur_qp); hmap_remove(&buffered_packets_map, &cur_qp->hmap_node); @@ -2699,8 +2698,7 @@ sync_dns_cache(const struct sbrec_dns_table *dns_table) } } - struct shash_node *next; - SHASH_FOR_EACH_SAFE (iter, next, &dns_cache) { + SHASH_FOR_EACH_SAFE (iter, &dns_cache) { struct dns_data *d = iter->data; if (d->delete) { shash_delete(&dns_cache, iter); @@ -2714,8 +2712,8 @@ sync_dns_cache(const struct sbrec_dns_table *dns_table) static void destroy_dns_cache(void) { - struct shash_node *iter, *next; - SHASH_FOR_EACH_SAFE (iter, next, &dns_cache) { + struct shash_node *iter; + SHASH_FOR_EACH_SAFE (iter, &dns_cache) { struct dns_data *d = iter->data; shash_delete(&dns_cache, iter); smap_destroy(&d->records); @@ -3569,8 +3567,8 @@ ipv6_ra_delete(struct ipv6_ra_state *ra) static void destroy_ipv6_ras(void) { - struct shash_node *iter, *next; - SHASH_FOR_EACH_SAFE (iter, next, &ipv6_ras) { + struct shash_node *iter; + SHASH_FOR_EACH_SAFE (iter, &ipv6_ras) { struct ipv6_ra_state *ra = iter->data; ipv6_ra_delete(ra); shash_delete(&ipv6_ras, iter); @@ -3926,7 +3924,7 @@ prepare_ipv6_ras(const struct shash *local_active_ports_ras, struct ovsdb_idl_index *sbrec_port_binding_by_name) OVS_REQUIRES(pinctrl_mutex) { - struct shash_node *iter, *iter_next; + struct shash_node *iter; SHASH_FOR_EACH (iter, &ipv6_ras) { struct ipv6_ra_state *ra = iter->data; @@ -3986,7 +3984,7 @@ prepare_ipv6_ras(const struct shash *local_active_ports_ras, } /* Remove those that are no longer in the SB database */ - SHASH_FOR_EACH_SAFE (iter, iter_next, &ipv6_ras) { + SHASH_FOR_EACH_SAFE (iter, &ipv6_ras) { struct ipv6_ra_state *ra = iter->data; if (ra->delete_me) { shash_delete(&ipv6_ras, iter); @@ -4275,9 +4273,8 @@ run_buffered_binding(struct ovsdb_idl_index *sbrec_mac_binding_by_lport_ip, for (size_t i = 0; i < ld->n_peer_ports; i++) { const struct sbrec_port_binding *pb = ld->peer_ports[i].local; - struct buffered_packets *cur_qp, *next_qp; - HMAP_FOR_EACH_SAFE (cur_qp, next_qp, hmap_node, - &buffered_packets_map) { + struct buffered_packets *cur_qp; + HMAP_FOR_EACH_SAFE (cur_qp, hmap_node, &buffered_packets_map) { struct ds ip_s = DS_EMPTY_INITIALIZER; ipv6_format_mapped(&cur_qp->ip, &ip_s); const struct sbrec_mac_binding *b = mac_binding_lookup( @@ -4957,9 +4954,9 @@ static void ip_mcast_snoop_destroy(void) OVS_NO_THREAD_SAFETY_ANALYSIS { - struct ip_mcast_snoop *ip_ms, *ip_ms_next; + struct ip_mcast_snoop *ip_ms; - HMAP_FOR_EACH_SAFE (ip_ms, ip_ms_next, hmap_node, &mcast_snoop_map) { + HMAP_FOR_EACH_SAFE (ip_ms, hmap_node, &mcast_snoop_map) { ip_mcast_snoop_remove(ip_ms); } hmap_destroy(&mcast_snoop_map); @@ -4975,7 +4972,7 @@ static void ip_mcast_snoop_run(void) OVS_REQUIRES(pinctrl_mutex) { - struct ip_mcast_snoop *ip_ms, *ip_ms_next; + struct ip_mcast_snoop *ip_ms; /* First read the config updated by pinctrl_main. If there's any new or * updated config then apply it. @@ -4996,7 +4993,7 @@ ip_mcast_snoop_run(void) bool notify = false; /* Then walk the multicast snoop instances. */ - HMAP_FOR_EACH_SAFE (ip_ms, ip_ms_next, hmap_node, &mcast_snoop_map) { + HMAP_FOR_EACH_SAFE (ip_ms, hmap_node, &mcast_snoop_map) { /* Delete the stale ones. */ if (!ip_mcast_snoop_state_find(ip_ms->dp_key)) { @@ -5061,7 +5058,7 @@ ip_mcast_sync(struct ovsdb_idl_txn *ovnsb_idl_txn, } struct sbrec_ip_multicast *ip_mcast; - struct ip_mcast_snoop_state *ip_ms_state, *ip_ms_state_next; + struct ip_mcast_snoop_state *ip_ms_state; /* First read and update our own local multicast configuration for the * local datapaths. @@ -5082,8 +5079,7 @@ ip_mcast_sync(struct ovsdb_idl_txn *ovnsb_idl_txn, } /* Then delete the old entries. */ - HMAP_FOR_EACH_SAFE (ip_ms_state, ip_ms_state_next, hmap_node, - &mcast_cfg_map) { + HMAP_FOR_EACH_SAFE (ip_ms_state, hmap_node, &mcast_cfg_map) { if (!get_local_datapath(local_datapaths, ip_ms_state->dp_key)) { ip_mcast_snoop_state_remove(ip_ms_state); notify = true; @@ -5141,13 +5137,13 @@ ip_mcast_sync(struct ovsdb_idl_txn *ovnsb_idl_txn, ovs_rwlock_unlock(&ip_ms->ms->rwlock); } - struct ip_mcast_snoop *ip_ms, *ip_ms_next; + struct ip_mcast_snoop *ip_ms; /* Last: write new IGMP_Groups to the southbound DB and update existing * ones (if needed). We also flush any old per-datapath multicast snoop * structures. */ - HMAP_FOR_EACH_SAFE (ip_ms, ip_ms_next, hmap_node, &mcast_snoop_map) { + HMAP_FOR_EACH_SAFE (ip_ms, hmap_node, &mcast_snoop_map) { /* Flush any non-local snooping datapaths (e.g., stale). */ struct local_datapath *local_dp = get_local_datapath(local_datapaths, ip_ms->dp_key); @@ -5767,8 +5763,8 @@ send_garp_rarp_prepare(struct ovsdb_idl_txn *ovnsb_idl_txn, &nat_addresses); /* For deleted ports and deleted nat ips, remove from * send_garp_rarp_data. */ - struct shash_node *iter, *next; - SHASH_FOR_EACH_SAFE (iter, next, &send_garp_rarp_data) { + struct shash_node *iter; + SHASH_FOR_EACH_SAFE (iter, &send_garp_rarp_data) { if (!sset_contains(&localnet_vifs, iter->name) && !sset_contains(&nat_ip_keys, iter->name)) { send_garp_rarp_delete(iter->name); @@ -5802,7 +5798,7 @@ send_garp_rarp_prepare(struct ovsdb_idl_txn *ovnsb_idl_txn, sset_destroy(&localnet_vifs); sset_destroy(&local_l3gw_ports); - SHASH_FOR_EACH_SAFE (iter, next, &nat_addresses) { + SHASH_FOR_EACH_SAFE (iter, &nat_addresses) { struct lport_addresses *laddrs = iter->data; destroy_lport_addresses(laddrs); shash_delete(&nat_addresses, iter); @@ -6585,8 +6581,7 @@ sync_svc_monitors(struct ovsdb_idl_txn *ovnsb_idl_txn, svc_mon->delete = false; } - struct svc_monitor *next; - LIST_FOR_EACH_SAFE (svc_mon, next, list_node, &svc_monitors) { + LIST_FOR_EACH_SAFE (svc_mon, list_node, &svc_monitors) { if (svc_mon->delete) { hmap_remove(&svc_monitors_map, &svc_mon->hmap_node); ovs_list_remove(&svc_mon->list_node); @@ -7159,7 +7154,7 @@ bfd_monitor_run(struct ovsdb_idl_txn *ovnsb_idl_txn, const struct sset *active_tunnels) OVS_REQUIRES(pinctrl_mutex) { - struct bfd_entry *entry, *next_entry; + struct bfd_entry *entry; long long int cur_time = time_msec(); bool changed = false; @@ -7280,7 +7275,7 @@ bfd_monitor_run(struct ovsdb_idl_txn *ovnsb_idl_txn, entry->erase = false; } - HMAP_FOR_EACH_SAFE (entry, next_entry, node, &bfd_monitor_map) { + HMAP_FOR_EACH_SAFE (entry, node, &bfd_monitor_map) { if (entry->erase) { hmap_remove(&bfd_monitor_map, &entry->node); free(entry); diff --git a/controller/vif-plug.c b/controller/vif-plug.c index 62b75263c..c6fbe7e59 100644 --- a/controller/vif-plug.c +++ b/controller/vif-plug.c @@ -582,8 +582,8 @@ vif_plug_run(struct vif_plug_ctx_in *vif_plug_ctx_in, static void vif_plug_finish_deleted__(struct shash *deleted_iface_ids, bool txn_success) { - struct shash_node *node, *next; - SHASH_FOR_EACH_SAFE (node, next, deleted_iface_ids) { + struct shash_node *node; + SHASH_FOR_EACH_SAFE (node, deleted_iface_ids) { struct vif_plug_port_ctx *vif_plug_port_ctx = node->data; if (txn_success) { vif_plug_port_finish(vif_plug_port_ctx->vif_plug, @@ -608,8 +608,8 @@ vif_plug_finish_deleted(struct shash *deleted_iface_ids) { static void vif_plug_finish_changed__(struct shash *changed_iface_ids, bool txn_success) { - struct shash_node *node, *next; - SHASH_FOR_EACH_SAFE (node, next, changed_iface_ids) { + struct shash_node *node; + SHASH_FOR_EACH_SAFE (node, changed_iface_ids) { struct vif_plug_port_ctx *vif_plug_port_ctx = node->data; if (txn_success) { vif_plug_port_finish(vif_plug_port_ctx->vif_plug, diff --git a/ic/ovn-ic.c b/ic/ovn-ic.c index a9b797af2..8511cb9ac 100644 --- a/ic/ovn-ic.c +++ b/ic/ovn-ic.c @@ -1406,8 +1406,8 @@ sync_learned_routes(struct ic_context *ctx, } /* Delete extra learned routes. */ - struct ic_route_info *route_learned, *next; - HMAP_FOR_EACH_SAFE (route_learned, next, node, &ic_lr->routes_learned) { + struct ic_route_info *route_learned; + HMAP_FOR_EACH_SAFE (route_learned, node, &ic_lr->routes_learned) { VLOG_DBG("Delete route %s -> %s that is not in IC-SB from NB.", route_learned->nb_route->ip_prefix, route_learned->nb_route->nexthop); @@ -1481,8 +1481,8 @@ advertise_routes(struct ic_context *ctx, icsbrec_route_index_destroy_row(isb_route_key); /* Create the missing routes in IC-SB */ - struct ic_route_info *route_adv, *next; - HMAP_FOR_EACH_SAFE (route_adv, next, node, routes_ad) { + struct ic_route_info *route_adv; + HMAP_FOR_EACH_SAFE (route_adv, node, routes_ad) { isb_route = icsbrec_route_insert(ctx->ovnisb_txn); icsbrec_route_set_transit_switch(isb_route, ts_name); icsbrec_route_set_availability_zone(isb_route, az); @@ -1673,8 +1673,8 @@ route_run(struct ic_context *ctx, } icsbrec_port_binding_index_destroy_row(isb_pb_key); - struct ic_router_info *ic_lr, *next; - HMAP_FOR_EACH_SAFE (ic_lr, next, node, &ic_lrs) { + struct ic_router_info *ic_lr; + HMAP_FOR_EACH_SAFE (ic_lr, node, &ic_lrs) { advertise_lr_routes(ctx, az, ic_lr); sync_learned_routes(ctx, az, ic_lr); free(ic_lr->isb_pbs); diff --git a/lib/expr.c b/lib/expr.c index 058390a16..83d1c38f1 100644 --- a/lib/expr.c +++ b/lib/expr.c @@ -269,9 +269,9 @@ expr_not(struct expr *expr) static struct expr * expr_fix_andor(struct expr *expr, bool short_circuit) { - struct expr *sub, *next; + struct expr *sub; - LIST_FOR_EACH_SAFE (sub, next, node, &expr->andor) { + LIST_FOR_EACH_SAFE (sub, node, &expr->andor) { if (sub->type == EXPR_T_BOOLEAN) { if (sub->boolean == short_circuit) { expr_destroy(expr); @@ -1289,9 +1289,9 @@ expr_const_sets_remove(struct shash *const_sets, const char *name) void expr_const_sets_destroy(struct shash *const_sets) { - struct shash_node *node, *next; + struct shash_node *node; - SHASH_FOR_EACH_SAFE (node, next, const_sets) { + SHASH_FOR_EACH_SAFE (node, const_sets) { struct expr_constant_set *cs = node->data; shash_delete(const_sets, node); @@ -1834,9 +1834,9 @@ expr_symtab_add_ovn_field(struct shash *symtab, const char *name, void expr_symtab_destroy(struct shash *symtab) { - struct shash_node *node, *next; + struct shash_node *node; - SHASH_FOR_EACH_SAFE (node, next, symtab) { + SHASH_FOR_EACH_SAFE (node, symtab) { struct expr_symbol *symbol = node->data; shash_delete(symtab, node); @@ -1914,7 +1914,7 @@ expr_destroy(struct expr *expr) free(expr->as_name); - struct expr *sub, *next; + struct expr *sub; switch (expr->type) { case EXPR_T_CMP: @@ -1925,7 +1925,7 @@ expr_destroy(struct expr *expr) case EXPR_T_AND: case EXPR_T_OR: - LIST_FOR_EACH_SAFE (sub, next, node, &expr->andor) { + LIST_FOR_EACH_SAFE (sub, node, &expr->andor) { ovs_list_remove(&sub->node); expr_destroy(sub); } @@ -2498,7 +2498,7 @@ crush_and_string(struct expr *expr, const struct expr_symbol *symbol) /* Otherwise the result is the intersection of all of the ORs. */ struct sset result = SSET_INITIALIZER(&result); - LIST_FOR_EACH_SAFE (sub, next, node, &expr->andor) { + LIST_FOR_EACH_SAFE (sub, node, &expr->andor) { struct sset strings = SSET_INITIALIZER(&strings); const struct expr *s; LIST_FOR_EACH (s, node, &sub->andor) { @@ -2602,7 +2602,7 @@ crush_and_numeric(struct expr *expr, const struct expr_symbol *symbol) ovs_list_init(&or->andor); ovs_assert(disjuncts->type == EXPR_T_OR); - LIST_FOR_EACH_SAFE (sub, next, node, &disjuncts->andor) { + LIST_FOR_EACH_SAFE (sub, node, &disjuncts->andor) { ovs_assert(sub->type == EXPR_T_CMP); ovs_list_remove(&sub->node); if (mf_subvalue_intersect(&value, &mask, diff --git a/lib/extend-table.c b/lib/extend-table.c index 32d541b55..4c3c4fac2 100644 --- a/lib/extend-table.c +++ b/lib/extend-table.c @@ -56,8 +56,8 @@ static void ovn_extend_table_info_destroy(struct ovn_extend_table_info *e) { free(e->name); - struct ovn_extend_table_lflow_ref *r, *r_next; - HMAP_FOR_EACH_SAFE (r, r_next, hmap_node, &e->references) { + struct ovn_extend_table_lflow_ref *r; + HMAP_FOR_EACH_SAFE (r, hmap_node, &e->references) { hmap_remove(&e->references, &r->hmap_node); ovs_list_remove(&r->list_node); free(r); @@ -170,19 +170,19 @@ ovn_extend_info_del_lflow_ref(struct ovn_extend_table_lflow_ref *r) void ovn_extend_table_clear(struct ovn_extend_table *table, bool existing) { - struct ovn_extend_table_info *g, *next; + struct ovn_extend_table_info *g; struct hmap *target = existing ? &table->existing : &table->desired; /* Clear lflow_to_desired index, if the target is desired table. */ if (!existing) { - struct ovn_extend_table_lflow_to_desired *l, *l_next; - HMAP_FOR_EACH_SAFE (l, l_next, hmap_node, &table->lflow_to_desired) { + struct ovn_extend_table_lflow_to_desired *l; + HMAP_FOR_EACH_SAFE (l, hmap_node, &table->lflow_to_desired) { ovn_extend_table_delete_desired(table, l); } } /* Clear the target table. */ - HMAP_FOR_EACH_SAFE (g, next, hmap_node, target) { + HMAP_FOR_EACH_SAFE (g, hmap_node, target) { hmap_remove(target, &g->hmap_node); /* Don't unset bitmap for desired group_info if the group_id * was not freshly reserved. */ @@ -222,8 +222,8 @@ ovn_extend_table_delete_desired(struct ovn_extend_table *table, struct ovn_extend_table_lflow_to_desired *l) { hmap_remove(&table->lflow_to_desired, &l->hmap_node); - struct ovn_extend_table_lflow_ref *r, *next_r; - LIST_FOR_EACH_SAFE (r, next_r, list_node, &l->desired) { + struct ovn_extend_table_lflow_ref *r; + LIST_FOR_EACH_SAFE (r, list_node, &l->desired) { struct ovn_extend_table_info *e = r->desired; ovn_extend_info_del_lflow_ref(r); if (hmap_is_empty(&e->references)) { @@ -268,10 +268,10 @@ ovn_extend_info_clone(struct ovn_extend_table_info *source) void ovn_extend_table_sync(struct ovn_extend_table *table) { - struct ovn_extend_table_info *desired, *next; + struct ovn_extend_table_info *desired; /* Copy the contents of desired to existing. */ - HMAP_FOR_EACH_SAFE (desired, next, hmap_node, &table->desired) { + HMAP_FOR_EACH_SAFE (desired, hmap_node, &table->desired) { if (!ovn_extend_table_lookup(&table->existing, desired)) { desired->new_table_id = false; struct ovn_extend_table_info *clone = diff --git a/lib/extend-table.h b/lib/extend-table.h index 6240b946e..6d81877af 100644 --- a/lib/extend-table.h +++ b/lib/extend-table.h @@ -108,8 +108,8 @@ ovn_extend_table_desired_lookup_by_name(struct ovn_extend_table * table, /* Iterates 'EXISTING' through all of the 'ovn_extend_table_info's in * 'TABLE'->existing that are not in 'TABLE'->desired. (The loop body * presumably removes them.) */ -#define EXTEND_TABLE_FOR_EACH_INSTALLED(EXISTING, NEXT, TABLE) \ - HMAP_FOR_EACH_SAFE (EXISTING, NEXT, hmap_node, &(TABLE)->existing) \ +#define EXTEND_TABLE_FOR_EACH_INSTALLED(EXISTING, TABLE) \ + HMAP_FOR_EACH_SAFE (EXISTING, hmap_node, &(TABLE)->existing) \ if (!ovn_extend_table_lookup(&(TABLE)->desired, EXISTING)) #endif /* lib/extend-table.h */ diff --git a/lib/vif-plug-provider.c b/lib/vif-plug-provider.c index 798e90e26..d318ed48d 100644 --- a/lib/vif-plug-provider.c +++ b/lib/vif-plug-provider.c @@ -179,10 +179,10 @@ vif_plug_provider_get(const char *type) bool vif_plug_provider_run_all(void) { - struct shash_node *node, *next; + struct shash_node *node; bool changed = false; - SHASH_FOR_EACH_SAFE (node, next, &vif_plug_classes) { + SHASH_FOR_EACH_SAFE (node, &vif_plug_classes) { struct vif_plug_class *vif_plug_class = node->data; if (vif_plug_class->run && vif_plug_class->run(vif_plug_class)) { changed = true; @@ -195,9 +195,9 @@ vif_plug_provider_run_all(void) void vif_plug_provider_destroy_all(void) { - struct shash_node *node, *next; + struct shash_node *node; - SHASH_FOR_EACH_SAFE (node, next, &vif_plug_classes) { + SHASH_FOR_EACH_SAFE (node, &vif_plug_classes) { struct vif_plug_class *vif_plug_class = node->data; vif_plug_provider_unregister(vif_plug_class->type); } diff --git a/northd/northd.c b/northd/northd.c index 2fb0a93c2..3dba84f67 100644 --- a/northd/northd.c +++ b/northd/northd.c @@ -1295,8 +1295,8 @@ join_datapaths(struct northd_input *input_data, ovs_list_init(nb_only); ovs_list_init(both); - const struct sbrec_datapath_binding *sb, *sb_next; - SBREC_DATAPATH_BINDING_TABLE_FOR_EACH_SAFE (sb, sb_next, + const struct sbrec_datapath_binding *sb; + SBREC_DATAPATH_BINDING_TABLE_FOR_EACH_SAFE (sb, input_data->sbrec_datapath_binding_table) { struct uuid key; if (!smap_get_uuid(&sb->external_ids, "logical-switch", &key) && @@ -1479,7 +1479,7 @@ build_datapaths(struct northd_input *input_data, /* Assign explicitly requested tunnel ids first. */ struct hmap dp_tnlids = HMAP_INITIALIZER(&dp_tnlids); - struct ovn_datapath *od, *next; + struct ovn_datapath *od; LIST_FOR_EACH (od, list, &both) { ovn_datapath_assign_requested_tnl_id(input_data, &dp_tnlids, od); } @@ -1496,11 +1496,11 @@ build_datapaths(struct northd_input *input_data, /* Assign new tunnel ids where needed. */ uint32_t hint = 0; - LIST_FOR_EACH_SAFE (od, next, list, &both) { + LIST_FOR_EACH_SAFE (od, list, &both) { ovn_datapath_allocate_key(input_data, datapaths, &dp_tnlids, od, &hint); } - LIST_FOR_EACH_SAFE (od, next, list, &nb_only) { + LIST_FOR_EACH_SAFE (od, list, &nb_only) { ovn_datapath_allocate_key(input_data, datapaths, &dp_tnlids, od, &hint); } @@ -1520,7 +1520,7 @@ build_datapaths(struct northd_input *input_data, ovn_destroy_tnlids(&dp_tnlids); /* Delete southbound records without northbound matches. */ - LIST_FOR_EACH_SAFE (od, next, list, &sb_only) { + LIST_FOR_EACH_SAFE (od, list, &sb_only) { ovs_list_remove(&od->list); sbrec_datapath_binding_delete(od->sb); ovn_datapath_destroy(datapaths, od); @@ -2989,8 +2989,8 @@ chassis_group_list_changed( } } - struct shash_node *node, *next; - SHASH_FOR_EACH_SAFE (node, next, &nb_ha_chassis_list) { + struct shash_node *node; + SHASH_FOR_EACH_SAFE (node, &nb_ha_chassis_list) { shash_delete(&nb_ha_chassis_list, node); changed = true; } @@ -3521,8 +3521,8 @@ cleanup_mac_bindings(struct northd_input *input_data, struct hmap *datapaths, struct hmap *ports) { - const struct sbrec_mac_binding *b, *n; - SBREC_MAC_BINDING_TABLE_FOR_EACH_SAFE (b, n, + const struct sbrec_mac_binding *b; + SBREC_MAC_BINDING_TABLE_FOR_EACH_SAFE (b, input_data->sbrec_mac_binding_table) { const struct ovn_datapath *od = ovn_datapath_from_sbrec(datapaths, b->datapath); @@ -3538,8 +3538,8 @@ static void cleanup_sb_ha_chassis_groups(struct northd_input *input_data, struct sset *active_ha_chassis_groups) { - const struct sbrec_ha_chassis_group *b, *n; - SBREC_HA_CHASSIS_GROUP_TABLE_FOR_EACH_SAFE (b, n, + const struct sbrec_ha_chassis_group *b; + SBREC_HA_CHASSIS_GROUP_TABLE_FOR_EACH_SAFE (b, input_data->sbrec_ha_chassis_group_table) { if (!sset_contains(active_ha_chassis_groups, b->name)) { sbrec_ha_chassis_group_delete(b); @@ -3551,8 +3551,8 @@ static void cleanup_stale_fdb_entries(struct northd_input *input_data, struct hmap *datapaths) { - const struct sbrec_fdb *fdb_e, *next; - SBREC_FDB_TABLE_FOR_EACH_SAFE (fdb_e, next, + const struct sbrec_fdb *fdb_e; + SBREC_FDB_TABLE_FOR_EACH_SAFE (fdb_e, input_data->sbrec_fdb_table) { bool delete = true; struct ovn_datapath *od @@ -3974,8 +3974,8 @@ sync_lbs(struct northd_input *input_data, struct ovsdb_idl_txn *ovnsb_txn, /* Delete any stale SB load balancer rows. */ struct hmapx existing_lbs = HMAPX_INITIALIZER(&existing_lbs); - const struct sbrec_load_balancer *sbrec_lb, *next; - SBREC_LOAD_BALANCER_TABLE_FOR_EACH_SAFE (sbrec_lb, next, + const struct sbrec_load_balancer *sbrec_lb; + SBREC_LOAD_BALANCER_TABLE_FOR_EACH_SAFE (sbrec_lb, input_data->sbrec_load_balancer_table) { const char *nb_lb_uuid = smap_get(&sbrec_lb->external_ids, "lb_id"); struct uuid lb_uuid; @@ -4146,7 +4146,7 @@ build_ports(struct northd_input *input_data, bool remove_mac_bindings = !ovs_list_is_empty(&sb_only); /* Assign explicitly requested tunnel ids first. */ - struct ovn_port *op, *next; + struct ovn_port *op; LIST_FOR_EACH (op, list, &both) { ovn_port_assign_requested_tnl_id(input_data, op); } @@ -4162,10 +4162,10 @@ build_ports(struct northd_input *input_data, } /* Assign new tunnel ids where needed. */ - LIST_FOR_EACH_SAFE (op, next, list, &both) { + LIST_FOR_EACH_SAFE (op, list, &both) { ovn_port_allocate_key(input_data, ports, op); } - LIST_FOR_EACH_SAFE (op, next, list, &nb_only) { + LIST_FOR_EACH_SAFE (op, list, &nb_only) { ovn_port_allocate_key(input_data, ports, op); } @@ -4173,7 +4173,7 @@ build_ports(struct northd_input *input_data, * record based on northbound data. * For logical ports that are in NB database, do any tag allocation * needed. */ - LIST_FOR_EACH_SAFE (op, next, list, &both) { + LIST_FOR_EACH_SAFE (op, list, &both) { /* When reusing stale Port_Bindings, make sure that stale * Mac_Bindings are purged. */ @@ -4191,7 +4191,7 @@ build_ports(struct northd_input *input_data, } /* Add southbound record for each unmatched northbound record. */ - LIST_FOR_EACH_SAFE (op, next, list, &nb_only) { + LIST_FOR_EACH_SAFE (op, list, &nb_only) { op->sb = sbrec_port_binding_insert(ovnsb_txn); ovn_port_update_sbrec(input_data, ovnsb_txn, sbrec_chassis_by_name, @@ -4203,7 +4203,7 @@ build_ports(struct northd_input *input_data, /* Delete southbound records without northbound matches. */ if (!ovs_list_is_empty(&sb_only)) { - LIST_FOR_EACH_SAFE (op, next, list, &sb_only) { + LIST_FOR_EACH_SAFE (op, list, &sb_only) { ovs_list_remove(&op->list); sbrec_port_binding_delete(op->sb); ovn_port_destroy(ports, op); @@ -9101,8 +9101,8 @@ parsed_routes_add(struct ovn_datapath *od, const struct hmap *ports, static void parsed_routes_destroy(struct ovs_list *routes) { - struct parsed_route *pr, *next; - LIST_FOR_EACH_SAFE (pr, next, list_node, routes) { + struct parsed_route *pr; + LIST_FOR_EACH_SAFE (pr, list_node, routes) { ovs_list_remove(&pr->list_node); free(pr); } @@ -9185,10 +9185,10 @@ ecmp_groups_find(struct hmap *ecmp_groups, struct parsed_route *route) static void ecmp_groups_destroy(struct hmap *ecmp_groups) { - struct ecmp_groups_node *eg, *next; - HMAP_FOR_EACH_SAFE (eg, next, hmap_node, ecmp_groups) { - struct ecmp_route_list_node *er, *er_next; - LIST_FOR_EACH_SAFE (er, er_next, list_node, &eg->route_list) { + struct ecmp_groups_node *eg; + HMAP_FOR_EACH_SAFE (eg, hmap_node, ecmp_groups) { + struct ecmp_route_list_node *er; + LIST_FOR_EACH_SAFE (er, list_node, &eg->route_list) { ovs_list_remove(&er->list_node); free(er); } @@ -9236,8 +9236,8 @@ unique_routes_remove(struct hmap *unique_routes, static void unique_routes_destroy(struct hmap *unique_routes) { - struct unique_routes_node *ur, *next; - HMAP_FOR_EACH_SAFE (ur, next, hmap_node, unique_routes) { + struct unique_routes_node *ur; + HMAP_FOR_EACH_SAFE (ur, hmap_node, unique_routes) { hmap_remove(unique_routes, &ur->hmap_node); free(ur); } @@ -13995,9 +13995,9 @@ void build_lflows(struct lflow_input *input_data, */ fast_hmap_size_for(&single_dp_lflows, max_seen_lflow_size); - struct ovn_lflow *lflow, *next_lflow; + struct ovn_lflow *lflow; struct hmapx_node *node; - HMAP_FOR_EACH_SAFE (lflow, next_lflow, hmap_node, &lflows) { + HMAP_FOR_EACH_SAFE (lflow, hmap_node, &lflows) { uint32_t hash; struct ovn_dp_group *dpg; @@ -14040,8 +14040,8 @@ void build_lflows(struct lflow_input *input_data, hmap_destroy(&single_dp_lflows); /* Push changes to the Logical_Flow table to database. */ - const struct sbrec_logical_flow *sbflow, *next_sbflow; - SBREC_LOGICAL_FLOW_TABLE_FOR_EACH_SAFE (sbflow, next_sbflow, + const struct sbrec_logical_flow *sbflow; + SBREC_LOGICAL_FLOW_TABLE_FOR_EACH_SAFE (sbflow, input_data->sbrec_logical_flow_table) { struct sbrec_logical_dp_group *dp_group = sbflow->logical_dp_group; struct ovn_datapath *logical_datapath_od = NULL; @@ -14172,7 +14172,7 @@ void build_lflows(struct lflow_input *input_data, } stopwatch_stop(LFLOWS_DP_GROUPS_STOPWATCH_NAME, time_msec()); - HMAP_FOR_EACH_SAFE (lflow, next_lflow, hmap_node, &lflows) { + HMAP_FOR_EACH_SAFE (lflow, hmap_node, &lflows) { const char *pipeline = ovn_stage_get_pipeline_name(lflow->stage); uint8_t table = ovn_stage_get_table(lflow->stage); @@ -14228,8 +14228,8 @@ void build_lflows(struct lflow_input *input_data, hmap_destroy(&dp_groups); /* Push changes to the Multicast_Group table to database. */ - const struct sbrec_multicast_group *sbmc, *next_sbmc; - SBREC_MULTICAST_GROUP_TABLE_FOR_EACH_SAFE (sbmc, next_sbmc, + const struct sbrec_multicast_group *sbmc; + SBREC_MULTICAST_GROUP_TABLE_FOR_EACH_SAFE (sbmc, input_data->sbrec_multicast_group_table) { struct ovn_datapath *od = ovn_datapath_from_sbrec( input_data->datapaths, sbmc->datapath); @@ -14250,8 +14250,8 @@ void build_lflows(struct lflow_input *input_data, sbrec_multicast_group_delete(sbmc); } } - struct ovn_multicast *mc, *next_mc; - HMAP_FOR_EACH_SAFE (mc, next_mc, hmap_node, &mcast_groups) { + struct ovn_multicast *mc; + HMAP_FOR_EACH_SAFE (mc, hmap_node, &mcast_groups) { if (!mc->datapath) { ovn_multicast_destroy(&mcast_groups, mc); continue; @@ -14264,10 +14264,9 @@ void build_lflows(struct lflow_input *input_data, ovn_multicast_destroy(&mcast_groups, mc); } - struct ovn_igmp_group *igmp_group, *next_igmp_group; + struct ovn_igmp_group *igmp_group; - HMAP_FOR_EACH_SAFE (igmp_group, next_igmp_group, hmap_node, - &igmp_groups) { + HMAP_FOR_EACH_SAFE (igmp_group, hmap_node, &igmp_groups) { ovn_igmp_group_destroy(&igmp_groups, igmp_group); } @@ -14395,8 +14394,8 @@ sync_address_sets(struct northd_input *input_data, nb_address_set->n_addresses, &sb_address_sets); } - struct shash_node *node, *next; - SHASH_FOR_EACH_SAFE (node, next, &sb_address_sets) { + struct shash_node *node; + SHASH_FOR_EACH_SAFE (node, &sb_address_sets) { sbrec_address_set_delete(node->data); shash_delete(&sb_address_sets, node); } @@ -14449,8 +14448,8 @@ sync_port_groups(struct northd_input *input_data, } ds_destroy(&sb_name); - struct shash_node *node, *next; - SHASH_FOR_EACH_SAFE (node, next, &sb_port_groups) { + struct shash_node *node; + SHASH_FOR_EACH_SAFE (node, &sb_port_groups) { sbrec_port_group_delete(node->data); shash_delete(&sb_port_groups, node); } @@ -14632,15 +14631,14 @@ sync_meters(struct northd_input *input_data, } const char *used_meter; - const char *used_meter_next; - SSET_FOR_EACH_SAFE (used_meter, used_meter_next, &used_sb_meters) { + SSET_FOR_EACH_SAFE (used_meter, &used_sb_meters) { shash_find_and_delete(&sb_meters, used_meter); sset_delete(&used_sb_meters, SSET_NODE_FROM_NAME(used_meter)); } sset_destroy(&used_sb_meters); - struct shash_node *node, *next; - SHASH_FOR_EACH_SAFE (node, next, &sb_meters) { + struct shash_node *node; + SHASH_FOR_EACH_SAFE (node, &sb_meters) { sbrec_meter_delete(node->data); shash_delete(&sb_meters, node); } @@ -14705,9 +14703,8 @@ sync_dns_entries(struct northd_input *input_data, } } - const struct sbrec_dns *sbrec_dns, *next; - SBREC_DNS_TABLE_FOR_EACH_SAFE (sbrec_dns, next, - input_data->sbrec_dns_table) { + const struct sbrec_dns *sbrec_dns; + SBREC_DNS_TABLE_FOR_EACH_SAFE (sbrec_dns, input_data->sbrec_dns_table) { const char *nb_dns_uuid = smap_get(&sbrec_dns->external_ids, "dns_id"); struct uuid dns_uuid; if (!nb_dns_uuid || !uuid_from_string(&dns_uuid, nb_dns_uuid)) { @@ -14783,14 +14780,14 @@ destroy_datapaths_and_ports(struct hmap *datapaths, struct hmap *ports, } } - struct ovn_datapath *dp, *next_dp; - HMAP_FOR_EACH_SAFE (dp, next_dp, key_node, datapaths) { + struct ovn_datapath *dp; + HMAP_FOR_EACH_SAFE (dp, key_node, datapaths) { ovn_datapath_destroy(datapaths, dp); } hmap_destroy(datapaths); - struct ovn_port *port, *next_port; - HMAP_FOR_EACH_SAFE (port, next_port, key_node, ports) { + struct ovn_port *port; + HMAP_FOR_EACH_SAFE (port, key_node, ports) { ovn_port_destroy(ports, port); } hmap_destroy(ports); @@ -14818,9 +14815,9 @@ build_ip_mcast(struct northd_input *input_data, } /* Delete southbound records without northbound matches. */ - const struct sbrec_ip_multicast *sb, *sb_next; + const struct sbrec_ip_multicast *sb; - SBREC_IP_MULTICAST_TABLE_FOR_EACH_SAFE (sb, sb_next, + SBREC_IP_MULTICAST_TABLE_FOR_EACH_SAFE (sb, input_data->sbrec_ip_multicast_table) { od = ovn_datapath_from_sbrec(datapaths, sb->datapath); if (!od || ovn_datapath_is_stale(od)) { @@ -14883,9 +14880,9 @@ build_mcast_groups(struct lflow_input *input_data, } } - const struct sbrec_igmp_group *sb_igmp, *sb_igmp_next; + const struct sbrec_igmp_group *sb_igmp; - SBREC_IGMP_GROUP_TABLE_FOR_EACH_SAFE (sb_igmp, sb_igmp_next, + SBREC_IGMP_GROUP_TABLE_FOR_EACH_SAFE (sb_igmp, input_data->sbrec_igmp_group_table) { /* If this is a stale group (e.g., controller had crashed, * purge it). @@ -14991,8 +14988,8 @@ build_mcast_groups(struct lflow_input *input_data, /* Walk the aggregated IGMP groups and allocate IDs for new entries. * Then store the ports in the associated multicast group. */ - struct ovn_igmp_group *igmp_group, *igmp_group_next; - HMAP_FOR_EACH_SAFE (igmp_group, igmp_group_next, hmap_node, igmp_groups) { + struct ovn_igmp_group *igmp_group; + HMAP_FOR_EACH_SAFE (igmp_group, hmap_node, igmp_groups) { if (!ovn_igmp_group_allocate_id(igmp_group)) { /* If we ran out of keys just destroy the entry. */ @@ -15039,16 +15036,16 @@ northd_destroy(struct northd_data *data) } hmap_destroy(&data->lbs); - struct ovn_port_group *pg, *next_pg; - HMAP_FOR_EACH_SAFE (pg, next_pg, key_node, &data->port_groups) { + struct ovn_port_group *pg; + HMAP_FOR_EACH_SAFE (pg, key_node, &data->port_groups) { ovn_port_group_destroy(&data->port_groups, pg); } hmap_destroy(&data->port_groups); hmap_destroy(&data->bfd_connections); - struct shash_node *node, *next; - SHASH_FOR_EACH_SAFE (node, next, &data->meter_groups) { + struct shash_node *node; + SHASH_FOR_EACH_SAFE (node, &data->meter_groups) { shash_delete(&data->meter_groups, node); } shash_destroy(&data->meter_groups); @@ -15240,8 +15237,8 @@ update_sb_ha_group_ref_chassis(struct northd_input *input_data, } /* Update each group and remove it from the set. */ - struct shash_node *node, *next; - SHASH_FOR_EACH_SAFE (node, next, ha_ref_chassis_map) { + struct shash_node *node; + SHASH_FOR_EACH_SAFE (node, ha_ref_chassis_map) { struct ha_ref_chassis_info *ha_ref_info = node->data; sbrec_ha_chassis_group_set_ref_chassis(ha_ref_info->ha_chassis_group, ha_ref_info->ref_chassis, @@ -15264,9 +15261,7 @@ update_sb_ha_group_ref_chassis(struct northd_input *input_data, /* Now the rest of the groups don't have any ref-chassis, so clear the SB * field for those records. */ - struct ha_chassis_group_node *ha_ch_grp_next; - HMAP_FOR_EACH_SAFE (ha_ch_grp_node, ha_ch_grp_next, hmap_node, - &ha_ch_grps) { + HMAP_FOR_EACH_SAFE (ha_ch_grp_node, hmap_node, &ha_ch_grps) { sbrec_ha_chassis_group_set_ref_chassis(ha_ch_grp_node->ha_ch_grp, NULL, 0); hmap_remove(&ha_ch_grps, &ha_ch_grp_node->hmap_node); diff --git a/northd/ovn-northd-ddlog.c b/northd/ovn-northd-ddlog.c index a02949b2d..718d052cc 100644 --- a/northd/ovn-northd-ddlog.c +++ b/northd/ovn-northd-ddlog.c @@ -712,9 +712,9 @@ static void uuidset_destroy(struct hmap *uuidset) { if (uuidset) { - struct uuidset_node *node, *next; + struct uuidset_node *node; - HMAP_FOR_EACH_SAFE (node, next, hmap_node, uuidset) { + HMAP_FOR_EACH_SAFE (node, hmap_node, uuidset) { uuidset_delete(uuidset, node); } hmap_destroy(uuidset); diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c index 95b395931..45b120697 100644 --- a/northd/ovn-northd.c +++ b/northd/ovn-northd.c @@ -334,20 +334,20 @@ check_and_update_rbac(struct ovsdb_idl_txn *ovnsb_txn, struct ovsdb_idl *ovnsb_idl) { const struct sbrec_rbac_role *rbac_role = NULL; - const struct sbrec_rbac_permission *perm_row, *perm_next; - const struct sbrec_rbac_role *role_row, *role_row_next; + const struct sbrec_rbac_permission *perm_row; + const struct sbrec_rbac_role *role_row; struct rbac_perm_cfg *pcfg; for (pcfg = rbac_perm_cfg; pcfg->table; pcfg++) { pcfg->row = NULL; } - SBREC_RBAC_PERMISSION_FOR_EACH_SAFE (perm_row, perm_next, ovnsb_idl) { + SBREC_RBAC_PERMISSION_FOR_EACH_SAFE (perm_row, ovnsb_idl) { if (!ovn_rbac_validate_perm(perm_row)) { sbrec_rbac_permission_delete(perm_row); } } - SBREC_RBAC_ROLE_FOR_EACH_SAFE (role_row, role_row_next, ovnsb_idl) { + SBREC_RBAC_ROLE_FOR_EACH_SAFE (role_row, ovnsb_idl) { if (strcmp(role_row->name, "ovn-controller")) { sbrec_rbac_role_delete(role_row); } else { @@ -378,8 +378,8 @@ check_and_add_supported_dhcp_opts_to_sb_db(struct ovsdb_idl_txn *ovnsb_txn, dhcp_opt_hash(supported_dhcp_opts[i].name)); } - const struct sbrec_dhcp_options *opt_row, *opt_row_next; - SBREC_DHCP_OPTIONS_FOR_EACH_SAFE (opt_row, opt_row_next, ovnsb_idl) { + const struct sbrec_dhcp_options *opt_row; + SBREC_DHCP_OPTIONS_FOR_EACH_SAFE (opt_row, ovnsb_idl) { struct gen_opts_map *dhcp_opt = dhcp_opts_find(&dhcp_opts_to_add, opt_row->name); if (dhcp_opt) { @@ -417,8 +417,8 @@ check_and_add_supported_dhcpv6_opts_to_sb_db(struct ovsdb_idl_txn *ovnsb_txn, dhcp_opt_hash(supported_dhcpv6_opts[i].name)); } - const struct sbrec_dhcpv6_options *opt_row, *opt_row_next; - SBREC_DHCPV6_OPTIONS_FOR_EACH_SAFE(opt_row, opt_row_next, ovnsb_idl) { + const struct sbrec_dhcpv6_options *opt_row; + SBREC_DHCPV6_OPTIONS_FOR_EACH_SAFE(opt_row, ovnsb_idl) { struct gen_opts_map *dhcp_opt = dhcp_opts_find(&dhcpv6_opts_to_add, opt_row->name); if (dhcp_opt) { diff --git a/utilities/ovn-ic-nbctl.c b/utilities/ovn-ic-nbctl.c index 46cf5189b..be294a7be 100644 --- a/utilities/ovn-ic-nbctl.c +++ b/utilities/ovn-ic-nbctl.c @@ -516,10 +516,10 @@ delete_connections(struct ctl_context *ctx) { const struct icnbrec_ic_nb_global *ic_nb_global = icnbrec_ic_nb_global_first(ctx->idl); - const struct icnbrec_connection *conn, *next; + const struct icnbrec_connection *conn; /* Delete Manager rows pointed to by 'connection_options' column. */ - ICNBREC_CONNECTION_FOR_EACH_SAFE (conn, next, ctx->idl) { + ICNBREC_CONNECTION_FOR_EACH_SAFE (conn, ctx->idl) { icnbrec_connection_delete(conn); } diff --git a/utilities/ovn-ic-sbctl.c b/utilities/ovn-ic-sbctl.c index e46b3bbbd..64d1d469e 100644 --- a/utilities/ovn-ic-sbctl.c +++ b/utilities/ovn-ic-sbctl.c @@ -579,10 +579,10 @@ delete_connections(struct ctl_context *ctx) { const struct icsbrec_ic_sb_global *ic_sb_global = icsbrec_ic_sb_global_first(ctx->idl); - const struct icsbrec_connection *conn, *next; + const struct icsbrec_connection *conn; /* Delete Manager rows pointed to by 'connection_options' column. */ - ICSBREC_CONNECTION_FOR_EACH_SAFE (conn, next, ctx->idl) { + ICSBREC_CONNECTION_FOR_EACH_SAFE (conn, ctx->idl) { icsbrec_connection_delete(conn); } diff --git a/utilities/ovn-nbctl.c b/utilities/ovn-nbctl.c index 7fcfa50d4..063616301 100644 --- a/utilities/ovn-nbctl.c +++ b/utilities/ovn-nbctl.c @@ -2788,11 +2788,11 @@ nbctl_pre_meter_del(struct ctl_context *ctx) static void nbctl_meter_del(struct ctl_context *ctx) { - const struct nbrec_meter *meter, *next; + const struct nbrec_meter *meter; /* If a name is not specified, delete all meters. */ if (ctx->argc == 1) { - NBREC_METER_FOR_EACH_SAFE (meter, next, ctx->idl) { + NBREC_METER_FOR_EACH_SAFE (meter, ctx->idl) { nbrec_meter_delete(meter); } return; @@ -6436,10 +6436,10 @@ static void delete_connections(struct ctl_context *ctx) { const struct nbrec_nb_global *nb_global = nbrec_nb_global_first(ctx->idl); - const struct nbrec_connection *conn, *next; + const struct nbrec_connection *conn; /* Delete Manager rows pointed to by 'connection_options' column. */ - NBREC_CONNECTION_FOR_EACH_SAFE(conn, next, ctx->idl) { + NBREC_CONNECTION_FOR_EACH_SAFE (conn, ctx->idl) { nbrec_connection_delete(conn); } diff --git a/utilities/ovn-sbctl.c b/utilities/ovn-sbctl.c index 4d7e7d670..b008b5d0b 100644 --- a/utilities/ovn-sbctl.c +++ b/utilities/ovn-sbctl.c @@ -1233,10 +1233,10 @@ static void delete_connections(struct ctl_context *ctx) { const struct sbrec_sb_global *sb_global = sbrec_sb_global_first(ctx->idl); - const struct sbrec_connection *conn, *next; + const struct sbrec_connection *conn; /* Delete Manager rows pointed to by 'connection_options' column. */ - SBREC_CONNECTION_FOR_EACH_SAFE(conn, next, ctx->idl) { + SBREC_CONNECTION_FOR_EACH_SAFE (conn, ctx->idl) { sbrec_connection_delete(conn); } diff --git a/utilities/ovn-trace.c b/utilities/ovn-trace.c index 9822618ae..b5116e969 100644 --- a/utilities/ovn-trace.c +++ b/utilities/ovn-trace.c @@ -1329,9 +1329,9 @@ static void ovntrace_node_list_destroy(struct ovs_list *list) { if (list) { - struct ovntrace_node *node, *next; + struct ovntrace_node *node; - LIST_FOR_EACH_SAFE (node, next, node, list) { + LIST_FOR_EACH_SAFE (node, node, list) { ovs_list_remove(&node->node); ovntrace_node_destroy(node); }