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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 544C4C433F5 for ; Tue, 10 May 2022 14:39:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346539AbiEJOnK (ORCPT ); Tue, 10 May 2022 10:43:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345157AbiEJOlD (ORCPT ); Tue, 10 May 2022 10:41:03 -0400 Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5DD042F7367; Tue, 10 May 2022 06:57:45 -0700 (PDT) Received: by mail-wr1-f50.google.com with SMTP id c11so23920688wrn.8; Tue, 10 May 2022 06:57:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=kLUsJJIOjnBzu7Fn+p8pQABeh5O/fVn3NLgRAHyO7K0=; b=rVD9dGOLZ+KIygSPWyoOgiNbqk5Y7O5EI5WSPu309CM/BWGmLBiQqPVs+eT+pcOZ3M /304vDKX7fLNVfp26psi7TsjMF+5mF3LZcp7Z9ZaTBhYGuYCyglaU+ww/WKlwa2L7uO4 jLHRe1P98OQpTcGQACbdmc8g04qJjk4cWPAmSiRX69E7MmDeWBhe1+mwAzxbiKqdLSTy 0KGdTOLpxx9nUIMslBX2OzZqkBHcjHv56G6KXtv/Z+vrD7PNRtw6rWxnXRyomEVlSyTT cSXDSHxYPQuQJTj8Qf1JZIrS47rV0zTaqtn/3leQ7D9JK2CyJcFugN6i5E15r3YfnF2U jANg== X-Gm-Message-State: AOAM532F5qv0uzP+f5GfeZivy8wsu1/L6KBLGhJcK1LN7CAs367+09+5 8KjMvvLMvKFmcO4RUZeWuVux920EV81iAI8m/QQ= X-Google-Smtp-Source: ABdhPJyXdjBKuRq72cBtrrUEpYnydXQDURkv81nEvnDJ+fmifrl92MntG3s+vyJ2HAL1KwM4b7mJ6Nl9QX59icqFeWU= X-Received: by 2002:a05:6000:2a7:b0:20c:4d42:189b with SMTP id l7-20020a05600002a700b0020c4d42189bmr18882068wry.16.1652191053526; Tue, 10 May 2022 06:57:33 -0700 (PDT) MIME-Version: 1.0 References: <20220509121958.3976-1-harini.katakam@xilinx.com> <19e704ace63483a765a3298610218c5d110bb0e4.camel@redhat.com> In-Reply-To: <19e704ace63483a765a3298610218c5d110bb0e4.camel@redhat.com> From: Harini Katakam Date: Tue, 10 May 2022 19:27:22 +0530 Message-ID: Subject: Re: [PATCH] net: macb: Increment rx bd head after allocating skb and buffer To: Paolo Abeni Cc: Harini Katakam , Nicolas Ferre , David Miller , Claudiu Beznea , Jakub Kicinski , dumazet@google.com, netdev , Linux Kernel Mailing List , Michal Simek , Radhey Shyam Pandey Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Paolo, On Tue, May 10, 2022 at 6:54 PM Paolo Abeni wrote: > > Hello, > > On Mon, 2022-05-09 at 17:49 +0530, Harini Katakam wrote: > > In gem_rx_refill rx_prepared_head is incremented at the beginning of > > the while loop preparing the skb and data buffers. If the skb or data > > buffer allocation fails, this BD will be unusable BDs until the head > > loops back to the same BD (and obviously buffer allocation succeeds). > > In the unlikely event that there's a string of allocation failures, > > there will be an equal number of unusable BDs and an inconsistent RX > > BD chain. Hence increment the head at the end of the while loop to be > > clean. > > > > Signed-off-by: Harini Katakam > > Signed-off-by: Michal Simek > > Signed-off-by: Radhey Shyam Pandey > > This looks like targeting the "net" tree, please repost adding a > suitable Fixes tag. Thanks for the review. This behavior would theoretically have been the same since GEM RX path handling was introduced ~9 yrs ago but I'm not sure since I cannot reproduce. Probably this? https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/net/ethernet/cadence?id=4df95131ea803bcb94f472d465c73ed57015c470 Also, this patch can't be backported to stable branches so far back since the driver files have changed. It can also be queued for net-next instead. Regards, Harini