This is preparation for multi-queue (MQ) RX; nothing sets multi_queue yet, so single-queue behavior does not change. The RX interrupt handler masks the queue's interrupt and schedules NAPI, and the poll unmasks it when done. Both go through ibmveth_toggle_irq(), which only handles queue 0 with h_vio_signal(). A subordinate queue's interrupt is controlled with H_VIOCTL on the hardware number H_REG_LOGICAL_LAN_QUEUE returned. Keep that number in queue_hwirq[] and add the H_VIOCTL branch, so the existing handler and poll can mask and unmask any queue. Mask each subordinate queue as soon as its interrupt is mapped, so it cannot fire before its NAPI is enabled; if that fails, open() fails. Signed-off-by: Mingming Cao --- drivers/net/ethernet/ibm/ibmveth.c | 32 +++++++++++++++++++++--------- drivers/net/ethernet/ibm/ibmveth.h | 4 ++++ 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c index 5783c0ce34a3..1a9499438930 100644 --- a/drivers/net/ethernet/ibm/ibmveth.c +++ b/drivers/net/ethernet/ibm/ibmveth.c @@ -402,8 +402,7 @@ ibmveth_cleanup_rx_resources(struct ibmveth_adapter *adapter) * @queue_index: RX queue index * @enable: true to unmask, false to mask * - * Only queue 0 exists for now. Its interrupt is the adapter's own, which - * h_vio_signal() controls, so @queue_index is used only for logging. + * Queue 0 uses h_vio_signal(); subordinate queues use H_VIOCTL. * * Return: 0 on success, -EIO on failure */ @@ -414,8 +413,17 @@ ibmveth_toggle_irq(struct ibmveth_adapter *adapter, int queue_index, const char *action = enable ? "enable" : "disable"; unsigned long h_rc; - h_rc = h_vio_signal(adapter->vdev->unit_address, - enable ? VIO_IRQ_ENABLE : VIO_IRQ_DISABLE); + if (queue_index == 0) + h_rc = h_vio_signal(adapter->vdev->unit_address, + enable ? VIO_IRQ_ENABLE : VIO_IRQ_DISABLE); + else + h_rc = plpar_hcall_norets(H_VIOCTL, + adapter->vdev->unit_address, + enable ? H_ENABLE_VIO_INTERRUPT : + H_DISABLE_VIO_INTERRUPT, + adapter->queue_hwirq[queue_index], + 0, 0); + if (h_rc) { dev_err_ratelimited(&adapter->netdev->dev, "Failed to %s IRQ for queue %d, rc=0x%lx\n", @@ -477,9 +485,9 @@ ibmveth_dispose_subordinate_irq_mappings(struct ibmveth_adapter *adapter) * ibmveth_setup_rx_interrupts - Register IRQs and enable NAPI * @adapter: ibmveth adapter structure * - * The queues must already be masked in PHYP, as they are before the LAN - * is registered; this does not unmask them. The caller kicks NAPI, and - * the first poll unmasks. + * The queues must already be masked in PHYP: queue 0 before the LAN is + * registered, the others as they are registered. This does not unmask + * them. The caller kicks NAPI, and the first poll unmasks. * * Return: 0 on success, negative error code on failure */ @@ -1328,7 +1336,8 @@ static void ibmveth_free_all_queues(struct ibmveth_adapter *adapter) * H_FREE_LOGICAL_LAN. * * Return: 0 on success, -ENOMEM if the interrupt cannot be mapped, - * -EIO if H_REG_LOGICAL_LAN_QUEUE fails + * -EIO if H_REG_LOGICAL_LAN_QUEUE fails or the interrupt + * cannot be masked */ static int ibmveth_register_rx_queue(struct ibmveth_adapter *adapter, int queue_idx) @@ -1371,7 +1380,12 @@ static int ibmveth_register_rx_queue(struct ibmveth_adapter *adapter, adapter->queue_handle[queue_idx] = handle; adapter->queue_irq[queue_idx] = virq; - return 0; + adapter->queue_hwirq[queue_idx] = hwirq; + + /* setup_rx_interrupts() expects every queue masked: until NAPI is + * enabled, the handler does not mask it. + */ + return ibmveth_disable_irq(adapter, queue_idx); } /** diff --git a/drivers/net/ethernet/ibm/ibmveth.h b/drivers/net/ethernet/ibm/ibmveth.h index 34f57ad07a2f..398d3a862503 100644 --- a/drivers/net/ethernet/ibm/ibmveth.h +++ b/drivers/net/ethernet/ibm/ibmveth.h @@ -256,6 +256,10 @@ struct ibmveth_adapter { /* Opaque PHYP cookie, 0 can be valid. Set only in multi_queue mode. */ u64 queue_handle[IBMVETH_MAX_RX_QUEUES]; unsigned int queue_irq[IBMVETH_MAX_RX_QUEUES]; + /* PHYP interrupt number for H_VIOCTL, subordinate queues only; + * queue 0 uses h_vio_signal(), so entry 0 is never read. + */ + unsigned long queue_hwirq[IBMVETH_MAX_RX_QUEUES]; bool multi_queue; unsigned int num_rx_queues; int rx_csum; -- 2.50.1 (Apple Git-155)