Commit | Line | Data |
---|---|---|
b31cdffa AL |
1 | #ifndef __LINKMODE_H |
2 | #define __LINKMODE_H | |
3 | ||
4 | #include <linux/bitmap.h> | |
5 | #include <linux/ethtool.h> | |
6 | #include <uapi/linux/ethtool.h> | |
7 | ||
8 | static inline void linkmode_zero(unsigned long *dst) | |
9 | { | |
10 | bitmap_zero(dst, __ETHTOOL_LINK_MODE_MASK_NBITS); | |
11 | } | |
12 | ||
96fa96e1 RKO |
13 | static inline void linkmode_fill(unsigned long *dst) |
14 | { | |
15 | bitmap_fill(dst, __ETHTOOL_LINK_MODE_MASK_NBITS); | |
16 | } | |
17 | ||
b31cdffa AL |
18 | static inline void linkmode_copy(unsigned long *dst, const unsigned long *src) |
19 | { | |
20 | bitmap_copy(dst, src, __ETHTOOL_LINK_MODE_MASK_NBITS); | |
21 | } | |
22 | ||
23 | static inline void linkmode_and(unsigned long *dst, const unsigned long *a, | |
24 | const unsigned long *b) | |
25 | { | |
26 | bitmap_and(dst, a, b, __ETHTOOL_LINK_MODE_MASK_NBITS); | |
27 | } | |
28 | ||
29 | static inline void linkmode_or(unsigned long *dst, const unsigned long *a, | |
30 | const unsigned long *b) | |
31 | { | |
32 | bitmap_or(dst, a, b, __ETHTOOL_LINK_MODE_MASK_NBITS); | |
33 | } | |
34 | ||
35 | static inline bool linkmode_empty(const unsigned long *src) | |
36 | { | |
37 | return bitmap_empty(src, __ETHTOOL_LINK_MODE_MASK_NBITS); | |
38 | } | |
39 | ||
40 | static inline int linkmode_andnot(unsigned long *dst, const unsigned long *src1, | |
41 | const unsigned long *src2) | |
42 | { | |
43 | return bitmap_andnot(dst, src1, src2, __ETHTOOL_LINK_MODE_MASK_NBITS); | |
44 | } | |
45 | ||
8fab6a9d AL |
46 | #define linkmode_test_bit test_bit |
47 | #define linkmode_set_bit __set_bit | |
48 | #define linkmode_clear_bit __clear_bit | |
49 | #define linkmode_mod_bit __assign_bit | |
b31cdffa | 50 | |
20c6e05b JK |
51 | static inline void linkmode_set_bit_array(const int *array, int array_size, |
52 | unsigned long *addr) | |
53 | { | |
54 | int i; | |
55 | ||
56 | for (i = 0; i < array_size; i++) | |
57 | linkmode_set_bit(array[i], addr); | |
58 | } | |
59 | ||
b31cdffa AL |
60 | static inline int linkmode_equal(const unsigned long *src1, |
61 | const unsigned long *src2) | |
62 | { | |
63 | return bitmap_equal(src1, src2, __ETHTOOL_LINK_MODE_MASK_NBITS); | |
64 | } | |
65 | ||
e812916d AL |
66 | static inline int linkmode_intersects(const unsigned long *src1, |
67 | const unsigned long *src2) | |
68 | { | |
69 | return bitmap_intersects(src1, src2, __ETHTOOL_LINK_MODE_MASK_NBITS); | |
70 | } | |
71 | ||
554032cd RK |
72 | static inline int linkmode_subset(const unsigned long *src1, |
73 | const unsigned long *src2) | |
74 | { | |
75 | return bitmap_subset(src1, src2, __ETHTOOL_LINK_MODE_MASK_NBITS); | |
76 | } | |
77 | ||
a87ae8a9 RK |
78 | void linkmode_resolve_pause(const unsigned long *local_adv, |
79 | const unsigned long *partner_adv, | |
80 | bool *tx_pause, bool *rx_pause); | |
81 | ||
45c767fa RK |
82 | void linkmode_set_pause(unsigned long *advertisement, bool tx, bool rx); |
83 | ||
b31cdffa | 84 | #endif /* __LINKMODE_H */ |