Bug 188061 - On quad port QLE2564 can't add in target only 2 ports
Summary: On quad port QLE2564 can't add in target only 2 ports
Status: NEW
Alias: None
Product: SCSI Drivers
Classification: Unclassified
Component: QLOGIC QLA2XXX (show other bugs)
Hardware: x86-64 Linux
: P1 normal
Assignee: scsi_drivers-qla2xxx
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-11-17 23:16 UTC by Anthony
Modified: 2019-08-01 17:59 UTC (History)
2 users (show)

See Also:
Kernel Version: 4.8.6-201.fc24.x86_64
Subsystem:
Regression: No
Bisected commit-id:


Attachments
Output lspci for 4-port card (14.16 KB, text/plain)
2017-03-04 03:53 UTC, Anthony
Details

Description Anthony 2016-11-17 23:16:43 UTC
I have QLE2564 (quad port) with portnames:
09:00.0 Fibre Channel: QLogic Corp. ISP2532-based 8Gb Fibre Channel to PCI Express HBA (rev 02)
09:00.1 Fibre Channel: QLogic Corp. ISP2532-based 8Gb Fibre Channel to PCI Express HBA (rev 02)
0a:00.0 Fibre Channel: QLogic Corp. ISP2532-based 8Gb Fibre Channel to PCI Express HBA (rev 02)
0a:00.1 Fibre Channel: QLogic Corp. ISP2532-based 8Gb Fibre Channel to PCI Express HBA (rev 02)

systool -c fc_host -v | grep port_name
    port_name           = "0x15b0024ffaa536f"
    port_name           = "0x115b0024ffaa536f"
    port_name           = "0x215b0024ffaa536f"
    port_name           = "0x315b0024ffaa536f"
Same info from targetcli:
/qla2xxx> info 
Fabric module name: qla2xxx
ConfigFS path: /sys/kernel/config/target/qla2xxx
Allowed WWN types: naa
Allowed WWNs list: naa.215b0024ffaa536f, naa.15b0024ffaa536f, naa.315b0024ffaa536f, naa.115b0024ffaa536f
Fabric module features: acls
Corresponding kernel module: tcm_qla2xxx

2 NAA I have succefully added:
naa.115b0024ffaa536f
naa.215b0024ffaa536f

but other two fails:
/qla2xxx> create naa.315b0024ffaa536f 
WWN not valid as: naa
Comment 1 himanshu.madhani@cavium.com 2016-11-21 07:28:05 UTC
Hello, 

What is version of targetcli version used here?. Also can you provide message file when this error is seen.

Thanks,
-Himanshu
Comment 2 Anthony 2016-11-21 08:02:05 UTC
targetcli-2.1.fb43-2.fc25.noarch
python3-rtslib-2.1.fb60-2.fc25.noarch

I found possible reason and ugly workaround:
in package RTSLib file utils.py change REGEXP to validate WWN

'naa': lambda wwn: re.match("naa\.[1235][0-9a-fA-F]{15}$", wwn),

but I can't understnad why my QLogic card uses strange port names:
0x15b0024ffaa536f and 0x315b0024ffaa536f
and why on quad ports card from port to port changes highest bit in portname
Comment 3 himanshu.madhani@cavium.com 2016-11-21 17:27:41 UTC
I would not know that part but from drive point of view any valid WWN should be fine.
Comment 4 Anthony 2016-11-21 17:38:04 UTC
From rtslib (naa wwn must start with 1 or 2 or 5):

def normalize_wwn(wwn_types, wwn):
    '''
    Take a WWN as given by the user and convert it to a standard text
    representation.

    Returns (normalized_wwn, wwn_type), or exception if invalid wwn.
    '''
    wwn_test = {
    'free': lambda wwn: True,
    'iqn': lambda wwn: \
        re.match("iqn\.[0-9]{4}-[0-1][0-9]\..*\..*", wwn) \
        and not re.search(' ', wwn) \
        and not re.search('_', wwn),
    'naa': lambda wwn: re.match("naa\.[125][0-9a-fA-F]{15}$", wwn),
    'eui': lambda wwn: re.match("eui\.[0-9a-f]{16}$", wwn),
    'ib': lambda wwn: re.match("ib\.[0-9a-f]{32}$", wwn),
    'unit_serial': lambda wwn: \
        re.match("[0-9A-Fa-f]{8}(-[0-9A-Fa-f]{4}){3}-[0-9A-Fa-f]{12}$", wwn),
    }

    for wwn_type in wwn_types:
        clean_wwn = _cleanse_wwn(wwn_type, wwn)
        found_type = wwn_test[wwn_type](clean_wwn)
        if found_type:
            break
    else:
        raise RTSLibError("WWN not valid as: %s" % ", ".join(wwn_types))

    return (clean_wwn, wwn_type)
