Skip to content

Commit d5f1ce9

Browse files
Stephen HemmingerDavid S. Miller
authored andcommitted
[PKTGEN]: don't use __constant_htonl()
The existing htonl() macro is smart enough to do the same code as using __constant_htonl() and it looks cleaner. Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org> Signed-off-by: Robert Olsson <robert.olsson@its.uu.se> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 5fa6fc7 commit d5f1ce9

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

‎net/core/pktgen.c‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@
168168
#define LAT_BUCKETS_MAX 32
169169
#define IP_NAME_SZ 32
170170
#define MAX_MPLS_LABELS 16 /* This is the max label stack depth */
171-
#define MPLS_STACK_BOTTOM __constant_htonl(0x00000100)
171+
#define MPLS_STACK_BOTTOM htonl(0x00000100)
172172

173173
/* Device flag bits */
174174
#define F_IPSRC_RND (1<<0) /* IP-Src Random */
@@ -2298,7 +2298,7 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev,
22982298
int datalen, iplen;
22992299
struct iphdr *iph;
23002300
struct pktgen_hdr *pgh = NULL;
2301-
__be16 protocol = __constant_htons(ETH_P_IP);
2301+
__be16 protocol = htons(ETH_P_IP);
23022302
__be32 *mpls;
23032303
__be16 *vlan_tci = NULL; /* Encapsulates priority and VLAN ID */
23042304
__be16 *vlan_encapsulated_proto = NULL; /* packet type ID field (or len) for VLAN tag */
@@ -2307,10 +2307,10 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev,
23072307

23082308

23092309
if (pkt_dev->nr_labels)
2310-
protocol = __constant_htons(ETH_P_MPLS_UC);
2310+
protocol = htons(ETH_P_MPLS_UC);
23112311

23122312
if (pkt_dev->vlan_id != 0xffff)
2313-
protocol = __constant_htons(ETH_P_8021Q);
2313+
protocol = htons(ETH_P_8021Q);
23142314

23152315
/* Update any of the values, used when we're incrementing various
23162316
* fields.
@@ -2342,14 +2342,14 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev,
23422342
pkt_dev->svlan_cfi,
23432343
pkt_dev->svlan_p);
23442344
svlan_encapsulated_proto = (__be16 *)skb_put(skb, sizeof(__be16));
2345-
*svlan_encapsulated_proto = __constant_htons(ETH_P_8021Q);
2345+
*svlan_encapsulated_proto = htons(ETH_P_8021Q);
23462346
}
23472347
vlan_tci = (__be16 *)skb_put(skb, sizeof(__be16));
23482348
*vlan_tci = build_tci(pkt_dev->vlan_id,
23492349
pkt_dev->vlan_cfi,
23502350
pkt_dev->vlan_p);
23512351
vlan_encapsulated_proto = (__be16 *)skb_put(skb, sizeof(__be16));
2352-
*vlan_encapsulated_proto = __constant_htons(ETH_P_IP);
2352+
*vlan_encapsulated_proto = htons(ETH_P_IP);
23532353
}
23542354

23552355
iph = (struct iphdr *)skb_put(skb, sizeof(struct iphdr));
@@ -2636,18 +2636,18 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev,
26362636
int datalen;
26372637
struct ipv6hdr *iph;
26382638
struct pktgen_hdr *pgh = NULL;
2639-
__be16 protocol = __constant_htons(ETH_P_IPV6);
2639+
__be16 protocol = htons(ETH_P_IPV6);
26402640
__be32 *mpls;
26412641
__be16 *vlan_tci = NULL; /* Encapsulates priority and VLAN ID */
26422642
__be16 *vlan_encapsulated_proto = NULL; /* packet type ID field (or len) for VLAN tag */
26432643
__be16 *svlan_tci = NULL; /* Encapsulates priority and SVLAN ID */
26442644
__be16 *svlan_encapsulated_proto = NULL; /* packet type ID field (or len) for SVLAN tag */
26452645

26462646
if (pkt_dev->nr_labels)
2647-
protocol = __constant_htons(ETH_P_MPLS_UC);
2647+
protocol = htons(ETH_P_MPLS_UC);
26482648

26492649
if (pkt_dev->vlan_id != 0xffff)
2650-
protocol = __constant_htons(ETH_P_8021Q);
2650+
protocol = htons(ETH_P_8021Q);
26512651

26522652
/* Update any of the values, used when we're incrementing various
26532653
* fields.
@@ -2678,14 +2678,14 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev,
26782678
pkt_dev->svlan_cfi,
26792679
pkt_dev->svlan_p);
26802680
svlan_encapsulated_proto = (__be16 *)skb_put(skb, sizeof(__be16));
2681-
*svlan_encapsulated_proto = __constant_htons(ETH_P_8021Q);
2681+
*svlan_encapsulated_proto = htons(ETH_P_8021Q);
26822682
}
26832683
vlan_tci = (__be16 *)skb_put(skb, sizeof(__be16));
26842684
*vlan_tci = build_tci(pkt_dev->vlan_id,
26852685
pkt_dev->vlan_cfi,
26862686
pkt_dev->vlan_p);
26872687
vlan_encapsulated_proto = (__be16 *)skb_put(skb, sizeof(__be16));
2688-
*vlan_encapsulated_proto = __constant_htons(ETH_P_IPV6);
2688+
*vlan_encapsulated_proto = htons(ETH_P_IPV6);
26892689
}
26902690

26912691
iph = (struct ipv6hdr *)skb_put(skb, sizeof(struct ipv6hdr));
@@ -2711,7 +2711,7 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev,
27112711
udph->len = htons(datalen + sizeof(struct udphdr));
27122712
udph->check = 0; /* No checksum */
27132713

2714-
*(__be32 *) iph = __constant_htonl(0x60000000); /* Version + flow */
2714+
*(__be32 *) iph = htonl(0x60000000); /* Version + flow */
27152715

27162716
if (pkt_dev->traffic_class) {
27172717
/* Version + traffic class + flow (0) */

0 commit comments

Comments
 (0)