rocker: add rocker_port_to_lport() helper to get lport from rocker_port

Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com>
Acked-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
rocker: set OF-DPA tbl IDs according to OF-DPA spec

Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com>
Acked-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
rocker: rename OF-DPA flows stat macros to match device

Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com>
Acked-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
rocker: update group macros to match device and add group ID set/get macros

Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com>
Acked-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
rocker: add OF-DPA flow and group hash tables

Add flow and group hash tables to track entries installed to HW.  A reference
count is keep on each entry so that multiple references by sw_flows to a
particular flow or group table entry can be tracks.  When the reference count
for a particular table entry reaches zero, the entry is deleted.  Flow table
entries are hashed by a key made up fields specific to OF-DPA flow table.  The
single flow hash table stores entries for all OF-DPA flow tables.  Group table
entries are hashed by group ID, which is defined to be unique for OF-DPA
groups.  The group ID typically encodes group type and other parameters
specific to that group type.

The general flow, on sw_flow add/del, is to parse the sw_flow and
install/remove the representative HW table entries.  Since a sw_flow maps to
multiple HW tables, and many sw_flows share same HW table entries, the hash
table track reference count and only removes the HW table entry when the hash
table entry reference count reaches zero.

Use kzalloc to zero out struct rocker to start hash table counters at zero.

Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com>
Acked-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
rocker: remove cmds for bridge and unicast flows

sw_flows need to be broken down into various OF-DPA table entries, so this
sw_flow parsing code needs to be rewritten to align with OF-DPA tables (flow
and group tables).  A lot of this code gets resused in subsequent patches, but
to improve patch readability, do a wholesale remove first, and then re-add code
one step at a time to see build-up.

Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com>
Acked-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
rocker: add sw_flow parsing and OF-DPA flow table management

For add/del of sw_flows, parse sw_flow into OF-DPA constituent parts and
install entries into OF-DPA tables.  A hashed flow table tracks references to
flow table entries installed in HW.  The key to the hash table is a crc32 of
key fields of the OF-DPA table entry.  The hash table entry has a unique cookie
value (not derived from sw_flow *) which is passed down to HW and used for
removal of the entry in HW.

Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com>
Acked-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
rocker: add flow parse for VLAN table

Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com>
Acked-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
rocker: add vlan unicast bridging and group support for L2 interface groups

Parse sw_flow for VLAN unicast bridging and add/del into bridge table.  Also,
add group table support for L2 interface group.  VLAN unicast bridging need L2
interface group as target for output port, so these two are dependent and it's
hard to break into two separate patches.

The group table is hashed by u32 group_id.

Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com>
Acked-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
rocker: add vlan mcast bridging support and group support for L2 mcast groups

Parse sw_flow for VLAN mcast bridging and add/del bridging table entry.  Also
add/del L2 mcast group support.  L2 mcast group has a list of L2 interface
group IDs to flood output pkts to.  The group ID list is kept sorted for
comparision purposes with existing L2 mcast groups.  If a new list is created,
a unique index is used to construct the group ID for the group.

Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com>
Acked-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
rocker: add ACL tbl support

Parse sw_flow for and add/del ACL table entry.

Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com>
Acked-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
rocker: add promisc mode support

OVS will put swdev port into promisc mode when port is admin UP.  On promisc
mode, install some ACL rules to allow certain pkts to ingress on swdev port up
to controller.  In particular, allow and ARP/IP pkts as well as LLDP mcast
pkts.  The ACL rules are installed at the lower priority, so any more-specific
ACL rules will override these default rules installed when swdev is put into
promisc mode.  When swdev port goes admin DOWN, promisc mode is dropped and ACL
rules are uninstalled.

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