From patchwork Wed Jun 30 09:56:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Gray X-Patchwork-Id: 1498860 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=Eqvf1k4t; 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 4GFGvX4Fpzz9sSs for ; Wed, 30 Jun 2021 19:56:23 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 58EC582735; Wed, 30 Jun 2021 09:56:20 +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 0jIPzXOZU0YR; Wed, 30 Jun 2021 09:56:19 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp1.osuosl.org (Postfix) with ESMTPS id 85BD6827D2; Wed, 30 Jun 2021 09:56:18 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 5A5A6C0010; Wed, 30 Jun 2021 09:56:18 +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 9EDA2C000E for ; Wed, 30 Jun 2021 09:56:17 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 8CCB24049E for ; Wed, 30 Jun 2021 09:56:17 +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 pN0Y8NcXFuh7 for ; Wed, 30 Jun 2021 09:56:16 +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 C216E403CD for ; Wed, 30 Jun 2021 09:56:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1625046975; 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=gsj7XC1vHzdZR9J2sLNyUX0zNAWLYJqDJE55yBmQ0v0=; b=Eqvf1k4tIoKRIiyrvobcg3nFubEl57rqZru75w1PromjQJeWgroOT73Zm/XdKndqM34wA3 7QIqGv+NJjcEdDt2JA6x5mSYaertiahFiT+DEOW1we5do2l5T5EoX28ANCEQC7/gkAs0hn 1gSSTVubxsh5UYmC9bYb31flzp0rxig= Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-280-BimG6jB7ONqTCc3wFkVhuA-1; Wed, 30 Jun 2021 05:56:14 -0400 X-MC-Unique: BimG6jB7ONqTCc3wFkVhuA-1 Received: by mail-qv1-f72.google.com with SMTP id kj25-20020a0562145299b02902883c3c1b4bso1009395qvb.18 for ; Wed, 30 Jun 2021 02:56:14 -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=gsj7XC1vHzdZR9J2sLNyUX0zNAWLYJqDJE55yBmQ0v0=; b=O4/htgNPOfolIaW0PheC/3ZFqGC9CMJRljHLDGJAbwzGVqSJNkuhmIO52pUZpQBJh/ 7+A/E/3BtuA5VUM//p4lmCO0lUAiESRfz5nA6DKkzunfGpXfQsuIo4iymmn23CVHaHEz 3WTBS1HW491bBCjKF6peprk7hxtrZg7qFuRH8ohpKutX2Ac4b3xYAF9uYU1Zh8Vzry5g gJ566DDKOHhRsW78/KlvIYC5tTY/egN7zro6ayEcX8iVfZGdeBAAl7g+5D8Ucdk5Cucn OMY6BV2Tz6aMjE24I2o1+SL5ktZAzF1Tc5lzgZoG1wqfa9/UcShXdIzw6jlNR0FMAnqY kywg== X-Gm-Message-State: AOAM533yCiAL9JWPgvvok1vKqmkYa012jFZAzZx7cw4j1M3A7dJASZEq Oyo+S6WxQcbvVRLgXUw2/tfMZE5jscKb/LbYsOdmwQxDdcRz/334L2iT/RkNuybQXbwcO2NDHhg AsV8+U/zCqFt9cgw/9gHH9Zh1HtiK/eTaasdk265+CCyXnGefC7YL3q/2mPjm88ssWeDw X-Received: by 2002:ac8:524e:: with SMTP id y14mr28374579qtn.140.1625046973924; Wed, 30 Jun 2021 02:56:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzgtVgkKuwepm2vCtFjnxb02O8GXlM3UDgm8Rf1A5K0aNUjnBneOusk3FxWoi0XoVULqiyj6g== X-Received: by 2002:ac8:524e:: with SMTP id y14mr28374557qtn.140.1625046973684; Wed, 30 Jun 2021 02:56:13 -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 k20sm13498671qko.113.2021.06.30.02.56.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Jun 2021 02:56:12 -0700 (PDT) From: Mark Gray To: dev@openvswitch.org Date: Wed, 30 Jun 2021 05:56:09 -0400 Message-Id: <20210630095611.817982-2-mark.d.gray@redhat.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210630095611.817982-1-mark.d.gray@redhat.com> References: <20210630095611.817982-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 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);