Skip to content

Commit 056a01b

Browse files
madalinbucurdavem330
authored andcommitted
dpaa_eth: refactor frag count checking
Signed-off-by: Madalin Bucur <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 81084b3 commit 056a01b

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

drivers/net/ethernet/freescale/dpaa/dpaa_eth.c

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2055,19 +2055,23 @@ static int dpaa_start_xmit(struct sk_buff *skb, struct net_device *net_dev)
20552055
/* MAX_SKB_FRAGS is equal or larger than our dpaa_SGT_MAX_ENTRIES;
20562056
* make sure we don't feed FMan with more fragments than it supports.
20572057
*/
2058-
if (nonlinear &&
2059-
likely(skb_shinfo(skb)->nr_frags < DPAA_SGT_MAX_ENTRIES)) {
2060-
/* Just create a S/G fd based on the skb */
2061-
err = skb_to_sg_fd(priv, skb, &fd);
2062-
percpu_priv->tx_frag_skbuffs++;
2063-
} else {
2058+
if (unlikely(nonlinear &&
2059+
(skb_shinfo(skb)->nr_frags >= DPAA_SGT_MAX_ENTRIES))) {
20642060
/* If the egress skb contains more fragments than we support
20652061
* we have no choice but to linearize it ourselves.
20662062
*/
2067-
if (unlikely(nonlinear) && __skb_linearize(skb))
2063+
if (__skb_linearize(skb))
20682064
goto enomem;
20692065

2070-
/* Finally, create a contig FD from this skb */
2066+
nonlinear = skb_is_nonlinear(skb);
2067+
}
2068+
2069+
if (nonlinear) {
2070+
/* Just create a S/G fd based on the skb */
2071+
err = skb_to_sg_fd(priv, skb, &fd);
2072+
percpu_priv->tx_frag_skbuffs++;
2073+
} else {
2074+
/* Create a contig FD from this skb */
20712075
err = skb_to_contig_fd(priv, skb, &fd, &offset);
20722076
}
20732077
if (unlikely(err < 0))

0 commit comments

Comments
 (0)