From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0040.outbound.protection.outlook.com [104.47.41.40]) by dpdk.org (Postfix) with ESMTP id B7C711B7D0 for ; Tue, 5 Jun 2018 12:36:06 +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:X-MS-Exchange-SenderADCheck; bh=x1HqaVz3WQIUfo+sZiLVvhjonzV57EXVZLPScqaoDTg=; b=fhXSHmDx4U3PlhS/rx5jdY9FbCtX3Vb6ybz1Bc4CBDFiXMHbe7D1Y5HvFEY2V5KQbxmUr1cLNPn2pbOwBNbSycu8avpbw+cDgN3pQTCYZ8mELfsIP9Vc4WqflFLGMVCNO5p9k4CKXemuA0hKhkdmQvZabmhg+Ouczg+gyt6YsuI= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Shally.Verma@cavium.com; Received: from hyd1sverma-dt.caveonetworks.com (115.113.156.2) by CY4PR0701MB3633.namprd07.prod.outlook.com (2603:10b6:910:92::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.820.11; Tue, 5 Jun 2018 10:36:03 +0000 From: Shally Verma To: pablo.de.lara.guarch@intel.com Cc: fiona.trahe@intel.com, dev@dpdk.org, pathreya@caviumnetworks.com, mchalla@caviumnetworks.com, Ashish Gupta , Sunila Sahu Date: Tue, 5 Jun 2018 16:05:09 +0530 Message-Id: <1528194913-25893-4-git-send-email-shally.verma@caviumnetworks.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1528194913-25893-1-git-send-email-shally.verma@caviumnetworks.com> References: <1528194913-25893-1-git-send-email-shally.verma@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [115.113.156.2] X-ClientProxiedBy: PN1PR0101CA0006.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00:e::16) To CY4PR0701MB3633.namprd07.prod.outlook.com (2603:10b6:910:92::35) X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:CY4PR0701MB3633; X-Microsoft-Exchange-Diagnostics: 1; CY4PR0701MB3633; 3:PAYEfNeuacmqeC1PW8ceSRPSQpIfWneIUr00RAF2NDv/puOGTIO1D+mQLdTLrJCmPbGG9tmv7+ZVl53Ww+YbLLCnrf0wKrYVnjjcUPh+MR0VviOB29UGDfwOjZPlsFid4Yn8Zq65oJx2+HN4tMJQ3gNfLFpoXsZLW3curUYl/QrRe0fUos0wpyFyodF2/7PMc/NsgLY4MptDTikeeZTtZTWIyXeUavtOzMvfCvtH4O9liW+tWQFHS1R+QwcvZ/cG; 25:z63z18eMb1Eplp9hNs+MWi4Lx0nA+WSInda78Z5xjj1vtDucvCcHfGI1FVe9q9z423AV0y5y0Un8tmLRXahfyK6luiHkmUoto9AdaM4RWra+lh9eIMRE6M9qNyRhr0hETwm+60bKSMrL0k471SEMt059kXYfkdV7XxWn+TSNE38JwuqDWSF+VhB+v/ycko67izSxckzwQFqEBFuA6aenxy4r+cgFX24jM/sHwvWpJkrmS/bC56IP83DSd3ZxpiUfP1GCM4Odrd9UfDYnjPt5ZHZwx4IzyPn/zHfGLXLoTVwbbEbOPU24DUovtTKCjsUbsBPf9h1lKYEEPk0y15pxhA==; 31:yXIKMTcVaxlVpi816TH9AdKjJbabO5fblsgtaWW2DKjvhjZPSUYVlCFROvOos/CeKBLSrJl5fa3lZE1nBhGssDAWbDnqlpdOttBC3guQJgALQ9kyp6tflRKp3uFX+mjalrXZAQFFW3tuhoiBeCGCqmQcDL40hu6IlHMi/Hu0WOGg0118XrGOt8/iz6iC8RF27q28GbIfvlqSydk21P92Yc7bAIMk6Fkci0i5x2Borxo= X-MS-TrafficTypeDiagnostic: CY4PR0701MB3633: X-Microsoft-Exchange-Diagnostics: 1; CY4PR0701MB3633; 20:SnD5ruUucVTQ7qF6P6wHskv6PzOvYtOSR0diLcJs3B8YYsSbo9Rq+FdTz1nQ3hDRFEAA8zLxNYCX/BjzfQNE6/JGkdgNGo9IpPKnqpFRG2lFRCPkpOpFNvz1tsbVkvGjn1KecZ2fPuBmJkWNK5JkNV6K15h4uIpau/d3tBO9o0lqlWYbJbSKB3s4GpDgWxlHx5qVNOkQHpnORKkRb4R+dsqupegQImgN1G7bzjCqD+c4R0jjlERslCZSI913EDmlFnH6NwqyGc9g7zH+EbnT0W2gVIkbexmF7UW+/DGYtvGpClZe92odLzMvP6u1QriIHaeooW3T7BWhTh1eCYkv1JLGyjgzI78j2qhU2psseFnnMiW9mGCn3udgxIV2t5+iZAYeuAnD+mgajjKg+Q8GJYnrAM/F7P3uhjMrHnESe6DMUtUCjtCGQ6f65h5v+6xfMYwHcuB/rPHZLHgSkhFudhfrlNO3FU+hAWbrEyKsUX0XN9B8lbmltG7NooQCkN/nbXgK/Wne4WXfczXub0NozNxEodO262r0bNDO7W8YaoTOy4UL0Wtngse6tUn1A9NrR8+xtR1NQI+pBtLnMMPWB8ttuLBV0MTw+P+S5dOt25M=; 4:xtuwqMhQ40mAGkjZLJqQZdXb17OtowLqaIM+z6Q49DE+UwoF8x44lG5hfD0RImA0mqwwMrDG/QaOJn37xmzqH1wVoUPDqQ+MpyvcufT6hyvkNy29VjBsR3QwM7WcFcBZKgH+UkvXE0nSj8yE3wQzF1Gs6Rh2HbxzDibWnXGfFxspL1ocJ8rvyNkbivaFfxIIVOFgKFy1olS9jVds52lu3WZNcuaPIZuIntz88EgOAyH4WoNKkPzgFUwPJjYjRx6vaLTt4DcoboKVlOCIud9a7Q== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(3231254)(944501410)(52105095)(10201501046)(3002001)(149027)(150027)(6041310)(20161123564045)(20161123560045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(6072148)(201708071742011)(7699016); SRVR:CY4PR0701MB3633; BCL:0; PCL:0; RULEID:; SRVR:CY4PR0701MB3633; X-Forefront-PRVS: 0694C54398 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39380400002)(366004)(39860400002)(346002)(396003)(376002)(189003)(199004)(6486002)(956004)(476003)(36756003)(97736004)(54906003)(5660300001)(316002)(59450400001)(386003)(25786009)(50466002)(69596002)(44832011)(53416004)(2906002)(186003)(48376002)(42882007)(52116002)(16526019)(76176011)(6512007)(486006)(8936002)(6916009)(8676002)(53936002)(6506007)(6116002)(3846002)(81166006)(105586002)(81156014)(2616005)(5890100001)(2351001)(26005)(47776003)(51416003)(72206003)(305945005)(107886003)(7736002)(16586007)(55236004)(106356001)(2361001)(4326008)(66066001)(478600001)(446003)(50226002)(11346002)(68736007); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR0701MB3633; H:hyd1sverma-dt.caveonetworks.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY4PR0701MB3633; 23:fZ3iCNKYG8Eg6GE+BpCQLlH61QuEtuhGwlhyQkX?= =?us-ascii?Q?EX/hhFyqoceZaBE97RxpHrzWMQD+hpBweCUXuF0NjIOd2878Hoz3p3SzWKjs?= =?us-ascii?Q?Ow6uGHmSXY7WhExtmawfBoixTwOkXLMJC7MjtBe5y+eTjLwOdPrkNzajMIQO?= =?us-ascii?Q?VNzpAfExAkhdb6Mm9G3BGFsF/zrEoZs85we60zOH+ghL/cKLUQIOSTxYfOpG?= =?us-ascii?Q?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trw8SA==; 5:DKHxNNV2ECTOn/2LckYhV/Y3gJa2uGeqPB/GWFlgmxEThC/zOfZAh7hmkdSxq4UpKmQaqGgkljBqpQg5dun7DJTJ0oFRFDYc1/G+kJXFEedCkXSc/Scfi0h0zYA7qNbIMzBjaL5382/9F1TxWVBf2L/Z28E1zztxRKLGLlCFv4s=; 24:sba3i64p/C9H+ZGskbJ0/1rC2j9uke5kqmA5Sw4R+qamsKe+BMYrqNxDskyvbCYAIc2ty0KFsQlZF0Nv9otmv1AgutBSK72t1Q04Sbk3kMM= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY4PR0701MB3633; 7:w9yhoboGGcb5/b9PVmac19eCqFg88p+oURmienRgi03Vu9FeAFyvJj7ZYL8f+aOQglWEINLyO9tDwWMqfHm89fvlmroLmZg4wiKK6KUTYW6UzAqGNa2mxxrj/yGNuIUzp5/qmopsifIhfWj2UXNu6J8ZL8aSuatFSwKtFYiNdcAK0P/fadFsRkyMbv8KKKRm7+pR7SlcBS4bKAUrcvRy9fu76Lbzs/FXMKwjWgaJv/IptSMBmM3acsq+72ZTkAA5 X-MS-Office365-Filtering-Correlation-Id: 26b271ff-f781-44a5-9253-08d5cad02471 X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jun 2018 10:36:03.0913 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 26b271ff-f781-44a5-9253-08d5cad02471 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR0701MB3633 Subject: [dpdk-dev] [PATCH v1 3/7] compress/octeontx: add xform and stream create support 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: Tue, 05 Jun 2018 10:36:07 -0000 implement private xform and stream create ops Signed-off-by: Ashish Gupta Signed-off-by: Shally Verma Signed-off-by: Sunila Sahu --- drivers/compress/octeontx/zip_pmd.c | 138 ++++++++++++++++++++++++++++++++++++ drivers/compress/octeontx/zipvf.h | 29 ++++++++ 2 files changed, 167 insertions(+) diff --git a/drivers/compress/octeontx/zip_pmd.c b/drivers/compress/octeontx/zip_pmd.c index 3bb7f6896..349114626 100644 --- a/drivers/compress/octeontx/zip_pmd.c +++ b/drivers/compress/octeontx/zip_pmd.c @@ -30,6 +30,104 @@ static const struct rte_compressdev_capabilities RTE_COMP_END_OF_CAPABILITIES_LIST() }; +/** Parse xform parameters and setup a stream */ +int +zip_set_stream_parameters(struct rte_compressdev *dev, + const struct rte_comp_xform *xform, + struct zip_stream *z_stream) +{ + int ret; + union zip_inst_s *inst; + struct zip_vf *vf = (struct zip_vf *)dev->data->dev_private; + void *res; + + ret = rte_mempool_get_bulk(vf->zip_mp, + z_stream->bufs, MAX_BUFS_PER_STREAM); + if (ret < 0) + return -1; + + inst = (union zip_inst_s *)z_stream->bufs[CMD_BUF]; + res = z_stream->bufs[RES_BUF]; + + /* get one command buffer from pool and set up */ + + memset(inst->u, 0, sizeof(inst->u)); + + /* set bf for only first ops of stream */ + inst->s.bf = 1; + + if (xform->type == RTE_COMP_COMPRESS) { + inst->s.op = ZIP_OP_E_COMP; + + switch (xform->compress.deflate.huffman) { + case RTE_COMP_HUFFMAN_DEFAULT: + inst->s.cc = ZIP_CC_DEFAULT; + break; + case RTE_COMP_HUFFMAN_FIXED: + inst->s.cc = ZIP_CC_FIXED_HUFF; + break; + case RTE_COMP_HUFFMAN_DYNAMIC: + inst->s.cc = ZIP_CC_DYN_HUFF; + break; + default: + ret = -1; + goto err; + } + + switch (xform->compress.level) { + case RTE_COMP_LEVEL_MIN: + inst->s.ss = ZIP_COMP_E_LEVEL_MIN; + break; + case RTE_COMP_LEVEL_MAX: + inst->s.ss = ZIP_COMP_E_LEVEL_MAX; + break; + case RTE_COMP_LEVEL_NONE: + ZIP_PMD_ERR("Compression level not supported"); + ret = -1; + goto err; + default: + /* for any value between min and max , choose + * PMD default. + */ + inst->s.ss = ZIP_COMP_E_LEVEL_MED; /** PMD default **/ + break; + } + } else if (xform->type == RTE_COMP_DECOMPRESS) { + inst->s.op = ZIP_OP_E_DECOMP; + /* from HRM, + * For DEFLATE decompression, [CC] must be 0x0. + * For decompression, [SS] must be 0x0 + */ + inst->s.cc = 0; + /* Speed bit should not be set for decompression */ + inst->s.ss = 0; + /* decompression context is supported only for STATEFUL + * operations. Currently we support STATELESS ONLY so + * skip setting of ctx pointer + */ + + } else { + ZIP_PMD_ERR("\nxform type not supported"); + ret = -1; + goto err; + } + + inst->s.res_ptr_addr.s.addr = rte_mempool_virt2iova(res); + inst->s.res_ptr_ctl.s.length = 0; + + z_stream->inst = inst; + z_stream->func = zip_process_op; + + return 0; + +err: + rte_mempool_put_bulk(vf->zip_mp, + (void *)&(z_stream->bufs[0]), + MAX_BUFS_PER_STREAM); + + return ret; +} + /** Configure device */ static int zip_pmd_config(struct rte_compressdev *dev, @@ -261,6 +359,46 @@ zip_pmd_qp_setup(struct rte_compressdev *dev, uint16_t qp_id, return -1; } +static int +zip_pmd_stream_create(struct rte_compressdev *dev, + const struct rte_comp_xform *xform, void **stream) +{ + int ret; + struct zip_stream *strm; + + strm = rte_malloc(NULL, + sizeof(struct zip_stream), 0); + ret = zip_set_stream_parameters(dev, xform, strm); + if (ret < 0) { + ZIP_PMD_ERR("failed configure xform parameters"); + rte_free(strm); + return ret; + } + *stream = strm; + return 0; +} + +static int +zip_pmd_stream_free(struct rte_compressdev *dev, void *stream) +{ + struct zip_vf *vf = (struct zip_vf *) (dev->data->dev_private); + struct zip_stream *z_stream; + + if (stream == NULL) + return -1; + + z_stream = (struct zip_stream *)stream; + rte_mempool_put_bulk(vf->zip_mp, + (void *)&(z_stream->bufs[0]), + MAX_BUFS_PER_STREAM); + + /* Zero out the whole structure */ + memset(stream, 0, sizeof(struct zip_stream)); + rte_free(stream); + + return 0; +} + struct rte_compressdev_ops octtx_zip_pmd_ops = { .dev_configure = zip_pmd_config, .dev_start = zip_pmd_start, diff --git a/drivers/compress/octeontx/zipvf.h b/drivers/compress/octeontx/zipvf.h index 9582d6119..2388e2947 100644 --- a/drivers/compress/octeontx/zipvf.h +++ b/drivers/compress/octeontx/zipvf.h @@ -77,6 +77,25 @@ int octtx_zip_logtype_driver; #define ZIP_PMD_WARN(fmt, args...) \ ZIP_PMD_LOG(WARNING, fmt, ## args) +/* resources required to process stream */ +enum { + RES_BUF = 0, + CMD_BUF, + HASH_CTX_BUF, + DECOMP_CTX_BUF, + IN_DATA_BUF, + OUT_DATA_BUF, + HISTORY_DATA_BUF, + MAX_BUFS_PER_STREAM +} NUM_BUFS_PER_STREAM; + +struct zip_stream; +struct zipvf_qp; + +/* Algorithm handler function prototype */ +typedef int (*comp_func_t)(struct rte_comp_op *op, + struct zipvf_qp *qp, struct zip_stream *zstrm); + struct zip_pmd_private { struct zip_vf *zipvf_table[ZIP_MAX_VFS]; /**< ZIP Devices List */ @@ -84,6 +103,16 @@ struct zip_pmd_private { /**< Number of ZIP VFs attached to a Guest */ }; +/** ZIP private stream structure */ +struct zip_stream { + union zip_inst_s *inst; + /**< zip instruction pointer */ + comp_func_t func; + /**< function to process comp operation */ + void *bufs[MAX_BUFS_PER_STREAM]; +} _rte_cache_aligned; + + /** * ZIP instruction Queue */ -- 2.14.3