openwrt/package/kernel/lantiq/ltq-vectoring/patches/001-fix-compile.patch
Jan Hoffmann f872b96609 ltq-vectoring: add driver
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.

Tested-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Jan Hoffmann <jan@3e8.eu>
2022-03-21 12:28:26 +00:00

96 lines
2.8 KiB
Diff

--- 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 <linux/version.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/etherdevice.h>
+#include <linux/proc_fs.h>
/*
* 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 <linux/version.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/proc_fs.h>
+#include <linux/seq_file.h>
#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)
{