netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v2 0/2 RESEND] r8152: adjust r8152_submit_rx
@ 2015-01-09  2:26 Hayes Wang
  2015-01-09  2:26 ` [PATCH net-next v2 1/2 RESEND] r8152: call rtl_start_rx after netif_carrier_on Hayes Wang
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Hayes Wang @ 2015-01-09  2:26 UTC (permalink / raw)
  To: netdev; +Cc: nic_swsd, linux-kernel, linux-usb, Hayes Wang

v2:
Replace the patch #1 with "call rtl_start_rx after netif_carrier_on".

For patch #2, replace checking tp->speed with netif_carrier_ok.

v1:
Avoid r8152_submit_rx() from submitting rx during unexpected
moment. This could reduce the time of stopping rx.

For patch #1, the tp->speed should be updated early. Then,
the patch #2 could use it to check the current linking status.

Hayes Wang (2):
  r8152: call rtl_start_rx after netif_carrier_on
  r8152: check the status before submitting rx

 drivers/net/usb/r8152.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

-- 
2.1.0

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH net-next v2 1/2 RESEND] r8152: call rtl_start_rx after netif_carrier_on
  2015-01-09  2:26 [PATCH net-next v2 0/2 RESEND] r8152: adjust r8152_submit_rx Hayes Wang
@ 2015-01-09  2:26 ` Hayes Wang
  2015-01-09  2:26 ` [PATCH net-next v2 2/2 RESEND] r8152: check the status before submitting rx Hayes Wang
  2015-01-12 21:11 ` [PATCH net-next v2 0/2 RESEND] r8152: adjust r8152_submit_rx David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Hayes Wang @ 2015-01-09  2:26 UTC (permalink / raw)
  To: netdev; +Cc: nic_swsd, linux-kernel, linux-usb, Hayes Wang

Remove rtl_start_rx() from rtl_enable() and put it after calling
netif_carrier_on().

Signed-off-by: Hayes Wang <hayeswang@realtek.com>
---
 drivers/net/usb/r8152.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index 57ec23e..cd93388 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -2059,7 +2059,7 @@ static int rtl_enable(struct r8152 *tp)
 
 	rxdy_gated_en(tp, false);
 
-	return rtl_start_rx(tp);
+	return 0;
 }
 
 static int rtl8152_enable(struct r8152 *tp)
@@ -2874,6 +2874,7 @@ static void set_carrier(struct r8152 *tp)
 			tp->rtl_ops.enable(tp);
 			set_bit(RTL8152_SET_RX_MODE, &tp->flags);
 			netif_carrier_on(netdev);
+			rtl_start_rx(tp);
 		}
 	} else {
 		if (tp->speed & LINK_STATUS) {
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH net-next v2 2/2 RESEND] r8152: check the status before submitting rx
  2015-01-09  2:26 [PATCH net-next v2 0/2 RESEND] r8152: adjust r8152_submit_rx Hayes Wang
  2015-01-09  2:26 ` [PATCH net-next v2 1/2 RESEND] r8152: call rtl_start_rx after netif_carrier_on Hayes Wang
@ 2015-01-09  2:26 ` Hayes Wang
  2015-01-12 21:11 ` [PATCH net-next v2 0/2 RESEND] r8152: adjust r8152_submit_rx David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Hayes Wang @ 2015-01-09  2:26 UTC (permalink / raw)
  To: netdev; +Cc: nic_swsd, linux-kernel, linux-usb, Hayes Wang

Don't submit the rx if the device is unplugged, stopped, or
linking down.

Signed-off-by: Hayes Wang <hayeswang@realtek.com>
---
 drivers/net/usb/r8152.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index cd93388..b23426e 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -1789,6 +1789,11 @@ int r8152_submit_rx(struct r8152 *tp, struct rx_agg *agg, gfp_t mem_flags)
 {
 	int ret;
 
+	/* The rx would be stopped, so skip submitting */
+	if (test_bit(RTL8152_UNPLUG, &tp->flags) ||
+	    !test_bit(WORK_ENABLE, &tp->flags) || !netif_carrier_ok(tp->netdev))
+		return 0;
+
 	usb_fill_bulk_urb(agg->urb, tp->udev, usb_rcvbulkpipe(tp->udev, 1),
 			  agg->head, agg_buf_sz,
 			  (usb_complete_t)read_bulk_callback, agg);
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next v2 0/2 RESEND] r8152: adjust r8152_submit_rx
  2015-01-09  2:26 [PATCH net-next v2 0/2 RESEND] r8152: adjust r8152_submit_rx Hayes Wang
  2015-01-09  2:26 ` [PATCH net-next v2 1/2 RESEND] r8152: call rtl_start_rx after netif_carrier_on Hayes Wang
  2015-01-09  2:26 ` [PATCH net-next v2 2/2 RESEND] r8152: check the status before submitting rx Hayes Wang
@ 2015-01-12 21:11 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2015-01-12 21:11 UTC (permalink / raw)
  To: hayeswang; +Cc: netdev, nic_swsd, linux-kernel, linux-usb

From: Hayes Wang <hayeswang@realtek.com>
Date: Fri, 9 Jan 2015 10:26:34 +0800

> v2:
> Replace the patch #1 with "call rtl_start_rx after netif_carrier_on".
> 
> For patch #2, replace checking tp->speed with netif_carrier_ok.
> 
> v1:
> Avoid r8152_submit_rx() from submitting rx during unexpected
> moment. This could reduce the time of stopping rx.
> 
> For patch #1, the tp->speed should be updated early. Then,
> the patch #2 could use it to check the current linking status.

Series applied, thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-01-12 21:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-09  2:26 [PATCH net-next v2 0/2 RESEND] r8152: adjust r8152_submit_rx Hayes Wang
2015-01-09  2:26 ` [PATCH net-next v2 1/2 RESEND] r8152: call rtl_start_rx after netif_carrier_on Hayes Wang
2015-01-09  2:26 ` [PATCH net-next v2 2/2 RESEND] r8152: check the status before submitting rx Hayes Wang
2015-01-12 21:11 ` [PATCH net-next v2 0/2 RESEND] r8152: adjust r8152_submit_rx David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).