| Message ID | 20250122222654.21833-2-ryazanov.s.a@gmail.com |
|---|---|
| State | Accepted |
| Delegated to: | Hauke Mehrtens |
| Headers | show
Return-Path:
<openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org>
X-Original-To: incoming@patchwork.ozlabs.org
Delivered-To: patchwork-incoming@legolas.ozlabs.org
Authentication-Results: legolas.ozlabs.org;
dkim=pass (2048-bit key;
secure) header.d=lists.infradead.org header.i=@lists.infradead.org
header.a=rsa-sha256 header.s=bombadil.20210309 header.b=bpGWsyMV;
dkim=fail reason="signature verification failed" (2048-bit key;
unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256
header.s=20230601 header.b=kqEQW3HF;
dkim-atps=neutral
Authentication-Results: legolas.ozlabs.org;
spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org
(client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org;
envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org;
receiver=patchwork.ozlabs.org)
Received: from bombadil.infradead.org (bombadil.infradead.org
[IPv6:2607:7c80:54:3::133])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384)
(No client certificate requested)
by legolas.ozlabs.org (Postfix) with ESMTPS id 4Yddym4522z20Hh
for <incoming@patchwork.ozlabs.org>; Thu, 23 Jan 2025 09:28:47 +1100 (AEDT)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
d=lists.infradead.org; s=bombadil.20210309; h=Sender:
Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post:
List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:
Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:
Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:
List-Owner; bh=b0TJEjkPh8xmeU+6IP1GlUAMwl9+629qCzzXOjPBR+k=; b=bpGWsyMVi88Wtt
Rn/7ps5Nm4p/1EsSeRx3Kn//3ztWTN4HobFt1DFDiL0HgfRyIoA9DBa1XbWBDTecfLVrbCcJOBroO
KNnK0D9QyUBZrbB8Wr7PawbQLvMbJ5xf4Gl5dOlYa6dHjIYMvgTWJcnPFMTA9sO0CVWegi5qhHTv9
bHmG2jx/uImIB6G5FkIvI87DrLoCF0vRREkf1io0WvNmMppVWd03C23hUVkgoV7Km1ZNh5oxFzs/s
Ll33kklpHB/g1+2MXWQUyFlLmLaJACAq3icp/eNyUgqhe2UGYv1hCuHK9Gtz30BaRfxEfwiK7NNdb
h3S4BZ//fXqVYa7MhQng==;
Received: from localhost ([::1] helo=bombadil.infradead.org)
by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux))
id 1tajBr-0000000BJNa-3Q2g;
Wed, 22 Jan 2025 22:27:15 +0000
Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336])
by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux))
id 1tajBo-0000000BJKz-49uf
for openwrt-devel@lists.openwrt.org;
Wed, 22 Jan 2025 22:27:14 +0000
Received: by mail-wm1-x336.google.com with SMTP id
5b1f17b1804b1-436202dd7f6so3087955e9.0
for <openwrt-devel@lists.openwrt.org>;
Wed, 22 Jan 2025 14:27:12 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1737584832; x=1738189632;
darn=lists.openwrt.org;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:from:to:cc:subject:date
:message-id:reply-to;
bh=TOdDCpSPzdvzdJDN+qcivoFng7qPMaXiXpU61Tj6hfc=;
b=kqEQW3HFOKBHP+/Qrqcj0I5eveBMD6+vppX7Ijh4CFvCKJCh6ZVGxJTGeh9BqYgDLA
0n9FcJr5D3Um6ZTJa2tpu2JtYg6ywFBPPpKn3p1SWlcQwDyCYTqIe5xn+8eGESGnp+co
qJODL1GRYjKkrbus6axpGgY/0pWyWutrn3CVK054Ku+771vUjpuCv6vmyP08cp8as8en
fQXdBG33gCdLN1aN3qzSIs82iocrDZlfiSJbPZHtIhLRiW7bgmnMv2Yuh/EH7dys/En4
RYBguBtwZV8K+OCKC8l7fa2vX3BgXyS1b33aJdF2smztnWSyzkvITsPkCClqfktJ2DL3
FJaw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1737584832; x=1738189632;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=TOdDCpSPzdvzdJDN+qcivoFng7qPMaXiXpU61Tj6hfc=;
b=Ih2uFfnAmO8e6jeruIIoo9Wl6Ukdwj2Y3t/pwKiZkKmWj7JcIgskflQCZAiIwVx4ip
6gnPoCSGF10YQ+fq0ZFFM3KVOrdUKVa+V/KRPNdgJjvZRLdMS9YQ5JI94KDVKbEvv+t1
Ckl0PsdQYc7GjwoqRW2+V46Vt3d1K/Cynkf+TOIP1AnpywXdB99A8QliTNgrcHgIizsO
BJ/k7wx2UOFF1KwfWuzrwMMmvZwtD22l/cya1p4XcMXm3kprJj4nWGD1ad2XFIoiC5NK
GWLhlvb2qN3cfKiQagqbzMq0nxePKCbHfd73ShWkrLrvUnP5p7ySjCOA1cYnL10YK1Hf
UOOw==
X-Gm-Message-State: AOJu0YwEB0omt9fUf6+vnDXej+6YbMZrNyTm5XlkAtnQsfcJgoVt3GoX
8ZElGLKuNYpskvRGeWCPtIjV9JiOuyEpc61IsQjuMg+m9dIrB/DI
X-Gm-Gg: ASbGncukkJR5xAL+geuRsL3ieMztNHQkXIAjjACj/r9VaEj/fYONsvfSeJS+69QykyQ
CdZo9hw6/cCTvP53uN18A6ULw9woMQ29wh3sCPJ5sMWpLWTalhlV/81BjdOEQ/HRW2yVjI/tymd
bWax4DJUGYqc23UvmWfYjpeQALC8CtZJ6A/lJZGCssZI9h3K1Uq+0mCD6kpMK4ErJWeq026dsp9
iUBsULIAvDdReTT2QBlTvh5u1oSKHJaBuvTWy3g9ZbfHAlEy7FwFPuatrO9mtw6oHi+SKcNIP1p
m0JXMw==
X-Google-Smtp-Source:
AGHT+IGkhO8mP5VGE7UGjVdfuGGV7MN+39SamIUwM1siVHCE/Cs2D0KmbH8CV8uuEf5fMOCLW/nYuA==
X-Received: by 2002:a05:6000:144e:b0:38a:5ce8:df6d with SMTP id
ffacd0b85a97d-38bf56557b5mr19268388f8f.1.1737584831523;
Wed, 22 Jan 2025 14:27:11 -0800 (PST)
Received: from localhost.localdomain ([69.6.8.124])
by smtp.gmail.com with ESMTPSA id
ffacd0b85a97d-38bf328864esm17773125f8f.99.2025.01.22.14.27.09
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Wed, 22 Jan 2025 14:27:10 -0800 (PST)
From: Sergey Ryazanov <ryazanov.s.a@gmail.com>
To: Daniel Golle <daniel@makrotopia.org>
Cc: OpenWrt Development List <openwrt-devel@lists.openwrt.org>,
Andre Heider <a.heider@gmail.com>,
Hauke Mehrtens <hauke@hauke-m.de>,
Jan Hoffmann <jan@3e8.eu>,
Martin Schiller <ms.3headeddevs@gmail.com>
Subject: [PATCH v4 1/4] kernel: vrx518_tc: fix RX desc phys to virt mapping
Date: Thu, 23 Jan 2025 00:26:51 +0200
Message-ID: <20250122222654.21833-2-ryazanov.s.a@gmail.com>
X-Mailer: git-send-email 2.45.2
In-Reply-To: <20250122222654.21833-1-ryazanov.s.a@gmail.com>
References: <20250122222654.21833-1-ryazanov.s.a@gmail.com>
MIME-Version: 1.0
X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3
X-CRM114-CacheID: sfid-20250122_142713_030265_B3F9FBB3
X-CRM114-Status: GOOD ( 15.66 )
X-Spam-Score: -1.1 (-)
X-Spam-Report: Spam detection software,
running on the system "bombadil.infradead.org",
has NOT identified this incoming email as spam. The original
message has been attached to this so you can view it or label
similar future email. If you have any questions, see
the administrator of that system for details.
Content preview: It looks like VRX518 returns phys addr of data buffer in
the
'data_ptr' field of the RX descriptor and an actual data offset within the
buffer in the 'byte_off' field. In order to map the phys address [...]
Content analysis details: (-1.1 points, 5.0 required)
pts rule name description
---- ----------------------
--------------------------------------------------
-0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no
trust
[2a00:1450:4864:20:0:0:0:336 listed in]
[list.dnswl.org]
-0.0 SPF_PASS SPF: sender matches SPF record
0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record
-0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from
author's
domain
0.1 DKIM_SIGNED Message has a DKIM or DK signature,
not necessarily valid
-0.1 DKIM_VALID Message has at least one valid DKIM or DK
signature
-0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from
envelope-from domain
-1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1%
[score: 0.0000]
0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail
provider
[ryazanov.s.a(at)gmail.com]
1.0 FREEMAIL_REPLY From and body contain different freemails
X-BeenThere: openwrt-devel@lists.openwrt.org
X-Mailman-Version: 2.1.34
Precedence: list
List-Id: OpenWrt Development List <openwrt-devel.lists.openwrt.org>
List-Unsubscribe: <https://lists.openwrt.org/mailman/options/openwrt-devel>,
<mailto:openwrt-devel-request@lists.openwrt.org?subject=unsubscribe>
List-Archive: <http://lists.openwrt.org/pipermail/openwrt-devel/>
List-Post: <mailto:openwrt-devel@lists.openwrt.org>
List-Help: <mailto:openwrt-devel-request@lists.openwrt.org?subject=help>
List-Subscribe: <https://lists.openwrt.org/mailman/listinfo/openwrt-devel>,
<mailto:openwrt-devel-request@lists.openwrt.org?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: "openwrt-devel" <openwrt-devel-bounces@lists.openwrt.org>
Errors-To:
openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org
|
| Series |
ipq40xx: fritzbox 7530: fix ADSL/ATM support
|
expand
|
diff --git a/package/kernel/lantiq/vrx518_tc/patches/200-swplat.patch b/package/kernel/lantiq/vrx518_tc/patches/200-swplat.patch index edc97998b7..6596a8b913 100644 --- a/package/kernel/lantiq/vrx518_tc/patches/200-swplat.patch +++ b/package/kernel/lantiq/vrx518_tc/patches/200-swplat.patch @@ -855,12 +855,12 @@ This replaces it by a basic working implementation. - continue; + + // this seems to be a pointer to a DS PKT buffer -+ phyaddr = desc->data_ptr + desc->byte_off; ++ phyaddr = desc->data_ptr; + ptr = plat_mem_virt(phyaddr); -+ + len = desc->data_len; + -+ dma_sync_single_range_for_cpu(pdev, phyaddr, 0, len, DMA_FROM_DEVICE); ++ dma_sync_single_for_cpu(pdev, phyaddr, desc->byte_off + len, ++ DMA_FROM_DEVICE); + + skb = netdev_alloc_skb(g_plat_priv->netdev, len); + if (unlikely(!skb)) { @@ -871,7 +871,7 @@ This replaces it by a basic working implementation. - ring_idx_inc(rxout, idx); + + dst = skb_put(skb, len); -+ memcpy(dst, ptr, len); ++ memcpy(dst, ptr + desc->byte_off, len); + + priv->tc_ops.recv(g_plat_priv->netdev, skb); +
It looks like VRX518 returns phys addr of data buffer in the 'data_ptr' field of the RX descriptor and an actual data offset within the buffer in the 'byte_off' field. In order to map the phys address back to virtual we need the original phys address of the allocated buffer. In the same driver applies offset to phys address before the mapping, what leads to WARN_ON triggering in plat_mem_virt() function with subsequent kernel panic: WARNING: CPU: 0 PID: 0 at .../sw_plat.c:764 0xbf306cd0 [vrx518_tc@8af9f5d0+0x25000] ... Unable to handle kernel NULL pointer dereference at virtual address 00000000 pgd = aff5701e [00000000] *pgd=00000000 Internal error: Oops: 5 [#1] SMP ARM Noticed in ATM mode, when chip always returns byte_off = 4. In order to fix the issue, pass the phys address to plat_mem_virt() as is and apply byte_off later for proper DMA syncing and on mapped virtual address when copying RXed data into the skb. Run tested with FRITZ!Box 7530 on both ADSL and VDSL (thanks Jan) links. Fixes: 474bbe23b7 ("kernel: add Intel/Lantiq VRX518 TC driver") Tested-by: Jan Hoffmann <jan@3e8.eu> # VDSL link Reported-and-tested-by: nebibigon93@yandex.ru # ADSL link Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com> -- Changes: v3->4: DMA sync the whole data buffer which length is byte_off + data_len --- package/kernel/lantiq/vrx518_tc/patches/200-swplat.patch | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)