From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 532AFC433DF for ; Tue, 2 Jun 2020 15:01:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 354E62074B for ; Tue, 2 Jun 2020 15:01:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726139AbgFBPBP (ORCPT ); Tue, 2 Jun 2020 11:01:15 -0400 Received: from www62.your-server.de ([213.133.104.62]:37796 "EHLO www62.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726140AbgFBPBP (ORCPT ); Tue, 2 Jun 2020 11:01:15 -0400 Received: from sslproxy02.your-server.de ([78.47.166.47]) by www62.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89_1) (envelope-from ) id 1jg8Pg-0007l5-LZ; Tue, 02 Jun 2020 17:01:12 +0200 Received: from [178.196.57.75] (helo=pc-9.home) by sslproxy02.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jg8Pg-000WjS-CY; Tue, 02 Jun 2020 17:01:12 +0200 Subject: Re: Checksum behaviour of bpf_redirected packets To: Lorenz Bauer , Alan Maguire Cc: Alexei Starovoitov , bpf , kernel-team , Jakub Kicinski References: <39d3bee2-dcfc-8240-4c78-2110d639d386@iogearbox.net> <835af597-c346-e178-09c4-9f67c9480020@iogearbox.net> From: Daniel Borkmann Message-ID: <030555e5-e0ba-3b78-3de3-531eba96245e@iogearbox.net> Date: Tue, 2 Jun 2020 17:01:11 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Authenticated-Sender: daniel@iogearbox.net X-Virus-Scanned: Clear (ClamAV 0.102.2/25831/Tue Jun 2 14:41:03 2020) Sender: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org On 6/2/20 12:13 PM, Lorenz Bauer wrote: > On Mon, 1 Jun 2020 at 22:25, Alan Maguire wrote: >> On Mon, 1 Jun 2020, Daniel Borkmann wrote: >>> On 6/1/20 7:48 PM, Alan Maguire wrote: >>>> On Wed, 13 May 2020, Lorenz Bauer wrote: >>>> >>>>>>> Option 1: always downgrade UNNECESSARY to NONE >>>>>>> - Easiest to back port >>>>>>> - The helper is safe by default >>>>>>> - Performance impact unclear >>>>>>> - No escape hatch for Cilium >>>>>>> >>>>>>> Option 2: add a flag to force CHECKSUM_NONE >>>>>>> - New UAPI, can this be backported? >>>>>>> - The helper isn't safe by default, needs documentation >>>>>>> - Escape hatch for Cilium >>>>>>> >>>>>>> Option 3: downgrade to CHECKSUM_NONE, add flag to skip this >>>>>>> - New UAPI, can this be backported? >>>>>>> - The helper is safe by default >>>>>>> - Escape hatch for Cilium (though you'd need to detect availability of >>>>>>> the >>>>>>> flag somehow) >>>>>> >>>>>> This seems most reasonable to me; I can try and cook a proposal for >>>>>> tomorrow as >>>>>> potential fix. Even if we add a flag, this is still backportable to stable >>>>>> (as >>>>>> long as the overall patch doesn't get too complex and the backport itself >>>>>> stays >>>>>> compatible uapi-wise to latest kernels. We've done that before.). I happen >>>>>> to >>>>>> have two ixgbe NICs on some of my test machines which seem to be setting >>>>>> the >>>>>> CHECKSUM_UNNECESSARY, so I'll run some experiments from over here as well. >>>>> >>>>> Great! I'm happy to test, of course. >>>> >>>> I had a go at implementing option 3 as a few colleagues ran into this >>>> problem. They confirmed the fix below resolved the issue. Daniel is >>>> this roughly what you had in mind? I can submit a patch for the bpf >>>> tree if that's acceptable with the new flag. Do we need a few >>>> tests though? >>> >>> Coded this [0] up last week which Lorenz gave a spin as well. Originally >>> wanted to >>> get it out Friday night, but due to internal release stuff it got too late Fri >>> night >>> and didn't want to rush it at 3am anymore, so the series as fixes is going out >>> tomorrow >>> morning [today was public holiday in CH over here]. >> >> Looks great! Although I've only seen this issue arise >> for cases where csum_level == 0, should we also >> add "skb->csum_level = 0;" when we reset the >> ip_summed value? > > FWIW I had the same reaction. Maybe it's worth adding after all, Daniel? Although not needed, but yeah, fair enough. I've added a small skb helper for it. Series is out here now, ptal [0]. Thanks, Daniel [0] https://lore.kernel.org/bpf/cover.1591108731.git.daniel@iogearbox.net/