From patchwork Fri Apr 30 15:31:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Gray X-Patchwork-Id: 1472369 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=2605:bc80:3010::138; helo=smtp1.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: 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=JaPTxWrN; dkim-atps=neutral Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) (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 ozlabs.org (Postfix) with ESMTPS id 4FWxDk6j9Zz9sW8 for ; Sat, 1 May 2021 01:31:50 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id E940085061; Fri, 30 Apr 2021 15:31:47 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org 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 IyHWDtC902K0; Fri, 30 Apr 2021 15:31:47 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp1.osuosl.org (Postfix) with ESMTP id D19A585025; Fri, 30 Apr 2021 15:31:45 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 12205C0025; Fri, 30 Apr 2021 15:31:45 +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 08282C0025 for ; Fri, 30 Apr 2021 15:31:44 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id C981C85024 for ; Fri, 30 Apr 2021 15:31:43 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org 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 yvK_JXICS7Nd for ; Fri, 30 Apr 2021 15:31:43 +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 [216.205.24.124]) by smtp1.osuosl.org (Postfix) with ESMTPS id F1A4F8501C for ; Fri, 30 Apr 2021 15:31:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619796701; 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=vSOmcaPpRv7Bw/O1IWsFik54nFnpnMjGxfsCuYpv0XM=; b=JaPTxWrN36O8ynl2lNjjIQG+txGpKYkGAACio5IfnzvsbXtZU/K7HTd1INTfYHy7cViivu xMs9dDYC5v12BJAYynbU/1EGIazEMtCOc0nlbN5rzkgi/49Wpc6MBWwXievqThdXcYhLou 9xbaCDUm4VdHlOL4qRDXfSqQMxmpfbU= Received: from mail-pj1-f69.google.com (mail-pj1-f69.google.com [209.85.216.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-251-mVn7APZCMdaRxlstDXMBCQ-1; Fri, 30 Apr 2021 11:31:39 -0400 X-MC-Unique: mVn7APZCMdaRxlstDXMBCQ-1 Received: by mail-pj1-f69.google.com with SMTP id w9-20020a17090a4609b0290150d07df879so16836784pjg.9 for ; Fri, 30 Apr 2021 08:31:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vSOmcaPpRv7Bw/O1IWsFik54nFnpnMjGxfsCuYpv0XM=; b=jtu2xz6HVXU9XAnxF8iHu9G4thlwcewEJ503P8UyqS/tNZC6qYP3VPKyu67JYL0tg+ aNxEupmJ0INuIVgiG++59Qa62yjsrTwrfAipNNcNqvgWFYr2qYrAlvGI2gIOuuTXp269 bGbY6/pP/MXyXBQnGYf7kHrcej7sm7wbqoViI473gog6U2Pmd2jgB2zAC/JUHQCZVluT 3Xf9PPnPiRUUjbTJMHQwOBCeJhqt/ZP5MhtuDrOcUe7tfEvgjsdLplI7iku932gu+FU/ 5101QDmA9xHK4W9+by6DqFoU8qcRSU/5KnFuahjs8W+I1mG7jWhJqnDBEfZzBpWQTb1X HZSA== X-Gm-Message-State: AOAM533TJ15dsO21CdzVxA8rtHyxl58gR7AeV6C+wEO1zZMw34ijG3ww DWF6O/CVP1308K8eC9gDJ9IpqkKd1vabViWs0i6qLAnYtLCBnEnbNaM5e0WNVB7Uiz3C0DASuwU q5zfBE+aerkjGdzhueoXeIAj/V61oVwTM73ewbD0bs3H2aZhj9CqeeT5/bFjD51cR2/91 X-Received: by 2002:a62:6d05:0:b029:250:d196:1fc8 with SMTP id i5-20020a626d050000b0290250d1961fc8mr5770401pfc.21.1619796698555; Fri, 30 Apr 2021 08:31:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzPZ+IvXT+bQcKphWmO9zdB2FB3BFvtLvOtxxhpTvqdpojsGuj9a7Q0JBEibULJSMNww1QFiQ== X-Received: by 2002:a62:6d05:0:b029:250:d196:1fc8 with SMTP id i5-20020a626d050000b0290250d1961fc8mr5770374pfc.21.1619796698181; Fri, 30 Apr 2021 08:31:38 -0700 (PDT) Received: from wsfd-netdev91.ntdv.lab.eng.bos.redhat.com (nat-pool-bos-t.redhat.com. [66.187.233.206]) by smtp.gmail.com with ESMTPSA id y1sm3472576pgl.88.2021.04.30.08.31.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Apr 2021 08:31:37 -0700 (PDT) From: Mark Gray To: dev@openvswitch.org Date: Fri, 30 Apr 2021 11:31:27 -0400 Message-Id: <20210430153129.27652-2-mark.d.gray@redhat.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210430153129.27652-1-mark.d.gray@redhat.com> References: <20210430153129.27652-1-mark.d.gray@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mark.d.gray@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [RFC 1/3] ofproto: change type of n_handlers and n_revalidators 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" 'n_handlers' and 'n_revalidators' are declared as type 'size_t'. However, dpif_handlers_set() requires parameter 'n_handlers' as type 'uint32_t'. This patch fixes this type mismatch. Signed-off-by: Mark Gray --- ofproto/ofproto-dpif-upcall.c | 24 ++++++++++++------------ ofproto/ofproto-dpif-upcall.h | 5 +++-- ofproto/ofproto-provider.h | 2 +- ofproto/ofproto.c | 2 +- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/ofproto/ofproto-dpif-upcall.c b/ofproto/ofproto-dpif-upcall.c index ccf97266c0b9..88406fea1391 100644 --- a/ofproto/ofproto-dpif-upcall.c +++ b/ofproto/ofproto-dpif-upcall.c @@ -129,10 +129,10 @@ struct udpif { struct dpif_backer *backer; /* Opaque dpif_backer pointer. */ struct handler *handlers; /* Upcall handlers. */ - size_t n_handlers; + uint32_t n_handlers; struct revalidator *revalidators; /* Flow revalidators. */ - size_t n_revalidators; + uint32_t n_revalidators; struct latch exit_latch; /* Tells child threads to exit. */ @@ -335,8 +335,8 @@ static int process_upcall(struct udpif *, struct upcall *, struct ofpbuf *odp_actions, struct flow_wildcards *); static void handle_upcalls(struct udpif *, struct upcall *, size_t n_upcalls); static void udpif_stop_threads(struct udpif *, bool delete_flows); -static void udpif_start_threads(struct udpif *, size_t n_handlers, - size_t n_revalidators); +static void udpif_start_threads(struct udpif *, uint32_t n_handlers, + uint32_t n_revalidators); static void udpif_pause_revalidators(struct udpif *); static void udpif_resume_revalidators(struct udpif *); static void *udpif_upcall_handler(void *); @@ -522,7 +522,7 @@ static void udpif_stop_threads(struct udpif *udpif, bool delete_flows) { if (udpif && (udpif->n_handlers != 0 || udpif->n_revalidators != 0)) { - size_t i; + uint32_t i; /* Tell the threads to exit. */ latch_set(&udpif->exit_latch); @@ -562,8 +562,8 @@ udpif_stop_threads(struct udpif *udpif, bool delete_flows) /* Starts the handler and revalidator threads. */ static void -udpif_start_threads(struct udpif *udpif, size_t n_handlers_, - size_t n_revalidators_) +udpif_start_threads(struct udpif *udpif, uint32_t n_handlers_, + uint32_t n_revalidators_) { if (udpif && n_handlers_ && n_revalidators_) { /* Creating a thread can take a significant amount of time on some @@ -574,7 +574,7 @@ udpif_start_threads(struct udpif *udpif, size_t n_handlers_, udpif->n_revalidators = n_revalidators_; udpif->handlers = xzalloc(udpif->n_handlers * sizeof *udpif->handlers); - for (size_t i = 0; i < udpif->n_handlers; i++) { + for (uint32_t i = 0; i < udpif->n_handlers; i++) { struct handler *handler = &udpif->handlers[i]; handler->udpif = udpif; @@ -632,8 +632,8 @@ udpif_resume_revalidators(struct udpif *udpif) * datapath handle must have packet reception enabled before starting * threads. */ void -udpif_set_threads(struct udpif *udpif, size_t n_handlers_, - size_t n_revalidators_) +udpif_set_threads(struct udpif *udpif, uint32_t n_handlers_, + uint32_t n_revalidators_) { ovs_assert(udpif); ovs_assert(n_handlers_ && n_revalidators_); @@ -691,8 +691,8 @@ udpif_get_memory_usage(struct udpif *udpif, struct simap *usage) void udpif_flush(struct udpif *udpif) { - size_t n_handlers_ = udpif->n_handlers; - size_t n_revalidators_ = udpif->n_revalidators; + uint32_t n_handlers_ = udpif->n_handlers; + uint32_t n_revalidators_ = udpif->n_revalidators; udpif_stop_threads(udpif, true); dpif_flow_flush(udpif->dpif); diff --git a/ofproto/ofproto-dpif-upcall.h b/ofproto/ofproto-dpif-upcall.h index 693107ae56c1..b4dfed32046e 100644 --- a/ofproto/ofproto-dpif-upcall.h +++ b/ofproto/ofproto-dpif-upcall.h @@ -16,6 +16,7 @@ #define OFPROTO_DPIF_UPCALL_H #include +#include struct dpif; struct dpif_backer; @@ -31,8 +32,8 @@ struct simap; void udpif_init(void); struct udpif *udpif_create(struct dpif_backer *, struct dpif *); void udpif_run(struct udpif *udpif); -void udpif_set_threads(struct udpif *, size_t n_handlers, - size_t n_revalidators); +void udpif_set_threads(struct udpif *, uint32_t n_handlers, + uint32_t n_revalidators); void udpif_destroy(struct udpif *); void udpif_revalidate(struct udpif *); void udpif_get_memory_usage(struct udpif *, struct simap *usage); diff --git a/ofproto/ofproto-provider.h b/ofproto/ofproto-provider.h index 9ad2b71d23eb..57c7d17cb28f 100644 --- a/ofproto/ofproto-provider.h +++ b/ofproto/ofproto-provider.h @@ -534,7 +534,7 @@ extern unsigned ofproto_min_revalidate_pps; /* Number of upcall handler and revalidator threads. Only affects the * ofproto-dpif implementation. */ -extern size_t n_handlers, n_revalidators; +extern uint32_t n_handlers, n_revalidators; static inline struct rule *rule_from_cls_rule(const struct cls_rule *); diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index b91517cd250d..69e5834e766c 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -309,7 +309,7 @@ unsigned ofproto_max_idle = OFPROTO_MAX_IDLE_DEFAULT; unsigned ofproto_max_revalidator = OFPROTO_MAX_REVALIDATOR_DEFAULT; unsigned ofproto_min_revalidate_pps = OFPROTO_MIN_REVALIDATE_PPS_DEFAULT; -size_t n_handlers, n_revalidators; +uint32_t n_handlers, n_revalidators; /* Map from datapath name to struct ofproto, for use by unixctl commands. */ static struct hmap all_ofprotos = HMAP_INITIALIZER(&all_ofprotos);