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>

v2:
	drop can_share and don't add unshared MBSS to
	global list (Johannes)
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 <bob@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 <bob@cozybit.com>

v2:
	kernel-doc fixes (Johannes)
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: 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.

Also update the congestion detection logic to take into
account a possibly different outgoing interface.

Signed-off-by: Thomas Pedersen <thomas@cozybit.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>
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 <bob@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-addressed 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 <bob@cozybit.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 <bob@cozybit.com>
{nl,mac}80211: specify MBSS sharing on/off

Allow the user to choose whether a newly joined MBSS
should be shared with other matching interfaces.

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>
mac80211: handle headroom for multi-if mesh

When a frame is forwarded across different interfaces
belonging to the same MBSS, the headroom requirements for
each interface may differ.

Expand the skb head if the headroom does not match that
required by the outgoing interface.

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