From patchwork Fri Jun 15 16:52:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jasvinder Singh X-Patchwork-Id: 41214 X-Patchwork-Delegate: cristian.dumitrescu@intel.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CE8671C11E; Fri, 15 Jun 2018 18:53:23 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 7F0011C01E for ; Fri, 15 Jun 2018 18:52:45 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Jun 2018 09:52:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,227,1526367600"; d="scan'208";a="237791147" Received: from silpixa00381635.ir.intel.com (HELO silpixa00381635.ger.corp.intel.com) ([10.237.222.149]) by fmsmga006.fm.intel.com with ESMTP; 15 Jun 2018 09:52:44 -0700 From: Jasvinder Singh To: dev@dpdk.org Cc: cristian.dumitrescu@intel.com Date: Fri, 15 Jun 2018 17:52:22 +0100 Message-Id: <20180615165224.25004-21-jasvinder.singh@intel.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20180615165224.25004-1-jasvinder.singh@intel.com> References: <20180608124155.140663-2-jasvinder.singh@intel.com> <20180615165224.25004-1-jasvinder.singh@intel.com> Subject: [dpdk-dev] [PATCH v2 20/22] net/softnic: receive and transmit queue setup 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" Implements softnic receive and transmit queues setup using swq object. Signed-off-by: Cristian Dumitrescu Signed-off-by: Jasvinder Singh --- drivers/net/softnic/rte_eth_softnic.c | 62 ++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/drivers/net/softnic/rte_eth_softnic.c b/drivers/net/softnic/rte_eth_softnic.c index 0f445a8..1b75708 100644 --- a/drivers/net/softnic/rte_eth_softnic.c +++ b/drivers/net/softnic/rte_eth_softnic.c @@ -88,26 +88,27 @@ static int pmd_rx_queue_setup(struct rte_eth_dev *dev, uint16_t rx_queue_id, uint16_t nb_rx_desc, - unsigned int socket_id, + unsigned int socket_id __rte_unused, const struct rte_eth_rxconf *rx_conf __rte_unused, struct rte_mempool *mb_pool __rte_unused) { - uint32_t size = RTE_ETH_NAME_MAX_LEN + strlen("_rxq") + 4; - char name[size]; - struct rte_ring *r; - - snprintf(name, sizeof(name), "%s_rxq%04x", - dev->data->name, - rx_queue_id); - - r = rte_ring_create(name, - nb_rx_desc, - socket_id, - RING_F_SP_ENQ | RING_F_SC_DEQ); - if (r == NULL) + char name[NAME_SIZE]; + struct pmd_internals *p = dev->data->dev_private; + struct swq *swq; + + struct swq_params params = { + .size = nb_rx_desc, + }; + + snprintf(name, sizeof(name), "RXQ%u", rx_queue_id); + + swq = swq_create(p, + name, + ¶ms); + if (swq == NULL) return -1; - dev->data->rx_queues[rx_queue_id] = r; + dev->data->rx_queues[rx_queue_id] = swq->r; return 0; } @@ -115,25 +116,26 @@ static int pmd_tx_queue_setup(struct rte_eth_dev *dev, uint16_t tx_queue_id, uint16_t nb_tx_desc, - unsigned int socket_id, + unsigned int socket_id __rte_unused, const struct rte_eth_txconf *tx_conf __rte_unused) { - uint32_t size = RTE_ETH_NAME_MAX_LEN + strlen("_txq") + 4; - char name[size]; - struct rte_ring *r; - - snprintf(name, sizeof(name), "%s_txq%04x", - dev->data->name, - tx_queue_id); - - r = rte_ring_create(name, - nb_tx_desc, - socket_id, - RING_F_SP_ENQ | RING_F_SC_DEQ); - if (r == NULL) + char name[NAME_SIZE]; + struct pmd_internals *p = dev->data->dev_private; + struct swq *swq; + + struct swq_params params = { + .size = nb_tx_desc, + }; + + snprintf(name, sizeof(name), "TXQ%u", tx_queue_id); + + swq = swq_create(p, + name, + ¶ms); + if (swq == NULL) return -1; - dev->data->tx_queues[tx_queue_id] = r; + dev->data->tx_queues[tx_queue_id] = swq->r; return 0; }