bvdev/compress: move comp transform structs to static globals
Code cleanup. Change-Id: I9f96a889ed39afbd14a42b50e2537b1c4844f514 Signed-off-by: paul luse <paul.e.luse@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456517 Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
5ef2b14e3c
commit
d5d7c57043
@ -152,6 +152,30 @@ struct comp_bdev_io {
|
|||||||
static struct rte_mempool *g_mbuf_mp = NULL; /* mbuf mempool */
|
static struct rte_mempool *g_mbuf_mp = NULL; /* mbuf mempool */
|
||||||
static struct rte_mempool *g_comp_op_mp = NULL; /* comp operations, must be rte* mempool */
|
static struct rte_mempool *g_comp_op_mp = NULL; /* comp operations, must be rte* mempool */
|
||||||
static struct rte_mbuf_ext_shared_info g_shinfo = {}; /* used by DPDK mbuf macros */
|
static struct rte_mbuf_ext_shared_info g_shinfo = {}; /* used by DPDK mbuf macros */
|
||||||
|
/* Create shrared (between all ops per PMD) compress xforms. */
|
||||||
|
static struct rte_comp_xform g_comp_xform = (struct rte_comp_xform)
|
||||||
|
{
|
||||||
|
.type = RTE_COMP_COMPRESS,
|
||||||
|
.compress = {
|
||||||
|
.algo = RTE_COMP_ALGO_DEFLATE,
|
||||||
|
.deflate.huffman = RTE_COMP_HUFFMAN_DEFAULT,
|
||||||
|
.level = RTE_COMP_LEVEL_MAX,
|
||||||
|
.window_size = DEFAULT_WINDOW_SIZE,
|
||||||
|
.chksum = RTE_COMP_CHECKSUM_NONE,
|
||||||
|
.hash_algo = RTE_COMP_HASH_ALGO_NONE
|
||||||
|
}
|
||||||
|
};
|
||||||
|
/* Create shrared (between all ops per PMD) decompress xforms. */
|
||||||
|
static struct rte_comp_xform g_decomp_xform = (struct rte_comp_xform)
|
||||||
|
{
|
||||||
|
.type = RTE_COMP_DECOMPRESS,
|
||||||
|
.decompress = {
|
||||||
|
.algo = RTE_COMP_ALGO_DEFLATE,
|
||||||
|
.chksum = RTE_COMP_CHECKSUM_NONE,
|
||||||
|
.window_size = DEFAULT_WINDOW_SIZE,
|
||||||
|
.hash_algo = RTE_COMP_HASH_ALGO_NONE
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
static void vbdev_compress_examine(struct spdk_bdev *bdev);
|
static void vbdev_compress_examine(struct spdk_bdev *bdev);
|
||||||
static void vbdev_compress_claim(struct vbdev_compress *comp_bdev);
|
static void vbdev_compress_claim(struct vbdev_compress *comp_bdev);
|
||||||
@ -176,8 +200,6 @@ create_compress_dev(uint8_t index, uint16_t num_lcores)
|
|||||||
struct compress_dev *device;
|
struct compress_dev *device;
|
||||||
uint16_t q_pairs = num_lcores;
|
uint16_t q_pairs = num_lcores;
|
||||||
uint8_t cdev_id;
|
uint8_t cdev_id;
|
||||||
struct rte_comp_xform comp_xform = {};
|
|
||||||
struct rte_comp_xform decomp_xform = {};
|
|
||||||
int rc, i;
|
int rc, i;
|
||||||
struct comp_device_qp *dev_qp;
|
struct comp_device_qp *dev_qp;
|
||||||
struct comp_device_qp *tmp_qp;
|
struct comp_device_qp *tmp_qp;
|
||||||
@ -234,23 +256,7 @@ create_compress_dev(uint8_t index, uint16_t num_lcores)
|
|||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: if later on all elements remain static, move these
|
rc = rte_compressdev_private_xform_create(cdev_id, &g_comp_xform,
|
||||||
* xform structs to static globals.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Create shrared (between all ops per PMD) compress xforms. */
|
|
||||||
comp_xform = (struct rte_comp_xform) {
|
|
||||||
.type = RTE_COMP_COMPRESS,
|
|
||||||
.compress = {
|
|
||||||
.algo = RTE_COMP_ALGO_DEFLATE,
|
|
||||||
.deflate.huffman = RTE_COMP_HUFFMAN_DEFAULT,
|
|
||||||
.level = RTE_COMP_LEVEL_MAX,
|
|
||||||
.window_size = DEFAULT_WINDOW_SIZE,
|
|
||||||
.chksum = RTE_COMP_CHECKSUM_NONE,
|
|
||||||
.hash_algo = RTE_COMP_HASH_ALGO_NONE
|
|
||||||
}
|
|
||||||
};
|
|
||||||
rc = rte_compressdev_private_xform_create(cdev_id, &comp_xform,
|
|
||||||
&device->comp_xform);
|
&device->comp_xform);
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
SPDK_ERRLOG("Failed to create private comp xform device %u: error %d\n",
|
SPDK_ERRLOG("Failed to create private comp xform device %u: error %d\n",
|
||||||
@ -258,19 +264,7 @@ create_compress_dev(uint8_t index, uint16_t num_lcores)
|
|||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create shrared (between all ops per PMD) decompress xforms. *
|
rc = rte_compressdev_private_xform_create(cdev_id, &g_decomp_xform,
|
||||||
* also TODO make this global static if everything stays like this
|
|
||||||
*/
|
|
||||||
decomp_xform = (struct rte_comp_xform) {
|
|
||||||
.type = RTE_COMP_DECOMPRESS,
|
|
||||||
.decompress = {
|
|
||||||
.algo = RTE_COMP_ALGO_DEFLATE,
|
|
||||||
.chksum = RTE_COMP_CHECKSUM_NONE,
|
|
||||||
.window_size = DEFAULT_WINDOW_SIZE,
|
|
||||||
.hash_algo = RTE_COMP_HASH_ALGO_NONE
|
|
||||||
}
|
|
||||||
};
|
|
||||||
rc = rte_compressdev_private_xform_create(cdev_id, &decomp_xform,
|
|
||||||
&device->decomp_xform);
|
&device->decomp_xform);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
SPDK_ERRLOG("Failed to create private decomp xform device %u: error %d\n",
|
SPDK_ERRLOG("Failed to create private decomp xform device %u: error %d\n",
|
||||||
|
@ -46,8 +46,6 @@ struct rte_comp_op g_comp_op[2];
|
|||||||
struct vbdev_compress g_comp_bdev;
|
struct vbdev_compress g_comp_bdev;
|
||||||
struct comp_device_qp g_device_qp;
|
struct comp_device_qp g_device_qp;
|
||||||
struct compress_dev g_device;
|
struct compress_dev g_device;
|
||||||
struct rte_comp_xform g_comp_xform;
|
|
||||||
struct rte_comp_xform g_decomp_xform;
|
|
||||||
static struct rte_mbuf *g_src_mbufs[2];
|
static struct rte_mbuf *g_src_mbufs[2];
|
||||||
static struct rte_mbuf *g_dst_mbufs[2];
|
static struct rte_mbuf *g_dst_mbufs[2];
|
||||||
static struct rte_mbuf g_expected_src_mbufs[2];
|
static struct rte_mbuf g_expected_src_mbufs[2];
|
||||||
|
Loading…
Reference in New Issue
Block a user