datapath-windows: define a version number in DP extensions

We need a version number for the datapath interface extensions that
we can leverage at some point.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
netlink-socket.c: add support for do_lookup_genl_family on Windows

In this patch, we add support for querying the genl family id for any
family supported by the OVS kernel datapath. On platforms that support
netlink natively, the operating system assigns a family ID, and the
OS netlink infrastructure supports querying the family ID by name.

In case of Windows, since OVS datpath provides the netlink support,
it is not necessary to make a call into the kernel. Returning a
family ID that is consistent between the userspace and kernel
is sufficient. Once there is code to support netlink message parsing
as well as constructing netlink messages, we can make a call into
the kernel, but that in itself may not buy anything more than this
approach.

This patch is a precursor to make progress of the other commands.
The next hurdle is to support nl_lookup_genl_mcgroup().

Signed-off-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
datapath-windows: add netlink message parsing APIs

In this change we introduce Netlink.c, Netlink.h and NetlinkProto.h
in datapath-windows. These files will provide netlink message
data structures and parsing APIs.

Changes are on similar lines to userspace netlink code.

We have mapped the userspace APIs and data structures to
kernel coding convention.
for example:
nlmsghdr ==> NL_MSG_HDR
nl_attr_get ==> NlAttrGet

Signed-off-by: Ankur Sharma <ankursharma@vmware.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/18
Acked-by: Nithin Raju <nithin@vmware.com>
Acked-by: Samuel Ghinet <sghinet@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
datapath-windows: Using windows kernel netlink parsing APIs.

In this patch we incorporate the usage of netlink message
and the parsing APIs that were added in previous commit.

Signed-off-by: Ankur Sharma <ankursharma@vmware.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/18
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
datapath-windows: remove reference to OvsNetlink.h

In this patch we remove reference to OvsNetlink.h.
Since we do not refer to lib/netlink-protocol.h anymore,
hence removed the WIN_DP based check as well.

Signed-off-by: Ankur Sharma <ankursharma@vmware.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/18
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
datapath-windows: Use OVS_DEFAULT_PORT_NO instead of 0 in a few places

Signed-off-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Saurabh Shah <ssaurabh@vmware.com>
ofproto/xlate: Add xlate_lookup_ofproto().

"xlate_receive" did not tell much about what it is used for.  We have
two users of it that only want the ofproto and the OF port number, use the
new xlate_lookup_ofproto() for those.

Fix the comments of xlate_receive() as we no longer change the flow.

Also, the helper ofproto_dpif_contains_flow() seemed ill-named, so this
path removes it and uses xlate_lookup_ofproto() directly.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
ofproto-dpif-upcall: Remove struct upcall netflow member.

The netflow member was not used for anything, so it can be removed.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
ofproto-dpif-xlate: Do not take references in xlate_receive().

xlate configuration (via xcfg) is already holding the references, so
the callers of xlate_receive() can safely use the returned pointers
upto the point when they quiesce.  If the objects are needed for
longer term, the callers can take additional references themselves.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
ofproto-dpif-xlate: Rename xlate_receive() as xlate_lookup().

Seems better as we no longer modify the flow.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
build: Add travis continuous integration support

This enables the use of travis-ci via github. Linking any ovs
github repo to travis-ci [0] will automatically lead to a build
and testsuite run being triggered for each new commit or pull
requests against the repo.

The introduction of any warnings will cause the build to fail as
both gcc and clang are invoked with -Werror.

The build matrix currently includes:
  * --disable-ssl
  * --with-linux=linux-3.14.7
  * --with-dpdk=1.7.0

Each of these builds is performed with gcc+sparse and clang. The
testsuite is only run for the --with-linux build to keep the total
build time on an acceptable level.

Build failures are reported to the author and commiter by email,
through the travis-ci web UI, and in the github pull request.

A full build report example can be found here [1]

[0] http://travis-ci.org/
[1] https://travis-ci.org/tgraf/ovs/builds/33485228

Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
ofproto-dpif-xlate: Only learn MAC addresses upon handling packets.

MAC learning, like flow entry learning via the "learn" action, should only
happen if a packet was actually received.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
ofproto-dpif-xlate: Skip pushing stats if there are no packets to push.

xlate_push_stats() mostly does nothing if 'stats->n_packets' is 0.  This
commit allows it to skip more complicated internal logic in that case.

The one case I see in which xlate_push_stats() does do something if
'stats->n_packets' is 0 is in the case of a cached fin_timeout translation.
That translation changes the idle and hard timeouts of a flow if tcp_flags
has FIN or RST set, even if n_packets is 0.  But I don't think that can
happen anyway; how would FIN or RST be set without receiving a packet?

More broadly, the xlate_push_stats handles two functions - pushing stats
and implementing side-effects from actions. If there are no packets, the
stats shouldn't need updating. If there were no packets, then no packets
could have hit actions for things such as mac learning/openflow learning,
so xlate_push_stats() should be a no-op.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
ofproto-dpif-xlate: Drop 'may_learn' parameter from xlate_push_stats().

Both existing callers calculated 'may_learn' as 'stats->n_packets > 0', so
it was redundant.  Because xlate_push_stats() is now entirely a no-op if
'stats->n_packets' is 0, we can now delete the tests entirely from the
cases that previously only ran if 'may_learn'.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
datapath: Remove flow member from struct ovs_skb_cb

struct ovs_skb_cb is full on kernels < 3.11 due to compatibility code.
This patch removes the 'flow' member in order to make room for data
needed by layer 3 flow/port support that will be added in an upcoming
patch.  The 'flow' memeber was chosen for removal because it's only used
in ovs_execute_actions().

Signed-off-by: Lorand Jakab <lojakab@cisco.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>