From patchwork Sun Mar 13 21:14:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hoffmann X-Patchwork-Id: 1604858 X-Patchwork-Delegate: daniel@makrotopia.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.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=j2x+OZEo; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=3e8.eu header.i=@3e8.eu header.a=rsa-sha256 header.s=mail20211217 header.b=XgITzkrD; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KGsvV35ymz9sGD for ; Mon, 14 Mar 2022 08:17:42 +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=UCXqxMDbgsov/r6ZnTmJDuW6JzRDLVlhGCibpSHvNOE=; b=j2x+OZEo8Bv3sP 6ExiLHowCHr9YeQtC4+492T+5l9PgAyOblFufBFKPE24EskeRBbUdeLepxEFQV7qpePzs0Syp96nh d6EB5xF4XEVz0/tQDBo7KbB/pWulgxBgKBXubheqfyHuROAdl0LzI7FEozjTGh/Ta5h15BAS0zlOD zKu6ZWw0bprUXRder5e/4+tGGaJ4fgdxj6QWXKl9tCTproZwmuN3k/fFvLOL/DVKZ3u+c0YgPs8oE nvCULUvM6EUwJK7r+rj3YQxbYE3qDgGxVBLGQ5QGU2tl0DQN0+3G3Eg85LcUdyWWpv1xgiOdnwVZt NUpL03AKcIC/z0RhAeWw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nTVZF-003NcA-RT; Sun, 13 Mar 2022 21:15:57 +0000 Received: from srv4.3e8.eu ([193.25.101.238]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nTVYL-003NTi-A8 for openwrt-devel@lists.openwrt.org; Sun, 13 Mar 2022 21:15:05 +0000 Received: from localhost.localdomain (p200300c6cf1a2ca042ec7477250c65aa.dip0.t-ipconnect.de [IPv6:2003:c6:cf1a:2ca0:42ec:7477:250c:65aa]) (using TLSv1.3 with cipher TLS_CHACHA20_POLY1305_SHA256 (256/256 bits)) (No client certificate requested) by srv4.3e8.eu (Postfix) with ESMTPSA id 7C6AE601E5; Sun, 13 Mar 2022 22:14:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=3e8.eu; s=mail20211217; t=1647206088; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wokXj18K5f/EdiT47iyjgggUdzKFFPGFdhfpfzylvlI=; b=XgITzkrDfHhvZQXXwa0CFsnH0tiBbZgQexSuhkpnvfiNNK2qim5w9elgcVAlwgsfjiPSeC TKgzckz81eGtaF35OPQ77kTlRi5QZ8hvSzCSx6uZvcpSEyJhnqzFD6VMAtiNmHUgs8hUm5 kG3mKmZgLK0fvFTwQQEO4cdiHJxuLmCxj5A2ykaT2eiQLF9UWISUlz6H9VUM50+pHp3wR4 9is5FVgmSBi7fYYAbWNrro+OFqY+ohhsd/RML6smIPLwfCCFHZOYC2F5iC2xTU1htcY7F4 hxisSr6aO6fJ1IVHlhzkpmnLtpAGVZ76L+7H8tj5YacVbDwH6qxeKOHiWzLEow== From: Jan Hoffmann To: openwrt-devel@lists.openwrt.org Cc: Jan Hoffmann Subject: [PATCH 1/4] ltq-vectoring: add driver Date: Sun, 13 Mar 2022 22:14:35 +0100 Message-Id: <20220313211438.1302111-2-jan@3e8.eu> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220313211438.1302111-1-jan@3e8.eu> References: <20220313211438.1302111-1-jan@3e8.eu> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220313_141501_703627_A0C1D599 X-CRM114-Status: GOOD ( 28.65 ) X-Spam-Score: -0.2 (/) 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: In order to calculate the required pre-distortion for downstream vectoring, the vectoring control entity (VCE) at the carrier office needs error samples from the modem. On Lantiq VR9 modems, error rep [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_NONE SPF: sender does not publish an SPF Record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org In order to calculate the required pre-distortion for downstream vectoring, the vectoring control entity (VCE) at the carrier office needs error samples from the modem. On Lantiq VR9 modems, error reports are generated by the firmware, but need to be multiplexed into the data stream by the driver on the main processor when L2 encapsulation is selected by the VCE. This driver provides the necessary callback function, which is called by the MEI driver after receiving an error report from the firmware. Originally, it is part of the Lantiq PPA driver, but after a few changes it also works with the PTM driver used in OpenWrt. The direct call to ndo_start_xmit needs to be replaced, as the PTM driver relies on locks from the kernel. Instead dev_queue_xmit is used, which is called from a work queue, as it is not safe to call from an interrupt handler. Additional changes include fixes to support recent kernel versions and a change of the used interface from ptm0 to dsl0. Signed-off-by: Jan Hoffmann --- package/kernel/lantiq/ltq-vectoring/Makefile | 61 +++++++++ .../patches/001-fix-compile.patch | 95 ++++++++++++++ .../ltq-vectoring/patches/100-cleanup.patch | 73 +++++++++++ .../ltq-vectoring/patches/200-compat.patch | 120 ++++++++++++++++++ 4 files changed, 349 insertions(+) create mode 100644 package/kernel/lantiq/ltq-vectoring/Makefile create mode 100644 package/kernel/lantiq/ltq-vectoring/patches/001-fix-compile.patch create mode 100644 package/kernel/lantiq/ltq-vectoring/patches/100-cleanup.patch create mode 100644 package/kernel/lantiq/ltq-vectoring/patches/200-compat.patch diff --git a/package/kernel/lantiq/ltq-vectoring/Makefile b/package/kernel/lantiq/ltq-vectoring/Makefile new file mode 100644 index 000000000000..b7b1b83a078a --- /dev/null +++ b/package/kernel/lantiq/ltq-vectoring/Makefile @@ -0,0 +1,61 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=ltq-vectoring +PKG_RELEASE:=$(AUTORELEASE) +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://gitlab.com/prpl-foundation/intel/ppa_drv.git +PKG_SOURCE_DATE:=2019-05-20 +PKG_SOURCE_VERSION:=4fa7ac30fcc8ec4eddae9debba5f4230981f469f +PKG_MIRROR_HASH:=444eb823dd9ddd25453976bf7a3230955e4148b8bf92f35f165ecffee32c4555 +PKG_LICENSE:=GPL-2.0 BSD-2-Clause + +MAKE_PATH:=src/vectoring +PKG_EXTMOD_SUBDIRS:=$(MAKE_PATH) + +include $(INCLUDE_DIR)/kernel.mk +include $(INCLUDE_DIR)/package.mk + +define KernelPackage/ltq-vectoring + SECTION:=sys + CATEGORY:=Kernel modules + SUBMENU:=Network Devices + TITLE:=driver for sending vectoring error samples + DEPENDS:=@TARGET_lantiq_xrx200 + FILES:=$(PKG_BUILD_DIR)/$(MAKE_PATH)/ltq_vectoring.ko + AUTOLOAD:=$(call AutoLoad,49,ltq_vectoring) +endef + +define Package/ltq-vectoring/description + This driver is responsible for sending error reports to the vectoring + control entity, which is required for downstream vectoring to work. + + The error reports are generated by the DSL firmware, and passed to this + driver by the MEI driver. +endef + +define KernelPackage/ltq-vectoring-test + SECTION:=sys + CATEGORY:=Kernel modules + SUBMENU:=Network Devices + TITLE:=driver for testing the vectoring driver + DEPENDS:=@TARGET_lantiq_xrx200 +kmod-ltq-vectoring + FILES:=$(PKG_BUILD_DIR)/$(MAKE_PATH)/ltq_vectoring_test.ko +endef + +define Package/ltq-vectoring-test/description + This allows to send dummy data to the vectoring error block callback. + This is only needed for test and development purposes. +endef + +define Build/Configure +endef + +define Build/Compile + +$(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" \ + $(KERNEL_MAKE_FLAGS) \ + M="$(PKG_BUILD_DIR)/$(MAKE_PATH)" \ + modules +endef + +$(eval $(call KernelPackage,ltq-vectoring)) +$(eval $(call KernelPackage,ltq-vectoring-test)) diff --git a/package/kernel/lantiq/ltq-vectoring/patches/001-fix-compile.patch b/package/kernel/lantiq/ltq-vectoring/patches/001-fix-compile.patch new file mode 100644 index 000000000000..c97ec4d94b3f --- /dev/null +++ b/package/kernel/lantiq/ltq-vectoring/patches/001-fix-compile.patch @@ -0,0 +1,95 @@ +--- a/src/vectoring/Makefile ++++ b/src/vectoring/Makefile +@@ -1,5 +1,5 @@ +-obj-$(CONFIG_PTM_VECTORING) += ifxmips_vectoring.o +-obj-y += ifxmips_vectoring_stub.o +-ifeq ($(CONFIG_DSL_MEI_CPE_DRV),) +-obj-$(CONFIG_PTM_VECTORING) += ifxmips_vectoring_test.o +-endif ++obj-m += ltq_vectoring.o ++ltq_vectoring-objs = ifxmips_vectoring.o ifxmips_vectoring_stub.o ++ ++obj-m += ltq_vectoring_test.o ++ltq_vectoring_test-objs = ifxmips_vectoring_test.o +--- a/src/vectoring/ifxmips_vectoring.c ++++ b/src/vectoring/ifxmips_vectoring.c +@@ -30,9 +30,11 @@ + /* + * Common Head File + */ ++#include + #include + #include + #include ++#include + + /* + * Chip Specific Head File +@@ -239,7 +241,7 @@ static int netdev_event_handler(struct n + && event != NETDEV_UNREGISTER ) + return NOTIFY_DONE; + +- netif = (struct net_device *)netdev; ++ netif = netdev_notifier_info_to_dev(netdev); + if ( strcmp(netif->name, "ptm0") != 0 ) + return NOTIFY_DONE; + +@@ -356,6 +358,7 @@ static int proc_write_dbg(struct file *f + return count; + } + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(5,6,0) + static struct file_operations g_proc_file_vectoring_dbg_seq_fops = { + .owner = THIS_MODULE, + .open = proc_read_dbg_seq_open, +@@ -364,6 +367,15 @@ static struct file_operations g_proc_fil + .llseek = seq_lseek, + .release = single_release, + }; ++#else ++static struct proc_ops g_proc_file_vectoring_dbg_seq_fops = { ++ .proc_open = proc_read_dbg_seq_open, ++ .proc_read = seq_read, ++ .proc_write = proc_write_dbg, ++ .proc_lseek = seq_lseek, ++ .proc_release = single_release, ++}; ++#endif + + static int proc_read_dbg_seq_open(struct inode *inode, struct file *file) + { +--- a/src/vectoring/ifxmips_vectoring_test.c ++++ b/src/vectoring/ifxmips_vectoring_test.c +@@ -1,6 +1,8 @@ ++#include + #include + #include + #include ++#include + + #include "ifxmips_vectoring_stub.h" + +@@ -82,6 +84,7 @@ static int proc_write_vectoring(struct f + return count; + } + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(5,6,0) + static struct file_operations g_proc_file_vectoring_seq_fops = { + .owner = THIS_MODULE, + .open = proc_read_vectoring_seq_open, +@@ -90,6 +93,15 @@ static struct file_operations g_proc_fil + .llseek = seq_lseek, + .release = single_release, + }; ++#else ++static struct proc_ops g_proc_file_vectoring_seq_fops = { ++ .proc_open = proc_read_vectoring_seq_open, ++ .proc_read = seq_read, ++ .proc_write = proc_write_vectoring, ++ .proc_lseek = seq_lseek, ++ .proc_release = single_release, ++}; ++#endif + + static int proc_read_vectoring_seq_open(struct inode *inode, struct file *file) + { diff --git a/package/kernel/lantiq/ltq-vectoring/patches/100-cleanup.patch b/package/kernel/lantiq/ltq-vectoring/patches/100-cleanup.patch new file mode 100644 index 000000000000..2b0067379dfd --- /dev/null +++ b/package/kernel/lantiq/ltq-vectoring/patches/100-cleanup.patch @@ -0,0 +1,73 @@ +--- a/src/vectoring/ifxmips_vectoring.c ++++ b/src/vectoring/ifxmips_vectoring.c +@@ -325,7 +325,7 @@ static int proc_write_dbg(struct file *f + else + printk(dbg_enable_mask_str[i] + 1); + } +- printk("] > /proc/vectoring\n"); ++ printk("] > /proc/driver/vectoring\n"); + } + + if ( f_enable ) +@@ -433,11 +433,10 @@ static int __init vectoring_init(void) + { + struct proc_dir_entry *res; + +- res = proc_create("vectoring", ++ res = proc_create("driver/vectoring", + S_IRUGO|S_IWUSR, + 0, + &g_proc_file_vectoring_dbg_seq_fops); +- printk("res = %p\n", res); + + register_netdev_event_handler(); + g_ptm_net_dev = dev_get_by_name(&init_net, "ptm0"); +@@ -460,7 +459,7 @@ static void __exit vectoring_exit(void) + + unregister_netdev_event_handler(); + +- remove_proc_entry("vectoring", NULL); ++ remove_proc_entry("driver/vectoring", NULL); + } + + module_init(vectoring_init); +--- a/src/vectoring/ifxmips_vectoring_test.c ++++ b/src/vectoring/ifxmips_vectoring_test.c +@@ -79,7 +79,7 @@ static int proc_write_vectoring(struct f + } + } + else +- printk("echo send > /proc/eth/vectoring\n"); ++ printk("echo send > /proc/driver/vectoring_test\n"); + + return count; + } +@@ -112,9 +112,7 @@ static __init void proc_file_create(void + { + struct proc_dir_entry *res; + +-// g_proc_dir = proc_mkdir("eth", NULL); +- +- res = proc_create("eth/vectoring", ++ res = proc_create("driver/vectoring_test", + S_IRUGO|S_IWUSR, + g_proc_dir, + &g_proc_file_vectoring_seq_fops); +@@ -122,10 +120,7 @@ static __init void proc_file_create(void + + static __exit void proc_file_delete(void) + { +- remove_proc_entry("vectoring", +- g_proc_dir); +- +- remove_proc_entry("eth", NULL); ++ remove_proc_entry("driver/vectoring_test", NULL); + } + + +@@ -151,3 +146,5 @@ static void __exit vectoring_test_exit(v + + module_init(vectoring_test_init); + module_exit(vectoring_test_exit); ++ ++MODULE_LICENSE("GPL"); diff --git a/package/kernel/lantiq/ltq-vectoring/patches/200-compat.patch b/package/kernel/lantiq/ltq-vectoring/patches/200-compat.patch new file mode 100644 index 000000000000..04c6880ddea6 --- /dev/null +++ b/package/kernel/lantiq/ltq-vectoring/patches/200-compat.patch @@ -0,0 +1,120 @@ +--- a/src/vectoring/ifxmips_vectoring.c ++++ b/src/vectoring/ifxmips_vectoring.c +@@ -35,6 +35,8 @@ + #include + #include + #include ++#include ++#include + + /* + * Chip Specific Head File +@@ -88,6 +90,7 @@ static void dump_skb(struct sk_buff *skb + + static void ltq_vectoring_priority(uint32_t priority); + ++static void xmit_work_handler(struct work_struct *); + + /* + * #################################### +@@ -118,9 +121,11 @@ struct erb_head { + + static struct notifier_block g_netdev_event_handler_nb = {0}; + static struct net_device *g_ptm_net_dev = NULL; +-static uint32_t vector_prio = 0; ++static uint32_t vector_prio = TC_PRIO_CONTROL; + static int g_dbg_enable = 0; + ++DECLARE_WORK(xmit_work, xmit_work_handler); ++struct sk_buff_head xmit_queue; + + + /* +@@ -129,9 +134,16 @@ static int g_dbg_enable = 0; + * #################################### + */ + ++static void xmit_work_handler(__attribute__((unused)) struct work_struct *work) { ++ struct sk_buff *skb; ++ ++ while ((skb = skb_dequeue(&xmit_queue)) != NULL) { ++ dev_queue_xmit(skb); ++ } ++} ++ + static int mei_dsm_cb_func(unsigned int *p_error_vector) + { +- int rc, ret; + struct sk_buff *skb_list = NULL; + struct sk_buff *skb; + struct erb_head *erb; +@@ -179,7 +191,6 @@ static int mei_dsm_cb_func(unsigned int + } + } + +- rc = 0; + sent_size = 0; + segment_code = 0; + while ( (skb = skb_list) != NULL ) { +@@ -197,24 +208,23 @@ static int mei_dsm_cb_func(unsigned int + segment_code |= 0xC0; + ((struct erb_head *)skb->data)->segment_code = segment_code; + +- skb->cb[13] = 0x5A; /* magic number indicating forcing QId */ +- skb->cb[15] = 0x00; /* highest priority queue */ +- skb->priority = vector_prio; ++ skb_reset_mac_header(skb); ++ skb_set_network_header(skb, offsetof(struct erb_head, llc_header)); ++ skb->protocol = htons(ETH_P_802_2); ++ skb->priority = vector_prio; + skb->dev = g_ptm_net_dev; + + dump_skb(skb, ~0, "vectoring TX", 0, 0, 1, 0); + +- ret = g_ptm_net_dev->netdev_ops->ndo_start_xmit(skb, g_ptm_net_dev); +- if ( rc == 0 ) +- rc = ret; ++ skb_queue_tail(&xmit_queue, skb); ++ schedule_work(&xmit_work); + + segment_code++; + } + + *p_error_vector = 0; /* notify DSL firmware that ERB is sent */ + +- ASSERT(rc == 0, "dev_queue_xmit fail - %d", rc); +- return rc; ++ return 0; + } + static void ltq_vectoring_priority(uint32_t priority) + { +@@ -242,7 +252,7 @@ static int netdev_event_handler(struct n + return NOTIFY_DONE; + + netif = netdev_notifier_info_to_dev(netdev); +- if ( strcmp(netif->name, "ptm0") != 0 ) ++ if ( strcmp(netif->name, "dsl0") != 0 ) + return NOTIFY_DONE; + + g_ptm_net_dev = event == NETDEV_REGISTER ? netif : NULL; +@@ -438,8 +448,10 @@ static int __init vectoring_init(void) + 0, + &g_proc_file_vectoring_dbg_seq_fops); + ++ skb_queue_head_init(&xmit_queue); ++ + register_netdev_event_handler(); +- g_ptm_net_dev = dev_get_by_name(&init_net, "ptm0"); ++ g_ptm_net_dev = dev_get_by_name(&init_net, "dsl0"); + if ( g_ptm_net_dev != NULL ) + dev_put(g_ptm_net_dev); + +@@ -459,6 +471,8 @@ static void __exit vectoring_exit(void) + + unregister_netdev_event_handler(); + ++ flush_scheduled_work(); ++ + remove_proc_entry("driver/vectoring", NULL); + } + From patchwork Sun Mar 13 21:14:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hoffmann X-Patchwork-Id: 1604855 X-Patchwork-Delegate: daniel@makrotopia.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.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=nWkPXgbI; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=3e8.eu header.i=@3e8.eu header.a=rsa-sha256 header.s=mail20211217 header.b=YitD9npF; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KGsvN2PSpz9sGJ for ; Mon, 14 Mar 2022 08:17:36 +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=gW5UFah48g76vtJeeVbIEoSq7oerLETe1K91XRTx6EI=; b=nWkPXgbIjhNVuX Mrwkavn2zpQyvkpn6kBquBru3oLb+5OLtC5gwr0b0a0FYMaawAWKEGAfMP7yhtGrFNecJOZHl1MMh e6yFRDhn2rU2312/K3rt/zxLXMx16AoxajwYqHdnSfIaq7XY3S8TsRyYmaNQ9RCQfjde+Kj95nvUB IHLJRNShOcInreHv0N1S7XmEOf//y3qXchjlpYYIHEfMzgdB0DYUwYeIkseFSUuTlZo/FryqOlaB2 VpbjOu15TjCAZzYuPYg3MS7wAhUsR426817cqn7L0j++6v3xv6g7x5xFxxFNKluncBzRlAeziAX42 Kni42XA1Ogp4oRK/XWvA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nTVYQ-003NVV-CK; Sun, 13 Mar 2022 21:15:06 +0000 Received: from srv4.3e8.eu ([193.25.101.238]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nTVYL-003NTk-4u for openwrt-devel@lists.openwrt.org; Sun, 13 Mar 2022 21:15:03 +0000 Received: from localhost.localdomain (p200300c6cf1a2ca042ec7477250c65aa.dip0.t-ipconnect.de [IPv6:2003:c6:cf1a:2ca0:42ec:7477:250c:65aa]) (using TLSv1.3 with cipher TLS_CHACHA20_POLY1305_SHA256 (256/256 bits)) (No client certificate requested) by srv4.3e8.eu (Postfix) with ESMTPSA id E84F5601E7; Sun, 13 Mar 2022 22:14:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=3e8.eu; s=mail20211217; t=1647206089; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wUqUD+JchGjcdtyICyDDbC9gtYfmJEbGv23LgGDBePo=; b=YitD9npFLoGEw+lnRlJnfjPhscuE6xNUy1W+TrhI6QIxV1S4bMweMAAI1sa/YRJzNW5RwC CtLI0SNAYoYu1eTyuvQzHSd1xEF/d+OgQfjaAAVA3iMWnN3w9aXG082SCi208QNHuaVp9F +Uk86s44aeBeShdJZOz43Ial8LblyycxbgH94SmfjpUR1bwt44rFRLqU11GDz0y8RlrgfC mMb4zNZWRnkSquw4kvQcp2DOyacY3SOWdOArDpKMGPo1kMw+5r1QiySzJ6bq5P53rfTU0S Ps9L97r8TfpH3WvDQY4SIGk9+ReaHIcMUcGTcM9OML0AAg4qBb4PQjQ0zXYOTQ== From: Jan Hoffmann To: openwrt-devel@lists.openwrt.org Cc: Jan Hoffmann Subject: [PATCH 2/4] ltq-vdsl-mei: enable vectoring error sample callback Date: Sun, 13 Mar 2022 22:14:36 +0100 Message-Id: <20220313211438.1302111-3-jan@3e8.eu> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220313211438.1302111-1-jan@3e8.eu> References: <20220313211438.1302111-1-jan@3e8.eu> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220313_141501_510669_3BE1396D X-CRM114-Status: UNSURE ( 9.42 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) 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: This re-enables the vectoring error sample callback and adds a dependency to the corresponding driver. Signed-off-by: Jan Hoffmann --- package/kernel/lantiq/ltq-vdsl-mei/Makefile | 4 ++-- .../lantiq/ltq-vdsl-mei/patches/100-compat.patch | 11 2 files changed, 2 insertions(+), 13 [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_NONE SPF: sender does not publish an SPF Record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org This re-enables the vectoring error sample callback and adds a dependency to the corresponding driver. Signed-off-by: Jan Hoffmann --- package/kernel/lantiq/ltq-vdsl-mei/Makefile | 4 ++-- .../lantiq/ltq-vdsl-mei/patches/100-compat.patch | 11 ----------- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/package/kernel/lantiq/ltq-vdsl-mei/Makefile b/package/kernel/lantiq/ltq-vdsl-mei/Makefile index 796918549a0e..d4a5ea720b67 100644 --- a/package/kernel/lantiq/ltq-vdsl-mei/Makefile +++ b/package/kernel/lantiq/ltq-vdsl-mei/Makefile @@ -9,7 +9,7 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=ltq-vdsl-vr9-mei PKG_VERSION:=1.5.17.6 -PKG_RELEASE:=4 +PKG_RELEASE:=5 PKG_BASE_NAME:=drv_mei_cpe PKG_SOURCE:=$(PKG_BASE_NAME)-$(PKG_VERSION).tar.gz @@ -29,7 +29,7 @@ define KernelPackage/ltq-vdsl-vr9-mei TITLE:=mei driver for vdsl SECTION:=sys SUBMENU:=Network Devices - DEPENDS:=@TARGET_lantiq_xrx200 +kmod-ltq-ifxos + DEPENDS:=@TARGET_lantiq_xrx200 +kmod-ltq-ifxos +kmod-ltq-vectoring FILES:=$(PKG_BUILD_DIR)/src/drv_mei_cpe.ko AUTOLOAD:=$(call AutoLoad,50,drv_mei_cpe) endef diff --git a/package/kernel/lantiq/ltq-vdsl-mei/patches/100-compat.patch b/package/kernel/lantiq/ltq-vdsl-mei/patches/100-compat.patch index 75e1500171a7..61ea826cb47c 100644 --- a/package/kernel/lantiq/ltq-vdsl-mei/patches/100-compat.patch +++ b/package/kernel/lantiq/ltq-vdsl-mei/patches/100-compat.patch @@ -376,17 +376,6 @@ } IFX_int32_t MEI_PLL_ConfigInit(MEI_DEV_T *pMeiDev) ---- a/src/drv_mei_cpe_dsm.c -+++ b/src/drv_mei_cpe_dsm.c -@@ -144,7 +144,7 @@ IFX_void_t MEI_VRX_DSM_DataInit(MEI_DEV_ - memset((IFX_uint8_t *)&pMeiDev->firmwareFeatures, 0x00, sizeof(IOCTL_MEI_firmwareFeatures_t)); - pMeiDev->meiFwDlCount = 0; - -- pMeiDev->meiERBbuf.pCallBackFunc = mei_dsm_cb_func_hook; -+ pMeiDev->meiERBbuf.pCallBackFunc = NULL; - - PRN_DBG_USR_NL( MEI_DRV, MEI_DRV_PRN_LEVEL_NORMAL, - ("MEI_DRV: PP callback function addr = 0x%08X" MEI_DRV_CRLF, --- a/src/drv_mei_cpe_download_vrx.c +++ b/src/drv_mei_cpe_download_vrx.c @@ -3281,12 +3281,14 @@ IFX_int32_t MEI_DEV_IoctlFirmwareDownloa From patchwork Sun Mar 13 21:14:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hoffmann X-Patchwork-Id: 1604854 X-Patchwork-Delegate: daniel@makrotopia.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.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=b7qg9MzL; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=3e8.eu header.i=@3e8.eu header.a=rsa-sha256 header.s=mail20211217 header.b=kZxtSnfD; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KGsvM2z3dz9sGD for ; Mon, 14 Mar 2022 08:17:35 +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=7nDviE8G8mMEAozSfGAqDD8PiEfdSihHdW8sBiEO/L0=; b=b7qg9MzLcpWFey BJCd/1bnSwhd3iRPkCSBIBWDXN0BYyItaGYjVoGP4vovxqGC+TF64ZviaL+2l9JErMCHTudJSNkGU jjxGR0cHRhtoWE2ndUolO/8vzJ/2bFSc5JMRMwnlvjlE+xA/UX+TAdVDaw1IevqZ3OmFFbR3aiN32 juAkWo+1ZNsZgAwmILqp/SSbWET1O4Ovs+vPCSVrVadwqjtM86ypm236g/6mrO9NLRj/+9QW48YeA R4gKSlA0B7YLNLK2Y7bYCHhkujb7qSPGQ9M4reLCoTlD3TnHD5P6lvlhepJACM0ZafATDx1gsjB/z yNakq53X4k2Y70rn0+dQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nTVYp-003NXY-8u; Sun, 13 Mar 2022 21:15:31 +0000 Received: from srv4.3e8.eu ([2001:67c:12a0:200::2]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nTVYL-003NTl-OV for openwrt-devel@lists.openwrt.org; Sun, 13 Mar 2022 21:15:04 +0000 Received: from localhost.localdomain (p200300c6cf1a2ca042ec7477250c65aa.dip0.t-ipconnect.de [IPv6:2003:c6:cf1a:2ca0:42ec:7477:250c:65aa]) (using TLSv1.3 with cipher TLS_CHACHA20_POLY1305_SHA256 (256/256 bits)) (No client certificate requested) by srv4.3e8.eu (Postfix) with ESMTPSA id 21839601E8; Sun, 13 Mar 2022 22:14:49 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=3e8.eu; s=mail20211217; t=1647206089; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mxa2dF3T/jbMY4zjo64IstKslNA5tRAyzFbrTsllHIk=; b=kZxtSnfDEqpoaXIJLLUt/AfYwRWOrrjooc0Ml8GXfNGU/dV14Yaf5iuHBzmdcuO9P0thN1 P3InN07TfnjWmCH2ouJQPr/XO7yRwIp72so47ybmUW5sNyIJn30slvF2vNhVycGrYiweuD T0pZrgeB6mF9D2H5dGEY/RKyF74+itI7yyzSK8ZrDms3ShC4obfcFtf3/YcdBb53tzUn+f e5JMFDNuHdyUUXgnlLZMJtDp7t0eqPGAW9ZKwZlGMKw7H/P8GAk6l9bV9samEwt+2faKUQ 2/X+1zv0oxM93Zd/0+U4r0d1xe86BYrGSwq52STr2h9rFAEPLhlitWejacE4cQ== From: Jan Hoffmann To: openwrt-devel@lists.openwrt.org Cc: Jan Hoffmann Subject: [PATCH 3/4] ltq-vdsl-app: set MAC address for vectoring error reports Date: Sun, 13 Mar 2022 22:14:37 +0100 Message-Id: <20220313211438.1302111-4-jan@3e8.eu> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220313211438.1302111-1-jan@3e8.eu> References: <20220313211438.1302111-1-jan@3e8.eu> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220313_141501_994845_AD2E6452 X-CRM114-Status: GOOD ( 11.89 ) X-Spam-Score: -0.2 (/) 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: This tells the modem about the WAN MAC address, which is used as source address for vectoring error reports that are generated by the firmware. It needs to be set early, as the MEI driver only actually writes the value to the modem when is in reset state (i.e. the firmware has been loaded, but connection has not started yet). Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_NONE SPF: sender does not publish an SPF Record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org This tells the modem about the WAN MAC address, which is used as source address for vectoring error reports that are generated by the firmware. It needs to be set early, as the MEI driver only actually writes the value to the modem when is in reset state (i.e. the firmware has been loaded, but connection has not started yet). Signed-off-by: Jan Hoffmann --- .../config/ltq-vdsl-app/files/dsl_control | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/package/network/config/ltq-vdsl-app/files/dsl_control b/package/network/config/ltq-vdsl-app/files/dsl_control index 54b739e2cd9d..34642dbda5aa 100644 --- a/package/network/config/ltq-vdsl-app/files/dsl_control +++ b/package/network/config/ltq-vdsl-app/files/dsl_control @@ -95,10 +95,11 @@ tone_vdsl_b="0x1" # B43 tone_adsl_bv="0x81" # B43 + B43c tone_vdsl_bv="0x5" # B43 + V43 -# create ADSL autoboot script. Used for SNR margin tweak +# create DSL autoboot script. Used for SNR margin tweak and to set MAC address for vectoring error reports autoboot_script() { echo "[WaitForConfiguration]={ locs 0 $1 +dsmmcs $2 } [WaitForLinkActivate]={ @@ -166,6 +167,12 @@ lowlevel_cfg() { 0" > /tmp/lowlevel.cfg } +get_macaddr() { + local name + config_get name $1 name + [ "$name" = "dsl0" ] && config_get $2 $1 macaddr +} + service_triggers() { procd_add_reload_trigger network } @@ -183,6 +190,7 @@ start_service() { local mode local lowlevel local snr + local macaddr config_load network config_get tone dsl tone @@ -191,6 +199,7 @@ start_service() { config_get xfer_mode dsl xfer_mode config_get line_mode dsl line_mode config_get snr dsl ds_snr_offset + config_foreach get_macaddr device macaddr eval "xtse=\"\${xtse_xdsl_$annex}\"" @@ -289,11 +298,10 @@ start_service() { lowlevel="-l /tmp/lowlevel.cfg" } - [ -z "${snr}" ] || { - # for SNR offset setting - autoboot_script "$snr" - autoboot="-a /tmp/dsl.scr -A /tmp/dsl.scr" - } + [ -z "${snr}" ] && snr=0 + [ -z "${macaddr}" ] && macaddr="00:00:00:00:00:00" + autoboot_script "$snr" "$macaddr" + autoboot="-a /tmp/dsl.scr -A /tmp/dsl.scr" procd_open_instance procd_set_param command /sbin/vdsl_cpe_control \ From patchwork Sun Mar 13 21:14:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hoffmann X-Patchwork-Id: 1604857 X-Patchwork-Delegate: daniel@makrotopia.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.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=anRjJ21w; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=3e8.eu header.i=@3e8.eu header.a=rsa-sha256 header.s=mail20211217 header.b=k6ClUfLb; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KGsvS2YSJz9sGJ for ; Mon, 14 Mar 2022 08:17:40 +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=CiDB/OjmxyBes7kdtYivXwITsl6ZRV3x3I+DuNseK3s=; b=anRjJ21wRg0h0x hfRlJiSkbltJ9tbiesfR0/KkpHmgXfH2sZ9nyFyBBHgNrUJEXvVn75LYMsZNxbG9wQyip8aRf/kyB gQBhUkX/+nxDCJDKLGt3U2ll/DHvp9TQJ869u6U96Sqtwh+if3cOGU+jRjyE5QQvqW5YCSXSaoSKX ZpIfS7gZBfNYg7SFjuaeMB8adju21sibjb219C+x2YI3hUi0cSVPYeSv3NtF372H9pgfeke0vxnZ3 n61ot9o26GYCQO5KGbyetu+8WV2qSKOcsNW5AQUG5xnlLxDnmEgSzqJRznkFN10O3Hz6vpw9mtLdg PXOCg30O5EBTTnuAIGuQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nTVYc-003NWM-Dw; Sun, 13 Mar 2022 21:15:18 +0000 Received: from srv4.3e8.eu ([2001:67c:12a0:200::2]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nTVYL-003NTm-5y for openwrt-devel@lists.openwrt.org; Sun, 13 Mar 2022 21:15:03 +0000 Received: from localhost.localdomain (p200300c6cf1a2ca042ec7477250c65aa.dip0.t-ipconnect.de [IPv6:2003:c6:cf1a:2ca0:42ec:7477:250c:65aa]) (using TLSv1.3 with cipher TLS_CHACHA20_POLY1305_SHA256 (256/256 bits)) (No client certificate requested) by srv4.3e8.eu (Postfix) with ESMTPSA id 4F852601EA; Sun, 13 Mar 2022 22:14:49 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=3e8.eu; s=mail20211217; t=1647206089; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=efQgbY4uYYeOnkIGS3XIEgk7LgkJPjdr5jeNoP8yha0=; b=k6ClUfLbJoQHlJVEp0+HSiD9ZTQVC4SDeBoanDhoMmx3QOY2NU83s/lPC4znu9gLEFoy2W nZ2YycU+cjIiHA7Igaxp4apDCvyp5P+ia+epjm9Xr10PXDeLbzLRJCuhpdLd6CltVQmwHn ZjDtqQ15B5uxClgehGFuiCLnGpU2g/SCNHvcz9Ujgav7eZ2LQTcl4NZM1BI+8pA/uv19Yj moo/X+fQ++8U2yok33NWsTnkH2PbV21jJc/+IbFK+k5UShz3p0H0Sx+fHa0YA1/6Z0uHdz a9izmDcYKI+O1ZCe463gGMnelbAkppTSK1qIt4nNcpzWLDNJCLRsUtaCaSun1A== From: Jan Hoffmann To: openwrt-devel@lists.openwrt.org Cc: Jan Hoffmann Subject: [PATCH 4/4] ltq-vdsl-mei: add locking to interrupt handler Date: Sun, 13 Mar 2022 22:14:38 +0100 Message-Id: <20220313211438.1302111-5-jan@3e8.eu> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220313211438.1302111-1-jan@3e8.eu> References: <20220313211438.1302111-1-jan@3e8.eu> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220313_141501_536690_A2026BDA X-CRM114-Status: GOOD ( 20.01 ) X-Spam-Score: -0.2 (/) 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: Some users noticed repeated resyncs at random intervals, which go away when the MEI driver is configured to use polling instead of interrupts. Debugging shows that this seems to be caused by concurren [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_NONE SPF: sender does not publish an SPF Record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Some users noticed repeated resyncs at random intervals, which go away when the MEI driver is configured to use polling instead of interrupts. Debugging shows that this seems to be caused by concurrent calls to MEI_ReadMailbox (in the interrupt handler) and MEI_WriteMailbox. This appears to be mostly triggered when there is an interrupt for vectoring error reports. In polling mode, calls to MEI_ReadMailbox are protected by the same semaphore as is used in MEI_WriteMailbox. When interrupts are used, MEI_WriteMailbox appears to rely on MEI_DisableDeviceInt and MEI_EnableDeviceInt to provide mutual exclusion with the interrupt handler. These functions mask/unmask interrupts, and there is an additional check of the mask in the interrupt handler itself. However, this is not sufficient on systems with SMP, as the interrupt handler may be running in parallel, and could already be past the interrupt mask check at this point. This adds a lock to the interrupt handler, and also acquires this lock in MEI_DisableDeviceInt. This should make sure that after a call to MEI_DisableDeviceInt the interrupt is masked, and the interrupt handler is either not running, has alread finished its work, or is still before the interrupt mask check, and is thus going to detect the change. Signed-off-by: Jan Hoffmann --- package/kernel/lantiq/ltq-vdsl-mei/Makefile | 2 +- .../patches/200-interrupt-lock.patch | 45 +++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 package/kernel/lantiq/ltq-vdsl-mei/patches/200-interrupt-lock.patch diff --git a/package/kernel/lantiq/ltq-vdsl-mei/Makefile b/package/kernel/lantiq/ltq-vdsl-mei/Makefile index d4a5ea720b67..b7060eb2b48b 100644 --- a/package/kernel/lantiq/ltq-vdsl-mei/Makefile +++ b/package/kernel/lantiq/ltq-vdsl-mei/Makefile @@ -9,7 +9,7 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=ltq-vdsl-vr9-mei PKG_VERSION:=1.5.17.6 -PKG_RELEASE:=5 +PKG_RELEASE:=6 PKG_BASE_NAME:=drv_mei_cpe PKG_SOURCE:=$(PKG_BASE_NAME)-$(PKG_VERSION).tar.gz diff --git a/package/kernel/lantiq/ltq-vdsl-mei/patches/200-interrupt-lock.patch b/package/kernel/lantiq/ltq-vdsl-mei/patches/200-interrupt-lock.patch new file mode 100644 index 000000000000..a677ccec554e --- /dev/null +++ b/package/kernel/lantiq/ltq-vdsl-mei/patches/200-interrupt-lock.patch @@ -0,0 +1,45 @@ +--- a/src/drv_mei_cpe_common.c ++++ b/src/drv_mei_cpe_common.c +@@ -104,6 +104,8 @@ IFX_uint32_t MEI_FsmStateSetMsgPreAction + MEI_DEVCFG_DATA_T MEI_DevCfgData; + #endif + ++static DEFINE_SPINLOCK(MEI_InterruptLock); ++ + /* ============================================================================ + Proc-FS and debug variable definitions + ========================================================================= */ +@@ -2134,6 +2136,9 @@ IFX_int32_t MEI_ProcessIntPerIrq(MEIX_CN + #if (MEI_SUPPORT_DEBUG_STREAMS == 1) + IFX_int_t extraDbgStreamLoop = 0; + #endif ++ unsigned long flags; ++ ++ spin_lock_irqsave(&MEI_InterruptLock, flags); + + /* get the actual chip device from the list and step through the VRX devices */ + while(pNextXCntrl) +@@ -2167,6 +2172,8 @@ IFX_int32_t MEI_ProcessIntPerIrq(MEIX_CN + } + #endif + ++ spin_unlock_irqrestore(&MEI_InterruptLock, flags); ++ + return meiIntCnt; + } + +@@ -2639,9 +2646,14 @@ IFX_int32_t MEI_MsgSendPreAction( + */ + IFX_void_t MEI_DisableDeviceInt(MEI_DEV_T *pMeiDev) + { ++ unsigned long flags; ++ spin_lock_irqsave(&MEI_InterruptLock, flags); ++ + MEI_MaskInterrupts( &pMeiDev->meiDrvCntrl, + ME_ARC2ME_INTERRUPT_MASK_ALL); + ++ spin_unlock_irqrestore(&MEI_InterruptLock, flags); ++ + return; + } +