Skip to content

Commit 3f70318

Browse files
Mengyuan Loudavem330
authored andcommitted
net: libwx: Add irq flow functions
Add irq flow functions for ngbe and txgbe. Alloc pcie msix irqs for drivers, otherwise fall back to msi/legacy. Signed-off-by: Mengyuan Lou <mengyuanlou@net-swift.com> Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 542bcea commit 3f70318

File tree

6 files changed

+788
-2
lines changed

6 files changed

+788
-2
lines changed

drivers/net/ethernet/wangxun/libwx/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44

55
obj-$(CONFIG_LIBWX) += libwx.o
66

7-
libwx-objs := wx_hw.o
7+
libwx-objs := wx_hw.o wx_lib.o

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

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ static void wx_intr_disable(struct wx *wx, u64 qmask)
1414
{
1515
u32 mask;
1616

17-
mask = (qmask & 0xFFFFFFFF);
17+
mask = (qmask & U32_MAX);
1818
if (mask)
1919
wr32(wx, WX_PX_IMS(0), mask);
2020

@@ -25,6 +25,45 @@ static void wx_intr_disable(struct wx *wx, u64 qmask)
2525
}
2626
}
2727

28+
void wx_intr_enable(struct wx *wx, u64 qmask)
29+
{
30+
u32 mask;
31+
32+
mask = (qmask & U32_MAX);
33+
if (mask)
34+
wr32(wx, WX_PX_IMC(0), mask);
35+
if (wx->mac.type == wx_mac_sp) {
36+
mask = (qmask >> 32);
37+
if (mask)
38+
wr32(wx, WX_PX_IMC(1), mask);
39+
}
40+
}
41+
EXPORT_SYMBOL(wx_intr_enable);
42+
43+
/**
44+
* wx_irq_disable - Mask off interrupt generation on the NIC
45+
* @wx: board private structure
46+
**/
47+
void wx_irq_disable(struct wx *wx)
48+
{
49+
struct pci_dev *pdev = wx->pdev;
50+
51+
wr32(wx, WX_PX_MISC_IEN, 0);
52+
wx_intr_disable(wx, WX_INTR_ALL);
53+
54+
if (pdev->msix_enabled) {
55+
int vector;
56+
57+
for (vector = 0; vector < wx->num_q_vectors; vector++)
58+
synchronize_irq(wx->msix_entries[vector].vector);
59+
60+
synchronize_irq(wx->msix_entries[vector].vector);
61+
} else {
62+
synchronize_irq(pdev->irq);
63+
}
64+
}
65+
EXPORT_SYMBOL(wx_irq_disable);
66+
2867
/* cmd_addr is used for some special command:
2968
* 1. to be sector address, when implemented erase sector command
3069
* 2. to be flash address when implemented read, write flash address
@@ -844,6 +883,20 @@ void wx_disable_rx(struct wx *wx)
844883
}
845884
EXPORT_SYMBOL(wx_disable_rx);
846885

886+
static void wx_configure_isb(struct wx *wx)
887+
{
888+
/* set ISB Address */
889+
wr32(wx, WX_PX_ISB_ADDR_L, wx->isb_dma & DMA_BIT_MASK(32));
890+
if (IS_ENABLED(CONFIG_ARCH_DMA_ADDR_T_64BIT))
891+
wr32(wx, WX_PX_ISB_ADDR_H, upper_32_bits(wx->isb_dma));
892+
}
893+
894+
void wx_configure(struct wx *wx)
895+
{
896+
wx_configure_isb(wx);
897+
}
898+
EXPORT_SYMBOL(wx_configure);
899+
847900
/**
848901
* wx_disable_pcie_master - Disable PCI-express master access
849902
* @wx: pointer to hardware structure

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
#ifndef _WX_HW_H_
55
#define _WX_HW_H_
66

7+
void wx_intr_enable(struct wx *wx, u64 qmask);
8+
void wx_irq_disable(struct wx *wx);
79
int wx_check_flash_load(struct wx *wx, u32 check_bit);
810
void wx_control_hw(struct wx *wx, bool drv);
911
int wx_mng_present(struct wx *wx);
@@ -20,6 +22,7 @@ void wx_mac_set_default_filter(struct wx *wx, u8 *addr);
2022
void wx_flush_sw_mac_table(struct wx *wx);
2123
int wx_set_mac(struct net_device *netdev, void *p);
2224
void wx_disable_rx(struct wx *wx);
25+
void wx_configure(struct wx *wx);
2326
int wx_disable_pcie_master(struct wx *wx);
2427
int wx_stop_adapter(struct wx *wx);
2528
void wx_reset_misc(struct wx *wx);

0 commit comments

Comments
 (0)