Commit 9020845f authored by Heiner Kallweit's avatar Heiner Kallweit Committed by David S. Miller

r8169: improve rtl8169_start_xmit

Only call rtl8169_xmit_frags() if the skb is actually fragmented.
This avoid a small overhead for non-fragmented skb's, and it allows
to simplify rtl8169_xmit_frags() a little.
Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8e3a5735
...@@ -4087,12 +4087,10 @@ static int rtl8169_xmit_frags(struct rtl8169_private *tp, struct sk_buff *skb, ...@@ -4087,12 +4087,10 @@ static int rtl8169_xmit_frags(struct rtl8169_private *tp, struct sk_buff *skb,
tp->tx_skb[entry].len = len; tp->tx_skb[entry].len = len;
} }
if (cur_frag) { tp->tx_skb[entry].skb = skb;
tp->tx_skb[entry].skb = skb; txd->opts1 |= cpu_to_le32(LastFrag);
txd->opts1 |= cpu_to_le32(LastFrag);
}
return cur_frag; return 0;
err_out: err_out:
rtl8169_tx_clear_range(tp, tp->cur_tx + 1, cur_frag); rtl8169_tx_clear_range(tp, tp->cur_tx + 1, cur_frag);
...@@ -4217,6 +4215,7 @@ static void rtl8169_doorbell(struct rtl8169_private *tp) ...@@ -4217,6 +4215,7 @@ static void rtl8169_doorbell(struct rtl8169_private *tp)
static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb, static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb,
struct net_device *dev) struct net_device *dev)
{ {
unsigned int frags = skb_shinfo(skb)->nr_frags;
struct rtl8169_private *tp = netdev_priv(dev); struct rtl8169_private *tp = netdev_priv(dev);
unsigned int entry = tp->cur_tx % NUM_TX_DESC; unsigned int entry = tp->cur_tx % NUM_TX_DESC;
struct TxDesc *txd = tp->TxDescArray + entry; struct TxDesc *txd = tp->TxDescArray + entry;
...@@ -4225,9 +4224,8 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb, ...@@ -4225,9 +4224,8 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb,
u32 opts[2], len; u32 opts[2], len;
bool stop_queue; bool stop_queue;
bool door_bell; bool door_bell;
int frags;
if (unlikely(!rtl_tx_slots_avail(tp, skb_shinfo(skb)->nr_frags))) { if (unlikely(!rtl_tx_slots_avail(tp, frags))) {
netif_err(tp, drv, dev, "BUG! Tx Ring full when queue awake!\n"); netif_err(tp, drv, dev, "BUG! Tx Ring full when queue awake!\n");
goto err_stop_0; goto err_stop_0;
} }
...@@ -4256,14 +4254,13 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb, ...@@ -4256,14 +4254,13 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb,
tp->tx_skb[entry].len = len; tp->tx_skb[entry].len = len;
txd->addr = cpu_to_le64(mapping); txd->addr = cpu_to_le64(mapping);
frags = rtl8169_xmit_frags(tp, skb, opts); if (!frags) {
if (frags < 0)
goto err_dma_1;
else if (frags)
opts[0] |= FirstFrag;
else {
opts[0] |= FirstFrag | LastFrag; opts[0] |= FirstFrag | LastFrag;
tp->tx_skb[entry].skb = skb; tp->tx_skb[entry].skb = skb;
} else {
if (rtl8169_xmit_frags(tp, skb, opts))
goto err_dma_1;
opts[0] |= FirstFrag;
} }
txd->opts2 = cpu_to_le32(opts[1]); txd->opts2 = cpu_to_le32(opts[1]);
......
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