* [PATCH net-next 0/2] couple more ARFS tidy-ups
@ 2020-02-17 13:42 Edward Cree
2020-02-17 13:43 ` [PATCH net-next 1/2] sfc: only schedule asynchronous filter work if needed Edward Cree
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Edward Cree @ 2020-02-17 13:42 UTC (permalink / raw)
To: linux-net-drivers, davem; +Cc: netdev
Tie up some loose ends from the recent ARFS work.
Edward Cree (2):
sfc: only schedule asynchronous filter work if needed
sfc: move some ARFS code out of headers
drivers/net/ethernet/sfc/efx.h | 18 ------------------
drivers/net/ethernet/sfc/efx_channels.c | 25 ++++++++++++++++++++++++-
2 files changed, 24 insertions(+), 19 deletions(-)
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH net-next 1/2] sfc: only schedule asynchronous filter work if needed
2020-02-17 13:42 [PATCH net-next 0/2] couple more ARFS tidy-ups Edward Cree
@ 2020-02-17 13:43 ` Edward Cree
2020-02-17 13:43 ` [PATCH net-next 2/2] sfc: move some ARFS code out of headers Edward Cree
2020-02-17 22:35 ` [PATCH net-next 0/2] couple more ARFS tidy-ups David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Edward Cree @ 2020-02-17 13:43 UTC (permalink / raw)
To: linux-net-drivers, davem; +Cc: netdev
Prevent excessive CPU time spent running a workitem with nothing to do.
We avoid any races by keeping the same check in efx_filter_rfs_expire().
Suggested-by: Martin Habets <mhabets@solarflare.com>
Signed-off-by: Edward Cree <ecree@solarflare.com>
---
drivers/net/ethernet/sfc/efx.h | 2 +-
drivers/net/ethernet/sfc/efx_channels.c | 8 +++++++-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/sfc/efx.h b/drivers/net/ethernet/sfc/efx.h
index f1bdb04efbe4..78babbe6d2d8 100644
--- a/drivers/net/ethernet/sfc/efx.h
+++ b/drivers/net/ethernet/sfc/efx.h
@@ -159,7 +159,7 @@ static inline void efx_filter_rfs_expire(struct work_struct *data)
channel = container_of(dwork, struct efx_channel, filter_work);
time = jiffies - channel->rfs_last_expiry;
quota = channel->rfs_filter_count * time / (30 * HZ);
- if (quota > 20 && __efx_filter_rfs_expire(channel, min(channel->rfs_filter_count, quota)))
+ if (quota >= 20 && __efx_filter_rfs_expire(channel, min(channel->rfs_filter_count, quota)))
channel->rfs_last_expiry += time;
/* Ensure we do more work eventually even if NAPI poll is not happening */
schedule_delayed_work(dwork, 30 * HZ);
diff --git a/drivers/net/ethernet/sfc/efx_channels.c b/drivers/net/ethernet/sfc/efx_channels.c
index aeb5e8aa2f2a..1b1265d94fc9 100644
--- a/drivers/net/ethernet/sfc/efx_channels.c
+++ b/drivers/net/ethernet/sfc/efx_channels.c
@@ -1166,6 +1166,9 @@ static int efx_poll(struct napi_struct *napi, int budget)
struct efx_channel *channel =
container_of(napi, struct efx_channel, napi_str);
struct efx_nic *efx = channel->efx;
+#ifdef CONFIG_RFS_ACCEL
+ unsigned int time;
+#endif
int spent;
netif_vdbg(efx, intr, efx->net_dev,
@@ -1185,7 +1188,10 @@ static int efx_poll(struct napi_struct *napi, int budget)
#ifdef CONFIG_RFS_ACCEL
/* Perhaps expire some ARFS filters */
- mod_delayed_work(system_wq, &channel->filter_work, 0);
+ time = jiffies - channel->rfs_last_expiry;
+ /* Would our quota be >= 20? */
+ if (channel->rfs_filter_count * time >= 600 * HZ)
+ mod_delayed_work(system_wq, &channel->filter_work, 0);
#endif
/* There is no race here; although napi_disable() will
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH net-next 2/2] sfc: move some ARFS code out of headers
2020-02-17 13:42 [PATCH net-next 0/2] couple more ARFS tidy-ups Edward Cree
2020-02-17 13:43 ` [PATCH net-next 1/2] sfc: only schedule asynchronous filter work if needed Edward Cree
@ 2020-02-17 13:43 ` Edward Cree
2020-02-17 22:35 ` [PATCH net-next 0/2] couple more ARFS tidy-ups David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Edward Cree @ 2020-02-17 13:43 UTC (permalink / raw)
To: linux-net-drivers, davem; +Cc: netdev
efx_filter_rfs_expire() is a work-function, so it being inline makes no
sense. It's only ever used in efx_channels.c, so move it there.
While we're at it, clean out some related unused cruft.
Signed-off-by: Edward Cree <ecree@solarflare.com>
---
drivers/net/ethernet/sfc/efx.h | 18 ------------------
drivers/net/ethernet/sfc/efx_channels.c | 17 +++++++++++++++++
2 files changed, 17 insertions(+), 18 deletions(-)
diff --git a/drivers/net/ethernet/sfc/efx.h b/drivers/net/ethernet/sfc/efx.h
index 78babbe6d2d8..da54afaa3c44 100644
--- a/drivers/net/ethernet/sfc/efx.h
+++ b/drivers/net/ethernet/sfc/efx.h
@@ -150,24 +150,6 @@ static inline s32 efx_filter_get_rx_ids(struct efx_nic *efx,
int efx_filter_rfs(struct net_device *net_dev, const struct sk_buff *skb,
u16 rxq_index, u32 flow_id);
bool __efx_filter_rfs_expire(struct efx_channel *channel, unsigned int quota);
-static inline void efx_filter_rfs_expire(struct work_struct *data)
-{
- struct delayed_work *dwork = to_delayed_work(data);
- struct efx_channel *channel;
- unsigned int time, quota;
-
- channel = container_of(dwork, struct efx_channel, filter_work);
- time = jiffies - channel->rfs_last_expiry;
- quota = channel->rfs_filter_count * time / (30 * HZ);
- if (quota >= 20 && __efx_filter_rfs_expire(channel, min(channel->rfs_filter_count, quota)))
- channel->rfs_last_expiry += time;
- /* Ensure we do more work eventually even if NAPI poll is not happening */
- schedule_delayed_work(dwork, 30 * HZ);
-}
-#define efx_filter_rfs_enabled() 1
-#else
-static inline void efx_filter_rfs_expire(struct work_struct *data) {}
-#define efx_filter_rfs_enabled() 0
#endif
/* RSS contexts */
diff --git a/drivers/net/ethernet/sfc/efx_channels.c b/drivers/net/ethernet/sfc/efx_channels.c
index 1b1265d94fc9..d2d738314c50 100644
--- a/drivers/net/ethernet/sfc/efx_channels.c
+++ b/drivers/net/ethernet/sfc/efx_channels.c
@@ -485,6 +485,23 @@ void efx_remove_eventq(struct efx_channel *channel)
*
*************************************************************************/
+#ifdef CONFIG_RFS_ACCEL
+static void efx_filter_rfs_expire(struct work_struct *data)
+{
+ struct delayed_work *dwork = to_delayed_work(data);
+ struct efx_channel *channel;
+ unsigned int time, quota;
+
+ channel = container_of(dwork, struct efx_channel, filter_work);
+ time = jiffies - channel->rfs_last_expiry;
+ quota = channel->rfs_filter_count * time / (30 * HZ);
+ if (quota >= 20 && __efx_filter_rfs_expire(channel, min(channel->rfs_filter_count, quota)))
+ channel->rfs_last_expiry += time;
+ /* Ensure we do more work eventually even if NAPI poll is not happening */
+ schedule_delayed_work(dwork, 30 * HZ);
+}
+#endif
+
/* Allocate and initialise a channel structure. */
struct efx_channel *
efx_alloc_channel(struct efx_nic *efx, int i, struct efx_channel *old_channel)
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net-next 0/2] couple more ARFS tidy-ups
2020-02-17 13:42 [PATCH net-next 0/2] couple more ARFS tidy-ups Edward Cree
2020-02-17 13:43 ` [PATCH net-next 1/2] sfc: only schedule asynchronous filter work if needed Edward Cree
2020-02-17 13:43 ` [PATCH net-next 2/2] sfc: move some ARFS code out of headers Edward Cree
@ 2020-02-17 22:35 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2020-02-17 22:35 UTC (permalink / raw)
To: ecree; +Cc: linux-net-drivers, netdev
From: Edward Cree <ecree@solarflare.com>
Date: Mon, 17 Feb 2020 13:42:04 +0000
> Tie up some loose ends from the recent ARFS work.
Series applied, thank you.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-02-17 22:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-17 13:42 [PATCH net-next 0/2] couple more ARFS tidy-ups Edward Cree
2020-02-17 13:43 ` [PATCH net-next 1/2] sfc: only schedule asynchronous filter work if needed Edward Cree
2020-02-17 13:43 ` [PATCH net-next 2/2] sfc: move some ARFS code out of headers Edward Cree
2020-02-17 22:35 ` [PATCH net-next 0/2] couple more ARFS tidy-ups David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).