mirror of
https://github.com/torvalds/linux.git
synced 2026-06-07 05:55:44 +02:00
net: ipa: use a bitmap for endpoint replenish_enabled
commit c1aaa01dbf upstream.
Define a new replenish_flags bitmap to contain Boolean flags
associated with an endpoint's replenishing state. Replace the
replenish_enabled field with a flag in that bitmap. This is to
prepare for the next patch, which adds another flag.
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
2ed912e3e0
commit
ad81380d3a
|
|
@ -901,7 +901,7 @@ static void ipa_endpoint_replenish(struct ipa_endpoint *endpoint, u32 count)
|
||||||
struct gsi *gsi;
|
struct gsi *gsi;
|
||||||
u32 backlog;
|
u32 backlog;
|
||||||
|
|
||||||
if (!endpoint->replenish_enabled) {
|
if (!test_bit(IPA_REPLENISH_ENABLED, endpoint->replenish_flags)) {
|
||||||
if (count)
|
if (count)
|
||||||
atomic_add(count, &endpoint->replenish_saved);
|
atomic_add(count, &endpoint->replenish_saved);
|
||||||
return;
|
return;
|
||||||
|
|
@ -938,7 +938,7 @@ static void ipa_endpoint_replenish_enable(struct ipa_endpoint *endpoint)
|
||||||
u32 max_backlog;
|
u32 max_backlog;
|
||||||
u32 saved;
|
u32 saved;
|
||||||
|
|
||||||
endpoint->replenish_enabled = true;
|
set_bit(IPA_REPLENISH_ENABLED, endpoint->replenish_flags);
|
||||||
while ((saved = atomic_xchg(&endpoint->replenish_saved, 0)))
|
while ((saved = atomic_xchg(&endpoint->replenish_saved, 0)))
|
||||||
atomic_add(saved, &endpoint->replenish_backlog);
|
atomic_add(saved, &endpoint->replenish_backlog);
|
||||||
|
|
||||||
|
|
@ -952,7 +952,7 @@ static void ipa_endpoint_replenish_disable(struct ipa_endpoint *endpoint)
|
||||||
{
|
{
|
||||||
u32 backlog;
|
u32 backlog;
|
||||||
|
|
||||||
endpoint->replenish_enabled = false;
|
clear_bit(IPA_REPLENISH_ENABLED, endpoint->replenish_flags);
|
||||||
while ((backlog = atomic_xchg(&endpoint->replenish_backlog, 0)))
|
while ((backlog = atomic_xchg(&endpoint->replenish_backlog, 0)))
|
||||||
atomic_add(backlog, &endpoint->replenish_saved);
|
atomic_add(backlog, &endpoint->replenish_saved);
|
||||||
}
|
}
|
||||||
|
|
@ -1469,7 +1469,7 @@ static void ipa_endpoint_setup_one(struct ipa_endpoint *endpoint)
|
||||||
/* RX transactions require a single TRE, so the maximum
|
/* RX transactions require a single TRE, so the maximum
|
||||||
* backlog is the same as the maximum outstanding TREs.
|
* backlog is the same as the maximum outstanding TREs.
|
||||||
*/
|
*/
|
||||||
endpoint->replenish_enabled = false;
|
clear_bit(IPA_REPLENISH_ENABLED, endpoint->replenish_flags);
|
||||||
atomic_set(&endpoint->replenish_saved,
|
atomic_set(&endpoint->replenish_saved,
|
||||||
gsi_channel_tre_max(gsi, endpoint->channel_id));
|
gsi_channel_tre_max(gsi, endpoint->channel_id));
|
||||||
atomic_set(&endpoint->replenish_backlog, 0);
|
atomic_set(&endpoint->replenish_backlog, 0);
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,17 @@ enum ipa_endpoint_name {
|
||||||
|
|
||||||
#define IPA_ENDPOINT_MAX 32 /* Max supported by driver */
|
#define IPA_ENDPOINT_MAX 32 /* Max supported by driver */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* enum ipa_replenish_flag: RX buffer replenish flags
|
||||||
|
*
|
||||||
|
* @IPA_REPLENISH_ENABLED: Whether receive buffer replenishing is enabled
|
||||||
|
* @IPA_REPLENISH_COUNT: Number of defined replenish flags
|
||||||
|
*/
|
||||||
|
enum ipa_replenish_flag {
|
||||||
|
IPA_REPLENISH_ENABLED,
|
||||||
|
IPA_REPLENISH_COUNT, /* Number of flags (must be last) */
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* struct ipa_endpoint - IPA endpoint information
|
* struct ipa_endpoint - IPA endpoint information
|
||||||
* @channel_id: EP's GSI channel
|
* @channel_id: EP's GSI channel
|
||||||
|
|
@ -60,7 +71,7 @@ struct ipa_endpoint {
|
||||||
struct net_device *netdev;
|
struct net_device *netdev;
|
||||||
|
|
||||||
/* Receive buffer replenishing for RX endpoints */
|
/* Receive buffer replenishing for RX endpoints */
|
||||||
bool replenish_enabled;
|
DECLARE_BITMAP(replenish_flags, IPA_REPLENISH_COUNT);
|
||||||
u32 replenish_ready;
|
u32 replenish_ready;
|
||||||
atomic_t replenish_saved;
|
atomic_t replenish_saved;
|
||||||
atomic_t replenish_backlog;
|
atomic_t replenish_backlog;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user