X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fdpif.c;h=01e905d936cafa61db25d1608b17ae2bba67d70a;hb=cd8055cce3e9dcd20c6125f064d73ef04b99aee4;hp=8286da402ae808c48019dcef9c019e7f7338ebef;hpb=c83cdd307248d798eac0d85681b0abeaaff1bf61;p=openvswitch diff --git a/lib/dpif.c b/lib/dpif.c index 8286da40..01e905d9 100644 --- a/lib/dpif.c +++ b/lib/dpif.c @@ -37,9 +37,9 @@ #include "svec.h" #include "util.h" #include "valgrind.h" - #include "vlog.h" -#define THIS_MODULE VLM_dpif + +VLOG_DEFINE_THIS_MODULE(dpif) static const struct dpif_class *base_dpif_classes[] = { #ifdef HAVE_NETLINK @@ -321,7 +321,7 @@ dpif_close(struct dpif *dpif) if (dpif) { struct registered_dpif_class *registered_class; - registered_class = shash_find_data(&dpif_classes, + registered_class = shash_find_data(&dpif_classes, dpif->dpif_class->type); assert(registered_class); assert(registered_class->refcount); @@ -1096,6 +1096,25 @@ dpif_get_netflow_ids(const struct dpif *dpif, *engine_type = dpif->netflow_engine_type; *engine_id = dpif->netflow_engine_id; } + +/* Translates OpenFlow queue ID 'queue_id' (in host byte order) into a priority + * value for use in the ODPAT_SET_PRIORITY action. On success, returns 0 and + * stores the priority into '*priority'. On failure, returns a positive errno + * value and stores 0 into '*priority'. */ +int +dpif_queue_to_priority(const struct dpif *dpif, uint32_t queue_id, + uint32_t *priority) +{ + int error = (dpif->dpif_class->queue_to_priority + ? dpif->dpif_class->queue_to_priority(dpif, queue_id, + priority) + : EOPNOTSUPP); + if (error) { + *priority = 0; + } + log_operation(dpif, "queue_to_priority", error); + return error; +} void dpif_init(struct dpif *dpif, const struct dpif_class *dpif_class,