linkmode: introduce linkmode_intersects()
authorAlexander Lobakin <alobakin@marvell.com>
Mon, 20 Jul 2020 18:08:00 +0000 (21:08 +0300)
committerDavid S. Miller <davem@davemloft.net>
Tue, 21 Jul 2020 00:59:43 +0000 (17:59 -0700)
Add a new helper to find intersections between Ethtool link modes,
linkmode_intersects(), similar to the other linkmode helpers.

Signed-off-by: Alexander Lobakin <alobakin@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/linkmode.h

index c664c27..f8397f3 100644 (file)
@@ -82,6 +82,12 @@ static inline int linkmode_equal(const unsigned long *src1,
        return bitmap_equal(src1, src2, __ETHTOOL_LINK_MODE_MASK_NBITS);
 }
 
+static inline int linkmode_intersects(const unsigned long *src1,
+                                     const unsigned long *src2)
+{
+       return bitmap_intersects(src1, src2, __ETHTOOL_LINK_MODE_MASK_NBITS);
+}
+
 static inline int linkmode_subset(const unsigned long *src1,
                                  const unsigned long *src2)
 {