diff options
author | billyom <billy.o.mahony@intel.com> | 2016-11-29 10:24:53 +0000 |
---|---|---|
committer | Daniele Di Proietto <diproiettod@vmware.com> | 2016-12-02 14:30:53 -0800 |
commit | 3fa215b15ab0c29c209114a558929474149216d6 (patch) | |
tree | d8f47447c82cd1f3a88aa06037387cbaa4eb81fa /lib | |
parent | 884e0dfe8fe85a8d2b21c9c6138cc239648ba312 (diff) | |
download | openvswitch-3fa215b15ab0c29c209114a558929474149216d6.tar.gz |
ovs-numa: Allow leading 0x on pmd-cpu-mask.
pmd-cpu-mask is interpreted as a hex bit mask. So it should be written
with a leading 0x to indicate this. But if this is done, while the value
is interpreted correctly and the PMDs pinned as expected, a confusing
warning message is also issued.
This patch allows but does not require a leading 0x or 0X to be used
without a warning. Existing functionality is not affected. Relevant DPDK
docs also updated.
Signed-off-by: Billy O'Mahony <billy.o.mahony@intel.com>
Tested-by: Kevin Traynor <ktraynor@redhat.com>
Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ovs-numa.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/ovs-numa.c b/lib/ovs-numa.c index c8173e0b4..e1e7068a2 100644 --- a/lib/ovs-numa.c +++ b/lib/ovs-numa.c @@ -535,6 +535,7 @@ ovs_numa_set_cpu_mask(const char *cmask) { int core_id = 0; int i; + int end_idx; if (!found_numa_and_core) { return; @@ -551,7 +552,13 @@ ovs_numa_set_cpu_mask(const char *cmask) return; } - for (i = strlen(cmask) - 1; i >= 0; i--) { + /* Ignore leading 0x. */ + end_idx = 0; + if (!strncmp(cmask, "0x", 2) || !strncmp(cmask, "0X", 2)) { + end_idx = 2; + } + + for (i = strlen(cmask) - 1; i >= end_idx; i--) { char hex = toupper((unsigned char)cmask[i]); int bin, j; @@ -575,7 +582,7 @@ ovs_numa_set_cpu_mask(const char *cmask) if (core_id >= hmap_count(&all_cpu_cores)) { return; } - } + } } /* For unspecified cores, sets 'available' to false. */ |