From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2A7DA391; Tue, 9 May 2023 07:45:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1B502C433EF; Tue, 9 May 2023 07:45:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1683618306; bh=hQf9pNjF7zwQYcyl32iKf1KLzffA/L5NTPvBZwMUTgQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=V5LB7U1w8G4yNHH3tkFYJG0rDXq46KYsBP33UJPdV3muH7IJ0NBQ+GLscVF4mH3Fl l/UG0wo3OZFH1I1zVYup3sEMAaSEytVom8vPwn+MQdBrkcJzyrfxPq3AHzWBnwexvJ qmsMzYkIRIdc1bs00SywKw5YmU1oRhyMMFAbHZGJ5QsWExGoolS97YzimyCLwMhDKJ YLHtjtHuVm7YMkq7e3o836Cbwi2EABhQivy3SAfag6PeYF/ZHy2uk+fLoKS+d5AbGL h6Q9m+bZST3sf8Oj27QIrlw0VDTx4pHpm+DEU9EQct67JkatYU+MwuSvDCPh0NABnz ss+U6ERs6r7Mg== Date: Tue, 9 May 2023 10:45:02 +0300 From: Leon Romanovsky To: Shenwei Wang Cc: Wei Fang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Clark Wang , NXP Linux Team , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , Alexander Lobakin , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, Gagandeep Singh Subject: Re: [PATCH v4 1/1] net: fec: correct the counting of XDP sent frames Message-ID: <20230509074502.GB38143@unreal> References: <20230508142931.980196-1-shenwei.wang@nxp.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230508142931.980196-1-shenwei.wang@nxp.com> On Mon, May 08, 2023 at 09:29:31AM -0500, Shenwei Wang wrote: > In the current xdp_xmit implementation, if any single frame fails to > transmit due to insufficient buffer descriptors, the function nevertheless > reports success in sending all frames. This results in erroneously > indicating that frames were transmitted when in fact they were dropped. > > This patch fixes the issue by ensureing the return value properly > indicates the actual number of frames successfully transmitted, rather than > potentially reporting success for all frames when some could not transmit. > > Fixes: 6d6b39f180b8 ("net: fec: add initial XDP support") > Signed-off-by: Gagandeep Singh > Signed-off-by: Shenwei Wang > --- > v4: > - the tx frame shouldn't be returned when error occurs. > - changed the function return values by using the standard errno. > > v3: > - resend the v2 fix for "net" as the standalone patch. > > v2: > - only keep the bug fix part of codes according to Horatiu's comments. > - restructure the functions to avoid the forward declaration. > > drivers/net/ethernet/freescale/fec_main.c | 14 +++++++++----- > 1 file changed, 9 insertions(+), 5 deletions(-) <...> > - for (i = 0; i < num_frames; i++) > - fec_enet_txq_xmit_frame(fep, txq, frames[i]); > + for (i = 0; i < num_frames; i++) { > + if (fec_enet_txq_xmit_frame(fep, txq, frames[i]) != 0) > + break; > + sent_frames++; > + } net-next has commit 6312c685ae0 ("net: fec: correct the counting of XDP sent frames") which has exactly these lines. Plus the patch is missing target tree in its subject line. For example: [PATCH net-next] ... Thanks