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

Commit f09e8963 authored by Jinesh K. Jayakumar's avatar Jinesh K. Jayakumar Committed by Gerrit - the friendly Code Review server
Browse files

msm: ipa: eth: Support for deleting default filter rules



Add ipa_eth_ep_deinit() for deleting default rules during offload path
deinit.

Change-Id: I083c37cc8e6e902a8bb6abede4972c9a793c8c7c
Signed-off-by: default avatarJinesh K. Jayakumar <jineshk@codeaurora.org>
parent 098d8066
Loading
Loading
Loading
Loading
+40 −14
Original line number Diff line number Diff line
@@ -382,16 +382,35 @@ void ipa_eth_ep_deinit_ctx(struct ipa_eth_channel *ch)
	memset(ep_ctx, 0, offsetof(typeof(*ep_ctx), sys));
}

static int __ipa_eth_ep_init(struct ipa_eth_channel *ch,
				struct ipa3_ep_context *ep_ctx)
{
	int rc;

	rc = ipa3_cfg_ep(ch->ipa_ep_num, &ep_ctx->cfg);
	if (rc) {
		ipa_eth_dev_err(ch->eth_dev,
				"Failed to configure EP %d", ch->ipa_ep_num);
		goto err_exit;
	}

	if (IPA_CLIENT_IS_PROD(ch->ipa_client))
		ipa3_install_dflt_flt_rules(ch->ipa_ep_num);

err_exit:
	return rc;
}

/**
 * ipa_eth_ep_init - Initialize IPA endpoint for a channel
 * ipa_eth_ep_init() - Initialize IPA endpoint for a channel
 * @ch: Channel for which EP need to be initialized
 *
 * Return: 0 on success, negative errno otherwise
 */
int ipa_eth_ep_init(struct ipa_eth_channel *ch)
{
	int rc = 0;
	struct ipa3_ep_context *ep_ctx = NULL;
	int rc;
	struct ipa3_ep_context *ep_ctx;

	ep_ctx = &ipa3_ctx->ep[ch->ipa_ep_num];
	if (!ep_ctx->valid) {
@@ -400,24 +419,31 @@ int ipa_eth_ep_init(struct ipa_eth_channel *ch)
	}

	IPA_ACTIVE_CLIENTS_INC_SIMPLE();

	rc = ipa3_cfg_ep(ch->ipa_ep_num, &ep_ctx->cfg);
	if (rc) {
		ipa_eth_dev_err(ch->eth_dev,
				"Failed to configure EP %d", ch->ipa_ep_num);
	rc = __ipa_eth_ep_init(ch, ep_ctx);
	IPA_ACTIVE_CLIENTS_DEC_SIMPLE();
		goto err_exit;

	return rc;
}
EXPORT_SYMBOL(ipa_eth_ep_init);

/**
 * ipa_eth_ep_deinit() - Deinitialize IPA endpoint for a channel
 * @ch: Channel for which EP need to be deinitialized
 *
 * Return: 0 on success, negative errno otherwise
 */
int ipa_eth_ep_deinit(struct ipa_eth_channel *ch)
{
	IPA_ACTIVE_CLIENTS_INC_SIMPLE();

	if (IPA_CLIENT_IS_PROD(ch->ipa_client))
		ipa3_install_dflt_flt_rules(ch->ipa_ep_num);
		ipa3_delete_dflt_flt_rules(ch->ipa_ep_num);

	IPA_ACTIVE_CLIENTS_DEC_SIMPLE();

err_exit:
	return rc;
	return 0;
}
EXPORT_SYMBOL(ipa_eth_ep_init);
EXPORT_SYMBOL(ipa_eth_ep_deinit);

/**
 * ipa_eth_ep_start() - Start an IPA endpoint
+3 −1
Original line number Diff line number Diff line
@@ -43,9 +43,10 @@
 *                  to notify of various device events.
 *           5    - Removed ipa_eth_{gsi,uc}_iommu_*{} APIs that were used for
 *                  mapping memory to GSI and IPA uC IOMMU CBs.
 *           6    - Added ipa_eth_ep_deinit()
 */

#define IPA_ETH_API_VER 5
#define IPA_ETH_API_VER 6

/**
 * enum ipa_eth_dev_features - Features supported by an ethernet device or
@@ -1018,6 +1019,7 @@ struct ipa_eth_resource *ipa_eth_net_ch_to_cb_mem(
	enum ipa_eth_hw_type hw_type);

int ipa_eth_ep_init(struct ipa_eth_channel *ch);
int ipa_eth_ep_deinit(struct ipa_eth_channel *ch);
int ipa_eth_ep_start(struct ipa_eth_channel *ch);
int ipa_eth_ep_stop(struct ipa_eth_channel *ch);