Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 42d3a731 authored by Dinesh K Garg's avatar Dinesh K Garg
Browse files

md: Performance improvement for ICE based FDE



Since ICE based solution does encryption in storage, there is no
need to keep the BIOs allocated. Adding a new constant that would
be used by ICE driver to detect ICE based DM solution and configure
requests correctly.

Change-Id: I8d52d55679e638a5eea066a1d62b8f617f1472ef
Signed-off-by: default avatarDinesh K Garg <dineshg@codeaurora.org>
parent 80e04190
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -977,7 +977,7 @@ static int qcom_ice_config(struct platform_device *pdev, struct request *req,
	 * non-dm entities. To ensure that we are running operation on dm
	 * based request, check BIO_DONT_FREE flag
	 */
	if (bio_flagged(req->bio, BIO_DONTFREE)) {
	if (bio_flagged(req->bio, BIO_INLINECRYPT)) {
		info = dm_get_rq_mapinfo(req);
		if (!info) {
			pr_err("%s info not available in request\n", __func__);
+12 −4
Original line number Diff line number Diff line
/* Copyright (c) 2015, The Linux Foundation. All rights reserved.
/* Copyright (c) 2014-2015, The Linux Foundation. All rights reserved.
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * only version 2 as published by the Free Software Foundation.
@@ -876,6 +876,10 @@ static int req_crypt_endio(struct dm_target *ti, struct request *clone,

	/* If it is a write request, do nothing just return. */
	bvec = NULL;
	if (encryption_mode == DM_REQ_CRYPT_ENCRYPTION_MODE_TRANSPARENT
		&& rq_data_dir(clone) == READ)
		goto submit_request;

	if (rq_data_dir(clone) == WRITE) {
		rq_for_each_segment(bvec, clone, iter1) {
			if (req_io->should_encrypt && bvec->bv_offset == 0) {
@@ -955,6 +959,9 @@ static int req_crypt_map(struct dm_target *ti, struct request *clone,
		 * is done and then the dm layer will complete the bios (clones)
		 * and free them.
		 */
		if (encryption_mode == DM_REQ_CRYPT_ENCRYPTION_MODE_TRANSPARENT)
			bio_src->bi_flags |= 1 << BIO_INLINECRYPT;
		else
			bio_src->bi_flags |= 1 << BIO_DONTFREE;

		/*
@@ -985,7 +992,8 @@ static int req_crypt_map(struct dm_target *ti, struct request *clone,

	}

	if (rq_data_dir(clone) == READ) {
	if (rq_data_dir(clone) == READ ||
		encryption_mode == DM_REQ_CRYPT_ENCRYPTION_MODE_TRANSPARENT) {
		error = DM_MAPIO_REMAPPED;
		goto submit_request;
	} else if (rq_data_dir(clone) == WRITE) {
@@ -1143,7 +1151,7 @@ static int req_crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv)
				err = -ENOMEM;
				goto ctr_exit;
			}
			ice_settings->key_size = ICE_CRYPTO_KEY_SIZE_256;
			ice_settings->key_size = ICE_CRYPTO_KEY_SIZE_128;
			ice_settings->algo_mode = ICE_CRYPTO_ALGO_MODE_AES_XTS;
			ice_settings->key_mode = ICE_CRYPTO_USE_LUT_SW_KEY;
			if (kstrtou16(argv[1], 10, &ice_settings->key_index) ||
+1 −0
Original line number Diff line number Diff line
@@ -142,6 +142,7 @@ struct bio {
 * at the dm level
 */
#define BIO_DONTFREE 14
#define BIO_INLINECRYPT 15

#define bio_flagged(bio, flag)	((bio)->bi_flags & (1 << (flag)))