drivers/net/ethernet/netronome/nfp/flower/action.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/netronome/nfp/flower/action.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/netronome/nfp/flower/action.c- Extension
.c- Size
- 40504 bytes
- Lines
- 1323
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bitfield.hlinux/mpls.hnet/pkt_cls.hnet/tc_act/tc_csum.hnet/tc_act/tc_gact.hnet/tc_act/tc_mirred.hnet/tc_act/tc_mpls.hnet/tc_act/tc_pedit.hnet/tc_act/tc_vlan.hnet/tc_act/tc_tunnel_key.hcmsg.hmain.h../nfp_net_repr.h
Detected Declarations
struct ipv4_ttl_wordstruct ipv6_hop_limit_wordstruct nfp_flower_pedit_actsfunction nfp_fl_push_mplsfunction nfp_fl_pop_mplsfunction nfp_fl_set_mplsfunction nfp_fl_pop_vlanfunction nfp_fl_push_vlanfunction nfp_fl_pre_lagfunction nfp_fl_outputfunction nfp_flower_tun_is_grefunction nfp_fl_get_tun_from_actfunction nfp_fl_push_geneve_optionsfunction nfp_fl_set_tunfunction nfp_fl_set_helper32function nfp_fl_set_ethfunction nfp_fl_set_ip4function nfp_fl_set_ip6_helperfunction nfp_fl_set_ip6_hop_limit_flow_labelfunction round_downfunction nfp_fl_set_ip6function nfp_fl_set_tportfunction nfp_fl_csum_l4_to_flagfunction nfp_fl_commit_manglefunction nfp_fl_peditfunction nfp_flower_meter_actionfunction nfp_flower_output_actionfunction nfp_flower_loop_actionfunction nfp_fl_check_mangle_startfunction nfp_fl_check_mangle_endfunction nfp_flower_compile_actionfunction flow_action_for_each
Annotated Snippet
struct ipv4_ttl_word {
__u8 ttl;
__u8 protocol;
__sum16 check;
};
static int
nfp_fl_set_ip4(const struct flow_action_entry *act, u32 off,
struct nfp_fl_set_ip4_addrs *set_ip_addr,
struct nfp_fl_set_ip4_ttl_tos *set_ip_ttl_tos,
struct netlink_ext_ack *extack)
{
struct ipv4_ttl_word *ttl_word_mask;
struct ipv4_ttl_word *ttl_word;
struct iphdr *tos_word_mask;
struct iphdr *tos_word;
__be32 exact, mask;
/* We are expecting tcf_pedit to return a big endian value */
mask = (__force __be32)~act->mangle.mask;
exact = (__force __be32)act->mangle.val;
if (exact & ~mask) {
NL_SET_ERR_MSG_MOD(extack, "unsupported offload: invalid pedit IPv4 action");
return -EOPNOTSUPP;
}
switch (off) {
case offsetof(struct iphdr, daddr):
set_ip_addr->ipv4_dst_mask |= mask;
set_ip_addr->ipv4_dst &= ~mask;
set_ip_addr->ipv4_dst |= exact & mask;
set_ip_addr->head.jump_id = NFP_FL_ACTION_OPCODE_SET_IPV4_ADDRS;
set_ip_addr->head.len_lw = sizeof(*set_ip_addr) >>
NFP_FL_LW_SIZ;
break;
case offsetof(struct iphdr, saddr):
set_ip_addr->ipv4_src_mask |= mask;
set_ip_addr->ipv4_src &= ~mask;
set_ip_addr->ipv4_src |= exact & mask;
set_ip_addr->head.jump_id = NFP_FL_ACTION_OPCODE_SET_IPV4_ADDRS;
set_ip_addr->head.len_lw = sizeof(*set_ip_addr) >>
NFP_FL_LW_SIZ;
break;
case offsetof(struct iphdr, ttl):
ttl_word_mask = (struct ipv4_ttl_word *)&mask;
ttl_word = (struct ipv4_ttl_word *)&exact;
if (ttl_word_mask->protocol || ttl_word_mask->check) {
NL_SET_ERR_MSG_MOD(extack, "unsupported offload: invalid pedit IPv4 ttl action");
return -EOPNOTSUPP;
}
set_ip_ttl_tos->ipv4_ttl_mask |= ttl_word_mask->ttl;
set_ip_ttl_tos->ipv4_ttl &= ~ttl_word_mask->ttl;
set_ip_ttl_tos->ipv4_ttl |= ttl_word->ttl & ttl_word_mask->ttl;
set_ip_ttl_tos->head.jump_id =
NFP_FL_ACTION_OPCODE_SET_IPV4_TTL_TOS;
set_ip_ttl_tos->head.len_lw = sizeof(*set_ip_ttl_tos) >>
NFP_FL_LW_SIZ;
break;
case round_down(offsetof(struct iphdr, tos), 4):
tos_word_mask = (struct iphdr *)&mask;
tos_word = (struct iphdr *)&exact;
if (tos_word_mask->version || tos_word_mask->ihl ||
tos_word_mask->tot_len) {
NL_SET_ERR_MSG_MOD(extack, "unsupported offload: invalid pedit IPv4 tos action");
return -EOPNOTSUPP;
}
set_ip_ttl_tos->ipv4_tos_mask |= tos_word_mask->tos;
set_ip_ttl_tos->ipv4_tos &= ~tos_word_mask->tos;
set_ip_ttl_tos->ipv4_tos |= tos_word->tos & tos_word_mask->tos;
set_ip_ttl_tos->head.jump_id =
NFP_FL_ACTION_OPCODE_SET_IPV4_TTL_TOS;
set_ip_ttl_tos->head.len_lw = sizeof(*set_ip_ttl_tos) >>
NFP_FL_LW_SIZ;
break;
default:
NL_SET_ERR_MSG_MOD(extack, "unsupported offload: pedit on unsupported section of IPv4 header");
return -EOPNOTSUPP;
}
return 0;
}
static void
nfp_fl_set_ip6_helper(int opcode_tag, u8 word, __be32 exact, __be32 mask,
struct nfp_fl_set_ipv6_addr *ip6)
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/mpls.h`, `net/pkt_cls.h`, `net/tc_act/tc_csum.h`, `net/tc_act/tc_gact.h`, `net/tc_act/tc_mirred.h`, `net/tc_act/tc_mpls.h`, `net/tc_act/tc_pedit.h`.
- Detected declarations: `struct ipv4_ttl_word`, `struct ipv6_hop_limit_word`, `struct nfp_flower_pedit_acts`, `function nfp_fl_push_mpls`, `function nfp_fl_pop_mpls`, `function nfp_fl_set_mpls`, `function nfp_fl_pop_vlan`, `function nfp_fl_push_vlan`, `function nfp_fl_pre_lag`, `function nfp_fl_output`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.