Nikolay Aleksandrov
2020-Jan-23 13:28 UTC
[Bridge] [PATCH net-next 1/4] net: bridge: check port state before br_allowed_egress
If we make sure that br_allowed_egress is called only when we have BR_STATE_FORWARDING state then we can avoid a test later when we add per-vlan state. Signed-off-by: Nikolay Aleksandrov <nikolay at cumulusnetworks.com> --- net/bridge/br_forward.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/bridge/br_forward.c b/net/bridge/br_forward.c index 86637000f275..7629b63f6f30 100644 --- a/net/bridge/br_forward.c +++ b/net/bridge/br_forward.c @@ -25,7 +25,7 @@ static inline int should_deliver(const struct net_bridge_port *p, vg = nbp_vlan_group_rcu(p); return ((p->flags & BR_HAIRPIN_MODE) || skb->dev != p->dev) && - br_allowed_egress(vg, skb) && p->state == BR_STATE_FORWARDING && + p->state == BR_STATE_FORWARDING && br_allowed_egress(vg, skb) && nbp_switchdev_allowed_egress(p, skb) && !br_skb_isolated(p, skb); } -- 2.21.0
Stephen Hemminger
2020-Jan-23 16:25 UTC
[Bridge] [PATCH net-next 1/4] net: bridge: check port state before br_allowed_egress
On Thu, 23 Jan 2020 15:28:04 +0200 Nikolay Aleksandrov <nikolay at cumulusnetworks.com> wrote:> return ((p->flags & BR_HAIRPIN_MODE) || skb->dev != p->dev) && > - br_allowed_egress(vg, skb) && p->state == BR_STATE_FORWARDING && > + p->state == BR_STATE_FORWARDING && br_allowed_egress(vg, skb) && > nbp_switchdev_allowed_egress(p, skb) && > !br_skb_isolated(p, skb); > }Maybe break this complex return for readability?