提交 eb5f10c2 编写于 作者: S Sreenivasa Honnur 提交者: David S. Miller

vxge: Allow multiple functions with INTA.

- Allow multiple functions with INTA.
- Removed the condition to allow only one vpath with INTA
- Ensure that the alarm bit in titan_mask_all_int register is cleared when
  driver exits.
Signed-off-by: NSreenivasa Honnur <sreenivasa.honnur@neterion.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 fa41fd10
...@@ -3882,6 +3882,30 @@ __vxge_hw_vpath_tim_configure(struct __vxge_hw_device *hldev, u32 vp_id) ...@@ -3882,6 +3882,30 @@ __vxge_hw_vpath_tim_configure(struct __vxge_hw_device *hldev, u32 vp_id)
return status; return status;
} }
void
vxge_hw_vpath_tti_ci_set(struct __vxge_hw_device *hldev, u32 vp_id)
{
struct __vxge_hw_virtualpath *vpath;
struct vxge_hw_vpath_reg __iomem *vp_reg;
struct vxge_hw_vp_config *config;
u64 val64;
vpath = &hldev->virtual_paths[vp_id];
vp_reg = vpath->vp_reg;
config = vpath->vp_config;
if (config->fifo.enable == VXGE_HW_FIFO_ENABLE) {
val64 = readq(&vp_reg->tim_cfg1_int_num[VXGE_HW_VPATH_INTR_TX]);
if (config->tti.timer_ci_en != VXGE_HW_TIM_TIMER_CI_ENABLE) {
config->tti.timer_ci_en = VXGE_HW_TIM_TIMER_CI_ENABLE;
val64 |= VXGE_HW_TIM_CFG1_INT_NUM_TIMER_CI;
writeq(val64,
&vp_reg->tim_cfg1_int_num[VXGE_HW_VPATH_INTR_TX]);
}
}
return;
}
/* /*
* __vxge_hw_vpath_initialize * __vxge_hw_vpath_initialize
* This routine is the final phase of init which initializes the * This routine is the final phase of init which initializes the
......
...@@ -2435,7 +2435,6 @@ static int vxge_add_isr(struct vxgedev *vdev) ...@@ -2435,7 +2435,6 @@ static int vxge_add_isr(struct vxgedev *vdev)
int ret = 0; int ret = 0;
#ifdef CONFIG_PCI_MSI #ifdef CONFIG_PCI_MSI
int vp_idx = 0, intr_idx = 0, intr_cnt = 0, msix_idx = 0, irq_req = 0; int vp_idx = 0, intr_idx = 0, intr_cnt = 0, msix_idx = 0, irq_req = 0;
u64 function_mode = vdev->config.device_hw_info.function_mode;
int pci_fun = PCI_FUNC(vdev->pdev->devfn); int pci_fun = PCI_FUNC(vdev->pdev->devfn);
if (vdev->config.intr_type == MSI_X) if (vdev->config.intr_type == MSI_X)
...@@ -2444,20 +2443,9 @@ static int vxge_add_isr(struct vxgedev *vdev) ...@@ -2444,20 +2443,9 @@ static int vxge_add_isr(struct vxgedev *vdev)
if (ret) { if (ret) {
vxge_debug_init(VXGE_ERR, vxge_debug_init(VXGE_ERR,
"%s: Enabling MSI-X Failed", VXGE_DRIVER_NAME); "%s: Enabling MSI-X Failed", VXGE_DRIVER_NAME);
if ((function_mode == VXGE_HW_FUNCTION_MODE_MULTI_FUNCTION) && vxge_debug_init(VXGE_ERR,
test_and_set_bit(__VXGE_STATE_CARD_UP, "%s: Defaulting to INTA", VXGE_DRIVER_NAME);
&driver_config->inta_dev_open)) vdev->config.intr_type = INTA;
return VXGE_HW_FAIL;
else {
vxge_debug_init(VXGE_ERR,
"%s: Defaulting to INTA", VXGE_DRIVER_NAME);
vdev->config.intr_type = INTA;
vxge_hw_device_set_intr_type(vdev->devh,
VXGE_HW_INTR_MODE_IRQLINE);
vxge_close_vpaths(vdev, 1);
vdev->no_of_vpath = 1;
vdev->stats.vpaths_open = 1;
}
} }
if (vdev->config.intr_type == MSI_X) { if (vdev->config.intr_type == MSI_X) {
...@@ -2505,24 +2493,11 @@ static int vxge_add_isr(struct vxgedev *vdev) ...@@ -2505,24 +2493,11 @@ static int vxge_add_isr(struct vxgedev *vdev)
"%s: MSIX - %d Registration failed", "%s: MSIX - %d Registration failed",
vdev->ndev->name, intr_cnt); vdev->ndev->name, intr_cnt);
vxge_rem_msix_isr(vdev); vxge_rem_msix_isr(vdev);
if ((function_mode == vdev->config.intr_type = INTA;
VXGE_HW_FUNCTION_MODE_MULTI_FUNCTION) && vxge_debug_init(VXGE_ERR,
test_and_set_bit(__VXGE_STATE_CARD_UP, "%s: Defaulting to INTA"
&driver_config->inta_dev_open)) , vdev->ndev->name);
return VXGE_HW_FAIL;
else {
vxge_hw_device_set_intr_type(
vdev->devh,
VXGE_HW_INTR_MODE_IRQLINE);
vdev->config.intr_type = INTA;
vxge_debug_init(VXGE_ERR,
"%s: Defaulting to INTA"
, vdev->ndev->name);
vxge_close_vpaths(vdev, 1);
vdev->no_of_vpath = 1;
vdev->stats.vpaths_open = 1;
goto INTA_MODE; goto INTA_MODE;
}
} }
if (irq_req) { if (irq_req) {
...@@ -2555,23 +2530,11 @@ static int vxge_add_isr(struct vxgedev *vdev) ...@@ -2555,23 +2530,11 @@ static int vxge_add_isr(struct vxgedev *vdev)
"%s: MSIX - %d Registration failed", "%s: MSIX - %d Registration failed",
vdev->ndev->name, intr_cnt); vdev->ndev->name, intr_cnt);
vxge_rem_msix_isr(vdev); vxge_rem_msix_isr(vdev);
if ((function_mode == vdev->config.intr_type = INTA;
VXGE_HW_FUNCTION_MODE_MULTI_FUNCTION) && vxge_debug_init(VXGE_ERR,
test_and_set_bit(__VXGE_STATE_CARD_UP, "%s: Defaulting to INTA",
&driver_config->inta_dev_open)) vdev->ndev->name);
return VXGE_HW_FAIL;
else {
vxge_hw_device_set_intr_type(vdev->devh,
VXGE_HW_INTR_MODE_IRQLINE);
vdev->config.intr_type = INTA;
vxge_debug_init(VXGE_ERR,
"%s: Defaulting to INTA",
vdev->ndev->name);
vxge_close_vpaths(vdev, 1);
vdev->no_of_vpath = 1;
vdev->stats.vpaths_open = 1;
goto INTA_MODE; goto INTA_MODE;
}
} }
vxge_hw_vpath_msix_unmask(vdev->vpaths[vp_idx].handle, vxge_hw_vpath_msix_unmask(vdev->vpaths[vp_idx].handle,
...@@ -2584,6 +2547,10 @@ static int vxge_add_isr(struct vxgedev *vdev) ...@@ -2584,6 +2547,10 @@ static int vxge_add_isr(struct vxgedev *vdev)
snprintf(vdev->desc[0], VXGE_INTR_STRLEN, "%s:vxge", vdev->ndev->name); snprintf(vdev->desc[0], VXGE_INTR_STRLEN, "%s:vxge", vdev->ndev->name);
if (vdev->config.intr_type == INTA) { if (vdev->config.intr_type == INTA) {
vxge_hw_device_set_intr_type(vdev->devh,
VXGE_HW_INTR_MODE_IRQLINE);
vxge_hw_vpath_tti_ci_set(vdev->devh,
vdev->vpaths[0].device_id);
ret = request_irq((int) vdev->pdev->irq, ret = request_irq((int) vdev->pdev->irq,
vxge_isr_napi, vxge_isr_napi,
IRQF_SHARED, vdev->desc[0], vdev); IRQF_SHARED, vdev->desc[0], vdev);
...@@ -2688,13 +2655,6 @@ vxge_open(struct net_device *dev) ...@@ -2688,13 +2655,6 @@ vxge_open(struct net_device *dev)
* initialized */ * initialized */
netif_carrier_off(dev); netif_carrier_off(dev);
/* Check for another device already opn with INTA */
if ((function_mode == VXGE_HW_FUNCTION_MODE_MULTI_FUNCTION) &&
test_bit(__VXGE_STATE_CARD_UP, &driver_config->inta_dev_open)) {
ret = -EPERM;
goto out0;
}
/* Open VPATHs */ /* Open VPATHs */
status = vxge_open_vpaths(vdev); status = vxge_open_vpaths(vdev);
if (status != VXGE_HW_OK) { if (status != VXGE_HW_OK) {
...@@ -2983,7 +2943,6 @@ int do_vxge_close(struct net_device *dev, int do_io) ...@@ -2983,7 +2943,6 @@ int do_vxge_close(struct net_device *dev, int do_io)
vxge_debug_entryexit(VXGE_TRACE, vxge_debug_entryexit(VXGE_TRACE,
"%s: %s:%d Exiting...", dev->name, __func__, __LINE__); "%s: %s:%d Exiting...", dev->name, __func__, __LINE__);
clear_bit(__VXGE_STATE_CARD_UP, &driver_config->inta_dev_open);
clear_bit(__VXGE_STATE_RESET_CARD, &vdev->state); clear_bit(__VXGE_STATE_RESET_CARD, &vdev->state);
return 0; return 0;
...@@ -4397,6 +4356,27 @@ vxge_probe(struct pci_dev *pdev, const struct pci_device_id *pre) ...@@ -4397,6 +4356,27 @@ vxge_probe(struct pci_dev *pdev, const struct pci_device_id *pre)
} }
kfree(device_config); kfree(device_config);
/*
* INTA is shared in multi-function mode. This is unlike the INTA
* implementation in MR mode, where each VH has its own INTA message.
* - INTA is masked (disabled) as long as at least one function sets
* its TITAN_MASK_ALL_INT.ALARM bit.
* - INTA is unmasked (enabled) when all enabled functions have cleared
* their own TITAN_MASK_ALL_INT.ALARM bit.
* The TITAN_MASK_ALL_INT ALARM & TRAFFIC bits are cleared on power up.
* Though this driver leaves the top level interrupts unmasked while
* leaving the required module interrupt bits masked on exit, there
* could be a rougue driver around that does not follow this procedure
* resulting in a failure to generate interrupts. The following code is
* present to prevent such a failure.
*/
if (ll_config.device_hw_info.function_mode ==
VXGE_HW_FUNCTION_MODE_MULTI_FUNCTION)
if (vdev->config.intr_type == INTA)
vxge_hw_device_unmask_all(hldev);
vxge_debug_entryexit(VXGE_TRACE, "%s: %s:%d Exiting...", vxge_debug_entryexit(VXGE_TRACE, "%s: %s:%d Exiting...",
vdev->ndev->name, __func__, __LINE__); vdev->ndev->name, __func__, __LINE__);
......
...@@ -112,7 +112,6 @@ enum vxge_mac_addr_state { ...@@ -112,7 +112,6 @@ enum vxge_mac_addr_state {
struct vxge_drv_config { struct vxge_drv_config {
int config_dev_cnt; int config_dev_cnt;
int total_dev_cnt; int total_dev_cnt;
unsigned long inta_dev_open;
int g_no_cpus; int g_no_cpus;
unsigned int vpath_per_dev; unsigned int vpath_per_dev;
}; };
......
...@@ -295,6 +295,8 @@ void vxge_hw_device_intr_enable(struct __vxge_hw_device *hldev) ...@@ -295,6 +295,8 @@ void vxge_hw_device_intr_enable(struct __vxge_hw_device *hldev)
u64 val64; u64 val64;
u32 val32; u32 val32;
vxge_hw_device_mask_all(hldev);
for (i = 0; i < VXGE_HW_MAX_VIRTUAL_PATHS; i++) { for (i = 0; i < VXGE_HW_MAX_VIRTUAL_PATHS; i++) {
if (!(hldev->vpaths_deployed & vxge_mBIT(i))) if (!(hldev->vpaths_deployed & vxge_mBIT(i)))
......
...@@ -2389,6 +2389,8 @@ vxge_hw_channel_dtr_free(struct __vxge_hw_channel *channel, void *dtrh); ...@@ -2389,6 +2389,8 @@ vxge_hw_channel_dtr_free(struct __vxge_hw_channel *channel, void *dtrh);
int int
vxge_hw_channel_dtr_count(struct __vxge_hw_channel *channel); vxge_hw_channel_dtr_count(struct __vxge_hw_channel *channel);
void
vxge_hw_vpath_tti_ci_set(struct __vxge_hw_device *hldev, u32 vp_id);
/* ========================== PRIVATE API ================================= */ /* ========================== PRIVATE API ================================= */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册