Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 236833
b: refs/heads/master
c: 2ba4514
h: refs/heads/master
i:
  236831: 2aadb29
v: v3
  • Loading branch information
Vladislav Zolotarov authored and David S. Miller committed Feb 1, 2011
1 parent 00d19c9 commit 8f74145
Show file tree
Hide file tree
Showing 7 changed files with 147 additions and 150 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0c838ff1ade71162775afffd9e5c6478a60bdca6
refs/heads/master: 2ba451421b23636c45fabfa522858c5c124b3673
2 changes: 2 additions & 0 deletions trunk/drivers/net/bnx2.h
Original file line number Diff line number Diff line change
Expand Up @@ -6207,6 +6207,8 @@ struct l2_fhdr {

#define BNX2_CP_SCRATCH 0x001a0000

#define BNX2_FW_MAX_ISCSI_CONN 0x001a0080


/*
* mcp_reg definition
Expand Down
5 changes: 4 additions & 1 deletion trunk/drivers/net/bnx2x/bnx2x.h
Original file line number Diff line number Diff line change
Expand Up @@ -976,8 +976,12 @@ struct bnx2x {
#define MF_FUNC_DIS 0x1000
#define FCOE_MACS_SET 0x2000
#define NO_FCOE_FLAG 0x4000
#define NO_ISCSI_OOO_FLAG 0x8000
#define NO_ISCSI_FLAG 0x10000

#define NO_FCOE(bp) ((bp)->flags & NO_FCOE_FLAG)
#define NO_ISCSI(bp) ((bp)->flags & NO_ISCSI_FLAG)
#define NO_ISCSI_OOO(bp) ((bp)->flags & NO_ISCSI_OOO_FLAG)

int pf_num; /* absolute PF number */
int pfid; /* per-path PF number */
Expand Down Expand Up @@ -1125,7 +1129,6 @@ struct bnx2x {
u16 cnic_kwq_pending;
u16 cnic_spq_pending;
struct mutex cnic_mutex;
u8 iscsi_mac[ETH_ALEN];
u8 fip_mac[ETH_ALEN];
#endif

Expand Down
25 changes: 16 additions & 9 deletions trunk/drivers/net/bnx2x/bnx2x_hsi.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,27 @@

#include "bnx2x_fw_defs.h"

#define FW_ENCODE_32BIT_PATTERN 0x1e1e1e1e

struct license_key {
u32 reserved[6];

#if defined(__BIG_ENDIAN)
u16 max_iscsi_init_conn;
u16 max_iscsi_trgt_conn;
#elif defined(__LITTLE_ENDIAN)
u16 max_iscsi_trgt_conn;
u16 max_iscsi_init_conn;
#endif
u32 max_iscsi_conn;
#define BNX2X_MAX_ISCSI_TRGT_CONN_MASK 0xFFFF
#define BNX2X_MAX_ISCSI_TRGT_CONN_SHIFT 0
#define BNX2X_MAX_ISCSI_INIT_CONN_MASK 0xFFFF0000
#define BNX2X_MAX_ISCSI_INIT_CONN_SHIFT 16

u32 reserved_a[6];
};
u32 reserved_a;

u32 max_fcoe_conn;
#define BNX2X_MAX_FCOE_TRGT_CONN_MASK 0xFFFF
#define BNX2X_MAX_FCOE_TRGT_CONN_SHIFT 0
#define BNX2X_MAX_FCOE_INIT_CONN_MASK 0xFFFF0000
#define BNX2X_MAX_FCOE_INIT_CONN_SHIFT 16

u32 reserved_b[4];
};

#define PORT_0 0
#define PORT_1 1
Expand Down
112 changes: 100 additions & 12 deletions trunk/drivers/net/bnx2x/bnx2x_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -6456,12 +6456,13 @@ static int bnx2x_set_iscsi_eth_mac_addr(struct bnx2x *bp, int set)
u32 iscsi_l2_cl_id = BNX2X_ISCSI_ETH_CL_ID +
BP_E1HVN(bp) * NONE_ETH_CONTEXT_USE;
u32 cl_bit_vec = (1 << iscsi_l2_cl_id);
u8 *iscsi_mac = bp->cnic_eth_dev.iscsi_mac;

/* Send a SET_MAC ramrod */
bnx2x_set_mac_addr_gen(bp, set, bp->iscsi_mac, cl_bit_vec,
bnx2x_set_mac_addr_gen(bp, set, iscsi_mac, cl_bit_vec,
cam_offset, 0);

bnx2x_set_mac_in_nig(bp, set, bp->iscsi_mac, LLH_CAM_ISCSI_ETH_LINE);
bnx2x_set_mac_in_nig(bp, set, iscsi_mac, LLH_CAM_ISCSI_ETH_LINE);

return 0;
}
Expand Down Expand Up @@ -8385,11 +8386,47 @@ static void __devinit bnx2x_get_port_hwinfo(struct bnx2x *bp)
bp->common.shmem2_base);
}

