From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by passt.top (Postfix) with ESMTP id 6B75C5A0272 for ; Tue, 2 Jan 2024 19:13:54 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704219233; 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=YvjurbMj9B2yySOJp4iYhrGYLFf6CtQRJhJCrrpw5uI=; b=bRTHmUjyVASZCg4DNtfIVEbvg1sSxjMznEQeeVFS6I9lR0lKt9qPuuONU/k0P971hO5oaZ kLie3Z4FY5c9h5HCx4EJe6McGF4snpXjchloHMmiZOyPwa2z3r/1dxz/IRypzdKFHMTEj/ 2Ng2LgMhCzKaZ/Nos3Qs3HQuwmgyDfg= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-688-cXp1-1UGPwyTeVksc2FcFg-1; Tue, 02 Jan 2024 13:13:52 -0500 X-MC-Unique: cXp1-1UGPwyTeVksc2FcFg-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D921183B826; Tue, 2 Jan 2024 18:13:51 +0000 (UTC) Received: from elisabeth (unknown [10.39.208.16]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 143C1492BC6; Tue, 2 Jan 2024 18:13:50 +0000 (UTC) Date: Tue, 2 Jan 2024 19:13:48 +0100 From: Stefano Brivio To: David Gibson Subject: Re: [PATCH v3 13/13] flow: Avoid moving flow entries to compact table Message-ID: <20240102191348.199c2f8d@elisabeth> In-Reply-To: References: <20231221061549.976358-1-david@gibson.dropbear.id.au> <20231221061549.976358-14-david@gibson.dropbear.id.au> <20231228192525.7ba1ee48@elisabeth> Organization: Red Hat MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: G3CVLYFXGH5FRBTT6URNTWMOTWSUCE2G X-Message-ID-Hash: G3CVLYFXGH5FRBTT6URNTWMOTWSUCE2G X-MailFrom: sbrivio@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: passt-dev@passt.top X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Mon, 1 Jan 2024 21:44:54 +1100 David Gibson wrote: > On Thu, Dec 28, 2023 at 07:25:25PM +0100, Stefano Brivio wrote: > > On Thu, 21 Dec 2023 17:15:49 +1100 > > David Gibson wrote: > > > > [...] > > > > > void flow_defer_handler(const struct ctx *c, const struct timespec *now) > > > { > > > + struct flow_free_block *free_head = NULL; > > > + unsigned *last_next = &flow_first_free; > > > bool timer = false; > > > - union flow *flow; > > > + unsigned idx; > > > > > > if (timespec_diff_ms(now, &flow_timer_run) >= FLOW_TIMER_INTERVAL) { > > > timer = true; > > > flow_timer_run = *now; > > > } > > > > > > - for (flow = flowtab + flow_count - 1; flow >= flowtab; flow--) { > > > + for (idx = 0; idx < FLOW_MAX; idx++) { > > > + union flow *flow = &flowtab[idx]; > > > bool closed = false; > > > > > > + if (flow->f.type == FLOW_TYPE_NONE) { > > > + /* Start of a free block */ > > > + free_head = &flow->free; > > > + *last_next = idx; > > > + last_next = &free_head->next; > > > + /* Skip the rest of the block */ > > > + idx += free_head->n - 1; > > > + continue; > > > + } > > > + > > > + > > > > Stray tabs. > > > > > switch (flow->f.type) { > > > + case FLOW_TYPE_NONE: > > > + closed = true; > > > + break; ...more important than stray tabs, I noticed only now: how would we ever hit this switch case, if you're checking for this in the if clause just before? > > > case FLOW_TCP: > > > closed = tcp_flow_defer(flow); > > > break; -- Stefano