Message ID | 1607339329-624-1-git-send-email-wangyunjian@huawei.com (mailing list archive) |
---|---|
State | New |
Delegated to: | David Marchand |
Headers | show |
Series | [v4] eal: fix create user mem map repeatedly when it exists | expand |
Context | Check | Description |
---|---|---|
ci/travis-robot | warning | Travis build: failed |
ci/iol-intel-Performance | success | Performance Testing PASS |
ci/iol-intel-Functional | success | Functional Testing PASS |
ci/iol-testing | success | Testing PASS |
ci/iol-broadcom-Performance | success | Performance Testing PASS |
ci/Intel-compilation | success | Compilation OK |
ci/iol-broadcom-Functional | success | Functional Testing PASS |
ci/checkpatch | success | coding style OK |
diff --git a/lib/librte_eal/linux/eal_vfio.c b/lib/librte_eal/linux/eal_vfio.c index 050082444e..0967215783 100644 --- a/lib/librte_eal/linux/eal_vfio.c +++ b/lib/librte_eal/linux/eal_vfio.c @@ -168,6 +168,10 @@ adjust_map(struct user_mem_map *src, struct user_mem_map *end, static int merge_map(struct user_mem_map *left, struct user_mem_map *right) { + /* merge the same maps into one */ + if (memcmp(left, right, sizeof(struct user_mem_map)) == 0) + goto out; + if (left->addr + left->len != right->addr) return 0; if (left->iova + left->len != right->iova) @@ -175,6 +179,7 @@ merge_map(struct user_mem_map *left, struct user_mem_map *right) left->len += right->len; +out: memset(right, 0, sizeof(*right)); return 1;