On Mon, Aug 12, 2013 at 04:28:12PM +0200, Simon Wunderlich wrote:
diff --git a/routing.c b/routing.c index d4f512d..5b8f087 100644 --- a/routing.c +++ b/routing.c @@ -1091,6 +1091,7 @@ int batadv_recv_bcast_packet(struct sk_buff *skb, int hdr_size = sizeof(*bcast_packet); int ret = NET_RX_DROP; int32_t seq_diff;
uint32_t seqno;
/* drop packet if it has not necessary minimum size */ if (unlikely(!pskb_may_pull(skb, hdr_size)))
@@ -1126,12 +1127,13 @@ int batadv_recv_bcast_packet(struct sk_buff *skb,
spin_lock_bh(&orig_node->bcast_seqno_lock);
- seqno = ntohl(bcast_packet->seqno); /* check whether the packet is a duplicate */ if (batadv_test_bit(orig_node->bcast_bits, orig_node->last_bcast_seqno,
ntohl(bcast_packet->seqno)))
goto spin_unlock;seqno))
- seq_diff = ntohl(bcast_packet->seqno) - orig_node->last_bcast_seqno;
seq_diff = seqno - orig_node->last_bcast_seqno;
/* check whether the packet is old and the host just restarted. */ if (batadv_window_protected(bat_priv, seq_diff,
@@ -1142,7 +1144,7 @@ int batadv_recv_bcast_packet(struct sk_buff *skb, * if required. */ if (batadv_bit_get_packet(bat_priv, orig_node->bcast_bits, seq_diff, 1))
orig_node->last_bcast_seqno = ntohl(bcast_packet->seqno);
orig_node->last_bcast_seqno = seqno;
spin_unlock_bh(&orig_node->bcast_seqno_lock);
Why are you changing this seqno stuff? Although this might be a valid (micro-)optimization, I don't think this should be in this patch ... or at least I don't understand it. :)
I must introduce a seqno variable to shorten a line that is following. Since I could choose, I decided to use seqno to store the value received within the packet so that I could reduce the number of ntohs. So I had to do that change and I did it in a good way :)
Cheers,