]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
bnx2x: changed iscsi/fcoe mac init and macros
authorDmitry Kravkov <dmitry@broadcom.com>
Sun, 18 Mar 2012 10:33:43 +0000 (10:33 +0000)
committerJoe Jin <joe.jin@oracle.com>
Tue, 28 Aug 2012 07:23:23 +0000 (15:23 +0800)
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.

(cherry picked from commit 9e62e912e56742af7eb7e0eeba3c7af4bb2f8537)
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>
Signed-off-by: Joe Jin <joe.jin@oracle.com>
drivers/net/bnx2x/bnx2x.h
drivers/net/bnx2x/bnx2x_cmn.c
drivers/net/bnx2x/bnx2x_cmn.h
drivers/net/bnx2x/bnx2x_main.c

index 0a691c5a8fd92b3667f3bc1210189ece04da2210..c2ca28444cd50a663ad610aaabd6f8d278edd2fa 100644 (file)
@@ -2117,14 +2117,22 @@ void bnx2x_set_ethtool_ops(struct net_device *netdev);
 void bnx2x_notify_link_changed(struct bnx2x *bp);
 
 
-#define BNX2X_MF_PROTOCOL(bp) \
+#define BNX2X_MF_SD_PROTOCOL(bp) \
        ((bp)->mf_config[BP_VN(bp)] & FUNC_MF_CFG_PROTOCOL_MASK)
 
 #ifdef BCM_CNIC
-#define BNX2X_IS_MF_PROTOCOL_ISCSI(bp) \
-       (BNX2X_MF_PROTOCOL(bp) == FUNC_MF_CFG_PROTOCOL_ISCSI)
+#define BNX2X_IS_MF_SD_PROTOCOL_ISCSI(bp) \
+       (BNX2X_MF_SD_PROTOCOL(bp) == FUNC_MF_CFG_PROTOCOL_ISCSI)
 
-#define IS_MF_ISCSI_SD(bp) (IS_MF_SD(bp) && BNX2X_IS_MF_PROTOCOL_ISCSI(bp))
+#define BNX2X_IS_MF_SD_PROTOCOL_FCOE(bp) \
+       (BNX2X_MF_SD_PROTOCOL(bp) == FUNC_MF_CFG_PROTOCOL_FCOE)
+
+#define IS_MF_ISCSI_SD(bp) (IS_MF_SD(bp) && BNX2X_IS_MF_SD_PROTOCOL_ISCSI(bp))
+#define IS_MF_FCOE_SD(bp) (IS_MF_SD(bp) && BNX2X_IS_MF_SD_PROTOCOL_FCOE(bp))
+
+#define IS_MF_STORAGE_SD(bp) (IS_MF_SD(bp) && \
+                               (BNX2X_IS_MF_SD_PROTOCOL_ISCSI(bp) || \
+                                BNX2X_IS_MF_SD_PROTOCOL_FCOE(bp)))
 #endif
 
 #endif /* bnx2x.h */
index a8177c57d13f5ea043f56c3ccbddd87dbab9ef21..753ed663d63cee618a0d3f435d702307ae3a2024 100644 (file)
@@ -1436,8 +1436,8 @@ void bnx2x_set_num_queues(struct bnx2x *bp)
        }
 
 #ifdef BCM_CNIC
-       /* override in ISCSI SD mod */
-       if (IS_MF_ISCSI_SD(bp))
+       /* override in STORAGE SD mode */
+       if (IS_MF_STORAGE_SD(bp))
                bp->num_queues = 1;
 #endif
        /* Add special queues */
@@ -3055,7 +3055,7 @@ int bnx2x_change_mac_addr(struct net_device *dev, void *p)
        }
 
 #ifdef BCM_CNIC
