#include <linux/uaccess.h>
#include <net/sch_generic.h>
-#if (RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(6,4))
-#ifdef CONFIG_RPS
-int netif_set_real_num_rx_queues(struct net_device *dev, unsigned int rxq)
-{
- int rc;
-
- /* we can't update the sysfs object for older kernels */
- if (dev->reg_state == NETREG_REGISTERED)
- return -EINVAL;
- dev->num_rx_queues = rxq;
- return 0;
-}
-#endif
-#endif
-
/*
* Routine to help set real_num_tx_queues. To avoid skbs mapped to queues
* greater then real_num_tx_queues stale skbs on the qdisc must be flushed.
return buf;
}
EXPORT_SYMBOL_GPL(vzalloc);
+
+#if (RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(6,4))
+#ifdef CONFIG_RPS
+/**
+ * netif_set_real_num_rx_queues - set actual number of RX queues used
+ * @dev: Network device
+ * @rxq: Actual number of RX queues
+ *
+ * This must be called either with the rtnl_lock held or before
+ * registration of the net device. Returns 0 on success, or a
+ * negative error code. If called before registration, it always
+ * succeeds.
+ */
+int netif_set_real_num_rx_queues(struct net_device *dev, unsigned int rxq)
+{
+ if (rxq < 1 || rxq > dev->num_rx_queues)
+ return -EINVAL;
+
+ /* we can't update the sysfs object for older kernels */
+ if (dev->reg_state == NETREG_REGISTERED)
+ return -EINVAL;
+ dev->num_rx_queues = rxq;
+ return 0;
+}
+EXPORT_SYMBOL(netif_set_real_num_rx_queues);
+#endif
+#endif