提交 f65fc668 编写于 作者: S Shaozhengchao 提交者: Xie XiuQi

net/hinic: optimize interrupt rush

driver inclusion
category:bugfix
bugzilla:4472
CVE:NA

-----------------------------------------------------------------------

optimize interrupt rush
Signed-off-by: NShaozhengchao <shaozhengchao@huawei.com>
Reviewed-by: NLuoshaokai <luoshaokai@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 98b244a9
...@@ -438,7 +438,7 @@ static void hinic_destroy_num_qps(struct hinic_nic_dev *nic_dev) ...@@ -438,7 +438,7 @@ static void hinic_destroy_num_qps(struct hinic_nic_dev *nic_dev)
kfree(nic_dev->qps_irq_info); kfree(nic_dev->qps_irq_info);
} }
int hinic_poll(struct napi_struct *napi, int budget) static int hinic_poll(struct napi_struct *napi, int budget)
{ {
int tx_pkts, rx_pkts; int tx_pkts, rx_pkts;
struct hinic_irq *irq_cfg = container_of(napi, struct hinic_irq, napi); struct hinic_irq *irq_cfg = container_of(napi, struct hinic_irq, napi);
...@@ -451,6 +451,13 @@ int hinic_poll(struct napi_struct *napi, int budget) ...@@ -451,6 +451,13 @@ int hinic_poll(struct napi_struct *napi, int budget)
if (tx_pkts >= budget || rx_pkts >= budget) if (tx_pkts >= budget || rx_pkts >= budget)
return budget; return budget;
set_bit(HINIC_RESEND_ON, &irq_cfg->intr_flag);
rx_pkts += hinic_rx_poll(irq_cfg->rxq, budget - rx_pkts);
if (rx_pkts >= budget) {
clear_bit(HINIC_RESEND_ON, &irq_cfg->intr_flag);
return budget;
}
napi_complete(napi); napi_complete(napi);
if (!test_and_set_bit(HINIC_INTR_ON, &irq_cfg->intr_flag)) { if (!test_and_set_bit(HINIC_INTR_ON, &irq_cfg->intr_flag)) {
...@@ -484,24 +491,33 @@ static irqreturn_t qp_irq(int irq, void *data) ...@@ -484,24 +491,33 @@ static irqreturn_t qp_irq(int irq, void *data)
{ {
struct hinic_irq *irq_cfg = (struct hinic_irq *)data; struct hinic_irq *irq_cfg = (struct hinic_irq *)data;
struct hinic_nic_dev *nic_dev = netdev_priv(irq_cfg->netdev); struct hinic_nic_dev *nic_dev = netdev_priv(irq_cfg->netdev);
u16 msix_entry_idx = irq_cfg->msix_entry_idx;
if (napi_schedule_prep(&irq_cfg->napi)) {
if (l2nic_interrupt_switch) { if (l2nic_interrupt_switch) {
/* Disable the interrupt until napi will be completed */ /* Disable the interrupt until napi will be completed */
if (!HINIC_FUNC_IS_VF(nic_dev->hwdev)) if (!HINIC_FUNC_IS_VF(nic_dev->hwdev)) {
hinic_set_msix_state(nic_dev->hwdev, hinic_set_msix_state(nic_dev->hwdev,
irq_cfg->msix_entry_idx, msix_entry_idx,
HINIC_MSIX_DISABLE); HINIC_MSIX_DISABLE);
else if (!nic_dev->in_vm) } else if (!nic_dev->in_vm) {
disable_irq_nosync(irq_cfg->irq_id); disable_irq_nosync(irq_cfg->irq_id);
}
clear_bit(HINIC_INTR_ON, &irq_cfg->intr_flag); clear_bit(HINIC_INTR_ON, &irq_cfg->intr_flag);
} }
/* 1 is resend_timer */
hinic_misx_intr_clear_resend_bit(nic_dev->hwdev, hinic_misx_intr_clear_resend_bit(nic_dev->hwdev,
irq_cfg->msix_entry_idx, 1); msix_entry_idx, 1);
clear_bit(HINIC_RESEND_ON, &irq_cfg->intr_flag);
__napi_schedule(&irq_cfg->napi);
} else if (!test_bit(HINIC_RESEND_ON, &irq_cfg->intr_flag)) {
hinic_misx_intr_clear_resend_bit(nic_dev->hwdev, msix_entry_idx,
1);
}
napi_schedule(&irq_cfg->napi);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
......
...@@ -104,6 +104,7 @@ struct hinic_dcb_config { ...@@ -104,6 +104,7 @@ struct hinic_dcb_config {
enum hinic_intr_flags { enum hinic_intr_flags {
HINIC_INTR_ON, HINIC_INTR_ON,
HINIC_RESEND_ON,
}; };
struct hinic_irq { struct hinic_irq {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册