FAQ: Fix version number for 2.0.

Presumably we will have minor version releases in the 2.x series
as well.

Signed-off-by: Jesse Gross <jesse@nicira.com>
ovsdb: Use DB load time, not on-disk commit times, for compaction.

The ovsdb-server compaction timing logic is written assuming monotonic
time at milliscond resolution but it calculated the next compaction time
based on the oldest commit in the database. This was a problem because
commit timestamps are written in wall-clock time to second resolution.

This commit calculates the next compaction time based on the time when
the database was first loaded or the last compaction was done, both in
monotonic time at millisecond resolution.

Signed-off-by: Paul Ingram <pingram@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
ovsdb: write commit timestamps to millisecond resolution.

This is expected to make system debugging easier.

This raises two compatibility issues:
1. When a new ovsdb-tool reads an old database, it will multiply by 1000 any
  timestamp it reads which is less than 1<<31. Since this date corresponds to
  Jan 16 1970 this is unlikely to cause a problem.
2. When an old ovsdb-tool reads a new database, it will interpret the
  millisecond timestamps as seconds and report dates in the far future; the
  time of this commit is reported as the year 45672 (each second since the
  epoch is interpreted as 16 minutes).

Signed-off-by: Paul Ingram <pingram@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
tests: Make ovsdb-server add-db/remove-db test faster and more reliable.

Until now, the "ovsdb-server/add-db and remove-db with --monitor" test
killed ovsdb-server with SIGSEGV twice.  Each time, the "--monitor" option
caused the supervisor process to restart the child, but the second time it
incurred a 10-second delay intended to prevent the daemon from wasting CPU
time by restarting itself and dying again very quickly in a loop.  This
made the test take over 10 seconds to execute.  It also made it
occasionally fail because the OVS_WAIT_UNTIL check waits at most
approximately 10 seconds before it decides that the condition that it is
testing for will never occur.

This commit fixes the problem by breaking the test into two tests, each of
which kills ovsdb-server with SIGSEGV only once.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
INSTALL.RHEL: Explain how to work around old Autoconf; add more prereqs.

The new text is adapted from INSTALL.XenServer.

Mark Hamilton supplied the list of additional build prerequisites.

Reported-by: Mark Hamilton <mhamilton@nicira.com>
CC: Gurucharan Shetty <shettyg@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
ofproto: Actually return the error code from meter add.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
ofproto meters: Keep provider meter_id over mods.

Changed the ofproto meter API to require the provider keep the provider
meter ID unchanged when modifying a meter.  This makes the mapping from
an OpenFlow meter ID to a datapath meter ID consistent over the lifetime
of the meter.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
rule_ofpacts: keep datapath meter_id.

This allows datapaths to operate without referring to the ofproto-level
meter configuration for mater ID mapping, which reduces needs for locking.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
ovs-ofctl: Add meter support.

Adds commands add-meter, mod-meter, del-meter, del-meters, dump-meter,
dump-meters, meter-stats, and meter-features.

Syntax is as follows:

add-meter <br> meter=<n> (kbps|pktps) [burst] [stats] bands= type=(drop|dscp_remark) rate=<n> [burst_size=<n>] [prec_level=<n>] <more bands>

mod-meter <br> meter=<n> (kbps|pktps) [burst] [stats] bands= type=(drop|dscp_remark) rate=<n> [burst_size=<n>] [prec_level=<n>] <more bands>

del-meter <br> meter=(<n>|all)

del-meters <br>

dump-meter <br> meter=(<n>|all)

dump-meters <br>

meter-stats <br> [meter=(<n>|all)]

meter-features <br>

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
vlog: Fix formatting of milliseconds in Python log messages.

Commit 2b31d8e713de7 (vlog: Report timestamps in millisecond resolution in
log messages.) introduced milliseconds to log messages by default, but the
Python version did not ensure that milliseconds were always formatted with
3 digits, so 3.001 was formatted as "3.1" and 3.012 as "3.12", and so on.
This commit fixes the problem.

CC: Paul Ingram <paul@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
ofproto-dpif: Fix use-after-free error deleting last bridge.

valgrind reported:

    Invalid read of size 4
       at 0x806ADC1: odp_port_to_ofport (hmap.h:267)
       by 0x8077C05: xlate_receive (ofproto-dpif-xlate.c:523)
       by 0x8073994: handle_miss_upcalls (ofproto-dpif-upcall.c:642)
       by 0x80741AA: udpif_miss_handler (ofproto-dpif-upcall.c:412)
       by 0x56FCC38: start_thread (pthread_create.c:304)
       by 0x735378D: clone (clone.S:130)
     Address 0x786c084 is 4 bytes inside a block of size 16 free'd
       at 0x4D8350C: free (vg_replace_malloc.c:427)
       by 0x8065EDA: close_dpif_backer (ofproto-dpif.c:1094)

The problem is that close_dpif_backer() destroys odp_to_ofport_map and the
associated mutex before it calls udpif_destroy() to stop the forwarding
threads.  This gives the forwarding threads a window in which to try to
use odp_to_ofport_map.

This commit moves the udpif_destroy() call much earlier, solving the
problem.  (The call to udpif_destroy() must follow the call to
drop_key_clear() because drop_key_clear() uses the udpif.)

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
ofproto-dpif: Use shash_find_and_delete() to simplify close_dpif_backer().

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
ofproto-dpif-upcall: Remove redundant 'packets' list from struct flow_miss.

Until now, struct flow_miss contained a list of packets and a list of
upcalls.  Each packet in the list of packets can be obtained from the
corresponding upcall in the list of upcalls via upcall->dpif_upcall.packet,
so this commit deletes the list of packets and replaces each reference to
a packet by that expression.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
ofproto-dpif: Remove write-only member 'key_fitness' from struct subfacet.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
ofproto-dpif: Avoid unnecessarily counting packets.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>