netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Michael Chan" <mchan@broadcom.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org
Subject: [PATCH net-next 2/4] cnic: Refactor code in cnic_cm_process_kcqe().
Date: Tue, 15 Jun 2010 11:57:01 -0700	[thread overview]
Message-ID: <1276628223-27125-2-git-send-email-mchan@broadcom.com> (raw)
In-Reply-To: <1276628223-27125-1-git-send-email-mchan@broadcom.com>

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>
---
 drivers/net/cnic.c |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/net/cnic.c b/drivers/net/cnic.c
index b20e11c..48fdbce 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)
 		break;
 
 	case L4_KCQE_OPCODE_VALUE_RESET_RECEIVED:
-		if (test_bit(CNIC_F_BNX2_CLASS, &dev->flags)) {
-			cnic_cm_upcall(cp, csk, opcode);
-			break;
-		} else if (test_and_clear_bit(SK_F_OFFLD_COMPLETE, &csk->flags))
-			csk->state = opcode;
-		/* fall through */
 	case L4_KCQE_OPCODE_VALUE_CLOSE_COMP:
 	case L4_KCQE_OPCODE_VALUE_RESET_COMP:
 	case L5CM_RAMROD_CMD_ID_SEARCHER_DELETE:
@@ -3204,6 +3198,10 @@ static int cnic_cm_alloc_mem(struct cnic_dev *dev)
 
 static int cnic_ready_to_close(struct cnic_sock *csk, u32 opcode)
 {
+	if (opcode == L4_KCQE_OPCODE_VALUE_RESET_RECEIVED) {
+		if (test_and_clear_bit(SK_F_OFFLD_COMPLETE, &csk->flags))
+			csk->state = opcode;
+	}
 	if ((opcode == csk->state) ||
 	    (opcode == L4_KCQE_OPCODE_VALUE_RESET_RECEIVED &&
 	     csk->state == L4_KCQE_OPCODE_VALUE_CLOSE_COMP)) {
@@ -3228,6 +3226,11 @@ static void cnic_close_bnx2_conn(struct cnic_sock *csk, u32 opcode)
 	struct cnic_dev *dev = csk->dev;
 	struct cnic_local *cp = dev->cnic_priv;
 
+	if (opcode == L4_KCQE_OPCODE_VALUE_RESET_RECEIVED) {
+		cnic_cm_upcall(cp, csk, opcode);
+		return;
+	}
+
 	clear_bit(SK_F_CONNECT_START, &csk->flags);
 	cnic_close_conn(csk);
 	cnic_cm_upcall(cp, csk, opcode);
-- 
1.6.4.GIT



  reply	other threads:[~2010-06-15 18:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-15 18:57 [PATCH net-next 1/4] cnic: Return error code in cnic_cm_close() if unsuccessful Michael Chan
2010-06-15 18:57 ` Michael Chan [this message]
2010-06-15 18:57   ` [PATCH net-next 3/4] cnic: Refactor and fix cnic_ready_to_close() Michael Chan
2010-06-15 18:57     ` [PATCH net-next 4/4] cnic: Fix cnic_cm_abort() error handling Michael Chan
2010-06-15 21:24       ` David Miller
2010-06-15 21:24     ` [PATCH net-next 3/4] cnic: Refactor and fix cnic_ready_to_close() David Miller
2010-06-15 21:24   ` [PATCH net-next 2/4] cnic: Refactor code in cnic_cm_process_kcqe() David Miller
2010-06-15 21:24 ` [PATCH net-next 1/4] cnic: Return error code in cnic_cm_close() if unsuccessful David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1276628223-27125-2-git-send-email-mchan@broadcom.com \
    --to=mchan@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).