nss-packages-qosmio/qca-nss-clients/patches/0005-11.4-capwapmgr.patch
Qosmio 69febdb1da QSDK 12.1 backport + fixes
* qca-nss-drv: backport 12.1 (add more firmware checks)
    * qca-nss-ecm: backport 12.1
    * qca-nss-gmac: consolidate patches
2022-09-16 08:19:33 -04:00

85 lines
2.6 KiB
Diff

--- a/capwapmgr/nss_capwapmgr.c
+++ b/capwapmgr/nss_capwapmgr.c
@@ -348,6 +348,40 @@ static struct rtnl_link_stats64 *nss_cap
return stats;
}
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0))
+/*
+ * nss_capwapmgr_dev_tunnel_stats()
+ * Netdev ops function to retrieve stats for kernel version < 4.6
+ */
+static struct rtnl_link_stats64 *nss_capwapmgr_dev_tunnel_stats(struct net_device *dev, struct rtnl_link_stats64 *stats)
+{
+ return nss_capwapmgr_get_tunnel_stats(dev, stats);
+}
+#else
+/*
+ * nss_capwapmgr_dev_tunnel_stats()
+ * Netdev ops function to retrieve stats for kernel version > 4.6
+ */
+static void nss_capwapmgr_dev_tunnel_stats(struct net_device *dev, struct rtnl_link_stats64 *stats)
+{
+ nss_capwapmgr_get_tunnel_stats(dev, stats);
+}
+#endif
+
+/**
+ * nss_capwapmgr_change_mtu - set new MTU size
+ * @dev: network device
+ * @new_mtu: new Maximum Transfer Unit
+ *
+ * Allow changing MTU size. Needs to be overridden for devices
+ * supporting jumbo frames.
+ */
+int nss_capwapmgr_change_mtu(struct net_device *dev, int new_mtu)
+{
+ dev->mtu = new_mtu;
+ return 0;
+}
+
/*
* nss_capwapmgr_netdev_ops
* Netdev operations.
@@ -357,8 +391,8 @@ static const struct net_device_ops nss_c
.ndo_stop = nss_capwapmgr_close,
.ndo_start_xmit = nss_capwapmgr_start_xmit,
.ndo_set_mac_address = eth_mac_addr,
- .ndo_change_mtu = eth_change_mtu,
- .ndo_get_stats64 = nss_capwapmgr_get_tunnel_stats,
+ .ndo_change_mtu = nss_capwapmgr_change_mtu,
+ .ndo_get_stats64 = nss_capwapmgr_dev_tunnel_stats,
};
/*
@@ -375,7 +409,12 @@ static void nss_capwapmgr_dummpy_netdev_
dev->ethtool_ops = NULL;
dev->header_ops = NULL;
dev->netdev_ops = &nss_capwapmgr_netdev_ops;
+
+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(4, 11, 8))
dev->destructor = NULL;
+#else
+ dev->priv_destructor = NULL;
+#endif
memcpy(dev->dev_addr, "\x00\x00\x00\x00\x00\x00", dev->addr_len);
memset(dev->broadcast, 0xff, dev->addr_len);
memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
@@ -514,6 +553,8 @@ static nss_capwapmgr_status_t nss_capwap
/*
* nss_capwapmgr_verify_tunnel_param()
* Common function to verify tunnel_id and returns pointer to tunnel.
+ *
+ * The caller of the function should hold reference to the net device before calling.
*/
static struct nss_capwapmgr_tunnel *nss_capwapmgr_verify_tunnel_param(struct net_device *dev, uint8_t tunnel_id)
{
@@ -1050,6 +1091,7 @@ static nss_tx_status_t nss_capwapmgr_cre
nircm->rule_flags |= rule_flags;
nircm->valid_flags |= valid_flags;
+ down(&ip_response.sem);
status = nss_ipv6_tx(nss_ctx, &nim);
if (status != NSS_TX_SUCCESS) {
up(&ip_response.sem);