#ifdef BCM_CNIC
static void __devinit bnx2x_get_cnic_info(struct bnx2x *bp)
{
u32 max_iscsi_conn = FW_ENCODE_32BIT_PATTERN ^ SHMEM_RD(bp,
drv_lic_key[BP_PORT(bp)].max_iscsi_conn);
u32 max_fcoe_conn = FW_ENCODE_32BIT_PATTERN ^ SHMEM_RD(bp,
drv_lic_key[BP_PORT(bp)].max_fcoe_conn);

/* Get the number of maximum allowed iSCSI and FCoE connections */
bp->cnic_eth_dev.max_iscsi_conn =
(max_iscsi_conn & BNX2X_MAX_ISCSI_INIT_CONN_MASK) >>
BNX2X_MAX_ISCSI_INIT_CONN_SHIFT;

bp->cnic_eth_dev.max_fcoe_conn =
(max_fcoe_conn & BNX2X_MAX_FCOE_INIT_CONN_MASK) >>
BNX2X_MAX_FCOE_INIT_CONN_SHIFT;

BNX2X_DEV_INFO("max_iscsi_conn 0x%x max_fcoe_conn 0x%x\n",
bp->cnic_eth_dev.max_iscsi_conn,
bp->cnic_eth_dev.max_fcoe_conn);

/* If mamimum allowed number of connections is zero -
* disable the feature.
*/
if (!bp->cnic_eth_dev.max_iscsi_conn)
bp->flags |= NO_ISCSI_OOO_FLAG | NO_ISCSI_FLAG;

if (!bp->cnic_eth_dev.max_fcoe_conn)
bp->flags |= NO_FCOE_FLAG;
}
#endif

static void __devinit bnx2x_get_mac_hwinfo(struct bnx2x *bp)
{
u32 val, val2;
int func = BP_ABS_FUNC(bp);
int port = BP_PORT(bp);
#ifdef BCM_CNIC
u8 *iscsi_mac = bp->cnic_eth_dev.iscsi_mac;
u8 *fip_mac = bp->fip_mac;
#endif

if (BP_NOMCP(bp)) {
BNX2X_ERROR("warning: random MAC workaround active\n");
Expand All @@ -8402,16 +8439,49 @@ static void __devinit bnx2x_get_mac_hwinfo(struct bnx2x *bp)
bnx2x_set_mac_buf(bp->dev->dev_addr, val, val2);

#ifdef BCM_CNIC
/* iSCSI NPAR MAC */
/* iSCSI and FCoE NPAR MACs: if there is no either iSCSI or
* FCoE MAC then the appropriate feature should be disabled.
*/
if (IS_MF_SI(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].
iscsi_mac_addr_upper);
val = MF_CFG_RD(bp, func_ext_config[func].
iscsi_mac_addr_lower);
bnx2x_set_mac_buf(bp->iscsi_mac, val, val2);
}
BNX2X_DEV_INFO("Read iSCSI MAC: "
"0x%x:0x%04x\n", val2, val);
bnx2x_set_mac_buf(iscsi_mac, val, val2);

/* Disable iSCSI OOO if MAC configuration is
* invalid.
*/
if (!is_valid_ether_addr(iscsi_mac)) {
bp->flags |= NO_ISCSI_OOO_FLAG |
NO_ISCSI_FLAG;
memset(iscsi_mac, 0, ETH_ALEN);
}
} else
bp->flags |= NO_ISCSI_OOO_FLAG | NO_ISCSI_FLAG;

if (cfg & MACP_FUNC_CFG_FLAGS_FCOE_OFFLOAD) {
val2 = MF_CFG_RD(bp, func_ext_config[func].
fcoe_mac_addr_upper);
val = MF_CFG_RD(bp, func_ext_config[func].
fcoe_mac_addr_lower);
BNX2X_DEV_INFO("Read FCoE MAC to "
"0x%x:0x%04x\n", val2, val);
bnx2x_set_mac_buf(fip_mac, val, val2);

/* Disable FCoE if MAC configuration is
* invalid.
*/
if (!is_valid_ether_addr(fip_mac)) {
bp->flags |= NO_FCOE_FLAG;
memset(bp->fip_mac, 0, ETH_ALEN);
}
} else
bp->flags |= NO_FCOE_FLAG;
}
#endif
} else {
Expand All @@ -8425,22 +8495,20 @@ static void __devinit bnx2x_get_mac_hwinfo(struct bnx2x *bp)
iscsi_mac_upper);
val = SHMEM_RD(bp, dev_info.port_hw_config[port].
iscsi_mac_lower);
bnx2x_set_mac_buf(bp->iscsi_mac, val, val2);
bnx2x_set_mac_buf(iscsi_mac, val, val2);
#endif
}

memcpy(bp->link_params.mac_addr, bp->dev->dev_addr, ETH_ALEN);
memcpy(bp->dev->perm_addr, bp->dev->dev_addr, ETH_ALEN);

#ifdef BCM_CNIC
/* Inform the upper layers about FCoE MAC */
/* Set the FCoE MAC in modes other then MF_SI */
if (!CHIP_IS_E1x(bp)) {
if (IS_MF_SD(bp))
memcpy(bp->fip_mac, bp->dev->dev_addr,
sizeof(bp->fip_mac));
else
memcpy(bp->fip_mac, bp->iscsi_mac,
sizeof(bp->fip_mac));
memcpy(fip_mac, bp->dev->dev_addr, ETH_ALEN);
else if (!IS_MF(bp))
memcpy(fip_mac, iscsi_mac, ETH_ALEN);
}
#endif
}
Expand Down Expand Up @@ -8603,6 +8671,10 @@ static int __devinit bnx2x_get_hwinfo(struct bnx2x *bp)
/* Get MAC addresses */
bnx2x_get_mac_hwinfo(bp);

#ifdef BCM_CNIC
bnx2x_get_cnic_info(bp);
#endif

return rc;
}

Expand Down Expand Up @@ -10077,6 +10149,13 @@ struct cnic_eth_dev *bnx2x_cnic_probe(struct net_device *dev)
struct bnx2x *bp = netdev_priv(dev);
struct cnic_eth_dev *cp = &bp->cnic_eth_dev;

/* If both iSCSI and FCoE are disabled - return NULL in
* order to indicate CNIC that it should not try to work
* with this device.
*/
if (NO_ISCSI(bp) && NO_FCOE(bp))
return NULL;

cp->drv_owner = THIS_MODULE;
cp->chip_id = CHIP_ID(bp);
cp->pdev = bp->pdev;
Expand All @@ -10097,6 +10176,15 @@ struct cnic_eth_dev *bnx2x_cnic_probe(struct net_device *dev)
BP_E1HVN(bp) * NONE_ETH_CONTEXT_USE;
cp->iscsi_l2_cid = BNX2X_ISCSI_ETH_CID;

if (NO_ISCSI_OOO(bp))
cp->drv_state |= CNIC_DRV_STATE_NO_ISCSI_OOO;

if (NO_ISCSI(bp))
cp->drv_state |= CNIC_DRV_STATE_NO_ISCSI;

if (NO_FCOE(bp))
cp->drv_state |= CNIC_DRV_STATE_NO_FCOE;

DP(BNX2X_MSG_SP, "page_size %d, tbl_offset %d, tbl_lines %d, "
"starting cid %d\n",
cp->ctx_blk_size,
Expand Down
Loading

0 comments on commit 8f74145

Please sign in to comment.