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

bnx2x: changed iscsi/fcoe mac init and macros

This includes changes in macros to better distinguish between the two
protocols, and slightly changed the way their macs are set.
Notice this file contains string print lines with more than 80 characters,
as to not break prints.

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Dmitry Kravkov and committed by
David S. Miller
9e62e912 910b2202

+63 -43
+12 -4
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
··· 2117 2117 void bnx2x_notify_link_changed(struct bnx2x *bp); 2118 2118 2119 2119 2120 - #define BNX2X_MF_PROTOCOL(bp) \ 2120 + #define BNX2X_MF_SD_PROTOCOL(bp) \ 2121 2121 ((bp)->mf_config[BP_VN(bp)] & FUNC_MF_CFG_PROTOCOL_MASK) 2122 2122 2123 2123 #ifdef BCM_CNIC 2124 - #define BNX2X_IS_MF_PROTOCOL_ISCSI(bp) \ 2125 - (BNX2X_MF_PROTOCOL(bp) == FUNC_MF_CFG_PROTOCOL_ISCSI) 2124 + #define BNX2X_IS_MF_SD_PROTOCOL_ISCSI(bp) \ 2125 + (BNX2X_MF_SD_PROTOCOL(bp) == FUNC_MF_CFG_PROTOCOL_ISCSI) 2126 2126 2127 - #define IS_MF_ISCSI_SD(bp) (IS_MF_SD(bp) && BNX2X_IS_MF_PROTOCOL_ISCSI(bp)) 2127 + #define BNX2X_IS_MF_SD_PROTOCOL_FCOE(bp) \ 2128 + (BNX2X_MF_SD_PROTOCOL(bp) == FUNC_MF_CFG_PROTOCOL_FCOE) 2129 + 2130 + #define IS_MF_ISCSI_SD(bp) (IS_MF_SD(bp) && BNX2X_IS_MF_SD_PROTOCOL_ISCSI(bp)) 2131 + #define IS_MF_FCOE_SD(bp) (IS_MF_SD(bp) && BNX2X_IS_MF_SD_PROTOCOL_FCOE(bp)) 2132 + 2133 + #define IS_MF_STORAGE_SD(bp) (IS_MF_SD(bp) && \ 2134 + (BNX2X_IS_MF_SD_PROTOCOL_ISCSI(bp) || \ 2135 + BNX2X_IS_MF_SD_PROTOCOL_FCOE(bp))) 2128 2136 #endif 2129 2137 2130 2138 #endif /* bnx2x.h */
+4 -4
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
··· 1453 1453 } 1454 1454 1455 1455 #ifdef BCM_CNIC 1456 - /* override in ISCSI SD mod */ 1457 - if (IS_MF_ISCSI_SD(bp)) 1456 + /* override in STORAGE SD mode */ 1457 + if (IS_MF_STORAGE_SD(bp)) 1458 1458 bp->num_queues = 1; 1459 1459 #endif 1460 1460 /* Add special queues */ ··· 3077 3077 } 3078 3078 3079 3079 #ifdef BCM_CNIC 3080 - if (IS_MF_ISCSI_SD(bp) && !is_zero_ether_addr(addr->sa_data)) { 3080 + if (IS_MF_STORAGE_SD(bp) && !is_zero_ether_addr(addr->sa_data)) { 3081 3081 BNX2X_ERR("Can't configure non-zero address on iSCSI or FCoE functions in MF-SD mode\n"); 3082 3082 return -EINVAL; 3083 3083 } ··· 3199 3199 int rx_ring_size = 0; 3200 3200 3201 3201 #ifdef BCM_CNIC 3202 - if (!bp->rx_ring_size && IS_MF_ISCSI_SD(bp)) { 3202 + if (!bp->rx_ring_size && IS_MF_STORAGE_SD(bp)) { 3203 3203 rx_ring_size = MIN_RX_SIZE_NONTPA; 3204 3204 bp->rx_ring_size = rx_ring_size; 3205 3205 } else
+1 -1
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
··· 1664 1664 if (is_valid_ether_addr(addr)) 1665 1665 return true; 1666 1666 #ifdef BCM_CNIC 1667 - if (is_zero_ether_addr(addr) && IS_MF_ISCSI_SD(bp)) 1667 + if (is_zero_ether_addr(addr) && IS_MF_STORAGE_SD(bp)) 1668 1668 return true; 1669 1669 #endif 1670 1670 return false;
+46 -34
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
··· 7177 7177 unsigned long ramrod_flags = 0; 7178 7178 7179 7179 #ifdef BCM_CNIC 7180 - if (is_zero_ether_addr(bp->dev->dev_addr) && IS_MF_ISCSI_SD(bp)) { 7180 + if (is_zero_ether_addr(bp->dev->dev_addr) && IS_MF_STORAGE_SD(bp)) { 7181 7181 DP(NETIF_MSG_IFUP | NETIF_MSG_IFDOWN, 7182 7182 "Ignoring Zero MAC for STORAGE SD mode\n"); 7183 7183 return 0; ··· 9479 9479 9480 9480 void bnx2x_get_iscsi_info(struct bnx2x *bp) 9481 9481 { 9482 + u32 no_flags = NO_ISCSI_FLAG; 9482 9483 #ifdef BCM_CNIC 9483 9484 int port = BP_PORT(bp); 9484 9485 ··· 9499 9498 * disable the feature. 9500 9499 */ 9501 9500 if (!bp->cnic_eth_dev.max_iscsi_conn) 9502 - bp->flags |= NO_ISCSI_FLAG; 9501 + bp->flags |= no_flags; 9503 9502 #else 9504 - bp->flags |= NO_ISCSI_FLAG; 9503 + bp->flags |= no_flags; 9505 9504 #endif 9506 9505 } 9507 9506 9507 + #ifdef BCM_CNIC 9508 + static void __devinit bnx2x_get_ext_wwn_info(struct bnx2x *bp, int func) 9509 + { 9510 + /* Port info */ 9511 + bp->cnic_eth_dev.fcoe_wwn_port_name_hi = 9512 + MF_CFG_RD(bp, func_ext_config[func].fcoe_wwn_port_name_upper); 9513 + bp->cnic_eth_dev.fcoe_wwn_port_name_lo = 9514 + MF_CFG_RD(bp, func_ext_config[func].fcoe_wwn_port_name_lower); 9515 + 9516 + /* Node info */ 9517 + bp->cnic_eth_dev.fcoe_wwn_node_name_hi = 9518 + MF_CFG_RD(bp, func_ext_config[func].fcoe_wwn_node_name_upper); 9519 + bp->cnic_eth_dev.fcoe_wwn_node_name_lo = 9520 + MF_CFG_RD(bp, func_ext_config[func].fcoe_wwn_node_name_lower); 9521 + } 9522 + #endif 9508 9523 static void __devinit bnx2x_get_fcoe_info(struct bnx2x *bp) 9509 9524 { 9510 9525 #ifdef BCM_CNIC ··· 9563 9546 * Read the WWN info only if the FCoE feature is enabled for 9564 9547 * this function. 9565 9548 */ 9566 - if (cfg & MACP_FUNC_CFG_FLAGS_FCOE_OFFLOAD) { 9567 - /* Port info */ 9568 - bp->cnic_eth_dev.fcoe_wwn_port_name_hi = 9569 - MF_CFG_RD(bp, func_ext_config[func]. 9570 - fcoe_wwn_port_name_upper); 9571 - bp->cnic_eth_dev.fcoe_wwn_port_name_lo = 9572 - MF_CFG_RD(bp, func_ext_config[func]. 9573 - fcoe_wwn_port_name_lower); 9549 + if (cfg & MACP_FUNC_CFG_FLAGS_FCOE_OFFLOAD) 9550 + bnx2x_get_ext_wwn_info(bp, func); 9574 9551 9575 - /* Node info */ 9576 - bp->cnic_eth_dev.fcoe_wwn_node_name_hi = 9577 - MF_CFG_RD(bp, func_ext_config[func]. 9578 - fcoe_wwn_node_name_upper); 9579 - bp->cnic_eth_dev.fcoe_wwn_node_name_lo = 9580 - MF_CFG_RD(bp, func_ext_config[func]. 9581 - fcoe_wwn_node_name_lower); 9582 - } 9583 - } 9552 + } else if (IS_MF_FCOE_SD(bp)) 9553 + bnx2x_get_ext_wwn_info(bp, func); 9584 9554 9585 9555 BNX2X_DEV_INFO("max_fcoe_conn 0x%x\n", bp->cnic_eth_dev.max_fcoe_conn); 9586 9556 ··· 9620 9616 /* 9621 9617 * iSCSI and FCoE NPAR MACs: if there is no either iSCSI or 9622 9618 * FCoE MAC then the appropriate feature should be disabled. 9619 + * 9620 + * In non SD mode features configuration comes from 9621 + * struct func_ext_config. 9623 9622 */ 9624 - if (IS_MF_SI(bp)) { 9623 + if (!IS_MF_SD(bp)) { 9625 9624 u32 cfg = MF_CFG_RD(bp, func_ext_config[func].func_cfg); 9626 9625 if (cfg & MACP_FUNC_CFG_FLAGS_ISCSI_OFFLOAD) { 9627 9626 val2 = MF_CFG_RD(bp, func_ext_config[func]. ··· 9648 9641 9649 9642 } else 9650 9643 bp->flags |= NO_FCOE_FLAG; 9651 - } else { /* SD mode */ 9652 - if (BNX2X_IS_MF_PROTOCOL_ISCSI(bp)) { 9653 - /* use primary mac as iscsi mac */ 9654 - memcpy(iscsi_mac, bp->dev->dev_addr, ETH_ALEN); 9644 + } else { /* SD MODE */ 9645 + if (IS_MF_STORAGE_SD(bp)) { 9646 + if (BNX2X_IS_MF_SD_PROTOCOL_ISCSI(bp)) { 9647 + /* use primary mac as iscsi mac */ 9648 + memcpy(iscsi_mac, bp->dev->dev_addr, 9649 + ETH_ALEN); 9650 + 9651 + BNX2X_DEV_INFO("SD ISCSI MODE\n"); 9652 + BNX2X_DEV_INFO("Read iSCSI MAC: %pM\n", 9653 + iscsi_mac); 9654 + } else { /* FCoE */ 9655 + memcpy(fip_mac, bp->dev->dev_addr, 9656 + ETH_ALEN); 9657 + BNX2X_DEV_INFO("SD FCoE MODE\n"); 9658 + BNX2X_DEV_INFO("Read FIP MAC: %pM\n", 9659 + fip_mac); 9660 + } 9655 9661 /* Zero primary MAC configuration */ 9656 9662 memset(bp->dev->dev_addr, 0, ETH_ALEN); 9657 - 9658 - BNX2X_DEV_INFO("SD ISCSI MODE\n"); 9659 - BNX2X_DEV_INFO("Read iSCSI MAC: %pM\n", 9660 - iscsi_mac); 9661 9663 } 9662 9664 } 9663 9665 #endif ··· 9695 9679 memcpy(bp->dev->perm_addr, bp->dev->dev_addr, ETH_ALEN); 9696 9680 9697 9681 #ifdef BCM_CNIC 9698 - /* Set the FCoE MAC in MF_SD mode */ 9699 - if (!CHIP_IS_E1x(bp) && IS_MF_SD(bp)) 9700 - memcpy(fip_mac, bp->dev->dev_addr, ETH_ALEN); 9701 - 9702 9682 /* Disable iSCSI if MAC configuration is 9703 9683 * invalid. 9704 9684 */ ··· 10104 10092 bp->disable_tpa = disable_tpa; 10105 10093 10106 10094 #ifdef BCM_CNIC 10107 - bp->disable_tpa |= IS_MF_ISCSI_SD(bp); 10095 + bp->disable_tpa |= IS_MF_STORAGE_SD(bp); 10108 10096 #endif 10109 10097 10110 10098 /* Set TPA flags */