All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael Chan" <mchan@broadcom.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org
Subject: [PATCH net-next 1/9] cnic: Fix iSCSI TCP port endian order.
Date: Thu, 23 Dec 2010 09:42:56 -0800	[thread overview]
Message-ID: <1293126184-13097-2-git-send-email-mchan@broadcom.com> (raw)
In-Reply-To: <1293126184-13097-1-git-send-email-mchan@broadcom.com>

Pass the TCP port parameter for iSCSI connections to the firmware in
proper endian order.

Signed-off-by: Michael Chan <mchan@broadcom.com>
---
 drivers/net/cnic.c |   23 +++++++++++++----------
 drivers/net/cnic.h |    2 +-
 2 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/drivers/net/cnic.c b/drivers/net/cnic.c
index 594ca9c..9c2e786 100644
--- a/drivers/net/cnic.c
+++ b/drivers/net/cnic.c
@@ -2883,7 +2883,7 @@ static void cnic_cm_cleanup(struct cnic_sock *csk)
 		struct cnic_dev *dev = csk->dev;
 		struct cnic_local *cp = dev->cnic_priv;
 
-		cnic_free_id(&cp->csk_port_tbl, csk->src_port);
+		cnic_free_id(&cp->csk_port_tbl, be16_to_cpu(csk->src_port));
 		csk->src_port = 0;
 	}
 }
@@ -3014,7 +3014,8 @@ static int cnic_get_route(struct cnic_sock *csk, struct cnic_sockaddr *saddr)
 	int is_v6, rc = 0;
 	struct dst_entry *dst = NULL;
 	struct net_device *realdev;
-	u32 local_port;
+	__be16 local_port;
+	u32 port_id;
 
 	if (saddr->local.v6.sin6_family == AF_INET6 &&
 	    saddr->remote.v6.sin6_family == AF_INET6)
@@ -3054,19 +3055,21 @@ static int cnic_get_route(struct cnic_sock *csk, struct cnic_sockaddr *saddr)
 		}
 	}
 
-	if (local_port >= CNIC_LOCAL_PORT_MIN &&
-	    local_port < CNIC_LOCAL_PORT_MAX) {
-		if (cnic_alloc_id(&cp->csk_port_tbl, local_port))
-			local_port = 0;
+	port_id = be16_to_cpu(local_port);
+	if (port_id >= CNIC_LOCAL_PORT_MIN &&
+	    port_id < CNIC_LOCAL_PORT_MAX) {
+		if (cnic_alloc_id(&cp->csk_port_tbl, port_id))
+			port_id = 0;
 	} else
-		local_port = 0;
+		port_id = 0;
 
-	if (!local_port) {
-		local_port = cnic_alloc_new_id(&cp->csk_port_tbl);
-		if (local_port == -1) {
+	if (!port_id) {
+		port_id = cnic_alloc_new_id(&cp->csk_port_tbl);
+		if (port_id == -1) {
 			rc = -ENOMEM;
 			goto err_out;
 		}
+		local_port = cpu_to_be16(port_id);
 	}
 	csk->src_port = local_port;
 
diff --git a/drivers/net/cnic.h b/drivers/net/cnic.h
index 6a4a0ae..bf38e57 100644
--- a/drivers/net/cnic.h
+++ b/drivers/net/cnic.h
@@ -82,7 +82,7 @@ struct cnic_redirect_entry {
 #define MAX_ISCSI_TBL_SZ	256
 
 #define CNIC_LOCAL_PORT_MIN	60000
-#define CNIC_LOCAL_PORT_MAX	61000
+#define CNIC_LOCAL_PORT_MAX	61024
 #define CNIC_LOCAL_PORT_RANGE	(CNIC_LOCAL_PORT_MAX - CNIC_LOCAL_PORT_MIN)
 
 #define KWQE_CNT (BCM_PAGE_SIZE / sizeof(struct kwqe))
-- 
1.6.4.GIT



  reply	other threads:[~2010-12-23 18:40 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-23 17:42 [PATCH net-next 0/9] cnic: Bug fixes and FCoE support Michael Chan
2010-12-23 17:42 ` Michael Chan [this message]
2010-12-23 17:42   ` [PATCH net-next 2/9] cnic: Prevent "scheduling while atomic" when calling ->cnic_init() Michael Chan
2010-12-23 17:42     ` [PATCH net-next 3/9] cnic: Improve ->iscsi_nl_msg_send() Michael Chan
2010-12-23 17:42       ` [PATCH net-next 4/9] cnic: Use proper client and connection IDs on iSCSI ring Michael Chan
2010-12-23 17:43         ` [PATCH net-next 5/9] cnic: Support NIC Partition mode Michael Chan
2010-12-23 17:43           ` Michael Chan
2010-12-23 17:43             ` [PATCH net-next 7/9] cnic: Call cm_connect_complete() immediately on error Michael Chan
2010-12-23 17:43               ` [PATCH net-next 8/9] cnic: Add kcq2 support on 57712 Michael Chan
2010-12-23 17:43                 ` [PATCH net-next 9/9] cnic: Add FCoE " Michael Chan
2010-12-23 19:27 ` [PATCH net-next 0/9] cnic: Bug fixes and FCoE support David Miller
2010-12-23 19:29   ` Michael Chan
2010-12-23 20:01 ` 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=1293126184-13097-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.