From patchwork Fri Jan 24 11:02:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Numan Siddique X-Patchwork-Id: 1228751 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 483x7b2pjWz9sP3 for ; Fri, 24 Jan 2020 22:02:50 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id B7C9D877BB; Fri, 24 Jan 2020 11:02:48 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id iPZhmru15Gs3; Fri, 24 Jan 2020 11:02:46 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by whitealder.osuosl.org (Postfix) with ESMTP id C562F877B3; Fri, 24 Jan 2020 11:02:46 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 96A8DC18DD; Fri, 24 Jan 2020 11:02:46 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 25225C0174 for ; Fri, 24 Jan 2020 11:02:45 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 09A4222775 for ; Fri, 24 Jan 2020 11:02:45 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id t5KQ1xrjrB-D for ; Fri, 24 Jan 2020 11:02:44 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay11.mail.gandi.net (relay11.mail.gandi.net [217.70.178.231]) by silver.osuosl.org (Postfix) with ESMTPS id B5AD322739 for ; Fri, 24 Jan 2020 11:02:43 +0000 (UTC) Received: from nummac.local (unknown [27.7.144.66]) (Authenticated sender: numans@ovn.org) by relay11.mail.gandi.net (Postfix) with ESMTPSA id EC8D210001B; Fri, 24 Jan 2020 11:02:39 +0000 (UTC) From: numans@ovn.org To: dev@openvswitch.org Date: Fri, 24 Jan 2020 16:32:28 +0530 Message-Id: <20200124110228.1555340-1-numans@ovn.org> X-Mailer: git-send-email 2.24.1 MIME-Version: 1.0 Subject: [ovs-dev] [PATCH ovn 1/4] Make is_switch() in lflow.c a util function 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" From: Numan Siddique This patch renames is_switch() to datapath_is_switch() and moves to lib/ovn-util.c. Upcoming patch will make use of it. Signed-off-by: Numan Siddique Acked-by: Han Zhou --- controller/lflow.c | 11 ++--------- lib/ovn-util.c | 6 ++++++ lib/ovn-util.h | 3 ++- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/controller/lflow.c b/controller/lflow.c index 9a3c1eb5b..3ddb0571e 100644 --- a/controller/lflow.c +++ b/controller/lflow.c @@ -149,13 +149,6 @@ is_chassis_resident_cb(const void *c_aux_, const char *port_name) } } -static bool -is_switch(const struct sbrec_datapath_binding *ldp) -{ - return smap_get(&ldp->external_ids, "logical-switch") != NULL; - -} - void lflow_resource_init(struct lflow_resource_ref *lfrr) { @@ -794,7 +787,7 @@ consider_logical_flow( .lookup_port = lookup_port_cb, .tunnel_ofport = tunnel_ofport_cb, .aux = &aux, - .is_switch = is_switch(ldp), + .is_switch = datapath_is_switch(ldp), .group_table = group_table, .meter_table = meter_table, .lflow_uuid = lflow->header_.uuid, @@ -818,7 +811,7 @@ consider_logical_flow( if (m->match.wc.masks.conj_id) { m->match.flow.conj_id += *conj_id_ofs; } - if (is_switch(ldp)) { + if (datapath_is_switch(ldp)) { unsigned int reg_index = (ingress ? MFF_LOG_INPORT : MFF_LOG_OUTPORT) - MFF_REG0; int64_t port_id = m->match.flow.regs[reg_index]; diff --git a/lib/ovn-util.c b/lib/ovn-util.c index e67c3c073..6e0bba2c5 100644 --- a/lib/ovn-util.c +++ b/lib/ovn-util.c @@ -423,3 +423,9 @@ ovn_logical_flow_hash(const struct uuid *logical_datapath, hash = hash_string(match, hash); return hash_string(actions, hash); } + +bool +datapath_is_switch(const struct sbrec_datapath_binding *ldp) +{ + return smap_get(&ldp->external_ids, "logical-switch") != NULL; +} diff --git a/lib/ovn-util.h b/lib/ovn-util.h index b58208e9b..422d69e5b 100644 --- a/lib/ovn-util.h +++ b/lib/ovn-util.h @@ -23,6 +23,7 @@ struct sbrec_logical_flow; struct uuid; struct eth_addr; struct sbrec_port_binding; +struct sbrec_datapath_binding; struct ipv4_netaddr { ovs_be32 addr; /* 192.168.10.123 */ @@ -86,5 +87,5 @@ uint32_t ovn_logical_flow_hash(const struct uuid *logical_datapath, uint8_t table_id, const char *pipeline, uint16_t priority, const char *match, const char *actions); - +bool datapath_is_switch(const struct sbrec_datapath_binding *); #endif