Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F107170317
D46037.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D46037.diff
View Options
diff --git a/sys/dev/axgbe/xgbe-dev.c b/sys/dev/axgbe/xgbe-dev.c
--- a/sys/dev/axgbe/xgbe-dev.c
+++ b/sys/dev/axgbe/xgbe-dev.c
@@ -826,7 +826,7 @@
xgbe_update_vlan_hash_table(struct xgbe_prv_data *pdata)
{
uint32_t crc;
- uint16_t vid;
+ size_t vid;
uint16_t vlan_hash_table = 0;
__le16 vid_le = 0;
@@ -834,14 +834,13 @@
XGMAC_IOREAD(pdata, MAC_VLANHTR));
/* Generate the VLAN Hash Table value */
- for_each_set_bit(vid, pdata->active_vlans, VLAN_NVID) {
-
+ bit_foreach(pdata->active_vlans, VLAN_NVID, vid) {
/* Get the CRC32 value of the VLAN ID */
vid_le = cpu_to_le16(vid);
crc = bitrev32(~xgbe_vid_crc32_le(vid_le)) >> 28;
vlan_hash_table |= (1 << crc);
- axgbe_printf(1, "%s: vid 0x%x vid_le 0x%x crc 0x%x "
+ axgbe_printf(1, "%s: vid 0x%lx vid_le 0x%x crc 0x%x "
"vlan_hash_table 0x%x\n", __func__, vid, vid_le, crc,
vlan_hash_table);
}
diff --git a/sys/dev/axgbe/xgbe_osdep.h b/sys/dev/axgbe/xgbe_osdep.h
--- a/sys/dev/axgbe/xgbe_osdep.h
+++ b/sys/dev/axgbe/xgbe_osdep.h
@@ -56,11 +56,6 @@
#define le32_to_cpu(x) htole32(x)
#define cpu_to_le16(x) htole16(x)
-#define for_each_set_bit(bit, addr, size) \
- for ((bit) = find_first_bit((addr), (size)); \
- (bit) < (size); \
- (bit) = find_next_bit((addr), (size), (bit) + 1))
-
typedef struct mtx spinlock_t;
static inline void
@@ -241,65 +236,4 @@
return (order); /* We could be slightly more clever with -1 here... */
}
-static inline unsigned long
-find_next_bit(const unsigned long *addr, unsigned long size, unsigned long offset)
-{
- long mask;
- int offs;
- int bit;
- int pos;
-
- if (offset >= size)
- return (size);
- pos = offset / BITS_PER_LONG;
- offs = offset % BITS_PER_LONG;
- bit = BITS_PER_LONG * pos;
- addr += pos;
- if (offs) {
- mask = (*addr) & ~BITMAP_LAST_WORD_MASK(offs);
- if (mask)
- return (bit + __ffsl(mask));
- if (size - bit <= BITS_PER_LONG)
- return (size);
- bit += BITS_PER_LONG;
- addr++;
- }
- for (size -= bit; size >= BITS_PER_LONG;
- size -= BITS_PER_LONG, bit += BITS_PER_LONG, addr++) {
- if (*addr == 0)
- continue;
- return (bit + __ffsl(*addr));
- }
- if (size) {
- mask = (*addr) & BITMAP_LAST_WORD_MASK(size);
- if (mask)
- bit += __ffsl(mask);
- else
- bit += size;
- }
- return (bit);
-}
-
-static inline unsigned long
-find_first_bit(const unsigned long *addr, unsigned long size)
-{
- long mask;
- int bit;
-
- for (bit = 0; size >= BITS_PER_LONG;
- size -= BITS_PER_LONG, bit += BITS_PER_LONG, addr++) {
- if (*addr == 0)
- continue;
- return (bit + __ffsl(*addr));
- }
- if (size) {
- mask = (*addr) & BITMAP_LAST_WORD_MASK(size);
- if (mask)
- bit += __ffsl(mask);
- else
- bit += size;
- }
- return (bit);
-}
-
#endif /* _XGBE_OSDEP_H_ */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Jan 12, 4:58 AM (20 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15761442
Default Alt Text
D46037.diff (2 KB)
Attached To
Mode
D46037: axgbe: use bit_foreach
Attached
Detach File
Event Timeline
Log In to Comment