From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0074.outbound.protection.outlook.com [104.47.42.74]) by dpdk.org (Postfix) with ESMTP id C42A958C8 for ; Fri, 30 Sep 2016 14:06:42 +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=/YZKZWx8ajTvjxsYhmxgPkJDNrqA4YYRf3DfjgVkrXU=; b=ZRHPaeLmPCihtOyUUltT5OuadOPp//fyZG9hOBRhX+Cz6Lu2GaAxeHwU4V46tL2TPDwgP0YQ3w7QJambc5YFTD22dbWMGPe4opwVx0CgAZFWLTJgR/Iey7sKND0ROXER9toYHzKNDwRk9RAUDZR4zmCE8V0eAJnERh8osajaMcM= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Kamil.Rytarowski@cavium.com; Received: from cavium1.semihalf.local (31.172.191.173) by CY4PR07MB3063.namprd07.prod.outlook.com (10.172.116.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.549.15; Fri, 30 Sep 2016 12:06:39 +0000 From: Kamil Rytarowski To: CC: , , , , , , , Kamil Rytarowski Date: Fri, 30 Sep 2016 14:05:40 +0200 Message-ID: <1475237154-25388-2-git-send-email-krytarowski@caviumnetworks.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1475237154-25388-1-git-send-email-krytarowski@caviumnetworks.com> References: <1472230448-17490-1-git-send-email-krytarowski@caviumnetworks.com> <1475237154-25388-1-git-send-email-krytarowski@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [31.172.191.173] X-ClientProxiedBy: VI1PR07CA0001.eurprd07.prod.outlook.com (10.163.160.139) To CY4PR07MB3063.namprd07.prod.outlook.com (10.172.116.144) X-MS-Office365-Filtering-Correlation-Id: 61d48b70-4930-4f89-ba36-08d3e92a3cf4 X-Microsoft-Exchange-Diagnostics: 1; CY4PR07MB3063; 2:JownZAweGlXYAuaisFDo2G+xaYGsfn1ArBU8WYdadUkkYChCafGaJzLxqfkqhOpbKPhWPajNMOsjEQs6dI/Z7Z4EL3xr5r3aoET2WzJu8J6KMLqH2IeZF02QpCmLcgf/Z/j7U3P+HcO+INVgU4nixbtai9uqCbKfsp1sC7ICtjDxC9Y/GJMt5odPr954EpAB; 3:W4nsYyw8KgipY/GgpWhO+C6CPAPYR1nOARb4KzXbH+rlmjJ8QY3FyUvoc6IqXFY9tCVT47xzWRmqVu65sThV7Ucpnn2M4Hq8YMq2lehMtKEa6zzRN7C3uYiDvbiWgaIu; 25:QA5tuJLVPZeK3QOapw2lqtwsBnaeQ5MKdG6+OZlfPaQN2IjcDtKWv9tUU0p/YzVumXCQMZZqC86L6WmWpCuNZAoyMCm9WZQBf5uoUrhOfsC2Kvl+zlY87OZsT/bifdBzGspmsXUCyx/SL6vvhpcebsW+qXTPPlVYKrKr7nCl+EKI5MDCt1SkVFDmbj8yOX2XssCAhnwcwtP8hM/i/RBkYfKgsNkiVfOlLYq+GhWQPXLZ429AX9naGanAKqxJFtcdUhiv8mGJdgDyJESnLievyHmRhQDxqX7qBINXjgXVN9CCHUDPV4IpaZBwfqjPPh/2nyNXlmBcqcjWfoa2vGCAf3KiKyfDu5hzoNzlDtF4F18B++23oLLYGnEBllXvbMVvsEthvaVYVkeL6tB8Wdq+SWi4e33KgKlZ86E3oJdcNxU= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY4PR07MB3063; X-Microsoft-Exchange-Diagnostics: 1; CY4PR07MB3063; 31:Cax0Hwe0M1tIb25qaqHfM14q3/XWxBkS9RFfPae8rkfXE1S5LOgz+f6iWdiNKx7Hp1F0NUIvs2e9M0m2UHdgihQoYjFWyTHMXALd5YDZmAfBilthTTbusJZQ4V0OZJ36eHL8WhDb8H2mvpQwlgscetCqj4WrZY4AScDOLwYYb6rOeuHdWjEGfCuUrFKgzNE9sgLvHXj0bsaT5NhWHvQfvPT2aU6TxF7eOlQKSLnXO0U=; 20:PCTla2qg+aZ0kQXc1h6GwKJJ9vhVC9rB4Zb2bI3PrnOFGEhazif2sqaF4gG7qFc4fK8TqvjncMl0RLuSeALKY77JAOZairJHWG7ZHOVcjl+hlVB57kvPQV+Pu/KqJatBP/s4J4pVaFqvPWFJm2FJ6CXnRsDmeT4u164B0OK/yeI+0SZYWAOQGzqUruibQwQJzO/AQ0BoBR9Wt6b+LiouAlyyRZBu9GI6jnSaMdNP+Fxtc9gqabRFEPmsyXeEm52+tMnk1dMvvlQ5OXgT/d1eTlVi3zJ+GjT0Vh++IxbQu9azTgeJtP2SUqpNMMdU2izQ0RXg5qQ14ggdpx0+u/K1AGL5bnvSlHenflOG8MB9RXVWUJfEWymNcys8kur1BX+u8KFHs62xNlHmVo5QDVD/KRKHujNaQnkEY68CTAmD2GFK7rmKdI0GiMTmsjpnbdemvvHCXHKozVwPq5tJOzyk3XTsJ3t1UH577yRezuWNTzKayycEXlxYuGLAaq/Rkcs/8X+8bTetkfLnFjO5GtV77/3e2i4KiYNOdFMwD17N7dJ2IrQrRj4AgxgPtldicTHTQ2JEM2Rx9odqXbvbrbjeVUUUHBkA9cXqnZHtyUgxh4w= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001); SRVR:CY4PR07MB3063; BCL:0; PCL:0; RULEID:; SRVR:CY4PR07MB3063; X-Microsoft-Exchange-Diagnostics: 1; CY4PR07MB3063; 4:CViVIEZ38rE4jqGCnerDhSq/3gODS0tHZqyyIplT+dcC/NOLwfjG5x98/wqKQkVhWXrHr4E3ttxEqxLKQFGSOOSjPNG0nyDiBV/NKQu7x3K7sYaVLVmtHkz4koql7ZZOI+QPz/DZOPz2A9siNVv8uhx1MbywppeC5/8NCl7nDWHkKy0A/4z9npfPWYTf1QQaegcCyLRmnslwEqGH7sGa+uXmzp9m+jvASNnpJMzn2N6/d2z0aeDLe9S6EZKXDR5Trmi4TvZBw4hE/8l965v9Y2Xm/Kcdc/McqAE6AlBSuWCMaT1/edmaaiC/fojEtGn3ly6/vir6BWQ74yJ5NBQixLZIkgVsX/6PCkfqXLyyHwcPcYGNL6UGeBHnh2zJTGHxABShLiR67xVw6Gxm2K+U1g== X-Forefront-PRVS: 008184426E X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(189002)(199003)(92566002)(3846002)(66066001)(189998001)(47776003)(42882006)(36756003)(105586002)(19580395003)(97736004)(6916009)(6666003)(68736007)(42186005)(19580405001)(50986999)(50226002)(77096005)(76176999)(5003940100001)(6116002)(7736002)(2950100002)(101416001)(586003)(106356001)(7846002)(5660300001)(4001430100002)(305945005)(33646002)(229853001)(110136003)(8676002)(4326007)(81166006)(107886002)(81156014)(50466002)(2906002)(48376002)(2351001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR07MB3063; H:cavium1.semihalf.local; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A: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; CY4PR07MB3063; 23:TysbTdsOK8SRSWn9GFjRxlGmLfLf5zrrjvvAio48Y?= =?us-ascii?Q?yP4ZV/EMb/aIcb3xBJY1QReuCpUBUuNbdPGPrXwUwNhAtrlr8ri82Lq690uP?= =?us-ascii?Q?1FrCmmFHFE6p47+ZRdHj/tmrBDMlNHYVI+cazpBdGrlQpN9VySTnc9yvSbtD?= =?us-ascii?Q?2AX2jQsnRSypkUo+Evyge/3aVYjCr1UPb4J/8C9Jbu4iI8Q7iVB8D1y/d1aT?= =?us-ascii?Q?EgJper1EH1fGmnrLUCkFrCF3ZN3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agnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Sep 2016 12:06:39.3087 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR07MB3063 Subject: [dpdk-dev] [PATCH v2 01/15] net/thunderx: cleanup the driver before adding new features X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Sep 2016 12:06:43 -0000 From: Kamil Rytarowski Refactored features: - enable nicvf_qset_rbdr_precharge to handle secondary queue sets - rte_free already handles NULL pointer - check mempool flags to predict being contiguous in memory - prohibit to use mempool with multiple memory chunks - simplify local construct of accessing nb_rx_queues - enable NICVF_CAP_CQE_RX2 on CN88XX PASS2.0 hardware. - remove redundant check for RSS size in nicvf_eth_dev_init Signed-off-by: Maciej Czekaj Signed-off-by: Kamil Rytarowski Signed-off-by: Zyta Szpak Signed-off-by: Slawomir Rosek Signed-off-by: Radoslaw Biernacki Signed-off-by: Jerin Jacob --- drivers/net/thunderx/base/nicvf_hw.c | 10 +++++----- drivers/net/thunderx/base/nicvf_hw.h | 6 +++--- drivers/net/thunderx/nicvf_ethdev.c | 37 ++++++++++++++++++------------------ 3 files changed, 26 insertions(+), 27 deletions(-) diff --git a/drivers/net/thunderx/base/nicvf_hw.c b/drivers/net/thunderx/base/nicvf_hw.c index 4bdd183..1f08ef2 100644 --- a/drivers/net/thunderx/base/nicvf_hw.c +++ b/drivers/net/thunderx/base/nicvf_hw.c @@ -141,7 +141,7 @@ nicvf_base_init(struct nicvf *nic) return NICVF_ERR_BASE_INIT; if (nicvf_hw_version(nic) == PCI_SUB_DEVICE_ID_CN88XX_PASS2_NICVF) - nic->hwcap |= NICVF_CAP_TUNNEL_PARSING; + nic->hwcap |= NICVF_CAP_TUNNEL_PARSING | NICVF_CAP_CQE_RX2; if (nicvf_hw_version(nic) == PCI_SUB_DEVICE_ID_CN81XX_NICVF) nic->hwcap |= NICVF_CAP_TUNNEL_PARSING | NICVF_CAP_CQE_RX2; @@ -497,9 +497,9 @@ nicvf_qsize_rbdr_roundup(uint32_t val) } int -nicvf_qset_rbdr_precharge(struct nicvf *nic, uint16_t ridx, - rbdr_pool_get_handler handler, - void *opaque, uint32_t max_buffs) +nicvf_qset_rbdr_precharge(void *dev, struct nicvf *nic, + uint16_t ridx, rbdr_pool_get_handler handler, + uint32_t max_buffs) { struct rbdr_entry_t *desc, *desc0; struct nicvf_rbdr *rbdr = nic->rbdr; @@ -514,7 +514,7 @@ nicvf_qset_rbdr_precharge(struct nicvf *nic, uint16_t ridx, if (count >= max_buffs) break; desc0 = desc + count; - phy = handler(opaque); + phy = handler(dev, nic); if (phy) { desc0->full_addr = phy; count++; diff --git a/drivers/net/thunderx/base/nicvf_hw.h b/drivers/net/thunderx/base/nicvf_hw.h index a6cda82..2b8738b 100644 --- a/drivers/net/thunderx/base/nicvf_hw.h +++ b/drivers/net/thunderx/base/nicvf_hw.h @@ -85,7 +85,7 @@ enum nicvf_err_e { NICVF_ERR_RSS_GET_SZ, /* -8171 */ }; -typedef nicvf_phys_addr_t (*rbdr_pool_get_handler)(void *opaque); +typedef nicvf_phys_addr_t (*rbdr_pool_get_handler)(void *dev, void *opaque); struct nicvf_hw_rx_qstats { uint64_t q_rx_bytes; @@ -194,8 +194,8 @@ int nicvf_qset_reclaim(struct nicvf *nic); int nicvf_qset_rbdr_config(struct nicvf *nic, uint16_t qidx); int nicvf_qset_rbdr_reclaim(struct nicvf *nic, uint16_t qidx); -int nicvf_qset_rbdr_precharge(struct nicvf *nic, uint16_t ridx, - rbdr_pool_get_handler handler, void *opaque, +int nicvf_qset_rbdr_precharge(void *dev, struct nicvf *nic, + uint16_t ridx, rbdr_pool_get_handler handler, uint32_t max_buffs); int nicvf_qset_rbdr_active(struct nicvf *nic, uint16_t qidx); diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c index 914035e..3cf32bf 100644 --- a/drivers/net/thunderx/nicvf_ethdev.c +++ b/drivers/net/thunderx/nicvf_ethdev.c @@ -691,7 +691,7 @@ nicvf_configure_cpi(struct rte_eth_dev *dev) int ret; /* Count started rx queues */ - for (qidx = qcnt = 0; qidx < nic->eth_dev->data->nb_rx_queues; qidx++) + for (qidx = qcnt = 0; qidx < dev->data->nb_rx_queues; qidx++) if (dev->data->rx_queue_state[qidx] == RTE_ETH_QUEUE_STATE_STARTED) qcnt++; @@ -1023,12 +1023,9 @@ nicvf_stop_rx_queue(struct rte_eth_dev *dev, uint16_t qidx) static void nicvf_dev_rx_queue_release(void *rx_queue) { - struct nicvf_rxq *rxq = rx_queue; - PMD_INIT_FUNC_TRACE(); - if (rxq) - rte_free(rxq); + rte_free(rx_queue); } static int @@ -1070,6 +1067,7 @@ nicvf_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t qidx) return nicvf_stop_tx_queue(dev, qidx); } + static int nicvf_dev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t qidx, uint16_t nb_desc, unsigned int socket_id, @@ -1087,9 +1085,15 @@ nicvf_dev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t qidx, PMD_DRV_LOG(WARNING, "socket_id expected %d, configured %d", socket_id, nic->node); - /* Mempool memory should be contiguous */ + /* Mempool memory must be contiguous, so must be one memory segment*/ if (mp->nb_mem_chunks != 1) { - PMD_INIT_LOG(ERR, "Non contiguous mempool, check huge page sz"); + PMD_INIT_LOG(ERR, "Non-contiguous mempool, add more huge pages"); + return -EINVAL; + } + + /* Mempool memory must be physically contiguous */ + if (mp->flags & MEMPOOL_F_NO_PHYS_CONTIG) { + PMD_INIT_LOG(ERR, "Mempool memory must be physically contiguous"); return -EINVAL; } @@ -1212,15 +1216,16 @@ nicvf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) } static nicvf_phys_addr_t -rbdr_rte_mempool_get(void *opaque) +rbdr_rte_mempool_get(void *dev, void *opaque) { uint16_t qidx; uintptr_t mbuf; struct nicvf_rxq *rxq; - struct nicvf *nic = nicvf_pmd_priv((struct rte_eth_dev *)opaque); + struct rte_eth_dev *eth_dev = (struct rte_eth_dev *)dev; + struct nicvf *nic __rte_unused = (struct nicvf *)opaque; - for (qidx = 0; qidx < nic->eth_dev->data->nb_rx_queues; qidx++) { - rxq = nic->eth_dev->data->rx_queues[qidx]; + for (qidx = 0; qidx < eth_dev->data->nb_rx_queues; qidx++) { + rxq = eth_dev->data->rx_queues[qidx]; /* Maintain equal buffer count across all pools */ if (rxq->precharge_cnt >= rxq->qlen_mask) continue; @@ -1354,8 +1359,8 @@ nicvf_dev_start(struct rte_eth_dev *dev) } /* Fill rte_mempool buffers in RBDR pool and precharge it */ - ret = nicvf_qset_rbdr_precharge(nic, 0, rbdr_rte_mempool_get, - dev, total_rxq_desc); + ret = nicvf_qset_rbdr_precharge(dev, nic, 0, rbdr_rte_mempool_get, + total_rxq_desc); if (ret) { PMD_INIT_LOG(ERR, "Failed to fill rbdr %d", ret); goto qset_rbdr_reclaim; @@ -1721,12 +1726,6 @@ nicvf_eth_dev_init(struct rte_eth_dev *eth_dev) goto malloc_fail; } - ret = nicvf_mbox_get_rss_size(nic); - if (ret) { - PMD_INIT_LOG(ERR, "Failed to get rss table size"); - goto malloc_fail; - } - PMD_INIT_LOG(INFO, "Port %d (%x:%x) mac=%02x:%02x:%02x:%02x:%02x:%02x", eth_dev->data->port_id, nic->vendor_id, nic->device_id, nic->mac_addr[0], nic->mac_addr[1], nic->mac_addr[2], -- 1.9.1