Commit e55f0f5b authored by Neel Patel's avatar Neel Patel Committed by Jakub Kicinski

ionic: refactor use of ionic_rx_fill()

The same pre-work code is used before each call to
ionic_rx_fill(), so bring it in and make it a part of
the routine.
Signed-off-by: default avatarNeel Patel <neel@pensando.io>
Signed-off-by: default avatarShannon Nelson <snelson@pensando.io>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent cad478c7
......@@ -348,16 +348,25 @@ void ionic_rx_fill(struct ionic_queue *q)
struct ionic_rxq_sg_desc *sg_desc;
struct ionic_rxq_sg_elem *sg_elem;
struct ionic_buf_info *buf_info;
unsigned int fill_threshold;
struct ionic_rxq_desc *desc;
unsigned int remain_len;
unsigned int frag_len;
unsigned int nfrags;
unsigned int n_fill;
unsigned int i, j;
unsigned int len;
n_fill = ionic_q_space_avail(q);
fill_threshold = min_t(unsigned int, IONIC_RX_FILL_THRESHOLD,
q->num_descs / IONIC_RX_FILL_DIV);
if (n_fill < fill_threshold)
return;
len = netdev->mtu + ETH_HLEN + VLAN_HLEN;
for (i = ionic_q_space_avail(q); i; i--) {
for (i = n_fill; i; i--) {
nfrags = 0;
remain_len = len;
desc_info = &q->info[q->head_idx];
......@@ -511,7 +520,6 @@ int ionic_rx_napi(struct napi_struct *napi, int budget)
struct ionic_cq *cq = napi_to_cq(napi);
struct ionic_dev *idev;
struct ionic_lif *lif;
u16 rx_fill_threshold;
u32 work_done = 0;
u32 flags = 0;
......@@ -521,10 +529,7 @@ int ionic_rx_napi(struct napi_struct *napi, int budget)
work_done = ionic_cq_service(cq, budget,
ionic_rx_service, NULL, NULL);
rx_fill_threshold = min_t(u16, IONIC_RX_FILL_THRESHOLD,
cq->num_descs / IONIC_RX_FILL_DIV);
if (work_done && ionic_q_space_avail(cq->bound_q) >= rx_fill_threshold)
ionic_rx_fill(cq->bound_q);
ionic_rx_fill(cq->bound_q);
if (work_done < budget && napi_complete_done(napi, work_done)) {
ionic_dim_update(qcq, IONIC_LIF_F_RX_DIM_INTR);
......@@ -550,7 +555,6 @@ int ionic_txrx_napi(struct napi_struct *napi, int budget)
struct ionic_dev *idev;
struct ionic_lif *lif;
struct ionic_cq *txcq;
u16 rx_fill_threshold;
u32 rx_work_done = 0;
u32 tx_work_done = 0;
u32 flags = 0;
......@@ -565,10 +569,7 @@ int ionic_txrx_napi(struct napi_struct *napi, int budget)
rx_work_done = ionic_cq_service(rxcq, budget,
ionic_rx_service, NULL, NULL);
rx_fill_threshold = min_t(u16, IONIC_RX_FILL_THRESHOLD,
rxcq->num_descs / IONIC_RX_FILL_DIV);
if (rx_work_done && ionic_q_space_avail(rxcq->bound_q) >= rx_fill_threshold)
ionic_rx_fill(rxcq->bound_q);
ionic_rx_fill(rxcq->bound_q);
if (rx_work_done < budget && napi_complete_done(napi, rx_work_done)) {
ionic_dim_update(qcq, 0);
......
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