[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 3 of 4 v2] xl: add support for vif rate limiting



On Tue, 2012-04-17 at 02:58 +0100, Mathieu Gagnà wrote:
> The `rate` keyword specifies the rate at which the outgoing traffic will be 
> limited to.
> The default if this keyword is not specified is unlimited.
> 
> The `rate` keyword supports an optional replenishment interval parameter for 
> specifying
> the granularity of credit replenishment. It determines the frequency at which
> the vif transmission credit is replenished. The default interval is 50ms.
> 
> For example:
> 
>         'rate=10Mb/s'
>         'rate=250KB/s'
>         'rate=1MB/s@20ms'
> 
> Signed-off-by: Mathieu Gagnà <mgagne@xxxxxxxx>
> 
> ddiff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
> --- a/tools/libxl/libxl.c
> +++ b/tools/libxl/libxl.c
> @@ -1854,6 +1854,13 @@ int libxl_device_nic_add(libxl_ctx *ctx,
>          flexarray_append(back, libxl__strdup(gc, nic->ip));
>      }
> 
> +    if (nic->rate_interval_usecs > 0) {
> +        flexarray_append(back, "rate");
> +        flexarray_append(back, libxl__sprintf(gc, "%llu,%lu",

I think you want to use PRIu64 and PRIu32 here. 
        "%"PRIu64",%"PRIu32"

> +                            (unsigned long long) 
> nic->rate_bytes_per_interval,
> +                            (unsigned long) nic->rate_interval_usecs));
> +    }
> +
>      flexarray_append(back, "bridge");
>      flexarray_append(back, libxl__strdup(gc, nic->bridge));
>      flexarray_append(back, "handle");

> @@ -4855,6 +4873,7 @@ int main_networkattach(int argc, char **
>  {
>      int opt;
>      libxl_device_nic nic;
> +    XLU_Config *config = 0;
>      char *endptr, *oparg;
>      const char *tok;
>      int i;
> @@ -4910,6 +4929,7 @@ int main_networkattach(int argc, char **
>          } else if (MATCH_OPTION("model", *argv, oparg)) {
>              replace_string(&nic.model, oparg);
>          } else if (MATCH_OPTION("rate", *argv, oparg)) {
> +            parse_vif_rate(&config, oparg, &nic);
>          } else if (MATCH_OPTION("accel", *argv, oparg)) {
>          } else {
>              fprintf(stderr, "unrecognized argument `%s'\n", *argv);

Both this and the existing main_blockattach and pci{attach,destach}
appear to fail to call xlu_cfg_destroy and so are a bit leaky. I don't
think this is critical right now (the process exits right away) -- but
if you fancied fixing these up in a future patch it'd be much
appreciated.

Given the use of PRIuXX as above:

Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

Ian.


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.