Article View: linux.kernel.netdev
Article #14695Re: [PATCH net-next v1 10/11] eth: fbnic: Support RX buffers it cannot split
From: Dimitri Daskalakis
Date: Wed, 11 Nov 2026 21:45
Date: Wed, 11 Nov 2026 21:45
114 lines
15824 bytes
15824 bytes
On 11/10/26 2:20 AM, Björn Töpel wrote:
> fbnic packs several headers, and several payloads, into one page. A
> provider without MP_CAP_FRAG needs one descriptor per buffer. Give
> such a buffer a single reference, program the queue so each header and
> payload takes a buffer of its own, and drop packets that break this.
>
> Header split is now set per queue, so link up changes only the drop
> mode.
>
> Signed-off-by: Björn Töpel <bjorn@kernel.org>
> ---
> drivers/net/ethernet/meta/fbnic/fbnic_txrx.c | 119 ++++++++++++++++---
> drivers/net/ethernet/meta/fbnic/fbnic_txrx.h | 2 +
> 2 files changed, 102 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c b/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c
> index bfaa284e497e..d96c957d6fba 100644
> --- a/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c
> +++ b/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c
> @@ -761,8 +761,14 @@ static void fbnic_page_pool_init(struct fbnic_ring *ring, unsigned int idx,
> {
> struct fbnic_rx_buf *rx_buf = &ring->rx_buf[idx];
>
> - page_pool_fragment_netmem(netmem, FBNIC_PAGECNT_BIAS_MAX);
> - rx_buf->pagecnt_bias = FBNIC_PAGECNT_BIAS_MAX;
> + /* A whole buffer has one reference. The packet takes it, so the buffer
> + * may be reused before its BDQ entry is cleaned.
> + */
> + rx_buf->pagecnt_bias = 1;
> + if (page_pool_supports_frag(ring->page_pool)) {
> + page_pool_fragment_netmem(netmem, FBNIC_PAGECNT_BIAS_MAX);
> + rx_buf->pagecnt_bias = FBNIC_PAGECNT_BIAS_MAX;
> + }
> rx_buf->netmem = netmem;
> }
>
> @@ -792,7 +798,8 @@ static void fbnic_page_pool_drain(struct fbnic_ring *ring, unsigned int idx,
> struct fbnic_rx_buf *rx_buf = &ring->rx_buf[idx];
> netmem_ref netmem = rx_buf->netmem;
>
> - if (!page_pool_unref_netmem(netmem, rx_buf->pagecnt_bias))
> + if (rx_buf->pagecnt_bias &&
> + !page_pool_unref_netmem(netmem, rx_buf->pagecnt_bias))
> page_pool_put_unrefed_netmem(ring->page_pool, netmem, -1,
> !!budget);
>
> @@ -993,6 +1000,19 @@ static unsigned int fbnic_hdr_pg_end(unsigned int pg_off, unsigned int len)
> return ALIGN(pg_off, 128) - FBNIC_RX_HROOM;
> }
>
> +/* A buffer that cannot be split has one reference and takes one descriptor */
> +static bool fbnic_bd_one_desc(struct fbnic_napi_vector *nv,
> + const struct fbnic_ring *bdq, unsigned int idx,
> + bool ok)
> +{
> + if (likely(page_pool_supports_frag(bdq->page_pool) ||
> + (bdq->rx_buf[idx].pagecnt_bias == 1 && ok)))
> + return true;
> +
> + netdev_err_once(nv->napi.dev, "Bad descriptor for a whole RX buffer\n");
> + return false;
> +}
> +
> static void fbnic_pkt_prepare(struct fbnic_napi_vector *nv, u64 rcd,
> struct fbnic_pkt_buff *pkt,
> struct fbnic_q_triad *qt)
> @@ -1007,6 +1027,17 @@ static void fbnic_pkt_prepare(struct fbnic_napi_vector *nv, u64 rcd,
> /* data_hard_start should always be NULL when this is called */
> WARN_ON_ONCE(pkt->buff.data_hard_start);
>
> + /* MAX_HDR leaves no room for a second header in a whole buffer, so
> + * the device closes it, with PAGE_FIN, after the first.
> + */
> + pkt->add_frag_failed = false;
> + if (unlikely(!fbnic_bd_one_desc(nv, &qt->sub0, hdr_pg_idx,
> + FIELD_GET(FBNIC_RCD_AL_PAGE_FIN,
> + rcd)))) {
> + pkt->add_frag_failed = true;
> + return;
> + }
> +
> netmem = fbnic_page_pool_get_head(qt, hdr_pg_idx);
> pkt->head = netmem;
>
> @@ -1032,7 +1063,6 @@ static void fbnic_pkt_prepare(struct fbnic_napi_vector *nv, u64 rcd,
> len - FBNIC_RX_PAD, true);
>
> pkt->hwtstamp = 0;
> - pkt->add_frag_failed = false;
> }
>
> static void fbnic_add_rx_frag(struct fbnic_napi_vector *nv, u64 rcd,
> @@ -1046,8 +1076,20 @@ static void fbnic_add_rx_frag(struct fbnic_napi_vector *nv, u64 rcd,
> netmem_ref netmem;
> bool added;
>
> + if (unlikely(!fbnic_bd_one_desc(nv, &qt->sub1, pg_idx, !pg_off))) {
> + pkt->add_frag_failed = true;
> + return;
> + }
> +
> netmem = fbnic_page_pool_get_data(qt, pg_idx);
>
> + /* Without a header buffer, the packet is dropped. */
> + if (unlikely(!pkt->buff.data_hard_start)) {
> + page_pool_put_full_netmem(qt->sub1.page_pool, netmem, true);
> + pkt->add_frag_failed = true;
> + return;
> + }
> +
How would we get in this state? Does the device need to misbehave and skip
the header descriptor?
Technical Details
Message-ID:
<f9979d3b-2a6a-4fa4-ad4d-10e5d4958678@gmail.com>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!nntp.comgw.net!eternal-september.org!feeder.eternal-september.org!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-361290-linux-kernel-netdev=dewy.ruReferences:
<20261110102039.1002605-1-bjorn@kernel.org> <20261110102039.1002605-11-bjorn@kernel.org>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!nntp.comgw.net!eternal-september.org!feeder.eternal-september.org!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-361290-linux-kernel-netdev=dewy.ru
From: dimitri.daskalakis1@gmail.com (Dimitri Daskalakis)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v1 10/11] eth: fbnic: Support RX buffers it
cannot split
Date: Wed, 11 Nov 2026 13:45:51 -0800
Organization: Usenet Network
Message-ID: <f9979d3b-2a6a-4fa4-ad4d-10e5d4958678@gmail.com>
References: <20261110102039.1002605-1-bjorn@kernel.org>
<20261110102039.1002605-11-bjorn@kernel.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
logging-data="945400"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:m3zWvBhjm9Vy26RCNDets1NXy08= sha256:qN5OxGTlRZHOMMKNjzaqMx6DeuhGfbTp+AqqIHSg90M=
sha1:hAasKP4Z0ViDZ+6lTTrasYKbSuo= sha256:syDJrlK7Zx7Md7krhC3psL/bSmyRDBzxBGQMw9AlYPI=
Content-Language: en-US
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
by mail.dewy.ru (Postfix) with ESMTP id 4D9DB113FDC; Thu, 12 Nov 2026 00:48:34 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.049
X-Spam-Status: No, score=-3.049 tagged_above=-9999 required=6.31
tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001,
FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
header.d=gmail.com
X-Received: from mail.dewy.ru ([127.0.0.1])
by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id UuN3HT1VF_lA;
Thu, 12 Nov 2026 00:48:26 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-361290-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
by mail.dewy.ru (Postfix) with ESMTPS id 64233113FCB; Thu, 12 Nov 2026 00:48:14 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by sea.lore.kernel.org (Postfix) with ESMTP id 0AA9D62F52; Wed, 11 Nov 2026 21:46:01 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
t=1794433557;
b=18C1LXHE0QfOa1hNA8k20fnPBliwkNp+NG+q/IY8InDt2FpvmKTHuk9hfv2WbSVDxL8x
x1Ee6wu+2T9tzMyWHVpFYL9vcUEApm77vI5/Tty20Pkx/NhBlGNTN0xa7QukPwAg3+VVN
IohFi1qJcYtNJqUa5XyYWLQ+cEZ9bawAJHYyQLS2xtPAxlWnhbksfAeZ+m1JVS1CTO/Ae
DLG7aswqzcZPubL0U/PD7KlakgityX477xL74OIa6p6ZK7B5DOHk4XG4ZjAdpQ0VdD7/V
kJoZzIRQi/Pfq3QflWcidXcwvywkCUGozGberqTZtm8XS4JvavF3WWeeXPFg3X1JnpA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1794433557;
h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
X-Google-DKIM-Signature:X-Forwarded-Encrypted:X-Gm-Message-State:
X-Gm-Gg:X-Received:Received:Message-ID:Date:X-Mailing-List:List-Id:
List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
Precedence:MIME-Version:User-Agent:Subject:To:Cc:References:
Content-Language:From:In-Reply-To:Content-Type:
Content-Transfer-Encoding;
bh=uLiiTa/Gb7h1TxDGjxBpe1u+WEWowZlfNkmPxqWemd0=;
b=2420HDT+ybpoKcCcvUgRbjwNtYhTk6Uu9Z1360akIEArSIV/NKjBqdDOM5wQZB2XXZv0
9jRpyU2nHb/VBUpsvotIm1afyxEv/Ns2ky+QSupQmAclMMU0CHrVM6g4sOAu5HyEl2yLG
nOp5svAeRTt7KMmsGpsvN7ak/v6D0SMRyOVmypPF+GGK9p//fpfbm8CqJhtJ9ksJo+NEG
DJk9K1G2Bj11fycBYGsdGUvHrxbcuYVXOeF9g51kyEi1uHhWtgRKsXtchNYkfsNwMGsGw
Igdrc1rQ+JHCQaC/l1FZDtJEKUstcofaVH2Jl8tcukm+z06YVWTnggBOKQywYRIGJBw==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=Q3o1yGAM;
dmarc=pass header.from=gmail.com;
spf=pass smtp.mailfrom=gmail.com;
arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id DF06D606A32A;
Wed, 11 Nov 2026 21:45:56 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=Q3o1yGAM
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.182
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1794433556;
b=0KHYVvuOuLbcJiLk5Zs9TlOjcWyg8pP89DllxHfbv98yIdVF0HOyqJSVr+WOh3IaCCSR
N/FegU5t+dIQLuwkLRhlfnB06tq7qUy6bjIlp8whXydPmHx81TJ9L9IF51NeInvnH/Fud
upF3UXairSI1Yf/aX0Qua2ircItTaqcSr4BclUKHaO2qbIbatAi0aVxS9FrJudBM2jHPf
nbQMUaIXKCFJTaxTJJi/CPvvGzycV0exi9nOSB1titZt4n9OqAjcSjEfLIh5wvFcMdVx7
IPb+xmQ+b71gHwZGwoDQS+WgG2QG4EqcKhVcnpomLHkdBnOf853UsvscCPMNcmW2kLQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1794433556;
h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received:
Message-ID:Date:MIME-Version:User-Agent:Subject:To:Cc:References:
Content-Language:From:In-Reply-To:Content-Type:
Content-Transfer-Encoding;
bh=uLiiTa/Gb7h1TxDGjxBpe1u+WEWowZlfNkmPxqWemd0=;
b=n7t9qQMicLnhFewA9RACv0X+wVW1/AbOzt9i5jEhJfuNkvCUCz+k6/1AvBxBhV9sSAR6
fQRKR4gHKYD4wT4qbsEw4+MR3FlTykTAbcKEfo3g63JMvdhpI/nSXY08GsOay+LwUT/oC
IUdtedZhloXAuu1z+od5Ur5Ix6cgwPRLpABl4PkbB6sNNh7iYtIuAiNKlfwuquW7tvLgN
OV8G3rPf4ocaxZBvBOPxjV1Llqd5TyxydqUUWKpwYEQu1CxED/2sgUrcwjnWo3Ow0Ytgy
K9MNWxDWbT5Bw/55HJhiqr+CFPiUvx5J8V9dKicufwJC0O8Yl9IGQxKEI87Xpjh3oTA==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=pass header.from=gmail.com;
spf=pass smtp.mailfrom=gmail.com;
dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=Q3o1yGAM;
arc=none smtp.remote-ip=74.125.82.182
X-Received: from mail-dy1-f182.google.com (mail-dy1-f182.google.com [74.125.82.182])
(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 72F62606A321
for <netdev@vger.kernel.org>; Wed, 11 Nov 2026 21:45:55 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 72F62606A321
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-dy1-f182.google.com with SMTP id 5a478bee46e88-3700ed8dbe3so6476939eec.0
for <netdev@vger.kernel.org>; Wed, 11 Nov 2026 13:45:55 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20260707; t=1794433554; x=1795038354; darn=vger.kernel.org;
h=content-transfer-encoding:content-type:in-reply-to:from
:content-language:references:cc:to:subject:user-agent:mime-version
:date:message-id:from:to:cc:subject:date:message-id:reply-to
:content-type;
bh=uLiiTa/Gb7h1TxDGjxBpe1u+WEWowZlfNkmPxqWemd0=;
b=Q3o1yGAMmIMBrIgCVDWk5ZLj3xdQII6hHVqnmtuQqxF30ztQZShfrSaWGPDsxxdTqZ
NF7wxW4425xwPino3SFafvANsRF6RpeNzwzIY8MrQ8robbnXnI+4LZskJxLaAMM3AMB9
sQG6Cn9vcAEToQ9Qyqeg2tccYh/hkxtK41BaGgXRj4cOHu3iXLo/F3oVJixljU9STury
0X1RK0TMK2Qi4v6SRrnM/YApgfD3gpxY8f4LfgMaXRuoog4bqcIwbS0tGnEw0nx4+0XM
GqGAwjlevoWNUoYT0pKtPnd4QuhU8e77GwG+nJzG3ZpPjjUpkqi+Wocl1zaTpYoPtW38
fX+g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1794433554; x=1795038354;
h=content-transfer-encoding:content-type:in-reply-to:from
:content-language:references:cc:to:subject:user-agent:mime-version
:date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
:message-id:reply-to:content-type;
bh=uLiiTa/Gb7h1TxDGjxBpe1u+W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vL6Bd2IgaQfPi1AzEkidGfYHnqqBy2W1OOTQq8TQ/ySKsEKw5lIV
0TWVy490OmZjRS6JFcDsapq2vPjHY3JzRBVyMIaicoKJYbO0XqqbD+Q6huGbDyRvNX9u9aLz359
FOjMNJo2quEBilBNYpMQQn531VyC9CBWVKbYaNMOZxeGKJDfzXNfvVyNra/v8ws+BKztaF2tZrU
7EYjXgrZ/R/SXodTwvo2PEj69hjG4ZD2PD3SyfQ==
X-Received: by 2002:a05:7301:3f19:b0:36f:3da8:dbc8 with SMTP id 5a478bee46e88-37686d31fa8mr5532433eec.31.1794433554164;
Wed, 11 Nov 2026 13:45:54 -0800 (PST)
X-Received: from ?IPV6:2a03:83e0:1151:15:c24:4ad9:f660:1904? ([2620:10d:c090:500::6:1f95])
by smtp.gmail.com with ESMTPSA id 5a478bee46e88-375212e9e03sm38006432eec.23.2026.11.11.13.45.52
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Wed, 11 Nov 2026 13:45:53 -0800 (PST)
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-User-Agent: Mozilla Thunderbird
X-Cc: "Mike Marciniszyn (Meta)" <mike.marciniszyn@gmail.com>,
Weiming Shi <bestswngs@gmail.com>, Nikolay Aleksandrov
<razor@blackwall.org>, David Wei <dw@davidwei.uk>,
Alexander Lobakin <aleksander.lobakin@intel.com>, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org, Stuart Clark <stuclar@meta.com>
X-In-Reply-To: <20261110102039.1002605-11-bjorn@kernel.org>