X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fdpif-linux.c;h=3920d462f7e5bd374b664bd85d7221e92f2ecfd8;hb=67a4917b07031b387beafaedce413b4207214059;hp=8216d18709933294c4f17b87ffed80402ad5b6fc;hpb=3f355f47f8e7343e909ccfa854454d667baf3c38;p=sliver-openvswitch.git diff --git a/lib/dpif-linux.c b/lib/dpif-linux.c index 8216d1870..3920d462f 100644 --- a/lib/dpif-linux.c +++ b/lib/dpif-linux.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009 Nicira Networks. + * Copyright (c) 2008, 2009, 2010 Nicira Networks. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -107,7 +107,7 @@ dpif_linux_enumerate(struct svec *all_dps) } static int -dpif_linux_open(const char *name UNUSED, char *suffix, bool create, +dpif_linux_open(const char *name OVS_UNUSED, char *suffix, bool create, struct dpif **dpifp) { int minor; @@ -196,6 +196,7 @@ dpif_linux_delete(struct dpif *dpif_) static int dpif_linux_get_stats(const struct dpif *dpif_, struct odp_stats *stats) { + memset(stats, 0, sizeof *stats); return do_ioctl(dpif_, ODP_DP_STATS, stats); } @@ -395,6 +396,19 @@ dpif_linux_recv_set_mask(struct dpif *dpif_, int listen_mask) return do_ioctl(dpif_, ODP_SET_LISTEN_MASK, &listen_mask); } +static int +dpif_linux_get_sflow_probability(const struct dpif *dpif_, + uint32_t *probability) +{ + return do_ioctl(dpif_, ODP_GET_SFLOW_PROBABILITY, probability); +} + +static int +dpif_linux_set_sflow_probability(struct dpif *dpif_, uint32_t probability) +{ + return do_ioctl(dpif_, ODP_SET_SFLOW_PROBABILITY, &probability); +} + static int dpif_linux_recv(struct dpif *dpif_, struct ofpbuf **bufp) { @@ -419,7 +433,7 @@ dpif_linux_recv(struct dpif *dpif_, struct ofpbuf **bufp) return 0; } else { VLOG_WARN_RL(&error_rl, "%s: discarding message truncated " - "from %zu bytes to %d", + "from %"PRIu32" bytes to %d", dpif_name(dpif_), msg->length, retval); error = ERANGE; } @@ -475,6 +489,8 @@ const struct dpif_class dpif_linux_class = { dpif_linux_execute, dpif_linux_recv_get_mask, dpif_linux_recv_set_mask, + dpif_linux_get_sflow_probability, + dpif_linux_set_sflow_probability, dpif_linux_recv, dpif_linux_recv_wait, }; @@ -555,13 +571,14 @@ make_openvswitch_device(int minor, char **fnp) struct stat s; char fn[128]; + *fnp = NULL; + major = get_openvswitch_major(); if (major < 0) { return -major; } dev = makedev(major, minor); - *fnp = NULL; sprintf(fn, "%s/dp%d", dirname, minor); if (!stat(fn, &s)) { if (!S_ISCHR(s.st_mode)) {