aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorDmitry Kravkov <dmitry@broadcom.com>2011-03-31 20:04:22 -0400
committerDavid S. Miller <davem@davemloft.net>2011-03-31 20:04:22 -0400
commitfab0dc89f0d98459c6ce7fa27422949ac15837fa (patch)
treecd7d169e81ff9028d746f2540302d677b17f30cf /drivers/net
parent3b7f817e47bb66ae4d82ed73689a521af70a5410 (diff)
bnx2x, cnic: Disable iSCSI if DCBX negotiation is successful
With current bnx2x firmware 6.2.9, iSCSI is not supported in DCB network, so we need to disable it. Add cnic command to disconnect iSCSI connections and prevent future connections when DCBX negotiation succeeds. Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com> Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/bnx2x/bnx2x_dcb.c22
-rw-r--r--drivers/net/bnx2x/bnx2x_dcb.h8
-rw-r--r--drivers/net/bnx2x/bnx2x_main.c5
-rw-r--r--drivers/net/cnic.c64
-rw-r--r--drivers/net/cnic.h1
-rw-r--r--drivers/net/cnic_if.h6
6 files changed, 83 insertions, 23 deletions
diff --git a/drivers/net/bnx2x/bnx2x_dcb.c b/drivers/net/bnx2x/bnx2x_dcb.c
index 9a24d79c71d9..1214907d00d9 100644
--- a/drivers/net/bnx2x/bnx2x_dcb.c
+++ b/drivers/net/bnx2x/bnx2x_dcb.c
@@ -571,6 +571,28 @@ void bnx2x_dcbx_set_params(struct bnx2x *bp, u32 state)
571{ 571{
572 switch (state) { 572 switch (state) {
573 case BNX2X_DCBX_STATE_NEG_RECEIVED: 573 case BNX2X_DCBX_STATE_NEG_RECEIVED:
574#ifdef BCM_CNIC
575 if (bp->state != BNX2X_STATE_OPENING_WAIT4_LOAD) {
576 struct cnic_ops *c_ops;
577 struct cnic_eth_dev *cp = &bp->cnic_eth_dev;
578 bp->flags |= NO_ISCSI_OOO_FLAG | NO_ISCSI_FLAG;
579 cp->drv_state |= CNIC_DRV_STATE_NO_ISCSI_OOO;
580 cp->drv_state |= CNIC_DRV_STATE_NO_ISCSI;
581
582 rcu_read_lock();
583 c_ops = rcu_dereference(bp->cnic_ops);
584 if (c_ops) {
585 bnx2x_cnic_notify(bp, CNIC_CTL_STOP_ISCSI_CMD);
586 rcu_read_unlock();
587 return;
588 }
589 rcu_read_unlock();
590 }
591
592 /* fall through if no CNIC initialized */
593 case BNX2X_DCBX_STATE_ISCSI_STOPPED:
594#endif
595
574 { 596 {
575 DP(NETIF_MSG_LINK, "BNX2X_DCBX_STATE_NEG_RECEIVED\n"); 597 DP(NETIF_MSG_LINK, "BNX2X_DCBX_STATE_NEG_RECEIVED\n");
576#ifdef BCM_DCBNL 598#ifdef BCM_DCBNL
diff --git a/drivers/net/bnx2x/bnx2x_dcb.h b/drivers/net/bnx2x/bnx2x_dcb.h
index 71b8eda43bd0..1e14775a18cb 100644
--- a/drivers/net/bnx2x/bnx2x_dcb.h
+++ b/drivers/net/bnx2x/bnx2x_dcb.h
@@ -183,9 +183,13 @@ void bnx2x_dcbx_set_state(struct bnx2x *bp, bool dcb_on, u32 dcbx_enabled);
183 183
184enum { 184enum {
185 BNX2X_DCBX_STATE_NEG_RECEIVED = 0x1, 185 BNX2X_DCBX_STATE_NEG_RECEIVED = 0x1,
186 BNX2X_DCBX_STATE_TX_PAUSED = 0x2, 186#ifdef BCM_CNIC
187 BNX2X_DCBX_STATE_TX_RELEASED = 0x4 187 BNX2X_DCBX_STATE_ISCSI_STOPPED,
188#endif
189 BNX2X_DCBX_STATE_TX_PAUSED,
190 BNX2X_DCBX_STATE_TX_RELEASED
188}; 191};
192
189void bnx2x_dcbx_set_params(struct bnx2x *bp, u32 state); 193void bnx2x_dcbx_set_params(struct bnx2x *bp, u32 state);
190 194
191/* DCB netlink */ 195/* DCB netlink */
diff --git a/drivers/net/bnx2x/bnx2x_main.c b/drivers/net/bnx2x/bnx2x_main.c
index 32e64cc85d2c..f3cf88918a9e 100644
--- a/drivers/net/bnx2x/bnx2x_main.c
+++ b/drivers/net/bnx2x/bnx2x_main.c
@@ -10342,6 +10342,11 @@ static int bnx2x_drv_ctl(struct net_device *dev, struct drv_ctl_info *ctl)
10342 break; 10342 break;
10343 } 10343 }
10344 10344
10345 case DRV_CTL_ISCSI_STOPPED_CMD: {
10346 bnx2x_dcbx_set_params(bp, BNX2X_DCBX_STATE_ISCSI_STOPPED);
10347 break;
10348 }
10349
10345 default: 10350 default:
10346 BNX2X_ERR("unknown command %x\n", ctl->cmd); 10351 BNX2X_ERR("unknown command %x\n", ctl->cmd);
10347 rc = -EINVAL; 10352 rc = -EINVAL;
diff --git a/drivers/net/cnic.c b/drivers/net/cnic.c
index 8cca60e43444..5dfbff06631c 100644
--- a/drivers/net/cnic.c
+++ b/drivers/net/cnic.c
@@ -2966,31 +2966,36 @@ static int cnic_service_bnx2x(void *data, void *status_blk)
2966 return 0; 2966 return 0;
2967} 2967}
2968 2968
2969static void cnic_ulp_stop(struct cnic_dev *dev) 2969static void cnic_ulp_stop_one(struct cnic_local *cp, int if_type)
2970{ 2970{
2971 struct cnic_local *cp = dev->cnic_priv; 2971 struct cnic_ulp_ops *ulp_ops;
2972 int if_type;
2973
2974 cnic_send_nlmsg(cp, ISCSI_KEVENT_IF_DOWN, NULL);
2975 2972
2976 for (if_type = 0; if_type < MAX_CNIC_ULP_TYPE; if_type++) { 2973 if (if_type == CNIC_ULP_ISCSI)
2977 struct cnic_ulp_ops *ulp_ops; 2974 cnic_send_nlmsg(cp, ISCSI_KEVENT_IF_DOWN, NULL);
2978 2975
2979 mutex_lock(&cnic_lock); 2976 mutex_lock(&cnic_lock);
2980 ulp_ops = rcu_dereference_protected(cp->ulp_ops[if_type], 2977 ulp_ops = rcu_dereference_protected(cp->ulp_ops[if_type],
2981 lockdep_is_held(&cnic_lock)); 2978 lockdep_is_held(&cnic_lock));
2982 if (!ulp_ops) { 2979 if (!ulp_ops) {
2983 mutex_unlock(&cnic_lock);
2984 continue;
2985 }
2986 set_bit(ULP_F_CALL_PENDING, &cp->ulp_flags[if_type]);
2987 mutex_unlock(&cnic_lock); 2980 mutex_unlock(&cnic_lock);
2981 return;
2982 }
2983 set_bit(ULP_F_CALL_PENDING, &cp->ulp_flags[if_type]);
2984 mutex_unlock(&cnic_lock);
2988 2985
2989 if (test_and_clear_bit(ULP_F_START, &cp->ulp_flags[if_type])) 2986 if (test_and_clear_bit(ULP_F_START, &cp->ulp_flags[if_type]))
2990 ulp_ops->cnic_stop(cp->ulp_handle[if_type]); 2987 ulp_ops->cnic_stop(cp->ulp_handle[if_type]);
2991 2988
2992 clear_bit(ULP_F_CALL_PENDING, &cp->ulp_flags[if_type]); 2989 clear_bit(ULP_F_CALL_PENDING, &cp->ulp_flags[if_type]);
2993 } 2990}
2991
2992static void cnic_ulp_stop(struct cnic_dev *dev)
2993{
2994 struct cnic_local *cp = dev->cnic_priv;
2995 int if_type;
2996
2997 for (if_type = 0; if_type < MAX_CNIC_ULP_TYPE; if_type++)
2998 cnic_ulp_stop_one(cp, if_type);
2994} 2999}
2995 3000
2996static void cnic_ulp_start(struct cnic_dev *dev) 3001static void cnic_ulp_start(struct cnic_dev *dev)
@@ -3039,6 +3044,12 @@ static int cnic_ctl(void *data, struct cnic_ctl_info *info)
3039 3044
3040 cnic_put(dev); 3045 cnic_put(dev);
3041 break; 3046 break;
3047 case CNIC_CTL_STOP_ISCSI_CMD: {
3048 struct cnic_local *cp = dev->cnic_priv;
3049 set_bit(CNIC_LCL_FL_STOP_ISCSI, &cp->cnic_local_flags);
3050 queue_delayed_work(cnic_wq, &cp->delete_task, 0);
3051 break;
3052 }
3042 case CNIC_CTL_COMPLETION_CMD: { 3053 case CNIC_CTL_COMPLETION_CMD: {
3043 u32 cid = BNX2X_SW_CID(info->data.comp.cid); 3054 u32 cid = BNX2X_SW_CID(info->data.comp.cid);
3044 u32 l5_cid; 3055 u32 l5_cid;
@@ -3562,8 +3573,12 @@ static void cnic_init_csk_state(struct cnic_sock *csk)
3562 3573
3563static int cnic_cm_connect(struct cnic_sock *csk, struct cnic_sockaddr *saddr) 3574static int cnic_cm_connect(struct cnic_sock *csk, struct cnic_sockaddr *saddr)
3564{ 3575{
3576 struct cnic_local *cp = csk->dev->cnic_priv;
3565 int err = 0; 3577 int err = 0;
3566 3578
3579 if (cp->ethdev->drv_state & CNIC_DRV_STATE_NO_ISCSI)
3580 return -EOPNOTSUPP;
3581
3567 if (!cnic_in_use(csk)) 3582 if (!cnic_in_use(csk))
3568 return -EINVAL; 3583 return -EINVAL;
3569 3584
@@ -3965,6 +3980,17 @@ static void cnic_delete_task(struct work_struct *work)
3965 cp = container_of(work, struct cnic_local, delete_task.work); 3980 cp = container_of(work, struct cnic_local, delete_task.work);
3966 dev = cp->dev; 3981 dev = cp->dev;
3967 3982
3983 if (test_and_clear_bit(CNIC_LCL_FL_STOP_ISCSI, &cp->cnic_local_flags)) {
3984 struct drv_ctl_info info;
3985
3986 rtnl_lock();
3987 cnic_ulp_stop_one(cp, CNIC_ULP_ISCSI);
3988 rtnl_unlock();
3989
3990 info.cmd = DRV_CTL_ISCSI_STOPPED_CMD;
3991 cp->ethdev->drv_ctl(dev->netdev, &info);
3992 }
3993
3968 for (i = 0; i < cp->max_cid_space; i++) { 3994 for (i = 0; i < cp->max_cid_space; i++) {
3969 struct cnic_context *ctx = &cp->ctx_tbl[i]; 3995 struct cnic_context *ctx = &cp->ctx_tbl[i];
3970 3996
diff --git a/drivers/net/cnic.h b/drivers/net/cnic.h
index 4456260c653c..3367a6d3a774 100644
--- a/drivers/net/cnic.h
+++ b/drivers/net/cnic.h
@@ -226,6 +226,7 @@ struct cnic_local {
226#define CNIC_LCL_FL_KWQ_INIT 0x0 226#define CNIC_LCL_FL_KWQ_INIT 0x0
227#define CNIC_LCL_FL_L2_WAIT 0x1 227#define CNIC_LCL_FL_L2_WAIT 0x1
228#define CNIC_LCL_FL_RINGS_INITED 0x2 228#define CNIC_LCL_FL_RINGS_INITED 0x2
229#define CNIC_LCL_FL_STOP_ISCSI 0x4
229 230
230 struct cnic_dev *dev; 231 struct cnic_dev *dev;
231 232
diff --git a/drivers/net/cnic_if.h b/drivers/net/cnic_if.h
index e01b49ee3591..fdd8e46a9050 100644
--- a/drivers/net/cnic_if.h
+++ b/drivers/net/cnic_if.h
@@ -12,8 +12,8 @@
12#ifndef CNIC_IF_H 12#ifndef CNIC_IF_H
13#define CNIC_IF_H 13#define CNIC_IF_H
14 14
15#define CNIC_MODULE_VERSION "2.2.13" 15#define CNIC_MODULE_VERSION "2.2.14"
16#define CNIC_MODULE_RELDATE "Jan 31, 2011" 16#define CNIC_MODULE_RELDATE "Mar 30, 2011"
17 17
18#define CNIC_ULP_RDMA 0 18#define CNIC_ULP_RDMA 0
19#define CNIC_ULP_ISCSI 1 19#define CNIC_ULP_ISCSI 1
@@ -85,6 +85,7 @@ struct kcqe {
85#define CNIC_CTL_STOP_CMD 1 85#define CNIC_CTL_STOP_CMD 1
86#define CNIC_CTL_START_CMD 2 86#define CNIC_CTL_START_CMD 2
87#define CNIC_CTL_COMPLETION_CMD 3 87#define CNIC_CTL_COMPLETION_CMD 3
88#define CNIC_CTL_STOP_ISCSI_CMD 4
88 89
89#define DRV_CTL_IO_WR_CMD 0x101 90#define DRV_CTL_IO_WR_CMD 0x101
90#define DRV_CTL_IO_RD_CMD 0x102 91#define DRV_CTL_IO_RD_CMD 0x102
@@ -94,6 +95,7 @@ struct kcqe {
94#define DRV_CTL_START_L2_CMD 0x106 95#define DRV_CTL_START_L2_CMD 0x106
95#define DRV_CTL_STOP_L2_CMD 0x107 96#define DRV_CTL_STOP_L2_CMD 0x107
96#define DRV_CTL_RET_L2_SPQ_CREDIT_CMD 0x10c 97#define DRV_CTL_RET_L2_SPQ_CREDIT_CMD 0x10c
98#define DRV_CTL_ISCSI_STOPPED_CMD 0x10d
97 99
98struct cnic_ctl_completion { 100struct cnic_ctl_completion {
99 u32 cid; 101 u32 cid;