#include "rtbsd.h"
#include "coverage.h"
+#include "dp-packet.h"
#include "dpif-netdev.h"
#include "dynamic-string.h"
#include "fatal-signal.h"
-#include "ofpbuf.h"
#include "openflow/openflow.h"
#include "ovs-thread.h"
-#include "packet-dpif.h"
#include "packets.h"
#include "poll-loop.h"
#include "shash.h"
* from rxq->pcap.
*/
static int
-netdev_rxq_bsd_recv_pcap(struct netdev_rxq_bsd *rxq, struct ofpbuf *buffer)
+netdev_rxq_bsd_recv_pcap(struct netdev_rxq_bsd *rxq, struct dp_packet *buffer)
{
struct pcap_arg arg;
int ret;
/* prepare the pcap argument to store the packet */
- arg.size = ofpbuf_tailroom(buffer);
- arg.data = ofpbuf_data(buffer);
+ arg.size = dp_packet_tailroom(buffer);
+ arg.data = dp_packet_data(buffer);
for (;;) {
ret = pcap_dispatch(rxq->pcap_handle, 1, proc_pkt, (u_char *) &arg);
if (ret > 0) {
- ofpbuf_set_size(buffer, ofpbuf_size(buffer) + arg.retval);
+ dp_packet_set_size(buffer, dp_packet_size(buffer) + arg.retval);
return 0;
}
if (ret == -1) {
* 'rxq->fd' is initialized with the tap file descriptor.
*/
static int
-netdev_rxq_bsd_recv_tap(struct netdev_rxq_bsd *rxq, struct ofpbuf *buffer)
+netdev_rxq_bsd_recv_tap(struct netdev_rxq_bsd *rxq, struct dp_packet *buffer)
{
- size_t size = ofpbuf_tailroom(buffer);
+ size_t size = dp_packet_tailroom(buffer);
for (;;) {
- ssize_t retval = read(rxq->fd, ofpbuf_data(buffer), size);
+ ssize_t retval = read(rxq->fd, dp_packet_data(buffer), size);
if (retval >= 0) {
- ofpbuf_set_size(buffer, ofpbuf_size(buffer) + retval);
+ dp_packet_set_size(buffer, dp_packet_size(buffer) + retval);
return 0;
} else if (errno != EINTR) {
if (errno != EAGAIN) {
}
static int
-netdev_bsd_rxq_recv(struct netdev_rxq *rxq_, struct dpif_packet **packets,
+netdev_bsd_rxq_recv(struct netdev_rxq *rxq_, struct dp_packet **packets,
int *c)
{
struct netdev_rxq_bsd *rxq = netdev_rxq_bsd_cast(rxq_);
struct netdev *netdev = rxq->up.netdev;
- struct dpif_packet *packet;
- struct ofpbuf *buffer;
+ struct dp_packet *packet;
ssize_t retval;
int mtu;
mtu = ETH_PAYLOAD_MAX;
}
- packet = dpif_packet_new_with_headroom(VLAN_ETH_HEADER_LEN + mtu,
+ packet = dp_packet_new_with_headroom(VLAN_ETH_HEADER_LEN + mtu,
DP_NETDEV_HEADROOM);
- buffer = &packet->ofpbuf;
-
retval = (rxq->pcap_handle
- ? netdev_rxq_bsd_recv_pcap(rxq, buffer)
- : netdev_rxq_bsd_recv_tap(rxq, buffer));
+ ? netdev_rxq_bsd_recv_pcap(rxq, packet)
+ : netdev_rxq_bsd_recv_tap(rxq, packet));
if (retval) {
- dpif_packet_delete(packet);
+ dp_packet_delete(packet);
} else {
- dp_packet_pad(buffer);
- dpif_packet_set_dp_hash(packet, 0);
+ dp_packet_pad(packet);
+ dp_packet_set_dp_hash(packet, 0);
packets[0] = packet;
*c = 1;
}
*/
static int
netdev_bsd_send(struct netdev *netdev_, int qid OVS_UNUSED,
- struct dpif_packet **pkts, int cnt, bool may_steal)
+ struct dp_packet **pkts, int cnt, bool may_steal)
{
struct netdev_bsd *dev = netdev_bsd_cast(netdev_);
const char *name = netdev_get_name(netdev_);
}
for (i = 0; i < cnt; i++) {
- const void *data = ofpbuf_data(&pkts[i]->ofpbuf);
- size_t size = ofpbuf_size(&pkts[i]->ofpbuf);
+ const void *data = dp_packet_data(pkts[i]);
+ size_t size = dp_packet_size(pkts[i]);
while (!error) {
ssize_t retval;
ovs_mutex_unlock(&dev->mutex);
if (may_steal) {
for (i = 0; i < cnt; i++) {
- dpif_packet_delete(pkts[i]);
+ dp_packet_delete(pkts[i]);
}
}