ioat: remove whitelist/blacklist functionality
This can be done via explicit options on the application command line instead. This has the added benefit of removing a usage of whitelist/blacklist which we are working to remove from the SPDK repository. Signed-off-by: Jim Harris <james.r.harris@intel.com> Change-Id: I5739e281f1c29fc8a5d175f5bbc916cd7d926fe4 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5274 Community-CI: Broadcom CI Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
parent
6b6ae3a214
commit
895ad89214
@ -24,6 +24,12 @@ listening on portals for a portal group until all associated target nodes are cr
|
||||
at startup, otherwise some iSCSI initiators may fail to re-login when SPDK iSCSI
|
||||
target application restarts.
|
||||
|
||||
## ioat
|
||||
|
||||
The PCI BDF whitelist option has been removed from the ioat_scan_accel_engine RPC.
|
||||
ioat PCI functions can still be allowed or denied using SPDK application command
|
||||
line options.
|
||||
|
||||
## v20.10:
|
||||
|
||||
### accel
|
||||
|
@ -107,7 +107,7 @@ DEPDIRS-blobfs_bdev += event
|
||||
endif
|
||||
|
||||
# module/accel
|
||||
DEPDIRS-accel_ioat := log ioat thread $(JSON_LIBS) accel
|
||||
DEPDIRS-accel_ioat := log ioat thread jsonrpc rpc accel
|
||||
DEPDIRS-accel_idxd := log idxd thread $(JSON_LIBS) accel
|
||||
|
||||
# module/env_dpdk
|
||||
|
@ -46,13 +46,6 @@
|
||||
static bool g_ioat_enable = false;
|
||||
static bool g_ioat_initialized = false;
|
||||
|
||||
struct ioat_probe_ctx {
|
||||
int num_whitelist_devices;
|
||||
struct spdk_pci_addr whitelist[IOAT_MAX_CHANNELS];
|
||||
};
|
||||
|
||||
static struct ioat_probe_ctx g_probe_ctx;
|
||||
|
||||
struct ioat_device {
|
||||
struct spdk_ioat_chan *ioat;
|
||||
bool is_allocated;
|
||||
@ -76,21 +69,6 @@ struct ioat_io_channel {
|
||||
struct spdk_poller *poller;
|
||||
};
|
||||
|
||||
static int
|
||||
ioat_find_dev_by_whitelist_bdf(const struct spdk_pci_addr *pci_addr,
|
||||
const struct spdk_pci_addr *whitelist,
|
||||
int num_whitelist_devices)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < num_whitelist_devices; i++) {
|
||||
if (spdk_pci_addr_compare(pci_addr, &whitelist[i]) == 0) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct ioat_device *
|
||||
ioat_allocate_device(void)
|
||||
{
|
||||
@ -242,7 +220,6 @@ ioat_get_io_channel(void)
|
||||
static bool
|
||||
probe_cb(void *cb_ctx, struct spdk_pci_device *pci_dev)
|
||||
{
|
||||
struct ioat_probe_ctx *ctx = cb_ctx;
|
||||
struct spdk_pci_addr pci_addr = spdk_pci_device_get_addr(pci_dev);
|
||||
struct pci_device *pdev;
|
||||
|
||||
@ -262,11 +239,6 @@ probe_cb(void *cb_ctx, struct spdk_pci_device *pci_dev)
|
||||
pdev->pci_dev = pci_dev;
|
||||
TAILQ_INSERT_TAIL(&g_pci_devices, pdev, tailq);
|
||||
|
||||
if (ctx->num_whitelist_devices > 0 &&
|
||||
!ioat_find_dev_by_whitelist_bdf(&pci_addr, ctx->whitelist, ctx->num_whitelist_devices)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Claim the device in case conflict with other process */
|
||||
if (spdk_pci_device_claim(pci_dev) < 0) {
|
||||
return false;
|
||||
@ -296,44 +268,6 @@ accel_engine_ioat_enable_probe(void)
|
||||
g_ioat_enable = true;
|
||||
}
|
||||
|
||||
static int
|
||||
accel_engine_ioat_add_whitelist_device(const char *pci_bdf)
|
||||
{
|
||||
if (pci_bdf == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (g_probe_ctx.num_whitelist_devices >= IOAT_MAX_CHANNELS) {
|
||||
SPDK_ERRLOG("Ioat whitelist is full (max size is %d)\n",
|
||||
IOAT_MAX_CHANNELS);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (spdk_pci_addr_parse(&g_probe_ctx.whitelist[g_probe_ctx.num_whitelist_devices],
|
||||
pci_bdf) < 0) {
|
||||
SPDK_ERRLOG("Invalid address %s\n", pci_bdf);
|
||||
return -1;
|
||||
}
|
||||
|
||||
g_probe_ctx.num_whitelist_devices++;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
accel_engine_ioat_add_whitelist_devices(const char *pci_bdfs[], size_t num_pci_bdfs)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < num_pci_bdfs; i++) {
|
||||
if (accel_engine_ioat_add_whitelist_device(pci_bdfs[i]) < 0) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
accel_engine_ioat_init(void)
|
||||
{
|
||||
@ -341,7 +275,7 @@ accel_engine_ioat_init(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (spdk_ioat_probe(&g_probe_ctx, probe_cb, attach_cb) != 0) {
|
||||
if (spdk_ioat_probe(NULL, probe_cb, attach_cb) != 0) {
|
||||
SPDK_ERRLOG("spdk_ioat_probe() failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
@ -38,7 +38,6 @@
|
||||
|
||||
#define IOAT_MAX_CHANNELS 64
|
||||
|
||||
int accel_engine_ioat_add_whitelist_devices(const char *pci_bdfs[], size_t num_pci_bdfs);
|
||||
void accel_engine_ioat_enable_probe(void);
|
||||
|
||||
#endif /* SPDK_ACCEL_ENGINE_IOAT_H */
|
||||
|
@ -37,71 +37,14 @@
|
||||
#include "spdk/util.h"
|
||||
#include "spdk/event.h"
|
||||
|
||||
struct rpc_pci_whitelist {
|
||||
size_t num_bdfs;
|
||||
char *bdfs[IOAT_MAX_CHANNELS];
|
||||
};
|
||||
|
||||
static int
|
||||
decode_rpc_pci_whitelist(const struct spdk_json_val *val, void *out)
|
||||
{
|
||||
struct rpc_pci_whitelist *pci_whitelist = out;
|
||||
|
||||
return spdk_json_decode_array(val, spdk_json_decode_string, pci_whitelist->bdfs,
|
||||
IOAT_MAX_CHANNELS, &pci_whitelist->num_bdfs, sizeof(char *));
|
||||
}
|
||||
|
||||
static void
|
||||
free_rpc_pci_whitelist(struct rpc_pci_whitelist *list)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < list->num_bdfs; i++) {
|
||||
free(list->bdfs[i]);
|
||||
}
|
||||
}
|
||||
|
||||
struct rpc_ioat_scan_accel_engine {
|
||||
struct rpc_pci_whitelist pci_whitelist;
|
||||
};
|
||||
|
||||
static void
|
||||
free_rpc_ioat_scan_accel_engine(struct rpc_ioat_scan_accel_engine *p)
|
||||
{
|
||||
free_rpc_pci_whitelist(&p->pci_whitelist);
|
||||
}
|
||||
|
||||
static const struct spdk_json_object_decoder rpc_ioat_scan_accel_engine_decoder[] = {
|
||||
{"pci_whitelist", offsetof(struct rpc_ioat_scan_accel_engine, pci_whitelist), decode_rpc_pci_whitelist},
|
||||
};
|
||||
|
||||
static void
|
||||
rpc_ioat_scan_accel_engine(struct spdk_jsonrpc_request *request,
|
||||
const struct spdk_json_val *params)
|
||||
{
|
||||
struct rpc_ioat_scan_accel_engine req = {};
|
||||
int rc;
|
||||
|
||||
if (params != NULL) {
|
||||
if (spdk_json_decode_object(params, rpc_ioat_scan_accel_engine_decoder,
|
||||
SPDK_COUNTOF(rpc_ioat_scan_accel_engine_decoder),
|
||||
&req)) {
|
||||
free_rpc_ioat_scan_accel_engine(&req);
|
||||
SPDK_ERRLOG("spdk_json_decode_object() failed\n");
|
||||
spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INVALID_PARAMS,
|
||||
"Invalid parameters");
|
||||
return;
|
||||
}
|
||||
|
||||
rc = accel_engine_ioat_add_whitelist_devices((const char **)req.pci_whitelist.bdfs,
|
||||
req.pci_whitelist.num_bdfs);
|
||||
free_rpc_ioat_scan_accel_engine(&req);
|
||||
if (rc < 0) {
|
||||
SPDK_ERRLOG("accel_engine_ioat_add_whitelist_devices() failed\n");
|
||||
spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INVALID_PARAMS,
|
||||
"Invalid parameters");
|
||||
return;
|
||||
}
|
||||
spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INVALID_PARAMS,
|
||||
"ioat_scan_accel_engine requires no parameters");
|
||||
return;
|
||||
}
|
||||
|
||||
accel_engine_ioat_enable_probe();
|
||||
|
@ -2298,17 +2298,11 @@ Format: 'user:u1 secret:s1 muser:mu1 msecret:ms1,user:u2 secret:s2 muser:mu2 mse
|
||||
|
||||
# ioat
|
||||
def ioat_scan_accel_engine(args):
|
||||
pci_whitelist = []
|
||||
if args.pci_whitelist:
|
||||
for w in args.pci_whitelist.strip().split(" "):
|
||||
pci_whitelist.append(w)
|
||||
rpc.ioat.ioat_scan_accel_engine(args.client, pci_whitelist)
|
||||
rpc.ioat.ioat_scan_accel_engine(args.client)
|
||||
|
||||
p = subparsers.add_parser('ioat_scan_accel_engine',
|
||||
aliases=['ioat_scan_copy_engine', 'scan_ioat_copy_engine'],
|
||||
help='Set scan and enable IOAT accel engine offload.')
|
||||
p.add_argument('-w', '--pci-whitelist', help="""Whitespace-separated list of PCI addresses in
|
||||
domain:bus:device.function format or domain.bus.device.function format""")
|
||||
help='Enable IOAT accel engine offload.')
|
||||
p.set_defaults(func=ioat_scan_accel_engine)
|
||||
|
||||
# idxd
|
||||
|
@ -3,15 +3,7 @@ from .helpers import deprecated_alias
|
||||
|
||||
@deprecated_alias('ioat_scan_copy_engine')
|
||||
@deprecated_alias('scan_ioat_copy_engine')
|
||||
def ioat_scan_accel_engine(client, pci_whitelist):
|
||||
"""Scan and enable IOAT accel engine.
|
||||
|
||||
Args:
|
||||
pci_whitelist: Python list of PCI addresses in
|
||||
domain:bus:device.function format or
|
||||
domain.bus.device.function format
|
||||
def ioat_scan_accel_engine(client):
|
||||
"""Enable IOAT accel engine.
|
||||
"""
|
||||
params = {}
|
||||
if pci_whitelist:
|
||||
params['pci_whitelist'] = pci_whitelist
|
||||
return client.call('ioat_scan_accel_engine', params)
|
||||
return client.call('ioat_scan_accel_engine')
|
||||
|
Loading…
Reference in New Issue
Block a user