wwan: quectel_MHI: Merge patches for kernel 6.12

Signed-off-by: Sean Khan <datapronix@protonmail.com>
This commit is contained in:
Sean Khan 2025-06-03 15:08:10 -04:00
parent c571de5a8e
commit 0dd2aa67ab
5 changed files with 29 additions and 78 deletions

View File

@ -1,61 +0,0 @@
--- a/core/mhi_init.c
+++ b/core/mhi_init.c
@@ -644,7 +644,11 @@ static int mon_text_release(struct inode
static const struct file_operations mon_fops_text_u = {
.owner = THIS_MODULE,
.open = mon_text_open,
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 14, 0))
.llseek = no_llseek,
+#else
+ .llseek = noop_llseek,
+#endif
.read = mon_text_read_u,
.release = mon_text_release,
};
@@ -2366,7 +2370,11 @@ void mhi_unprepare_after_power_down(stru
}
/* match dev to drv */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 11, 0)
static int mhi_match(struct device *dev, struct device_driver *drv)
+#else
+static int mhi_match(struct device *dev, const struct device_driver *drv)
+#endif
{
struct mhi_device *mhi_dev = to_mhi_device(dev);
struct mhi_driver *mhi_drv = to_mhi_driver(drv);
--- a/devices/mhi_netdev.c
+++ b/devices/mhi_netdev.c
@@ -486,7 +486,7 @@ static int mhi_netdev_ioctl_extended(str
ext_cmd.u.data = 0;
break;
case RMNET_IOCTL_GET_DRIVER_NAME:
- strlcpy(ext_cmd.u.if_name, mhi_netdev->interface_name,
+ strscpy(ext_cmd.u.if_name, mhi_netdev->interface_name,
sizeof(ext_cmd.u.if_name));
break;
case RMNET_IOCTL_SET_SLEEP_STATE:
@@ -560,8 +560,8 @@ static void mhi_netdev_get_drvinfo (stru
{
//struct mhi_netdev *mhi_netdev = ndev_to_mhi(ndev);
- strlcpy (info->driver, "pcie_mhi", sizeof info->driver);
- strlcpy (info->version, PCIE_MHI_DRIVER_VERSION, sizeof info->version);
+ strscpy (info->driver, "pcie_mhi", sizeof info->driver);
+ strscpy (info->version, PCIE_MHI_DRIVER_VERSION, sizeof info->version);
}
static const struct ethtool_ops mhi_netdev_ethtool_ops = {
--- a/devices/mhi_netdev_quectel.c
+++ b/devices/mhi_netdev_quectel.c
@@ -2308,8 +2308,8 @@ static void mhi_netdev_get_drvinfo (stru
{
//struct mhi_netdev *mhi_netdev = ndev_to_mhi(ndev);
- strlcpy (info->driver, "pcie_mhi", sizeof info->driver);
- strlcpy (info->version, PCIE_MHI_DRIVER_VERSION, sizeof info->version);
+ strscpy (info->driver, "pcie_mhi", sizeof info->driver);
+ strscpy (info->version, PCIE_MHI_DRIVER_VERSION, sizeof info->version);
}
static const struct ethtool_ops mhi_netdev_ethtool_ops = {

View File

@ -644,7 +644,11 @@ static int mon_text_release(struct inode *inode, struct file *file)
static const struct file_operations mon_fops_text_u = {
.owner = THIS_MODULE,
.open = mon_text_open,
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 14, 0))
.llseek = no_llseek,
#else
.llseek = noop_llseek,
#endif
.read = mon_text_read_u,
.release = mon_text_release,
};
@ -2369,7 +2373,11 @@ void mhi_unprepare_after_power_down(struct mhi_controller *mhi_cntrl)
}
/* match dev to drv */
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 11, 0)
static int mhi_match(struct device *dev, struct device_driver *drv)
#else
static int mhi_match(struct device *dev, const struct device_driver *drv)
#endif
{
struct mhi_device *mhi_dev = to_mhi_device(dev);
struct mhi_driver *mhi_drv = to_mhi_driver(drv);
@ -2691,7 +2699,7 @@ static int __init mhi_cntrl_init(void)
return 0;
}
void mhi_cntrl_exit(void)
static void mhi_cntrl_exit(void)
{
class_destroy(mhi_cntrl_drv.class);
unregister_chrdev(mhi_cntrl_drv.major, MHI_CNTRL_DRIVER_NAME);

View File

@ -486,7 +486,7 @@ static int mhi_netdev_ioctl_extended(struct net_device *dev, struct ifreq *ifr)
ext_cmd.u.data = 0;
break;
case RMNET_IOCTL_GET_DRIVER_NAME:
strlcpy(ext_cmd.u.if_name, mhi_netdev->interface_name,
strscpy(ext_cmd.u.if_name, mhi_netdev->interface_name,
sizeof(ext_cmd.u.if_name));
break;
case RMNET_IOCTL_SET_SLEEP_STATE:
@ -560,8 +560,8 @@ static void mhi_netdev_get_drvinfo (struct net_device *ndev, struct ethtool_drvi
{
//struct mhi_netdev *mhi_netdev = ndev_to_mhi(ndev);
strlcpy (info->driver, "pcie_mhi", sizeof info->driver);
strlcpy (info->version, PCIE_MHI_DRIVER_VERSION, sizeof info->version);
strscpy (info->driver, "pcie_mhi", sizeof info->driver);
strscpy (info->version, PCIE_MHI_DRIVER_VERSION, sizeof info->version);
}
static const struct ethtool_ops mhi_netdev_ethtool_ops = {

View File

@ -2587,8 +2587,8 @@ static void mhi_netdev_get_drvinfo (struct net_device *ndev, struct ethtool_drvi
{
//struct mhi_netdev *mhi_netdev = ndev_to_mhi(ndev);
strlcpy (info->driver, "pcie_mhi", sizeof info->driver);
strlcpy (info->version, PCIE_MHI_DRIVER_VERSION, sizeof info->version);
strscpy (info->driver, "pcie_mhi", sizeof info->driver);
strscpy (info->version, PCIE_MHI_DRIVER_VERSION, sizeof info->version);
}
static const struct ethtool_ops mhi_netdev_ethtool_ops = {

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");