Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1685574pxb; Fri, 20 Aug 2021 11:18:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxOz56gxYvXLZ8ZlRQWei1yr7TiNhk1qb6feEf/umJ8w4JftLe3ZNC9nrtWnm5NMeKSsIG+ X-Received: by 2002:a5d:914b:: with SMTP id y11mr16672055ioq.6.1629483480182; Fri, 20 Aug 2021 11:18:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629483480; cv=none; d=google.com; s=arc-20160816; b=MvCZnGMeX1LvjYLL97hp9oY2ArNEcpkuco68WD3bZWwWPUIo2zxvKb1glU60JMfOlj xRLzBp34oSdrOgIX9Ij2WvFUoknaRNyKRKFi3WngQ8/PKZCzTnIg1Xu6+iDQ0QNS2E3U W8GCYCRJteIECsllg3M5G1lhSg5HwAM6VtVJ10Z/ku1DfckSUhe0VKQSQvakQ/apghmm Ho6F4t43ojBNXZlFOHpeJyTWcGWFZl4uktXbqGBaY/9r/DLZFSxLInHXTwdHu5Cl4EHl RAhK+Rg0YQFP7NELPBVMUfk3MwYeZc2u/zpSFR5OmNrDdH/lh5jOlnKdsrqwskG6uAZ0 cXZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature:dkim-filter; bh=UW5TElFP/RTBb2KKkUeXBfbuUlBUxtX/AtHK8rIv3Q4=; b=iKJV/tp1imxMk+f8a1K5bmbHryk6V1jmj8YWaE2sukV+luEmoTkZE5ntffMX2MA1MD rZdUYSf9bd62mqhCGeZQDTk/T7HHKG79+eSHGwCAg7UcAnKoqFCoBp0E4ffOa/EiJPYB E5PD4WnsZXbdfWqFPtHL3GTLXOJpxdQkh5h/aIbwRjmBGafotlz2R7eYl5hnOtJy9vzC rJPeNjvh+SLbXXn+8Tyl9ICMbZiBU17YWjD/ax7nJw7VtlbhqGpyWG20ENMRowwLb80B gG7McWva7hKUos92UiKRogerWP+O/ZsJEsiAg2UT2wH7lZPO4oyeXId19JgSaRXWhj4f r4FQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=aNmfrAPT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d3si7649736ilq.47.2021.08.20.11.17.48; Fri, 20 Aug 2021 11:18:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=aNmfrAPT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235726AbhHTSPi (ORCPT + 99 others); Fri, 20 Aug 2021 14:15:38 -0400 Received: from linux.microsoft.com ([13.77.154.182]:42732 "EHLO linux.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230089AbhHTSPh (ORCPT ); Fri, 20 Aug 2021 14:15:37 -0400 Received: from mail-pg1-f170.google.com (mail-pg1-f170.google.com [209.85.215.170]) by linux.microsoft.com (Postfix) with ESMTPSA id 325D720C33D4; Fri, 20 Aug 2021 11:14:59 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 325D720C33D4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1629483299; bh=UW5TElFP/RTBb2KKkUeXBfbuUlBUxtX/AtHK8rIv3Q4=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=aNmfrAPThbvUKjB9EGI1zxxmKNepmRru9jyeoYK8nXHg6Q2RedfVl5EcB1xemLSaq DbQTnbHXVHXWwEAQY9Q4/D8tVgWkuQDpi7Uyf4x+9DFulxTyFoOuFttTVtjWhiebGj oIxl9oP+FT3euE8AmTTye79Si6UnS8W8HqK37XuM= Received: by mail-pg1-f170.google.com with SMTP id e7so9967134pgk.2; Fri, 20 Aug 2021 11:14:59 -0700 (PDT) X-Gm-Message-State: AOAM5320rLk4nj3ccULo0+vOtWBAh2YwMXxsUYp4U9sg+lswvsDkC4QU oWyXwA2EzckdZxsfBD9abCywXtG6+fg9GCR4lRk= X-Received: by 2002:a05:6a00:225c:b0:3e1:a127:dd96 with SMTP id i28-20020a056a00225c00b003e1a127dd96mr21298632pfu.0.1629483298725; Fri, 20 Aug 2021 11:14:58 -0700 (PDT) MIME-Version: 1.0 References: <20210614022504.24458-1-mcroce@linux.microsoft.com> <871r71azjw.wl-maz@kernel.org> <202417ef-f8ae-895d-4d07-1f9f3d89b4a4@gmail.com> <87o8a49idp.wl-maz@kernel.org> <20210812121835.405d2e37@linux.microsoft.com> <874kbuapod.wl-maz@kernel.org> <87wnohqty1.wl-maz@kernel.org> <87fsv4qdzm.wl-maz@kernel.org> <87mtpcyrdv.wl-maz@kernel.org> <87h7fkyqpv.wl-maz@kernel.org> <87fsv4ypfn.wl-maz@kernel.org> <87eeaoyon3.wl-maz@kernel.org> In-Reply-To: <87eeaoyon3.wl-maz@kernel.org> From: Matteo Croce Date: Fri, 20 Aug 2021 20:14:22 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH net-next] stmmac: align RX buffers To: Marc Zyngier Cc: Eric Dumazet , Thierry Reding , netdev@vger.kernel.org, Linux Kernel Mailing List , linux-riscv , Giuseppe Cavallaro , Alexandre Torgue , "David S. Miller" , Jakub Kicinski , Palmer Dabbelt , Paul Walmsley , Drew Fustini , Emil Renner Berthing , Jon Hunter , Will Deacon Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 20, 2021 at 8:09 PM Marc Zyngier wrote: > > On Fri, 20 Aug 2021 18:56:33 +0100, > Matteo Croce wrote: > > > > On Fri, Aug 20, 2021 at 7:51 PM Marc Zyngier wrote: > > > > > > On Fri, 20 Aug 2021 18:35:45 +0100, > > > Matteo Croce wrote: > > > > > > > > > > I think it's wrong. The original offset was 0, and to align it to the > > > > > > boundary we need to add just NET_IP_ALIGN, which is two. > > > > > > NET_SKB_PAD is a much bigger value, (I think 64), which is used to > > > > > > reserve space to prepend an header, e.g. with tunnels. > > > > > > > > > > How about the other adjustments that Eric mentioned regarding the size > > > > > of the buffer? Aren't they required? > > > > > > > > > > > > > I guess that if stmmac_rx_buf1_len() needed such adjustment, it would > > > > be already broken when XDP is in use. > > > > When you use XDP, stmmac_rx_offset() adds a pretty big headroom of 256 > > > > byte, which would easily trigger an overflow if not accounted. > > > > Did you try attaching a simple XDP program on a stock 5.13 kernel? > > > > > > Yes, as mentioned in [1], to which you replied... > > > > > > M. > > > > > > [1] https://lore.kernel.org/r/87wnohqty1.wl-maz@kernel.org > > > > > > > Great. > > So I doubt that the adjustment is needed. > > Does it work with all the frame size? > > I have no idea. Honestly, you are the one who should be able to answer > these questions, given that you should have worked out how the buffer > allocations work in this particular driver. > > This whole "let's try another random set of values until something > sticks" is not how things ought to be done, and doesn't fill me with > the utmost confidence that 5.14 (which apparently may well be cut in > *two days*) is going to have a solid stmmac driver. > > I re-re-request that this patch gets reverted until you figure out > what is wrong with the initial patch. > > Thanks, > I would have done it, but I'll not have the hardware until next week at least, otherwise I'd have tried all these tests myself. I'm sure that NET_SKB_PAD doesn't need to be there, if just removing it fixes the problem, consider applying it and put a Fixes tag. -- per aspera ad upstream