return 0;
}
+static const char *
+dpif_netdev_port_open_type(const struct dpif_class *class, const char *type)
+{
+ return strcmp(type, "internal") ? type
+ : class != &dpif_netdev_class ? "dummy"
+ : "tap";
+}
+
static struct dpif *
create_dpif_netdev(struct dp_netdev *dp)
{
/* XXX reject devices already in some dp_netdev. */
/* Open and validate network device. */
- open_type = (strcmp(type, "internal") ? type
- : dp->class != &dpif_netdev_class ? "dummy"
- : "tap");
+ open_type = dpif_netdev_port_open_type(dp->class, type);
error = netdev_open(devname, open_type, &netdev);
if (error) {
return error;
dpif_netdev_flow_from_nlattrs(const struct nlattr *key, uint32_t key_len,
struct flow *flow)
{
- if (odp_flow_key_to_flow(key, key_len, flow)) {
+ if (odp_flow_key_to_flow(key, key_len, flow) != ODP_FIT_PERFECT) {
/* This should not happen: it indicates that odp_flow_key_from_flow()
* and odp_flow_key_to_flow() disagree on the acceptable form of a
* flow. Log the problem as an error, with enough details to enable
const struct dpif_class dpif_netdev_class = {
"netdev",
dpif_netdev_enumerate,
+ dpif_netdev_port_open_type,
dpif_netdev_open,
dpif_netdev_close,
dpif_netdev_destroy,