summaryrefslogtreecommitdiff
path: root/lib/netdev.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/netdev.c')
-rw-r--r--lib/netdev.c42
1 files changed, 33 insertions, 9 deletions
diff --git a/lib/netdev.c b/lib/netdev.c
index b76da139a..45f7f29a0 100644
--- a/lib/netdev.c
+++ b/lib/netdev.c
@@ -34,6 +34,7 @@
#include "netdev-dpdk.h"
#include "netdev-provider.h"
#include "netdev-vport.h"
+#include "odp-netlink.h"
#include "openflow/openflow.h"
#include "packets.h"
#include "poll-loop.h"
@@ -43,6 +44,7 @@
#include "sset.h"
#include "svec.h"
#include "openvswitch/vlog.h"
+#include "flow.h"
VLOG_DEFINE_THIS_MODULE(netdev);
@@ -108,7 +110,8 @@ bool
netdev_is_pmd(const struct netdev *netdev)
{
return (!strcmp(netdev->netdev_class->type, "dpdk") ||
- !strcmp(netdev->netdev_class->type, "dpdkr"));
+ !strcmp(netdev->netdev_class->type, "dpdkr") ||
+ !strcmp(netdev->netdev_class->type, "dpdkvhost"));
}
static void
@@ -733,16 +736,30 @@ netdev_send(struct netdev *netdev, int qid, struct dp_packet **buffers,
int
netdev_pop_header(struct netdev *netdev, struct dp_packet **buffers, int cnt)
{
- return (netdev->netdev_class->pop_header
- ? netdev->netdev_class->pop_header(netdev, buffers, cnt)
- : EOPNOTSUPP);
+ int i;
+
+ if (!netdev->netdev_class->pop_header) {
+ return EOPNOTSUPP;
+ }
+
+ for (i = 0; i < cnt; i++) {
+ int err;
+
+ err = netdev->netdev_class->pop_header(buffers[i]);
+ if (err) {
+ dp_packet_clear(buffers[i]);
+ }
+ }
+
+ return 0;
}
int
-netdev_build_header(const struct netdev *netdev, struct ovs_action_push_tnl *data)
+netdev_build_header(const struct netdev *netdev, struct ovs_action_push_tnl *data,
+ const struct flow *tnl_flow)
{
if (netdev->netdev_class->build_header) {
- return netdev->netdev_class->build_header(netdev, data);
+ return netdev->netdev_class->build_header(netdev, data, tnl_flow);
}
return EOPNOTSUPP;
}
@@ -752,11 +769,18 @@ netdev_push_header(const struct netdev *netdev,
struct dp_packet **buffers, int cnt,
const struct ovs_action_push_tnl *data)
{
- if (netdev->netdev_class->push_header) {
- return netdev->netdev_class->push_header(netdev, buffers, cnt, data);
- } else {
+ int i;
+
+ if (!netdev->netdev_class->push_header) {
return -EINVAL;
}
+
+ for (i = 0; i < cnt; i++) {
+ netdev->netdev_class->push_header(buffers[i], data);
+ buffers[i]->md = PKT_METADATA_INITIALIZER(u32_to_odp(data->out_port));
+ }
+
+ return 0;
}
/* Registers with the poll loop to wake up from the next call to poll_block()