summaryrefslogtreecommitdiffstats
path: root/net/core/pktgen.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2021-12-14 12:53:41 +0000
committerDavid S. Miller <davem@davemloft.net>2021-12-14 12:53:41 +0000
commitdc91e3be837ced738d04a4dc8aefc338e8f79235 (patch)
tree86b5c674b1e58aef7d77b5b598831b61516e0c4f /net/core/pktgen.c
parent13510fef48a3803d9ee8f044b015dacfb06fe0f5 (diff)
downloadlinux-stable-dc91e3be837ced738d04a4dc8aefc338e8f79235.tar.gz
linux-stable-dc91e3be837ced738d04a4dc8aefc338e8f79235.tar.bz2
linux-stable-dc91e3be837ced738d04a4dc8aefc338e8f79235.zip
Revert "pktgen: use min() to make code cleaner"
This reverts commit 13510fef48a3803d9ee8f044b015dacfb06fe0f5. Causes build warnings. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/pktgen.c')
-rw-r--r--net/core/pktgen.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 239effb42b61..560a5e712dc3 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -2778,7 +2778,8 @@ static void pktgen_finalize_skb(struct pktgen_dev *pkt_dev, struct sk_buff *skb,
}
i = 0;
- frag_len = min(datalen / frags, PAGE_SIZE);
+ frag_len = (datalen/frags) < PAGE_SIZE ?
+ (datalen/frags) : PAGE_SIZE;
while (datalen > 0) {
if (unlikely(!pkt_dev->page)) {
int node = numa_node_id();
@@ -2795,7 +2796,7 @@ static void pktgen_finalize_skb(struct pktgen_dev *pkt_dev, struct sk_buff *skb,
/*last fragment, fill rest of data*/
if (i == (frags - 1))
skb_frag_size_set(&skb_shinfo(skb)->frags[i],
- min(datalen, PAGE_SIZE));
+ (datalen < PAGE_SIZE ? datalen : PAGE_SIZE));
else
skb_frag_size_set(&skb_shinfo(skb)->frags[i], frag_len);
datalen -= skb_frag_size(&skb_shinfo(skb)->frags[i]);