Skip to content

Commit

Permalink
net: libwx: Add irq flow functions
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Mengyuan Lou authored and intel-lab-lkp committed Jan 18, 2023
1 parent c4791b3 commit f807094
Show file tree
Hide file tree
Showing 6 changed files with 779 additions and 2 deletions.
2 changes: 1 addition & 1 deletion drivers/net/ethernet/wangxun/libwx/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

obj-$(CONFIG_LIBWX) += libwx.o

libwx-objs := wx_hw.o
libwx-objs := wx_hw.o wx_lib.o
54 changes: 53 additions & 1 deletion drivers/net/ethernet/wangxun/libwx/wx_hw.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ static void wx_intr_disable(struct wx *wx, u64 qmask)
{
u32 mask;

mask = (qmask & 0xFFFFFFFF);
mask = (qmask & U32_MAX);
if (mask)
wr32(wx, WX_PX_IMS(0), mask);

Expand All @@ -25,6 +25,45 @@ static void wx_intr_disable(struct wx *wx, u64 qmask)
}
}

void wx_intr_enable(struct wx *wx, u64 qmask)
{
u32 mask;

mask = (qmask & U32_MAX);
if (mask)
wr32(wx, WX_PX_IMC(0), mask);
if (wx->mac.type == wx_mac_sp) {
mask = (qmask >> 32);
if (mask)
wr32(wx, WX_PX_IMC(1), mask);
}
}
EXPORT_SYMBOL(wx_intr_enable);

/**
* wx_irq_disable - Mask off interrupt generation on the NIC
* @wx: board private structure
**/
void wx_irq_disable(struct wx *wx)
{
struct pci_dev *pdev = wx->pdev;

wr32(wx, WX_PX_MISC_IEN, 0);
wx_intr_disable(wx, WX_INTR_ALL);

if (pdev->msix_enabled) {
int vector;

for (vector = 0; vector < wx->num_q_vectors; vector++)
synchronize_irq(wx->msix_entries[vector].vector);

synchronize_irq(wx->msix_entries[vector].vector);
} else {
synchronize_irq(pdev->irq);
}
}
EXPORT_SYMBOL(wx_irq_disable);

/* cmd_addr is used for some special command:
* 1. to be sector address, when implemented erase sector command
* 2. to be flash address when implemented read, write flash address
Expand Down Expand Up @@ -844,6 +883,19 @@ void wx_disable_rx(struct wx *wx)
}
EXPORT_SYMBOL(wx_disable_rx);

static void wx_configure_isb(struct wx *wx)
{
/* set ISB Address */
wr32(wx, WX_PX_ISB_ADDR_L, wx->isb_dma & DMA_BIT_MASK(32));
wr32(wx, WX_PX_ISB_ADDR_H, wx->isb_dma >> 32);
}

void wx_configure(struct wx *wx)
{
wx_configure_isb(wx);
}
EXPORT_SYMBOL(wx_configure);

/**
* wx_disable_pcie_master - Disable PCI-express master access
* @wx: pointer to hardware structure
Expand Down
3 changes: 3 additions & 0 deletions drivers/net/ethernet/wangxun/libwx/wx_hw.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#ifndef _WX_HW_H_
#define _WX_HW_H_

void wx_intr_enable(struct wx *wx, u64 qmask);
void wx_irq_disable(struct wx *wx);
int wx_check_flash_load(struct wx *wx, u32 check_bit);
void wx_control_hw(struct wx *wx, bool drv);
int wx_mng_present(struct wx *wx);
Expand All @@ -20,6 +22,7 @@ void wx_mac_set_default_filter(struct wx *wx, u8 *addr);
void wx_flush_sw_mac_table(struct wx *wx);
int wx_set_mac(struct net_device *netdev, void *p);
void wx_disable_rx(struct wx *wx);
void wx_configure(struct wx *wx);
int wx_disable_pcie_master(struct wx *wx);
int wx_stop_adapter(struct wx *wx);
void wx_reset_misc(struct wx *wx);
Expand Down

0 comments on commit f807094

Please sign in to comment.