Skip to contentSkip to conversation

cnic, bnx2fc: Increase maximum FCoE sessions.

PATCH Applied Michael Chan 4 participants 8 messages Aug 26, 2011 – Aug 28, 2011

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 cnic, bnx2fc: Increase maximum FCoE sessions.

Increase it to NVRAM configured limit or 1024 whichever is less.

---
 drivers/net/ethernet/broadcom/cnic.c |   14 ++++++++------
 drivers/net/ethernet/broadcom/cnic.h |    2 +-
 drivers/scsi/bnx2fc/bnx2fc.h         |    2 +-
 3 files changed, 10 insertions(+), 8 deletions(-)
drivers/net/ethernet/broadcom/cnic.c +8 -6
index 7698161..73060f4 100644
@@ -1177,7 +1177,7 @@ static int cnic_alloc_bnx2x_resc(struct cnic_dev *dev)
 	cp->fcoe_start_cid = start_cid + MAX_ISCSI_TBL_SZ;
 
 	if (BNX2X_CHIP_IS_E2_PLUS(cp->chip_id)) {
-		cp->max_cid_space += BNX2X_FCOE_NUM_CONNECTIONS;
+		cp->max_cid_space += dev->max_fcoe_conn;
 		cp->fcoe_init_cid = ethdev->fcoe_init_cid;
 		if (!cp->fcoe_init_cid)
 			cp->fcoe_init_cid = 0x10;
@@ -2280,7 +2280,7 @@ static int cnic_bnx2x_fcoe_ofld1(struct cnic_dev *dev, struct kwqe *wqes[],
 	*work = 4;
 
 	l5_cid = req1->fcoe_conn_id;
-	if (l5_cid >= BNX2X_FCOE_NUM_CONNECTIONS)
+	if (l5_cid >= dev->max_fcoe_conn)
 		goto err_reply;
 
 	l5_cid += BNX2X_FCOE_L5_CID_BASE;
@@ -2384,7 +2384,7 @@ static int cnic_bnx2x_fcoe_disable(struct cnic_dev *dev, struct kwqe *kwqe)
 	req = (struct fcoe_kwqe_conn_enable_disable *) kwqe;
 	cid = req->context_id;
 	l5_cid = req->conn_id;
-	if (l5_cid >= BNX2X_FCOE_NUM_CONNECTIONS)
+	if (l5_cid >= dev->max_fcoe_conn)
 		return -EINVAL;
 
 	l5_cid += BNX2X_FCOE_L5_CID_BASE;
@@ -2418,7 +2418,7 @@ static int cnic_bnx2x_fcoe_destroy(struct cnic_dev *dev, struct kwqe *kwqe)
 	req = (struct fcoe_kwqe_conn_destroy *) kwqe;
 	cid = req->context_id;
 	l5_cid = req->conn_id;
-	if (l5_cid >= BNX2X_FCOE_NUM_CONNECTIONS)
+	if (l5_cid >= dev->max_fcoe_conn)
 		return -EINVAL;
 
 	l5_cid += BNX2X_FCOE_L5_CID_BASE;
@@ -4850,8 +4850,7 @@ static int cnic_start_bnx2x_hw(struct cnic_dev *dev)
 		return -ENOMEM;
 
 	if (BNX2X_CHIP_IS_E2_PLUS(cp->chip_id)) {
-		ret = cnic_init_id_tbl(&cp->fcoe_cid_tbl,
-					BNX2X_FCOE_NUM_CONNECTIONS,
+		ret = cnic_init_id_tbl(&cp->fcoe_cid_tbl, dev->max_fcoe_conn,
 					cp->fcoe_start_cid, 0);
 
 		if (ret)
@@ -5292,6 +5291,9 @@ static struct cnic_dev *init_bnx2x_cnic(struct net_device *dev)
 	    !(ethdev->drv_state & CNIC_DRV_STATE_NO_FCOE))
 		cdev->max_fcoe_conn = ethdev->max_fcoe_conn;
 
+	if (cdev->max_fcoe_conn > BNX2X_FCOE_NUM_CONNECTIONS)
+		cdev->max_fcoe_conn = BNX2X_FCOE_NUM_CONNECTIONS;
+
 	memcpy(cdev->mac_addr, ethdev->iscsi_mac, 6);
 
 	cp->cnic_ops = &cnic_bnx2x_ops;
drivers/net/ethernet/broadcom/cnic.h +1 -1
index 7a2928f..15b1c09 100644
@@ -373,7 +373,7 @@ struct bnx2x_bd_chain_next {
 #define BNX2X_ISCSI_PBL_NOT_CACHED	0xff
 #define BNX2X_ISCSI_PDU_HEADER_NOT_CACHED	0xff
 
-#define BNX2X_FCOE_NUM_CONNECTIONS	128
+#define BNX2X_FCOE_NUM_CONNECTIONS	1024
 
 #define BNX2X_FCOE_L5_CID_BASE		MAX_ISCSI_TBL_SZ
 
drivers/scsi/bnx2fc/bnx2fc.h +1 -1
index 5613e8a..dd335a2 100644
@@ -81,7 +81,7 @@
 #define BNX2FC_RQ_WQES_MAX	16
 #define BNX2FC_CQ_WQES_MAX	(BNX2FC_SQ_WQES_MAX + BNX2FC_RQ_WQES_MAX)
 
-#define BNX2FC_NUM_MAX_SESS	128
+#define BNX2FC_NUM_MAX_SESS	1024
 #define BNX2FC_NUM_MAX_SESS_LOG	(ilog2(BNX2FC_NUM_MAX_SESS))
 
 #define BNX2FC_MAX_OUTSTANDING_CMNDS	2048
Signature · 1 line
1.7.1
#1 lore raw

PATCH 2/3 cnic: Add timeout for ramrod replies.

If the bnx2x device has encountered parity errors, the chip will not DMA any replies. Using wait_event_timeout() will allow us to make forward progress and let bnx2x reset the chip.

---
 drivers/net/ethernet/broadcom/cnic.c      |   17 ++++++++++-------
 drivers/net/ethernet/broadcom/cnic.h      |    2 ++
 drivers/net/ethernet/broadcom/cnic_defs.h |    1 +
 3 files changed, 13 insertions(+), 7 deletions(-)
drivers/net/ethernet/broadcom/cnic.c +10 -7
index 73060f4..6f10c69 100644
@@ -1875,12 +1875,12 @@ static int cnic_bnx2x_destroy_ramrod(struct cnic_dev *dev, u32 l5_cid)
 				  hw_cid, NONE_CONNECTION_TYPE, &l5_data);
 
 	if (ret == 0) {
-		wait_event(ctx->waitq, ctx->wait_cond);
+		wait_event_timeout(ctx->waitq, ctx->wait_cond, CNIC_RAMROD_TMO);
 		if (unlikely(test_bit(CTX_FL_CID_ERROR, &ctx->ctx_flags)))
 			return -EBUSY;
 	}
 
-	return ret;
+	return 0;
 }
 
 static int cnic_bnx2x_iscsi_destroy(struct cnic_dev *dev, struct kwqe *kwqe)
@@ -2428,17 +2428,20 @@ static int cnic_bnx2x_fcoe_destroy(struct cnic_dev *dev, struct kwqe *kwqe)
 	init_waitqueue_head(&ctx->waitq);
 	ctx->wait_cond = 0;
 
+	memset(&kcqe, 0, sizeof(kcqe));
+	kcqe.completion_status = FCOE_KCQE_COMPLETION_STATUS_ERROR;
 	memset(&l5_data, 0, sizeof(l5_data));
 	ret = cnic_submit_kwqe_16(dev, FCOE_RAMROD_CMD_ID_TERMINATE_CONN, cid,
 				  FCOE_CONNECTION_TYPE, &l5_data);
 	if (ret == 0) {
-		wait_event(ctx->waitq, ctx->wait_cond);
-		set_bit(CTX_FL_DELETE_WAIT, &ctx->ctx_flags);
-		queue_delayed_work(cnic_wq, &cp->delete_task,
-				   msecs_to_jiffies(2000));
+		wait_event_timeout(ctx->waitq, ctx->wait_cond, CNIC_RAMROD_TMO);
+		if (ctx->wait_cond)
+			kcqe.completion_status = 0;
 	}
 
-	memset(&kcqe, 0, sizeof(kcqe));
+	set_bit(CTX_FL_DELETE_WAIT, &ctx->ctx_flags);
+	queue_delayed_work(cnic_wq, &cp->delete_task, msecs_to_jiffies(2000));
+
 	kcqe.op_code = FCOE_KCQE_OPCODE_DESTROY_CONN;
 	kcqe.fcoe_conn_id = req->conn_id;
 	kcqe.fcoe_conn_context_id = cid;
drivers/net/ethernet/broadcom/cnic.h +2 -0
index 15b1c09..3032809 100644
@@ -474,5 +474,7 @@ struct bnx2x_bd_chain_next {
 	  MAX_STAT_COUNTER_ID_E1))
 #endif
 
+#define CNIC_RAMROD_TMO			(HZ / 4)
+
 #endif
 
drivers/net/ethernet/broadcom/cnic_defs.h +1 -0
index e47d210..239de89 100644
@@ -67,6 +67,7 @@
 #define FCOE_KWQE_OPCODE_DESTROY		(10)
 #define FCOE_KWQE_OPCODE_STAT			(11)
 
+#define FCOE_KCQE_COMPLETION_STATUS_ERROR	(0x1)
 #define FCOE_KCQE_COMPLETION_STATUS_CTX_ALLOC_FAILURE	(0x3)
 
 /* KCQ (kernel completion queue) response op codes */
Signature · 1 line
1.7.1
#2 lore raw

PATCH 3/3 net: Define NETDEV_FCOE_WWNN, NETDEV_FCOE_WWPN only when CONFIG_LIBFCOE is enabled

From: Bhanu Prakash Gollapudi <[email protected]>

bnx2fc driver calls netdev->netdev_ops->ndo_fcoe_get_wwn() and it may not be defined with the current Kconfig dependencies. ndo_fcoe_get_wwn is dependent on CONFIG_FCOE, but bnx2fc does not select CONFIG_FCOE, as it does not depend on fcoe driver. Since both fcoe and bnx2fc drivers select CONFIG_LIBFCOE, define NETDEV_FCOE_WWNN and NETDEV_FCOE_WWPN when CONFIG_LIBFCOE is defined.

---
 include/linux/netdevice.h |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
include/linux/netdevice.h +4 -0
index 125f9fb..0a7f619 100644
@@ -922,11 +922,15 @@ struct net_device_ops {
 						       u16 xid,
 						       struct scatterlist *sgl,
 						       unsigned int sgc);
+#endif
+
+#if defined(CONFIG_LIBFCOE) || defined(CONFIG_LIBFCOE_MODULE)
 #define NETDEV_FCOE_WWNN 0
 #define NETDEV_FCOE_WWPN 1
 	int			(*ndo_fcoe_get_wwn)(struct net_device *dev,
 						    u64 *wwn, int type);
 #endif
+
 #ifdef CONFIG_RFS_ACCEL
 	int			(*ndo_rx_flow_steer)(struct net_device *dev,
 						     const struct sk_buff *skb,
Signature · 1 line
1.7.1
Reviewed-by on v1 3/3
#3 lore raw

RE: [PATCH 3/3 net-next] net: Define NETDEV_FCOE_WWNN, NETDEV_FCOE_WWPN only when CONFIG_LIBFCOE is enabled

Quoted 40 lines

From: Bhanu Prakash Gollapudi <[email protected]>

bnx2fc driver calls netdev->netdev_ops->ndo_fcoe_get_wwn() and it may not be defined with the current Kconfig dependencies. ndo_fcoe_get_wwn is dependent on CONFIG_FCOE, but bnx2fc does not select CONFIG_FCOE, as it does
not depend on fcoe driver. Since both fcoe and bnx2fc drivers select CONFIG_LIBFCOE, define NETDEV_FCOE_WWNN and NETDEV_FCOE_WWPN when CONFIG_LIBFCOE is defined.

---
 include/linux/netdevice.h |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
include/linux/netdevice.h +4 -1
index 125f9fb..0a7f619 100644
@@ -922,11 +922,15 @@ struct net_device_ops {
 						       u16 xid,
 						       struct scatterlist *sgl,
 						       unsigned int sgc);
+#endif
+
+#if defined(CONFIG_LIBFCOE) || defined(CONFIG_LIBFCOE_MODULE)
 #define NETDEV_FCOE_WWNN 0
 #define NETDEV_FCOE_WWPN 1
 	int			(*ndo_fcoe_get_wwn)(struct net_device *dev,
 						    u64 *wwn, int type);
 #endif
+
 #ifdef CONFIG_RFS_ACCEL
 	int			(*ndo_rx_flow_steer)(struct net_device *dev,
 						     const struct sk_buff *skb,
--
Quoted 2 lines

1.7.1

Thanks,

Acked-by
#4 lore raw

Re: [PATCH 3/3 net-next] net: Define NETDEV_FCOE_WWNN, NETDEV_FCOE_WWPN only when CONFIG_LIBFCOE is enabled

Quoted 44 lines · Yi
Quoted 40 lines

From: Bhanu Prakash Gollapudi <[email protected]>

bnx2fc driver calls netdev->netdev_ops->ndo_fcoe_get_wwn() and it may not be defined with the current Kconfig dependencies. ndo_fcoe_get_wwn is dependent on CONFIG_FCOE, but bnx2fc does not select CONFIG_FCOE, as it does
not depend on fcoe driver. Since both fcoe and bnx2fc drivers select CONFIG_LIBFCOE, define NETDEV_FCOE_WWNN and NETDEV_FCOE_WWPN when CONFIG_LIBFCOE is defined.

---
 include/linux/netdevice.h |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
include/linux/netdevice.h +4 -1
index 125f9fb..0a7f619 100644
@@ -922,11 +922,15 @@ struct net_device_ops {
 						       u16 xid,
 						       struct scatterlist *sgl,
 						       unsigned int sgc);
+#endif
+
+#if defined(CONFIG_LIBFCOE) || defined(CONFIG_LIBFCOE_MODULE)
 #define NETDEV_FCOE_WWNN 0
 #define NETDEV_FCOE_WWPN 1
 	int			(*ndo_fcoe_get_wwn)(struct net_device *dev,
 						    u64 *wwn, int type);
 #endif
+
 #ifdef CONFIG_RFS_ACCEL
 	int			(*ndo_rx_flow_steer)(struct net_device *dev,
 						     const struct sk_buff *skb,
--
Quoted 2 lines

1.7.1

Thanks,

Quoted 1 line

This one fixes lots of build errors, like:

drivers/scsi/fcoe/fcoe_transport.c:152: error: 'const struct net_device_ops' has no member named 'ndo_fcoe_get_wwn'

drivers/scsi/bnx2fc/bnx2fc_fcoe.c:765: error: 'NETDEV_FCOE_WWNN' undeclared (first use in this function) drivers/scsi/bnx2fc/bnx2fc_fcoe.c:771: error: 'NETDEV_FCOE_WWPN' undeclared (first use in this function) drivers/scsi/fcoe/fcoe_transport.c:152: error: 'const struct net_device_ops' has no member named 'ndo_fcoe_get_wwn'

thanks,
---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

maintainer Applied
#6 lore raw

Re: [PATCH 2/3 net-next] cnic: Add timeout for ramrod replies.

In reply to Michael Chan

From: "Michael Chan" <[email protected]>
Date: Fri, 26 Aug 2011 12:45:40 -0700

Quoted 6 lines

If the bnx2x device has encountered parity errors, the chip will not DMA any replies. Using wait_event_timeout() will allow us to make forward progress and let bnx2x reset the chip.

Applied.

maintainer Applied
#5 lore raw

Re: [PATCH 3/3 net-next] net: Define NETDEV_FCOE_WWNN, NETDEV_FCOE_WWPN only when CONFIG_LIBFCOE is enabled

In reply to Michael Chan

From: "Michael Chan" <[email protected]>
Date: Fri, 26 Aug 2011 12:45:41 -0700

Quoted 9 lines

From: Bhanu Prakash Gollapudi <[email protected]>

bnx2fc driver calls netdev->netdev_ops->ndo_fcoe_get_wwn() and it may not be defined with the current Kconfig dependencies. ndo_fcoe_get_wwn is dependent on CONFIG_FCOE, but bnx2fc does not select CONFIG_FCOE, as it does not depend on fcoe driver. Since both fcoe and bnx2fc drivers select CONFIG_LIBFCOE, define NETDEV_FCOE_WWNN and NETDEV_FCOE_WWPN when CONFIG_LIBFCOE is defined.

Quoted 5 lines

Applied.