Commit b5f1d9ec authored by Nikolay Aleksandrov's avatar Nikolay Aleksandrov Committed by David S. Miller

net: bridge: add a flag to avoid refreshing fdb when changing/adding

When we modify or create a new fdb entry sometimes we want to avoid
refreshing its activity in order to track it properly. One example is
when a mac is received from EVPN multi-homing peer by FRR, which doesn't
want to change local activity accounting. It makes it static and sets a
flag to track its activity.
Signed-off-by: default avatarNikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 31cbc39b
...@@ -191,6 +191,7 @@ enum { ...@@ -191,6 +191,7 @@ enum {
enum { enum {
NFEA_UNSPEC, NFEA_UNSPEC,
NFEA_ACTIVITY_NOTIFY, NFEA_ACTIVITY_NOTIFY,
NFEA_DONT_REFRESH,
__NFEA_MAX __NFEA_MAX
}; };
#define NFEA_MAX (__NFEA_MAX - 1) #define NFEA_MAX (__NFEA_MAX - 1)
......
...@@ -860,6 +860,7 @@ static int fdb_add_entry(struct net_bridge *br, struct net_bridge_port *source, ...@@ -860,6 +860,7 @@ static int fdb_add_entry(struct net_bridge *br, struct net_bridge_port *source,
struct nlattr *nfea_tb[]) struct nlattr *nfea_tb[])
{ {
bool is_sticky = !!(ndm->ndm_flags & NTF_STICKY); bool is_sticky = !!(ndm->ndm_flags & NTF_STICKY);
bool refresh = !nfea_tb[NFEA_DONT_REFRESH];
struct net_bridge_fdb_entry *fdb; struct net_bridge_fdb_entry *fdb;
u16 state = ndm->ndm_state; u16 state = ndm->ndm_state;
bool modified = false; bool modified = false;
...@@ -937,7 +938,8 @@ static int fdb_add_entry(struct net_bridge *br, struct net_bridge_port *source, ...@@ -937,7 +938,8 @@ static int fdb_add_entry(struct net_bridge *br, struct net_bridge_port *source,
fdb->used = jiffies; fdb->used = jiffies;
if (modified) { if (modified) {
fdb->updated = jiffies; if (refresh)
fdb->updated = jiffies;
fdb_notify(br, fdb, RTM_NEWNEIGH, true); fdb_notify(br, fdb, RTM_NEWNEIGH, true);
} }
...@@ -977,6 +979,7 @@ static int __br_fdb_add(struct ndmsg *ndm, struct net_bridge *br, ...@@ -977,6 +979,7 @@ static int __br_fdb_add(struct ndmsg *ndm, struct net_bridge *br,
static const struct nla_policy br_nda_fdb_pol[NFEA_MAX + 1] = { static const struct nla_policy br_nda_fdb_pol[NFEA_MAX + 1] = {
[NFEA_ACTIVITY_NOTIFY] = { .type = NLA_U8 }, [NFEA_ACTIVITY_NOTIFY] = { .type = NLA_U8 },
[NFEA_DONT_REFRESH] = { .type = NLA_FLAG },
}; };
/* Add new permanent fdb entry with RTM_NEWNEIGH */ /* Add new permanent fdb entry with RTM_NEWNEIGH */
......
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