@@ -6400,6 +6400,43 @@ int dev_set_threaded(struct net_device *dev, bool threaded)
64006400}
64016401EXPORT_SYMBOL (dev_set_threaded );
64026402
6403+ /**
6404+ * netif_queue_set_napi - Associate queue with the napi
6405+ * @dev: device to which NAPI and queue belong
6406+ * @queue_index: Index of queue
6407+ * @type: queue type as RX or TX
6408+ * @napi: NAPI context, pass NULL to clear previously set NAPI
6409+ *
6410+ * Set queue with its corresponding napi context. This should be done after
6411+ * registering the NAPI handler for the queue-vector and the queues have been
6412+ * mapped to the corresponding interrupt vector.
6413+ */
6414+ void netif_queue_set_napi (struct net_device * dev , unsigned int queue_index ,
6415+ enum netdev_queue_type type , struct napi_struct * napi )
6416+ {
6417+ struct netdev_rx_queue * rxq ;
6418+ struct netdev_queue * txq ;
6419+
6420+ if (WARN_ON_ONCE (napi && !napi -> dev ))
6421+ return ;
6422+ if (dev -> reg_state >= NETREG_REGISTERED )
6423+ ASSERT_RTNL ();
6424+
6425+ switch (type ) {
6426+ case NETDEV_QUEUE_TYPE_RX :
6427+ rxq = __netif_get_rx_queue (dev , queue_index );
6428+ rxq -> napi = napi ;
6429+ return ;
6430+ case NETDEV_QUEUE_TYPE_TX :
6431+ txq = netdev_get_tx_queue (dev , queue_index );
6432+ txq -> napi = napi ;
6433+ return ;
6434+ default :
6435+ return ;
6436+ }
6437+ }
6438+ EXPORT_SYMBOL (netif_queue_set_napi );
6439+
64036440void netif_napi_add_weight (struct net_device * dev , struct napi_struct * napi ,
64046441 int (* poll )(struct napi_struct * , int ), int weight )
64056442{
0 commit comments