drivers/net/ethernet/netronome/nfp/flower/qos_conf.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/netronome/nfp/flower/qos_conf.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/netronome/nfp/flower/qos_conf.c- Extension
.c- Size
- 25915 bytes
- Lines
- 888
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/hash.hlinux/hashtable.hlinux/jhash.hlinux/math64.hlinux/vmalloc.hnet/pkt_cls.hnet/pkt_sched.hcmsg.hmain.h../nfp_port.h
Detected Declarations
struct nfp_police_cfg_headstruct nfp_police_configstruct nfp_police_stats_replyenum NFP_FL_QOS_TYPESfunction nfp_flower_offload_one_policefunction nfp_policer_validatefunction nfp_flower_install_rate_limiterfunction nfp_flower_remove_rate_limiterfunction nfp_flower_stats_rlim_replyfunction nfp_flower_stats_rlim_requestfunction nfp_flower_stats_rlim_request_allfunction update_stats_cachefunction nfp_flower_stats_rate_limiterfunction nfp_flower_qos_initfunction nfp_flower_qos_cleanupfunction nfp_flower_setup_qos_offloadfunction nfp_flower_search_meter_entryfunction nfp_flower_add_meter_entryfunction nfp_flower_del_meter_entryfunction nfp_flower_setup_meter_entryfunction nfp_init_meter_tablefunction nfp_flower_stats_meter_request_allfunction nfp_act_install_actionsfunction nfp_act_remove_actionsfunction nfp_act_stats_replyfunction nfp_act_stats_actionsfunction nfp_setup_tc_act_offload
Annotated Snippet
struct nfp_police_cfg_head {
__be32 flags_opts;
union {
__be32 meter_id;
__be32 port;
};
};
enum NFP_FL_QOS_TYPES {
NFP_FL_QOS_TYPE_BPS,
NFP_FL_QOS_TYPE_PPS,
NFP_FL_QOS_TYPE_MAX,
};
/* Police cmsg for configuring a trTCM traffic conditioner (8W/32B)
* See RFC 2698 for more details.
* ----------------------------------------------------------------
* 3 2 1
* 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | Reserved |p| Reserved |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | Port Ingress |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | Token Bucket Peak |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | Token Bucket Committed |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | Peak Burst Size |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | Committed Burst Size |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | Peak Information Rate |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | Committed Information Rate |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* Word[0](FLag options):
* [15] p(pps) 1 for pps, 0 for bps
*
* Meter control message
* 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
* +-------------------------------+-+---+-----+-+---------+-+---+-+
* | Reserved |p| Y |TYPE |E|TSHFV |P| PC|R|
* +-------------------------------+-+---+-----+-+---------+-+---+-+
* | meter ID |
* +-------------------------------+-------------------------------+
*
*/
struct nfp_police_config {
struct nfp_police_cfg_head head;
__be32 bkt_tkn_p;
__be32 bkt_tkn_c;
__be32 pbs;
__be32 cbs;
__be32 pir;
__be32 cir;
};
struct nfp_police_stats_reply {
struct nfp_police_cfg_head head;
__be64 pass_bytes;
__be64 pass_pkts;
__be64 drop_bytes;
__be64 drop_pkts;
};
int nfp_flower_offload_one_police(struct nfp_app *app, bool ingress,
bool pps, u32 id, u32 rate, u32 burst)
{
struct nfp_police_config *config;
struct sk_buff *skb;
skb = nfp_flower_cmsg_alloc(app, sizeof(struct nfp_police_config),
NFP_FLOWER_CMSG_TYPE_QOS_MOD, GFP_KERNEL);
if (!skb)
return -ENOMEM;
config = nfp_flower_cmsg_get_data(skb);
memset(config, 0, sizeof(struct nfp_police_config));
if (pps)
config->head.flags_opts |= cpu_to_be32(NFP_FL_QOS_PPS);
if (!ingress)
config->head.flags_opts |= cpu_to_be32(NFP_FL_QOS_METER);
if (ingress)
config->head.port = cpu_to_be32(id);
else
config->head.meter_id = cpu_to_be32(id);
config->bkt_tkn_p = cpu_to_be32(burst);
Annotation
- Immediate include surface: `linux/hash.h`, `linux/hashtable.h`, `linux/jhash.h`, `linux/math64.h`, `linux/vmalloc.h`, `net/pkt_cls.h`, `net/pkt_sched.h`, `cmsg.h`.
- Detected declarations: `struct nfp_police_cfg_head`, `struct nfp_police_config`, `struct nfp_police_stats_reply`, `enum NFP_FL_QOS_TYPES`, `function nfp_flower_offload_one_police`, `function nfp_policer_validate`, `function nfp_flower_install_rate_limiter`, `function nfp_flower_remove_rate_limiter`, `function nfp_flower_stats_rlim_reply`, `function nfp_flower_stats_rlim_request`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.