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 pp_memory_provider_params *mpp; 26 27 memset(qcfg, 0, sizeof(*qcfg)); 28 29 /* Get defaults from the driver, in case user config not set */ 30 if (dev->queue_mgmt_ops->ndo_default_qcfg) 31 dev->queue_mgmt_ops->ndo_default_qcfg(dev, qcfg); 32 33 /* Apply MP overrides */ 34 mpp = &__netif_get_rx_queue(dev, rxq_idx)->mp_params; 35 if (mpp->rx_page_size) 36 qcfg->rx_page_size = mpp->rx_page_size; 37 } 38 EXPORT_SYMBOL(netdev_queue_config); 39