From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf0-f67.google.com (mail-lf0-f67.google.com [209.85.215.67]) by dpdk.org (Postfix) with ESMTP id 7DC63A48F for ; Thu, 15 Mar 2018 08:52:24 +0100 (CET) Received: by mail-lf0-f67.google.com with SMTP id q69-v6so8664696lfi.10 for ; Thu, 15 Mar 2018 00:52:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=3fX06hADYyUG4wnC4UlRimd3DMTOjwSeKjnNbxDwwas=; b=hZsEJvyamaw8DxdkyqmeUsx0Zr5syFrUFswCCPksgQzk6PtaY6usHms9ATP/L7Y0ga 7Ugl2RsxeOdr+WuEFIuvDwbAEUUrIP1AqajZKr1cCvBus/7qTePoROvByTxLUH/Wl1II pZsuMDv6YgB4xiG+GFKBNB43WfmzlXddpTryrXDhli4DaBzWNGM8kOQ2Mqj+itXZAg/d MuhvaxNRBQR44oeQKcC0ah0KCh6ghttTTEsaHs83uH3/zfXgEClEaTCG3WThuE1iPvb/ z+VIUX2Y3Ddj0rBwLJvIx/Do54JURGYm0qCEgKNAy29EuISD6OomYN/oxmpm+KFpdPRK 2bMA== 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; bh=3fX06hADYyUG4wnC4UlRimd3DMTOjwSeKjnNbxDwwas=; b=QXCgmE5PQkpIN76ow54kA8MwZXTq/oDXKWMODf97x1IRgWccbsv4PDkjoBpMdkaEMN clCRC6WTxaOkt2YJ+tulMTrQ4NixWZ2gxR/0VdTM3RigEStFyeuPGCyG+wRjCMROY2PM HFXPrDGzIAb3YUKcuzhLjhoVjliEr0M2so0FPMzFRbgVr6GBPGJdXb4nvH8EUAvnIP5p N1pVnNSFgmcD9C2R9DPj59zmihMfhDB8HvxoayZKBHRelxpOqD5UcLPMlpt54Cld7CSW b9X911Ezo+90M1sawEpofszbgiz17Kowhvzdyvgunq2g+0viOSy5+WV/kddI2I8tOhaC KSHQ== X-Gm-Message-State: AElRT7FvIyBE2Qh9mrAYeQ5/06FTpuuXgyz8VElsZ/Aq65d6+KHFYU6M Rj9497ilwhc+Au9YkEMQNm1hO7FaKIk= X-Google-Smtp-Source: AG47ELtbdJ0wdUXkoplJtyW/S9urmdF1WrX0YuOzd1vU0pj5EsqJK9HBDPG4ZmYc/dDatPpe+gRxEg== X-Received: by 2002:a19:b516:: with SMTP id e22-v6mr5935085lff.47.1521100343795; Thu, 15 Mar 2018 00:52:23 -0700 (PDT) Received: from sh.semihalf.local (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.gmail.com with ESMTPSA id d14sm972925ljd.31.2018.03.15.00.52.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 15 Mar 2018 00:52:22 -0700 (PDT) From: Tomasz Duszynski To: dev@dpdk.org Cc: mw@semihalf.com, dima@marvell.com, nsamsono@marvell.com, jck@semihalf.com, jianbo.liu@arm.com, Tomasz Duszynski Date: Thu, 15 Mar 2018 08:52:04 +0100 Message-Id: <1521100324-26558-9-git-send-email-tdu@semihalf.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1521100324-26558-1-git-send-email-tdu@semihalf.com> References: <1520844132-29969-1-git-send-email-tdu@semihalf.com> <1521100324-26558-1-git-send-email-tdu@semihalf.com> Subject: [dpdk-dev] [PATCH v3 8/8] net/mrvl: add Tx queue start/stop 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: , X-List-Received-Date: Thu, 15 Mar 2018 07:52:24 -0000 Add Tx queue start/stop feature. Signed-off-by: Natalie Samsonov Signed-off-by: Tomasz Duszynski --- doc/guides/nics/mrvl.rst | 1 + drivers/net/mrvl/mrvl_ethdev.c | 92 +++++++++++++++++++++++++++++++++++++++++- 2 files changed, 91 insertions(+), 2 deletions(-) diff --git a/doc/guides/nics/mrvl.rst b/doc/guides/nics/mrvl.rst index 550bd79..f9ec9d6 100644 --- a/doc/guides/nics/mrvl.rst +++ b/doc/guides/nics/mrvl.rst @@ -73,6 +73,7 @@ Features of the MRVL PMD are: - Extended stats - QoS - RX flow control +- TX queue start/stop Limitations diff --git a/drivers/net/mrvl/mrvl_ethdev.c b/drivers/net/mrvl/mrvl_ethdev.c index bf596f4..fac924f 100644 --- a/drivers/net/mrvl/mrvl_ethdev.c +++ b/drivers/net/mrvl/mrvl_ethdev.c @@ -134,6 +134,7 @@ struct mrvl_txq { int port_id; uint64_t bytes_sent; struct mrvl_shadow_txq shadow_txqs[RTE_MAX_LCORE]; + int tx_deferred_start; }; static int mrvl_lcore_first; @@ -459,6 +460,70 @@ mrvl_dev_set_link_down(struct rte_eth_dev *dev) } /** + * DPDK callback to start tx queue. + * + * @param dev + * Pointer to Ethernet device structure. + * @param queue_id + * Transmit queue index. + * + * @return + * 0 on success, negative error value otherwise. + */ +static int +mrvl_tx_queue_start(struct rte_eth_dev *dev, uint16_t queue_id) +{ + struct mrvl_priv *priv = dev->data->dev_private; + int ret; + + if (!priv) + return -EPERM; + + /* passing 1 enables given tx queue */ + ret = pp2_ppio_set_outq_state(priv->ppio, queue_id, 1); + if (ret) { + RTE_LOG(ERR, PMD, "Failed to start txq %d\n", queue_id); + return ret; + } + + dev->data->tx_queue_state[queue_id] = RTE_ETH_QUEUE_STATE_STARTED; + + return 0; +} + +/** + * DPDK callback to stop tx queue. + * + * @param dev + * Pointer to Ethernet device structure. + * @param queue_id + * Transmit queue index. + * + * @return + * 0 on success, negative error value otherwise. + */ +static int +mrvl_tx_queue_stop(struct rte_eth_dev *dev, uint16_t queue_id) +{ + struct mrvl_priv *priv = dev->data->dev_private; + int ret; + + if (!priv->ppio) + return -EPERM; + + /* passing 0 disables given tx queue */ + ret = pp2_ppio_set_outq_state(priv->ppio, queue_id, 0); + if (ret) { + RTE_LOG(ERR, PMD, "Failed to stop txq %d\n", queue_id); + return ret; + } + + dev->data->tx_queue_state[queue_id] = RTE_ETH_QUEUE_STATE_STOPPED; + + return 0; +} + +/** * DPDK callback to start the device. * * @param dev @@ -472,7 +537,7 @@ mrvl_dev_start(struct rte_eth_dev *dev) { struct mrvl_priv *priv = dev->data->dev_private; char match[MRVL_MATCH_LEN]; - int ret = 0, def_init_size; + int ret = 0, i, def_init_size; snprintf(match, sizeof(match), "ppio-%d:%d", priv->pp_id, priv->ppio_id); @@ -559,6 +624,24 @@ mrvl_dev_start(struct rte_eth_dev *dev) goto out; } + /* start tx queues */ + for (i = 0; i < dev->data->nb_tx_queues; i++) { + struct mrvl_txq *txq = dev->data->tx_queues[i]; + + dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED; + + if (!txq->tx_deferred_start) + continue; + + /* + * All txqs are started by default. Stop them + * so that tx_deferred_start works as expected. + */ + ret = mrvl_tx_queue_stop(dev, i); + if (ret) + goto out; + } + return 0; out: RTE_LOG(ERR, PMD, "Failed to start device\n"); @@ -1330,9 +1413,11 @@ static void mrvl_txq_info_get(struct rte_eth_dev *dev, uint16_t tx_queue_id, struct rte_eth_txq_info *qinfo) { struct mrvl_priv *priv = dev->data->dev_private; + struct mrvl_txq *txq = dev->data->tx_queues[tx_queue_id]; qinfo->nb_desc = priv->ppio_params.outqs_params.outqs_params[tx_queue_id].size; + qinfo->conf.tx_deferred_start = txq->tx_deferred_start; } /** @@ -1643,7 +1728,7 @@ mrvl_tx_queue_offloads_okay(struct rte_eth_dev *dev, uint64_t requested) * @param socket * NUMA socket on which memory must be allocated. * @param conf - * Thresholds parameters. + * Tx queue configuration parameters. * * @return * 0 on success, negative error value otherwise. @@ -1671,6 +1756,7 @@ mrvl_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, txq->priv = priv; txq->queue_id = idx; txq->port_id = dev->data->port_id; + txq->tx_deferred_start = conf->tx_deferred_start; dev->data->tx_queues[idx] = txq; priv->ppio_params.outqs_params.outqs_params[idx].size = desc; @@ -1886,6 +1972,8 @@ static const struct eth_dev_ops mrvl_ops = { .rxq_info_get = mrvl_rxq_info_get, .txq_info_get = mrvl_txq_info_get, .vlan_filter_set = mrvl_vlan_filter_set, + .tx_queue_start = mrvl_tx_queue_start, + .tx_queue_stop = mrvl_tx_queue_stop, .rx_queue_setup = mrvl_rx_queue_setup, .rx_queue_release = mrvl_rx_queue_release, .tx_queue_setup = mrvl_tx_queue_setup, -- 2.7.4