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.129.124]) by passt.top (Postfix) with ESMTP id EB63C5A026D for ; Thu, 18 Jan 2024 16:41:51 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1705592510; 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=SzpbGWZ8fna4CxW7RzDfaHoxNNtFfHxtHpRIa8e9Gbw=; b=M+4DoOPA6pzghTNImxqQTGzP12xGXUydZxZOKs3/wt8cHVbTyuE2QmiVIY429JgBNZ3aOK wpkm0WpA6B4JiApL23iJJoitRuEevJuWDIwseIA/BwNgw3n/wTi+cbjHHvgVMT0kV+QURd uFez6chj5Jr5myP2u0/kTMItPq7/i3A= 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-639-KYglWG0jO9KFVrayFTvw0A-1; Thu, 18 Jan 2024 10:41:47 -0500 X-MC-Unique: KYglWG0jO9KFVrayFTvw0A-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (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 E3B5285A589; Thu, 18 Jan 2024 15:41:46 +0000 (UTC) Received: from elisabeth (unknown [10.39.208.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 221F11C02EB3; Thu, 18 Jan 2024 15:41:45 +0000 (UTC) Date: Thu, 18 Jan 2024 16:40:38 +0100 From: Stefano Brivio To: David Gibson Subject: Re: [PATCH v3 05/15] flow, tcp, tcp_splice: Uniform debug helpers for new flows Message-ID: <20240118163959.6ea1956b@elisabeth> In-Reply-To: References: <20231221070237.1422557-1-david@gibson.dropbear.id.au> <20231221070237.1422557-6-david@gibson.dropbear.id.au> <20240117205922.7bba3b54@elisabeth> Organization: Red Hat MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: BQPPI3CZP5NTRRRFF6GXSJ3RWR5AZ74O X-Message-ID-Hash: BQPPI3CZP5NTRRRFF6GXSJ3RWR5AZ74O 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 Thu, 18 Jan 2024 12:04:15 +1100 David Gibson wrote: > On Wed, Jan 17, 2024 at 08:59:22PM +0100, Stefano Brivio wrote: > > On Thu, 21 Dec 2023 18:02:27 +1100 > > David Gibson wrote: > > > > > When debugging passt/pasta, and the flow table in particular, one of the > > > most obvious things to know is when a new flow is initiated, along with the > > > details of its interface, addresses and ports. Once we've determined to > > > what interface the flow should be forwarded, it's useful to know the > > > details of how it will appear on that other interface. > > > > > > To help present that information uniformly, introduce FLOW_NEW_DBG() and > > > FLOW_FWD_DBG() helpers and use them for TCP connections, both "tap" and > > > spliced. > > > > > > Signed-off-by: David Gibson > > > --- > > > flow.c | 40 ++++++++++++++++++++++++++++++++++++++++ > > > flow.h | 16 ++++++++++++++++ > > > tcp.c | 11 +++++++++-- > > > tcp_splice.c | 3 ++- > > > 4 files changed, 67 insertions(+), 3 deletions(-) > > > > > > diff --git a/flow.c b/flow.c > > > index b9c4a18..bc8cfc6 100644 > > > --- a/flow.c > > > +++ b/flow.c > > > @@ -9,6 +9,7 @@ > > > #include > > > #include > > > #include > > > +#include > > > > > > #include "util.h" > > > #include "passt.h" > > > @@ -50,6 +51,45 @@ void flow_log_(const struct flow_common *f, int pri, const char *fmt, ...) > > > logmsg(pri, "Flow %u (%s): %s", flow_idx(f), FLOW_TYPE(f), msg); > > > } > > > > > > +/** > > > + * flow_new_dbg() - Print debug message for new flow > > > + * @f: Common flow structure > > > + * @side: Which side initiated the new flow > > > + */ > > > +void flow_new_dbg(const struct flow_common *f, unsigned side) > > > +{ > > > + char ebuf[INET6_ADDRSTRLEN], fbuf[INET6_ADDRSTRLEN]; > > > + const struct flowside *fside = &f->side[side]; > > > + > > > + flow_log_(f, LOG_DEBUG, "New %s from %s/%u: [%s]:%hu <-> [%s]:%hu", > > > > I think we should always print the connection index too (passed from > > the macro, or passing 'conn' as argument here) -- especially if we want > > to correlate this to what flow_fwd_dbg() will print later. > > Printing the index is built into flow_log_(), so we're already doing > that. Oh, right, sorry, I forgot about it. -- Stefano