Commit 74694e7b authored by Wei Yongjun's avatar Wei Yongjun Committed by David S. Miller

bridge: using for_each_set_bit to simplify the code

Using for_each_set_bit() to simplify the code.
Signed-off-by: default avatarWei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5096e3c4
...@@ -722,13 +722,10 @@ int br_fdb_add(struct ndmsg *ndm, struct nlattr *tb[], ...@@ -722,13 +722,10 @@ int br_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
* specify a VLAN. To be nice, add/update entry for every * specify a VLAN. To be nice, add/update entry for every
* vlan on this port. * vlan on this port.
*/ */
vid = find_first_bit(pv->vlan_bitmap, BR_VLAN_BITMAP_LEN); for_each_set_bit(vid, pv->vlan_bitmap, BR_VLAN_BITMAP_LEN) {
while (vid < BR_VLAN_BITMAP_LEN) {
err = __br_fdb_add(ndm, p, addr, nlh_flags, vid); err = __br_fdb_add(ndm, p, addr, nlh_flags, vid);
if (err) if (err)
goto out; goto out;
vid = find_next_bit(pv->vlan_bitmap,
BR_VLAN_BITMAP_LEN, vid+1);
} }
} }
...@@ -813,11 +810,8 @@ int br_fdb_delete(struct ndmsg *ndm, struct nlattr *tb[], ...@@ -813,11 +810,8 @@ int br_fdb_delete(struct ndmsg *ndm, struct nlattr *tb[],
* vlan on this port. * vlan on this port.
*/ */
err = -ENOENT; err = -ENOENT;
vid = find_first_bit(pv->vlan_bitmap, BR_VLAN_BITMAP_LEN); for_each_set_bit(vid, pv->vlan_bitmap, BR_VLAN_BITMAP_LEN) {
while (vid < BR_VLAN_BITMAP_LEN) {
err &= __br_fdb_delete(p, addr, vid); err &= __br_fdb_delete(p, addr, vid);
vid = find_next_bit(pv->vlan_bitmap,
BR_VLAN_BITMAP_LEN, vid+1);
} }
} }
out: out:
......
...@@ -136,10 +136,7 @@ static int br_fill_ifinfo(struct sk_buff *skb, ...@@ -136,10 +136,7 @@ static int br_fill_ifinfo(struct sk_buff *skb,
goto nla_put_failure; goto nla_put_failure;
pvid = br_get_pvid(pv); pvid = br_get_pvid(pv);
for (vid = find_first_bit(pv->vlan_bitmap, BR_VLAN_BITMAP_LEN); for_each_set_bit(vid, pv->vlan_bitmap, BR_VLAN_BITMAP_LEN) {
vid < BR_VLAN_BITMAP_LEN;
vid = find_next_bit(pv->vlan_bitmap,
BR_VLAN_BITMAP_LEN, vid+1)) {
vinfo.vid = vid; vinfo.vid = vid;
vinfo.flags = 0; vinfo.flags = 0;
if (vid == pvid) if (vid == pvid)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment