On 1/13/2019 12:04 PM, Gal Pressman wrote:
Account for UD's 40 bytes offset when doing buffer validation.
Please add few words to explain what is wrong without skipping the 40 bytes.
Fixes: 099c5aa50bc8 ("libibverb/examples: Add command line option to enable buffer validation")
The original patch requires by mistake to have an extra parameter for
the buffer validation option, correct ? (i.e. '-c' option
"p:d:i:s:r:n:l:eg:c:), please fix as part of this patch which handles
the validation.
This was already fixed in rc_pingpong, it needs to be fixed also in
ud/uc/srq pingpong.
Cc: Yuval Shaia <yuval.shaia@xxxxxxxxxx>
Signed-off-by: Gal Pressman <galpress@xxxxxxxxxx>
---
libibverbs/examples/ud_pingpong.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/libibverbs/examples/ud_pingpong.c b/libibverbs/examples/ud_pingpong.c
index a89fbe3148ad..fa1e59ab2cc9 100644
--- a/libibverbs/examples/ud_pingpong.c
+++ b/libibverbs/examples/ud_pingpong.c
@@ -747,7 +747,7 @@ int main(int argc, char *argv[])
if (servername) {
if (validate_buf)
for (int i = 0; i < size; i += page_size)
- ctx->buf[i] = i / page_size % sizeof(char);
+ ctx->buf[i + 40] = i / page_size % sizeof(char);
if (pp_post_send(ctx, rem_dest->qpn)) {
fprintf(stderr, "Couldn't post send\n");
@@ -860,7 +860,8 @@ int main(int argc, char *argv[])
if ((!servername) && (validate_buf)) {
for (int i = 0; i < size; i += page_size)
- if (ctx->buf[i] != i / page_size % sizeof(char))
+ if (ctx->buf[i + 40] !=
+ i / page_size % sizeof(char))
printf("invalid data in page %d\n",
i / page_size);
}