compat/nes: Adding pci_zalloc_consistent backport
[~tnikolova/compat/.git] / include / linux / compat-3.17.h
index d2c054e..848291f 100644 (file)
@@ -2,54 +2,37 @@
 #define LINUX_3_17_COMPAT_H
 
 #include <linux/version.h>
-#include <linux/dcbnl.h>
+#include "../../compat/config.h"
+#include <linux/dma-mapping.h>
+#include <linux/pci.h>
+#include <linux/device.h>
 
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,17,0))
 
-#include <linux/netdevice.h>
-
-#ifdef alloc_netdev
-#undef alloc_netdev
-#define alloc_netdev(sizeof_priv, name, name_assign_type, setup) \
-       alloc_netdev_mqs(sizeof_priv, name, setup, 1, 1)
-#endif
-
-#ifndef CONFIG_COMPAT_IS_QCN
-
-enum dcbnl_cndd_states {
-       DCB_CNDD_RESET = 0,
-       DCB_CNDD_EDGE,
-       DCB_CNDD_INTERIOR,
-       DCB_CNDD_INTERIOR_READY,
-};
-
-struct ieee_qcn {
-       __u8 rpg_enable[IEEE_8021QAZ_MAX_TCS];
-       __u32 rppp_max_rps[IEEE_8021QAZ_MAX_TCS];
-       __u32 rpg_time_reset[IEEE_8021QAZ_MAX_TCS];
-       __u32 rpg_byte_reset[IEEE_8021QAZ_MAX_TCS];
-       __u32 rpg_threshold[IEEE_8021QAZ_MAX_TCS];
-       __u32 rpg_max_rate[IEEE_8021QAZ_MAX_TCS];
-       __u32 rpg_ai_rate[IEEE_8021QAZ_MAX_TCS];
-       __u32 rpg_hai_rate[IEEE_8021QAZ_MAX_TCS];
-       __u32 rpg_gd[IEEE_8021QAZ_MAX_TCS];
-       __u32 rpg_min_dec_fac[IEEE_8021QAZ_MAX_TCS];
-       __u32 rpg_min_rate[IEEE_8021QAZ_MAX_TCS];
-       __u32 cndd_state_machine[IEEE_8021QAZ_MAX_TCS];
-};
-
-struct ieee_qcn_stats {
-       __u64 rppp_rp_centiseconds[IEEE_8021QAZ_MAX_TCS];
-       __u32 rppp_created_rps[IEEE_8021QAZ_MAX_TCS];
-       __u32 ignored_cnm[IEEE_8021QAZ_MAX_TCS];
-       __u32 estimated_total_rate[IEEE_8021QAZ_MAX_TCS];
-       __u32 cnms_handled_successfully[IEEE_8021QAZ_MAX_TCS];
-       __u32 min_total_limiters_rate[IEEE_8021QAZ_MAX_TCS];
-       __u32 max_total_limiters_rate[IEEE_8021QAZ_MAX_TCS];
-};
-
-#endif
-
+#define pci_zalloc_consistent backport_pci_zalloc_consistent
+static inline void *
+backport_pci_zalloc_consistent(struct pci_dev *hwdev, size_t size,
+                      dma_addr_t *dma_handle)
+{
+        return dma_zalloc_coherent(hwdev == NULL ? NULL : &hwdev->dev,
+                               size, dma_handle, GFP_ATOMIC);
+}
+
+#ifndef HAVE_KTIME_GET_REAL_NS
+#include <linux/hrtimer.h>
+#include <linux/ktime.h>
+static inline u64 ktime_get_real_ns(void) {
+       return ktime_to_ns(ktime_get_real());
+}
+#endif /* HAVE_KTIME_GET_REAL_NS */
+
+#ifndef HAVE_KTIME_GET_BOOT_NS
+#include <linux/hrtimer.h>
+static inline u64 ktime_get_boot_ns(void)
+{
+       return ktime_to_ns(ktime_get_boottime());
+}
+#endif /* HAVE_KTIME_GET_BOOT_NS */
 
 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,17,0)) */