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
index 27dae8fd4642ea6e4f361c67d6344a670420d9ac,78061118918ba08d7ae9b20b8009e0ef9f781cc2..b77cd701137bb3fac0413007fa23475a2c718b13
  #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
index 6c0db0feaf5a240c1c490fcbf482a4350546bdeb,2bb801a48c199ec9e47e0bfa4ec4f4fab7bc9994..6bf514456fbde230ec0c9e5861c90a324275224b
  #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
index f8d3beb0c0c153e98e7b8ad42d5e5653e02190d6,51a51b9cd5683a353ba659d0fb9170339f94466f..d8807fda3e521b46d9a975138f3c408ba6724661
@@@ -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
index 0e422146070dd1f6166351fa873ba44641fcb43a,3768eede02a7db716dfb495cbba04316524034cb..189aa2c827a96ee04eb2b02db178e5fd23064799
@@@ -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