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

Commit dbe4fc2b authored by Michael Adisumarta's avatar Michael Adisumarta
Browse files

msm: ipa3: Correctly return error for ipa3_mdfy_flt_rule



Return the right error in internal mdfy_flt_rule for
better IPACM debugability and update the status last
after the modify in and out.

Change-Id: Id872cd8fcea9816d13a20a4cf71c47311897aa9d
Signed-off-by: default avatarMichael Adisumarta <madisuma@codeaurora.org>
parent 8b72bbf9
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2012-2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
 */

#include "ipa_i.h"
@@ -1693,17 +1693,23 @@ int ipa3_mdfy_flt_rule(struct ipa_ioc_mdfy_flt_rule *hdls)
	}

	mutex_lock(&ipa3_ctx->lock);

	for (i = 0; i < hdls->num_rules; i++) {
		/* if hashing not supported, all tables are non-hash tables*/
		if (ipa3_ctx->ipa_fltrt_not_hashable)
			hdls->rules[i].rule.hashable = false;

		__ipa_convert_flt_mdfy_in(hdls->rules[i], &rule);
		if (__ipa_mdfy_flt_rule(&rule, hdls->ip)) {
			IPAERR_RL("failed to mdfy flt rule %i\n", i);

		result = __ipa_mdfy_flt_rule(&rule, hdls->ip);

		__ipa_convert_flt_mdfy_out(rule, &hdls->rules[i]);

		if (result) {
			IPAERR_RL("failed to mdfy flt rule %d\n", i);
			hdls->rules[i].status = IPA_FLT_STATUS_OF_MDFY_FAILED;
		} else {
			hdls->rules[i].status = 0;
			__ipa_convert_flt_mdfy_out(rule, &hdls->rules[i]);
		}
	}