From: Stefano Brivio <sbrivio@redhat.com>
To: Laurent Vivier <lvivier@redhat.com>
Cc: passt-dev@passt.top
Subject: Re: [PATCH v2 6/8] checksum: use csum_ip4_header() in udp.c and tcp.c
Date: Sat, 17 Feb 2024 15:37:07 +0100 [thread overview]
Message-ID: <20240217153707.77eb1cd5@elisabeth> (raw)
In-Reply-To: <a3cc6e26-b424-4961-a74d-dd888ae3ef6d@redhat.com>
On Sat, 17 Feb 2024 15:22:12 +0100
Laurent Vivier <lvivier@redhat.com> wrote:
> On 2/16/24 19:24, Stefano Brivio wrote:
> > On Fri, 16 Feb 2024 19:05:39 +0100
> > Laurent Vivier <lvivier@redhat.com> wrote:
> >
> > ...
> >> I think I will send the v3 of my series without fixing that because I don't have enough
> >> time this week. I will address the problem later.
> > No problem! I will also try to spend a moment and see if there's some
> > reasonable solution I can suggest. Thanks,
> >
> I can imagine 4 solutions:
>
> * to use inline functions (could it helps the compiler to manage the alignment problem?)
I guess in practice yes, but it could be formally complicated for a
compiler to make sure no instructions dereferencing those pointers will
be emitted, plus this is on the packet path and if the compiler decides
to *not* inline, we shouldn't force that.
> * to use C macros
I'm not sure exactly how, I have some vague idea of what you might
mean, it could be quite awkward though.
> * to use these new functions only with vhost-user as we know pointers will be aligned.
This is quite unlikely to help: the problem is that 802.3 (Ethernet)
frame headers are (without VLANs) 14 bytes.
If you align the start of the frame, and we need those frames (and
pointers to them) whenever we talk Layer-2, the rest can't be aligned
to 4-bytes boundary.
> * to include structure we want to address in a generic wrapperstructure that will
> unalign it as it is done with the current structure.
This sounds like the easiest and safest way to me. Note that pointers
to 'taph' can be happily dereferenced, too. You can pass around
pointers to that, instead of using 'iph'.
I used (almost everywhere?) the start of the buffer, but 'taph' is fine
as well.
--
Stefano
next prev parent reply other threads:[~2024-02-17 14:37 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-14 8:56 [PATCH v2 0/8] Add vhost-user support to passt (part 1) Laurent Vivier
2024-02-14 8:56 ` [PATCH v2 1/8] iov: add some functions to manage iovec Laurent Vivier
2024-02-15 0:24 ` David Gibson
2024-02-15 0:32 ` David Gibson
2024-02-16 5:29 ` Stefano Brivio
2024-02-14 8:56 ` [PATCH v2 2/8] pcap: add pcap_iov() Laurent Vivier
2024-02-15 0:35 ` David Gibson
2024-02-16 5:30 ` Stefano Brivio
2024-02-14 8:56 ` [PATCH v2 3/8] checksum: align buffers Laurent Vivier
2024-02-15 0:40 ` David Gibson
2024-02-14 8:56 ` [PATCH v2 4/8] checksum: add csum_iov() Laurent Vivier
2024-02-15 0:44 ` David Gibson
2024-02-14 8:56 ` [PATCH v2 5/8] util: move IP stuff from util.[ch] to ip.[ch] Laurent Vivier
2024-02-15 2:29 ` David Gibson
2024-02-14 8:56 ` [PATCH v2 6/8] checksum: use csum_ip4_header() in udp.c and tcp.c Laurent Vivier
2024-02-15 2:51 ` David Gibson
2024-02-16 9:08 ` Stefano Brivio
2024-02-16 14:17 ` Laurent Vivier
2024-02-16 14:54 ` Stefano Brivio
2024-02-16 18:05 ` Laurent Vivier
2024-02-16 18:24 ` Stefano Brivio
2024-02-17 14:22 ` Laurent Vivier
2024-02-17 14:37 ` Stefano Brivio [this message]
2024-02-19 2:06 ` David Gibson
2024-02-14 8:56 ` [PATCH v2 7/8] checksum: introduce functions to compute the header part checksum for TCP/UDP Laurent Vivier
2024-02-15 3:12 ` David Gibson
2024-02-14 8:56 ` [PATCH v2 8/8] tap: make tap_update_mac() generic Laurent Vivier
2024-02-15 3:13 ` David Gibson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240217153707.77eb1cd5@elisabeth \
--to=sbrivio@redhat.com \
--cc=lvivier@redhat.com \
--cc=passt-dev@passt.top \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://passt.top/passt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).