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 010555A026D for ; Thu, 8 Feb 2024 18:12:47 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1707412367; 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=75jKyeTRDmXk6xK5CtyuewAPM53wrfino4lffdMeryE=; b=dHiRmR7dMwxG7eCPAZlC3fGl5TuiLHTf9wUDYFDL1Z7FiGp4UR/qIXhhnS0ZSAjYKxRqfB zhIbak/HuGXuI+ceh+Uim8WvCU8kULfOW2uBd2ecysnZDCDGkAIJ6Abz/BvQquBX8pCHFc d/tM/hd/SQ5S1vVI56AGTGNnDRdDKNI= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-494-i55Qbc3nMoOSGzwOG1dwSw-1; Thu, 08 Feb 2024 12:12:45 -0500 X-MC-Unique: i55Qbc3nMoOSGzwOG1dwSw-1 Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-a26f2da3c7bso930466b.0 for ; Thu, 08 Feb 2024 09:12:45 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707412364; x=1708017164; h=content-transfer-encoding:mime-version:organization:references :in-reply-to:message-id:subject:cc:to:from:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=75jKyeTRDmXk6xK5CtyuewAPM53wrfino4lffdMeryE=; b=aFnH2E5R6yOfeImw2eVRJu02h6IYNBO8m16D9Zv+DgmO3tV1YrPXYAQgFCk+WlrJ3d 1SFNqOCuZO+pUfjl4uW9hLqeOX7hlaQlctFmi3RVJq5YYGnaqbWwE70jfXP93i4mX5Ol dvrdPuT3Og814UJbEBH/YcKkbFon+Pi9dDZjdehRMIoB3lpqV2C2sCtbHuHoFX5/AKfV zG12vtdcqxhEK0M6oTYP2NOi/JOf4xLeUl4C9mop3/quy+84TsHitAi7n8poFA2/qC7/ KBrPtf3oAJhYyOfWdGA60KzF2qW9GpS52YeI6f559UOosdYkl7S+lbk/ZaughR9o08id 3Neg== X-Gm-Message-State: AOJu0YzDyBULF1RIr40lQ10Fym2RIYrWozyNjubYlBi1Y4Ddzq/BLkCc u8poEo+3Obg9O2ObPE3TH1CxmZNt51bvBVYH0O1S60e2NzbIc2U5XsCpV/G6tIrdxcdN0YmHnTK OYbeNTdkqVcEI5XOt+xvVKTWoxQEwJP61fGuS0rMiIBox0qrgWQ== X-Received: by 2002:a17:906:191:b0:a38:535c:6c4d with SMTP id 17-20020a170906019100b00a38535c6c4dmr5545186ejb.53.1707412364319; Thu, 08 Feb 2024 09:12:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IHNVsvZ+fe5lOp8k3O6+Tyv0NvlW7S1gY74aNiRD2+2qZ4ldFvG0BXFd8AiJAxiBBz9D+IAlQ== X-Received: by 2002:a17:906:191:b0:a38:535c:6c4d with SMTP id 17-20020a170906019100b00a38535c6c4dmr5545174ejb.53.1707412364035; Thu, 08 Feb 2024 09:12:44 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCUKuBjVUo7iMgd4zpPrm8f9Pp0hZomwdnK8isuM4+Im3ggU/yTdq/ljZ355oL5+6IVTmh3UzRSHjhjg8LfBW+lE6UNd Received: from maya.cloud.tilaa.com (maya.cloud.tilaa.com. [164.138.29.33]) by smtp.gmail.com with ESMTPSA id pj24-20020a170906d79800b00a37ad2c72dasm241120ejb.183.2024.02.08.09.12.43 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Feb 2024 09:12:43 -0800 (PST) Date: Thu, 8 Feb 2024 18:10:51 +0100 From: Stefano Brivio To: David Gibson Subject: Re: [PATCH 12/24] tap: make tap_update_mac() generic Message-ID: <20240208181051.12433bf7@elisabeth> In-Reply-To: References: <20240202141151.3762941-1-lvivier@redhat.com> <20240202141151.3762941-13-lvivier@redhat.com> Organization: Red Hat X-Mailer: Claws Mail 4.1.1 (GTK 3.24.36; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: HTWR5WWUGMF437PSRSWBZ2XUR4Z333HL X-Message-ID-Hash: HTWR5WWUGMF437PSRSWBZ2XUR4Z333HL 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: Laurent Vivier , 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 Tue, 6 Feb 2024 12:49:40 +1100 David Gibson wrote: > On Fri, Feb 02, 2024 at 03:11:39PM +0100, Laurent Vivier wrote: > > Use ethhdr rather than tap_hdr. > > > > Signed-off-by: Laurent Vivier > > Reviewed-by: David Gibson > > I'd be happy to see this applied immediately, in advance of the rest > of the series. Oh, hm, do you need this for something around the flow table? I just have one nit below: > > --- > > tap.c | 6 +++--- > > tap.h | 2 +- > > tcp_buf.c | 8 ++++---- > > udp.c | 4 ++-- > > 4 files changed, 10 insertions(+), 10 deletions(-) > > > > diff --git a/tap.c b/tap.c > > index 3ea03f720d6d..29f389057ac1 100644 > > --- a/tap.c > > +++ b/tap.c > > @@ -447,13 +447,13 @@ size_t tap_send_frames(const struct ctx *c, const struct iovec *iov, size_t n) > > * @eth_d: Ethernet destination address, NULL if unchanged > > * @eth_s: Ethernet source address, NULL if unchanged > > */ > > -void tap_update_mac(struct tap_hdr *taph, > > +void eth_update_mac(struct ethhdr *eh, ...function comment should be updated accordingly. > > const unsigned char *eth_d, const unsigned char *eth_s) > > { > > if (eth_d) > > - memcpy(taph->eh.h_dest, eth_d, sizeof(taph->eh.h_dest)); > > + memcpy(eh->h_dest, eth_d, sizeof(eh->h_dest)); > > if (eth_s) > > - memcpy(taph->eh.h_source, eth_s, sizeof(taph->eh.h_source)); > > + memcpy(eh->h_source, eth_s, sizeof(eh->h_source)); > > } > > > > PACKET_POOL_DECL(pool_l4, UIO_MAXIOV, pkt_buf); > > diff --git a/tap.h b/tap.h > > index 466d91466c3d..437b9aa2b43f 100644 > > --- a/tap.h > > +++ b/tap.h > > @@ -74,7 +74,7 @@ void tap_icmp6_send(const struct ctx *c, > > const void *in, size_t len); > > int tap_send(const struct ctx *c, const void *data, size_t len); > > size_t tap_send_frames(const struct ctx *c, const struct iovec *iov, size_t n); > > -void tap_update_mac(struct tap_hdr *taph, > > +void eth_update_mac(struct ethhdr *eh, > > const unsigned char *eth_d, const unsigned char *eth_s); > > void tap_listen_handler(struct ctx *c, uint32_t events); > > void tap_handler_pasta(struct ctx *c, uint32_t events, > > diff --git a/tcp_buf.c b/tcp_buf.c > > index d70e7f810e4a..4c1f00c1d1b2 100644 > > --- a/tcp_buf.c > > +++ b/tcp_buf.c > > @@ -218,10 +218,10 @@ void tcp_buf_update_l2(const unsigned char *eth_d, const unsigned char *eth_s) > > struct tcp4_l2_buf_t *b4 = &tcp4_l2_buf[i]; > > struct tcp6_l2_buf_t *b6 = &tcp6_l2_buf[i]; > > > > - tap_update_mac(&b4->taph, eth_d, eth_s); > > - tap_update_mac(&b6->taph, eth_d, eth_s); > > - tap_update_mac(&b4f->taph, eth_d, eth_s); > > - tap_update_mac(&b6f->taph, eth_d, eth_s); > > + eth_update_mac(&b4->taph.eh, eth_d, eth_s); > > + eth_update_mac(&b6->taph.eh, eth_d, eth_s); > > + eth_update_mac(&b4f->taph.eh, eth_d, eth_s); > > + eth_update_mac(&b6f->taph.eh, eth_d, eth_s); > > } > > } > > > > diff --git a/udp.c b/udp.c > > index 96b4e6ca9a85..db635742319b 100644 > > --- a/udp.c > > +++ b/udp.c > > @@ -283,8 +283,8 @@ void udp_update_l2_buf(const unsigned char *eth_d, const unsigned char *eth_s) > > struct udp4_l2_buf_t *b4 = &udp4_l2_buf[i]; > > struct udp6_l2_buf_t *b6 = &udp6_l2_buf[i]; > > > > - tap_update_mac(&b4->taph, eth_d, eth_s); > > - tap_update_mac(&b6->taph, eth_d, eth_s); > > + eth_update_mac(&b4->taph.eh, eth_d, eth_s); > > + eth_update_mac(&b6->taph.eh, eth_d, eth_s); > > } > > } > > > -- Stefano