[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <13A253B3F9BEFE43B93C09CF75F63CAA81A886ED36@MNEXMB1.qlogic.org>
Date: Fri, 2 Mar 2012 11:22:16 -0600
From: Rajesh Borundia <rajesh.borundia@...gic.com>
To: santosh nayak <santoshprasadnayak@...il.com>,
Sony Chacko <sony.chacko@...gic.com>
CC: netdev <netdev@...r.kernel.org>,
linux-kernel <linux-kernel@...r.kernel.org>,
"kernel-janitors@...r.kernel.org" <kernel-janitors@...r.kernel.org>
Subject: RE: [PATCH 3/3] netxen: qlogic ethernet : Fix Endian Bug.
Santosh,
Thanks for pointing out the bug. But adapter takes ip in big endian format.
So no need to use be32_to_cpu instead data type of ip should be changed to __be32.
Also in netxen_config_ipaddr()
- req.words[1] = cpu_to_le64(ip);
+ req.words[1] = ip;
Rest looks fine.
Rajesh
________________________________________
From: santosh nayak [santoshprasadnayak@...il.com]
Sent: Friday, March 02, 2012 8:41 PM
To: Sony Chacko
Cc: Rajesh Borundia; netdev; linux-kernel; kernel-janitors@...r.kernel.org; Santosh Nayak
Subject: [PATCH 3/3] netxen: qlogic ethernet : Fix Endian Bug.
From: Santosh Nayak <santoshprasadnayak@...il.com>
Fix endian bug.
Add a default case in 'netxen_list_config_vlan_ip'
Signed-off-by: Santosh Nayak <santoshprasadnayak@...il.com>
---
.../net/ethernet/qlogic/netxen/netxen_nic_main.c | 20 ++++++++++++--------
1 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
index 8dc4a134..971b286 100644
--- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
+++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
@@ -818,7 +818,7 @@ netxen_check_options(struct netxen_adapter *adapter)
adapter->driver_mismatch = 1;
return;
}
- ptr32[i] = cpu_to_le32(val);
+ ptr32[i] = val;
offset += sizeof(u32);
}
@@ -3028,7 +3028,7 @@ netxen_list_config_vlan_ip(struct netxen_adapter *adapter,
list_for_each(head, &adapter->vlan_ip_list) {
cur = list_entry(head, struct nx_vlan_ip_list, list);
- if (cur->ip_addr == ifa->ifa_address)
+ if (cur->ip_addr == be32_to_cpu(ifa->ifa_address))
return;
}
@@ -3039,18 +3039,22 @@ netxen_list_config_vlan_ip(struct netxen_adapter *adapter,
return;
}
- cur->ip_addr = ifa->ifa_address;
+ cur->ip_addr = be32_to_cpu(ifa->ifa_address);
list_add_tail(&cur->list, &adapter->vlan_ip_list);
break;
case NX_IP_DOWN:
list_for_each_entry_safe(cur, tmp_cur,
&adapter->vlan_ip_list, list) {
- if (cur->ip_addr == ifa->ifa_address) {
+ if (cur->ip_addr == be32_to_cpu(ifa->ifa_address)) {
list_del(&cur->list);
kfree(cur);
break;
}
}
+ break;
+ default:
+ printk(KERN_ERR "%ld: Wrong event id \n", event);
+ break;
}
}
static void
@@ -3070,12 +3074,12 @@ netxen_config_indev_addr(struct netxen_adapter *adapter,
switch (event) {
case NETDEV_UP:
netxen_config_ipaddr(adapter,
- ifa->ifa_address, NX_IP_UP);
+ be32_to_cpu(ifa->ifa_address), NX_IP_UP);
netxen_list_config_vlan_ip(adapter, ifa, NX_IP_UP);
break;
case NETDEV_DOWN:
netxen_config_ipaddr(adapter,
- ifa->ifa_address, NX_IP_DOWN);
+ be32_to_cpu(ifa->ifa_address), NX_IP_DOWN);
netxen_list_config_vlan_ip(adapter, ifa, NX_IP_DOWN);
break;
default:
@@ -3167,11 +3171,11 @@ recheck:
switch (event) {
case NETDEV_UP:
- netxen_config_ipaddr(adapter, ifa->ifa_address, NX_IP_UP);
+ netxen_config_ipaddr(adapter, be32_to_cpu(ifa->ifa_address), NX_IP_UP);
netxen_list_config_vlan_ip(adapter, ifa, NX_IP_UP);
break;
case NETDEV_DOWN:
- netxen_config_ipaddr(adapter, ifa->ifa_address, NX_IP_DOWN);
+ netxen_config_ipaddr(adapter, be32_to_cpu(ifa->ifa_address), NX_IP_DOWN);
netxen_list_config_vlan_ip(adapter, ifa, NX_IP_DOWN);
break;
default:
--
1.7.4.4
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists