Skip to content

Commit 4174c0c

Browse files
Jiawen WuPaolo Abeni
authored andcommitted
net: ngbe: specify IRQ vector when the number of VFs is 7
For NGBE devices, the queue number is limited to be 1 when SRIOV is enabled. In this case, IRQ vector[0] is used for MISC and vector[1] is used for queue, based on the previous patches. But for the hardware design, the IRQ vector[1] must be allocated for use by the VF[6] when the number of VFs is 7. So the IRQ vector[0] should be shared for PF MISC and QUEUE interrupts. +-----------+----------------------+ | Vector | Assigned To | +-----------+----------------------+ | Vector 0 | PF MISC and QUEUE | | Vector 1 | VF 6 | | Vector 2 | VF 5 | | Vector 3 | VF 4 | | Vector 4 | VF 3 | | Vector 5 | VF 2 | | Vector 6 | VF 1 | | Vector 7 | VF 0 | +-----------+----------------------+ Minimize code modifications, only adjust the IRQ vector number for this case. Fixes: 877253d ("net: ngbe: add sriov function support") Signed-off-by: Jiawen Wu <[email protected]> Reviewed-by: Larysa Zaremba <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
1 parent e37546a commit 4174c0c

File tree

5 files changed

+16
-2
lines changed

5 files changed

+16
-2
lines changed

drivers/net/ethernet/wangxun/libwx/wx_lib.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1795,6 +1795,13 @@ static int wx_acquire_msix_vectors(struct wx *wx)
17951795
wx->msix_entry->entry = nvecs;
17961796
wx->msix_entry->vector = pci_irq_vector(wx->pdev, nvecs);
17971797

1798+
if (test_bit(WX_FLAG_IRQ_VECTOR_SHARED, wx->flags)) {
1799+
wx->msix_entry->entry = 0;
1800+
wx->msix_entry->vector = pci_irq_vector(wx->pdev, 0);
1801+
wx->msix_q_entries[0].entry = 0;
1802+
wx->msix_q_entries[0].vector = pci_irq_vector(wx->pdev, 1);
1803+
}
1804+
17981805
return 0;
17991806
}
18001807

@@ -2293,6 +2300,8 @@ static void wx_set_ivar(struct wx *wx, s8 direction,
22932300

22942301
if (direction == -1) {
22952302
/* other causes */
2303+
if (test_bit(WX_FLAG_IRQ_VECTOR_SHARED, wx->flags))
2304+
msix_vector = 0;
22962305
msix_vector |= WX_PX_IVAR_ALLOC_VAL;
22972306
index = 0;
22982307
ivar = rd32(wx, WX_PX_MISC_IVAR);

drivers/net/ethernet/wangxun/libwx/wx_sriov.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ static void wx_sriov_clear_data(struct wx *wx)
6464
wr32m(wx, WX_PSR_VM_CTL, WX_PSR_VM_CTL_POOL_MASK, 0);
6565
wx->ring_feature[RING_F_VMDQ].offset = 0;
6666

67+
clear_bit(WX_FLAG_IRQ_VECTOR_SHARED, wx->flags);
6768
clear_bit(WX_FLAG_SRIOV_ENABLED, wx->flags);
6869
/* Disable VMDq flag so device will be set in NM mode */
6970
if (wx->ring_feature[RING_F_VMDQ].limit == 1)
@@ -78,6 +79,9 @@ static int __wx_enable_sriov(struct wx *wx, u8 num_vfs)
7879
set_bit(WX_FLAG_SRIOV_ENABLED, wx->flags);
7980
dev_info(&wx->pdev->dev, "SR-IOV enabled with %d VFs\n", num_vfs);
8081

82+
if (num_vfs == 7 && wx->mac.type == wx_mac_em)
83+
set_bit(WX_FLAG_IRQ_VECTOR_SHARED, wx->flags);
84+
8185
/* Enable VMDq flag so device will be set in VM mode */
8286
set_bit(WX_FLAG_VMDQ_ENABLED, wx->flags);
8387
if (!wx->ring_feature[RING_F_VMDQ].limit)

drivers/net/ethernet/wangxun/libwx/wx_type.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1191,6 +1191,7 @@ enum wx_pf_flags {
11911191
WX_FLAG_VMDQ_ENABLED,
11921192
WX_FLAG_VLAN_PROMISC,
11931193
WX_FLAG_SRIOV_ENABLED,
1194+
WX_FLAG_IRQ_VECTOR_SHARED,
11941195
WX_FLAG_FDIR_CAPABLE,
11951196
WX_FLAG_FDIR_HASH,
11961197
WX_FLAG_FDIR_PERFECT,

drivers/net/ethernet/wangxun/ngbe/ngbe_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ static int ngbe_request_msix_irqs(struct wx *wx)
286286
* for queue. But when num_vfs == 7, vector[1] is assigned to vf6.
287287
* Misc and queue should reuse interrupt vector[0].
288288
*/
289-
if (wx->num_vfs == 7)
289+
if (test_bit(WX_FLAG_IRQ_VECTOR_SHARED, wx->flags))
290290
err = request_irq(wx->msix_entry->vector,
291291
ngbe_misc_and_queue, 0, netdev->name, wx);
292292
else

drivers/net/ethernet/wangxun/ngbe/ngbe_type.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
#define NGBE_PX_MISC_IC_TIMESYNC BIT(11) /* time sync */
8888

8989
#define NGBE_INTR_ALL 0x1FF
90-
#define NGBE_INTR_MISC(A) BIT((A)->num_q_vectors)
90+
#define NGBE_INTR_MISC(A) BIT((A)->msix_entry->entry)
9191

9292
#define NGBE_PHY_CONFIG(reg_offset) (0x14000 + ((reg_offset) * 4))
9393
#define NGBE_CFG_LAN_SPEED 0x14440

0 commit comments

Comments
 (0)