From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0064.outbound.protection.outlook.com [104.47.36.64]) by dpdk.org (Postfix) with ESMTP id 80D181B257 for ; Sun, 8 Oct 2017 14:46:10 +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=VveJCBCK/iQLZJJ6v1JxKRJXGaRkjowjSrlm3+S/5aI=; b=J5mKD//HG6yG+HPz1HjZ9R/gt0xatlDP4ZFPR8jsLAJfQLxkCTeXNdoFAVVOn5D/ZEiubbKsC41BbEnBiQahwG+auGTeksYZxiksAt/QVBWqoV61+ciu2ey4wc0qxiiN/t013qyNQQlDujTBG5psU6NT5YlcJF93qDDCNh3LhbE= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Santosh.Shukla@cavium.com; Received: from localhost.localdomain (14.140.2.178) by BN6PR07MB3089.namprd07.prod.outlook.com (10.172.105.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Sun, 8 Oct 2017 12:46:07 +0000 From: Santosh Shukla To: dev@dpdk.org Cc: ferruh.yigit@intel.com, jerin.jacob@caviumnetworks.com, Santosh Shukla Date: Sun, 8 Oct 2017 18:14:23 +0530 Message-Id: <20171008124430.1866-20-santosh.shukla@caviumnetworks.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171008124430.1866-1-santosh.shukla@caviumnetworks.com> References: <20170831145436.5397-1-jerin.jacob@caviumnetworks.com> <20171008124430.1866-1-santosh.shukla@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [14.140.2.178] X-ClientProxiedBy: MA1PR01CA0113.INDPRD01.PROD.OUTLOOK.COM (10.174.56.157) To BN6PR07MB3089.namprd07.prod.outlook.com (10.172.105.7) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c58f4ec1-718a-421c-2476-08d50e4a8ca6 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254152)(2017052603199)(201703131423075)(201703031133081)(201702281549075); SRVR:BN6PR07MB3089; X-Microsoft-Exchange-Diagnostics: 1; BN6PR07MB3089; 3:ZDLmI3YbzMXhyfHX7nThw4bglncjPCpNEHMdC1EO7WNT8g9YwYguiuTAzCzKmbimdJEvcmeKhFIjpdEA0002J4jFCO3EI2iHXSl1LgU2L+M8idWD5rcKXi60akXi+5/6kH/1NW7o++D/AH0ajA2UFVHW6xnETbiehZnaaC7rYkeutC5WDc/bmgLdZa5AUwIIjPtj5OVCfqfZ+Eju8dSYzebpWkM/GTLXCLyoJxjFD2qy/P6JP2S7r/WsrJmKWtaD; 25:+lGt7OJ/gkPdL5+pm2BoSO+QP9QUoNlRC61i+39DYyEUeOWUqb4Ulf0NaBePPKg46NOIFJafWAOzFihN+lsU9ntY4cnK9QbrRnvvVAFk9sy/jzcAvu26tjZ//FfpppJD0W9g5gLUGjqfVjwe4P4nez4GnjR6Rg0ukmWC+/4hlzK1qqrLm0NNKsbMvAei5I2IfC2obqisiFznL0k4jC4FjTazqVc/BalIo68zGC3r8uiuhyXcrzDOs6sw0HdkF33bdwYu9O2nxnJzj0S2YV2Icl+lYRduczepKJfEdUYwig+2XiUZfT/vCrCmcHKysYABIz+XZg8G9OaBbAdw1EOOVg==; 31:jVNzADqwdTYQGttFbt+DR7JD59yHnWvfxy4MM42So2nfoT47sc94ptHUkvtpw7ud/8HJ/7ClQsTXnoDDFinH4ruY3rqjIoQu118uj2nvRBMeM0nT7VYa3agJ9961XqF7BHmeyfIm+PG12s4QwUdVISaNER8LImdF2TH4C3xiQVF2PSZuRgnOLXvEWAIK+mEi+z46vpUFwdWD5tdcoo5zZfX3W8N0cStXNiQlVI4Fhdw= X-MS-TrafficTypeDiagnostic: BN6PR07MB3089: X-Microsoft-Exchange-Diagnostics: 1; BN6PR07MB3089; 20:l6Xr8INpWY5Cog09uztC4+SFqvwiULFUBa3MYxW8LwDehz+UrQeUKIrlnNjEG141MF2KBJLuvWrh31sOeaa8ns3mIjrq5fgd8KcotCH0m8hrdiPS3+xmtaMmRTsbE0KqTNqF5lFrGHzIOYJ9Ln2pUkRxySYkJX61hLqzl1zoeiaMOQgqm/Jx/DUp8/VpCeMhSkB7bomLDpvou74qonKA3PvNZg4C4YnGLCEQGX51sU8WVnlSiTtZYCWNJxhcB5sM/pwGAmyeEfqUbbRw5ok72w+4ktjmTBoY+A6hUg0uW0o+bJKDVOVwPTgmVv6V49CtF9hABJUHLg58bclI/1cSTz6t4QE+V89iM5uqU2eEwg+Ah5OWJX6MkynubLYWWM8YN+BB7rwT00oKs2kAw6stO7YTempUuvyA1j1s540KHgTgyJoJ+JaH3XlIFbntlOiRnTZbEPfqJOy+xCdGATdKXeouGfldrAhLydtsEinBM+sLXREX+sYh300qphKvFAcSZORw97ZB6AYpEc2VD63hoCYhjlN79dLqihEMvnLBD4dMRU4K/ASSaeS3tXbFC6fFhX37enTi4saGsdAxNLjFL77jmO6Ir3K/UbSTVJHSbX0=; 4:26dx5645CcQSP6lworS2I6qOGQCu60M0CJi82f+ZkFOu/bggMF7lfGsrAkm0qjXMWCt8vv17LyXj6+TD/NNKVXnRG+Kmw8SIuSvBwjILC0j3vdsIfXTuMP2wQ8W1o7LdZLZjWQDwg2yb5NXguzaxZnmlxqOMoMRgbEL4b7paajXxjxsO9f86/+CXcwVuhdRUMxSnKmaNN31//jQGX3HBIIgJRh8EA8sLXZzahx91ArRPii5UViEeVHyu8wCw79th 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)(2401047)(8121501046)(5005006)(3002001)(10201501046)(93006095)(100000703101)(100105400095)(6041248)(20161123562025)(20161123558100)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123560025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BN6PR07MB3089; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BN6PR07MB3089; X-Forefront-PRVS: 0454444834 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6069001)(6009001)(376002)(346002)(199003)(189002)(6916009)(42882006)(81166006)(575784001)(2950100002)(81156014)(8936002)(50226002)(6486002)(16526018)(6666003)(189998001)(16586007)(316002)(6116002)(1076002)(6506006)(3846002)(7736002)(305945005)(8676002)(106356001)(105586002)(5009440100003)(53936002)(4326008)(66066001)(107886003)(47776003)(2906002)(5660300001)(6512007)(76176999)(5003940100001)(50986999)(97736004)(25786009)(101416001)(68736007)(48376002)(50466002)(478600001)(72206003)(2351001)(2361001)(33646002)(36756003)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR07MB3089; H:localhost.localdomain; 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; BN6PR07MB3089; 23:d0Uc5Ep82R2CxK2z5Vg7OjXCVLIBWeeWFSFezTwHZ?= =?us-ascii?Q?AIeP7MbRgwsXlBCdZfqEm0yfHtnyA0tyzWYbG1D38pxAH+IfZmcG7Gv6rBnj?= =?us-ascii?Q?lpz8P043qameZBOpGvIZDrbfsgIDiofITQqHwNVAIy51hQOAbfTSmjb/MQYl?= =?us-ascii?Q?MZbHsHt76rfHwvBiCa7oeLDtDMBQwAiVee8WpVBl52L5MYf1MpygqLOOQb93?= =?us-ascii?Q?Xii6asUmQpgIn/+QB6WZp0GCRgdNRSsWfHbOl1/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pamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Oct 2017 12:46:07.3414 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR07MB3089 Subject: [dpdk-dev] [PATCH v2 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: Sun, 08 Oct 2017 12:46:11 -0000 From: Jerin Jacob Signed-off-by: Jerin Jacob Co-authored-by: Santosh Shukla Signed-off-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