From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0068.outbound.protection.outlook.com [104.47.36.68]) by dpdk.org (Postfix) with ESMTP id 395327CD1 for ; Thu, 31 Aug 2017 16:56:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=zrMHNiFwIUGm8ILeD4e99Vk6kUhQ7WeqLx8qTkzC3m4=; b=YqTxXelpxhI5l3VEdNYjGqUD0Zgjkfjx33bEy3p+WREaqkZ59lA3QVyBd1nCIKzFmos9ImudvSCh4nssXonz2xIPPsPpPXiN4lcOCbtBw2aIhaVBsQShrQDKDC6kVBLNAfDC0nz3eJpeDSsgmGxjUWYGaNlHSwFk4IfCIJU5SQM= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jerin.JacobKollanukkaran@cavium.com; Received: from jerin.domain.name (171.76.126.71) by SN2PR07MB2526.namprd07.prod.outlook.com (2603:10b6:804:6::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.13.10; Thu, 31 Aug 2017 14:56:06 +0000 From: Jerin Jacob To: dev@dpdk.org Cc: ferruh.yigit@intel.com, santosh.shukla@caviumnetworks.com, Jerin Jacob Date: Thu, 31 Aug 2017 20:24:29 +0530 Message-Id: <20170831145436.5397-20-jerin.jacob@caviumnetworks.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170831145436.5397-1-jerin.jacob@caviumnetworks.com> References: <20170831145436.5397-1-jerin.jacob@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [171.76.126.71] X-ClientProxiedBy: MA1PR01CA0109.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:1::25) To SN2PR07MB2526.namprd07.prod.outlook.com (2603:10b6:804:6::26) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 83d5e2c6-49ec-49f9-ba49-08d4f0806946 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(300000502095)(300135100095)(22001)(2017030254152)(300000503095)(300135400095)(2017052603199)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:SN2PR07MB2526; X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2526; 3:iwrFTnsZ8PYdhBrJb/XTmQpGR4pIjh78sxGcERgM6mchp4EloGig7Gnu6M4PfCg0lDIOtxFrRK4DxfDeI5feTgpjI7Mycw1D2dpki86v9Bc0SPxhoz+SY747Xkde9kUZqAMVV4Irtx4xQ/hXt0/SEVCSwSR7s6A7byRm0n0q0FHod3h+T3eNQtCm5wzXAKstetH8K227ueBkjq7Ti11h2vpJYO92vTGdBcKthJbZl+jHjWwcwl0ebte+d30DthOJ; 25:WbgpwYbshxqAs/eRmI7z0f/E2ziQ8lHuXMMlsxYwuoVBFyAecPXM0aot3WCCYefh4XYF/BP4ZgzbeF1wnLFn1zzgGqUDXPnkNshregy2iSnYvrPpBTQw03IN2L1kBqBM6RMMzaxLtjg8D4FYNFCns/IjsYbYwtVb+pJnoCzxaGpHJgJGu0yML6b2ataasJj/V7jjljlqV7U6qCT8eFDfK+mR9fLQ4u/dNHPMH549IVHuzNb5T39xBlSRSEhg+vDi8HCeQgC12Jca4rZStChdWSMDkXKwPg/YTRN81V4UTqqK2vf6htpUtSnmUUr1xYz6wbz++pMwdH4DDnV3WbwAWQ==; 31:h3VGNoqLhtZD2IoB3/HHq+DNtCYEwr4/VQG7UnnitXbJYGNJECUqCZZlB4FHCC7fLkMxTCb1hm4gLustQZCTTm9IyH6eF8uwqXh7Gdma5aYaC8/CnWU7bz0LS0FcN9XHgKvrKd9JT7x+7gEfuZRROxzgV9F/t7I4wfEIyF5f/hF7wtN/xL/cqA8GriQyFDCxS/KQySZ9eezru2BTU+z2e9GybO6UEiPR87u0K69dWFE= X-MS-TrafficTypeDiagnostic: SN2PR07MB2526: X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2526; 20:73ZuRJ3A5VGKR6GK2lkGPO79wkduvrnDJLHMgfOggmZEF7KiMlLuq9Yd++C30XigNoGzZnRVyU64OylP/4baBmEZ5lovZIZ0MRLfTsm9jlWNyauQFd+Ixkpwja73DxdHdajmMz4+OOimpWlfcZnImaf+ucua0UNRJykXEq4X3GwAUEXruTUvyd4T35IgjNp90lvs/POCfn0W3PkuUC95z0FgAgB8TvSbOlj5RfWXOLcR7Gb3CePl/2XfhbSz7bYlX9YxwqY2H4/2x+vWzUWyOpwJrpJonI0g4Xib8CKLMgOQ7VLTdYH7n3cxVWRW0JEHoPP0++b7PP50eRV/BaSGl1JNqPxk4WW9Xh472jM2khJXfzFCX86AKiL5SVYlceu+veWoxaOSascikQXLBMI/QD+/Qk3jgxrmrDn365NYBj3h25nufx4F8MfHLd8cqsEiZD2mDRBJzSvMCKlX0rAqHLGCEDOlUKpff92rrdrir+5+5zcXH9Fycpz+KO5i1ZaSSUB8kcMlMHQl8snlLTOtG4tyAUcIEldjXW0d03cecIaUPGzS6yLM0g1J2zMcjqXOWDq1TmSNxchYOh2qtkBQB1KzzSdaX6ShEZQomWlkNkw=; 4:xgc+3zR7prV1gGtZX1CsV275bpzOgrLP7BcIGoq0fNd8A4CfoCx2tDUchS+zwN0tTCPlXStqryIvTTNIy19oPPaTslvCiyDTx+LyuTwx77gvYEcgRmlSjp4balOTWDyZqzrBk7fYpROMJpUMZIvG7M5I27UC9rjQ+ENkqLrqgGuPR0EoPnfEmj8h2yJmnjfmSqLROb9ubm+k7HHqPY4KOoXrvO10H+wpzAvKImqj13w1MMHWZ714VTKePXegplim X-Exchange-Antispam-Report-Test: UriScan:; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(5005006)(8121501046)(93006095)(100000703101)(100105400095)(10201501046)(3002001)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(20161123564025)(20161123562025)(20161123560025)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:SN2PR07MB2526; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:SN2PR07MB2526; X-Forefront-PRVS: 04163EF38A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(199003)(189002)(25786009)(1076002)(53936002)(3846002)(6116002)(575784001)(478600001)(110136004)(72206003)(7736002)(6666003)(107886003)(6512007)(305945005)(6506006)(36756003)(6486002)(68736007)(5003940100001)(189998001)(50986999)(42882006)(106356001)(101416001)(76176999)(2950100002)(6916009)(5660300001)(2361001)(33646002)(2351001)(2906002)(4326008)(97736004)(105586002)(48376002)(50466002)(81166006)(66066001)(69596002)(8936002)(47776003)(53416004)(8676002)(50226002)(81156014)(42186005); DIR:OUT; SFP:1101; SCL:1; SRVR:SN2PR07MB2526; H:jerin.domain.name; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN2PR07MB2526; 23:bnrlaIYwBStHcfZRRRLXDtKEWBUHxnXwTcTDZvnaA?= =?us-ascii?Q?6PetQN/epjUB/StAyaqF8Li6mxlfrYSHZSfb6OLTyGepym2Qsg5ItrojRz5L?= =?us-ascii?Q?MGvTC4/X2lvdDGqL+hh/eNfdywWiN8Tjp3cfevZyIp5QmuXQlaokhxa5w5bw?= =?us-ascii?Q?CFhWv4dTj9eP0O7EnfjWZLQl3dpFbMpAMhpStf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99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Aug 2017 14:56:06.1774 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN2PR07MB2526 Subject: [dpdk-dev] [PATCH 19/26] net/octeontx: add Rx queue setup and release ops 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, 31 Aug 2017 14:56:09 -0000 Signed-off-by: Jerin Jacob Co-authored-by: Santosh Shukla --- drivers/net/octeontx/octeontx_ethdev.c | 168 +++++++++++++++++++++++++++++++++ drivers/net/octeontx/octeontx_ethdev.h | 9 ++ 2 files changed, 177 insertions(+) diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c index d77859aea..034de113a 100644 --- a/drivers/net/octeontx/octeontx_ethdev.c +++ b/drivers/net/octeontx/octeontx_ethdev.c @@ -500,6 +500,172 @@ octeontx_dev_info(struct rte_eth_dev *dev, dev_info->tx_offload_capa = DEV_TX_OFFLOAD_MT_LOCKFREE; } +static int +octeontx_dev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t qidx, + uint16_t nb_desc, unsigned int socket_id, + const struct rte_eth_rxconf *rx_conf, + struct rte_mempool *mb_pool) +{ + struct octeontx_nic *nic = octeontx_pmd_priv(dev); + struct rte_mempool_ops *mp_ops = NULL; + struct octeontx_rxq *rxq = NULL; + pki_pktbuf_cfg_t pktbuf_conf; + pki_hash_cfg_t pki_hash; + pki_qos_cfg_t pki_qos; + uintptr_t pool; + int ret, port; + uint8_t gaura; + unsigned int ev_queues = (nic->ev_queues * nic->port_id) + qidx; + unsigned int ev_ports = (nic->ev_ports * nic->port_id) + qidx; + + RTE_SET_USED(nb_desc); + + memset(&pktbuf_conf, 0, sizeof(pktbuf_conf)); + memset(&pki_hash, 0, sizeof(pki_hash)); + memset(&pki_qos, 0, sizeof(pki_qos)); + + mp_ops = rte_mempool_get_ops(mb_pool->ops_index); + if (strcmp(mp_ops->name, "octeontx_fpavf")) { + octeontx_log_err("failed to find octeontx_fpavf mempool"); + return -ENOTSUP; + } + + /* Handle forbidden configurations */ + if (nic->pki.classifier_enable) { + octeontx_log_err("cannot setup queue %d. " + "Classifier option unsupported", qidx); + return -EINVAL; + } + + port = nic->port_id; + + /* Rx deferred start is not supported */ + if (rx_conf->rx_deferred_start) { + octeontx_log_err("rx deferred start not supported"); + return -EINVAL; + } + + /* Verify queue index */ + if (qidx >= dev->data->nb_rx_queues) { + octeontx_log_err("QID %d not supporteded (0 - %d available)\n", + qidx, (dev->data->nb_rx_queues - 1)); + return -ENOTSUP; + } + + /* Socket id check */ + if (socket_id != (unsigned int)SOCKET_ID_ANY && + socket_id != (unsigned int)nic->node) + PMD_RX_LOG(INFO, "socket_id expected %d, configured %d", + socket_id, nic->node); + + /* Allocating rx queue data structure */ + rxq = rte_zmalloc_socket("ethdev RX queue", sizeof(struct octeontx_rxq), + RTE_CACHE_LINE_SIZE, nic->node); + if (rxq == NULL) { + octeontx_log_err("failed to allocate rxq=%d", qidx); + return -ENOMEM; + } + + if (!nic->pki.initialized) { + pktbuf_conf.port_type = 0; + pki_hash.port_type = 0; + pki_qos.port_type = 0; + + pktbuf_conf.mmask.f_wqe_skip = 1; + pktbuf_conf.mmask.f_first_skip = 1; + pktbuf_conf.mmask.f_later_skip = 1; + pktbuf_conf.mmask.f_mbuff_size = 1; + pktbuf_conf.mmask.f_cache_mode = 1; + + pktbuf_conf.wqe_skip = OCTTX_PACKET_WQE_SKIP; + pktbuf_conf.first_skip = OCTTX_PACKET_FIRST_SKIP; + pktbuf_conf.later_skip = OCTTX_PACKET_LATER_SKIP; + pktbuf_conf.mbuff_size = (mb_pool->elt_size - + RTE_PKTMBUF_HEADROOM - + sizeof(struct rte_mbuf)); + + pktbuf_conf.cache_mode = PKI_OPC_MODE_STF2_STT; + + ret = octeontx_pki_port_pktbuf_config(port, &pktbuf_conf); + if (ret != 0) { + octeontx_log_err("fail to configure pktbuf for port %d", + port); + rte_free(rxq); + return ret; + } + PMD_RX_LOG(DEBUG, "Port %d Rx pktbuf configured:\n" + "\tmbuf_size:\t0x%0x\n" + "\twqe_skip:\t0x%0x\n" + "\tfirst_skip:\t0x%0x\n" + "\tlater_skip:\t0x%0x\n" + "\tcache_mode:\t%s\n", + port, + pktbuf_conf.mbuff_size, + pktbuf_conf.wqe_skip, + pktbuf_conf.first_skip, + pktbuf_conf.later_skip, + (pktbuf_conf.cache_mode == + PKI_OPC_MODE_STT) ? + "STT" : + (pktbuf_conf.cache_mode == + PKI_OPC_MODE_STF) ? + "STF" : + (pktbuf_conf.cache_mode == + PKI_OPC_MODE_STF1_STT) ? + "STF1_STT" : "STF2_STT"); + + if (nic->pki.hash_enable) { + pki_hash.tag_dlc = 1; + pki_hash.tag_slc = 1; + pki_hash.tag_dlf = 1; + pki_hash.tag_slf = 1; + octeontx_pki_port_hash_config(port, &pki_hash); + } + + pool = (uintptr_t)mb_pool->pool_id; + + /* Get the gpool Id */ + gaura = octeontx_fpa_bufpool_gpool(pool); + + pki_qos.qpg_qos = PKI_QPG_QOS_NONE; + pki_qos.num_entry = 1; + pki_qos.drop_policy = 0; + pki_qos.tag_type = 2L; + pki_qos.qos_entry[0].port_add = 0; + pki_qos.qos_entry[0].gaura = gaura; + pki_qos.qos_entry[0].ggrp_ok = ev_queues; + pki_qos.qos_entry[0].ggrp_bad = ev_queues; + pki_qos.qos_entry[0].grptag_bad = 0; + pki_qos.qos_entry[0].grptag_ok = 0; + + ret = octeontx_pki_port_create_qos(port, &pki_qos); + if (ret < 0) { + octeontx_log_err("failed to create QOS port=%d, q=%d", + port, qidx); + rte_free(rxq); + return ret; + } + nic->pki.initialized = true; + } + + rxq->port_id = nic->port_id; + rxq->eth_dev = dev; + rxq->queue_id = qidx; + rxq->evdev = nic->evdev; + rxq->ev_queues = ev_queues; + rxq->ev_ports = ev_ports; + + dev->data->rx_queues[qidx] = rxq; + dev->data->rx_queue_state[qidx] = RTE_ETH_QUEUE_STATE_STOPPED; + return 0; +} + +static void +octeontx_dev_rx_queue_release(void *rxq) +{ + rte_free(rxq); +} + /* Initialize and register driver with DPDK Application */ static const struct eth_dev_ops octeontx_dev_ops = { .dev_configure = octeontx_dev_configure, @@ -510,6 +676,8 @@ static const struct eth_dev_ops octeontx_dev_ops = { .stats_get = octeontx_dev_stats_get, .stats_reset = octeontx_dev_stats_reset, .mac_addr_set = octeontx_dev_default_mac_addr_set, + .rx_queue_setup = octeontx_dev_rx_queue_setup, + .rx_queue_release = octeontx_dev_rx_queue_release, }; /* Create Ethdev interface per BGX LMAC ports */ diff --git a/drivers/net/octeontx/octeontx_ethdev.h b/drivers/net/octeontx/octeontx_ethdev.h index 4c880f187..0c3452956 100644 --- a/drivers/net/octeontx/octeontx_ethdev.h +++ b/drivers/net/octeontx/octeontx_ethdev.h @@ -91,4 +91,13 @@ struct octeontx_nic { uint16_t ev_ports; } __rte_cache_aligned; +struct octeontx_rxq { + uint16_t queue_id; + uint16_t port_id; + uint8_t evdev; + struct rte_eth_dev *eth_dev; + uint16_t ev_queues; + uint16_t ev_ports; +} __rte_cache_aligned; + #endif /* __OCTEONTX_ETHDEV_H__ */ -- 2.14.1