X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fdpif.c;h=40741a45eb8d354b5cb20cf4e63ad033b3a5a7ab;hb=ba18611;hp=097b38d8c22aa7eeaf359d4912bb2d20995cceb9;hpb=43253595291318833572088595769b45a79c9c54;p=openvswitch diff --git a/lib/dpif.c b/lib/dpif.c index 097b38d8..40741a45 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, }; @@ -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,