From: Ben Pfaff Date: Mon, 25 Jan 2010 18:52:28 +0000 (-0800) Subject: Merge "sflow" into "master". X-Git-Tag: v0.99.1~1 X-Git-Url: http://git.onelab.eu/?p=sliver-openvswitch.git;a=commitdiff_plain;h=49c36903d6d65bed96cba31f05534510a21a68d7 Merge "sflow" into "master". No conflicts, but lib/dpif.c needed a few changes since struct dpif's member "class" was renamed to "dpif_class" in master since sflow was branched off. --- 49c36903d6d65bed96cba31f05534510a21a68d7 diff --cc lib/dpif.c index 72184c840,6eaa5e0c8..7edaf31b4 --- a/lib/dpif.c +++ b/lib/dpif.c @@@ -845,6 -844,41 +845,41 @@@ dpif_recv_set_mask(struct dpif *dpif, i return error; } + /* Retrieve the sFlow sampling probability. '*probability' is expressed as the + * number of packets out of UINT_MAX to sample, e.g. probability/UINT_MAX is + * the probability of sampling a given packet. + * + * Returns 0 if successful, otherwise a positive errno value. EOPNOTSUPP + * indicates that 'dpif' does not support sFlow sampling. */ + int + dpif_get_sflow_probability(const struct dpif *dpif, uint32_t *probability) + { - int error = (dpif->class->get_sflow_probability - ? dpif->class->get_sflow_probability(dpif, probability) ++ int error = (dpif->dpif_class->get_sflow_probability ++ ? dpif->dpif_class->get_sflow_probability(dpif, probability) + : EOPNOTSUPP); + if (error) { + *probability = 0; + } + log_operation(dpif, "get_sflow_probability", error); + return error; + } + + /* Set the sFlow sampling probability. 'probability' is expressed as the + * number of packets out of UINT_MAX to sample, e.g. probability/UINT_MAX is + * the probability of sampling a given packet. + * + * Returns 0 if successful, otherwise a positive errno value. EOPNOTSUPP + * indicates that 'dpif' does not support sFlow sampling. */ + int + dpif_set_sflow_probability(struct dpif *dpif, uint32_t probability) + { - int error = (dpif->class->set_sflow_probability - ? dpif->class->set_sflow_probability(dpif, probability) ++ int error = (dpif->dpif_class->set_sflow_probability ++ ? dpif->dpif_class->set_sflow_probability(dpif, probability) + : EOPNOTSUPP); + log_operation(dpif, "set_sflow_probability", error); + return error; + } + /* Attempts to receive a message from 'dpif'. If successful, stores the * message into '*packetp'. The message, if one is received, will begin with * 'struct odp_msg' as a header. Only messages of the types selected with