From: Antonio Quartulli <antonio@openvpn.net>
To: Qingfang Deng <dqfext@gmail.com>
Cc: andrew+netdev@lunn.ch, donald.hunter@gmail.com,
edumazet@google.com, horms@kernel.org, kuba@kernel.org,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
netdev@vger.kernel.org, pabeni@redhat.com,
ryazanov.s.a@gmail.com, sd@queasysnail.net, shaw.leon@gmail.com,
shuah@kernel.org, "Jason A. Donenfeld" <Jason@zx2c4.com>
Subject: Re: [PATCH net-next v23 03/23] ovpn: add basic interface creation/destruction/management routines
Date: Mon, 17 Mar 2025 11:00:51 +0100 [thread overview]
Message-ID: <0d8a8602-2db4-4c19-ab1c-51efef42cef6@openvpn.net> (raw)
In-Reply-To: <CALW65jZe3JQGNcWsZtqU-B4-V-JZ6ocninxvoqMGeusMaU7C=A@mail.gmail.com>
On 17/03/2025 10:41, Qingfang Deng wrote:
> Hi Antonio,
>
> On Mon, Mar 17, 2025 at 5:23 PM Antonio Quartulli <antonio@openvpn.net> wrote:
>>>> +static void ovpn_setup(struct net_device *dev)
>>>> +{
>>>> + netdev_features_t feat = NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_RXCSUM |
>>>
>>> Do not advertise NETIF_F_HW_CSUM or NETIF_F_RXCSUM, as TX/RX checksum is
>>> not handled in hardware.
>>
>> The idea behind these flags was that the OpenVPN protocol will take care
>> of authenticating packets, thus substituting what the CSUM would do here.
>> For this I wanted to avoid the stack to spend time computing the CSUM in
>> software.
>
> For the RX part (NETIF_F_RXCSUM), you might be correct, but in patch
> 08 you wrote:
>> /* we can't guarantee the packet wasn't corrupted before entering the
>> * VPN, therefore we give other layers a chance to check that
>> */
>> skb->ip_summed = CHECKSUM_NONE;
Right. This was the result after a lengthy discussion with Sabrina.
Despite authenticating what enters the tunnel, we indeed concluded it is
better to let the stack verify that what entered was not corrupted.
>
> So NETIF_F_RXCSUM has no effect.
Does it mean I can drop NETIF_F_RXCSUM and also the line
skb->ip_summed = CHECKSUM_NONE;
at the same time?
>
> For the TX part (NETIF_F_HW_CSUM) however, I believe wireguard made
> the same mistake.
> Your code both contains the pattern:
>
> if (skb->ip_summed == CHECKSUM_PARTIAL && skb_checksum_help(skb)) // ...
>
> NETIF_F_HW_CSUM causes the upper layers to send packets with
> CHECKSUM_PARTIAL, assuming hardware offload will complete the
> checksum, but if skb_checksum_help(skb) is invoked, the checksum is
> still computed in software. This means there's no real benefit unless
> there's an actual hardware offload mechanism.
Got it.
Then as per your suggestion I can drop both NETIF_F_HW_CSUM and the
if/call to skb_checksum_help().
Regards,
>
> +Cc: zx2c4
>
>>
>> I believe wireguard sets those flags for the same reason.
>>
>> Does it make sense to you?
>>
>>>
>>>> + NETIF_F_GSO | NETIF_F_GSO_SOFTWARE |
>>>> + NETIF_F_HIGHDMA;
>>
>>
>> Regards,
>>
>> --
>> Antonio Quartulli
>> OpenVPN Inc.
>>
--
Antonio Quartulli
OpenVPN Inc.
next prev parent reply other threads:[~2025-03-17 10:00 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-12 20:54 [PATCH net-next v23 00/23] Introducing OpenVPN Data Channel Offload Antonio Quartulli
2025-03-12 20:54 ` [PATCH net-next v23 01/23] net: introduce OpenVPN Data Channel Offload (ovpn) Antonio Quartulli
2025-03-12 20:54 ` [PATCH net-next v23 02/23] ovpn: add basic netlink support Antonio Quartulli
2025-03-12 20:54 ` [PATCH net-next v23 03/23] ovpn: add basic interface creation/destruction/management routines Antonio Quartulli
2025-03-17 6:09 ` Qingfang Deng
2025-03-17 9:23 ` Antonio Quartulli
2025-03-17 9:41 ` Qingfang Deng
2025-03-17 10:00 ` Antonio Quartulli [this message]
2025-03-17 10:10 ` Qingfang Deng
2025-03-17 10:23 ` Antonio Quartulli
2025-03-12 20:54 ` [PATCH net-next v23 04/23] ovpn: keep carrier always on for MP interfaces Antonio Quartulli
2025-03-12 20:54 ` [PATCH net-next v23 05/23] ovpn: introduce the ovpn_peer object Antonio Quartulli
2025-03-12 20:54 ` [PATCH net-next v23 06/23] ovpn: introduce the ovpn_socket object Antonio Quartulli
2025-03-12 20:54 ` [PATCH net-next v23 07/23] ovpn: implement basic TX path (UDP) Antonio Quartulli
2025-03-12 20:54 ` [PATCH net-next v23 08/23] ovpn: implement basic RX " Antonio Quartulli
2025-03-12 20:54 ` [PATCH net-next v23 09/23] ovpn: implement packet processing Antonio Quartulli
2025-03-17 6:17 ` Qingfang Deng
2025-03-12 20:54 ` [PATCH net-next v23 10/23] ovpn: store tunnel and transport statistics Antonio Quartulli
2025-03-12 20:54 ` [PATCH net-next v23 11/23] ovpn: implement TCP transport Antonio Quartulli
2025-03-12 20:54 ` [PATCH net-next v23 12/23] skb: implement skb_send_sock_locked_with_flags() Antonio Quartulli
2025-03-12 20:54 ` [PATCH net-next v23 13/23] ovpn: add support for MSG_NOSIGNAL in tcp_sendmsg Antonio Quartulli
2025-03-12 20:54 ` [PATCH net-next v23 14/23] ovpn: implement multi-peer support Antonio Quartulli
2025-03-12 20:54 ` [PATCH net-next v23 15/23] ovpn: implement peer lookup logic Antonio Quartulli
2025-03-12 20:54 ` [PATCH net-next v23 16/23] ovpn: implement keepalive mechanism Antonio Quartulli
2025-03-12 20:54 ` [PATCH net-next v23 17/23] ovpn: add support for updating local or remote UDP endpoint Antonio Quartulli
2025-03-12 20:54 ` [PATCH net-next v23 18/23] ovpn: implement peer add/get/dump/delete via netlink Antonio Quartulli
2025-03-17 12:47 ` Sabrina Dubroca
2025-03-17 13:13 ` Antonio Quartulli
2025-03-12 20:54 ` [PATCH net-next v23 19/23] ovpn: implement key add/get/del/swap " Antonio Quartulli
2025-03-12 20:54 ` [PATCH net-next v23 20/23] ovpn: kill key and notify userspace in case of IV exhaustion Antonio Quartulli
2025-03-12 20:54 ` [PATCH net-next v23 21/23] ovpn: notify userspace when a peer is deleted Antonio Quartulli
2025-03-12 20:54 ` [PATCH net-next v23 22/23] ovpn: add basic ethtool support Antonio Quartulli
2025-03-12 20:54 ` [PATCH net-next v23 23/23] testing/selftests: add test tool and scripts for ovpn module Antonio Quartulli
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=0d8a8602-2db4-4c19-ab1c-51efef42cef6@openvpn.net \
--to=antonio@openvpn.net \
--cc=Jason@zx2c4.com \
--cc=andrew+netdev@lunn.ch \
--cc=donald.hunter@gmail.com \
--cc=dqfext@gmail.com \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=ryazanov.s.a@gmail.com \
--cc=sd@queasysnail.net \
--cc=shaw.leon@gmail.com \
--cc=shuah@kernel.org \
/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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox