openvswitch: add support for datapath hardware offload

Benefit from the possibility to work with flows in switch devices and
use the swdev api to offload flow datapath.

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

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
rocker: check PCI region size

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
rocker: implement port enable/disable

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
rocker: perform sw reset of chip during probe

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
rocker: use GFP_DMA for dma test buffer allocation

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
rocker: add DMA related register definitions and other stuff

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
rocker: impement DMA rings and descs manipulation

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
rocker: impelement CMD DMA ring

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
rocker: add code section labels

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

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
rocker: move wait queue init into probe

It will be not used by test code only.

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
rocker: implement ethtool get_settings op

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
rocker: make the module dependent on CONFIG_NET_SWITCHDEV

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
rocker: remove PORT_PHYS_MODE; to be replaced with PORT_SETTING_MODE tlv

Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
rocker: port setting tlvs: remove MAX_SPEED and add AUTONEG and MODE to sync w/ spec and device

Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
rocker: Change COMP_STATUS to COMP_ERR to match changes in spec/device

Also pad desc so that comp_err is last two bytes of desc and completion gen bit
is last bit of those two bytes.  The resv padding desc is before comp_err.  The
reason for putting comp_err at very end of desc is we want comp_err to be the
last two bytes written in descriptor so if software is polling comp gen bit,
when it see gen bit change, it's safe to read other fields of desc.  Software
should read comp_err gen bit first, and then other desc fields.

Alos note that comp_err is 2 bytes, not 4.

Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
rocker: sync TLVs with device/spec

Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
rocker: Get CMD ring working

A few changes to get things working:

1) ring head and tail should be initialized to 0 to match device reset state.
2) when tlv parsing the desc, use real desc->tlv_size to know extent of tlv
area of buf.
3) when getting a desc off of ring to post, get desc at current head position.
Once desc buf is filled in, advance head.  In getting the head desc and posting
the head desc, check rung-full condition to avoid overrunning tail.

With these changes, ethtool eth1 works:

cumulus@debian:~$ sudo ethtool eth1
Settings for eth1:
	Supported ports: [ TP ]
	Supported link modes:   Not reported
	Supported pause frame use: No
	Supports auto-negotiation: No
	Advertised link modes:  Not reported
	Advertised pause frame use: No
	Advertised auto-negotiation: No
	Speed: 10000Mb/s
	Duplex: Full
	Port: Twisted Pair
	PHYAD: 255
	Transceiver: internal
	Auto-negotiation: off
	MDI-X: Unknown
	Link detected: no

Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
rocker: move port enable/disable to ndo_open/stop

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