dpif-netdev: Reintroduce ref_cnt for dp_netdev_flow

struct dp_netdev_flow used to have a reference counter.
It has been replaced by RCU. Unfortunately RCU is not
enough if we plan to hold a reference to the dp_netdev_flow
for a long time. So this commit reintroduces reference
counting for struct dp_netdev_flow

Subsequent commits make use of it.

Signed-off-by: Daniele Di Proietto <ddiproietto@vmware.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
netdev-dpdk: Move to DPDK 1.7.0

With this commit we move our DPDK support to 1.7.0.
DPDK binaries (starting with dpdk 1.7.0) should be linked with --whole-archive
to include pmd drivers

Signed-off-by: Daniele Di Proietto <ddiproietto@vmware.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
netdev-dpdk: Keep calling rte_eth_tx_burst() until it returns 0

rte_eth_tx_burst() _should_ transmit every packet that it is passed unless the
queue is full. Nontheless some implementation of rte_eth_tx_burst (e.g.
ixgbe_xmit_pkts_vec()) does not transmit more than a fixed number (32) of
packets at a time.

With this commit we assume that there's an error only if rte_eth_tx_burst
returns 0.

Signed-off-by: Daniele Di Proietto <ddiproietto@vmware.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
datapath: Fix memory leak in ovs_vport_alloc() error path

ovs_vport_alloc() bails out without freeing the memory 'vport' points
to.

Picked up by Coverity - CID 1230503.

Fixes: beb1c69a3 ("datapath: Allow each vport to have an array of
'port_id's.")
Signed-off-by: Christoph Jaeger <cj@linux.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
No newline at end of file

Adding newline at end of the following files: packet.h, uio.h.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Prepare include headers

Preparing the include headers needed to compile dpif-linux.c with MSVC.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
ovs-numa: Add ovs-numa.{c,h} for extracting and storing cpu
socket and cpu core info.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
datapath-windows: check source port during tunnel Tx

In the Windows datapath, Tx tunneling functionality is implemented by checking
if the outport in the action is a tunnel port. If so, the packet is
encapsulated and sent out on the PIF bridge for as second flow lookup.
Basically, we don't use the hypervisor's IP stack to send out a packet, and
short circuit the path ourselves. On the PIF bridge, the source port of the
encapsulated packet is the VTEP port ie. the internal port.

If a Tunneling port is added to the PIF bridge (a possible misconfiguration),
where the VTEP(internal) port and the external port (physical NIC) also reside,
a flooding action can cause a loop, by re-injecting the packet on the same PIF
bridge which again floods to the tunnel port.

In this change, we break the loop by encapsulating packets only if they are
sent out by a VIF or if they originate from userspace ie. userspace generated.
We make use of the input port attribute in the packet execute ioctl.

This change is based off of the legacy datapath interface published in
OvsPub.h. This interface has a input port field in the packet execute ioctl.
I looked in dpif-linux.c that uses the netlink based datapath interface and
even in that case, we do add the the source port in:
    dpif_linux_encode_execute() -> odp_key_from_pkt_metadata().
So, this fix is applicable when we adopt the netlink based datapath interface
as well.

The Rx side of OvsDetectTunnelPkt() has only documentation updates. The fix is
on the Tx side.

Validation (using dpif-windows.c):
- Was able to perform VTEP <-> VTEP ping with the configuration posted in the
issue.
- Was able to perform VIF <-> VIF ping when the setup was configured correctly.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Reported-by: Alin Serdean <aserdean@cloudbasesolutions.com>
Tested-by: Alin Serdean <aserdean@cloudbasesolutions.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/20
Signed-off-by: Ben Pfaff <blp@nicira.com>
ovs-numa: Correct printf format specifiers.

list_size() yields a size_t, not uint64_t, and these types are different on
32-bit targets.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
dpif: Support flow_get in dpif_operate().

This cleans up the dpif interface to make it more consistent with the
other dpif operations, and allows flows to be fetched in batches.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>