Skip to content

Commit

Permalink
Enable COP_FLAG_NO_ZC at unaligned case
Browse files Browse the repository at this point in the history
COP_FLAG_NO_ZC means "no zero copy". So when we find unaligned
case, we need to enable this flag instead of disabling it.
  • Loading branch information
peter-harliman authored and cristian-stoica committed Apr 11, 2018
1 parent 9c70011 commit ef5f1d9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,17 +222,17 @@ int crypto_run(struct fcrypt *fcr, struct kernel_crypt_op *kcop)
}

if (likely(cop->len)) {
if (cop->flags & COP_FLAG_NO_ZC) {
if (!(cop->flags & COP_FLAG_NO_ZC)) {
if (unlikely(ses_ptr->alignmask && !IS_ALIGNED((unsigned long)cop->src, ses_ptr->alignmask))) {
dwarning(2, "source address %p is not %d byte aligned - disabling zero copy",
cop->src, ses_ptr->alignmask + 1);
cop->flags &= ~COP_FLAG_NO_ZC;
cop->flags |= COP_FLAG_NO_ZC;
}

if (unlikely(ses_ptr->alignmask && !IS_ALIGNED((unsigned long)cop->dst, ses_ptr->alignmask))) {
dwarning(2, "destination address %p is not %d byte aligned - disabling zero copy",
cop->dst, ses_ptr->alignmask + 1);
cop->flags &= ~COP_FLAG_NO_ZC;
cop->flags |= COP_FLAG_NO_ZC;
}
}

Expand Down

0 comments on commit ef5f1d9

Please sign in to comment.