Merge branch 'mainstream'
authorGiuseppe Lettieri <g.lettieri@iet.unipi.it>
Sat, 24 Aug 2013 10:23:11 +0000 (12:23 +0200)
committerGiuseppe Lettieri <g.lettieri@iet.unipi.it>
Sat, 24 Aug 2013 10:23:11 +0000 (12:23 +0200)
1  2 
lib/automake.mk
lib/dpif-netdev.c
lib/dpif-provider.h
lib/dpif.c
lib/netdev.c

diff --combined lib/automake.mk
@@@ -33,6 -33,8 +33,8 @@@ lib_libopenvswitch_a_SOURCES = 
        lib/compiler.h \
        lib/coverage.c \
        lib/coverage.h \
+       lib/crc32c.c \
+       lib/crc32c.h \
        lib/csum.c \
        lib/csum.h \
        lib/daemon.c \
@@@ -93,8 -95,6 +95,8 @@@
        lib/multipath.c \
        lib/multipath.h \
        lib/netdev-dummy.c \
 +      lib/netdev-tunnel.c \
 +      lib/netdev-pltap.c \
        lib/netdev-provider.h \
        lib/netdev-vport.c \
        lib/netdev-vport.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 \
diff --combined lib/dpif-netdev.c
@@@ -201,17 -201,10 +201,17 @@@ dpif_netdev_class_is_dummy(const struc
      return class != &dpif_netdev_class;
  }
  
 +static bool
 +dpif_netdev_class_is_planetlab(const struct dpif_class *class)
 +{
 +    return class == &dpif_planetlab_class;
 +}
 +
  static const char *
  dpif_netdev_port_open_type(const struct dpif_class *class, const char *type)
  {
      return strcmp(type, "internal") ? type
 +                  : dpif_netdev_class_is_planetlab(class) ? "pltap"
                    : dpif_netdev_class_is_dummy(class) ? "dummy"
                    : "tap";
  }
@@@ -239,8 -232,7 +239,8 @@@ choose_port(struct dp_netdev *dp, cons
  {
      uint32_t port_no;
  
 -    if (dp->class != &dpif_netdev_class) {
 +    if (dp->class != &dpif_netdev_class && 
 +        dp->class != &dpif_planetlab_class) {
          const char *p;
          int start_no = 0;
  
@@@ -616,10 -608,10 +616,10 @@@ dpif_netdev_port_query_by_name(const st
      return error;
  }
  
- static odp_port_t
+ static uint32_t
  dpif_netdev_get_max_ports(const struct dpif *dpif OVS_UNUSED)
  {
-     return u32_to_odp(MAX_PORTS);
+     return MAX_PORTS;
  }
  
  static void
@@@ -1305,49 -1297,41 +1305,49 @@@ dp_netdev_execute_actions(struct dp_net
                          dp_netdev_output_port, dp_netdev_action_userspace);
  }
  
 +#define DPIF_NETDEV_CLASS_FUNCTIONS                   \
 +    dpif_netdev_enumerate,                            \
 +    dpif_netdev_port_open_type,                               \
 +    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_port_open_type,
 -    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
@@@ -1419,4 -1403,3 +1419,4 @@@ dpif_dummy_register(bool override
                               "DP PORT NEW-NUMBER",
                               3, 3, dpif_dummy_change_port_number, NULL);
  }
 +
diff --combined lib/dpif-provider.h
@@@ -146,7 -146,7 +146,7 @@@ struct dpif_class 
  
      /* Returns one greater than the largest port number accepted in flow
       * actions. */
-     odp_port_t (*get_max_ports)(const struct dpif *dpif);
+     uint32_t (*get_max_ports)(const struct dpif *dpif);
  
      /* Returns the Netlink PID value to supply in OVS_ACTION_ATTR_USERSPACE
       * actions as the OVS_USERSPACE_ATTR_PID attribute's value, for use in
  
  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
@@@ -61,7 -61,6 +61,7 @@@ static const struct dpif_class *base_dp
      &dpif_linux_class,
  #endif
      &dpif_netdev_class,
 +    &dpif_planetlab_class,
  };
  
  struct registered_dpif_class {
@@@ -635,7 -634,7 +635,7 @@@ dpif_port_query_by_name(const struct dp
  
  /* Returns one greater than the maximum port number accepted in flow
   * actions. */
odp_port_t
uint32_t
  dpif_get_max_ports(const struct dpif *dpif)
  {
      return dpif->dpif_class->get_max_ports(dpif);
diff --combined lib/netdev.c
@@@ -109,8 -109,6 +109,8 @@@ netdev_initialize(void
          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);
  
          ovsthread_once_done(&once);
      }
@@@ -128,7 -126,9 +128,9 @@@ netdev_run(void
  
      ovs_rwlock_rdlock(&netdev_class_rwlock);
      HMAP_FOR_EACH (rc, hmap_node, &netdev_classes) {
-         rc->class->run();
+         if (rc->class->run) {
+             rc->class->run();
+         }
      }
      ovs_rwlock_unlock(&netdev_class_rwlock);
  }
@@@ -145,7 -145,9 +147,9 @@@ netdev_wait(void
  
      ovs_rwlock_rdlock(&netdev_class_rwlock);
      HMAP_FOR_EACH (rc, hmap_node, &netdev_classes) {
-         rc->class->wait();
+         if (rc->class->wait) {
+             rc->class->wait();
+         }
      }
      ovs_rwlock_unlock(&netdev_class_rwlock);
  }