Skip to contentSkip to conversation

SCTP: Move sctp_v4_dst_saddr out of loop

PATCH In review Gui Jianfeng 2 participants 2 messages Jun 3, 2008

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 SCTP: Move sctp_v4_dst_saddr out of loop

There's no need to execute sctp_v4_dst_saddr() for each iteration, just move it out of loop.

---
 net/sctp/protocol.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
net/sctp/protocol.c +1 -1
index c2dd65d..b51d980 100644
@@ -470,11 +470,11 @@ static struct dst_entry *sctp_v4_get_dst(struct sctp_association *asoc,
 		/* Walk through the bind address list and look for a bind
 		 * address that matches the source address of the returned dst.
 		 */
+		sctp_v4_dst_saddr(&dst_saddr, dst, htons(bp->port));
 		rcu_read_lock();
 		list_for_each_entry_rcu(laddr, &bp->address_list, list) {
 			if (!laddr->valid || (laddr->state != SCTP_ADDR_SRC))
 				continue;
-			sctp_v4_dst_saddr(&dst_saddr, dst, htons(bp->port));
 			if (sctp_v4_cmp_addr(&dst_saddr, &laddr->a))
 				goto out_unlock;
 		}
Signature · 1 line
1.5.3
#1 lore raw

Hi Gui

Quoted 4 lines · Gui Jianfeng

There's no need to execute sctp_v4_dst_saddr() for each iteration, just move it out of loop.

I'll put this in the set that I am getting ready to submit.

-vlad