-       if (IS_MF_ISCSI_SD(bp) && !is_zero_ether_addr(addr->sa_data)) {
+       if (IS_MF_STORAGE_SD(bp) && !is_zero_ether_addr(addr->sa_data)) {
                BNX2X_ERR("Can't configure non-zero address on iSCSI or FCoE functions in MF-SD mode\n");
                return -EINVAL;
        }
@@ -3176,7 +3176,7 @@ static int bnx2x_alloc_fp_mem_at(struct bnx2x *bp, int index)
        int rx_ring_size = 0;
 
 #ifdef BCM_CNIC
-       if (!bp->rx_ring_size && IS_MF_ISCSI_SD(bp)) {
+       if (!bp->rx_ring_size && IS_MF_STORAGE_SD(bp)) {
                rx_ring_size = MIN_RX_SIZE_NONTPA;
                bp->rx_ring_size = rx_ring_size;
        } else
index de96cd06953c32fdcf079e5bde57545393c4a694..ae3bba98763cbf445c49ec80e016a18287f59a4b 100644 (file)
@@ -1664,7 +1664,7 @@ static inline bool bnx2x_is_valid_ether_addr(struct bnx2x *bp, u8 *addr)
        if (is_valid_ether_addr(addr))
                return true;
 #ifdef BCM_CNIC
-       if (is_zero_ether_addr(addr) && IS_MF_ISCSI_SD(bp))
+       if (is_zero_ether_addr(addr) && IS_MF_STORAGE_SD(bp))
                return true;
 #endif
        return false;
index 2c372a949d97d56e442f9a1e97dbfd76ff9a0887..716138ca7f0160a49adda23b69cde2e1eb107e16 100644 (file)
@@ -7177,7 +7177,7 @@ int bnx2x_set_eth_mac(struct bnx2x *bp, bool set)
        unsigned long ramrod_flags = 0;
 
 #ifdef BCM_CNIC
-       if (is_zero_ether_addr(bp->dev->dev_addr) && IS_MF_ISCSI_SD(bp)) {
+       if (is_zero_ether_addr(bp->dev->dev_addr) && IS_MF_STORAGE_SD(bp)) {
                DP(NETIF_MSG_IFUP | NETIF_MSG_IFDOWN,
                   "Ignoring Zero MAC for STORAGE SD mode\n");
                return 0;
@@ -9479,6 +9479,7 @@ static void __devinit bnx2x_get_port_hwinfo(struct bnx2x *bp)
 
 void bnx2x_get_iscsi_info(struct bnx2x *bp)
 {
+       u32 no_flags = NO_ISCSI_FLAG;
 #ifdef BCM_CNIC
        int port = BP_PORT(bp);
 
@@ -9498,12 +9499,28 @@ void bnx2x_get_iscsi_info(struct bnx2x *bp)
         * disable the feature.
         */
        if (!bp->cnic_eth_dev.max_iscsi_conn)
-               bp->flags |= NO_ISCSI_FLAG;
+               bp->flags |= no_flags;
 #else
-       bp->flags |= NO_ISCSI_FLAG;
+       bp->flags |= no_flags;
 #endif
 }
 
+#ifdef BCM_CNIC
+static void __devinit bnx2x_get_ext_wwn_info(struct bnx2x *bp, int func)
+{
+       /* Port info */
+       bp->cnic_eth_dev.fcoe_wwn_port_name_hi =
+               MF_CFG_RD(bp, func_ext_config[func].fcoe_wwn_port_name_upper);
+       bp->cnic_eth_dev.fcoe_wwn_port_name_lo =
+               MF_CFG_RD(bp, func_ext_config[func].fcoe_wwn_port_name_lower);
+
+       /* Node info */
+       bp->cnic_eth_dev.fcoe_wwn_node_name_hi =
+               MF_CFG_RD(bp, func_ext_config[func].fcoe_wwn_node_name_upper);
+       bp->cnic_eth_dev.fcoe_wwn_node_name_lo =
+               MF_CFG_RD(bp, func_ext_config[func].fcoe_wwn_node_name_lower);
+}
+#endif
 static void __devinit bnx2x_get_fcoe_info(struct bnx2x *bp)
 {
 #ifdef BCM_CNIC
@@ -9546,24 +9563,11 @@ static void __devinit bnx2x_get_fcoe_info(struct bnx2x *bp)
                 * Read the WWN info only if the FCoE feature is enabled for
                 * this function.
                 */
-               if (cfg & MACP_FUNC_CFG_FLAGS_FCOE_OFFLOAD) {
-                       /* Port info */
-                       bp->cnic_eth_dev.fcoe_wwn_port_name_hi =
-                               MF_CFG_RD(bp, func_ext_config[func].
-                                               fcoe_wwn_port_name_upper);
-                       bp->cnic_eth_dev.fcoe_wwn_port_name_lo =
-                               MF_CFG_RD(bp, func_ext_config[func].
-                                               fcoe_wwn_port_name_lower);
-
-                       /* Node info */
-                       bp->cnic_eth_dev.fcoe_wwn_node_name_hi =
-                               MF_CFG_RD(bp, func_ext_config[func].
-                                               fcoe_wwn_node_name_upper);
-                       bp->cnic_eth_dev.fcoe_wwn_node_name_lo =
-                               MF_CFG_RD(bp, func_ext_config[func].
-                                               fcoe_wwn_node_name_lower);
-               }
-       }
+               if (cfg & MACP_FUNC_CFG_FLAGS_FCOE_OFFLOAD)
+                       bnx2x_get_ext_wwn_info(bp, func);
+
+       } else if (IS_MF_FCOE_SD(bp))
+               bnx2x_get_ext_wwn_info(bp, func);
 
        BNX2X_DEV_INFO("max_fcoe_conn 0x%x\n", bp->cnic_eth_dev.max_fcoe_conn);
 
@@ -9616,8 +9620,11 @@ static void __devinit bnx2x_get_mac_hwinfo(struct bnx2x *bp)
                /*
                 * iSCSI and FCoE NPAR MACs: if there is no either iSCSI or
                 * FCoE MAC then the appropriate feature should be disabled.
+                *
+                * In non SD mode features configuration comes from
+                * struct func_ext_config.
                 */
-               if (IS_MF_SI(bp)) {
+               if (!IS_MF_SD(bp)) {
                        u32 cfg = MF_CFG_RD(bp, func_ext_config[func].func_cfg);
                        if (cfg & MACP_FUNC_CFG_FLAGS_ISCSI_OFFLOAD) {
                                val2 = MF_CFG_RD(bp, func_ext_config[func].
@@ -9641,16 +9648,25 @@ static void __devinit bnx2x_get_mac_hwinfo(struct bnx2x *bp)
 
                        } else
                                bp->flags |= NO_FCOE_FLAG;
-               } else { /* SD mode */
-                       if (BNX2X_IS_MF_PROTOCOL_ISCSI(bp)) {
-                               /* use primary mac as iscsi mac */
-                               memcpy(iscsi_mac, bp->dev->dev_addr, ETH_ALEN);
+               } else { /* SD MODE */
+                       if (IS_MF_STORAGE_SD(bp)) {
+                               if (BNX2X_IS_MF_SD_PROTOCOL_ISCSI(bp)) {
+                                       /* use primary mac as iscsi mac */
+                                       memcpy(iscsi_mac, bp->dev->dev_addr,
+                                              ETH_ALEN);
+
+                                       BNX2X_DEV_INFO("SD ISCSI MODE\n");
+                                       BNX2X_DEV_INFO("Read iSCSI MAC: %pM\n",
+                                                      iscsi_mac);
+                               } else { /* FCoE */
+                                       memcpy(fip_mac, bp->dev->dev_addr,
+                                              ETH_ALEN);
+                                       BNX2X_DEV_INFO("SD FCoE MODE\n");
+                                       BNX2X_DEV_INFO("Read FIP MAC: %pM\n",
+                                                      fip_mac);
+                               }
                                /* Zero primary MAC configuration */
                                memset(bp->dev->dev_addr, 0, ETH_ALEN);
-
-                               BNX2X_DEV_INFO("SD ISCSI MODE\n");
-                               BNX2X_DEV_INFO("Read iSCSI MAC: %pM\n",
-                                              iscsi_mac);
                        }
                }
 #endif
@@ -9679,10 +9695,6 @@ static void __devinit bnx2x_get_mac_hwinfo(struct bnx2x *bp)
        memcpy(bp->dev->perm_addr, bp->dev->dev_addr, ETH_ALEN);
 
 #ifdef BCM_CNIC
-       /* Set the FCoE MAC in MF_SD mode */
-       if (!CHIP_IS_E1x(bp) && IS_MF_SD(bp))
-               memcpy(fip_mac, bp->dev->dev_addr, ETH_ALEN);
-
        /* Disable iSCSI if MAC configuration is
         * invalid.
         */
@@ -10092,7 +10104,7 @@ static int __devinit bnx2x_init_bp(struct bnx2x *bp)
        bp->disable_tpa = disable_tpa;
 
 #ifdef BCM_CNIC
-       bp->disable_tpa |= IS_MF_ISCSI_SD(bp);
+       bp->disable_tpa |= IS_MF_STORAGE_SD(bp);
 #endif
 
        /* Set TPA flags */