From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 77340A09F0; Wed, 16 Dec 2020 22:15:15 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 20EB8CA30; Wed, 16 Dec 2020 22:13:38 +0100 (CET) Received: from mail-pg1-f175.google.com (mail-pg1-f175.google.com [209.85.215.175]) by dpdk.org (Postfix) with ESMTP id E3A02CA16 for ; Wed, 16 Dec 2020 22:13:34 +0100 (CET) Received: by mail-pg1-f175.google.com with SMTP id w16so18513418pga.9 for ; Wed, 16 Dec 2020 13:13:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pensando.io; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=BNvMlG6hvt/wHqDM4ng6uSSXIhmPdhANFyidDN2NeQU=; b=vvetOmEQVhjSohmX0YkB6ieQPlrdULqyVX6PDeWp3/17weSUspzeSVXqDV5fAg5Mpw BII29CDVzl/8PSYAIPBSqDJDTh+ooToExI5fC4qxp7WqOsiZIeIn/YBxhajVc7gvQydB T+NbWtszW4tTvPUpdRRMjJgsokZlDrn0jQIyMsc+ouua2A70GEWPtQOiInlZN9v5HCGw VJ9r2OCJG6Iwmu70FqkDHZEkc1LKmSalIxlxqZpu86EUb+Kz2XM/m/czGxhrWqbsCIc3 d5TejyHZb5W52B9Mh7X3dUDXp6Hh5ZVqrCCPmbhEGLjOjNBgh474LZVvNn+Z6C1uMyUS yutg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=BNvMlG6hvt/wHqDM4ng6uSSXIhmPdhANFyidDN2NeQU=; b=S/i44Y5awl8RJv953vYF6i8PDcxuK0y4bYsNe8Lp68eNTx7M3zUa164Yhfm1LeAN/H q78iKff6HuvURzgEmUBO3dyip4T9KNx0E1f9oqBpUvGKCxtIsON4YFVP1SrcMn79u2v/ 5FrHn/LnpdZXcoFsYmV5L9VfiQLbC0mJ9X98VqEfhwVt/g382kNV31kk5PTttaNM1i2n By9KKspX6FxC33UKRR/DiaKyNHs2OON+vR58SZX3nv0s5Vll3XOBICrrN/WwJcxnQmq/ hRKQYApoYQS/lrlzPxQdgIj0DswEP8bawXNsUwPPfOcGaBF9JpT4YEXzLDSg6OUw2jfu VcBA== X-Gm-Message-State: AOAM533oFo4bslwu4aYlJvXTbCWc1YqFG0kBGPn5FV6DdLdYGfyjCBUl ph+z5DonitYAvA52jAZcFMlU4I1XARN9Ww== X-Google-Smtp-Source: ABdhPJzrl0b6AicfZ1qbdffk/hNzFjCp8zpLTiBXWhwD1VHiVzs1rLQ9voIiI7UaT5gJ4buXFhT50g== X-Received: by 2002:a62:ae0c:0:b029:1a5:819d:9ac5 with SMTP id q12-20020a62ae0c0000b02901a5819d9ac5mr15318259pff.26.1608153212862; Wed, 16 Dec 2020 13:13:32 -0800 (PST) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id r67sm3345614pfc.82.2020.12.16.13.13.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Dec 2020 13:13:32 -0800 (PST) From: Andrew Boyer To: dev@dpdk.org Cc: Alfredo Cardigliano , Andrew Boyer Date: Wed, 16 Dec 2020 13:12:56 -0800 Message-Id: <20201216211257.37195-7-aboyer@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201216211257.37195-1-aboyer@pensando.io> References: <20201216211257.37195-1-aboyer@pensando.io> In-Reply-To: <20201210142231.63209-1-aboyer@pensando.io> References: <20201210142231.63209-1-aboyer@pensando.io> Subject: [dpdk-dev] [PATCH v2 6/7] net/ionic: improve queue state handling X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Skip ionic_lif_[rxq|txq]_init() in queue start if it's already done. Move ionic_lif_[rxq|txq]_deinit() from queue stop to queue release. This allows the queues to be restarted. Signed-off-by: Andrew Boyer --- drivers/net/ionic/ionic_rxtx.c | 62 +++++++++++++++++++++++----------- 1 file changed, 42 insertions(+), 20 deletions(-) diff --git a/drivers/net/ionic/ionic_rxtx.c b/drivers/net/ionic/ionic_rxtx.c index b689c8381..d06f1246c 100644 --- a/drivers/net/ionic/ionic_rxtx.c +++ b/drivers/net/ionic/ionic_rxtx.c @@ -125,6 +125,8 @@ ionic_dev_tx_queue_release(void *tx_queue) IONIC_PRINT_CALL(); + ionic_lif_txq_deinit(txq); + ionic_qcq_free(txq); } @@ -137,6 +139,9 @@ ionic_dev_tx_queue_stop(struct rte_eth_dev *eth_dev, uint16_t tx_queue_id) txq = eth_dev->data->tx_queues[tx_queue_id]; + eth_dev->data->tx_queue_state[tx_queue_id] = + RTE_ETH_QUEUE_STATE_STOPPED; + /* * Note: we should better post NOP Tx desc and wait for its completion * before disabling Tx queue @@ -146,11 +151,6 @@ ionic_dev_tx_queue_stop(struct rte_eth_dev *eth_dev, uint16_t tx_queue_id) ionic_tx_flush(&txq->cq); - ionic_lif_txq_deinit(txq); - - eth_dev->data->tx_queue_state[tx_queue_id] = - RTE_ETH_QUEUE_STATE_STOPPED; - return 0; } @@ -187,6 +187,9 @@ ionic_dev_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t tx_queue_id, eth_dev->data->tx_queues[tx_queue_id] = NULL; } + eth_dev->data->tx_queue_state[tx_queue_id] = + RTE_ETH_QUEUE_STATE_STOPPED; + err = ionic_tx_qcq_alloc(lif, tx_queue_id, nb_desc, &txq); if (err) { IONIC_PRINT(DEBUG, "Queue allocation failure"); @@ -210,22 +213,30 @@ ionic_dev_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t tx_queue_id, int __rte_cold ionic_dev_tx_queue_start(struct rte_eth_dev *eth_dev, uint16_t tx_queue_id) { + uint8_t *tx_queue_state = eth_dev->data->tx_queue_state; struct ionic_qcq *txq; int err; + if (tx_queue_state[tx_queue_id] == RTE_ETH_QUEUE_STATE_STARTED) { + IONIC_PRINT(DEBUG, "TX queue %u already started", + tx_queue_id); + return 0; + } + txq = eth_dev->data->tx_queues[tx_queue_id]; IONIC_PRINT(DEBUG, "Starting TX queue %u, %u descs", tx_queue_id, txq->q.num_descs); - err = ionic_lif_txq_init(txq); - if (err) - return err; + if (!(txq->flags & IONIC_QCQ_F_INITED)) { + err = ionic_lif_txq_init(txq); + if (err) + return err; + } ionic_qcq_enable(txq); - eth_dev->data->tx_queue_state[tx_queue_id] = - RTE_ETH_QUEUE_STATE_STARTED; + tx_queue_state[tx_queue_id] = RTE_ETH_QUEUE_STATE_STARTED; return 0; } @@ -634,6 +645,8 @@ ionic_dev_rx_queue_release(void *rx_queue) ionic_rx_empty(&rxq->q); + ionic_lif_rxq_deinit(rxq); + ionic_qcq_free(rxq); } @@ -682,6 +695,9 @@ ionic_dev_rx_queue_setup(struct rte_eth_dev *eth_dev, eth_dev->data->rx_queues[rx_queue_id] = NULL; } + eth_dev->data->rx_queue_state[rx_queue_id] = + RTE_ETH_QUEUE_STATE_STOPPED; + err = ionic_rx_qcq_alloc(lif, rx_queue_id, nb_desc, &rxq); if (err) { IONIC_PRINT(ERR, "Queue %d allocation failure", rx_queue_id); @@ -953,17 +969,26 @@ int __rte_cold ionic_dev_rx_queue_start(struct rte_eth_dev *eth_dev, uint16_t rx_queue_id) { uint32_t frame_size = eth_dev->data->dev_conf.rxmode.max_rx_pkt_len; + uint8_t *rx_queue_state = eth_dev->data->rx_queue_state; struct ionic_qcq *rxq; int err; + if (rx_queue_state[rx_queue_id] == RTE_ETH_QUEUE_STATE_STARTED) { + IONIC_PRINT(DEBUG, "RX queue %u already started", + rx_queue_id); + return 0; + } + rxq = eth_dev->data->rx_queues[rx_queue_id]; IONIC_PRINT(DEBUG, "Starting RX queue %u, %u descs (size: %u)", rx_queue_id, rxq->q.num_descs, frame_size); - err = ionic_lif_rxq_init(rxq); - if (err) - return err; + if (!(rxq->flags & IONIC_QCQ_F_INITED)) { + err = ionic_lif_rxq_init(rxq); + if (err) + return err; + } /* Allocate buffers for descriptor rings */ if (ionic_rx_fill(rxq, frame_size) != 0) { @@ -974,8 +999,7 @@ ionic_dev_rx_queue_start(struct rte_eth_dev *eth_dev, uint16_t rx_queue_id) ionic_qcq_enable(rxq); - eth_dev->data->rx_queue_state[rx_queue_id] = - RTE_ETH_QUEUE_STATE_STARTED; + rx_queue_state[rx_queue_id] = RTE_ETH_QUEUE_STATE_STARTED; return 0; } @@ -1044,16 +1068,14 @@ ionic_dev_rx_queue_stop(struct rte_eth_dev *eth_dev, uint16_t rx_queue_id) rxq = eth_dev->data->rx_queues[rx_queue_id]; + eth_dev->data->rx_queue_state[rx_queue_id] = + RTE_ETH_QUEUE_STATE_STOPPED; + ionic_qcq_disable(rxq); /* Flush */ ionic_rxq_service(&rxq->cq, -1, NULL); - ionic_lif_rxq_deinit(rxq); - - eth_dev->data->rx_queue_state[rx_queue_id] = - RTE_ETH_QUEUE_STATE_STOPPED; - return 0; } -- 2.17.1