From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0044.outbound.protection.outlook.com [104.47.36.44]) by dpdk.org (Postfix) with ESMTP id 01931325F for ; Thu, 1 Feb 2018 12:07:54 +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=F0INH+c3aMjaTD2ou15TlHq1ZwsO2ZpIMKYYBNMZnbs=; b=HJBWNsGcM7i9zQFYUBPwSeFyhE7MIGTRI8A7YCBemCeJjsfpGaIyKj9VqonkpLG+68jh98X26vmCKGpqwa/sugKsgv2KA6KSmDU8en27NkYzz5SIhCoU4EAhflvEsQsWvJYMYussSvDm64vKdgCCHZC/SXHn9wwhSFirRDGm+MU= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Shally.Verma@cavium.com; Received: from hyd1sverma-dt.caveonetworks.com (115.113.156.2) by MWHPR0701MB3642.namprd07.prod.outlook.com (2603:10b6:301:7d::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.464.11; Thu, 1 Feb 2018 11:07:50 +0000 From: Shally Verma To: fiona.trahe@intel.com Cc: pathreya@caviumnetworks.com, mchalla@caviumnetworks.com, agupta@caviumnetworks.com, dev@dpdk.org, ahmed.mansour@nxp.com Date: Thu, 1 Feb 2018 16:37:12 +0530 Message-Id: <1517483232-28756-1-git-send-email-shally.verma@caviumnetworks.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 Content-Type: text/plain; charset=y Content-Transfer-Encoding: 8bit X-Originating-IP: [115.113.156.2] X-ClientProxiedBy: BMXPR01CA0032.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:c::18) To MWHPR0701MB3642.namprd07.prod.outlook.com (2603:10b6:301:7d::35) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c368246e-027d-4d0e-f5bd-08d5696409e4 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:MWHPR0701MB3642; X-Microsoft-Exchange-Diagnostics: 1; MWHPR0701MB3642; 3:vn1sDw5lYPeHN/uOhLvblhyXG4VTVNvkVLYvGWaBfHe0wTy2VnVx2Ac7lcP3fLlIp7H8NFtM0udLtAMWBFy2sM7HP9rNyk2vHVT7PpjNtRp8YNKOFDL+DhZ91FE9QxaGA0+C8tC8W3/C0MvMR2kw082yw+RrPpRJdFtRhoBqOk4TF+S7CTErNETl2TCoP95Fp9ix96vmCXF3iH0qfPBG6+0SkxmAIf7PIP2nNCoDfraG6iI+5unYnahfk2IZG/m7; 25:Zo3ad1Te0TkeBTkdMZAbKQFoQmSr68QWcee/sd5PkK2jEDXD5cyPBkUpAc9yybHWTiFEpCv4ARJ0AUPBBhNgiOUg2RcUZ35GZkq15hp3sV5Zt2Jv27BmL8ou8XYXTRzn5A4PtxTKaclMKegfbs0Ok+Xem+ROqsKegsBC2RqYRlhWKhXSFhSxYd9kjcg5xW0zKxA5VgGpQqGiPj8upnfjd1UvINeFzEnt/bgET2THl7tz+IYf0GhVyNJwdrwd9EpwjNM2SRyNobYVDgsUfUkjd2C/5nW66WaxPKtD0mokaxrTJp/tDYAueIehBoIzuLF3UlIOSfYVqwOK4GTERR1gyA==; 31:9iwuSCedaqCwqbdFscR15UBarQ6+h9XtVrnKDbULpZQ5Mf6ZK7XksTYA7RLQC2acaLeeyF16XYLInB8oKNEjOW5h31r7WGrsqFeS1HtH9twpdiBEOX9fPtxEhJsP++n8ZWQbMcaxQxh3MzSf0n2/dWdYhNLNGacvserAri16M8CiYj3DwXm5AmTD8LEVZRS3QH02aQHUSBEdYdw7Z2CbY8LgKr3BN+Yp8IkAYL9zLlE= X-MS-TrafficTypeDiagnostic: MWHPR0701MB3642: X-Microsoft-Exchange-Diagnostics: 1; MWHPR0701MB3642; 20:d4ACUHzedCRa2Utd4rIUVs2YI68/gVl9Wz2s4/dCaadsvaPj/usaiQ0zjCgvtgbmsS9fclapVnXrH+tppKN48cT5eNXcV/OrPDY2b3fSZzD6URVj2COauAkg5tPq1ki79GbrRp8XQi7FOZHOjfaTHre7pIgSLNOpDnNHrqBAcWBPEbcALziIQgVPTXqJey2jFUVyzTZvHzlUe9awBnQSM2mxyF49Qjkxg4gQ9bmpRhL1AE44UmLdEEdOx+F4DaUtRKwMlwE1tj4NPU4McaUQw/7+Fm5O+hCWHDH1DFPcrCRP0HdSeRLRKIzKCSyekxDtM/dOsfe1K0dqCmqCcPO8NUXlyJEf4Eub9NQk4BqjXyvONFL6S01RNCJ/ycN0NRAbWbg/bPPoKp4L2UNlU0r0zE2ODno6HOeKzo9FuLVUwgimaZhUSqIbm7MenMo0SMRobHz9VEcW00Y9RP9GvQ97MaVRWX3TUp4RgVu0HMjia6FdUQvLmSlVhwFQDDrJB40L9btdAWavjvux/urMhpb4zcA18qqk4qRP9DNgdIomKYBW8W5YZLe1IykQRYA9sShEdvb25UEckBPnhIsvhU6VBe/Mr0b/WwtVGylExAuSr8Y=; 4:QdRieIOSy7Ze89aczUxTswPrQMXI59wmnRGyg6H9ME8m0kV/yFfFxp8xYDujzspjFWr+D/vf+HlMjudbMHEzn64RPvWhOIO89R3cWJDoRa69668m5aHgQMqVtb1IzsK8D5BhBBjHaqAX3HwsZ52wSVARRvN0WuCtg5mdNpYTXr8IVXVpbdAyFugTa+0jxrcrE0A16DD8awDTbsawHYzeJUDhIKrMjWlAFefcANrOMI/UNVunR8NziGF85p9mUv5+f9yx5OC5ZRe/xkQ4eNkClg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(8121501046)(5005006)(10201501046)(3231101)(2400082)(944501161)(3002001)(93006095)(6041288)(20161123558120)(20161123560045)(20161123564045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:MWHPR0701MB3642; BCL:0; PCL:0; RULEID:; SRVR:MWHPR0701MB3642; X-Forefront-PRVS: 0570F1F193 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(396003)(366004)(39380400002)(376002)(39860400002)(199004)(189003)(36756003)(16526019)(2906002)(186003)(2870700001)(6116002)(3846002)(53416004)(25786009)(8656006)(69596002)(966005)(26005)(72206003)(55236004)(52116002)(4326008)(386003)(6506007)(59450400001)(50466002)(478600001)(105586002)(6916009)(6486002)(6306002)(7736002)(53936002)(6512007)(47776003)(68736007)(575784001)(50226002)(8936002)(5660300001)(97736004)(316002)(66066001)(305945005)(6666003)(81156014)(81166006)(106356001)(42882006)(2361001)(2351001)(8676002); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR0701MB3642; H:hyd1sverma-dt.caveonetworks.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX: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; MWHPR0701MB3642; 23:S3phX1FELKp2lt8xCSnwdA53RDGbXNDuRg03g41?= =?us-ascii?Q?hZxrWupVip1y9LN4msU17Pv+S5NzTOh6XFm5T0hmW9WuLLzxqB1BN9ZiF6K6?= =?us-ascii?Q?yIrRcwMOo0sjaKId5+cpvklSYhnV+fJNFx4PaC9QW4fniGWk390MvTubywJ4?= =?us-ascii?Q?pqYjXTmUHuU1F4fuHqTC6evknNiiUE0LyrZ+97mBKY5v4N9q0Fo5k1UZNNLA?= =?us-ascii?Q?37/71gbf0Ilon2Ov2gbssAz8aX7P+amNjrwedulfGYsQFEAs+HDtv1zqEVJl?= =?us-ascii?Q?bNOKx7Dfuw/hTJCmtUOHNqDhM9DOAea18gc6LR4ZuZhSijaibn2AsN3RIPpE?= =?us-ascii?Q?w3NKDRX8JidUixSdgth3pluC8s106a+fsEzXBoe6RubBbLkhZVzm90r+M2/H?= =?us-ascii?Q?YaQKonnmkfqcIqn+kwCB2VIb3XKqowlA1RTrrCg2gTKFkV281JzHkCa34lJE?= =?us-ascii?Q?tg/esGWgyMa7mOs8X4t7X2N3Y4OPGhM0z8mmCm1DXpi1N+TaOLnPHPGtIioL?= =?us-ascii?Q?5J2/HlSNYxIw+fJGSyVrgWCVp9TGcMLWHP8Q/8JZvQYiI7dErrQsfJ7FhaB+?= =?us-ascii?Q?cZI1EHGWXELzPdI8F/guQUmn58TXrhDV0BNfmaARElfbMd9V9kII5SaxNNfx?= =?us-ascii?Q?4grcUSW59wcmAA4FPoeV47a97rjLEuJo2589S0OJKNRE0T53eSss8XbC+E03?= =?us-ascii?Q?QdEc1ydWdeRDwW7hr7ZW/IILclgTbwupVB+lNIQ0fw+ntkeAnUnW0OLUEmC4?= =?us-ascii?Q?B+KbTBD81beCOQYEXHa0CjhqX63nsA5RC/hUe3Kb4Jbm9YHAYbMsdjwAiEOW?= =?us-ascii?Q?RS252ww1R9AMX3hl1jy53UjEQUPaiOqkLVS2io8i4ARn+cplWTJ1riMkBfQM?= =?us-ascii?Q?V31noTJ7qNvelWl1bUC0D4yr+JO3US/l9Tj/0/2t+iPgrtzMfaurM10e4HAY?= =?us-ascii?Q?Y7hDQy+h8n2DwCS9ikNS43DVtQh80U2XObKto9FyCcunAwMrlViQDke3/QoG?= =?us-ascii?Q?KYHYc+fybXBB5ITcMFciXjwo1i8DuwxLxgO5R8xFtljG9Uv5CTCoVlWsf1Xe?= =?us-ascii?Q?2FRfvaodQoeJXzMCqaerNtXoSqLHYIAn4k0UP0422JGOxuBztboDVDwuRYxf?= =?us-ascii?Q?CnmpPuPsPQVqwtEyxwarvfatO/MWo+8xdBjnyI4GlgIQgsbLOCg3Kch8QJrN?= =?us-ascii?Q?cXstVavZVOxjbWKMS6n2fz9giQfxJKqrT8YyEJ3vVbdtXblCyCNTDExuC8Tz?= =?us-ascii?Q?Ci8QP3I6XsIfULsAanpk=3D?= X-Microsoft-Exchange-Diagnostics: 1; MWHPR0701MB3642; 6:E5YTMIfzBQEazo/u8As/nfPwmNkGI96HURFfVXCs9ESEaKLsQ16ElGmXXBUe/uTA+5pzwXp917HmXdT8ncKJyqtUpYIL/br6zrel8/Q3qjSTmgvTYqMyR8lKMGyBgLZ7rSX+A8SycKjl9qYuXN43uJuLXLl+Y0hXw55+7pezZZdOeWuiS97HwnH5Dspb2dcAPjqCywitIq7SGgfrBHFsc96lxjS1Eg7hSJY0P8h2Qj6zaLll6q59Rm/uNb2zj3Paimk7JnWD1vtyA+JBNGcotHmUKSdke8KEWcKuQn/9BQEiXYaRZvqBGO+ild500IGiyYXwbYhpbjKW4XmlUYAFYuq48Rwe2NBMkxt37VJPyDI=; 5:H5Sg3PANFYTXocWNt7wInO0G7tF7GPcuhV86FRacITNFCWbU+I/z3yf0psAPIXZArVHIQIi3PbmLgfKf0kYAcHcbGxuNLizIGTn+sfy4lVdqo8mi3/ewno3UQ7DAvQYmA8Yl62Pxrht57myBm8oT1m3IwJG9be17l5/EWJTSwBc=; 24:vncPVAEWk+M9e36HNgP9eUA/4Ko2FgzllStEN/148BxsRN6QAkacAnU64WPCDuA6qiD6OyXR+A89au/cX71wgq/7IjeRQdS8r+SWqkiEC8E=; 7:skf23BzE54EM8Qxdz+mWpl2/tzNQIlep8cmbUfzHNvsMCnPxcq80b4xFUv8BAZiUgmQrEaAOxbByQzGVH6HL9aYAPPGG8BspO7P/hTo+bhV/7CznZT1WTpLNcdtMtc5ZbY6CuLgP+7B5cwpNaHvyabJDP/KPJrnA2QunbVIXUqH7Wg5zdwgZ+PYwqalhr2gu+P7xQuKcJfXsHaGewbgbuvELvGoR8fUaQSmS99Tkaf8a2SUu/kwGOwUo07lCoA+N SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Feb 2018 11:07:50.6282 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c368246e-027d-4d0e-f5bd-08d5696409e4 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR0701MB3642 Subject: [dpdk-dev] [RFC v4 1/1] lib/compressdev: Adding hash 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: Thu, 01 Feb 2018 11:07:55 -0000 Added hash support in lib compressdev. It's an incremental patch to compression lib RFC v3 https://dpdk.org/dev/patchwork/patch/32331/ Changes from RFC v3: - Added hash algo enumeration and associated capability stucture and params in xform and rte_comp_op - Rearranged rte_compresdev_capability structure to have separate rte_comp_algo_capability and moved algo specific capabilities: window_size, dictionary support, and hash as part of it - Added RTE_COMP_UNSPECIFIED=0 in enum rte_comp_algorithm - Redefined RTE_COMP_END_OF_CAPABILITIES_LIST to use RTE_COMP_UNSPECIFIED to resolve missing-field-initializer compiler warning - Updated compress/decompress xform to input hash algorithm during session init - Updated struct rte_comp_op to input hash buffer - Fixed checkpatch reported errors on RFCv3 Every compression algorithm can indicate its capability to perform alongside hash in its associate rte_comp_algo_capa structure. If none is supported, can terminate array with hash_algo = RTE_COMP_HASH_ALGO_UNSPECIFIED. if supported, application can initialize session with desired algorithm enumeration in xform structure and pass valid hash buffer pointer during enqueue_burst(). Signed-off-by: Shally Verma --- lib/librte_compressdev/rte_comp.h | 83 +++++++++++++++++----- lib/librte_compressdev/rte_compressdev.c | 19 +++++ lib/librte_compressdev/rte_compressdev.h | 59 ++++++++++++--- lib/librte_compressdev/rte_compressdev_version.map | 1 + 4 files changed, 137 insertions(+), 25 deletions(-) diff --git a/lib/librte_compressdev/rte_comp.h b/lib/librte_compressdev/rte_comp.h index ca8cbb4..341f59f 100644 --- a/lib/librte_compressdev/rte_comp.h +++ b/lib/librte_compressdev/rte_comp.h @@ -75,10 +75,11 @@ enum rte_comp_op_status { */ }; - /** Compression Algorithms */ enum rte_comp_algorithm { - RTE_COMP_NULL = 0, + RTE_COMP_UNSPECIFIED = 0, + /** No Compression algo */ + RTE_COMP_NULL, /**< No compression. * Pass-through, data is copied unchanged from source buffer to * destination buffer. @@ -94,6 +95,18 @@ enum rte_comp_algorithm { RTE_COMP_ALGO_LIST_END }; + +/** Compression hash algorithms */ +enum rte_comp_hash_algorithm { + RTE_COMP_HASH_ALGO_UNSPECIFIED = 0, + /**< No hash */ + RTE_COMP_HASH_ALGO_SHA1, + /**< SHA1 hash algorithm */ + RTE_COMP_HASH_ALGO_SHA256, + /**< SHA256 hash algorithm */ + RTE_COMP_HASH_ALGO_LIST_END, +}; + /**< Compression Level. * The number is interpreted by each PMD differently. However, lower numbers * give fastest compression, at the expense of compression ratio while @@ -154,21 +167,24 @@ enum rte_comp_flush_flag { RTE_COMP_FLUSH_SYNC, /**< All data should be flushed to output buffer. Output data can be * decompressed. However state and history is not cleared, so future - * ops may use history from this op */ + * ops may use history from this op + */ RTE_COMP_FLUSH_FULL, /**< All data should be flushed to output buffer. Output data can be * decompressed. State and history data is cleared, so future * ops will be independent of ops processed before this. */ RTE_COMP_FLUSH_FINAL - /**< Same as RTE_COMP_FLUSH_FULL but also bfinal bit is set in last block + /**< Same as RTE_COMP_FLUSH_FULL but also bfinal bit is set in + * last block */ /* TODO: * describe flag meanings for decompression. * describe behavous in OUT_OF_SPACE case. * At least the last flag is specific to deflate algo. Should this be * called rte_comp_deflate_flush_flag? And should there be - * comp_op_deflate_params in the op? */ + * comp_op_deflate_params in the op? + */ }; /** Compression transform types */ @@ -180,17 +196,17 @@ enum rte_comp_xform_type { }; enum rte_comp_op_type { - RTE_COMP_OP_STATELESS, - /**< All data to be processed is submitted in the op, no state or history - * from previous ops is used and none will be stored for future ops. - * flush must be set to either FLUSH_FULL or FLUSH_FINAL - */ - RTE_COMP_OP_STATEFUL - /**< There may be more data to be processed after this op, it's part of a - * stream of data. State and history from previous ops can be used - * and resulting state and history can be stored for future ops, - * depending on flush_flag. - */ + RTE_COMP_OP_STATELESS, + /**< All data to be processed is submitted in the op, no state or + * history from previous ops is used and none will be stored for + * future ops.flush must be set to either FLUSH_FULL or FLUSH_FINAL + */ + RTE_COMP_OP_STATEFUL + /**< There may be more data to be processed after this op, it's + * part of a stream of data. State and history from previous ops + * can be usedand resulting state and history can be stored for + * future ops, depending on flush_flag. + */ }; @@ -207,6 +223,13 @@ struct rte_comp_deflate_params { struct rte_comp_compress_common_params { enum rte_comp_algorithm algo; /**< Algorithm to use for compress operation */ + enum rte_comp_hash_algorithm hash_algo; + /**< Hash algorithm to be used with compress operation. Hash is always + * done on plaintext. application can query + * rte_compressdev_capability_get() and parse hash_capa array per each + * algorithm to know supported hash algos and associated params until + * it find an entry with RTE_COMP_HASH_ALGO_UNSPECIFIED + */ union { struct rte_comp_deflate_params deflate; /**< Parameters specific to the deflate algorithm */ @@ -240,6 +263,13 @@ struct rte_comp_compress_xform { struct rte_comp_decompress_common_params { enum rte_comp_algorithm algo; /**< Algorithm to use for decompression */ + enum rte_comp_hash_algorithm hash_algo; + /**< Hash algorithm to be used with decompress operation. Hash is always + * done on plaintext. application can query + * rte_compressdev_capability_get() and parse hash_capa array per each + * algorithm to know supported hash algos and associated params until + * it find an entry with RTE_COMP_HASH_ALGO_UNSPECIFIED + */ enum rte_comp_checksum_type chksum; /**< Type of checksum to generate on the decompressed data. */ uint16_t window_size; @@ -301,7 +331,7 @@ struct rte_comp_xform { struct rte_comp_op { enum rte_comp_op_type op_type; - void * stream_private; + void *stream_private; /* location where PMD maintains stream state * only required if op_type is STATEFUL, else should be NULL */ @@ -344,6 +374,25 @@ struct rte_comp_op { * decompress direction. */ } dst; + struct { + uint8_t *hash_buf; + /**< Pointer to output hash calculated on plaintext if session + * is initialized with Hash algorithm RTE_COMP_HASH_ALGO_SHA1 / + * RTE_COMP_HASH_ALGO_SHA256. Buffer would contain valid value + * only after an op with + * flush flag = RTE_COMP_FLUSH_FULL/FLUSH_FINAL is processed + * successfully. + * + * Length of buffer should be large enough to accommodate digest + * produced by specific hash algo. Application can know + * digest_size via parsing hash capability array in struct + * rte_compressdev_capabilities + */ + uint32_t offset; + /**< Starting offset for writing hash bytes, specified as + * number of bytes from start of hash buffer pointer. + */ + } hash; enum rte_comp_flush_flag flush_flag; /**< defines flush characteristics for the output data. * Only applicable in compress direction diff --git a/lib/librte_compressdev/rte_compressdev.c b/lib/librte_compressdev/rte_compressdev.c index 6186ce5..b62b1ce 100644 --- a/lib/librte_compressdev/rte_compressdev.c +++ b/lib/librte_compressdev/rte_compressdev.c @@ -113,6 +113,25 @@ struct rte_compressdev_callback { }; +const struct rte_compressdev_capabilities * +rte_compressdev_capability_get(uint8_t dev_id, + const struct rte_compressdev_capability_idx *idx) +{ + const struct rte_compressdev_capabilities *capability; + struct rte_compressdev_info dev_info; + int i = 0; + + memset(&dev_info, 0, sizeof(struct rte_compressdev_info)); + rte_compressdev_info_get(dev_id, &dev_info); + + while ((capability = &dev_info.capabilities[i++])->algo != + RTE_COMP_UNSPECIFIED){ + if (capability->algo == idx->algo) + return capability; + } + + return NULL; +} #define param_range_check(x, y) \ (((x < y.min) || (x > y.max)) || \ diff --git a/lib/librte_compressdev/rte_compressdev.h b/lib/librte_compressdev/rte_compressdev.h index 9a86603..7d1b9b1 100644 --- a/lib/librte_compressdev/rte_compressdev.h +++ b/lib/librte_compressdev/rte_compressdev.h @@ -125,22 +125,65 @@ struct rte_comp_param_range { */ }; +/** + * Compression hash algo Capability + */ +struct rte_comp_hash_algo_capability { + enum rte_comp_hash_algorithm hash_alg; + /**< hash algo enumeration */ + uint32_t digest_size; + /**< length of digest produced by hash */ +}; + +/** + * Compression algo Capability + */ +struct rte_comp_algo_capability { + struct rte_comp_param_range window_size; + /**< window size range in bytes */ + int support_dict; + /** Indicate algo support for dictionary load */ + struct rte_comp_hash_algo_capability *hash_capa; + /** pointer to an array of hash capability struct */ +}; /** Structure used to capture a capability of a comp device */ struct rte_compressdev_capabilities { - /* TODO */ enum rte_comp_algorithm algo; + /** Compression Algorithm */ + struct rte_comp_algo_capability alg_capa; + /**< Compression algo capabilities */ uint64_t comp_feature_flags; - /**< bitmap of flags for compression service features*/ - struct rte_comp_param_range window_size; - /**< window size range in bytes */ + /**< bitmap of flags for compression service features */ }; +/** Structure used to index compression device capability array */ +struct rte_compressdev_capability_idx { + enum rte_comp_algorithm algo; +}; + +/** + * Provide device capability for requested algorithm + * + * @param dev_id The identifier of the device. + * @param idx Index to capability array + * + * @return + * - Return pointer to capability structure, if exist. + * - Return NULL, if does not exist. + */ +const struct rte_compressdev_capabilities * +rte_compressdev_capability_get(uint8_t dev_id, + const struct rte_compressdev_capability_idx *idx); + /** Macro used at end of comp PMD list */ #define RTE_COMP_END_OF_CAPABILITIES_LIST() \ - { RTE_COMP_ALGO_LIST_END } + { RTE_COMP_UNSPECIFIED } +/** Macro used at end of comp hash capability list */ +#define RTE_COMP_HASH_END_OF_CAPABILITIES_LIST() \ + { RTE_COMP_HASH_ALG_UNSPECIFIED } /** * compression device supported feature flags @@ -833,7 +876,7 @@ struct rte_comp_session * rte_compressdev_queue_pair_detach_session(uint8_t dev_id, uint16_t qp_id, struct rte_comp_session *session); /** - * This should alloc a stream from the device’s mempool and initialise it. + * This should alloc a stream from the device's mempool and initialise it. * This handle will be passed to the PMD with every op in the stream. * * @param dev_id The identifier of the device. @@ -850,7 +893,7 @@ struct rte_comp_session * */ int rte_comp_stream_create(uint8_t dev_id, struct rte_comp_session *sess, - void ** stream); + void **stream); /** * This should clear the stream and return it to the device’s mempool. @@ -863,7 +906,7 @@ struct rte_comp_session * * @return */ int -rte_comp_stream_free(uint8_t dev_id, void * stream); +rte_comp_stream_free(uint8_t dev_id, void *stream); /** * Provide driver identifier. diff --git a/lib/librte_compressdev/rte_compressdev_version.map b/lib/librte_compressdev/rte_compressdev_version.map index 665f0bf..3114949 100644 --- a/lib/librte_compressdev/rte_compressdev_version.map +++ b/lib/librte_compressdev/rte_compressdev_version.map @@ -5,6 +5,7 @@ EXPERIMENTAL { rte_compressdev_allocate_driver; rte_compressdev_callback_register; rte_compressdev_callback_unregister; + rte_compressdev_capability_get; rte_compressdev_close; rte_compressdev_configure; rte_compressdev_count; -- 1.9.1