summaryrefslogtreecommitdiff
path: root/backport/compat/backport-4.10.c
diff options
context:
space:
mode:
Diffstat (limited to 'backport/compat/backport-4.10.c')
-rw-r--r--backport/compat/backport-4.10.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/backport/compat/backport-4.10.c b/backport/compat/backport-4.10.c
index b4d7edea..4c8125fb 100644
--- a/backport/compat/backport-4.10.c
+++ b/backport/compat/backport-4.10.c
@@ -14,6 +14,30 @@
#include <linux/mii.h>
#if LINUX_VERSION_IS_GEQ(4,6,0)
+#if LINUX_VERSION_IS_LESS(4,7,0)
+static bool ethtool_convert_link_mode_to_legacy_u32(u32 *legacy_u32,
+ const unsigned long *src)
+{
+ bool retval = true;
+
+ /* TODO: following test will soon always be true */
+ if (__ETHTOOL_LINK_MODE_MASK_NBITS > 32) {
+ __ETHTOOL_DECLARE_LINK_MODE_MASK(ext);
+
+ bitmap_zero(ext, __ETHTOOL_LINK_MODE_MASK_NBITS);
+ bitmap_fill(ext, 32);
+ bitmap_complement(ext, ext, __ETHTOOL_LINK_MODE_MASK_NBITS);
+ if (bitmap_intersects(ext, src,
+ __ETHTOOL_LINK_MODE_MASK_NBITS)) {
+ /* src mask goes beyond bit 31 */
+ retval = false;
+ }
+ }
+ *legacy_u32 = src[0];
+ return retval;
+}
+#endif
+
static u32 mii_get_an(struct mii_if_info *mii, u16 addr)
{
int advert;