All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xl: Make the devid attribute manually settable for nics
@ 2017-02-02 12:20 Fatih Acar
  2017-02-02 12:47 ` Wei Liu
  0 siblings, 1 reply; 3+ messages in thread
From: Fatih Acar @ 2017-02-02 12:20 UTC (permalink / raw)
  To: xen-devel; +Cc: ian.jackson, wei.liu2, Fatih Acar

This permits to have control over the devid attribute when attaching new nics.
It may become useful if one has its own nic indexing somewhere else than xl/xenstore.

Signed-off-by: Fatih Acar <fatih.acar@gandi.net>
Signed-off-by: Nikita Kozlov <nikita.kozlov@gandi.net>
Signed-off-by: Vincent Legout <vincent.legout@gandi.net>
Signed-off-by: Baptiste Daroussin <baptiste.daroussin@gandi.net>
---
 docs/man/xl-network-configuration.markdown.5 |  5 +++++
 tools/libxl/xl_cmdimpl.c                     | 28 +++++++++++++++-------------
 2 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/docs/man/xl-network-configuration.markdown.5 b/docs/man/xl-network-configuration.markdown.5
index 3c439d4..84c2645 100644
--- a/docs/man/xl-network-configuration.markdown.5
+++ b/docs/man/xl-network-configuration.markdown.5
@@ -162,6 +162,11 @@ For example:
 NOTE: The actual underlying limits of rate limiting are dependent
 on the underlying netback implementation.
 
+### devid
+
+Specifies the devid manually instead of letting xl choose the lowest index available.
+
+NOTE: This should not be set unless you have a reason to.
 
 [oui]: http://en.wikipedia.org/wiki/Organizationally_Unique_Identifier
 [net]: http://wiki.xen.org/wiki/HostConfiguration/Networking
diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 7e8a8ae..98ac8ad 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -993,6 +993,19 @@ static void parse_vcpu_affinity(libxl_domain_build_info *b_info,
     }
 }
 
+static unsigned long parse_ulong(const char *str)
+{
+    char *endptr;
+    unsigned long val;
+
+    val = strtoul(str, &endptr, 10);
+    if (endptr == str || val == ULONG_MAX) {
+        fprintf(stderr, "xl: failed to convert \"%s\" to number\n", str);
+        exit(EXIT_FAILURE);
+    }
+    return val;
+}
+
 static void replace_string(char **str, const char *val)
 {
     free(*str);
@@ -1061,6 +1074,8 @@ static int parse_nic_config(libxl_device_nic *nic, XLU_Config **config, char *to
         replace_string(&nic->coloft_forwarddev, oparg);
     } else if (MATCH_OPTION("accel", token, oparg)) {
         fprintf(stderr, "the accel parameter for vifs is currently not supported\n");
+    } else if (MATCH_OPTION("devid", token, oparg)) {
+        nic->devid = parse_ulong(oparg);
     } else {
         fprintf(stderr, "unrecognized argument `%s'\n", token);
         return 1;
@@ -1068,19 +1083,6 @@ static int parse_nic_config(libxl_device_nic *nic, XLU_Config **config, char *to
     return 0;
 }
 
-static unsigned long parse_ulong(const char *str)
-{
-    char *endptr;
-    unsigned long val;
-
-    val = strtoul(str, &endptr, 10);
-    if (endptr == str || val == ULONG_MAX) {
-        fprintf(stderr, "xl: failed to convert \"%s\" to number\n", str);
-        exit(EXIT_FAILURE);
-    }
-    return val;
-}
-
 static void parse_vnuma_config(const XLU_Config *config,
                                libxl_domain_build_info *b_info)
 {
-- 
2.7.4


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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] xl: Make the devid attribute manually settable for nics
  2017-02-02 12:20 [PATCH] xl: Make the devid attribute manually settable for nics Fatih Acar
@ 2017-02-02 12:47 ` Wei Liu
  2017-02-08  9:33   ` Wei Liu
  0 siblings, 1 reply; 3+ messages in thread
From: Wei Liu @ 2017-02-02 12:47 UTC (permalink / raw)
  To: Fatih Acar; +Cc: xen-devel, wei.liu2, ian.jackson

On Thu, Feb 02, 2017 at 01:20:49PM +0100, Fatih Acar wrote:
> This permits to have control over the devid attribute when attaching new nics.
> It may become useful if one has its own nic indexing somewhere else than xl/xenstore.
> 
> Signed-off-by: Fatih Acar <fatih.acar@gandi.net>
> Signed-off-by: Nikita Kozlov <nikita.kozlov@gandi.net>
> Signed-off-by: Vincent Legout <vincent.legout@gandi.net>
> Signed-off-by: Baptiste Daroussin <baptiste.daroussin@gandi.net>

I have no objection to this, but I wait a bit for other people to
express their opinions.

Wei.

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] xl: Make the devid attribute manually settable for nics
  2017-02-02 12:47 ` Wei Liu
@ 2017-02-08  9:33   ` Wei Liu
  0 siblings, 0 replies; 3+ messages in thread
From: Wei Liu @ 2017-02-08  9:33 UTC (permalink / raw)
  To: Fatih Acar; +Cc: xen-devel, wei.liu2, ian.jackson

On Thu, Feb 02, 2017 at 12:47:17PM +0000, Wei Liu wrote:
> On Thu, Feb 02, 2017 at 01:20:49PM +0100, Fatih Acar wrote:
> > This permits to have control over the devid attribute when attaching new nics.
> > It may become useful if one has its own nic indexing somewhere else than xl/xenstore.
> > 
> > Signed-off-by: Fatih Acar <fatih.acar@gandi.net>
> > Signed-off-by: Nikita Kozlov <nikita.kozlov@gandi.net>
> > Signed-off-by: Vincent Legout <vincent.legout@gandi.net>
> > Signed-off-by: Baptiste Daroussin <baptiste.daroussin@gandi.net>
> 
> I have no objection to this, but I wait a bit for other people to
> express their opinions.

Acked + applied.

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-02-08  9:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-02 12:20 [PATCH] xl: Make the devid attribute manually settable for nics Fatih Acar
2017-02-02 12:47 ` Wei Liu
2017-02-08  9:33   ` Wei Liu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.