Merge branch 'stable-3.2' into pandora-3.2
[pandora-kernel.git] / include / net / red.h
index b72a3b8..d2eb24d 100644 (file)
@@ -124,6 +124,17 @@ static inline u32 red_rmask(u8 Plog)
        return Plog < 32 ? ((1 << Plog) - 1) : ~0UL;
 }
 
+static inline bool red_check_params(u32 qth_min, u32 qth_max, u8 Wlog)
+{
+       if (fls(qth_min) + Wlog > 32)
+               return false;
+       if (fls(qth_max) + Wlog > 32)
+               return false;
+       if (qth_max < qth_min)
+               return false;
+       return true;
+}
+
 static inline void red_set_parms(struct red_parms *p,
                                 u32 qth_min, u32 qth_max, u8 Wlog, u8 Plog,
                                 u8 Scell_log, u8 *stab)