return error;
}
- int error = (dpif->class->get_sflow_probability
- ? dpif->class->get_sflow_probability(dpif, probability)
+ /* 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->set_sflow_probability
- ? dpif->class->set_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->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