drivers/net/ethernet/netronome/nfp/flower/cmsg.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/netronome/nfp/flower/cmsg.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/netronome/nfp/flower/cmsg.c- Extension
.c- Size
- 10097 bytes
- Lines
- 384
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bitfield.hlinux/netdevice.hlinux/skbuff.hlinux/workqueue.hnet/dst_metadata.hmain.h../nfp_net.h../nfp_net_repr.h./cmsg.h
Detected Declarations
function nfp_flower_cmsg_get_hdrfunction nfp_flower_cmsg_allocfunction nfp_flower_cmsg_mac_repr_startfunction nfp_flower_cmsg_mac_repr_addfunction nfp_flower_cmsg_portmodfunction nfp_flower_cmsg_portreifyfunction nfp_flower_process_mtu_ackfunction be16_to_cpufunction nfp_flower_cmsg_portmod_rxfunction nfp_flower_cmsg_portreify_rxfunction nfp_flower_cmsg_merge_hint_rxfunction nfp_flower_cmsg_process_one_rxfunction nfp_flower_cmsg_process_rxfunction nfp_flower_queue_ctl_msgfunction nfp_flower_cmsg_rxfunction nfp_flower_process_mtu_ack
Annotated Snippet
be16_to_cpu(msg->mtu) != app_priv->mtu_conf.requested_val) {
/* Not an ack for requested MTU change. */
spin_unlock_bh(&app_priv->mtu_conf.lock);
return false;
}
app_priv->mtu_conf.ack = true;
app_priv->mtu_conf.requested_val = 0;
wake_up(&app_priv->mtu_conf.wait_q);
spin_unlock_bh(&app_priv->mtu_conf.lock);
return true;
}
static void
nfp_flower_cmsg_portmod_rx(struct nfp_app *app, struct sk_buff *skb)
{
struct nfp_flower_cmsg_portmod *msg;
struct net_device *netdev;
bool link;
msg = nfp_flower_cmsg_get_data(skb);
link = msg->info & NFP_FLOWER_CMSG_PORTMOD_INFO_LINK;
rtnl_lock();
rcu_read_lock();
netdev = nfp_app_dev_get(app, be32_to_cpu(msg->portnum), NULL);
rcu_read_unlock();
if (!netdev) {
nfp_flower_cmsg_warn(app, "ctrl msg for unknown port 0x%08x\n",
be32_to_cpu(msg->portnum));
rtnl_unlock();
return;
}
if (link) {
u16 mtu = be16_to_cpu(msg->mtu);
netif_carrier_on(netdev);
/* An MTU of 0 from the firmware should be ignored */
if (mtu)
dev_set_mtu(netdev, mtu);
} else {
netif_carrier_off(netdev);
}
rtnl_unlock();
}
static void
nfp_flower_cmsg_portreify_rx(struct nfp_app *app, struct sk_buff *skb)
{
struct nfp_flower_priv *priv = app->priv;
struct nfp_flower_cmsg_portreify *msg;
bool exists;
msg = nfp_flower_cmsg_get_data(skb);
rcu_read_lock();
exists = !!nfp_app_dev_get(app, be32_to_cpu(msg->portnum), NULL);
rcu_read_unlock();
if (!exists) {
nfp_flower_cmsg_warn(app, "ctrl msg for unknown port 0x%08x\n",
be32_to_cpu(msg->portnum));
return;
}
atomic_inc(&priv->reify_replies);
wake_up(&priv->reify_wait_queue);
}
static void
nfp_flower_cmsg_merge_hint_rx(struct nfp_app *app, struct sk_buff *skb)
{
unsigned int msg_len = nfp_flower_cmsg_get_data_len(skb);
struct nfp_flower_cmsg_merge_hint *msg;
struct nfp_fl_payload *sub_flows[2];
struct nfp_flower_priv *priv;
int err, i, flow_cnt;
msg = nfp_flower_cmsg_get_data(skb);
/* msg->count starts at 0 and always assumes at least 1 entry. */
flow_cnt = msg->count + 1;
if (msg_len < struct_size(msg, flow, flow_cnt)) {
nfp_flower_cmsg_warn(app, "Merge hint ctrl msg too short - %d bytes but expect %zd\n",
msg_len, struct_size(msg, flow, flow_cnt));
return;
}
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/netdevice.h`, `linux/skbuff.h`, `linux/workqueue.h`, `net/dst_metadata.h`, `main.h`, `../nfp_net.h`, `../nfp_net_repr.h`.
- Detected declarations: `function nfp_flower_cmsg_get_hdr`, `function nfp_flower_cmsg_alloc`, `function nfp_flower_cmsg_mac_repr_start`, `function nfp_flower_cmsg_mac_repr_add`, `function nfp_flower_cmsg_portmod`, `function nfp_flower_cmsg_portreify`, `function nfp_flower_process_mtu_ack`, `function be16_to_cpu`, `function nfp_flower_cmsg_portmod_rx`, `function nfp_flower_cmsg_portreify_rx`.
- 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.