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

Commit a0cfd91f authored by Amir Levy's avatar Amir Levy Committed by Gerrit - the friendly Code Review server
Browse files

msm: ipa: remove ipa rm deprecated mechanism support



RM isn't in use for newer devices.

Acked-by: default avatarTal Gelbard <tgelbard@qti.qualcomm.com>
Change-Id: I8005f02acbd424e0721c2efa49f840f2cf7e8f7b
Signed-off-by: default avatarAmir Levy <alevy@codeaurora.org>
parent 7eaf07a0
Loading
Loading
Loading
Loading
+8 −24
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@
#include <linux/ipa_uc_offload.h>
#include <linux/pci.h>
#include "ipa_api.h"
#include "ipa_v3/ipa_i.h"

/*
 * The following for adding code (ie. for EMULATION) not found on x86.
@@ -2794,24 +2795,19 @@ enum ipa_client_type ipa_get_client_mapping(int pipe_idx)
EXPORT_SYMBOL(ipa_get_client_mapping);

/**
 * ipa_get_rm_resource_from_ep() - get the IPA_RM resource which is related to
 * the supplied pipe index.
 *
 * @pipe_idx:
 *
 * Return value: IPA_RM resource related to the pipe, -1 if a resource was not
 * found.
 * ipa_get_rm_resource_from_ep() - this function is part of the deprecated
 * RM mechanism but is still used by some drivers so we kept the definition.
 */

enum ipa_rm_resource_name ipa_get_rm_resource_from_ep(int pipe_idx)
{
	int ret;

	IPA_API_DISPATCH_RETURN(ipa_get_rm_resource_from_ep, pipe_idx);

	return ret;
	IPAERR("IPA RM is not supported idx=%d\n", pipe_idx);
	return -EFAULT;
}
EXPORT_SYMBOL(ipa_get_rm_resource_from_ep);



/**
 * ipa_get_modem_cfg_emb_pipe_flt()- Return ipa_ctx->modem_cfg_emb_pipe_flt
 *
@@ -3645,18 +3641,6 @@ void ipa_deregister_client_callback(enum ipa_client_type client)
}


/**
 * ipa_pm_is_used() - Returns if IPA PM framework is used
 */
bool ipa_pm_is_used(void)
{
	bool ret;

	IPA_API_DISPATCH_RETURN(ipa_pm_is_used);

	return ret;
}

