This is a note to let you know that I've just added the patch titled net/sched: act_mirred: refactor the handle of xmit to the 5.10-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: net-sched-act_mirred-refactor-the-handle-of-xmit.patch and it can be found in the queue-5.10 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From stable-owner@xxxxxxxxxxxxxxx Tue May 16 20:01:48 2023 From: Dragos-Marian Panait <dragos.panait@xxxxxxxxxxxxx> Date: Tue, 16 May 2023 22:00:38 +0300 Subject: net/sched: act_mirred: refactor the handle of xmit To: stable@xxxxxxxxxxxxxxx Cc: wenxu <wenxu@xxxxxxxxx>, Jakub Kicinski <kuba@xxxxxxxxxx>, Jamal Hadi Salim <jhs@xxxxxxxxxxxx>, Davide Caratti <dcaratti@xxxxxxxxxx>, Marcelo Ricardo Leitner <marcelo.leitner@xxxxxxxxx>, Paolo Abeni <pabeni@xxxxxxxxxx>, William Zhao <wizhao@xxxxxxxxxx>, Xin Long <lucien.xin@xxxxxxxxx>, "David S . Miller" <davem@xxxxxxxxxxxxx>, Eric Dumazet <edumazet@xxxxxxxxxx>, Cong Wang <xiyou.wangcong@xxxxxxxxx>, Jiri Pirko <jiri@xxxxxxxxxxx>, Shuah Khan <shuah@xxxxxxxxxx>, linux-kselftest@xxxxxxxxxxxxxxx, netdev@xxxxxxxxxxxxxxx Message-ID: <20230516190040.636627-2-dragos.panait@xxxxxxxxxxxxx> From: wenxu <wenxu@xxxxxxxxx> [ Upstream commit fa6d639930ee5cd3f932cc314f3407f07a06582d ] This one is prepare for the next patch. Signed-off-by: wenxu <wenxu@xxxxxxxxx> Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx> [DP: adjusted context for linux-5.10.y] Signed-off-by: Dragos-Marian Panait <dragos.panait@xxxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- include/net/sch_generic.h | 5 ----- net/sched/act_mirred.c | 21 +++++++++++++++------ 2 files changed, 15 insertions(+), 11 deletions(-) --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h @@ -1320,11 +1320,6 @@ void mini_qdisc_pair_init(struct mini_Qd void mini_qdisc_pair_block_init(struct mini_Qdisc_pair *miniqp, struct tcf_block *block); -static inline int skb_tc_reinsert(struct sk_buff *skb, struct tcf_result *res) -{ - return res->ingress ? netif_receive_skb(skb) : dev_queue_xmit(skb); -} - /* Make sure qdisc is no longer in SCHED state. */ static inline void qdisc_synchronize(const struct Qdisc *q) { --- a/net/sched/act_mirred.c +++ b/net/sched/act_mirred.c @@ -206,6 +206,18 @@ release_idr: return err; } +static int tcf_mirred_forward(bool want_ingress, struct sk_buff *skb) +{ + int err; + + if (!want_ingress) + err = dev_queue_xmit(skb); + else + err = netif_receive_skb(skb); + + return err; +} + static int tcf_mirred_act(struct sk_buff *skb, const struct tc_action *a, struct tcf_result *res) { @@ -295,18 +307,15 @@ static int tcf_mirred_act(struct sk_buff /* let's the caller reinsert the packet, if possible */ if (use_reinsert) { res->ingress = want_ingress; - if (skb_tc_reinsert(skb, res)) + err = tcf_mirred_forward(res->ingress, skb); + if (err) tcf_action_inc_overlimit_qstats(&m->common); __this_cpu_dec(mirred_rec_level); return TC_ACT_CONSUMED; } } - if (!want_ingress) - err = dev_queue_xmit(skb2); - else - err = netif_receive_skb(skb2); - + err = tcf_mirred_forward(want_ingress, skb2); if (err) { out: tcf_action_inc_overlimit_qstats(&m->common); Patches currently in stable-queue which might be from stable-owner@xxxxxxxxxxxxxxx are queue-5.10/act_mirred-use-the-backlog-for-nested-calls-to-mirred-ingress.patch queue-5.10/net-sched-act_mirred-better-wording-on-protection-against-excessive-stack-growth.patch queue-5.10/net-sched-act_mirred-refactor-the-handle-of-xmit.patch