mirror of
https://github.com/openvswitch/ovs
synced 2025-09-05 00:35:33 +00:00
dpif-netdev: Use ofpbuf functions instead of their out-of-line expansions.
Acked-by: Jesse Gross <jesse@nicira.com>
This commit is contained in:
@@ -815,7 +815,7 @@ dpif_netdev_execute(struct dpif *dpif,
|
|||||||
/* We need a deep copy of 'packet' since we're going to modify its
|
/* We need a deep copy of 'packet' since we're going to modify its
|
||||||
* data. */
|
* data. */
|
||||||
ofpbuf_init(©, DP_NETDEV_HEADROOM + packet->size);
|
ofpbuf_init(©, DP_NETDEV_HEADROOM + packet->size);
|
||||||
copy.data = (char*)copy.base + DP_NETDEV_HEADROOM;
|
ofpbuf_reserve(©, DP_NETDEV_HEADROOM);
|
||||||
ofpbuf_put(©, packet->data, packet->size);
|
ofpbuf_put(©, packet->data, packet->size);
|
||||||
} else {
|
} else {
|
||||||
/* We still need a shallow copy of 'packet', even though we won't
|
/* We still need a shallow copy of 'packet', even though we won't
|
||||||
@@ -951,8 +951,8 @@ dp_netdev_run(void)
|
|||||||
int error;
|
int error;
|
||||||
|
|
||||||
/* Reset packet contents. */
|
/* Reset packet contents. */
|
||||||
packet.data = (char*)packet.base + DP_NETDEV_HEADROOM;
|
ofpbuf_clear(&packet);
|
||||||
packet.size = 0;
|
ofpbuf_reserve(&packet, DP_NETDEV_HEADROOM);
|
||||||
|
|
||||||
error = netdev_recv(port->netdev, &packet);
|
error = netdev_recv(port->netdev, &packet);
|
||||||
if (!error) {
|
if (!error) {
|
||||||
@@ -1025,8 +1025,7 @@ dp_netdev_strip_vlan(struct ofpbuf *packet)
|
|||||||
memcpy(tmp.eth_src, veh->veth_src, ETH_ADDR_LEN);
|
memcpy(tmp.eth_src, veh->veth_src, ETH_ADDR_LEN);
|
||||||
tmp.eth_type = veh->veth_next_type;
|
tmp.eth_type = veh->veth_next_type;
|
||||||
|
|
||||||
packet->size -= VLAN_HEADER_LEN;
|
ofpbuf_pull(packet, VLAN_HEADER_LEN);
|
||||||
packet->data = (char*)packet->data + VLAN_HEADER_LEN;
|
|
||||||
packet->l2 = (char*)packet->l2 + VLAN_HEADER_LEN;
|
packet->l2 = (char*)packet->l2 + VLAN_HEADER_LEN;
|
||||||
memcpy(packet->data, &tmp, sizeof tmp);
|
memcpy(packet->data, &tmp, sizeof tmp);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user