static const struct dev_pm_ops ipa_pm_ops = {
	.suspend_noirq = ipa_ap_suspend,
	.resume_noirq = ipa_ap_resume,
+0 −4
Original line number Diff line number Diff line
@@ -340,8 +340,6 @@ struct ipa_api_controller {

	enum ipa_client_type (*ipa_get_client_mapping)(int pipe_idx);

	enum ipa_rm_resource_name (*ipa_get_rm_resource_from_ep)(int pipe_idx);

	bool (*ipa_get_modem_cfg_emb_pipe_flt)(void);

	enum ipa_transport_type (*ipa_get_transport_type)(void);
@@ -434,8 +432,6 @@ struct ipa_api_controller {
		struct ipa_smmu_out_params *out);
	int (*ipa_is_vlan_mode)(enum ipa_vlan_ifaces iface, bool *res);

	bool (*ipa_pm_is_used)(void);

	int (*ipa_wigig_uc_init)(
		struct ipa_wdi_uc_ready_params *inout,
		ipa_wigig_misc_int_cb int_notify,
+16 −169
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2013-2018, The Linux Foundation. All rights reserved.
 * Copyright (c) 2013-2019, The Linux Foundation. All rights reserved.
 */

#include <linux/debugfs.h>
@@ -112,7 +112,7 @@ enum ecm_ipa_state {
};

/**
 * enum ecm_ipa_operation - enumerations used to descibe the API operation
 * enum ecm_ipa_operation - enumerations used to describe the API operation
 *
 * Those enums are used as input for the driver state machine.
 */
@@ -147,8 +147,6 @@ enum ecm_ipa_operation {
 * state is changed to RNDIS_IPA_CONNECTED_AND_UP
 * @ipa_to_usb_client: consumer client
 * @usb_to_ipa_client: producer client
 * @ipa_rm_resource_name_prod: IPA resource manager producer resource
 * @ipa_rm_resource_name_cons: IPA resource manager consumer resource
 * @pm_hdl: handle for IPA PM
 * @is_vlan_mode: does the driver need to work in VLAN mode?
 */
@@ -166,8 +164,6 @@ struct ecm_ipa_dev {
	void (*device_ready_notify)(void);
	enum ipa_client_type ipa_to_usb_client;
	enum ipa_client_type usb_to_ipa_client;
	enum ipa_rm_resource_name ipa_rm_resource_name_prod;
	enum ipa_rm_resource_name ipa_rm_resource_name_cons;
	u32 pm_hdl;
	bool is_vlan_mode;
};
@@ -186,15 +182,9 @@ static int ecm_ipa_rules_cfg
static void ecm_ipa_rules_destroy(struct ecm_ipa_dev *ecm_ipa_ctx);
static int ecm_ipa_register_properties(struct ecm_ipa_dev *ecm_ipa_ctx);
static void ecm_ipa_deregister_properties(void);
static void ecm_ipa_rm_notify
	(void *user_data, enum ipa_rm_event event, unsigned long data);
static struct net_device_stats *ecm_ipa_get_stats(struct net_device *net);
static int ecm_ipa_create_rm_resource(struct ecm_ipa_dev *ecm_ipa_ctx);
static void ecm_ipa_destroy_rm_resource(struct ecm_ipa_dev *ecm_ipa_ctx);
static int ecm_ipa_register_pm_client(struct ecm_ipa_dev *ecm_ipa_ctx);
static void ecm_ipa_deregister_pm_client(struct ecm_ipa_dev *ecm_ipa_ctx);
static int resource_request(struct ecm_ipa_dev *ecm_ipa_ctx);
static void resource_release(struct ecm_ipa_dev *ecm_ipa_ctx);
static netdev_tx_t ecm_ipa_start_xmit
	(struct sk_buff *skb, struct net_device *net);
static int ecm_ipa_debugfs_atomic_open(struct inode *inode, struct file *file);
@@ -242,7 +232,6 @@ static void ecm_ipa_msg_free_cb(void *buff, u32 len, u32 type)
 *  - allocate the network device
 *  - set default values for driver internals
 *  - create debugfs folder and files
 *  - create IPA resource manager client
 *  - add header insertion rules for IPA driver (based on host/device
 *    Ethernet addresses given in input params)
 *  - register tx/rx properties to IPA driver (will be later used
@@ -446,44 +435,18 @@ int ecm_ipa_connect(u32 usb_to_ipa_hdl, u32 ipa_to_usb_hdl, void *priv)
	ECM_IPA_DEBUG("usb_to_ipa_client = %d\n",
		      ecm_ipa_ctx->usb_to_ipa_client);

	if (ipa_pm_is_used()) {
	retval = ecm_ipa_register_pm_client(ecm_ipa_ctx);
	} else {
		ecm_ipa_ctx->ipa_rm_resource_name_cons =
			ipa_get_rm_resource_from_ep(ipa_to_usb_hdl);
		if (ecm_ipa_ctx->ipa_rm_resource_name_cons < 0) {
			ECM_IPA_ERROR(
			"Error getting CONS RM resource from handle %d\n",
				      ecm_ipa_ctx->ipa_rm_resource_name_cons);
			return -EINVAL;
		}
		ECM_IPA_DEBUG("ipa_rm_resource_name_cons = %d\n",
			      ecm_ipa_ctx->ipa_rm_resource_name_cons);

		ecm_ipa_ctx->ipa_rm_resource_name_prod =
			ipa_get_rm_resource_from_ep(usb_to_ipa_hdl);
		if (ecm_ipa_ctx->ipa_rm_resource_name_prod < 0) {
			ECM_IPA_ERROR(
			"Error getting PROD RM resource from handle %d\n",
				      ecm_ipa_ctx->ipa_rm_resource_name_prod);
			return -EINVAL;
		}
		ECM_IPA_DEBUG("ipa_rm_resource_name_prod = %d\n",
			      ecm_ipa_ctx->ipa_rm_resource_name_prod);

		retval = ecm_ipa_create_rm_resource(ecm_ipa_ctx);
	}

	if (retval) {
		ECM_IPA_ERROR("fail on RM create\n");
		goto fail_create_rm;
		ECM_IPA_ERROR("fail register PM client\n");
		return retval;
	}
	ECM_IPA_DEBUG("RM resource was created\n");
	ECM_IPA_DEBUG("PM client registered\n");

	retval = ecm_ipa_register_properties(ecm_ipa_ctx);
	if (retval) {
		ECM_IPA_ERROR("fail on properties set\n");
		goto fail_create_rm;
		goto fail_register_pm;
	}
	ECM_IPA_DEBUG("ecm_ipa 2 Tx and 2 Rx properties were registered\n");

@@ -537,11 +500,8 @@ int ecm_ipa_connect(u32 usb_to_ipa_hdl, u32 ipa_to_usb_hdl, void *priv)

fail:
	ecm_ipa_deregister_properties();
fail_create_rm:
	if (ipa_pm_is_used())
fail_register_pm:
	ecm_ipa_deregister_pm_client(ecm_ipa_ctx);
	else
		ecm_ipa_destroy_rm_resource(ecm_ipa_ctx);
	return retval;
}
EXPORT_SYMBOL(ecm_ipa_connect);
@@ -592,10 +552,7 @@ static int ecm_ipa_open(struct net_device *net)
 *   in "send" state
 * - The driver internal state is in "UP" state.
 * - Filter Tx switch is turned off
 * - The IPA resource manager state for the driver producer client
 *   is "Granted" which implies that all the resources in the dependency
 *   graph are valid for data flow.
 * - outstanding high boundary did not reach.
 * - Outstanding high boundary did not reach.
 *
 * In case all of the above conditions are met, the network driver will
 * send the packet by using the IPA API for Tx.
@@ -626,11 +583,11 @@ static netdev_tx_t ecm_ipa_start_xmit
		return NETDEV_TX_BUSY;
	}

	ret = resource_request(ecm_ipa_ctx);
	ret = ipa_pm_activate(ecm_ipa_ctx->pm_hdl);
	if (ret) {
		ECM_IPA_DEBUG("Waiting to resource\n");
		ECM_IPA_DEBUG("Failed to activate PM client\n");
		netif_stop_queue(net);
		goto resource_busy;
		goto fail_pm_activate;
	}

	if (atomic_read(&ecm_ipa_ctx->outstanding_pkts) >=
@@ -662,8 +619,8 @@ static netdev_tx_t ecm_ipa_start_xmit

fail_tx_packet:
out:
	resource_release(ecm_ipa_ctx);
resource_busy:
	ipa_pm_deferred_deactivate(ecm_ipa_ctx->pm_hdl);
fail_pm_activate:
	return status;
}

@@ -803,10 +760,7 @@ int ecm_ipa_disconnect(void *priv)
	netif_stop_queue(ecm_ipa_ctx->net);
	ECM_IPA_DEBUG("queue stopped\n");

	if (ipa_pm_is_used())
	ecm_ipa_deregister_pm_client(ecm_ipa_ctx);
	else
		ecm_ipa_destroy_rm_resource(ecm_ipa_ctx);

	outstanding_dropped_pkts =
		atomic_read(&ecm_ipa_ctx->outstanding_pkts);
@@ -831,8 +785,6 @@ EXPORT_SYMBOL(ecm_ipa_disconnect);
 * needed anymore, e.g: when the USB composition does not support ECM.
 * This function shall be called after the pipes were disconnected.
 * Detailed description:
 *  - delete the driver dependency defined for IPA resource manager and
 *   destroy the producer resource.
 *  -  remove the debugfs entries
 *  - deregister the network interface from Linux network stack
 *  - free all internal data structs
@@ -1110,99 +1062,11 @@ static void ecm_ipa_deregister_properties(void)
 * Returns negative errno, or zero on success
 */

static void ecm_ipa_rm_notify
	(void *user_data, enum ipa_rm_event event, unsigned long data)
{
	struct ecm_ipa_dev *ecm_ipa_ctx = user_data;

	ECM_IPA_LOG_ENTRY();
	if
		(event == IPA_RM_RESOURCE_GRANTED &&
			netif_queue_stopped(ecm_ipa_ctx->net)) {
		ECM_IPA_DEBUG("Resource Granted - starting queue\n");
		netif_start_queue(ecm_ipa_ctx->net);
	} else {
		ECM_IPA_DEBUG("Resource released\n");
	}
	ECM_IPA_LOG_EXIT();
}

static struct net_device_stats *ecm_ipa_get_stats(struct net_device *net)
{
	return &net->stats;
}

static int ecm_ipa_create_rm_resource(struct ecm_ipa_dev *ecm_ipa_ctx)
{
	struct ipa_rm_create_params create_params = {0};
	struct ipa_rm_perf_profile profile;
	int result;

	ECM_IPA_LOG_ENTRY();
	create_params.name = IPA_RM_RESOURCE_STD_ECM_PROD;
	create_params.reg_params.user_data = ecm_ipa_ctx;
	create_params.reg_params.notify_cb = ecm_ipa_rm_notify;
	result = ipa_rm_create_resource(&create_params);
	if (result) {
		ECM_IPA_ERROR("Fail on ipa_rm_create_resource\n");
		goto fail_rm_create;
	}
	ECM_IPA_DEBUG("rm client was created");

	profile.max_supported_bandwidth_mbps = IPA_APPS_MAX_BW_IN_MBPS;
	ipa_rm_set_perf_profile(IPA_RM_RESOURCE_STD_ECM_PROD, &profile);

	result = ipa_rm_inactivity_timer_init
		(IPA_RM_RESOURCE_STD_ECM_PROD,
		INACTIVITY_MSEC_DELAY);
	if (result) {
		ECM_IPA_ERROR("Fail on ipa_rm_inactivity_timer_init\n");
		goto fail_it;
	}
	ECM_IPA_DEBUG("rm_it client was created");

	result = ipa_rm_add_dependency_sync
		(IPA_RM_RESOURCE_STD_ECM_PROD,
		ecm_ipa_ctx->ipa_rm_resource_name_cons);
	if (result && result != -EINPROGRESS)
		ECM_IPA_ERROR
		("unable to add ECM/USB dependency (%d)\n", result);

	result = ipa_rm_add_dependency_sync
		(ecm_ipa_ctx->ipa_rm_resource_name_prod,
		IPA_RM_RESOURCE_APPS_CONS);
	if (result && result != -EINPROGRESS)
		ECM_IPA_ERROR
		("unable to add USB/APPS dependency (%d)\n", result);

	ECM_IPA_DEBUG("rm dependency was set\n");

	ECM_IPA_LOG_EXIT();
	return 0;

fail_it:
fail_rm_create:
	return result;
}

static void ecm_ipa_destroy_rm_resource(struct ecm_ipa_dev *ecm_ipa_ctx)
{
	int result;

	ECM_IPA_LOG_ENTRY();

	ipa_rm_delete_dependency(IPA_RM_RESOURCE_STD_ECM_PROD,
				 ecm_ipa_ctx->ipa_rm_resource_name_cons);
	ipa_rm_delete_dependency(ecm_ipa_ctx->ipa_rm_resource_name_prod,
				 IPA_RM_RESOURCE_APPS_CONS);
	ipa_rm_inactivity_timer_destroy(IPA_RM_RESOURCE_STD_ECM_PROD);
	result = ipa_rm_delete_resource(IPA_RM_RESOURCE_STD_ECM_PROD);
	if (result)
		ECM_IPA_ERROR("resource deletion failed\n");

	ECM_IPA_LOG_EXIT();
}

static void ecm_ipa_pm_cb(void *p, enum ipa_pm_cb_event event)
{
	struct ecm_ipa_dev *ecm_ipa_ctx = p;
@@ -1246,23 +1110,6 @@ static void ecm_ipa_deregister_pm_client(struct ecm_ipa_dev *ecm_ipa_ctx)
	ecm_ipa_ctx->pm_hdl = ~0;
}

static int resource_request(struct ecm_ipa_dev *ecm_ipa_ctx)
{
	if (ipa_pm_is_used())
		return ipa_pm_activate(ecm_ipa_ctx->pm_hdl);

	return ipa_rm_inactivity_timer_request_resource(
		IPA_RM_RESOURCE_STD_ECM_PROD);
}

static void resource_release(struct ecm_ipa_dev *ecm_ipa_ctx)
{
	if (ipa_pm_is_used())
		ipa_pm_deferred_deactivate(ecm_ipa_ctx->pm_hdl);
	else
		ipa_rm_inactivity_timer_release_resource(
			IPA_RM_RESOURCE_STD_ECM_PROD);
}

/**
 * ecm_ipa_tx_complete_notify() - Rx notify
+49 −441

File changed.

Preview size limit exceeded, changes collapsed.

+14 −197
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
 * Copyright (c) 2015-2019, The Linux Foundation. All rights reserved.
 */

#include <linux/ipa_uc_offload.h>
@@ -69,9 +69,6 @@ struct ipa_uc_offload_ctx {

static struct ipa_uc_offload_ctx *ipa_uc_offload_ctx[IPA_UC_MAX_PROT_SIZE];

static int ipa_uc_ntn_cons_release(void);
static int ipa_uc_ntn_cons_request(void);
static void ipa_uc_offload_rm_notify(void *, enum ipa_rm_event, unsigned long);

static int ipa_commit_partial_hdr(
	struct ipa_ioc_add_hdr *hdr,
@@ -150,36 +147,6 @@ static void ipa_uc_offload_ntn_deregister_pm_client(
	ipa_pm_deactivate_sync(ntn_ctx->pm_hdl);
	ipa_pm_deregister(ntn_ctx->pm_hdl);
}
static int ipa_uc_offload_ntn_create_rm_resources(
	struct ipa_uc_offload_ctx *ntn_ctx)
{
	int ret;
	struct ipa_rm_create_params param;

	memset(&param, 0, sizeof(param));
	param.name = IPA_RM_RESOURCE_ETHERNET_PROD;
	param.reg_params.user_data = ntn_ctx;
	param.reg_params.notify_cb = ipa_uc_offload_rm_notify;
	param.floor_voltage = IPA_VOLTAGE_SVS;
	ret = ipa_rm_create_resource(&param);
	if (ret) {
		IPA_UC_OFFLOAD_ERR("fail to create ETHERNET_PROD resource\n");
		return -EFAULT;
	}

	memset(&param, 0, sizeof(param));
	param.name = IPA_RM_RESOURCE_ETHERNET_CONS;
	param.request_resource = ipa_uc_ntn_cons_request;
	param.release_resource = ipa_uc_ntn_cons_release;
	ret = ipa_rm_create_resource(&param);
	if (ret) {
		IPA_UC_OFFLOAD_ERR("fail to create ETHERNET_CONS resource\n");
		ipa_rm_delete_resource(IPA_RM_RESOURCE_ETHERNET_PROD);
		return -EFAULT;
	}

	return 0;
}

static int ipa_uc_offload_ntn_reg_intf(
	struct ipa_uc_offload_intf_params *inp,
@@ -197,12 +164,9 @@ static int ipa_uc_offload_ntn_reg_intf(

	IPA_UC_OFFLOAD_DBG("register interface for netdev %s\n",
					 inp->netdev_name);
	if (ipa_pm_is_used())
	ret = ipa_uc_offload_ntn_register_pm_client(ntn_ctx);
	else
		ret = ipa_uc_offload_ntn_create_rm_resources(ntn_ctx);
	if (ret) {
		IPA_UC_OFFLOAD_ERR("fail to create rm resource\n");
		IPA_UC_OFFLOAD_ERR("fail to register PM client\n");
		return -EFAULT;
	}
	memcpy(ntn_ctx->netdev_name, inp->netdev_name, IPA_RESOURCE_NAME_MAX);
@@ -282,12 +246,7 @@ static int ipa_uc_offload_ntn_reg_intf(
fail:
	kfree(hdr);
fail_alloc:
	if (ipa_pm_is_used()) {
	ipa_uc_offload_ntn_deregister_pm_client(ntn_ctx);
	} else {
		ipa_rm_delete_resource(IPA_RM_RESOURCE_ETHERNET_CONS);
		ipa_rm_delete_resource(IPA_RM_RESOURCE_ETHERNET_PROD);
	}
	return ret;
}

@@ -336,56 +295,6 @@ int ipa_uc_offload_reg_intf(
}
EXPORT_SYMBOL(ipa_uc_offload_reg_intf);

static int ipa_uc_ntn_cons_release(void)
{
	return 0;
}

static int ipa_uc_ntn_cons_request(void)
{
	int ret = 0;
	struct ipa_uc_offload_ctx *ntn_ctx;

	ntn_ctx = ipa_uc_offload_ctx[IPA_UC_NTN];
	if (!ntn_ctx) {
		IPA_UC_OFFLOAD_ERR("NTN is not initialized\n");
		ret = -EFAULT;
	} else if (ntn_ctx->state != IPA_UC_OFFLOAD_STATE_UP) {
		IPA_UC_OFFLOAD_ERR("Invalid State: %d\n", ntn_ctx->state);
		ret = -EFAULT;
	}

	return ret;
}

static void ipa_uc_offload_rm_notify(void *user_data, enum ipa_rm_event event,
		unsigned long data)
{
	struct ipa_uc_offload_ctx *offload_ctx;

	offload_ctx = (struct ipa_uc_offload_ctx *)user_data;
	if (!(offload_ctx && offload_ctx->proto > IPA_UC_INVALID &&
		  offload_ctx->proto < IPA_UC_MAX_PROT_SIZE)) {
		IPA_UC_OFFLOAD_ERR("Invalid user data\n");
		return;
	}

	if (offload_ctx->state != IPA_UC_OFFLOAD_STATE_INITIALIZED)
		IPA_UC_OFFLOAD_ERR("Invalid State: %d\n", offload_ctx->state);

	switch (event) {
	case IPA_RM_RESOURCE_GRANTED:
		complete_all(&offload_ctx->ntn_completion);
		break;

	case IPA_RM_RESOURCE_RELEASED:
		break;

	default:
		IPA_UC_OFFLOAD_ERR("Invalid RM Evt: %d", event);
		break;
	}
}

static int ipa_uc_ntn_alloc_conn_smmu_info(struct ipa_ntn_setup_info *dest,
	struct ipa_ntn_setup_info *source)
@@ -456,35 +365,11 @@ int ipa_uc_ntn_conn_pipes(struct ipa_ntn_conn_in_params *inp,
		return -EINVAL;
	}

	if (ipa_pm_is_used()) {
	result = ipa_pm_activate_sync(ntn_ctx->pm_hdl);
	if (result) {
		IPA_UC_OFFLOAD_ERR("fail to activate: %d\n", result);
		return result;
	}
	} else {
		result = ipa_rm_add_dependency(IPA_RM_RESOURCE_ETHERNET_PROD,
			IPA_RM_RESOURCE_APPS_CONS);
		if (result) {
			IPA_UC_OFFLOAD_ERR("fail to add rm dependency: %d\n",
				result);
			return result;
		}

		result = ipa_rm_request_resource(IPA_RM_RESOURCE_ETHERNET_PROD);
		if (result == -EINPROGRESS) {
			if (wait_for_completion_timeout(&ntn_ctx->ntn_completion
				, 10*HZ) == 0) {
				IPA_UC_OFFLOAD_ERR("ETH_PROD req timeout\n");
				result = -EFAULT;
				goto fail;
			}
		} else if (result != 0) {
			IPA_UC_OFFLOAD_ERR("fail to request resource\n");
			result = -EFAULT;
			goto fail;
		}
	}

	ntn_ctx->state = IPA_UC_OFFLOAD_STATE_UP;
	result = ipa_setup_uc_ntn_pipes(inp, ntn_ctx->notify,
@@ -514,9 +399,6 @@ int ipa_uc_ntn_conn_pipes(struct ipa_ntn_conn_in_params *inp,
	}

fail:
	if (!ipa_pm_is_used())
		ipa_rm_delete_dependency(IPA_RM_RESOURCE_ETHERNET_PROD,
			IPA_RM_RESOURCE_APPS_CONS);
	return result;
}

@@ -565,42 +447,6 @@ int ipa_uc_offload_conn_pipes(struct ipa_uc_offload_conn_in_params *inp,
}
EXPORT_SYMBOL(ipa_uc_offload_conn_pipes);

int ipa_set_perf_profile(struct ipa_perf_profile *profile)
{
	struct ipa_rm_perf_profile rm_profile;
	enum ipa_rm_resource_name resource_name;

	if (profile == NULL) {
		IPA_UC_OFFLOAD_ERR("Invalid input\n");
		return -EINVAL;
	}

	rm_profile.max_supported_bandwidth_mbps =
		profile->max_supported_bw_mbps;

	if (profile->client == IPA_CLIENT_ETHERNET_PROD) {
		resource_name = IPA_RM_RESOURCE_ETHERNET_PROD;
	} else if (profile->client == IPA_CLIENT_ETHERNET_CONS) {
		resource_name = IPA_RM_RESOURCE_ETHERNET_CONS;
	} else {
		IPA_UC_OFFLOAD_ERR("not supported\n");
		return -EINVAL;
	}

	if (ipa_pm_is_used())
		return ipa_pm_set_throughput(
			ipa_uc_offload_ctx[IPA_UC_NTN]->pm_hdl,
			profile->max_supported_bw_mbps);

	if (ipa_rm_set_perf_profile(resource_name, &rm_profile)) {
		IPA_UC_OFFLOAD_ERR("fail to setup rm perf profile\n");
		return -EFAULT;
	}

	return 0;
}
EXPORT_SYMBOL(ipa_set_perf_profile);

static int ipa_uc_ntn_disconn_pipes(struct ipa_uc_offload_ctx *ntn_ctx)
{
	int ipa_ep_idx_ul, ipa_ep_idx_dl;
@@ -612,29 +458,12 @@ static int ipa_uc_ntn_disconn_pipes(struct ipa_uc_offload_ctx *ntn_ctx)
	}

	ntn_ctx->state = IPA_UC_OFFLOAD_STATE_INITIALIZED;

	if (ipa_pm_is_used()) {
	ret = ipa_pm_deactivate_sync(ntn_ctx->pm_hdl);
	if (ret) {
		IPA_UC_OFFLOAD_ERR("fail to deactivate res: %d\n",
			ret);
		return -EFAULT;
	}
	} else {
		ret = ipa_rm_release_resource(IPA_RM_RESOURCE_ETHERNET_PROD);
		if (ret) {
			IPA_UC_OFFLOAD_ERR("fail release ETHERNET_PROD: %d\n",
				ret);
			return -EFAULT;
		}

		ret = ipa_rm_delete_dependency(IPA_RM_RESOURCE_ETHERNET_PROD,
			IPA_RM_RESOURCE_APPS_CONS);
		if (ret) {
			IPA_UC_OFFLOAD_ERR("fail del dep ETH->APPS, %d\n", ret);
			return -EFAULT;
		}
	}

	ipa_ep_idx_ul = ipa_get_ep_mapping(IPA_CLIENT_ETHERNET_PROD);
	ipa_ep_idx_dl = ipa_get_ep_mapping(IPA_CLIENT_ETHERNET_CONS);
@@ -695,19 +524,7 @@ static int ipa_uc_ntn_cleanup(struct ipa_uc_offload_ctx *ntn_ctx)
	int len, result = 0;
	struct ipa_ioc_del_hdr *hdr;

	if (ipa_pm_is_used()) {
	ipa_uc_offload_ntn_deregister_pm_client(ntn_ctx);
	} else {
		if (ipa_rm_delete_resource(IPA_RM_RESOURCE_ETHERNET_PROD)) {
			IPA_UC_OFFLOAD_ERR("fail to delete ETHERNET_PROD\n");
			return -EFAULT;
		}

		if (ipa_rm_delete_resource(IPA_RM_RESOURCE_ETHERNET_CONS)) {
			IPA_UC_OFFLOAD_ERR("fail to delete ETHERNET_CONS\n");
			return -EFAULT;
		}
	}

	len = sizeof(struct ipa_ioc_del_hdr) + 2 * sizeof(struct ipa_hdr_del);
	hdr = kzalloc(len, GFP_KERNEL);
Loading