diff options
author | Vladislav Zolotarov <vladz@broadcom.com> | 2011-07-21 03:56:51 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-07-21 15:33:56 -0400 |
commit | bf61ee146749de86a5ac46b25d28f8da5bb39d03 (patch) | |
tree | 01e73869a9aee32b72c1ac7203f4bd2036a68f91 /drivers | |
parent | 7ad711b49e661a0979ed1a84bed16bc9fa7f872b (diff) |
bnx2x: Implementation for netdev->ndo_fcoe_get_wwn
Signed-off-by: Vladislav Zolotarov <vladz@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/bnx2x/bnx2x_cmn.c | 23 | ||||
-rw-r--r-- | drivers/net/bnx2x/bnx2x_cmn.h | 11 | ||||
-rw-r--r-- | drivers/net/bnx2x/bnx2x_main.c | 60 | ||||
-rw-r--r-- | drivers/net/cnic_if.h | 5 |
4 files changed, 96 insertions, 3 deletions
diff --git a/drivers/net/bnx2x/bnx2x_cmn.c b/drivers/net/bnx2x/bnx2x_cmn.c index 8b079dcd5b96..3aadc306c8d2 100644 --- a/drivers/net/bnx2x/bnx2x_cmn.c +++ b/drivers/net/bnx2x/bnx2x_cmn.c | |||
@@ -3327,6 +3327,29 @@ int bnx2x_get_link_cfg_idx(struct bnx2x *bp) | |||
3327 | return LINK_CONFIG_IDX(sel_phy_idx); | 3327 | return LINK_CONFIG_IDX(sel_phy_idx); |
3328 | } | 3328 | } |
3329 | 3329 | ||
3330 | #if defined(NETDEV_FCOE_WWNN) && defined(BCM_CNIC) | ||
3331 | int bnx2x_fcoe_get_wwn(struct net_device *dev, u64 *wwn, int type) | ||
3332 | { | ||
3333 | struct bnx2x *bp = netdev_priv(dev); | ||
3334 | struct cnic_eth_dev *cp = &bp->cnic_eth_dev; | ||
3335 | |||
3336 | switch (type) { | ||
3337 | case NETDEV_FCOE_WWNN: | ||
3338 | *wwn = HILO_U64(cp->fcoe_wwn_node_name_hi, | ||
3339 | cp->fcoe_wwn_node_name_lo); | ||
3340 | break; | ||
3341 | case NETDEV_FCOE_WWPN: | ||
3342 | *wwn = HILO_U64(cp->fcoe_wwn_port_name_hi, | ||
3343 | cp->fcoe_wwn_port_name_lo); | ||
3344 | break; | ||
3345 | default: | ||
3346 | return -EINVAL; | ||
3347 | } | ||
3348 | |||
3349 | return 0; | ||
3350 | } | ||
3351 | #endif | ||
3352 | |||
3330 | /* called with rtnl_lock */ | 3353 | /* called with rtnl_lock */ |
3331 | int bnx2x_change_mtu(struct net_device *dev, int new_mtu) | 3354 | int bnx2x_change_mtu(struct net_device *dev, int new_mtu) |
3332 | { | 3355 | { |
diff --git a/drivers/net/bnx2x/bnx2x_cmn.h b/drivers/net/bnx2x/bnx2x_cmn.h index 83d7d1bb7b12..223bfeebc597 100644 --- a/drivers/net/bnx2x/bnx2x_cmn.h +++ b/drivers/net/bnx2x/bnx2x_cmn.h | |||
@@ -522,6 +522,17 @@ void bnx2x_free_mem_bp(struct bnx2x *bp); | |||
522 | */ | 522 | */ |
523 | int bnx2x_change_mtu(struct net_device *dev, int new_mtu); | 523 | int bnx2x_change_mtu(struct net_device *dev, int new_mtu); |
524 | 524 | ||
525 | #if defined(BCM_CNIC) && (defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE)) | ||
526 | /** | ||
527 | * bnx2x_fcoe_get_wwn - return the requested WWN value for this port | ||
528 | * | ||
529 | * @dev: net_device | ||
530 | * @wwn: output buffer | ||
531 | * @type: WWN type: NETDEV_FCOE_WWNN (node) or NETDEV_FCOE_WWPN (port) | ||
532 | * | ||
533 | */ | ||
534 | int bnx2x_fcoe_get_wwn(struct net_device *dev, u64 *wwn, int type); | ||
535 | #endif | ||
525 | u32 bnx2x_fix_features(struct net_device *dev, u32 features); | 536 | u32 bnx2x_fix_features(struct net_device *dev, u32 features); |
526 | int bnx2x_set_features(struct net_device *dev, u32 features); | 537 | int bnx2x_set_features(struct net_device *dev, u32 features); |
527 | 538 | ||
diff --git a/drivers/net/bnx2x/bnx2x_main.c b/drivers/net/bnx2x/bnx2x_main.c index 28ef7faf4480..121df1f676e3 100644 --- a/drivers/net/bnx2x/bnx2x_main.c +++ b/drivers/net/bnx2x/bnx2x_main.c | |||
@@ -9104,10 +9104,13 @@ static void __devinit bnx2x_get_port_hwinfo(struct bnx2x *bp) | |||
9104 | #ifdef BCM_CNIC | 9104 | #ifdef BCM_CNIC |
9105 | static void __devinit bnx2x_get_cnic_info(struct bnx2x *bp) | 9105 | static void __devinit bnx2x_get_cnic_info(struct bnx2x *bp) |
9106 | { | 9106 | { |
9107 | int port = BP_PORT(bp); | ||
9108 | int func = BP_ABS_FUNC(bp); | ||
9109 | |||
9107 | u32 max_iscsi_conn = FW_ENCODE_32BIT_PATTERN ^ SHMEM_RD(bp, | 9110 | u32 max_iscsi_conn = FW_ENCODE_32BIT_PATTERN ^ SHMEM_RD(bp, |
9108 | drv_lic_key[BP_PORT(bp)].max_iscsi_conn); | 9111 | drv_lic_key[port].max_iscsi_conn); |
9109 | u32 max_fcoe_conn = FW_ENCODE_32BIT_PATTERN ^ SHMEM_RD(bp, | 9112 | u32 max_fcoe_conn = FW_ENCODE_32BIT_PATTERN ^ SHMEM_RD(bp, |
9110 | drv_lic_key[BP_PORT(bp)].max_fcoe_conn); | 9113 | drv_lic_key[port].max_fcoe_conn); |
9111 | 9114 | ||
9112 | /* Get the number of maximum allowed iSCSI and FCoE connections */ | 9115 | /* Get the number of maximum allowed iSCSI and FCoE connections */ |
9113 | bp->cnic_eth_dev.max_iscsi_conn = | 9116 | bp->cnic_eth_dev.max_iscsi_conn = |
@@ -9118,11 +9121,59 @@ static void __devinit bnx2x_get_cnic_info(struct bnx2x *bp) | |||
9118 | (max_fcoe_conn & BNX2X_MAX_FCOE_INIT_CONN_MASK) >> | 9121 | (max_fcoe_conn & BNX2X_MAX_FCOE_INIT_CONN_MASK) >> |
9119 | BNX2X_MAX_FCOE_INIT_CONN_SHIFT; | 9122 | BNX2X_MAX_FCOE_INIT_CONN_SHIFT; |
9120 | 9123 | ||
9124 | /* Read the WWN: */ | ||
9125 | if (!IS_MF(bp)) { | ||
9126 | /* Port info */ | ||
9127 | bp->cnic_eth_dev.fcoe_wwn_port_name_hi = | ||
9128 | SHMEM_RD(bp, | ||
9129 | dev_info.port_hw_config[port]. | ||
9130 | fcoe_wwn_port_name_upper); | ||
9131 | bp->cnic_eth_dev.fcoe_wwn_port_name_lo = | ||
9132 | SHMEM_RD(bp, | ||
9133 | dev_info.port_hw_config[port]. | ||
9134 | fcoe_wwn_port_name_lower); | ||
9135 | |||
9136 | /* Node info */ | ||
9137 | bp->cnic_eth_dev.fcoe_wwn_node_name_hi = | ||
9138 | SHMEM_RD(bp, | ||
9139 | dev_info.port_hw_config[port]. | ||
9140 | fcoe_wwn_node_name_upper); | ||
9141 | bp->cnic_eth_dev.fcoe_wwn_node_name_lo = | ||
9142 | SHMEM_RD(bp, | ||
9143 | dev_info.port_hw_config[port]. | ||
9144 | fcoe_wwn_node_name_lower); | ||
9145 | } else if (!IS_MF_SD(bp)) { | ||
9146 | u32 cfg = MF_CFG_RD(bp, func_ext_config[func].func_cfg); | ||
9147 | |||
9148 | /* | ||
9149 | * Read the WWN info only if the FCoE feature is enabled for | ||
9150 | * this function. | ||
9151 | */ | ||
9152 | if (cfg & MACP_FUNC_CFG_FLAGS_FCOE_OFFLOAD) { | ||
9153 | /* Port info */ | ||
9154 | bp->cnic_eth_dev.fcoe_wwn_port_name_hi = | ||
9155 | MF_CFG_RD(bp, func_ext_config[func]. | ||
9156 | fcoe_wwn_port_name_upper); | ||
9157 | bp->cnic_eth_dev.fcoe_wwn_port_name_lo = | ||
9158 | MF_CFG_RD(bp, func_ext_config[func]. | ||
9159 | fcoe_wwn_port_name_lower); | ||
9160 | |||
9161 | /* Node info */ | ||
9162 | bp->cnic_eth_dev.fcoe_wwn_node_name_hi = | ||
9163 | MF_CFG_RD(bp, func_ext_config[func]. | ||
9164 | fcoe_wwn_node_name_upper); | ||
9165 | bp->cnic_eth_dev.fcoe_wwn_node_name_lo = | ||
9166 | MF_CFG_RD(bp, func_ext_config[func]. | ||
9167 | fcoe_wwn_node_name_lower); | ||
9168 | } | ||
9169 | } | ||
9170 | |||
9121 | BNX2X_DEV_INFO("max_iscsi_conn 0x%x max_fcoe_conn 0x%x\n", | 9171 | BNX2X_DEV_INFO("max_iscsi_conn 0x%x max_fcoe_conn 0x%x\n", |
9122 | bp->cnic_eth_dev.max_iscsi_conn, | 9172 | bp->cnic_eth_dev.max_iscsi_conn, |
9123 | bp->cnic_eth_dev.max_fcoe_conn); | 9173 | bp->cnic_eth_dev.max_fcoe_conn); |
9124 | 9174 | ||
9125 | /* If mamimum allowed number of connections is zero - | 9175 | /* |
9176 | * If maximum allowed number of connections is zero - | ||
9126 | * disable the feature. | 9177 | * disable the feature. |
9127 | */ | 9178 | */ |
9128 | if (!bp->cnic_eth_dev.max_iscsi_conn) | 9179 | if (!bp->cnic_eth_dev.max_iscsi_conn) |
@@ -9993,6 +10044,9 @@ static const struct net_device_ops bnx2x_netdev_ops = { | |||
9993 | #endif | 10044 | #endif |
9994 | .ndo_setup_tc = bnx2x_setup_tc, | 10045 | .ndo_setup_tc = bnx2x_setup_tc, |
9995 | 10046 | ||
10047 | #if defined(NETDEV_FCOE_WWNN) && defined(BCM_CNIC) | ||
10048 | .ndo_fcoe_get_wwn = bnx2x_fcoe_get_wwn, | ||
10049 | #endif | ||
9996 | }; | 10050 | }; |
9997 | 10051 | ||
9998 | static inline int bnx2x_set_coherency_mask(struct bnx2x *bp) | 10052 | static inline int bnx2x_set_coherency_mask(struct bnx2x *bp) |
diff --git a/drivers/net/cnic_if.h b/drivers/net/cnic_if.h index 642b9d56a1c6..8a1ffbe123bb 100644 --- a/drivers/net/cnic_if.h +++ b/drivers/net/cnic_if.h | |||
@@ -181,6 +181,11 @@ struct cnic_eth_dev { | |||
181 | u32 max_fcoe_conn; | 181 | u32 max_fcoe_conn; |
182 | u32 max_rdma_conn; | 182 | u32 max_rdma_conn; |
183 | u32 fcoe_init_cid; | 183 | u32 fcoe_init_cid; |
184 | u32 fcoe_wwn_port_name_hi; | ||
185 | u32 fcoe_wwn_port_name_lo; | ||
186 | u32 fcoe_wwn_node_name_hi; | ||
187 | u32 fcoe_wwn_node_name_lo; | ||
188 | |||
184 | u16 iscsi_l2_client_id; | 189 | u16 iscsi_l2_client_id; |
185 | u16 iscsi_l2_cid; | 190 | u16 iscsi_l2_cid; |
186 | u8 iscsi_mac[ETH_ALEN]; | 191 | u8 iscsi_mac[ETH_ALEN]; |