X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fdpif.c;h=01e905d936cafa61db25d1608b17ae2bba67d70a;hb=refs%2Fheads%2Flts-1.0a;hp=097b38d8c22aa7eeaf359d4912bb2d20995cceb9;hpb=43253595291318833572088595769b45a79c9c54;p=sliver-openvswitch.git diff --git a/lib/dpif.c b/lib/dpif.c index 097b38d8c..01e905d93 100644 --- a/lib/dpif.c +++ b/lib/dpif.c @@ -37,12 +37,14 @@ #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 &dpif_linux_class, +#endif &dpif_netdev_class, }; @@ -319,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); @@ -1094,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,