Commit 03080e5c authored by Harvey Harrison's avatar Harvey Harrison Committed by Roland Dreier

RDMA/nes: Fix for NIPQUAD removal

Commit 63779436 ("drivers: replace NIPQUAD()") accidentally replaced
some HIPQUAD()s, causing IP addresses to be printed in reverse order.
Add temporary local vars until the byteswapping can be pushed further
up the stack.
Signed-off-by: default avatarHarvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
parent 6a94cb73
...@@ -778,12 +778,13 @@ static struct nes_cm_node *find_node(struct nes_cm_core *cm_core, ...@@ -778,12 +778,13 @@ static struct nes_cm_node *find_node(struct nes_cm_core *cm_core,
unsigned long flags; unsigned long flags;
struct list_head *hte; struct list_head *hte;
struct nes_cm_node *cm_node; struct nes_cm_node *cm_node;
__be32 tmp_addr = cpu_to_be32(loc_addr);
/* get a handle on the hte */ /* get a handle on the hte */
hte = &cm_core->connected_nodes; hte = &cm_core->connected_nodes;
nes_debug(NES_DBG_CM, "Searching for an owner node: %pI4:%x from core %p->%p\n", nes_debug(NES_DBG_CM, "Searching for an owner node: %pI4:%x from core %p->%p\n",
&loc_addr, loc_port, cm_core, hte); &tmp_addr, loc_port, cm_core, hte);
/* walk list and find cm_node associated with this session ID */ /* walk list and find cm_node associated with this session ID */
spin_lock_irqsave(&cm_core->ht_lock, flags); spin_lock_irqsave(&cm_core->ht_lock, flags);
...@@ -816,6 +817,7 @@ static struct nes_cm_listener *find_listener(struct nes_cm_core *cm_core, ...@@ -816,6 +817,7 @@ static struct nes_cm_listener *find_listener(struct nes_cm_core *cm_core,
{ {
unsigned long flags; unsigned long flags;
struct nes_cm_listener *listen_node; struct nes_cm_listener *listen_node;
__be32 tmp_addr = cpu_to_be32(dst_addr);
/* walk list and find cm_node associated with this session ID */ /* walk list and find cm_node associated with this session ID */
spin_lock_irqsave(&cm_core->listen_list_lock, flags); spin_lock_irqsave(&cm_core->listen_list_lock, flags);
...@@ -833,7 +835,7 @@ static struct nes_cm_listener *find_listener(struct nes_cm_core *cm_core, ...@@ -833,7 +835,7 @@ static struct nes_cm_listener *find_listener(struct nes_cm_core *cm_core,
spin_unlock_irqrestore(&cm_core->listen_list_lock, flags); spin_unlock_irqrestore(&cm_core->listen_list_lock, flags);
nes_debug(NES_DBG_CM, "Unable to find listener for %pI4:%x\n", nes_debug(NES_DBG_CM, "Unable to find listener for %pI4:%x\n",
&dst_addr, dst_port); &tmp_addr, dst_port);
/* no listener */ /* no listener */
return NULL; return NULL;
...@@ -2059,6 +2061,7 @@ static int mini_cm_recv_pkt(struct nes_cm_core *cm_core, ...@@ -2059,6 +2061,7 @@ static int mini_cm_recv_pkt(struct nes_cm_core *cm_core,
struct tcphdr *tcph; struct tcphdr *tcph;
struct nes_cm_info nfo; struct nes_cm_info nfo;
int skb_handled = 1; int skb_handled = 1;
__be32 tmp_daddr, tmp_saddr;
if (!skb) if (!skb)
return 0; return 0;
...@@ -2074,8 +2077,11 @@ static int mini_cm_recv_pkt(struct nes_cm_core *cm_core, ...@@ -2074,8 +2077,11 @@ static int mini_cm_recv_pkt(struct nes_cm_core *cm_core,
nfo.rem_addr = ntohl(iph->saddr); nfo.rem_addr = ntohl(iph->saddr);
nfo.rem_port = ntohs(tcph->source); nfo.rem_port = ntohs(tcph->source);
tmp_daddr = cpu_to_be32(iph->daddr);
tmp_saddr = cpu_to_be32(iph->saddr);
nes_debug(NES_DBG_CM, "Received packet: dest=%pI4:0x%04X src=%pI4:0x%04X\n", nes_debug(NES_DBG_CM, "Received packet: dest=%pI4:0x%04X src=%pI4:0x%04X\n",
&iph->daddr, tcph->dest, &iph->saddr, tcph->source); &tmp_daddr, tcph->dest, &tmp_saddr, tcph->source);
do { do {
cm_node = find_node(cm_core, cm_node = find_node(cm_core,
......
...@@ -655,6 +655,7 @@ int nes_arp_table(struct nes_device *nesdev, u32 ip_addr, u8 *mac_addr, u32 acti ...@@ -655,6 +655,7 @@ int nes_arp_table(struct nes_device *nesdev, u32 ip_addr, u8 *mac_addr, u32 acti
struct nes_adapter *nesadapter = nesdev->nesadapter; struct nes_adapter *nesadapter = nesdev->nesadapter;
int arp_index; int arp_index;
int err = 0; int err = 0;
__be32 tmp_addr;
for (arp_index = 0; (u32) arp_index < nesadapter->arp_table_size; arp_index++) { for (arp_index = 0; (u32) arp_index < nesadapter->arp_table_size; arp_index++) {
if (nesadapter->arp_table[arp_index].ip_addr == ip_addr) if (nesadapter->arp_table[arp_index].ip_addr == ip_addr)
...@@ -682,8 +683,9 @@ int nes_arp_table(struct nes_device *nesdev, u32 ip_addr, u8 *mac_addr, u32 acti ...@@ -682,8 +683,9 @@ int nes_arp_table(struct nes_device *nesdev, u32 ip_addr, u8 *mac_addr, u32 acti
/* DELETE or RESOLVE */ /* DELETE or RESOLVE */
if (arp_index == nesadapter->arp_table_size) { if (arp_index == nesadapter->arp_table_size) {
tmp_addr = cpu_to_be32(ip_addr);
nes_debug(NES_DBG_NETDEV, "MAC for %pI4 not in ARP table - cannot %s\n", nes_debug(NES_DBG_NETDEV, "MAC for %pI4 not in ARP table - cannot %s\n",
&ip_addr, action == NES_ARP_RESOLVE ? "resolve" : "delete"); &tmp_addr, action == NES_ARP_RESOLVE ? "resolve" : "delete");
return -1; return -1;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment