From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0040.outbound.protection.outlook.com [104.47.40.40]) by dpdk.org (Postfix) with ESMTP id 64DE75A36 for ; Fri, 26 Aug 2016 18:54:56 +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=X8qictb1kML5hXoA9umw2MVdjNZcHSL61JuXaN7BkRU=; b=o2elI21jfDz+uL06zNQ82vR4CpG/iZZ+zXyfd8NPJ4oe0KrOKM7Jk09L893U6sJfpHgWzG+mGgdxK3XAx48VZ2mTMfjndt12rJF7qZDe1R/FdH3EQj3NcFeN6c8Z/uOIegz9ierJrj1blQvcoqXLzBIuYrO97ICbrxsM/bOsTUU= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Kamil.Rytarowski@cavium.com; Received: from cavium1.semihalf.local (31.172.191.173) by CY4PR07MB3064.namprd07.prod.outlook.com (10.172.116.145) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.549.15; Fri, 26 Aug 2016 16:54:51 +0000 From: Kamil Rytarowski To: CC: , , , , , Kamil Rytarowski Date: Fri, 26 Aug 2016 18:53:56 +0200 Message-ID: <1472230448-17490-2-git-send-email-krytarowski@caviumnetworks.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1472230448-17490-1-git-send-email-krytarowski@caviumnetworks.com> References: <1472230448-17490-1-git-send-email-krytarowski@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [31.172.191.173] X-ClientProxiedBy: HE1PR0201CA0008.eurprd02.prod.outlook.com (10.165.229.18) To CY4PR07MB3064.namprd07.prod.outlook.com (10.172.116.145) X-MS-Office365-Filtering-Correlation-Id: 8e1d049e-a4c0-4242-ea04-08d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1z3MGO54twjclNYOlZbcFB2/d5EQvEaRlv6jANdujL2SlKK+Y4pfK7WzT8=; 20:mPNaU5p6SbF2kgHdLFvy46cikbpLNuMFspVa6AxXU+utACajtmZV/kSpVkIFSWfqNJnUCBrVGUlcDD8yhCAQqxkoxScBK5UhJiS53yiX59I3QFofJAfSqez/gamFxwj1/x7YpA7qh/ICYmpOATqVMX3WQVAJMIFeOhmwLQXcsFhpXODRMAcjFaZFaO82QSuGncoxzc9ktBm5oijMqLeoJPkBvODtUDFuTjaRE6TCzPdrqRu8NpJrxA6Cqmb20CgCYsJXVRjUGGyZjQWq8bdKW0CS72MxeKYAJLWwUgl4CG3xa+C0RTfU/MOX2wx55Ov30i1bkFdNhN7Vl0BUVZT8eaRg8Nx+qvtmDVvy4dSMClyjR3LfxtKI7T68uBnOSXrjuDluN4RjuI6ScmHLm3ZoBl41GjkH+38iO61Am1Og0I0rXatuLxnt9lk7Fd9d7LcFPIWuehCg/dKoO/2BWYczKVh5qcKSzMYuVDiY6nfdw4j41KMRUTRGYJ1612f8uiQ5hEpn/3XFFwxmufmpzwWtTPeziCtjsTlDf6CLDgWToUJfWpQV0jOlEtsrjGr+oH1bIiNJV1mLtYRfVQ0AKwPcPZdp8wTMDGHW8ePd2/FZzms= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001); SRVR:CY4PR07MB3064; BCL:0; PCL:0; RULEID:; SRVR:CY4PR07MB3064; X-Microsoft-Exchange-Diagnostics: 1; CY4PR07MB3064; 4:tsSS5q96Y0XkWrT+f+Nv/orQOSptRK14A+4lIymQHFdDnGPsLlehtZwUccNPhEPyNtrT9K5vxnkMbiWihuBi9QkIFt+sa9/zHq+T/0zVkfzFLzpJrCqm4aZDFBVSCdqjfJOfmDtvaaKgytWObQBwPszoAolg4BSjoajhy4k17yp+Z23hrp11a5s0wt7GwgVFWl0yGc+uJFaaep2fgz9Tv0NV0wKwe8V0baWLV3rCX5QwGV5HgqUfjzE/79mtbgU+NOjJEVwyDispbbMkygXyy2awtHY6NhTCu64lsU0++JplADK/CZqH7ZGAJ/Lwfr65ioAVkAHCYm2KwrIeMuGi064lL1Z9vvoCnrly1JO5rG8Fydoh2Pj5JHxMGYMIHt3RsazLUgN/lAaR9vGHA734fg== X-Forefront-PRVS: 00462943DE X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(189002)(199003)(81156014)(36756003)(77096005)(189998001)(2906002)(229853001)(2351001)(105586002)(8676002)(101416001)(92566002)(5660300001)(81166006)(6116002)(4001430100002)(2950100001)(7736002)(47776003)(4326007)(66066001)(586003)(50466002)(106356001)(50226002)(5003940100001)(19580405001)(19580395003)(305945005)(50986999)(110136002)(76176999)(7846002)(48376002)(68736007)(42186005)(3846002)(107886002)(33646002)(97736004); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR07MB3064; 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; CY4PR07MB3064; 23:C9/bz1GIxXR1MSkhKoSAWIwG0JyW1ycfnrpvzF/Vm?= =?us-ascii?Q?VBEFeTeJe7+IljqsZ3zwlI8Q4DnuqmQtp2X5PwcPbwbc5hD90TF+lEBev0ZI?= =?us-ascii?Q?U8TwfCro7mFJ0pAhFvzP3D/8ZGZ8qMw+BLw1fw0qb9/1Vvm0JQ4VloWHWFmf?= =?us-ascii?Q?1OGclQb43mARj8f3nvLoXIwe2FFl+CEXxLxWnIRYnw5WTYqaHG9nPgGOqyMm?= =?us-ascii?Q?1JbZOjiUxo6e6cGVHUdRijbkA/TR2aSFN7FZgQrXxEAoPsisUR37nNZ70foM?= =?us-ascii?Q?WfbuLGqXJcKIWfvOkxLMDzob/H/otPFeLMdsYwnp4LXozHubm+NBBJgqlzbL?= =?us-ascii?Q?a0rMQCwUSecZ9xTLIJhfkARdF2Ylv7z8S9FrKVKBuOtkbItfZ2i1J4xi0SkA?= =?us-ascii?Q?WHoVMRlVro04b+JsDrynWFZVeQ3+zsh8OOi20bqvG5YRbQu5cP1FTkWWXhg0?= =?us-ascii?Q?2PLyko3KhE5ns8TYyt4VHO+qCwoWj8n2vqj+n9rj8KaFJ3suBjypJE2UQLVE?= =?us-ascii?Q?x8kFXSRCxH8M5jIm1j9gRVGGAh00ck2IkrVdxqG17z3dE0kHVFKMEXRY+kVU?= =?us-ascii?Q?dOINpx9KGeC76qXAjF+EbhP2qUdOEobJOnxIaF5pPJCAbBH9YOfkmFFu9c8p?= =?us-ascii?Q?3uv3X++9y8/5rXfh7YV2LWW/0OCIGEIsrX4sMZELlAujB8p260LuiOYVd9lM?= =?us-ascii?Q?+o993lxCezbLdcYOuxeEC2SVC2YBa91k+Hxx5hA4mhleMsu4EfiaNC9miHPv?= =?us-ascii?Q?Hpo3GhdWatQLeX2YBBVBINtxbSa4B6St2zPo+Tip+SbKQGdOtqyXo5WD4ian?= =?us-ascii?Q?os2dnMUJnHjenC6qDvh15lnqemLF+SifiHvlA3e15V1OwOUuHj6C7FjbyjME?= =?us-ascii?Q?sV46PAa1IewuTkNDFXTTSM1L0GMd32iZGTBwQwL+qkrQw2pB3Xf2uWmzR5bN?= =?us-ascii?Q?/XP5moY1ir2R9WkVXtYg2ysnBd4qmhuuu12wWzSGibQkvv4h+e5nt6POubUM?= =?us-ascii?Q?xZU5h7QFwYKHeNr4RrL3EOn+eNXDUuqkmO4kXAu8QjlO/75iDRd4MTXk8EFm?= =?us-ascii?Q?t0QrXvlA8gyxM1E7HBKCcd+tq5rtF3FtF/+ADszXUCnvq+F692g3nCqU1Ndk?= =?us-ascii?Q?h82HV/sz8M=3D?= X-Microsoft-Exchange-Diagnostics: 1; CY4PR07MB3064; 6:QoxxRp1e/kNduwYNrwlKBZiRT/NHEdqPOi2hpnvquDf5LUa9/JbhqXDrEUKg4qUxV6BT4TtPF03hZca/tFXbcCGWw1catAbn0LGM3VVa69YcMkV84+IXVpfIXWa3QgXZZCeHyA2JOGlaZxNHRsouojj+mWLsOnBiQ/35phvmrtJ4vvXyt5eG9OfDec7k2FxQOUAAHeQlRlZFFCwEdetL0jGJj5rKDHLz1rbP/8qT3RusXTlj3rJRgRxWCfofwzEMZLLZscnXGpX0y7IuF6djPtm5WZ2o9R9k1Tlhv7momR4=; 5:r80GpuoeHi7kB3E6u0is5OOGgTibiIaAVqzBiB0oqW1pAfpY2GClOSXMEcQlkPwbtJh8xofmYge3M3ZD3W/wV2dLJWlM77PlXbDKPy/DGbFJSj6/hf4NfIlNcwXZizSDK1ANrM0EdGlGQ/RHe06sHw==; 24:0Un4B7Y6FQvUuJpeVpF/XA1lBYSohwjYQBOzXj5SUtngtzI6XiFWE6ox6ziJS2eEMStgpLHEWd9NvkmF58dvTYw0YQ4oCgWYfl4nD670nag=; 7:i9BMEJmZj1bRti7YxCSaxUF+bB8rryXqD/f0VgWXLq+LkqS1iKim0mfp2Lc5vYM4kFHxV/LTsXIQnSkemiJCkqAIBEu6Ae4jjLKYK09AgSiibBZ7DpUaXYtj0C8voKHnhEygdsENjl4fSMeei5oO5uE3w3bHBg+fZKc8Hrrs5885FI9+5xltKHhIxRB57N2T1cnc/x7rwNagrTxvVQVEIloBYI7qQy5i6ejeRVHo9cxyvEBN57d9DeEmmAhQIcDg SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Aug 2016 16:54:51.7982 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR07MB3064 Subject: [dpdk-dev] [PATCH 01/13] 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, 26 Aug 2016 16:54:56 -0000 From: Kamil Rytarowski Refactored features: - enable nicvf_qset_rbdr_precharge to handle handle secondary queue sets - rte_free already handles NULL pointer - check mempool flags to predict being contiguous in memory - allow to use mempool with multiple memory chunks - simplify local construct of accessing nb_rx_queus 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 | 32 ++++++++++++-------------------- 3 files changed, 20 insertions(+), 28 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 4402f6a..48f2cd2 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 @@ -1087,9 +1084,9 @@ 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 */ - if (mp->nb_mem_chunks != 1) { - PMD_INIT_LOG(ERR, "Non contiguous mempool, check huge page sz"); + /* Mempool memory must be contiguous */ + if (mp->flags & MEMPOOL_F_NO_PHYS_CONTIG) { + PMD_INIT_LOG(ERR, "Mempool memory must be contiguous"); return -EINVAL; } @@ -1212,15 +1209,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 +1352,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 +1719,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