Revert "pktgen: use min() to make code cleaner"

This reverts commit 13510fef48.

Causes build warnings.

Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
David S. Miller 2021-12-14 12:53:41 +00:00
parent 13510fef48
commit dc91e3be83

View File

@ -2778,7 +2778,8 @@ static void pktgen_finalize_skb(struct pktgen_dev *pkt_dev, struct sk_buff *skb,
} }
i = 0; i = 0;
frag_len = min(datalen / frags, PAGE_SIZE); frag_len = (datalen/frags) < PAGE_SIZE ?
(datalen/frags) : PAGE_SIZE;
while (datalen > 0) { while (datalen > 0) {
if (unlikely(!pkt_dev->page)) { if (unlikely(!pkt_dev->page)) {
int node = numa_node_id(); 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*/ /*last fragment, fill rest of data*/
if (i == (frags - 1)) if (i == (frags - 1))
skb_frag_size_set(&skb_shinfo(skb)->frags[i], skb_frag_size_set(&skb_shinfo(skb)->frags[i],
min(datalen, PAGE_SIZE)); (datalen < PAGE_SIZE ? datalen : PAGE_SIZE));
else else
skb_frag_size_set(&skb_shinfo(skb)->frags[i], frag_len); skb_frag_size_set(&skb_shinfo(skb)->frags[i], frag_len);
datalen -= skb_frag_size(&skb_shinfo(skb)->frags[i]); datalen -= skb_frag_size(&skb_shinfo(skb)->frags[i]);