diff options
author | Michael Chan <mchan@broadcom.com> | 2010-12-23 02:42:56 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-12-23 14:44:26 -0500 |
commit | 9b09336072796378dac46df63bcd43291b24fd12 (patch) | |
tree | 7412a3c3ab15f7b19472818f5398118c6c742d40 /drivers/net/cnic.c | |
parent | a130883d9528eefb66285728ba6a232d8fff9465 (diff) |
cnic: Fix iSCSI TCP port endian order.
Pass the TCP port parameter for iSCSI connections to the firmware in
proper endian order.
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/cnic.c')
-rw-r--r-- | drivers/net/cnic.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/drivers/net/cnic.c b/drivers/net/cnic.c index 594ca9c2c10a..9c2e7860b18e 100644 --- a/drivers/net/cnic.c +++ b/drivers/net/cnic.c | |||
@@ -2883,7 +2883,7 @@ static void cnic_cm_cleanup(struct cnic_sock *csk) | |||
2883 | struct cnic_dev *dev = csk->dev; | 2883 | struct cnic_dev *dev = csk->dev; |
2884 | struct cnic_local *cp = dev->cnic_priv; | 2884 | struct cnic_local *cp = dev->cnic_priv; |
2885 | 2885 | ||
2886 | cnic_free_id(&cp->csk_port_tbl, csk->src_port); | 2886 | cnic_free_id(&cp->csk_port_tbl, be16_to_cpu(csk->src_port)); |
2887 | csk->src_port = 0; | 2887 | csk->src_port = 0; |
2888 | } | 2888 | } |
2889 | } | 2889 | } |
@@ -3014,7 +3014,8 @@ static int cnic_get_route(struct cnic_sock *csk, struct cnic_sockaddr *saddr) | |||
3014 | int is_v6, rc = 0; | 3014 | int is_v6, rc = 0; |
3015 | struct dst_entry *dst = NULL; | 3015 | struct dst_entry *dst = NULL; |
3016 | struct net_device *realdev; | 3016 | struct net_device *realdev; |
3017 | u32 local_port; | 3017 | __be16 local_port; |
3018 | u32 port_id; | ||
3018 | 3019 | ||
3019 | if (saddr->local.v6.sin6_family == AF_INET6 && | 3020 | if (saddr->local.v6.sin6_family == AF_INET6 && |
3020 | saddr->remote.v6.sin6_family == AF_INET6) | 3021 | saddr->remote.v6.sin6_family == AF_INET6) |
@@ -3054,19 +3055,21 @@ static int cnic_get_route(struct cnic_sock *csk, struct cnic_sockaddr *saddr) | |||
3054 | } | 3055 | } |
3055 | } | 3056 | } |
3056 | 3057 | ||
3057 | if (local_port >= CNIC_LOCAL_PORT_MIN && | 3058 | port_id = be16_to_cpu(local_port); |
3058 | local_port < CNIC_LOCAL_PORT_MAX) { | 3059 | if (port_id >= CNIC_LOCAL_PORT_MIN && |
3059 | if (cnic_alloc_id(&cp->csk_port_tbl, local_port)) | 3060 | port_id < CNIC_LOCAL_PORT_MAX) { |
3060 | local_port = 0; | 3061 | if (cnic_alloc_id(&cp->csk_port_tbl, port_id)) |
3062 | port_id = 0; | ||
3061 | } else | 3063 | } else |
3062 | local_port = 0; | 3064 | port_id = 0; |
3063 | 3065 | ||
3064 | if (!local_port) { | 3066 | if (!port_id) { |
3065 | local_port = cnic_alloc_new_id(&cp->csk_port_tbl); | 3067 | port_id = cnic_alloc_new_id(&cp->csk_port_tbl); |
3066 | if (local_port == -1) { | 3068 | if (port_id == -1) { |
3067 | rc = -ENOMEM; | 3069 | rc = -ENOMEM; |
3068 | goto err_out; | 3070 | goto err_out; |
3069 | } | 3071 | } |
3072 | local_port = cpu_to_be16(port_id); | ||
3070 | } | 3073 | } |
3071 | csk->src_port = local_port; | 3074 | csk->src_port = local_port; |
3072 | 3075 | ||