From patchwork Mon Jul 5 13:38:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Gray X-Patchwork-Id: 1500764 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=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=F+5lHaAe; dkim-atps=neutral Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.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 4GJRbw0rVWz9sV8 for ; Mon, 5 Jul 2021 23:38:52 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id CD6A183A5D; Mon, 5 Jul 2021 13:38:49 +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 YCcyglJHY5ZP; Mon, 5 Jul 2021 13:38:48 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp1.osuosl.org (Postfix) with ESMTPS id C208E83837; Mon, 5 Jul 2021 13:38:47 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 12AC3C0024; Mon, 5 Jul 2021 13:38:46 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 3D666C000E for ; Mon, 5 Jul 2021 13:38:44 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 1F3E440257 for ; Mon, 5 Jul 2021 13:38:44 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp4.osuosl.org (amavisd-new); dkim=pass (1024-bit key) header.d=redhat.com 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 2urC3KtN8zf7 for ; Mon, 5 Jul 2021 13:38: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 [170.10.133.124]) by smtp4.osuosl.org (Postfix) with ESMTPS id 17C0C4024E for ; Mon, 5 Jul 2021 13:38:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1625492322; 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=/BkA+BHp0/8Hc7uGlZv1Sxfd535JMmcbf7qMC/STSHY=; b=F+5lHaAekvXeFEMiU3s1c7htpOjoVwoPxWeUmgRaugs3DUEJUR011bK5bt4NAlWN+yCHe/ va0AVkNSZYyQbR6BIvkGERSwNSHFzvD5vip62Vu0Vd1rL4adEebSVInSg+Yp5r7AEpZlnB efjBldsAO0JZsp6ulfJOyK9pzMCRF4o= Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-118-duMzeMadO7qzB0vL-YREcA-1; Mon, 05 Jul 2021 09:38:41 -0400 X-MC-Unique: duMzeMadO7qzB0vL-YREcA-1 Received: by mail-qk1-f199.google.com with SMTP id a2-20020a05620a0662b02903ad3598ec02so14097734qkh.17 for ; Mon, 05 Jul 2021 06:38:41 -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=/BkA+BHp0/8Hc7uGlZv1Sxfd535JMmcbf7qMC/STSHY=; b=e7bArlqRnwhlKCZ8QGXGb43zuTzzz/oio8hEV3V4Q72na+nMq0AKALIw5PQ2jUITgI 5FqPSUt9p4aOWO/YQVUtC+d5+6m8d5yl6obrTg1UXaV4HAA/TtG12WdDREWKiHOBG6yZ 8kmqdn+szPYkzbtG9sncVu/YyfQnyzrB/bv0GP5t/+Ja5eDIjBldxMqnpNBCBSPR36lr rbO+yliDPA2drFr4Uyg9EwQ4xfjbr9PJanZOGXVvEVo6LAShROX1PhjDddGoA39AHc0w AdZ+h7M6xuMSCUTvr/UT3/wusTQlOI2ChGzXEb5nx5I1ooIpniRfU1tbfZTH+p7ZxKwv Ao2w== X-Gm-Message-State: AOAM533m1Cla8z4lrFC+4F0z1MyPZTAtXdRAf7XEd4AEDnLgjIzXvW60 hW7kUzHma2ojjUkJ7g30BRdgtM2voUc1MXsVFU0O6srVx2prRCRHgdzMKFa/zWNLDWREnwGRLlX 19PP9HupjtG6vaGx7AMfMM0rhnGLS//++pXaoqumytTH8j07iYgBDL4kIzeC+bYDgaQt9 X-Received: by 2002:a05:620a:6cd:: with SMTP id 13mr14157981qky.346.1625492320455; Mon, 05 Jul 2021 06:38:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzu2Ad80V2HTHX2OWPAsArzKDYI+aYQshk8mVF6Q7ApjYH7gco8haeJvUPWeODqJJgcXR8aoQ== X-Received: by 2002:a05:620a:6cd:: with SMTP id 13mr14157958qky.346.1625492320218; Mon, 05 Jul 2021 06:38:40 -0700 (PDT) Received: from wsfd-netdev76.ntdv.lab.eng.bos.redhat.com (nat-pool-bos-t.redhat.com. [66.187.233.206]) by smtp.gmail.com with ESMTPSA id i19sm5375100qkl.19.2021.07.05.06.38.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jul 2021 06:38:39 -0700 (PDT) From: Mark Gray To: dev@openvswitch.org Date: Mon, 5 Jul 2021 09:38:35 -0400 Message-Id: <20210705133837.992663-2-mark.d.gray@redhat.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210705133837.992663-1-mark.d.gray@redhat.com> References: <20210705133837.992663-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 Cc: fbl@sysclose.org Subject: [ovs-dev] [PATCH v3 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 Acked-by: Flavio Leitner --- Notes: v1 - Reworked based on Flavio's comments: * fixed inconsistency with change of size_t -> uint32_t ofproto/ofproto-dpif-upcall.c | 20 ++++++++++---------- ofproto/ofproto-dpif-upcall.h | 5 +++-- ofproto/ofproto-provider.h | 2 +- ofproto/ofproto.c | 2 +- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/ofproto/ofproto-dpif-upcall.c b/ofproto/ofproto-dpif-upcall.c index ccf97266c0b9..d22f7f07361f 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 *); @@ -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 @@ -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 80ec2d9ac9c7..53002f082b52 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);