Skip to content

Commit 6067804

Browse files
acmeldavem330
authored andcommitted
net: Use hton[sl]() instead of __constant_hton[sl]() where applicable
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent a574420 commit 6067804

File tree

11 files changed

+35
-35
lines changed

11 files changed

+35
-35
lines changed

net/8021q/vlan_dev.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ static int vlan_dev_rebuild_header(struct sk_buff *skb)
4848

4949
switch (veth->h_vlan_encapsulated_proto) {
5050
#ifdef CONFIG_INET
51-
case __constant_htons(ETH_P_IP):
51+
case htons(ETH_P_IP):
5252

5353
/* TODO: Confirm this will work with VLAN headers... */
5454
return arp_find(veth->h_dest, skb);

net/atm/br2684.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -375,11 +375,11 @@ static void br2684_push(struct atm_vcc *atmvcc, struct sk_buff *skb)
375375
if (memcmp
376376
(skb->data + 6, ethertype_ipv6,
377377
sizeof(ethertype_ipv6)) == 0)
378-
skb->protocol = __constant_htons(ETH_P_IPV6);
378+
skb->protocol = htons(ETH_P_IPV6);
379379
else if (memcmp
380380
(skb->data + 6, ethertype_ipv4,
381381
sizeof(ethertype_ipv4)) == 0)
382-
skb->protocol = __constant_htons(ETH_P_IP);
382+
skb->protocol = htons(ETH_P_IP);
383383
else
384384
goto error;
385385
skb_pull(skb, sizeof(llc_oui_ipv4));
@@ -404,9 +404,9 @@ static void br2684_push(struct atm_vcc *atmvcc, struct sk_buff *skb)
404404
skb_reset_network_header(skb);
405405
iph = ip_hdr(skb);
406406
if (iph->version == 4)
407-
skb->protocol = __constant_htons(ETH_P_IP);
407+
skb->protocol = htons(ETH_P_IP);
408408
else if (iph->version == 6)
409-
skb->protocol = __constant_htons(ETH_P_IPV6);
409+
skb->protocol = htons(ETH_P_IPV6);
410410
else
411411
goto error;
412412
skb->pkt_type = PACKET_HOST;

net/core/dev.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1675,13 +1675,13 @@ static u16 simple_tx_hash(struct net_device *dev, struct sk_buff *skb)
16751675
}
16761676

