Commit 76ed8a4a authored by Shannon Nelson's avatar Shannon Nelson Committed by David S. Miller

ionic: fix up dim accounting for tx and rx

We need to count the correct Tx and/or Rx packets for dynamic
interrupt moderation, depending on which we're processing on
the queue interrupt.

Fixes: 04a83459 ("ionic: dynamic interrupt moderation")
Signed-off-by: default avatarShannon Nelson <snelson@pensando.io>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a6ff85e0
...@@ -451,11 +451,12 @@ void ionic_rx_empty(struct ionic_queue *q) ...@@ -451,11 +451,12 @@ void ionic_rx_empty(struct ionic_queue *q)
q->tail_idx = 0; q->tail_idx = 0;
} }
static void ionic_dim_update(struct ionic_qcq *qcq) static void ionic_dim_update(struct ionic_qcq *qcq, int napi_mode)
{ {
struct dim_sample dim_sample; struct dim_sample dim_sample;
struct ionic_lif *lif; struct ionic_lif *lif;
unsigned int qi; unsigned int qi;
u64 pkts, bytes;
if (!qcq->intr.dim_coal_hw) if (!qcq->intr.dim_coal_hw)
return; return;
...@@ -463,10 +464,23 @@ static void ionic_dim_update(struct ionic_qcq *qcq) ...@@ -463,10 +464,23 @@ static void ionic_dim_update(struct ionic_qcq *qcq)
lif = qcq->q.lif; lif = qcq->q.lif;
qi = qcq->cq.bound_q->index; qi = qcq->cq.bound_q->index;
switch (napi_mode) {
case IONIC_LIF_F_TX_DIM_INTR:
pkts = lif->txqstats[qi].pkts;
bytes = lif->txqstats[qi].bytes;
break;
case IONIC_LIF_F_RX_DIM_INTR:
pkts = lif->rxqstats[qi].pkts;
bytes = lif->rxqstats[qi].bytes;
break;
default:
pkts = lif->txqstats[qi].pkts + lif->rxqstats[qi].pkts;
bytes = lif->txqstats[qi].bytes + lif->rxqstats[qi].bytes;
break;
}
dim_update_sample(qcq->cq.bound_intr->rearm_count, dim_update_sample(qcq->cq.bound_intr->rearm_count,
lif->txqstats[qi].pkts, pkts, bytes, &dim_sample);
lif->txqstats[qi].bytes,
&dim_sample);
net_dim(&qcq->dim, dim_sample); net_dim(&qcq->dim, dim_sample);
} }
...@@ -487,7 +501,7 @@ int ionic_tx_napi(struct napi_struct *napi, int budget) ...@@ -487,7 +501,7 @@ int ionic_tx_napi(struct napi_struct *napi, int budget)
ionic_tx_service, NULL, NULL); ionic_tx_service, NULL, NULL);
if (work_done < budget && napi_complete_done(napi, work_done)) { if (work_done < budget && napi_complete_done(napi, work_done)) {
ionic_dim_update(qcq); ionic_dim_update(qcq, IONIC_LIF_F_TX_DIM_INTR);
flags |= IONIC_INTR_CRED_UNMASK; flags |= IONIC_INTR_CRED_UNMASK;
cq->bound_intr->rearm_count++; cq->bound_intr->rearm_count++;
} }
...@@ -526,7 +540,7 @@ int ionic_rx_napi(struct napi_struct *napi, int budget) ...@@ -526,7 +540,7 @@ int ionic_rx_napi(struct napi_struct *napi, int budget)
ionic_rx_fill(cq->bound_q); ionic_rx_fill(cq->bound_q);
if (work_done < budget && napi_complete_done(napi, work_done)) { if (work_done < budget && napi_complete_done(napi, work_done)) {
ionic_dim_update(qcq); ionic_dim_update(qcq, IONIC_LIF_F_RX_DIM_INTR);
flags |= IONIC_INTR_CRED_UNMASK; flags |= IONIC_INTR_CRED_UNMASK;
cq->bound_intr->rearm_count++; cq->bound_intr->rearm_count++;
} }
...@@ -572,7 +586,7 @@ int ionic_txrx_napi(struct napi_struct *napi, int budget) ...@@ -572,7 +586,7 @@ int ionic_txrx_napi(struct napi_struct *napi, int budget)
ionic_rx_fill(rxcq->bound_q); ionic_rx_fill(rxcq->bound_q);
if (rx_work_done < budget && napi_complete_done(napi, rx_work_done)) { if (rx_work_done < budget && napi_complete_done(napi, rx_work_done)) {
ionic_dim_update(qcq); ionic_dim_update(qcq, 0);
flags |= IONIC_INTR_CRED_UNMASK; flags |= IONIC_INTR_CRED_UNMASK;
rxcq->bound_intr->rearm_count++; rxcq->bound_intr->rearm_count++;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment