diff options
author | Greg Kroah-Hartman <gregkh@google.com> | 2019-02-23 10:12:45 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@google.com> | 2019-02-23 10:12:45 +0100 |
commit | a99ac1920cdf2c5906d74b41f026f34194b512ea (patch) | |
tree | 582bb604c5ab9cd7865fed2303160feb317cb05e /include/linux/netdev_features.h | |
parent | d93cfb73cdfc89c4e1a22297872b457fd7e99fd4 (diff) | |
parent | af13f43f01a3e4a11686f5fa4de42ecec8ed71b1 (diff) |
Merge 4.4.176 into android-4.4-p
Changes in 4.4.176
net: fix IPv6 prefix route residue
vsock: cope with memory allocation failure at socket creation time
hwmon: (lm80) Fix missing unlock on error in set_fan_div()
net: Fix for_each_netdev_feature on Big endian
sky2: Increase D3 delay again
net: Add header for usage of fls64()
tcp: tcp_v4_err() should be more careful
net: Do not allocate page fragments that are not skb aligned
tcp: clear icsk_backoff in tcp_write_queue_purge()
vxlan: test dev->flags & IFF_UP before calling netif_rx()
net: stmmac: Fix a race in EEE enable callback
net: ipv4: use a dedicated counter for icmp_v4 redirect packets
x86: livepatch: Treat R_X86_64_PLT32 as R_X86_64_PC32
kvm: fix kvm_ioctl_create_device() reference counting (CVE-2019-6974)
mfd: as3722: Handle interrupts on suspend
mfd: as3722: Mark PM functions as __maybe_unused
net/x25: do not hold the cpu too long in x25_new_lci()
mISDN: fix a race in dev_expire_timer()
ax25: fix possible use-after-free
KVM: VMX: Fix x2apic check in vmx_msr_bitmap_mode()
Linux 4.4.176
Change-Id: I82b10bb7d9692d4fe0386744934f09557d65ffe6
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'include/linux/netdev_features.h')
-rw-r--r-- | include/linux/netdev_features.h | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h index f0d87347df19..0508fcc67480 100644 --- a/include/linux/netdev_features.h +++ b/include/linux/netdev_features.h @@ -11,6 +11,8 @@ #define _LINUX_NETDEV_FEATURES_H #include <linux/types.h> +#include <linux/bitops.h> +#include <asm/byteorder.h> typedef u64 netdev_features_t; @@ -125,8 +127,26 @@ enum { #define NETIF_F_HW_L2FW_DOFFLOAD __NETIF_F(HW_L2FW_DOFFLOAD) #define NETIF_F_BUSY_POLL __NETIF_F(BUSY_POLL) -#define for_each_netdev_feature(mask_addr, bit) \ - for_each_set_bit(bit, (unsigned long *)mask_addr, NETDEV_FEATURE_COUNT) +/* Finds the next feature with the highest number of the range of start till 0. + */ +static inline int find_next_netdev_feature(u64 feature, unsigned long start) +{ + /* like BITMAP_LAST_WORD_MASK() for u64 + * this sets the most significant 64 - start to 0. + */ + feature &= ~0ULL >> (-start & ((sizeof(feature) * 8) - 1)); + + return fls64(feature) - 1; +} + +/* This goes for the MSB to the LSB through the set feature bits, + * mask_addr should be a u64 and bit an int + */ +#define for_each_netdev_feature(mask_addr, bit) \ + for ((bit) = find_next_netdev_feature((mask_addr), \ + NETDEV_FEATURE_COUNT); \ + (bit) >= 0; \ + (bit) = find_next_netdev_feature((mask_addr), (bit) - 1)) /* Features valid for ethtool to change */ /* = all defined minus driver/device-class-related */ |