Commit 94b295ed authored by Andy Shevchenko's avatar Andy Shevchenko Committed by David S. Miller

net/macb: replace macb_count_tx_descriptors() by DIV_ROUND_UP()

macb_count_tx_descriptors() repeats the generic macro DIV_ROUND_UP(). The patch
does a replacement.

There is no functional change.
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8bcbf82f
...@@ -1157,12 +1157,6 @@ static void macb_poll_controller(struct net_device *dev) ...@@ -1157,12 +1157,6 @@ static void macb_poll_controller(struct net_device *dev)
} }
#endif #endif
static inline unsigned int macb_count_tx_descriptors(struct macb *bp,
unsigned int len)
{
return (len + bp->max_tx_length - 1) / bp->max_tx_length;
}
static unsigned int macb_tx_map(struct macb *bp, static unsigned int macb_tx_map(struct macb *bp,
struct macb_queue *queue, struct macb_queue *queue,
struct sk_buff *skb) struct sk_buff *skb)
...@@ -1313,11 +1307,11 @@ static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -1313,11 +1307,11 @@ static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev)
* socket buffer: skb fragments of jumbo frames may need to be * socket buffer: skb fragments of jumbo frames may need to be
* splitted into many buffer descriptors. * splitted into many buffer descriptors.
*/ */
count = macb_count_tx_descriptors(bp, skb_headlen(skb)); count = DIV_ROUND_UP(skb_headlen(skb), bp->max_tx_length);
nr_frags = skb_shinfo(skb)->nr_frags; nr_frags = skb_shinfo(skb)->nr_frags;
for (f = 0; f < nr_frags; f++) { for (f = 0; f < nr_frags; f++) {
frag_size = skb_frag_size(&skb_shinfo(skb)->frags[f]); frag_size = skb_frag_size(&skb_shinfo(skb)->frags[f]);
count += macb_count_tx_descriptors(bp, frag_size); count += DIV_ROUND_UP(frag_size, bp->max_tx_length);
} }
spin_lock_irqsave(&bp->lock, flags); spin_lock_irqsave(&bp->lock, flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment