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

net: ipa: kill replenish_saved

The replenish_saved field keeps track of the number of times a new
buffer is added to the backlog when replenishing is disabled.  We
don't really use it though, so there's no need for us to track it
separately.  Whether replenishing is enabled or not, we can simply
increment the backlog.

Get rid of replenish_saved, and initialize and increment the backlog
where it would have otherwise been used.
Signed-off-by: default avatarAlex Elder <elder@linaro.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b93235e6
...@@ -1090,9 +1090,8 @@ static int ipa_endpoint_replenish_one(struct ipa_endpoint *endpoint) ...@@ -1090,9 +1090,8 @@ static int ipa_endpoint_replenish_one(struct ipa_endpoint *endpoint)
* endpoint, based on the number of entries in the underlying channel ring * endpoint, based on the number of entries in the underlying channel ring
* buffer. If an endpoint's "backlog" is non-zero, it indicates how many * buffer. If an endpoint's "backlog" is non-zero, it indicates how many
* more receive buffers can be supplied to the hardware. Replenishing for * more receive buffers can be supplied to the hardware. Replenishing for
* an endpoint can be disabled, in which case requests to replenish a * an endpoint can be disabled, in which case buffers are not queued to
* buffer are "saved", and transferred to the backlog once it is re-enabled * the hardware.
* again.
*/ */
static void ipa_endpoint_replenish(struct ipa_endpoint *endpoint, bool add_one) static void ipa_endpoint_replenish(struct ipa_endpoint *endpoint, bool add_one)
{ {
...@@ -1102,7 +1101,7 @@ static void ipa_endpoint_replenish(struct ipa_endpoint *endpoint, bool add_one) ...@@ -1102,7 +1101,7 @@ static void ipa_endpoint_replenish(struct ipa_endpoint *endpoint, bool add_one)
if (!test_bit(IPA_REPLENISH_ENABLED, endpoint->replenish_flags)) { if (!test_bit(IPA_REPLENISH_ENABLED, endpoint->replenish_flags)) {
if (add_one) if (add_one)
atomic_inc(&endpoint->replenish_saved); atomic_inc(&endpoint->replenish_backlog);
return; return;
} }
...@@ -1147,11 +1146,8 @@ static void ipa_endpoint_replenish_enable(struct ipa_endpoint *endpoint) ...@@ -1147,11 +1146,8 @@ static void ipa_endpoint_replenish_enable(struct ipa_endpoint *endpoint)
{ {
struct gsi *gsi = &endpoint->ipa->gsi; struct gsi *gsi = &endpoint->ipa->gsi;
u32 max_backlog; u32 max_backlog;
u32 saved;
set_bit(IPA_REPLENISH_ENABLED, endpoint->replenish_flags); set_bit(IPA_REPLENISH_ENABLED, endpoint->replenish_flags);
while ((saved = atomic_xchg(&endpoint->replenish_saved, 0)))
atomic_add(saved, &endpoint->replenish_backlog);
/* Start replenishing if hardware currently has no buffers */ /* Start replenishing if hardware currently has no buffers */
max_backlog = gsi_channel_tre_max(gsi, endpoint->channel_id); max_backlog = gsi_channel_tre_max(gsi, endpoint->channel_id);
...@@ -1161,11 +1157,7 @@ static void ipa_endpoint_replenish_enable(struct ipa_endpoint *endpoint) ...@@ -1161,11 +1157,7 @@ static void ipa_endpoint_replenish_enable(struct ipa_endpoint *endpoint)
static void ipa_endpoint_replenish_disable(struct ipa_endpoint *endpoint) static void ipa_endpoint_replenish_disable(struct ipa_endpoint *endpoint)
{ {
u32 backlog;
clear_bit(IPA_REPLENISH_ENABLED, endpoint->replenish_flags); clear_bit(IPA_REPLENISH_ENABLED, endpoint->replenish_flags);
while ((backlog = atomic_xchg(&endpoint->replenish_backlog, 0)))
atomic_add(backlog, &endpoint->replenish_saved);
} }
static void ipa_endpoint_replenish_work(struct work_struct *work) static void ipa_endpoint_replenish_work(struct work_struct *work)
...@@ -1727,9 +1719,8 @@ static void ipa_endpoint_setup_one(struct ipa_endpoint *endpoint) ...@@ -1727,9 +1719,8 @@ static void ipa_endpoint_setup_one(struct ipa_endpoint *endpoint)
*/ */
clear_bit(IPA_REPLENISH_ENABLED, endpoint->replenish_flags); clear_bit(IPA_REPLENISH_ENABLED, endpoint->replenish_flags);
clear_bit(IPA_REPLENISH_ACTIVE, endpoint->replenish_flags); clear_bit(IPA_REPLENISH_ACTIVE, endpoint->replenish_flags);
atomic_set(&endpoint->replenish_saved, atomic_set(&endpoint->replenish_backlog,
gsi_channel_tre_max(gsi, endpoint->channel_id)); gsi_channel_tre_max(gsi, endpoint->channel_id));
atomic_set(&endpoint->replenish_backlog, 0);
INIT_DELAYED_WORK(&endpoint->replenish_work, INIT_DELAYED_WORK(&endpoint->replenish_work,
ipa_endpoint_replenish_work); ipa_endpoint_replenish_work);
} }
......
...@@ -66,7 +66,6 @@ enum ipa_replenish_flag { ...@@ -66,7 +66,6 @@ enum ipa_replenish_flag {
* @netdev: Network device pointer, if endpoint uses one * @netdev: Network device pointer, if endpoint uses one
* @replenish_flags: Replenishing state flags * @replenish_flags: Replenishing state flags
* @replenish_ready: Number of replenish transactions without doorbell * @replenish_ready: Number of replenish transactions without doorbell
* @replenish_saved: Replenish requests held while disabled
* @replenish_backlog: Number of buffers needed to fill hardware queue * @replenish_backlog: Number of buffers needed to fill hardware queue
* @replenish_work: Work item used for repeated replenish failures * @replenish_work: Work item used for repeated replenish failures
*/ */
...@@ -87,7 +86,6 @@ struct ipa_endpoint { ...@@ -87,7 +86,6 @@ struct ipa_endpoint {
/* Receive buffer replenishing for RX endpoints */ /* Receive buffer replenishing for RX endpoints */
DECLARE_BITMAP(replenish_flags, IPA_REPLENISH_COUNT); DECLARE_BITMAP(replenish_flags, IPA_REPLENISH_COUNT);
u32 replenish_ready; u32 replenish_ready;
atomic_t replenish_saved;
atomic_t replenish_backlog; atomic_t replenish_backlog;
struct delayed_work replenish_work; /* global wq */ struct delayed_work replenish_work; /* global wq */
}; };
......
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