rocker: fix internal_vlan_id assigment

I screwed up between v1 and v2 of last patch series and introduced a bug that
Jiri is hitting.  When installing flow tbl entries, the internal_vlan_id should
be the value cached in the rocker_port struct for phys in_ports.  For non- phys
in_port, the value is calculated based on in_port_ifindex.

Signed-off-by: Scott Feldman <sfeldma@gmail.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
rocker: split base tbls install apart into separate ig_port and vlan tables

We need to be able to install vlan tbl entries independent of ig_port tbl
entries, so split the base_tbl func into two funcs, one for ig_port and one
for vlans.

Signed-off-by: Scott Feldman <sfeldma@gmail.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
rocker: refine test for VLAN filtering vs. untagged

Signed-off-by: Scott Feldman <sfeldma@gmail.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
rocker: enable VLAN filter ops to install/remove VLAN tbl entries

Signed-off-by: Scott Feldman <sfeldma@gmail.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
net: add new swdev fdb ops to add/del bridge fdbs

Signed-off-by: Scott Feldman <sfeldma@gmail.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
swdev: add swdev fdb API to add/del bridge fdbs

Signed-off-by: Scott Feldman <sfeldma@gmail.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
net: add/del bridge fdbs to swdev

Signed-off-by: Scott Feldman <sfeldma@gmail.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
rocker: implement swdev fdb ops in driver to add/del bridge fdbs

Signed-off-by: Scott Feldman <sfeldma@gmail.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
rocker: fix spelling

Signed-off-by: Scott Feldman <sfeldma@gmail.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
rocker: remove promisc mode ctrl filters; they're coming back with STP

Signed-off-by: Scott Feldman <sfeldma@gmail.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
rocker: derive ACL tlb entry priority based on eth_dst specificity

Group ACL tbl entries into three priority categories: ctrl, normal, and dflt.
ctrl is for ctrl protocols such as LLDP.  dflt is for catch-alls such as
bcast/mcast flooding.  normal is for everything else.

Signed-off-by: Scott Feldman <sfeldma@gmail.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
rocker: use exact match on port if in_port is phys port in flow_parse

Signed-off-by: Scott Feldman <sfeldma@gmail.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
net: add new ndo_swdev_stp_update op and swdev wrapper

To notify switch driver of change in STP state of bridge port, add new
.ndo op and provide swdev wrapper func to call ndo op.

Signed-off-by: Scott Feldman <sfeldma@gmail.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
bridge: call swdev_stp_update when bridge port STP status changes

Signed-off-by: Scott Feldman <sfeldma@gmail.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
rocker: handle STP change notification

On STP notification from bridge, adjust port ctrl filters.  Port starts out
in DISABLED state.  On port open, state goes to BLOCKED.  Subsequent states
are achieved as the bridge negotiates STP with peers.  Ctrl filters installed
depends on STP state level.  For example, in BLOCKED state, only STP pkts and
a few IEEE 802 ctrl pkts (i.g. LACP) are allowed.

Signed-off-by: Scott Feldman <sfeldma@gmail.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
rocker: no need to mask of upper vlan bits

The driver (and device) pass around vlan ids using just the lower 12-bits, so
no meed to mask off the upper 4-bits from the 16-bit vlan id field.

Signed-off-by: Scott Feldman <sfeldma@gmail.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
rocker: add new FDB hash tbl in driver to track installed FDBs

The driver needs to keep track of FDB installed in HW when handling FDB events
from device or from user.  For the device, learned FDB entries are posted to
the driver using the EVENT queue.  The device may report multiple events
for a given FDB while it is being learned and installed into HW by the driver.
To avoid thrashing, use a new FDB hash table as the autourity as to what
FDBs have been installed in HW.  The same hash tbl tracks FDBs installed by
user using netlink.  Additionally, the hash tbl is used when flushing learned
macs on a port, when a port goes down.

Signed-off-by: Scott Feldman <sfeldma@gmail.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
bridge: add API to notify bridge driver of learned FBD on offloaded device

When the swdev device learns a new mac/vlan on a port, it sends some async
notification to the driver and the driver installs an FDB in the device.
To give a holistic system view, the learned mac/vlan should be reflected
in the bridge's FBD table, so the user, using normal iproute2 cmds, can view
what is currently learned by the device.  This API on the bridge driver gives
a way for the swdev driver to install an FBD entry in the bridge FBD table.
(And remove one).

This is equivalent to the device running these cmds:

  bridge fdb [add|del] <mac> dev <dev> vid <vlan id> master

This patch needs some extra eyeballs for review, in paricular around the
locking and contexts.

Signed-off-by: Scott Feldman <sfeldma@gmail.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
rocker: use fdb tbl to track learned or user-installed fdbs

Use fdb hash tbl to track add/del of FDBs, either due to device learning event,
or due to manually installed FDB using iproute2.

Signed-off-by: Scott Feldman <sfeldma@gmail.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
rocker: add mac/vlan seen event support to install learned FDBs

Add event handler for mac/vlan seen events and call FDB installer.  The event
is async from the device when a new mac/vlan is seen on a port.  The driver
is signalled in IRQ context of the event and in response, should install an
FBD entry into the device (and notify the bridge driver of new FDB entry).
There may be some delay from event generation by device and when FDB entry is
installed in device, so the device may send multiple events before the FBD
is fully installed.

Signed-off-by: Scott Feldman <sfeldma@gmail.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>