Comment 5 Anthony 2017-03-03 07:37:08 UTC
I've installed another 4-port card and got same issue - port names have variable part at highest bits. On 2-port card port names have variable part at lower bits:
    port_name           = "0x21000024ff3bcb3e"
    port_name           = "0x21000024ff3bcb3f"
I'm trying to change a port name in NVRAM with FLASUTIL.EXE with no luck.
Comment 6 himanshu.madhani@cavium.com 2017-03-03 17:42:34 UTC
(In reply to Anthony from comment #5)
> I've installed another 4-port card and got same issue - port names have
> variable part at highest bits. On 2-port card port names have variable part
> at lower bits:
>     port_name           = "0x21000024ff3bcb3e"
>     port_name           = "0x21000024ff3bcb3f"
> I'm trying to change a port name in NVRAM with FLASUTIL.EXE with no luck.

Hi Anthony, 

Can you please attach output of following command from your 4-port card.

# lspci -vvv -s <pci_bus_for_each_port>

So for example 

# lspci -vvv -s 09.00.0 and so on for each of the 4 ports of 4-port card. 

Thanks,
Himanshu
Comment 7 Anthony 2017-03-04 03:53:45 UTC
Created attachment 255073 [details]
Output lspci for 4-port card
Comment 8 Anthony 2017-03-04 03:56:36 UTC
I added output in text attachment. By construction this card have 3 PCI-E switches onboard.
Comment 9 himanshu.madhani@cavium.com 2017-03-15 21:15:34 UTC
(In reply to Anthony from comment #8)
> I added output in text attachment. By construction this card have 3 PCI-E
> switches onboard.

Checking with our hardware/firmware team on what is going on with these cards. 

Thanks,
Himanshu
Comment 10 Anthony 2017-06-26 12:10:44 UTC
Problem does not change with kernel updates. Any news about firmware?
Comment 11 Stefan Leitner 2019-08-01 17:59:24 UTC
This bug is still present on Linux 5.0

root@server:~# systool -c fc_host -v | grep port_name
    port_name           = "0x18b0024ffb7bbf7"
    port_name           = "0x118b0024ffb7bbf7"
    port_name           = "0x218b0024ffb7bbf7"
    port_name           = "0x318b0024ffb7bbf7"

So the numbering of the first port swallows the 0 - resulting in a 14 char value.
Also port number 4 (0x318...) results in targetcli in a 
WWN not valid as: naa

While changing utils.py REGEXP to re.match("naa\.[1235][0-9a-fA-F]{15}$", wwn) it helps to add the 3rd port it does not solve the problem for the port number 1 (0x18... - which should be 0x018...)

lspci -v

0f:00.0 Fibre Channel: QLogic Corp. ISP2532-based 8Gb Fibre Channel to PCI Express HBA (rev 02)
        Subsystem: QLogic Corp. ISP2532-based 8Gb Fibre Channel to PCI Express HBA (QLE2564 PCI Express to 8Gb FC Quad Channel)
        Flags: bus master, fast devsel, latency 0, IRQ 102, NUMA node 0
        I/O ports at 7000 [size=256]
        Memory at f7bf0000 (64-bit, non-prefetchable) [size=16K]
        Memory at f7a00000 (64-bit, non-prefetchable) [size=1M]
        [virtual] Expansion ROM at f7900000 [disabled] [size=256K]
        Capabilities: [44] Power Management version 3
        Capabilities: [4c] Express Endpoint, MSI 00
        Capabilities: [88] MSI: Enable- Count=1/32 Maskable- 64bit+
        Capabilities: [98] Vital Product Data
        Capabilities: [a0] MSI-X: Enable+ Count=32 Masked-
        Capabilities: [100] Advanced Error Reporting
        Capabilities: [138] Power Budgeting <?>
        Kernel driver in use: qla2xxx
        Kernel modules: qla2xxx

Note You need to log in before you can comment on or make changes to this bug.