Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[SCSI] bfa: FDMI enhancements

Update addl. fields in FDMI to confirm to FC-GS6 standard for RPA and
RHBA commands.

Signed-off-by: Anil Gurumurthy <agurumur@brocade.com>
Signed-off-by: Vijaya Mohan Guvva <vmohan@brocade.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>

authored by

Vijaya Mohan Guvva and committed by
James Bottomley
d7cbc304 1287641e

+224 -2
+15
drivers/scsi/bfa/bfa_fc.h
··· 1531 1531 FDMI_HBA_ATTRIB_FW_VERSION, /* 0x0009 */ 1532 1532 FDMI_HBA_ATTRIB_OS_NAME, /* 0x000A */ 1533 1533 FDMI_HBA_ATTRIB_MAX_CT, /* 0x000B */ 1534 + FDMI_HBA_ATTRIB_NODE_SYM_NAME, /* 0x000C */ 1535 + FDMI_HBA_ATTRIB_VENDOR_INFO, /* 0x000D */ 1536 + FDMI_HBA_ATTRIB_NUM_PORTS, /* 0x000E */ 1537 + FDMI_HBA_ATTRIB_FABRIC_NAME, /* 0x000F */ 1538 + FDMI_HBA_ATTRIB_BIOS_VER, /* 0x0010 */ 1539 + FDMI_HBA_ATTRIB_VENDOR_ID = 0x00E0, 1534 1540 1535 1541 FDMI_HBA_ATTRIB_MAX_TYPE 1536 1542 }; ··· 1551 1545 FDMI_PORT_ATTRIB_FRAME_SIZE, /* 0x0004 */ 1552 1546 FDMI_PORT_ATTRIB_DEV_NAME, /* 0x0005 */ 1553 1547 FDMI_PORT_ATTRIB_HOST_NAME, /* 0x0006 */ 1548 + FDMI_PORT_ATTRIB_NODE_NAME, /* 0x0007 */ 1549 + FDMI_PORT_ATTRIB_PORT_NAME, /* 0x0008 */ 1550 + FDMI_PORT_ATTRIB_PORT_SYM_NAME, /* 0x0009 */ 1551 + FDMI_PORT_ATTRIB_PORT_TYPE, /* 0x000A */ 1552 + FDMI_PORT_ATTRIB_SUPP_COS, /* 0x000B */ 1553 + FDMI_PORT_ATTRIB_PORT_FAB_NAME, /* 0x000C */ 1554 + FDMI_PORT_ATTRIB_PORT_FC4_TYPE, /* 0x000D */ 1555 + FDMI_PORT_ATTRIB_PORT_STATE = 0x101, /* 0x0101 */ 1556 + FDMI_PORT_ATTRIB_PORT_NUM_RPRT = 0x102, /* 0x0102 */ 1554 1557 1555 1558 FDMI_PORT_ATTR_MAX_TYPE 1556 1559 };
+19 -2
drivers/scsi/bfa/bfa_fcs.h
··· 627 627 628 628 #define BFA_FCS_FDMI_SUPP_SPEEDS_10G FDMI_TRANS_SPEED_10G 629 629 630 + #define BFA_FCS_FDMI_VENDOR_INFO_LEN 8 631 + #define BFA_FCS_FDMI_FC4_TYPE_LEN 32 632 + 630 633 /* 631 634 * HBA Attribute Block : BFA internal representation. Note : Some variable 632 635 * sizes have been trimmed to suit BFA For Ex : Model will be "Brocade". Based ··· 640 637 u8 manufacturer[64]; 641 638 u8 serial_num[64]; 642 639 u8 model[16]; 643 - u8 model_desc[256]; 640 + u8 model_desc[128]; 644 641 u8 hw_version[8]; 645 642 u8 driver_version[BFA_VERSION_LEN]; 646 643 u8 option_rom_ver[BFA_VERSION_LEN]; 647 644 u8 fw_version[BFA_VERSION_LEN]; 648 645 u8 os_name[256]; 649 646 __be32 max_ct_pyld; 647 + struct bfa_lport_symname_s node_sym_name; 648 + u8 vendor_info[BFA_FCS_FDMI_VENDOR_INFO_LEN]; 649 + __be32 num_ports; 650 + wwn_t fabric_name; 651 + u8 bios_ver[BFA_VERSION_LEN]; 650 652 }; 651 653 652 654 /* 653 655 * Port Attribute Block 654 656 */ 655 657 struct bfa_fcs_fdmi_port_attr_s { 656 - u8 supp_fc4_types[32]; /* supported FC4 types */ 658 + u8 supp_fc4_types[BFA_FCS_FDMI_FC4_TYPE_LEN]; 657 659 __be32 supp_speed; /* supported speed */ 658 660 __be32 curr_speed; /* current Speed */ 659 661 __be32 max_frm_size; /* max frame size */ 660 662 u8 os_device_name[256]; /* OS device Name */ 661 663 u8 host_name[256]; /* host name */ 664 + wwn_t port_name; 665 + wwn_t node_name; 666 + struct bfa_lport_symname_s port_sym_name; 667 + __be32 port_type; 668 + enum fc_cos scos; 669 + wwn_t port_fabric_name; 670 + u8 port_act_fc4_type[BFA_FCS_FDMI_FC4_TYPE_LEN]; 671 + __be32 port_state; 672 + __be32 num_ports; 662 673 }; 663 674 664 675 struct bfa_fcs_stats_s {
+190
drivers/scsi/bfa/bfa_fcs_lport.c
··· 2048 2048 attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_MAX_CT); 2049 2049 templen = sizeof(fcs_hba_attr->max_ct_pyld); 2050 2050 memcpy(attr->value, &fcs_hba_attr->max_ct_pyld, templen); 2051 + templen = fc_roundup(templen, sizeof(u32)); 2052 + curr_ptr += sizeof(attr->type) + sizeof(templen) + templen; 2051 2053 len += templen; 2052 2054 count++; 2053 2055 attr->len = cpu_to_be16(templen + sizeof(attr->type) + 2054 2056 sizeof(templen)); 2057 + /* 2058 + * Send extended attributes ( FOS 7.1 support ) 2059 + */ 2060 + if (fdmi->retry_cnt == 0) { 2061 + attr = (struct fdmi_attr_s *) curr_ptr; 2062 + attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_NODE_SYM_NAME); 2063 + templen = sizeof(fcs_hba_attr->node_sym_name); 2064 + memcpy(attr->value, &fcs_hba_attr->node_sym_name, templen); 2065 + templen = fc_roundup(templen, sizeof(u32)); 2066 + curr_ptr += sizeof(attr->type) + sizeof(templen) + templen; 2067 + len += templen; 2068 + count++; 2069 + attr->len = cpu_to_be16(templen + sizeof(attr->type) + 2070 + sizeof(templen)); 2071 + 2072 + attr = (struct fdmi_attr_s *) curr_ptr; 2073 + attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_VENDOR_ID); 2074 + templen = sizeof(fcs_hba_attr->vendor_info); 2075 + memcpy(attr->value, &fcs_hba_attr->vendor_info, templen); 2076 + templen = fc_roundup(templen, sizeof(u32)); 2077 + curr_ptr += sizeof(attr->type) + sizeof(templen) + templen; 2078 + len += templen; 2079 + count++; 2080 + attr->len = cpu_to_be16(templen + sizeof(attr->type) + 2081 + sizeof(templen)); 2082 + 2083 + attr = (struct fdmi_attr_s *) curr_ptr; 2084 + attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_NUM_PORTS); 2085 + templen = sizeof(fcs_hba_attr->num_ports); 2086 + memcpy(attr->value, &fcs_hba_attr->num_ports, templen); 2087 + templen = fc_roundup(templen, sizeof(u32)); 2088 + curr_ptr += sizeof(attr->type) + sizeof(templen) + templen; 2089 + len += templen; 2090 + count++; 2091 + attr->len = cpu_to_be16(templen + sizeof(attr->type) + 2092 + sizeof(templen)); 2093 + 2094 + attr = (struct fdmi_attr_s *) curr_ptr; 2095 + attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_FABRIC_NAME); 2096 + templen = sizeof(fcs_hba_attr->fabric_name); 2097 + memcpy(attr->value, &fcs_hba_attr->fabric_name, templen); 2098 + templen = fc_roundup(templen, sizeof(u32)); 2099 + curr_ptr += sizeof(attr->type) + sizeof(templen) + templen; 2100 + len += templen; 2101 + count++; 2102 + attr->len = cpu_to_be16(templen + sizeof(attr->type) + 2103 + sizeof(templen)); 2104 + 2105 + attr = (struct fdmi_attr_s *) curr_ptr; 2106 + attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_BIOS_VER); 2107 + templen = sizeof(fcs_hba_attr->bios_ver); 2108 + memcpy(attr->value, &fcs_hba_attr->bios_ver, templen); 2109 + templen = fc_roundup(attr->len, sizeof(u32)); 2110 + curr_ptr += sizeof(attr->type) + sizeof(templen) + templen; 2111 + len += templen; 2112 + count++; 2113 + attr->len = cpu_to_be16(templen + sizeof(attr->type) + 2114 + sizeof(templen)); 2115 + } 2055 2116 2056 2117 /* 2057 2118 * Update size of payload ··· 2305 2244 attr->type = cpu_to_be16(FDMI_PORT_ATTRIB_HOST_NAME); 2306 2245 templen = (u16) strlen(fcs_port_attr.host_name); 2307 2246 memcpy(attr->value, fcs_port_attr.host_name, templen); 2247 + templen = fc_roundup(templen, sizeof(u32)); 2248 + curr_ptr += sizeof(attr->type) + sizeof(templen) + templen; 2249 + len += templen; 2250 + ++count; 2251 + attr->len = cpu_to_be16(templen + sizeof(attr->type) + 2252 + sizeof(templen)); 2253 + } 2254 + 2255 + if (fdmi->retry_cnt == 0) { 2256 + attr = (struct fdmi_attr_s *) curr_ptr; 2257 + attr->type = cpu_to_be16(FDMI_PORT_ATTRIB_NODE_NAME); 2258 + templen = sizeof(fcs_port_attr.node_name); 2259 + memcpy(attr->value, &fcs_port_attr.node_name, templen); 2260 + templen = fc_roundup(templen, sizeof(u32)); 2261 + curr_ptr += sizeof(attr->type) + sizeof(templen) + templen; 2262 + len += templen; 2263 + ++count; 2264 + attr->len = cpu_to_be16(templen + sizeof(attr->type) + 2265 + sizeof(templen)); 2266 + 2267 + attr = (struct fdmi_attr_s *) curr_ptr; 2268 + attr->type = cpu_to_be16(FDMI_PORT_ATTRIB_PORT_NAME); 2269 + templen = sizeof(fcs_port_attr.port_name); 2270 + memcpy(attr->value, &fcs_port_attr.port_name, templen); 2271 + templen = fc_roundup(templen, sizeof(u32)); 2272 + curr_ptr += sizeof(attr->type) + sizeof(attr->len) + templen; 2273 + len += templen; 2274 + ++count; 2275 + attr->len = cpu_to_be16(templen + sizeof(attr->type) + 2276 + sizeof(templen)); 2277 + 2278 + if (fcs_port_attr.port_sym_name.symname[0] != '\0') { 2279 + attr = (struct fdmi_attr_s *) curr_ptr; 2280 + attr->type = 2281 + cpu_to_be16(FDMI_PORT_ATTRIB_PORT_SYM_NAME); 2282 + templen = sizeof(fcs_port_attr.port_sym_name); 2283 + memcpy(attr->value, 2284 + &fcs_port_attr.port_sym_name, templen); 2285 + templen = fc_roundup(templen, sizeof(u32)); 2286 + curr_ptr += sizeof(attr->type) + 2287 + sizeof(templen) + templen; 2288 + len += templen; 2289 + ++count; 2290 + attr->len = cpu_to_be16(templen + 2291 + sizeof(attr->type) + sizeof(templen)); 2292 + } 2293 + 2294 + attr = (struct fdmi_attr_s *) curr_ptr; 2295 + attr->type = cpu_to_be16(FDMI_PORT_ATTRIB_PORT_TYPE); 2296 + templen = sizeof(fcs_port_attr.port_type); 2297 + memcpy(attr->value, &fcs_port_attr.port_type, templen); 2298 + templen = fc_roundup(templen, sizeof(u32)); 2299 + curr_ptr += sizeof(attr->type) + sizeof(templen) + templen; 2300 + len += templen; 2301 + ++count; 2302 + attr->len = cpu_to_be16(templen + sizeof(attr->type) + 2303 + sizeof(templen)); 2304 + 2305 + attr = (struct fdmi_attr_s *) curr_ptr; 2306 + attr->type = cpu_to_be16(FDMI_PORT_ATTRIB_SUPP_COS); 2307 + templen = sizeof(fcs_port_attr.scos); 2308 + memcpy(attr->value, &fcs_port_attr.scos, templen); 2309 + templen = fc_roundup(templen, sizeof(u32)); 2310 + curr_ptr += sizeof(attr->type) + sizeof(templen) + templen; 2311 + len += templen; 2312 + ++count; 2313 + attr->len = cpu_to_be16(templen + sizeof(attr->type) + 2314 + sizeof(templen)); 2315 + 2316 + attr = (struct fdmi_attr_s *) curr_ptr; 2317 + attr->type = cpu_to_be16(FDMI_PORT_ATTRIB_PORT_FAB_NAME); 2318 + templen = sizeof(fcs_port_attr.port_fabric_name); 2319 + memcpy(attr->value, &fcs_port_attr.port_fabric_name, templen); 2320 + templen = fc_roundup(templen, sizeof(u32)); 2321 + curr_ptr += sizeof(attr->type) + sizeof(templen) + templen; 2322 + len += templen; 2323 + ++count; 2324 + attr->len = cpu_to_be16(templen + sizeof(attr->type) + 2325 + sizeof(templen)); 2326 + 2327 + attr = (struct fdmi_attr_s *) curr_ptr; 2328 + attr->type = cpu_to_be16(FDMI_PORT_ATTRIB_PORT_FC4_TYPE); 2329 + templen = sizeof(fcs_port_attr.port_act_fc4_type); 2330 + memcpy(attr->value, fcs_port_attr.port_act_fc4_type, 2331 + templen); 2332 + templen = fc_roundup(templen, sizeof(u32)); 2333 + curr_ptr += sizeof(attr->type) + sizeof(templen) + templen; 2334 + len += templen; 2335 + ++count; 2336 + attr->len = cpu_to_be16(templen + sizeof(attr->type) + 2337 + sizeof(templen)); 2338 + 2339 + attr = (struct fdmi_attr_s *) curr_ptr; 2340 + attr->type = cpu_to_be16(FDMI_PORT_ATTRIB_PORT_STATE); 2341 + templen = sizeof(fcs_port_attr.port_state); 2342 + memcpy(attr->value, &fcs_port_attr.port_state, templen); 2343 + templen = fc_roundup(templen, sizeof(u32)); 2344 + curr_ptr += sizeof(attr->type) + sizeof(templen) + templen; 2345 + len += templen; 2346 + ++count; 2347 + attr->len = cpu_to_be16(templen + sizeof(attr->type) + 2348 + sizeof(templen)); 2349 + 2350 + attr = (struct fdmi_attr_s *) curr_ptr; 2351 + attr->type = cpu_to_be16(FDMI_PORT_ATTRIB_PORT_NUM_RPRT); 2352 + templen = sizeof(fcs_port_attr.num_ports); 2353 + memcpy(attr->value, &fcs_port_attr.num_ports, templen); 2308 2354 templen = fc_roundup(templen, sizeof(u32)); 2309 2355 curr_ptr += sizeof(attr->type) + sizeof(templen) + templen; 2310 2356 len += templen; ··· 2626 2458 /* Retrieve the max frame size from the port attr */ 2627 2459 bfa_fcs_fdmi_get_portattr(fdmi, &fcs_port_attr); 2628 2460 hba_attr->max_ct_pyld = fcs_port_attr.max_frm_size; 2461 + 2462 + strncpy(hba_attr->node_sym_name.symname, 2463 + port->port_cfg.node_sym_name.symname, BFA_SYMNAME_MAXLEN); 2464 + strcpy(hba_attr->vendor_info, "BROCADE"); 2465 + hba_attr->num_ports = 2466 + cpu_to_be32(bfa_ioc_get_nports(&port->fcs->bfa->ioc)); 2467 + hba_attr->fabric_name = port->fabric->lps->pr_nwwn; 2468 + strncpy(hba_attr->bios_ver, hba_attr->option_rom_ver, BFA_VERSION_LEN); 2469 + 2629 2470 } 2630 2471 2631 2472 static void ··· 2644 2467 struct bfa_fcs_lport_s *port = fdmi->ms->port; 2645 2468 struct bfa_fcs_driver_info_s *driver_info = &port->fcs->driver_info; 2646 2469 struct bfa_port_attr_s pport_attr; 2470 + struct bfa_lport_attr_s lport_attr; 2647 2471 2648 2472 memset(port_attr, 0, sizeof(struct bfa_fcs_fdmi_port_attr_s)); 2649 2473 ··· 2709 2531 strncpy(port_attr->host_name, (char *)driver_info->host_machine_name, 2710 2532 sizeof(port_attr->host_name)); 2711 2533 2534 + port_attr->node_name = bfa_fcs_lport_get_nwwn(port); 2535 + port_attr->port_name = bfa_fcs_lport_get_pwwn(port); 2536 + 2537 + strncpy(port_attr->port_sym_name.symname, 2538 + (char *)&bfa_fcs_lport_get_psym_name(port), BFA_SYMNAME_MAXLEN); 2539 + bfa_fcs_lport_get_attr(port, &lport_attr); 2540 + port_attr->port_type = cpu_to_be32(lport_attr.port_type); 2541 + port_attr->scos = pport_attr.cos_supported; 2542 + port_attr->port_fabric_name = port->fabric->lps->pr_nwwn; 2543 + fc_get_fc4type_bitmask(FC_TYPE_FCP, port_attr->port_act_fc4_type); 2544 + port_attr->port_state = cpu_to_be32(pport_attr.port_state); 2545 + port_attr->num_ports = cpu_to_be32(port->num_rports); 2712 2546 } 2713 2547 2714 2548 /*