From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 5AE6B727F for ; Fri, 8 Jun 2018 14:42:22 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Jun 2018 05:42:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,490,1520924400"; d="scan'208";a="235505404" Received: from silpixa00381635.ir.intel.com (HELO silpixa00381635.ger.corp.intel.com) ([10.237.222.149]) by fmsmga005.fm.intel.com with ESMTP; 08 Jun 2018 05:42:18 -0700 From: Jasvinder Singh To: dev@dpdk.org Cc: cristian.dumitrescu@intel.com Date: Fri, 8 Jun 2018 13:41:55 +0100 Message-Id: <20180608124155.140663-22-jasvinder.singh@intel.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20180608124155.140663-1-jasvinder.singh@intel.com> References: <20180608124155.140663-1-jasvinder.singh@intel.com> Subject: [dpdk-dev] [PATCH 21/21] net/softnic: start and stop function 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: Fri, 08 Jun 2018 12:42:24 -0000 Implements softnic start and stop function. Signed-off-by: Cristian Dumitrescu Signed-off-by: Jasvinder Singh --- drivers/net/softnic/rte_eth_softnic.c | 38 ++++++++++++++++++------- drivers/net/softnic/rte_eth_softnic_internals.h | 6 ++++ drivers/net/softnic/rte_eth_softnic_pipeline.c | 12 ++++++++ drivers/net/softnic/rte_eth_softnic_swq.c | 16 +++++++++++ 4 files changed, 62 insertions(+), 10 deletions(-) diff --git a/drivers/net/softnic/rte_eth_softnic.c b/drivers/net/softnic/rte_eth_softnic.c index e91e1cb..58d63cd 100644 --- a/drivers/net/softnic/rte_eth_softnic.c +++ b/drivers/net/softnic/rte_eth_softnic.c @@ -142,6 +142,18 @@ pmd_tx_queue_setup(struct rte_eth_dev *dev, static int pmd_dev_start(struct rte_eth_dev *dev) { + struct pmd_internals *p = dev->data->dev_private; + int status; + + /* Firmware UP */ + status = cli_script_process(p, + p->params.script, + conn_params_default.msg_in_len_max, + conn_params_default.msg_out_len_max); + if (status) + return status; + + /* Link UP */ dev->data->dev_link.link_status = ETH_LINK_UP; return 0; @@ -150,21 +162,27 @@ pmd_dev_start(struct rte_eth_dev *dev) static void pmd_dev_stop(struct rte_eth_dev *dev) { + struct pmd_internals *p = dev->data->dev_private; + + /* Link DOWN */ dev->data->dev_link.link_status = ETH_LINK_DOWN; + + /* Firmware DOWN */ + pipeline_disable_all(p); + pipeline_free(p); + table_action_profile_free(p); + port_in_action_profile_free(p); + tap_free(p); + tmgr_free(p); + link_free(p); + swq_free_keep_rxq_txq(p); + mempool_free(p); } static void -pmd_dev_close(struct rte_eth_dev *dev) +pmd_dev_close(struct rte_eth_dev *dev __rte_unused) { - uint32_t i; - - /* RX queues */ - for (i = 0; i < dev->data->nb_rx_queues; i++) - rte_ring_free((struct rte_ring *)dev->data->rx_queues[i]); - - /* TX queues */ - for (i = 0; i < dev->data->nb_tx_queues; i++) - rte_ring_free((struct rte_ring *)dev->data->tx_queues[i]); + return; } static int diff --git a/drivers/net/softnic/rte_eth_softnic_internals.h b/drivers/net/softnic/rte_eth_softnic_internals.h index 4d09a63..83b0c54 100644 --- a/drivers/net/softnic/rte_eth_softnic_internals.h +++ b/drivers/net/softnic/rte_eth_softnic_internals.h @@ -550,6 +550,9 @@ swq_init(struct pmd_internals *p); void swq_free(struct pmd_internals *p); +void +swq_free_keep_rxq_txq(struct pmd_internals *p); + struct swq * swq_find(struct pmd_internals *p, const char *name); @@ -672,6 +675,9 @@ pipeline_init(struct pmd_internals *p); void pipeline_free(struct pmd_internals *p); +void +pipeline_disable_all(struct pmd_internals *p); + struct pipeline * pipeline_find(struct pmd_internals *p, const char *name); diff --git a/drivers/net/softnic/rte_eth_softnic_pipeline.c b/drivers/net/softnic/rte_eth_softnic_pipeline.c index 7382288..16fc93b 100644 --- a/drivers/net/softnic/rte_eth_softnic_pipeline.c +++ b/drivers/net/softnic/rte_eth_softnic_pipeline.c @@ -61,6 +61,18 @@ pipeline_free(struct pmd_internals *p) } } +void +pipeline_disable_all(struct pmd_internals *p) +{ + struct pipeline *pipeline; + + TAILQ_FOREACH(pipeline, &p->pipeline_list, node) + if (pipeline->enabled) + thread_pipeline_disable(p, + pipeline->thread_id, + pipeline->name); +} + struct pipeline * pipeline_find(struct pmd_internals *p, const char *name) diff --git a/drivers/net/softnic/rte_eth_softnic_swq.c b/drivers/net/softnic/rte_eth_softnic_swq.c index d385dd1..e53da92 100644 --- a/drivers/net/softnic/rte_eth_softnic_swq.c +++ b/drivers/net/softnic/rte_eth_softnic_swq.c @@ -33,6 +33,22 @@ swq_free(struct pmd_internals *p) } } +void +swq_free_keep_rxq_txq(struct pmd_internals *p) +{ + struct swq *swq; + + TAILQ_FOREACH(swq, &p->swq_list, node) { + if ((strncmp(swq->name, "RXQ", strlen("RXQ")) == 0) || + (strncmp(swq->name, "TXQ", strlen("TXQ")) == 0)) + continue; + + TAILQ_REMOVE(&p->swq_list, swq, node); + rte_ring_free(swq->r); + free(swq); + } +} + struct swq * swq_find(struct pmd_internals *p, const char *name) -- 2.9.3