mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 06:15:47 +00:00
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>
This commit is contained in:
committed by
Pravin B Shelar
parent
6e2f6e708f
commit
1f317cb5c2
@@ -1462,8 +1462,8 @@ dpif_netdev_flow_dump_next(const struct dpif *dpif, void *iter_, void *state_,
|
||||
odp_flow_key_from_flow(&buf, &netdev_flow->flow,
|
||||
netdev_flow->flow.in_port.odp_port);
|
||||
|
||||
*key = buf.data;
|
||||
*key_len = buf.size;
|
||||
*key = ofpbuf_data(&buf);
|
||||
*key_len = ofpbuf_size(&buf);
|
||||
}
|
||||
|
||||
if (key && mask) {
|
||||
@@ -1476,8 +1476,8 @@ dpif_netdev_flow_dump_next(const struct dpif *dpif, void *iter_, void *state_,
|
||||
odp_to_u32(wc.masks.in_port.odp_port),
|
||||
SIZE_MAX);
|
||||
|
||||
*mask = buf.data;
|
||||
*mask_len = buf.size;
|
||||
*mask = ofpbuf_data(&buf);
|
||||
*mask_len = ofpbuf_size(&buf);
|
||||
}
|
||||
|
||||
if (actions || stats) {
|
||||
@@ -1515,8 +1515,8 @@ dpif_netdev_execute(struct dpif *dpif, struct dpif_execute *execute)
|
||||
struct pkt_metadata *md = &execute->md;
|
||||
struct flow key;
|
||||
|
||||
if (execute->packet->size < ETH_HEADER_LEN ||
|
||||
execute->packet->size > UINT16_MAX) {
|
||||
if (ofpbuf_size(execute->packet) < ETH_HEADER_LEN ||
|
||||
ofpbuf_size(execute->packet) > UINT16_MAX) {
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
@@ -1966,7 +1966,7 @@ dp_netdev_flow_used(struct dp_netdev_flow *netdev_flow,
|
||||
ovs_mutex_lock(&bucket->mutex);
|
||||
bucket->used = MAX(now, bucket->used);
|
||||
bucket->packet_count++;
|
||||
bucket->byte_count += packet->size;
|
||||
bucket->byte_count += ofpbuf_size(packet);
|
||||
bucket->tcp_flags |= tcp_flags;
|
||||
ovs_mutex_unlock(&bucket->mutex);
|
||||
}
|
||||
@@ -1997,7 +1997,7 @@ dp_netdev_port_input(struct dp_netdev *dp, struct ofpbuf *packet,
|
||||
struct dp_netdev_flow *netdev_flow;
|
||||
struct flow key;
|
||||
|
||||
if (packet->size < ETH_HEADER_LEN) {
|
||||
if (ofpbuf_size(packet) < ETH_HEADER_LEN) {
|
||||
ofpbuf_delete(packet);
|
||||
return;
|
||||
}
|
||||
@@ -2045,13 +2045,13 @@ dp_netdev_output_userspace(struct dp_netdev *dp, struct ofpbuf *packet,
|
||||
if (userdata) {
|
||||
buf_size += NLA_ALIGN(userdata->nla_len);
|
||||
}
|
||||
buf_size += packet->size;
|
||||
buf_size += ofpbuf_size(packet);
|
||||
ofpbuf_init(buf, buf_size);
|
||||
|
||||
/* Put ODP flow. */
|
||||
odp_flow_key_from_flow(buf, flow, flow->in_port.odp_port);
|
||||
upcall->key = buf->data;
|
||||
upcall->key_len = buf->size;
|
||||
upcall->key = ofpbuf_data(buf);
|
||||
upcall->key_len = ofpbuf_size(buf);
|
||||
|
||||
/* Put userdata. */
|
||||
if (userdata) {
|
||||
@@ -2059,8 +2059,9 @@ dp_netdev_output_userspace(struct dp_netdev *dp, struct ofpbuf *packet,
|
||||
NLA_ALIGN(userdata->nla_len));
|
||||
}
|
||||
|
||||
upcall->packet.data = ofpbuf_put(buf, packet->data, packet->size);
|
||||
upcall->packet.size = packet->size;
|
||||
ofpbuf_set_data(&upcall->packet,
|
||||
ofpbuf_put(buf, ofpbuf_data(packet), ofpbuf_size(packet)));
|
||||
ofpbuf_set_size(&upcall->packet, ofpbuf_size(packet));
|
||||
|
||||
seq_change(q->seq);
|
||||
|
||||
|
Reference in New Issue
Block a user