Merge branch 'net-ipa-limit-special-reset-handling'

Alex Elder says:

====================
net: ipa: limit special reset handling

Some special handling done during channel reset should only be done
for IPA hardare version 3.5.1.  This series generalizes the meaning
of a flag passed to indicate special behavior, then has the special
handling be used only when appropriate.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
David S. Miller 2020-05-06 17:36:04 -07:00
Родитель ee733cd896 a3f2405b04
Коммит 9c729e7484
4 изменённых файлов: 23 добавлений и 23 удалений

Просмотреть файл

@ -834,18 +834,18 @@ int gsi_channel_stop(struct gsi *gsi, u32 channel_id)
}
/* Reset and reconfigure a channel (possibly leaving doorbell disabled) */
void gsi_channel_reset(struct gsi *gsi, u32 channel_id, bool db_enable)
void gsi_channel_reset(struct gsi *gsi, u32 channel_id, bool legacy)
{
struct gsi_channel *channel = &gsi->channel[channel_id];
mutex_lock(&gsi->mutex);
/* Due to a hardware quirk we need to reset RX channels twice. */
gsi_channel_reset_command(channel);
if (!channel->toward_ipa)
/* Due to a hardware quirk we may need to reset RX channels twice. */
if (legacy && !channel->toward_ipa)
gsi_channel_reset_command(channel);
gsi_channel_program(channel, db_enable);
gsi_channel_program(channel, legacy);
gsi_channel_trans_cancel_pending(channel);
mutex_unlock(&gsi->mutex);
@ -1455,7 +1455,7 @@ static void gsi_evt_ring_teardown(struct gsi *gsi)
/* Setup function for a single channel */
static int gsi_channel_setup_one(struct gsi *gsi, u32 channel_id,
bool db_enable)
bool legacy)
{
struct gsi_channel *channel = &gsi->channel[channel_id];
u32 evt_ring_id = channel->evt_ring_id;
@ -1474,7 +1474,7 @@ static int gsi_channel_setup_one(struct gsi *gsi, u32 channel_id,
if (ret)
goto err_evt_ring_de_alloc;
gsi_channel_program(channel, db_enable);
gsi_channel_program(channel, legacy);
if (channel->toward_ipa)
netif_tx_napi_add(&gsi->dummy_dev, &channel->napi,
@ -1545,7 +1545,7 @@ static void gsi_modem_channel_halt(struct gsi *gsi, u32 channel_id)
}
/* Setup function for channels */
static int gsi_channel_setup(struct gsi *gsi, bool db_enable)
static int gsi_channel_setup(struct gsi *gsi, bool legacy)
{
u32 channel_id = 0;
u32 mask;
@ -1557,7 +1557,7 @@ static int gsi_channel_setup(struct gsi *gsi, bool db_enable)
mutex_lock(&gsi->mutex);
do {
ret = gsi_channel_setup_one(gsi, channel_id, db_enable);
ret = gsi_channel_setup_one(gsi, channel_id, legacy);
if (ret)
goto err_unwind;
} while (++channel_id < gsi->channel_count);
@ -1643,7 +1643,7 @@ static void gsi_channel_teardown(struct gsi *gsi)
}
/* Setup function for GSI. GSI firmware must be loaded and initialized */
int gsi_setup(struct gsi *gsi, bool db_enable)
int gsi_setup(struct gsi *gsi, bool legacy)
{
u32 val;
@ -1686,7 +1686,7 @@ int gsi_setup(struct gsi *gsi, bool db_enable)
/* Writing 1 indicates IRQ interrupts; 0 would be MSI */
iowrite32(1, gsi->virt + GSI_CNTXT_INTSET_OFFSET);
return gsi_channel_setup(gsi, db_enable);
return gsi_channel_setup(gsi, legacy);
}
/* Inverse of gsi_setup() */

Просмотреть файл

@ -165,14 +165,14 @@ struct gsi {
/**
* gsi_setup() - Set up the GSI subsystem
* @gsi: Address of GSI structure embedded in an IPA structure
* @db_enable: Whether to use the GSI doorbell engine
* @legacy: Set up for legacy hardware
*
* @Return: 0 if successful, or a negative error code
*
* Performs initialization that must wait until the GSI hardware is
* ready (including firmware loaded).
*/
int gsi_setup(struct gsi *gsi, bool db_enable);
int gsi_setup(struct gsi *gsi, bool legacy);
/**
* gsi_teardown() - Tear down GSI subsystem
@ -220,15 +220,15 @@ int gsi_channel_stop(struct gsi *gsi, u32 channel_id);
* gsi_channel_reset() - Reset an allocated GSI channel
* @gsi: GSI pointer
* @channel_id: Channel to be reset
* @db_enable: Whether doorbell engine should be enabled
* @legacy: Legacy behavior
*
* Reset a channel and reconfigure it. The @db_enable flag indicates
* whether the doorbell engine will be enabled following reconfiguration.
* Reset a channel and reconfigure it. The @legacy flag indicates
* that some steps should be done differently for legacy hardware.
*
* GSI hardware relinquishes ownership of all pending receive buffer
* transactions and they will complete with their cancelled flag set.
*/
void gsi_channel_reset(struct gsi *gsi, u32 channel_id, bool db_enable);
void gsi_channel_reset(struct gsi *gsi, u32 channel_id, bool legacy);
int gsi_channel_suspend(struct gsi *gsi, u32 channel_id, bool stop);
int gsi_channel_resume(struct gsi *gsi, u32 channel_id, bool start);

Просмотреть файл

@ -1136,7 +1136,7 @@ static int ipa_endpoint_reset_rx_aggr(struct ipa_endpoint *endpoint)
bool endpoint_suspended = false;
struct gsi *gsi = &ipa->gsi;
dma_addr_t addr;
bool db_enable;
bool legacy;
u32 retries;
u32 len = 1;
void *virt;
@ -1200,8 +1200,8 @@ static int ipa_endpoint_reset_rx_aggr(struct ipa_endpoint *endpoint)
* complete the channel reset sequence. Finish by suspending the
* channel again (if necessary).
*/
db_enable = ipa->version == IPA_VERSION_3_5_1;
gsi_channel_reset(gsi, endpoint->channel_id, db_enable);
legacy = ipa->version == IPA_VERSION_3_5_1;
gsi_channel_reset(gsi, endpoint->channel_id, legacy);
msleep(1);
@ -1223,8 +1223,8 @@ static void ipa_endpoint_reset(struct ipa_endpoint *endpoint)
{
u32 channel_id = endpoint->channel_id;
struct ipa *ipa = endpoint->ipa;
bool db_enable;
bool special;
bool legacy;
int ret = 0;
/* On IPA v3.5.1, if an RX endpoint is reset while aggregation
@ -1233,12 +1233,12 @@ static void ipa_endpoint_reset(struct ipa_endpoint *endpoint)
*
* IPA v3.5.1 enables the doorbell engine. Newer versions do not.
*/
db_enable = ipa->version == IPA_VERSION_3_5_1;
legacy = ipa->version == IPA_VERSION_3_5_1;
special = !endpoint->toward_ipa && endpoint->data->aggregation;
if (special && ipa_endpoint_aggr_active(endpoint))
ret = ipa_endpoint_reset_rx_aggr(endpoint);
else
gsi_channel_reset(&ipa->gsi, channel_id, db_enable);
gsi_channel_reset(&ipa->gsi, channel_id, legacy);
if (ret)
dev_err(&ipa->pdev->dev,

Просмотреть файл

@ -108,7 +108,7 @@ int ipa_setup(struct ipa *ipa)
struct ipa_endpoint *command_endpoint;
int ret;
/* IPA v4.0 and above don't use the doorbell engine. */
/* Setup for IPA v3.5.1 has some slight differences */
ret = gsi_setup(&ipa->gsi, ipa->version == IPA_VERSION_3_5_1);
if (ret)
return ret;