Merge branch 'mainstream'
authorGiuseppe Lettieri <g.lettieri@iet.unipi.it>
Mon, 29 Oct 2012 16:27:21 +0000 (17:27 +0100)
committerGiuseppe Lettieri <g.lettieri@iet.unipi.it>
Mon, 29 Oct 2012 16:27:21 +0000 (17:27 +0100)
1  2 
Makefile.am
lib/automake.mk
lib/dpif-netdev.c
lib/dpif-provider.h
lib/dpif.c
lib/netdev.c

diff --combined Makefile.am
@@@ -43,6 -43,7 +43,7 @@@ EXTRA_DIST = 
        DESIGN \
        FAQ \
        INSTALL \
+       INSTALL.Fedora \
        INSTALL.KVM \
        INSTALL.Libvirt \
        INSTALL.RHEL \
@@@ -104,7 -105,6 +105,7 @@@ ro_shell = printf '\043 Generated autom
  
  SUFFIXES += .in
  .in:
 +      @mkdir -p $$(dirname $@)
        $(PERL) $(srcdir)/build-aux/soexpand.pl -I$(srcdir) < $< | \
            sed \
                -e 's,[@]PKIDIR[@],$(PKIDIR),g' \
@@@ -146,7 -146,7 +147,7 @@@ dist-hook-git: distfile
          (cd datapath && $(MAKE) distfiles);                               \
          (cat distfiles; sed 's|^|datapath/|' datapath/distfiles) |        \
            sort -u > all-distfiles;                                        \
 -        (cd $(srcdir) && git ls-files) | grep -v '\.gitignore$$' |        \
 +        (cd $(srcdir) && git ls-files) | grep -vFf $(srcdir)/.non-distfiles |     \
            sort -u > all-gitfiles;                                         \
          comm -1 -3 all-distfiles all-gitfiles > missing-distfiles;        \
          if test -s missing-distfiles; then                                \
@@@ -224,4 -224,3 +225,4 @@@ include rhel/automake.m
  include xenserver/automake.mk
  include python/automake.mk
  include python/compat/automake.mk
 +include planetlab/automake.mk
diff --combined lib/automake.mk
@@@ -88,8 -88,6 +88,8 @@@ lib_libopenvswitch_a_SOURCES = 
        lib/multipath.c \
        lib/multipath.h \
        lib/netdev-dummy.c \
 +      lib/netdev-tunnel.c \
 +      lib/netdev-pltap.c \
        lib/netdev-provider.h \
        lib/netdev.c \
        lib/netdev.h \
        lib/timeval.h \
        lib/token-bucket.c \
        lib/token-bucket.h \
 +      lib/tunalloc.c \
 +      lib/tunalloc.h \
        lib/type-props.h \
        lib/unaligned.h \
        lib/unicode.c \
@@@ -231,7 -227,7 +231,7 @@@ if HAVE_WNO_UNUSED_PARAMETE
  lib_libsflow_a_CFLAGS += -Wno-unused-parameter
  endif
  
- if HAVE_NETLINK
+ if LINUX_DATAPATH
  lib_libopenvswitch_a_SOURCES += \
        lib/dpif-linux.c \
        lib/dpif-linux.h \
        lib/route-table.h
  endif
  
+ if ESX
+ lib_libopenvswitch_a_SOURCES += \
+         lib/route-table-stub.c
+ endif
  if HAVE_IF_DL
  lib_libopenvswitch_a_SOURCES += \
        lib/netdev-bsd.c \
@@@ -304,14 -305,16 +309,16 @@@ MAN_FRAGMENTS += 
  
  # vswitch IDL
  OVSIDL_BUILT += \
-       lib/vswitch-idl.c \
-       lib/vswitch-idl.h \
-       lib/vswitch-idl.ovsidl
+       $(srcdir)/lib/vswitch-idl.c \
+       $(srcdir)/lib/vswitch-idl.h \
+       $(srcdir)/lib/vswitch-idl.ovsidl
  
- EXTRA_DIST += lib/vswitch-idl.ann
- VSWITCH_IDL_FILES = vswitchd/vswitch.ovsschema lib/vswitch-idl.ann
- lib/vswitch-idl.ovsidl: $(VSWITCH_IDL_FILES)
-       $(OVSDB_IDLC) -C $(srcdir) annotate $(VSWITCH_IDL_FILES) > $@.tmp
+ EXTRA_DIST += $(srcdir)/lib/vswitch-idl.ann
+ VSWITCH_IDL_FILES = \
+       $(srcdir)/vswitchd/vswitch.ovsschema \
+       $(srcdir)/lib/vswitch-idl.ann
+ $(srcdir)/lib/vswitch-idl.ovsidl: $(VSWITCH_IDL_FILES)
+       $(OVSDB_IDLC) annotate $(VSWITCH_IDL_FILES) > $@.tmp
        mv $@.tmp $@
  
  lib/dirs.c: lib/dirs.c.in Makefile
diff --combined lib/dpif-netdev.c
@@@ -316,15 -316,6 +316,15 @@@ dpif_netdev_get_stats(const struct dpi
      return 0;
  }
  
 +static const char* internal_port_type(const struct dp_netdev* dp)
 +{
 +      if (dp->class == &dpif_netdev_class)
 +              return "tap";
 +      if (dp->class == &dpif_planetlab_class)
 +              return "pltap";
 +      return "dummy";
 +}
 +
  static int
  do_add_port(struct dp_netdev *dp, const char *devname, const char *type,
              uint16_t port_no)
      /* XXX reject devices already in some dp_netdev. */
  
      /* Open and validate network device. */
 -    open_type = (strcmp(type, "internal") ? type
 -                 : dp->class != &dpif_netdev_class ? "dummy"
 -                 : "tap");
 +    open_type = (strcmp(type, "internal") ? type : internal_port_type(dp));
      error = netdev_open(devname, open_type, &netdev);
      if (error) {
          return error;
@@@ -383,9 -376,7 +383,9 @@@ choose_port(struct dpif *dpif, struct n
      struct dp_netdev *dp = get_dp_netdev(dpif);
      int port_no;
  
 -    if (dpif->dpif_class != &dpif_netdev_class) {
 +    if (dpif->dpif_class != &dpif_netdev_class &&
 +        dpif->dpif_class != &dpif_planetlab_class)
 +    {
          /* If the port name contains a number, try to assign that port number.
           * This can make writing unit tests easier because port numbers are
           * predictable. */
@@@ -925,7 -916,7 +925,7 @@@ dpif_netdev_execute(struct dpif *dpif, 
      ofpbuf_reserve(&copy, DP_NETDEV_HEADROOM);
      ofpbuf_put(&copy, execute->packet->data, execute->packet->size);
  
-     flow_extract(&copy, 0, 0, -1, &key);
+     flow_extract(&copy, 0, NULL, -1, &key);
      error = dpif_netdev_flow_from_nlattrs(execute->key, execute->key_len,
                                            &key);
      if (!error) {
@@@ -1005,13 -996,12 +1005,12 @@@ dpif_netdev_recv_purge(struct dpif *dpi
  }
  \f
  static void
- dp_netdev_flow_used(struct dp_netdev_flow *flow, struct flow *key,
-                     const struct ofpbuf *packet)
+ dp_netdev_flow_used(struct dp_netdev_flow *flow, const struct ofpbuf *packet)
  {
      flow->used = time_msec();
      flow->packet_count++;
      flow->byte_count += packet->size;
-     flow->tcp_flags |= packet_get_tcp_flags(packet, key);
+     flow->tcp_flags |= packet_get_tcp_flags(packet, &flow->key);
  }
  
  static void
@@@ -1024,10 -1014,10 +1023,10 @@@ dp_netdev_port_input(struct dp_netdev *
      if (packet->size < ETH_HEADER_LEN) {
          return;
      }
-     flow_extract(packet, 0, 0, odp_port_to_ofp_port(port->port_no), &key);
+     flow_extract(packet, 0, NULL, odp_port_to_ofp_port(port->port_no), &key);
      flow = dp_netdev_lookup_flow(dp, &key);
      if (flow) {
-         dp_netdev_flow_used(flow, &key, packet);
+         dp_netdev_flow_used(flow, packet);
          dp_netdev_execute_actions(dp, packet, &key,
                                    flow->actions, flow->actions_len);
          dp->n_hit++;
@@@ -1189,6 -1179,7 +1188,7 @@@ execute_set_action(struct ofpbuf *packe
      case OVS_KEY_ATTR_TUN_ID:
      case OVS_KEY_ATTR_PRIORITY:
      case OVS_KEY_ATTR_IPV6:
+     case OVS_KEY_ATTR_IPV4_TUNNEL:
          /* not implemented */
          break;
  
@@@ -1274,48 -1265,40 +1274,48 @@@ dp_netdev_execute_actions(struct dp_net
      }
  }
  
 +#define DPIF_NETDEV_CLASS_FUNCTIONS                   \
 +    dpif_netdev_enumerate,                            \
 +    dpif_netdev_open,                                 \
 +    dpif_netdev_close,                                        \
 +    dpif_netdev_destroy,                              \
 +    dpif_netdev_run,                                  \
 +    dpif_netdev_wait,                                 \
 +    dpif_netdev_get_stats,                            \
 +    dpif_netdev_port_add,                             \
 +    dpif_netdev_port_del,                             \
 +    dpif_netdev_port_query_by_number,                 \
 +    dpif_netdev_port_query_by_name,                   \
 +    dpif_netdev_get_max_ports,                                \
 +    NULL,                       /* port_get_pid */    \
 +    dpif_netdev_port_dump_start,                      \
 +    dpif_netdev_port_dump_next,                               \
 +    dpif_netdev_port_dump_done,                               \
 +    dpif_netdev_port_poll,                            \
 +    dpif_netdev_port_poll_wait,                               \
 +    dpif_netdev_flow_get,                             \
 +    dpif_netdev_flow_put,                             \
 +    dpif_netdev_flow_del,                             \
 +    dpif_netdev_flow_flush,                           \
 +    dpif_netdev_flow_dump_start,                      \
 +    dpif_netdev_flow_dump_next,                               \
 +    dpif_netdev_flow_dump_done,                               \
 +    dpif_netdev_execute,                              \
 +    NULL,                       /* operate */         \
 +    dpif_netdev_recv_set,                             \
 +    dpif_netdev_queue_to_priority,                    \
 +    dpif_netdev_recv,                                 \
 +    dpif_netdev_recv_wait,                            \
 +    dpif_netdev_recv_purge,                           \
 +
  const struct dpif_class dpif_netdev_class = {
      "netdev",
 -    dpif_netdev_enumerate,
 -    dpif_netdev_open,
 -    dpif_netdev_close,
 -    dpif_netdev_destroy,
 -    dpif_netdev_run,
 -    dpif_netdev_wait,
 -    dpif_netdev_get_stats,
 -    dpif_netdev_port_add,
 -    dpif_netdev_port_del,
 -    dpif_netdev_port_query_by_number,
 -    dpif_netdev_port_query_by_name,
 -    dpif_netdev_get_max_ports,
 -    NULL,                       /* port_get_pid */
 -    dpif_netdev_port_dump_start,
 -    dpif_netdev_port_dump_next,
 -    dpif_netdev_port_dump_done,
 -    dpif_netdev_port_poll,
 -    dpif_netdev_port_poll_wait,
 -    dpif_netdev_flow_get,
 -    dpif_netdev_flow_put,
 -    dpif_netdev_flow_del,
 -    dpif_netdev_flow_flush,
 -    dpif_netdev_flow_dump_start,
 -    dpif_netdev_flow_dump_next,
 -    dpif_netdev_flow_dump_done,
 -    dpif_netdev_execute,
 -    NULL,                       /* operate */
 -    dpif_netdev_recv_set,
 -    dpif_netdev_queue_to_priority,
 -    dpif_netdev_recv,
 -    dpif_netdev_recv_wait,
 -    dpif_netdev_recv_purge,
 +    DPIF_NETDEV_CLASS_FUNCTIONS
 +};
 +
 +const struct dpif_class dpif_planetlab_class = {
 +    "planetlab",
 +    DPIF_NETDEV_CLASS_FUNCTIONS
  };
  
  static void
@@@ -1348,4 -1331,3 +1348,4 @@@ dpif_dummy_register(bool override
  
      dpif_dummy_register__("dummy");
  }
 +
diff --combined lib/dpif-provider.h
@@@ -292,7 -292,7 +292,7 @@@ struct dpif_class 
       * taken from the flow specified in the 'execute->key_len' bytes of
       * 'execute->key'.  ('execute->key' is mostly redundant with
       * 'execute->packet', but it contains some metadata that cannot be
-      * recovered from 'execute->packet', such as tun_id and in_port.) */
+      * recovered from 'execute->packet', such as tunnel and in_port.) */
      int (*execute)(struct dpif *dpif, const struct dpif_execute *execute);
  
      /* Executes each of the 'n_ops' operations in 'ops' on 'dpif', in the order
  
  extern const struct dpif_class dpif_linux_class;
  extern const struct dpif_class dpif_netdev_class;
 +extern const struct dpif_class dpif_planetlab_class;
  
  #ifdef  __cplusplus
  }
diff --combined lib/dpif.c
@@@ -58,11 -58,10 +58,11 @@@ COVERAGE_DEFINE(dpif_execute)
  COVERAGE_DEFINE(dpif_purge);
  
  static const struct dpif_class *base_dpif_classes[] = {
- #ifdef HAVE_NETLINK
+ #ifdef LINUX_DATAPATH
      &dpif_linux_class,
  #endif
      &dpif_netdev_class,
 +    &dpif_planetlab_class,
  };
  
  struct registered_dpif_class {
@@@ -978,7 -977,7 +978,7 @@@ dpif_execute__(struct dpif *dpif, cons
   * the Ethernet frame specified in 'packet' taken from the flow specified in
   * the 'key_len' bytes of 'key'.  ('key' is mostly redundant with 'packet', but
   * it contains some metadata that cannot be recovered from 'packet', such as
-  * tun_id and in_port.)
+  * tunnel and in_port.)
   *
   * Returns 0 if successful, otherwise a positive errno value. */
  int
diff --combined lib/netdev.c
@@@ -75,7 -75,7 +75,7 @@@ netdev_initialize(void
  
          fatal_signal_add_hook(close_all_netdevs, NULL, NULL, true);
  
- #ifdef HAVE_NETLINK
+ #ifdef LINUX_DATAPATH
          netdev_register_provider(&netdev_linux_class);
          netdev_register_provider(&netdev_internal_class);
          netdev_register_provider(&netdev_tap_class);
@@@ -85,8 -85,6 +85,8 @@@
          netdev_register_provider(&netdev_tap_class);
          netdev_register_provider(&netdev_bsd_class);
  #endif
 +      netdev_register_provider(&netdev_tunnel_class);
 +      netdev_register_provider(&netdev_pltap_class);
      }
  }