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>
enum nfp_bpf_action_type {
NN_ACT_TC_DROP,
+ NN_ACT_TC_REDIR,
};
/* Software register representation, hardware encoding in asm.h */
{
const u8 act2code[] = {
[NN_ACT_TC_DROP] = 0x22,
+ [NN_ACT_TC_REDIR] = 0x24
};
/* Target for aborts */
nfp_prog->tgt_abort = nfp_prog_current_offset(nfp_prog);
{
switch (nfp_prog->act) {
case NN_ACT_TC_DROP:
+ case NN_ACT_TC_REDIR:
nfp_outro_tc_legacy(nfp_prog);
break;
}
list_for_each_entry(a, &actions, list) {
if (is_tcf_gact_shot(a))
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;