net/devlink/dpipe.c
Source file repositories/reference/linux-study-clean/net/devlink/dpipe.c
File Facts
- System
- Linux kernel
- Corpus path
net/devlink/dpipe.c- Extension
.c- Size
- 23470 bytes
- Lines
- 916
- Domain
- Networking Core
- Bucket
- Sockets, Protocols, Packet Path, And Network Policy
- Inferred role
- Networking Core: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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
devl_internal.h
Detected Declarations
function devlink_dpipe_match_putfunction devlink_dpipe_matches_putfunction devlink_dpipe_action_putfunction devlink_dpipe_actions_putfunction devlink_dpipe_table_putfunction devlink_dpipe_send_and_alloc_skbfunction devlink_dpipe_tables_fillfunction devlink_nl_dpipe_table_get_doitfunction devlink_dpipe_value_putfunction devlink_dpipe_action_value_putfunction devlink_dpipe_action_values_putfunction devlink_dpipe_match_value_putfunction devlink_dpipe_match_values_putfunction devlink_dpipe_entry_putfunction devlink_dpipe_table_findfunction list_for_each_entry_rcufunction devlink_dpipe_entry_ctx_preparefunction devlink_dpipe_entry_ctx_appendfunction devlink_dpipe_entry_ctx_closefunction devlink_dpipe_entry_clearfunction devlink_dpipe_entries_fillfunction devlink_nl_dpipe_entries_get_doitfunction devlink_dpipe_fields_putfunction devlink_dpipe_header_putfunction devlink_dpipe_headers_fillfunction devlink_nl_dpipe_headers_get_doitfunction devlink_dpipe_table_counters_setfunction devlink_nl_dpipe_table_counters_set_doitfunction devl_dpipe_headers_registerfunction devl_dpipe_headers_unregisterfunction devlink_dpipe_table_counter_enabledfunction devl_dpipe_table_registerfunction devl_dpipe_table_unregisterfunction devl_dpipe_table_resource_setexport devlink_dpipe_header_ethernetexport devlink_dpipe_header_ipv4export devlink_dpipe_header_ipv6export devlink_dpipe_match_putexport devlink_dpipe_action_putexport devlink_dpipe_entry_ctx_prepareexport devlink_dpipe_entry_ctx_appendexport devlink_dpipe_entry_ctx_closeexport devlink_dpipe_entry_clearexport devl_dpipe_headers_registerexport devl_dpipe_headers_unregisterexport devlink_dpipe_table_counter_enabledexport devl_dpipe_table_registerexport devl_dpipe_table_unregister
Annotated Snippet
if (!table_name) {
err = devlink_dpipe_table_put(skb, table);
if (err) {
if (!i)
goto err_table_put;
incomplete = true;
break;
}
} else {
if (!strcmp(table->name, table_name)) {
err = devlink_dpipe_table_put(skb, table);
if (err)
break;
}
}
i++;
}
nla_nest_end(skb, tables_attr);
genlmsg_end(skb, hdr);
if (incomplete)
goto start_again;
send_done:
nlh = nlmsg_put(skb, info->snd_portid, info->snd_seq,
NLMSG_DONE, 0, flags | NLM_F_MULTI);
if (!nlh) {
err = devlink_dpipe_send_and_alloc_skb(&skb, info);
if (err)
return err;
goto send_done;
}
return genlmsg_reply(skb, info);
nla_put_failure:
err = -EMSGSIZE;
err_table_put:
nlmsg_free(skb);
return err;
}
int devlink_nl_dpipe_table_get_doit(struct sk_buff *skb, struct genl_info *info)
{
struct devlink *devlink = info->user_ptr[0];
const char *table_name = NULL;
if (info->attrs[DEVLINK_ATTR_DPIPE_TABLE_NAME])
table_name = nla_data(info->attrs[DEVLINK_ATTR_DPIPE_TABLE_NAME]);
return devlink_dpipe_tables_fill(info, DEVLINK_CMD_DPIPE_TABLE_GET, 0,
&devlink->dpipe_table_list,
table_name);
}
static int devlink_dpipe_value_put(struct sk_buff *skb,
struct devlink_dpipe_value *value)
{
if (nla_put(skb, DEVLINK_ATTR_DPIPE_VALUE,
value->value_size, value->value))
return -EMSGSIZE;
if (value->mask)
if (nla_put(skb, DEVLINK_ATTR_DPIPE_VALUE_MASK,
value->value_size, value->mask))
return -EMSGSIZE;
if (value->mapping_valid)
if (nla_put_u32(skb, DEVLINK_ATTR_DPIPE_VALUE_MAPPING,
value->mapping_value))
return -EMSGSIZE;
return 0;
}
static int devlink_dpipe_action_value_put(struct sk_buff *skb,
struct devlink_dpipe_value *value)
{
if (!value->action)
return -EINVAL;
if (devlink_dpipe_action_put(skb, value->action))
return -EMSGSIZE;
if (devlink_dpipe_value_put(skb, value))
return -EMSGSIZE;
return 0;
}
static int devlink_dpipe_action_values_put(struct sk_buff *skb,
struct devlink_dpipe_value *values,
unsigned int values_count)
{
struct nlattr *action_attr;
int i;
Annotation
- Immediate include surface: `devl_internal.h`.
- Detected declarations: `function devlink_dpipe_match_put`, `function devlink_dpipe_matches_put`, `function devlink_dpipe_action_put`, `function devlink_dpipe_actions_put`, `function devlink_dpipe_table_put`, `function devlink_dpipe_send_and_alloc_skb`, `function devlink_dpipe_tables_fill`, `function devlink_nl_dpipe_table_get_doit`, `function devlink_dpipe_value_put`, `function devlink_dpipe_action_value_put`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: integration 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.