xref: /linux/net/core/netdev_config.c (revision b9ac2c60a3ad445fa81289aac5adc06b8c1b1d57)
1 // SPDX-License-Identifier: GPL-2.0-only
2 
3 #include <linux/netdevice.h>
4 #include <net/netdev_queues.h>
5 #include <net/netdev_rx_queue.h>
6 
7 /**
8  * netdev_queue_config() - get configuration for a given queue
9  * @dev:      net_device instance
10  * @rxq_idx:  index of the queue of interest
11  * @qcfg: queue configuration struct (output)
12  *
13  * Render the configuration for a given queue. This helper should be used
14  * by drivers which support queue configuration to retrieve config for
15  * a particular queue.
16  *
17  * @qcfg is an output parameter and is always fully initialized by this
18  * function. Some values may not be set by the user, drivers may either
19  * deal with the "unset" values in @qcfg, or provide the callback
20  * to populate defaults in queue_management_ops.
21  */
22 void netdev_queue_config(struct net_device *dev, int rxq_idx,
23 			 struct netdev_queue_config *qcfg)
24 {
25 	struct netdev_queue_config *stored;
26 
27 	memset(qcfg, 0, sizeof(*qcfg));
28 
29 	stored = &__netif_get_rx_queue(dev, rxq_idx)->qcfg;
30 	qcfg->rx_page_size = stored->rx_page_size;
31 }
32 EXPORT_SYMBOL(netdev_queue_config);
33