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 mail.toke.dk (Postfix) with ESMTPS id 040539FDB25 for ; Thu, 13 Apr 2023 21:05:38 +0200 (CEST) Authentication-Results: mail.toke.dk; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=ADZ53R42 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681412736; 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=UCBVyFd5BBmA+6Xv/IIgNhhtsz0B8DYXHt8AQVnFyEY=; b=ADZ53R42VBZxh8v38I9Xot5FvqsXejzzFSD5/8ggefm2wP9Pw+WhRxmNjrmerEPI7wJ6zi 5D7weuwiYNx5XmDxC1mAjQNmOLPxpKMHkCzW8kftROq95hDsSVrjsBuoLVCyvMMW/Lvgi2 4jn3epuqvvN83ARin0EZJl5XVSK0Mns= Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-564-nPquIBTqOpiTzu257mpJcg-1; Thu, 13 Apr 2023 15:05:35 -0400 X-MC-Unique: nPquIBTqOpiTzu257mpJcg-1 Received: by mail-ej1-f69.google.com with SMTP id r12-20020a1709062ccc00b0092fce91a838so5824467ejr.20 for ; Thu, 13 Apr 2023 12:05:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681412734; x=1684004734; h=content-transfer-encoding:in-reply-to:references:to :content-language:subject:cc:user-agent:mime-version:date:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=UCBVyFd5BBmA+6Xv/IIgNhhtsz0B8DYXHt8AQVnFyEY=; b=iU/kM6i58mlPVhhczGNu7VESmTxRmf5XFdzzkFR8HIwWPuULCYt86pkHmFSYv2iVsA JT2CFF4rs6AMTCmZ73vsOwjnCIiN0dkMwjzeasOBEe0KqR76riEsMRjDTG2bqELpBGam otPCPxGKOV5QKWZmiFXfEx9wRF/6XH6D6whZ+OvmIa+6zUFLGsTrPWUzSHcRiAYbO4qg +J//aMHrf/WIzdHWBKOyK9DmNjPzEU1uOr3XlsM5A4DGB6ZnpgvBChgRRJ6IcZqj5jcn wJJLG3B896HTJcP7VXwMJzBfM9rNioDqXHeOEff24dY4lCyJrq8Jy59PLhKJKQM4z2bk ru8A== X-Gm-Message-State: AAQBX9e3Qhf9HaFRFQ1mH9N90Tc2g6a9rJi6tRpfVTzrDbUO5jd56VGu Wecky+ce6B0hOgl9tB9Os4b1lC/p9AEDcYGxv+jytIWhH4/MC0xkPoYFxZHAJ1KsuldNevlJwRS 4/C+HAn0S9ua9FGQ31SeB X-Received: by 2002:a17:907:7783:b0:92b:f118:ef32 with SMTP id ky3-20020a170907778300b0092bf118ef32mr3344079ejc.48.1681412734065; Thu, 13 Apr 2023 12:05:34 -0700 (PDT) X-Google-Smtp-Source: AKy350b0NoeyqPTndxzzpsGhufBoItrSucdDKVSwz86SIeJfM9Bqvf0Y1jAxX92P52cAl7P9mNqd0A== X-Received: by 2002:a17:907:7783:b0:92b:f118:ef32 with SMTP id ky3-20020a170907778300b0092bf118ef32mr3344059ejc.48.1681412733732; Thu, 13 Apr 2023 12:05:33 -0700 (PDT) Received: from [192.168.42.222] (194-45-78-10.static.kviknet.net. [194.45.78.10]) by smtp.gmail.com with ESMTPSA id gz1-20020a170907a04100b0094a6ba1f5ccsm1368474ejc.22.2023.04.13.12.05.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 13 Apr 2023 12:05:33 -0700 (PDT) From: Jesper Dangaard Brouer X-Google-Original-From: Jesper Dangaard Brouer Message-ID: Date: Thu, 13 Apr 2023 21:05:32 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 To: 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 References: <20230413151222.1864307-1-yoong.siang.song@intel.com> In-Reply-To: <20230413151222.1864307-1-yoong.siang.song@intel.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Message-ID-Hash: DH53CCSYC7K6UVVFXQV4QLU7RA6B4RSE X-Message-ID-Hash: DH53CCSYC7K6UVVFXQV4QLU7RA6B4RSE X-MailFrom: jbrouer@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: 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 X-Mailman-Version: 3.3.8 Precedence: list Subject: [xdp-hints] Re: [PATCH net 1/1] igc: read before write to SRRCTL register List-Id: XDP hardware hints design discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On 13/04/2023 17.12, Song Yoong Siang wrote: > igc_configure_rx_ring() function will be called as part of XDP program > 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. > > 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 program > to igc driver. It will display hardware timestamp of UDP packet with > port number 9092. Below are detail of test steps and results. [...] > diff --git a/drivers/net/ethernet/intel/igc/igc_base.h b/drivers/net/ethernet/intel/igc/igc_base.h > index 7a992befca24..b95007d51d13 100644 > --- a/drivers/net/ethernet/intel/igc/igc_base.h > +++ b/drivers/net/ethernet/intel/igc/igc_base.h > @@ -87,8 +87,11 @@ union igc_adv_rx_desc { > #define IGC_RXDCTL_SWFLUSH 0x04000000 /* Receive Software Flush */ > > /* SRRCTL bit definitions */ > -#define IGC_SRRCTL_BSIZEPKT_SHIFT 10 /* Shift _right_ */ > -#define IGC_SRRCTL_BSIZEHDRSIZE_SHIFT 2 /* Shift _left_ */ > +#define IGC_SRRCTL_BSIZEPKT_MASK GENMASK(6, 0) > +#define IGC_SRRCTL_BSIZEPKT_SHIFT 10 /* Shift _right_ */ > +#define IGC_SRRCTL_BSIZEHDRSIZE_MASK GENMASK(13, 8) > +#define IGC_SRRCTL_BSIZEHDRSIZE_SHIFT 2 /* Shift _left_ */ > +#define IGC_SRRCTL_DESCTYPE_MASK GENMASK(27, 25) > #define IGC_SRRCTL_DESCTYPE_ADV_ONEBUF 0x02000000 > > #endif /* _IGC_BASE_H */ > diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c > index 25fc6c65209b..de7b21c2ccd6 100644 > --- a/drivers/net/ethernet/intel/igc/igc_main.c > +++ b/drivers/net/ethernet/intel/igc/igc_main.c > @@ -641,7 +641,10 @@ static void igc_configure_rx_ring(struct igc_adapter *adapter, > else > buf_size = IGC_RXBUFFER_2048; > > - srrctl = IGC_RX_HDR_LEN << IGC_SRRCTL_BSIZEHDRSIZE_SHIFT; > + srrctl = rd32(IGC_SRRCTL(reg_idx)); > + srrctl &= ~(IGC_SRRCTL_BSIZEPKT_MASK | IGC_SRRCTL_BSIZEHDRSIZE_MASK | > + IGC_SRRCTL_DESCTYPE_MASK); ^^ Please fix indention, moving IGC_SRRCTL_DESCTYPE_MASK such that it aligns with IGC_SRRCTL_BSIZEPKT_MASK. This make is easier for the eye to spot that it is part of the negation (~). > + srrctl |= IGC_RX_HDR_LEN << IGC_SRRCTL_BSIZEHDRSIZE_SHIFT; > srrctl |= buf_size >> IGC_SRRCTL_BSIZEPKT_SHIFT; > srrctl |= IGC_SRRCTL_DESCTYPE_ADV_ONEBUF; >