[ovs-dev] [netlink v2 4/4] datapath: Make adding and attaching a vport a single step.
Jesse Gross
jesse at nicira.com
Thu Sep 30 00:35:24 UTC 2010
On Fri, Sep 24, 2010 at 5:15 PM, Ben Pfaff <blp at nicira.com> wrote:
> diff --git a/lib/netdev-vport.c b/lib/netdev-vport.c
> index 90eb741..ffbb4b3 100644
> +int
> +netdev_vport_parse_config(struct odp_port *port, const char *name,
> + const char *type, const struct shash *args)
> {
> - const struct vport_class *c = vport_class_cast(netdev_class);
> - if (c->parse_config) {
> - struct vport_info info;
> - int error;
> -
> - info.devname = name;
> - info.type = netdev_class->type;
> - error = (c->parse_config)(&info, args);
> - *configp = info.config;
> - return error;
> + memset(port, 0, sizeof *port);
> + strncpy(port->devname, name, sizeof port->devname);
> +
> + if (type[0] == '\0' || !strcmp(type, "system")) {
> + strncpy(port->type, "netdev", sizeof port->type);
> } else {
> - if (!shash_is_empty(args)) {
> - VLOG_WARN("%s: arguments for %s vports should be empty",
> - name, netdev_class->type);
> + const struct netdev_class *netdev_class;
> + const struct vport_class *class;
> +
> + strncpy(port->type, type, sizeof port->type);
> +
> + netdev_class = netdev_lookup_provider(port->type);
> + class = (netdev_class && is_vport_class(netdev_class)
> + ? vport_class_cast(netdev_class)
> + : NULL);
> +
> + if (!class) {
> + VLOG_WARN("%s: unsupported port type \"%s\"", name, type);
> + return EINVAL;
> + } else if (class->parse_config) {
> + return (class->parse_config)(port, args);
Does this break "internal"/non-vport devices (if we had others)? They
won't get caught by the "system" type and it won't find a vport class
type.
> diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
> index 6c271fb..c310311 100644
> + /* Determine interface type. The local port always has type
> + * "internal". Other ports take their type from the database and
> + * default to "netdev" if none is specified. */
Default is "system" in userspace.
More information about the dev
mailing list