diff options
author | Antonio Quartulli <ordex@autistici.org> | 2013-05-19 12:55:16 +0200 |
---|---|---|
committer | Antonio Quartulli <antonio@meshcoding.com> | 2013-10-12 11:59:23 +0200 |
commit | 293e93385e024be71500c9480ef85d6199459d17 (patch) | |
tree | da710c595953f0442c0a2b18dd2f7723d8a5ee7d /net/batman-adv/gateway_client.c | |
parent | batman-adv: Fragment and send skbs larger than mtu (diff) | |
download | linux-293e93385e024be71500c9480ef85d6199459d17.tar.xz linux-293e93385e024be71500c9480ef85d6199459d17.zip |
batman-adv: use htons when possible
When comparing a network ordered value with a constant, it
is better to convert the constant at compile time by means
of htons() instead of converting the value at runtime using
ntohs().
This refactoring may slightly improve the code performance.
Moreover substitute __constant_htons() with htons() since
the latter increase readability and it is smart enough to be
as efficient as the former
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Acked-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Diffstat (limited to 'net/batman-adv/gateway_client.c')
-rw-r--r-- | net/batman-adv/gateway_client.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/batman-adv/gateway_client.c b/net/batman-adv/gateway_client.c index ac97ca7f4ad0..053bb318c7a7 100644 --- a/net/batman-adv/gateway_client.c +++ b/net/batman-adv/gateway_client.c @@ -716,11 +716,11 @@ bool batadv_gw_is_dhcp_target(struct sk_buff *skb, unsigned int *header_len) /* check for bootp port */ if ((proto == htons(ETH_P_IP)) && - (ntohs(udphdr->dest) != 67)) + (udphdr->dest != htons(67))) return false; if ((proto == htons(ETH_P_IPV6)) && - (ntohs(udphdr->dest) != 547)) + (udphdr->dest != htons(547))) return false; return true; |