Merge "master" into "next".
authorBen Pfaff <blp@nicira.com>
Wed, 24 Feb 2010 21:47:09 +0000 (13:47 -0800)
committerBen Pfaff <blp@nicira.com>
Wed, 24 Feb 2010 21:47:09 +0000 (13:47 -0800)
23 files changed:
1  2 
configure.ac
datapath/actions.c
include/openflow/openflow.h
include/openvswitch/datapath-protocol.h
lib/classifier.c
lib/classifier.h
lib/compiler.h
lib/dpif-netdev.c
lib/dpif.h
lib/flow.h
lib/ofp-print.c
lib/packets.h
lib/poll-loop.h
lib/rconn.c
lib/stp.c
lib/util.h
lib/vconn.c
lib/vconn.h
ofproto/netflow.h
ofproto/ofproto.c
ofproto/ofproto.h
ofproto/pinsched.c
ofproto/pktbuf.c

diff --cc configure.ac
Simple merge
Simple merge
  #define OFP_ASSERT BOOST_STATIC_ASSERT
  #endif /* __cplusplus */
  
- #ifndef SWIG
- #define OFP_PACKED __attribute__((packed))
- #else
- #define OFP_PACKED              /* SWIG doesn't understand __attribute. */
- #endif
 +/* Version number:
 + * Non-experimental versions released: 0x01
 + * Experimental versions released: 0x81 -- 0x99
 + */
  /* The most significant bit being set in the version field indicates an
 - * experimental OpenFlow version.  
 + * experimental OpenFlow version.
   */
 -#define OFP_VERSION   0x97
 +#define OFP_VERSION   0x01
  
  #define OFP_MAX_TABLE_NAME_LEN 32
  #define OFP_MAX_PORT_NAME_LEN  16
Simple merge
Simple merge
diff --cc lib/compiler.h
  #define STRFTIME_FORMAT(FMT) __attribute__((__format__(__strftime__, FMT, 0)))
  #define MALLOC_LIKE __attribute__((__malloc__))
  #define ALWAYS_INLINE __attribute__((always_inline))
- #define likely(x) __builtin_expect((x),1)
- #define unlikely(x) __builtin_expect((x),0)
 +#define WARN_UNUSED_RESULT __attribute__((__warn_unused_result__))
+ #else
+ #define NO_RETURN
+ #define OVS_UNUSED
+ #define PRINTF_FORMAT(FMT, ARG1)
+ #define STRFTIME_FORMAT(FMT)
+ #define MALLOC_LIKE
+ #define ALWAYS_INLINE
++#define WARN_UNUSED_RESULT
+ #endif
  
  #endif /* compiler.h */
Simple merge
diff --cc lib/dpif.h
Simple merge
diff --cc lib/flow.h
Simple merge
diff --cc lib/ofp-print.c
Simple merge
diff --cc lib/packets.h
Simple merge
diff --cc lib/poll-loop.h
Simple merge
diff --cc lib/rconn.c
Simple merge
diff --cc lib/stp.c
Simple merge
diff --cc lib/util.h
Simple merge
diff --cc lib/vconn.c
@@@ -184,51 -221,31 +222,51 @@@ vconn_open(const char *name, int min_ve
      COVERAGE_INC(vconn_open);
      check_vconn_classes();
  
-     *vconnp = NULL;
-     prefix_len = strcspn(name, ":");
-     if (prefix_len == strlen(name)) {
-         return EAFNOSUPPORT;
+     /* Look up the class. */
+     error = vconn_lookup_class(name, &class);
+     if (!class) {
+         goto error;
      }
-     for (i = 0; i < ARRAY_SIZE(vconn_classes); i++) {
-         struct vconn_class *class = vconn_classes[i];
-         if (strlen(class->name) == prefix_len
-             && !memcmp(class->name, name, prefix_len)) {
-             struct vconn *vconn;
-             char *suffix_copy = xstrdup(name + prefix_len + 1);
-             int retval = class->open(name, suffix_copy, &vconn);
-             free(suffix_copy);
-             if (!retval) {
-                 assert(vconn->state != VCS_CONNECTING
-                        || vconn->class->connect);
-                 vconn->min_version = min_version;
-                 *vconnp = vconn;
-             }
-             return retval;
-         }
+     /* Call class's "open" function. */
+     suffix_copy = xstrdup(strchr(name, ':') + 1);
+     error = class->open(name, suffix_copy, &vconn);
+     free(suffix_copy);
+     if (error) {
+         goto error;
      }
-     return EAFNOSUPPORT;
+     /* Success. */
+     assert(vconn->state != VCS_CONNECTING || vconn->class->connect);
+     vconn->min_version = min_version;
+     *vconnp = vconn;
+     return 0;
+ error:
+     *vconnp = NULL;
+     return error;
  }
  
 +/* Allows 'vconn' to perform maintenance activities, such as flushing output
 + * buffers. */
 +void
 +vconn_run(struct vconn *vconn)
 +{
 +    if (vconn->class->run) {
 +        (vconn->class->run)(vconn);
 +    }
 +}
 +
 +/* Arranges for the poll loop to wake up when 'vconn' needs to perform
 + * maintenance activities. */
 +void
 +vconn_run_wait(struct vconn *vconn)
 +{
 +    if (vconn->class->run_wait) {
 +        (vconn->class->run_wait)(vconn);
 +    }
 +}
 +
  int
  vconn_open_block(const char *name, int min_version, struct vconn **vconnp)
  {
diff --cc lib/vconn.h
Simple merge
Simple merge
@@@ -754,12 -759,8 +754,14 @@@ ofproto_destroy(struct ofproto *p
  
      mac_learning_destroy(p->ml);
  
 +    free(p->mfr_desc);
 +    free(p->hw_desc);
 +    free(p->sw_desc);
 +    free(p->serial_desc);
 +    free(p->dp_desc);
 +
+     port_array_destroy(&p->ports);
      free(p);
  }
  
Simple merge
Simple merge
Simple merge