Here's an incremental. --- ofproto/ofproto-dpif.c | 55 +++++++++++++++++++++++-------------------- ofproto/ofproto-provider.h | 8 ++++-- ofproto/ofproto.c | 8 ++++-- vswitchd/vswitch.xml | 2 +- 4 files changed, 40 insertions(+), 33 deletions(-)
diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index b32df2e..650cb1f 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -326,12 +326,15 @@ struct ofport_dpif { enum stp_state stp_state; /* Always STP_DISABLED if STP not in use. */ long long int stp_state_entered; - struct hmap priorities; /* Map of attached 'priority_node's. */ + struct hmap priorities; /* Map of attached 'priority_to_dscp's. */ }; -struct priority_node { - uint32_t priority; /* Priority of this queue. */ +/* Node in 'ofport_dpif''s 'priorities' map. Used to maintain a map from + * 'priority' (the datapath's term for QoS queue) to the dscp bits which all + * traffic egressing the 'ofport' with that priority should be marked with. */ +struct priority_to_dscp { struct hmap_node hmap_node; /* Node in 'ofport_dpif''s 'priorities' map. */ + uint32_t priority; /* Priority of this queue (see struct flow). */ uint8_t dscp; /* DSCP bits to mark outgoing traffic with. */ }; @@ -1186,16 +1189,16 @@ stp_process_packet(const struct ofport_dpif *ofport, } } -static struct priority_node * +static struct priority_to_dscp * get_priority(const struct ofport_dpif *ofport, uint32_t priority) { - struct priority_node *pnode; + struct priority_to_dscp *pdscp; uint32_t hash; hash = hash_int(priority, 0); - HMAP_FOR_EACH_IN_BUCKET (pnode, hmap_node, hash, &ofport->priorities) { - if (pnode->priority == priority) { - return pnode; + HMAP_FOR_EACH_IN_BUCKET (pdscp, hmap_node, hash, &ofport->priorities) { + if (pdscp->priority == priority) { + return pdscp; } } return NULL; @@ -1204,11 +1207,11 @@ get_priority(const struct ofport_dpif *ofport, uint32_t priority) static void ofport_clear_priorities(struct ofport_dpif *ofport) { - struct priority_node *pnode, *next; + struct priority_to_dscp *pdscp, *next; - HMAP_FOR_EACH_SAFE (pnode, next, hmap_node, &ofport->priorities) { - hmap_remove(&ofport->priorities, &pnode->hmap_node); - free(pnode); + HMAP_FOR_EACH_SAFE (pdscp, next, hmap_node, &ofport->priorities) { + hmap_remove(&ofport->priorities, &pdscp->hmap_node); + free(pdscp); } } @@ -1223,7 +1226,7 @@ set_queues(struct ofport *ofport_, size_t i; for (i = 0; i < n_qdscp; i++) { - struct priority_node *pnode; + struct priority_to_dscp *pdscp; uint32_t priority; uint8_t dscp; @@ -1233,22 +1236,22 @@ set_queues(struct ofport *ofport_, continue; } - pnode = get_priority(ofport, priority); - if (pnode) { - hmap_remove(&ofport->priorities, &pnode->hmap_node); + pdscp = get_priority(ofport, priority); + if (pdscp) { + hmap_remove(&ofport->priorities, &pdscp->hmap_node); } else { - pnode = xmalloc(sizeof *pnode); - pnode->priority = priority; - pnode->dscp = dscp; + pdscp = xmalloc(sizeof *pdscp); + pdscp->priority = priority; + pdscp->dscp = dscp; ofproto->need_revalidate = true; } - if (pnode->dscp != dscp) { - pnode->dscp = dscp; + if (pdscp->dscp != dscp) { + pdscp->dscp = dscp; ofproto->need_revalidate = true; } - hmap_insert(&new, &pnode->hmap_node, hash_int(pnode->priority, 0)); + hmap_insert(&new, &pdscp->hmap_node, hash_int(pdscp->priority, 0)); } if (!hmap_is_empty(&ofport->priorities)) { @@ -3868,17 +3871,17 @@ compose_output_action__(struct action_xlate_ctx *ctx, uint16_t ofp_port, uint8_t flow_nw_tos = ctx->flow.nw_tos; if (ofport) { - struct priority_node *pnode; + struct priority_to_dscp *pdscp; if (ofport->up.opp.config & htonl(OFPPC_NO_FWD) || (check_stp && !stp_forward_in_state(ofport->stp_state))) { return; } - pnode = get_priority(ofport, ctx->flow.priority); - if (pnode) { + pdscp = get_priority(ofport, ctx->flow.priority); + if (pdscp) { ctx->flow.nw_tos &= ~IP_DSCP_MASK; - ctx->flow.nw_tos |= pnode->dscp; + ctx->flow.nw_tos |= pdscp->dscp; } } else { /* We may not have an ofport record for this port, but it doesn't hurt diff --git a/ofproto/ofproto-provider.h b/ofproto/ofproto-provider.h index ed06a35..d303632 100644 --- a/ofproto/ofproto-provider.h +++ b/ofproto/ofproto-provider.h @@ -965,9 +965,11 @@ struct ofproto_class { int (*get_stp_port_status)(struct ofport *ofport, struct ofproto_port_stp_status *s); - /* Registers the Quality of Service 'queues' associated with 'ofport'. - * 'queues' is an array of Queue elements in arbitrary order with 'n_qdscp' - * elements. + /* Registers meta-data associated with the 'n_qdscp' Qualities of Service + * 'queues' attached to 'ofport'. This data is not intended to be + * sufficient to implement QoS. Instead, providers may use this + * information to implement features which require knowledge of what queues + * exist on a port, and some basic information about them. * * EOPNOTSUPP as a return value indicates that this ofproto_class does not * support QoS, as does a null pointer. */ diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index f08d64e..af02a0e 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -605,9 +605,11 @@ ofproto_port_get_stp_status(struct ofproto *ofproto, uint16_t ofp_port, /* Queue DSCP configuration. */ -/* Registers the Quality of Service 'queues' associated with 'ofp_port' in - * 'ofproto'. 'queues' is an array of Queue elements in arbitrary order with - * 'n_qdscp' elements. +/* Registers meta-data associated with the 'n_qdscp' Qualities of Service + * 'queues' attached to 'ofport'. This data is not intended to be sufficient + * to implement QoS. Instead, it is used to implement features which require + * knowledge of what queues exist on a port, and some basic information about + * them. * * Returns 0 if successful, otherwise a positive errno value. */ int diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml index 9bbd532..8eba5cb 100644 --- a/vswitchd/vswitch.xml +++ b/vswitchd/vswitch.xml @@ -1845,7 +1845,7 @@ <column name="dscp"> If set, Open vSwitch will mark all traffic egressing this <ref table="Queue"/> with the given DSCP bits. Traffic egressing the - default <ref table="Queue"/> is only marked if it was explicity selected + default <ref table="Queue"/> is only marked if it was explicitly selected as the <ref table="Queue"/> at the time the packet was output. If unset, the DSCP bits of traffic egressing this <ref table="Queue"/> will remain unchanged. -- 1.7.7.1 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev