Article View: linux.kernel.netdev
Article #89Re: [PATCH net] bnxt_en: fix DMA mapping length for padded small packets
From: Fabian Grünbichler
Date: Wed, 07 Oct 2026 06:51
Date: Wed, 07 Oct 2026 06:51
161 lines
11483 bytes
11483 bytes
On October 5, 2026 4:26 pm, Bernhard Schmidt wrote:
> On 05/10/26 01:18 PM, Salvatore Bonaccorso wrote:
>> Hi,
>>
>> On Mon, Oct 05, 2026 at 04:38:12AM +0200, Eric Dumazet wrote:
>> > Stefan Fleischmann reported Intel IOMMU DMA Read faults on BCM57412
>> > NetXtreme-E NICs when transmitting packets on VLAN/macvlan interfaces:
>> >
>> > DMAR: [DMA Read NO_PASID] Request device [18:00.0] fault addr 0xfc499000
>> > [fault reason 0x06] PTE Read access is not set
>> > bnxt_en 0000:18:00.0 eno1np0: Abandoning msg {0xb4 0x41a} len: 0 due to firmware status: 0x2000001
>> > ...
>> > NETDEV WATCHDOG: eno1np0 (bnxt_en): transmit queue 0 timed out
>> >
>> > The fault address (0xfc499000) is on an exact 4KB page boundary,
>> > pointing to a DMA read buffer overrun.
>> >
>> > In bnxt_start_xmit(), packets smaller than BNXT_MIN_PKT_SIZE (52 bytes),
>> > such as 42-byte untagged ARP frames, are padded:
>> >
>> > if (length < BNXT_MIN_PKT_SIZE) {
>> > pad = BNXT_MIN_PKT_SIZE - length;
>> > if (skb_pad(skb, pad))
>> > goto tx_kick_pending;
>> > length = BNXT_MIN_PKT_SIZE;
>> > }
>> >
>> > mapping = dma_map_single(&pdev->dev, skb->data, len, DMA_TO_DEVICE);
>> > ...
>> > dma_unmap_len_set(tx_buf, len, len);
>> >
>> > However, 'len' was initialized earlier to skb_headlen(skb) (e.g. 42 bytes)
>> > and is left unadjusted after padding. Consequently, dma_map_single() and
>> > dma_unmap_len_set() map and track only 42 bytes.
>> >
>> > Later, the hardware TX buffer descriptor is programmed with the padded length:
>> >
>> > txbd->tx_bd_len_flags_type =
>> > cpu_to_le32(((len + pad) << TX_BD_LEN_SHIFT) | flags |
>> > TX_BD_FLAGS_PACKET_END);
>> >
>> > The NIC DMA engine is thus instructed to read 52 bytes from a region where
>> > only 42 bytes were DMA-mapped. If skb->data ends near the boundary of a 4KB
>> > page (within 'pad' bytes of the next page), the hardware DMA read overruns
>> > into the unmapped adjacent page, triggering an IOMMU fault.
>> >
>> > This issue was exposed after commit 447cbe95ebb9 ("vlan: fix skb_under_panic
>> > and races when toggling HW VLAN offload") because reserving extra VLAN
>> > headroom rounded LL_RESERVED_SPACE from 48 up to 64 bytes, shifting skb->data
>> > offsets and potentially causing small frames to land right against page
>> > boundaries.
>> >
>> > Fix this by using skb_put_padto(skb, BNXT_MIN_PKT_SIZE) in the normal_tx
>> > path. This ensures skb->len and skb_headlen(skb) reflect the padded size so
>> > that dma_map_single() maps the full buffer and the descriptor length is
>> > consistent. This also removes the temporary 'pad' variable and masking logic.
>> >
>> > Fixes: c0c050c58d84 ("bnxt_en: New Broadcom ethernet driver.")
>> > Cc: stable@vger.kernel.org
>> > Reported-by: Stefan Fleischmann <sfle@kth.se>
>> > Closes: https://lore.kernel.org/netdev/20261004122616.56714cbd@nargothrond/
>> > Signed-off-by: Eric Dumazet <edumazet@google.com>
>> > ---
>> > Cc: Michael Chan <michael.chan@broadcom.com>
>> > Cc: Pavan Chebbi <pavan.chebbi@broadcom.com>
>> > Cc: Andrew Lunn <andrew+netdev@lunn.ch>
>> > ---
>> > drivers/net/ethernet/broadcom/bnxt/bnxt.c | 19 +++++++------------
>> > 1 file changed, 7 insertions(+), 12 deletions(-)
>> >
>> > diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
>> > index d7728d0c5b6e63ee72de9dea54426bb4c8b7a9fc..7ea27e81e88c5ca82a453b449982b791e8acc831 100644
>> > --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
>> > +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
>> > @@ -486,7 +486,7 @@ static netdev_tx_t bnxt_start_xmit(struct sk_buff *skb, struct net_device *dev)
>> > struct netdev_queue *txq;
>> > int i;
>> > dma_addr_t mapping;
>> > - unsigned int length, pad = 0;
>> > + unsigned int length;
>> > u32 len, free_size, vlan_tag_flags, cfa_action, flags;
>> > struct bnxt_ptp_cfg *ptp = bp->ptp_cfg;
>> > struct pci_dev *pdev = bp->pdev;
>> > @@ -672,14 +672,12 @@ static netdev_tx_t bnxt_start_xmit(struct sk_buff *skb, struct net_device *dev)
>> > }
>> >
>> > normal_tx:
>> > - if (length < BNXT_MIN_PKT_SIZE) {
>> > - pad = BNXT_MIN_PKT_SIZE - length;
>> > - if (skb_pad(skb, pad))
>> > - /* SKB already freed. */
>> > - goto tx_kick_pending;
>> > - length = BNXT_MIN_PKT_SIZE;
>> > + if (skb_put_padto(skb, BNXT_MIN_PKT_SIZE)) {
>> > + /* SKB already freed. */
>> > + goto tx_kick_pending;
>> > }
>> > -
>> > + length = skb->len;
>> > + len = skb_headlen(skb);
>> > mapping = dma_map_single(&pdev->dev, skb->data, len, DMA_TO_DEVICE);
>> >
>> > if (unlikely(dma_mapping_error(&pdev->dev, mapping)))
>> > @@ -759,10 +757,7 @@ static netdev_tx_t bnxt_start_xmit(struct sk_buff *skb, struct net_device *dev)
>> > txbd->tx_bd_len_flags_type = cpu_to_le32(flags);
>> > }
>> >
>> > - flags &= ~TX_BD_LEN;
>> > - txbd->tx_bd_len_flags_type =
>> > - cpu_to_le32(((len + pad) << TX_BD_LEN_SHIFT) | flags |
>> > - TX_BD_FLAGS_PACKET_END);
>> > + txbd->tx_bd_len_flags_type |= cpu_to_le32(TX_BD_FLAGS_PACKET_END);
>> >
>> > netdev_tx_sent_queue(txq, skb->len);
>> >
>> > --
>> > 2.53.0
>>
>> FWIW, got as well reported in Debian for an update in the 6.12.y
>> series: https://bugs.debian.org/1149564 , in case you would like to
>> add a further Link/Closes reference. Bernhard Schmidt is testing the
>> patch as well on top of 6.12.111 (what we have right now in Debian)
>> and looks promissing: https://bugs.debian.org/1149564#89 .
>>
>> Berhard, want to report back a Tested-by from you?
>
> Looks good. Machine has been stable with that patch applied to 6.12
>
> Tested-by: Bernhard Schmidt <berni@debian.org>
>
> Bernhard
Our users' testing (on top of 7.0.14 with 7.1.x and 7.2.x stable patches
mostly added on top) came back positive as well. Since I don't have
access to the hardware myself, and can neither reproduce nor rest, not
sending a T-b..
Technical Details
Message-ID:
<1791355804.90wql0jw19.astroid@yuna.none>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-342222-linux-kernel-netdev=dewy.ruReferences:
<20261005023812.130639-1-edumazet@kernel.org> <asOHdc6HMSVrS9z9@eldamar.lan> <asOzkZIrKusyF1d0@fliwatuet.svr02.mucip.net>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-342222-linux-kernel-netdev=dewy.ru From: f.gruenbichler@proxmox.com (Fabian Grünbichler) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net] bnxt_en: fix DMA mapping length for padded small packets Date: Wed, 07 Oct 2026 08:51:17 +0200 Organization: Usenet Network Message-ID: <1791355804.90wql0jw19.astroid@yuna.none> References: <20261005023812.130639-1-edumazet@kernel.org> <asOHdc6HMSVrS9z9@eldamar.lan> <asOzkZIrKusyF1d0@fliwatuet.svr02.mucip.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: usenet.network; logging-data="593684"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:ErVxY3N8l3/763OnhsgnhUcI6Gs= sha256:h0BiUjvBVvTrfngJyIENJNyLn/LCoj4briKXaxvt6Z8= sha1:20us/r7vnmwMZLXJJFxyWCWhLWI= sha256:PWm0jKPcAfCCGj2BmlgO3s4bY2t2Wa+rPIrNUS2ZZ/s= 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 8603510F0E6; Wed, 7 Oct 2026 09:54:02 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -0.651 X-Spam-Status: No, score=-0.651 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no 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 5tJ4aPwXrW3p; Wed, 7 Oct 2026 09:53:54 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-342222-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=proxmox.com X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 6B7F910F0E5; Wed, 7 Oct 2026 09:53:48 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1]) by sea.lore.kernel.org (Postfix) with ESMTP id 3A5C72447A; Wed, 7 Oct 2026 06:51:35 +0000 (UTC) X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1023F40681D; Wed, 7 Oct 2026 06:51:35 +0000 (UTC) X-Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (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 E77CA40B112; Wed, 7 Oct 2026 06:51:31 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=94.136.29.106 X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791355895; cv=none; b=ksQLXRENqtrl66Vainxxba2aTw9cMgmVvuDTEFAa3I79sWe8KvVwxqeO4QRMbyCA+Gu6p6ejwS998DeMqlkU2BbG5hVUN7FYSk/lCYlL7d18ruSETOT0en2Z6Mkhka/BHtuc8xvXRACdZPq9iLRSHSQEr+ZHhxUgl83p6tcgGA4= X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791355895; c=relaxed/simple; bh=KfHGF8Eh/o6TnDUuA44CBHtFbaVHKAS5slJ9Lv1puP4=; h=Date:From:Subject:To:Cc:References:In-Reply-To:MIME-Version: Message-Id:Content-Type; b=XSVdOcPo5uucf8cTSaDKC4mTvfSapSM6BacAKxg22r6chdWShd7OfdoD29JJ3Eb/3wfOq3aD3Xjf7eAwbCrYdKmUhIcOosefQKRtMLPxWkPBWjc9GSZ8K6J8FM1gqLehql0NEHY7saqkOUvI4FcVmwG5gc2beQqM99DpbvPxKsw= X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=proxmox.com; spf=pass smtp.mailfrom=proxmox.com; arc=none smtp.client-ip=94.136.29.106 X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=proxmox.com X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=proxmox.com X-Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 8EB0A423AD; Wed, 07 Oct 2026 08:51:22 +0200 (CEST) X-Cc: Andrew Lunn <andrew+netdev@lunn.ch>, "David S . Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Eric Dumazet <edumazet@kernel.org>, Simon Horman <horms@kernel.org>, Jakub Kicinski <kuba@kernel.org>, Michael Chan <michael.chan@broadcom.com>, netdev@vger.kernel.org, Paolo Abeni <pabeni@redhat.com>, Pavan Chebbi <pavan.chebbi@broadcom.com>, Stefan Fleischmann <sfle@kth.se>, stable@vger.kernel.org X-In-Reply-To: <asOzkZIrKusyF1d0@fliwatuet.svr02.mucip.net> X-Precedence: bulk X-Mailing-List: netdev@vger.kernel.org X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-User-Agent: astroid/0.17.0 (https://github.com/astroidmail/astroid) X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1791355880511