From fd83f07839efaf9220b1d4c496c317b0a407d097 Mon Sep 17 00:00:00 2001 From: DHDAXCW Date: Sun, 30 Apr 2023 14:07:54 +0000 Subject: [PATCH] ??? --- package/wwan/driver/quectel_Gobinet/Makefile | 2 +- package/wwan/driver/quectel_MHI/Makefile | 2 +- package/wwan/driver/quectel_QMI_WWAN/Makefile | 6 +-- .../driver/quectel_QMI_WWAN/src/qmi_wwan_q.c | 49 +++++++++++++++++++ .../wwan/driver/quectel_SRPD_PCIE/Makefile | 3 +- 5 files changed, 55 insertions(+), 7 deletions(-) diff --git a/package/wwan/driver/quectel_Gobinet/Makefile b/package/wwan/driver/quectel_Gobinet/Makefile index 5457008a4..abdba443e 100644 --- a/package/wwan/driver/quectel_Gobinet/Makefile +++ b/package/wwan/driver/quectel_Gobinet/Makefile @@ -15,7 +15,7 @@ include $(INCLUDE_DIR)/kernel.mk include $(INCLUDE_DIR)/package.mk define KernelPackage/gobinet - SUBMENU:=Gobinet Support + SUBMENU:=WWAN Support TITLE:=Quectel Linux USB Gobinet Driver DEPENDS:=+kmod-usb-net FILES:=$(PKG_BUILD_DIR)/GobiNet.ko diff --git a/package/wwan/driver/quectel_MHI/Makefile b/package/wwan/driver/quectel_MHI/Makefile index bf6f718a0..24dec5ea1 100644 --- a/package/wwan/driver/quectel_MHI/Makefile +++ b/package/wwan/driver/quectel_MHI/Makefile @@ -15,7 +15,7 @@ include $(INCLUDE_DIR)/kernel.mk include $(INCLUDE_DIR)/package.mk define KernelPackage/pcie_mhi - SUBMENU:=PCIE Support + SUBMENU:=WWAN Support TITLE:=Kernel pcie driver for MHI device DEPENDS:=+pciids +pciutils +quectel-CM-5G FILES:=$(PKG_BUILD_DIR)/pcie_mhi.ko diff --git a/package/wwan/driver/quectel_QMI_WWAN/Makefile b/package/wwan/driver/quectel_QMI_WWAN/Makefile index 74e9d1c62..b27dfad76 100644 --- a/package/wwan/driver/quectel_QMI_WWAN/Makefile +++ b/package/wwan/driver/quectel_QMI_WWAN/Makefile @@ -9,15 +9,15 @@ include $(TOPDIR)/rules.mk PKG_NAME:=qmi_wwan_q PKG_VERSION:=3.0 -PKG_RELEASE:=1 +PKG_RELEASE:=2 include $(INCLUDE_DIR)/kernel.mk include $(INCLUDE_DIR)/package.mk define KernelPackage/qmi_wwan_q - SUBMENU:=qmiwwan Support + SUBMENU:=WWAN Support TITLE:=Quectel Linux USB QMI WWAN Driver - DEPENDS:=+kmod-usb-net kmod-usb-wdm + DEPENDS:=+kmod-usb-net +kmod-usb-wdm FILES:=$(PKG_BUILD_DIR)/qmi_wwan_q.ko AUTOLOAD:=$(call AutoLoad,81,qmi_wwan_q) endef diff --git a/package/wwan/driver/quectel_QMI_WWAN/src/qmi_wwan_q.c b/package/wwan/driver/quectel_QMI_WWAN/src/qmi_wwan_q.c index 5b9c9ac18..99a9e9fba 100644 --- a/package/wwan/driver/quectel_QMI_WWAN/src/qmi_wwan_q.c +++ b/package/wwan/driver/quectel_QMI_WWAN/src/qmi_wwan_q.c @@ -319,7 +319,11 @@ static int bridge_arp_reply(struct net_device *net, struct sk_buff *skb, uint br reply->ip_summed = CHECKSUM_UNNECESSARY; reply->pkt_type = PACKET_HOST; +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0) netif_rx_ni(reply); +#else + netif_rx(reply); +#endif } return 1; } @@ -383,7 +387,11 @@ static struct sk_buff *bridge_mode_tx_fixup(struct net_device *net, struct sk_bu __skb_pull(reply, skb_network_offset(reply)); reply->ip_summed = CHECKSUM_UNNECESSARY; reply->pkt_type = PACKET_HOST; +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0) netif_rx_ni(reply); +#else + netif_rx(reply); +#endif return NULL; } #endif @@ -753,12 +761,22 @@ static void rmnet_vnd_update_rx_stats(struct net_device *net, struct pcpu_sw_netstats *stats64 = this_cpu_ptr(dev->stats64); u64_stats_update_begin(&stats64->syncp); +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0) stats64->rx_packets += rx_packets; stats64->rx_bytes += rx_bytes; +#else + u64_stats_add(&stats64->rx_packets, rx_packets); + u64_stats_add(&stats64->rx_bytes, rx_bytes); +#endif u64_stats_update_end(&stats64->syncp); #else +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0) net->stats.rx_packets += rx_packets; net->stats.rx_bytes += rx_bytes; +#else + u64_stats_add(&net->stats.rx_packets, rx_packets); + u64_stats_add(&net->stats.rx_bytes, rx_bytes); +#endif #endif } @@ -769,12 +787,22 @@ static void rmnet_vnd_update_tx_stats(struct net_device *net, struct pcpu_sw_netstats *stats64 = this_cpu_ptr(dev->stats64); u64_stats_update_begin(&stats64->syncp); +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0) stats64->tx_packets += tx_packets; stats64->tx_bytes += tx_bytes; +#else + u64_stats_add(&stats64->tx_packets, tx_packets); + u64_stats_add(&stats64->tx_bytes, tx_bytes); +#endif u64_stats_update_end(&stats64->syncp); #else +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0) net->stats.tx_packets += tx_packets; net->stats.tx_bytes += tx_bytes; +#else + u64_stats_add(&net->stats.tx_packets, tx_packets); + u64_stats_add(&net->tx_bytes, tx_bytes); +#endif #endif } @@ -801,16 +829,25 @@ static struct rtnl_link_stats64 *_rmnet_vnd_get_stats64(struct net_device *net, do { start = u64_stats_fetch_begin_irq(&stats64->syncp); +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0) rx_packets = stats64->rx_packets; rx_bytes = stats64->rx_bytes; tx_packets = stats64->tx_packets; tx_bytes = stats64->tx_bytes; +#else + rx_packets = u64_stats_read(&stats64->rx_packets); + rx_bytes = u64_stats_read(&stats64->rx_bytes); + tx_packets = u64_stats_read(&stats64->tx_packets); + tx_bytes = u64_stats_read(&stats64->tx_bytes); +#endif } while (u64_stats_fetch_retry_irq(&stats64->syncp, start)); + stats->rx_packets += rx_packets; stats->rx_bytes += rx_bytes; stats->tx_packets += tx_packets; stats->tx_bytes += tx_bytes; + } return stats; @@ -1258,7 +1295,11 @@ static int qmap_register_device(sQmiWwanQmap * pDev, u8 offset_id) priv->dev = pDev->mpNetDev; priv->qmap_version = pDev->qmap_version; priv->mux_id = QUECTEL_QMAP_MUX_ID + offset_id; +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0) memcpy (qmap_net->dev_addr, real_dev->dev_addr, ETH_ALEN); +#else + eth_hw_addr_set (real_dev, qmap_net->dev_addr); +#endif #ifdef QUECTEL_BRIDGE_MODE priv->bridge_mode = !!(pDev->bridge_mode & BIT(offset_id)); @@ -2025,8 +2066,16 @@ static int qmi_wwan_bind(struct usbnet *dev, struct usb_interface *intf) /* make MAC addr easily distinguishable from an IP header */ if (possibly_iphdr(dev->net->dev_addr)) { +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0) dev->net->dev_addr[0] |= 0x02; /* set local assignment bit */ dev->net->dev_addr[0] &= 0xbf; /* clear "IP" bit */ +#else + u8 addr = dev->net->dev_addr[0]; + + addr |= 0x02; /* set local assignment bit */ + addr &= 0xbf; /* clear "IP" bit */ + dev_addr_mod(dev->net, 0, &addr, 1); +#endif } if (!_usbnet_get_stats64) _usbnet_get_stats64 = dev->net->netdev_ops->ndo_get_stats64; diff --git a/package/wwan/driver/quectel_SRPD_PCIE/Makefile b/package/wwan/driver/quectel_SRPD_PCIE/Makefile index 6397c2386..7e0f6b572 100644 --- a/package/wwan/driver/quectel_SRPD_PCIE/Makefile +++ b/package/wwan/driver/quectel_SRPD_PCIE/Makefile @@ -15,9 +15,8 @@ include $(INCLUDE_DIR)/kernel.mk include $(INCLUDE_DIR)/package.mk define KernelPackage/sprd_pcie - SUBMENU:=PCIE Support + SUBMENU:=WWAN Support TITLE:=Kernel pcie driver for SPRD device - DEPENDS:= FILES:=$(PKG_BUILD_DIR)/sprd_pcie.ko AUTOLOAD:=$(call AutoLoad,41,sprd_pcie) endef