16771677
switch (skb->protocol) {
1678-
case __constant_htons(ETH_P_IP):
1678+
case htons(ETH_P_IP):
16791679
ip_proto = ip_hdr(skb)->protocol;
16801680
addr1 = ip_hdr(skb)->saddr;
16811681
addr2 = ip_hdr(skb)->daddr;
16821682
ihl = ip_hdr(skb)->ihl;
16831683
break;
1684-
case __constant_htons(ETH_P_IPV6):
1684+
case htons(ETH_P_IPV6):
16851685
ip_proto = ipv6_hdr(skb)->nexthdr;
16861686
addr1 = ipv6_hdr(skb)->saddr.s6_addr32[3];
16871687
addr2 = ipv6_hdr(skb)->daddr.s6_addr32[3];

net/ethernet/eth.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ int eth_rebuild_header(struct sk_buff *skb)
129129

130130
switch (eth->h_proto) {
131131
#ifdef CONFIG_INET
132-
case __constant_htons(ETH_P_IP):
132+
case htons(ETH_P_IP):
133133
return arp_find(eth->h_dest, skb);
134134
#endif
135135
default:

net/ipv4/ipvs/ip_vs_core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -938,7 +938,7 @@ ip_vs_out(unsigned int hooknum, struct sk_buff *skb,
938938

939939
EnterFunction(11);
940940

941-
af = (skb->protocol == __constant_htons(ETH_P_IP)) ? AF_INET : AF_INET6;
941+
af = (skb->protocol == htons(ETH_P_IP)) ? AF_INET : AF_INET6;
942942

943943
if (skb->ipvs_property)
944944
return NF_ACCEPT;
@@ -1258,7 +1258,7 @@ ip_vs_in(unsigned int hooknum, struct sk_buff *skb,
12581258
struct ip_vs_conn *cp;
12591259
int ret, restart, af;
12601260

1261-
af = (skb->protocol == __constant_htons(ETH_P_IP)) ? AF_INET : AF_INET6;
1261+
af = (skb->protocol == htons(ETH_P_IP)) ? AF_INET : AF_INET6;
12621262

12631263
ip_vs_fill_iphdr(af, skb_network_header(skb), &iph);
12641264

net/ipv6/ip6_tunnel.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,10 +1050,10 @@ ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev)
10501050
}
10511051

10521052
switch (skb->protocol) {
1053-
case __constant_htons(ETH_P_IP):
1053+
case htons(ETH_P_IP):
10541054
ret = ip4ip6_tnl_xmit(skb, dev);
10551055
break;
1056-
case __constant_htons(ETH_P_IPV6):
1056+
case htons(ETH_P_IPV6):
10571057
ret = ip6ip6_tnl_xmit(skb, dev);
10581058
break;
10591059
default:

net/mac80211/wme.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ static unsigned int classify_1d(struct sk_buff *skb)
3939
return skb->priority - 256;
4040

4141
switch (skb->protocol) {
42-
case __constant_htons(ETH_P_IP):
42+
case htons(ETH_P_IP):
4343
dscp = ip_hdr(skb)->tos & 0xfc;
4444
break;
4545

net/sched/cls_flow.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ static inline u32 addr_fold(void *addr)
6767
static u32 flow_get_src(const struct sk_buff *skb)
6868
{
6969
switch (skb->protocol) {
70-
case __constant_htons(ETH_P_IP):
70+
case htons(ETH_P_IP):
7171
return ntohl(ip_hdr(skb)->saddr);
72-
case __constant_htons(ETH_P_IPV6):
72+
case htons(ETH_P_IPV6):
7373
return ntohl(ipv6_hdr(skb)->saddr.s6_addr32[3]);
7474
default:
7575
return addr_fold(skb->sk);
@@ -79,9 +79,9 @@ static u32 flow_get_src(const struct sk_buff *skb)
7979
static u32 flow_get_dst(const struct sk_buff *skb)
8080
{
8181
switch (skb->protocol) {
82-
case __constant_htons(ETH_P_IP):
82+
case htons(ETH_P_IP):
8383
return ntohl(ip_hdr(skb)->daddr);
84-
case __constant_htons(ETH_P_IPV6):
84+
case htons(ETH_P_IPV6):
8585
return ntohl(ipv6_hdr(skb)->daddr.s6_addr32[3]);
8686
default:
8787
return addr_fold(skb->dst) ^ (__force u16)skb->protocol;
@@ -91,9 +91,9 @@ static u32 flow_get_dst(const struct sk_buff *skb)
9191
static u32 flow_get_proto(const struct sk_buff *skb)
9292
{
9393
switch (skb->protocol) {
94-
case __constant_htons(ETH_P_IP):
94+
case htons(ETH_P_IP):
9595
return ip_hdr(skb)->protocol;
96-
case __constant_htons(ETH_P_IPV6):
96+
case htons(ETH_P_IPV6):
9797
return ipv6_hdr(skb)->nexthdr;
9898
default:
9999
return 0;
@@ -120,15 +120,15 @@ static u32 flow_get_proto_src(const struct sk_buff *skb)
120120
u32 res = 0;
121121

122122
switch (skb->protocol) {
123-
case __constant_htons(ETH_P_IP): {
123+
case htons(ETH_P_IP): {
124124
struct iphdr *iph = ip_hdr(skb);
125125

126126
if (!(iph->frag_off&htons(IP_MF|IP_OFFSET)) &&
127127
has_ports(iph->protocol))
128128
res = ntohs(*(__be16 *)((void *)iph + iph->ihl * 4));
129129
break;
130130
}
131-
case __constant_htons(ETH_P_IPV6): {
131+
case htons(ETH_P_IPV6): {
132132
struct ipv6hdr *iph = ipv6_hdr(skb);
133133

134134
if (has_ports(iph->nexthdr))
@@ -147,15 +147,15 @@ static u32 flow_get_proto_dst(const struct sk_buff *skb)
147147
u32 res = 0;
148148

149149
switch (skb->protocol) {
150-
case __constant_htons(ETH_P_IP): {
150+
case htons(ETH_P_IP): {
151151
struct iphdr *iph = ip_hdr(skb);
152152

153153
if (!(iph->frag_off&htons(IP_MF|IP_OFFSET)) &&
154154
has_ports(iph->protocol))
155155
res = ntohs(*(__be16 *)((void *)iph + iph->ihl * 4 + 2));
156156
break;
157157
}
158-
case __constant_htons(ETH_P_IPV6): {
158+
case htons(ETH_P_IPV6): {
159159
struct ipv6hdr *iph = ipv6_hdr(skb);
160160

161161
if (has_ports(iph->nexthdr))
@@ -213,9 +213,9 @@ static u32 flow_get_nfct(const struct sk_buff *skb)
213213
static u32 flow_get_nfct_src(const struct sk_buff *skb)
214214
{
215215
switch (skb->protocol) {
216-
case __constant_htons(ETH_P_IP):
216+
case htons(ETH_P_IP):
217217
return ntohl(CTTUPLE(skb, src.u3.ip));
218-
case __constant_htons(ETH_P_IPV6):
218+
case htons(ETH_P_IPV6):
219219
return ntohl(CTTUPLE(skb, src.u3.ip6[3]));
220220
}
221221
fallback:
@@ -225,9 +225,9 @@ static u32 flow_get_nfct_src(const struct sk_buff *skb)
225225
static u32 flow_get_nfct_dst(const struct sk_buff *skb)
226226
{
227227
switch (skb->protocol) {
228-
case __constant_htons(ETH_P_IP):
228+
case htons(ETH_P_IP):
229229
return ntohl(CTTUPLE(skb, dst.u3.ip));
230-
case __constant_htons(ETH_P_IPV6):
230+
case htons(ETH_P_IPV6):
231231
return ntohl(CTTUPLE(skb, dst.u3.ip6[3]));
232232
}
233233
fallback:

net/sched/sch_dsmark.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,15 +202,15 @@ static int dsmark_enqueue(struct sk_buff *skb, struct Qdisc *sch)
202202

203203
if (p->set_tc_index) {
204204
switch (skb->protocol) {
205-
case __constant_htons(ETH_P_IP):
205+
case htons(ETH_P_IP):
206206
if (skb_cow_head(skb, sizeof(struct iphdr)))
207207
goto drop;
208208

209209
skb->tc_index = ipv4_get_dsfield(ip_hdr(skb))
210210
& ~INET_ECN_MASK;
211211
break;
212212

213-
case __constant_htons(ETH_P_IPV6):
213+
case htons(ETH_P_IPV6):
214214
if (skb_cow_head(skb, sizeof(struct ipv6hdr)))
215215
goto drop;
216216

@@ -289,11 +289,11 @@ static struct sk_buff *dsmark_dequeue(struct Qdisc *sch)
289289
pr_debug("index %d->%d\n", skb->tc_index, index);
290290

291291
switch (skb->protocol) {
292-
case __constant_htons(ETH_P_IP):
292+
case htons(ETH_P_IP):
293293
ipv4_change_dsfield(ip_hdr(skb), p->mask[index],
294294
p->value[index]);
295295
break;
296-
case __constant_htons(ETH_P_IPV6):
296+
case htons(ETH_P_IPV6):
297297
ipv6_change_dsfield(ipv6_hdr(skb), p->mask[index],
298298
p->value[index]);
299299
break;

net/sched/sch_sfq.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ static unsigned sfq_hash(struct sfq_sched_data *q, struct sk_buff *skb)
119119
u32 h, h2;
120120

121121
switch (skb->protocol) {
122-
case __constant_htons(ETH_P_IP):
122+
case htons(ETH_P_IP):
123123
{
124124
const struct iphdr *iph = ip_hdr(skb);
125125
h = iph->daddr;
@@ -134,7 +134,7 @@ static unsigned sfq_hash(struct sfq_sched_data *q, struct sk_buff *skb)
134134
h2 ^= *(((u32*)iph) + iph->ihl);
135135
break;
136136
}
137-
case __constant_htons(ETH_P_IPV6):
137+
case htons(ETH_P_IPV6):
138138
{
139139
struct ipv6hdr *iph = ipv6_hdr(skb);
140140
h = iph->daddr.s6_addr32[3];

0 commit comments

Comments
 (0)