From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D541DA0C47; Tue, 15 Jun 2021 14:29:42 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 52F874067A; Tue, 15 Jun 2021 14:29:42 +0200 (CEST) Received: from mail-il1-f169.google.com (mail-il1-f169.google.com [209.85.166.169]) by mails.dpdk.org (Postfix) with ESMTP id 162DE40140 for ; Tue, 15 Jun 2021 14:29:41 +0200 (CEST) Received: by mail-il1-f169.google.com with SMTP id i12so5719769ila.13 for ; Tue, 15 Jun 2021 05:29:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=1KTQNE+GiFFZ9T24IAo2sK7/H7zpwAbFbb5QBW3f22E=; b=X86ZwOegUUdA21WgASGhV+E3LG9+qm7ob7Qc3sJMkPxDKEstDu1+lS1b22M4wSw9Cl Fe4wQWAOIZdjmPgFza7+GcTx1Rw9O3fXoQcbOImw0XT87oC0fxpFSQvFVovBizRYYX8y Cz3ByCpuAN4NJn441IARIBXYRpNC7G4WSKyAX5uvtIVZUrO5t1BdSp1ttVzwzpBc7sVU OEW9USp1NKrsYPTnorrZdnjUktSLJjPb0jGPHWDUZMIQjgfzRBwqANY0IjazRYI0sYVD 7loJ7nOGdq+t++pN/KJd0oBPxZ0Xd+Vhsgmw58yealpZ2Ieu+kWY75IbzhzUpq+ebqUs 9hgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=1KTQNE+GiFFZ9T24IAo2sK7/H7zpwAbFbb5QBW3f22E=; b=pEkeyLkMvPRJ+0HMsbrHGAx1RkqyuFMfPf/U0ObHsRENps5y7JJf3ozQ08jFmWgVoW 8g9/HglsCkNXZiMHEbujVnJV0yt+iJx7kuvr51lUFdDee0rDOlckpgqtC39fdZMb3lPB hGMqCnlqVgdLD9W5GDbJ+Tjx3Z8xNPx2yTwIv93qEERD276y6b4M4QIXW9zYoxUt86fU nKsVgmWY41mSaEIZbmyt01SG05X4I9Je9kTb791rQlGd1xRS62jAjibDkeOJI+03HDhe +Tb6nBdUIYa6wdlig3ZxwDntPexOJzzyDi6KhzS+ZiYtaMfkVVHY0fC4zpDmQKWeCPTn 1YYQ== X-Gm-Message-State: AOAM5334/9+W7ZAkoXxcWtt28NWcDsOGcH+MnGH8aipvJkKPd2JFnO5A BkHtCMiCqLxziDDOEwIoK66yGBcMOklBiFjM7Co= X-Google-Smtp-Source: ABdhPJy20JYo5uxHOHVF4jN4QiyV0R4CrLWEDYCdRFNM6AbAXj2vPfbMnYXsTsQ0CBOUw6NmlcntQZIiZ2KLAc4bGsI= X-Received: by 2002:a05:6e02:1b87:: with SMTP id h7mr16716669ili.271.1623760180326; Tue, 15 Jun 2021 05:29:40 -0700 (PDT) MIME-Version: 1.0 References: <20210306153404.10781-1-ndabilpuram@marvell.com> <20210607175943.31690-1-ndabilpuram@marvell.com> <20210607175943.31690-14-ndabilpuram@marvell.com> In-Reply-To: <20210607175943.31690-14-ndabilpuram@marvell.com> From: Jerin Jacob Date: Tue, 15 Jun 2021 17:59:24 +0530 Message-ID: To: Nithin Dabilpuram Cc: dpdk-dev , Jerin Jacob , Sunil Kumar Kori , Satha Koteswara Rao Kottidi , Pavan Nikhilesh , Kiran Kumar K , Satheesh Paul , Ashwin Sekhar Thalakalath Kottilveetil Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH v2 13/62] net/cnxk: add device configuration operation X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" On Mon, Jun 7, 2021 at 11:34 PM Nithin Dabilpuram wrote: > > Add device configuration op for CN9K and CN10K. Most of the > device configuration is common between two platforms except for > some supported offloads. > > Signed-off-by: Nithin Dabilpuram > +static int > +nix_restore_queue_cfg(struct rte_eth_dev *eth_dev) > +{ > + struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev); > + const struct eth_dev_ops *dev_ops = eth_dev->dev_ops; > + struct cnxk_eth_qconf *tx_qconf = dev->tx_qconf; > + struct cnxk_eth_qconf *rx_qconf = dev->rx_qconf; > + int rc, i, nb_rxq, nb_txq; > + void **txq, **rxq; > + > + nb_rxq = RTE_MIN(dev->nb_rxq, eth_dev->data->nb_rx_queues); > + nb_txq = RTE_MIN(dev->nb_txq, eth_dev->data->nb_tx_queues); > + > + rc = -ENOMEM; > + /* Setup tx & rx queues with previous configuration so > + * that the queues can be functional in cases like ports > + * are started without re configuring queues. > + * > + * Usual re config sequence is like below: > + * port_configure() { > + * if(reconfigure) { > + * queue_release() > + * queue_setup() > + * } > + * queue_configure() { > + * queue_release() > + * queue_setup() > + * } > + * } > + * port_start() This logic no more required as the KNI application fixed the bug. > + * > + * In some application's control path, queue_configure() would > + * NOT be invoked for TXQs/RXQs in port_configure(). > + * In such cases, queues can be functional after start as the > + * queues are already setup in port_configure(). > + */ > + for (i = 0; i < nb_txq; i++) { > + if (!tx_qconf[i].valid) > + continue; > + rc = dev_ops->tx_queue_setup(eth_dev, i, tx_qconf[i].nb_desc, 0, > + &tx_qconf[i].conf.tx); > + if (rc) { > + plt_err("Failed to setup tx queue rc=%d", rc); > + txq = eth_dev->data->tx_queues; > + for (i -= 1; i >= 0; i--) > + dev_ops->tx_queue_release(txq[i]); > + goto fail; > + } > + } > + > + free(tx_qconf); > + tx_qconf = NULL; > + > + for (i = 0; i < nb_rxq; i++) { > + if (!rx_qconf[i].valid) > + continue; > + rc = dev_ops->rx_queue_setup(eth_dev, i, rx_qconf[i].nb_desc, 0, > + &rx_qconf[i].conf.rx, > + rx_qconf[i].mp); > + if (rc) { > + plt_err("Failed to setup rx queue rc=%d", rc); > + rxq = eth_dev->data->rx_queues; > + for (i -= 1; i >= 0; i--) > + dev_ops->rx_queue_release(rxq[i]); > + goto tx_queue_release; > + } > + } > + > + free(rx_qconf); > + rx_qconf = NULL; > + > + return 0; > + > +tx_queue_release: > + txq = eth_dev->data->tx_queues; > + for (i = 0; i < eth_dev->data->nb_tx_queues; i++) > + dev_ops->tx_queue_release(txq[i]); > +fail: > + if (tx_qconf) > + free(tx_qconf); > + if (rx_qconf) > + free(rx_qconf); > + > + return rc; > +} > + >