Re: [PATCH net-next v7 5/6] net: ngbe: add sriov function support
From: "mengyuanlou@net-swift.com" <mengyuanlou@net-swift.com>
Date: 2025-02-11 11:15:18
2025年2月8日 09:19,Jakub Kicinski [off-list ref] 写道: On Thu, 6 Feb 2025 18:37:49 +0800 mengyuanlou wrote:quoted
static irqreturn_t ngbe_msix_other(int __always_unused irq, void *data) { - struct wx *wx = data; + struct wx_q_vector *q_vector; + struct wx *wx = data; + u32 eicr; - /* re-enable the original interrupt state, no lsc, no queues */ - if (netif_running(wx->netdev)) - ngbe_irq_enable(wx, false); + q_vector = wx->q_vector[0]; + + eicr = wx_misc_isb(wx, WX_ISB_MISC); + + if (eicr & NGBE_PX_MISC_IC_VF_MBOX) + wx_msg_task(wx); + + if (wx->num_vfs == 7) { + napi_schedule_irqoff(&q_vector->napi); + ngbe_irq_enable(wx, true); + } else { + /* re-enable the original interrupt state, no lsc, no queues */ + if (netif_running(wx->netdev)) + ngbe_irq_enable(wx, false); + } return IRQ_HANDLED; }You need to explain in the commit message what's happening here.
IDK why the num_vfs == 7 is special.
Due to hardware design, when 6 vfs are assigned. +------------------------------------------------------------+ | | pf | pf | vf5 | vf4 | vf3 | vf2 | vf1 | vf0 | pf | |--------|----|-----|-----|-----|-----|-----|-----|-----|----| | vector | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | +------------------------------------------------------------+ When 7 vfs are assigned. +------------------------------------------------------------+ | | pf | vf6 | vf5 | vf4 | vf3 | vf2 | vf1 | vf0 | pf | |--------|----|-----|-----|-----|-----|-----|-----|-----|----| | vector | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | +------------------------------------------------------------+ When num_vfs < 7, pf can use 0 for misc and 1 for queue. But when num_vfs == 7, vector 1 is assigned to vf6. 1. Alloc 9 irq vectors, but only request_irq for 0 and 8. 2. Reuse interrupt vector 0.
Also why are you now scheduling NAPI from a misc MSI-X handler?
The code used the second. Misc and queue reuse interrupt vector 0.
-- pw-bot: cr