Commit 2091c79a authored by Alex Elder's avatar Alex Elder Committed by David S. Miller

net: ipa: count the number of modem TX endpoints

In ipa_endpoint_modem_exception_reset_all(), a high estimate was
made of the number of endpoints that need their status register
updated.  We only used what was needed, so the high estimate didn't
matter much.

However the next few patches are going to limit the number of
commands in a single transaction, and the overestimate would exceed
that.  So count the number of modem TX endpoints at initialization
time, and use it in ipa_endpoint_modem_exception_reset_all().
Signed-off-by: default avatarAlex Elder <elder@linaro.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d15180b4
...@@ -62,6 +62,7 @@ struct ipa_interrupt; ...@@ -62,6 +62,7 @@ struct ipa_interrupt;
* @initialized: Bit mask indicating endpoints initialized * @initialized: Bit mask indicating endpoints initialized
* @set_up: Bit mask indicating endpoints set up * @set_up: Bit mask indicating endpoints set up
* @enabled: Bit mask indicating endpoints enabled * @enabled: Bit mask indicating endpoints enabled
* @modem_tx_count: Number of defined modem TX endoints
* @endpoint: Array of endpoint information * @endpoint: Array of endpoint information
* @channel_map: Mapping of GSI channel to IPA endpoint * @channel_map: Mapping of GSI channel to IPA endpoint
* @name_map: Mapping of IPA endpoint name to IPA endpoint * @name_map: Mapping of IPA endpoint name to IPA endpoint
...@@ -114,6 +115,7 @@ struct ipa { ...@@ -114,6 +115,7 @@ struct ipa {
u32 set_up; u32 set_up;
u32 enabled; u32 enabled;
u32 modem_tx_count;
struct ipa_endpoint endpoint[IPA_ENDPOINT_MAX]; struct ipa_endpoint endpoint[IPA_ENDPOINT_MAX];
struct ipa_endpoint *channel_map[GSI_CHANNEL_COUNT_MAX]; struct ipa_endpoint *channel_map[GSI_CHANNEL_COUNT_MAX];
struct ipa_endpoint *name_map[IPA_ENDPOINT_COUNT]; struct ipa_endpoint *name_map[IPA_ENDPOINT_COUNT];
......
...@@ -442,12 +442,10 @@ int ipa_endpoint_modem_exception_reset_all(struct ipa *ipa) ...@@ -442,12 +442,10 @@ int ipa_endpoint_modem_exception_reset_all(struct ipa *ipa)
struct gsi_trans *trans; struct gsi_trans *trans;
u32 count; u32 count;
/* We need one command per modem TX endpoint. We can get an upper /* We need one command per modem TX endpoint, plus the commands
* bound on that by assuming all initialized endpoints are modem->IPA. * that clear the pipeline.
* That won't happen, and we could be more precise, but this is fine
* for now. End the transaction with commands to clear the pipeline.
*/ */
count = hweight32(initialized) + ipa_cmd_pipeline_clear_count(); count = ipa->modem_tx_count + ipa_cmd_pipeline_clear_count();
trans = ipa_cmd_trans_alloc(ipa, count); trans = ipa_cmd_trans_alloc(ipa, count);
if (!trans) { if (!trans) {
dev_err(&ipa->pdev->dev, dev_err(&ipa->pdev->dev,
...@@ -1924,6 +1922,8 @@ u32 ipa_endpoint_init(struct ipa *ipa, u32 count, ...@@ -1924,6 +1922,8 @@ u32 ipa_endpoint_init(struct ipa *ipa, u32 count,
if (data->endpoint.filter_support) if (data->endpoint.filter_support)
filter_map |= BIT(data->endpoint_id); filter_map |= BIT(data->endpoint_id);
if (data->ee_id == GSI_EE_MODEM && data->toward_ipa)
ipa->modem_tx_count++;
} }
if (!ipa_filter_map_valid(ipa, filter_map)) if (!ipa_filter_map_valid(ipa, filter_map))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment