aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/cnic.c
diff options
context:
space:
mode:
authorMichael Chan <mchan@broadcom.com>2010-06-15 04:57:01 -0400
committerDavid S. Miller <davem@davemloft.net>2010-06-15 17:23:36 -0400
commita1e621bf6d03621de207cd416f6a21969dd0601c (patch)
treea6f170cedcf63f3312ef885e8209d2d5aec14a3b /drivers/net/cnic.c
parented99daa5a0de4df9ed579ce36ff8b1373b6dbe47 (diff)
cnic: Refactor code in cnic_cm_process_kcqe().
Move chip-specific code to the respective chip's ->close_conn() functions for better code organization. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: Eddie Wai <waie@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/cnic.c')
-rw-r--r--drivers/net/cnic.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/net/cnic.c b/drivers/net/cnic.c
index b20e11cf5618..48fdbceb2181 100644
--- a/drivers/net/cnic.c
+++ b/drivers/net/cnic.c
@@ -3143,12 +3143,6 @@ static void cnic_cm_process_kcqe(struct cnic_dev *dev, struct kcqe *kcqe)
3143 break; 3143 break;
3144 3144
3145 case L4_KCQE_OPCODE_VALUE_RESET_RECEIVED: 3145 case L4_KCQE_OPCODE_VALUE_RESET_RECEIVED:
3146 if (test_bit(CNIC_F_BNX2_CLASS, &dev->flags)) {
3147 cnic_cm_upcall(cp, csk, opcode);
3148 break;
3149 } else if (test_and_clear_bit(SK_F_OFFLD_COMPLETE, &csk->flags))
3150 csk->state = opcode;
3151 /* fall through */
3152 case L4_KCQE_OPCODE_VALUE_CLOSE_COMP: 3146 case L4_KCQE_OPCODE_VALUE_CLOSE_COMP:
3153 case L4_KCQE_OPCODE_VALUE_RESET_COMP: 3147 case L4_KCQE_OPCODE_VALUE_RESET_COMP:
3154 case L5CM_RAMROD_CMD_ID_SEARCHER_DELETE: 3148 case L5CM_RAMROD_CMD_ID_SEARCHER_DELETE:
@@ -3204,6 +3198,10 @@ static int cnic_cm_alloc_mem(struct cnic_dev *dev)
3204 3198
3205static int cnic_ready_to_close(struct cnic_sock *csk, u32 opcode) 3199static int cnic_ready_to_close(struct cnic_sock *csk, u32 opcode)
3206{ 3200{
3201 if (opcode == L4_KCQE_OPCODE_VALUE_RESET_RECEIVED) {
3202 if (test_and_clear_bit(SK_F_OFFLD_COMPLETE, &csk->flags))
3203 csk->state = opcode;
3204 }
3207 if ((opcode == csk->state) || 3205 if ((opcode == csk->state) ||
3208 (opcode == L4_KCQE_OPCODE_VALUE_RESET_RECEIVED && 3206 (opcode == L4_KCQE_OPCODE_VALUE_RESET_RECEIVED &&
3209 csk->state == L4_KCQE_OPCODE_VALUE_CLOSE_COMP)) { 3207 csk->state == L4_KCQE_OPCODE_VALUE_CLOSE_COMP)) {
@@ -3228,6 +3226,11 @@ static void cnic_close_bnx2_conn(struct cnic_sock *csk, u32 opcode)
3228 struct cnic_dev *dev = csk->dev; 3226 struct cnic_dev *dev = csk->dev;
3229 struct cnic_local *cp = dev->cnic_priv; 3227 struct cnic_local *cp = dev->cnic_priv;
3230 3228
3229 if (opcode == L4_KCQE_OPCODE_VALUE_RESET_RECEIVED) {
3230 cnic_cm_upcall(cp, csk, opcode);
3231 return;
3232 }
3233
3231 clear_bit(SK_F_CONNECT_START, &csk->flags); 3234 clear_bit(SK_F_CONNECT_START, &csk->flags);
3232 cnic_close_conn(csk); 3235 cnic_close_conn(csk);
3233 cnic_cm_upcall(cp, csk, opcode); 3236 cnic_cm_upcall(cp, csk, opcode);