From 6479ddb358f047ad0a63c2f06e4a456cba87a547 Mon Sep 17 00:00:00 2001 From: Alexey Marchuk Date: Fri, 18 Jun 2021 12:23:14 +0300 Subject: [PATCH] compress: Add RPC option to enable mlx5_pci PMD Signed-off-by: Alexey Marchuk Change-Id: I31efa2f9dd1aafdb87904083e56d693a699af526 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8781 Community-CI: Broadcom CI Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins Reviewed-by: Ben Walker Reviewed-by: Jim Harris --- doc/bdev.md | 7 ++++++- doc/jsonrpc.md | 2 +- module/bdev/compress/vbdev_compress.c | 10 ++++++++++ module/bdev/compress/vbdev_compress.h | 2 ++ 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/doc/bdev.md b/doc/bdev.md index 7dea46e86..a7ccb92f2 100644 --- a/doc/bdev.md +++ b/doc/bdev.md @@ -82,7 +82,12 @@ for detailed information. The vbdev module relies on the DPDK CompressDev Framework to provide all compression functionality. The framework provides support for many different software only compression modules as well as hardware assisted support for Intel QAT. At this -time the vbdev module supports the DPDK drivers for ISAL and QAT. +time the vbdev module supports the DPDK drivers for ISAL, QAT and mlx5_pci. + +mlx5_pci driver works with BlueField 2 SmartNIC and requires additional configuration of DPDK +environment to enable compression function. It can be done via SPDK event library by configuring +`env_context` member of `spdk_app_opts` structure or by passing corresponding CLI arguments in the +following form: `--allow=BDF,class=compress`, e.g. `--allow=0000:01:00.0,class=compress`. Persistent memory is used to store metadata associated with the layout of the data on the backing device. SPDK relies on [PMDK](http://pmem.io/pmdk/) to interface persistent memory so any hardware diff --git a/doc/jsonrpc.md b/doc/jsonrpc.md index 710961b94..a70fff8f4 100644 --- a/doc/jsonrpc.md +++ b/doc/jsonrpc.md @@ -1979,7 +1979,7 @@ Example response: ## bdev_compress_set_pmd {#rpc_bdev_compress_set_pmd} Select the DPDK polled mode driver (pmd) for a compressed bdev, -0 = auto-select, 1= QAT only, 2 = ISAL only. +0 = auto-select, 1= QAT only, 2 = ISAL only, 3 = mlx5_pci only. ### Parameters diff --git a/module/bdev/compress/vbdev_compress.c b/module/bdev/compress/vbdev_compress.c index 929af824e..693783426 100644 --- a/module/bdev/compress/vbdev_compress.c +++ b/module/bdev/compress/vbdev_compress.c @@ -3,6 +3,7 @@ * * Copyright (c) Intel Corporation. * All rights reserved. + * Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -73,6 +74,7 @@ static int g_mbuf_offset; #define ISAL_PMD "compress_isal" #define QAT_PMD "compress_qat" +#define MLX5_PMD "mlx5_pci" #define NUM_MBUFS 8192 #define POOL_CACHE_SIZE 256 @@ -170,6 +172,7 @@ static struct rte_mempool *g_comp_op_mp = NULL; /* comp operations, must be rt static struct rte_mbuf_ext_shared_info g_shinfo = {}; /* used by DPDK mbuf macros */ static bool g_qat_available = false; static bool g_isal_available = false; +static bool g_mlx5_pci_available = false; /* Create shared (between all ops per PMD) compress xforms. */ static struct rte_comp_xform g_comp_xform = { @@ -325,6 +328,9 @@ create_compress_dev(uint8_t index) if (strcmp(device->cdev_info.driver_name, ISAL_PMD) == 0) { g_isal_available = true; } + if (strcmp(device->cdev_info.driver_name, MLX5_PMD) == 0) { + g_mlx5_pci_available = true; + } return 0; @@ -1359,6 +1365,8 @@ _set_pmd(struct vbdev_compress *comp_dev) if (g_opts == COMPRESS_PMD_AUTO) { if (g_qat_available) { comp_dev->drv_name = QAT_PMD; + } else if (g_mlx5_pci_available) { + comp_dev->drv_name = MLX5_PMD; } else { comp_dev->drv_name = ISAL_PMD; } @@ -1366,6 +1374,8 @@ _set_pmd(struct vbdev_compress *comp_dev) comp_dev->drv_name = QAT_PMD; } else if (g_opts == COMPRESS_PMD_ISAL_ONLY && g_isal_available) { comp_dev->drv_name = ISAL_PMD; + } else if (g_opts == COMPRESS_PMD_MLX5_PCI_ONLY && g_mlx5_pci_available) { + comp_dev->drv_name = MLX5_PMD; } else { SPDK_ERRLOG("Requested PMD is not available.\n"); return false; diff --git a/module/bdev/compress/vbdev_compress.h b/module/bdev/compress/vbdev_compress.h index 4dcd78f60..413eeb335 100644 --- a/module/bdev/compress/vbdev_compress.h +++ b/module/bdev/compress/vbdev_compress.h @@ -3,6 +3,7 @@ * * Copyright (c) Intel Corporation. * All rights reserved. + * Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -76,6 +77,7 @@ enum compress_pmd { COMPRESS_PMD_AUTO = 0, COMPRESS_PMD_QAT_ONLY, COMPRESS_PMD_ISAL_ONLY, + COMPRESS_PMD_MLX5_PCI_ONLY, COMPRESS_PMD_MAX };