File 0001-fix-for-kernel-4.12.0.patch of Package mt7630e

From 49788c9162610fc527a43278e6388a2d05f1856a Mon Sep 17 00:00:00 2001
From: Davide Gessa <gessadavide@gmail.com>
Date: Thu, 6 Jul 2017 10:45:29 +0200
Subject: [PATCH] kernel >= 4.12.0 fix

---
 rt2x00/rt2800lib.c | 24 ++++++++++++++++++++----
 rt2x00/rt2x00dev.c | 13 ++++++++++---
 2 files changed, 30 insertions(+), 7 deletions(-)

diff --git a/rt2x00/rt2800lib.c b/rt2x00/rt2800lib.c
index fe432fc..b1458c9 100644
--- a/rt2x00/rt2800lib.c
+++ b/rt2x00/rt2800lib.c
@@ -1926,10 +1926,18 @@ void rt2800_process_rxwi(struct queue_entry *entry,
 		//rt2x00_desc_read(rxwi, 1, &word);
 
 		if (pRxWI->RxWISGI)
-			rxdesc->flags |= RX_FLAG_SHORT_GI;
+			#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
+				rxdesc->flags |= RX_FLAG_DUP_VALIDATED;
+			#else
+				rxdesc->flags |= RX_FLAG_SHORT_GI;
+			#endif
 
 		if (pRxWI->RxWIBW)
-			rxdesc->flags |= RX_FLAG_40MHZ;
+			#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
+				rxdesc->flags |= RX_FLAG_PN_VALIDATED;
+			#else
+				rxdesc->flags |= RX_FLAG_40MHZ;
+			#endif
 
 		/*
 		 * Detect RX rate, always use MCS as signal type.
@@ -2004,10 +2012,18 @@ void rt2800_process_rxwi(struct queue_entry *entry,
 		rt2x00_desc_read(rxwi, 1, &word);
 
 		if (rt2x00_get_field32(word, RXWI_W1_SHORT_GI))
-			rxdesc->flags |= RX_FLAG_SHORT_GI;
+			#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
+				rxdesc->flags |= RX_FLAG_DUP_VALIDATED;
+			#else
+				rxdesc->flags |= RX_FLAG_SHORT_GI;
+			#endif
 
 		if (rt2x00_get_field32(word, RXWI_W1_BW))
-			rxdesc->flags |= RX_FLAG_40MHZ;
+			#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
+				rxdesc->flags |= RX_FLAG_PN_VALIDATED;
+			#else
+				rxdesc->flags |= RX_FLAG_40MHZ;
+			#endif
 
 		/*
 		 * Detect RX rate, always use MCS as signal type.
diff --git a/rt2x00/rt2x00dev.c b/rt2x00/rt2x00dev.c
index a5ca2b0..b9012cf 100644
--- a/rt2x00/rt2x00dev.c
+++ b/rt2x00/rt2x00dev.c
@@ -787,10 +787,17 @@ void rt2x00lib_rxdone(struct queue_entry *entry, gfp_t gfp)
 	 * Translate the signal to the correct bitrate index.
 	 */
 	rate_idx = rt2x00lib_rxdone_read_signal(rt2x00dev, &rxdesc);
-	if (rxdesc.rate_mode == RATE_MODE_HT_MIX ||
-	    rxdesc.rate_mode == RATE_MODE_HT_GREENFIELD)
-		rxdesc.flags |= RX_FLAG_HT;
 
+	#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
+	    if (rxdesc.rate_mode == RATE_MODE_HT_MIX || 
+			rxdesc.rate_mode == RATE_MODE_HT_GREENFIELD)
+			rxdesc.flags |= RX_FLAG_AMPDU_DETAILS;
+	#else
+		if (rxdesc.rate_mode == RATE_MODE_HT_MIX ||
+			rxdesc.rate_mode == RATE_MODE_HT_GREENFIELD)
+			rxdesc.flags |= RX_FLAG_HT;
+	#endif
+	
 	/*
 	 * Check if this is a beacon, and more frames have been
 	 * buffered while we were in powersaving mode.
openSUSE Build Service is sponsored by