wwan: quectel_QMI_WWAN: Merge patches for kernel 6.6 and 6.12

Signed-off-by: Sean Khan <datapronix@protonmail.com>
This commit is contained in:
Sean Khan 2025-06-02 23:46:03 -04:00
parent e361cee5ed
commit 0c22a801c2
4 changed files with 16 additions and 182 deletions

View File

@ -1,72 +0,0 @@
--- a/qmi_wwan_q.c
+++ b/qmi_wwan_q.c
@@ -46,7 +46,7 @@
#define ARPHRD_RAWIP ARPHRD_NONE
#endif
-#ifdef CONFIG_PINCTRL_IPQ807x
+#ifdef CONFIG_PINCTRL_IPQ8074
#define CONFIG_QCA_NSS_DRV
//#define CONFIG_QCA_NSS_PACKET_FILTER
#endif
@@ -847,12 +847,20 @@ static struct rtnl_link_stats64 *_rmnet_
stats64 = per_cpu_ptr(dev->stats64, cpu);
do {
+#if (LINUX_VERSION_CODE < KERNEL_VERSION( 6,6,0 ))
start = u64_stats_fetch_begin_irq(&stats64->syncp);
+#else
+ start = u64_stats_fetch_begin(&stats64->syncp);
+#endif
rx_packets = stats64->rx_packets;
rx_bytes = stats64->rx_bytes;
tx_packets = stats64->tx_packets;
tx_bytes = stats64->tx_bytes;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION( 6,6,0 ))
} while (u64_stats_fetch_retry_irq(&stats64->syncp, start));
+#else
+ } while (u64_stats_fetch_retry(&stats64->syncp, start));
+#endif
stats->rx_packets += u64_stats_read(&rx_packets);
stats->rx_bytes += u64_stats_read(&rx_bytes);
@@ -2644,7 +2652,6 @@ static void qmap_qmi_wwan_disconnect(str
static struct usb_driver qmi_wwan_driver = {
.name = "qmi_wwan_q",
.id_table = products,
- .probe = qmi_wwan_probe,
#if defined(QUECTEL_WWAN_QMAP)
.probe = qmap_qmi_wwan_probe,
.disconnect = qmap_qmi_wwan_disconnect,
--- a/rmnet_nss.c
+++ b/rmnet_nss.c
@@ -31,8 +31,8 @@ struct rmnet_nss_cb {
int (*nss_tx)(struct sk_buff *skb);
};
-extern struct rmnet_nss_cb *rmnet_nss_callbacks;
-
+struct rmnet_nss_cb *rmnet_nss_callbacks;
+EXPORT_SYMBOL(rmnet_nss_callbacks);
#endif
#define RMNET_NSS_HASH_BITS 8
@@ -356,7 +356,8 @@ int rmnet_nss_tx(struct sk_buff *skb)
}
eth = (struct ethhdr *)skb_push(skb, sizeof(*eth));
- memset(&eth->h_dest, 0, ETH_ALEN * 2);
+ memset(eth->h_dest, 0, ETH_ALEN); // Clear h_dest
+ memset(eth->h_source, 0, ETH_ALEN); // Clear h_source
if (version == 4) {
eth->h_proto = htons(ETH_P_IP);
} else if (version == 6) {
@@ -463,7 +464,7 @@ int rmnet_nss_free_vnd(struct net_device
return 0;
}
-static const struct rmnet_nss_cb rmnet_nss = {
+static struct rmnet_nss_cb rmnet_nss = {
.nss_create = rmnet_nss_create_vnd,
.nss_free = rmnet_nss_free_vnd,
.nss_tx = rmnet_nss_tx,

View File

@ -1,98 +0,0 @@
--- a/rmnet_nss.c
+++ b/rmnet_nss.c
@@ -259,7 +259,9 @@ static int rmnet_nss_adjust_header(struc
/* subtract to account for skb_push */
skb->len -= bytes;
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 12, 0))
+ frag->offset += bytes;
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0))
frag->bv_offset += bytes;
#else
frag->page_offset += bytes;
@@ -277,7 +279,7 @@ static int rmnet_nss_adjust_header(struc
* handle it. Remove the ethernet header and pass it onward to the stack
* if possible.
*/
-void rmnet_nss_receive(struct net_device *dev, struct sk_buff *skb,
+static void rmnet_nss_receive(struct net_device *dev, struct sk_buff *skb,
struct napi_struct *napi)
{
rmnet_nss_inc_stat(RMNET_NSS_EXCEPTIONS);
@@ -331,7 +333,7 @@ drop:
* we add a dummy ethernet header with the approriate protocol field set,
* the pass the packet off to NSS for hardware acceleration.
*/
-int rmnet_nss_tx(struct sk_buff *skb)
+static int rmnet_nss_tx(struct sk_buff *skb)
{
struct ethhdr *eth;
struct rmnet_nss_ctx *ctx;
@@ -402,7 +404,7 @@ fail:
* We need to pull the header off and invoke our ndo_start_xmit function
* to handle transmitting the packet to the network stack.
*/
-void rmnet_nss_xmit(struct net_device *dev, struct sk_buff *skb)
+static void rmnet_nss_xmit(struct net_device *dev, struct sk_buff *skb)
{
int rc;
@@ -432,7 +434,7 @@ void rmnet_nss_xmit(struct net_device *d
}
/* Create and register an NSS context for an rmnet_data device */
-int rmnet_nss_create_vnd(struct net_device *dev)
+static int rmnet_nss_create_vnd(struct net_device *dev)
{
struct rmnet_nss_ctx *ctx;
@@ -454,7 +456,7 @@ int rmnet_nss_create_vnd(struct net_devi
}
/* Unregister and destroy the NSS context for an rmnet_data device */
-int rmnet_nss_free_vnd(struct net_device *dev)
+static int rmnet_nss_free_vnd(struct net_device *dev)
{
struct rmnet_nss_ctx *ctx;
@@ -470,7 +472,7 @@ static struct rmnet_nss_cb rmnet_nss = {
.nss_tx = rmnet_nss_tx,
};
-int __init rmnet_nss_init(void)
+static int __init rmnet_nss_init(void)
{
pr_err("%s(): initializing rmnet_nss\n", __func__);
RCU_INIT_POINTER(rmnet_nss_callbacks, &rmnet_nss);
@@ -478,7 +480,7 @@ int __init rmnet_nss_init(void)
return 0;
}
-void __exit rmnet_nss_exit(void)
+static void __exit rmnet_nss_exit(void)
{
struct hlist_node *tmp;
struct rmnet_nss_ctx *ctx;
--- a/qmi_wwan_q.c
+++ b/qmi_wwan_q.c
@@ -1465,7 +1465,7 @@ typedef struct {
} BRMAC_SETTING;
#endif
-int qma_setting_store(struct device *dev, QMAP_SETTING *qmap_settings, size_t size) {
+static int qma_setting_store(struct device *dev, QMAP_SETTING *qmap_settings, size_t size) {
struct net_device *netdev = to_net_dev(dev);
struct usbnet * usbnetdev = netdev_priv( netdev );
struct qmi_wwan_state *info = (void *)&usbnetdev->data;
@@ -2007,8 +2007,8 @@ static void ql_net_get_drvinfo(struct ne
{
/* Inherit standard device info */
usbnet_get_drvinfo(net, info);
- strlcpy(info->driver, driver_name, sizeof(info->driver));
- strlcpy(info->version, VERSION_NUMBER, sizeof(info->version));
+ strscpy(info->driver, driver_name, sizeof(info->driver));
+ strscpy(info->version, VERSION_NUMBER, sizeof(info->version));
}
static struct ethtool_ops ql_net_ethtool_ops;

View File

@ -1470,7 +1470,7 @@ typedef struct {
} BRMAC_SETTING;
#endif
int qma_setting_store(struct device *dev, QMAP_SETTING *qmap_settings, size_t size) {
static int qma_setting_store(struct device *dev, QMAP_SETTING *qmap_settings, size_t size) {
struct net_device *netdev = to_net_dev(dev);
struct usbnet * usbnetdev = netdev_priv( netdev );
struct qmi_wwan_state *info = (void *)&usbnetdev->data;

View File

@ -157,6 +157,7 @@ static int rmnet_nss_ethhdr_pull(struct sk_buff *skb)
rmnet_nss_inc_stat(RMNET_NSS_RX_NON_ETH);
return -1;
}
static int rmnet_nss_handle_non_zero_headlen(struct sk_buff *skb)
{
struct iphdr *iph;
@ -259,7 +260,9 @@ static int rmnet_nss_adjust_header(struct sk_buff *skb)
/* subtract to account for skb_push */
skb->len -= bytes;
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0))
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 12, 0))
frag->offset += bytes;
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0))
frag->bv_offset += bytes;
#else
frag->page_offset += bytes;
@ -277,7 +280,7 @@ static int rmnet_nss_adjust_header(struct sk_buff *skb)
* handle it. Remove the ethernet header and pass it onward to the stack
* if possible.
*/
void rmnet_nss_receive(struct net_device *dev, struct sk_buff *skb,
static void rmnet_nss_receive(struct net_device *dev, struct sk_buff *skb,
struct napi_struct *napi)
{
rmnet_nss_inc_stat(RMNET_NSS_EXCEPTIONS);
@ -331,7 +334,7 @@ drop:
* we add a dummy ethernet header with the approriate protocol field set,
* the pass the packet off to NSS for hardware acceleration.
*/
int rmnet_nss_tx(struct sk_buff *skb)
static int rmnet_nss_tx(struct sk_buff *skb)
{
struct ethhdr *eth;
struct rmnet_nss_ctx *ctx;
@ -356,7 +359,8 @@ int rmnet_nss_tx(struct sk_buff *skb)
}
eth = (struct ethhdr *)skb_push(skb, sizeof(*eth));
memset(&eth->h_dest, 0, ETH_ALEN * 2);
memset(eth->h_dest, 0, ETH_ALEN);
memset(eth->h_source, 0, ETH_ALEN);
if (version == 4) {
eth->h_proto = htons(ETH_P_IP);
} else if (version == 6) {
@ -401,7 +405,7 @@ fail:
* We need to pull the header off and invoke our ndo_start_xmit function
* to handle transmitting the packet to the network stack.
*/
void rmnet_nss_xmit(struct net_device *dev, struct sk_buff *skb)
static void rmnet_nss_xmit(struct net_device *dev, struct sk_buff *skb)
{
int rc;
@ -431,7 +435,7 @@ void rmnet_nss_xmit(struct net_device *dev, struct sk_buff *skb)
}
/* Create and register an NSS context for an rmnet_data device */
int rmnet_nss_create_vnd(struct net_device *dev)
static int rmnet_nss_create_vnd(struct net_device *dev)
{
struct rmnet_nss_ctx *ctx;
@ -453,7 +457,7 @@ int rmnet_nss_create_vnd(struct net_device *dev)
}
/* Unregister and destroy the NSS context for an rmnet_data device */
int rmnet_nss_free_vnd(struct net_device *dev)
static int rmnet_nss_free_vnd(struct net_device *dev)
{
struct rmnet_nss_ctx *ctx;
@ -469,15 +473,15 @@ static const struct rmnet_nss_cb rmnet_nss = {
.nss_tx = rmnet_nss_tx,
};
int __init rmnet_nss_init(void)
static int __init rmnet_nss_init(void)
{
pr_err("%s(): initializing rmnet_nss\n", __func__);
RCU_INIT_POINTER(rmnet_nss_callbacks, &rmnet_nss);
RCU_INIT_POINTER(rmnet_nss_callbacks, (struct rmnet_nss_cb *)&rmnet_nss);
rmnet_mark_skb = symbol_get(qmi_rmnet_mark_skb);
return 0;
}
void __exit rmnet_nss_exit(void)
static void __exit rmnet_nss_exit(void)
{
struct hlist_node *tmp;
struct rmnet_nss_ctx *ctx;
@ -490,7 +494,7 @@ void __exit rmnet_nss_exit(void)
/* Tear down all NSS contexts */
hash_for_each_safe(rmnet_nss_ctx_hashtable, bkt, tmp, ctx, hnode)
rmnet_nss_free_ctx(ctx);
rmnet_nss_free_ctx(ctx);
}
MODULE_LICENSE("GPL v2");