From: Hayes Wang <hayeswang@realtek.com>
To: <netdev@vger.kernel.org>
Cc: <nic_swsd@realtek.com>, <linux-kernel@vger.kernel.org>,
<linux-usb@vger.kernel.org>, Hayes Wang <hayeswang@realtek.com>
Subject: [PATCH net-next 06/12] r8152: up the priority of the transmission
Date: Tue, 4 Mar 2014 20:00:58 +0800 [thread overview]
Message-ID: <1393934464-23675-7-git-send-email-hayeswang@realtek.com> (raw)
In-Reply-To: <1393934464-23675-1-git-send-email-hayeswang@realtek.com>
move the tx_bottom() from delayed_work to tasklet. It makes the rx
and tx balanced. If the device is in runtime suspend when getting
the tx packet, wakeup the device before trasmitting.
Signed-off-by: Hayes Wang <hayeswang@realtek.com>
---
drivers/net/usb/r8152.c | 45 +++++++++++++++++++++++++++------------------
1 file changed, 27 insertions(+), 18 deletions(-)
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index 00b3192..f1eaa18 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -447,6 +447,7 @@ enum rtl8152_flags {
RTL8152_LINK_CHG,
SELECTIVE_SUSPEND,
PHY_RESET,
+ SCHEDULE_TASKLET,
};
/* Define these values to match your device */
@@ -1071,7 +1072,7 @@ static void write_bulk_callback(struct urb *urb)
return;
if (!skb_queue_empty(&tp->tx_queue))
- schedule_delayed_work(&tp->schedule, 0);
+ tasklet_schedule(&tp->tl);
}
static void intr_callback(struct urb *urb)
@@ -1335,9 +1336,9 @@ static int r8152_tx_agg_fill(struct r8152 *tp, struct tx_agg *agg)
u8 *tx_data;
__skb_queue_head_init(&skb_head);
- spin_lock_bh(&tx_queue->lock);
+ spin_lock(&tx_queue->lock);
skb_queue_splice_init(tx_queue, &skb_head);
- spin_unlock_bh(&tx_queue->lock);
+ spin_unlock(&tx_queue->lock);
tx_data = agg->head;
agg->skb_num = agg->skb_len = 0;
@@ -1374,20 +1375,20 @@ static int r8152_tx_agg_fill(struct r8152 *tp, struct tx_agg *agg)
}
if (!skb_queue_empty(&skb_head)) {
- spin_lock_bh(&tx_queue->lock);
+ spin_lock(&tx_queue->lock);
skb_queue_splice(&skb_head, tx_queue);
- spin_unlock_bh(&tx_queue->lock);
+ spin_unlock(&tx_queue->lock);
}
- netif_tx_lock_bh(tp->netdev);
+ netif_tx_lock(tp->netdev);
if (netif_queue_stopped(tp->netdev) &&
skb_queue_len(&tp->tx_queue) < tp->tx_qlen)
netif_wake_queue(tp->netdev);
- netif_tx_unlock_bh(tp->netdev);
+ netif_tx_unlock(tp->netdev);
- ret = usb_autopm_get_interface(tp->intf);
+ ret = usb_autopm_get_interface_async(tp->intf);
if (ret < 0)
goto out_tx_fill;
@@ -1395,9 +1396,9 @@ static int r8152_tx_agg_fill(struct r8152 *tp, struct tx_agg *agg)
agg->head, (int)(tx_data - (u8 *)agg->head),
(usb_complete_t)write_bulk_callback, agg);
- ret = usb_submit_urb(agg->urb, GFP_KERNEL);
+ ret = usb_submit_urb(agg->urb, GFP_ATOMIC);
if (ret < 0)
- usb_autopm_put_interface(tp->intf);
+ usb_autopm_put_interface_async(tp->intf);
out_tx_fill:
return ret;
@@ -1535,6 +1536,7 @@ static void bottom_half(unsigned long data)
return;
rx_bottom(tp);
+ tx_bottom(tp);
}
static
@@ -1630,7 +1632,7 @@ static void _rtl8152_set_rx_mode(struct net_device *netdev)
}
static netdev_tx_t rtl8152_start_xmit(struct sk_buff *skb,
- struct net_device *netdev)
+ struct net_device *netdev)
{
struct r8152 *tp = netdev_priv(netdev);
@@ -1638,13 +1640,17 @@ static netdev_tx_t rtl8152_start_xmit(struct sk_buff *skb,
skb_queue_tail(&tp->tx_queue, skb);
- if (list_empty(&tp->tx_free) &&
- skb_queue_len(&tp->tx_queue) > tp->tx_qlen)
+ if (!list_empty(&tp->tx_free)) {
+ if (test_bit(SELECTIVE_SUSPEND, &tp->flags)) {
+ set_bit(SCHEDULE_TASKLET, &tp->flags);
+ schedule_delayed_work(&tp->schedule, 0);
+ } else {
+ usb_mark_last_busy(tp->udev);
+ tasklet_schedule(&tp->tl);
+ }
+ } else if (skb_queue_len(&tp->tx_queue) > tp->tx_qlen)
netif_stop_queue(netdev);
- if (!list_empty(&tp->tx_free))
- schedule_delayed_work(&tp->schedule, 0);
-
return NETDEV_TX_OK;
}
@@ -2523,8 +2529,11 @@ static void rtl_work_func_t(struct work_struct *work)
if (test_bit(RTL8152_SET_RX_MODE, &tp->flags))
_rtl8152_set_rx_mode(tp->netdev);
- if (tp->speed & LINK_STATUS)
- tx_bottom(tp);
+ if (test_bit(SCHEDULE_TASKLET, &tp->flags) &&
+ (tp->speed & LINK_STATUS)) {
+ clear_bit(SCHEDULE_TASKLET, &tp->flags);
+ tasklet_schedule(&tp->tl);
+ }
if (test_bit(PHY_RESET, &tp->flags))
rtl_phy_reset(tp);
--
1.8.4.2
next prev parent reply other threads:[~2014-03-04 12:04 UTC|newest]
Thread overview: 80+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-04 12:00 [PATCH net-next 00/12] r8152: new features Hayes Wang
2014-03-04 12:00 ` [PATCH net-next 01/12] r8152: deal with the empty line and space Hayes Wang
2014-03-04 12:00 ` [PATCH net-next 02/12] r8152: replace tp->netdev with netdev Hayes Wang
2014-03-04 12:00 ` [PATCH net-next 03/12] r8152: remove rtl8152_get_stats Hayes Wang
2014-03-04 12:00 ` [PATCH net-next 04/12] r8152: replace spin_lock_irqsave and spin_unlock_irqrestore Hayes Wang
2014-03-04 12:00 ` [PATCH net-next 05/12] r8152: check tx agg list before spin lock Hayes Wang
2014-03-04 12:00 ` Hayes Wang [this message]
2014-03-04 12:00 ` [PATCH net-next 07/12] r8152: support rx checksum Hayes Wang
2014-03-04 21:32 ` David Miller
2014-03-04 12:01 ` [PATCH net-next 08/12] r8152: support TSO Hayes Wang
2014-03-04 12:11 ` David Laight
2014-03-04 13:11 ` hayeswang
2014-03-04 14:35 ` David Laight
2014-03-04 15:02 ` Eric Dumazet
2014-03-04 15:14 ` David Laight
2014-03-04 16:11 ` Eric Dumazet
2014-03-04 16:52 ` Eric Dumazet
2014-03-04 12:01 ` [PATCH net-next 09/12] r8152: support IPv6 Hayes Wang
2014-03-04 16:58 ` Eric Dumazet
2014-03-04 12:01 ` [PATCH net-next 10/12] r8152: reduce the numbers of the bulks Hayes Wang
2014-03-04 12:01 ` [PATCH net-next 11/12] r8152: add additional parameter for non x86 platform Hayes Wang
2014-03-04 12:01 ` [PATCH net-next 12/12] r8152: modify the tx timeout funcfion Hayes Wang
2014-03-25 20:12 ` Grant Grundler
2014-03-26 9:54 ` hayeswang
2014-03-05 6:49 ` [PATCH net-next v2 00/13] r8152: new features Hayes Wang
2014-03-05 6:49 ` [PATCH net-next v2 01/13] r8152: deal with the empty line and space Hayes Wang
2014-03-05 6:49 ` [PATCH net-next v2 02/13] r8152: replace tp->netdev with netdev Hayes Wang
2014-03-05 6:49 ` [PATCH net-next v2 03/13] r8152: remove rtl8152_get_stats Hayes Wang
2014-03-05 6:49 ` [PATCH net-next v2 04/13] r8152: replace spin_lock_irqsave and spin_unlock_irqrestore Hayes Wang
2014-03-05 6:49 ` [PATCH net-next v2 05/13] r8152: check tx agg list before spin lock Hayes Wang
2014-03-05 6:49 ` [PATCH net-next v2 06/13] r8152: up the priority of the transmission Hayes Wang
2014-03-05 6:49 ` [PATCH net-next v2 07/13] r8152: calculate the dropped packets for rx Hayes Wang
2014-03-05 6:49 ` [PATCH net-next v2 08/13] r8152: support rx checksum Hayes Wang
2014-03-05 6:49 ` [PATCH net-next v2 09/13] r8152: support TSO Hayes Wang
2014-03-05 6:49 ` [PATCH net-next v2 10/13] r8152: support IPv6 Hayes Wang
2014-03-09 19:47 ` Ben Hutchings
2014-03-09 22:56 ` David Miller
2014-03-05 6:49 ` [PATCH net-next v2 11/13] r8152: reduce the numbers of the bulks Hayes Wang
2014-03-05 6:49 ` [PATCH net-next v2 12/13] r8152: add additional parameter for non x86 platform Hayes Wang
2014-03-06 5:05 ` David Miller
2014-03-05 6:49 ` [PATCH net-next v2 13/13] r8152: modify the tx timeout funcfion Hayes Wang
2014-03-06 7:07 ` [PATCH net-next 0/3] r8152: cleanups Hayes Wang
2014-03-06 7:07 ` [PATCH net-next 1/3] r8152: deal with the empty line and space Hayes Wang
2014-03-06 7:07 ` [PATCH net-next 2/3] r8152: replace tp->netdev with netdev Hayes Wang
2014-03-06 7:07 ` [PATCH net-next 3/3] r8152: remove rtl8152_get_stats Hayes Wang
2014-03-06 18:17 ` [PATCH net-next 0/3] r8152: cleanups David Miller
2014-03-07 3:04 ` [PATCH net-next 0/7] r8152: tx/rx improvement Hayes Wang
2014-03-07 3:04 ` [PATCH net-next 1/7] r8152: replace spin_lock_irqsave and spin_unlock_irqrestore Hayes Wang
2014-03-07 3:04 ` [PATCH net-next 2/7] r8152: check tx agg list before spin lock Hayes Wang
2014-03-07 3:04 ` [PATCH net-next 3/7] r8152: up the priority of the transmission Hayes Wang
2014-03-07 3:04 ` [PATCH net-next 4/7] r8152: calculate the dropped packets for rx Hayes Wang
2014-03-07 3:04 ` [PATCH net-next 5/7] r8152: support rx checksum Hayes Wang
2014-03-07 3:04 ` [PATCH net-next 6/7] r8152: support TSO Hayes Wang
2014-03-07 3:04 ` [PATCH net-next 7/7] r8152: support IPv6 Hayes Wang
2014-03-07 21:27 ` [PATCH net-next 0/7] r8152: tx/rx improvement David Miller
2014-03-10 3:45 ` hayeswang
2014-03-10 6:22 ` [PATCH net-next] r8152: add skb_cow_head Hayes Wang
2014-03-10 20:31 ` David Miller
2014-03-11 2:20 ` [PATCH net-next v2] " Hayes Wang
2014-03-11 2:25 ` David Miller
2014-03-12 12:39 ` [PATCH net-next 0/2] parameter modification Hayes Wang
2014-03-12 12:39 ` [PATCH net-next 1/2] r8152: add CONFIG_RTL8152_EARLY_AGG_SUPER Hayes Wang
2014-03-12 13:40 ` Bjørn Mork
2014-03-12 12:39 ` [PATCH net-next 2/2] r8152: reduce the numbers of the bulks Hayes Wang
2014-03-13 3:34 ` [PATCH net-next v2 0/2] parameter modification Hayes Wang
2014-03-13 3:34 ` [PATCH net-next v2 1/2] r8152: add RTL8152_EARLY_AGG_TIMEOUT_SUPER Hayes Wang
2014-03-13 9:28 ` David Laight
2014-03-13 3:34 ` [PATCH net-next v2 2/2] r8152: reduce the numbers of the bulks Hayes Wang
2014-03-13 12:05 ` [PATCH net-next v3 0/2] parameter modification Hayes Wang
2014-03-13 12:05 ` [PATCH net-next v3 1/2] r8152: add RTL8152_EARLY_AGG_TIMEOUT_SUPER Hayes Wang
2014-03-13 13:12 ` David Laight
2014-03-13 17:22 ` David Miller
2014-03-14 2:37 ` [PATCH net-next v3 1/2] r8152: addRTL8152_EARLY_AGG_TIMEOUT_SUPER hayeswang
2014-03-14 4:07 ` David Miller
2014-03-14 7:24 ` [PATCH net-next v3 1/2] r8152:addRTL8152_EARLY_AGG_TIMEOUT_SUPER hayeswang
2014-03-14 18:43 ` David Miller
2014-03-17 6:01 ` [PATCH net-next v3 1/2]r8152:addRTL8152_EARLY_AGG_TIMEOUT_SUPER hayeswang
2014-03-14 23:42 ` [PATCH net-next v3 1/2] r8152:addRTL8152_EARLY_AGG_TIMEOUT_SUPER Francois Romieu
2014-03-17 6:03 ` hayeswang
2014-03-13 12:05 ` [PATCH net-next v3 2/2] r8152: reduce the numbers of the bulks Hayes Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1393934464-23675-7-git-send-email-hayeswang@realtek.com \
--to=hayeswang@realtek.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nic_swsd@realtek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®