[ovs-dev] [VLAN splinters 06/16] netdev: Remove netdev_get_vlan_vid().

Ethan Jackson ethan at nicira.com
Wed Nov 23 03:07:09 UTC 2011


Looks good.

Ethan

On Tue, Nov 15, 2011 at 17:17, Ben Pfaff <blp at nicira.com> wrote:
> It has no remaining users.
> ---
>  lib/netdev-dummy.c    |    1 -
>  lib/netdev-linux.c    |   56 -------------------------------------------------
>  lib/netdev-provider.h |   11 ---------
>  lib/netdev-vport.c    |    1 -
>  lib/netdev.c          |   18 ---------------
>  lib/netdev.h          |    3 --
>  6 files changed, 0 insertions(+), 90 deletions(-)
>
> diff --git a/lib/netdev-dummy.c b/lib/netdev-dummy.c
> index f62ea53..4090236 100644
> --- a/lib/netdev-dummy.c
> +++ b/lib/netdev-dummy.c
> @@ -277,7 +277,6 @@ static const struct netdev_class dummy_class = {
>
>     NULL,                       /* get_features */
>     NULL,                       /* set_advertisements */
> -    NULL,                       /* get_vlan_vid */
>
>     NULL,                       /* set_policing */
>     NULL,                       /* get_qos_types */
> diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
> index 8329f22..dddec33 100644
> --- a/lib/netdev-linux.c
> +++ b/lib/netdev-linux.c
> @@ -72,7 +72,6 @@
>
>  VLOG_DEFINE_THIS_MODULE(netdev_linux);
>
> -COVERAGE_DEFINE(netdev_get_vlan_vid);
>  COVERAGE_DEFINE(netdev_set_policing);
>  COVERAGE_DEFINE(netdev_arp_lookup);
>  COVERAGE_DEFINE(netdev_get_ifindex);
> @@ -1544,60 +1543,6 @@ netdev_linux_set_advertisements(struct netdev *netdev, uint32_t advertise)
>                                    ETHTOOL_SSET, "ETHTOOL_SSET");
>  }
>
> -/* If 'netdev_name' is the name of a VLAN network device (e.g. one created with
> - * vconfig(8)), sets '*vlan_vid' to the VLAN VID associated with that device
> - * and returns 0.  Otherwise returns a errno value (specifically ENOENT if
> - * 'netdev_name' is the name of a network device that is not a VLAN device) and
> - * sets '*vlan_vid' to -1. */
> -static int
> -netdev_linux_get_vlan_vid(const struct netdev *netdev, int *vlan_vid)
> -{
> -    const char *netdev_name = netdev_get_name(netdev);
> -    struct ds line = DS_EMPTY_INITIALIZER;
> -    FILE *stream = NULL;
> -    int error;
> -    char *fn;
> -
> -    COVERAGE_INC(netdev_get_vlan_vid);
> -    fn = xasprintf("/proc/net/vlan/%s", netdev_name);
> -    stream = fopen(fn, "r");
> -    if (!stream) {
> -        error = errno;
> -        goto done;
> -    }
> -
> -    if (ds_get_line(&line, stream)) {
> -        if (ferror(stream)) {
> -            error = errno;
> -            VLOG_ERR_RL(&rl, "error reading \"%s\": %s", fn, strerror(errno));
> -        } else {
> -            error = EPROTO;
> -            VLOG_ERR_RL(&rl, "unexpected end of file reading \"%s\"", fn);
> -        }
> -        goto done;
> -    }
> -
> -    if (!sscanf(ds_cstr(&line), "%*s VID: %d", vlan_vid)) {
> -        error = EPROTO;
> -        VLOG_ERR_RL(&rl, "parse error reading \"%s\" line 1: \"%s\"",
> -                    fn, ds_cstr(&line));
> -        goto done;
> -    }
> -
> -    error = 0;
> -
> -done:
> -    free(fn);
> -    if (stream) {
> -        fclose(stream);
> -    }
> -    ds_destroy(&line);
> -    if (error) {
> -        *vlan_vid = -1;
> -    }
> -    return error;
> -}
> -
>  #define POLICE_ADD_CMD "/sbin/tc qdisc add dev %s handle ffff: ingress"
>  #define POLICE_CONFIG_CMD "/sbin/tc filter add dev %s parent ffff: protocol ip prio 50 u32 match ip src 0.0.0.0/0 police rate %dkbit burst %dk mtu 65535 drop flowid :1"
>
> @@ -2331,7 +2276,6 @@ netdev_linux_change_seq(const struct netdev *netdev)
>                                                                 \
>     netdev_linux_get_features,                                  \
>     netdev_linux_set_advertisements,                            \
> -    netdev_linux_get_vlan_vid,                                  \
>                                                                 \
>     netdev_linux_set_policing,                                  \
>     netdev_linux_get_qos_types,                                 \
> diff --git a/lib/netdev-provider.h b/lib/netdev-provider.h
> index 921c397..81e6c39 100644
> --- a/lib/netdev-provider.h
> +++ b/lib/netdev-provider.h
> @@ -320,17 +320,6 @@ struct netdev_class {
>      * support configuring advertisements. */
>     int (*set_advertisements)(struct netdev *netdev, uint32_t advertise);
>
> -    /* If 'netdev' is a VLAN network device (e.g. one created with vconfig(8)),
> -     * sets '*vlan_vid' to the VLAN VID associated with that device and returns
> -     * 0.
> -     *
> -     * Returns ENOENT if 'netdev' is a network device that is not a
> -     * VLAN device.
> -     *
> -     * This function should be set to null if it doesn't make any sense for
> -     * your network device (it probably doesn't). */
> -    int (*get_vlan_vid)(const struct netdev *netdev, int *vlan_vid);
> -
>     /* Attempts to set input rate limiting (policing) policy, such that up to
>      * 'kbits_rate' kbps of traffic is accepted, with a maximum accumulative
>      * burst size of 'kbits' kb.
> diff --git a/lib/netdev-vport.c b/lib/netdev-vport.c
> index 77b151d..92096e3 100644
> --- a/lib/netdev-vport.c
> +++ b/lib/netdev-vport.c
> @@ -922,7 +922,6 @@ unparse_patch_config(const char *name OVS_UNUSED, const char *type OVS_UNUSED,
>                                                             \
>     NULL,                       /* get_features */          \
>     NULL,                       /* set_advertisements */    \
> -    NULL,                       /* get_vlan_vid */          \
>                                                             \
>     NULL,                       /* set_policing */          \
>     NULL,                       /* get_qos_types */         \
> diff --git a/lib/netdev.c b/lib/netdev.c
> index 9f15b72..e77fcdf 100644
> --- a/lib/netdev.c
> +++ b/lib/netdev.c
> @@ -1250,24 +1250,6 @@ netdev_change_seq(const struct netdev *netdev)
>  {
>     return netdev_get_dev(netdev)->netdev_class->change_seq(netdev);
>  }
> -
> -/* If 'netdev' is a VLAN network device (e.g. one created with vconfig(8)),
> - * sets '*vlan_vid' to the VLAN VID associated with that device and returns 0.
> - * Otherwise returns a errno value (specifically ENOENT if 'netdev_name' is the
> - * name of a network device that is not a VLAN device) and sets '*vlan_vid' to
> - * -1. */
> -int
> -netdev_get_vlan_vid(const struct netdev *netdev, int *vlan_vid)
> -{
> -    int error = (netdev_get_dev(netdev)->netdev_class->get_vlan_vid
> -                 ? netdev_get_dev(netdev)->netdev_class->get_vlan_vid(netdev,
> -                        vlan_vid)
> -                 : ENOENT);
> -    if (error) {
> -        *vlan_vid = 0;
> -    }
> -    return error;
> -}
>
>  /* Initializes 'netdev_dev' as a netdev device named 'name' of the specified
>  * 'netdev_class'.  This function is ordinarily called from a netdev provider's
> diff --git a/lib/netdev.h b/lib/netdev.h
> index 85be394..02271d4 100644
> --- a/lib/netdev.h
> +++ b/lib/netdev.h
> @@ -196,9 +196,6 @@ int netdev_dump_queue_stats(const struct netdev *,
>
>  unsigned int netdev_change_seq(const struct netdev *netdev);
>
> -/* Linux stuff. */
> -int netdev_get_vlan_vid(const struct netdev *, int *vlan_vid);
> -
>  #ifdef  __cplusplus
>  }
>  #endif
> --
> 1.7.4.4
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
>



More information about the dev mailing list