sfc: keep alive neighbour entries while a TC encap action is using them
Subsystems (3)
PATCH 1/1 sfc: keep alive neighbour entries while a TC encap action is using them
From: Edward Cree <[email protected]>
When processing counter updates, if any action set using the newly
incremented counter includes an encap action, prod the corresponding neighbouring entry to indicate to the neighbour cache that the entry is still in use and passing traffic.
--- drivers/net/ethernet/sfc/tc.c | 20 ++++++++- drivers/net/ethernet/sfc/tc.h | 1 + drivers/net/ethernet/sfc/tc_counters.c | 58 ++++++++++++++++++++++++++ drivers/net/ethernet/sfc/tc_counters.h | 3 ++ 4 files changed, 81 insertions(+), 1 deletion(-)
drivers/net/ethernet/sfc/tc.c +19 -1
@@ -110,8 +110,13 @@ static void efx_tc_free_action_set(struct efx_nic *efx,*/ list_del (&act->list); } -if (act->count) +if (act->count) { +spin_lock_bh (&act->count->cnt->lock); +if (!list_empty (&act->count_user)) +list_del (&act->count_user); +spin_unlock_bh (&act->count->cnt->lock);efx_tc_flower_put_counter_index (efx, act->count); + }if (act->encap_md) {list_del (&act->encap_user);efx_tc_flower_release_encap_md (efx, act->encap_md);
@@ -796,6 +801,7 @@ static int efx_tc_flower_replace_foreign(struct efx_nic *efx, goto release; } act->count = ctr; +INIT_LIST_HEAD (&act->count_user); }if (!efx_tc_flower_action_order_ok (act,EFX_TC_AO_DELIVER )) {
@@ -1083,6 +1089,7 @@ static int efx_tc_flower_replace(struct efx_nic *efx, goto release; } act->count = ctr; +INIT_LIST_HEAD (&act->count_user); }switch (fa->id) {
@@ -1120,6 +1127,17 @@ static int efx_tc_flower_replace(struct efx_nic *efx,list_add_tail (&act->encap_user, &encap->users); act->dest_mport = encap->dest_mport; act->deliver =1 ; +if (act->count && !WARN_ON (!act->count->cnt)) { +/* This counter is used by an encap +* action, which needs a reference back +* so it can prod neighbouring whenever +* traffic is seen. +*/ +spin_lock_bh (&act->count->cnt->lock); +list_add_tail (&act->count_user, + &act->count->cnt->users); +spin_unlock_bh (&act->count->cnt->lock); + } rc =efx_mae_alloc_action_set (efx, act);if (rc) {NL_SET_ERR_MSG_MOD (extack,"Failed to write action set to hw (encap)" );
drivers/net/ethernet/sfc/tc.h +1 -0
@@ -38,6 +38,7 @@ struct efx_tc_action_set {struct efx_tc_encap_action *encap_md;/* entry in tc_encap_ht table */ struct list_head encap_user;/* entry on encap_md->users list */ struct efx_tc_action_set_list *user;/* Only populated if encap_md */ +struct list_head count_user;/* entry on counter->users list, if encap */ u32 dest_mport;u32 fw_id;/* index of this entry in firmware actions table */ struct list_head list;
drivers/net/ethernet/sfc/tc_counters.c +58 -0
106 lines not on this page · raw message
drivers/net/ethernet/sfc/tc_counters.h +3 -0
@@ -32,6 +32,9 @@ struct efx_tc_counter {u64 old_packets, old_bytes;/* Values last time passed to userspace */ /* jiffies of the last time we saw packets increase */ unsigned long touched; +struct work_struct work;/* For notifying encap actions */ +/* owners of corresponding count actions */ +struct list_head users; };struct efx_tc_counter_index {
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Wed, 21 Jun 2023 13:15:04 +0100 you wrote:
From: Edward Cree <[email protected]>
When processing counter updates, if any action set using the newly
incremented counter includes an encap action, prod the corresponding neighbouring entry to indicate to the neighbour cache that the entry is still in use and passing traffic.[...]
Here is the summary with links:
- [net-next] sfc: keep alive neighbour entries while a TC encap action is using them
https://git.kernel.org/netdev/net-next/c/9a14f2e3dab1
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html