From 84d6642e4d1609562abb421341c9a90c023247a1 Mon Sep 17 00:00:00 2001 From: Dominik Sliwa Date: Tue, 4 Jul 2017 11:53:51 +0200 Subject: backports:fix compilation with toradex kernels Signed-off-by: Dominik Sliwa --- net/mac80211/iface.c | 8 ++++++++ net/mac80211/rx.c | 2 ++ net/mac80211/status.c | 2 ++ net/mac80211/tx.c | 2 ++ net/wireless/trace.c | 2 +- net/wireless/trace.h | 38 +++++++++++++++++++------------------- 6 files changed, 34 insertions(+), 20 deletions(-) (limited to 'net') diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index 242a3c1..33ee381 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c @@ -1137,6 +1137,7 @@ static u16 ieee80211_netdev_select_queue(struct net_device *dev, static void ieee80211_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats) { +#if LINUX_VERSION_IS_GEQ(3,14,0) int i; for_each_possible_cpu(i) { @@ -1159,6 +1160,7 @@ ieee80211_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats) stats->rx_bytes += rx_bytes; stats->tx_bytes += tx_bytes; } +#endif } static const struct net_device_ops ieee80211_dataif_ops = { @@ -1232,7 +1234,11 @@ static void ieee80211_if_setup(struct net_device *dev) static void ieee80211_if_setup_no_queue(struct net_device *dev) { ieee80211_if_setup(dev); +#if LINUX_VERSION_IS_GEQ(4,3,0) dev->priv_flags |= IFF_NO_QUEUE; +#else + dev->tx_queue_len = 0; +#endif } static void ieee80211_iface_work(struct work_struct *work) @@ -1913,9 +1919,11 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, netdev_set_default_ethtool_ops(ndev, &ieee80211_ethtool_ops); +#if LINUX_VERSION_IS_GEQ(4,10,0) /* MTU range: 256 - 2304 */ ndev->min_mtu = 256; ndev->max_mtu = IEEE80211_MAX_DATA_LEN; +#endif ret = register_netdevice(ndev); if (ret) { diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index b34bbb4..332fdc5 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c @@ -36,12 +36,14 @@ static inline void ieee80211_rx_stats(struct net_device *dev, u32 len) { +#if LINUX_VERSION_IS_GEQ(3,14,0) struct pcpu_sw_netstats *tstats = this_cpu_ptr(dev->tstats); u64_stats_update_begin(&tstats->syncp); tstats->rx_packets++; tstats->rx_bytes += len; u64_stats_update_end(&tstats->syncp); +#endif } static u8 *ieee80211_get_bssid(struct ieee80211_hdr *hdr, size_t len, diff --git a/net/mac80211/status.c b/net/mac80211/status.c index 83b8b11..7d769a1 100644 --- a/net/mac80211/status.c +++ b/net/mac80211/status.c @@ -542,8 +542,10 @@ static void ieee80211_report_used_skb(struct ieee80211_local *local, } if (!dropped && skb->destructor) { +#if LINUX_VERSION_IS_GEQ(3,3,0) skb->wifi_acked_valid = 1; skb->wifi_acked = acked; +#endif } } diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 6e0a675..762ec66 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -43,12 +43,14 @@ static inline void ieee80211_tx_stats(struct net_device *dev, u32 len) { +#if LINUX_VERSION_IS_GEQ(3,14,0) struct pcpu_sw_netstats *tstats = this_cpu_ptr(dev->tstats); u64_stats_update_begin(&tstats->syncp); tstats->tx_packets++; tstats->tx_bytes += len; u64_stats_update_end(&tstats->syncp); +#endif } static __le16 ieee80211_duration(struct ieee80211_tx_data *tx, diff --git a/net/wireless/trace.c b/net/wireless/trace.c index c435908..7f2f887 100644 --- a/net/wireless/trace.c +++ b/net/wireless/trace.c @@ -1,5 +1,5 @@ #include -#if LINUX_VERSION_IS_LESS(3,1,0) +#if LINUX_VERSION_IS_LESS(3,2,0) #include #endif diff --git a/net/wireless/trace.h b/net/wireless/trace.h index 9675c73..90ce475 100644 --- a/net/wireless/trace.h +++ b/net/wireless/trace.h @@ -11,6 +11,9 @@ #include #include "core.h" +#ifndef BACKPORTS_TRACE +#define BACKPORTS_TRACE + #define MAC_ENTRY(entry_mac) __array(u8, entry_mac, ETH_ALEN) #define MAC_ASSIGN(entry_mac, given_mac) do { \ if (given_mac) \ @@ -212,6 +215,18 @@ /************************************************************* * rdev->ops traces * *************************************************************/ +#if LINUX_VERSION_IS_LESS(4,0,0) +#undef TP_PROTO +#define TP_PROTO(args...) args +#undef DECLARE_TRACE +#define DECLARE_TRACE(args...) +#undef DEFINE_EVENT +#define DEFINE_EVENT(skip,name,proto,args...) inline void trace_##name(proto){} +#undef TRACE_EVENT +#define TRACE_EVENT(name,proto,args...) inline void trace_##name(proto){} +#endif +DEFINE_EVENT(skip, rdev_set_multicast_to_unicast, + TP_PROTO(struct wiphy *wiphy, struct net_device *dev, bool ena), a); TRACE_EVENT(rdev_suspend, TP_PROTO(struct wiphy *wiphy, struct cfg80211_wowlan *wow), @@ -277,6 +292,9 @@ TRACE_EVENT(rdev_scan, TP_printk(WIPHY_PR_FMT, WIPHY_PR_ARG) ); +#undef DECLARE_EVENT_CLASS +#define DECLARE_EVENT_CLASS(args...) + DECLARE_EVENT_CLASS(wiphy_only_evt, TP_PROTO(struct wiphy *wiphy), TP_ARGS(wiphy), @@ -3051,25 +3069,7 @@ DEFINE_EVENT(wiphy_wdev_evt, rdev_abort_scan, TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev), TP_ARGS(wiphy, wdev) ); - -TRACE_EVENT(rdev_set_multicast_to_unicast, - TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, - const bool enabled), - TP_ARGS(wiphy, netdev, enabled), - TP_STRUCT__entry( - WIPHY_ENTRY - NETDEV_ENTRY - __field(bool, enabled) - ), - TP_fast_assign( - WIPHY_ASSIGN; - NETDEV_ASSIGN; - __entry->enabled = enabled; - ), - TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", unicast: %s", - WIPHY_PR_ARG, NETDEV_PR_ARG, - BOOL_TO_STR(__entry->enabled)) -); +#endif /* BACKPORTS_TRACE */ #endif /* !__RDEV_OPS_TRACE || TRACE_HEADER_MULTI_READ */ #undef TRACE_INCLUDE_PATH -- cgit v1.2.3