mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-15 19:18:02 +00:00
nfp: bpf: add support for legacy redirect action
Data path has redirect support so expressing redirect to the port frame came from is a trivial matter of setting the right result code. Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
9798e6fe4f
commit
2d18421deb
3 changed files with 7 additions and 0 deletions
|
@ -60,6 +60,7 @@ enum static_regs {
|
||||||
|
|
||||||
enum nfp_bpf_action_type {
|
enum nfp_bpf_action_type {
|
||||||
NN_ACT_TC_DROP,
|
NN_ACT_TC_DROP,
|
||||||
|
NN_ACT_TC_REDIR,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Software register representation, hardware encoding in asm.h */
|
/* Software register representation, hardware encoding in asm.h */
|
||||||
|
|
|
@ -1440,6 +1440,7 @@ static void nfp_outro_tc_legacy(struct nfp_prog *nfp_prog)
|
||||||
{
|
{
|
||||||
const u8 act2code[] = {
|
const u8 act2code[] = {
|
||||||
[NN_ACT_TC_DROP] = 0x22,
|
[NN_ACT_TC_DROP] = 0x22,
|
||||||
|
[NN_ACT_TC_REDIR] = 0x24
|
||||||
};
|
};
|
||||||
/* Target for aborts */
|
/* Target for aborts */
|
||||||
nfp_prog->tgt_abort = nfp_prog_current_offset(nfp_prog);
|
nfp_prog->tgt_abort = nfp_prog_current_offset(nfp_prog);
|
||||||
|
@ -1468,6 +1469,7 @@ static void nfp_outro(struct nfp_prog *nfp_prog)
|
||||||
{
|
{
|
||||||
switch (nfp_prog->act) {
|
switch (nfp_prog->act) {
|
||||||
case NN_ACT_TC_DROP:
|
case NN_ACT_TC_DROP:
|
||||||
|
case NN_ACT_TC_REDIR:
|
||||||
nfp_outro_tc_legacy(nfp_prog);
|
nfp_outro_tc_legacy(nfp_prog);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,6 +123,10 @@ nfp_net_bpf_get_act(struct nfp_net *nn, struct tc_cls_bpf_offload *cls_bpf)
|
||||||
list_for_each_entry(a, &actions, list) {
|
list_for_each_entry(a, &actions, list) {
|
||||||
if (is_tcf_gact_shot(a))
|
if (is_tcf_gact_shot(a))
|
||||||
return NN_ACT_TC_DROP;
|
return NN_ACT_TC_DROP;
|
||||||
|
|
||||||
|
if (is_tcf_mirred_redirect(a) &&
|
||||||
|
tcf_mirred_ifindex(a) == nn->netdev->ifindex)
|
||||||
|
return NN_ACT_TC_REDIR;
|
||||||
}
|
}
|
||||||
|
|
||||||
return -ENOTSUPP;
|
return -ENOTSUPP;
|
||||||
|
|
Loading…
Add table
Reference in a new issue