Rename "odp" to "xflow".
authorBen Pfaff <blp@nicira.com>
Thu, 1 Apr 2010 23:45:39 +0000 (16:45 -0700)
committerBen Pfaff <blp@nicira.com>
Thu, 1 Apr 2010 23:54:55 +0000 (16:54 -0700)
In an upcoming commit we will have two layers of datapaths: a high-level
datapath that supports wildcards and a low-level datapath that only
supports exact-match flows.  This is confusing enough without the two
layers having similar names.  This commit attempts to fix the naming
problem in advance, by renaming the exact-match only layer from "odp"
to "xflow" (which stands for "exact-match flow").

47 files changed:
SubmittingPatches
datapath/actions.c
datapath/actions.h
datapath/datapath.c
datapath/datapath.h
datapath/dp_notify.c
datapath/dp_sysfs_dp.c
datapath/dp_sysfs_if.c
datapath/flow.c
datapath/flow.h
datapath/table.c
include/openvswitch/automake.mk
include/openvswitch/datapath-protocol.h [deleted file]
include/openvswitch/xflow.h [new file with mode: 0644]
lib/automake.mk
lib/dpif-netdev.c [deleted file]
lib/dpif.h [deleted file]
lib/flow.c
lib/flow.h
lib/rtnetlink.c
lib/vconn.c
lib/vlog-modules.def
lib/xfif-linux.c [moved from lib/dpif-linux.c with 58% similarity]
lib/xfif-netdev.c [new file with mode: 0644]
lib/xfif-provider.h [moved from lib/dpif-provider.h with 61% similarity]
lib/xfif.c [moved from lib/dpif.c with 58% similarity]
lib/xfif.h [new file with mode: 0644]
lib/xfif.man [moved from lib/dpif.man with 100% similarity]
lib/xflow-util.c [moved from lib/odp-util.c with 77% similarity]
lib/xflow-util.h [moved from lib/odp-util.h with 53% similarity]
ofproto/discovery.c
ofproto/discovery.h
ofproto/fail-open.c
ofproto/in-band.c
ofproto/in-band.h
ofproto/ofproto-sflow.c
ofproto/ofproto-sflow.h
ofproto/ofproto.c
ofproto/ofproto.h
ofproto/pinsched.c
utilities/ovs-dpctl.8.in
utilities/ovs-dpctl.c
utilities/ovs-ofctl.c
utilities/ovs-openflowd.8.in
utilities/ovs-openflowd.c
vswitchd/bridge.c
vswitchd/ovs-vswitchd.c

index 280f11e..99eb953 100644 (file)
@@ -145,7 +145,7 @@ true (at the time) for bridges named dpN.  Now that assumption has been
 eliminated, so this commit eliminates the restriction too.
 
 This change is also a cleanup in that it eliminates one form of the
-vswitch's dependence on specifics of the dpif implementation.
+vswitch's dependence on specifics of the xfif implementation.
 ---
  vswitchd/bridge.c               |   23 +++++------------------
  vswitchd/ovs-vswitchd.conf.5.in |    3 +--
@@ -195,10 +195,10 @@ index 32647ea..00cffbc 100644
 @@ -793,7 +780,7 @@ bridge_create(const char *name)
      br = xzalloc(sizeof *br);
  
-     error = dpif_create(name, &br->dpif);
+     error = xfif_create(name, &br->xfif);
 -    if (error == EEXIST) {
 +    if (error == EEXIST || error == EBUSY) {
-         error = dpif_open(name, &br->dpif);
+         error = xfif_open(name, &br->xfif);
          if (error) {
              VLOG_ERR("datapath %s already exists but cannot be opened: %s",
 diff --git a/vswitchd/ovs-vswitchd.conf.5.in b/vswitchd/ovs-vswitchd.conf.5.in
index d8b6691..64e8588 100644 (file)
@@ -21,7 +21,7 @@
 #include "datapath.h"
 #include "dp_dev.h"
 #include "actions.h"
-#include "openvswitch/datapath-protocol.h"
+#include "openvswitch/xflow.h"
 
 static struct sk_buff *
 make_writable(struct sk_buff *skb, unsigned min_headroom, gfp_t gfp)
@@ -86,7 +86,7 @@ vlan_pull_tag(struct sk_buff *skb)
 
 static struct sk_buff *
 modify_vlan_tci(struct datapath *dp, struct sk_buff *skb,
-               struct odp_flow_key *key, const union odp_action *a,
+               struct xflow_key *key, const union xflow_action *a,
                int n_actions, gfp_t gfp)
 {
        __be16 mask = a->dl_tci.mask;
@@ -156,7 +156,7 @@ modify_vlan_tci(struct datapath *dp, struct sk_buff *skb,
                                segs = __vlan_put_tag(segs, ntohs(tci));
                                err = -ENOMEM;
                                if (segs) {
-                                       struct odp_flow_key segkey = *key;
+                                       struct xflow_key segkey = *key;
                                        err = execute_actions(dp, segs,
                                                              &segkey, a + 1,
                                                              n_actions - 1,
@@ -199,7 +199,7 @@ modify_vlan_tci(struct datapath *dp, struct sk_buff *skb,
 }
 
 static struct sk_buff *strip_vlan(struct sk_buff *skb,
-                                 struct odp_flow_key *key, gfp_t gfp)
+                                 struct xflow_key *key, gfp_t gfp)
 {
        skb = make_writable(skb, 0, gfp);
        if (skb) {
@@ -210,14 +210,14 @@ static struct sk_buff *strip_vlan(struct sk_buff *skb,
 }
 
 static struct sk_buff *set_dl_addr(struct sk_buff *skb,
-                                  struct odp_flow_key *key,
-                                  const struct odp_action_dl_addr *a,
+                                  struct xflow_key *key,
+                                  const struct xflow_action_dl_addr *a,
                                   gfp_t gfp)
 {
        skb = make_writable(skb, 0, gfp);
        if (skb) {
                struct ethhdr *eh = eth_hdr(skb);
-               if (a->type == ODPAT_SET_DL_SRC) {
+               if (a->type == XFLOWAT_SET_DL_SRC) {
                        memcpy(eh->h_source, a->dl_addr, ETH_ALEN);
                        memcpy(key->dl_src, a->dl_addr, ETH_ALEN);
                } else {
@@ -249,8 +249,8 @@ static void update_csum(__sum16 *sum, struct sk_buff *skb,
 }
 
 static struct sk_buff *set_nw_addr(struct sk_buff *skb,
-                                  struct odp_flow_key *key,
-                                  const struct odp_action_nw_addr *a,
+                                  struct xflow_key *key,
+                                  const struct xflow_action_nw_addr *a,
                                   gfp_t gfp)
 {
        if (key->dl_type != htons(ETH_P_IP))
@@ -259,7 +259,7 @@ static struct sk_buff *set_nw_addr(struct sk_buff *skb,
        skb = make_writable(skb, 0, gfp);
        if (skb) {
                struct iphdr *nh = ip_hdr(skb);
-               u32 *f = a->type == ODPAT_SET_NW_SRC ? &nh->saddr : &nh->daddr;
+               u32 *f = a->type == XFLOWAT_SET_NW_SRC ? &nh->saddr : &nh->daddr;
                u32 old = *f;
                u32 new = a->nw_addr;
 
@@ -273,7 +273,7 @@ static struct sk_buff *set_nw_addr(struct sk_buff *skb,
                update_csum(&nh->check, skb, old, new, 0);
                *f = new;
 
-               if (a->type == ODPAT_SET_NW_SRC)
+               if (a->type == XFLOWAT_SET_NW_SRC)
                        key->nw_src = a->nw_addr;
                else
                        key->nw_dst = a->nw_addr;
@@ -282,8 +282,8 @@ static struct sk_buff *set_nw_addr(struct sk_buff *skb,
 }
 
 static struct sk_buff *set_nw_tos(struct sk_buff *skb,
-                                  struct odp_flow_key *key,
-                                  const struct odp_action_nw_tos *a,
+                                  struct xflow_key *key,
+                                  const struct xflow_action_nw_tos *a,
                                   gfp_t gfp)
 {
        if (key->dl_type != htons(ETH_P_IP))
@@ -307,8 +307,8 @@ static struct sk_buff *set_nw_tos(struct sk_buff *skb,
 }
 
 static struct sk_buff *
-set_tp_port(struct sk_buff *skb, struct odp_flow_key *key,
-           const struct odp_action_tp_port *a,
+set_tp_port(struct sk_buff *skb, struct xflow_key *key,
+           const struct xflow_action_tp_port *a,
            gfp_t gfp)
 {
        int check_ofs;
@@ -326,13 +326,13 @@ set_tp_port(struct sk_buff *skb, struct odp_flow_key *key,
        skb = make_writable(skb, 0, gfp);
        if (skb) {
                struct udphdr *th = udp_hdr(skb);
-               u16 *f = a->type == ODPAT_SET_TP_SRC ? &th->source : &th->dest;
+               u16 *f = a->type == XFLOWAT_SET_TP_SRC ? &th->source : &th->dest;
                u16 old = *f;
                u16 new = a->tp_port;
                update_csum((u16*)(skb_transport_header(skb) + check_ofs), 
                                skb, old, new, 0);
                *f = new;
-               if (a->type == ODPAT_SET_TP_SRC)
+               if (a->type == XFLOWAT_SET_TP_SRC)
                        key->tp_src = a->tp_port;
                else
                        key->tp_dst = a->tp_port;
@@ -422,18 +422,18 @@ output_control(struct datapath *dp, struct sk_buff *skb, u32 arg, gfp_t gfp)
        skb = skb_clone(skb, gfp);
        if (!skb)
                return -ENOMEM;
-       return dp_output_control(dp, skb, _ODPL_ACTION_NR, arg);
+       return dp_output_control(dp, skb, _XFLOWL_ACTION_NR, arg);
 }
 
 /* Send a copy of this packet up to the sFlow agent, along with extra
  * information about what happened to it. */
 static void sflow_sample(struct datapath *dp, struct sk_buff *skb,
-                        const union odp_action *a, int n_actions,
+                        const union xflow_action *a, int n_actions,
                         gfp_t gfp, struct net_bridge_port *nbp)
 {
-       struct odp_sflow_sample_header *hdr;
-       unsigned int actlen = n_actions * sizeof(union odp_action);
-       unsigned int hdrlen = sizeof(struct odp_sflow_sample_header);
+       struct xflow_sflow_sample_header *hdr;
+       unsigned int actlen = n_actions * sizeof(union xflow_action);
+       unsigned int hdrlen = sizeof(struct xflow_sflow_sample_header);
        struct sk_buff *nskb;
 
        nskb = skb_copy_expand(skb, actlen + hdrlen, 0, gfp);
@@ -441,16 +441,16 @@ static void sflow_sample(struct datapath *dp, struct sk_buff *skb,
                return;
 
        memcpy(__skb_push(nskb, actlen), a, actlen);
-       hdr = (struct odp_sflow_sample_header*)__skb_push(nskb, hdrlen);
+       hdr = (struct xflow_sflow_sample_header*)__skb_push(nskb, hdrlen);
        hdr->n_actions = n_actions;
        hdr->sample_pool = atomic_read(&nbp->sflow_pool);
-       dp_output_control(dp, nskb, _ODPL_SFLOW_NR, 0);
+       dp_output_control(dp, nskb, _XFLOWL_SFLOW_NR, 0);
 }
 
 /* Execute a list of actions against 'skb'. */
 int execute_actions(struct datapath *dp, struct sk_buff *skb,
-                   struct odp_flow_key *key,
-                   const union odp_action *a, int n_actions,
+                   struct xflow_key *key,
+                   const union xflow_action *a, int n_actions,
                    gfp_t gfp)
 {
        /* Every output action needs a separate clone of 'skb', but the common
@@ -478,16 +478,16 @@ int execute_actions(struct datapath *dp, struct sk_buff *skb,
                }
 
                switch (a->type) {
-               case ODPAT_OUTPUT:
+               case XFLOWAT_OUTPUT:
                        prev_port = a->output.port;
                        break;
 
-               case ODPAT_OUTPUT_GROUP:
+               case XFLOWAT_OUTPUT_GROUP:
                        prev_port = output_group(dp, a->output_group.group,
                                                 skb, gfp);
                        break;
 
-               case ODPAT_CONTROLLER:
+               case XFLOWAT_CONTROLLER:
                        err = output_control(dp, skb, a->controller.arg, gfp);
                        if (err) {
                                kfree_skb(skb);
@@ -495,32 +495,32 @@ int execute_actions(struct datapath *dp, struct sk_buff *skb,
                        }
                        break;
 
-               case ODPAT_SET_DL_TCI:
+               case XFLOWAT_SET_DL_TCI:
                        skb = modify_vlan_tci(dp, skb, key, a, n_actions, gfp);
                        if (IS_ERR(skb))
                                return PTR_ERR(skb);
                        break;
 
-               case ODPAT_STRIP_VLAN:
+               case XFLOWAT_STRIP_VLAN:
                        skb = strip_vlan(skb, key, gfp);
                        break;
 
-               case ODPAT_SET_DL_SRC:
-               case ODPAT_SET_DL_DST:
+               case XFLOWAT_SET_DL_SRC:
+               case XFLOWAT_SET_DL_DST:
                        skb = set_dl_addr(skb, key, &a->dl_addr, gfp);
                        break;
 
-               case ODPAT_SET_NW_SRC:
-               case ODPAT_SET_NW_DST:
+               case XFLOWAT_SET_NW_SRC:
+               case XFLOWAT_SET_NW_DST:
                        skb = set_nw_addr(skb, key, &a->nw_addr, gfp);
                        break;
 
-               case ODPAT_SET_NW_TOS:
+               case XFLOWAT_SET_NW_TOS:
                        skb = set_nw_tos(skb, key, &a->nw_tos, gfp);
                        break;
 
-               case ODPAT_SET_TP_SRC:
-               case ODPAT_SET_TP_DST:
+               case XFLOWAT_SET_TP_SRC:
+               case XFLOWAT_SET_TP_DST:
                        skb = set_tp_port(skb, key, &a->tp_port, gfp);
                        break;
                }
index 065c0e4..9ad0486 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009 Nicira Networks.
+ * Copyright (c) 2009, 2010 Nicira Networks.
  * Distributed under the terms of the GNU GPL version 2.
  *
  * Significant portions of this file may be copied from parts of the Linux
 
 struct datapath;
 struct sk_buff;
-struct odp_flow_key;
-union odp_action;
+struct xflow_key;
+union xflow_action;
 
 int dp_xmit_skb(struct sk_buff *);
 int execute_actions(struct datapath *dp, struct sk_buff *skb,
-                   struct odp_flow_key *key,
-                   const union odp_action *, int n_actions,
+                   struct xflow_key *key,
+                   const union xflow_action *, int n_actions,
                    gfp_t gfp);
 
 #endif /* actions.h */
index 3b082c5..7f02908 100644 (file)
@@ -44,7 +44,7 @@
 #include <net/inet_ecn.h>
 #include <net/llc.h>
 
-#include "openvswitch/datapath-protocol.h"
+#include "openvswitch/xflow.h"
 #include "datapath.h"
 #include "actions.h"
 #include "dp_dev.h"
@@ -65,7 +65,7 @@ EXPORT_SYMBOL(dp_ioctl_hook);
  * It is safe to access the datapath and net_bridge_port structures with just
  * dp_mutex.
  */
-static struct datapath *dps[ODP_MAX];
+static struct datapath *dps[XFLOW_MAX];
 static DEFINE_MUTEX(dp_mutex);
 
 /* Number of milliseconds between runs of the maintenance thread. */
@@ -76,7 +76,7 @@ static int new_nbp(struct datapath *, struct net_device *, int port_no);
 /* Must be called with rcu_read_lock or dp_mutex. */
 struct datapath *get_dp(int dp_idx)
 {
-       if (dp_idx < 0 || dp_idx >= ODP_MAX)
+       if (dp_idx < 0 || dp_idx >= XFLOW_MAX)
                return NULL;
        return rcu_dereference(dps[dp_idx]);
 }
@@ -127,7 +127,7 @@ static int dp_fill_ifinfo(struct sk_buff *skb,
        hdr->ifi_change = 0;
 
        NLA_PUT_STRING(skb, IFLA_IFNAME, dev->name);
-       NLA_PUT_U32(skb, IFLA_MASTER, dp->ports[ODPP_LOCAL]->dev->ifindex);
+       NLA_PUT_U32(skb, IFLA_MASTER, dp->ports[XFLOWP_LOCAL]->dev->ifindex);
        NLA_PUT_U32(skb, IFLA_MTU, dev->mtu);
 #ifdef IFLA_OPERSTATE
        NLA_PUT_U8(skb, IFLA_OPERSTATE,
@@ -234,12 +234,12 @@ static int create_dp(int dp_idx, const char __user *devnamep)
                goto err_free_dp;
 
        /* Set up our datapath device. */
-       dp_dev = dp_dev_create(dp, devname, ODPP_LOCAL);
+       dp_dev = dp_dev_create(dp, devname, XFLOWP_LOCAL);
        err = PTR_ERR(dp_dev);
        if (IS_ERR(dp_dev))
                goto err_destroy_table;
 
-       err = new_nbp(dp, dp_dev, ODPP_LOCAL);
+       err = new_nbp(dp, dp_dev, XFLOWP_LOCAL);
        if (err) {
                dp_dev_destroy(dp_dev);
                goto err_destroy_table;
@@ -259,7 +259,7 @@ static int create_dp(int dp_idx, const char __user *devnamep)
        return 0;
 
 err_destroy_local_port:
-       dp_del_port(dp->ports[ODPP_LOCAL]);
+       dp_del_port(dp->ports[XFLOWP_LOCAL]);
 err_destroy_table:
        dp_table_destroy(dp->table, 0);
 err_free_dp:
@@ -279,14 +279,14 @@ static void do_destroy_dp(struct datapath *dp)
        int i;
 
        list_for_each_entry_safe (p, n, &dp->port_list, node)
-               if (p->port_no != ODPP_LOCAL)
+               if (p->port_no != XFLOWP_LOCAL)
                        dp_del_port(p);
 
        dp_sysfs_del_dp(dp);
 
        rcu_assign_pointer(dps[dp->dp_idx], NULL);
 
-       dp_del_port(dp->ports[ODPP_LOCAL]);
+       dp_del_port(dp->ports[XFLOWP_LOCAL]);
 
        dp_table_destroy(dp->table, 1);
 
@@ -374,11 +374,11 @@ static int new_nbp(struct datapath *dp, struct net_device *dev, int port_no)
        return 0;
 }
 
-static int add_port(int dp_idx, struct odp_port __user *portp)
+static int add_port(int dp_idx, struct xflow_port __user *portp)
 {
        struct net_device *dev;
        struct datapath *dp;
-       struct odp_port port;
+       struct xflow_port port;
        int port_no;
        int err;
 
@@ -400,7 +400,7 @@ static int add_port(int dp_idx, struct odp_port __user *portp)
        goto out_unlock_dp;
 
 got_port_no:
-       if (!(port.flags & ODP_PORT_INTERNAL)) {
+       if (!(port.flags & XFLOW_PORT_INTERNAL)) {
                err = -ENODEV;
                dev = dev_get_by_name(&init_net, port.devname);
                if (!dev)
@@ -441,7 +441,7 @@ int dp_del_port(struct net_bridge_port *p)
 {
        ASSERT_RTNL();
 
-       if (p->port_no != ODPP_LOCAL)
+       if (p->port_no != XFLOWP_LOCAL)
                dp_sysfs_del_if(p);
        dp_ifinfo_notify(RTM_DELLINK, p);
 
@@ -479,7 +479,7 @@ static int del_port(int dp_idx, int port_no)
        int err;
 
        err = -EINVAL;
-       if (port_no < 0 || port_no >= DP_MAX_PORTS || port_no == ODPP_LOCAL)
+       if (port_no < 0 || port_no >= DP_MAX_PORTS || port_no == XFLOWP_LOCAL)
                goto out;
 
        rtnl_lock();
@@ -531,7 +531,7 @@ void dp_process_received_packet(struct sk_buff *skb, struct net_bridge_port *p)
 {
        struct datapath *dp = p->dp;
        struct dp_stats_percpu *stats;
-       struct odp_flow_key key;
+       struct xflow_key key;
        struct sw_flow *flow;
 
        WARN_ON_ONCE(skb_shared(skb));
@@ -541,7 +541,7 @@ void dp_process_received_packet(struct sk_buff *skb, struct net_bridge_port *p)
        /* BHs are off so we don't have to use get_cpu()/put_cpu() here. */
        stats = percpu_ptr(dp->stats_percpu, smp_processor_id());
 
-       if (flow_extract(skb, p ? p->port_no : ODPP_NONE, &key)) {
+       if (flow_extract(skb, p ? p->port_no : XFLOWP_NONE, &key)) {
                if (dp->drop_frags) {
                        kfree_skb(skb);
                        stats->n_frags++;
@@ -558,7 +558,7 @@ void dp_process_received_packet(struct sk_buff *skb, struct net_bridge_port *p)
                stats->n_hit++;
        } else {
                stats->n_missed++;
-               dp_output_control(dp, skb, _ODPL_MISS_NR, 0);
+               dp_output_control(dp, skb, _XFLOWL_MISS_NR, 0);
        }
 }
 
@@ -778,7 +778,7 @@ queue_control_packets(struct sk_buff *skb, struct sk_buff_head *queue,
        int port_no;
        int err;
 
-       port_no = ODPP_LOCAL;
+       port_no = XFLOWP_LOCAL;
        if (skb->dev) {
                if (skb->dev->br_port)
                        port_no = skb->dev->br_port->port_no;
@@ -787,7 +787,7 @@ queue_control_packets(struct sk_buff *skb, struct sk_buff_head *queue,
        }
 
        do {
-               struct odp_msg *header;
+               struct xflow_msg *header;
 
                nskb = skb->next;
                skb->next = NULL;
@@ -828,7 +828,7 @@ queue_control_packets(struct sk_buff *skb, struct sk_buff_head *queue,
                if (err)
                        goto err_kfree_skbs;
 
-               header = (struct odp_msg*)__skb_push(skb, sizeof *header);
+               header = (struct xflow_msg*)__skb_push(skb, sizeof *header);
                header->type = queue_no;
                header->length = skb->len;
                header->port = port_no;
@@ -858,7 +858,7 @@ dp_output_control(struct datapath *dp, struct sk_buff *skb, int queue_no,
        int err;
 
        WARN_ON_ONCE(skb_shared(skb));
-       BUG_ON(queue_no != _ODPL_MISS_NR && queue_no != _ODPL_ACTION_NR && queue_no != _ODPL_SFLOW_NR);
+       BUG_ON(queue_no != _XFLOWL_MISS_NR && queue_no != _XFLOWL_ACTION_NR && queue_no != _XFLOWL_SFLOW_NR);
        queue = &dp->queues[queue_no];
        err = -ENOBUFS;
        if (skb_queue_len(queue) >= DP_MAX_QUEUE_LEN)
@@ -908,21 +908,21 @@ static int validate_actions(const struct sw_flow_actions *actions)
        unsigned int i;
 
        for (i = 0; i < actions->n_actions; i++) {
-               const union odp_action *a = &actions->actions[i];
+               const union xflow_action *a = &actions->actions[i];
                __be16 mask;
 
                switch (a->type) {
-               case ODPAT_OUTPUT:
+               case XFLOWAT_OUTPUT:
                        if (a->output.port >= DP_MAX_PORTS)
                                return -EINVAL;
                        break;
 
-               case ODPAT_OUTPUT_GROUP:
+               case XFLOWAT_OUTPUT_GROUP:
                        if (a->output_group.group >= DP_MAX_GROUPS)
                                return -EINVAL;
                        break;
 
-               case ODPAT_SET_DL_TCI:
+               case XFLOWAT_SET_DL_TCI:
                        mask = a->dl_tci.mask;
                        if (mask != htons(VLAN_VID_MASK) &&
                            mask != htons(VLAN_PCP_MASK) &&
@@ -932,13 +932,13 @@ static int validate_actions(const struct sw_flow_actions *actions)
                                return -EINVAL;
                        break;
 
-               case ODPAT_SET_NW_TOS:
+               case XFLOWAT_SET_NW_TOS:
                        if (a->nw_tos.nw_tos & INET_ECN_MASK)
                                return -EINVAL;
                        break;
 
                default:
-                       if (a->type >= ODPAT_N_ACTIONS)
+                       if (a->type >= XFLOWAT_N_ACTIONS)
                                return -EOPNOTSUPP;
                        break;
                }
@@ -947,7 +947,7 @@ static int validate_actions(const struct sw_flow_actions *actions)
        return 0;
 }
 
-static struct sw_flow_actions *get_actions(const struct odp_flow *flow)
+static struct sw_flow_actions *get_actions(const struct xflow_flow *flow)
 {
        struct sw_flow_actions *actions;
        int error;
@@ -959,7 +959,7 @@ static struct sw_flow_actions *get_actions(const struct odp_flow *flow)
 
        error = -EFAULT;
        if (copy_from_user(actions->actions, flow->actions,
-                          flow->n_actions * sizeof(union odp_action)))
+                          flow->n_actions * sizeof(union xflow_action)))
                goto error_free_actions;
        error = validate_actions(actions);
        if (error)
@@ -973,7 +973,7 @@ error:
        return ERR_PTR(error);
 }
 
-static void get_stats(struct sw_flow *flow, struct odp_flow_stats *stats)
+static void get_stats(struct sw_flow *flow, struct xflow_flow_stats *stats)
 {
        if (flow->used.tv_sec) {
                stats->used_sec = flow->used.tv_sec;
@@ -998,16 +998,16 @@ static void clear_stats(struct sw_flow *flow)
        flow->byte_count = 0;
 }
 
-static int put_flow(struct datapath *dp, struct odp_flow_put __user *ufp)
+static int put_flow(struct datapath *dp, struct xflow_flow_put __user *ufp)
 {
-       struct odp_flow_put uf;
+       struct xflow_flow_put uf;
        struct sw_flow *flow;
        struct dp_table *table;
-       struct odp_flow_stats stats;
+       struct xflow_flow_stats stats;
        int error;
 
        error = -EFAULT;
-       if (copy_from_user(&uf, ufp, sizeof(struct odp_flow_put)))
+       if (copy_from_user(&uf, ufp, sizeof(struct xflow_flow_put)))
                goto error;
 
        table = rcu_dereference(dp->table);
@@ -1017,7 +1017,7 @@ static int put_flow(struct datapath *dp, struct odp_flow_put __user *ufp)
                struct sw_flow_actions *acts;
 
                error = -ENOENT;
-               if (!(uf.flags & ODPPF_CREATE))
+               if (!(uf.flags & XFLOWPF_CREATE))
                        goto error;
 
                /* Expand table, if necessary, to make room. */
@@ -1053,7 +1053,7 @@ static int put_flow(struct datapath *dp, struct odp_flow_put __user *ufp)
                if (error)
                        goto error_free_flow_acts;
                dp->n_flows++;
-               memset(&stats, 0, sizeof(struct odp_flow_stats));
+               memset(&stats, 0, sizeof(struct xflow_flow_stats));
        } else {
                /* We found a matching flow. */
                struct sw_flow_actions *old_acts, *new_acts;
@@ -1061,7 +1061,7 @@ static int put_flow(struct datapath *dp, struct odp_flow_put __user *ufp)
 
                /* Bail out if we're not allowed to modify an existing flow. */
                error = -EEXIST;
-               if (!(uf.flags & ODPPF_MODIFY))
+               if (!(uf.flags & XFLOWPF_MODIFY))
                        goto error;
 
                /* Swap actions. */
@@ -1072,7 +1072,7 @@ static int put_flow(struct datapath *dp, struct odp_flow_put __user *ufp)
                old_acts = rcu_dereference(flow->sf_acts);
                if (old_acts->n_actions != new_acts->n_actions ||
                    memcmp(old_acts->actions, new_acts->actions,
-                          sizeof(union odp_action) * old_acts->n_actions)) {
+                          sizeof(union xflow_action) * old_acts->n_actions)) {
                        rcu_assign_pointer(flow->sf_acts, new_acts);
                        flow_deferred_free_acts(old_acts);
                } else {
@@ -1082,14 +1082,14 @@ static int put_flow(struct datapath *dp, struct odp_flow_put __user *ufp)
                /* Fetch stats, then clear them if necessary. */
                spin_lock_irqsave(&flow->lock, flags);
                get_stats(flow, &stats);
-               if (uf.flags & ODPPF_ZERO_STATS)
+               if (uf.flags & XFLOWPF_ZERO_STATS)
                        clear_stats(flow);
                spin_unlock_irqrestore(&flow->lock, flags);
        }
 
        /* Copy stats to userspace. */
        if (__copy_to_user(&ufp->flow.stats, &stats,
-                          sizeof(struct odp_flow_stats)))
+                          sizeof(struct xflow_flow_stats)))
                return -EFAULT;
        return 0;
 
@@ -1101,9 +1101,9 @@ error:
        return error;
 }
 
-static int put_actions(const struct sw_flow *flow, struct odp_flow __user *ufp)
+static int put_actions(const struct sw_flow *flow, struct xflow_flow __user *ufp)
 {
-       union odp_action __user *actions;
+       union xflow_action __user *actions;
        struct sw_flow_actions *sf_acts;
        u32 n_actions;
 
@@ -1117,7 +1117,7 @@ static int put_actions(const struct sw_flow *flow, struct odp_flow __user *ufp)
        sf_acts = rcu_dereference(flow->sf_acts);
        if (__put_user(sf_acts->n_actions, &ufp->n_actions) ||
            (actions && copy_to_user(actions, sf_acts->actions,
-                                    sizeof(union odp_action) *
+                                    sizeof(union xflow_action) *
                                     min(sf_acts->n_actions, n_actions))))
                return -EFAULT;
 
@@ -1125,28 +1125,28 @@ static int put_actions(const struct sw_flow *flow, struct odp_flow __user *ufp)
 }
 
 static int answer_query(struct sw_flow *flow, u32 query_flags,
-                       struct odp_flow __user *ufp)
+                       struct xflow_flow __user *ufp)
 {
-       struct odp_flow_stats stats;
+       struct xflow_flow_stats stats;
        unsigned long int flags;
 
        spin_lock_irqsave(&flow->lock, flags);
        get_stats(flow, &stats);
 
-       if (query_flags & ODPFF_ZERO_TCP_FLAGS) {
+       if (query_flags & XFLOWFF_ZERO_TCP_FLAGS) {
                flow->tcp_flags = 0;
        }
        spin_unlock_irqrestore(&flow->lock, flags);
 
-       if (__copy_to_user(&ufp->stats, &stats, sizeof(struct odp_flow_stats)))
+       if (__copy_to_user(&ufp->stats, &stats, sizeof(struct xflow_flow_stats)))
                return -EFAULT;
        return put_actions(flow, ufp);
 }
 
-static int del_flow(struct datapath *dp, struct odp_flow __user *ufp)
+static int del_flow(struct datapath *dp, struct xflow_flow __user *ufp)
 {
        struct dp_table *table = rcu_dereference(dp->table);
-       struct odp_flow uf;
+       struct xflow_flow uf;
        struct sw_flow *flow;
        int error;
 
@@ -1176,13 +1176,13 @@ error:
        return error;
 }
 
-static int query_flows(struct datapath *dp, const struct odp_flowvec *flowvec)
+static int query_flows(struct datapath *dp, const struct xflow_flowvec *flowvec)
 {
        struct dp_table *table = rcu_dereference(dp->table);
        int i;
        for (i = 0; i < flowvec->n_flows; i++) {
-               struct __user odp_flow *ufp = &flowvec->flows[i];
-               struct odp_flow uf;
+               struct __user xflow_flow *ufp = &flowvec->flows[i];
+               struct xflow_flow uf;
                struct sw_flow *flow;
                int error;
 
@@ -1201,7 +1201,7 @@ static int query_flows(struct datapath *dp, const struct odp_flowvec *flowvec)
 }
 
 struct list_flows_cbdata {
-       struct odp_flow __user *uflows;
+       struct xflow_flow __user *uflows;
        int n_flows;
        int listed_flows;
 };
@@ -1209,7 +1209,7 @@ struct list_flows_cbdata {
 static int list_flow(struct sw_flow *flow, void *cbdata_)
 {
        struct list_flows_cbdata *cbdata = cbdata_;
-       struct odp_flow __user *ufp = &cbdata->uflows[cbdata->listed_flows++];
+       struct xflow_flow __user *ufp = &cbdata->uflows[cbdata->listed_flows++];
        int error;
 
        if (__copy_to_user(&ufp->key, &flow->key, sizeof flow->key))
@@ -1223,7 +1223,7 @@ static int list_flow(struct sw_flow *flow, void *cbdata_)
        return 0;
 }
 
-static int list_flows(struct datapath *dp, const struct odp_flowvec *flowvec)
+static int list_flows(struct datapath *dp, const struct xflow_flowvec *flowvec)
 {
        struct list_flows_cbdata cbdata;
        int error;
@@ -1241,22 +1241,22 @@ static int list_flows(struct datapath *dp, const struct odp_flowvec *flowvec)
 
 static int do_flowvec_ioctl(struct datapath *dp, unsigned long argp,
                            int (*function)(struct datapath *,
-                                           const struct odp_flowvec *))
+                                           const struct xflow_flowvec *))
 {
-       struct odp_flowvec __user *uflowvec;
-       struct odp_flowvec flowvec;
+       struct xflow_flowvec __user *uflowvec;
+       struct xflow_flowvec flowvec;
        int retval;
 
-       uflowvec = (struct odp_flowvec __user *)argp;
+       uflowvec = (struct xflow_flowvec __user *)argp;
        if (!access_ok(VERIFY_WRITE, uflowvec, sizeof *uflowvec) ||
            copy_from_user(&flowvec, uflowvec, sizeof flowvec))
                return -EFAULT;
 
-       if (flowvec.n_flows > INT_MAX / sizeof(struct odp_flow))
+       if (flowvec.n_flows > INT_MAX / sizeof(struct xflow_flow))
                return -EINVAL;
 
        if (!access_ok(VERIFY_WRITE, flowvec.flows,
-                      flowvec.n_flows * sizeof(struct odp_flow)))
+                      flowvec.n_flows * sizeof(struct xflow_flow)))
                return -EFAULT;
 
        retval = function(dp, &flowvec);
@@ -1265,10 +1265,10 @@ static int do_flowvec_ioctl(struct datapath *dp, unsigned long argp,
                : __put_user(retval, &uflowvec->n_flows));
 }
 
-static int do_execute(struct datapath *dp, const struct odp_execute *executep)
+static int do_execute(struct datapath *dp, const struct xflow_execute *executep)
 {
-       struct odp_execute execute;
-       struct odp_flow_key key;
+       struct xflow_execute execute;
+       struct xflow_key key;
        struct sk_buff *skb;
        struct sw_flow_actions *actions;
        struct ethhdr *eth;
@@ -1336,9 +1336,9 @@ error:
        return err;
 }
 
-static int get_dp_stats(struct datapath *dp, struct odp_stats __user *statsp)
+static int get_dp_stats(struct datapath *dp, struct xflow_stats __user *statsp)
 {
-       struct odp_stats stats;
+       struct xflow_stats stats;
        int i;
 
        stats.n_flows = dp->n_flows;
@@ -1408,20 +1408,20 @@ void set_dp_devs_mtu(const struct datapath *dp, struct net_device *dev)
 }
 
 static int
-put_port(const struct net_bridge_port *p, struct odp_port __user *uop)
+put_port(const struct net_bridge_port *p, struct xflow_port __user *uop)
 {
-       struct odp_port op;
+       struct xflow_port op;
        memset(&op, 0, sizeof op);
        strncpy(op.devname, p->dev->name, sizeof op.devname);
        op.port = p->port_no;
-       op.flags = is_dp_dev(p->dev) ? ODP_PORT_INTERNAL : 0;
+       op.flags = is_dp_dev(p->dev) ? XFLOW_PORT_INTERNAL : 0;
        return copy_to_user(uop, &op, sizeof op) ? -EFAULT : 0;
 }
 
 static int
-query_port(struct datapath *dp, struct odp_port __user *uport)
+query_port(struct datapath *dp, struct xflow_port __user *uport)
 {
-       struct odp_port port;
+       struct xflow_port port;
 
        if (copy_from_user(&port, uport, sizeof port))
                return -EFAULT;
@@ -1456,9 +1456,9 @@ query_port(struct datapath *dp, struct odp_port __user *uport)
 }
 
 static int
-list_ports(struct datapath *dp, struct odp_portvec __user *pvp)
+list_ports(struct datapath *dp, struct xflow_portvec __user *pvp)
 {
-       struct odp_portvec pv;
+       struct xflow_portvec pv;
        struct net_bridge_port *p;
        int idx;
 
@@ -1485,9 +1485,9 @@ static void free_port_group(struct rcu_head *rcu)
 }
 
 static int
-set_port_group(struct datapath *dp, const struct odp_port_group __user *upg)
+set_port_group(struct datapath *dp, const struct xflow_port_group __user *upg)
 {
-       struct odp_port_group pg;
+       struct xflow_port_group pg;
        struct dp_port_group *new_group, *old_group;
        int error;
 
@@ -1524,9 +1524,9 @@ error:
 }
 
 static int
-get_port_group(struct datapath *dp, struct odp_port_group *upg)
+get_port_group(struct datapath *dp, struct xflow_port_group *upg)
 {
-       struct odp_port_group pg;
+       struct xflow_port_group pg;
        struct dp_port_group *g;
        u16 n_copy;
 
@@ -1568,19 +1568,19 @@ static long openvswitch_ioctl(struct file *f, unsigned int cmd,
 
        /* Handle commands with special locking requirements up front. */
        switch (cmd) {
-       case ODP_DP_CREATE:
+       case XFLOW_DP_CREATE:
                err = create_dp(dp_idx, (char __user *)argp);
                goto exit;
 
-       case ODP_DP_DESTROY:
+       case XFLOW_DP_DESTROY:
                err = destroy_dp(dp_idx);
                goto exit;
 
-       case ODP_PORT_ADD:
-               err = add_port(dp_idx, (struct odp_port __user *)argp);
+       case XFLOW_PORT_ADD:
+               err = add_port(dp_idx, (struct xflow_port __user *)argp);
                goto exit;
 
-       case ODP_PORT_DEL:
+       case XFLOW_PORT_DEL:
                err = get_user(port_no, (int __user *)argp);
                if (!err)
                        err = del_port(dp_idx, port_no);
@@ -1593,15 +1593,15 @@ static long openvswitch_ioctl(struct file *f, unsigned int cmd,
                goto exit;
 
        switch (cmd) {
-       case ODP_DP_STATS:
-               err = get_dp_stats(dp, (struct odp_stats __user *)argp);
+       case XFLOW_DP_STATS:
+               err = get_dp_stats(dp, (struct xflow_stats __user *)argp);
                break;
 
-       case ODP_GET_DROP_FRAGS:
+       case XFLOW_GET_DROP_FRAGS:
                err = put_user(dp->drop_frags, (int __user *)argp);
                break;
 
-       case ODP_SET_DROP_FRAGS:
+       case XFLOW_SET_DROP_FRAGS:
                err = get_user(drop_frags, (int __user *)argp);
                if (err)
                        break;
@@ -1612,69 +1612,69 @@ static long openvswitch_ioctl(struct file *f, unsigned int cmd,
                err = 0;
                break;
 
-       case ODP_GET_LISTEN_MASK:
+       case XFLOW_GET_LISTEN_MASK:
                err = put_user(get_listen_mask(f), (int __user *)argp);
                break;
 
-       case ODP_SET_LISTEN_MASK:
+       case XFLOW_SET_LISTEN_MASK:
                err = get_user(listeners, (int __user *)argp);
                if (err)
                        break;
                err = -EINVAL;
-               if (listeners & ~ODPL_ALL)
+               if (listeners & ~XFLOWL_ALL)
                        break;
                err = 0;
                set_listen_mask(f, listeners);
                break;
 
-       case ODP_GET_SFLOW_PROBABILITY:
+       case XFLOW_GET_SFLOW_PROBABILITY:
                err = put_user(dp->sflow_probability, (unsigned int __user *)argp);
                break;
 
-       case ODP_SET_SFLOW_PROBABILITY:
+       case XFLOW_SET_SFLOW_PROBABILITY:
                err = get_user(sflow_probability, (unsigned int __user *)argp);
                if (!err)
                        dp->sflow_probability = sflow_probability;
                break;
 
-       case ODP_PORT_QUERY:
-               err = query_port(dp, (struct odp_port __user *)argp);
+       case XFLOW_PORT_QUERY:
+               err = query_port(dp, (struct xflow_port __user *)argp);
                break;
 
-       case ODP_PORT_LIST:
-               err = list_ports(dp, (struct odp_portvec __user *)argp);
+       case XFLOW_PORT_LIST:
+               err = list_ports(dp, (struct xflow_portvec __user *)argp);
                break;
 
-       case ODP_PORT_GROUP_SET:
-               err = set_port_group(dp, (struct odp_port_group __user *)argp);
+       case XFLOW_PORT_GROUP_SET:
+               err = set_port_group(dp, (struct xflow_port_group __user *)argp);
                break;
 
-       case ODP_PORT_GROUP_GET:
-               err = get_port_group(dp, (struct odp_port_group __user *)argp);
+       case XFLOW_PORT_GROUP_GET:
+               err = get_port_group(dp, (struct xflow_port_group __user *)argp);
                break;
 
-       case ODP_FLOW_FLUSH:
+       case XFLOW_FLOW_FLUSH:
                err = flush_flows(dp);
                break;
 
-       case ODP_FLOW_PUT:
-               err = put_flow(dp, (struct odp_flow_put __user *)argp);
+       case XFLOW_FLOW_PUT:
+               err = put_flow(dp, (struct xflow_flow_put __user *)argp);
                break;
 
-       case ODP_FLOW_DEL:
-               err = del_flow(dp, (struct odp_flow __user *)argp);
+       case XFLOW_FLOW_DEL:
+               err = del_flow(dp, (struct xflow_flow __user *)argp);
                break;
 
-       case ODP_FLOW_GET:
+       case XFLOW_FLOW_GET:
                err = do_flowvec_ioctl(dp, argp, query_flows);
                break;
 
-       case ODP_FLOW_LIST:
+       case XFLOW_FLOW_LIST:
                err = do_flowvec_ioctl(dp, argp, list_flows);
                break;
 
-       case ODP_EXECUTE:
-               err = do_execute(dp, (struct odp_execute __user *)argp);
+       case XFLOW_EXECUTE:
+               err = do_execute(dp, (struct xflow_execute __user *)argp);
                break;
 
        default:
index 38c8475..ef50432 100644 (file)
@@ -118,14 +118,14 @@ struct dp_port_group {
  * @waitqueue: Waitqueue, for waiting for new packets in @queues.
  * @n_flows: Number of flows currently in flow table.
  * @table: Current flow table (RCU protected).
- * @groups: Port groups, used by ODPAT_OUTPUT_GROUP action (RCU protected).
+ * @groups: Port groups, used by XFLOWAT_OUTPUT_GROUP action (RCU protected).
  * @n_ports: Number of ports currently in @ports.
- * @ports: Map from port number to &struct net_bridge_port.  %ODPP_LOCAL port
+ * @ports: Map from port number to &struct net_bridge_port.  %XFLOWP_LOCAL port
  * always exists, other ports may be %NULL.
  * @port_list: List of all ports in @ports in arbitrary order.
  * @stats_percpu: Per-CPU datapath statistics.
  * @sflow_probability: Number of packets out of UINT_MAX to sample to the
- * %ODPL_SFLOW queue, e.g. (@sflow_probability/UINT_MAX) is the probability of
+ * %XFLOWL_SFLOW queue, e.g. (@sflow_probability/UINT_MAX) is the probability of
  * sampling a given packet.
  */
 struct datapath {
@@ -205,7 +205,7 @@ extern int (*dp_ioctl_hook)(struct net_device *dev, struct ifreq *rq, int cmd);
 /* Flow table. */
 struct dp_table *dp_table_create(unsigned int n_buckets);
 void dp_table_destroy(struct dp_table *, int free_flows);
-struct sw_flow *dp_table_lookup(struct dp_table *, const struct odp_flow_key *);
+struct sw_flow *dp_table_lookup(struct dp_table *, const struct xflow_key *);
 int dp_table_insert(struct dp_table *, struct sw_flow *);
 int dp_table_delete(struct dp_table *, struct sw_flow *);
 int dp_table_expand(struct datapath *);
@@ -224,7 +224,7 @@ struct datapath *get_dp(int dp_idx);
 
 static inline const char *dp_name(const struct datapath *dp)
 {
-       return dp->ports[ODPP_LOCAL]->dev->name;
+       return dp->ports[XFLOWP_LOCAL]->dev->name;
 }
 
 #if defined(CONFIG_XEN) && defined(HAVE_PROTO_DATA_VALID)
index 0278988..7662657 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Distributed under the terms of the GNU GPL version 2.
- * Copyright (c) 2007, 2008, 2009 Nicira Networks.
+ * Copyright (c) 2007, 2008, 2009, 2010 Nicira Networks.
  *
  * Significant portions of this file may be copied from parts of the Linux
  * kernel, by Linus Torvalds and others.
@@ -38,7 +38,7 @@ static int dp_device_event(struct notifier_block *unused, unsigned long event,
                break;
 
        case NETDEV_CHANGENAME:
-               if (p->port_no != ODPP_LOCAL) {
+               if (p->port_no != XFLOWP_LOCAL) {
                        mutex_lock(&dp->mutex);
                        dp_sysfs_del_if(p);
                        dp_sysfs_add_if(p);
index 3cd6d1a..738d2e1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009 Nicira Networks.
+ * Copyright (c) 2009, 2010 Nicira Networks.
  * Distributed under the terms of the GNU GPL version 2.
  *
  * Significant portions of this file may be copied from parts of the Linux
@@ -276,7 +276,7 @@ static DP_DEVICE_ATTR(root_id, S_IRUGO, show_root_id, NULL);
 static ssize_t show_bridge_id(DEVICE_PARAMS, char *buf)
 {
        struct datapath *dp = dp_dev_get_dp(to_net_dev(d));
-       const unsigned char *addr = dp->ports[ODPP_LOCAL]->dev->dev_addr;
+       const unsigned char *addr = dp->ports[XFLOWP_LOCAL]->dev->dev_addr;
 
        /* xxx Do we need a lock of some sort? */
        return sprintf(buf, "%.2x%.2x.%.2x%.2x%.2x%.2x%.2x%.2x\n",
@@ -464,7 +464,7 @@ static struct attribute_group bridge_group = {
  */
 int dp_sysfs_add_dp(struct datapath *dp)
 {
-       struct kobject *kobj = &dp->ports[ODPP_LOCAL]->dev->NETDEV_DEV_MEMBER.kobj;
+       struct kobject *kobj = &dp->ports[XFLOWP_LOCAL]->dev->NETDEV_DEV_MEMBER.kobj;
        int err;
 
        /* Create /sys/class/net/<devname>/bridge directory. */
@@ -493,7 +493,7 @@ int dp_sysfs_add_dp(struct datapath *dp)
 
 int dp_sysfs_del_dp(struct datapath *dp)
 {
-       struct kobject *kobj = &dp->ports[ODPP_LOCAL]->dev->NETDEV_DEV_MEMBER.kobj;
+       struct kobject *kobj = &dp->ports[XFLOWP_LOCAL]->dev->NETDEV_DEV_MEMBER.kobj;
 
        kobject_del(&dp->ifobj);
        sysfs_remove_group(kobj, &bridge_group);
index 95c26dc..c8e2a6f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009 Nicira Networks.
+ * Copyright (c) 2009, 2010 Nicira Networks.
  * Distributed under the terms of the GNU GPL version 2.
  *
  * Significant portions of this file may be copied from parts of the Linux
@@ -286,7 +286,7 @@ int dp_sysfs_add_if(struct net_bridge_port *p)
        /* Create symlink from /sys/class/net/<devname>/brport/bridge to
         * /sys/class/net/<bridgename>. */
        err = sysfs_create_link(&p->kobj,
-                               &dp->ports[ODPP_LOCAL]->dev->NETDEV_DEV_MEMBER.kobj,
+                               &dp->ports[XFLOWP_LOCAL]->dev->NETDEV_DEV_MEMBER.kobj,
                                SYSFS_BRIDGE_PORT_LINK); /* "bridge" */
        if (err)
                goto err_del;
index 62eed5d..d75e7a8 100644 (file)
@@ -121,10 +121,10 @@ struct sw_flow_actions *flow_actions_alloc(size_t n_actions)
 {
        struct sw_flow_actions *sfa;
 
-       if (n_actions > (PAGE_SIZE - sizeof *sfa) / sizeof(union odp_action))
+       if (n_actions > (PAGE_SIZE - sizeof *sfa) / sizeof(union xflow_action))
                return ERR_PTR(-EINVAL);
 
-       sfa = kmalloc(sizeof *sfa + n_actions * sizeof(union odp_action),
+       sfa = kmalloc(sizeof *sfa + n_actions * sizeof(union xflow_action),
                      GFP_KERNEL);
        if (!sfa)
                return ERR_PTR(-ENOMEM);
@@ -194,7 +194,7 @@ static int is_snap(const struct eth_snap_hdr *esh)
 /* Parses the Ethernet frame in 'skb', which was received on 'in_port',
  * and initializes 'key' to match.  Returns 1 if 'skb' contains an IP
  * fragment, 0 otherwise. */
-int flow_extract(struct sk_buff *skb, u16 in_port, struct odp_flow_key *key)
+int flow_extract(struct sk_buff *skb, u16 in_port, struct xflow_key *key)
 {
        struct ethhdr *eth;
        struct eth_snap_hdr *esh;
@@ -214,13 +214,13 @@ int flow_extract(struct sk_buff *skb, u16 in_port, struct odp_flow_key *key)
        eth = eth_hdr(skb);
        esh = (struct eth_snap_hdr *) eth;
        nh_ofs = sizeof *eth;
-       if (likely(ntohs(eth->h_proto) >= ODP_DL_TYPE_ETH2_CUTOFF))
+       if (likely(ntohs(eth->h_proto) >= XFLOW_DL_TYPE_ETH2_CUTOFF))
                key->dl_type = eth->h_proto;
        else if (skb->len >= sizeof *esh && is_snap(esh)) {
                key->dl_type = esh->ethertype;
                nh_ofs = sizeof *esh;
        } else {
-               key->dl_type = htons(ODP_DL_TYPE_NOT_ETH_TYPE);
+               key->dl_type = htons(XFLOW_DL_TYPE_NOT_ETH_TYPE);
                if (skb->len >= nh_ofs + sizeof(struct llc_pdu_un)) {
                        nh_ofs += sizeof(struct llc_pdu_un); 
                }
@@ -231,7 +231,7 @@ int flow_extract(struct sk_buff *skb, u16 in_port, struct odp_flow_key *key)
            skb->len >= nh_ofs + sizeof(struct vlan_hdr)) {
                struct vlan_hdr *vh = (struct vlan_hdr*)(skb->data + nh_ofs);
                key->dl_type = vh->h_vlan_encapsulated_proto;
-               key->dl_tci = vh->h_vlan_TCI | htons(ODP_TCI_PRESENT);
+               key->dl_tci = vh->h_vlan_TCI | htons(XFLOW_TCI_PRESENT);
                nh_ofs += sizeof(struct vlan_hdr);
        }
        memcpy(key->dl_src, eth->h_source, ETH_ALEN);
index 44cc3a6..dc1e153 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009 Nicira Networks.
+ * Copyright (c) 2009, 2010 Nicira Networks.
  * Distributed under the terms of the GNU GPL version 2.
  *
  * Significant portions of this file may be copied from parts of the Linux
 #include <linux/rcupdate.h>
 #include <linux/gfp.h>
 
-#include "openvswitch/datapath-protocol.h"
+#include "openvswitch/xflow.h"
 
 struct sk_buff;
 
 struct sw_flow_actions {
        struct rcu_head rcu;
        unsigned int n_actions;
-       union odp_action actions[];
+       union xflow_action actions[];
 };
 
 struct sw_flow {
        struct rcu_head rcu;
-       struct odp_flow_key key;
+       struct xflow_key key;
        struct sw_flow_actions *sf_acts;
 
        struct timespec used;   /* Last used time. */
@@ -46,7 +46,7 @@ struct sw_flow_actions *flow_actions_alloc(size_t n_actions);
 void flow_free(struct sw_flow *);
 void flow_deferred_free(struct sw_flow *);
 void flow_deferred_free_acts(struct sw_flow_actions *);
-int flow_extract(struct sk_buff *, u16 in_port, struct odp_flow_key *);
+int flow_extract(struct sk_buff *, u16 in_port, struct xflow_key *);
 void flow_used(struct sw_flow *, struct sk_buff *);
 
 int flow_init(void);
index 23ae8ab..2b95caf 100644 (file)
@@ -128,13 +128,13 @@ static struct dp_bucket **find_bucket(struct dp_table *table, u32 hash)
        return &table->buckets[l1][l2];
 }
 
-static int search_bucket(const struct dp_bucket *bucket, const struct odp_flow_key *key)
+static int search_bucket(const struct dp_bucket *bucket, const struct xflow_key *key)
 {
        int i;
 
        for (i = 0; i < bucket->n_flows; i++) {
                struct sw_flow *flow = rcu_dereference(bucket->flows[i]);
-               if (!memcmp(&flow->key, key, sizeof(struct odp_flow_key)))
+               if (!memcmp(&flow->key, key, sizeof(struct xflow_key)))
                        return i;
        }
 
@@ -142,7 +142,7 @@ static int search_bucket(const struct dp_bucket *bucket, const struct odp_flow_k
 }
 
 static struct sw_flow *lookup_flow(struct dp_table *table, u32 hash,
-                                  const struct odp_flow_key *key)
+                                  const struct xflow_key *key)
 {
        struct dp_bucket **bucketp = find_bucket(table, hash);
        struct dp_bucket *bucket = rcu_dereference(*bucketp);
@@ -159,7 +159,7 @@ static struct sw_flow *lookup_flow(struct dp_table *table, u32 hash,
 }
 
 static u32 flow_hash(const struct dp_table *table,
-                    const struct odp_flow_key *key)
+                    const struct xflow_key *key)
 {
        return jhash2((u32*)key, sizeof *key / sizeof(u32), table->hash_seed);
 }
@@ -173,7 +173,7 @@ static u32 flow_hash(const struct dp_table *table,
  * successful, otherwise %NULL.
  */
 struct sw_flow *dp_table_lookup(struct dp_table *table,
-                               const struct odp_flow_key *key)
+                               const struct xflow_key *key)
 {
        return lookup_flow(table, flow_hash(table, key), key);
 }
index 92e0718..6185997 100644 (file)
@@ -1,5 +1,5 @@
 noinst_HEADERS += \
        include/openvswitch/gre.h \
        include/openvswitch/brcompat-netlink.h \
-       include/openvswitch/datapath-protocol.h
+       include/openvswitch/xflow.h
 
diff --git a/include/openvswitch/datapath-protocol.h b/include/openvswitch/datapath-protocol.h
deleted file mode 100644 (file)
index 9ee689e..0000000
+++ /dev/null
@@ -1,351 +0,0 @@
-/*
- * Copyright (c) 2009, 2010 Nicira Networks.
- *
- * This file is offered under your choice of two licenses: Apache 2.0 or GNU
- * GPL 2.0 or later.  The permission statements for each of these licenses is
- * given below.  You may license your modifications to this file under either
- * of these licenses or both.  If you wish to license your modifications under
- * only one of these licenses, delete the permission text for the other
- * license.
- *
- * ----------------------------------------------------------------------
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ----------------------------------------------------------------------
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- * ----------------------------------------------------------------------
- */
-
-/* Protocol between userspace and kernel datapath. */
-
-#ifndef OPENVSWITCH_DATAPATH_PROTOCOL_H
-#define OPENVSWITCH_DATAPATH_PROTOCOL_H 1
-
-#ifdef __KERNEL__
-#include <linux/types.h>
-#else
-#include <sys/types.h>
-#endif
-#include <linux/if_ether.h>
-
-#define ODP_MAX 256             /* Maximum number of datapaths. */
-
-#define ODP_DP_CREATE           _IO('O', 0)
-#define ODP_DP_DESTROY          _IO('O', 1)
-#define ODP_DP_STATS            _IOW('O', 2, struct odp_stats)
-
-#define ODP_GET_DROP_FRAGS      _IOW('O', 3, int)
-#define ODP_SET_DROP_FRAGS      _IOR('O', 4, int)
-
-#define ODP_GET_LISTEN_MASK     _IOW('O', 5, int)
-#define ODP_SET_LISTEN_MASK     _IOR('O', 6, int)
-
-#define ODP_PORT_ADD            _IOR('O', 7, struct odp_port)
-#define ODP_PORT_DEL            _IOR('O', 8, int)
-#define ODP_PORT_QUERY          _IOWR('O', 9, struct odp_port)
-#define ODP_PORT_LIST           _IOWR('O', 10, struct odp_portvec)
-
-#define ODP_PORT_GROUP_SET      _IOR('O', 11, struct odp_port_group)
-#define ODP_PORT_GROUP_GET      _IOWR('O', 12, struct odp_port_group)
-
-#define ODP_FLOW_GET            _IOWR('O', 13, struct odp_flow)
-#define ODP_FLOW_PUT            _IOWR('O', 14, struct odp_flow)
-#define ODP_FLOW_LIST           _IOWR('O', 15, struct odp_flowvec)
-#define ODP_FLOW_FLUSH          _IO('O', 16)
-#define ODP_FLOW_DEL            _IOWR('O', 17, struct odp_flow)
-
-#define ODP_EXECUTE             _IOR('O', 18, struct odp_execute)
-
-#define ODP_SET_SFLOW_PROBABILITY _IOR('O', 19, int)
-#define ODP_GET_SFLOW_PROBABILITY _IOW('O', 20, int)
-
-struct odp_stats {
-    /* Flows. */
-    __u32 n_flows;              /* Number of flows in flow table. */
-    __u32 cur_capacity;         /* Current flow table capacity. */
-    __u32 max_capacity;         /* Maximum expansion of flow table capacity. */
-
-    /* Ports. */
-    __u32 n_ports;              /* Current number of ports. */
-    __u32 max_ports;            /* Maximum supported number of ports. */
-    __u16 max_groups;           /* Maximum number of port groups. */
-    __u16 reserved;
-
-    /* Lookups. */
-    __u64 n_frags;               /* Number of dropped IP fragments. */
-    __u64 n_hit;                 /* Number of flow table matches. */
-    __u64 n_missed;              /* Number of flow table misses. */
-    __u64 n_lost;                /* Number of misses not sent to userspace. */
-
-    /* Queues. */
-    __u16 max_miss_queue;       /* Max length of ODPL_MISS queue. */
-    __u16 max_action_queue;     /* Max length of ODPL_ACTION queue. */
-    __u16 max_sflow_queue;      /* Max length of ODPL_SFLOW queue. */
-};
-
-/* Logical ports. */
-#define ODPP_LOCAL      ((__u16)0)
-#define ODPP_NONE       ((__u16)-1)
-#define ODPP_NORMAL     ((__u16)-2)
-
-/* Listening channels. */
-#define _ODPL_MISS_NR   0       /* Packet missed in flow table. */
-#define ODPL_MISS       (1 << _ODPL_MISS_NR)
-#define _ODPL_ACTION_NR 1       /* Packet output to ODPP_CONTROLLER. */
-#define ODPL_ACTION     (1 << _ODPL_ACTION_NR)
-#define _ODPL_SFLOW_NR  2       /* sFlow samples. */
-#define ODPL_SFLOW      (1 << _ODPL_SFLOW_NR)
-#define ODPL_ALL        (ODPL_MISS | ODPL_ACTION | ODPL_SFLOW)
-
-/**
- * struct odp_msg - format of messages read from datapath fd.
- * @type: One of the %_ODPL_* constants.
- * @length: Total length of message, including this header.
- * @port: Port that received the packet embedded in this message.
- * @reserved: Not currently used.  Should be set to 0.
- * @arg: Argument value whose meaning depends on @type.
- *
- * For @type == %_ODPL_MISS_NR, the header is followed by packet data.  The
- * @arg member is unused and set to 0.
- *
- * For @type == %_ODPL_ACTION_NR, the header is followed by packet data.  The
- * @arg member is copied from the &struct odp_action_controller that caused
- * the &struct odp_msg to be composed.
- *
- * For @type == %_ODPL_SFLOW_NR, the header is followed by &struct
- * odp_sflow_sample_header, then by an array of &union odp_action (the number
- * of which is specified in &struct odp_sflow_sample_header), then by packet
- * data.
- */
-struct odp_msg {
-    __u32 type;
-    __u32 length;
-    __u16 port;
-    __u16 reserved;
-    __u32 arg;
-};
-
-/**
- * struct odp_sflow_sample_header - header added to sFlow sampled packet.
- * @sample_pool: Number of packets that were candidates for sFlow sampling,
- * regardless of whether they were actually chosen and sent down to userspace.
- * @n_actions: Number of "union odp_action"s immediately following this header.
- *
- * This header follows &struct odp_msg when that structure's @type is
- * %_ODPL_SFLOW_NR, and it is itself followed by an array of &union odp_action
- * (the number of which is specified in @n_actions) and then by packet data.
- */
-struct odp_sflow_sample_header {
-    __u32 sample_pool;
-    __u32 n_actions;
-};
-
-#define ODP_PORT_INTERNAL (1 << 0) /* This port is simulated. */
-struct odp_port {
-    char devname[16];           /* IFNAMSIZ */
-    __u16 port;
-    __u16 flags;
-    __u32 reserved2;
-};
-
-struct odp_portvec {
-    struct odp_port *ports;
-    int n_ports;
-};
-
-struct odp_port_group {
-    __u16 *ports;
-    __u16 n_ports;                /* Number of ports. */
-    __u16 group;                  /* Group number. */
-};
-
-struct odp_flow_stats {
-    __u64 n_packets;            /* Number of matched packets. */
-    __u64 n_bytes;              /* Number of matched bytes. */
-    __u64 used_sec;             /* Time last used. */
-    __u32 used_nsec;
-    __u8 tcp_flags;
-    __u8 ip_tos;
-    __u16 error;                /* Used by ODP_FLOW_GET. */
-};
-
-/*
- * The datapath protocol adopts the Linux convention for TCI fields: if an
- * 802.1Q header is present then its TCI value is used verbatim except that the
- * CFI bit (0x1000) is always set to 1, and all-bits-zero indicates no 802.1Q
- * header.
- */
-#define ODP_TCI_PRESENT 0x1000  /* CFI bit */
-
-struct odp_flow_key {
-    __be32 nw_src;               /* IP source address. */
-    __be32 nw_dst;               /* IP destination address. */
-    __u16  in_port;              /* Input switch port. */
-    __be16 dl_tci;               /* All zeros if 802.1Q header absent,
-                                  * ODP_TCI_PRESENT set if present. */
-    __be16 dl_type;              /* Ethernet frame type. */
-    __be16 tp_src;               /* TCP/UDP source port. */
-    __be16 tp_dst;               /* TCP/UDP destination port. */
-    __u8   dl_src[ETH_ALEN];     /* Ethernet source address. */
-    __u8   dl_dst[ETH_ALEN];     /* Ethernet destination address. */
-    __u8   nw_proto;             /* IP protocol or low 8 bits of ARP opcode. */
-    __u8   nw_tos;               /* IP ToS (DSCP field, 6 bits). */
-};
-
-/* Flags for ODP_FLOW. */
-#define ODPFF_ZERO_TCP_FLAGS (1 << 0) /* Zero the TCP flags. */
-
-struct odp_flow {
-    struct odp_flow_stats stats;
-    struct odp_flow_key key;
-    union odp_action *actions;
-    __u32 n_actions;
-    __u32 flags;
-};
-
-/* Flags for ODP_FLOW_PUT. */
-#define ODPPF_CREATE        (1 << 0) /* Allow creating a new flow. */
-#define ODPPF_MODIFY        (1 << 1) /* Allow modifying an existing flow. */
-#define ODPPF_ZERO_STATS    (1 << 2) /* Zero the stats of an existing flow. */
-
-/* ODP_FLOW_PUT argument. */
-struct odp_flow_put {
-    struct odp_flow flow;
-    __u32 flags;
-};
-
-struct odp_flowvec {
-    struct odp_flow *flows;
-    int n_flows;
-};
-
-/* Action types. */
-#define ODPAT_OUTPUT            0    /* Output to switch port. */
-#define ODPAT_OUTPUT_GROUP      1    /* Output to all ports in group. */
-#define ODPAT_CONTROLLER        2    /* Send copy to controller. */
-#define ODPAT_SET_DL_TCI        3    /* Set the 802.1q VLAN VID and/or PCP. */
-#define ODPAT_STRIP_VLAN        4    /* Strip the 802.1q header. */
-#define ODPAT_SET_DL_SRC        5    /* Ethernet source address. */
-#define ODPAT_SET_DL_DST        6    /* Ethernet destination address. */
-#define ODPAT_SET_NW_SRC        7    /* IP source address. */
-#define ODPAT_SET_NW_DST        8    /* IP destination address. */
-#define ODPAT_SET_NW_TOS        9    /* IP ToS/DSCP field (6 bits). */
-#define ODPAT_SET_TP_SRC        10   /* TCP/UDP source port. */
-#define ODPAT_SET_TP_DST        11   /* TCP/UDP destination port. */
-#define ODPAT_N_ACTIONS         12
-
-struct odp_action_output {
-    __u16 type;                  /* ODPAT_OUTPUT. */
-    __u16 port;                  /* Output port. */
-    __u16 reserved1;
-    __u16 reserved2;
-};
-
-struct odp_action_output_group {
-    __u16 type;                 /* ODPAT_OUTPUT_GROUP. */
-    __u16 group;                /* Group number. */
-    __u16 reserved1;
-    __u16 reserved2;
-};
-
-struct odp_action_controller {
-    __u16 type;                 /* ODPAT_OUTPUT_CONTROLLER. */
-    __u16 reserved;
-    __u32 arg;                  /* Copied to struct odp_msg 'arg' member. */
-};
-
-/* Action structure for ODPAT_SET_DL_TCI. */
-struct odp_action_dl_tci {
-    __u16 type;                  /* ODPAT_SET_DL_TCI. */
-    __be16 tci;                  /* New TCI.  Bits not in mask must be zero. */
-    __be16 mask;                 /* 0x0fff to set VID, 0xe000 to set PCP,
-                                    or 0xefff to set both. */
-    __u16 reserved;
-};
-
-/* Action structure for ODPAT_SET_DL_SRC/DST. */
-struct odp_action_dl_addr {
-    __u16 type;                  /* ODPAT_SET_DL_SRC/DST. */
-    __u8 dl_addr[ETH_ALEN];      /* Ethernet address. */
-};
-
-/* Action structure for ODPAT_SET_NW_SRC/DST. */
-struct odp_action_nw_addr {
-    __u16 type;                 /* ODPAT_SET_TW_SRC/DST. */
-    __u16 reserved;
-    __be32 nw_addr;             /* IP address. */
-};
-
-struct odp_action_nw_tos {
-    __u16 type;                  /* ODPAT_SET_NW_TOS. */
-    __u8 nw_tos;                 /* IP ToS/DSCP field (6 bits). */
-    __u8 reserved1;
-    __u16 reserved2;
-    __u16 reserved3;
-};
-
-/* Action structure for ODPAT_SET_TP_SRC/DST. */
-struct odp_action_tp_port {
-    __u16 type;                  /* ODPAT_SET_TP_SRC/DST. */
-    __be16 tp_port;              /* TCP/UDP port. */
-    __u16 reserved1;
-    __u16 reserved2;
-};
-
-union odp_action {
-    __u16 type;
-    struct odp_action_output output;
-    struct odp_action_output_group output_group;
-    struct odp_action_controller controller;
-    struct odp_action_dl_tci dl_tci;
-    struct odp_action_dl_addr dl_addr;
-    struct odp_action_nw_addr nw_addr;
-    struct odp_action_nw_tos nw_tos;
-    struct odp_action_tp_port tp_port;
-};
-
-struct odp_execute {
-    __u16 in_port;
-    __u16 reserved1;
-    __u32 reserved2;
-
-    union odp_action *actions;
-    __u32 n_actions;
-
-    const void *data;
-    __u32 length;
-};
-
-/* Values below this cutoff are 802.3 packets and the two bytes
- * following MAC addresses are used as a frame length.  Otherwise, the
- * two bytes are used as the Ethernet type.
- */
-#define ODP_DL_TYPE_ETH2_CUTOFF   0x0600
-
-/* Value of dl_type to indicate that the frame does not include an
- * Ethernet type.
- */
-#define ODP_DL_TYPE_NOT_ETH_TYPE  0x05ff
-
-#endif /* openvswitch/datapath-protocol.h */
diff --git a/include/openvswitch/xflow.h b/include/openvswitch/xflow.h
new file mode 100644 (file)
index 0000000..8920a24
--- /dev/null
@@ -0,0 +1,353 @@
+/*
+ * Copyright (c) 2009, 2010 Nicira Networks.
+ *
+ * This file is offered under your choice of two licenses: Apache 2.0 or GNU
+ * GPL 2.0 or later.  The permission statements for each of these licenses is
+ * given below.  You may license your modifications to this file under either
+ * of these licenses or both.  If you wish to license your modifications under
+ * only one of these licenses, delete the permission text for the other
+ * license.
+ *
+ * ----------------------------------------------------------------------
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ----------------------------------------------------------------------
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ * ----------------------------------------------------------------------
+ */
+
+/* Protocol between userspace and kernel datapath. */
+
+#ifndef XFLOW_H
+#define XFLOW_H 1
+
+#ifdef __KERNEL__
+#include <linux/types.h>
+#else
+#include <sys/types.h>
+#endif
+#include <linux/if_ether.h>
+
+#define XFLOW_MAX 256             /* Maximum number of datapaths. */
+
+#define XFLOW_DP_CREATE           _IO('O', 0)
+#define XFLOW_DP_DESTROY          _IO('O', 1)
+#define XFLOW_DP_STATS            _IOW('O', 2, struct xflow_stats)
+
+#define XFLOW_GET_DROP_FRAGS      _IOW('O', 3, int)
+#define XFLOW_SET_DROP_FRAGS      _IOR('O', 4, int)
+
+#define XFLOW_GET_LISTEN_MASK     _IOW('O', 5, int)
+#define XFLOW_SET_LISTEN_MASK     _IOR('O', 6, int)
+
+#define XFLOW_PORT_ADD            _IOR('O', 7, struct xflow_port)
+#define XFLOW_PORT_DEL            _IOR('O', 8, int)
+#define XFLOW_PORT_QUERY          _IOWR('O', 9, struct xflow_port)
+#define XFLOW_PORT_LIST           _IOWR('O', 10, struct xflow_portvec)
+
+#define XFLOW_PORT_GROUP_SET      _IOR('O', 11, struct xflow_port_group)
+#define XFLOW_PORT_GROUP_GET      _IOWR('O', 12, struct xflow_port_group)
+
+#define XFLOW_FLOW_GET            _IOWR('O', 13, struct xflow_flow)
+#define XFLOW_FLOW_PUT            _IOWR('O', 14, struct xflow_flow)
+#define XFLOW_FLOW_LIST           _IOWR('O', 15, struct xflow_flowvec)
+#define XFLOW_FLOW_FLUSH          _IO('O', 16)
+#define XFLOW_FLOW_DEL            _IOWR('O', 17, struct xflow_flow)
+
+#define XFLOW_EXECUTE             _IOR('O', 18, struct xflow_execute)
+
+#define XFLOW_SET_SFLOW_PROBABILITY _IOR('O', 19, int)
+#define XFLOW_GET_SFLOW_PROBABILITY _IOW('O', 20, int)
+
+struct xflow_stats {
+    /* Flows. */
+    __u32 n_flows;              /* Number of flows in flow table. */
+    __u32 cur_capacity;         /* Current flow table capacity. */
+    __u32 max_capacity;         /* Maximum expansion of flow table capacity. */
+
+    /* Ports. */
+    __u32 n_ports;              /* Current number of ports. */
+    __u32 max_ports;            /* Maximum supported number of ports. */
+    __u16 max_groups;           /* Maximum number of port groups. */
+    __u16 reserved;
+
+    /* Lookups. */
+    __u64 n_frags;              /* Number of dropped IP fragments. */
+    __u64 n_hit;                /* Number of flow table matches. */
+    __u64 n_missed;             /* Number of flow table misses. */
+    __u64 n_lost;               /* Number of misses not sent to userspace. */
+
+    /* Queues. */
+    __u16 max_miss_queue;       /* Max length of XFLOWL_MISS queue. */
+    __u16 max_action_queue;     /* Max length of XFLOWL_ACTION queue. */
+    __u16 max_sflow_queue;      /* Max length of XFLOWL_SFLOW queue. */
+};
+
+/* Logical ports. */
+#define XFLOWP_LOCAL      ((__u16)0)
+#define XFLOWP_NONE       ((__u16)-1)
+#define XFLOWP_NORMAL     ((__u16)-2)
+
+/* Listening channels. */
+#define _XFLOWL_MISS_NR   0       /* Packet missed in flow table. */
+#define XFLOWL_MISS       (1 << _XFLOWL_MISS_NR)
+#define _XFLOWL_ACTION_NR 1       /* Packet output to XFLOWP_CONTROLLER. */
+#define XFLOWL_ACTION     (1 << _XFLOWL_ACTION_NR)
+#define _XFLOWL_SFLOW_NR  2       /* sFlow samples. */
+#define XFLOWL_SFLOW      (1 << _XFLOWL_SFLOW_NR)
+#define XFLOWL_ALL        (XFLOWL_MISS | XFLOWL_ACTION | XFLOWL_SFLOW)
+
+/**
+ * struct xflow_msg - format of messages read from datapath fd.
+ * @type: One of the %_XFLOWL_* constants.
+ * @length: Total length of message, including this header.
+ * @port: Port that received the packet embedded in this message.
+ * @reserved: Not currently used.  Should be set to 0.
+ * @arg: Argument value whose meaning depends on @type.
+ *
+ * For @type == %_XFLOWL_MISS_NR, the header is followed by packet data.  The
+ * @arg member is unused and set to 0.
+ *
+ * For @type == %_XFLOWL_ACTION_NR, the header is followed by packet data.  The
+ * @arg member is copied from the &struct xflow_action_controller that caused
+ * the &struct xflow_msg to be composed.
+ *
+ * For @type == %_XFLOWL_SFLOW_NR, the header is followed by &struct
+ * xflow_sflow_sample_header, then by an array of &union xflow_action (the
+ * number of which is specified in &struct xflow_sflow_sample_header), then by
+ * packet data.
+ */
+struct xflow_msg {
+    __u32 type;
+    __u32 length;
+    __u16 port;
+    __u16 reserved;
+    __u32 arg;
+};
+
+/**
+ * struct xflow_sflow_sample_header - header added to sFlow sampled packet.
+ * @sample_pool: Number of packets that were candidates for sFlow sampling,
+ * regardless of whether they were actually chosen and sent down to userspace.
+ * @n_actions: Number of "union xflow_action"s immediately following this
+ * header.
+ *
+ * This header follows &struct xflow_msg when that structure's @type is
+ * %_XFLOWL_SFLOW_NR, and it is itself followed by an array of &union
+ * xflow_action (the number of which is specified in @n_actions) and then by
+ * packet data.
+ */
+struct xflow_sflow_sample_header {
+    __u32 sample_pool;
+    __u32 n_actions;
+};
+
+#define XFLOW_PORT_INTERNAL (1 << 0) /* This port is simulated. */
+struct xflow_port {
+    char devname[16];           /* IFNAMSIZ */
+    __u16 port;
+    __u16 flags;
+    __u32 reserved2;
+};
+
+struct xflow_portvec {
+    struct xflow_port *ports;
+    int n_ports;
+};
+
+struct xflow_port_group {
+    __u16 *ports;
+    __u16 n_ports;                /* Number of ports. */
+    __u16 group;                  /* Group number. */
+};
+
+struct xflow_flow_stats {
+    __u64 n_packets;            /* Number of matched packets. */
+    __u64 n_bytes;              /* Number of matched bytes. */
+    __u64 used_sec;             /* Time last used. */
+    __u32 used_nsec;
+    __u8 tcp_flags;
+    __u8 ip_tos;
+    __u16 error;                /* Used by XFLOW_FLOW_GET. */
+};
+
+/*
+ * The datapath protocol adopts the Linux convention for TCI fields: if an
+ * 802.1Q header is present then its TCI value is used verbatim except that the
+ * CFI bit (0x1000) is always set to 1, and all-bits-zero indicates no 802.1Q
+ * header.
+ */
+#define XFLOW_TCI_PRESENT 0x1000  /* CFI bit */
+
+struct xflow_key {
+    __be32 nw_src;               /* IP source address. */
+    __be32 nw_dst;               /* IP destination address. */
+    __u16  in_port;              /* Input switch port. */
+    __be16 dl_tci;               /* All zeros if 802.1Q header absent,
+                                  * XFLOW_TCI_PRESENT set if present. */
+    __be16 dl_type;              /* Ethernet frame type. */
+    __be16 tp_src;               /* TCP/UDP source port. */
+    __be16 tp_dst;               /* TCP/UDP destination port. */
+    __u8   dl_src[ETH_ALEN];     /* Ethernet source address. */
+    __u8   dl_dst[ETH_ALEN];     /* Ethernet destination address. */
+    __u8   nw_proto;             /* IP protocol or low 8 bits of ARP opcode. */
+    __u8   nw_tos;               /* IP ToS (DSCP field, 6 bits). */
+};
+
+/* Flags for XFLOW_FLOW. */
+#define XFLOWFF_ZERO_TCP_FLAGS (1 << 0) /* Zero the TCP flags. */
+
+struct xflow_flow {
+    struct xflow_flow_stats stats;
+    struct xflow_key key;
+    union xflow_action *actions;
+    __u32 n_actions;
+    __u32 flags;
+};
+
+/* Flags for XFLOW_FLOW_PUT. */
+#define XFLOWPF_CREATE        (1 << 0) /* Allow creating a new flow. */
+#define XFLOWPF_MODIFY        (1 << 1) /* Allow modifying an existing flow. */
+#define XFLOWPF_ZERO_STATS    (1 << 2) /* Zero the stats of existing flow. */
+
+/* XFLOW_FLOW_PUT argument. */
+struct xflow_flow_put {
+    struct xflow_flow flow;
+    __u32 flags;
+};
+
+struct xflow_flowvec {
+    struct xflow_flow *flows;
+    int n_flows;
+};
+
+/* Action types. */
+#define XFLOWAT_OUTPUT            0  /* Output to switch port. */
+#define XFLOWAT_OUTPUT_GROUP      1  /* Output to all ports in group. */
+#define XFLOWAT_CONTROLLER        2  /* Send copy to controller. */
+#define XFLOWAT_SET_DL_TCI        3  /* Set the 802.1q VLAN VID and/or PCP. */
+#define XFLOWAT_STRIP_VLAN        4  /* Strip the 802.1q header. */
+#define XFLOWAT_SET_DL_SRC        5  /* Ethernet source address. */
+#define XFLOWAT_SET_DL_DST        6  /* Ethernet destination address. */
+#define XFLOWAT_SET_NW_SRC        7  /* IP source address. */
+#define XFLOWAT_SET_NW_DST        8  /* IP destination address. */
+#define XFLOWAT_SET_NW_TOS        9  /* IP ToS/DSCP field (6 bits). */
+#define XFLOWAT_SET_TP_SRC        10 /* TCP/UDP source port. */
+#define XFLOWAT_SET_TP_DST        11 /* TCP/UDP destination port. */
+#define XFLOWAT_N_ACTIONS         12
+
+struct xflow_action_output {
+    __u16 type;                  /* XFLOWAT_OUTPUT. */
+    __u16 port;                  /* Output port. */
+    __u16 reserved1;
+    __u16 reserved2;
+};
+
+struct xflow_action_output_group {
+    __u16 type;                 /* XFLOWAT_OUTPUT_GROUP. */
+    __u16 group;                /* Group number. */
+    __u16 reserved1;
+    __u16 reserved2;
+};
+
+struct xflow_action_controller {
+    __u16 type;                 /* XFLOWAT_OUTPUT_CONTROLLER. */
+    __u16 reserved;
+    __u32 arg;                  /* Copied to struct xflow_msg 'arg' member. */
+};
+
+/* Action structure for XFLOWAT_SET_DL_TCI. */
+struct xflow_action_dl_tci {
+    __u16 type;                  /* XFLOWAT_SET_DL_TCI. */
+    __be16 tci;                  /* New TCI.  Bits not in mask must be zero. */
+    __be16 mask;                 /* 0x0fff to set VID, 0xe000 to set PCP,
+                                    or 0xefff to set both. */
+    __u16 reserved;
+};
+
+/* Action structure for XFLOWAT_SET_DL_SRC/DST. */
+struct xflow_action_dl_addr {
+    __u16 type;                  /* XFLOWAT_SET_DL_SRC/DST. */
+    __u8 dl_addr[ETH_ALEN];      /* Ethernet address. */
+};
+
+/* Action structure for XFLOWAT_SET_NW_SRC/DST. */
+struct xflow_action_nw_addr {
+    __u16 type;                 /* XFLOWAT_SET_TW_SRC/DST. */
+    __u16 reserved;
+    __be32 nw_addr;             /* IP address. */
+};
+
+struct xflow_action_nw_tos {
+    __u16 type;                  /* XFLOWAT_SET_NW_TOS. */
+    __u8 nw_tos;                 /* IP ToS/DSCP field (6 bits). */
+    __u8 reserved1;
+    __u16 reserved2;
+    __u16 reserved3;
+};
+
+/* Action structure for XFLOWAT_SET_TP_SRC/DST. */
+struct xflow_action_tp_port {
+    __u16 type;                  /* XFLOWAT_SET_TP_SRC/DST. */
+    __be16 tp_port;              /* TCP/UDP port. */
+    __u16 reserved1;
+    __u16 reserved2;
+};
+
+union xflow_action {
+    __u16 type;
+    struct xflow_action_output output;
+    struct xflow_action_output_group output_group;
+    struct xflow_action_controller controller;
+    struct xflow_action_dl_tci dl_tci;
+    struct xflow_action_dl_addr dl_addr;
+    struct xflow_action_nw_addr nw_addr;
+    struct xflow_action_nw_tos nw_tos;
+    struct xflow_action_tp_port tp_port;
+};
+
+struct xflow_execute {
+    __u16 in_port;
+    __u16 reserved1;
+    __u32 reserved2;
+
+    union xflow_action *actions;
+    __u32 n_actions;
+
+    const void *data;
+    __u32 length;
+};
+
+/* Values below this cutoff are 802.3 packets and the two bytes
+ * following MAC addresses are used as a frame length.  Otherwise, the
+ * two bytes are used as the Ethernet type.
+ */
+#define XFLOW_DL_TYPE_ETH2_CUTOFF   0x0600
+
+/* Value of dl_type to indicate that the frame does not include an
+ * Ethernet type.
+ */
+#define XFLOW_DL_TYPE_NOT_ETH_TYPE  0x05ff
+
+#endif /* openvswitch/xflow.h */
index 51d3c11..9128536 100644 (file)
@@ -21,9 +21,9 @@ lib_libopenvswitch_a_SOURCES = \
        lib/command-line.c \
        lib/command-line.h \
        lib/compiler.h \
+       lib/coverage-counters.h \
        lib/coverage.c \
        lib/coverage.h \
-       lib/coverage-counters.h \
        lib/csum.c \
        lib/csum.h \
        lib/daemon.c \
@@ -34,11 +34,6 @@ lib_libopenvswitch_a_SOURCES = \
        lib/dhcp.h \
        lib/dhparams.h \
        lib/dirs.h \
-       lib/dpif-linux.c \
-       lib/dpif-netdev.c \
-       lib/dpif-provider.h \
-       lib/dpif.c \
-       lib/dpif.h \
        lib/dynamic-string.c \
        lib/dynamic-string.h \
        lib/fatal-signal.c \
@@ -67,8 +62,6 @@ lib_libopenvswitch_a_SOURCES = \
        lib/netdev-provider.h \
        lib/netdev.c \
        lib/netdev.h \
-       lib/odp-util.c \
-       lib/odp-util.h \
        lib/ofp-print.c \
        lib/ofp-print.h \
        lib/ofpbuf.c \
@@ -149,6 +142,13 @@ lib_libopenvswitch_a_SOURCES = \
        lib/vlog-modules.def \
        lib/vlog.c \
        lib/vlog.h \
+       lib/xfif-linux.c \
+       lib/xfif-netdev.c \
+       lib/xfif-provider.h \
+       lib/xfif.c \
+       lib/xfif.h \
+       lib/xflow-util.c \
+       lib/xflow-util.h \
        lib/xtoxll.h
 nodist_lib_libopenvswitch_a_SOURCES = \
        lib/coverage-counters.c \
@@ -194,22 +194,22 @@ EXTRA_DIST += \
        lib/dhparams.h
 
 EXTRA_DIST += \
-       lib/common.man \
        lib/common-syn.man \
-       lib/daemon.man \
+       lib/common.man \
        lib/daemon-syn.man \
-       lib/dpif.man \
+       lib/daemon.man \
        lib/leak-checker.man \
-       lib/ssl-bootstrap.man \
        lib/ssl-bootstrap-syn.man \
+       lib/ssl-bootstrap.man \
        lib/ssl-peer-ca-cert.man \
-       lib/ssl.man \
        lib/ssl-syn.man \
+       lib/ssl.man \
        lib/vconn-active.man \
        lib/vconn-passive.man \
-       lib/vlog-unixctl.man \
        lib/vlog-syn.man \
-       lib/vlog.man
+       lib/vlog-unixctl.man \
+       lib/vlog.man \
+       lib/xfif.man
 
 
 lib/dirs.c: Makefile
@@ -227,15 +227,13 @@ install-data-local:
 
 # All the source files that have coverage counters.
 COVERAGE_FILES = \
-       lib/dpif.c \
        lib/flow.c \
-       lib/lockfile.c \
        lib/hmap.c \
+       lib/lockfile.c \
        lib/mac-learning.c \
-       lib/netdev.c \
        lib/netdev-linux.c \
+       lib/netdev.c \
        lib/netlink.c \
-       lib/odp-util.c \
        lib/poll-loop.c \
        lib/process.c \
        lib/rconn.c \
@@ -245,6 +243,8 @@ COVERAGE_FILES = \
        lib/unixctl.c \
        lib/util.c \
        lib/vconn.c \
+       lib/xfif.c \
+       lib/xflow-util.c \
        ofproto/ofproto.c \
        ofproto/pktbuf.c \
        vswitchd/bridge.c \
diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
deleted file mode 100644 (file)
index 34c1d81..0000000
+++ /dev/null
@@ -1,1380 +0,0 @@
-/*
- * Copyright (c) 2009, 2010 Nicira Networks.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <config.h>
-#include "dpif.h"
-
-#include <assert.h>
-#include <ctype.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <inttypes.h>
-#include <netinet/in.h>
-#include <net/if.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/ioctl.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
-#include "csum.h"
-#include "dpif-provider.h"
-#include "flow.h"
-#include "hmap.h"
-#include "list.h"
-#include "netdev.h"
-#include "odp-util.h"
-#include "ofp-print.h"
-#include "ofpbuf.h"
-#include "packets.h"
-#include "poll-loop.h"
-#include "queue.h"
-#include "timeval.h"
-#include "util.h"
-
-#include "vlog.h"
-#define THIS_MODULE VLM_dpif_netdev
-
-/* Configuration parameters. */
-enum { N_QUEUES = 2 };          /* Number of queues for dpif_recv(). */
-enum { MAX_QUEUE_LEN = 100 };   /* Maximum number of packets per queue. */
-enum { N_GROUPS = 16 };         /* Number of port groups. */
-enum { MAX_PORTS = 256 };       /* Maximum number of ports. */
-enum { MAX_FLOWS = 65536 };     /* Maximum number of flows in flow table. */
-
-/* Enough headroom to add a vlan tag, plus an extra 2 bytes to allow IP
- * headers to be aligned on a 4-byte boundary.  */
-enum { DP_NETDEV_HEADROOM = 2 + VLAN_HEADER_LEN };
-
-/* Datapath based on the network device interface from netdev.h. */
-struct dp_netdev {
-    struct list node;
-    int dp_idx;
-    int open_cnt;
-    bool destroyed;
-
-    bool drop_frags;            /* Drop all IP fragments, if true. */
-    struct ovs_queue queues[N_QUEUES]; /* Messages queued for dpif_recv(). */
-    struct hmap flow_table;     /* Flow table. */
-    struct odp_port_group groups[N_GROUPS];
-
-    /* Statistics. */
-    long long int n_frags;      /* Number of dropped IP fragments. */
-    long long int n_hit;        /* Number of flow table matches. */
-    long long int n_missed;     /* Number of flow table misses. */
-    long long int n_lost;       /* Number of misses not passed to client. */
-
-    /* Ports. */
-    int n_ports;
-    struct dp_netdev_port *ports[MAX_PORTS];
-    struct list port_list;
-    unsigned int serial;
-};
-
-/* A port in a netdev-based datapath. */
-struct dp_netdev_port {
-    int port_no;                /* Index into dp_netdev's 'ports'. */
-    struct list node;           /* Element in dp_netdev's 'port_list'. */
-    struct netdev *netdev;
-    bool internal;              /* Internal port (as ODP_PORT_INTERNAL)? */
-};
-
-/* A flow in dp_netdev's 'flow_table'. */
-struct dp_netdev_flow {
-    struct hmap_node node;      /* Element in dp_netdev's 'flow_table'. */
-    struct odp_flow_key key;
-
-    /* Statistics. */
-    struct timeval used;        /* Last used time, in milliseconds. */
-    long long int packet_count; /* Number of packets matched. */
-    long long int byte_count;   /* Number of bytes matched. */
-    uint8_t ip_tos;             /* IP TOS value. */
-    uint16_t tcp_ctl;           /* Bitwise-OR of seen tcp_ctl values. */
-
-    /* Actions. */
-    union odp_action *actions;
-    unsigned int n_actions;
-};
-
-/* Interface to netdev-based datapath. */
-struct dpif_netdev {
-    struct dpif dpif;
-    struct dp_netdev *dp;
-    int listen_mask;
-    unsigned int dp_serial;
-};
-
-/* All netdev-based datapaths. */
-static struct dp_netdev *dp_netdevs[256];
-struct list dp_netdev_list = LIST_INITIALIZER(&dp_netdev_list);
-enum { N_DP_NETDEVS = ARRAY_SIZE(dp_netdevs) };
-
-/* Maximum port MTU seen so far. */
-static int max_mtu = ETH_PAYLOAD_MAX;
-
-static int get_port_by_number(struct dp_netdev *, uint16_t port_no,
-                              struct dp_netdev_port **portp);
-static int get_port_by_name(struct dp_netdev *, const char *devname,
-                            struct dp_netdev_port **portp);
-static void dp_netdev_free(struct dp_netdev *);
-static void dp_netdev_flow_flush(struct dp_netdev *);
-static int do_add_port(struct dp_netdev *, const char *devname, uint16_t flags,
-                       uint16_t port_no);
-static int do_del_port(struct dp_netdev *, uint16_t port_no);
-static int dp_netdev_output_control(struct dp_netdev *, const struct ofpbuf *,
-                                    int queue_no, int port_no, uint32_t arg);
-static int dp_netdev_execute_actions(struct dp_netdev *,
-                                     struct ofpbuf *, struct odp_flow_key *,
-                                     const union odp_action *, int n);
-
-static struct dpif_netdev *
-dpif_netdev_cast(const struct dpif *dpif)
-{
-    dpif_assert_class(dpif, &dpif_netdev_class);
-    return CONTAINER_OF(dpif, struct dpif_netdev, dpif);
-}
-
-static struct dp_netdev *
-get_dp_netdev(const struct dpif *dpif)
-{
-    return dpif_netdev_cast(dpif)->dp;
-}
-
-static int
-name_to_dp_idx(const char *name)
-{
-    if (!strncmp(name, "dp", 2) && isdigit((unsigned char)name[2])) {
-        int dp_idx = atoi(name + 2);
-        if (dp_idx >= 0 && dp_idx < N_DP_NETDEVS) {
-            return dp_idx;
-        }
-    }
-    return -1;
-}
-
-static struct dp_netdev *
-find_dp_netdev(const char *name)
-{
-    int dp_idx;
-    size_t i;
-
-    dp_idx = name_to_dp_idx(name);
-    if (dp_idx >= 0) {
-        return dp_netdevs[dp_idx];
-    }
-
-    for (i = 0; i < N_DP_NETDEVS; i++) {
-        struct dp_netdev *dp = dp_netdevs[i];
-        if (dp) {
-            struct dp_netdev_port *port;
-            if (!get_port_by_name(dp, name, &port)) {
-                return dp;
-            }
-        }
-    }
-    return NULL;
-}
-
-static struct dpif *
-create_dpif_netdev(struct dp_netdev *dp)
-{
-    struct dpif_netdev *dpif;
-    char *dpname;
-
-    dp->open_cnt++;
-
-    dpname = xasprintf("dp%d", dp->dp_idx);
-    dpif = xmalloc(sizeof *dpif);
-    dpif_init(&dpif->dpif, &dpif_netdev_class, dpname, dp->dp_idx, dp->dp_idx);
-    dpif->dp = dp;
-    dpif->listen_mask = 0;
-    dpif->dp_serial = dp->serial;
-    free(dpname);
-
-    return &dpif->dpif;
-}
-
-static int
-create_dp_netdev(const char *name, int dp_idx, struct dpif **dpifp)
-{
-    struct dp_netdev *dp;
-    int error;
-    int i;
-
-    if (dp_netdevs[dp_idx]) {
-        return EBUSY;
-    }
-
-    /* Create datapath. */
-    dp_netdevs[dp_idx] = dp = xzalloc(sizeof *dp);
-    list_push_back(&dp_netdev_list, &dp->node);
-    dp->dp_idx = dp_idx;
-    dp->open_cnt = 0;
-    dp->drop_frags = false;
-    for (i = 0; i < N_QUEUES; i++) {
-        queue_init(&dp->queues[i]);
-    }
-    hmap_init(&dp->flow_table);
-    for (i = 0; i < N_GROUPS; i++) {
-        dp->groups[i].ports = NULL;
-        dp->groups[i].n_ports = 0;
-        dp->groups[i].group = i;
-    }
-    list_init(&dp->port_list);
-    error = do_add_port(dp, name, ODP_PORT_INTERNAL, ODPP_LOCAL);
-    if (error) {
-        dp_netdev_free(dp);
-        return ENODEV;
-    }
-
-    *dpifp = create_dpif_netdev(dp);
-    return 0;
-}
-
-static int
-dpif_netdev_open(const char *name, const char *type OVS_UNUSED, bool create,
-                 struct dpif **dpifp)
-{
-    if (create) {
-        if (find_dp_netdev(name)) {
-            return EEXIST;
-        } else {
-            int dp_idx = name_to_dp_idx(name);
-            if (dp_idx >= 0) {
-                return create_dp_netdev(name, dp_idx, dpifp);
-            } else {
-                /* Scan for unused dp_idx number. */
-                for (dp_idx = 0; dp_idx < N_DP_NETDEVS; dp_idx++) {
-                    int error = create_dp_netdev(name, dp_idx, dpifp);
-                    if (error != EBUSY) {
-                        return error;
-                    }
-                }
-
-                /* All datapath numbers in use. */
-                return ENOBUFS;
-            }
-        }
-    } else {
-        struct dp_netdev *dp = find_dp_netdev(name);
-        if (dp) {
-            *dpifp = create_dpif_netdev(dp);
-            return 0;
-        } else {
-            return ENODEV;
-        }
-    }
-}
-
-static void
-dp_netdev_free(struct dp_netdev *dp)
-{
-    int i;
-
-    dp_netdev_flow_flush(dp);
-    while (dp->n_ports > 0) {
-        struct dp_netdev_port *port = CONTAINER_OF(
-            dp->port_list.next, struct dp_netdev_port, node);
-        do_del_port(dp, port->port_no);
-    }
-    for (i = 0; i < N_QUEUES; i++) {
-        queue_destroy(&dp->queues[i]);
-    }
-    hmap_destroy(&dp->flow_table);
-    for (i = 0; i < N_GROUPS; i++) {
-        free(dp->groups[i].ports);
-    }
-    dp_netdevs[dp->dp_idx] = NULL;
-    list_remove(&dp->node);
-    free(dp);
-}
-
-static void
-dpif_netdev_close(struct dpif *dpif)
-{
-    struct dp_netdev *dp = get_dp_netdev(dpif);
-    assert(dp->open_cnt > 0);
-    if (--dp->open_cnt == 0 && dp->destroyed) {
-        dp_netdev_free(dp);
-    }
-    free(dpif);
-}
-
-static int
-dpif_netdev_destroy(struct dpif *dpif)
-{
-    struct dp_netdev *dp = get_dp_netdev(dpif);
-    dp->destroyed = true;
-    return 0;
-}
-
-static int
-dpif_netdev_get_stats(const struct dpif *dpif, struct odp_stats *stats)
-{
-    struct dp_netdev *dp = get_dp_netdev(dpif);
-    memset(stats, 0, sizeof *stats);
-    stats->n_flows = hmap_count(&dp->flow_table);
-    stats->cur_capacity = hmap_capacity(&dp->flow_table);
-    stats->max_capacity = MAX_FLOWS;
-    stats->n_ports = dp->n_ports;
-    stats->max_ports = MAX_PORTS;
-    stats->max_groups = N_GROUPS;
-    stats->n_frags = dp->n_frags;
-    stats->n_hit = dp->n_hit;
-    stats->n_missed = dp->n_missed;
-    stats->n_lost = dp->n_lost;
-    stats->max_miss_queue = MAX_QUEUE_LEN;
-    stats->max_action_queue = MAX_QUEUE_LEN;
-    return 0;
-}
-
-static int
-dpif_netdev_get_drop_frags(const struct dpif *dpif, bool *drop_fragsp)
-{
-    struct dp_netdev *dp = get_dp_netdev(dpif);
-    *drop_fragsp = dp->drop_frags;
-    return 0;
-}
-
-static int
-dpif_netdev_set_drop_frags(struct dpif *dpif, bool drop_frags)
-{
-    struct dp_netdev *dp = get_dp_netdev(dpif);
-    dp->drop_frags = drop_frags;
-    return 0;
-}
-
-static int
-do_add_port(struct dp_netdev *dp, const char *devname, uint16_t flags,
-            uint16_t port_no)
-{
-    bool internal = (flags & ODP_PORT_INTERNAL) != 0;
-    struct dp_netdev_port *port;
-    struct netdev_options netdev_options;
-    struct netdev *netdev;
-    int mtu;
-    int error;
-
-    /* XXX reject devices already in some dp_netdev. */
-
-    /* Open and validate network device. */
-    memset(&netdev_options, 0, sizeof netdev_options);
-    netdev_options.name = devname;
-    netdev_options.ethertype = NETDEV_ETH_TYPE_ANY;
-    netdev_options.may_create = true;
-    if (internal) {
-        netdev_options.type = "tap";
-    } else {
-        netdev_options.may_open = true;
-    }
-
-    error = netdev_open(&netdev_options, &netdev);
-    if (error) {
-        return error;
-    }
-    /* XXX reject loopback devices */
-    /* XXX reject non-Ethernet devices */
-
-    error = netdev_turn_flags_on(netdev, NETDEV_PROMISC, false);
-    if (error) {
-        netdev_close(netdev);
-        return error;
-    }
-
-    port = xmalloc(sizeof *port);
-    port->port_no = port_no;
-    port->netdev = netdev;
-    port->internal = internal;
-
-    netdev_get_mtu(netdev, &mtu);
-    if (mtu > max_mtu) {
-        max_mtu = mtu;
-    }
-
-    list_push_back(&dp->port_list, &port->node);
-    dp->ports[port_no] = port;
-    dp->n_ports++;
-    dp->serial++;
-
-    return 0;
-}
-
-static int
-dpif_netdev_port_add(struct dpif *dpif, const char *devname, uint16_t flags,
-                     uint16_t *port_nop)
-{
-    struct dp_netdev *dp = get_dp_netdev(dpif);
-    int port_no;
-
-    for (port_no = 0; port_no < MAX_PORTS; port_no++) {
-        if (!dp->ports[port_no]) {
-            *port_nop = port_no;
-            return do_add_port(dp, devname, flags, port_no);
-        }
-    }
-    return EFBIG;
-}
-
-static int
-dpif_netdev_port_del(struct dpif *dpif, uint16_t port_no)
-{
-    struct dp_netdev *dp = get_dp_netdev(dpif);
-    return port_no == ODPP_LOCAL ? EINVAL : do_del_port(dp, port_no);
-}
-
-static bool
-is_valid_port_number(uint16_t port_no)
-{
-    return port_no < MAX_PORTS;
-}
-
-static int
-get_port_by_number(struct dp_netdev *dp,
-                   uint16_t port_no, struct dp_netdev_port **portp)
-{
-    if (!is_valid_port_number(port_no)) {
-        *portp = NULL;
-        return EINVAL;
-    } else {
-        *portp = dp->ports[port_no];
-        return *portp ? 0 : ENOENT;
-    }
-}
-
-static int
-get_port_by_name(struct dp_netdev *dp,
-                 const char *devname, struct dp_netdev_port **portp)
-{
-    struct dp_netdev_port *port;
-
-    LIST_FOR_EACH (port, struct dp_netdev_port, node, &dp->port_list) {
-        if (!strcmp(netdev_get_name(port->netdev), devname)) {
-            *portp = port;
-            return 0;
-        }
-    }
-    return ENOENT;
-}
-
-static int
-do_del_port(struct dp_netdev *dp, uint16_t port_no)
-{
-    struct dp_netdev_port *port;
-    char *name;
-    int error;
-
-    error = get_port_by_number(dp, port_no, &port);
-    if (error) {
-        return error;
-    }
-
-    list_remove(&port->node);
-    dp->ports[port->port_no] = NULL;
-    dp->n_ports--;
-    dp->serial++;
-
-    name = xstrdup(netdev_get_name(port->netdev));
-    netdev_close(port->netdev);
-
-    free(name);
-    free(port);
-
-    return 0;
-}
-
-static void
-answer_port_query(const struct dp_netdev_port *port, struct odp_port *odp_port)
-{
-    memset(odp_port, 0, sizeof *odp_port);
-    ovs_strlcpy(odp_port->devname, netdev_get_name(port->netdev),
-                sizeof odp_port->devname);
-    odp_port->port = port->port_no;
-    odp_port->flags = port->internal ? ODP_PORT_INTERNAL : 0;
-}
-
-static int
-dpif_netdev_port_query_by_number(const struct dpif *dpif, uint16_t port_no,
-                                 struct odp_port *odp_port)
-{
-    struct dp_netdev *dp = get_dp_netdev(dpif);
-    struct dp_netdev_port *port;
-    int error;
-
-    error = get_port_by_number(dp, port_no, &port);
-    if (!error) {
-        answer_port_query(port, odp_port);
-    }
-    return error;
-}
-
-static int
-dpif_netdev_port_query_by_name(const struct dpif *dpif, const char *devname,
-                               struct odp_port *odp_port)
-{
-    struct dp_netdev *dp = get_dp_netdev(dpif);
-    struct dp_netdev_port *port;
-    int error;
-
-    error = get_port_by_name(dp, devname, &port);
-    if (!error) {
-        answer_port_query(port, odp_port);
-    }
-    return error;
-}
-
-static void
-dp_netdev_free_flow(struct dp_netdev *dp, struct dp_netdev_flow *flow)
-{
-    hmap_remove(&dp->flow_table, &flow->node);
-    free(flow->actions);
-    free(flow);
-}
-
-static void
-dp_netdev_flow_flush(struct dp_netdev *dp)
-{
-    struct dp_netdev_flow *flow, *next;
-
-    HMAP_FOR_EACH_SAFE (flow, next, struct dp_netdev_flow, node,
-                        &dp->flow_table) {
-        dp_netdev_free_flow(dp, flow);
-    }
-}
-
-static int
-dpif_netdev_flow_flush(struct dpif *dpif)
-{
-    struct dp_netdev *dp = get_dp_netdev(dpif);
-    dp_netdev_flow_flush(dp);
-    return 0;
-}
-
-static int
-dpif_netdev_port_list(const struct dpif *dpif, struct odp_port *ports, int n)
-{
-    struct dp_netdev *dp = get_dp_netdev(dpif);
-    struct dp_netdev_port *port;
-    int i;
-
-    i = 0;
-    LIST_FOR_EACH (port, struct dp_netdev_port, node, &dp->port_list) {
-        struct odp_port *odp_port = &ports[i];
-        if (i >= n) {
-            break;
-        }
-        answer_port_query(port, odp_port);
-        i++;
-    }
-    return dp->n_ports;
-}
-
-static int
-dpif_netdev_port_poll(const struct dpif *dpif_, char **devnamep OVS_UNUSED)
-{
-    struct dpif_netdev *dpif = dpif_netdev_cast(dpif_);
-    if (dpif->dp_serial != dpif->dp->serial) {
-        dpif->dp_serial = dpif->dp->serial;
-        return ENOBUFS;
-    } else {
-        return EAGAIN;
-    }
-}
-
-static void
-dpif_netdev_port_poll_wait(const struct dpif *dpif_)
-{
-    struct dpif_netdev *dpif = dpif_netdev_cast(dpif_);
-    if (dpif->dp_serial != dpif->dp->serial) {
-        poll_immediate_wake();
-    }
-}
-
-static int
-get_port_group(const struct dpif *dpif, int group_no,
-               struct odp_port_group **groupp)
-{
-    struct dp_netdev *dp = get_dp_netdev(dpif);
-
-    if (group_no >= 0 && group_no < N_GROUPS) {
-        *groupp = &dp->groups[group_no];
-        return 0;
-    } else {
-        *groupp = NULL;
-        return EINVAL;
-    }
-}
-
-static int
-dpif_netdev_port_group_get(const struct dpif *dpif, int group_no,
-                           uint16_t ports[], int n)
-{
-    struct odp_port_group *group;
-    int error;
-
-    if (n < 0) {
-        return -EINVAL;
-    }
-
-    error = get_port_group(dpif, group_no, &group);
-    if (!error) {
-        memcpy(ports, group->ports, MIN(n, group->n_ports) * sizeof *ports);
-        return group->n_ports;
-    } else {
-        return -error;
-    }
-}
-
-static int
-dpif_netdev_port_group_set(struct dpif *dpif, int group_no,
-                           const uint16_t ports[], int n)
-{
-    struct odp_port_group *group;
-    int error;
-
-    if (n < 0 || n > MAX_PORTS) {
-        return EINVAL;
-    }
-
-    error = get_port_group(dpif, group_no, &group);
-    if (!error) {
-        free(group->ports);
-        group->ports = xmemdup(ports, n * sizeof *group->ports);
-        group->n_ports = n;
-        group->group = group_no;
-    }
-    return error;
-}
-
-static struct dp_netdev_flow *
-dp_netdev_lookup_flow(const struct dp_netdev *dp,
-                      const struct odp_flow_key *key)
-{
-    struct dp_netdev_flow *flow;
-
-    HMAP_FOR_EACH_WITH_HASH (flow, struct dp_netdev_flow, node,
-                             odp_flow_key_hash(key, 0), &dp->flow_table) {
-        if (odp_flow_key_equal(&flow->key, key)) {
-            return flow;
-        }
-    }
-    return NULL;
-}
-
-static void
-answer_flow_query(struct dp_netdev_flow *flow, uint32_t query_flags,
-                  struct odp_flow *odp_flow)
-{
-    if (flow) {
-        odp_flow->key = flow->key;
-        odp_flow->stats.n_packets = flow->packet_count;
-        odp_flow->stats.n_bytes = flow->byte_count;
-        odp_flow->stats.used_sec = flow->used.tv_sec;
-        odp_flow->stats.used_nsec = flow->used.tv_usec * 1000;
-        odp_flow->stats.tcp_flags = TCP_FLAGS(flow->tcp_ctl);
-        odp_flow->stats.ip_tos = flow->ip_tos;
-        odp_flow->stats.error = 0;
-        if (odp_flow->n_actions > 0) {
-            unsigned int n = MIN(odp_flow->n_actions, flow->n_actions);
-            memcpy(odp_flow->actions, flow->actions,
-                   n * sizeof *odp_flow->actions);
-            odp_flow->n_actions = flow->n_actions;
-        }
-
-        if (query_flags & ODPFF_ZERO_TCP_FLAGS) {
-            flow->tcp_ctl = 0;
-        }
-
-    } else {
-        odp_flow->stats.error = ENOENT;
-    }
-}
-
-static int
-dpif_netdev_flow_get(const struct dpif *dpif, struct odp_flow flows[], int n)
-{
-    struct dp_netdev *dp = get_dp_netdev(dpif);
-    int i;
-
-    for (i = 0; i < n; i++) {
-        struct odp_flow *odp_flow = &flows[i];
-        answer_flow_query(dp_netdev_lookup_flow(dp, &odp_flow->key),
-                          odp_flow->flags, odp_flow);
-    }
-    return 0;
-}
-
-static int
-dpif_netdev_validate_actions(const union odp_action *actions, int n_actions,
-                             bool *mutates)
-{
-    unsigned int i;
-
-    *mutates = false;
-    for (i = 0; i < n_actions; i++) {
-        const union odp_action *a = &actions[i];
-        switch (a->type) {
-        case ODPAT_OUTPUT:
-            if (a->output.port >= MAX_PORTS) {
-                return EINVAL;
-            }
-            break;
-
-        case ODPAT_OUTPUT_GROUP:
-            *mutates = true;
-            if (a->output_group.group >= N_GROUPS) {
-                return EINVAL;
-            }
-            break;
-
-        case ODPAT_CONTROLLER:
-            break;
-
-        case ODPAT_SET_DL_TCI:
-            *mutates = true;
-            if (a->dl_tci.mask != htons(VLAN_VID_MASK)
-                && a->dl_tci.mask != htons(VLAN_PCP_MASK)
-                && a->dl_tci.mask != htons(VLAN_VID_MASK | VLAN_PCP_MASK)) {
-                return EINVAL;
-            }
-            if (a->dl_tci.tci & ~a->dl_tci.mask){
-                return EINVAL;
-            }
-            break;
-
-        case ODPAT_SET_NW_TOS:
-            *mutates = true;
-            if (a->nw_tos.nw_tos & IP_ECN_MASK) {
-                return EINVAL;
-            }
-            break;
-
-        case ODPAT_STRIP_VLAN:
-        case ODPAT_SET_DL_SRC:
-        case ODPAT_SET_DL_DST:
-        case ODPAT_SET_NW_SRC:
-        case ODPAT_SET_NW_DST:
-        case ODPAT_SET_TP_SRC:
-        case ODPAT_SET_TP_DST:
-            *mutates = true;
-            break;
-
-        default:
-            return EOPNOTSUPP;
-        }
-    }
-    return 0;
-}
-
-static int
-set_flow_actions(struct dp_netdev_flow *flow, struct odp_flow *odp_flow)
-{
-    size_t n_bytes;
-    bool mutates;
-    int error;
-
-    if (odp_flow->n_actions >= 4096 / sizeof *odp_flow->actions) {
-        return EINVAL;
-    }
-    error = dpif_netdev_validate_actions(odp_flow->actions,
-                                         odp_flow->n_actions, &mutates);
-    if (error) {
-        return error;
-    }
-
-    n_bytes = odp_flow->n_actions * sizeof *flow->actions;
-    flow->actions = xrealloc(flow->actions, n_bytes);
-    flow->n_actions = odp_flow->n_actions;
-    memcpy(flow->actions, odp_flow->actions, n_bytes);
-    return 0;
-}
-
-static int
-add_flow(struct dpif *dpif, struct odp_flow *odp_flow)
-{
-    struct dp_netdev *dp = get_dp_netdev(dpif);
-    struct dp_netdev_flow *flow;
-    int error;
-
-    flow = xzalloc(sizeof *flow);
-    flow->key = odp_flow->key;
-
-    error = set_flow_actions(flow, odp_flow);
-    if (error) {
-        free(flow);
-        return error;
-    }
-
-    hmap_insert(&dp->flow_table, &flow->node,
-                odp_flow_key_hash(&flow->key, 0));
-    return 0;
-}
-
-static void
-clear_stats(struct dp_netdev_flow *flow)
-{
-    flow->used.tv_sec = 0;
-    flow->used.tv_usec = 0;
-    flow->packet_count = 0;
-    flow->byte_count = 0;
-    flow->ip_tos = 0;
-    flow->tcp_ctl = 0;
-}
-
-static int
-dpif_netdev_flow_put(struct dpif *dpif, struct odp_flow_put *put)
-{
-    struct dp_netdev *dp = get_dp_netdev(dpif);
-    struct dp_netdev_flow *flow;
-
-    flow = dp_netdev_lookup_flow(dp, &put->flow.key);
-    if (!flow) {
-        if (put->flags & ODPPF_CREATE) {
-            if (hmap_count(&dp->flow_table) < MAX_FLOWS) {
-                return add_flow(dpif, &put->flow);
-            } else {
-                return EFBIG;
-            }
-        } else {
-            return ENOENT;
-        }
-    } else {
-        if (put->flags & ODPPF_MODIFY) {
-            int error = set_flow_actions(flow, &put->flow);
-            if (!error && put->flags & ODPPF_ZERO_STATS) {
-                clear_stats(flow);
-            }
-            return error;
-        } else {
-            return EEXIST;
-        }
-    }
-}
-
-
-static int
-dpif_netdev_flow_del(struct dpif *dpif, struct odp_flow *odp_flow)
-{
-    struct dp_netdev *dp = get_dp_netdev(dpif);
-    struct dp_netdev_flow *flow;
-
-    flow = dp_netdev_lookup_flow(dp, &odp_flow->key);
-    if (flow) {
-        answer_flow_query(flow, 0, odp_flow);
-        dp_netdev_free_flow(dp, flow);
-        return 0;
-    } else {
-        return ENOENT;
-    }
-}
-
-static int
-dpif_netdev_flow_list(const struct dpif *dpif, struct odp_flow flows[], int n)
-{
-    struct dp_netdev *dp = get_dp_netdev(dpif);
-    struct dp_netdev_flow *flow;
-    int i;
-
-    i = 0;
-    HMAP_FOR_EACH (flow, struct dp_netdev_flow, node, &dp->flow_table) {
-        if (i >= n) {
-            break;
-        }
-        answer_flow_query(flow, 0, &flows[i++]);
-    }
-    return hmap_count(&dp->flow_table);
-}
-
-static int
-dpif_netdev_execute(struct dpif *dpif, uint16_t in_port,
-                    const union odp_action actions[], int n_actions,
-                    const struct ofpbuf *packet)
-{
-    struct dp_netdev *dp = get_dp_netdev(dpif);
-    struct ofpbuf copy;
-    bool mutates;
-    struct odp_flow_key key;
-    flow_t flow;
-    int error;
-
-    if (packet->size < ETH_HEADER_LEN || packet->size > UINT16_MAX) {
-        return EINVAL;
-    }
-
-    error = dpif_netdev_validate_actions(actions, n_actions, &mutates);
-    if (error) {
-        return error;
-    }
-
-    if (mutates) {
-        /* We need a deep copy of 'packet' since we're going to modify its
-         * data. */
-        ofpbuf_init(&copy, DP_NETDEV_HEADROOM + packet->size);
-        copy.data = (char*)copy.base + DP_NETDEV_HEADROOM;
-        ofpbuf_put(&copy, packet->data, packet->size);
-    } else {
-        /* We still need a shallow copy of 'packet', even though we won't
-         * modify its data, because flow_extract() modifies packet->l2, etc.
-         * We could probably get away with modifying those but it's more polite
-         * if we don't. */
-        copy = *packet;
-    }
-    flow_extract(&copy, in_port, &flow);
-    odp_flow_key_from_flow(&key, &flow);
-    error = dp_netdev_execute_actions(dp, &copy, &key, actions, n_actions);
-    if (mutates) {
-        ofpbuf_uninit(&copy);
-    }
-    return error;
-}
-
-static int
-dpif_netdev_recv_get_mask(const struct dpif *dpif, int *listen_mask)
-{
-    struct dpif_netdev *dpif_netdev = dpif_netdev_cast(dpif);
-    *listen_mask = dpif_netdev->listen_mask;
-    return 0;
-}
-
-static int
-dpif_netdev_recv_set_mask(struct dpif *dpif, int listen_mask)
-{
-    struct dpif_netdev *dpif_netdev = dpif_netdev_cast(dpif);
-    if (!(listen_mask & ~ODPL_ALL)) {
-        dpif_netdev->listen_mask = listen_mask;
-        return 0;
-    } else {
-        return EINVAL;
-    }
-}
-
-static struct ovs_queue *
-find_nonempty_queue(struct dpif *dpif)
-{
-    struct dpif_netdev *dpif_netdev = dpif_netdev_cast(dpif);
-    struct dp_netdev *dp = get_dp_netdev(dpif);
-    int mask = dpif_netdev->listen_mask;
-    int i;
-
-    for (i = 0; i < N_QUEUES; i++) {
-        struct ovs_queue *q = &dp->queues[i];
-        if (q->n && mask & (1u << i)) {
-            return q;
-        }
-    }
-    return NULL;
-}
-
-static int
-dpif_netdev_recv(struct dpif *dpif, struct ofpbuf **bufp)
-{
-    struct ovs_queue *q = find_nonempty_queue(dpif);
-    if (q) {
-        *bufp = queue_pop_head(q);
-        return 0;
-    } else {
-        return EAGAIN;
-    }
-}
-
-static void
-dpif_netdev_recv_wait(struct dpif *dpif)
-{
-    struct ovs_queue *q = find_nonempty_queue(dpif);
-    if (q) {
-        poll_immediate_wake();
-    } else {
-        /* No messages ready to be received, and dp_wait() will ensure that we
-         * wake up to queue new messages, so there is nothing to do. */
-    }
-}
-\f
-static void
-dp_netdev_flow_used(struct dp_netdev_flow *flow,
-                    const struct odp_flow_key *key,
-                    const struct ofpbuf *packet)
-{
-    time_timeval(&flow->used);
-    flow->packet_count++;
-    flow->byte_count += packet->size;
-    if (key->dl_type == htons(ETH_TYPE_IP)) {
-        struct ip_header *nh = packet->l3;
-        flow->ip_tos = nh->ip_tos;
-
-        if (key->nw_proto == IPPROTO_TCP) {
-            struct tcp_header *th = packet->l4;
-            flow->tcp_ctl |= th->tcp_ctl;
-        }
-    }
-}
-
-static void
-dp_netdev_port_input(struct dp_netdev *dp, struct dp_netdev_port *port,
-                     struct ofpbuf *packet)
-{
-    struct dp_netdev_flow *flow;
-    struct odp_flow_key key;
-    flow_t f;
-
-    if (flow_extract(packet, port->port_no, &f) && dp->drop_frags) {
-        dp->n_frags++;
-        return;
-    }
-    odp_flow_key_from_flow(&key, &f);
-
-    flow = dp_netdev_lookup_flow(dp, &key);
-    if (flow) {
-        dp_netdev_flow_used(flow, &key, packet);
-        dp_netdev_execute_actions(dp, packet, &key,
-                                  flow->actions, flow->n_actions);
-        dp->n_hit++;
-    } else {
-        dp->n_missed++;
-        dp_netdev_output_control(dp, packet, _ODPL_MISS_NR, port->port_no, 0);
-    }
-}
-
-static void
-dp_netdev_run(void)
-{
-    struct ofpbuf packet;
-    struct dp_netdev *dp;
-
-    ofpbuf_init(&packet, DP_NETDEV_HEADROOM + max_mtu);
-    LIST_FOR_EACH (dp, struct dp_netdev, node, &dp_netdev_list) {
-        struct dp_netdev_port *port;
-
-        LIST_FOR_EACH (port, struct dp_netdev_port, node, &dp->port_list) {
-            int error;
-
-            /* Reset packet contents. */
-            packet.data = (char*)packet.base + DP_NETDEV_HEADROOM;
-            packet.size = 0;
-
-            error = netdev_recv(port->netdev, &packet);
-            if (!error) {
-                dp_netdev_port_input(dp, port, &packet);
-            } else if (error != EAGAIN) {
-                struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);
-                VLOG_ERR_RL(&rl, "error receiving data from %s: %s",
-                            netdev_get_name(port->netdev), strerror(error));
-            }
-        }
-    }
-    ofpbuf_uninit(&packet);
-}
-
-static void
-dp_netdev_wait(void)
-{
-    struct dp_netdev *dp;
-
-    LIST_FOR_EACH (dp, struct dp_netdev, node, &dp_netdev_list) {
-        struct dp_netdev_port *port;
-        LIST_FOR_EACH (port, struct dp_netdev_port, node, &dp->port_list) {
-            netdev_recv_wait(port->netdev);
-        }
-    }
-}
-
-
-/* Modify or add a 802.1Q header in 'packet' according to 'a'. */
-static void
-dp_netdev_set_dl_tci(struct ofpbuf *packet, struct odp_flow_key *key,
-                     const struct odp_action_dl_tci *a)
-{
-    struct vlan_eth_header *veh;
-
-    if (key->dl_tci) {
-        veh = packet->l2;
-        veh->veth_tci = (veh->veth_tci & ~a->mask) | a->tci;
-    } else {
-        /* Insert new 802.1Q header. */
-        struct eth_header *eh = packet->l2;
-        struct vlan_eth_header tmp;
-        memcpy(tmp.veth_dst, eh->eth_dst, ETH_ADDR_LEN);
-        memcpy(tmp.veth_src, eh->eth_src, ETH_ADDR_LEN);
-        tmp.veth_type = htons(ETH_TYPE_VLAN);
-        tmp.veth_tci = htons(a->tci);
-        tmp.veth_next_type = eh->eth_type;
-
-        veh = ofpbuf_push_uninit(packet, VLAN_HEADER_LEN);
-        memcpy(veh, &tmp, sizeof tmp);
-        packet->l2 = (char*)packet->l2 - VLAN_HEADER_LEN;
-    }
-
-    key->dl_tci = veh->veth_tci | htons(ODP_TCI_PRESENT);
-}
-
-static void
-dp_netdev_strip_vlan(struct ofpbuf *packet, struct odp_flow_key *key)
-{
-    struct vlan_eth_header *veh = packet->l2;
-    if (veh->veth_type == htons(ETH_TYPE_VLAN)) {
-        struct eth_header tmp;
-
-        memcpy(tmp.eth_dst, veh->veth_dst, ETH_ADDR_LEN);
-        memcpy(tmp.eth_src, veh->veth_src, ETH_ADDR_LEN);
-        tmp.eth_type = veh->veth_next_type;
-
-        packet->size -= VLAN_HEADER_LEN;
-        packet->data = (char*)packet->data + VLAN_HEADER_LEN;
-        packet->l2 = (char*)packet->l2 + VLAN_HEADER_LEN;
-        memcpy(packet->data, &tmp, sizeof tmp);
-
-        key->dl_tci = htons(0);
-    }
-}
-
-static void
-dp_netdev_set_dl_src(struct ofpbuf *packet, struct odp_flow_key *key,
-                     const uint8_t dl_addr[ETH_ADDR_LEN])
-{
-    struct eth_header *eh = packet->l2;
-    memcpy(eh->eth_src, dl_addr, sizeof eh->eth_src);
-    memcpy(key->dl_src, dl_addr, sizeof key->dl_src);
-}
-
-static void
-dp_netdev_set_dl_dst(struct ofpbuf *packet, struct odp_flow_key *key,
-                     const uint8_t dl_addr[ETH_ADDR_LEN])
-{
-    struct eth_header *eh = packet->l2;
-    memcpy(eh->eth_dst, dl_addr, sizeof eh->eth_dst);
-    memcpy(key->dl_dst, dl_addr, sizeof key->dl_dst);
-}
-
-static void
-dp_netdev_set_nw_addr(struct ofpbuf *packet, struct odp_flow_key *key,
-                      const struct odp_action_nw_addr *a)
-{
-    if (key->dl_type == htons(ETH_TYPE_IP)) {
-        struct ip_header *nh = packet->l3;
-        uint32_t *field;
-
-        field = a->type == ODPAT_SET_NW_SRC ? &nh->ip_src : &nh->ip_dst;
-        if (key->nw_proto == IP_TYPE_TCP) {
-            struct tcp_header *th = packet->l4;
-            th->tcp_csum = recalc_csum32(th->tcp_csum, *field, a->nw_addr);
-        } else if (key->nw_proto == IP_TYPE_UDP) {
-            struct udp_header *uh = packet->l4;
-            if (uh->udp_csum) {
-                uh->udp_csum = recalc_csum32(uh->udp_csum, *field, a->nw_addr);
-                if (!uh->udp_csum) {
-                    uh->udp_csum = 0xffff;
-                }
-            }
-        }
-        nh->ip_csum = recalc_csum32(nh->ip_csum, *field, a->nw_addr);
-        *field = a->nw_addr;
-
-        if (a->type == ODPAT_SET_NW_SRC) {
-            key->nw_src = a->type;
-        } else {
-            key->nw_dst = a->type;
-        }
-    }
-}
-
-static void
-dp_netdev_set_nw_tos(struct ofpbuf *packet, struct odp_flow_key *key,
-                     const struct odp_action_nw_tos *a)
-{
-    if (key->dl_type == htons(ETH_TYPE_IP)) {
-        struct ip_header *nh = packet->l3;
-        uint8_t *field = &nh->ip_tos;
-
-        /* Set the DSCP bits and preserve the ECN bits. */
-        uint8_t new = a->nw_tos | (nh->ip_tos & IP_ECN_MASK);
-
-        nh->ip_csum = recalc_csum16(nh->ip_csum, htons((uint16_t)*field),
-                htons((uint16_t)a->nw_tos));
-        *field = new;
-        key->nw_tos = a->nw_tos;
-    }
-}
-
-static void
-dp_netdev_set_tp_port(struct ofpbuf *packet, struct odp_flow_key *key,
-                      const struct odp_action_tp_port *a)
-{
-    if (key->dl_type == htons(ETH_TYPE_IP)) {
-        uint16_t *field;
-        if (key->nw_proto == IPPROTO_TCP) {
-            struct tcp_header *th = packet->l4;
-            field = a->type == ODPAT_SET_TP_SRC ? &th->tcp_src : &th->tcp_dst;
-            th->tcp_csum = recalc_csum16(th->tcp_csum, *field, a->tp_port);
-            *field = a->tp_port;
-        } else if (key->nw_proto == IPPROTO_UDP) {
-            struct udp_header *uh = packet->l4;
-            field = a->type == ODPAT_SET_TP_SRC ? &uh->udp_src : &uh->udp_dst;
-            uh->udp_csum = recalc_csum16(uh->udp_csum, *field, a->tp_port);
-            *field = a->tp_port;
-        } else {
-            return;
-        }
-
-        if (a->type == ODPAT_SET_TP_SRC) {
-            key->tp_src = a->tp_port;
-        } else {
-            key->tp_dst = a->tp_port;
-        }
-    }
-}
-
-static void
-dp_netdev_output_port(struct dp_netdev *dp, struct ofpbuf *packet,
-                      uint16_t out_port)
-{
-    struct dp_netdev_port *p = dp->ports[out_port];
-    if (p) {
-        netdev_send(p->netdev, packet);
-    }
-}
-
-static void
-dp_netdev_output_group(struct dp_netdev *dp, uint16_t group, uint16_t in_port,
-                       struct ofpbuf *packet)
-{
-    struct odp_port_group *g = &dp->groups[group];
-    int i;
-
-    for (i = 0; i < g->n_ports; i++) {
-        uint16_t out_port = g->ports[i];
-        if (out_port != in_port) {
-            dp_netdev_output_port(dp, packet, out_port);
-        }
-    }
-}
-
-static int
-dp_netdev_output_control(struct dp_netdev *dp, const struct ofpbuf *packet,
-                         int queue_no, int port_no, uint32_t arg)
-{
-    struct ovs_queue *q = &dp->queues[queue_no];
-    struct odp_msg *header;
-    struct ofpbuf *msg;
-    size_t msg_size;
-
-    if (q->n >= MAX_QUEUE_LEN) {
-        dp->n_lost++;
-        return ENOBUFS;
-    }
-
-    msg_size = sizeof *header + packet->size;
-    msg = ofpbuf_new(msg_size);
-    header = ofpbuf_put_uninit(msg, sizeof *header);
-    header->type = queue_no;
-    header->length = msg_size;
-    header->port = port_no;
-    header->arg = arg;
-    ofpbuf_put(msg, packet->data, packet->size);
-    queue_push_tail(q, msg);
-
-    return 0;
-}
-
-static int
-dp_netdev_execute_actions(struct dp_netdev *dp,
-                          struct ofpbuf *packet, struct odp_flow_key *key,
-                          const union odp_action *actions, int n_actions)
-{
-    int i;
-    for (i = 0; i < n_actions; i++) {
-        const union odp_action *a = &actions[i];
-
-        switch (a->type) {
-        case ODPAT_OUTPUT:
-            dp_netdev_output_port(dp, packet, a->output.port);
-            break;
-
-        case ODPAT_OUTPUT_GROUP:
-            dp_netdev_output_group(dp, a->output_group.group, key->in_port,
-                                   packet);
-            break;
-
-        case ODPAT_CONTROLLER:
-            dp_netdev_output_control(dp, packet, _ODPL_ACTION_NR,
-                                     key->in_port, a->controller.arg);
-            break;
-
-        case ODPAT_SET_DL_TCI:
-            dp_netdev_set_dl_tci(packet, key, &a->dl_tci);
-            break;
-
-        case ODPAT_STRIP_VLAN:
-            dp_netdev_strip_vlan(packet, key);
-            break;
-
-        case ODPAT_SET_DL_SRC:
-            dp_netdev_set_dl_src(packet, key, a->dl_addr.dl_addr);
-            break;
-
-        case ODPAT_SET_DL_DST:
-            dp_netdev_set_dl_dst(packet, key, a->dl_addr.dl_addr);
-            break;
-
-        case ODPAT_SET_NW_SRC:
-        case ODPAT_SET_NW_DST:
-            dp_netdev_set_nw_addr(packet, key, &a->nw_addr);
-            break;
-
-        case ODPAT_SET_NW_TOS:
-            dp_netdev_set_nw_tos(packet, key, &a->nw_tos);
-            break;
-
-        case ODPAT_SET_TP_SRC:
-        case ODPAT_SET_TP_DST:
-            dp_netdev_set_tp_port(packet, key, &a->tp_port);
-            break;
-        }
-    }
-    return 0;
-}
-
-const struct dpif_class dpif_netdev_class = {
-    "netdev",
-    dp_netdev_run,
-    dp_netdev_wait,
-    NULL,                       /* enumerate */
-    dpif_netdev_open,
-    dpif_netdev_close,
-    NULL,                       /* get_all_names */
-    dpif_netdev_destroy,
-    dpif_netdev_get_stats,
-    dpif_netdev_get_drop_frags,
-    dpif_netdev_set_drop_frags,
-    dpif_netdev_port_add,
-    dpif_netdev_port_del,
-    dpif_netdev_port_query_by_number,
-    dpif_netdev_port_query_by_name,
-    dpif_netdev_port_list,
-    dpif_netdev_port_poll,
-    dpif_netdev_port_poll_wait,
-    dpif_netdev_port_group_get,
-    dpif_netdev_port_group_set,
-    dpif_netdev_flow_get,
-    dpif_netdev_flow_put,
-    dpif_netdev_flow_del,
-    dpif_netdev_flow_flush,
-    dpif_netdev_flow_list,
-    dpif_netdev_execute,
-    dpif_netdev_recv_get_mask,
-    dpif_netdev_recv_set_mask,
-    NULL,                       /* get_sflow_probability */
-    NULL,                       /* set_sflow_probability */
-    dpif_netdev_recv,
-    dpif_netdev_recv_wait,
-};
diff --git a/lib/dpif.h b/lib/dpif.h
deleted file mode 100644 (file)
index 4789284..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright (c) 2008, 2009, 2010 Nicira Networks.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-#ifndef DPIF_H
-#define DPIF_H 1
-
-#include "openvswitch/datapath-protocol.h"
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdint.h>
-
-#ifdef  __cplusplus
-extern "C" {
-#endif
-
-struct dpif;
-struct ofpbuf;
-struct svec;
-struct dpif_class;
-
-void dp_run(void);
-void dp_wait(void);
-
-int dp_register_provider(const struct dpif_class *);
-int dp_unregister_provider(const char *type);
-void dp_enumerate_types(struct svec *types);
-
-int dp_enumerate_names(const char *type, struct svec *names);
-void dp_parse_name(const char *datapath_name, char **name, char **type);
-
-int dpif_open(const char *name, const char *type, struct dpif **);
-int dpif_create(const char *name, const char *type, struct dpif **);
-int dpif_create_and_open(const char *name, const char *type, struct dpif **);
-void dpif_close(struct dpif *);
-
-const char *dpif_name(const struct dpif *);
-const char *dpif_base_name(const struct dpif *);
-int dpif_get_all_names(const struct dpif *, struct svec *);
-
-int dpif_delete(struct dpif *);
-
-int dpif_get_dp_stats(const struct dpif *, struct odp_stats *);
-int dpif_get_drop_frags(const struct dpif *, bool *drop_frags);
-int dpif_set_drop_frags(struct dpif *, bool drop_frags);
-
-int dpif_port_add(struct dpif *, const char *devname, uint16_t flags,
-                  uint16_t *port_no);
-int dpif_port_del(struct dpif *, uint16_t port_no);
-int dpif_port_query_by_number(const struct dpif *, uint16_t port_no,
-                              struct odp_port *);
-int dpif_port_query_by_name(const struct dpif *, const char *devname,
-                            struct odp_port *);
-int dpif_port_get_name(struct dpif *, uint16_t port_no,
-                       char *name, size_t name_size);
-int dpif_port_list(const struct dpif *, struct odp_port **, size_t *n_ports);
-
-int dpif_port_poll(const struct dpif *, char **devnamep);
-void dpif_port_poll_wait(const struct dpif *);
-
-int dpif_port_group_get(const struct dpif *, uint16_t group,
-                        uint16_t **ports, size_t *n_ports);
-int dpif_port_group_set(struct dpif *, uint16_t group,
-                        const uint16_t ports[], size_t n_ports);
-
-int dpif_flow_flush(struct dpif *);
-int dpif_flow_put(struct dpif *, struct odp_flow_put *);
-int dpif_flow_del(struct dpif *, struct odp_flow *);
-int dpif_flow_get(const struct dpif *, struct odp_flow *);
-int dpif_flow_get_multiple(const struct dpif *, struct odp_flow[], size_t n);
-int dpif_flow_list(const struct dpif *, struct odp_flow[], size_t n,
-                   size_t *n_out);
-int dpif_flow_list_all(const struct dpif *,
-                       struct odp_flow **flowsp, size_t *np);
-
-int dpif_execute(struct dpif *, uint16_t in_port,
-                 const union odp_action[], size_t n_actions,
-                 const struct ofpbuf *);
-
-int dpif_recv_get_mask(const struct dpif *, int *listen_mask);
-int dpif_recv_set_mask(struct dpif *, int listen_mask);
-int dpif_get_sflow_probability(const struct dpif *, uint32_t *probability);
-int dpif_set_sflow_probability(struct dpif *, uint32_t probability);
-int dpif_recv(struct dpif *, struct ofpbuf **);
-int dpif_recv_purge(struct dpif *);
-void dpif_recv_wait(struct dpif *);
-
-void dpif_get_netflow_ids(const struct dpif *,
-                          uint8_t *engine_type, uint8_t *engine_id);
-
-#ifdef  __cplusplus
-}
-#endif
-
-#endif /* dpif.h */
index 28aec66..c70180e 100644 (file)
@@ -25,7 +25,7 @@
 #include "hash.h"
 #include "ofpbuf.h"
 #include "openflow/openflow.h"
-#include "openvswitch/datapath-protocol.h"
+#include "openvswitch/xflow.h"
 #include "packets.h"
 
 #include "vlog.h"
@@ -220,7 +220,7 @@ flow_extract(struct ofpbuf *packet, uint16_t in_port, flow_t *flow)
  */
 void
 flow_extract_stats(const flow_t *flow, struct ofpbuf *packet, 
-        struct odp_flow_stats *stats)
+        struct xflow_flow_stats *stats)
 {
     memset(stats, '\0', sizeof(*stats));
 
@@ -243,7 +243,7 @@ void
 flow_to_match(const flow_t *flow, uint32_t wildcards, struct ofp_match *match)
 {
     match->wildcards = htonl(wildcards);
-    match->in_port = htons(flow->in_port == ODPP_LOCAL ? OFPP_LOCAL
+    match->in_port = htons(flow->in_port == XFLOWP_LOCAL ? OFPP_LOCAL
                            : flow->in_port);
     match->dl_vlan = flow->dl_vlan;
     match->dl_vlan_pcp = flow->dl_vlan_pcp;
@@ -269,7 +269,7 @@ flow_from_match(flow_t *flow, uint32_t *wildcards,
     }
     flow->nw_src = match->nw_src;
     flow->nw_dst = match->nw_dst;
-    flow->in_port = (match->in_port == htons(OFPP_LOCAL) ? ODPP_LOCAL
+    flow->in_port = (match->in_port == htons(OFPP_LOCAL) ? XFLOWP_LOCAL
                      : ntohs(match->in_port));
     flow->dl_vlan = match->dl_vlan;
     flow->dl_vlan_pcp = match->dl_vlan_pcp;
index 9eace03..ae09bc3 100644 (file)
 #include <stdbool.h>
 #include <stdint.h>
 #include <string.h>
-#include "openflow/openflow.h"
 #include "hash.h"
 #include "openflow/openflow.h"
-#include "openvswitch/datapath-protocol.h"
+#include "openvswitch/xflow.h"
 #include "util.h"
 
 struct ds;
@@ -57,7 +56,7 @@ BUILD_ASSERT_DECL(sizeof(struct flow) == FLOW_SIG_SIZE + FLOW_PAD_SIZE);
 
 int flow_extract(struct ofpbuf *, uint16_t in_port, flow_t *);
 void flow_extract_stats(const flow_t *flow, struct ofpbuf *packet, 
-        struct odp_flow_stats *stats);
+        struct xflow_flow_stats *stats);
 void flow_to_match(const flow_t *, uint32_t wildcards, struct ofp_match *);
 void flow_from_match(flow_t *, uint32_t *wildcards, const struct ofp_match *);
 char *flow_to_string(const flow_t *);
index 1d302ea..79541f3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009 Nicira Networks.
+ * Copyright (c) 2009, 2010 Nicira Networks.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -47,7 +47,7 @@ static void rtnetlink_report_notify_error(void);
  * caller must not modify or free.
  *
  * This is probably not the function that you want.  You should probably be
- * using dpif_port_poll() or netdev_monitor_create(), which unlike this
+ * using xfif_port_poll() or netdev_monitor_create(), which unlike this
  * function are not Linux-specific.
  *
  * Returns 0 if successful, otherwise a positive errno value. */
index d8807fd..025479a 100644 (file)
@@ -966,7 +966,7 @@ make_flow_mod(uint16_t command, const flow_t *flow, size_t actions_len)
     ofm->header.length = htons(size);
     ofm->cookie = 0;
     ofm->match.wildcards = htonl(0);
-    ofm->match.in_port = htons(flow->in_port == ODPP_LOCAL ? OFPP_LOCAL
+    ofm->match.in_port = htons(flow->in_port == XFLOWP_LOCAL ? OFPP_LOCAL
                                : flow->in_port);
     memcpy(ofm->match.dl_src, flow->dl_src, sizeof ofm->match.dl_src);
     memcpy(ofm->match.dl_dst, flow->dl_dst, sizeof ofm->match.dl_dst);
@@ -1057,7 +1057,7 @@ make_packet_out(const struct ofpbuf *packet, uint32_t buffer_id,
     opo->header.length = htons(size);
     opo->header.xid = htonl(0);
     opo->buffer_id = htonl(buffer_id);
-    opo->in_port = htons(in_port == ODPP_LOCAL ? OFPP_LOCAL : in_port);
+    opo->in_port = htons(in_port == XFLOWP_LOCAL ? OFPP_LOCAL : in_port);
     opo->actions_len = htons(actions_len);
     ofpbuf_put(out, actions, actions_len);
     if (packet) {
index dac8162..62e9de5 100644 (file)
@@ -28,9 +28,6 @@ VLOG_MODULE(datapath)
 VLOG_MODULE(dhcp)
 VLOG_MODULE(dhcp_client)
 VLOG_MODULE(discovery)
-VLOG_MODULE(dpif)
-VLOG_MODULE(dpif_linux)
-VLOG_MODULE(dpif_netdev)
 VLOG_MODULE(dpctl)
 VLOG_MODULE(ezio_term)
 VLOG_MODULE(fail_open)
@@ -47,19 +44,19 @@ VLOG_MODULE(netdev_linux)
 VLOG_MODULE(netflow)
 VLOG_MODULE(netlink)
 VLOG_MODULE(ofctl)
-VLOG_MODULE(ovs_discover)
 VLOG_MODULE(ofproto)
 VLOG_MODULE(openflowd)
+VLOG_MODULE(ovs_discover)
 VLOG_MODULE(ovsdb_client)
 VLOG_MODULE(ovsdb_error)
 VLOG_MODULE(ovsdb_file)
 VLOG_MODULE(ovsdb_idl)
-VLOG_MODULE(ovsdb_log)
 VLOG_MODULE(ovsdb_jsonrpc_server)
+VLOG_MODULE(ovsdb_log)
 VLOG_MODULE(ovsdb_server)
 VLOG_MODULE(ovsdb_tool)
-VLOG_MODULE(pktbuf)
 VLOG_MODULE(pcap)
+VLOG_MODULE(pktbuf)
 VLOG_MODULE(poll_loop)
 VLOG_MODULE(port_watcher)
 VLOG_MODULE(proc_net_compat)
@@ -68,33 +65,36 @@ VLOG_MODULE(rconn)
 VLOG_MODULE(reconnect)
 VLOG_MODULE(rtnetlink)
 VLOG_MODULE(sflow)
+VLOG_MODULE(socket_util)
+VLOG_MODULE(stats)
+VLOG_MODULE(status)
 VLOG_MODULE(stp)
+VLOG_MODULE(stream)
 VLOG_MODULE(stream_fd)
 VLOG_MODULE(stream_ssl)
 VLOG_MODULE(stream_tcp)
 VLOG_MODULE(stream_unix)
-VLOG_MODULE(stream)
-VLOG_MODULE(stats)
-VLOG_MODULE(status)
 VLOG_MODULE(svec)
 VLOG_MODULE(switch)
+VLOG_MODULE(switchui)
 VLOG_MODULE(terminal)
 VLOG_MODULE(timeval)
 VLOG_MODULE(tty)
-VLOG_MODULE(socket_util)
-VLOG_MODULE(switchui)
 VLOG_MODULE(unixctl)
 VLOG_MODULE(util)
-VLOG_MODULE(vconn_tcp)
+VLOG_MODULE(vconn)
 VLOG_MODULE(vconn_ssl)
 VLOG_MODULE(vconn_stream)
+VLOG_MODULE(vconn_tcp)
 VLOG_MODULE(vconn_unix)
-VLOG_MODULE(vconn)
-VLOG_MODULE(vsctl)
 VLOG_MODULE(vlog)
-VLOG_MODULE(wcelim)
+VLOG_MODULE(vsctl)
 VLOG_MODULE(vswitchd)
 VLOG_MODULE(vt)
+VLOG_MODULE(wcelim)
 VLOG_MODULE(xenserver)
+VLOG_MODULE(xfif)
+VLOG_MODULE(xfif_linux)
+VLOG_MODULE(xfif_netdev)
 
 #undef VLOG_MODULE
similarity index 58%
rename from lib/dpif-linux.c
rename to lib/xfif-linux.c
index 1eaba74..8300f70 100644 (file)
@@ -15,7 +15,7 @@
  */
 
 #include <config.h>
-#include "dpif.h"
+#include "xfif.h"
 
 #include <assert.h>
 #include <ctype.h>
 #include <sys/ioctl.h>
 #include <unistd.h>
 
-#include "dpif-provider.h"
 #include "ofpbuf.h"
 #include "poll-loop.h"
 #include "rtnetlink.h"
 #include "svec.h"
 #include "util.h"
+#include "xfif-provider.h"
 
 #include "vlog.h"
-#define THIS_MODULE VLM_dpif_linux
+#define THIS_MODULE VLM_xfif_linux
 
 /* Datapath interface for the openvswitch Linux kernel module. */
-struct dpif_linux {
-    struct dpif dpif;
+struct xfif_linux {
+    struct xfif xfif;
     int fd;
 
-    /* Used by dpif_linux_get_all_names(). */
+    /* Used by xfif_linux_get_all_names(). */
     char *local_ifname;
     int minor;
 
@@ -58,25 +58,25 @@ struct dpif_linux {
 
 static struct vlog_rate_limit error_rl = VLOG_RATE_LIMIT_INIT(9999, 5);
 
-static int do_ioctl(const struct dpif *, int cmd, const void *arg);
+static int do_ioctl(const struct xfif *, int cmd, const void *arg);
 static int lookup_minor(const char *name, int *minor);
-static int finish_open(struct dpif *, const char *local_ifname);
+static int finish_open(struct xfif *, const char *local_ifname);
 static int get_openvswitch_major(void);
-static int create_minor(const char *name, int minor, struct dpif **dpifp);
-static int open_minor(int minor, struct dpif **dpifp);
+static int create_minor(const char *name, int minor, struct xfif **xfifp);
+static int open_minor(int minor, struct xfif **xfifp);
 static int make_openvswitch_device(int minor, char **fnp);
-static void dpif_linux_port_changed(const struct rtnetlink_change *,
-                                    void *dpif);
+static void xfif_linux_port_changed(const struct rtnetlink_change *,
+                                    void *xfif);
 
-static struct dpif_linux *
-dpif_linux_cast(const struct dpif *dpif)
+static struct xfif_linux *
+xfif_linux_cast(const struct xfif *xfif)
 {
-    dpif_assert_class(dpif, &dpif_linux_class);
-    return CONTAINER_OF(dpif, struct dpif_linux, dpif);
+    xfif_assert_class(xfif, &xfif_linux_class);
+    return CONTAINER_OF(xfif, struct xfif_linux, xfif);
 }
 
 static int
-dpif_linux_enumerate(struct svec *all_dps)
+xfif_linux_enumerate(struct svec *all_dps)
 {
     int major;
     int error;
@@ -89,16 +89,16 @@ dpif_linux_enumerate(struct svec *all_dps)
     }
 
     error = 0;
-    for (i = 0; i < ODP_MAX; i++) {
-        struct dpif *dpif;
+    for (i = 0; i < XFLOW_MAX; i++) {
+        struct xfif *xfif;
         char devname[16];
         int retval;
 
         sprintf(devname, "dp%d", i);
-        retval = dpif_open(devname, "system", &dpif);
+        retval = xfif_open(devname, "system", &xfif);
         if (!retval) {
             svec_add(all_dps, devname);
-            dpif_uninit(dpif, true);
+            xfif_uninit(xfif, true);
         } else if (retval != ENODEV && !error) {
             error = retval;
         }
@@ -107,8 +107,8 @@ dpif_linux_enumerate(struct svec *all_dps)
 }
 
 static int
-dpif_linux_open(const char *name, const char *type OVS_UNUSED, bool create,
-                struct dpif **dpifp)
+xfif_linux_open(const char *name, const char *type OVS_UNUSED, bool create,
+                struct xfif **xfifp)
 {
     int minor;
 
@@ -116,11 +116,11 @@ dpif_linux_open(const char *name, const char *type OVS_UNUSED, bool create,
             && isdigit((unsigned char)name[2]) ? atoi(name + 2) : -1;
     if (create) {
         if (minor >= 0) {
-            return create_minor(name, minor, dpifp);
+            return create_minor(name, minor, xfifp);
         } else {
             /* Scan for unused minor number. */
-            for (minor = 0; minor < ODP_MAX; minor++) {
-                int error = create_minor(name, minor, dpifp);
+            for (minor = 0; minor < XFLOW_MAX; minor++) {
+                int error = create_minor(name, minor, xfifp);
                 if (error != EBUSY) {
                     return error;
                 }
@@ -130,8 +130,8 @@ dpif_linux_open(const char *name, const char *type OVS_UNUSED, bool create,
             return ENOBUFS;
         }
     } else {
-        struct dpif_linux *dpif;
-        struct odp_port port;
+        struct xfif_linux *xfif;
+        struct xflow_port port;
         int error;
 
         if (minor < 0) {
@@ -141,72 +141,72 @@ dpif_linux_open(const char *name, const char *type OVS_UNUSED, bool create,
             }
         }
 
-        error = open_minor(minor, dpifp);
+        error = open_minor(minor, xfifp);
         if (error) {
             return error;
         }
-        dpif = dpif_linux_cast(*dpifp);
+        xfif = xfif_linux_cast(*xfifp);
 
         /* We need the local port's ifindex for the poll function.  Start by
          * getting the local port's name. */
         memset(&port, 0, sizeof port);
-        port.port = ODPP_LOCAL;
-        if (ioctl(dpif->fd, ODP_PORT_QUERY, &port)) {
+        port.port = XFLOWP_LOCAL;
+        if (ioctl(xfif->fd, XFLOW_PORT_QUERY, &port)) {
             error = errno;
             if (error != ENODEV) {
                 VLOG_WARN("%s: probe returned unexpected error: %s",
-                          dpif_name(*dpifp), strerror(error));
+                          xfif_name(*xfifp), strerror(error));
             }
-            dpif_uninit(*dpifp, true);
+            xfif_uninit(*xfifp, true);
             return error;
         }
 
         /* Then use that to finish up opening. */
-        return finish_open(&dpif->dpif, port.devname);
+        return finish_open(&xfif->xfif, port.devname);
     }
 }
 
 static void
-dpif_linux_close(struct dpif *dpif_)
+xfif_linux_close(struct xfif *xfif_)
 {
-    struct dpif_linux *dpif = dpif_linux_cast(dpif_);
-    rtnetlink_notifier_unregister(&dpif->port_notifier);
-    svec_destroy(&dpif->changed_ports);
-    free(dpif->local_ifname);
-    close(dpif->fd);
-    free(dpif);
+    struct xfif_linux *xfif = xfif_linux_cast(xfif_);
+    rtnetlink_notifier_unregister(&xfif->port_notifier);
+    svec_destroy(&xfif->changed_ports);
+    free(xfif->local_ifname);
+    close(xfif->fd);
+    free(xfif);
 }
 
 static int
-dpif_linux_get_all_names(const struct dpif *dpif_, struct svec *all_names)
+xfif_linux_get_all_names(const struct xfif *xfif_, struct svec *all_names)
 {
-    struct dpif_linux *dpif = dpif_linux_cast(dpif_);
+    struct xfif_linux *xfif = xfif_linux_cast(xfif_);
 
-    svec_add_nocopy(all_names, xasprintf("dp%d", dpif->minor));
-    svec_add(all_names, dpif->local_ifname);
+    svec_add_nocopy(all_names, xasprintf("dp%d", xfif->minor));
+    svec_add(all_names, xfif->local_ifname);
     return 0;
 }
 
 static int
-dpif_linux_destroy(struct dpif *dpif_)
+xfif_linux_destroy(struct xfif *xfif_)
 {
-    return do_ioctl(dpif_, ODP_DP_DESTROY, NULL);
+    return do_ioctl(xfif_, XFLOW_DP_DESTROY, NULL);
 }
 
 static int
-dpif_linux_get_stats(const struct dpif *dpif_, struct odp_stats *stats)
+xfif_linux_get_stats(const struct xfif *xfif_, struct xflow_stats *stats)
 {
     memset(stats, 0, sizeof *stats);
-    return do_ioctl(dpif_, ODP_DP_STATS, stats);
+    return do_ioctl(xfif_, XFLOW_DP_STATS, stats);
 }
 
 static int
-dpif_linux_get_drop_frags(const struct dpif *dpif_, bool *drop_fragsp)
+xfif_linux_get_drop_frags(const struct xfif *xfif_, bool *drop_fragsp)
 {
     int drop_frags;
     int error;
 
-    error = do_ioctl(dpif_, ODP_GET_DROP_FRAGS, &drop_frags);
+    error = do_ioctl(xfif_, XFLOW_GET_DROP_FRAGS, &drop_frags);
     if (!error) {
         *drop_fragsp = drop_frags & 1;
     }
@@ -214,23 +214,23 @@ dpif_linux_get_drop_frags(const struct dpif *dpif_, bool *drop_fragsp)
 }
 
 static int
-dpif_linux_set_drop_frags(struct dpif *dpif_, bool drop_frags)
+xfif_linux_set_drop_frags(struct xfif *xfif_, bool drop_frags)
 {
     int drop_frags_int = drop_frags;
-    return do_ioctl(dpif_, ODP_SET_DROP_FRAGS, &drop_frags_int);
+    return do_ioctl(xfif_, XFLOW_SET_DROP_FRAGS, &drop_frags_int);
 }
 
 static int
-dpif_linux_port_add(struct dpif *dpif_, const char *devname, uint16_t flags,
+xfif_linux_port_add(struct xfif *xfif_, const char *devname, uint16_t flags,
                     uint16_t *port_no)
 {
-    struct odp_port port;
+    struct xflow_port port;
     int error;
 
     memset(&port, 0, sizeof port);
     strncpy(port.devname, devname, sizeof port.devname);
     port.flags = flags;
-    error = do_ioctl(dpif_, ODP_PORT_ADD, &port);
+    error = do_ioctl(xfif_, XFLOW_PORT_ADD, &port);
     if (!error) {
         *port_no = port.port;
     }
@@ -238,59 +238,59 @@ dpif_linux_port_add(struct dpif *dpif_, const char *devname, uint16_t flags,
 }
 
 static int
-dpif_linux_port_del(struct dpif *dpif_, uint16_t port_no)
+xfif_linux_port_del(struct xfif *xfif_, uint16_t port_no)
 {
     int tmp = port_no;
-    return do_ioctl(dpif_, ODP_PORT_DEL, &tmp);
+    return do_ioctl(xfif_, XFLOW_PORT_DEL, &tmp);
 }
 
 static int
-dpif_linux_port_query_by_number(const struct dpif *dpif_, uint16_t port_no,
-                          struct odp_port *port)
+xfif_linux_port_query_by_number(const struct xfif *xfif_, uint16_t port_no,
+                          struct xflow_port *port)
 {
     memset(port, 0, sizeof *port);
     port->port = port_no;
-    return do_ioctl(dpif_, ODP_PORT_QUERY, port);
+    return do_ioctl(xfif_, XFLOW_PORT_QUERY, port);
 }
 
 static int
-dpif_linux_port_query_by_name(const struct dpif *dpif_, const char *devname,
-                              struct odp_port *port)
+xfif_linux_port_query_by_name(const struct xfif *xfif_, const char *devname,
+                              struct xflow_port *port)
 {
     memset(port, 0, sizeof *port);
     strncpy(port->devname, devname, sizeof port->devname);
-    return do_ioctl(dpif_, ODP_PORT_QUERY, port);
+    return do_ioctl(xfif_, XFLOW_PORT_QUERY, port);
 }
 
 static int
-dpif_linux_flow_flush(struct dpif *dpif_)
+xfif_linux_flow_flush(struct xfif *xfif_)
 {
-    return do_ioctl(dpif_, ODP_FLOW_FLUSH, NULL);
+    return do_ioctl(xfif_, XFLOW_FLOW_FLUSH, NULL);
 }
 
 static int
-dpif_linux_port_list(const struct dpif *dpif_, struct odp_port *ports, int n)
+xfif_linux_port_list(const struct xfif *xfif_, struct xflow_port *ports, int n)
 {
-    struct odp_portvec pv;
+    struct xflow_portvec pv;
     int error;
 
     pv.ports = ports;
     pv.n_ports = n;
-    error = do_ioctl(dpif_, ODP_PORT_LIST, &pv);
+    error = do_ioctl(xfif_, XFLOW_PORT_LIST, &pv);
     return error ? -error : pv.n_ports;
 }
 
 static int
-dpif_linux_port_poll(const struct dpif *dpif_, char **devnamep)
+xfif_linux_port_poll(const struct xfif *xfif_, char **devnamep)
 {
-    struct dpif_linux *dpif = dpif_linux_cast(dpif_);
+    struct xfif_linux *xfif = xfif_linux_cast(xfif_);
 
-    if (dpif->change_error) {
-        dpif->change_error = false;
-        svec_clear(&dpif->changed_ports);
+    if (xfif->change_error) {
+        xfif->change_error = false;
+        svec_clear(&xfif->changed_ports);
         return ENOBUFS;
-    } else if (dpif->changed_ports.n) {
-        *devnamep = dpif->changed_ports.names[--dpif->changed_ports.n];
+    } else if (xfif->changed_ports.n) {
+        *devnamep = xfif->changed_ports.names[--xfif->changed_ports.n];
         return 0;
     } else {
         return EAGAIN;
@@ -298,10 +298,10 @@ dpif_linux_port_poll(const struct dpif *dpif_, char **devnamep)
 }
 
 static void
-dpif_linux_port_poll_wait(const struct dpif *dpif_)
+xfif_linux_port_poll_wait(const struct xfif *xfif_)
 {
-    struct dpif_linux *dpif = dpif_linux_cast(dpif_);
-    if (dpif->changed_ports.n || dpif->change_error) {
+    struct xfif_linux *xfif = xfif_linux_cast(xfif_);
+    if (xfif->changed_ports.n || xfif->change_error) {
         poll_immediate_wake();
     } else {
         rtnetlink_notifier_wait();
@@ -309,124 +309,124 @@ dpif_linux_port_poll_wait(const struct dpif *dpif_)
 }
 
 static int
-dpif_linux_port_group_get(const struct dpif *dpif_, int group,
+xfif_linux_port_group_get(const struct xfif *xfif_, int group,
                           uint16_t ports[], int n)
 {
-    struct odp_port_group pg;
+    struct xflow_port_group pg;
     int error;
 
     assert(n <= UINT16_MAX);
     pg.group = group;
     pg.ports = ports;
     pg.n_ports = n;
-    error = do_ioctl(dpif_, ODP_PORT_GROUP_GET, &pg);
+    error = do_ioctl(xfif_, XFLOW_PORT_GROUP_GET, &pg);
     return error ? -error : pg.n_ports;
 }
 
 static int
-dpif_linux_port_group_set(struct dpif *dpif_, int group,
+xfif_linux_port_group_set(struct xfif *xfif_, int group,
                           const uint16_t ports[], int n)
 {
-    struct odp_port_group pg;
+    struct xflow_port_group pg;
 
     assert(n <= UINT16_MAX);
     pg.group = group;
     pg.ports = (uint16_t *) ports;
     pg.n_ports = n;
-    return do_ioctl(dpif_, ODP_PORT_GROUP_SET, &pg);
+    return do_ioctl(xfif_, XFLOW_PORT_GROUP_SET, &pg);
 }
 
 static int
-dpif_linux_flow_get(const struct dpif *dpif_, struct odp_flow flows[], int n)
+xfif_linux_flow_get(const struct xfif *xfif_, struct xflow_flow flows[], int n)
 {
-    struct odp_flowvec fv;
+    struct xflow_flowvec fv;
     fv.flows = flows;
     fv.n_flows = n;
-    return do_ioctl(dpif_, ODP_FLOW_GET, &fv);
+    return do_ioctl(xfif_, XFLOW_FLOW_GET, &fv);
 }
 
 static int
-dpif_linux_flow_put(struct dpif *dpif_, struct odp_flow_put *put)
+xfif_linux_flow_put(struct xfif *xfif_, struct xflow_flow_put *put)
 {
-    return do_ioctl(dpif_, ODP_FLOW_PUT, put);
+    return do_ioctl(xfif_, XFLOW_FLOW_PUT, put);
 }
 
 static int
-dpif_linux_flow_del(struct dpif *dpif_, struct odp_flow *flow)
+xfif_linux_flow_del(struct xfif *xfif_, struct xflow_flow *flow)
 {
-    return do_ioctl(dpif_, ODP_FLOW_DEL, flow);
+    return do_ioctl(xfif_, XFLOW_FLOW_DEL, flow);
 }
 
 static int
-dpif_linux_flow_list(const struct dpif *dpif_, struct odp_flow flows[], int n)
+xfif_linux_flow_list(const struct xfif *xfif_, struct xflow_flow flows[], int n)
 {
-    struct odp_flowvec fv;
+    struct xflow_flowvec fv;
     int error;
 
     fv.flows = flows;
     fv.n_flows = n;
-    error = do_ioctl(dpif_, ODP_FLOW_LIST, &fv);
+    error = do_ioctl(xfif_, XFLOW_FLOW_LIST, &fv);
     return error ? -error : fv.n_flows;
 }
 
 static int
-dpif_linux_execute(struct dpif *dpif_, uint16_t in_port,
-                   const union odp_action actions[], int n_actions,
+xfif_linux_execute(struct xfif *xfif_, uint16_t in_port,
+                   const union xflow_action actions[], int n_actions,
                    const struct ofpbuf *buf)
 {
-    struct odp_execute execute;
+    struct xflow_execute execute;
     memset(&execute, 0, sizeof execute);
     execute.in_port = in_port;
-    execute.actions = (union odp_action *) actions;
+    execute.actions = (union xflow_action *) actions;
     execute.n_actions = n_actions;
     execute.data = buf->data;
     execute.length = buf->size;
-    return do_ioctl(dpif_, ODP_EXECUTE, &execute);
+    return do_ioctl(xfif_, XFLOW_EXECUTE, &execute);
 }
 
 static int
-dpif_linux_recv_get_mask(const struct dpif *dpif_, int *listen_mask)
+xfif_linux_recv_get_mask(const struct xfif *xfif_, int *listen_mask)
 {
-    return do_ioctl(dpif_, ODP_GET_LISTEN_MASK, listen_mask);
+    return do_ioctl(xfif_, XFLOW_GET_LISTEN_MASK, listen_mask);
 }
 
 static int
-dpif_linux_recv_set_mask(struct dpif *dpif_, int listen_mask)
+xfif_linux_recv_set_mask(struct xfif *xfif_, int listen_mask)
 {
-    return do_ioctl(dpif_, ODP_SET_LISTEN_MASK, &listen_mask);
+    return do_ioctl(xfif_, XFLOW_SET_LISTEN_MASK, &listen_mask);
 }
 
 static int
-dpif_linux_get_sflow_probability(const struct dpif *dpif_,
+xfif_linux_get_sflow_probability(const struct xfif *xfif_,
                                  uint32_t *probability)
 {
-    return do_ioctl(dpif_, ODP_GET_SFLOW_PROBABILITY, probability);
+    return do_ioctl(xfif_, XFLOW_GET_SFLOW_PROBABILITY, probability);
 }
 
 static int
-dpif_linux_set_sflow_probability(struct dpif *dpif_, uint32_t probability)
+xfif_linux_set_sflow_probability(struct xfif *xfif_, uint32_t probability)
 {
-    return do_ioctl(dpif_, ODP_SET_SFLOW_PROBABILITY, &probability);
+    return do_ioctl(xfif_, XFLOW_SET_SFLOW_PROBABILITY, &probability);
 }
 
 static int
-dpif_linux_recv(struct dpif *dpif_, struct ofpbuf **bufp)
+xfif_linux_recv(struct xfif *xfif_, struct ofpbuf **bufp)
 {
-    struct dpif_linux *dpif = dpif_linux_cast(dpif_);
+    struct xfif_linux *xfif = xfif_linux_cast(xfif_);
     struct ofpbuf *buf;
     int retval;
     int error;
 
     buf = ofpbuf_new(65536);
-    retval = read(dpif->fd, ofpbuf_tail(buf), ofpbuf_tailroom(buf));
+    retval = read(xfif->fd, ofpbuf_tail(buf), ofpbuf_tailroom(buf));
     if (retval < 0) {
         error = errno;
         if (error != EAGAIN) {
             VLOG_WARN_RL(&error_rl, "%s: read failed: %s",
-                         dpif_name(dpif_), strerror(error));
+                         xfif_name(xfif_), strerror(error));
         }
-    } else if (retval >= sizeof(struct odp_msg)) {
-        struct odp_msg *msg = buf->data;
+    } else if (retval >= sizeof(struct xflow_msg)) {
+        struct xflow_msg *msg = buf->data;
         if (msg->length <= retval) {
             buf->size += retval;
             *bufp = buf;
@@ -434,16 +434,16 @@ dpif_linux_recv(struct dpif *dpif_, struct ofpbuf **bufp)
         } else {
             VLOG_WARN_RL(&error_rl, "%s: discarding message truncated "
                          "from %"PRIu32" bytes to %d",
-                         dpif_name(dpif_), msg->length, retval);
+                         xfif_name(xfif_), msg->length, retval);
             error = ERANGE;
         }
     } else if (!retval) {
-        VLOG_WARN_RL(&error_rl, "%s: unexpected end of file", dpif_name(dpif_));
+        VLOG_WARN_RL(&error_rl, "%s: unexpected end of file", xfif_name(xfif_));
         error = EPROTO;
     } else {
         VLOG_WARN_RL(&error_rl,
                      "%s: discarding too-short message (%d bytes)",
-                     dpif_name(dpif_), retval);
+                     xfif_name(xfif_), retval);
         error = ERANGE;
     }
 
@@ -453,55 +453,55 @@ dpif_linux_recv(struct dpif *dpif_, struct ofpbuf **bufp)
 }
 
 static void
-dpif_linux_recv_wait(struct dpif *dpif_)
+xfif_linux_recv_wait(struct xfif *xfif_)
 {
-    struct dpif_linux *dpif = dpif_linux_cast(dpif_);
-    poll_fd_wait(dpif->fd, POLLIN);
+    struct xfif_linux *xfif = xfif_linux_cast(xfif_);
+    poll_fd_wait(xfif->fd, POLLIN);
 }
 
-const struct dpif_class dpif_linux_class = {
+const struct xfif_class xfif_linux_class = {
     "system",
     NULL,
     NULL,
-    dpif_linux_enumerate,
-    dpif_linux_open,
-    dpif_linux_close,
-    dpif_linux_get_all_names,
-    dpif_linux_destroy,
-    dpif_linux_get_stats,
-    dpif_linux_get_drop_frags,
-    dpif_linux_set_drop_frags,
-    dpif_linux_port_add,
-    dpif_linux_port_del,
-    dpif_linux_port_query_by_number,
-    dpif_linux_port_query_by_name,
-    dpif_linux_port_list,
-    dpif_linux_port_poll,
-    dpif_linux_port_poll_wait,
-    dpif_linux_port_group_get,
-    dpif_linux_port_group_set,
-    dpif_linux_flow_get,
-    dpif_linux_flow_put,
-    dpif_linux_flow_del,
-    dpif_linux_flow_flush,
-    dpif_linux_flow_list,
-    dpif_linux_execute,
-    dpif_linux_recv_get_mask,
-    dpif_linux_recv_set_mask,
-    dpif_linux_get_sflow_probability,
-    dpif_linux_set_sflow_probability,
-    dpif_linux_recv,
-    dpif_linux_recv_wait,
+    xfif_linux_enumerate,
+    xfif_linux_open,
+    xfif_linux_close,
+    xfif_linux_get_all_names,
+    xfif_linux_destroy,
+    xfif_linux_get_stats,
+    xfif_linux_get_drop_frags,
+    xfif_linux_set_drop_frags,
+    xfif_linux_port_add,
+    xfif_linux_port_del,
+    xfif_linux_port_query_by_number,
+    xfif_linux_port_query_by_name,
+    xfif_linux_port_list,
+    xfif_linux_port_poll,
+    xfif_linux_port_poll_wait,
+    xfif_linux_port_group_get,
+    xfif_linux_port_group_set,
+    xfif_linux_flow_get,
+    xfif_linux_flow_put,
+    xfif_linux_flow_del,
+    xfif_linux_flow_flush,
+    xfif_linux_flow_list,
+    xfif_linux_execute,
+    xfif_linux_recv_get_mask,
+    xfif_linux_recv_set_mask,
+    xfif_linux_get_sflow_probability,
+    xfif_linux_set_sflow_probability,
+    xfif_linux_recv,
+    xfif_linux_recv_wait,
 };
 \f
 static int get_openvswitch_major(void);
 static int get_major(const char *target);
 
 static int
-do_ioctl(const struct dpif *dpif_, int cmd, const void *arg)
+do_ioctl(const struct xfif *xfif_, int cmd, const void *arg)
 {
-    struct dpif_linux *dpif = dpif_linux_cast(dpif_);
-    return ioctl(dpif->fd, cmd, arg) ? errno : 0;
+    struct xfif_linux *xfif = xfif_linux_cast(xfif_);
+    return ioctl(xfif->fd, cmd, arg) ? errno : 0;
 }
 
 static int
@@ -542,7 +542,7 @@ lookup_minor(const char *name, int *minorp)
         VLOG_WARN("%s ethtool bus_info has unexpected format", name);
         error = EPROTOTYPE;
         goto error_close_sock;
-    } else if (port_no != ODPP_LOCAL) {
+    } else if (port_no != XFLOWP_LOCAL) {
         /* This is an Open vSwitch device but not the local port.  We
          * intentionally support only using the name of the local port as the
          * name of a datapath; otherwise, it would be too difficult to
@@ -684,14 +684,14 @@ get_major(const char *target)
 }
 
 static int
-finish_open(struct dpif *dpif_, const char *local_ifname)
+finish_open(struct xfif *xfif_, const char *local_ifname)
 {
-    struct dpif_linux *dpif = dpif_linux_cast(dpif_);
-    dpif->local_ifname = xstrdup(local_ifname);
-    dpif->local_ifindex = if_nametoindex(local_ifname);
-    if (!dpif->local_ifindex) {
+    struct xfif_linux *xfif = xfif_linux_cast(xfif_);
+    xfif->local_ifname = xstrdup(local_ifname);
+    xfif->local_ifindex = if_nametoindex(local_ifname);
+    if (!xfif->local_ifindex) {
         int error = errno;
-        dpif_uninit(dpif_, true);
+        xfif_uninit(xfif_, true);
         VLOG_WARN("could not get ifindex of %s device: %s",
                   local_ifname, strerror(errno));
         return error;
@@ -700,22 +700,22 @@ finish_open(struct dpif *dpif_, const char *local_ifname)
 }
 
 static int
-create_minor(const char *name, int minor, struct dpif **dpifp)
+create_minor(const char *name, int minor, struct xfif **xfifp)
 {
-    int error = open_minor(minor, dpifp);
+    int error = open_minor(minor, xfifp);
     if (!error) {
-        error = do_ioctl(*dpifp, ODP_DP_CREATE, name);
+        error = do_ioctl(*xfifp, XFLOW_DP_CREATE, name);
         if (!error) {
-            error = finish_open(*dpifp, name);
+            error = finish_open(*xfifp, name);
         } else {
-            dpif_uninit(*dpifp, true);
+            xfif_uninit(*xfifp, true);
         }
     }
     return error;
 }
 
 static int
-open_minor(int minor, struct dpif **dpifp)
+open_minor(int minor, struct xfif **xfifp)
 {
     int error;
     char *fn;
@@ -728,25 +728,25 @@ open_minor(int minor, struct dpif **dpifp)
 
     fd = open(fn, O_RDONLY | O_NONBLOCK);
     if (fd >= 0) {
-        struct dpif_linux *dpif = xmalloc(sizeof *dpif);
-        error = rtnetlink_notifier_register(&dpif->port_notifier,
-                                           dpif_linux_port_changed, dpif);
+        struct xfif_linux *xfif = xmalloc(sizeof *xfif);
+        error = rtnetlink_notifier_register(&xfif->port_notifier,
+                                           xfif_linux_port_changed, xfif);
         if (!error) {
             char *name;
 
             name = xasprintf("dp%d", minor);
-            dpif_init(&dpif->dpif, &dpif_linux_class, name, minor, minor);
+            xfif_init(&xfif->xfif, &xfif_linux_class, name, minor, minor);
             free(name);
 
-            dpif->fd = fd;
-            dpif->local_ifname = NULL;
-            dpif->minor = minor;
-            dpif->local_ifindex = 0;
-            svec_init(&dpif->changed_ports);
-            dpif->change_error = false;
-            *dpifp = &dpif->dpif;
+            xfif->fd = fd;
+            xfif->local_ifname = NULL;
+            xfif->minor = minor;
+            xfif->local_ifindex = 0;
+            svec_init(&xfif->changed_ports);
+            xfif->change_error = false;
+            *xfifp = &xfif->xfif;
         } else {
-            free(dpif);
+            free(xfif);
         }
     } else {
         error = errno;
@@ -758,23 +758,23 @@ open_minor(int minor, struct dpif **dpifp)
 }
 
 static void
-dpif_linux_port_changed(const struct rtnetlink_change *change, void *dpif_)
+xfif_linux_port_changed(const struct rtnetlink_change *change, void *xfif_)
 {
-    struct dpif_linux *dpif = dpif_;
+    struct xfif_linux *xfif = xfif_;
 
     if (change) {
-        if (change->master_ifindex == dpif->local_ifindex
+        if (change->master_ifindex == xfif->local_ifindex
             && (change->nlmsg_type == RTM_NEWLINK
                 || change->nlmsg_type == RTM_DELLINK))
         {
             /* Our datapath changed, either adding a new port or deleting an
              * existing one. */
-            if (!svec_contains(&dpif->changed_ports, change->ifname)) {
-                svec_add(&dpif->changed_ports, change->ifname);
-                svec_sort(&dpif->changed_ports);
+            if (!svec_contains(&xfif->changed_ports, change->ifname)) {
+                svec_add(&xfif->changed_ports, change->ifname);
+                svec_sort(&xfif->changed_ports);
             }
         }
     } else {
-        dpif->change_error = true;
+        xfif->change_error = true;
     }
 }
diff --git a/lib/xfif-netdev.c b/lib/xfif-netdev.c
new file mode 100644 (file)
index 0000000..475e7f5
--- /dev/null
@@ -0,0 +1,1380 @@
+/*
+ * Copyright (c) 2009, 2010 Nicira Networks.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <config.h>
+#include "xfif.h"
+
+#include <assert.h>
+#include <ctype.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <inttypes.h>
+#include <netinet/in.h>
+#include <net/if.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/ioctl.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#include "csum.h"
+#include "flow.h"
+#include "hmap.h"
+#include "list.h"
+#include "netdev.h"
+#include "xflow-util.h"
+#include "ofp-print.h"
+#include "ofpbuf.h"
+#include "packets.h"
+#include "poll-loop.h"
+#include "queue.h"
+#include "timeval.h"
+#include "util.h"
+#include "xfif-provider.h"
+
+#include "vlog.h"
+#define THIS_MODULE VLM_xfif_netdev
+
+/* Configuration parameters. */
+enum { N_QUEUES = 2 };          /* Number of queues for xfif_recv(). */
+enum { MAX_QUEUE_LEN = 100 };   /* Maximum number of packets per queue. */
+enum { N_GROUPS = 16 };         /* Number of port groups. */
+enum { MAX_PORTS = 256 };       /* Maximum number of ports. */
+enum { MAX_FLOWS = 65536 };     /* Maximum number of flows in flow table. */
+
+/* Enough headroom to add a vlan tag, plus an extra 2 bytes to allow IP
+ * headers to be aligned on a 4-byte boundary.  */
+enum { XF_NETDEV_HEADROOM = 2 + VLAN_HEADER_LEN };
+
+/* Datapath based on the network device interface from netdev.h. */
+struct xf_netdev {
+    struct list node;
+    int xf_idx;
+    int open_cnt;
+    bool destroyed;
+
+    bool drop_frags;            /* Drop all IP fragments, if true. */
+    struct ovs_queue queues[N_QUEUES]; /* Messages queued for xfif_recv(). */
+    struct hmap flow_table;     /* Flow table. */
+    struct xflow_port_group groups[N_GROUPS];
+
+    /* Statistics. */
+    long long int n_frags;      /* Number of dropped IP fragments. */
+    long long int n_hit;        /* Number of flow table matches. */
+    long long int n_missed;     /* Number of flow table misses. */
+    long long int n_lost;       /* Number of misses not passed to client. */
+
+    /* Ports. */
+    int n_ports;
+    struct xf_netdev_port *ports[MAX_PORTS];
+    struct list port_list;
+    unsigned int serial;
+};
+
+/* A port in a netdev-based datapath. */
+struct xf_netdev_port {
+    int port_no;                /* Index into xf_netdev's 'ports'. */
+    struct list node;           /* Element in xf_netdev's 'port_list'. */
+    struct netdev *netdev;
+    bool internal;              /* Internal port (as XFLOW_PORT_INTERNAL)? */
+};
+
+/* A flow in xf_netdev's 'flow_table'. */
+struct xf_netdev_flow {
+    struct hmap_node node;      /* Element in xf_netdev's 'flow_table'. */
+    struct xflow_key key;
+
+    /* Statistics. */
+    struct timeval used;        /* Last used time, in milliseconds. */
+    long long int packet_count; /* Number of packets matched. */
+    long long int byte_count;   /* Number of bytes matched. */
+    uint8_t ip_tos;             /* IP TOS value. */
+    uint16_t tcp_ctl;           /* Bitwise-OR of seen tcp_ctl values. */
+
+    /* Actions. */
+    union xflow_action *actions;
+    unsigned int n_actions;
+};
+
+/* Interface to netdev-based datapath. */
+struct xfif_netdev {
+    struct xfif xfif;
+    struct xf_netdev *xf;
+    int listen_mask;
+    unsigned int xf_serial;
+};
+
+/* All netdev-based datapaths. */
+static struct xf_netdev *xf_netdevs[256];
+struct list xf_netdev_list = LIST_INITIALIZER(&xf_netdev_list);
+enum { N_XF_NETDEVS = ARRAY_SIZE(xf_netdevs) };
+
+/* Maximum port MTU seen so far. */
+static int max_mtu = ETH_PAYLOAD_MAX;
+
+static int get_port_by_number(struct xf_netdev *, uint16_t port_no,
+                              struct xf_netdev_port **portp);
+static int get_port_by_name(struct xf_netdev *, const char *devname,
+                            struct xf_netdev_port **portp);
+static void xf_netdev_free(struct xf_netdev *);
+static void xf_netdev_flow_flush(struct xf_netdev *);
+static int do_add_port(struct xf_netdev *, const char *devname, uint16_t flags,
+                       uint16_t port_no);
+static int do_del_port(struct xf_netdev *, uint16_t port_no);
+static int xf_netdev_output_control(struct xf_netdev *, const struct ofpbuf *,
+                                    int queue_no, int port_no, uint32_t arg);
+static int xf_netdev_execute_actions(struct xf_netdev *,
+                                     struct ofpbuf *, struct xflow_key *,
+                                     const union xflow_action *, int n);
+
+static struct xfif_netdev *
+xfif_netdev_cast(const struct xfif *xfif)
+{
+    xfif_assert_class(xfif, &xfif_netdev_class);
+    return CONTAINER_OF(xfif, struct xfif_netdev, xfif);
+}
+
+static struct xf_netdev *
+get_xf_netdev(const struct xfif *xfif)
+{
+    return xfif_netdev_cast(xfif)->xf;
+}
+
+static int
+name_to_xf_idx(const char *name)
+{
+    if (!strncmp(name, "xf", 2) && isdigit((unsigned char)name[2])) {
+        int xf_idx = atoi(name + 2);
+        if (xf_idx >= 0 && xf_idx < N_XF_NETDEVS) {
+            return xf_idx;
+        }
+    }
+    return -1;
+}
+
+static struct xf_netdev *
+find_xf_netdev(const char *name)
+{
+    int xf_idx;
+    size_t i;
+
+    xf_idx = name_to_xf_idx(name);
+    if (xf_idx >= 0) {
+        return xf_netdevs[xf_idx];
+    }
+
+    for (i = 0; i < N_XF_NETDEVS; i++) {
+        struct xf_netdev *xf = xf_netdevs[i];
+        if (xf) {
+            struct xf_netdev_port *port;
+            if (!get_port_by_name(xf, name, &port)) {
+                return xf;
+            }
+        }
+    }
+    return NULL;
+}
+
+static struct xfif *
+create_xfif_netdev(struct xf_netdev *xf)
+{
+    struct xfif_netdev *xfif;
+    char *xfname;
+
+    xf->open_cnt++;
+
+    xfname = xasprintf("xf%d", xf->xf_idx);
+    xfif = xmalloc(sizeof *xfif);
+    xfif_init(&xfif->xfif, &xfif_netdev_class, xfname, xf->xf_idx, xf->xf_idx);
+    xfif->xf = xf;
+    xfif->listen_mask = 0;
+    xfif->xf_serial = xf->serial;
+    free(xfname);
+
+    return &xfif->xfif;
+}
+
+static int
+create_xf_netdev(const char *name, int xf_idx, struct xfif **xfifp)
+{
+    struct xf_netdev *xf;
+    int error;
+    int i;
+
+    if (xf_netdevs[xf_idx]) {
+        return EBUSY;
+    }
+
+    /* Create datapath. */
+    xf_netdevs[xf_idx] = xf = xzalloc(sizeof *xf);
+    list_push_back(&xf_netdev_list, &xf->node);
+    xf->xf_idx = xf_idx;
+    xf->open_cnt = 0;
+    xf->drop_frags = false;
+    for (i = 0; i < N_QUEUES; i++) {
+        queue_init(&xf->queues[i]);
+    }
+    hmap_init(&xf->flow_table);
+    for (i = 0; i < N_GROUPS; i++) {
+        xf->groups[i].ports = NULL;
+        xf->groups[i].n_ports = 0;
+        xf->groups[i].group = i;
+    }
+    list_init(&xf->port_list);
+    error = do_add_port(xf, name, XFLOW_PORT_INTERNAL, XFLOWP_LOCAL);
+    if (error) {
+        xf_netdev_free(xf);
+        return ENODEV;
+    }
+
+    *xfifp = create_xfif_netdev(xf);
+    return 0;
+}
+
+static int
+xfif_netdev_open(const char *name, const char *type OVS_UNUSED, bool create,
+                 struct xfif **xfifp)
+{
+    if (create) {
+        if (find_xf_netdev(name)) {
+            return EEXIST;
+        } else {
+            int xf_idx = name_to_xf_idx(name);
+            if (xf_idx >= 0) {
+                return create_xf_netdev(name, xf_idx, xfifp);
+            } else {
+                /* Scan for unused xf_idx number. */
+                for (xf_idx = 0; xf_idx < N_XF_NETDEVS; xf_idx++) {
+                    int error = create_xf_netdev(name, xf_idx, xfifp);
+                    if (error != EBUSY) {
+                        return error;
+                    }
+                }
+
+                /* All datapath numbers in use. */
+                return ENOBUFS;
+            }
+        }
+    } else {
+        struct xf_netdev *xf = find_xf_netdev(name);
+        if (xf) {
+            *xfifp = create_xfif_netdev(xf);
+            return 0;
+        } else {
+            return ENODEV;
+        }
+    }
+}
+
+static void
+xf_netdev_free(struct xf_netdev *xf)
+{
+    int i;
+
+    xf_netdev_flow_flush(xf);
+    while (xf->n_ports > 0) {
+        struct xf_netdev_port *port = CONTAINER_OF(
+            xf->port_list.next, struct xf_netdev_port, node);
+        do_del_port(xf, port->port_no);
+    }
+    for (i = 0; i < N_QUEUES; i++) {
+        queue_destroy(&xf->queues[i]);
+    }
+    hmap_destroy(&xf->flow_table);
+    for (i = 0; i < N_GROUPS; i++) {
+        free(xf->groups[i].ports);
+    }
+    xf_netdevs[xf->xf_idx] = NULL;
+    list_remove(&xf->node);
+    free(xf);
+}
+
+static void
+xfif_netdev_close(struct xfif *xfif)
+{
+    struct xf_netdev *xf = get_xf_netdev(xfif);
+    assert(xf->open_cnt > 0);
+    if (--xf->open_cnt == 0 && xf->destroyed) {
+        xf_netdev_free(xf);
+    }
+    free(xfif);
+}
+
+static int
+xfif_netdev_destroy(struct xfif *xfif)
+{
+    struct xf_netdev *xf = get_xf_netdev(xfif);
+    xf->destroyed = true;
+    return 0;
+}
+
+static int
+xfif_netdev_get_stats(const struct xfif *xfif, struct xflow_stats *stats)
+{
+    struct xf_netdev *xf = get_xf_netdev(xfif);
+    memset(stats, 0, sizeof *stats);
+    stats->n_flows = hmap_count(&xf->flow_table);
+    stats->cur_capacity = hmap_capacity(&xf->flow_table);
+    stats->max_capacity = MAX_FLOWS;
+    stats->n_ports = xf->n_ports;
+    stats->max_ports = MAX_PORTS;
+    stats->max_groups = N_GROUPS;
+    stats->n_frags = xf->n_frags;
+    stats->n_hit = xf->n_hit;
+    stats->n_missed = xf->n_missed;
+    stats->n_lost = xf->n_lost;
+    stats->max_miss_queue = MAX_QUEUE_LEN;
+    stats->max_action_queue = MAX_QUEUE_LEN;
+    return 0;
+}
+
+static int
+xfif_netdev_get_drop_frags(const struct xfif *xfif, bool *drop_fragsp)
+{
+    struct xf_netdev *xf = get_xf_netdev(xfif);
+    *drop_fragsp = xf->drop_frags;
+    return 0;
+}
+
+static int
+xfif_netdev_set_drop_frags(struct xfif *xfif, bool drop_frags)
+{
+    struct xf_netdev *xf = get_xf_netdev(xfif);
+    xf->drop_frags = drop_frags;
+    return 0;
+}
+
+static int
+do_add_port(struct xf_netdev *xf, const char *devname, uint16_t flags,
+            uint16_t port_no)
+{
+    bool internal = (flags & XFLOW_PORT_INTERNAL) != 0;
+    struct xf_netdev_port *port;
+    struct netdev_options netdev_options;
+    struct netdev *netdev;
+    int mtu;
+    int error;
+
+    /* XXX reject devices already in some xf_netdev. */
+
+    /* Open and validate network device. */
+    memset(&netdev_options, 0, sizeof netdev_options);
+    netdev_options.name = devname;
+    netdev_options.ethertype = NETDEV_ETH_TYPE_ANY;
+    netdev_options.may_create = true;
+    if (internal) {
+        netdev_options.type = "tap";
+    } else {
+        netdev_options.may_open = true;
+    }
+
+    error = netdev_open(&netdev_options, &netdev);
+    if (error) {
+        return error;
+    }
+    /* XXX reject loopback devices */
+    /* XXX reject non-Ethernet devices */
+
+    error = netdev_turn_flags_on(netdev, NETDEV_PROMISC, false);
+    if (error) {
+        netdev_close(netdev);
+        return error;
+    }
+
+    port = xmalloc(sizeof *port);
+    port->port_no = port_no;
+    port->netdev = netdev;
+    port->internal = internal;
+
+    netdev_get_mtu(netdev, &mtu);
+    if (mtu > max_mtu) {
+        max_mtu = mtu;
+    }
+
+    list_push_back(&xf->port_list, &port->node);
+    xf->ports[port_no] = port;
+    xf->n_ports++;
+    xf->serial++;
+
+    return 0;
+}
+
+static int
+xfif_netdev_port_add(struct xfif *xfif, const char *devname, uint16_t flags,
+                     uint16_t *port_nop)
+{
+    struct xf_netdev *xf = get_xf_netdev(xfif);
+    int port_no;
+
+    for (port_no = 0; port_no < MAX_PORTS; port_no++) {
+        if (!xf->ports[port_no]) {
+            *port_nop = port_no;
+            return do_add_port(xf, devname, flags, port_no);
+        }
+    }
+    return EFBIG;
+}
+
+static int
+xfif_netdev_port_del(struct xfif *xfif, uint16_t port_no)
+{
+    struct xf_netdev *xf = get_xf_netdev(xfif);
+    return port_no == XFLOWP_LOCAL ? EINVAL : do_del_port(xf, port_no);
+}
+
+static bool
+is_valid_port_number(uint16_t port_no)
+{
+    return port_no < MAX_PORTS;
+}
+
+static int
+get_port_by_number(struct xf_netdev *xf,
+                   uint16_t port_no, struct xf_netdev_port **portp)
+{
+    if (!is_valid_port_number(port_no)) {
+        *portp = NULL;
+        return EINVAL;
+    } else {
+        *portp = xf->ports[port_no];
+        return *portp ? 0 : ENOENT;
+    }
+}
+
+static int
+get_port_by_name(struct xf_netdev *xf,
+                 const char *devname, struct xf_netdev_port **portp)
+{
+    struct xf_netdev_port *port;
+
+    LIST_FOR_EACH (port, struct xf_netdev_port, node, &xf->port_list) {
+        if (!strcmp(netdev_get_name(port->netdev), devname)) {
+            *portp = port;
+            return 0;
+        }
+    }
+    return ENOENT;
+}
+
+static int
+do_del_port(struct xf_netdev *xf, uint16_t port_no)
+{
+    struct xf_netdev_port *port;
+    char *name;
+    int error;
+
+    error = get_port_by_number(xf, port_no, &port);
+    if (error) {
+        return error;
+    }
+
+    list_remove(&port->node);
+    xf->ports[port->port_no] = NULL;
+    xf->n_ports--;
+    xf->serial++;
+
+    name = xstrdup(netdev_get_name(port->netdev));
+    netdev_close(port->netdev);
+
+    free(name);
+    free(port);
+
+    return 0;
+}
+
+static void
+answer_port_query(const struct xf_netdev_port *port, struct xflow_port *xflow_port)
+{
+    memset(xflow_port, 0, sizeof *xflow_port);
+    ovs_strlcpy(xflow_port->devname, netdev_get_name(port->netdev),
+                sizeof xflow_port->devname);
+    xflow_port->port = port->port_no;
+    xflow_port->flags = port->internal ? XFLOW_PORT_INTERNAL : 0;
+}
+
+static int
+xfif_netdev_port_query_by_number(const struct xfif *xfif, uint16_t port_no,
+                                 struct xflow_port *xflow_port)
+{
+    struct xf_netdev *xf = get_xf_netdev(xfif);
+    struct xf_netdev_port *port;
+    int error;
+
+    error = get_port_by_number(xf, port_no, &port);
+    if (!error) {
+        answer_port_query(port, xflow_port);
+    }
+    return error;
+}
+
+static int
+xfif_netdev_port_query_by_name(const struct xfif *xfif, const char *devname,
+                               struct xflow_port *xflow_port)
+{
+    struct xf_netdev *xf = get_xf_netdev(xfif);
+    struct xf_netdev_port *port;
+    int error;
+
+    error = get_port_by_name(xf, devname, &port);
+    if (!error) {
+        answer_port_query(port, xflow_port);
+    }
+    return error;
+}
+
+static void
+xf_netdev_free_flow(struct xf_netdev *xf, struct xf_netdev_flow *flow)
+{
+    hmap_remove(&xf->flow_table, &flow->node);
+    free(flow->actions);
+    free(flow);
+}
+
+static void
+xf_netdev_flow_flush(struct xf_netdev *xf)
+{
+    struct xf_netdev_flow *flow, *next;
+
+    HMAP_FOR_EACH_SAFE (flow, next, struct xf_netdev_flow, node,
+                        &xf->flow_table) {
+        xf_netdev_free_flow(xf, flow);
+    }
+}
+
+static int
+xfif_netdev_flow_flush(struct xfif *xfif)
+{
+    struct xf_netdev *xf = get_xf_netdev(xfif);
+    xf_netdev_flow_flush(xf);
+    return 0;
+}
+
+static int
+xfif_netdev_port_list(const struct xfif *xfif, struct xflow_port *ports, int n)
+{
+    struct xf_netdev *xf = get_xf_netdev(xfif);
+    struct xf_netdev_port *port;
+    int i;
+
+    i = 0;
+    LIST_FOR_EACH (port, struct xf_netdev_port, node, &xf->port_list) {
+        struct xflow_port *xflow_port = &ports[i];
+        if (i >= n) {
+            break;
+        }
+        answer_port_query(port, xflow_port);
+        i++;
+    }
+    return xf->n_ports;
+}
+
+static int
+xfif_netdev_port_poll(const struct xfif *xfif_, char **devnamep OVS_UNUSED)
+{
+    struct xfif_netdev *xfif = xfif_netdev_cast(xfif_);
+    if (xfif->xf_serial != xfif->xf->serial) {
+        xfif->xf_serial = xfif->xf->serial;
+        return ENOBUFS;
+    } else {
+        return EAGAIN;
+    }
+}
+
+static void
+xfif_netdev_port_poll_wait(const struct xfif *xfif_)
+{
+    struct xfif_netdev *xfif = xfif_netdev_cast(xfif_);
+    if (xfif->xf_serial != xfif->xf->serial) {
+        poll_immediate_wake();
+    }
+}
+
+static int
+get_port_group(const struct xfif *xfif, int group_no,
+               struct xflow_port_group **groupp)
+{
+    struct xf_netdev *xf = get_xf_netdev(xfif);
+
+    if (group_no >= 0 && group_no < N_GROUPS) {
+        *groupp = &xf->groups[group_no];
+        return 0;
+    } else {
+        *groupp = NULL;
+        return EINVAL;
+    }
+}
+
+static int
+xfif_netdev_port_group_get(const struct xfif *xfif, int group_no,
+                           uint16_t ports[], int n)
+{
+    struct xflow_port_group *group;
+    int error;
+
+    if (n < 0) {
+        return -EINVAL;
+    }
+
+    error = get_port_group(xfif, group_no, &group);
+    if (!error) {
+        memcpy(ports, group->ports, MIN(n, group->n_ports) * sizeof *ports);
+        return group->n_ports;
+    } else {
+        return -error;
+    }
+}
+
+static int
+xfif_netdev_port_group_set(struct xfif *xfif, int group_no,
+                           const uint16_t ports[], int n)
+{
+    struct xflow_port_group *group;
+    int error;
+
+    if (n < 0 || n > MAX_PORTS) {
+        return EINVAL;
+    }
+
+    error = get_port_group(xfif, group_no, &group);
+    if (!error) {
+        free(group->ports);
+        group->ports = xmemdup(ports, n * sizeof *group->ports);
+        group->n_ports = n;
+        group->group = group_no;
+    }
+    return error;
+}
+
+static struct xf_netdev_flow *
+xf_netdev_lookup_flow(const struct xf_netdev *xf,
+                      const struct xflow_key *key)
+{
+    struct xf_netdev_flow *flow;
+
+    HMAP_FOR_EACH_WITH_HASH (flow, struct xf_netdev_flow, node,
+                             xflow_key_hash(key, 0), &xf->flow_table) {
+        if (xflow_key_equal(&flow->key, key)) {
+            return flow;
+        }
+    }
+    return NULL;
+}
+
+static void
+answer_flow_query(struct xf_netdev_flow *flow, uint32_t query_flags,
+                  struct xflow_flow *xflow_flow)
+{
+    if (flow) {
+        xflow_flow->key = flow->key;
+        xflow_flow->stats.n_packets = flow->packet_count;
+        xflow_flow->stats.n_bytes = flow->byte_count;
+        xflow_flow->stats.used_sec = flow->used.tv_sec;
+        xflow_flow->stats.used_nsec = flow->used.tv_usec * 1000;
+        xflow_flow->stats.tcp_flags = TCP_FLAGS(flow->tcp_ctl);
+        xflow_flow->stats.ip_tos = flow->ip_tos;
+        xflow_flow->stats.error = 0;
+        if (xflow_flow->n_actions > 0) {
+            unsigned int n = MIN(xflow_flow->n_actions, flow->n_actions);
+            memcpy(xflow_flow->actions, flow->actions,
+                   n * sizeof *xflow_flow->actions);
+            xflow_flow->n_actions = flow->n_actions;
+        }
+
+        if (query_flags & XFLOWFF_ZERO_TCP_FLAGS) {
+            flow->tcp_ctl = 0;
+        }
+
+    } else {
+        xflow_flow->stats.error = ENOENT;
+    }
+}
+
+static int
+xfif_netdev_flow_get(const struct xfif *xfif, struct xflow_flow flows[], int n)
+{
+    struct xf_netdev *xf = get_xf_netdev(xfif);
+    int i;
+
+    for (i = 0; i < n; i++) {
+        struct xflow_flow *xflow_flow = &flows[i];
+        answer_flow_query(xf_netdev_lookup_flow(xf, &xflow_flow->key),
+                          xflow_flow->flags, xflow_flow);
+    }
+    return 0;
+}
+
+static int
+xfif_netdev_validate_actions(const union xflow_action *actions, int n_actions,
+                             bool *mutates)
+{
+    unsigned int i;
+
+    *mutates = false;
+    for (i = 0; i < n_actions; i++) {
+        const union xflow_action *a = &actions[i];
+        switch (a->type) {
+        case XFLOWAT_OUTPUT:
+            if (a->output.port >= MAX_PORTS) {
+                return EINVAL;
+            }
+            break;
+
+        case XFLOWAT_OUTPUT_GROUP:
+            *mutates = true;
+            if (a->output_group.group >= N_GROUPS) {
+                return EINVAL;
+            }
+            break;
+
+        case XFLOWAT_CONTROLLER:
+            break;
+
+        case XFLOWAT_SET_DL_TCI:
+            *mutates = true;
+            if (a->dl_tci.mask != htons(VLAN_VID_MASK)
+                && a->dl_tci.mask != htons(VLAN_PCP_MASK)
+                && a->dl_tci.mask != htons(VLAN_VID_MASK | VLAN_PCP_MASK)) {
+                return EINVAL;
+            }
+            if (a->dl_tci.tci & ~a->dl_tci.mask){
+                return EINVAL;
+            }
+            break;
+
+        case XFLOWAT_SET_NW_TOS:
+            *mutates = true;
+            if (a->nw_tos.nw_tos & IP_ECN_MASK) {
+                return EINVAL;
+            }
+            break;
+
+        case XFLOWAT_STRIP_VLAN:
+        case XFLOWAT_SET_DL_SRC:
+        case XFLOWAT_SET_DL_DST:
+        case XFLOWAT_SET_NW_SRC:
+        case XFLOWAT_SET_NW_DST:
+        case XFLOWAT_SET_TP_SRC:
+        case XFLOWAT_SET_TP_DST:
+            *mutates = true;
+            break;
+
+        default:
+            return EOPNOTSUPP;
+        }
+    }
+    return 0;
+}
+
+static int
+set_flow_actions(struct xf_netdev_flow *flow, struct xflow_flow *xflow_flow)
+{
+    size_t n_bytes;
+    bool mutates;
+    int error;
+
+    if (xflow_flow->n_actions >= 4096 / sizeof *xflow_flow->actions) {
+        return EINVAL;
+    }
+    error = xfif_netdev_validate_actions(xflow_flow->actions,
+                                         xflow_flow->n_actions, &mutates);
+    if (error) {
+        return error;
+    }
+
+    n_bytes = xflow_flow->n_actions * sizeof *flow->actions;
+    flow->actions = xrealloc(flow->actions, n_bytes);
+    flow->n_actions = xflow_flow->n_actions;
+    memcpy(flow->actions, xflow_flow->actions, n_bytes);
+    return 0;
+}
+
+static int
+add_flow(struct xfif *xfif, struct xflow_flow *xflow_flow)
+{
+    struct xf_netdev *xf = get_xf_netdev(xfif);
+    struct xf_netdev_flow *flow;
+    int error;
+
+    flow = xzalloc(sizeof *flow);
+    flow->key = xflow_flow->key;
+
+    error = set_flow_actions(flow, xflow_flow);
+    if (error) {
+        free(flow);
+        return error;
+    }
+
+    hmap_insert(&xf->flow_table, &flow->node,
+                xflow_key_hash(&flow->key, 0));
+    return 0;
+}
+
+static void
+clear_stats(struct xf_netdev_flow *flow)
+{
+    flow->used.tv_sec = 0;
+    flow->used.tv_usec = 0;
+    flow->packet_count = 0;
+    flow->byte_count = 0;
+    flow->ip_tos = 0;
+    flow->tcp_ctl = 0;
+}
+
+static int
+xfif_netdev_flow_put(struct xfif *xfif, struct xflow_flow_put *put)
+{
+    struct xf_netdev *xf = get_xf_netdev(xfif);
+    struct xf_netdev_flow *flow;
+
+    flow = xf_netdev_lookup_flow(xf, &put->flow.key);
+    if (!flow) {
+        if (put->flags & XFLOWPF_CREATE) {
+            if (hmap_count(&xf->flow_table) < MAX_FLOWS) {
+                return add_flow(xfif, &put->flow);
+            } else {
+                return EFBIG;
+            }
+        } else {
+            return ENOENT;
+        }
+    } else {
+        if (put->flags & XFLOWPF_MODIFY) {
+            int error = set_flow_actions(flow, &put->flow);
+            if (!error && put->flags & XFLOWPF_ZERO_STATS) {
+                clear_stats(flow);
+            }
+            return error;
+        } else {
+            return EEXIST;
+        }
+    }
+}
+
+
+static int
+xfif_netdev_flow_del(struct xfif *xfif, struct xflow_flow *xflow_flow)
+{
+    struct xf_netdev *xf = get_xf_netdev(xfif);
+    struct xf_netdev_flow *flow;
+
+    flow = xf_netdev_lookup_flow(xf, &xflow_flow->key);
+    if (flow) {
+        answer_flow_query(flow, 0, xflow_flow);
+        xf_netdev_free_flow(xf, flow);
+        return 0;
+    } else {
+        return ENOENT;
+    }
+}
+
+static int
+xfif_netdev_flow_list(const struct xfif *xfif, struct xflow_flow flows[], int n)
+{
+    struct xf_netdev *xf = get_xf_netdev(xfif);
+    struct xf_netdev_flow *flow;
+    int i;
+
+    i = 0;
+    HMAP_FOR_EACH (flow, struct xf_netdev_flow, node, &xf->flow_table) {
+        if (i >= n) {
+            break;
+        }
+        answer_flow_query(flow, 0, &flows[i++]);
+    }
+    return hmap_count(&xf->flow_table);
+}
+
+static int
+xfif_netdev_execute(struct xfif *xfif, uint16_t in_port,
+                    const union xflow_action actions[], int n_actions,
+                    const struct ofpbuf *packet)
+{
+    struct xf_netdev *xf = get_xf_netdev(xfif);
+    struct ofpbuf copy;
+    bool mutates;
+    struct xflow_key key;
+    flow_t flow;
+    int error;
+
+    if (packet->size < ETH_HEADER_LEN || packet->size > UINT16_MAX) {
+        return EINVAL;
+    }
+
+    error = xfif_netdev_validate_actions(actions, n_actions, &mutates);
+    if (error) {
+        return error;
+    }
+
+    if (mutates) {
+        /* We need a deep copy of 'packet' since we're going to modify its
+         * data. */
+        ofpbuf_init(&copy, XF_NETDEV_HEADROOM + packet->size);
+        copy.data = (char*)copy.base + XF_NETDEV_HEADROOM;
+        ofpbuf_put(&copy, packet->data, packet->size);
+    } else {
+        /* We still need a shallow copy of 'packet', even though we won't
+         * modify its data, because flow_extract() modifies packet->l2, etc.
+         * We could probably get away with modifying those but it's more polite
+         * if we don't. */
+        copy = *packet;
+    }
+    flow_extract(&copy, in_port, &flow);
+    xflow_key_from_flow(&key, &flow);
+    error = xf_netdev_execute_actions(xf, &copy, &key, actions, n_actions);
+    if (mutates) {
+        ofpbuf_uninit(&copy);
+    }
+    return error;
+}
+
+static int
+xfif_netdev_recv_get_mask(const struct xfif *xfif, int *listen_mask)
+{
+    struct xfif_netdev *xfif_netdev = xfif_netdev_cast(xfif);
+    *listen_mask = xfif_netdev->listen_mask;
+    return 0;
+}
+
+static int
+xfif_netdev_recv_set_mask(struct xfif *xfif, int listen_mask)
+{
+    struct xfif_netdev *xfif_netdev = xfif_netdev_cast(xfif);
+    if (!(listen_mask & ~XFLOWL_ALL)) {
+        xfif_netdev->listen_mask = listen_mask;
+        return 0;
+    } else {
+        return EINVAL;
+    }
+}
+
+static struct ovs_queue *
+find_nonempty_queue(struct xfif *xfif)
+{
+    struct xfif_netdev *xfif_netdev = xfif_netdev_cast(xfif);
+    struct xf_netdev *xf = get_xf_netdev(xfif);
+    int mask = xfif_netdev->listen_mask;
+    int i;
+
+    for (i = 0; i < N_QUEUES; i++) {
+        struct ovs_queue *q = &xf->queues[i];
+        if (q->n && mask & (1u << i)) {
+            return q;
+        }
+    }
+    return NULL;
+}
+
+static int
+xfif_netdev_recv(struct xfif *xfif, struct ofpbuf **bufp)
+{
+    struct ovs_queue *q = find_nonempty_queue(xfif);
+    if (q) {
+        *bufp = queue_pop_head(q);
+        return 0;
+    } else {
+        return EAGAIN;
+    }
+}
+
+static void
+xfif_netdev_recv_wait(struct xfif *xfif)
+{
+    struct ovs_queue *q = find_nonempty_queue(xfif);
+    if (q) {
+        poll_immediate_wake();
+    } else {
+        /* No messages ready to be received, and xf_wait() will ensure that we
+         * wake up to queue new messages, so there is nothing to do. */
+    }
+}
+\f
+static void
+xf_netdev_flow_used(struct xf_netdev_flow *flow,
+                    const struct xflow_key *key,
+                    const struct ofpbuf *packet)
+{
+    time_timeval(&flow->used);
+    flow->packet_count++;
+    flow->byte_count += packet->size;
+    if (key->dl_type == htons(ETH_TYPE_IP)) {
+        struct ip_header *nh = packet->l3;
+        flow->ip_tos = nh->ip_tos;
+
+        if (key->nw_proto == IPPROTO_TCP) {
+            struct tcp_header *th = packet->l4;
+            flow->tcp_ctl |= th->tcp_ctl;
+        }
+    }
+}
+
+static void
+xf_netdev_port_input(struct xf_netdev *xf, struct xf_netdev_port *port,
+                     struct ofpbuf *packet)
+{
+    struct xf_netdev_flow *flow;
+    struct xflow_key key;
+    flow_t f;
+
+    if (flow_extract(packet, port->port_no, &f) && xf->drop_frags) {
+        xf->n_frags++;
+        return;
+    }
+    xflow_key_from_flow(&key, &f);
+
+    flow = xf_netdev_lookup_flow(xf, &key);
+    if (flow) {
+        xf_netdev_flow_used(flow, &key, packet);
+        xf_netdev_execute_actions(xf, packet, &key,
+                                  flow->actions, flow->n_actions);
+        xf->n_hit++;
+    } else {
+        xf->n_missed++;
+        xf_netdev_output_control(xf, packet, _XFLOWL_MISS_NR, port->port_no, 0);
+    }
+}
+
+static void
+xf_netdev_run(void)
+{
+    struct ofpbuf packet;
+    struct xf_netdev *xf;
+
+    ofpbuf_init(&packet, XF_NETDEV_HEADROOM + max_mtu);
+    LIST_FOR_EACH (xf, struct xf_netdev, node, &xf_netdev_list) {
+        struct xf_netdev_port *port;
+
+        LIST_FOR_EACH (port, struct xf_netdev_port, node, &xf->port_list) {
+            int error;
+
+            /* Reset packet contents. */
+            packet.data = (char*)packet.base + XF_NETDEV_HEADROOM;
+            packet.size = 0;
+
+            error = netdev_recv(port->netdev, &packet);
+            if (!error) {
+                xf_netdev_port_input(xf, port, &packet);
+            } else if (error != EAGAIN) {
+                struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);
+                VLOG_ERR_RL(&rl, "error receiving data from %s: %s",
+                            netdev_get_name(port->netdev), strerror(error));
+            }
+        }
+    }
+    ofpbuf_uninit(&packet);
+}
+
+static void
+xf_netdev_wait(void)
+{
+    struct xf_netdev *xf;
+
+    LIST_FOR_EACH (xf, struct xf_netdev, node, &xf_netdev_list) {
+        struct xf_netdev_port *port;
+        LIST_FOR_EACH (port, struct xf_netdev_port, node, &xf->port_list) {
+            netdev_recv_wait(port->netdev);
+        }
+    }
+}
+
+
+/* Modify or add a 802.1Q header in 'packet' according to 'a'. */
+static void
+xf_netdev_set_dl_tci(struct ofpbuf *packet, struct xflow_key *key,
+                     const struct xflow_action_dl_tci *a)
+{
+    struct vlan_eth_header *veh;
+
+    if (key->dl_tci) {
+        veh = packet->l2;
+        veh->veth_tci = (veh->veth_tci & ~a->mask) | a->tci;
+    } else {
+        /* Insert new 802.1Q header. */
+        struct eth_header *eh = packet->l2;
+        struct vlan_eth_header tmp;
+        memcpy(tmp.veth_dst, eh->eth_dst, ETH_ADDR_LEN);
+        memcpy(tmp.veth_src, eh->eth_src, ETH_ADDR_LEN);
+        tmp.veth_type = htons(ETH_TYPE_VLAN);
+        tmp.veth_tci = htons(a->tci);
+        tmp.veth_next_type = eh->eth_type;
+
+        veh = ofpbuf_push_uninit(packet, VLAN_HEADER_LEN);
+        memcpy(veh, &tmp, sizeof tmp);
+        packet->l2 = (char*)packet->l2 - VLAN_HEADER_LEN;
+    }
+
+    key->dl_tci = veh->veth_tci | htons(XFLOW_TCI_PRESENT);
+}
+
+static void
+xf_netdev_strip_vlan(struct ofpbuf *packet, struct xflow_key *key)
+{
+    struct vlan_eth_header *veh = packet->l2;
+    if (veh->veth_type == htons(ETH_TYPE_VLAN)) {
+        struct eth_header tmp;
+
+        memcpy(tmp.eth_dst, veh->veth_dst, ETH_ADDR_LEN);
+        memcpy(tmp.eth_src, veh->veth_src, ETH_ADDR_LEN);
+        tmp.eth_type = veh->veth_next_type;
+
+        packet->size -= VLAN_HEADER_LEN;
+        packet->data = (char*)packet->data + VLAN_HEADER_LEN;
+        packet->l2 = (char*)packet->l2 + VLAN_HEADER_LEN;
+        memcpy(packet->data, &tmp, sizeof tmp);
+
+        key->dl_tci = htons(0);
+    }
+}
+
+static void
+xf_netdev_set_dl_src(struct ofpbuf *packet, struct xflow_key *key,
+                     const uint8_t dl_addr[ETH_ADDR_LEN])
+{
+    struct eth_header *eh = packet->l2;
+    memcpy(eh->eth_src, dl_addr, sizeof eh->eth_src);
+    memcpy(key->dl_src, dl_addr, sizeof key->dl_src);
+}
+
+static void
+xf_netdev_set_dl_dst(struct ofpbuf *packet, struct xflow_key *key,
+                     const uint8_t dl_addr[ETH_ADDR_LEN])
+{
+    struct eth_header *eh = packet->l2;
+    memcpy(eh->eth_dst, dl_addr, sizeof eh->eth_dst);
+    memcpy(key->dl_dst, dl_addr, sizeof key->dl_dst);
+}
+
+static void
+xf_netdev_set_nw_addr(struct ofpbuf *packet, struct xflow_key *key,
+                      const struct xflow_action_nw_addr *a)
+{
+    if (key->dl_type == htons(ETH_TYPE_IP)) {
+        struct ip_header *nh = packet->l3;
+        uint32_t *field;
+
+        field = a->type == XFLOWAT_SET_NW_SRC ? &nh->ip_src : &nh->ip_dst;
+        if (key->nw_proto == IP_TYPE_TCP) {
+            struct tcp_header *th = packet->l4;
+            th->tcp_csum = recalc_csum32(th->tcp_csum, *field, a->nw_addr);
+        } else if (key->nw_proto == IP_TYPE_UDP) {
+            struct udp_header *uh = packet->l4;
+            if (uh->udp_csum) {
+                uh->udp_csum = recalc_csum32(uh->udp_csum, *field, a->nw_addr);
+                if (!uh->udp_csum) {
+                    uh->udp_csum = 0xffff;
+                }
+            }
+        }
+        nh->ip_csum = recalc_csum32(nh->ip_csum, *field, a->nw_addr);
+        *field = a->nw_addr;
+
+        if (a->type == XFLOWAT_SET_NW_SRC) {
+            key->nw_src = a->type;
+        } else {
+            key->nw_dst = a->type;
+        }
+    }
+}
+
+static void
+xf_netdev_set_nw_tos(struct ofpbuf *packet, struct xflow_key *key,
+                     const struct xflow_action_nw_tos *a)
+{
+    if (key->dl_type == htons(ETH_TYPE_IP)) {
+        struct ip_header *nh = packet->l3;
+        uint8_t *field = &nh->ip_tos;
+
+        /* Set the DSCP bits and preserve the ECN bits. */
+        uint8_t new = a->nw_tos | (nh->ip_tos & IP_ECN_MASK);
+
+        nh->ip_csum = recalc_csum16(nh->ip_csum, htons((uint16_t)*field),
+                htons((uint16_t)a->nw_tos));
+        *field = new;
+        key->nw_tos = a->nw_tos;
+    }
+}
+
+static void
+xf_netdev_set_tp_port(struct ofpbuf *packet, struct xflow_key *key,
+                      const struct xflow_action_tp_port *a)
+{
+    if (key->dl_type == htons(ETH_TYPE_IP)) {
+        uint16_t *field;
+        if (key->nw_proto == IPPROTO_TCP) {
+            struct tcp_header *th = packet->l4;
+            field = a->type == XFLOWAT_SET_TP_SRC ? &th->tcp_src : &th->tcp_dst;
+            th->tcp_csum = recalc_csum16(th->tcp_csum, *field, a->tp_port);
+            *field = a->tp_port;
+        } else if (key->nw_proto == IPPROTO_UDP) {
+            struct udp_header *uh = packet->l4;
+            field = a->type == XFLOWAT_SET_TP_SRC ? &uh->udp_src : &uh->udp_dst;
+            uh->udp_csum = recalc_csum16(uh->udp_csum, *field, a->tp_port);
+            *field = a->tp_port;
+        } else {
+            return;
+        }
+
+        if (a->type == XFLOWAT_SET_TP_SRC) {
+            key->tp_src = a->tp_port;
+        } else {
+            key->tp_dst = a->tp_port;
+        }
+    }
+}
+
+static void
+xf_netdev_output_port(struct xf_netdev *xf, struct ofpbuf *packet,
+                      uint16_t out_port)
+{
+    struct xf_netdev_port *p = xf->ports[out_port];
+    if (p) {
+        netdev_send(p->netdev, packet);
+    }
+}
+
+static void
+xf_netdev_output_group(struct xf_netdev *xf, uint16_t group, uint16_t in_port,
+                       struct ofpbuf *packet)
+{
+    struct xflow_port_group *g = &xf->groups[group];
+    int i;
+
+    for (i = 0; i < g->n_ports; i++) {
+        uint16_t out_port = g->ports[i];
+        if (out_port != in_port) {
+            xf_netdev_output_port(xf, packet, out_port);
+        }
+    }
+}
+
+static int
+xf_netdev_output_control(struct xf_netdev *xf, const struct ofpbuf *packet,
+                         int queue_no, int port_no, uint32_t arg)
+{
+    struct ovs_queue *q = &xf->queues[queue_no];
+    struct xflow_msg *header;
+    struct ofpbuf *msg;
+    size_t msg_size;
+
+    if (q->n >= MAX_QUEUE_LEN) {
+        xf->n_lost++;
+        return ENOBUFS;
+    }
+
+    msg_size = sizeof *header + packet->size;
+    msg = ofpbuf_new(msg_size);
+    header = ofpbuf_put_uninit(msg, sizeof *header);
+    header->type = queue_no;
+    header->length = msg_size;
+    header->port = port_no;
+    header->arg = arg;
+    ofpbuf_put(msg, packet->data, packet->size);
+    queue_push_tail(q, msg);
+
+    return 0;
+}
+
+static int
+xf_netdev_execute_actions(struct xf_netdev *xf,
+                          struct ofpbuf *packet, struct xflow_key *key,
+                          const union xflow_action *actions, int n_actions)
+{
+    int i;
+    for (i = 0; i < n_actions; i++) {
+        const union xflow_action *a = &actions[i];
+
+        switch (a->type) {
+        case XFLOWAT_OUTPUT:
+            xf_netdev_output_port(xf, packet, a->output.port);
+            break;
+
+        case XFLOWAT_OUTPUT_GROUP:
+            xf_netdev_output_group(xf, a->output_group.group, key->in_port,
+                                   packet);
+            break;
+
+        case XFLOWAT_CONTROLLER:
+            xf_netdev_output_control(xf, packet, _XFLOWL_ACTION_NR,
+                                     key->in_port, a->controller.arg);
+            break;
+
+        case XFLOWAT_SET_DL_TCI:
+            xf_netdev_set_dl_tci(packet, key, &a->dl_tci);
+            break;
+
+        case XFLOWAT_STRIP_VLAN:
+            xf_netdev_strip_vlan(packet, key);
+            break;
+
+        case XFLOWAT_SET_DL_SRC:
+            xf_netdev_set_dl_src(packet, key, a->dl_addr.dl_addr);
+            break;
+
+        case XFLOWAT_SET_DL_DST:
+            xf_netdev_set_dl_dst(packet, key, a->dl_addr.dl_addr);
+            break;
+
+        case XFLOWAT_SET_NW_SRC:
+        case XFLOWAT_SET_NW_DST:
+            xf_netdev_set_nw_addr(packet, key, &a->nw_addr);
+            break;
+
+        case XFLOWAT_SET_NW_TOS:
+            xf_netdev_set_nw_tos(packet, key, &a->nw_tos);
+            break;
+
+        case XFLOWAT_SET_TP_SRC:
+        case XFLOWAT_SET_TP_DST:
+            xf_netdev_set_tp_port(packet, key, &a->tp_port);
+            break;
+        }
+    }
+    return 0;
+}
+
+const struct xfif_class xfif_netdev_class = {
+    "netdev",
+    xf_netdev_run,
+    xf_netdev_wait,
+    NULL,                       /* enumerate */
+    xfif_netdev_open,
+    xfif_netdev_close,
+    NULL,                       /* get_all_names */
+    xfif_netdev_destroy,
+    xfif_netdev_get_stats,
+    xfif_netdev_get_drop_frags,
+    xfif_netdev_set_drop_frags,
+    xfif_netdev_port_add,
+    xfif_netdev_port_del,
+    xfif_netdev_port_query_by_number,
+    xfif_netdev_port_query_by_name,
+    xfif_netdev_port_list,
+    xfif_netdev_port_poll,
+    xfif_netdev_port_poll_wait,
+    xfif_netdev_port_group_get,
+    xfif_netdev_port_group_set,
+    xfif_netdev_flow_get,
+    xfif_netdev_flow_put,
+    xfif_netdev_flow_del,
+    xfif_netdev_flow_flush,
+    xfif_netdev_flow_list,
+    xfif_netdev_execute,
+    xfif_netdev_recv_get_mask,
+    xfif_netdev_recv_set_mask,
+    NULL,                       /* get_sflow_probability */
+    NULL,                       /* set_sflow_probability */
+    xfif_netdev_recv,
+    xfif_netdev_recv_wait,
+};
similarity index 61%
rename from lib/dpif-provider.h
rename to lib/xfif-provider.h
index fddc8ea..101849b 100644 (file)
 #ifndef DPIF_PROVIDER_H
 #define DPIF_PROVIDER_H 1
 
-/* Provider interface to dpifs, which provide an interface to an Open vSwitch
+/* Provider interface to xfifs, which provide an interface to an Open vSwitch
  * datapath. */
 
 #include <assert.h>
-#include "dpif.h"
+#include "xfif.h"
 
 #ifdef  __cplusplus
 extern "C" {
@@ -29,23 +29,23 @@ extern "C" {
 
 /* Open vSwitch datapath interface.
  *
- * This structure should be treated as opaque by dpif implementations. */
-struct dpif {
-    const struct dpif_class *dpif_class;
+ * This structure should be treated as opaque by xfif implementations. */
+struct xfif {
+    const struct xfif_class *xfif_class;
     char *base_name;
     char *full_name;
     uint8_t netflow_engine_type;
     uint8_t netflow_engine_id;
 };
 
-void dpif_init(struct dpif *, const struct dpif_class *, const char *name,
+void xfif_init(struct xfif *, const struct xfif_class *, const char *name,
                uint8_t netflow_engine_type, uint8_t netflow_engine_id);
-void dpif_uninit(struct dpif *dpif, bool close);
+void xfif_uninit(struct xfif *xfif, bool close);
 
-static inline void dpif_assert_class(const struct dpif *dpif,
-                                     const struct dpif_class *dpif_class)
+static inline void xfif_assert_class(const struct xfif *xfif,
+                                     const struct xfif_class *xfif_class)
 {
-    assert(dpif->dpif_class == dpif_class);
+    assert(xfif->xfif_class == xfif_class);
 }
 
 /* Datapath interface class structure, to be defined by each implementation of
@@ -58,14 +58,14 @@ static inline void dpif_assert_class(const struct dpif *dpif,
  * necessary to obtain a result.  Thus, they may not return EAGAIN or
  * EWOULDBLOCK or EINPROGRESS.  We may relax this requirement in the future if
  * and when we encounter performance problems. */
-struct dpif_class {
-    /* Type of dpif in this class, e.g. "system", "netdev", etc.
+struct xfif_class {
+    /* Type of xfif in this class, e.g. "system", "netdev", etc.
      *
      * One of the providers should supply a "system" type, since this is
-     * the type assumed if no type is specified when opening a dpif. */
+     * the type assumed if no type is specified when opening a xfif. */
     const char *type;
 
-    /* Performs periodic work needed by dpifs of this class, if any is
+    /* Performs periodic work needed by xfifs of this class, if any is
      * necessary. */
     void (*run)(void);
 
@@ -74,7 +74,7 @@ struct dpif_class {
     void (*wait)(void);
 
     /* Enumerates the names of all known created datapaths, if possible, into
-     * 'all_dps'.  The caller has already initialized 'all_dps' and other dpif
+     * 'all_dps'.  The caller has already initialized 'all_dps' and other xfif
      * classes might already have added names to it.
      *
      * This is used by the vswitch at startup, so that it can delete any
@@ -84,20 +84,20 @@ struct dpif_class {
      * case this function may be a null pointer. */
     int (*enumerate)(struct svec *all_dps);
 
-    /* Attempts to open an existing dpif called 'name', if 'create' is false,
-     * or to open an existing dpif or create a new one, if 'create' is true.
-     * 'type' corresponds to the 'type' field used in the dpif_class
+    /* Attempts to open an existing xfif called 'name', if 'create' is false,
+     * or to open an existing xfif or create a new one, if 'create' is true.
+     * 'type' corresponds to the 'type' field used in the xfif_class
      * structure.
      *
-     * If successful, stores a pointer to the new dpif in '*dpifp'.  On failure
-     * there are no requirements on what is stored in '*dpifp'. */
+     * If successful, stores a pointer to the new xfif in '*xfifp'.  On failure
+     * there are no requirements on what is stored in '*xfifp'. */
     int (*open)(const char *name, const char *type, bool create,
-                struct dpif **dpifp);
+                struct xfif **xfifp);
 
-    /* Closes 'dpif' and frees associated memory. */
-    void (*close)(struct dpif *dpif);
+    /* Closes 'xfif' and frees associated memory. */
+    void (*close)(struct xfif *xfif);
 
-    /* Enumerates all names that may be used to open 'dpif' into 'all_names'.
+    /* Enumerates all names that may be used to open 'xfif' into 'all_names'.
      * The Linux datapath, for example, supports opening a datapath both by
      * number, e.g. "dp0", and by the name of the datapath's local port.  For
      * some datapaths, this might be an infinite set (e.g. in a file name,
@@ -112,55 +112,55 @@ struct dpif_class {
      * function may be a null pointer.
      *
      * This is used by the vswitch at startup, */
-    int (*get_all_names)(const struct dpif *dpif, struct svec *all_names);
+    int (*get_all_names)(const struct xfif *xfif, struct svec *all_names);
 
-    /* Attempts to destroy the dpif underlying 'dpif'.
+    /* Attempts to destroy the xfif underlying 'xfif'.
      *
-     * If successful, 'dpif' will not be used again except as an argument for
+     * If successful, 'xfif' will not be used again except as an argument for
      * the 'close' member function. */
-    int (*destroy)(struct dpif *dpif);
+    int (*destroy)(struct xfif *xfif);
 
-    /* Retrieves statistics for 'dpif' into 'stats'. */
-    int (*get_stats)(const struct dpif *dpif, struct odp_stats *stats);
+    /* Retrieves statistics for 'xfif' into 'stats'. */
+    int (*get_stats)(const struct xfif *xfif, struct xflow_stats *stats);
 
-    /* Retrieves 'dpif''s current treatment of IP fragments into '*drop_frags':
+    /* Retrieves 'xfif''s current treatment of IP fragments into '*drop_frags':
      * true indicates that fragments are dropped, false indicates that
      * fragments are treated in the same way as other IP packets (except that
      * the L4 header cannot be read). */
-    int (*get_drop_frags)(const struct dpif *dpif, bool *drop_frags);
+    int (*get_drop_frags)(const struct xfif *xfif, bool *drop_frags);
 
-    /* Changes 'dpif''s treatment of IP fragments to 'drop_frags', whose
+    /* Changes 'xfif''s treatment of IP fragments to 'drop_frags', whose
      * meaning is the same as for the get_drop_frags member function. */
-    int (*set_drop_frags)(struct dpif *dpif, bool drop_frags);
+    int (*set_drop_frags)(struct xfif *xfif, bool drop_frags);
 
-    /* Creates a new port in 'dpif' connected to network device 'devname'.
-     * 'flags' is a set of ODP_PORT_* flags.  If successful, sets '*port_no'
+    /* Creates a new port in 'xfif' connected to network device 'devname'.
+     * 'flags' is a set of XFLOW_PORT_* flags.  If successful, sets '*port_no'
      * to the new port's port number. */
-    int (*port_add)(struct dpif *dpif, const char *devname, uint16_t flags,
+    int (*port_add)(struct xfif *xfif, const char *devname, uint16_t flags,
                     uint16_t *port_no);
 
-    /* Removes port numbered 'port_no' from 'dpif'. */
-    int (*port_del)(struct dpif *dpif, uint16_t port_no);
+    /* Removes port numbered 'port_no' from 'xfif'. */
+    int (*port_del)(struct xfif *xfif, uint16_t port_no);
 
-    /* Queries 'dpif' for a port with the given 'port_no' or 'devname'.  Stores
+    /* Queries 'xfif' for a port with the given 'port_no' or 'devname'.  Stores
      * information about the port into '*port' if successful. */
-    int (*port_query_by_number)(const struct dpif *dpif, uint16_t port_no,
-                                struct odp_port *port);
-    int (*port_query_by_name)(const struct dpif *dpif, const char *devname,
-                              struct odp_port *port);
+    int (*port_query_by_number)(const struct xfif *xfif, uint16_t port_no,
+                                struct xflow_port *port);
+    int (*port_query_by_name)(const struct xfif *xfif, const char *devname,
+                              struct xflow_port *port);
 
-    /* Stores in 'ports' information about up to 'n' ports attached to 'dpif',
-     * in no particular order.  Returns the number of ports attached to 'dpif'
+    /* Stores in 'ports' information about up to 'n' ports attached to 'xfif',
+     * in no particular order.  Returns the number of ports attached to 'xfif'
      * (not the number stored), if successful, otherwise a negative errno
      * value. */
-    int (*port_list)(const struct dpif *dpif, struct odp_port *ports, int n);
+    int (*port_list)(const struct xfif *xfif, struct xflow_port *ports, int n);
 
-    /* Polls for changes in the set of ports in 'dpif'.  If the set of ports in
-     * 'dpif' has changed, then this function should do one of the
+    /* Polls for changes in the set of ports in 'xfif'.  If the set of ports in
+     * 'xfif' has changed, then this function should do one of the
      * following:
      *
      * - Preferably: store the name of the device that was added to or deleted
-     *   from 'dpif' in '*devnamep' and return 0.  The caller is responsible
+     *   from 'xfif' in '*devnamep' and return 0.  The caller is responsible
      *   for freeing '*devnamep' (with free()) when it no longer needs it.
      *
      * - Alternatively: return ENOBUFS, without indicating the device that was
@@ -170,32 +170,32 @@ struct dpif_class {
      * indicating a device that was not actually added or deleted or returns
      * ENOBUFS without any change, are acceptable.
      *
-     * If the set of ports in 'dpif' has not changed, returns EAGAIN.  May also
+     * If the set of ports in 'xfif' has not changed, returns EAGAIN.  May also
      * return other positive errno values to indicate that something has gone
      * wrong. */
-    int (*port_poll)(const struct dpif *dpif, char **devnamep);
+    int (*port_poll)(const struct xfif *xfif, char **devnamep);
 
     /* Arranges for the poll loop to wake up when 'port_poll' will return a
      * value other than EAGAIN. */
-    void (*port_poll_wait)(const struct dpif *dpif);
+    void (*port_poll_wait)(const struct xfif *xfif);
 
     /* Stores in 'ports' the port numbers of up to 'n' ports that belong to
-     * 'group' in 'dpif'.  Returns the number of ports in 'group' (not the
+     * 'group' in 'xfif'.  Returns the number of ports in 'group' (not the
      * number stored), if successful, otherwise a negative errno value. */
-    int (*port_group_get)(const struct dpif *dpif, int group,
+    int (*port_group_get)(const struct xfif *xfif, int group,
                           uint16_t ports[], int n);
 
-    /* Changes port group 'group' in 'dpif' to consist of the 'n' ports whose
+    /* Changes port group 'group' in 'xfif' to consist of the 'n' ports whose
      * numbers are given in 'ports'.
      *
      * Use the get_stats member function to obtain the number of supported port
      * groups. */
-    int (*port_group_set)(struct dpif *dpif, int group,
+    int (*port_group_set)(struct xfif *xfif, int group,
                           const uint16_t ports[], int n);
 
     /* For each flow 'flow' in the 'n' flows in 'flows':
      *
-     * - If a flow matching 'flow->key' exists in 'dpif':
+     * - If a flow matching 'flow->key' exists in 'xfif':
      *
      *     Stores 0 into 'flow->stats.error' and stores statistics for the flow
      *     into 'flow->stats'.
@@ -210,7 +210,7 @@ struct dpif_class {
      *
      * - Flow-specific errors are indicated by a positive errno value in
      *   'flow->stats.error'.  In particular, ENOENT indicates that no flow
-     *   matching 'flow->key' exists in 'dpif'.  When an error value is stored,
+     *   matching 'flow->key' exists in 'xfif'.  When an error value is stored,
      *   the contents of 'flow->key' are preserved but other members of 'flow'
      *   should be treated as indeterminate.
      *
@@ -220,103 +220,104 @@ struct dpif_class {
      * this update occurred, in which the caller must not depend on any
      * elements in 'flows' being updated or not updated.
      */
-    int (*flow_get)(const struct dpif *dpif, struct odp_flow flows[], int n);
+    int (*flow_get)(const struct xfif *xfif, struct xflow_flow flows[], int n);
 
-    /* Adds or modifies a flow in 'dpif' as specified in 'put':
+    /* Adds or modifies a flow in 'xfif' as specified in 'put':
      *
-     * - If the flow specified in 'put->flow' does not exist in 'dpif', then
-     *   behavior depends on whether ODPPF_CREATE is specified in 'put->flags':
+     * - If the flow specified in 'put->flow' does not exist in 'xfif', then
+     *   behavior depends on whether XFLOWPF_CREATE is specified in 'put->flags':
      *   if it is, the flow will be added, otherwise the operation will fail
      *   with ENOENT.
      *
-     * - Otherwise, the flow specified in 'put->flow' does exist in 'dpif'.
-     *   Behavior in this case depends on whether ODPPF_MODIFY is specified in
+     * - Otherwise, the flow specified in 'put->flow' does exist in 'xfif'.
+     *   Behavior in this case depends on whether XFLOWPF_MODIFY is specified in
      *   'put->flags': if it is, the flow's actions will be updated, otherwise
      *   the operation will fail with EEXIST.  If the flow's actions are
-     *   updated, then its statistics will be zeroed if ODPPF_ZERO_STATS is set
+     *   updated, then its statistics will be zeroed if XFLOWPF_ZERO_STATS is set
      *   in 'put->flags', left as-is otherwise.
      */
-    int (*flow_put)(struct dpif *dpif, struct odp_flow_put *put);
+    int (*flow_put)(struct xfif *xfif, struct xflow_flow_put *put);
 
-    /* Deletes a flow matching 'flow->key' from 'dpif' or returns ENOENT if
-     * 'dpif' does not contain such a flow.
+    /* Deletes a flow matching 'flow->key' from 'xfif' or returns ENOENT if
+     * 'xfif' does not contain such a flow.
      *
      * If successful, updates 'flow->stats', 'flow->n_actions', and
      * 'flow->actions' as described in more detail under the flow_get member
      * function below. */
-    int (*flow_del)(struct dpif *dpif, struct odp_flow *flow);
+    int (*flow_del)(struct xfif *xfif, struct xflow_flow *flow);
 
-    /* Deletes all flows from 'dpif' and clears all of its queues of received
+    /* Deletes all flows from 'xfif' and clears all of its queues of received
      * packets. */
-    int (*flow_flush)(struct dpif *dpif);
+    int (*flow_flush)(struct xfif *xfif);
 
-    /* Stores up to 'n' flows in 'dpif' into 'flows', updating their statistics
+    /* Stores up to 'n' flows in 'xfif' into 'flows', updating their statistics
      * and actions as described under the flow_get member function.  If
-     * successful, returns the number of flows actually present in 'dpif',
-     * which might be greater than the number stored (if 'dpif' has more than
+     * successful, returns the number of flows actually present in 'xfif',
+     * which might be greater than the number stored (if 'xfif' has more than
      * 'n' flows).  On failure, returns a negative errno value. */
-    int (*flow_list)(const struct dpif *dpif, struct odp_flow flows[], int n);
+    int (*flow_list)(const struct xfif *xfif,
+                     struct xflow_flow flows[], int n);
 
     /* Performs the 'n_actions' actions in 'actions' on the Ethernet frame
      * specified in 'packet'.
      *
      * Pretends that the frame was originally received on the port numbered
-     * 'in_port'.  This affects only ODPAT_OUTPUT_GROUP actions, which will not
-     * send a packet out their input port.  Specify the number of an unused
+     * 'in_port'.  This affects only XFLOWAT_OUTPUT_GROUP actions, which will
+     * not send a packet out their input port.  Specify the number of an unused
      * port (e.g. UINT16_MAX is currently always unused) to avoid this
      * behavior. */
-    int (*execute)(struct dpif *dpif, uint16_t in_port,
-                   const union odp_action actions[], int n_actions,
+    int (*execute)(struct xfif *xfif, uint16_t in_port,
+                   const union xflow_action actions[], int n_actions,
                    const struct ofpbuf *packet);
 
-    /* Retrieves 'dpif''s "listen mask" into '*listen_mask'.  Each ODPL_* bit
-     * set in '*listen_mask' indicates the 'dpif' will receive messages of the
+    /* Retrieves 'xfif''s "listen mask" into '*listen_mask'.  Each XFLOWL_* bit
+     * set in '*listen_mask' indicates the 'xfif' will receive messages of the
      * corresponding type when it calls the recv member function. */
-    int (*recv_get_mask)(const struct dpif *dpif, int *listen_mask);
+    int (*recv_get_mask)(const struct xfif *xfif, int *listen_mask);
 
-    /* Sets 'dpif''s "listen mask" to 'listen_mask'.  Each ODPL_* bit set in
-     * 'listen_mask' indicates the 'dpif' will receive messages of the
+    /* Sets 'xfif''s "listen mask" to 'listen_mask'.  Each XFLOWL_* bit set in
+     * 'listen_mask' indicates the 'xfif' will receive messages of the
      * corresponding type when it calls the recv member function. */
-    int (*recv_set_mask)(struct dpif *dpif, int listen_mask);
+    int (*recv_set_mask)(struct xfif *xfif, int listen_mask);
 
-    /* Retrieves 'dpif''s sFlow sampling probability into '*probability'.
+    /* Retrieves 'xfif''s sFlow sampling probability into '*probability'.
      * Return value is 0 or a positive errno value.  EOPNOTSUPP indicates that
      * the datapath does not support sFlow, as does a null pointer.
      *
      * '*probability' is expressed as the number of packets out of UINT_MAX to
      * sample, e.g. probability/UINT_MAX is the probability of sampling a given
      * packet. */
-    int (*get_sflow_probability)(const struct dpif *dpif,
+    int (*get_sflow_probability)(const struct xfif *xfif,
                                  uint32_t *probability);
 
-    /* Sets 'dpif''s sFlow sampling probability to 'probability'.  Return value
+    /* Sets 'xfif''s sFlow sampling probability to 'probability'.  Return value
      * is 0 or a positive errno value.  EOPNOTSUPP indicates that the datapath
      * does not support sFlow, as does a null pointer.
      *
      * 'probability' is expressed as the number of packets out of UINT_MAX to
      * sample, e.g. probability/UINT_MAX is the probability of sampling a given
      * packet. */
-    int (*set_sflow_probability)(struct dpif *dpif, uint32_t probability);
+    int (*set_sflow_probability)(struct xfif *xfif, uint32_t probability);
 
-    /* Attempts to receive a message from 'dpif'.  If successful, stores the
+    /* Attempts to receive a message from 'xfif'.  If successful, stores the
      * message into '*packetp'.  The message, if one is received, must begin
-     * with 'struct odp_msg' as a header.  Only messages of the types selected
-     * with the set_listen_mask member function should be received.
+     * with 'struct xflow_msg' as a header.  Only messages of the types
+     * selected with the set_listen_mask member function should be received.
      *
      * This function must not block.  If no message is ready to be received
      * when it is called, it should return EAGAIN without blocking. */
-    int (*recv)(struct dpif *dpif, struct ofpbuf **packetp);
+    int (*recv)(struct xfif *xfif, struct ofpbuf **packetp);
 
-    /* Arranges for the poll loop to wake up when 'dpif' has a message queued
+    /* Arranges for the poll loop to wake up when 'xfif' has a message queued
      * to be received with the recv member function. */
-    void (*recv_wait)(struct dpif *dpif);
+    void (*recv_wait)(struct xfif *xfif);
 };
 
-extern const struct dpif_class dpif_linux_class;
-extern const struct dpif_class dpif_netdev_class;
+extern const struct xfif_class xfif_linux_class;
+extern const struct xfif_class xfif_netdev_class;
 
 #ifdef  __cplusplus
 }
 #endif
 
-#endif /* dpif-provider.h */
+#endif /* xfif-provider.h */
similarity index 58%
rename from lib/dpif.c
rename to lib/xfif.c
index 44d74b8..e78a890 100644 (file)
@@ -15,7 +15,7 @@
  */
 
 #include <config.h>
-#include "dpif-provider.h"
+#include "xfif-provider.h"
 
 #include <assert.h>
 #include <ctype.h>
@@ -28,7 +28,7 @@
 #include "dynamic-string.h"
 #include "flow.h"
 #include "netlink.h"
-#include "odp-util.h"
+#include "xflow-util.h"
 #include "ofp-print.h"
 #include "ofpbuf.h"
 #include "packets.h"
 #include "valgrind.h"
 
 #include "vlog.h"
-#define THIS_MODULE VLM_dpif
+#define THIS_MODULE VLM_xfif
 
-static const struct dpif_class *base_dpif_classes[] = {
-    &dpif_linux_class,
-    &dpif_netdev_class,
+static const struct xfif_class *base_xfif_classes[] = {
+    &xfif_linux_class,
+    &xfif_netdev_class,
 };
 
-struct registered_dpif_class {
-    struct dpif_class dpif_class;
+struct registered_xfif_class {
+    struct xfif_class xfif_class;
     int refcount;
 };
-static struct shash dpif_classes = SHASH_INITIALIZER(&dpif_classes);
+static struct shash xfif_classes = SHASH_INITIALIZER(&xfif_classes);
 
 /* Rate limit for individual messages going to or from the datapath, output at
  * DBG level.  This is very high because, if these are enabled, it is because
  * we really need to see them. */
 static struct vlog_rate_limit dpmsg_rl = VLOG_RATE_LIMIT_INIT(600, 600);
 
-/* Not really much point in logging many dpif errors. */
+/* Not really much point in logging many xfif errors. */
 static struct vlog_rate_limit error_rl = VLOG_RATE_LIMIT_INIT(9999, 5);
 
-static void log_operation(const struct dpif *, const char *operation,
+static void log_operation(const struct xfif *, const char *operation,
                           int error);
-static void log_flow_operation(const struct dpif *, const char *operation,
-                               int error, struct odp_flow *flow);
-static void log_flow_put(struct dpif *, int error,
-                         const struct odp_flow_put *);
+static void log_flow_operation(const struct xfif *, const char *operation,
+                               int error, struct xflow_flow *flow);
+static void log_flow_put(struct xfif *, int error,
+                         const struct xflow_flow_put *);
 static bool should_log_flow_message(int error);
-static void check_rw_odp_flow(struct odp_flow *);
+static void check_rw_xflow_flow(struct xflow_flow *);
 
 static void
-dp_initialize(void)
+xf_initialize(void)
 {
     static int status = -1;
 
@@ -78,77 +78,77 @@ dp_initialize(void)
         int i;
 
         status = 0;
-        for (i = 0; i < ARRAY_SIZE(base_dpif_classes); i++) {
-            dp_register_provider(base_dpif_classes[i]);
+        for (i = 0; i < ARRAY_SIZE(base_xfif_classes); i++) {
+            xf_register_provider(base_xfif_classes[i]);
         }
     }
 }
 
-/* Performs periodic work needed by all the various kinds of dpifs.
+/* Performs periodic work needed by all the various kinds of xfifs.
  *
- * If your program opens any dpifs, it must call both this function and
+ * If your program opens any xfifs, it must call both this function and
  * netdev_run() within its main poll loop. */
 void
-dp_run(void)
+xf_run(void)
 {
     struct shash_node *node;
-    SHASH_FOR_EACH(node, &dpif_classes) {
-        const struct registered_dpif_class *registered_class = node->data;
-        if (registered_class->dpif_class.run) {
-            registered_class->dpif_class.run();
+    SHASH_FOR_EACH(node, &xfif_classes) {
+        const struct registered_xfif_class *registered_class = node->data;
+        if (registered_class->xfif_class.run) {
+            registered_class->xfif_class.run();
         }
     }
 }
 
-/* Arranges for poll_block() to wake up when dp_run() needs to be called.
+/* Arranges for poll_block() to wake up when xf_run() needs to be called.
  *
- * If your program opens any dpifs, it must call both this function and
+ * If your program opens any xfifs, it must call both this function and
  * netdev_wait() within its main poll loop. */
 void
-dp_wait(void)
+xf_wait(void)
 {
     struct shash_node *node;
-    SHASH_FOR_EACH(node, &dpif_classes) {
-        const struct registered_dpif_class *registered_class = node->data;
-        if (registered_class->dpif_class.wait) {
-            registered_class->dpif_class.wait();
+    SHASH_FOR_EACH(node, &xfif_classes) {
+        const struct registered_xfif_class *registered_class = node->data;
+        if (registered_class->xfif_class.wait) {
+            registered_class->xfif_class.wait();
         }
     }
 }
 
 /* Registers a new datapath provider.  After successful registration, new
- * datapaths of that type can be opened using dpif_open(). */
+ * datapaths of that type can be opened using xfif_open(). */
 int
-dp_register_provider(const struct dpif_class *new_class)
+xf_register_provider(const struct xfif_class *new_class)
 {
-    struct registered_dpif_class *registered_class;
+    struct registered_xfif_class *registered_class;
 
-    if (shash_find(&dpif_classes, new_class->type)) {
+    if (shash_find(&xfif_classes, new_class->type)) {
         VLOG_WARN("attempted to register duplicate datapath provider: %s",
                   new_class->type);
         return EEXIST;
     }
 
     registered_class = xmalloc(sizeof *registered_class);
-    memcpy(&registered_class->dpif_class, new_class,
-           sizeof registered_class->dpif_class);
+    memcpy(&registered_class->xfif_class, new_class,
+           sizeof registered_class->xfif_class);
     registered_class->refcount = 0;
 
-    shash_add(&dpif_classes, new_class->type, registered_class);
+    shash_add(&xfif_classes, new_class->type, registered_class);
 
     return 0;
 }
 
 /* Unregisters a datapath provider.  'type' must have been previously
- * registered and not currently be in use by any dpifs.  After unregistration
- * new datapaths of that type cannot be opened using dpif_open(). */
+ * registered and not currently be in use by any xfifs.  After unregistration
+ * new datapaths of that type cannot be opened using xfif_open(). */
 int
-dp_unregister_provider(const char *type)
+xf_unregister_provider(const char *type)
 {
     struct shash_node *node;
-    struct registered_dpif_class *registered_class;
+    struct registered_xfif_class *registered_class;
 
-    node = shash_find(&dpif_classes, type);
+    node = shash_find(&xfif_classes, type);
     if (!node) {
         VLOG_WARN("attempted to unregister a datapath provider that is not "
                   "registered: %s", type);
@@ -161,7 +161,7 @@ dp_unregister_provider(const char *type)
         return EBUSY;
     }
 
-    shash_delete(&dpif_classes, node);
+    shash_delete(&xfif_classes, node);
     free(registered_class);
 
     return 0;
@@ -170,16 +170,16 @@ dp_unregister_provider(const char *type)
 /* Clears 'types' and enumerates the types of all currently registered datapath
  * providers into it.  The caller must first initialize the svec. */
 void
-dp_enumerate_types(struct svec *types)
+xf_enumerate_types(struct svec *types)
 {
     struct shash_node *node;
 
-    dp_initialize();
+    xf_initialize();
     svec_clear(types);
 
-    SHASH_FOR_EACH(node, &dpif_classes) {
-        const struct registered_dpif_class *registered_class = node->data;
-        svec_add(types, registered_class->dpif_class.type);
+    SHASH_FOR_EACH(node, &xfif_classes) {
+        const struct registered_xfif_class *registered_class = node->data;
+        svec_add(types, registered_class->xfif_class.type);
     }
 }
 
@@ -190,26 +190,26 @@ dp_enumerate_types(struct svec *types)
  * Some kinds of datapaths might not be practically enumerable.  This is not
  * considered an error. */
 int
-dp_enumerate_names(const char *type, struct svec *names)
+xf_enumerate_names(const char *type, struct svec *names)
 {
-    const struct registered_dpif_class *registered_class;
-    const struct dpif_class *dpif_class;
+    const struct registered_xfif_class *registered_class;
+    const struct xfif_class *xfif_class;
     int error;
 
-    dp_initialize();
+    xf_initialize();
     svec_clear(names);
 
-    registered_class = shash_find_data(&dpif_classes, type);
+    registered_class = shash_find_data(&xfif_classes, type);
     if (!registered_class) {
         VLOG_WARN("could not enumerate unknown type: %s", type);
         return EAFNOSUPPORT;
     }
 
-    dpif_class = &registered_class->dpif_class;
-    error = dpif_class->enumerate ? dpif_class->enumerate(names) : 0;
+    xfif_class = &registered_class->xfif_class;
+    error = xfif_class->enumerate ? xfif_class->enumerate(names) : 0;
 
     if (error) {
-        VLOG_WARN("failed to enumerate %s datapaths: %s", dpif_class->type,
+        VLOG_WARN("failed to enumerate %s datapaths: %s", xfif_class->type,
                    strerror(error));
     }
 
@@ -219,7 +219,7 @@ dp_enumerate_names(const char *type, struct svec *names)
 /* Parses 'datapath name', which is of the form type@name into its
  * component pieces.  'name' and 'type' must be freed by the caller. */
 void
-dp_parse_name(const char *datapath_name_, char **name, char **type)
+xf_parse_name(const char *datapath_name_, char **name, char **type)
 {
     char *datapath_name = xstrdup(datapath_name_);
     char *separator;
@@ -236,19 +236,19 @@ dp_parse_name(const char *datapath_name_, char **name, char **type)
 }
 
 static int
-do_open(const char *name, const char *type, bool create, struct dpif **dpifp)
+do_open(const char *name, const char *type, bool create, struct xfif **xfifp)
 {
-    struct dpif *dpif = NULL;
+    struct xfif *xfif = NULL;
     int error;
-    struct registered_dpif_class *registered_class;
+    struct registered_xfif_class *registered_class;
 
-    dp_initialize();
+    xf_initialize();
 
     if (!type || *type == '\0') {
         type = "system";
     }
 
-    registered_class = shash_find_data(&dpif_classes, type);
+    registered_class = shash_find_data(&xfif_classes, type);
     if (!registered_class) {
         VLOG_WARN("could not create datapath %s of unknown type %s", name,
                   type);
@@ -256,13 +256,13 @@ do_open(const char *name, const char *type, bool create, struct dpif **dpifp)
         goto exit;
     }
 
-    error = registered_class->dpif_class.open(name, type, create, &dpif);
+    error = registered_class->xfif_class.open(name, type, create, &xfif);
     if (!error) {
         registered_class->refcount++;
     }
 
 exit:
-    *dpifp = error ? NULL : dpif;
+    *xfifp = error ? NULL : xfif;
     return error;
 }
 
@@ -270,37 +270,37 @@ exit:
  * if no datapath with 'name' and 'type' exists.  'type' may be either NULL or
  * the empty string to specify the default system type.  Returns 0 if
  * successful, otherwise a positive errno value.  On success stores a pointer
- * to the datapath in '*dpifp', otherwise a null pointer. */
+ * to the datapath in '*xfifp', otherwise a null pointer. */
 int
-dpif_open(const char *name, const char *type, struct dpif **dpifp)
+xfif_open(const char *name, const char *type, struct xfif **xfifp)
 {
-    return do_open(name, type, false, dpifp);
+    return do_open(name, type, false, xfifp);
 }
 
 /* Tries to create and open a new datapath with the given 'name' and 'type'.
  * 'type' may be either NULL or the empty string to specify the default system
  * type.  Will fail if a datapath with 'name' and 'type' already exists.
  * Returns 0 if successful, otherwise a positive errno value.  On success
- * stores a pointer to the datapath in '*dpifp', otherwise a null pointer. */
+ * stores a pointer to the datapath in '*xfifp', otherwise a null pointer. */
 int
-dpif_create(const char *name, const char *type, struct dpif **dpifp)
+xfif_create(const char *name, const char *type, struct xfif **xfifp)
 {
-    return do_open(name, type, true, dpifp);
+    return do_open(name, type, true, xfifp);
 }
 
 /* Tries to open a datapath with the given 'name' and 'type', creating it if it
  * does not exist.  'type' may be either NULL or the empty string to specify
  * the default system type.  Returns 0 if successful, otherwise a positive
- * errno value. On success stores a pointer to the datapath in '*dpifp',
+ * errno value. On success stores a pointer to the datapath in '*xfifp',
  * otherwise a null pointer. */
 int
-dpif_create_and_open(const char *name, const char *type, struct dpif **dpifp)
+xfif_create_and_open(const char *name, const char *type, struct xfif **xfifp)
 {
     int error;
 
-    error = dpif_create(name, type, dpifp);
+    error = xfif_create(name, type, xfifp);
     if (error == EEXIST || error == EBUSY) {
-        error = dpif_open(name, type, dpifp);
+        error = xfif_open(name, type, xfifp);
         if (error) {
             VLOG_WARN("datapath %s already exists but cannot be opened: %s",
                       name, strerror(error));
@@ -311,41 +311,41 @@ dpif_create_and_open(const char *name, const char *type, struct dpif **dpifp)
     return error;
 }
 
-/* Closes and frees the connection to 'dpif'.  Does not destroy the datapath
- * itself; call dpif_delete() first, instead, if that is desirable. */
+/* Closes and frees the connection to 'xfif'.  Does not destroy the datapath
+ * itself; call xfif_delete() first, instead, if that is desirable. */
 void
-dpif_close(struct dpif *dpif)
+xfif_close(struct xfif *xfif)
 {
-    if (dpif) {
-        struct registered_dpif_class *registered_class;
+    if (xfif) {
+        struct registered_xfif_class *registered_class;
 
-        registered_class = shash_find_data(&dpif_classes, 
-                dpif->dpif_class->type);
+        registered_class = shash_find_data(&xfif_classes, 
+                xfif->xfif_class->type);
         assert(registered_class);
         assert(registered_class->refcount);
 
         registered_class->refcount--;
-        dpif_uninit(dpif, true);
+        xfif_uninit(xfif, true);
     }
 }
 
-/* Returns the name of datapath 'dpif' prefixed with the type
+/* Returns the name of datapath 'xfif' prefixed with the type
  * (for use in log messages). */
 const char *
-dpif_name(const struct dpif *dpif)
+xfif_name(const struct xfif *xfif)
 {
-    return dpif->full_name;
+    return xfif->full_name;
 }
 
-/* Returns the name of datapath 'dpif' without the type
+/* Returns the name of datapath 'xfif' without the type
  * (for use in device names). */
 const char *
-dpif_base_name(const struct dpif *dpif)
+xfif_base_name(const struct xfif *xfif)
 {
-    return dpif->base_name;
+    return xfif->base_name;
 }
 
-/* Enumerates all names that may be used to open 'dpif' into 'all_names'.  The
+/* Enumerates all names that may be used to open 'xfif' into 'all_names'.  The
  * Linux datapath, for example, supports opening a datapath both by number,
  * e.g. "dp0", and by the name of the datapath's local port.  For some
  * datapaths, this might be an infinite set (e.g. in a file name, slashes may
@@ -355,98 +355,98 @@ dpif_base_name(const struct dpif *dpif)
  * The caller must already have initialized 'all_names'.  Any existing names in
  * 'all_names' will not be disturbed. */
 int
-dpif_get_all_names(const struct dpif *dpif, struct svec *all_names)
+xfif_get_all_names(const struct xfif *xfif, struct svec *all_names)
 {
-    if (dpif->dpif_class->get_all_names) {
-        int error = dpif->dpif_class->get_all_names(dpif, all_names);
+    if (xfif->xfif_class->get_all_names) {
+        int error = xfif->xfif_class->get_all_names(xfif, all_names);
         if (error) {
             VLOG_WARN_RL(&error_rl,
                          "failed to retrieve names for datpath %s: %s",
-                         dpif_name(dpif), strerror(error));
+                         xfif_name(xfif), strerror(error));
         }
         return error;
     } else {
-        svec_add(all_names, dpif_base_name(dpif));
+        svec_add(all_names, xfif_base_name(xfif));
         return 0;
     }
 }
 
-/* Destroys the datapath that 'dpif' is connected to, first removing all of its
- * ports.  After calling this function, it does not make sense to pass 'dpif'
- * to any functions other than dpif_name() or dpif_close(). */
+/* Destroys the datapath that 'xfif' is connected to, first removing all of its
+ * ports.  After calling this function, it does not make sense to pass 'xfif'
+ * to any functions other than xfif_name() or xfif_close(). */
 int
-dpif_delete(struct dpif *dpif)
+xfif_delete(struct xfif *xfif)
 {
     int error;
 
-    COVERAGE_INC(dpif_destroy);
+    COVERAGE_INC(xfif_destroy);
 
-    error = dpif->dpif_class->destroy(dpif);
-    log_operation(dpif, "delete", error);
+    error = xfif->xfif_class->destroy(xfif);
+    log_operation(xfif, "delete", error);
     return error;
 }
 
-/* Retrieves statistics for 'dpif' into 'stats'.  Returns 0 if successful,
+/* Retrieves statistics for 'xfif' into 'stats'.  Returns 0 if successful,
  * otherwise a positive errno value. */
 int
-dpif_get_dp_stats(const struct dpif *dpif, struct odp_stats *stats)
+xfif_get_xf_stats(const struct xfif *xfif, struct xflow_stats *stats)
 {
-    int error = dpif->dpif_class->get_stats(dpif, stats);
+    int error = xfif->xfif_class->get_stats(xfif, stats);
     if (error) {
         memset(stats, 0, sizeof *stats);
     }
-    log_operation(dpif, "get_stats", error);
+    log_operation(xfif, "get_stats", error);
     return error;
 }
 
-/* Retrieves the current IP fragment handling policy for 'dpif' into
+/* Retrieves the current IP fragment handling policy for 'xfif' into
  * '*drop_frags': true indicates that fragments are dropped, false indicates
  * that fragments are treated in the same way as other IP packets (except that
  * the L4 header cannot be read).  Returns 0 if successful, otherwise a
  * positive errno value. */
 int
-dpif_get_drop_frags(const struct dpif *dpif, bool *drop_frags)
+xfif_get_drop_frags(const struct xfif *xfif, bool *drop_frags)
 {
-    int error = dpif->dpif_class->get_drop_frags(dpif, drop_frags);
+    int error = xfif->xfif_class->get_drop_frags(xfif, drop_frags);
     if (error) {
         *drop_frags = false;
     }
-    log_operation(dpif, "get_drop_frags", error);
+    log_operation(xfif, "get_drop_frags", error);
     return error;
 }
 
-/* Changes 'dpif''s treatment of IP fragments to 'drop_frags', whose meaning is
+/* Changes 'xfif''s treatment of IP fragments to 'drop_frags', whose meaning is
  * the same as for the get_drop_frags member function.  Returns 0 if
  * successful, otherwise a positive errno value. */
 int
-dpif_set_drop_frags(struct dpif *dpif, bool drop_frags)
+xfif_set_drop_frags(struct xfif *xfif, bool drop_frags)
 {
-    int error = dpif->dpif_class->set_drop_frags(dpif, drop_frags);
-    log_operation(dpif, "set_drop_frags", error);
+    int error = xfif->xfif_class->set_drop_frags(xfif, drop_frags);
+    log_operation(xfif, "set_drop_frags", error);
     return error;
 }
 
-/* Attempts to add 'devname' as a port on 'dpif', given the combination of
- * ODP_PORT_* flags in 'flags'.  If successful, returns 0 and sets '*port_nop'
+/* Attempts to add 'devname' as a port on 'xfif', given the combination of
+ * XFLOW_PORT_* flags in 'flags'.  If successful, returns 0 and sets '*port_nop'
  * to the new port's port number (if 'port_nop' is non-null).  On failure,
  * returns a positive errno value and sets '*port_nop' to UINT16_MAX (if
  * 'port_nop' is non-null). */
 int
-dpif_port_add(struct dpif *dpif, const char *devname, uint16_t flags,
+xfif_port_add(struct xfif *xfif, const char *devname, uint16_t flags,
               uint16_t *port_nop)
 {
     uint16_t port_no;
     int error;
 
-    COVERAGE_INC(dpif_port_add);
+    COVERAGE_INC(xfif_port_add);
 
-    error = dpif->dpif_class->port_add(dpif, devname, flags, &port_no);
+    error = xfif->xfif_class->port_add(xfif, devname, flags, &port_no);
     if (!error) {
         VLOG_DBG_RL(&dpmsg_rl, "%s: added %s as port %"PRIu16,
-                    dpif_name(dpif), devname, port_no);
+                    xfif_name(xfif), devname, port_no);
     } else {
         VLOG_WARN_RL(&error_rl, "%s: failed to add %s as port: %s",
-                     dpif_name(dpif), devname, strerror(error));
+                     xfif_name(xfif), devname, strerror(error));
         port_no = UINT16_MAX;
     }
     if (port_nop) {
@@ -455,76 +455,76 @@ dpif_port_add(struct dpif *dpif, const char *devname, uint16_t flags,
     return error;
 }
 
-/* Attempts to remove 'dpif''s port number 'port_no'.  Returns 0 if successful,
+/* Attempts to remove 'xfif''s port number 'port_no'.  Returns 0 if successful,
  * otherwise a positive errno value. */
 int
-dpif_port_del(struct dpif *dpif, uint16_t port_no)
+xfif_port_del(struct xfif *xfif, uint16_t port_no)
 {
     int error;
 
-    COVERAGE_INC(dpif_port_del);
+    COVERAGE_INC(xfif_port_del);
 
-    error = dpif->dpif_class->port_del(dpif, port_no);
-    log_operation(dpif, "port_del", error);
+    error = xfif->xfif_class->port_del(xfif, port_no);
+    log_operation(xfif, "port_del", error);
     return error;
 }
 
-/* Looks up port number 'port_no' in 'dpif'.  On success, returns 0 and
+/* Looks up port number 'port_no' in 'xfif'.  On success, returns 0 and
  * initializes '*port' appropriately; on failure, returns a positive errno
  * value. */
 int
-dpif_port_query_by_number(const struct dpif *dpif, uint16_t port_no,
-                          struct odp_port *port)
+xfif_port_query_by_number(const struct xfif *xfif, uint16_t port_no,
+                          struct xflow_port *port)
 {
-    int error = dpif->dpif_class->port_query_by_number(dpif, port_no, port);
+    int error = xfif->xfif_class->port_query_by_number(xfif, port_no, port);
     if (!error) {
         VLOG_DBG_RL(&dpmsg_rl, "%s: port %"PRIu16" is device %s",
-                    dpif_name(dpif), port_no, port->devname);
+                    xfif_name(xfif), port_no, port->devname);
     } else {
         memset(port, 0, sizeof *port);
         VLOG_WARN_RL(&error_rl, "%s: failed to query port %"PRIu16": %s",
-                     dpif_name(dpif), port_no, strerror(error));
+                     xfif_name(xfif), port_no, strerror(error));
     }
     return error;
 }
 
-/* Looks up port named 'devname' in 'dpif'.  On success, returns 0 and
+/* Looks up port named 'devname' in 'xfif'.  On success, returns 0 and
  * initializes '*port' appropriately; on failure, returns a positive errno
  * value. */
 int
-dpif_port_query_by_name(const struct dpif *dpif, const char *devname,
-                        struct odp_port *port)
+xfif_port_query_by_name(const struct xfif *xfif, const char *devname,
+                        struct xflow_port *port)
 {
-    int error = dpif->dpif_class->port_query_by_name(dpif, devname, port);
+    int error = xfif->xfif_class->port_query_by_name(xfif, devname, port);
     if (!error) {
         VLOG_DBG_RL(&dpmsg_rl, "%s: device %s is on port %"PRIu16,
-                    dpif_name(dpif), devname, port->port);
+                    xfif_name(xfif), devname, port->port);
     } else {
         memset(port, 0, sizeof *port);
 
         /* Log level is DBG here because all the current callers are interested
-         * in whether 'dpif' actually has a port 'devname', so that it's not an
+         * in whether 'xfif' actually has a port 'devname', so that it's not an
          * issue worth logging if it doesn't. */
         VLOG_DBG_RL(&error_rl, "%s: failed to query port %s: %s",
-                    dpif_name(dpif), devname, strerror(error));
+                    xfif_name(xfif), devname, strerror(error));
     }
     return error;
 }
 
-/* Looks up port number 'port_no' in 'dpif'.  On success, returns 0 and copies
+/* Looks up port number 'port_no' in 'xfif'.  On success, returns 0 and copies
  * the port's name into the 'name_size' bytes in 'name', ensuring that the
  * result is null-terminated.  On failure, returns a positive errno value and
  * makes 'name' the empty string. */
 int
-dpif_port_get_name(struct dpif *dpif, uint16_t port_no,
+xfif_port_get_name(struct xfif *xfif, uint16_t port_no,
                    char *name, size_t name_size)
 {
-    struct odp_port port;
+    struct xflow_port port;
     int error;
 
     assert(name_size > 0);
 
-    error = dpif_port_query_by_number(dpif, port_no, &port);
+    error = xfif_port_query_by_number(xfif, port_no, &port);
     if (!error) {
         ovs_strlcpy(name, port.devname, name_size);
     } else {
@@ -533,7 +533,7 @@ dpif_port_get_name(struct dpif *dpif, uint16_t port_no,
     return error;
 }
 
-/* Obtains a list of all the ports in 'dpif'.
+/* Obtains a list of all the ports in 'xfif'.
  *
  * If successful, returns 0 and sets '*portsp' to point to an array of
  * appropriately initialized port structures and '*n_portsp' to the number of
@@ -543,24 +543,24 @@ dpif_port_get_name(struct dpif *dpif, uint16_t port_no,
  * On failure, returns a positive errno value and sets '*portsp' to NULL and
  * '*n_portsp' to 0. */
 int
-dpif_port_list(const struct dpif *dpif,
-               struct odp_port **portsp, size_t *n_portsp)
+xfif_port_list(const struct xfif *xfif,
+               struct xflow_port **portsp, size_t *n_portsp)
 {
-    struct odp_port *ports;
+    struct xflow_port *ports;
     size_t n_ports = 0;
     int error;
 
     for (;;) {
-        struct odp_stats stats;
+        struct xflow_stats stats;
         int retval;
 
-        error = dpif_get_dp_stats(dpif, &stats);
+        error = xfif_get_xf_stats(xfif, &stats);
         if (error) {
             goto exit;
         }
 
         ports = xcalloc(stats.n_ports, sizeof *ports);
-        retval = dpif->dpif_class->port_list(dpif, ports, stats.n_ports);
+        retval = xfif->xfif_class->port_list(xfif, ports, stats.n_ports);
         if (retval < 0) {
             /* Hard error. */
             error = -retval;
@@ -585,14 +585,14 @@ exit:
         *portsp = ports;
         *n_portsp = n_ports;
     }
-    log_operation(dpif, "port_list", error);
+    log_operation(xfif, "port_list", error);
     return error;
 }
 
-/* Polls for changes in the set of ports in 'dpif'.  If the set of ports in
- * 'dpif' has changed, this function does one of the following:
+/* Polls for changes in the set of ports in 'xfif'.  If the set of ports in
+ * 'xfif' has changed, this function does one of the following:
  *
- * - Stores the name of the device that was added to or deleted from 'dpif' in
+ * - Stores the name of the device that was added to or deleted from 'xfif' in
  *   '*devnamep' and returns 0.  The caller is responsible for freeing
  *   '*devnamep' (with free()) when it no longer needs it.
  *
@@ -602,38 +602,38 @@ exit:
  * '*devnamep' names a device that was not actually added or deleted or it
  * returns ENOBUFS without any change.
  *
- * Returns EAGAIN if the set of ports in 'dpif' has not changed.  May also
+ * Returns EAGAIN if the set of ports in 'xfif' has not changed.  May also
  * return other positive errno values to indicate that something has gone
  * wrong. */
 int
-dpif_port_poll(const struct dpif *dpif, char **devnamep)
+xfif_port_poll(const struct xfif *xfif, char **devnamep)
 {
-    int error = dpif->dpif_class->port_poll(dpif, devnamep);
+    int error = xfif->xfif_class->port_poll(xfif, devnamep);
     if (error) {
         *devnamep = NULL;
     }
     return error;
 }
 
-/* Arranges for the poll loop to wake up when port_poll(dpif) will return a
+/* Arranges for the poll loop to wake up when port_poll(xfif) will return a
  * value other than EAGAIN. */
 void
-dpif_port_poll_wait(const struct dpif *dpif)
+xfif_port_poll_wait(const struct xfif *xfif)
 {
-    dpif->dpif_class->port_poll_wait(dpif);
+    xfif->xfif_class->port_poll_wait(xfif);
 }
 
-/* Retrieves a list of the port numbers in port group 'group' in 'dpif'.
+/* Retrieves a list of the port numbers in port group 'group' in 'xfif'.
  *
  * On success, returns 0 and points '*ports' to a newly allocated array of
- * integers, each of which is a 'dpif' port number for a port in
+ * integers, each of which is a 'xfif' port number for a port in
  * 'group'.  Stores the number of elements in the array in '*n_ports'.  The
  * caller is responsible for freeing '*ports' by calling free().
  *
  * On failure, returns a positive errno value and sets '*ports' to NULL and
  * '*n_ports' to 0. */
 int
-dpif_port_group_get(const struct dpif *dpif, uint16_t group,
+xfif_port_group_get(const struct xfif *xfif, uint16_t group,
                     uint16_t **ports, size_t *n_ports)
 {
     int error;
@@ -641,7 +641,7 @@ dpif_port_group_get(const struct dpif *dpif, uint16_t group,
     *ports = NULL;
     *n_ports = 0;
     for (;;) {
-        int retval = dpif->dpif_class->port_group_get(dpif, group,
+        int retval = xfif->xfif_class->port_group_get(xfif, group,
                                                       *ports, *n_ports);
         if (retval < 0) {
             /* Hard error. */
@@ -663,45 +663,45 @@ dpif_port_group_get(const struct dpif *dpif, uint16_t group,
             *n_ports = retval;
         }
     }
-    log_operation(dpif, "port_group_get", error);
+    log_operation(xfif, "port_group_get", error);
     return error;
 }
 
-/* Updates port group 'group' in 'dpif', making it contain the 'n_ports' ports
- * whose 'dpif' port numbers are given in 'n_ports'.  Returns 0 if
+/* Updates port group 'group' in 'xfif', making it contain the 'n_ports' ports
+ * whose 'xfif' port numbers are given in 'n_ports'.  Returns 0 if
  * successful, otherwise a positive errno value.
  *
  * Behavior is undefined if the values in ports[] are not unique. */
 int
-dpif_port_group_set(struct dpif *dpif, uint16_t group,
+xfif_port_group_set(struct xfif *xfif, uint16_t group,
                     const uint16_t ports[], size_t n_ports)
 {
     int error;
 
-    COVERAGE_INC(dpif_port_group_set);
+    COVERAGE_INC(xfif_port_group_set);
 
-    error = dpif->dpif_class->port_group_set(dpif, group, ports, n_ports);
-    log_operation(dpif, "port_group_set", error);
+    error = xfif->xfif_class->port_group_set(xfif, group, ports, n_ports);
+    log_operation(xfif, "port_group_set", error);
     return error;
 }
 
-/* Deletes all flows from 'dpif'.  Returns 0 if successful, otherwise a
+/* Deletes all flows from 'xfif'.  Returns 0 if successful, otherwise a
  * positive errno value.  */
 int
-dpif_flow_flush(struct dpif *dpif)
+xfif_flow_flush(struct xfif *xfif)
 {
     int error;
 
-    COVERAGE_INC(dpif_flow_flush);
+    COVERAGE_INC(xfif_flow_flush);
 
-    error = dpif->dpif_class->flow_flush(dpif);
-    log_operation(dpif, "flow_flush", error);
+    error = xfif->xfif_class->flow_flush(xfif);
+    log_operation(xfif, "flow_flush", error);
     return error;
 }
 
-/* Queries 'dpif' for a flow entry matching 'flow->key'.
+/* Queries 'xfif' for a flow entry matching 'flow->key'.
  *
- * If a flow matching 'flow->key' exists in 'dpif', stores statistics for the
+ * If a flow matching 'flow->key' exists in 'xfif', stores statistics for the
  * flow into 'flow->stats'.  If 'flow->n_actions' is zero, then 'flow->actions'
  * is ignored.  If 'flow->n_actions' is nonzero, then 'flow->actions' should
  * point to an array of the specified number of actions.  At most that many of
@@ -710,29 +710,29 @@ dpif_flow_flush(struct dpif *dpif)
  * be greater than the number stored if the flow has more actions than space
  * available in the array.
  *
- * If no flow matching 'flow->key' exists in 'dpif', returns ENOENT.  On other
+ * If no flow matching 'flow->key' exists in 'xfif', returns ENOENT.  On other
  * failure, returns a positive errno value. */
 int
-dpif_flow_get(const struct dpif *dpif, struct odp_flow *flow)
+xfif_flow_get(const struct xfif *xfif, struct xflow_flow *flow)
 {
     int error;
 
-    COVERAGE_INC(dpif_flow_get);
+    COVERAGE_INC(xfif_flow_get);
 
-    check_rw_odp_flow(flow);
-    error = dpif->dpif_class->flow_get(dpif, flow, 1);
+    check_rw_xflow_flow(flow);
+    error = xfif->xfif_class->flow_get(xfif, flow, 1);
     if (!error) {
         error = flow->stats.error;
     }
     if (should_log_flow_message(error)) {
-        log_flow_operation(dpif, "flow_get", error, flow);
+        log_flow_operation(xfif, "flow_get", error, flow);
     }
     return error;
 }
 
 /* For each flow 'flow' in the 'n' flows in 'flows':
  *
- * - If a flow matching 'flow->key' exists in 'dpif':
+ * - If a flow matching 'flow->key' exists in 'xfif':
  *
  *     Stores 0 into 'flow->stats.error' and stores statistics for the flow
  *     into 'flow->stats'.
@@ -747,7 +747,7 @@ dpif_flow_get(const struct dpif *dpif, struct odp_flow *flow)
  *
  * - Flow-specific errors are indicated by a positive errno value in
  *   'flow->stats.error'.  In particular, ENOENT indicates that no flow
- *   matching 'flow->key' exists in 'dpif'.  When an error value is stored, the
+ *   matching 'flow->key' exists in 'xfif'.  When an error value is stored, the
  *   contents of 'flow->key' are preserved but other members of 'flow' should
  *   be treated as indeterminate.
  *
@@ -758,89 +758,89 @@ dpif_flow_get(const struct dpif *dpif, struct odp_flow *flow)
  * 'flows' being updated or not updated.
  */
 int
-dpif_flow_get_multiple(const struct dpif *dpif,
-                       struct odp_flow flows[], size_t n)
+xfif_flow_get_multiple(const struct xfif *xfif,
+                       struct xflow_flow flows[], size_t n)
 {
     int error;
     size_t i;
 
-    COVERAGE_ADD(dpif_flow_get, n);
+    COVERAGE_ADD(xfif_flow_get, n);
 
     for (i = 0; i < n; i++) {
-        check_rw_odp_flow(&flows[i]);
+        check_rw_xflow_flow(&flows[i]);
     }
 
-    error = dpif->dpif_class->flow_get(dpif, flows, n);
-    log_operation(dpif, "flow_get_multiple", error);
+    error = xfif->xfif_class->flow_get(xfif, flows, n);
+    log_operation(xfif, "flow_get_multiple", error);
     return error;
 }
 
-/* Adds or modifies a flow in 'dpif' as specified in 'put':
+/* Adds or modifies a flow in 'xfif' as specified in 'put':
  *
- * - If the flow specified in 'put->flow' does not exist in 'dpif', then
- *   behavior depends on whether ODPPF_CREATE is specified in 'put->flags': if
+ * - If the flow specified in 'put->flow' does not exist in 'xfif', then
+ *   behavior depends on whether XFLOWPF_CREATE is specified in 'put->flags': if
  *   it is, the flow will be added, otherwise the operation will fail with
  *   ENOENT.
  *
- * - Otherwise, the flow specified in 'put->flow' does exist in 'dpif'.
- *   Behavior in this case depends on whether ODPPF_MODIFY is specified in
+ * - Otherwise, the flow specified in 'put->flow' does exist in 'xfif'.
+ *   Behavior in this case depends on whether XFLOWPF_MODIFY is specified in
  *   'put->flags': if it is, the flow's actions will be updated, otherwise the
  *   operation will fail with EEXIST.  If the flow's actions are updated, then
- *   its statistics will be zeroed if ODPPF_ZERO_STATS is set in 'put->flags',
+ *   its statistics will be zeroed if XFLOWPF_ZERO_STATS is set in 'put->flags',
  *   left as-is otherwise.
  *
  * Returns 0 if successful, otherwise a positive errno value.
  */
 int
-dpif_flow_put(struct dpif *dpif, struct odp_flow_put *put)
+xfif_flow_put(struct xfif *xfif, struct xflow_flow_put *put)
 {
     int error;
 
-    COVERAGE_INC(dpif_flow_put);
+    COVERAGE_INC(xfif_flow_put);
 
-    error = dpif->dpif_class->flow_put(dpif, put);
+    error = xfif->xfif_class->flow_put(xfif, put);
     if (should_log_flow_message(error)) {
-        log_flow_put(dpif, error, put);
+        log_flow_put(xfif, error, put);
     }
     return error;
 }
 
-/* Deletes a flow matching 'flow->key' from 'dpif' or returns ENOENT if 'dpif'
+/* Deletes a flow matching 'flow->key' from 'xfif' or returns ENOENT if 'xfif'
  * does not contain such a flow.
  *
  * If successful, updates 'flow->stats', 'flow->n_actions', and 'flow->actions'
- * as described for dpif_flow_get(). */
+ * as described for xfif_flow_get(). */
 int
-dpif_flow_del(struct dpif *dpif, struct odp_flow *flow)
+xfif_flow_del(struct xfif *xfif, struct xflow_flow *flow)
 {
     int error;
 
-    COVERAGE_INC(dpif_flow_del);
+    COVERAGE_INC(xfif_flow_del);
 
-    check_rw_odp_flow(flow);
+    check_rw_xflow_flow(flow);
     memset(&flow->stats, 0, sizeof flow->stats);
 
-    error = dpif->dpif_class->flow_del(dpif, flow);
+    error = xfif->xfif_class->flow_del(xfif, flow);
     if (should_log_flow_message(error)) {
-        log_flow_operation(dpif, "delete flow", error, flow);
+        log_flow_operation(xfif, "delete flow", error, flow);
     }
     return error;
 }
 
-/* Stores up to 'n' flows in 'dpif' into 'flows', including their statistics
+/* Stores up to 'n' flows in 'xfif' into 'flows', including their statistics
  * but not including any information about their actions.  If successful,
  * returns 0 and sets '*n_out' to the number of flows actually present in
- * 'dpif', which might be greater than the number stored (if 'dpif' has more
+ * 'xfif', which might be greater than the number stored (if 'xfif' has more
  * than 'n' flows).  On failure, returns a negative errno value and sets
  * '*n_out' to 0. */
 int
-dpif_flow_list(const struct dpif *dpif, struct odp_flow flows[], size_t n,
+xfif_flow_list(const struct xfif *xfif, struct xflow_flow flows[], size_t n,
                size_t *n_out)
 {
     uint32_t i;
     int retval;
 
-    COVERAGE_INC(dpif_flow_query_list);
+    COVERAGE_INC(xfif_flow_query_list);
     if (RUNNING_ON_VALGRIND) {
         memset(flows, 0, n * sizeof *flows);
     } else {
@@ -849,22 +849,22 @@ dpif_flow_list(const struct dpif *dpif, struct odp_flow flows[], size_t n,
             flows[i].n_actions = 0;
         }
     }
-    retval = dpif->dpif_class->flow_list(dpif, flows, n);
+    retval = xfif->xfif_class->flow_list(xfif, flows, n);
     if (retval < 0) {
         *n_out = 0;
         VLOG_WARN_RL(&error_rl, "%s: flow list failed (%s)",
-                     dpif_name(dpif), strerror(-retval));
+                     xfif_name(xfif), strerror(-retval));
         return -retval;
     } else {
-        COVERAGE_ADD(dpif_flow_query_list_n, retval);
+        COVERAGE_ADD(xfif_flow_query_list_n, retval);
         *n_out = MIN(n, retval);
         VLOG_DBG_RL(&dpmsg_rl, "%s: listed %zu flows (of %d)",
-                    dpif_name(dpif), *n_out, retval);
+                    xfif_name(xfif), *n_out, retval);
         return 0;
     }
 }
 
-/* Retrieves all of the flows in 'dpif'.
+/* Retrieves all of the flows in 'xfif'.
  *
  * If successful, returns 0 and stores in '*flowsp' a pointer to a newly
  * allocated array of flows, including their statistics but not including any
@@ -875,24 +875,24 @@ dpif_flow_list(const struct dpif *dpif, struct odp_flow flows[], size_t n,
  * On failure, returns a positive errno value and sets '*flowsp' to NULL and
  * '*np' to 0. */
 int
-dpif_flow_list_all(const struct dpif *dpif,
-                   struct odp_flow **flowsp, size_t *np)
+xfif_flow_list_all(const struct xfif *xfif,
+                   struct xflow_flow **flowsp, size_t *np)
 {
-    struct odp_stats stats;
-    struct odp_flow *flows;
+    struct xflow_stats stats;
+    struct xflow_flow *flows;
     size_t n_flows;
     int error;
 
     *flowsp = NULL;
     *np = 0;
 
-    error = dpif_get_dp_stats(dpif, &stats);
+    error = xfif_get_xf_stats(xfif, &stats);
     if (error) {
         return error;
     }
 
     flows = xmalloc(sizeof *flows * stats.n_flows);
-    error = dpif_flow_list(dpif, flows, stats.n_flows, &n_flows);
+    error = xfif_flow_list(xfif, flows, stats.n_flows, &n_flows);
     if (error) {
         free(flows);
         return error;
@@ -901,32 +901,32 @@ dpif_flow_list_all(const struct dpif *dpif,
     if (stats.n_flows != n_flows) {
         VLOG_WARN_RL(&error_rl, "%s: datapath stats reported %"PRIu32" "
                      "flows but flow listing reported %zu",
-                     dpif_name(dpif), stats.n_flows, n_flows);
+                     xfif_name(xfif), stats.n_flows, n_flows);
     }
     *flowsp = flows;
     *np = n_flows;
     return 0;
 }
 
-/* Causes 'dpif' to perform the 'n_actions' actions in 'actions' on the
+/* Causes 'xfif' to perform the 'n_actions' actions in 'actions' on the
  * Ethernet frame specified in 'packet'.
  *
  * Pretends that the frame was originally received on the port numbered
- * 'in_port'.  This affects only ODPAT_OUTPUT_GROUP actions, which will not
+ * 'in_port'.  This affects only XFLOWAT_OUTPUT_GROUP actions, which will not
  * send a packet out their input port.  Specify the number of an unused port
  * (e.g. UINT16_MAX is currently always unused) to avoid this behavior.
  *
  * Returns 0 if successful, otherwise a positive errno value. */
 int
-dpif_execute(struct dpif *dpif, uint16_t in_port,
-             const union odp_action actions[], size_t n_actions,
+xfif_execute(struct xfif *xfif, uint16_t in_port,
+             const union xflow_action actions[], size_t n_actions,
              const struct ofpbuf *buf)
 {
     int error;
 
-    COVERAGE_INC(dpif_execute);
+    COVERAGE_INC(xfif_execute);
     if (n_actions > 0) {
-        error = dpif->dpif_class->execute(dpif, in_port, actions,
+        error = xfif->xfif_class->execute(xfif, in_port, actions,
                                           n_actions, buf);
     } else {
         error = 0;
@@ -935,8 +935,8 @@ dpif_execute(struct dpif *dpif, uint16_t in_port,
     if (!(error ? VLOG_DROP_WARN(&error_rl) : VLOG_DROP_DBG(&dpmsg_rl))) {
         struct ds ds = DS_EMPTY_INITIALIZER;
         char *packet = ofp_packet_to_string(buf->data, buf->size, buf->size);
-        ds_put_format(&ds, "%s: execute ", dpif_name(dpif));
-        format_odp_actions(&ds, actions, n_actions);
+        ds_put_format(&ds, "%s: execute ", xfif_name(xfif));
+        format_xflow_actions(&ds, actions, n_actions);
         if (error) {
             ds_put_format(&ds, " failed (%s)", strerror(error));
         }
@@ -948,28 +948,28 @@ dpif_execute(struct dpif *dpif, uint16_t in_port,
     return error;
 }
 
-/* Retrieves 'dpif''s "listen mask" into '*listen_mask'.  Each ODPL_* bit set
- * in '*listen_mask' indicates that dpif_recv() will receive messages of that
+/* Retrieves 'xfif''s "listen mask" into '*listen_mask'.  Each XFLOWL_* bit set
+ * in '*listen_mask' indicates that xfif_recv() will receive messages of that
  * type.  Returns 0 if successful, otherwise a positive errno value. */
 int
-dpif_recv_get_mask(const struct dpif *dpif, int *listen_mask)
+xfif_recv_get_mask(const struct xfif *xfif, int *listen_mask)
 {
-    int error = dpif->dpif_class->recv_get_mask(dpif, listen_mask);
+    int error = xfif->xfif_class->recv_get_mask(xfif, listen_mask);
     if (error) {
         *listen_mask = 0;
     }
-    log_operation(dpif, "recv_get_mask", error);
+    log_operation(xfif, "recv_get_mask", error);
     return error;
 }
 
-/* Sets 'dpif''s "listen mask" to 'listen_mask'.  Each ODPL_* bit set in
- * '*listen_mask' requests that dpif_recv() receive messages of that type.
+/* Sets 'xfif''s "listen mask" to 'listen_mask'.  Each XFLOWL_* bit set in
+ * '*listen_mask' requests that xfif_recv() receive messages of that type.
  * Returns 0 if successful, otherwise a positive errno value. */
 int
-dpif_recv_set_mask(struct dpif *dpif, int listen_mask)
+xfif_recv_set_mask(struct xfif *xfif, int listen_mask)
 {
-    int error = dpif->dpif_class->recv_set_mask(dpif, listen_mask);
-    log_operation(dpif, "recv_set_mask", error);
+    int error = xfif->xfif_class->recv_set_mask(xfif, listen_mask);
+    log_operation(xfif, "recv_set_mask", error);
     return error;
 }
 
@@ -978,17 +978,17 @@ dpif_recv_set_mask(struct dpif *dpif, int listen_mask)
  * the probability of sampling a given packet.
  *
  * Returns 0 if successful, otherwise a positive errno value.  EOPNOTSUPP
- * indicates that 'dpif' does not support sFlow sampling. */
+ * indicates that 'xfif' does not support sFlow sampling. */
 int
-dpif_get_sflow_probability(const struct dpif *dpif, uint32_t *probability)
+xfif_get_sflow_probability(const struct xfif *xfif, uint32_t *probability)
 {
-    int error = (dpif->dpif_class->get_sflow_probability
-                 ? dpif->dpif_class->get_sflow_probability(dpif, probability)
+    int error = (xfif->xfif_class->get_sflow_probability
+                 ? xfif->xfif_class->get_sflow_probability(xfif, probability)
                  : EOPNOTSUPP);
     if (error) {
         *probability = 0;
     }
-    log_operation(dpif, "get_sflow_probability", error);
+    log_operation(xfif, "get_sflow_probability", error);
     return error;
 }
 
@@ -997,41 +997,41 @@ dpif_get_sflow_probability(const struct dpif *dpif, uint32_t *probability)
  * the probability of sampling a given packet.
  *
  * Returns 0 if successful, otherwise a positive errno value.  EOPNOTSUPP
- * indicates that 'dpif' does not support sFlow sampling. */
+ * indicates that 'xfif' does not support sFlow sampling. */
 int
-dpif_set_sflow_probability(struct dpif *dpif, uint32_t probability)
+xfif_set_sflow_probability(struct xfif *xfif, uint32_t probability)
 {
-    int error = (dpif->dpif_class->set_sflow_probability
-                 ? dpif->dpif_class->set_sflow_probability(dpif, probability)
+    int error = (xfif->xfif_class->set_sflow_probability
+                 ? xfif->xfif_class->set_sflow_probability(xfif, probability)
                  : EOPNOTSUPP);
-    log_operation(dpif, "set_sflow_probability", error);
+    log_operation(xfif, "set_sflow_probability", error);
     return error;
 }
 
-/* Attempts to receive a message from 'dpif'.  If successful, stores the
+/* Attempts to receive a message from 'xfif'.  If successful, stores the
  * message into '*packetp'.  The message, if one is received, will begin with
- * 'struct odp_msg' as a header.  Only messages of the types selected with
- * dpif_set_listen_mask() will ordinarily be received (but if a message type is
+ * 'struct xflow_msg' as a header.  Only messages of the types selected with
+ * xfif_set_listen_mask() will ordinarily be received (but if a message type is
  * enabled and then later disabled, some stragglers might pop up).
  *
  * Returns 0 if successful, otherwise a positive errno value.  Returns EAGAIN
  * if no message is immediately available. */
 int
-dpif_recv(struct dpif *dpif, struct ofpbuf **packetp)
+xfif_recv(struct xfif *xfif, struct ofpbuf **packetp)
 {
-    int error = dpif->dpif_class->recv(dpif, packetp);
+    int error = xfif->xfif_class->recv(xfif, packetp);
     if (!error) {
         if (VLOG_IS_DBG_ENABLED()) {
             struct ofpbuf *buf = *packetp;
-            struct odp_msg *msg = buf->data;
+            struct xflow_msg *msg = buf->data;
             void *payload = msg + 1;
             size_t payload_len = buf->size - sizeof *msg;
             char *s = ofp_packet_to_string(payload, payload_len, payload_len);
             VLOG_DBG_RL(&dpmsg_rl, "%s: received %s message of length "
-                        "%zu on port %"PRIu16": %s", dpif_name(dpif),
-                        (msg->type == _ODPL_MISS_NR ? "miss"
-                         : msg->type == _ODPL_ACTION_NR ? "action"
-                         : msg->type == _ODPL_SFLOW_NR ? "sFlow"
+                        "%zu on port %"PRIu16": %s", xfif_name(xfif),
+                        (msg->type == _XFLOWL_MISS_NR ? "miss"
+                         : msg->type == _XFLOWL_ACTION_NR ? "action"
+                         : msg->type == _XFLOWL_SFLOW_NR ? "sFlow"
                          : "<unknown>"),
                         payload_len, msg->port, s);
             free(s);
@@ -1042,25 +1042,25 @@ dpif_recv(struct dpif *dpif, struct ofpbuf **packetp)
     return error;
 }
 
-/* Discards all messages that would otherwise be received by dpif_recv() on
- * 'dpif'.  Returns 0 if successful, otherwise a positive errno value. */
+/* Discards all messages that would otherwise be received by xfif_recv() on
+ * 'xfif'.  Returns 0 if successful, otherwise a positive errno value. */
 int
-dpif_recv_purge(struct dpif *dpif)
+xfif_recv_purge(struct xfif *xfif)
 {
-    struct odp_stats stats;
+    struct xflow_stats stats;
     unsigned int i;
     int error;
 
-    COVERAGE_INC(dpif_purge);
+    COVERAGE_INC(xfif_purge);
 
-    error = dpif_get_dp_stats(dpif, &stats);
+    error = xfif_get_xf_stats(xfif, &stats);
     if (error) {
         return error;
     }
 
     for (i = 0; i < stats.max_miss_queue + stats.max_action_queue + stats.max_sflow_queue; i++) {
         struct ofpbuf *buf;
-        error = dpif_recv(dpif, &buf);
+        error = xfif_recv(xfif, &buf);
         if (error) {
             return error == EAGAIN ? 0 : error;
         }
@@ -1069,50 +1069,50 @@ dpif_recv_purge(struct dpif *dpif)
     return 0;
 }
 
-/* Arranges for the poll loop to wake up when 'dpif' has a message queued to be
- * received with dpif_recv(). */
+/* Arranges for the poll loop to wake up when 'xfif' has a message queued to be
+ * received with xfif_recv(). */
 void
-dpif_recv_wait(struct dpif *dpif)
+xfif_recv_wait(struct xfif *xfif)
 {
-    dpif->dpif_class->recv_wait(dpif);
+    xfif->xfif_class->recv_wait(xfif);
 }
 
-/* Obtains the NetFlow engine type and engine ID for 'dpif' into '*engine_type'
+/* Obtains the NetFlow engine type and engine ID for 'xfif' into '*engine_type'
  * and '*engine_id', respectively. */
 void
-dpif_get_netflow_ids(const struct dpif *dpif,
+xfif_get_netflow_ids(const struct xfif *xfif,
                      uint8_t *engine_type, uint8_t *engine_id)
 {
-    *engine_type = dpif->netflow_engine_type;
-    *engine_id = dpif->netflow_engine_id;
+    *engine_type = xfif->netflow_engine_type;
+    *engine_id = xfif->netflow_engine_id;
 }
 \f
 void
-dpif_init(struct dpif *dpif, const struct dpif_class *dpif_class,
+xfif_init(struct xfif *xfif, const struct xfif_class *xfif_class,
           const char *name,
           uint8_t netflow_engine_type, uint8_t netflow_engine_id)
 {
-    dpif->dpif_class = dpif_class;
-    dpif->base_name = xstrdup(name);
-    dpif->full_name = xasprintf("%s@%s", dpif_class->type, name);
-    dpif->netflow_engine_type = netflow_engine_type;
-    dpif->netflow_engine_id = netflow_engine_id;
+    xfif->xfif_class = xfif_class;
+    xfif->base_name = xstrdup(name);
+    xfif->full_name = xasprintf("%s@%s", xfif_class->type, name);
+    xfif->netflow_engine_type = netflow_engine_type;
+    xfif->netflow_engine_id = netflow_engine_id;
 }
 
 /* Undoes the results of initialization.
  *
- * Normally this function only needs to be called from dpif_close().
+ * Normally this function only needs to be called from xfif_close().
  * However, it may be called by providers due to an error on opening
- * that occurs after initialization.  It this case dpif_close() would
+ * that occurs after initialization.  It this case xfif_close() would
  * never be called. */
 void
-dpif_uninit(struct dpif *dpif, bool close)
+xfif_uninit(struct xfif *xfif, bool close)
 {
-    char *base_name = dpif->base_name;
-    char *full_name = dpif->full_name;
+    char *base_name = xfif->base_name;
+    char *full_name = xfif->full_name;
 
     if (close) {
-        dpif->dpif_class->close(dpif);
+        xfif->xfif_class->close(xfif);
     }
 
     free(base_name);
@@ -1120,13 +1120,13 @@ dpif_uninit(struct dpif *dpif, bool close)
 }
 \f
 static void
-log_operation(const struct dpif *dpif, const char *operation, int error)
+log_operation(const struct xfif *xfif, const char *operation, int error)
 {
     if (!error) {
-        VLOG_DBG_RL(&dpmsg_rl, "%s: %s success", dpif_name(dpif), operation);
+        VLOG_DBG_RL(&dpmsg_rl, "%s: %s success", xfif_name(xfif), operation);
     } else {
         VLOG_WARN_RL(&error_rl, "%s: %s failed (%s)",
-                     dpif_name(dpif), operation, strerror(error));
+                     xfif_name(xfif), operation, strerror(error));
     }
 }
 
@@ -1144,13 +1144,13 @@ should_log_flow_message(int error)
 }
 
 static void
-log_flow_message(const struct dpif *dpif, int error, const char *operation,
-                 const struct odp_flow_key *flow,
-                 const struct odp_flow_stats *stats,
-                 const union odp_action *actions, size_t n_actions)
+log_flow_message(const struct xfif *xfif, int error, const char *operation,
+                 const struct xflow_key *flow,
+                 const struct xflow_flow_stats *stats,
+                 const union xflow_action *actions, size_t n_actions)
 {
     struct ds ds = DS_EMPTY_INITIALIZER;
-    ds_put_format(&ds, "%s: ", dpif_name(dpif));
+    ds_put_format(&ds, "%s: ", xfif_name(xfif));
     if (error) {
         ds_put_cstr(&ds, "failed to ");
     }
@@ -1158,58 +1158,58 @@ log_flow_message(const struct dpif *dpif, int error, const char *operation,
     if (error) {
         ds_put_format(&ds, "(%s) ", strerror(error));
     }
-    format_odp_flow_key(&ds, flow);
+    format_xflow_key(&ds, flow);
     if (stats) {
         ds_put_cstr(&ds, ", ");
-        format_odp_flow_stats(&ds, stats);
+        format_xflow_flow_stats(&ds, stats);
     }
     if (actions || n_actions) {
         ds_put_cstr(&ds, ", actions:");
-        format_odp_actions(&ds, actions, n_actions);
+        format_xflow_actions(&ds, actions, n_actions);
     }
     vlog(THIS_MODULE, flow_message_log_level(error), "%s", ds_cstr(&ds));
     ds_destroy(&ds);
 }
 
 static void
-log_flow_operation(const struct dpif *dpif, const char *operation, int error,
-                   struct odp_flow *flow)
+log_flow_operation(const struct xfif *xfif, const char *operation, int error,
+                   struct xflow_flow *flow)
 {
     if (error) {
         flow->n_actions = 0;
     }
-    log_flow_message(dpif, error, operation, &flow->key,
+    log_flow_message(xfif, error, operation, &flow->key,
                      !error ? &flow->stats : NULL,
                      flow->actions, flow->n_actions);
 }
 
 static void
-log_flow_put(struct dpif *dpif, int error, const struct odp_flow_put *put)
+log_flow_put(struct xfif *xfif, int error, const struct xflow_flow_put *put)
 {
-    enum { ODPPF_ALL = ODPPF_CREATE | ODPPF_MODIFY | ODPPF_ZERO_STATS };
+    enum { XFLOWPF_ALL = XFLOWPF_CREATE | XFLOWPF_MODIFY | XFLOWPF_ZERO_STATS };
     struct ds s;
 
     ds_init(&s);
     ds_put_cstr(&s, "put");
-    if (put->flags & ODPPF_CREATE) {
+    if (put->flags & XFLOWPF_CREATE) {
         ds_put_cstr(&s, "[create]");
     }
-    if (put->flags & ODPPF_MODIFY) {
+    if (put->flags & XFLOWPF_MODIFY) {
         ds_put_cstr(&s, "[modify]");
     }
-    if (put->flags & ODPPF_ZERO_STATS) {
+    if (put->flags & XFLOWPF_ZERO_STATS) {
         ds_put_cstr(&s, "[zero]");
     }
-    if (put->flags & ~ODPPF_ALL) {
-        ds_put_format(&s, "[%x]", put->flags & ~ODPPF_ALL);
+    if (put->flags & ~XFLOWPF_ALL) {
+        ds_put_format(&s, "[%x]", put->flags & ~XFLOWPF_ALL);
     }
-    log_flow_message(dpif, error, ds_cstr(&s), &put->flow.key,
+    log_flow_message(xfif, error, ds_cstr(&s), &put->flow.key,
                      !error ? &put->flow.stats : NULL,
                      put->flow.actions, put->flow.n_actions);
     ds_destroy(&s);
 }
 
-/* There is a tendency to construct odp_flow objects on the stack and to
+/* There is a tendency to construct xflow_flow objects on the stack and to
  * forget to properly initialize their "actions" and "n_actions" members.
  * When this happens, we get memory corruption because the kernel
  * writes through the random pointer that is in the "actions" member.
@@ -1226,7 +1226,7 @@ log_flow_put(struct dpif *dpif, int error, const struct odp_flow_put *put)
  *        "actions" or "n_actions" was not initialized.
  */
 static void
-check_rw_odp_flow(struct odp_flow *flow)
+check_rw_xflow_flow(struct xflow_flow *flow)
 {
     if (flow->n_actions) {
         memset(&flow->actions[0], 0xcc, sizeof flow->actions[0]);
diff --git a/lib/xfif.h b/lib/xfif.h
new file mode 100644 (file)
index 0000000..da82344
--- /dev/null
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2008, 2009, 2010 Nicira Networks.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef DPIF_H
+#define DPIF_H 1
+
+#include "openvswitch/xflow.h"
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+struct xfif;
+struct ofpbuf;
+struct svec;
+struct xfif_class;
+
+void xf_run(void);
+void xf_wait(void);
+
+int xf_register_provider(const struct xfif_class *);
+int xf_unregister_provider(const char *type);
+void xf_enumerate_types(struct svec *types);
+
+int xf_enumerate_names(const char *type, struct svec *names);
+void xf_parse_name(const char *datapath_name, char **name, char **type);
+
+int xfif_open(const char *name, const char *type, struct xfif **);
+int xfif_create(const char *name, const char *type, struct xfif **);
+int xfif_create_and_open(const char *name, const char *type, struct xfif **);
+void xfif_close(struct xfif *);
+
+const char *xfif_name(const struct xfif *);
+const char *xfif_base_name(const struct xfif *);
+int xfif_get_all_names(const struct xfif *, struct svec *);
+
+int xfif_delete(struct xfif *);
+
+int xfif_get_xf_stats(const struct xfif *, struct xflow_stats *);
+int xfif_get_drop_frags(const struct xfif *, bool *drop_frags);
+int xfif_set_drop_frags(struct xfif *, bool drop_frags);
+
+int xfif_port_add(struct xfif *, const char *devname, uint16_t flags,
+                  uint16_t *port_no);
+int xfif_port_del(struct xfif *, uint16_t port_no);
+int xfif_port_query_by_number(const struct xfif *, uint16_t port_no,
+                              struct xflow_port *);
+int xfif_port_query_by_name(const struct xfif *, const char *devname,
+                            struct xflow_port *);
+int xfif_port_get_name(struct xfif *, uint16_t port_no,
+                       char *name, size_t name_size);
+int xfif_port_list(const struct xfif *, struct xflow_port **, size_t *n_ports);
+
+int xfif_port_poll(const struct xfif *, char **devnamep);
+void xfif_port_poll_wait(const struct xfif *);
+
+int xfif_port_group_get(const struct xfif *, uint16_t group,
+                        uint16_t **ports, size_t *n_ports);
+int xfif_port_group_set(struct xfif *, uint16_t group,
+                        const uint16_t ports[], size_t n_ports);
+
+int xfif_flow_flush(struct xfif *);
+int xfif_flow_put(struct xfif *, struct xflow_flow_put *);
+int xfif_flow_del(struct xfif *, struct xflow_flow *);
+int xfif_flow_get(const struct xfif *, struct xflow_flow *);
+int xfif_flow_get_multiple(const struct xfif *, struct xflow_flow[], size_t n);
+int xfif_flow_list(const struct xfif *, struct xflow_flow[], size_t n,
+                   size_t *n_out);
+int xfif_flow_list_all(const struct xfif *,
+                       struct xflow_flow **flowsp, size_t *np);
+
+int xfif_execute(struct xfif *, uint16_t in_port,
+                 const union xflow_action[], size_t n_actions,
+                 const struct ofpbuf *);
+
+int xfif_recv_get_mask(const struct xfif *, int *listen_mask);
+int xfif_recv_set_mask(struct xfif *, int listen_mask);
+int xfif_get_sflow_probability(const struct xfif *, uint32_t *probability);
+int xfif_set_sflow_probability(struct xfif *, uint32_t probability);
+int xfif_recv(struct xfif *, struct ofpbuf **);
+int xfif_recv_purge(struct xfif *);
+void xfif_recv_wait(struct xfif *);
+
+void xfif_get_netflow_ids(const struct xfif *,
+                          uint8_t *engine_type, uint8_t *engine_id);
+
+#ifdef  __cplusplus
+}
+#endif
+
+#endif /* xfif.h */
similarity index 100%
rename from lib/dpif.man
rename to lib/xfif.man
similarity index 77%
rename from lib/odp-util.c
rename to lib/xflow-util.c
index aeeda3b..60452cd 100644 (file)
@@ -15,7 +15,7 @@
  */
 
 #include <config.h>
-#include "odp-util.h"
+#include "xflow-util.h"
 #include <inttypes.h>
 #include <stdlib.h>
 #include <string.h>
 #include "timeval.h"
 #include "util.h"
 
-union odp_action *
-odp_actions_add(struct odp_actions *actions, uint16_t type)
+union xflow_action *
+xflow_actions_add(struct xflow_actions *actions, uint16_t type)
 {
-    union odp_action *a;
-    if (actions->n_actions < MAX_ODP_ACTIONS) {
+    union xflow_action *a;
+    if (actions->n_actions < MAX_XFLOW_ACTIONS) {
         a = &actions->actions[actions->n_actions++];
     } else {
-        COVERAGE_INC(odp_overflow);
-        actions->n_actions = MAX_ODP_ACTIONS + 1;
-        a = &actions->actions[MAX_ODP_ACTIONS - 1];
+        COVERAGE_INC(xflow_overflow);
+        actions->n_actions = MAX_XFLOW_ACTIONS + 1;
+        a = &actions->actions[MAX_XFLOW_ACTIONS - 1];
     }
     memset(a, 0, sizeof *a);
     a->type = type;
@@ -43,7 +43,7 @@ odp_actions_add(struct odp_actions *actions, uint16_t type)
 }
 
 void
-format_odp_flow_key(struct ds *ds, const struct odp_flow_key *key)
+format_xflow_key(struct ds *ds, const struct xflow_key *key)
 {
     ds_put_format(ds, "in_port%04x", key->in_port);
     if (key->dl_tci) {
@@ -60,48 +60,48 @@ format_odp_flow_key(struct ds *ds, const struct odp_flow_key *key)
 }
 
 void
-format_odp_action(struct ds *ds, const union odp_action *a)
+format_xflow_action(struct ds *ds, const union xflow_action *a)
 {
     switch (a->type) {
-    case ODPAT_OUTPUT:
+    case XFLOWAT_OUTPUT:
         ds_put_format(ds, "%"PRIu16, a->output.port);
         break;
-    case ODPAT_OUTPUT_GROUP:
+    case XFLOWAT_OUTPUT_GROUP:
         ds_put_format(ds, "g%"PRIu16, a->output_group.group);
         break;
-    case ODPAT_CONTROLLER:
+    case XFLOWAT_CONTROLLER:
         ds_put_format(ds, "ctl(%"PRIu32")", a->controller.arg);
         break;
-    case ODPAT_SET_DL_TCI:
+    case XFLOWAT_SET_DL_TCI:
         ds_put_format(ds, "set_tci(%04"PRIx16",mask=%04"PRIx16")",
                       ntohs(a->dl_tci.tci), ntohs(a->dl_tci.mask));
         break;
-    case ODPAT_STRIP_VLAN:
+    case XFLOWAT_STRIP_VLAN:
         ds_put_format(ds, "strip_vlan");
         break;
-    case ODPAT_SET_DL_SRC:
+    case XFLOWAT_SET_DL_SRC:
         ds_put_format(ds, "set_dl_src("ETH_ADDR_FMT")",
                ETH_ADDR_ARGS(a->dl_addr.dl_addr));
         break;
-    case ODPAT_SET_DL_DST:
+    case XFLOWAT_SET_DL_DST:
         ds_put_format(ds, "set_dl_dst("ETH_ADDR_FMT")",
                ETH_ADDR_ARGS(a->dl_addr.dl_addr));
         break;
-    case ODPAT_SET_NW_SRC:
+    case XFLOWAT_SET_NW_SRC:
         ds_put_format(ds, "set_nw_src("IP_FMT")",
                       IP_ARGS(&a->nw_addr.nw_addr));
         break;
-    case ODPAT_SET_NW_DST:
+    case XFLOWAT_SET_NW_DST:
         ds_put_format(ds, "set_nw_dst("IP_FMT")",
                       IP_ARGS(&a->nw_addr.nw_addr));
         break;
-    case ODPAT_SET_NW_TOS:
+    case XFLOWAT_SET_NW_TOS:
         ds_put_format(ds, "set_nw_tos(%"PRIu8")", a->nw_tos.nw_tos);
         break;
-    case ODPAT_SET_TP_SRC:
+    case XFLOWAT_SET_TP_SRC:
         ds_put_format(ds, "set_tp_src(%"PRIu16")", ntohs(a->tp_port.tp_port));
         break;
-    case ODPAT_SET_TP_DST:
+    case XFLOWAT_SET_TP_DST:
         ds_put_format(ds, "set_tp_dst(%"PRIu16")", ntohs(a->tp_port.tp_port));
         break;
     default:
@@ -111,7 +111,7 @@ format_odp_action(struct ds *ds, const union odp_action *a)
 }
 
 void
-format_odp_actions(struct ds *ds, const union odp_action *actions,
+format_xflow_actions(struct ds *ds, const union xflow_action *actions,
                    size_t n_actions)
 {
     size_t i;
@@ -119,7 +119,7 @@ format_odp_actions(struct ds *ds, const union odp_action *actions,
         if (i) {
             ds_put_char(ds, ',');
         }
-        format_odp_action(ds, &actions[i]);
+        format_xflow_action(ds, &actions[i]);
     }
     if (!n_actions) {
         ds_put_cstr(ds, "drop");
@@ -127,7 +127,7 @@ format_odp_actions(struct ds *ds, const union odp_action *actions,
 }
 
 void
-format_odp_flow_stats(struct ds *ds, const struct odp_flow_stats *s)
+format_xflow_flow_stats(struct ds *ds, const struct xflow_flow_stats *s)
 {
     ds_put_format(ds, "packets:%llu, bytes:%llu, used:",
                   (unsigned long long int) s->n_packets,
@@ -141,17 +141,17 @@ format_odp_flow_stats(struct ds *ds, const struct odp_flow_stats *s)
 }
 
 void
-format_odp_flow(struct ds *ds, const struct odp_flow *f)
+format_xflow_flow(struct ds *ds, const struct xflow_flow *f)
 {
-    format_odp_flow_key(ds, &f->key);
+    format_xflow_key(ds, &f->key);
     ds_put_cstr(ds, ", ");
-    format_odp_flow_stats(ds, &f->stats);
+    format_xflow_flow_stats(ds, &f->stats);
     ds_put_cstr(ds, ", actions:");
-    format_odp_actions(ds, f->actions, f->n_actions);
+    format_xflow_actions(ds, f->actions, f->n_actions);
 }
 \f
 void
-odp_flow_key_from_flow(struct odp_flow_key *key, const struct flow *flow)
+xflow_key_from_flow(struct xflow_key *key, const struct flow *flow)
 {
     key->nw_src = flow->nw_src;
     key->nw_dst = flow->nw_dst;
@@ -162,7 +162,7 @@ odp_flow_key_from_flow(struct odp_flow_key *key, const struct flow *flow)
         uint16_t vid = flow->dl_vlan & htons(VLAN_VID_MASK);
         uint16_t pcp = htons((flow->dl_vlan_pcp << VLAN_PCP_SHIFT)
                              & VLAN_PCP_MASK);
-        key->dl_tci = vid | pcp | htons(ODP_TCI_PRESENT);
+        key->dl_tci = vid | pcp | htons(XFLOW_TCI_PRESENT);
     }
     key->dl_type = flow->dl_type;
     key->tp_src = flow->tp_src;
@@ -171,11 +171,10 @@ odp_flow_key_from_flow(struct odp_flow_key *key, const struct flow *flow)
     memcpy(key->dl_dst, flow->dl_dst, ETH_ALEN);
     key->nw_proto = flow->nw_proto;
     key->nw_tos = flow->nw_tos;
-    memset(key->reserved, 0, sizeof key->reserved);
 }
 
 void
-odp_flow_key_to_flow(const struct odp_flow_key *key, struct flow *flow)
+xflow_key_to_flow(const struct xflow_key *key, struct flow *flow)
 {
     flow->nw_src = key->nw_src;
     flow->nw_dst = key->nw_dst;
similarity index 53%
rename from lib/odp-util.h
rename to lib/xflow-util.h
index 4c9cb91..55da492 100644 (file)
  * limitations under the License.
  */
 
-#ifndef ODP_UTIL_H
-#define ODP_UTIL_H 1
+#ifndef XFLOW_UTIL_H
+#define XFLOW_UTIL_H 1
 
 #include <stdbool.h>
 #include <stdint.h>
 #include <string.h>
 #include "hash.h"
 #include "openflow/openflow.h"
-#include "openvswitch/datapath-protocol.h"
+#include "openvswitch/xflow.h"
 
 struct ds;
 struct flow;
 
 /* The kernel datapaths limits actions to those that fit in a single page of
  * memory, so there is no point in allocating more than that.  */
-enum { MAX_ODP_ACTIONS = 4096 / sizeof(union odp_action) };
+enum { MAX_XFLOW_ACTIONS = 4096 / sizeof(union xflow_action) };
 
-struct odp_actions {
+struct xflow_actions {
     size_t n_actions;
-    union odp_action actions[MAX_ODP_ACTIONS];
+    union xflow_action actions[MAX_XFLOW_ACTIONS];
 };
 
 static inline void
-odp_actions_init(struct odp_actions *actions)
+xflow_actions_init(struct xflow_actions *actions)
 {
     actions->n_actions = 0;
 }
 
-union odp_action *odp_actions_add(struct odp_actions *actions, uint16_t type);
+union xflow_action *xflow_actions_add(struct xflow_actions *actions, uint16_t type);
 
 static inline bool
-odp_actions_overflow(const struct odp_actions *actions)
+xflow_actions_overflow(const struct xflow_actions *actions)
 {
-    return actions->n_actions > MAX_ODP_ACTIONS;
+    return actions->n_actions > MAX_XFLOW_ACTIONS;
 }
 
 static inline uint16_t
-ofp_port_to_odp_port(uint16_t ofp_port)
+ofp_port_to_xflow_port(uint16_t ofp_port)
 {
     switch (ofp_port) {
     case OFPP_LOCAL:
-        return ODPP_LOCAL;
+        return XFLOWP_LOCAL;
     case OFPP_NONE:
-        return ODPP_NONE;
+        return XFLOWP_NONE;
     default:
         return ofp_port;
     }
 }
 
 static inline uint16_t
-odp_port_to_ofp_port(uint16_t odp_port)
+xflow_port_to_ofp_port(uint16_t xflow_port)
 {
-    switch (odp_port) {
-    case ODPP_LOCAL:
+    switch (xflow_port) {
+    case XFLOWP_LOCAL:
         return OFPP_LOCAL;
-    case ODPP_NONE:
+    case XFLOWP_NONE:
         return OFPP_NONE;
     default:
-        return odp_port;
+        return xflow_port;
     }
 }
 
-void format_odp_flow_key(struct ds *, const struct odp_flow_key *);
-void format_odp_action(struct ds *, const union odp_action *);
-void format_odp_actions(struct ds *, const union odp_action *actions,
+void format_xflow_key(struct ds *, const struct xflow_key *);
+void format_xflow_action(struct ds *, const union xflow_action *);
+void format_xflow_actions(struct ds *, const union xflow_action *actions,
                         size_t n_actions);
-void format_odp_flow_stats(struct ds *, const struct odp_flow_stats *);
-void format_odp_flow(struct ds *, const struct odp_flow *);
+void format_xflow_flow_stats(struct ds *, const struct xflow_flow_stats *);
+void format_xflow_flow(struct ds *, const struct xflow_flow *);
 
-void odp_flow_key_from_flow(struct odp_flow_key *, const struct flow *);
-void odp_flow_key_to_flow(const struct odp_flow_key *, struct flow *);
+void xflow_key_from_flow(struct xflow_key *, const struct flow *);
+void xflow_key_to_flow(const struct xflow_key *, struct flow *);
 
 static inline bool
-odp_flow_key_equal(const struct odp_flow_key *a, const struct odp_flow_key *b)
+xflow_key_equal(const struct xflow_key *a, const struct xflow_key *b)
 {
     return !memcmp(a, b, sizeof *a);
 }
 
 static inline size_t
-odp_flow_key_hash(const struct odp_flow_key *flow, uint32_t basis)
+xflow_key_hash(const struct xflow_key *flow, uint32_t basis)
 {
     BUILD_ASSERT_DECL(!(sizeof *flow % sizeof(uint32_t)));
     return hash_words((const uint32_t *) flow,
                       sizeof *flow / sizeof(uint32_t), basis);
 }
 
-#endif /* odp-util.h */
+#endif /* xflow-util.h */
index ae36b4d..5a81dac 100644 (file)
 #include <string.h>
 #include "dhcp-client.h"
 #include "dhcp.h"
-#include "dpif.h"
 #include "netdev.h"
 #include "openflow/openflow.h"
 #include "packets.h"
 #include "status.h"
 #include "stream-ssl.h"
+#include "xfif.h"
 
 #define THIS_MODULE VLM_discovery
 #include "vlog.h"
@@ -95,7 +95,7 @@ discovery_status_cb(struct status_reply *sr, void *d_)
 
 int
 discovery_create(const char *re, bool update_resolv_conf,
-                 struct dpif *dpif, struct switch_status *ss,
+                 struct xfif *xfif, struct switch_status *ss,
                  struct discovery **discoveryp)
 {
     struct discovery *d;
@@ -112,7 +112,7 @@ discovery_create(const char *re, bool update_resolv_conf,
     d->update_resolv_conf = update_resolv_conf;
 
     /* Initialize DHCP client. */
-    error = dpif_port_get_name(dpif, ODPP_LOCAL,
+    error = xfif_port_get_name(xfif, XFLOWP_LOCAL,
                                local_name, sizeof local_name);
     if (error) {
         VLOG_ERR("failed to query datapath local port: %s", strerror(error));
index 98ff5b8..2ede899 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2009 Nicira Networks.
+ * Copyright (c) 2008, 2009, 2010 Nicira Networks.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 
 #include <stdbool.h>
 
-struct dpif;
+struct xfif;
 struct discovery;
 struct settings;
 struct switch_status;
 
 int discovery_create(const char *accept_controller_re, bool update_resolv_conf,
-                     struct dpif *, struct switch_status *,
+                     struct xfif *, struct switch_status *,
                      struct discovery **);
 void discovery_destroy(struct discovery *);
 void discovery_set_update_resolv_conf(struct discovery *,
index ff77de8..8f11bb2 100644 (file)
@@ -20,7 +20,7 @@
 #include <stdlib.h>
 #include "flow.h"
 #include "mac-learning.h"
-#include "odp-util.h"
+#include "xflow-util.h"
 #include "ofpbuf.h"
 #include "ofproto.h"
 #include "pktbuf.h"
index 857618f..a152bf0 100644 (file)
 #include <string.h>
 #include <stdlib.h>
 #include "dhcp.h"
-#include "dpif.h"
 #include "flow.h"
 #include "mac-learning.h"
 #include "netdev.h"
-#include "odp-util.h"
+#include "xflow-util.h"
 #include "ofp-print.h"
 #include "ofproto.h"
 #include "ofpbuf.h"
 #include "openflow/openflow.h"
-#include "openvswitch/datapath-protocol.h"
+#include "openvswitch/xflow.h"
 #include "packets.h"
 #include "poll-loop.h"
 #include "rconn.h"
 #include "status.h"
 #include "timeval.h"
 #include "vconn.h"
+#include "xfif.h"
 
 #define THIS_MODULE VLM_in_band
 #include "vlog.h"
@@ -421,7 +421,7 @@ in_band_msg_in_hook(struct in_band *in_band, const flow_t *flow,
  * allowed to be set up in the datapath. */
 bool
 in_band_rule_check(struct in_band *in_band, const flow_t *flow,
-                   const struct odp_actions *actions)
+                   const struct xflow_actions *actions)
 {
     if (!in_band) {
         return true;
@@ -436,8 +436,8 @@ in_band_rule_check(struct in_band *in_band, const flow_t *flow,
         int i;
 
         for (i=0; i<actions->n_actions; i++) {
-            if (actions->actions[i].output.type == ODPAT_OUTPUT 
-                    && actions->actions[i].output.port == ODPP_LOCAL) {
+            if (actions->actions[i].output.type == XFLOWAT_OUTPUT 
+                    && actions->actions[i].output.port == XFLOWP_LOCAL) {
                 return true;
             }   
         }
@@ -475,7 +475,7 @@ in_band_run(struct in_band *in_band)
     if (local_mac) {
         /* Allow DHCP requests to be sent from the local port. */
         memset(&flow, 0, sizeof flow);
-        flow.in_port = ODPP_LOCAL;
+        flow.in_port = XFLOWP_LOCAL;
         flow.dl_type = htons(ETH_TYPE_IP);
         memcpy(flow.dl_src, local_mac, ETH_ADDR_LEN);
         flow.nw_proto = IP_TYPE_UDP;
@@ -600,7 +600,7 @@ in_band_flushed(struct in_band *in_band)
 }
 
 int
-in_band_create(struct ofproto *ofproto, struct dpif *dpif,
+in_band_create(struct ofproto *ofproto, struct xfif *xfif,
                struct switch_status *ss, struct rconn *controller, 
                struct in_band **in_bandp)
 {
@@ -609,7 +609,7 @@ in_band_create(struct ofproto *ofproto, struct dpif *dpif,
     struct netdev *local_netdev;
     int error;
 
-    error = dpif_port_get_name(dpif, ODPP_LOCAL,
+    error = xfif_port_get_name(xfif, XFLOWP_LOCAL,
                                local_name, sizeof local_name);
     if (error) {
         VLOG_ERR("failed to initialize in-band control: cannot get name "
index ddbc5e5..08d49c9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2009 Nicira Networks.
+ * Copyright (c) 2008, 2009, 2010 Nicira Networks.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 
 #include "flow.h"
 
-struct dpif;
+struct xfif;
 struct in_band;
-struct odp_actions;
+struct xflow_actions;
 struct ofproto;
 struct rconn;
 struct settings;
 struct switch_status;
 
-int in_band_create(struct ofproto *, struct dpif *, struct switch_status *,
+int in_band_create(struct ofproto *, struct xfif *, struct switch_status *,
                    struct rconn *controller, struct in_band **);
 void in_band_destroy(struct in_band *);
 void in_band_run(struct in_band *);
 bool in_band_msg_in_hook(struct in_band *, const flow_t *, 
                          const struct ofpbuf *packet);
 bool in_band_rule_check(struct in_band *, const flow_t *,
-                        const struct odp_actions *);
+                        const struct xflow_actions *);
 void in_band_wait(struct in_band *);
 void in_band_flushed(struct in_band *);
 
index cd216ea..b530bd0 100644 (file)
@@ -20,7 +20,6 @@
 #include <inttypes.h>
 #include <stdlib.h>
 #include "collectors.h"
-#include "dpif.h"
 #include "compiler.h"
 #include "netdev.h"
 #include "ofpbuf.h"
@@ -31,6 +30,7 @@
 #include "sflow_api.h"
 #include "socket-util.h"
 #include "timeval.h"
+#include "xfif.h"
 
 #define THIS_MODULE VLM_sflow
 #include "vlog.h"
@@ -45,10 +45,10 @@ struct ofproto_sflow {
     struct collectors *collectors;
     SFLAgent *sflow_agent;
     struct ofproto_sflow_options *options;
-    struct dpif *dpif;
+    struct xfif *xfif;
     time_t next_tick;
     size_t n_flood, n_all;
-    struct port_array ports;    /* Indexed by ODP port number. */
+    struct port_array ports;    /* Indexed by XFLOW port number. */
 };
 
 #define RECEIVER_INDEX 1
@@ -241,7 +241,7 @@ void
 ofproto_sflow_clear(struct ofproto_sflow *os)
 {
     struct ofproto_sflow_port *osp;
-    unsigned int odp_port;
+    unsigned int xflow_port;
 
     if (os->sflow_agent) {
         sfl_agent_release(os->sflow_agent);
@@ -252,13 +252,13 @@ ofproto_sflow_clear(struct ofproto_sflow *os)
     ofproto_sflow_options_destroy(os->options);
     os->options = NULL;
 
-    PORT_ARRAY_FOR_EACH (osp, &os->ports, odp_port) {
-        ofproto_sflow_del_port(os, odp_port);
+    PORT_ARRAY_FOR_EACH (osp, &os->ports, xflow_port) {
+        ofproto_sflow_del_port(os, xflow_port);
     }
     port_array_clear(&os->ports);
 
     /* Turn off sampling to save CPU cycles. */
-    dpif_set_sflow_probability(os->dpif, 0);
+    xfif_set_sflow_probability(os->xfif, 0);
 }
 
 bool
@@ -268,12 +268,12 @@ ofproto_sflow_is_enabled(const struct ofproto_sflow *os)
 }
 
 struct ofproto_sflow *
-ofproto_sflow_create(struct dpif *dpif)
+ofproto_sflow_create(struct xfif *xfif)
 {
     struct ofproto_sflow *os;
 
     os = xcalloc(1, sizeof *os);
-    os->dpif = dpif;
+    os->xfif = xfif;
     os->next_tick = time_now() + 1;
     port_array_init(&os->ports);
     return os;
@@ -291,13 +291,13 @@ ofproto_sflow_destroy(struct ofproto_sflow *os)
 
 static void
 ofproto_sflow_add_poller(struct ofproto_sflow *os,
-                         struct ofproto_sflow_port *osp, uint16_t odp_port)
+                         struct ofproto_sflow_port *osp, uint16_t xflow_port)
 {
     SFLPoller *poller = sfl_agent_addPoller(os->sflow_agent, &osp->dsi, os,
                                             sflow_agent_get_counters);
     sfl_poller_set_sFlowCpInterval(poller, os->options->polling_interval);
     sfl_poller_set_sFlowCpReceiver(poller, RECEIVER_INDEX);
-    sfl_poller_set_bridgePort(poller, odp_port);
+    sfl_poller_set_bridgePort(poller, xflow_port);
 }
 
 static void
@@ -312,7 +312,7 @@ ofproto_sflow_add_sampler(struct ofproto_sflow *os,
 }
 
 void
-ofproto_sflow_add_port(struct ofproto_sflow *os, uint16_t odp_port,
+ofproto_sflow_add_port(struct ofproto_sflow *os, uint16_t xflow_port,
                        const char *netdev_name)
 {
     struct ofproto_sflow_port *osp;
@@ -320,7 +320,7 @@ ofproto_sflow_add_port(struct ofproto_sflow *os, uint16_t odp_port,
     uint32_t ifindex;
     int error;
 
-    ofproto_sflow_del_port(os, odp_port);
+    ofproto_sflow_del_port(os, xflow_port);
 
     /* Open network device. */
     error = netdev_open_default(netdev_name, &netdev);
@@ -335,21 +335,21 @@ ofproto_sflow_add_port(struct ofproto_sflow *os, uint16_t odp_port,
     osp->netdev = netdev;
     ifindex = netdev_get_ifindex(netdev);
     if (ifindex <= 0) {
-        ifindex = (os->sflow_agent->subId << 16) + odp_port;
+        ifindex = (os->sflow_agent->subId << 16) + xflow_port;
     }
     SFL_DS_SET(osp->dsi, 0, ifindex, 0);
-    port_array_set(&os->ports, odp_port, osp);
+    port_array_set(&os->ports, xflow_port, osp);
 
     /* Add poller. */
     if (os->sflow_agent) {
-        ofproto_sflow_add_poller(os, osp, odp_port);
+        ofproto_sflow_add_poller(os, osp, xflow_port);
     }
 }
 
 void
-ofproto_sflow_del_port(struct ofproto_sflow *os, uint16_t odp_port)
+ofproto_sflow_del_port(struct ofproto_sflow *os, uint16_t xflow_port)
 {
-    struct ofproto_sflow_port *osp = port_array_get(&os->ports, odp_port);
+    struct ofproto_sflow_port *osp = port_array_get(&os->ports, xflow_port);
     if (osp) {
         if (os->sflow_agent) {
             sfl_agent_removePoller(os->sflow_agent, &osp->dsi);
@@ -357,7 +357,7 @@ ofproto_sflow_del_port(struct ofproto_sflow *os, uint16_t odp_port)
         }
         netdev_close(osp->netdev);
         free(osp);
-        port_array_set(&os->ports, odp_port, NULL);
+        port_array_set(&os->ports, xflow_port, NULL);
     }
 }
 
@@ -368,7 +368,7 @@ ofproto_sflow_set_options(struct ofproto_sflow *os,
     struct ofproto_sflow_port *osp;
     bool options_changed;
     SFLReceiver *receiver;
-    unsigned int odp_port;
+    unsigned int xflow_port;
     SFLAddress agentIP;
     time_t now;
 
@@ -435,48 +435,48 @@ ofproto_sflow_set_options(struct ofproto_sflow *os,
     sfl_receiver_set_sFlowRcvrTimeout(receiver, 0xffffffff);
 
     /* Set the sampling_rate down in the datapath. */
-    dpif_set_sflow_probability(os->dpif,
+    xfif_set_sflow_probability(os->xfif,
                                MAX(1, UINT32_MAX / options->sampling_rate));
 
     /* Add samplers and pollers for the currently known ports. */
-    PORT_ARRAY_FOR_EACH (osp, &os->ports, odp_port) {
+    PORT_ARRAY_FOR_EACH (osp, &os->ports, xflow_port) {
         ofproto_sflow_add_sampler(os, osp,
                                   options->sampling_rate, options->header_len);
     }
 }
 
 static int
-ofproto_sflow_odp_port_to_ifindex(const struct ofproto_sflow *os,
-                                  uint16_t odp_port)
+ofproto_sflow_xflow_port_to_ifindex(const struct ofproto_sflow *os,
+                                  uint16_t xflow_port)
 {
-    struct ofproto_sflow_port *osp = port_array_get(&os->ports, odp_port);
+    struct ofproto_sflow_port *osp = port_array_get(&os->ports, xflow_port);
     return osp ? SFL_DS_INDEX(osp->dsi) : 0;
 }
 
 void
-ofproto_sflow_received(struct ofproto_sflow *os, struct odp_msg *msg)
+ofproto_sflow_received(struct ofproto_sflow *os, struct xflow_msg *msg)
 {
     SFL_FLOW_SAMPLE_TYPE fs;
     SFLFlow_sample_element hdrElem;
     SFLSampled_header *header;
     SFLFlow_sample_element switchElem;
     SFLSampler *sampler;
-    const struct odp_sflow_sample_header *hdr;
-    const union odp_action *actions;
+    const struct xflow_sflow_sample_header *hdr;
+    const union xflow_action *actions;
     struct ofpbuf payload;
     size_t n_actions, n_outputs;
     size_t min_size;
     flow_t flow;
     size_t i;
 
-    /* Get odp_sflow_sample_header. */
+    /* Get xflow_sflow_sample_header. */
     min_size = sizeof *msg + sizeof *hdr;
     if (min_size > msg->length) {
         VLOG_WARN_RL(&rl, "sFlow packet too small (%"PRIu32" < %zu)",
                      msg->length, min_size);
         return;
     }
-    hdr = (const struct odp_sflow_sample_header *) (msg + 1);
+    hdr = (const struct xflow_sflow_sample_header *) (msg + 1);
 
     /* Get actions. */
     n_actions = hdr->n_actions;
@@ -492,16 +492,16 @@ ofproto_sflow_received(struct ofproto_sflow *os, struct odp_msg *msg)
                      n_actions, msg->length, min_size);
         return;
     }
-    actions = (const union odp_action *) (hdr + 1);
+    actions = (const union xflow_action *) (hdr + 1);
 
     /* Get packet payload and extract flow. */
-    payload.data = (union odp_action *) (actions + n_actions);
+    payload.data = (union xflow_action *) (actions + n_actions);
     payload.size = msg->length - min_size;
     flow_extract(&payload, msg->port, &flow);
 
     /* Build a flow sample */
     memset(&fs, 0, sizeof fs);
-    fs.input = ofproto_sflow_odp_port_to_ifindex(os, msg->port);
+    fs.input = ofproto_sflow_xflow_port_to_ifindex(os, msg->port);
     fs.output = 0;              /* Filled in correctly below. */
     fs.sample_pool = hdr->sample_pool;
 
@@ -537,21 +537,21 @@ ofproto_sflow_received(struct ofproto_sflow *os, struct odp_msg *msg)
     /* Figure out the output ports. */
     n_outputs = 0;
     for (i = 0; i < n_actions; i++) {
-        const union odp_action *a = &actions[i];
+        const union xflow_action *a = &actions[i];
 
         switch (a->type) {
-        case ODPAT_OUTPUT:
-            fs.output = ofproto_sflow_odp_port_to_ifindex(os, a->output.port);
+        case XFLOWAT_OUTPUT:
+            fs.output = ofproto_sflow_xflow_port_to_ifindex(os, a->output.port);
             n_outputs++;
             break;
 
-        case ODPAT_OUTPUT_GROUP:
+        case XFLOWAT_OUTPUT_GROUP:
             n_outputs += (a->output_group.group == DP_GROUP_FLOOD ? os->n_flood
                           : a->output_group.group == DP_GROUP_ALL ? os->n_all
                           : 0);
             break;
 
-        case ODPAT_SET_DL_TCI:
+        case XFLOWAT_SET_DL_TCI:
             if (a->dl_tci.mask & htons(VLAN_VID_MASK)) {
                 switchElem.flowType.sw.dst_vlan = vlan_tci_to_vid(a->dl_tci.tci);
             }
index ec86d11..d6521a6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009 InMon Corp.
+ * Copyright (c) 2009, 2010 InMon Corp.
  * Copyright (c) 2009 Nicira Networks.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
 #include <stdint.h>
 #include "svec.h"
 
-struct dpif;
-struct odp_msg;
+struct xfif;
+struct xflow_msg;
 struct ofproto_sflow_options;
 
-struct ofproto_sflow *ofproto_sflow_create(struct dpif *);
+struct ofproto_sflow *ofproto_sflow_create(struct xfif *);
 void ofproto_sflow_destroy(struct ofproto_sflow *);
 void ofproto_sflow_set_options(struct ofproto_sflow *,
                                const struct ofproto_sflow_options *);
 void ofproto_sflow_clear(struct ofproto_sflow *);
 bool ofproto_sflow_is_enabled(const struct ofproto_sflow *);
 
-void ofproto_sflow_add_port(struct ofproto_sflow *, uint16_t odp_port,
+void ofproto_sflow_add_port(struct ofproto_sflow *, uint16_t xflow_port,
                             const char *netdev_name);
-void ofproto_sflow_del_port(struct ofproto_sflow *, uint16_t odp_port);
+void ofproto_sflow_del_port(struct ofproto_sflow *, uint16_t xflow_port);
 void ofproto_sflow_set_group_sizes(struct ofproto_sflow *,
                                    size_t n_flood, size_t n_all);
 
 void ofproto_sflow_run(struct ofproto_sflow *);
 void ofproto_sflow_wait(struct ofproto_sflow *);
 
-void ofproto_sflow_received(struct ofproto_sflow *, struct odp_msg *);
+void ofproto_sflow_received(struct ofproto_sflow *, struct xflow_msg *);
 
 #endif /* ofproto/ofproto-sflow.h */
index e868e92..1d3b897 100644 (file)
 #include "classifier.h"
 #include "coverage.h"
 #include "discovery.h"
-#include "dpif.h"
 #include "dynamic-string.h"
 #include "fail-open.h"
 #include "in-band.h"
 #include "mac-learning.h"
 #include "netdev.h"
 #include "netflow.h"
-#include "odp-util.h"
+#include "xflow-util.h"
 #include "ofp-print.h"
 #include "ofproto-sflow.h"
 #include "ofpbuf.h"
 #include "openflow/nicira-ext.h"
 #include "openflow/openflow.h"
-#include "openvswitch/datapath-protocol.h"
+#include "openvswitch/xflow.h"
 #include "packets.h"
 #include "pinsched.h"
 #include "pktbuf.h"
@@ -54,6 +53,7 @@
 #include "timeval.h"
 #include "unixctl.h"
 #include "vconn.h"
+#include "xfif.h"
 #include "xtoxll.h"
 
 #define THIS_MODULE VLM_ofproto
@@ -77,7 +77,7 @@ static void hton_ofp_phy_port(struct ofp_phy_port *);
 static int xlate_actions(const union ofp_action *in, size_t n_in,
                          const flow_t *flow, struct ofproto *ofproto,
                          const struct ofpbuf *packet,
-                         struct odp_actions *out, tag_type *tags,
+                         struct xflow_actions *out, tag_type *tags,
                          bool *may_set_up_flow, uint16_t *nf_output_iface);
 
 struct rule {
@@ -115,13 +115,13 @@ struct rule {
 
     /* Datapath actions.
      *
-     * A super-rule with wildcard fields never has ODP actions (since the
+     * A super-rule with wildcard fields never has XFLOW actions (since the
      * datapath only supports exact-match flows). */
     bool installed;             /* Installed in datapath? */
     bool may_install;           /* True ordinarily; false if actions must
                                  * be reassessed for every packet. */
-    int n_odp_actions;
-    union odp_action *odp_actions;
+    int n_xflow_actions;
+    union xflow_action *xflow_actions;
 };
 
 static inline bool
@@ -194,9 +194,9 @@ struct ofproto {
     char *dp_desc;              /* Datapath description. */
 
     /* Datapath. */
-    struct dpif *dpif;
+    struct xfif *xfif;
     struct netdev_monitor *netdev_monitor;
-    struct port_array ports;    /* Index is ODP port nr; ofport->opp.port_no is
+    struct port_array ports;    /* Index is XFLOW port nr; ofport->opp.port_no is
                                  * OFP port nr. */
     struct shash port_by_name;
     uint32_t max_ports;
@@ -243,13 +243,13 @@ static void send_packet_in_miss(struct ofpbuf *, void *ofproto);
 static void send_packet_in_action(struct ofpbuf *, void *ofproto);
 static void update_used(struct ofproto *);
 static void update_stats(struct ofproto *, struct rule *,
-                         const struct odp_flow_stats *);
+                         const struct xflow_flow_stats *);
 static void expire_rule(struct cls_rule *, void *ofproto);
 static void active_timeout(struct ofproto *ofproto, struct rule *rule);
 static bool revalidate_rule(struct ofproto *p, struct rule *rule);
 static void revalidate_cb(struct cls_rule *rule_, void *p_);
 
-static void handle_odp_msg(struct ofproto *, struct ofpbuf *);
+static void handle_xflow_msg(struct ofproto *, struct ofpbuf *);
 
 static void handle_openflow(struct ofconn *, struct ofproto *,
                             struct ofpbuf *);
@@ -265,35 +265,35 @@ ofproto_create(const char *datapath, const char *datapath_type,
                const struct ofhooks *ofhooks, void *aux,
                struct ofproto **ofprotop)
 {
-    struct odp_stats stats;
+    struct xflow_stats stats;
     struct ofproto *p;
-    struct dpif *dpif;
+    struct xfif *xfif;
     int error;
 
     *ofprotop = NULL;
 
     /* Connect to datapath and start listening for messages. */
-    error = dpif_open(datapath, datapath_type, &dpif);
+    error = xfif_open(datapath, datapath_type, &xfif);
     if (error) {
         VLOG_ERR("failed to open datapath %s: %s", datapath, strerror(error));
         return error;
     }
-    error = dpif_get_dp_stats(dpif, &stats);
+    error = xfif_get_xf_stats(xfif, &stats);
     if (error) {
         VLOG_ERR("failed to obtain stats for datapath %s: %s",
                  datapath, strerror(error));
-        dpif_close(dpif);
+        xfif_close(xfif);
         return error;
     }
-    error = dpif_recv_set_mask(dpif, ODPL_MISS | ODPL_ACTION | ODPL_SFLOW);
+    error = xfif_recv_set_mask(xfif, XFLOWL_MISS | XFLOWL_ACTION | XFLOWL_SFLOW);
     if (error) {
         VLOG_ERR("failed to listen on datapath %s: %s",
                  datapath, strerror(error));
-        dpif_close(dpif);
+        xfif_close(xfif);
         return error;
     }
-    dpif_flow_flush(dpif);
-    dpif_recv_purge(dpif);
+    xfif_flow_flush(xfif);
+    xfif_recv_purge(xfif);
 
     /* Initialize settings. */
     p = xzalloc(sizeof *p);
@@ -306,7 +306,7 @@ ofproto_create(const char *datapath, const char *datapath_type,
     p->dp_desc = xstrdup(DEFAULT_DP_DESC);
 
     /* Initialize datapath. */
-    p->dpif = dpif;
+    p->xfif = xfif;
     p->netdev_monitor = netdev_monitor_create();
     port_array_init(&p->ports);
     shash_init(&p->port_by_name);
@@ -444,7 +444,7 @@ ofproto_set_in_band(struct ofproto *p, bool in_band)
 {
     if (in_band != (p->in_band != NULL)) {
         if (in_band) {
-            return in_band_create(p, p->dpif, p->switch_status,
+            return in_band_create(p, p->xfif, p->switch_status,
                                   p->controller->rconn, &p->in_band);
         } else {
             ofproto_set_discovery(p, false, NULL, true);
@@ -467,7 +467,7 @@ ofproto_set_discovery(struct ofproto *p, bool discovery,
                 return error;
             }
             error = discovery_create(re, update_resolv_conf,
-                                     p->dpif, p->switch_status,
+                                     p->xfif, p->switch_status,
                                      &p->discovery);
             if (error) {
                 return error;
@@ -575,12 +575,12 @@ ofproto_set_sflow(struct ofproto *ofproto,
     if (oso) {
         if (!os) {
             struct ofport *ofport;
-            unsigned int odp_port;
+            unsigned int xflow_port;
 
-            os = ofproto->sflow = ofproto_sflow_create(ofproto->dpif);
+            os = ofproto->sflow = ofproto_sflow_create(ofproto->xfif);
             refresh_port_groups(ofproto);
-            PORT_ARRAY_FOR_EACH (ofport, &ofproto->ports, odp_port) {
-                ofproto_sflow_add_port(os, odp_port,
+            PORT_ARRAY_FOR_EACH (ofport, &ofproto->ports, xflow_port) {
+                ofproto_sflow_add_port(os, xflow_port,
                                        netdev_get_name(ofport->netdev));
             }
         }
@@ -725,7 +725,7 @@ ofproto_destroy(struct ofproto *p)
         ofconn_destroy(ofconn);
     }
 
-    dpif_close(p->dpif);
+    xfif_close(p->xfif);
     netdev_monitor_destroy(p->netdev_monitor);
     PORT_ARRAY_FOR_EACH (ofport, &p->ports, port_no) {
         ofport_free(ofport);
@@ -802,7 +802,7 @@ ofproto_run1(struct ofproto *p)
         struct ofpbuf *buf;
         int error;
 
-        error = dpif_recv(p->dpif, &buf);
+        error = xfif_recv(p->xfif, &buf);
         if (error) {
             if (error == ENODEV) {
                 /* Someone destroyed the datapath behind our back.  The caller
@@ -810,16 +810,16 @@ ofproto_run1(struct ofproto *p)
                  * spin from here on out. */
                 static struct vlog_rate_limit rl2 = VLOG_RATE_LIMIT_INIT(1, 5);
                 VLOG_ERR_RL(&rl2, "%s: datapath was destroyed externally",
-                            dpif_name(p->dpif));
+                            xfif_name(p->xfif));
                 return ENODEV;
             }
             break;
         }
 
-        handle_odp_msg(p, buf);
+        handle_xflow_msg(p, buf);
     }
 
-    while ((error = dpif_port_poll(p->dpif, &devname)) != EAGAIN) {
+    while ((error = xfif_port_poll(p->xfif, &devname)) != EAGAIN) {
         process_port_change(p, error, devname);
     }
     while ((error = netdev_monitor_poll(p->netdev_monitor,
@@ -939,8 +939,8 @@ ofproto_wait(struct ofproto *p)
     struct ofconn *ofconn;
     size_t i;
 
-    dpif_recv_wait(p->dpif);
-    dpif_port_poll_wait(p->dpif);
+    xfif_recv_wait(p->xfif);
+    xfif_port_poll_wait(p->xfif);
     netdev_monitor_poll_wait(p->netdev_monitor);
     LIST_FOR_EACH (ofconn, struct ofconn, node, &p->all_conns) {
         ofconn_wait(ofconn);
@@ -1000,19 +1000,19 @@ ofproto_send_packet(struct ofproto *p, const flow_t *flow,
                     const union ofp_action *actions, size_t n_actions,
                     const struct ofpbuf *packet)
 {
-    struct odp_actions odp_actions;
+    struct xflow_actions xflow_actions;
     int error;
 
-    error = xlate_actions(actions, n_actions, flow, p, packet, &odp_actions,
+    error = xlate_actions(actions, n_actions, flow, p, packet, &xflow_actions,
                           NULL, NULL, NULL);
     if (error) {
         return error;
     }
 
-    /* XXX Should we translate the dpif_execute() errno value into an OpenFlow
+    /* XXX Should we translate the xfif_execute() errno value into an OpenFlow
      * error code? */
-    dpif_execute(p->dpif, flow->in_port, odp_actions.actions,
-                 odp_actions.n_actions, packet);
+    xfif_execute(p->xfif, flow->in_port, xflow_actions.actions,
+                 xflow_actions.n_actions, packet);
     return 0;
 }
 
@@ -1053,7 +1053,7 @@ destroy_rule(struct cls_rule *rule_, void *ofproto_)
     /* Mark the flow as not installed, even though it might really be
      * installed, so that rule_remove() doesn't bother trying to uninstall it.
      * There is no point in uninstalling it individually since we are about to
-     * blow away all the flows with dpif_flow_flush(). */
+     * blow away all the flows with xfif_flow_flush(). */
     rule->installed = false;
 
     rule_remove(ofproto, rule);
@@ -1064,7 +1064,7 @@ ofproto_flush_flows(struct ofproto *ofproto)
 {
     COVERAGE_INC(ofproto_flush);
     classifier_for_each(&ofproto->cls, CLS_INC_ALL, destroy_rule, ofproto);
-    dpif_flow_flush(ofproto->dpif);
+    xfif_flow_flush(ofproto->xfif);
     if (ofproto->in_band) {
         in_band_flushed(ofproto->in_band);
     }
@@ -1079,19 +1079,19 @@ reinit_ports(struct ofproto *p)
     struct svec devnames;
     struct ofport *ofport;
     unsigned int port_no;
-    struct odp_port *odp_ports;
-    size_t n_odp_ports;
+    struct xflow_port *xflow_ports;
+    size_t n_xflow_ports;
     size_t i;
 
     svec_init(&devnames);
     PORT_ARRAY_FOR_EACH (ofport, &p->ports, port_no) {
         svec_add (&devnames, (char *) ofport->opp.name);
     }
-    dpif_port_list(p->dpif, &odp_ports, &n_odp_ports);
-    for (i = 0; i < n_odp_ports; i++) {
-        svec_add (&devnames, odp_ports[i].devname);
+    xfif_port_list(p->xfif, &xflow_ports, &n_xflow_ports);
+    for (i = 0; i < n_xflow_ports; i++) {
+        svec_add (&devnames, xflow_ports[i].devname);
     }
-    free(odp_ports);
+    free(xflow_ports);
 
     svec_sort_unique(&devnames);
     for (i = 0; i < devnames.n; i++) {
@@ -1117,7 +1117,7 @@ refresh_port_group(struct ofproto *p, unsigned int group)
             ports[n_ports++] = port_no;
         }
     }
-    dpif_port_group_set(p->dpif, group, ports, n_ports);
+    xfif_port_group_set(p->xfif, group, ports, n_ports);
     free(ports);
 
     return n_ports;
@@ -1134,7 +1134,7 @@ refresh_port_groups(struct ofproto *p)
 }
 
 static struct ofport *
-make_ofport(const struct odp_port *odp_port)
+make_ofport(const struct xflow_port *xflow_port)
 {
     struct netdev_options netdev_options;
     enum netdev_flags flags;
@@ -1144,7 +1144,7 @@ make_ofport(const struct odp_port *odp_port)
     int error;
 
     memset(&netdev_options, 0, sizeof netdev_options);
-    netdev_options.name = odp_port->devname;
+    netdev_options.name = xflow_port->devname;
     netdev_options.ethertype = NETDEV_ETH_TYPE_NONE;
     netdev_options.may_open = true;
 
@@ -1152,17 +1152,17 @@ make_ofport(const struct odp_port *odp_port)
     if (error) {
         VLOG_WARN_RL(&rl, "ignoring port %s (%"PRIu16") because netdev %s "
                      "cannot be opened (%s)",
-                     odp_port->devname, odp_port->port,
-                     odp_port->devname, strerror(error));
+                     xflow_port->devname, xflow_port->port,
+                     xflow_port->devname, strerror(error));
         return NULL;
     }
 
     ofport = xmalloc(sizeof *ofport);
     ofport->netdev = netdev;
-    ofport->opp.port_no = odp_port_to_ofp_port(odp_port->port);
+    ofport->opp.port_no = xflow_port_to_ofp_port(xflow_port->port);
     netdev_get_etheraddr(netdev, ofport->opp.hw_addr);
-    memcpy(ofport->opp.name, odp_port->devname,
-           MIN(sizeof ofport->opp.name, sizeof odp_port->devname));
+    memcpy(ofport->opp.name, xflow_port->devname,
+           MIN(sizeof ofport->opp.name, sizeof xflow_port->devname));
     ofport->opp.name[sizeof ofport->opp.name - 1] = '\0';
 
     netdev_get_flags(netdev, &flags);
@@ -1178,15 +1178,15 @@ make_ofport(const struct odp_port *odp_port)
 }
 
 static bool
-ofport_conflicts(const struct ofproto *p, const struct odp_port *odp_port)
+ofport_conflicts(const struct ofproto *p, const struct xflow_port *xflow_port)
 {
-    if (port_array_get(&p->ports, odp_port->port)) {
+    if (port_array_get(&p->ports, xflow_port->port)) {
         VLOG_WARN_RL(&rl, "ignoring duplicate port %"PRIu16" in datapath",
-                     odp_port->port);
+                     xflow_port->port);
         return true;
-    } else if (shash_find(&p->port_by_name, odp_port->devname)) {
+    } else if (shash_find(&p->port_by_name, xflow_port->devname)) {
         VLOG_WARN_RL(&rl, "ignoring duplicate device %s in datapath",
-                     odp_port->devname);
+                     xflow_port->devname);
         return true;
     } else {
         return false;
@@ -1235,28 +1235,28 @@ send_port_status(struct ofproto *p, const struct ofport *ofport,
 static void
 ofport_install(struct ofproto *p, struct ofport *ofport)
 {
-    uint16_t odp_port = ofp_port_to_odp_port(ofport->opp.port_no);
+    uint16_t xflow_port = ofp_port_to_xflow_port(ofport->opp.port_no);
     const char *netdev_name = (const char *) ofport->opp.name;
 
     netdev_monitor_add(p->netdev_monitor, ofport->netdev);
-    port_array_set(&p->ports, odp_port, ofport);
+    port_array_set(&p->ports, xflow_port, ofport);
     shash_add(&p->port_by_name, netdev_name, ofport);
     if (p->sflow) {
-        ofproto_sflow_add_port(p->sflow, odp_port, netdev_name);
+        ofproto_sflow_add_port(p->sflow, xflow_port, netdev_name);
     }
 }
 
 static void
 ofport_remove(struct ofproto *p, struct ofport *ofport)
 {
-    uint16_t odp_port = ofp_port_to_odp_port(ofport->opp.port_no);
+    uint16_t xflow_port = ofp_port_to_xflow_port(ofport->opp.port_no);
 
     netdev_monitor_remove(p->netdev_monitor, ofport->netdev);
-    port_array_set(&p->ports, odp_port, NULL);
+    port_array_set(&p->ports, xflow_port, NULL);
     shash_delete(&p->port_by_name,
                  shash_find(&p->port_by_name, (char *) ofport->opp.name));
     if (p->sflow) {
-        ofproto_sflow_del_port(p->sflow, odp_port);
+        ofproto_sflow_del_port(p->sflow, xflow_port);
     }
 }
 
@@ -1272,7 +1272,7 @@ ofport_free(struct ofport *ofport)
 static void
 update_port(struct ofproto *p, const char *devname)
 {
-    struct odp_port odp_port;
+    struct xflow_port xflow_port;
     struct ofport *old_ofport;
     struct ofport *new_ofport;
     int error;
@@ -1280,7 +1280,7 @@ update_port(struct ofproto *p, const char *devname)
     COVERAGE_INC(ofproto_update_port);
 
     /* Query the datapath for port information. */
-    error = dpif_port_query_by_name(p->dpif, devname, &odp_port);
+    error = xfif_port_query_by_name(p->xfif, devname, &xflow_port);
 
     /* Find the old ofport. */
     old_ofport = shash_find_data(&p->port_by_name, devname);
@@ -1296,16 +1296,16 @@ update_port(struct ofproto *p, const char *devname)
              * reliably but more portably by comparing the old port's MAC
              * against the new port's MAC.  However, this code isn't that smart
              * and always sends an OFPPR_MODIFY (XXX). */
-            old_ofport = port_array_get(&p->ports, odp_port.port);
+            old_ofport = port_array_get(&p->ports, xflow_port.port);
         }
     } else if (error != ENOENT && error != ENODEV) {
-        VLOG_WARN_RL(&rl, "dpif_port_query_by_name returned unexpected error "
+        VLOG_WARN_RL(&rl, "xfif_port_query_by_name returned unexpected error "
                      "%s", strerror(error));
         return;
     }
 
     /* Create a new ofport. */
-    new_ofport = !error ? make_ofport(&odp_port) : NULL;
+    new_ofport = !error ? make_ofport(&xflow_port) : NULL;
 
     /* Eliminate a few pathological cases. */
     if (!old_ofport && !new_ofport) {
@@ -1344,20 +1344,20 @@ update_port(struct ofproto *p, const char *devname)
 static int
 init_ports(struct ofproto *p)
 {
-    struct odp_port *ports;
+    struct xflow_port *ports;
     size_t n_ports;
     size_t i;
     int error;
 
-    error = dpif_port_list(p->dpif, &ports, &n_ports);
+    error = xfif_port_list(p->xfif, &ports, &n_ports);
     if (error) {
         return error;
     }
 
     for (i = 0; i < n_ports; i++) {
-        const struct odp_port *odp_port = &ports[i];
-        if (!ofport_conflicts(p, odp_port)) {
-            struct ofport *ofport = make_ofport(odp_port);
+        const struct xflow_port *xflow_port = &ports[i];
+        if (!ofport_conflicts(p, xflow_port)) {
+            struct ofport *ofport = make_ofport(xflow_port);
             if (ofport) {
                 ofport_install(p, ofport);
             }
@@ -1469,7 +1469,7 @@ static void
 rule_free(struct rule *rule)
 {
     free(rule->actions);
-    free(rule->odp_actions);
+    free(rule->xflow_actions);
     free(rule);
 }
 
@@ -1514,7 +1514,7 @@ rule_has_out_port(const struct rule *rule, uint16_t out_port)
 }
 
 /* Executes the actions indicated by 'rule' on 'packet', which is in flow
- * 'flow' and is considered to have arrived on ODP port 'in_port'.
+ * 'flow' and is considered to have arrived on XFLOW port 'in_port'.
  *
  * The flow that 'packet' actually contains does not need to actually match
  * 'rule'; the actions in 'rule' will be applied to it either way.  Likewise,
@@ -1522,24 +1522,24 @@ rule_has_out_port(const struct rule *rule, uint16_t out_port)
  * out whether or not the packet actually matches 'rule'.
  *
  * If 'rule' is an exact-match rule and 'flow' actually equals the rule's flow,
- * the caller must already have accurately composed ODP actions for it given
+ * the caller must already have accurately composed XFLOW actions for it given
  * 'packet' using rule_make_actions().  If 'rule' is a wildcard rule, or if
  * 'rule' is an exact-match rule but 'flow' is not the rule's flow, then this
- * function will compose a set of ODP actions based on 'rule''s OpenFlow
+ * function will compose a set of XFLOW actions based on 'rule''s OpenFlow
  * actions and apply them to 'packet'. */
 static void
 rule_execute(struct ofproto *ofproto, struct rule *rule,
              struct ofpbuf *packet, const flow_t *flow)
 {
-    const union odp_action *actions;
+    const union xflow_action *actions;
     size_t n_actions;
-    struct odp_actions a;
+    struct xflow_actions a;
 
-    /* Grab or compose the ODP actions.
+    /* Grab or compose the XFLOW actions.
      *
      * The special case for an exact-match 'rule' where 'flow' is not the
      * rule's flow is important to avoid, e.g., sending a packet out its input
-     * port simply because the ODP actions were composed for the wrong
+     * port simply because the XFLOW actions were composed for the wrong
      * scenario. */
     if (rule->cr.wc.wildcards || !flow_equal(flow, &rule->cr.flow)) {
         struct rule *super = rule->super ? rule->super : rule;
@@ -1550,14 +1550,14 @@ rule_execute(struct ofproto *ofproto, struct rule *rule,
         actions = a.actions;
         n_actions = a.n_actions;
     } else {
-        actions = rule->odp_actions;
-        n_actions = rule->n_odp_actions;
+        actions = rule->xflow_actions;
+        n_actions = rule->n_xflow_actions;
     }
 
-    /* Execute the ODP actions. */
-    if (!dpif_execute(ofproto->dpif, flow->in_port,
+    /* Execute the XFLOW actions. */
+    if (!xfif_execute(ofproto->xfif, flow->in_port,
                       actions, n_actions, packet)) {
-        struct odp_flow_stats stats;
+        struct xflow_flow_stats stats;
         flow_extract_stats(flow, packet, &stats);
         update_stats(ofproto, rule, &stats);
         rule->used = time_msec();
@@ -1634,7 +1634,7 @@ rule_make_actions(struct ofproto *p, struct rule *rule,
                   const struct ofpbuf *packet)
 {
     const struct rule *super;
-    struct odp_actions a;
+    struct xflow_actions a;
     size_t actions_len;
 
     assert(!rule->cr.wc.wildcards);
@@ -1646,12 +1646,12 @@ rule_make_actions(struct ofproto *p, struct rule *rule,
                   &rule->nf_flow.output_iface);
 
     actions_len = a.n_actions * sizeof *a.actions;
-    if (rule->n_odp_actions != a.n_actions
-        || memcmp(rule->odp_actions, a.actions, actions_len)) {
-        COVERAGE_INC(ofproto_odp_unchanged);
-        free(rule->odp_actions);
-        rule->n_odp_actions = a.n_actions;
-        rule->odp_actions = xmemdup(a.actions, actions_len);
+    if (rule->n_xflow_actions != a.n_actions
+        || memcmp(rule->xflow_actions, a.actions, actions_len)) {
+        COVERAGE_INC(ofproto_xflow_unchanged);
+        free(rule->xflow_actions);
+        rule->n_xflow_actions = a.n_actions;
+        rule->xflow_actions = xmemdup(a.actions, actions_len);
         return true;
     } else {
         return false;
@@ -1660,14 +1660,14 @@ rule_make_actions(struct ofproto *p, struct rule *rule,
 
 static int
 do_put_flow(struct ofproto *ofproto, struct rule *rule, int flags,
-            struct odp_flow_put *put)
+            struct xflow_flow_put *put)
 {
     memset(&put->flow.stats, 0, sizeof put->flow.stats);
-    odp_flow_key_from_flow(&put->flow.key, &rule->cr.flow);
-    put->flow.actions = rule->odp_actions;
-    put->flow.n_actions = rule->n_odp_actions;
+    xflow_key_from_flow(&put->flow.key, &rule->cr.flow);
+    put->flow.actions = rule->xflow_actions;
+    put->flow.n_actions = rule->n_xflow_actions;
     put->flags = flags;
-    return dpif_flow_put(ofproto->dpif, put);
+    return xfif_flow_put(ofproto->xfif, put);
 }
 
 static void
@@ -1676,9 +1676,9 @@ rule_install(struct ofproto *p, struct rule *rule, struct rule *displaced_rule)
     assert(!rule->cr.wc.wildcards);
 
     if (rule->may_install) {
-        struct odp_flow_put put;
+        struct xflow_flow_put put;
         if (!do_put_flow(p, rule,
-                         ODPPF_CREATE | ODPPF_MODIFY | ODPPF_ZERO_STATS,
+                         XFLOWPF_CREATE | XFLOWPF_MODIFY | XFLOWPF_ZERO_STATS,
                          &put)) {
             rule->installed = true;
             if (displaced_rule) {
@@ -1695,9 +1695,9 @@ static void
 rule_reinstall(struct ofproto *ofproto, struct rule *rule)
 {
     if (rule->installed) {
-        struct odp_flow_put put;
+        struct xflow_flow_put put;
         COVERAGE_INC(ofproto_dp_missed);
-        do_put_flow(ofproto, rule, ODPPF_CREATE | ODPPF_MODIFY, &put);
+        do_put_flow(ofproto, rule, XFLOWPF_CREATE | XFLOWPF_MODIFY, &put);
     } else {
         rule_install(ofproto, rule, NULL);
     }
@@ -1715,9 +1715,9 @@ rule_update_actions(struct ofproto *ofproto, struct rule *rule)
     if (rule->may_install) {
         if (rule->installed) {
             if (actions_changed) {
-                struct odp_flow_put put;
-                do_put_flow(ofproto, rule, ODPPF_CREATE | ODPPF_MODIFY
-                                           | ODPPF_ZERO_STATS, &put);
+                struct xflow_flow_put put;
+                do_put_flow(ofproto, rule, XFLOWPF_CREATE | XFLOWPF_MODIFY
+                                           | XFLOWPF_ZERO_STATS, &put);
                 update_stats(ofproto, rule, &put.flow.stats);
 
                 /* Temporarily set the old output iface so that NetFlow
@@ -1745,7 +1745,7 @@ rule_account(struct ofproto *ofproto, struct rule *rule, uint64_t extra_bytes)
         && total_bytes > rule->accounted_bytes)
     {
         ofproto->ofhooks->account_flow_cb(
-            &rule->cr.flow, rule->odp_actions, rule->n_odp_actions,
+            &rule->cr.flow, rule->xflow_actions, rule->n_xflow_actions,
             total_bytes - rule->accounted_bytes, ofproto->aux);
         rule->accounted_bytes = total_bytes;
     }
@@ -1756,13 +1756,13 @@ rule_uninstall(struct ofproto *p, struct rule *rule)
 {
     assert(!rule->cr.wc.wildcards);
     if (rule->installed) {
-        struct odp_flow odp_flow;
+        struct xflow_flow xflow_flow;
 
-        odp_flow_key_from_flow(&odp_flow.key, &rule->cr.flow);
-        odp_flow.actions = NULL;
-        odp_flow.n_actions = 0;
-        if (!dpif_flow_del(p->dpif, &odp_flow)) {
-            update_stats(p, rule, &odp_flow.stats);
+        xflow_key_from_flow(&xflow_flow.key, &rule->cr.flow);
+        xflow_flow.actions = NULL;
+        xflow_flow.n_actions = 0;
+        if (!xfif_flow_del(p->xfif, &xflow_flow)) {
+            update_stats(p, rule, &xflow_flow.stats);
         }
         rule->installed = false;
 
@@ -1922,7 +1922,7 @@ handle_get_config_request(struct ofproto *p, struct ofconn *ofconn,
     bool drop_frags;
 
     /* Figure out flags. */
-    dpif_get_drop_frags(p->dpif, &drop_frags);
+    xfif_get_drop_frags(p->xfif, &drop_frags);
     flags = drop_frags ? OFPC_FRAG_DROP : OFPC_FRAG_NORMAL;
 
     /* Send reply. */
@@ -1950,10 +1950,10 @@ handle_set_config(struct ofproto *p, struct ofconn *ofconn,
     if (ofconn == p->controller) {
         switch (flags & OFPC_FRAG_MASK) {
         case OFPC_FRAG_NORMAL:
-            dpif_set_drop_frags(p->dpif, false);
+            xfif_set_drop_frags(p->xfif, false);
             break;
         case OFPC_FRAG_DROP:
-            dpif_set_drop_frags(p->dpif, true);
+            xfif_set_drop_frags(p->xfif, true);
             break;
         default:
             VLOG_WARN_RL(&rl, "requested bad fragment mode (flags=%"PRIx16")",
@@ -1976,10 +1976,10 @@ handle_set_config(struct ofproto *p, struct ofconn *ofconn,
 }
 
 static void
-add_output_group_action(struct odp_actions *actions, uint16_t group,
+add_output_group_action(struct xflow_actions *actions, uint16_t group,
                         uint16_t *nf_output_iface)
 {
-    odp_actions_add(actions, ODPAT_OUTPUT_GROUP)->output_group.group = group;
+    xflow_actions_add(actions, XFLOWAT_OUTPUT_GROUP)->output_group.group = group;
 
     if (group == DP_GROUP_ALL || group == DP_GROUP_FLOOD) {
         *nf_output_iface = NF_OUT_FLOOD;
@@ -1987,10 +1987,10 @@ add_output_group_action(struct odp_actions *actions, uint16_t group,
 }
 
 static void
-add_controller_action(struct odp_actions *actions,
+add_controller_action(struct xflow_actions *actions,
                       const struct ofp_action_output *oao)
 {
-    union odp_action *a = odp_actions_add(actions, ODPAT_CONTROLLER);
+    union xflow_action *a = xflow_actions_add(actions, XFLOWAT_CONTROLLER);
     a->controller.arg = oao->max_len ? ntohs(oao->max_len) : UINT32_MAX;
 }
 
@@ -2004,7 +2004,7 @@ struct action_xlate_ctx {
                                   * without a packet to refer to. */
 
     /* Output. */
-    struct odp_actions *out;    /* Datapath actions. */
+    struct xflow_actions *out;    /* Datapath actions. */
     tag_type *tags;             /* Tags associated with OFPP_NORMAL actions. */
     bool may_set_up_flow;       /* True ordinarily; false if the actions must
                                  * be reassessed for every packet. */
@@ -2032,7 +2032,7 @@ add_output_action(struct action_xlate_ctx *ctx, uint16_t port)
          */
     }
 
-    odp_actions_add(ctx->out, ODPAT_OUTPUT)->output.port = port;
+    xflow_actions_add(ctx->out, XFLOWAT_OUTPUT)->output.port = port;
     ctx->nf_output_iface = port;
 }
 
@@ -2082,7 +2082,7 @@ static void
 xlate_output_action(struct action_xlate_ctx *ctx,
                     const struct ofp_action_output *oao)
 {
-    uint16_t odp_port;
+    uint16_t xflow_port;
     uint16_t prev_nf_output_iface = ctx->nf_output_iface;
 
     ctx->nf_output_iface = NF_OUT_DROP;
@@ -2114,12 +2114,12 @@ xlate_output_action(struct action_xlate_ctx *ctx,
         add_controller_action(ctx->out, oao);
         break;
     case OFPP_LOCAL:
-        add_output_action(ctx, ODPP_LOCAL);
+        add_output_action(ctx, XFLOWP_LOCAL);
         break;
     default:
-        odp_port = ofp_port_to_odp_port(ntohs(oao->port));
-        if (odp_port != ctx->flow->in_port) {
-            add_output_action(ctx, odp_port);
+        xflow_port = ofp_port_to_xflow_port(ntohs(oao->port));
+        if (xflow_port != ctx->flow->in_port) {
+            add_output_action(ctx, xflow_port);
         }
         break;
     }
@@ -2145,7 +2145,7 @@ xlate_nicira_action(struct action_xlate_ctx *ctx,
     switch (subtype) {
     case NXAST_RESUBMIT:
         nar = (const struct nx_action_resubmit *) nah;
-        xlate_table_action(ctx, ofp_port_to_odp_port(ntohs(nar->in_port)));
+        xlate_table_action(ctx, ofp_port_to_xflow_port(ntohs(nar->in_port)));
         break;
 
     default:
@@ -2172,7 +2172,7 @@ do_xlate_actions(const union ofp_action *in, size_t n_in,
 
     for (ia = actions_first(&iter, in, n_in); ia; ia = actions_next(&iter)) {
         uint16_t type = ntohs(ia->type);
-        union odp_action *oa;
+        union xflow_action *oa;
 
         switch (type) {
         case OFPAT_OUTPUT:
@@ -2180,56 +2180,56 @@ do_xlate_actions(const union ofp_action *in, size_t n_in,
             break;
 
         case OFPAT_SET_VLAN_VID:
-            oa = odp_actions_add(ctx->out, ODPAT_SET_DL_TCI);
+            oa = xflow_actions_add(ctx->out, XFLOWAT_SET_DL_TCI);
             oa->dl_tci.tci = ia->vlan_vid.vlan_vid & htons(VLAN_VID_MASK);
             oa->dl_tci.mask = htons(VLAN_VID_MASK);
             break;
 
         case OFPAT_SET_VLAN_PCP:
-            oa = odp_actions_add(ctx->out, ODPAT_SET_DL_TCI);
+            oa = xflow_actions_add(ctx->out, XFLOWAT_SET_DL_TCI);
             oa->dl_tci.tci = htons((ia->vlan_pcp.vlan_pcp << VLAN_PCP_SHIFT)
                                    & VLAN_PCP_MASK);
             oa->dl_tci.mask = htons(VLAN_PCP_MASK);
             break;
 
         case OFPAT_STRIP_VLAN:
-            odp_actions_add(ctx->out, ODPAT_STRIP_VLAN);
+            xflow_actions_add(ctx->out, XFLOWAT_STRIP_VLAN);
             break;
 
         case OFPAT_SET_DL_SRC:
-            oa = odp_actions_add(ctx->out, ODPAT_SET_DL_SRC);
+            oa = xflow_actions_add(ctx->out, XFLOWAT_SET_DL_SRC);
             memcpy(oa->dl_addr.dl_addr,
                    ((struct ofp_action_dl_addr *) ia)->dl_addr, ETH_ADDR_LEN);
             break;
 
         case OFPAT_SET_DL_DST:
-            oa = odp_actions_add(ctx->out, ODPAT_SET_DL_DST);
+            oa = xflow_actions_add(ctx->out, XFLOWAT_SET_DL_DST);
             memcpy(oa->dl_addr.dl_addr,
                    ((struct ofp_action_dl_addr *) ia)->dl_addr, ETH_ADDR_LEN);
             break;
 
         case OFPAT_SET_NW_SRC:
-            oa = odp_actions_add(ctx->out, ODPAT_SET_NW_SRC);
+            oa = xflow_actions_add(ctx->out, XFLOWAT_SET_NW_SRC);
             oa->nw_addr.nw_addr = ia->nw_addr.nw_addr;
             break;
 
         case OFPAT_SET_NW_DST:
-            oa = odp_actions_add(ctx->out, ODPAT_SET_NW_DST);
+            oa = xflow_actions_add(ctx->out, XFLOWAT_SET_NW_DST);
             oa->nw_addr.nw_addr = ia->nw_addr.nw_addr;
             break;
 
         case OFPAT_SET_NW_TOS:
-            oa = odp_actions_add(ctx->out, ODPAT_SET_NW_TOS);
+            oa = xflow_actions_add(ctx->out, XFLOWAT_SET_NW_TOS);
             oa->nw_tos.nw_tos = ia->nw_tos.nw_tos;
             break;
 
         case OFPAT_SET_TP_SRC:
-            oa = odp_actions_add(ctx->out, ODPAT_SET_TP_SRC);
+            oa = xflow_actions_add(ctx->out, XFLOWAT_SET_TP_SRC);
             oa->tp_port.tp_port = ia->tp_port.tp_port;
             break;
 
         case OFPAT_SET_TP_DST:
-            oa = odp_actions_add(ctx->out, ODPAT_SET_TP_DST);
+            oa = xflow_actions_add(ctx->out, XFLOWAT_SET_TP_DST);
             oa->tp_port.tp_port = ia->tp_port.tp_port;
             break;
 
@@ -2248,13 +2248,13 @@ static int
 xlate_actions(const union ofp_action *in, size_t n_in,
               const flow_t *flow, struct ofproto *ofproto,
               const struct ofpbuf *packet,
-              struct odp_actions *out, tag_type *tags, bool *may_set_up_flow,
+              struct xflow_actions *out, tag_type *tags, bool *may_set_up_flow,
               uint16_t *nf_output_iface)
 {
     tag_type no_tags = 0;
     struct action_xlate_ctx ctx;
-    COVERAGE_INC(ofproto_ofp2odp);
-    odp_actions_init(out);
+    COVERAGE_INC(ofproto_ofp2xflow);
+    xflow_actions_init(out);
     ctx.flow = flow;
     ctx.recurse = 0;
     ctx.ofproto = ofproto;
@@ -2277,8 +2277,8 @@ xlate_actions(const union ofp_action *in, size_t n_in,
     if (nf_output_iface) {
         *nf_output_iface = ctx.nf_output_iface;
     }
-    if (odp_actions_overflow(out)) {
-        odp_actions_init(out);
+    if (xflow_actions_overflow(out)) {
+        xflow_actions_init(out);
         return ofp_mkerr(OFPET_BAD_ACTION, OFPBAC_TOO_MANY);
     }
     return 0;
@@ -2290,7 +2290,7 @@ handle_packet_out(struct ofproto *p, struct ofconn *ofconn,
 {
     struct ofp_packet_out *opo;
     struct ofpbuf payload, *buffer;
-    struct odp_actions actions;
+    struct xflow_actions actions;
     int n_actions;
     uint16_t in_port;
     flow_t flow;
@@ -2314,14 +2314,14 @@ handle_packet_out(struct ofproto *p, struct ofconn *ofconn,
         buffer = NULL;
     }
 
-    flow_extract(&payload, ofp_port_to_odp_port(ntohs(opo->in_port)), &flow);
+    flow_extract(&payload, ofp_port_to_xflow_port(ntohs(opo->in_port)), &flow);
     error = xlate_actions((const union ofp_action *) opo->actions, n_actions,
                           &flow, p, &payload, &actions, NULL, NULL, NULL);
     if (error) {
         return error;
     }
 
-    dpif_execute(p->dpif, flow.in_port, actions.actions, actions.n_actions,
+    xfif_execute(p->xfif, flow.in_port, actions.actions, actions.n_actions,
                  &payload);
     ofpbuf_delete(buffer);
 
@@ -2370,7 +2370,7 @@ handle_port_mod(struct ofproto *p, struct ofp_header *oh)
     opm = (struct ofp_port_mod *) oh;
 
     port = port_array_get(&p->ports,
-                          ofp_port_to_odp_port(ntohs(opm->port_no)));
+                          ofp_port_to_xflow_port(ntohs(opm->port_no)));
     if (!port) {
         return ofp_mkerr(OFPET_PORT_MOD_FAILED, OFPPMFC_BAD_PORT);
     } else if (memcmp(port->opp.hw_addr, opm->hw_addr, OFP_ETH_ALEN)) {
@@ -2454,7 +2454,7 @@ handle_table_stats_request(struct ofproto *p, struct ofconn *ofconn,
 {
     struct ofp_table_stats *ots;
     struct ofpbuf *msg;
-    struct odp_stats dpstats;
+    struct xflow_stats xfstats;
     int n_exact, n_subrules, n_wild;
 
     msg = start_stats_reply(request, sizeof *ots * 2);
@@ -2466,17 +2466,17 @@ handle_table_stats_request(struct ofproto *p, struct ofconn *ofconn,
     n_wild = classifier_count(&p->cls) - classifier_count_exact(&p->cls);
 
     /* Hash table. */
-    dpif_get_dp_stats(p->dpif, &dpstats);
+    xfif_get_xf_stats(p->xfif, &xfstats);
     ots = append_stats_reply(sizeof *ots, ofconn, &msg);
     memset(ots, 0, sizeof *ots);
     ots->table_id = TABLEID_HASH;
     strcpy(ots->name, "hash");
     ots->wildcards = htonl(0);
-    ots->max_entries = htonl(dpstats.max_capacity);
+    ots->max_entries = htonl(xfstats.max_capacity);
     ots->active_count = htonl(n_exact);
-    ots->lookup_count = htonll(dpstats.n_frags + dpstats.n_hit +
-                               dpstats.n_missed);
-    ots->matched_count = htonll(dpstats.n_hit); /* XXX */
+    ots->lookup_count = htonll(xfstats.n_frags + xfstats.n_hit +
+                               xfstats.n_missed);
+    ots->matched_count = htonll(xfstats.n_hit); /* XXX */
 
     /* Classifier table. */
     ots = append_stats_reply(sizeof *ots, ofconn, &msg);
@@ -2506,7 +2506,7 @@ append_port_stat(struct ofport *port, uint16_t port_no, struct ofconn *ofconn,
     netdev_get_stats(port->netdev, &stats);
 
     ops = append_stats_reply(sizeof *ops, ofconn, &msg);
-    ops->port_no = htons(odp_port_to_ofp_port(port_no));
+    ops->port_no = htons(xflow_port_to_ofp_port(port_no));
     memset(ops->pad, 0, sizeof ops->pad);
     ops->rx_packets = htonll(stats.rx_packets);
     ops->tx_packets = htonll(stats.tx_packets);
@@ -2541,7 +2541,7 @@ handle_port_stats_request(struct ofproto *p, struct ofconn *ofconn,
     msg = start_stats_reply(osr, sizeof *ops * 16);
     if (psr->port_no != htons(OFPP_NONE)) {
         port = port_array_get(&p->ports, 
-                ofp_port_to_odp_port(ntohs(psr->port_no)));
+                ofp_port_to_xflow_port(ntohs(psr->port_no)));
         if (port) {
             append_port_stat(port, ntohs(psr->port_no), ofconn, msg);
         }
@@ -2571,8 +2571,8 @@ query_stats(struct ofproto *p, struct rule *rule,
 {
     uint64_t packet_count, byte_count;
     struct rule *subrule;
-    struct odp_flow *odp_flows;
-    size_t n_odp_flows;
+    struct xflow_flow *xflow_flows;
+    size_t n_xflow_flows;
 
     /* Start from historical data for 'rule' itself that are no longer tracked
      * by the datapath.  This counts, for example, subrules that have
@@ -2585,31 +2585,31 @@ query_stats(struct ofproto *p, struct rule *rule,
      *
      * Also, add any statistics that are not tracked by the datapath for each
      * subrule.  This includes, for example, statistics for packets that were
-     * executed "by hand" by ofproto via dpif_execute() but must be accounted
+     * executed "by hand" by ofproto via xfif_execute() but must be accounted
      * to a flow. */
-    n_odp_flows = rule->cr.wc.wildcards ? list_size(&rule->list) : 1;
-    odp_flows = xzalloc(n_odp_flows * sizeof *odp_flows);
+    n_xflow_flows = rule->cr.wc.wildcards ? list_size(&rule->list) : 1;
+    xflow_flows = xzalloc(n_xflow_flows * sizeof *xflow_flows);
     if (rule->cr.wc.wildcards) {
         size_t i = 0;
         LIST_FOR_EACH (subrule, struct rule, list, &rule->list) {
-            odp_flow_key_from_flow(&odp_flows[i++].key, &subrule->cr.flow);
+            xflow_key_from_flow(&xflow_flows[i++].key, &subrule->cr.flow);
             packet_count += subrule->packet_count;
             byte_count += subrule->byte_count;
         }
     } else {
-        odp_flow_key_from_flow(&odp_flows[0].key, &rule->cr.flow);
+        xflow_key_from_flow(&xflow_flows[0].key, &rule->cr.flow);
     }
 
     /* Fetch up-to-date statistics from the datapath and add them in. */
-    if (!dpif_flow_get_multiple(p->dpif, odp_flows, n_odp_flows)) {
+    if (!xfif_flow_get_multiple(p->xfif, xflow_flows, n_xflow_flows)) {
         size_t i;
-        for (i = 0; i < n_odp_flows; i++) {
-            struct odp_flow *odp_flow = &odp_flows[i];
-            packet_count += odp_flow->stats.n_packets;
-            byte_count += odp_flow->stats.n_bytes;
+        for (i = 0; i < n_xflow_flows; i++) {
+            struct xflow_flow *xflow_flow = &xflow_flows[i];
+            packet_count += xflow_flow->stats.n_packets;
+            byte_count += xflow_flow->stats.n_bytes;
         }
     }
-    free(odp_flows);
+    free(xflow_flows);
 
     /* Return the stats to the caller. */
     *packet_countp = packet_count;
@@ -2852,7 +2852,7 @@ msec_from_nsec(uint64_t sec, uint32_t nsec)
 
 static void
 update_time(struct ofproto *ofproto, struct rule *rule,
-            const struct odp_flow_stats *stats)
+            const struct xflow_flow_stats *stats)
 {
     long long int used = msec_from_nsec(stats->used_sec, stats->used_nsec);
     if (used > rule->used) {
@@ -2866,7 +2866,7 @@ update_time(struct ofproto *ofproto, struct rule *rule,
 
 static void
 update_stats(struct ofproto *ofproto, struct rule *rule,
-             const struct odp_flow_stats *stats)
+             const struct xflow_flow_stats *stats)
 {
     if (stats->n_packets) {
         update_time(ofproto, rule, stats);
@@ -3183,10 +3183,10 @@ handle_openflow(struct ofconn *ofconn, struct ofproto *p,
 }
 \f
 static void
-handle_odp_miss_msg(struct ofproto *p, struct ofpbuf *packet)
+handle_xflow_miss_msg(struct ofproto *p, struct ofpbuf *packet)
 {
-    struct odp_msg *msg = packet->data;
-    uint16_t in_port = odp_port_to_ofp_port(msg->port);
+    struct xflow_msg *msg = packet->data;
+    uint16_t in_port = xflow_port_to_ofp_port(msg->port);
     struct rule *rule;
     struct ofpbuf payload;
     flow_t flow;
@@ -3198,12 +3198,12 @@ handle_odp_miss_msg(struct ofproto *p, struct ofpbuf *packet)
     /* Check with in-band control to see if this packet should be sent
      * to the local port regardless of the flow table. */
     if (in_band_msg_in_hook(p->in_band, &flow, &payload)) {
-        union odp_action action;
+        union xflow_action action;
 
         memset(&action, 0, sizeof(action));
-        action.output.type = ODPAT_OUTPUT;
-        action.output.port = ODPP_LOCAL;
-        dpif_execute(p->dpif, flow.in_port, &action, 1, &payload);
+        action.output.type = XFLOWAT_OUTPUT;
+        action.output.port = XFLOWP_LOCAL;
+        xfif_execute(p->xfif, flow.in_port, &action, 1, &payload);
     }
 
     rule = lookup_valid_rule(p, &flow);
@@ -3262,30 +3262,30 @@ handle_odp_miss_msg(struct ofproto *p, struct ofpbuf *packet)
 }
 
 static void
-handle_odp_msg(struct ofproto *p, struct ofpbuf *packet)
+handle_xflow_msg(struct ofproto *p, struct ofpbuf *packet)
 {
-    struct odp_msg *msg = packet->data;
+    struct xflow_msg *msg = packet->data;
 
     switch (msg->type) {
-    case _ODPL_ACTION_NR:
+    case _XFLOWL_ACTION_NR:
         COVERAGE_INC(ofproto_ctlr_action);
-        pinsched_send(p->action_sched, odp_port_to_ofp_port(msg->port), packet,
+        pinsched_send(p->action_sched, xflow_port_to_ofp_port(msg->port), packet,
                       send_packet_in_action, p);
         break;
 
-    case _ODPL_SFLOW_NR:
+    case _XFLOWL_SFLOW_NR:
         if (p->sflow) {
             ofproto_sflow_received(p->sflow, msg);
         }
         ofpbuf_delete(packet);
         break;
 
-    case _ODPL_MISS_NR:
-        handle_odp_miss_msg(p, packet);
+    case _XFLOWL_MISS_NR:
+        handle_xflow_miss_msg(p, packet);
         break;
 
     default:
-        VLOG_WARN_RL(&rl, "received ODP message of unexpected type %"PRIu32,
+        VLOG_WARN_RL(&rl, "received XFLOW message of unexpected type %"PRIu32,
                      msg->type);
         break;
     }
@@ -3452,26 +3452,26 @@ active_timeout(struct ofproto *ofproto, struct rule *rule)
     if (ofproto->netflow && !is_controller_rule(rule) &&
         netflow_active_timeout_expired(ofproto->netflow, &rule->nf_flow)) {
         struct ofexpired expired;
-        struct odp_flow odp_flow;
+        struct xflow_flow xflow_flow;
 
         /* Get updated flow stats. */
-        memset(&odp_flow, 0, sizeof odp_flow);
+        memset(&xflow_flow, 0, sizeof xflow_flow);
         if (rule->installed) {
-            odp_flow_key_from_flow(&odp_flow.key, &rule->cr.flow);
-            odp_flow.flags = ODPFF_ZERO_TCP_FLAGS;
-            dpif_flow_get(ofproto->dpif, &odp_flow);
-
-            if (odp_flow.stats.n_packets) {
-                update_time(ofproto, rule, &odp_flow.stats);
-                netflow_flow_update_flags(&rule->nf_flow, odp_flow.stats.ip_tos,
-                                          odp_flow.stats.tcp_flags);
+            xflow_key_from_flow(&xflow_flow.key, &rule->cr.flow);
+            xflow_flow.flags = XFLOWFF_ZERO_TCP_FLAGS;
+            xfif_flow_get(ofproto->xfif, &xflow_flow);
+
+            if (xflow_flow.stats.n_packets) {
+                update_time(ofproto, rule, &xflow_flow.stats);
+                netflow_flow_update_flags(&rule->nf_flow, xflow_flow.stats.ip_tos,
+                                          xflow_flow.stats.tcp_flags);
             }
         }
 
         expired.flow = rule->cr.flow;
         expired.packet_count = rule->packet_count +
-                               odp_flow.stats.n_packets;
-        expired.byte_count = rule->byte_count + odp_flow.stats.n_bytes;
+                               xflow_flow.stats.n_packets;
+        expired.byte_count = rule->byte_count + xflow_flow.stats.n_bytes;
         expired.used = rule->used;
 
         netflow_expire(ofproto->netflow, &rule->nf_flow, &expired);
@@ -3485,28 +3485,28 @@ active_timeout(struct ofproto *ofproto, struct rule *rule)
 static void
 update_used(struct ofproto *p)
 {
-    struct odp_flow *flows;
+    struct xflow_flow *flows;
     size_t n_flows;
     size_t i;
     int error;
 
-    error = dpif_flow_list_all(p->dpif, &flows, &n_flows);
+    error = xfif_flow_list_all(p->xfif, &flows, &n_flows);
     if (error) {
         return;
     }
 
     for (i = 0; i < n_flows; i++) {
-        struct odp_flow *f = &flows[i];
+        struct xflow_flow *f = &flows[i];
         struct rule *rule;
         flow_t flow;
 
-        odp_flow_key_to_flow(&f->key, &flow);
+        xflow_key_to_flow(&f->key, &flow);
 
         rule = rule_from_cls_rule(
             classifier_find_rule_exactly(&p->cls, &flow, 0, UINT16_MAX));
         if (!rule || !rule->installed) {
             COVERAGE_INC(ofproto_unexpected_rule);
-            dpif_flow_del(p->dpif, f);
+            xfif_flow_del(p->xfif, f);
             continue;
         }
 
@@ -3520,7 +3520,7 @@ static void
 do_send_packet_in(struct ofconn *ofconn, uint32_t buffer_id,
                   const struct ofpbuf *packet, int send_len)
 {
-    struct odp_msg *msg = packet->data;
+    struct xflow_msg *msg = packet->data;
     struct ofpbuf payload;
     struct ofpbuf *opi;
     uint8_t reason;
@@ -3530,8 +3530,8 @@ do_send_packet_in(struct ofconn *ofconn, uint32_t buffer_id,
     payload.size = msg->length - sizeof *msg;
 
     /* Construct ofp_packet_in message. */
-    reason = msg->type == _ODPL_ACTION_NR ? OFPR_ACTION : OFPR_NO_MATCH;
-    opi = make_packet_in(buffer_id, odp_port_to_ofp_port(msg->port), reason,
+    reason = msg->type == _XFLOWL_ACTION_NR ? OFPR_ACTION : OFPR_NO_MATCH;
+    opi = make_packet_in(buffer_id, xflow_port_to_ofp_port(msg->port), reason,
                          &payload, send_len);
 
     /* Send. */
@@ -3543,7 +3543,7 @@ send_packet_in_action(struct ofpbuf *packet, void *p_)
 {
     struct ofproto *p = p_;
     struct ofconn *ofconn;
-    struct odp_msg *msg;
+    struct xflow_msg *msg;
 
     msg = packet->data;
     LIST_FOR_EACH (ofconn, struct ofconn, node, &p->all_conns) {
@@ -3561,7 +3561,7 @@ send_packet_in_miss(struct ofpbuf *packet, void *p_)
     bool in_fail_open = p->fail_open && fail_open_is_active(p->fail_open);
     struct ofconn *ofconn;
     struct ofpbuf payload;
-    struct odp_msg *msg;
+    struct xflow_msg *msg;
 
     msg = packet->data;
     payload.data = msg + 1;
@@ -3585,7 +3585,7 @@ pick_datapath_id(const struct ofproto *ofproto)
 {
     const struct ofport *port;
 
-    port = port_array_get(&ofproto->ports, ODPP_LOCAL);
+    port = port_array_get(&ofproto->ports, XFLOWP_LOCAL);
     if (port) {
         uint8_t ea[ETH_ADDR_LEN];
         int error;
@@ -3610,7 +3610,7 @@ pick_fallback_dpid(void)
 \f
 static bool
 default_normal_ofhook_cb(const flow_t *flow, const struct ofpbuf *packet,
-                         struct odp_actions *actions, tag_type *tags,
+                         struct xflow_actions *actions, tag_type *tags,
                          uint16_t *nf_output_iface, void *ofproto_)
 {
     struct ofproto *ofproto = ofproto_;
@@ -3640,7 +3640,7 @@ default_normal_ofhook_cb(const flow_t *flow, const struct ofpbuf *packet,
     if (out_port < 0) {
         add_output_group_action(actions, DP_GROUP_FLOOD, nf_output_iface);
     } else if (out_port != flow->in_port) {
-        odp_actions_add(actions, ODPAT_OUTPUT)->output.port = out_port;
+        xflow_actions_add(actions, XFLOWAT_OUTPUT)->output.port = out_port;
         *nf_output_iface = out_port;
     } else {
         /* Drop. */
index d9e71d7..4958aab 100644 (file)
@@ -28,7 +28,7 @@
 extern "C" {
 #endif
 
-struct odp_actions;
+struct xflow_actions;
 struct ofhooks;
 struct ofproto;
 struct svec;
@@ -121,9 +121,9 @@ struct ofhooks {
     void (*port_changed_cb)(enum ofp_port_reason, const struct ofp_phy_port *,
                             void *aux);
     bool (*normal_cb)(const flow_t *, const struct ofpbuf *packet,
-                      struct odp_actions *, tag_type *,
+                      struct xflow_actions *, tag_type *,
                       uint16_t *nf_output_iface, void *aux);
-    void (*account_flow_cb)(const flow_t *, const union odp_action *,
+    void (*account_flow_cb)(const flow_t *, const union xflow_action *,
                             size_t n_actions, unsigned long long int n_bytes,
                             void *aux);
     void (*account_checkpoint_cb)(void *aux);
index b9c6371..d11048b 100644 (file)
@@ -163,7 +163,7 @@ pinsched_send(struct pinsched *ps, uint16_t port_no,
         /* Otherwise queue it up for the periodic callback to drain out. */
         struct ovs_queue *q;
 
-        /* We are called with a buffer obtained from dpif_recv() that has much
+        /* We are called with a buffer obtained from xfif_recv() that has much
          * more allocated space than actual content most of the time.  Since
          * we're going to store the packet for some time, free up that
          * otherwise wasted space. */
index 752a447..7977080 100644 (file)
@@ -29,7 +29,7 @@ Do not use \fBovs\-dpctl\fR commands to modify datapaths if
 Most \fBovs\-dpctl\fR commands that work with datapaths take an argument
 that specifies the name of the datapath, in one of the following
 forms:
-.so lib/dpif.man
+.so lib/xfif.man
 .PP
 The following commands manage datapaths.
 .
index eb78a57..a696ed9 100644 (file)
 #include "command-line.h"
 #include "compiler.h"
 #include "dirs.h"
-#include "dpif.h"
 #include "dynamic-string.h"
 #include "netdev.h"
-#include "odp-util.h"
+#include "xflow-util.h"
 #include "svec.h"
 #include "timeval.h"
 #include "util.h"
+#include "xfif.h"
 
 #include "vlog.h"
 #define THIS_MODULE VLM_dpctl
@@ -177,17 +177,17 @@ static int if_up(const char *netdev_name)
 }
 
 static int
-parsed_dpif_open(const char *arg_, bool create, struct dpif **dpifp)
+parsed_xfif_open(const char *arg_, bool create, struct xfif **xfifp)
 {
     int result;
     char *name, *type;
 
-    dp_parse_name(arg_, &name, &type);
+    xf_parse_name(arg_, &name, &type);
 
     if (create) {
-        result = dpif_create(name, type, dpifp);
+        result = xfif_create(name, type, xfifp);
     } else {
-        result = dpif_open(name, type, dpifp);
+        result = xfif_open(name, type, xfifp);
     }
 
     free(name);
@@ -198,9 +198,9 @@ parsed_dpif_open(const char *arg_, bool create, struct dpif **dpifp)
 static void
 do_add_dp(int argc OVS_UNUSED, char *argv[])
 {
-    struct dpif *dpif;
-    run(parsed_dpif_open(argv[1], true, &dpif), "add_dp");
-    dpif_close(dpif);
+    struct xfif *xfif;
+    run(parsed_xfif_open(argv[1], true, &xfif), "add_dp");
+    xfif_close(xfif);
     if (argc > 2) {
         do_add_if(argc, argv);
     }
@@ -209,24 +209,24 @@ do_add_dp(int argc OVS_UNUSED, char *argv[])
 static void
 do_del_dp(int argc OVS_UNUSED, char *argv[])
 {
-    struct dpif *dpif;
-    run(parsed_dpif_open(argv[1], false, &dpif), "opening datapath");
-    run(dpif_delete(dpif), "del_dp");
-    dpif_close(dpif);
+    struct xfif *xfif;
+    run(parsed_xfif_open(argv[1], false, &xfif), "opening datapath");
+    run(xfif_delete(xfif), "del_dp");
+    xfif_close(xfif);
 }
 
 static int
 compare_ports(const void *a_, const void *b_)
 {
-    const struct odp_port *a = a_;
-    const struct odp_port *b = b_;
+    const struct xflow_port *a = a_;
+    const struct xflow_port *b = b_;
     return a->port < b->port ? -1 : a->port > b->port;
 }
 
 static void
-query_ports(struct dpif *dpif, struct odp_port **ports, size_t *n_ports)
+query_ports(struct xfif *xfif, struct xflow_port **ports, size_t *n_ports)
 {
-    run(dpif_port_list(dpif, ports, n_ports), "listing ports");
+    run(xfif_port_list(xfif, ports, n_ports), "listing ports");
     qsort(*ports, *n_ports, sizeof **ports, compare_ports);
 }
 
@@ -234,10 +234,10 @@ static void
 do_add_if(int argc OVS_UNUSED, char *argv[])
 {
     bool failure = false;
-    struct dpif *dpif;
+    struct xfif *xfif;
     int i;
 
-    run(parsed_dpif_open(argv[1], false, &dpif), "opening datapath");
+    run(parsed_xfif_open(argv[1], false, &xfif), "opening datapath");
     for (i = 2; i < argc; i++) {
         char *save_ptr = NULL;
         char *devname, *suboptions;
@@ -264,7 +264,7 @@ do_add_if(int argc OVS_UNUSED, char *argv[])
 
                 switch (getsubopt(&suboptions, options, &value)) {
                 case AP_INTERNAL:
-                    flags |= ODP_PORT_INTERNAL;
+                    flags |= XFLOW_PORT_INTERNAL;
                     break;
 
                 default:
@@ -274,7 +274,7 @@ do_add_if(int argc OVS_UNUSED, char *argv[])
             }
         }
 
-        error = dpif_port_add(dpif, devname, flags, NULL);
+        error = xfif_port_add(xfif, devname, flags, NULL);
         if (error) {
             ovs_error(error, "adding %s to %s failed", devname, argv[1]);
             failure = true;
@@ -282,20 +282,20 @@ do_add_if(int argc OVS_UNUSED, char *argv[])
             failure = true;
         }
     }
-    dpif_close(dpif);
+    xfif_close(xfif);
     if (failure) {
         exit(EXIT_FAILURE);
     }
 }
 
 static bool
-get_port_number(struct dpif *dpif, const char *name, uint16_t *port)
+get_port_number(struct xfif *xfif, const char *name, uint16_t *port)
 {
-    struct odp_port *ports;
+    struct xflow_port *ports;
     size_t n_ports;
     size_t i;
 
-    query_ports(dpif, &ports, &n_ports);
+    query_ports(xfif, &ports, &n_ports);
     for (i = 0; i < n_ports; i++) {
         if (!strcmp(name, ports[i].devname)) {
             *port = ports[i].port;
@@ -312,10 +312,10 @@ static void
 do_del_if(int argc OVS_UNUSED, char *argv[])
 {
     bool failure = false;
-    struct dpif *dpif;
+    struct xfif *xfif;
     int i;
 
-    run(parsed_dpif_open(argv[1], false, &dpif), "opening datapath");
+    run(parsed_xfif_open(argv[1], false, &xfif), "opening datapath");
     for (i = 2; i < argc; i++) {
         const char *name = argv[i];
         uint16_t port;
@@ -323,33 +323,33 @@ do_del_if(int argc OVS_UNUSED, char *argv[])
 
         if (!name[strspn(name, "0123456789")]) {
             port = atoi(name);
-        } else if (!get_port_number(dpif, name, &port)) {
+        } else if (!get_port_number(xfif, name, &port)) {
             failure = true;
             continue;
         }
 
-        error = dpif_port_del(dpif, port);
+        error = xfif_port_del(xfif, port);
         if (error) {
             ovs_error(error, "deleting port %s from %s failed", name, argv[1]);
             failure = true;
         }
     }
-    dpif_close(dpif);
+    xfif_close(xfif);
     if (failure) {
         exit(EXIT_FAILURE);
     }
 }
 
 static void
-show_dpif(struct dpif *dpif)
+show_xfif(struct xfif *xfif)
 {
-    struct odp_port *ports;
-    struct odp_stats stats;
+    struct xflow_port *ports;
+    struct xflow_stats stats;
     size_t n_ports;
     size_t i;
 
-    printf("%s:\n", dpif_name(dpif));
-    if (!dpif_get_dp_stats(dpif, &stats)) {
+    printf("%s:\n", xfif_name(xfif));
+    if (!xfif_get_xf_stats(xfif, &stats)) {
         printf("\tflows: cur:%"PRIu32", soft-max:%"PRIu32", "
                "hard-max:%"PRIu32"\n",
                stats.n_flows, stats.cur_capacity, stats.max_capacity);
@@ -364,16 +364,16 @@ show_dpif(struct dpif *dpif)
         printf("\tqueues: max-miss:%"PRIu16", max-action:%"PRIu16"\n",
                stats.max_miss_queue, stats.max_action_queue);
     }
-    query_ports(dpif, &ports, &n_ports);
+    query_ports(xfif, &ports, &n_ports);
     for (i = 0; i < n_ports; i++) {
         printf("\tport %u: %s", ports[i].port, ports[i].devname);
-        if (ports[i].flags & ODP_PORT_INTERNAL) {
+        if (ports[i].flags & XFLOW_PORT_INTERNAL) {
             printf(" (internal)");
         }
         printf("\n");
     }
     free(ports);
-    dpif_close(dpif);
+    xfif_close(xfif);
 }
 
 static void
@@ -384,12 +384,12 @@ do_show(int argc, char *argv[])
         int i;
         for (i = 1; i < argc; i++) {
             const char *name = argv[i];
-            struct dpif *dpif;
+            struct xfif *xfif;
             int error;
 
-            error = parsed_dpif_open(name, false, &dpif);
+            error = parsed_xfif_open(name, false, &xfif);
             if (!error) {
-                show_dpif(dpif);
+                show_xfif(xfif);
             } else {
                 ovs_error(error, "opening datapath %s failed", name);
                 failure = true;
@@ -397,15 +397,15 @@ do_show(int argc, char *argv[])
         }
     } else {
         unsigned int i;
-        for (i = 0; i < ODP_MAX; i++) {
+        for (i = 0; i < XFLOW_MAX; i++) {
             char name[128];
-            struct dpif *dpif;
+            struct xfif *xfif;
             int error;
 
             sprintf(name, "dp%u", i);
-            error = parsed_dpif_open(name, false, &dpif);
+            error = parsed_xfif_open(name, false, &xfif);
             if (!error) {
-                show_dpif(dpif);
+                show_xfif(xfif);
             } else if (error != ENODEV) {
                 ovs_error(error, "opening datapath %s failed", name);
                 failure = true;
@@ -420,34 +420,34 @@ do_show(int argc, char *argv[])
 static void
 do_dump_dps(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
 {
-    struct svec dpif_names, dpif_types;
+    struct svec xfif_names, xfif_types;
     unsigned int i;
     int error = 0;
 
-    svec_init(&dpif_names);
-    svec_init(&dpif_types);
-    dp_enumerate_types(&dpif_types);
+    svec_init(&xfif_names);
+    svec_init(&xfif_types);
+    xf_enumerate_types(&xfif_types);
 
-    for (i = 0; i < dpif_types.n; i++) {
+    for (i = 0; i < xfif_types.n; i++) {
         unsigned int j;
         int retval;
 
-        retval = dp_enumerate_names(dpif_types.names[i], &dpif_names);
+        retval = xf_enumerate_names(xfif_types.names[i], &xfif_names);
         if (retval) {
             error = retval;
         }
 
-        for (j = 0; j < dpif_names.n; j++) {
-            struct dpif *dpif;
-            if (!dpif_open(dpif_names.names[j], dpif_types.names[i], &dpif)) {
-                printf("%s\n", dpif_name(dpif));
-                dpif_close(dpif);
+        for (j = 0; j < xfif_names.n; j++) {
+            struct xfif *xfif;
+            if (!xfif_open(xfif_names.names[j], xfif_types.names[i], &xfif)) {
+                printf("%s\n", xfif_name(xfif));
+                xfif_close(xfif);
             }
         }
     }
 
-    svec_destroy(&dpif_names);
-    svec_destroy(&dpif_types);
+    svec_destroy(&xfif_names);
+    svec_destroy(&xfif_types);
     if (error) {
         exit(EXIT_FAILURE);
     }
@@ -456,57 +456,57 @@ do_dump_dps(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
 static void
 do_dump_flows(int argc OVS_UNUSED, char *argv[])
 {
-    struct odp_flow *flows;
-    struct dpif *dpif;
+    struct xflow_flow *flows;
+    struct xfif *xfif;
     size_t n_flows;
     struct ds ds;
     size_t i;
 
-    run(parsed_dpif_open(argv[1], false, &dpif), "opening datapath");
-    run(dpif_flow_list_all(dpif, &flows, &n_flows), "listing all flows");
+    run(parsed_xfif_open(argv[1], false, &xfif), "opening datapath");
+    run(xfif_flow_list_all(xfif, &flows, &n_flows), "listing all flows");
 
     ds_init(&ds);
     for (i = 0; i < n_flows; i++) {
-        struct odp_flow *f = &flows[i];
-        enum { MAX_ACTIONS = 4096 / sizeof(union odp_action) };
-        union odp_action actions[MAX_ACTIONS];
+        struct xflow_flow *f = &flows[i];
+        enum { MAX_ACTIONS = 4096 / sizeof(union xflow_action) };
+        union xflow_action actions[MAX_ACTIONS];
 
         f->actions = actions;
         f->n_actions = MAX_ACTIONS;
-        dpif_flow_get(dpif, f);
+        xfif_flow_get(xfif, f);
 
         ds_clear(&ds);
-        format_odp_flow(&ds, f);
+        format_xflow_flow(&ds, f);
         printf("%s\n", ds_cstr(&ds));
     }
     ds_destroy(&ds);
-    dpif_close(dpif);
+    xfif_close(xfif);
 }
 
 static void
 do_del_flows(int argc OVS_UNUSED, char *argv[])
 {
-    struct dpif *dpif;
+    struct xfif *xfif;
 
-    run(parsed_dpif_open(argv[1], false, &dpif), "opening datapath");
-    run(dpif_flow_flush(dpif), "deleting all flows");
-    dpif_close(dpif);
+    run(parsed_xfif_open(argv[1], false, &xfif), "opening datapath");
+    run(xfif_flow_flush(xfif), "deleting all flows");
+    xfif_close(xfif);
 }
 
 static void
 do_dump_groups(int argc OVS_UNUSED, char *argv[])
 {
-    struct odp_stats stats;
-    struct dpif *dpif;
+    struct xflow_stats stats;
+    struct xfif *xfif;
     unsigned int i;
 
-    run(parsed_dpif_open(argv[1], false, &dpif), "opening datapath");
-    run(dpif_get_dp_stats(dpif, &stats), "get datapath stats");
+    run(parsed_xfif_open(argv[1], false, &xfif), "opening datapath");
+    run(xfif_get_xf_stats(xfif, &stats), "get datapath stats");
     for (i = 0; i < stats.max_groups; i++) {
         uint16_t *ports;
         size_t n_ports;
 
-        if (!dpif_port_group_get(dpif, i, &ports, &n_ports) && n_ports) {
+        if (!xfif_port_group_get(xfif, i, &ports, &n_ports) && n_ports) {
             size_t j;
 
             printf("group %u:", i);
@@ -517,7 +517,7 @@ do_dump_groups(int argc OVS_UNUSED, char *argv[])
         }
         free(ports);
     }
-    dpif_close(dpif);
+    xfif_close(xfif);
 }
 
 static void
index 9a75969..6f90fbc 100644 (file)
 #include "command-line.h"
 #include "compiler.h"
 #include "dirs.h"
-#include "dpif.h"
 #include "dynamic-string.h"
 #include "netdev.h"
 #include "netlink.h"
-#include "odp-util.h"
+#include "xflow-util.h"
 #include "ofp-print.h"
 #include "ofpbuf.h"
 #include "openflow/nicira-ext.h"
@@ -48,6 +47,7 @@
 #include "timeval.h"
 #include "util.h"
 #include "vconn.h"
+#include "xfif.h"
 #include "xtoxll.h"
 
 #include "vlog.h"
@@ -216,12 +216,12 @@ open_vconn_socket(const char *name, struct vconn **vconnp)
 static void
 open_vconn(const char *name, struct vconn **vconnp)
 {
-    struct dpif *dpif;
+    struct xfif *xfif;
     struct stat s;
     char *bridge_path, *datapath_name, *datapath_type;
 
     bridge_path = xasprintf("%s/%s.mgmt", ovs_rundir, name);
-    dp_parse_name(name, &datapath_name, &datapath_type);
+    xf_parse_name(name, &datapath_name, &datapath_type);
 
     if (strstr(name, ":")) {
         run(vconn_open_block(name, OFP_VERSION, vconnp),
@@ -230,18 +230,18 @@ open_vconn(const char *name, struct vconn **vconnp)
         open_vconn_socket(name, vconnp);
     } else if (!stat(bridge_path, &s) && S_ISSOCK(s.st_mode)) {
         open_vconn_socket(bridge_path, vconnp);
-    } else if (!dpif_open(datapath_name, datapath_type, &dpif)) {
-        char dpif_name[IF_NAMESIZE + 1];
+    } else if (!xfif_open(datapath_name, datapath_type, &xfif)) {
+        char xfif_name[IF_NAMESIZE + 1];
         char *socket_name;
 
-        run(dpif_port_get_name(dpif, ODPP_LOCAL, dpif_name, sizeof dpif_name),
-            "obtaining name of %s", dpif_name);
-        dpif_close(dpif);
-        if (strcmp(dpif_name, name)) {
-            VLOG_INFO("datapath %s is named %s", name, dpif_name);
+        run(xfif_port_get_name(xfif, XFLOWP_LOCAL, xfif_name, sizeof xfif_name),
+            "obtaining name of %s", xfif_name);
+        xfif_close(xfif);
+        if (strcmp(xfif_name, name)) {
+            VLOG_INFO("datapath %s is named %s", name, xfif_name);
         }
 
-        socket_name = xasprintf("%s/%s.mgmt", ovs_rundir, dpif_name);
+        socket_name = xasprintf("%s/%s.mgmt", ovs_rundir, xfif_name);
         if (stat(socket_name, &s)) {
             ovs_fatal(errno, "cannot connect to %s: stat failed on %s",
                       name, socket_name);
index 6247bf0..750e02e 100644 (file)
@@ -16,7 +16,7 @@ over TCP or SSL.
 The mandatory \fIdatapath\fR argument argument specifies the local datapath
 to relay.  It takes one of the following forms:
 .
-.so lib/dpif.man
+.so lib/xfif.man
 .
 .PP
 The optional \fIcontroller\fR argument specifies how to connect to
index 858770d..fb8c556 100644 (file)
@@ -28,7 +28,6 @@
 #include "compiler.h"
 #include "daemon.h"
 #include "dirs.h"
-#include "dpif.h"
 #include "leak-checker.h"
 #include "list.h"
 #include "netdev.h"
@@ -44,6 +43,7 @@
 #include "unixctl.h"
 #include "util.h"
 #include "vconn.h"
+#include "xfif.h"
 
 #include "vlog.h"
 #define THIS_MODULE VLM_openflowd
@@ -109,7 +109,7 @@ main(int argc, char *argv[])
     struct ofproto *ofproto;
     struct ofsettings s;
     int error;
-    struct dpif *dpif;
+    struct xfif *xfif;
     struct netflow_options nf_options;
 
     proctitle_init(argc, argv);
@@ -131,7 +131,7 @@ main(int argc, char *argv[])
     VLOG_INFO("Open vSwitch version %s", VERSION BUILDNR);
     VLOG_INFO("OpenFlow protocol version 0x%02x", OFP_VERSION);
 
-    error = dpif_create_and_open(s.dp_name, s.dp_type, &dpif);
+    error = xfif_create_and_open(s.dp_name, s.dp_type, &xfif);
     if (error) {
         ovs_fatal(error, "could not create datapath");
     }
@@ -148,7 +148,7 @@ main(int argc, char *argv[])
                 ovs_fatal(error, "failed to open %s as a device", port);
             }
 
-            error = dpif_port_add(dpif, port, 0, NULL);
+            error = xfif_port_add(xfif, port, 0, NULL);
             if (error) {
                 ovs_fatal(error, "failed to add %s as a port", port);
             }
@@ -218,17 +218,17 @@ main(int argc, char *argv[])
             ovs_fatal(error, "unrecoverable datapath error");
         }
         unixctl_server_run(unixctl);
-        dp_run();
+        xf_run();
         netdev_run();
 
         ofproto_wait(ofproto);
         unixctl_server_wait(unixctl);
-        dp_wait();
+        xf_wait();
         netdev_wait();
         poll_block();
     }
 
-    dpif_close(dpif);
+    xfif_close(xfif);
 
     return 0;
 }
@@ -496,7 +496,7 @@ parse_options(int argc, char *argv[], struct ofsettings *s)
     }
 
     /* Local and remote vconns. */
-    dp_parse_name(argv[0], &s->dp_name, &s->dp_type);
+    xf_parse_name(argv[0], &s->dp_name, &s->dp_type);
 
     s->controller_name = argc > 1 ? xstrdup(argv[1]) : NULL;
 
index e5dab84..3aa3a28 100644 (file)
 #include "bitmap.h"
 #include "coverage.h"
 #include "dirs.h"
-#include "dpif.h"
 #include "dynamic-string.h"
 #include "flow.h"
 #include "hash.h"
 #include "list.h"
 #include "mac-learning.h"
 #include "netdev.h"
-#include "odp-util.h"
+#include "xflow-util.h"
 #include "ofp-print.h"
 #include "ofpbuf.h"
 #include "ofproto/netflow.h"
@@ -60,6 +59,7 @@
 #include "vconn.h"
 #include "vswitchd/vswitch-idl.h"
 #include "xenserver.h"
+#include "xfif.h"
 #include "xtoxll.h"
 #include "sflow_api.h"
 
@@ -68,7 +68,7 @@
 
 struct dst {
     uint16_t vlan;
-    uint16_t dp_ifidx;
+    uint16_t xf_ifidx;
 };
 
 struct iface {
@@ -81,7 +81,7 @@ struct iface {
 
     /* These members are valid only after bridge_reconfigure() causes them to
      * be initialized.*/
-    int dp_ifidx;               /* Index within kernel datapath. */
+    int xf_ifidx;               /* Index within kernel datapath. */
     struct netdev *netdev;      /* Network device. */
     bool enabled;               /* May be chosen for flows? */
 
@@ -171,7 +171,7 @@ struct bridge {
     char *dp_desc;              /* Datapath description. */
 
     /* Kernel datapath information. */
-    struct dpif *dpif;          /* Datapath. */
+    struct xfif *xfif;          /* Datapath. */
     struct port_array ifaces;   /* Indexed by kernel datapath port number. */
 
     /* Bridge ports. */
@@ -239,8 +239,8 @@ static void port_reconfigure(struct port *, const struct ovsrec_port *);
 static void port_destroy(struct port *);
 static struct port *port_lookup(const struct bridge *, const char *name);
 static struct iface *port_lookup_iface(const struct port *, const char *name);
-static struct port *port_from_dp_ifidx(const struct bridge *,
-                                       uint16_t dp_ifidx);
+static struct port *port_from_xf_ifidx(const struct bridge *,
+                                       uint16_t xf_ifidx);
 static void port_update_bond_compat(struct port *);
 static void port_update_vlan_compat(struct port *);
 static void port_update_bonding(struct port *);
@@ -255,8 +255,8 @@ static struct iface *iface_create(struct port *port,
                                   const struct ovsrec_interface *if_cfg);
 static void iface_destroy(struct iface *);
 static struct iface *iface_lookup(const struct bridge *, const char *name);
-static struct iface *iface_from_dp_ifidx(const struct bridge *,
-                                         uint16_t dp_ifidx);
+static struct iface *iface_from_xf_ifidx(const struct bridge *,
+                                         uint16_t xf_ifidx);
 static bool iface_is_internal(const struct bridge *, const char *name);
 static void iface_set_mac(struct iface *);
 
@@ -279,11 +279,11 @@ bridge_get_ifaces(struct svec *svec)
 
             for (j = 0; j < port->n_ifaces; j++) {
                 struct iface *iface = port->ifaces[j];
-                if (iface->dp_ifidx < 0) {
+                if (iface->xf_ifidx < 0) {
                     VLOG_ERR("%s interface not in datapath %s, ignoring",
-                             iface->name, dpif_name(br->dpif));
+                             iface->name, xfif_name(br->xfif));
                 } else {
-                    if (iface->dp_ifidx != ODPP_LOCAL) {
+                    if (iface->xf_ifidx != XFLOWP_LOCAL) {
                         svec_add(svec, iface->name);
                     }
                 }
@@ -296,7 +296,7 @@ void
 bridge_init(const struct ovsrec_open_vswitch *cfg)
 {
     struct svec bridge_names;
-    struct svec dpif_names, dpif_types;
+    struct svec xfif_names, xfif_types;
     size_t i;
 
     unixctl_command_register("fdb/show", bridge_unixctl_fdb_show, NULL);
@@ -307,38 +307,38 @@ bridge_init(const struct ovsrec_open_vswitch *cfg)
     }
     svec_sort(&bridge_names);
 
-    svec_init(&dpif_names);
-    svec_init(&dpif_types);
-    dp_enumerate_types(&dpif_types);
-    for (i = 0; i < dpif_types.n; i++) {
-        struct dpif *dpif;
+    svec_init(&xfif_names);
+    svec_init(&xfif_types);
+    xf_enumerate_types(&xfif_types);
+    for (i = 0; i < xfif_types.n; i++) {
+        struct xfif *xfif;
         int retval;
         size_t j;
 
-        dp_enumerate_names(dpif_types.names[i], &dpif_names);
+        xf_enumerate_names(xfif_types.names[i], &xfif_names);
 
-        for (j = 0; j < dpif_names.n; j++) {
-            retval = dpif_open(dpif_names.names[j], dpif_types.names[i], &dpif);
+        for (j = 0; j < xfif_names.n; j++) {
+            retval = xfif_open(xfif_names.names[j], xfif_types.names[i], &xfif);
             if (!retval) {
                 struct svec all_names;
                 size_t k;
 
                 svec_init(&all_names);
-                dpif_get_all_names(dpif, &all_names);
+                xfif_get_all_names(xfif, &all_names);
                 for (k = 0; k < all_names.n; k++) {
                     if (svec_contains(&bridge_names, all_names.names[k])) {
                         goto found;
                     }
                 }
-                dpif_delete(dpif);
+                xfif_delete(xfif);
             found:
                 svec_destroy(&all_names);
-                dpif_close(dpif);
+                xfif_close(xfif);
             }
         }
     }
-    svec_destroy(&dpif_names);
-    svec_destroy(&dpif_types);
+    svec_destroy(&xfif_names);
+    svec_destroy(&xfif_types);
 
     unixctl_command_register("bridge/dump-flows", bridge_unixctl_dump_flows,
                              NULL);
@@ -450,17 +450,17 @@ check_iface_netdev(struct bridge *br OVS_UNUSED, struct iface *iface,
 }
 
 static bool
-check_iface_dp_ifidx(struct bridge *br, struct iface *iface,
+check_iface_xf_ifidx(struct bridge *br, struct iface *iface,
                      void *aux OVS_UNUSED)
 {
-    if (iface->dp_ifidx >= 0) {
+    if (iface->xf_ifidx >= 0) {
         VLOG_DBG("%s has interface %s on port %d",
-                 dpif_name(br->dpif),
-                 iface->name, iface->dp_ifidx);
+                 xfif_name(br->xfif),
+                 iface->name, iface->xf_ifidx);
         return true;
     } else {
         VLOG_ERR("%s interface not in %s, dropping",
-                 iface->name, dpif_name(br->dpif));
+                 iface->name, xfif_name(br->xfif));
         return false;
     }
 }
@@ -476,7 +476,7 @@ set_iface_properties(struct bridge *br OVS_UNUSED, struct iface *iface,
 
     /* Set MAC address of internal interfaces other than the local
      * interface. */
-    if (iface->dp_ifidx != ODPP_LOCAL
+    if (iface->xf_ifidx != XFLOWP_LOCAL
         && iface_is_internal(br, iface->name)) {
         iface_set_mac(iface);
     }
@@ -585,43 +585,43 @@ bridge_reconfigure(const struct ovsrec_open_vswitch *ovs_cfg)
      * that port already belongs to a different datapath, so we must do all
      * port deletions before any port additions. */
     LIST_FOR_EACH (br, struct bridge, node, &all_bridges) {
-        struct odp_port *dpif_ports;
-        size_t n_dpif_ports;
+        struct xflow_port *xfif_ports;
+        size_t n_xfif_ports;
         struct shash want_ifaces;
 
-        dpif_port_list(br->dpif, &dpif_ports, &n_dpif_ports);
+        xfif_port_list(br->xfif, &xfif_ports, &n_xfif_ports);
         bridge_get_all_ifaces(br, &want_ifaces);
-        for (i = 0; i < n_dpif_ports; i++) {
-            const struct odp_port *p = &dpif_ports[i];
+        for (i = 0; i < n_xfif_ports; i++) {
+            const struct xflow_port *p = &xfif_ports[i];
             if (!shash_find(&want_ifaces, p->devname)
                 && strcmp(p->devname, br->name)) {
-                int retval = dpif_port_del(br->dpif, p->port);
+                int retval = xfif_port_del(br->xfif, p->port);
                 if (retval) {
                     VLOG_ERR("failed to remove %s interface from %s: %s",
-                             p->devname, dpif_name(br->dpif),
+                             p->devname, xfif_name(br->xfif),
                              strerror(retval));
                 }
             }
         }
         shash_destroy(&want_ifaces);
-        free(dpif_ports);
+        free(xfif_ports);
     }
     LIST_FOR_EACH (br, struct bridge, node, &all_bridges) {
-        struct odp_port *dpif_ports;
-        size_t n_dpif_ports;
+        struct xflow_port *xfif_ports;
+        size_t n_xfif_ports;
         struct shash cur_ifaces, want_ifaces;
         struct shash_node *node;
 
         /* Get the set of interfaces currently in this datapath. */
-        dpif_port_list(br->dpif, &dpif_ports, &n_dpif_ports);
+        xfif_port_list(br->xfif, &xfif_ports, &n_xfif_ports);
         shash_init(&cur_ifaces);
-        for (i = 0; i < n_dpif_ports; i++) {
-            const char *name = dpif_ports[i].devname;
+        for (i = 0; i < n_xfif_ports; i++) {
+            const char *name = xfif_ports[i].devname;
             if (!shash_find(&cur_ifaces, name)) {
                 shash_add(&cur_ifaces, name, NULL);
             }
         }
-        free(dpif_ports);
+        free(xfif_ports);
 
         /* Get the set of interfaces we want on this datapath. */
         bridge_get_all_ifaces(br, &want_ifaces);
@@ -642,15 +642,15 @@ bridge_reconfigure(const struct ovsrec_open_vswitch *ovs_cfg)
 
                 /* Add to datapath. */
                 internal = iface_is_internal(br, if_name);
-                error = dpif_port_add(br->dpif, if_name,
-                                      internal ? ODP_PORT_INTERNAL : 0, NULL);
+                error = xfif_port_add(br->xfif, if_name,
+                                      internal ? XFLOW_PORT_INTERNAL : 0, NULL);
                 if (error == EFBIG) {
                     VLOG_ERR("ran out of valid port numbers on %s",
-                             dpif_name(br->dpif));
+                             xfif_name(br->xfif));
                     break;
                 } else if (error) {
                     VLOG_ERR("failed to add %s interface to %s: %s",
-                             if_name, dpif_name(br->dpif), strerror(error));
+                             if_name, xfif_name(br->xfif), strerror(error));
                 }
             }
         }
@@ -668,7 +668,7 @@ bridge_reconfigure(const struct ovsrec_open_vswitch *ovs_cfg)
         bridge_fetch_dp_ifaces(br);
 
         iterate_and_prune_ifaces(br, check_iface_netdev, NULL);
-        iterate_and_prune_ifaces(br, check_iface_dp_ifidx, NULL);
+        iterate_and_prune_ifaces(br, check_iface_xf_ifidx, NULL);
 
         /* Pick local port hardware address, datapath ID. */
         bridge_pick_local_hw_addr(br, ea, &hw_addr_iface);
@@ -697,7 +697,7 @@ bridge_reconfigure(const struct ovsrec_open_vswitch *ovs_cfg)
 
             memset(&opts, 0, sizeof opts);
 
-            dpif_get_netflow_ids(br->dpif, &opts.engine_type, &opts.engine_id);
+            xfif_get_netflow_ids(br->xfif, &opts.engine_type, &opts.engine_id);
             if (nf_cfg->engine_type) {
                 opts.engine_type = *nf_cfg->engine_type;
             }
@@ -780,7 +780,7 @@ bridge_reconfigure(const struct ovsrec_open_vswitch *ovs_cfg)
         /* Update the controller and related settings.  It would be more
          * straightforward to call this from bridge_reconfigure_one(), but we
          * can't do it there for two reasons.  First, and most importantly, at
-         * that point we don't know the dp_ifidx of any interfaces that have
+         * that point we don't know the xf_ifidx of any interfaces that have
          * been added to the bridge (because we haven't actually added them to
          * the datapath).  Second, at that point we haven't set the datapath ID
          * yet; when a controller is configured, resetting the datapath ID will
@@ -885,7 +885,7 @@ bridge_pick_local_hw_addr(struct bridge *br, uint8_t ea[ETH_ADDR_LEN],
 
             /* The local port doesn't count (since we're trying to choose its
              * MAC address anyway). */
-            if (iface->dp_ifidx == ODPP_LOCAL) {
+            if (iface->xf_ifidx == XFLOWP_LOCAL) {
                 continue;
             }
 
@@ -1059,7 +1059,7 @@ bridge_flush(struct bridge *br)
     mac_learning_flush(br->ml);
 }
 
-/* Returns the 'br' interface for the ODPP_LOCAL port, or null if 'br' has no
+/* Returns the 'br' interface for the XFLOWP_LOCAL port, or null if 'br' has no
  * such interface. */
 static struct iface *
 bridge_get_local_iface(struct bridge *br)
@@ -1070,7 +1070,7 @@ bridge_get_local_iface(struct bridge *br)
         struct port *port = br->ports[i];
         for (j = 0; j < port->n_ifaces; j++) {
             struct iface *iface = port->ifaces[j];
-            if (iface->dp_ifidx == ODPP_LOCAL) {
+            if (iface->xf_ifidx == XFLOWP_LOCAL) {
                 return iface;
             }
         }
@@ -1100,7 +1100,7 @@ bridge_unixctl_fdb_show(struct unixctl_conn *conn,
             continue;
         }
         ds_put_format(&ds, "%5d  %4d  "ETH_ADDR_FMT"  %3d\n",
-                      br->ports[e->port]->ifaces[0]->dp_ifidx,
+                      br->ports[e->port]->ifaces[0]->xf_ifidx,
                       e->vlan, ETH_ADDR_ARGS(e->mac), mac_entry_age(e));
     }
     unixctl_command_reply(conn, 200, ds_cstr(&ds));
@@ -1117,21 +1117,21 @@ bridge_create(const struct ovsrec_bridge *br_cfg)
     assert(!bridge_lookup(br_cfg->name));
     br = xzalloc(sizeof *br);
 
-    error = dpif_create_and_open(br_cfg->name, br_cfg->datapath_type,
-                                 &br->dpif);
+    error = xfif_create_and_open(br_cfg->name, br_cfg->datapath_type,
+                                 &br->xfif);
     if (error) {
         free(br);
         return NULL;
     }
-    dpif_flow_flush(br->dpif);
+    xfif_flow_flush(br->xfif);
 
     error = ofproto_create(br_cfg->name, br_cfg->datapath_type, &bridge_ofhooks,
                            br, &br->ofproto);
     if (error) {
         VLOG_ERR("failed to create switch %s: %s", br_cfg->name,
                  strerror(error));
-        dpif_delete(br->dpif);
-        dpif_close(br->dpif);
+        xfif_delete(br->xfif);
+        xfif_close(br->xfif);
         free(br);
         return NULL;
     }
@@ -1149,7 +1149,7 @@ bridge_create(const struct ovsrec_bridge *br_cfg)
 
     list_push_back(&all_bridges, &br->node);
 
-    VLOG_INFO("created bridge %s on %s", br->name, dpif_name(br->dpif));
+    VLOG_INFO("created bridge %s on %s", br->name, xfif_name(br->xfif));
 
     return br;
 }
@@ -1164,12 +1164,12 @@ bridge_destroy(struct bridge *br)
             port_destroy(br->ports[br->n_ports - 1]);
         }
         list_remove(&br->node);
-        error = dpif_delete(br->dpif);
+        error = xfif_delete(br->xfif);
         if (error && error != ENOENT) {
             VLOG_ERR("failed to delete %s: %s",
-                     dpif_name(br->dpif), strerror(error));
+                     xfif_name(br->xfif), strerror(error));
         }
-        dpif_close(br->dpif);
+        xfif_close(br->xfif);
         ofproto_destroy(br->ofproto);
         free(br->controller);
         mac_learning_destroy(br->ml);
@@ -1384,7 +1384,7 @@ bridge_reconfigure_one(const struct ovsrec_open_vswitch *ovs_cfg,
         char local_name[IF_NAMESIZE];
         int error;
 
-        error = dpif_port_get_name(br->dpif, ODPP_LOCAL,
+        error = xfif_port_get_name(br->xfif, XFLOWP_LOCAL,
                                    local_name, sizeof local_name);
         if (!error && !shash_find(&new_ports, local_name)) {
             VLOG_WARN("bridge %s: controller specified but no local port "
@@ -1613,16 +1613,16 @@ bridge_get_all_ifaces(const struct bridge *br, struct shash *ifaces)
 /* For robustness, in case the administrator moves around datapath ports behind
  * our back, we re-check all the datapath port numbers here.
  *
- * This function will set the 'dp_ifidx' members of interfaces that have
+ * This function will set the 'xf_ifidx' members of interfaces that have
  * disappeared to -1, so only call this function from a context where those
  * 'struct iface's will be removed from the bridge.  Otherwise, the -1
- * 'dp_ifidx'es will cause trouble later when we try to send them to the
+ * 'xf_ifidx'es will cause trouble later when we try to send them to the
  * datapath, which doesn't support UINT16_MAX+1 ports. */
 static void
 bridge_fetch_dp_ifaces(struct bridge *br)
 {
-    struct odp_port *dpif_ports;
-    size_t n_dpif_ports;
+    struct xflow_port *xfif_ports;
+    size_t n_xfif_ports;
     size_t i, j;
 
     /* Reset all interface numbers. */
@@ -1630,36 +1630,36 @@ bridge_fetch_dp_ifaces(struct bridge *br)
         struct port *port = br->ports[i];
         for (j = 0; j < port->n_ifaces; j++) {
             struct iface *iface = port->ifaces[j];
-            iface->dp_ifidx = -1;
+            iface->xf_ifidx = -1;
         }
     }
     port_array_clear(&br->ifaces);
 
-    dpif_port_list(br->dpif, &dpif_ports, &n_dpif_ports);
-    for (i = 0; i < n_dpif_ports; i++) {
-        struct odp_port *p = &dpif_ports[i];
+    xfif_port_list(br->xfif, &xfif_ports, &n_xfif_ports);
+    for (i = 0; i < n_xfif_ports; i++) {
+        struct xflow_port *p = &xfif_ports[i];
         struct iface *iface = iface_lookup(br, p->devname);
         if (iface) {
-            if (iface->dp_ifidx >= 0) {
+            if (iface->xf_ifidx >= 0) {
                 VLOG_WARN("%s reported interface %s twice",
-                          dpif_name(br->dpif), p->devname);
-            } else if (iface_from_dp_ifidx(br, p->port)) {
+                          xfif_name(br->xfif), p->devname);
+            } else if (iface_from_xf_ifidx(br, p->port)) {
                 VLOG_WARN("%s reported interface %"PRIu16" twice",
-                          dpif_name(br->dpif), p->port);
+                          xfif_name(br->xfif), p->port);
             } else {
                 port_array_set(&br->ifaces, p->port, iface);
-                iface->dp_ifidx = p->port;
+                iface->xf_ifidx = p->port;
             }
 
             if (iface->cfg) {
-                int64_t ofport = (iface->dp_ifidx >= 0
-                                  ? odp_port_to_ofp_port(iface->dp_ifidx)
+                int64_t ofport = (iface->xf_ifidx >= 0
+                                  ? xflow_port_to_ofp_port(iface->xf_ifidx)
                                   : -1);
                 ovsrec_interface_set_ofport(iface->cfg, &ofport, 1);
             }
         }
     }
-    free(dpif_ports);
+    free(xfif_ports);
 }
 \f
 /* Bridge packet processing functions. */
@@ -1708,7 +1708,7 @@ bond_choose_iface(const struct port *port)
 
 static bool
 choose_output_iface(const struct port *port, const uint8_t *dl_src,
-                    uint16_t *dp_ifidx, tag_type *tags)
+                    uint16_t *xf_ifidx, tag_type *tags)
 {
     struct iface *iface;
 
@@ -1732,7 +1732,7 @@ choose_output_iface(const struct port *port, const uint8_t *dl_src,
         *tags |= e->iface_tag;
         iface = port->ifaces[e->iface_idx];
     }
-    *dp_ifidx = iface->dp_ifidx;
+    *xf_ifidx = iface->xf_ifidx;
     *tags |= iface->tag;        /* Currently only used for bonding. */
     return true;
 }
@@ -1889,7 +1889,7 @@ set_dst(struct dst *p, const flow_t *flow,
     p->vlan = (out_port->vlan >= 0 ? OFP_VLAN_NONE
               : in_port->vlan >= 0 ? in_port->vlan
               : ntohs(flow->dl_vlan));
-    return choose_output_iface(out_port, flow->dl_src, &p->dp_ifidx, tags);
+    return choose_output_iface(out_port, flow->dl_src, &p->xf_ifidx, tags);
 }
 
 static void
@@ -1950,7 +1950,7 @@ dst_is_duplicate(const struct dst *dsts, size_t n_dsts,
 {
     size_t i;
     for (i = 0; i < n_dsts; i++) {
-        if (dsts[i].vlan == test->vlan && dsts[i].dp_ifidx == test->dp_ifidx) {
+        if (dsts[i].vlan == test->vlan && dsts[i].xf_ifidx == test->xf_ifidx) {
             return true;
         }
     }
@@ -1979,7 +1979,7 @@ compose_dsts(const struct bridge *br, const flow_t *flow, uint16_t vlan,
     size_t i;
 
     if (out_port == FLOOD_PORT) {
-        /* XXX use ODP_FLOOD if no vlans or bonding. */
+        /* XXX use XFLOW_FLOOD if no vlans or bonding. */
         /* XXX even better, define each VLAN as a datapath port group */
         for (i = 0; i < br->n_ports; i++) {
             struct port *port = br->ports[i];
@@ -1992,7 +1992,7 @@ compose_dsts(const struct bridge *br, const flow_t *flow, uint16_t vlan,
         }
         *nf_output_iface = NF_OUT_FLOOD;
     } else if (out_port && set_dst(dst, flow, in_port, out_port, tags)) {
-        *nf_output_iface = dst->dp_ifidx;
+        *nf_output_iface = dst->xf_ifidx;
         mirrors |= out_port->dst_mirrors;
         dst++;
     }
@@ -2050,7 +2050,7 @@ static void OVS_UNUSED
 print_dsts(const struct dst *dsts, size_t n)
 {
     for (; n--; dsts++) {
-        printf(">p%"PRIu16, dsts->dp_ifidx);
+        printf(">p%"PRIu16, dsts->xf_ifidx);
         if (dsts->vlan != OFP_VLAN_NONE) {
             printf("v%"PRIu16, dsts->vlan);
         }
@@ -2060,7 +2060,7 @@ print_dsts(const struct dst *dsts, size_t n)
 static void
 compose_actions(struct bridge *br, const flow_t *flow, uint16_t vlan,
                 const struct port *in_port, const struct port *out_port,
-                tag_type *tags, struct odp_actions *actions,
+                tag_type *tags, struct xflow_actions *actions,
                 uint16_t *nf_output_iface)
 {
     struct dst dsts[DP_MAX_PORTS * (MAX_MIRRORS + 1)];
@@ -2073,19 +2073,19 @@ compose_actions(struct bridge *br, const flow_t *flow, uint16_t vlan,
 
     cur_vlan = ntohs(flow->dl_vlan);
     for (p = dsts; p < &dsts[n_dsts]; p++) {
-        union odp_action *a;
+        union xflow_action *a;
         if (p->vlan != cur_vlan) {
             if (p->vlan == OFP_VLAN_NONE) {
-                odp_actions_add(actions, ODPAT_STRIP_VLAN);
+                xflow_actions_add(actions, XFLOWAT_STRIP_VLAN);
             } else {
-                a = odp_actions_add(actions, ODPAT_SET_DL_TCI);
+                a = xflow_actions_add(actions, XFLOWAT_SET_DL_TCI);
                 a->dl_tci.tci = htons(p->vlan & VLAN_VID_MASK);
                 a->dl_tci.mask = htons(VLAN_VID_MASK);
             }
             cur_vlan = p->vlan;
         }
-        a = odp_actions_add(actions, ODPAT_OUTPUT);
-        a->output.port = p->dp_ifidx;
+        a = xflow_actions_add(actions, XFLOWAT_OUTPUT);
+        a->output.port = p->xf_ifidx;
     }
 }
 
@@ -2167,7 +2167,7 @@ is_bcast_arp_reply(const flow_t *flow)
  * not at all, if 'packet' was NULL. */
 static bool
 process_flow(struct bridge *br, const flow_t *flow,
-             const struct ofpbuf *packet, struct odp_actions *actions,
+             const struct ofpbuf *packet, struct xflow_actions *actions,
              tag_type *tags, uint16_t *nf_output_iface)
 {
     struct iface *in_iface;
@@ -2177,7 +2177,7 @@ process_flow(struct bridge *br, const flow_t *flow,
     int out_port_idx;
 
     /* Find the interface and port structure for the received packet. */
-    in_iface = iface_from_dp_ifidx(br, flow->in_port);
+    in_iface = iface_from_xf_ifidx(br, flow->in_port);
     if (!in_iface) {
         /* No interface?  Something fishy... */
         if (packet != NULL) {
@@ -2288,7 +2288,7 @@ bridge_port_changed_ofhook_cb(enum ofp_port_reason reason,
     struct iface *iface;
     struct port *port;
 
-    iface = iface_from_dp_ifidx(br, ofp_port_to_odp_port(opp->port_no));
+    iface = iface_from_xf_ifidx(br, ofp_port_to_xflow_port(opp->port_no));
     if (!iface) {
         return;
     }
@@ -2316,7 +2316,7 @@ bridge_port_changed_ofhook_cb(enum ofp_port_reason reason,
 
 static bool
 bridge_normal_ofhook_cb(const flow_t *flow, const struct ofpbuf *packet,
-                        struct odp_actions *actions, tag_type *tags,
+                        struct xflow_actions *actions, tag_type *tags,
                         uint16_t *nf_output_iface, void *br_)
 {
     struct bridge *br = br_;
@@ -2327,18 +2327,18 @@ bridge_normal_ofhook_cb(const flow_t *flow, const struct ofpbuf *packet,
 
 static void
 bridge_account_flow_ofhook_cb(const flow_t *flow,
-                              const union odp_action *actions,
+                              const union xflow_action *actions,
                               size_t n_actions, unsigned long long int n_bytes,
                               void *br_)
 {
     struct bridge *br = br_;
     struct port *in_port;
-    const union odp_action *a;
+    const union xflow_action *a;
 
     /* Feed information from the active flows back into the learning table
      * to ensure that table is always in sync with what is actually flowing
      * through the datapath. */
-    in_port = port_from_dp_ifidx(br, flow->in_port);
+    in_port = port_from_xf_ifidx(br, flow->in_port);
     if (in_port) {
         int vlan = flow_get_vlan(br, flow, in_port, false);
          if (vlan >= 0) {
@@ -2351,8 +2351,8 @@ bridge_account_flow_ofhook_cb(const flow_t *flow,
     }
 
     for (a = actions; a < &actions[n_actions]; a++) {
-        if (a->type == ODPAT_OUTPUT) {
-            struct port *out_port = port_from_dp_ifidx(br, a->output.port);
+        if (a->type == XFLOWAT_OUTPUT) {
+            struct port *out_port = port_from_xf_ifidx(br, a->output.port);
             if (out_port && out_port->n_ifaces >= 2) {
                 struct bond_entry *e = lookup_bond_entry(out_port,
                                                          flow->dl_src);
@@ -2709,13 +2709,13 @@ bond_send_learning_packets(struct port *port)
     error = n_packets = n_errors = 0;
     LIST_FOR_EACH (e, struct mac_entry, lru_node, &br->ml->lrus) {
         union ofp_action actions[2], *a;
-        uint16_t dp_ifidx;
+        uint16_t xf_ifidx;
         tag_type tags = 0;
         flow_t flow;
         int retval;
 
         if (e->port == port->port_idx
-            || !choose_output_iface(port, e->mac, &dp_ifidx, &tags)) {
+            || !choose_output_iface(port, e->mac, &xf_ifidx, &tags)) {
             continue;
         }
 
@@ -2730,14 +2730,14 @@ bond_send_learning_packets(struct port *port)
         }
         a->output.type = htons(OFPAT_OUTPUT);
         a->output.len = htons(sizeof *a);
-        a->output.port = htons(odp_port_to_ofp_port(dp_ifidx));
+        a->output.port = htons(xflow_port_to_ofp_port(xf_ifidx));
         a++;
 
         /* Send packet. */
         n_packets++;
         compose_benign_packet(&packet, "Open vSwitch Bond Failover", 0xf177,
                               e->mac);
-        flow_extract(&packet, ODPP_NONE, &flow);
+        flow_extract(&packet, XFLOWP_NONE, &flow);
         retval = ofproto_send_packet(br->ofproto, &flow, actions, a - actions,
                                      &packet);
         if (retval) {
@@ -2860,12 +2860,12 @@ bond_unixctl_show(struct unixctl_conn *conn,
             /* MACs. */
             LIST_FOR_EACH (me, struct mac_entry, lru_node,
                            &port->bridge->ml->lrus) {
-                uint16_t dp_ifidx;
+                uint16_t xf_ifidx;
                 tag_type tags = 0;
                 if (bond_hash(me->mac) == hash
                     && me->port != port->port_idx
-                    && choose_output_iface(port, me->mac, &dp_ifidx, &tags)
-                    && dp_ifidx == iface->dp_ifidx)
+                    && choose_output_iface(port, me->mac, &xf_ifidx, &tags)
+                    && xf_ifidx == iface->xf_ifidx)
                 {
                     ds_put_format(&ds, "\t\t"ETH_ADDR_FMT"\n",
                                   ETH_ADDR_ARGS(me->mac));
@@ -3243,9 +3243,9 @@ port_destroy(struct port *port)
 }
 
 static struct port *
-port_from_dp_ifidx(const struct bridge *br, uint16_t dp_ifidx)
+port_from_xf_ifidx(const struct bridge *br, uint16_t xf_ifidx)
 {
-    struct iface *iface = iface_from_dp_ifidx(br, dp_ifidx);
+    struct iface *iface = iface_from_xf_ifidx(br, xf_ifidx);
     return iface ? iface->port : NULL;
 }
 
@@ -3429,7 +3429,7 @@ iface_create(struct port *port, const struct ovsrec_interface *if_cfg)
     iface->port = port;
     iface->port_ifidx = port->n_ifaces;
     iface->name = xstrdup(name);
-    iface->dp_ifidx = -1;
+    iface->xf_ifidx = -1;
     iface->tag = tag_create_random();
     iface->delay_expires = LLONG_MAX;
     iface->netdev = NULL;
@@ -3470,8 +3470,8 @@ iface_destroy(struct iface *iface)
         bool del_active = port->active_iface == iface->port_ifidx;
         struct iface *del;
 
-        if (iface->dp_ifidx >= 0) {
-            port_array_set(&br->ifaces, iface->dp_ifidx, NULL);
+        if (iface->xf_ifidx >= 0) {
+            port_array_set(&br->ifaces, iface->xf_ifidx, NULL);
         }
 
         del = port->ifaces[iface->port_ifidx] = port->ifaces[--port->n_ifaces];
@@ -3510,14 +3510,14 @@ iface_lookup(const struct bridge *br, const char *name)
 }
 
 static struct iface *
-iface_from_dp_ifidx(const struct bridge *br, uint16_t dp_ifidx)
+iface_from_xf_ifidx(const struct bridge *br, uint16_t xf_ifidx)
 {
-    return port_array_get(&br->ifaces, dp_ifidx);
+    return port_array_get(&br->ifaces, xf_ifidx);
 }
 
 /* Returns true if 'iface' is the name of an "internal" interface on bridge
  * 'br', that is, an interface that is entirely simulated within the datapath.
- * The local port (ODPP_LOCAL) is always an internal interface.  Other local
+ * The local port (XFLOWP_LOCAL) is always an internal interface.  Other local
  * interfaces are created by setting "iface.<iface>.internal = true".
  *
  * In addition, we have a kluge-y feature that creates an internal port with
@@ -3559,7 +3559,7 @@ iface_set_mac(struct iface *iface)
         if (eth_addr_is_multicast(ea)) {
             VLOG_ERR("interface %s: cannot set MAC to multicast address",
                      iface->name);
-        } else if (iface->dp_ifidx == ODPP_LOCAL) {
+        } else if (iface->xf_ifidx == XFLOWP_LOCAL) {
             VLOG_ERR("ignoring iface.%s.mac; use bridge.%s.mac instead",
                      iface->name, iface->name);
         } else {
index c1acfc4..9472bfe 100644 (file)
@@ -30,7 +30,6 @@
 #include "command-line.h"
 #include "compiler.h"
 #include "daemon.h"
-#include "dpif.h"
 #include "leak-checker.h"
 #include "netdev.h"
 #include "ovsdb-idl.h"
@@ -46,6 +45,7 @@
 #include "util.h"
 #include "vconn.h"
 #include "vswitchd/vswitch-idl.h"
+#include "xfif.h"
 
 #include "vlog.h"
 #define THIS_MODULE VLM_vswitchd
@@ -117,7 +117,7 @@ main(int argc, char *argv[])
             }
         }
         unixctl_server_run(unixctl);
-        dp_run();
+        xf_run();
         netdev_run();
 
         signal_wait(sighup);
@@ -126,7 +126,7 @@ main(int argc, char *argv[])
         }
         ovsdb_idl_wait(idl);
         unixctl_server_wait(unixctl);
-        dp_wait();
+        xf_wait();
         netdev_wait();
         poll_block();
     }