Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0eb43b4b authored by Bhanu Prakash Gollapudi's avatar Bhanu Prakash Gollapudi Committed by David S. Miller
Browse files

bnx2x, bnx2fc: Use per port max exchange resources



The firmware supports a maximum of 4K FCoE exchanges. In 4-port devices,
or when working in multi-function mode, this resource needs to be distributed
between the various possible FCoE functions.

This information needs to be calculated by bnx2x and propagated into bnx2fc
via cnic. bnx2fc can then use this value to calculate corresponding xid
resources instead of using global constants.

Signed-off-by: default avatarBhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: default avatarMichael Chan <mchan@broadcom.com>
Signed-off-by: default avatarYuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4c09eed9
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -386,4 +386,8 @@

#define UNDEF_IRO 0x80000000

/* used for defining the amount of FCoE tasks supported for PF */
#define MAX_FCOE_FUNCS_PER_ENGINE 2
#define MAX_NUM_FCOE_TASKS_PER_ENGINE 4096

#endif /* BNX2X_FW_DEFS_H */
+6 −0
Original line number Diff line number Diff line
@@ -10791,6 +10791,12 @@ static void bnx2x_get_fcoe_info(struct bnx2x *bp)
		(max_fcoe_conn & BNX2X_MAX_FCOE_INIT_CONN_MASK) >>
		BNX2X_MAX_FCOE_INIT_CONN_SHIFT;

	/* Calculate the number of maximum allowed FCoE tasks */
	bp->cnic_eth_dev.max_fcoe_exchanges = MAX_NUM_FCOE_TASKS_PER_ENGINE;
	if (IS_MF(bp) || CHIP_MODE_IS_4_PORT(bp))
		bp->cnic_eth_dev.max_fcoe_exchanges /=
						MAX_FCOE_FUNCS_PER_ENGINE;

	/* Read the WWN: */
	if (!IS_MF(bp)) {
		/* Port info */
+3 −1
Original line number Diff line number Diff line
@@ -5544,8 +5544,10 @@ static struct cnic_dev *init_bnx2x_cnic(struct net_device *dev)

	if (!(ethdev->drv_state & CNIC_DRV_STATE_NO_ISCSI))
		cdev->max_iscsi_conn = ethdev->max_iscsi_conn;
	if (CNIC_SUPPORTS_FCOE(cp))
	if (CNIC_SUPPORTS_FCOE(cp)) {
		cdev->max_fcoe_conn = ethdev->max_fcoe_conn;
		cdev->max_fcoe_exchanges = ethdev->max_fcoe_exchanges;
	}

	if (cdev->max_fcoe_conn > BNX2X_FCOE_NUM_CONNECTIONS)
		cdev->max_fcoe_conn = BNX2X_FCOE_NUM_CONNECTIONS;
+3 −0
Original line number Diff line number Diff line
@@ -195,6 +195,7 @@ struct cnic_eth_dev {
	u32		max_fcoe_conn;
	u32		max_rdma_conn;
	u32		fcoe_init_cid;
	u32		max_fcoe_exchanges;
	u32		fcoe_wwn_port_name_hi;
	u32		fcoe_wwn_port_name_lo;
	u32		fcoe_wwn_node_name_hi;
@@ -313,6 +314,8 @@ struct cnic_dev {
	int		max_fcoe_conn;
	int		max_rdma_conn;

	int		max_fcoe_exchanges;

	union drv_info_to_mcp	*stats_addr;
	struct fcoe_capabilities	*fcoe_cap;

+10 −13
Original line number Diff line number Diff line
@@ -88,9 +88,6 @@

#define BNX2FC_MAX_NPIV		256

#define BNX2FC_MAX_OUTSTANDING_CMNDS	2048
#define BNX2FC_CAN_QUEUE		BNX2FC_MAX_OUTSTANDING_CMNDS
#define BNX2FC_ELSTM_XIDS		BNX2FC_CAN_QUEUE
#define BNX2FC_MIN_PAYLOAD		256
#define BNX2FC_MAX_PAYLOAD		2048
#define BNX2FC_MFS			\
@@ -108,11 +105,8 @@
#define BNX2FC_CONFQ_WQE_SIZE		(sizeof(struct fcoe_confqe))
#define BNX2FC_5771X_DB_PAGE_SIZE	128

#define BNX2FC_MAX_TASKS		\
			     (BNX2FC_MAX_OUTSTANDING_CMNDS + BNX2FC_ELSTM_XIDS)
#define BNX2FC_TASK_SIZE		128
#define	BNX2FC_TASKS_PER_PAGE		(PAGE_SIZE/BNX2FC_TASK_SIZE)
#define BNX2FC_TASK_CTX_ARR_SZ		(BNX2FC_MAX_TASKS/BNX2FC_TASKS_PER_PAGE)

#define BNX2FC_MAX_ROWS_IN_HASH_TBL	8
#define BNX2FC_HASH_TBL_CHUNK_SIZE	(16 * 1024)
@@ -125,12 +119,9 @@
#define BNX2FC_WRITE			(1 << 0)

#define BNX2FC_MIN_XID			0
#define BNX2FC_MAX_XID			\
			(BNX2FC_MAX_OUTSTANDING_CMNDS + BNX2FC_ELSTM_XIDS - 1)
#define FCOE_MAX_NUM_XIDS		0x2000
#define FCOE_MIN_XID			(BNX2FC_MAX_XID + 1)
#define FCOE_MAX_XID			(FCOE_MIN_XID + FCOE_MAX_NUM_XIDS - 1)
#define FCOE_XIDS_PER_CPU		(FCOE_MIN_XID + (512 * nr_cpu_ids) - 1)
#define FCOE_MAX_XID_OFFSET		(FCOE_MAX_NUM_XIDS - 1)
#define FCOE_XIDS_PER_CPU_OFFSET	((512 * nr_cpu_ids) - 1)
#define BNX2FC_MAX_LUN			0xFFFF
#define BNX2FC_MAX_FCP_TGT		256
#define BNX2FC_MAX_CMD_LEN		16
@@ -206,6 +197,13 @@ struct bnx2fc_hba {
		#define BNX2FC_FLAG_FW_INIT_DONE	0
		#define BNX2FC_FLAG_DESTROY_CMPL	1
	u32 next_conn_id;

	/* xid resources */
	u16 max_xid;
	u32 max_tasks;
	u32 max_outstanding_cmds;
	u32 elstm_xids;

	struct fcoe_task_ctx_entry **task_ctx;
	dma_addr_t *task_ctx_dma;
	struct regpair *task_ctx_bd_tbl;
@@ -504,8 +502,7 @@ int bnx2fc_setup_task_ctx(struct bnx2fc_hba *hba);
void bnx2fc_free_task_ctx(struct bnx2fc_hba *hba);
int bnx2fc_setup_fw_resc(struct bnx2fc_hba *hba);
void bnx2fc_free_fw_resc(struct bnx2fc_hba *hba);
struct bnx2fc_cmd_mgr *bnx2fc_cmd_mgr_alloc(struct bnx2fc_hba *hba,
						u16 min_xid, u16 max_xid);
struct bnx2fc_cmd_mgr *bnx2fc_cmd_mgr_alloc(struct bnx2fc_hba *hba);
void bnx2fc_cmd_mgr_free(struct bnx2fc_cmd_mgr *cmgr);
void bnx2fc_get_link_state(struct bnx2fc_hba *hba);
char *bnx2fc_get_next_rqe(struct bnx2fc_rport *tgt, u8 num_items);
Loading