/* Creates the netdev device of 'type' with 'name'. */
static int
-netdev_linux_create_system(const char *name, const char *type OVS_UNUSED,
- const struct shash *args, struct netdev_dev **netdev_devp)
+netdev_linux_create_system(const struct netdev_class *class OVS_UNUSED,
+ const char *name, const struct shash *args,
+ struct netdev_dev **netdev_devp)
{
struct netdev_dev_linux *netdev_dev;
int error;
* buffers, across all readers. Therefore once data is read it will
* be unavailable to other reads for tap devices. */
static int
-netdev_linux_create_tap(const char *name, const char *type OVS_UNUSED,
- const struct shash *args, struct netdev_dev **netdev_devp)
+netdev_linux_create_tap(const struct netdev_class *class OVS_UNUSED,
+ const char *name, const struct shash *args,
+ struct netdev_dev **netdev_devp)
{
struct netdev_dev_linux *netdev_dev;
struct tap_state *state;
}
static int
-netdev_patch_create(const char *name, const char *type OVS_UNUSED,
- const struct shash *args, struct netdev_dev **netdev_devp)
+netdev_patch_create(const struct netdev_class *class OVS_UNUSED,
+ const char *name, const struct shash *args,
+ struct netdev_dev **netdev_devp)
{
int err;
struct odp_vport_add ova;
* to be called. May be null if nothing is needed here. */
void (*wait)(void);
- /* Attempts to create a network device of 'type' with 'name'.
- * 'type' corresponds to the 'type' field used in the netdev_class
- * structure. On success sets 'netdev_devp' to the newly created device. */
- int (*create)(const char *name, const char *type, const struct shash *args,
- struct netdev_dev **netdev_devp);
+ /* Attempts to create a network device named 'name' with initial 'args' in
+ * 'netdev_class'. On success sets 'netdev_devp' to the newly created
+ * device. */
+ int (*create)(const struct netdev_class *netdev_class, const char *name,
+ const struct shash *args, struct netdev_dev **netdev_devp);
/* Destroys 'netdev_dev'.
*
struct netdev netdev;
};
-static int netdev_tunnel_create(const char *name, const char *type,
+static int netdev_tunnel_create(const struct netdev_class *, const char *name,
const struct shash *args, struct netdev_dev **);
static struct netdev_dev_tunnel *
}
static int
-netdev_tunnel_create(const char *name, const char *type,
+netdev_tunnel_create(const struct netdev_class *class, const char *name,
const struct shash *args, struct netdev_dev **netdev_devp)
{
int err;
struct tnl_port_config port_config;
struct netdev_dev_tunnel *netdev_dev;
- ovs_strlcpy(ova.port_type, type, sizeof ova.port_type);
+ ovs_strlcpy(ova.port_type, class->type, sizeof ova.port_type);
ovs_strlcpy(ova.devname, name, sizeof ova.devname);
ova.config = &port_config;
- err = parse_config(name, type, args, &port_config);
+ err = parse_config(name, class->type, args, &port_config);
if (err) {
return err;
}
netdev_dev = xmalloc(sizeof *netdev_dev);
- if (!strcmp(type, "gre")) {
- netdev_dev_init(&netdev_dev->netdev_dev, name, &netdev_gre_class);
- } else {
- netdev_dev_init(&netdev_dev->netdev_dev, name, &netdev_capwap_class);
- }
-
+ netdev_dev_init(&netdev_dev->netdev_dev, name, class);
*netdev_devp = &netdev_dev->netdev_dev;
return 0;
}
return EAFNOSUPPORT;
}
- return netdev_class->create(options->name, options->type, options->args,
+ return netdev_class->create(netdev_class, options->name, options->args,
netdev_devp);
}