net/ionic: convert boolean to flag bit
authorAndrew Boyer <aboyer@pensando.io>
Thu, 10 Dec 2020 02:57:34 +0000 (18:57 -0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 8 Jan 2021 15:03:04 +0000 (16:03 +0100)
This conserves resources.

Signed-off-by: Andrew Boyer <aboyer@pensando.io>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
drivers/net/ionic/ionic_lif.c
drivers/net/ionic/ionic_lif.h
drivers/net/ionic/ionic_rxtx.c

index bc15d75..2e33fb8 100644 (file)
@@ -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)
index 4e09171..8e2b424 100644 (file)
@@ -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)
index 2592f5c..b953aff 100644 (file)
@@ -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;