From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0051.outbound.protection.outlook.com [104.47.36.51]) by dpdk.org (Postfix) with ESMTP id 3B05DD47E for ; Sat, 25 Mar 2017 07:27:42 +0100 (CET) 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=mI16u4OOHCpj3IL5ejZxlwouhs7MEzGNER0/frTsqFA=; b=SD1vGVUaFms+CDybkP8lpMy0WrwJAwyVQUcrmwMj7s3tB2KRe5/DrPRNUDHeG0q9t1bEdAK7FeXUX72e7iJxbEeuJ0qJkqXJbTtS/W7l79oXoX4L9zU0Uy7DOgzx3uWjRgCkSUG9Rw3m6we4ekXLEacf/qmeTJ0L4tk7dnGL+Xk= Authentication-Results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=caviumnetworks.com; Received: from lio357.in.caveonetworks.com (14.140.2.178) by CY1PR07MB2280.namprd07.prod.outlook.com (10.164.112.158) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.977.11; Sat, 25 Mar 2017 06:27:38 +0000 From: Shijith Thotton To: Ferruh Yigit Cc: dev@dpdk.org, Jerin Jacob , Derek Chickles , Venkat Koppula , Srisivasubramanian S , Mallesham Jatharakonda Date: Sat, 25 Mar 2017 11:54:26 +0530 Message-Id: <1490423097-6797-16-git-send-email-shijith.thotton@caviumnetworks.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1490423097-6797-1-git-send-email-shijith.thotton@caviumnetworks.com> References: <1488454371-3342-1-git-send-email-shijith.thotton@caviumnetworks.com> <1490423097-6797-1-git-send-email-shijith.thotton@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [14.140.2.178] X-ClientProxiedBy: BM1PR01CA0117.INDPRD01.PROD.OUTLOOK.COM (10.174.208.33) To CY1PR07MB2280.namprd07.prod.outlook.com (10.164.112.158) X-MS-Office365-Filtering-Correlation-Id: 0ff52c89-8724-4ee1-f5bf-08d4734809c8 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:CY1PR07MB2280; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2280; 3:jMN7bjxFdhnfY9kBiZQdYdZMKzbjZSjvZtpxmesTTf3I3UCKXdEqdfssqyA+6AbzABDUG6jlIyxChWS+MI7ZCNnWa/P50du9qiegh1KctP3Xmi3Y/fGDinm2HlV7o38CwlybDdJEbxrao8WPg2GPvUtwhFKw5gfCSwhp2ZtF8VVrJVoqdLCXWRu9HVZdqDNvGDW4elxXVMolRm1q96AqPEhy5WwVhTwz+pEXYphyYmao+OYtEm3jlHR0Y/B9OnjOtNBegdmgevimVgIlnp7gRQ==; 25:ezbDQYaxf238VyqLabCv41dujDF6iHp+7CypqSwAT4548cJ0pGW58bSeVJE+taQDBvpEiImaQs4A/vMnbEDu05CpXbiPtZGAFe06FSKv1B7zDvoSNas6VapNQAuAVbsG7uKH+MzXFCXWPbopirx38CP01rsVaERKXK30ehsVjQDcN5//1R2WBSxBstI+X2iV20P+1kNHP02HR6A1NGzQpC9JiLImspFkE0YN4vYCtgqXDu8j8WTZN+q0AHFfPHTpcLBXHKoHjfBMnFLlPULBK2+DzFBKuWtwDr2SfAREtkVLTWqd/PhwOSmmbJjUk5B0dVXCqT+bVv5ghhu8zPgJMsikYYBzchE9pjNUVYNY4x3x5/4vp51Hl2PK0rDB2fJFzYfHoKpxH0HtwswP/xOIwrlMuv6NpNc56deQX9PCznjpe86LzQetxDrXgikYrqfbdhqXu5CbjVBlkXeksSaxSQ== X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2280; 31:4dSKbkoP4c8pFtInp4Gl6DHJ1siPiog5AiHoJa5oPWEOBneACXaKVz5Jk+JsI8i38Q8DdfOH0s4EfEnSLVFXlX8zuoPI+mGtgMICRk0nJIi+DH37rM84ltocM/4cnMy9AaoTxdXbW5BLLlJcITXiq+fXcj3E2XfmnpnNsJP+pC+ao9kcncxAhZQgQQbRggYGBS+IkYN99MbiUX7Yb0XlpvHKzcBfA8LiyAexNcOehio=; 20:JOxpgm/ZrxBktTcV1VGIG/nUHXyyeZKringOcksKYX2/YB+V3o2hv6Mr4QlzI/Y4l+97iwZWBNFMlBo8oxXprdpRu/9I58QVOz+osNQEgThf7y5xog0P5zJs5fUxR3u1ZnBAEhxJT3Z1pSdAxiChiJ+pXr1CFhRStaKtXyQdwgyNNMTXf03gYsUEG/iftsquRqIHo4FOsgduu05yeVGNbEiHcKkGLts8TZGmpW3oH3CzhtZUwLVYacGBvJPV6KdUl8RHwtya/wLs3Zna6RG5bN7JZxm2DyeA6rJ4M75J/s879kltvNnxxWLwN4NQn53sUSDEfAxbKWMVtXEdHthkeqrVgpid4FZpaoDKgPQdGVFYZOb3J4FSqShhODxrDePYm1XieXrJcRXzu7wSuaDRjLrVFqWxoAxAH8XhbtiibF/VV8fVvMURnLaVETPbstjpTU0z/yM+zTyCshhJhPCnrWQtaoDi+NoxdSWFpKAz3led0HF8XbTndq2zvx0NEHCCkxTfbeWigVBivs3Px6VBgWryI+BNZhFPsPF9kdXVqo0HqL7yhj+11QGgDDUhVz6NiEHYnWZwdUgO1Rl76VLgnfJMfmtskKmBc/ejc6qbp+Y= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6041248)(20161123564025)(20161123560025)(20161123562025)(20161123558025)(20161123555025)(6072148); SRVR:CY1PR07MB2280; BCL:0; PCL:0; RULEID:; SRVR:CY1PR07MB2280; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2280; 4:rSITMWBMq92lLyCXJPoOzP39CEP92nlushrtWtMm+fPD39RVGgyuRpF7y8pDtbfaDvBq+1CnnkgdZnrbC//3OOOROdGDRO5DS8sulLx0T2TexI2AeHl0lxHrgUhVUgHt3dXWXzwrLwklkY0GIrQDIjdiAoEKYZDkRepvDBhzbmyGKQ8zcFQNZ2f9F7KrSUq/Beygkv5uG2hISDDz+KTxL8detn3rXHLaGgxFGl0KmIA3jHz8Mq7QbOOIh69hDgbMEpdHXe4NXqXnK+IomMpIgBGoCBJAN4t3hl7osdyBLQRbUr85wgKCSPsrqHsuZDqJ4ZaBtW/zMW+XHUQTGSXTSuvJhtZ5rizxftvEQ8PErf+LoABFMvybg2GvNjrJOS9qol4TZAWodz3ofyxQnCQAlsjnDFU14sdCnLDayF8iBFri2Go2rzZtSL+ixYEDkEt2tH4+TE38qDc00c7hjyuoIDgdnjGC2WLzXld3AqwWZZcHwjwd+ZjiE90e3VYsM/Vrrhy4X8EKJWIs0+sUOKeaC0GvP5hpuH3yt0Puy1FYtz3H6CRAB+Hh+hGpXRlmffblyUuFLZVH/omr8TwRWbB2SZUmOEycy0yz/OdEtOWhCk4= X-Forefront-PRVS: 025796F161 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(39450400003)(39410400002)(39830400002)(2906002)(2950100002)(5003940100001)(66066001)(42882006)(6916009)(50466002)(48376002)(47776003)(42186005)(53936002)(6512007)(68736007)(5009440100003)(54906002)(50226002)(38730400002)(6486002)(6666003)(25786009)(305945005)(81166006)(7736002)(6116002)(3846002)(4326008)(8676002)(6506006)(189998001)(36756003)(50986999)(76176999)(33646002)(4720700003)(5660300001)(110136004)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR07MB2280; H:lio357.in.caveonetworks.com; FPR:; SPF:None; MLV:nov; PTR:InfoNoRecords; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR07MB2280; 23:0ZuzMh+9fmpN1mVhyXDUkUeMa1rMRfkaka4PPq6Hu?= =?us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SCa352UfqQwvr?= =?us-ascii?Q?3NGxUDBIJ/gELJLE0UK6IN5BHqzkeQiiFBlcne1iPa/2rEDYc2emKcQeEnsb?= =?us-ascii?Q?VkqZEDCGDYcOrR8gIXB9Fn1eMXddHdgAxWQcLSLOSSpya2txlVyDrTSz9U0A?= =?us-ascii?Q?2B2HdLR3kCBUjxexgQGlcWYEcxM?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2280; 6:FuoYQcM+FmzWwd1gxpF+HdOocXEEbv8R+H06Jp+9frq4n2rjUaAv/TCn1C//MqtbnOfL8BY20ZEv4Ce/k8e/qmlFfFPgYNJ9vp9FZXV9Njp7p9GAm8Pwo4ZA7rzw3A2Cu6hy5aUbKpqRR3T9e3B0WuXwKmXoka6+GNCahkJekUbmMOwtXzzTWN7TAdI9my0HER9irnxWfoVyrhhz4JSG+sIY7QO20KNraTitKBZePw3oYmRui/YPmdC3K5bBa2YNPwB9blvVBy7PNJrmmdeGfXoXjVFVwmHxUPr37d+7LNFnsIQ4TuS0Inj8V07ejJzqDOOtrp758525XvknE+bU4EtvAHw6nDrNymlBezg62ofKYVNPB9tLllR++Ylvul2k7Mt4PjQmEjFlwwzwQAZhtA==; 5:dvSDo9pIBIm/lUjQqJbJhGAziLcZHR0j/Z/CTVkng6bwagF/BLq8H0NnPb0OfGGA4PbHCONW/IJcEPyLKj1xtsY0g89wbzHBCfEbJcoGOZN4w3KKYJWb1ibro6RHxW4lBXT+yeaCjS3ximlTGLuzfQ==; 24:OJTXLdW0/ClRnqbVdKl6CaiRvhjNuvNcSjPB3IOKRca7gTR4V8sjXfFAL6FyGCBxujvbLLOWJjdCMQQvcRxAHocL8nptwmyAv47wroB1Bxs= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2280; 7:TtNLhQ0jB13QxMO4yCqXYPDtoeCiR39qWPaKqV1uyZlL1DThKOVkPA9QyY2G7935TXxAnNIaH8wFjJMf7azjcHGE/7eI+L5vX8RrQ09RPpmdfbr30yu1EYxMlW00Be+v41ueOc5Vq3ZQ4bMfJtI/ur8gJt0nSy9sPY7obH8AAkxAXgHs7Th3ZFZ3fgEF9C6dBkIuQa57/C6cqJqLKoxKfvD0C7zc9h6YO0gIE6F4pPSnhBVLEhaHaKHRabTlNn8jPCWv9GhE4hLFld1sNcsTx848lYeXsq2JjU+WWMe81oex2WhJtUJdo0ko89DS+OckrQHD2H5A75vRgHt4Io5aUA== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Mar 2017 06:27:38.1368 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2280 Subject: [dpdk-dev] [PATCH v3 15/46] net/liquidio: add APIs to allocate and free SC buffer pool 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: Sat, 25 Mar 2017 06:27:42 -0000 Soft command (SC) holds device control command and related information. SC buffer pool holds buffers which are used during soft command allocation. Signed-off-by: Shijith Thotton Signed-off-by: Jerin Jacob Signed-off-by: Derek Chickles Signed-off-by: Venkat Koppula Signed-off-by: Srisivasubramanian S Signed-off-by: Mallesham Jatharakonda --- drivers/net/liquidio/lio_ethdev.c | 12 ++++++++++++ drivers/net/liquidio/lio_rxtx.c | 21 +++++++++++++++++++++ drivers/net/liquidio/lio_rxtx.h | 9 +++++++++ drivers/net/liquidio/lio_struct.h | 3 +++ 4 files changed, 45 insertions(+) diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c index 5d7d5a7..a1dcdf6 100644 --- a/drivers/net/liquidio/lio_ethdev.c +++ b/drivers/net/liquidio/lio_ethdev.c @@ -101,6 +101,12 @@ return -1; } + /* Initialize soft command buffer pool */ + if (lio_setup_sc_buffer_pool(lio_dev)) { + lio_dev_err(lio_dev, "sc buffer pool allocation failed\n"); + return -1; + } + if (lio_dev->fn_list.setup_mbox(lio_dev)) { lio_dev_err(lio_dev, "Mailbox setup failed\n"); goto error; @@ -141,6 +147,7 @@ return 0; error: + lio_free_sc_buffer_pool(lio_dev); if (lio_dev->mbox[0]) lio_dev->fn_list.free_mbox(lio_dev); if (lio_dev->instr_queue[0]) @@ -152,11 +159,16 @@ static int lio_eth_dev_uninit(struct rte_eth_dev *eth_dev) { + struct lio_device *lio_dev = LIO_DEV(eth_dev); + PMD_INIT_FUNC_TRACE(); if (rte_eal_process_type() != RTE_PROC_PRIMARY) return -EPERM; + /* lio_free_sc_buffer_pool */ + lio_free_sc_buffer_pool(lio_dev); + rte_free(eth_dev->data->mac_addrs); eth_dev->data->mac_addrs = NULL; diff --git a/drivers/net/liquidio/lio_rxtx.c b/drivers/net/liquidio/lio_rxtx.c index 4a687d8..1c6ce59 100644 --- a/drivers/net/liquidio/lio_rxtx.c +++ b/drivers/net/liquidio/lio_rxtx.c @@ -206,3 +206,24 @@ lio_dev->instr_queue[0] = NULL; lio_dev->num_iqs--; } + +int +lio_setup_sc_buffer_pool(struct lio_device *lio_dev) +{ + char sc_pool_name[RTE_MEMPOOL_NAMESIZE]; + uint16_t buf_size; + + buf_size = LIO_SOFT_COMMAND_BUFFER_SIZE + RTE_PKTMBUF_HEADROOM; + snprintf(sc_pool_name, sizeof(sc_pool_name), + "lio_sc_pool_%u", lio_dev->port_id); + lio_dev->sc_buf_pool = rte_pktmbuf_pool_create(sc_pool_name, + LIO_MAX_SOFT_COMMAND_BUFFERS, + 0, 0, buf_size, SOCKET_ID_ANY); + return 0; +} + +void +lio_free_sc_buffer_pool(struct lio_device *lio_dev) +{ + rte_mempool_free(lio_dev->sc_buf_pool); +} diff --git a/drivers/net/liquidio/lio_rxtx.h b/drivers/net/liquidio/lio_rxtx.h index 33f178b..b308211 100644 --- a/drivers/net/liquidio/lio_rxtx.h +++ b/drivers/net/liquidio/lio_rxtx.h @@ -47,6 +47,15 @@ struct lio_request_list { void *buf; }; +/** The size of each buffer in soft command buffer pool */ +#define LIO_SOFT_COMMAND_BUFFER_SIZE 1536 + +/** Maximum number of buffers to allocate into soft command buffer pool */ +#define LIO_MAX_SOFT_COMMAND_BUFFERS 255 + +int lio_setup_sc_buffer_pool(struct lio_device *lio_dev); +void lio_free_sc_buffer_pool(struct lio_device *lio_dev); + /** Setup instruction queue zero for the device * @param lio_dev which lio device to setup * diff --git a/drivers/net/liquidio/lio_struct.h b/drivers/net/liquidio/lio_struct.h index 2806c37..992ad39 100644 --- a/drivers/net/liquidio/lio_struct.h +++ b/drivers/net/liquidio/lio_struct.h @@ -277,6 +277,9 @@ struct lio_device { uint32_t num_iqs; + /* The pool containing pre allocated buffers used for soft commands */ + struct rte_mempool *sc_buf_pool; + /** The input instruction queues */ struct lio_instr_queue *instr_queue[LIO_MAX_POSSIBLE_INSTR_QUEUES]; -- 1.8.3.1