mac80211: track and share mesh BSSes among interfaces

Add a new global list of mesh BSSes for this host.  Each struct
mesh_local_bss contains parameters specific to a mesh instance,
as well as a list of interfaces participating in the MBSS.  This
will enable lookup of other interfaces on the host participating
in the same mesh.

Signed-off-by: Bob Copeland <bob@cozybit.com>
mac80211: mesh: add function to tx on all other mbss ifaces

Add a function to rebroadcast mcast/bcast frames on other
interfaces when multiple interfaces are shared in an mbss.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
mac80211: stop device queues on leaving mesh

Do this before MBSS removal, so we don't race with
mesh_local_bss_forward().

Signed-off-by: Thomas Pedersen <thomas@cozybit.com>
mac80211: use all MBSS interfaces for path selection

Change the HWMP path selection code to establish paths using
all interfaces participating in a shared mbss.  This means that
group-addressed action frames like PREQ will go out on each
interface, while individually addressed frames use whichever
interface has the destination as a peer.

When processing received frames, consider it a match if any
local interface in the mbss matches the target address.

Finally, mesh_path_lookup() now scans the path table on each
interface until a path (if any) is found so that paths can
be shared among the interfaces.

[ PERR/unicast frame handling fixes from Thomas Pedersen ]

Signed-off-by: Bob Copeland <me@bobcopeland.com>
mac80211: assign outgoing interface with nexthop

When updated mpath routing info is found, the new route
may be on a different interface (in the case of MBSS
sharing).

Signed-off-by: Thomas Pedersen <thomas@cozybit.com>
mac80211: hash mpath according to MBSS

Since the mpath->sdata might change over the lifetime of
an mpath, generate a hash bucket index from something
which doesn't: the mesh ID.

Signed-off-by: Thomas Pedersen <thomas@cozybit.com>
mac80211: hwmp: clear up mesh_path_lookup() API

mesh_path_lookup() would take an sdata, but really search
the sdata list attached to the MBSS, so pass the MBSS
instead to make it clear the resulting mpath is tied to an
unknown interface.

This patch should have no functional changes.

Signed-off-by: Thomas Pedersen <thomas@cozybit.com>
mac80211: make RMC per-mbss

The RMC was previously per-sdata, but it is sufficient for
one of the interfaces in a local mbss to receive a
multicast frame once.

Once multiple interfaces share the same mesh data forwarding
duties, we may inadvertently create a multicast routing loop
and have a corner case where a multicast frame is
retransmitted a few times too many.

Signed-off-by: Thomas Pedersen <thomas@cozybit.com>
mac80211: forward group frames on mbss-shared interfaces

When multiple local interfaces are in the same MBSS, we should
forward group-directed data frames received on one interface
for transmit on the other interfaces, so that the frames may be
seen on other channels.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
mac80211: forward frames on correct mbss-shared interface

A forwarded frame may have a destination STA which resides
on a vif other than the RX interface. Have
mesh_nexthop_lookup() fill in the right outgoing sdata in
the skb control block.

Signed-off-by: Thomas Pedersen <thomas@cozybit.com>
mac80211: fix mesh forwarding congestion detection

Now the outgoing interface may be different from the
incoming one in the forwarding path, don't check for
stopped queues until the outgoing interface has been
resolved.

Signed-off-by: Thomas Pedersen <thomas@cozybit.com>
mac80211: add shared-mbss transmit path

Transmit locally-originated group data frames on every interface
so that members of the mesh on every channel will see the frame.

For individually-directed frames, when we resolve the next
hop, the outgoing interface might be different than the
originator if the best path is on a different channel.
Requeue such frames on the correct interface's pending queue.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
mac08211: add shared-mbss receive path handling

If a destination interface is participating in a shared mbss, then
receive data frames on the correct interface (or all for mcast) when
passing frames to upper layers.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
mac80211: notify bridge when leaving mesh

After turning carrier off, any parent bridge interface
needs to be notified. Otherwise we would see a panic when
attempting to transmit frames on a mesh interface which
hadn't yet been put down.

Signed-off-by: Thomas Pedersen <thomas@cozybit.com>
nl80211: specify per-vif or shared MBSS

Signed-off-by: Thomas Pedersen <thomas@cozybit.com>
nl80211: MBSS sharing defaults to on

If the user joins two MBSSes with matching mesh IDs on the
same host, they would probably expect automatic
forwarding.

Signed-off-by: Thomas Pedersen <thomas@cozybit.com>
{nl,mac}80211: allow mpath dump to span local MBSS

Allow the user to specify a flag
NL80211_ATTR_MPATH_DUMP_MBSS along with an mpath dump
request to dump all paths in the interface's mbss.

Signed-off-by: Thomas Pedersen <thomas@cozybit.com>

Conflicts:
	include/uapi/linux/nl80211.h
	net/mac80211/mesh_pathtbl.c