From 8fa4f1770d56af6f0a5a862f1fd298a4eeea94f3 Mon Sep 17 00:00:00 2001 From: "Matthew R. Ochs" Date: Wed, 12 Apr 2017 14:14:05 -0500 Subject: scsi: cxlflash: Remove port configuration assumptions At present, the cxlflash driver only supports hardware with two FC ports. The code was initially designed with this assumption and is dependent on having two FC ports - adding more ports will break logic within the driver. To mitigate this issue, remove the existing port assumptions and transition the code to support more than two ports. As a side effect, clarify the interpretation of the DK_CXLFLASH_ALL_PORTS_ACTIVE flag. Signed-off-by: Matthew R. Ochs Signed-off-by: Uma Krishnan Signed-off-by: Martin K. Petersen --- drivers/scsi/cxlflash/common.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'drivers/scsi/cxlflash/common.h') diff --git a/drivers/scsi/cxlflash/common.h b/drivers/scsi/cxlflash/common.h index 6a04867a0eec..ee23e81994c4 100644 --- a/drivers/scsi/cxlflash/common.h +++ b/drivers/scsi/cxlflash/common.h @@ -29,6 +29,10 @@ extern const struct file_operations cxlflash_cxl_fops; #define NUM_FC_PORTS CXLFLASH_NUM_FC_PORTS /* ports per AFU */ #define MAX_FC_PORTS CXLFLASH_MAX_FC_PORTS /* ports per AFU */ +#define CHAN2PORTMASK(_x) (1 << (_x)) /* channel to port mask */ +#define PORTMASK2CHAN(_x) (ilog2((_x))) /* port mask to channel */ +#define PORTNUM2CHAN(_x) ((_x) - 1) /* port number to channel */ + #define CXLFLASH_BLOCK_SIZE 4096 /* 4K blocks */ #define CXLFLASH_MAX_XFER_SIZE 16777216 /* 16MB transfer */ #define CXLFLASH_MAX_SECTORS (CXLFLASH_MAX_XFER_SIZE/512) /* SCSI wants -- cgit v1.2.3