Steal flow_key definition from OVS, with a few tweaks

Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com>
Add dma.c implemention for desc ring operations

Add a new dma.c for DMA desc ring implementation.  The consolidates all desc
ring opertions into one place and hides the desc ring implemention details from
client code.  Add some notes to reg_guide about ring empty, ring full
conditions.  Add callback for Tx and DMA rings to process descs.  (Rx and Event
rings don't need a consumer callbacks into driver since the driver is the
producer of those descs).  Add sanity check for ring overrun, underrun
conditions as well as alignment issues and DPRINTF errs.  On HEAD write,
automatically process descriptors and generate interrupt for desc ring if work
was done (and interrupt for that ring is unmasked).

I believe at this point we have what we need to process Tx and CMD rings.  Just
need the matching driver code and TLV parses for descs.

Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com>
Add Tx/Rx/Cmd desc ring processing.

Compiles clean but untested.  (Need kernel driver matching changes).

The tx path is complete except for the tx offloads.  Any tx desc queued up by
the driver should end up sent out the qemu netdev.  The rx path is complete
except for the Rx csum and flag parsing.  The idea is the rx_produce() will be
called from the Flow or L2/L3 ig() handler (for pkts dst to CPU).

Oh, CMD processing is hooked up also.  Just stubbed out for individual cmds.
It seems we might want to make first TLV in buf the actual cmd TLV, otherwise
we need to walk TLV list looking for cmd.  Maybe there is a better way?

Use rocker_tlv structure with template structures for value field.  This gives
us a couple of things: 1) size of value is available with
sizeof(tlv->value->field), 2) endianess of field is specified (documented) by
value field type, 3) tlv->value->field can be lvalue or rvalue and compiler
does type checking, 4) compound fields (e.g. tx_frags) are natuarally specifed
using sub-struct, 5) arrays of same-type field specified with value[0] for
run-time array size calculation (array size = TLV_SIZE(tlv) / sizeof(value[0]).

There is a little bit more work to do on the TLV_xxx macros to make sure tlv
reads/write to/from cpu use lexx_to_cpu/cpu_to_lexx.

Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com>
Add switch world framework

Add framework for switch world modules.  A front-panel port belongs to one
world.  Add three worlds, dead, flow and l2l3 to rocker.  Dead world is the
default which does nothing except drop all ingress traffic on front-panel
ports.
implement tlv_parse
implement port set/get settings
rocker: add irq_status setter

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
rocker: implement link up/down propagation

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
rocker: implement switch ID propagation

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
rocker: implement bogus registers reads

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
rocker: get rid of r->fp_ports and always use fp_port->enabled value

No need to duplicate the enabled info. Just leave it in the port struct.
Adjust the relevatn piece of red_guide as well and add debug
enabled/disabled print.

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
rocker: fix order of PORT_PHYS_ENABLE read/write to match _hw.h

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
rocker: remove dead world and make l2l3 default

There is no meaning for dead world. Also, mode bitarray does not allow
to expose "mode dead" to driver. So just make l2l3 default one.

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
rocker: allow to get which world a port is in

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
rocker: implement rd/wr of PORT_PHYS_MODE

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
rocker: implement pci reset

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
rocker: implement pci reset

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
rocker: introduce control register and  implement sw reset

le/be switching is removed for now. Can be reintroduced as a bits of
control register.

Signed-off-by: Jiri Pirko <jiri@resnulli.us>