Message ID | 20231221213358.105704-4-aaptel@nvidia.com (mailing list archive) |
---|---|
State | Deferred |
Headers | show |
Series | nvme-tcp receive offloads | expand |
diff --git a/lib/iov_iter.c b/lib/iov_iter.c index 8ff6824a1005..b96d8b6f5818 100644 --- a/lib/iov_iter.c +++ b/lib/iov_iter.c @@ -62,7 +62,14 @@ static __always_inline size_t memcpy_to_iter(void *iter_to, size_t progress, size_t len, void *from, void *priv2) { - memcpy(iter_to, from + progress, len); + /* + * When using direct data placement (DDP) the hardware writes + * data directly to the destination buffer, and constructs + * IOVs such that they point to this data. + * Thus, when the src == dst we skip the memcpy. + */ + if (iter_to != from + progress) + memcpy(iter_to, from + progress, len); return 0; }