net/core/netdev_config.c
Source file repositories/reference/linux-study-clean/net/core/netdev_config.c
File Facts
- System
- Linux kernel
- Corpus path
net/core/netdev_config.c- Extension
.c- Size
- 2335 bytes
- Lines
- 79
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/netdevice.hnet/netdev_queues.hnet/netdev_rx_queue.hdev.h
Detected Declarations
function netdev_nop_validate_qcfgfunction __netdev_queue_configfunction netdev_queue_configfunction netdev_queue_config_validateexport netdev_queue_config
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
#include <linux/netdevice.h>
#include <net/netdev_queues.h>
#include <net/netdev_rx_queue.h>
#include "dev.h"
static int netdev_nop_validate_qcfg(struct net_device *dev,
struct netdev_queue_config *qcfg,
struct netlink_ext_ack *extack)
{
return 0;
}
static int __netdev_queue_config(struct net_device *dev, int rxq_idx,
struct netdev_queue_config *qcfg,
struct netlink_ext_ack *extack,
bool validate)
{
int (*validate_cb)(struct net_device *dev,
struct netdev_queue_config *qcfg,
struct netlink_ext_ack *extack);
struct pp_memory_provider_params *mpp;
int err;
validate_cb = netdev_nop_validate_qcfg;
if (validate && dev->queue_mgmt_ops->ndo_validate_qcfg)
validate_cb = dev->queue_mgmt_ops->ndo_validate_qcfg;
memset(qcfg, 0, sizeof(*qcfg));
/* Get defaults from the driver, in case user config not set */
if (dev->queue_mgmt_ops->ndo_default_qcfg)
dev->queue_mgmt_ops->ndo_default_qcfg(dev, qcfg);
err = validate_cb(dev, qcfg, extack);
if (err)
return err;
/* Apply MP overrides */
mpp = &__netif_get_rx_queue(dev, rxq_idx)->mp_params;
if (mpp->rx_page_size)
qcfg->rx_page_size = mpp->rx_page_size;
err = validate_cb(dev, qcfg, extack);
if (err)
return err;
return 0;
}
/**
* netdev_queue_config() - get configuration for a given queue
* @dev: net_device instance
* @rxq_idx: index of the queue of interest
* @qcfg: queue configuration struct (output)
*
* Render the configuration for a given queue. This helper should be used
* by drivers which support queue configuration to retrieve config for
* a particular queue.
*
* @qcfg is an output parameter and is always fully initialized by this
* function. Some values may not be set by the user, drivers may either
* deal with the "unset" values in @qcfg, or provide the callback
* to populate defaults in queue_management_ops.
*/
void netdev_queue_config(struct net_device *dev, int rxq_idx,
struct netdev_queue_config *qcfg)
{
__netdev_queue_config(dev, rxq_idx, qcfg, NULL, false);
}
EXPORT_SYMBOL(netdev_queue_config);
int netdev_queue_config_validate(struct net_device *dev, int rxq_idx,
struct netdev_queue_config *qcfg,
struct netlink_ext_ack *extack)
{
return __netdev_queue_config(dev, rxq_idx, qcfg, extack, true);
}
Annotation
- Immediate include surface: `linux/netdevice.h`, `net/netdev_queues.h`, `net/netdev_rx_queue.h`, `dev.h`.
- Detected declarations: `function netdev_nop_validate_qcfg`, `function __netdev_queue_config`, `function netdev_queue_config`, `function netdev_queue_config_validate`, `export netdev_queue_config`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: integration 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.