aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/cnic.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/cnic.c')
-rw-r--r--drivers/net/cnic.c56
1 files changed, 31 insertions, 25 deletions
diff --git a/drivers/net/cnic.c b/drivers/net/cnic.c
index 80471269977a..04e299f46455 100644
--- a/drivers/net/cnic.c
+++ b/drivers/net/cnic.c
@@ -2824,7 +2824,7 @@ static int cnic_get_v4_route(struct sockaddr_in *dst_addr,
2824 2824
2825 err = ip_route_output_key(&init_net, &rt, &fl); 2825 err = ip_route_output_key(&init_net, &rt, &fl);
2826 if (!err) 2826 if (!err)
2827 *dst = &rt->u.dst; 2827 *dst = &rt->dst;
2828 return err; 2828 return err;
2829#else 2829#else
2830 return -ENETUNREACH; 2830 return -ENETUNREACH;
@@ -2996,7 +2996,7 @@ err_out:
2996static int cnic_cm_abort(struct cnic_sock *csk) 2996static int cnic_cm_abort(struct cnic_sock *csk)
2997{ 2997{
2998 struct cnic_local *cp = csk->dev->cnic_priv; 2998 struct cnic_local *cp = csk->dev->cnic_priv;
2999 u32 opcode; 2999 u32 opcode = L4_KCQE_OPCODE_VALUE_RESET_COMP;
3000 3000
3001 if (!cnic_in_use(csk)) 3001 if (!cnic_in_use(csk))
3002 return -EINVAL; 3002 return -EINVAL;
@@ -3008,12 +3008,9 @@ static int cnic_cm_abort(struct cnic_sock *csk)
3008 * connect was not successful. 3008 * connect was not successful.
3009 */ 3009 */
3010 3010
3011 csk->state = L4_KCQE_OPCODE_VALUE_RESET_COMP;
3012 if (test_bit(SK_F_PG_OFFLD_COMPLETE, &csk->flags))
3013 opcode = csk->state;
3014 else
3015 opcode = L5CM_RAMROD_CMD_ID_TERMINATE_OFFLOAD;
3016 cp->close_conn(csk, opcode); 3011 cp->close_conn(csk, opcode);
3012 if (csk->state != opcode)
3013 return -EALREADY;
3017 3014
3018 return 0; 3015 return 0;
3019} 3016}
@@ -3026,6 +3023,8 @@ static int cnic_cm_close(struct cnic_sock *csk)
3026 if (cnic_close_prep(csk)) { 3023 if (cnic_close_prep(csk)) {
3027 csk->state = L4_KCQE_OPCODE_VALUE_CLOSE_COMP; 3024 csk->state = L4_KCQE_OPCODE_VALUE_CLOSE_COMP;
3028 return cnic_cm_close_req(csk); 3025 return cnic_cm_close_req(csk);
3026 } else {
3027 return -EALREADY;
3029 } 3028 }
3030 return 0; 3029 return 0;
3031} 3030}
@@ -3141,12 +3140,6 @@ static void cnic_cm_process_kcqe(struct cnic_dev *dev, struct kcqe *kcqe)
3141 break; 3140 break;
3142 3141
3143 case L4_KCQE_OPCODE_VALUE_RESET_RECEIVED: 3142 case L4_KCQE_OPCODE_VALUE_RESET_RECEIVED:
3144 if (test_bit(CNIC_F_BNX2_CLASS, &dev->flags)) {
3145 cnic_cm_upcall(cp, csk, opcode);
3146 break;
3147 } else if (test_and_clear_bit(SK_F_OFFLD_COMPLETE, &csk->flags))
3148 csk->state = opcode;
3149 /* fall through */
3150 case L4_KCQE_OPCODE_VALUE_CLOSE_COMP: 3143 case L4_KCQE_OPCODE_VALUE_CLOSE_COMP:
3151 case L4_KCQE_OPCODE_VALUE_RESET_COMP: 3144 case L4_KCQE_OPCODE_VALUE_RESET_COMP:
3152 case L5CM_RAMROD_CMD_ID_SEARCHER_DELETE: 3145 case L5CM_RAMROD_CMD_ID_SEARCHER_DELETE:
@@ -3202,19 +3195,22 @@ static int cnic_cm_alloc_mem(struct cnic_dev *dev)
3202 3195
3203static int cnic_ready_to_close(struct cnic_sock *csk, u32 opcode) 3196static int cnic_ready_to_close(struct cnic_sock *csk, u32 opcode)
3204{ 3197{
3205 if ((opcode == csk->state) || 3198 if (test_and_clear_bit(SK_F_OFFLD_COMPLETE, &csk->flags)) {
3206 (opcode == L4_KCQE_OPCODE_VALUE_RESET_RECEIVED && 3199 /* Unsolicited RESET_COMP or RESET_RECEIVED */
3207 csk->state == L4_KCQE_OPCODE_VALUE_CLOSE_COMP)) { 3200 opcode = L4_KCQE_OPCODE_VALUE_RESET_RECEIVED;
3208 if (!test_and_set_bit(SK_F_CLOSING, &csk->flags)) 3201 csk->state = opcode;
3209 return 1;
3210 } 3202 }
3211 /* 57710+ only workaround to handle unsolicited RESET_COMP 3203
3212 * which will be treated like a RESET RCVD notification 3204 /* 1. If event opcode matches the expected event in csk->state
3213 * which triggers the clean up procedure 3205 * 2. If the expected event is CLOSE_COMP, we accept any event
3206 * 3. If the expected event is 0, meaning the connection was never
3207 * never established, we accept the opcode from cm_abort.
3214 */ 3208 */
3215 else if (opcode == L4_KCQE_OPCODE_VALUE_RESET_COMP) { 3209 if (opcode == csk->state || csk->state == 0 ||
3210 csk->state == L4_KCQE_OPCODE_VALUE_CLOSE_COMP) {
3216 if (!test_and_set_bit(SK_F_CLOSING, &csk->flags)) { 3211 if (!test_and_set_bit(SK_F_CLOSING, &csk->flags)) {
3217 csk->state = L4_KCQE_OPCODE_VALUE_RESET_RECEIVED; 3212 if (csk->state == 0)
3213 csk->state = opcode;
3218 return 1; 3214 return 1;
3219 } 3215 }
3220 } 3216 }
@@ -3226,8 +3222,14 @@ static void cnic_close_bnx2_conn(struct cnic_sock *csk, u32 opcode)
3226 struct cnic_dev *dev = csk->dev; 3222 struct cnic_dev *dev = csk->dev;
3227 struct cnic_local *cp = dev->cnic_priv; 3223 struct cnic_local *cp = dev->cnic_priv;
3228 3224
3225 if (opcode == L4_KCQE_OPCODE_VALUE_RESET_RECEIVED) {
3226 cnic_cm_upcall(cp, csk, opcode);
3227 return;
3228 }
3229
3229 clear_bit(SK_F_CONNECT_START, &csk->flags); 3230 clear_bit(SK_F_CONNECT_START, &csk->flags);
3230 cnic_close_conn(csk); 3231 cnic_close_conn(csk);
3232 csk->state = opcode;
3231 cnic_cm_upcall(cp, csk, opcode); 3233 cnic_cm_upcall(cp, csk, opcode);
3232} 3234}
3233 3235
@@ -3257,8 +3259,12 @@ static void cnic_close_bnx2x_conn(struct cnic_sock *csk, u32 opcode)
3257 case L4_KCQE_OPCODE_VALUE_RESET_RECEIVED: 3259 case L4_KCQE_OPCODE_VALUE_RESET_RECEIVED:
3258 case L4_KCQE_OPCODE_VALUE_CLOSE_COMP: 3260 case L4_KCQE_OPCODE_VALUE_CLOSE_COMP:
3259 case L4_KCQE_OPCODE_VALUE_RESET_COMP: 3261 case L4_KCQE_OPCODE_VALUE_RESET_COMP:
3260 if (cnic_ready_to_close(csk, opcode)) 3262 if (cnic_ready_to_close(csk, opcode)) {
3261 cmd = L5CM_RAMROD_CMD_ID_SEARCHER_DELETE; 3263 if (test_bit(SK_F_PG_OFFLD_COMPLETE, &csk->flags))
3264 cmd = L5CM_RAMROD_CMD_ID_SEARCHER_DELETE;
3265 else
3266 close_complete = 1;
3267 }
3262 break; 3268 break;
3263 case L5CM_RAMROD_CMD_ID_SEARCHER_DELETE: 3269 case L5CM_RAMROD_CMD_ID_SEARCHER_DELETE:
3264 cmd = L5CM_RAMROD_CMD_ID_TERMINATE_OFFLOAD; 3270 cmd = L5CM_RAMROD_CMD_ID_TERMINATE_OFFLOAD;