mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-02 15:18:19 +00:00
bridge: avoid unnecessary read of jiffies
Jiffies is volatile so read it once. Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Acked-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
9bcdef3288
commit
ca6d4480f8
2 changed files with 8 additions and 4 deletions
|
@ -592,13 +592,15 @@ void br_fdb_update(struct net_bridge *br, struct net_bridge_port *source,
|
||||||
br_warn(br, "received packet on %s with own address as source address (addr:%pM, vlan:%u)\n",
|
br_warn(br, "received packet on %s with own address as source address (addr:%pM, vlan:%u)\n",
|
||||||
source->dev->name, addr, vid);
|
source->dev->name, addr, vid);
|
||||||
} else {
|
} else {
|
||||||
|
unsigned long now = jiffies;
|
||||||
|
|
||||||
/* fastpath: update of existing entry */
|
/* fastpath: update of existing entry */
|
||||||
if (unlikely(source != fdb->dst)) {
|
if (unlikely(source != fdb->dst)) {
|
||||||
fdb->dst = source;
|
fdb->dst = source;
|
||||||
fdb_modified = true;
|
fdb_modified = true;
|
||||||
}
|
}
|
||||||
if (jiffies != fdb->updated)
|
if (now != fdb->updated)
|
||||||
fdb->updated = jiffies;
|
fdb->updated = now;
|
||||||
if (unlikely(added_by_user))
|
if (unlikely(added_by_user))
|
||||||
fdb->added_by_user = 1;
|
fdb->added_by_user = 1;
|
||||||
if (unlikely(fdb_modified))
|
if (unlikely(fdb_modified))
|
||||||
|
|
|
@ -195,11 +195,13 @@ int br_handle_frame_finish(struct net *net, struct sock *sk, struct sk_buff *skb
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dst) {
|
if (dst) {
|
||||||
|
unsigned long now = jiffies;
|
||||||
|
|
||||||
if (dst->is_local)
|
if (dst->is_local)
|
||||||
return br_pass_frame_up(skb);
|
return br_pass_frame_up(skb);
|
||||||
|
|
||||||
if (jiffies != dst->used)
|
if (now != dst->used)
|
||||||
dst->used = jiffies;
|
dst->used = now;
|
||||||
br_forward(dst->dst, skb, local_rcv, false);
|
br_forward(dst->dst, skb, local_rcv, false);
|
||||||
} else {
|
} else {
|
||||||
if (!mcast_hit)
|
if (!mcast_hit)
|
||||||
|
|
Loading…
Reference in a new issue