From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0079.outbound.protection.outlook.com [104.47.40.79]) by dpdk.org (Postfix) with ESMTP id 1B12D1B533 for ; Mon, 2 Jul 2018 18:56:00 +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=n9hfZrfHOt95SdVHAnwubuwj9sxPLR3I9vwyE506cyw=; b=UD8z/9vIxjh1f7DlzpLsah2n6MwdyaWteW0Av94j4f27m+6c1jYrOA1tU9ErOyXh1tw5r/9NPkHyhG7ydqdWc1F9paHDPnzMizS2mE16SUY6kxiVSRf8TMP35B1AQD7Afo0l0HkDHxr4nCpQsrG28F5k5yePHNI6kxi/MkqmDeQ= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Shally.Verma@cavium.com; Received: from hyd1sverma-dt.caveonetworks.com (115.113.156.2) by MWHPR0701MB3644.namprd07.prod.outlook.com (2603:10b6:301:7d::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.906.20; Mon, 2 Jul 2018 16:55:51 +0000 From: Shally Verma To: pablo.de.lara.guarch@intel.com Cc: dev@dpdk.org, pathreya@caviumnetworks.com, mchalla@caviumnetworks.com, Ashish Gupta , Ashish Gupta , Sunila Sahu Date: Mon, 2 Jul 2018 22:24:34 +0530 Message-Id: <1530550477-22444-4-git-send-email-shally.verma@caviumnetworks.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1530550477-22444-1-git-send-email-shally.verma@caviumnetworks.com> References: <1530550477-22444-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: MAXPR0101CA0007.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:c::17) To MWHPR0701MB3644.namprd07.prod.outlook.com (2603:10b6:301:7d::37) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8c72e913-aa00-4752-c685-08d5e03caf5e X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600053)(711020)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:MWHPR0701MB3644; X-Microsoft-Exchange-Diagnostics: 1; MWHPR0701MB3644; 3:ENDpKM+pp+ZzfcvxV1RjlfnqLw5RARMZ+n3Jmg1tlF0EirsCtAg+hiqvMpM3aux0J3GZAJ/AHwyupBGmsX899llGxwiGKFUkEY9Ks+Gc2TYkP4smwh0irfNf2WqyyNdfOFVW6a0ojHeiD1Mfkb8lMVkIwhuiCS96P0Qh4OjJVQBOIGlTSLyoh+gT6areeiAV+czAmFEuuWilFRhhvLff2vfgJe93y+Q891WRmHVKjsITgv1ehtBOteC9m6Deqz/5; 25:5T/TH1Q2Uhdx8Nwyy//6pgivyeLy/H5f5FbeJF3r8fUsF5kz2LWoQ6dzsij6P2vyv12kDL49CqSjOGW+tiI7ohC+Ik8faZwD1r0fUlvgJ+IIIsv5eW+nlfBZfx7Et1YB2l00xEFE3D1RKpmDVoX2uNiMH49znRRzyGTLWNkg3srg+CQAVIm+E36B0TZiFB7O0ilvaY2fiiBcNUYoyvOJP1FgFVa3wB2tS5A6Zqrc3txCjZkB+it4z+gxGivdejUPOxnwml+ZTuGLS6cbve7nADZeILiFxUA08lr7ZDgGU1u1PZ+9OhPVrAEQJ8vJjVkMXt5+gDM7wUTAlb5lN4W1Gg==; 31:wHrPgqyX0oBoBHrywfNCHByIRd1LD4Z+FuIoC6aikVIN97yzflXklwNnas9c//9rXyyvUoW5q/gMWdAhvOASOuG9S46Bu9YNaZPh+1P+c28bbVohR38HN331EJvJCy8IW7IGW9h0ukI7oiQodUalntlby4/3jUTVoQCV7MvNKoGkyrxXJ3iiq8hU2qXeg/nzqh95U2Cd3JhnlI+d43xPYlualuNRoRc7jaSFPAym4HI= X-MS-TrafficTypeDiagnostic: MWHPR0701MB3644: X-Microsoft-Exchange-Diagnostics: 1; MWHPR0701MB3644; 20:bbFSIkM1w8VJCClZEkJwFhxuT5d/UnLsM5pRXuNSShF+0C6c0NigBoeCIeWc0rUUKoNdhA3Nl8aLN9tBLOp2tzN5WPuskWVcoFuztrGBgpQxVWejHDbYkW4Cz4q7WNxxnwmNYip6kAUOSflGcQqaumVUILsvZK+sAYa3zyXEDQ5JcbdnNAagMVvjri/akNj0Z0ozDfWshYNH1bEdE1k7bBggbm5Zdy8KA+jgny3T6Q7prJgJwetzwVxJgapeJKOuXXvrtR4/ewjiDBNUFKvtm/FIkQl8psEXFTmfmXbkLJYTRQ6O2F9U/D5/nF4n6lhuXNAcRvvizN98Z7CXPELl84E+uUShTBmApvCc8c8dGY7jD76Ni70BA80F2HTR6pHriPIBZQ79G0hx8uyYa5tqtRSFsS2njw9ycVOsHd85PI5MACyE3gcEQdTNKzWixHtw2qeyvS0STXz8c/UuCHxukAbz+FqlHSyAgPLkotH7L8vjQj1hUGdKdF070G6WwKeKmkcZetLaK20dTXn68IfZSuiDNTVdFdvHVu8QpntVROeFKp7TwE0/El3BKNE29wiyinqedY2bo+n0pAn83UtdOLRGuRpVcaVqsGjIH0gGWRw=; 4:QnmjAOItah4pU1Il5uGZycTNmnINFfSCDkK5LczGt7FvT/qPd1q5AZo9bd8kx5CP2f0LOb3Q32sLCDSLjbgTB85fhQorARfX9tZ978k8QsfJg71YqY1om3GZoLto69kiG0BkDkzheVBp36IAtvlid0WkS+rc4FUF0T6TDsz4HYrbqENxiUf/XSlvJjdqxtwBpfqKJo0S80zQ0QhTa98qVVpaiXtddCPKMMZ0j28PCoRVd/7oPI0dTVac2VtVLhEweaN7bpgCVWi0gudVTp6kFQ== 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)(8121501046)(5005006)(93006095)(10201501046)(3002001)(3231254)(944501410)(52105095)(149027)(150027)(6041310)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123558120)(20161123562045)(6072148)(201708071742011)(7699016); SRVR:MWHPR0701MB3644; BCL:0; PCL:0; RULEID:; SRVR:MWHPR0701MB3644; X-Forefront-PRVS: 07215D0470 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(396003)(136003)(39860400002)(346002)(376002)(189003)(199004)(6506007)(25786009)(55236004)(107886003)(3846002)(6116002)(16586007)(2906002)(14444005)(186003)(51416003)(52116002)(16526019)(76176011)(4326008)(6486002)(105586002)(386003)(36756003)(6512007)(2351001)(42882007)(54906003)(69596002)(72206003)(2361001)(53936002)(26005)(48376002)(50466002)(316002)(68736007)(478600001)(6916009)(476003)(81166006)(66066001)(81156014)(8936002)(97736004)(8676002)(47776003)(446003)(11346002)(106356001)(50226002)(2616005)(956004)(6666003)(44832011)(53416004)(486006)(7736002)(305945005)(5660300001); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR0701MB3644; 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; MWHPR0701MB3644; 23:RE3m16rHk2hwwyz/DSghar/4GIT3zFPbap7IH5N?= =?us-ascii?Q?TfbQRvAounpvLzXyoUWQMLZfIrAREyRcmJ5uKFoAxf/V8NLkfMX6ic7jJkg/?= =?us-ascii?Q?WRqNkoc1PVpfWJ+1XSGcDs7jNkMePeBLQEYYrUfZsbyxUg8eWgyZiHu3Fyol?= =?us-ascii?Q?XKFdUz4qmK9KSEHR2KxlyUCzMajHVIPTKKMBpYRSIB770/aSZjsGGKlpn8b3?= =?us-ascii?Q?oS92GbocIJ7cOY5eCWWModryRbav9jKAMqcJOo/i+zanV891yon486Kb/xcY?= =?us-ascii?Q?ucPGr4q60E9WH95XGyOroTJ64O9SvD1bFeyXC10kEyfWbiF0XQcfS3uQL3WL?= =?us-ascii?Q?K50vpNudYPLla/5NPttzP1U96r675OKJvmMeiNJ/D/tIFsrmjc0mguDnJayV?= =?us-ascii?Q?g2ighBYnBRmHTvEZuUfCGd/fWYN6vQJND9hMtwd0bOt37KkgvvquyLrhR8t3?= =?us-ascii?Q?KaFGcWZBhpnlSxJ3XT3a94BNWe5qjNaRNBNHfJNRQoT27gFzs12hkNoNBwQU?= =?us-ascii?Q?Clj23zju0l0sC6jzCdjVZR94sVR8wQ+tJI1AaX/2IYzzOlsQbpW99B93bX0B?= =?us-ascii?Q?eoXXX7dRXC88xDbWWsd3WWChSTDIUafuXZ5afYxi3PV7yjZmRXuHsV1oOhsn?= =?us-ascii?Q?06VAnTSfUN3oBGa1g5KBVg9UtKCGy/QC9iG/H1c8QgcqFAzjePIyGtxjTmwv?= =?us-ascii?Q?o053KW+jxpM5Pmx6/fkaBB7gFzNVM0USpWEIcrvi/aGQo8ROvI792oPcOnwC?= =?us-ascii?Q?u5hm+fn3Rt7d597RavGbrwqbemERafVpG6+rx9e7WGrQDLjZ+J0yoIQNd4Ox?= =?us-ascii?Q?kgwn9oT9ZlkppekFBqUqZSMNfhSNx9oTqgbUZsueRJneUm6EQNDwIQNwQsB9?= =?us-ascii?Q?vLtHD51bK2Zh6Qa3oUusdqC6AVCq0qs37nJVbcQMqVzn5AvXSakx354CD/Ly?= =?us-ascii?Q?q2HcrvVWHv64hw6o5imnshBXaXjbi0zH2uLlUTCpBMv8vwCoc+o2x9I00EeE?= =?us-ascii?Q?0gmkFRejoUkr8fV1ZGRGezm3sWPF1RnropwxdSHhSScH3K3ZmWKlTyFVqavU?= =?us-ascii?Q?S5VKZ+/rlDW3BO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slXKjm1VnfC7keqxqIC0KgTtFgJ86LyTUrelV1QvRKiuOBZuLxcxtQnqSTxPFwhr0OKddRHQSB8UZwQoj06e9NY2C+tQKgCGaC/uILkb1P32z/x+qy6+ZdexxSUzQg/qZ7HkCvblVo6FRR+z+RRz3RN54eTGDOUaBUK14wkz5tSGe3oH8ium925sbE6oAibK/Gmo95WFI49nz+4kA==; 5:pGbmBBPACG8j9oP++oldwvVBePf+AVOXjfBlJRtA97+TA3trnfrlB/McbKhQEOR4OPdeMTyKY+rJuVbFDdQ9I8XITB4Si4tEF+lHAJiP4eqx4HLb05Aqkanv9nMHEsS28bIvt58jPu9rmmAC4ZD0xX3fLyjPaP6wTY/plGtt6dQ=; 24:kIrTuycDcxkOWMWBeONBZ6IW5XvjmNtfxH0J8tpNJ2uHJNHNSo0maEtDtTMU0twrJ8Wj+1w/gwkggeB1oSLhuN/v69+GSNip3m66P9sWTGU= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; MWHPR0701MB3644; 7:0Agi1nxJtTqOQ1Mp+ohzHmXYEMwUtMEgGkdd8HVVoZPKQiv2UjtSBJlnEneuZbIDCoQacL552WP84jsjmlTezv/ZDNgfUzVxkCFNDrJMPea5pS++R5SmI/Gak8s7Pe+yFV0iSG7LVbYmUBlX+1AaMJ2JKo13qTv0VVCl7gKlsZyvTpTW8gipTLF3bvym+kHJLrFknIq4S+rnBHX5TNjKB/t8cM2pASlxvSRe1GGQ2c73rTkPOrUK0RMS1DWNYkLy X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jul 2018 16:55:51.7362 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8c72e913-aa00-4752-c685-08d5e03caf5e X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR0701MB3644 Subject: [dpdk-dev] [PATCH v2 3/6] 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: Mon, 02 Jul 2018 16:56:00 -0000 From: Ashish Gupta 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 | 140 ++++++++++++++++++++++++++++++++++++ drivers/compress/octeontx/zipvf.h | 24 ++++++- 2 files changed, 163 insertions(+), 1 deletion(-) diff --git a/drivers/compress/octeontx/zip_pmd.c b/drivers/compress/octeontx/zip_pmd.c index 44c271e1a..c8feb96bc 100644 --- a/drivers/compress/octeontx/zip_pmd.c +++ b/drivers/compress/octeontx/zip_pmd.c @@ -25,6 +25,103 @@ 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; + + 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, @@ -248,6 +345,45 @@ 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, @@ -263,6 +399,10 @@ struct rte_compressdev_ops octtx_zip_pmd_ops = { .queue_pair_setup = zip_pmd_qp_setup, .queue_pair_release = zip_pmd_qp_release, + .private_xform_create = zip_pmd_stream_create, + .private_xform_free = zip_pmd_stream_free, + .stream_create = zip_pmd_stream_create, + .stream_free = zip_pmd_stream_free }; static int diff --git a/drivers/compress/octeontx/zipvf.h b/drivers/compress/octeontx/zipvf.h index 4c7eb8862..038877e4e 100644 --- a/drivers/compress/octeontx/zipvf.h +++ b/drivers/compress/octeontx/zipvf.h @@ -88,9 +88,24 @@ enum { 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); + +/** + * 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 @@ -153,6 +168,13 @@ zipvf_q_init(struct zipvf_qp *qp); int zipvf_q_term(struct zipvf_qp *qp); +int +zipvf_push_command(struct zipvf_qp *qp, union zip_inst_s *zcmd); + +int +zip_set_stream_parameters(struct rte_compressdev *dev, + const struct rte_comp_xform *xform, + struct zip_stream *z_stream); uint64_t zip_reg_read64(uint8_t *hw_addr, uint64_t offset); -- 2.14.3