From 02eabf57594cd7424969527598054e1c48951470 Mon Sep 17 00:00:00 2001 From: Andrew Boyer Date: Wed, 9 Dec 2020 18:57:34 -0800 Subject: [PATCH] net/ionic: convert boolean to flag bit This conserves resources. Signed-off-by: Andrew Boyer Reviewed-by: Ferruh Yigit --- drivers/net/ionic/ionic_lif.c | 4 ++-- drivers/net/ionic/ionic_lif.h | 2 +- drivers/net/ionic/ionic_rxtx.c | 10 ++++++---- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/net/ionic/ionic_lif.c b/drivers/net/ionic/ionic_lif.c index bc15d75fd6..2e33fb8d9b 100644 --- a/drivers/net/ionic/ionic_lif.c +++ b/drivers/net/ionic/ionic_lif.c @@ -1590,7 +1590,7 @@ ionic_lif_start(struct ionic_lif *lif) for (i = 0; i < lif->nrxqcqs; i++) { struct ionic_qcq *rxq = lif->rxqcqs[i]; - if (!rxq->deferred_start) { + if (!(rxq->flags & IONIC_QCQ_F_DEFERRED)) { err = ionic_dev_rx_queue_start(lif->eth_dev, i); if (err) @@ -1600,7 +1600,7 @@ ionic_lif_start(struct ionic_lif *lif) for (i = 0; i < lif->ntxqcqs; i++) { struct ionic_qcq *txq = lif->txqcqs[i]; - if (!txq->deferred_start) { + if (!(txq->flags & IONIC_QCQ_F_DEFERRED)) { err = ionic_dev_tx_queue_start(lif->eth_dev, i); if (err) diff --git a/drivers/net/ionic/ionic_lif.h b/drivers/net/ionic/ionic_lif.h index 4e091719f5..8e2b42443b 100644 --- a/drivers/net/ionic/ionic_lif.h +++ b/drivers/net/ionic/ionic_lif.h @@ -50,6 +50,7 @@ struct ionic_rx_stats { #define IONIC_QCQ_F_SG BIT(1) #define IONIC_QCQ_F_INTR BIT(2) #define IONIC_QCQ_F_NOTIFYQ BIT(3) +#define IONIC_QCQ_F_DEFERRED BIT(4) /* Queue / Completion Queue */ struct ionic_qcq { @@ -68,7 +69,6 @@ struct ionic_qcq { uint32_t total_size; uint32_t flags; struct ionic_intr_info intr; - bool deferred_start; }; #define IONIC_Q_TO_QCQ(q) container_of(q, struct ionic_qcq, q) diff --git a/drivers/net/ionic/ionic_rxtx.c b/drivers/net/ionic/ionic_rxtx.c index 2592f5cab6..b953aff49d 100644 --- a/drivers/net/ionic/ionic_rxtx.c +++ b/drivers/net/ionic/ionic_rxtx.c @@ -64,7 +64,7 @@ ionic_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id, qinfo->nb_desc = q->num_descs; qinfo->conf.offloads = txq->offloads; - qinfo->conf.tx_deferred_start = txq->deferred_start; + qinfo->conf.tx_deferred_start = txq->flags & IONIC_QCQ_F_DEFERRED; } static inline void __rte_cold @@ -196,7 +196,8 @@ ionic_dev_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t tx_queue_id, } /* Do not start queue with rte_eth_dev_start() */ - txq->deferred_start = tx_conf->tx_deferred_start; + if (tx_conf->tx_deferred_start) + txq->flags |= IONIC_QCQ_F_DEFERRED; txq->offloads = offloads; @@ -605,7 +606,7 @@ ionic_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id, qinfo->mp = rxq->mb_pool; qinfo->scattered_rx = dev->data->scattered_rx; qinfo->nb_desc = q->num_descs; - qinfo->conf.rx_deferred_start = rxq->deferred_start; + qinfo->conf.rx_deferred_start = rxq->flags & IONIC_QCQ_F_DEFERRED; qinfo->conf.offloads = rxq->offloads; } @@ -703,7 +704,8 @@ ionic_dev_rx_queue_setup(struct rte_eth_dev *eth_dev, */ /* Do not start queue with rte_eth_dev_start() */ - rxq->deferred_start = rx_conf->rx_deferred_start; + if (rx_conf->rx_deferred_start) + rxq->flags |= IONIC_QCQ_F_DEFERRED; rxq->offloads = offloads; -- 2.20.1