net: bridge: fdb: convert is_sticky to bitops
Straight-forward convert of the is_sticky field to bitops. Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
29e63fffd6
commit
e0458d9a73
|
@ -509,7 +509,6 @@ static struct net_bridge_fdb_entry *fdb_create(struct net_bridge *br,
|
||||||
fdb->added_by_user = 0;
|
fdb->added_by_user = 0;
|
||||||
fdb->added_by_external_learn = 0;
|
fdb->added_by_external_learn = 0;
|
||||||
fdb->offloaded = 0;
|
fdb->offloaded = 0;
|
||||||
fdb->is_sticky = 0;
|
|
||||||
fdb->updated = fdb->used = jiffies;
|
fdb->updated = fdb->used = jiffies;
|
||||||
if (rhashtable_lookup_insert_fast(&br->fdb_hash_tbl,
|
if (rhashtable_lookup_insert_fast(&br->fdb_hash_tbl,
|
||||||
&fdb->rhnode,
|
&fdb->rhnode,
|
||||||
|
@ -590,7 +589,8 @@ void br_fdb_update(struct net_bridge *br, struct net_bridge_port *source,
|
||||||
unsigned long now = jiffies;
|
unsigned long now = jiffies;
|
||||||
|
|
||||||
/* fastpath: update of existing entry */
|
/* fastpath: update of existing entry */
|
||||||
if (unlikely(source != fdb->dst && !fdb->is_sticky)) {
|
if (unlikely(source != fdb->dst &&
|
||||||
|
!test_bit(BR_FDB_STICKY, &fdb->flags))) {
|
||||||
fdb->dst = source;
|
fdb->dst = source;
|
||||||
fdb_modified = true;
|
fdb_modified = true;
|
||||||
/* Take over HW learned entry */
|
/* Take over HW learned entry */
|
||||||
|
@ -662,7 +662,7 @@ static int fdb_fill_info(struct sk_buff *skb, const struct net_bridge *br,
|
||||||
ndm->ndm_flags |= NTF_OFFLOADED;
|
ndm->ndm_flags |= NTF_OFFLOADED;
|
||||||
if (fdb->added_by_external_learn)
|
if (fdb->added_by_external_learn)
|
||||||
ndm->ndm_flags |= NTF_EXT_LEARNED;
|
ndm->ndm_flags |= NTF_EXT_LEARNED;
|
||||||
if (fdb->is_sticky)
|
if (test_bit(BR_FDB_STICKY, &fdb->flags))
|
||||||
ndm->ndm_flags |= NTF_STICKY;
|
ndm->ndm_flags |= NTF_STICKY;
|
||||||
|
|
||||||
if (nla_put(skb, NDA_LLADDR, ETH_ALEN, &fdb->key.addr))
|
if (nla_put(skb, NDA_LLADDR, ETH_ALEN, &fdb->key.addr))
|
||||||
|
@ -809,7 +809,7 @@ static int fdb_add_entry(struct net_bridge *br, struct net_bridge_port *source,
|
||||||
const u8 *addr, u16 state, u16 flags, u16 vid,
|
const u8 *addr, u16 state, u16 flags, u16 vid,
|
||||||
u8 ndm_flags)
|
u8 ndm_flags)
|
||||||
{
|
{
|
||||||
u8 is_sticky = !!(ndm_flags & NTF_STICKY);
|
bool is_sticky = !!(ndm_flags & NTF_STICKY);
|
||||||
struct net_bridge_fdb_entry *fdb;
|
struct net_bridge_fdb_entry *fdb;
|
||||||
bool modified = false;
|
bool modified = false;
|
||||||
|
|
||||||
|
@ -866,8 +866,8 @@ static int fdb_add_entry(struct net_bridge *br, struct net_bridge_port *source,
|
||||||
modified = true;
|
modified = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_sticky != fdb->is_sticky) {
|
if (is_sticky != test_bit(BR_FDB_STICKY, &fdb->flags)) {
|
||||||
fdb->is_sticky = is_sticky;
|
change_bit(BR_FDB_STICKY, &fdb->flags);
|
||||||
modified = true;
|
modified = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -176,6 +176,7 @@ struct net_bridge_vlan_group {
|
||||||
enum {
|
enum {
|
||||||
BR_FDB_LOCAL,
|
BR_FDB_LOCAL,
|
||||||
BR_FDB_STATIC,
|
BR_FDB_STATIC,
|
||||||
|
BR_FDB_STICKY,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct net_bridge_fdb_key {
|
struct net_bridge_fdb_key {
|
||||||
|
@ -190,8 +191,7 @@ struct net_bridge_fdb_entry {
|
||||||
struct net_bridge_fdb_key key;
|
struct net_bridge_fdb_key key;
|
||||||
struct hlist_node fdb_node;
|
struct hlist_node fdb_node;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
unsigned char is_sticky:1,
|
unsigned char added_by_user:1,
|
||||||
added_by_user:1,
|
|
||||||
added_by_external_learn:1,
|
added_by_external_learn:1,
|
||||||
offloaded:1;
|
offloaded:1;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue