} sa;
if (ofconn->band == OFPROTO_IN_BAND
- && stream_parse_target_with_default_port(target, OFP_OLD_PORT,
- &sa.ss)
+ && stream_parse_target_with_default_port(target, OFP_PORT, &sa.ss)
&& sa.ss.ss_family == AF_INET) {
addrs[n_addrs++] = sa.in;
}
void
ofconn_send_replies(const struct ofconn *ofconn, struct ovs_list *replies)
{
- struct ofpbuf *reply, *next;
+ struct ofpbuf *reply;
- LIST_FOR_EACH_SAFE (reply, next, list_node, replies) {
- list_remove(&reply->list_node);
+ LIST_FOR_EACH_POP (reply, list_node, replies) {
ofconn_send_reply(ofconn, reply);
}
}
}
ofconn->last_op = now;
}
+\f
+/* OpenFlow 1.4 bundles. */
-struct hmap *
-ofconn_get_bundles(struct ofconn *ofconn)
+static inline uint32_t
+bundle_hash(uint32_t id)
{
- return &ofconn->bundles;
+ return hash_int(id, 0);
}
+struct ofp_bundle *
+ofconn_get_bundle(struct ofconn *ofconn, uint32_t id)
+{
+ struct ofp_bundle *bundle;
+
+ HMAP_FOR_EACH_IN_BUCKET(bundle, node, bundle_hash(id), &ofconn->bundles) {
+ if (bundle->id == id) {
+ return bundle;
+ }
+ }
+
+ return NULL;
+}
+
+enum ofperr
+ofconn_insert_bundle(struct ofconn *ofconn, struct ofp_bundle *bundle)
+{
+ /* XXX: Check the limit of open bundles */
+
+ hmap_insert(&ofconn->bundles, &bundle->node, bundle_hash(bundle->id));
+
+ return 0;
+}
+
+enum ofperr
+ofconn_remove_bundle(struct ofconn *ofconn, struct ofp_bundle *bundle)
+{
+ hmap_remove(&ofconn->bundles, &bundle->node);
+
+ return 0;
+}
+
+static void
+bundle_remove_all(struct ofconn *ofconn)
+{
+ struct ofp_bundle *b, *next;
+
+ HMAP_FOR_EACH_SAFE (b, next, node, &ofconn->bundles) {
+ ofp_bundle_remove__(ofconn, b);
+ }
+}
\f
/* Private ofconn functions. */
hmap_remove(&ofconn->connmgr->controllers, &ofconn->hmap_node);
}
- ofp_bundle_remove_all(ofconn);
+ bundle_remove_all(ofconn);
hmap_destroy(&ofconn->bundles);
hmap_destroy(&ofconn->monitors);
static void
do_send_packet_ins(struct ofconn *ofconn, struct ovs_list *txq)
{
- struct ofpbuf *pin, *next_pin;
-
- LIST_FOR_EACH_SAFE (pin, next_pin, list_node, txq) {
- list_remove(&pin->list_node);
+ struct ofpbuf *pin;
+ LIST_FOR_EACH_POP (pin, list_node, txq) {
if (rconn_send_with_limit(ofconn->rconn, pin,
ofconn->packet_in_counter, 100) == EAGAIN) {
static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 5);
ofpact_pad(&ofpacts);
match_init_catchall(&match);
- ofproto_add_flow(mgr->ofproto, &match, 0, ofpbuf_data(&ofpacts),
- ofpbuf_size(&ofpacts));
+ ofproto_add_flow(mgr->ofproto, &match, 0, ofpacts.data,
+ ofpacts.size);
ofpbuf_uninit(&ofpacts);
}
struct ofconn *ofconn;
LIST_FOR_EACH (ofconn, node, &mgr->all_conns) {
- struct ofpbuf *msg, *next;
+ struct ofpbuf *msg;
- LIST_FOR_EACH_SAFE (msg, next, list_node, &ofconn->updates) {
+ LIST_FOR_EACH_POP (msg, list_node, &ofconn->updates) {
unsigned int n_bytes;
- list_remove(&msg->list_node);
ofconn_send(ofconn, msg, ofconn->monitor_counter);
n_bytes = rconn_packet_counter_n_bytes(ofconn->monitor_counter);
if (!ofconn->monitor_paused && n_bytes > 128 * 1024) {