Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f350a0a8 authored by Jiri Pirko's avatar Jiri Pirko Committed by David S. Miller
Browse files

bridge: use rx_handler_data pointer to store net_bridge_port pointer



Register net_bridge_port pointer as rx_handler data pointer. As br_port is
removed from struct net_device, another netdev priv_flag is added to indicate
the device serves as a bridge port. Also rcuized pointers are now correctly
dereferenced in br_fdb.c and in netfilter parts.

Signed-off-by: default avatarJiri Pirko <jpirko@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a35e2c1b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -5718,7 +5718,7 @@ static void dev_set_promiscuous(struct net_device *dev, struct dev_priv *priv,
		 * from the bridge.
		 */
		if ((hw->features & STP_SUPPORT) && !promiscuous &&
				dev->br_port) {
		    (dev->priv_flags & IFF_BRIDGE_PORT)) {
			struct ksz_switch *sw = hw->ksz_switch;
			int port = priv->port.first_port;

+1 −1
Original line number Diff line number Diff line
@@ -71,7 +71,7 @@ static int is_valid_iface(struct net_device *net_dev)
#endif

	/* Device is being bridged */
	/* if (net_dev->br_port != NULL)
	/* if (net_dev->priv_flags & IFF_BRIDGE_PORT)
		return 0; */

	return 1;
+1 −0
Original line number Diff line number Diff line
@@ -74,6 +74,7 @@
#define IFF_IN_NETPOLL	0x1000		/* whether we are processing netpoll */
#define IFF_DISABLE_NETPOLL	0x2000	/* disable netpoll at run-time */
#define IFF_MACVLAN_PORT	0x4000	/* device used as macvlan port */
#define IFF_BRIDGE_PORT	0x8000		/* device used as bridge port */

#define IF_GET_IFACE	0x0001		/* for querying only */
#define IF_GET_PROTO	0x0002
+0 −2
Original line number Diff line number Diff line
@@ -1047,8 +1047,6 @@ struct net_device {
	/* mid-layer private */
	void			*ml_priv;

	/* bridge stuff */
	struct net_bridge_port	*br_port;
	/* GARP */
	struct garp_port	*garp_port;

+2 −2
Original line number Diff line number Diff line
@@ -242,11 +242,11 @@ int br_fdb_test_addr(struct net_device *dev, unsigned char *addr)
	struct net_bridge_fdb_entry *fdb;
	int ret;

	if (!dev->br_port)
	if (!br_port_exists(dev))
		return 0;

	rcu_read_lock();
	fdb = __br_fdb_get(dev->br_port->br, addr);
	fdb = __br_fdb_get(br_port_get_rcu(dev)->br, addr);
	ret = fdb && fdb->dst->dev != dev &&
		fdb->dst->state == BR_STATE_FORWARDING;
	rcu_read_unlock();
Loading