X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fdpif-netdev.c;h=55712dde1674beb117e1ea70db81d3aec82a2a07;hb=04c881eb6441fff2e91c9b9e23502bc554c0f437;hp=15aa42a03d8adad6804a32dd69d8bd1471b14243;hpb=fbfe01de0dedaf6d5b909b1a977d1f8164243754;p=sliver-openvswitch.git diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index 15aa42a03..55712dde1 100644 --- a/lib/dpif-netdev.c +++ b/lib/dpif-netdev.c @@ -323,7 +323,6 @@ struct pmd_thread { pthread_t thread; int id; atomic_uint change_seq; - char *name; }; /* Interface to netdev-based datapath. */ @@ -1528,8 +1527,10 @@ dpif_netdev_execute(struct dpif *dpif, struct dpif_execute *execute) { struct dp_netdev *dp = get_dp_netdev(dpif); struct pkt_metadata *md = &execute->md; - struct miniflow key; - uint32_t buf[FLOW_U32S]; + struct { + struct miniflow flow; + uint32_t buf[FLOW_U32S]; + } key; if (ofpbuf_size(execute->packet) < ETH_HEADER_LEN || ofpbuf_size(execute->packet) > UINT16_MAX) { @@ -1537,11 +1538,11 @@ dpif_netdev_execute(struct dpif *dpif, struct dpif_execute *execute) } /* Extract flow key. */ - miniflow_initialize(&key, buf); - miniflow_extract(execute->packet, md, &key); + miniflow_initialize(&key.flow, key.buf); + miniflow_extract(execute->packet, md, &key.flow); ovs_rwlock_rdlock(&dp->port_rwlock); - dp_netdev_execute_actions(dp, &key, execute->packet, false, md, + dp_netdev_execute_actions(dp, &key.flow, execute->packet, false, md, execute->actions, execute->actions_len); ovs_rwlock_unlock(&dp->port_rwlock); @@ -1877,8 +1878,6 @@ pmd_thread_main(void *f_) int poll_cnt; int i; - f->name = xasprintf("pmd_%u", ovsthread_id_self()); - set_subprogram_name("%s", f->name); poll_cnt = 0; poll_list = NULL; @@ -1918,7 +1917,6 @@ reload: } free(poll_list); - free(f->name); return NULL; } @@ -1955,7 +1953,7 @@ dp_netdev_set_pmd_threads(struct dp_netdev *dp, int n) /* Each thread will distribute all devices rx-queues among * themselves. */ - xpthread_create(&f->thread, NULL, pmd_thread_main, f); + f->thread = ovs_thread_create("pmd", pmd_thread_main, f); } } @@ -2013,32 +2011,34 @@ dp_netdev_input(struct dp_netdev *dp, struct ofpbuf *packet, OVS_REQ_RDLOCK(dp->port_rwlock) { struct dp_netdev_flow *netdev_flow; - struct miniflow key; - uint32_t buf[FLOW_U32S]; + struct { + struct miniflow flow; + uint32_t buf[FLOW_U32S]; + } key; if (ofpbuf_size(packet) < ETH_HEADER_LEN) { ofpbuf_delete(packet); return; } - miniflow_initialize(&key, buf); - miniflow_extract(packet, md, &key); + miniflow_initialize(&key.flow, key.buf); + miniflow_extract(packet, md, &key.flow); - netdev_flow = dp_netdev_lookup_flow(dp, &key); + netdev_flow = dp_netdev_lookup_flow(dp, &key.flow); if (netdev_flow) { struct dp_netdev_actions *actions; - dp_netdev_flow_used(netdev_flow, packet, &key); + dp_netdev_flow_used(netdev_flow, packet, &key.flow); actions = dp_netdev_flow_get_actions(netdev_flow); - dp_netdev_execute_actions(dp, &key, packet, true, md, + dp_netdev_execute_actions(dp, &key.flow, packet, true, md, actions->actions, actions->size); dp_netdev_count_packet(dp, DP_STAT_HIT); } else if (dp->handler_queues) { dp_netdev_count_packet(dp, DP_STAT_MISS); dp_netdev_output_userspace(dp, packet, - miniflow_hash_5tuple(&key, 0) + miniflow_hash_5tuple(&key.flow, 0) % dp->n_handlers, - DPIF_UC_MISS, &key, NULL); + DPIF_UC_MISS, &key.flow, NULL); ofpbuf_delete(packet); } } @@ -2160,7 +2160,7 @@ dp_execute_cb(void *aux_, struct ofpbuf *packet, if (hash_act->hash_alg == OVS_HASH_ALG_L4) { /* Hash need not be symmetric, nor does it need to include * L2 fields. */ - hash = miniflow_hash_5tuple(aux->key, hash_act->hash_bias); + hash = miniflow_hash_5tuple(aux->key, hash_act->hash_basis); if (!hash) { hash = 1; /* 0 is not valid */ }