Skip to content

Commit e37546a

Browse files
Jiawen WuPaolo Abeni
authored andcommitted
net: wangxun: revert the adjustment of the IRQ vector sequence
Due to hardware limitations of NGBE, queue IRQs can only be requested on vector 0 to 7. When the number of queues is set to the maximum 8, the PCI IRQ vectors are allocated from 0 to 8. The vector 0 is used by MISC interrupt, and althrough the vector 8 is used by queue interrupt, it is unable to receive packets. This will cause some packets to be dropped when RSS is enabled and they are assigned to queue 8. So revert the adjustment of the MISC IRQ location, to make it be the last one in IRQ vectors. Fixes: 937d46e ("net: wangxun: add ethtool_ops for channel number") Cc: [email protected] 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 cc9f7f6 commit e37546a

File tree

6 files changed

+16
-17
lines changed

6 files changed

+16
-17
lines changed

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

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1747,7 +1747,7 @@ static void wx_set_num_queues(struct wx *wx)
17471747
*/
17481748
static int wx_acquire_msix_vectors(struct wx *wx)
17491749
{
1750-
struct irq_affinity affd = { .pre_vectors = 1 };
1750+
struct irq_affinity affd = { .post_vectors = 1 };
17511751
int nvecs, i;
17521752

17531753
/* We start by asking for one vector per queue pair */
@@ -1784,16 +1784,17 @@ static int wx_acquire_msix_vectors(struct wx *wx)
17841784
return nvecs;
17851785
}
17861786

1787-
wx->msix_entry->entry = 0;
1788-
wx->msix_entry->vector = pci_irq_vector(wx->pdev, 0);
17891787
nvecs -= 1;
17901788
for (i = 0; i < nvecs; i++) {
17911789
wx->msix_q_entries[i].entry = i;
1792-
wx->msix_q_entries[i].vector = pci_irq_vector(wx->pdev, i + 1);
1790+
wx->msix_q_entries[i].vector = pci_irq_vector(wx->pdev, i);
17931791
}
17941792

17951793
wx->num_q_vectors = nvecs;
17961794

1795+
wx->msix_entry->entry = nvecs;
1796+
wx->msix_entry->vector = pci_irq_vector(wx->pdev, nvecs);
1797+
17971798
return 0;
17981799
}
17991800

@@ -2300,8 +2301,6 @@ static void wx_set_ivar(struct wx *wx, s8 direction,
23002301
wr32(wx, WX_PX_MISC_IVAR, ivar);
23012302
} else {
23022303
/* tx or rx causes */
2303-
if (!(wx->mac.type == wx_mac_em && wx->num_vfs == 7))
2304-
msix_vector += 1; /* offset for queue vectors */
23052304
msix_vector |= WX_PX_IVAR_ALLOC_VAL;
23062305
index = ((16 * (queue & 1)) + (8 * direction));
23072306
ivar = rd32(wx, WX_PX_IVAR(queue >> 1));
@@ -2340,7 +2339,7 @@ void wx_write_eitr(struct wx_q_vector *q_vector)
23402339

23412340
itr_reg |= WX_PX_ITR_CNT_WDIS;
23422341

2343-
wr32(wx, WX_PX_ITR(v_idx + 1), itr_reg);
2342+
wr32(wx, WX_PX_ITR(v_idx), itr_reg);
23442343
}
23452344

23462345
/**
@@ -2393,9 +2392,9 @@ void wx_configure_vectors(struct wx *wx)
23932392
wx_write_eitr(q_vector);
23942393
}
23952394

2396-
wx_set_ivar(wx, -1, 0, 0);
2395+
wx_set_ivar(wx, -1, 0, v_idx);
23972396
if (pdev->msix_enabled)
2398-
wr32(wx, WX_PX_ITR(0), 1950);
2397+
wr32(wx, WX_PX_ITR(v_idx), 1950);
23992398
}
24002399
EXPORT_SYMBOL(wx_configure_vectors);
24012400

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1343,7 +1343,7 @@ struct wx {
13431343
};
13441344

13451345
#define WX_INTR_ALL (~0ULL)
1346-
#define WX_INTR_Q(i) BIT((i) + 1)
1346+
#define WX_INTR_Q(i) BIT((i))
13471347

13481348
/* register operations */
13491349
#define wr32(a, reg, value) writel((value), ((a)->hw_addr + (reg)))

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ static void ngbe_irq_enable(struct wx *wx, bool queues)
161161
if (queues)
162162
wx_intr_enable(wx, NGBE_INTR_ALL);
163163
else
164-
wx_intr_enable(wx, NGBE_INTR_MISC);
164+
wx_intr_enable(wx, NGBE_INTR_MISC(wx));
165165
}
166166

167167
/**

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 BIT(0)
90+
#define NGBE_INTR_MISC(A) BIT((A)->num_q_vectors)
9191

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

drivers/net/ethernet/wangxun/txgbe/txgbe_irq.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ void txgbe_irq_enable(struct wx *wx, bool queues)
3131
wr32(wx, WX_PX_MISC_IEN, misc_ien);
3232

3333
/* unmask interrupt */
34-
wx_intr_enable(wx, TXGBE_INTR_MISC);
34+
wx_intr_enable(wx, TXGBE_INTR_MISC(wx));
3535
if (queues)
3636
wx_intr_enable(wx, TXGBE_INTR_QALL(wx));
3737
}
@@ -131,7 +131,7 @@ static irqreturn_t txgbe_misc_irq_handle(int irq, void *data)
131131
txgbe->eicr = eicr;
132132
if (eicr & TXGBE_PX_MISC_IC_VF_MBOX) {
133133
wx_msg_task(txgbe->wx);
134-
wx_intr_enable(wx, TXGBE_INTR_MISC);
134+
wx_intr_enable(wx, TXGBE_INTR_MISC(wx));
135135
}
136136
return IRQ_WAKE_THREAD;
137137
}
@@ -183,7 +183,7 @@ static irqreturn_t txgbe_misc_irq_thread_fn(int irq, void *data)
183183
nhandled++;
184184
}
185185

186-
wx_intr_enable(wx, TXGBE_INTR_MISC);
186+
wx_intr_enable(wx, TXGBE_INTR_MISC(wx));
187187
return (nhandled > 0 ? IRQ_HANDLED : IRQ_NONE);
188188
}
189189

drivers/net/ethernet/wangxun/txgbe/txgbe_type.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,8 @@ struct txgbe_fdir_filter {
302302
#define TXGBE_DEFAULT_RX_WORK 128
303303
#endif
304304

305-
#define TXGBE_INTR_MISC BIT(0)
306-
#define TXGBE_INTR_QALL(A) GENMASK((A)->num_q_vectors, 1)
305+
#define TXGBE_INTR_MISC(A) BIT((A)->num_q_vectors)
306+
#define TXGBE_INTR_QALL(A) (TXGBE_INTR_MISC(A) - 1)
307307

308308
#define TXGBE_MAX_EITR GENMASK(11, 3)
309309

0 commit comments

Comments
 (0)