mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-03-17 20:54:10 +00:00
net/sched: act_mirred: refactor the handle of xmit
This one is prepare for the next patch. Signed-off-by: wenxu <wenxu@ucloud.cn> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
aadaca9e7c
commit
fa6d639930
2 changed files with 15 additions and 11 deletions
|
@ -1281,9 +1281,4 @@ void mini_qdisc_pair_init(struct mini_Qdisc_pair *miniqp, struct Qdisc *qdisc,
|
||||||
void mini_qdisc_pair_block_init(struct mini_Qdisc_pair *miniqp,
|
void mini_qdisc_pair_block_init(struct mini_Qdisc_pair *miniqp,
|
||||||
struct tcf_block *block);
|
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -205,6 +205,18 @@ release_idr:
|
||||||
return err;
|
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,
|
static int tcf_mirred_act(struct sk_buff *skb, const struct tc_action *a,
|
||||||
struct tcf_result *res)
|
struct tcf_result *res)
|
||||||
{
|
{
|
||||||
|
@ -287,18 +299,15 @@ static int tcf_mirred_act(struct sk_buff *skb, const struct tc_action *a,
|
||||||
/* let's the caller reinsert the packet, if possible */
|
/* let's the caller reinsert the packet, if possible */
|
||||||
if (use_reinsert) {
|
if (use_reinsert) {
|
||||||
res->ingress = want_ingress;
|
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);
|
tcf_action_inc_overlimit_qstats(&m->common);
|
||||||
__this_cpu_dec(mirred_rec_level);
|
__this_cpu_dec(mirred_rec_level);
|
||||||
return TC_ACT_CONSUMED;
|
return TC_ACT_CONSUMED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!want_ingress)
|
err = tcf_mirred_forward(want_ingress, skb2);
|
||||||
err = dev_queue_xmit(skb2);
|
|
||||||
else
|
|
||||||
err = netif_receive_skb(skb2);
|
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
out:
|
out:
|
||||||
tcf_action_inc_overlimit_qstats(&m->common);
|
tcf_action_inc_overlimit_qstats(&m->common);
|
||||||
|
|
Loading…
Add table
Reference in a new issue