aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/cnic.c26
1 files changed, 10 insertions, 16 deletions
diff --git a/drivers/net/cnic.c b/drivers/net/cnic.c
index 48fdbceb2181..11eeded146d9 100644
--- a/drivers/net/cnic.c
+++ b/drivers/net/cnic.c
@@ -3198,25 +3198,19 @@ static int cnic_cm_alloc_mem(struct cnic_dev *dev)
3198 3198
3199static int cnic_ready_to_close(struct cnic_sock *csk, u32 opcode) 3199static int cnic_ready_to_close(struct cnic_sock *csk, u32 opcode)
3200{ 3200{
3201 if (opcode == L4_KCQE_OPCODE_VALUE_RESET_RECEIVED) { 3201 if (test_and_clear_bit(SK_F_OFFLD_COMPLETE, &csk->flags)) {
3202 if (test_and_clear_bit(SK_F_OFFLD_COMPLETE, &csk->flags)) 3202 /* Unsolicited RESET_COMP or RESET_RECEIVED */
3203 csk->state = opcode; 3203 opcode = L4_KCQE_OPCODE_VALUE_RESET_RECEIVED;
3204 } 3204 csk->state = opcode;
3205 if ((opcode == csk->state) ||
3206 (opcode == L4_KCQE_OPCODE_VALUE_RESET_RECEIVED &&
3207 csk->state == L4_KCQE_OPCODE_VALUE_CLOSE_COMP)) {
3208 if (!test_and_set_bit(SK_F_CLOSING, &csk->flags))
3209 return 1;
3210 } 3205 }
3211 /* 57710+ only workaround to handle unsolicited RESET_COMP 3206
3212 * which will be treated like a RESET RCVD notification 3207 /* 1. If event opcode matches the expected event in csk->state
3213 * which triggers the clean up procedure 3208 * 2. If the expected event is CLOSE_COMP, we accept any event
3214 */ 3209 */
3215 else if (opcode == L4_KCQE_OPCODE_VALUE_RESET_COMP) { 3210 if (opcode == csk->state ||
3216 if (!test_and_set_bit(SK_F_CLOSING, &csk->flags)) { 3211 csk->state == L4_KCQE_OPCODE_VALUE_CLOSE_COMP) {
3217 csk->state = L4_KCQE_OPCODE_VALUE_RESET_RECEIVED; 3212 if (!test_and_set_bit(SK_F_CLOSING, &csk->flags))
3218 return 1; 3213 return 1;
3219 }
3220 } 3214 }
3221 return 0; 3215 return 0;
3222} 3216}