[Bridge] [PATCH net-next 4/6] net: bridge: add __br_mdb_do

2017-05-17 Thread Vivien Didelot
br_mdb_add and br_mdb_del call respectively __br_mdb_add and __br_mdb_del and notify the message type on success. Factorize this in a new __br_mdb_do function which add or delete a br_mdb_entry depending on the message type, then notify it. Note that the dev argument is p->br->dev, so no need to

[Bridge] [PATCH net-next 1/6] net: bridge: pass net_bridge_port to __br_mdb_add

2017-05-17 Thread Vivien Didelot
The __br_mdb_add function uses exactly the same mechanism as its caller br_mdb_add to retrieve the net_bridge_port pointer from br_mdb_entry. Remove it and pass directly the net_bridge_port pointer to __br_mdb_add. Signed-off-by: Vivien Didelot ---

[Bridge] [PATCH net-next 5/6] net: bridge: get msgtype from nlmsghdr in mdb ops

2017-05-17 Thread Vivien Didelot
Retrieve the message type from the nlmsghdr structure instead of hardcoding it in both br_mdb_add and br_mdb_del. Signed-off-by: Vivien Didelot --- net/bridge/br_mdb.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git

[Bridge] [PATCH net-next 2/6] net: bridge: check multicast bridge only once

2017-05-17 Thread Vivien Didelot
__br_mdb_add and __br_mdb_del both check that the bridge is up and running and that multicast is enabled on it before doing any operation. Since they can be called multiple times by br_mdb_add and br_mdb_del, move the check in their caller functions so that it is done just once. Signed-off-by:

[Bridge] [PATCH net-next 3/6] net: bridge: break if __br_mdb_del fails

2017-05-17 Thread Vivien Didelot
Be symmetric with br_mdb_add and break if __br_mdb_del returns an error. Signed-off-by: Vivien Didelot --- net/bridge/br_mdb.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/net/bridge/br_mdb.c b/net/bridge/br_mdb.c index