diff options
author | Pravin Shelar <pshelar@nicira.com> | 2014-03-30 01:31:50 -0700 |
---|---|---|
committer | Pravin B Shelar <pshelar@nicira.com> | 2014-03-30 06:18:43 -0700 |
commit | 1f317cb5c2aa446c4b0252634a4a70dcc3682f93 (patch) | |
tree | 340ff378a96bbd710b75a51e77cda57498bd4c8f /ofproto/netflow.c | |
parent | 6e2f6e708fb9bdb5443f8854016ea4f6fa73b355 (diff) | |
download | openvswitch-1f317cb5c2aa446c4b0252634a4a70dcc3682f93.tar.gz |
ofpbuf: Introduce access api for base, data and size.
These functions will be used by later patches. Following patch
does not change functionality.
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Diffstat (limited to 'ofproto/netflow.c')
-rw-r--r-- | ofproto/netflow.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/ofproto/netflow.c b/ofproto/netflow.c index a09374999..7729906c1 100644 --- a/ofproto/netflow.c +++ b/ofproto/netflow.c @@ -110,7 +110,7 @@ gen_netflow_rec(struct netflow *nf, struct netflow_flow *nf_flow, struct netflow_v5_header *nf_hdr; struct netflow_v5_record *nf_rec; - if (!nf->packet.size) { + if (!ofpbuf_size(&nf->packet)) { struct timespec now; time_wall_timespec(&now); @@ -127,7 +127,7 @@ gen_netflow_rec(struct netflow *nf, struct netflow_flow *nf_flow, nf_hdr->sampling_interval = htons(0); } - nf_hdr = nf->packet.data; + nf_hdr = ofpbuf_data(&nf->packet); nf_hdr->count = htons(ntohs(nf_hdr->count) + 1); nf_rec = ofpbuf_put_zeros(&nf->packet, sizeof *nf_rec); @@ -313,9 +313,9 @@ netflow_run__(struct netflow *nf) OVS_REQUIRES(mutex) long long int now = time_msec(); struct netflow_flow *nf_flow, *next; - if (nf->packet.size) { - collectors_send(nf->collectors, nf->packet.data, nf->packet.size); - nf->packet.size = 0; + if (ofpbuf_size(&nf->packet)) { + collectors_send(nf->collectors, ofpbuf_data(&nf->packet), ofpbuf_size(&nf->packet)); + ofpbuf_set_size(&nf->packet, 0); } if (!nf->active_timeout || now < nf->next_timeout) { @@ -354,7 +354,7 @@ netflow_wait(struct netflow *nf) OVS_EXCLUDED(mutex) if (nf->active_timeout) { poll_timer_wait_until(nf->next_timeout); } - if (nf->packet.size) { + if (ofpbuf_size(&nf->packet)) { poll_immediate_wake(); } ovs_mutex_unlock(&mutex); |