Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp5145634rwe; Tue, 18 Apr 2023 02:44:17 -0700 (PDT) X-Google-Smtp-Source: AKy350YniF0RoIL3byliur0JrDnkkruMt/UmkdjL3b/i7MxaO+PrqMAsAL5+RARpsuVs4FamdGN7 X-Received: by 2002:a05:6a00:1349:b0:63d:3411:f9eb with SMTP id k9-20020a056a00134900b0063d3411f9ebmr3216339pfu.1.1681811057518; Tue, 18 Apr 2023 02:44:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681811057; cv=none; d=google.com; s=arc-20160816; b=gM6fL6Oh/0dhXE2GSNr/oHtpHNtngNguw+ZRj6iL6hOjRBTsXCpJBSs3iBea6OispR nFcH8L/Mdc1XdXkuNq/ECT73M2BEe34vYY+ovg9OB1olx01aJdmCFhtkLADTdAMt1yTH Bi2MmpOMmLgnlidbpzJgMO9KJ7QuOR1+Ia4VuoyblUgDbOUFjG9thaNgMGVZMV+ULbgh WBb4YqKkSYyBs7Qr1KiCVpVP2msKF8n817QK0gYC3J9lHHxJl1s62hTELQHpXYnhMFM5 AIRaAf2W7DJGaAPh4eqgB94oPuJp1D2bL6D7JCruuu5+EsARMKfJEXk0+pekzvr0RXne TaCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:feedback-id:mime-version :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id:dkim-signature; bh=CqK3hsqP4ZsT3ZUY+isIcg9eKHACr0lAiNG1+JRla6g=; b=ZgRYDRsLqWLfaY5+LBKitZne3QdS3JLz4QAtWiwHc9AgLmJAalziMNZTZ8YVsqM2+b 7Moc/B25HG65DHswEiD1UA145zsrU/0vsOgpttv5gs98xWTjVVElWoazerx5LuNMz01U gkDTub/IWhKoDmHbqWy6Vnuxr+VlciB5MwJArJ05B4NWc8TEGumqCgJk/6coRmMAMt76 6aMM+3VUQgCxEaBvICHf4HVPoPTxo079PFsYwP/TgCkiCKmgflLmHmciWKQD+5XGzG20 9PRLT9kGDGJeBMtVXjui2e7IcPSLlAHZehxiiA3HsIzAMZ2dDHRP7yW+86G7d5lEl0+B 5img== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@siemens.com header.s=fm1 header.b=qgSvw768; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siemens.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x20-20020aa79ad4000000b0063bcab61625si5059361pfp.178.2023.04.18.02.44.03; Tue, 18 Apr 2023 02:44:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@siemens.com header.s=fm1 header.b=qgSvw768; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siemens.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230454AbjDRJb3 (ORCPT + 99 others); Tue, 18 Apr 2023 05:31:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229635AbjDRJb1 (ORCPT ); Tue, 18 Apr 2023 05:31:27 -0400 Received: from mta-65-227.siemens.flowmailer.net (mta-65-227.siemens.flowmailer.net [185.136.65.227]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4666F59CC for ; Tue, 18 Apr 2023 02:31:23 -0700 (PDT) Received: by mta-65-227.siemens.flowmailer.net with ESMTPSA id 202304180931194b406a5dffd5c3211e for ; Tue, 18 Apr 2023 11:31:19 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm1; d=siemens.com; i=florian.bezdeka@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=CqK3hsqP4ZsT3ZUY+isIcg9eKHACr0lAiNG1+JRla6g=; b=qgSvw768XrHXL9zjoF5Fi+WBoNdMdWHl324bLBiS9wq1u4tQkr2ulODt4ZPNSvEiHuxy2w RKE2yu8Sb8Bi5ojr66/Z5zlRmyQQ9lRmWdbz4qoWuBo9sjNznGinj7y4/74qtLGJqMnle6KC e1VTaI9CzcGE4fniV7kl20klcOhV8=; Message-ID: <98a4831de6c2ae4a3eb8d29dcd114a6e96c34f94.camel@siemens.com> Subject: Re: [PATCH net v3 1/1] igc: read before write to SRRCTL register From: Florian Bezdeka To: Jesper Dangaard Brouer , Song Yoong Siang , Jesse Brandeburg , Tony Nguyen , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , Maciej Fijalkowski , Vedang Patel , Jithu Joseph , Andre Guedes , Stanislav Fomichev , Jacob Keller , David Laight Cc: brouer@redhat.com, intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, xdp-hints@xdp-project.net, stable@vger.kernel.org Date: Tue, 18 Apr 2023 11:31:16 +0200 In-Reply-To: References: <20230414154902.2950535-1-yoong.siang.song@intel.com> <934a4204-1920-f5e1-bcde-89429554d0d6@redhat.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-68982:519-21489:flowmailer X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2023-04-17 at 16:24 +0200, Jesper Dangaard Brouer wrote: > On 14/04/2023 22.05, Jesper Dangaard Brouer wrote: > > =20 > > On 14/04/2023 17.49, Song Yoong Siang wrote: > > > igc_configure_rx_ring() function will be called as part of XDP progra= m > > > setup. If Rx hardware timestamp is enabled prio to XDP program setup, > > > this timestamp enablement will be overwritten when buffer size is > > > written into SRRCTL register. > > >=20 > > > Thus, this commit read the register value before write to SRRCTL > > > register. This commit is tested by using xdp_hw_metadata bpf selftest > > > tool. The tool enables Rx hardware timestamp and then attach XDP prog= ram > > > to igc driver. It will display hardware timestamp of UDP packet with > > > port number 9092. Below are detail of test steps and results. > > >=20 > [...] > > >=20 > > > Fixes: fc9df2a0b520 ("igc: Enable RX via AF_XDP zero-copy") > > > Cc: # 5.14+ > > > Signed-off-by: Song Yoong Siang > > > Reviewed-by: Jacob Keller > > > Reviewed-by: Jesper Dangaard Brouer > > > --- > >=20 > > LGTM, thank for the adjustments :-) > >=20 > > Acked-by: Jesper Dangaard Brouer > >=20 >=20 > Tested-by: Jesper Dangaard Brouer >=20 > I can confirm that this patch fix the issue I experienced with igc. >=20 > This patch clearly fixes a bug in igc when writing the SRRCTL register. > (as bit 30 in register is "Timestamp Received Packet" which got cleared= =20 > before). >=20 > Florian might have found another bug around RX timestamps, but this > patch should be safe and sane to apply as is. After a closer look I'm quite sure now that this patch should fix my issue as well. The register will be overwritten when setting up a XSK_POOL as well: igc_bpf igc_xdp_setup_pool igc_enable_rx_ring igc_configure_rx_ring wr32(IGC_SRRCTL) I already removed the BPF loading (which is the use case that the patch description mentions) from my setup to limit the search scope. If you like you could extend the patch description, but I'm fine with it. Thanks a lot for all the support / ideas! Highly appreciated! Florian >=20 > > > v2 -> v3: Refactor SRRCTL definitions to more human readable definiti= ons > > > v1 -> v2: Fix indention > > > --- > > > =C2=A0 drivers/net/ethernet/intel/igc/igc_base.h | 11 ++++++++--- > > > =C2=A0 drivers/net/ethernet/intel/igc/igc_main.c |=C2=A0 7 +++++-- > > > =C2=A0 2 files changed, 13 insertions(+), 5 deletions(-) >=20