This keeps packets that can be minutes old from getting forwarded.
stats.n_missed += s->n_missed;
stats.n_lost += s->n_lost;
}
+ stats.max_miss_queue = DP_MAX_QUEUE_LEN;
+ stats.max_action_queue = DP_MAX_QUEUE_LEN;
return copy_to_user(statsp, &stats, sizeof stats);
}
__u64 n_frags; /* Number of dropped IP fragments. */
__u64 n_hit; /* Number of flow table matches. */
__u64 n_missed; /* Number of flow table misses. */
- __u64 n_lost; /* Number of misses not sent to userspace. */
+ __u64 n_lost; /* Number of misses not sent to userspace. */
+
+ /* Queues. */
+ __u16 max_miss_queue; /* Max length of ODPL_MISS queue. */
+ __u16 max_action_queue; /* Max length of ODPL_ACTION queue. */
};
/* Logical ports. */
return IOCTL(dpif, ODP_SET_LISTEN_MASK, &listen_mask);
}
+int
+dpif_purge(struct dpif *dpif)
+{
+ struct odp_stats stats;
+ unsigned int i;
+ int error;
+
+ error = dpif_get_dp_stats(dpif, &stats);
+ if (error) {
+ return error;
+ }
+
+ for (i = 0; i < stats.max_miss_queue + stats.max_action_queue; i++) {
+ struct ofpbuf *buf;
+ error = dpif_recv(dpif, &buf);
+ if (error) {
+ return error == EAGAIN ? 0 : error;
+ }
+ ofpbuf_delete(buf);
+ }
+ return 0;
+}
+
int
dpif_port_add(struct dpif *dpif, const char *devname, uint16_t port_no)
{
int dpif_get_listen_mask(const struct dpif *, int *listen_mask);
int dpif_set_listen_mask(struct dpif *, int listen_mask);
+int dpif_purge(struct dpif *);
int dpif_port_add(struct dpif *, const char *devname, uint16_t port_no);
int dpif_port_del(struct dpif *, uint16_t port_no);
return error;
}
dpif_flow_flush(&dpif);
+ dpif_purge(&dpif);
/* Start monitoring datapath ports for status changes. */
error = dpifmon_create(datapath, &dpifmon);