From 53a4218dca89c70bf1e3230827b00af54386c8ff Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Tue, 16 Jun 2009 10:59:43 -0700 Subject: [PATCH] dpif: New function dpif_get_netflow_ids(). The 'minor' member of struct dpif is used for two different purposes: for printing in log messages and for encapsulating in NetFlow messages. The needs in each case are different, so we should break up these uses. This commit does half of that, by introducing a new function to retrieve NetFlow ids and using it where appropriate. --- lib/dpif.c | 7 +++++++ lib/dpif.h | 2 ++ vswitchd/bridge.c | 4 ++-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/dpif.c b/lib/dpif.c index 3dc7af007..bcb4e7b44 100644 --- a/lib/dpif.c +++ b/lib/dpif.c @@ -680,6 +680,13 @@ dpif_recv_wait(struct dpif *dpif) { poll_fd_wait(dpif->fd, POLLIN); } + +void +dpif_get_netflow_ids(const struct dpif *dpif, + uint8_t *engine_type, uint8_t *engine_id) +{ + *engine_type = *engine_id = dpif->minor; +} struct dpifmon { struct dpif dpif; diff --git a/lib/dpif.h b/lib/dpif.h index a0e603114..52e8075b5 100644 --- a/lib/dpif.h +++ b/lib/dpif.h @@ -89,6 +89,8 @@ dpif_id(const struct dpif *dpif) { return dpif->minor; } +void dpif_get_netflow_ids(const struct dpif *, + uint8_t *engine_type, uint8_t *engine_id); struct dpifmon; diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index 7ecf12458..47d67e37e 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -481,8 +481,7 @@ bridge_reconfigure(void) uint64_t dpid; struct iface *local_iface = NULL; const char *devname; - uint8_t engine_type = br->dpif.minor; - uint8_t engine_id = br->dpif.minor; + uint8_t engine_type, engine_id; bool add_id_to_iface = false; struct svec nf_hosts; @@ -529,6 +528,7 @@ bridge_reconfigure(void) ofproto_set_datapath_id(br->ofproto, dpid); /* Set NetFlow configuration on this bridge. */ + dpif_get_netflow_ids(&br->dpif, &engine_type, &engine_id); if (cfg_has("netflow.%s.engine-type", br->name)) { engine_type = cfg_get_int(0, "netflow.%s.engine-type", br->name); -- 2.43.0