fix: qmi_wwan_* for higher kernel versions
Signed-off-by: sfwtw <wtw@cr.cx>
This commit is contained in:
parent
729bebe78f
commit
a4619fa1ec
@ -688,8 +688,7 @@ static void rmnet_vnd_update_tx_stats(struct net_device *net,
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(MHI_NETDEV_STATUS64)
|
||||
static struct rtnl_link_stats64 *_rmnet_vnd_get_stats64(struct net_device *net, struct rtnl_link_stats64 *stats)
|
||||
static struct rtnl_link_stats64 * _rmnet_vnd_get_stats64(struct net_device *net, struct rtnl_link_stats64 *stats)
|
||||
{
|
||||
struct qmap_priv *dev = netdev_priv(net);
|
||||
unsigned int start;
|
||||
@ -712,7 +711,11 @@ static struct rtnl_link_stats64 *_rmnet_vnd_get_stats64(struct net_device *net,
|
||||
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
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0)
|
||||
rx_packets = stats64->rx_packets;
|
||||
rx_bytes = stats64->rx_bytes;
|
||||
@ -724,7 +727,11 @@ static struct rtnl_link_stats64 *_rmnet_vnd_get_stats64(struct net_device *net,
|
||||
tx_packets = u64_stats_read(&stats64->tx_packets);
|
||||
tx_bytes = u64_stats_read(&stats64->tx_bytes);
|
||||
#endif
|
||||
#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 += rx_packets;
|
||||
stats->rx_bytes += rx_bytes;
|
||||
@ -735,6 +742,7 @@ static struct rtnl_link_stats64 *_rmnet_vnd_get_stats64(struct net_device *net,
|
||||
return stats;
|
||||
}
|
||||
|
||||
#if defined(MHI_NETDEV_STATUS64)
|
||||
#if (LINUX_VERSION_CODE > KERNEL_VERSION( 4,10,0 )) //bc1f44709cf27fb2a5766cadafe7e2ad5e9cb221
|
||||
static void rmnet_vnd_get_stats64(struct net_device *net, struct rtnl_link_stats64 *stats) {
|
||||
_rmnet_vnd_get_stats64(net, stats);
|
||||
@ -1187,7 +1195,7 @@ static int qmap_register_device(sQmiWwanQmap * pDev, u8 offset_id)
|
||||
priv->mux_id = FIBOCOM_QMAP_MUX_ID + offset_id;
|
||||
sprintf(qmap_net->name, "%s.%d", real_dev->name, offset_id + 1);
|
||||
qmap_net->netdev_ops = &qmap_netdev_ops;
|
||||
memcpy (qmap_net->dev_addr, real_dev->dev_addr, ETH_ALEN);
|
||||
ether_addr_copy(qmap_net->dev_addr, real_dev->dev_addr);
|
||||
|
||||
#ifdef FIBOCOM_BRIDGE_MODE
|
||||
priv->bridge_mode = !!(pDev->bridge_mode & BIT(offset_id));
|
||||
|
@ -828,35 +828,35 @@ static struct rtnl_link_stats64 *_rmnet_vnd_get_stats64(struct net_device *net,
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION( 6,1,0 ))
|
||||
u64 rx_packets, rx_bytes;
|
||||
u64 tx_packets, tx_bytes;
|
||||
#else
|
||||
u64_stats_t rx_packets, rx_bytes;
|
||||
u64_stats_t tx_packets, tx_bytes;
|
||||
#endif
|
||||
|
||||
stats64 = per_cpu_ptr(dev->stats64, cpu);
|
||||
|
||||
do {
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION( 6,6,0 ))
|
||||
start = u64_stats_fetch_begin(&stats64->syncp);
|
||||
#else
|
||||
start = u64_stats_fetch_begin_irq(&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(&stats64->syncp, start));
|
||||
#else
|
||||
} while (u64_stats_fetch_retry_irq(&stats64->syncp, start));
|
||||
#endif
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION( 6,1,0 ))
|
||||
stats->rx_packets += rx_packets;
|
||||
stats->rx_bytes += rx_bytes;
|
||||
stats->tx_packets += tx_packets;
|
||||
stats->tx_bytes += tx_bytes;
|
||||
#else
|
||||
u64_stats_t rx_packets, rx_bytes;
|
||||
u64_stats_t tx_packets, tx_bytes;
|
||||
|
||||
stats64 = per_cpu_ptr(dev->stats64, cpu);
|
||||
|
||||
do {
|
||||
start = u64_stats_fetch_begin_irq(&stats64->syncp);
|
||||
rx_packets = stats64->rx_packets;
|
||||
rx_bytes = stats64->rx_bytes;
|
||||
tx_packets = stats64->tx_packets;
|
||||
tx_bytes = stats64->tx_bytes;
|
||||
} while (u64_stats_fetch_retry_irq(&stats64->syncp, start));
|
||||
|
||||
stats->rx_packets += u64_stats_read(&rx_packets);
|
||||
stats->rx_bytes += u64_stats_read(&rx_bytes);
|
||||
stats->tx_packets += u64_stats_read(&tx_packets);
|
||||
|
Loading…
x
Reference in New Issue
Block a user