[ovs-dev] [PATCH V9 02/31] tc: Introduce tc module

Simon Horman simon.horman at netronome.com
Tue May 30 08:07:09 UTC 2017


On Sun, May 28, 2017 at 02:59:44PM +0300, Roi Dayan wrote:
> Add tc module to expose tc operations to be used by other modules.
> Move some tc related functions from netdev-linux.c to tc.c
> This patch doesn't change any functionality.
> 
> Signed-off-by: Paul Blakey <paulb at mellanox.com>
> Signed-off-by: Roi Dayan <roid at mellanox.com>

Thanks, this looks good to me modulo the minor suggestion below.
I would be happy to apply it if someone provided a review.

...

> diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
> index 4fc3f6b..7a0517b 100644
> --- a/lib/netdev-linux.c
> +++ b/lib/netdev-linux.c

...

> @@ -4643,44 +4634,6 @@ static double ticks_per_s;
>   */
>  static unsigned int buffer_hz;
>  
> -/* Returns tc handle 'major':'minor'. */
> -static unsigned int
> -tc_make_handle(unsigned int major, unsigned int minor)
> -{
> -    return TC_H_MAKE(major << 16, minor);
> -}
> -
> -/* Returns the major number from 'handle'. */
> -static unsigned int
> -tc_get_major(unsigned int handle)
> -{
> -    return TC_H_MAJ(handle) >> 16;
> -}
> -
> -/* Returns the minor number from 'handle'. */
> -static unsigned int
> -tc_get_minor(unsigned int handle)
> -{
> -    return TC_H_MIN(handle);
> -}

...

> diff --git a/lib/tc.c b/lib/tc.c
> new file mode 100644
> index 0000000..644f30c
> --- /dev/null
> +++ b/lib/tc.c
> @@ -0,0 +1,114 @@

...

> +VLOG_DEFINE_THIS_MODULE(tc);
> +
> +/* Returns tc handle 'major':'minor'. */
> +unsigned int
> +tc_make_handle(unsigned int major, unsigned int minor)
> +{
> +    return TC_H_MAKE(major << 16, minor);
> +}
> +
> +/* Returns the major number from 'handle'. */
> +unsigned int
> +tc_get_major(unsigned int handle)
> +{
> +    return TC_H_MAJ(handle) >> 16;
> +}
> +
> +/* Returns the minor number from 'handle'. */
> +unsigned int
> +tc_get_minor(unsigned int handle)
> +{
> +    return TC_H_MIN(handle);
> +}

I think that some consideration should be given to a follow-up patch to
move the above functions to tc.h and making them static inline to avoid
function-call overhead.

...


More information about the dev mailing list