Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1662150 > unrolled thread
| Started by | Hayes Wang <hayeswang@realtek.com> |
|---|---|
| First post | 2017-06-09 11:20 +0200 |
| Last post | 2017-06-09 21:40 +0200 |
| Articles | 10 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH net-next 00/11] r8152: minor adjustment Hayes Wang <hayeswang@realtek.com> - 2017-06-09 11:20 +0200
[PATCH net-next 05/11] r8152: adjust rtl8153_runtime_enable function Hayes Wang <hayeswang@realtek.com> - 2017-06-09 11:20 +0200
[PATCH net-next 11/11] r8152: replace napi_complete with napi_complete_done Hayes Wang <hayeswang@realtek.com> - 2017-06-09 11:20 +0200
[PATCH net-next 03/11] r8152: adjust the settings about MAC clock speed down for RTL8153 Hayes Wang <hayeswang@realtek.com> - 2017-06-09 11:20 +0200
[PATCH net-next 10/11] r8152: avoid rx queue more than 1000 packets Hayes Wang <hayeswang@realtek.com> - 2017-06-09 11:20 +0200
[PATCH net-next 04/11] r8152: move the setting of rx aggregation Hayes Wang <hayeswang@realtek.com> - 2017-06-09 11:20 +0200
[PATCH net-next 02/11] r8152: adjust lpm settings for RTL8153 Hayes Wang <hayeswang@realtek.com> - 2017-06-09 11:20 +0200
[PATCH net-next 07/11] r8152: move the default coalesce setting for RTL8153 Hayes Wang <hayeswang@realtek.com> - 2017-06-09 11:20 +0200
[PATCH net-next 01/11] r8152: add r8153_phy_status function Hayes Wang <hayeswang@realtek.com> - 2017-06-09 11:20 +0200
Re: [PATCH net-next 00/11] r8152: minor adjustment David Miller <davem@davemloft.net> - 2017-06-09 21:40 +0200
| From | Hayes Wang <hayeswang@realtek.com> |
|---|---|
| Date | 2017-06-09 11:20 +0200 |
| Subject | [PATCH net-next 00/11] r8152: minor adjustment |
| Message-ID | <tQoff-88B-3@gated-at.bofh.it> |
Adjust some code to make it reasonable or satisfy the suggestion from the engineers. Hayes Wang (11): r8152: add r8153_phy_status function r8152: adjust lpm settings for RTL8153 r8152: adjust the settings about MAC clock speed down for RTL8153 r8152: move the setting of rx aggregation r8152: adjust rtl8153_runtime_enable function r8152: adjust U2P3 for RTL8153 r8152: move the default coalesce setting for RTL8153 r8152: move the initialization to reset_resume function r8152: check if disabling ALDPS is finished r8152: avoid rx queue more than 1000 packets r8152: replace napi_complete with napi_complete_done drivers/net/usb/r8152.c | 181 ++++++++++++++++++++++++++++++++++-------------- 1 file changed, 130 insertions(+), 51 deletions(-) -- 2.7.4
[toc] | [next] | [standalone]
| From | Hayes Wang <hayeswang@realtek.com> |
|---|---|
| Date | 2017-06-09 11:20 +0200 |
| Subject | [PATCH net-next 05/11] r8152: adjust rtl8153_runtime_enable function |
| Message-ID | <tQoff-88B-15@gated-at.bofh.it> |
| In reply to | #1662150 |
Adjust the order of rtl8153_runtime_enable() according to the
suggestion from the engineer.
Signed-off-by: Hayes Wang <hayeswang@realtek.com>
---
drivers/net/usb/r8152.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index e569c48..32e83fd 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -2551,13 +2551,13 @@ static void rtl_runtime_suspend_enable(struct r8152 *tp, bool enable)
static void rtl8153_runtime_enable(struct r8152 *tp, bool enable)
{
- rtl_runtime_suspend_enable(tp, enable);
-
if (enable) {
r8153_u1u2en(tp, false);
r8153_u2p3en(tp, false);
r8153_mac_clk_spd(tp, true);
+ rtl_runtime_suspend_enable(tp, true);
} else {
+ rtl_runtime_suspend_enable(tp, false);
r8153_mac_clk_spd(tp, false);
r8153_u2p3en(tp, true);
r8153_u1u2en(tp, true);
--
2.7.4
[toc] | [prev] | [next] | [standalone]
| From | Hayes Wang <hayeswang@realtek.com> |
|---|---|
| Date | 2017-06-09 11:20 +0200 |
| Subject | [PATCH net-next 11/11] r8152: replace napi_complete with napi_complete_done |
| Message-ID | <tQofg-88B-25@gated-at.bofh.it> |
| In reply to | #1662150 |
Change from using napi_complete to napi_complete_done to allow for the
use of gro_flush_timeout in tuning network processing.
Signed-off-by: Hayes Wang <hayeswang@realtek.com>
---
drivers/net/usb/r8152.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index fa29583..5a02053 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -1938,7 +1938,8 @@ static int r8152_poll(struct napi_struct *napi, int budget)
bottom_half(tp);
if (work_done < budget) {
- napi_complete(napi);
+ if (!napi_complete_done(napi, work_done))
+ goto out;
if (!list_empty(&tp->rx_done))
napi_schedule(napi);
else if (!skb_queue_empty(&tp->tx_queue) &&
@@ -1946,6 +1947,7 @@ static int r8152_poll(struct napi_struct *napi, int budget)
napi_schedule(napi);
}
+out:
return work_done;
}
--
2.7.4
[toc] | [prev] | [next] | [standalone]
| From | Hayes Wang <hayeswang@realtek.com> |
|---|---|
| Date | 2017-06-09 11:20 +0200 |
| Subject | [PATCH net-next 03/11] r8152: adjust the settings about MAC clock speed down for RTL8153 |
| Message-ID | <tQofg-88B-33@gated-at.bofh.it> |
| In reply to | #1662150 |
The MAC clock speed down could be enabled if the U1/U2 is disabled.
Signed-off-by: Hayes Wang <hayeswang@realtek.com>
---
drivers/net/usb/r8152.c | 34 +++++++++++++++++++++++++++++-----
1 file changed, 29 insertions(+), 5 deletions(-)
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index b8c904f..9a794db 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -2428,6 +2428,29 @@ static void __rtl_set_wol(struct r8152 *tp, u32 wolopts)
device_set_wakeup_enable(&tp->udev->dev, false);
}
+static void r8153_mac_clk_spd(struct r8152 *tp, bool enable)
+{
+ /* MAC clock speed down */
+ if (enable) {
+ ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL,
+ ALDPS_SPDWN_RATIO);
+ ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL2,
+ EEE_SPDWN_RATIO);
+ ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL3,
+ PKT_AVAIL_SPDWN_EN | SUSPEND_SPDWN_EN |
+ U1U2_SPDWN_EN | L1_SPDWN_EN);
+ ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL4,
+ PWRSAVE_SPDWN_EN | RXDV_SPDWN_EN | TX10MIDLE_EN |
+ TP100_SPDWN_EN | TP500_SPDWN_EN | EEE_SPDWN_EN |
+ TP1000_SPDWN_EN);
+ } else {
+ ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL, 0);
+ ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL2, 0);
+ ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL3, 0);
+ ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL4, 0);
+ }
+}
+
static void r8153_u1u2en(struct r8152 *tp, bool enable)
{
u8 u1u2[8];
@@ -2533,7 +2556,9 @@ static void rtl8153_runtime_enable(struct r8152 *tp, bool enable)
if (enable) {
r8153_u1u2en(tp, false);
r8153_u2p3en(tp, false);
+ r8153_mac_clk_spd(tp, true);
} else {
+ r8153_mac_clk_spd(tp, false);
r8153_u2p3en(tp, true);
r8153_u1u2en(tp, true);
}
@@ -2881,6 +2906,7 @@ static void r8153_first_init(struct r8152 *tp)
u32 ocp_data;
int i;
+ r8153_mac_clk_spd(tp, false);
rxdy_gated_en(tp, true);
r8153_teredo_off(tp);
@@ -2947,6 +2973,8 @@ static void r8153_enter_oob(struct r8152 *tp)
u32 ocp_data;
int i;
+ r8153_mac_clk_spd(tp, true);
+
ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL);
ocp_data &= ~NOW_IS_OOB;
ocp_write_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL, ocp_data);
@@ -3513,13 +3541,9 @@ static void r8153_init(struct r8152 *tp)
r8153_power_cut_en(tp, false);
r8153_u1u2en(tp, true);
+ r8153_mac_clk_spd(tp, false);
usb_enable_lpm(tp->udev);
- /* MAC clock speed down */
- ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL, 0);
- ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL2, 0);
- ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL3, 0);
- ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL4, 0);
rtl_tally_reset(tp);
r8153_u2p3en(tp, true);
--
2.7.4
[toc] | [prev] | [next] | [standalone]
| From | Hayes Wang <hayeswang@realtek.com> |
|---|---|
| Date | 2017-06-09 11:20 +0200 |
| Subject | [PATCH net-next 10/11] r8152: avoid rx queue more than 1000 packets |
| Message-ID | <tQofh-88B-37@gated-at.bofh.it> |
| In reply to | #1662150 |
Stop queuing rx packets if it is more than 1000. Signed-off-by: Hayes Wang <hayeswang@realtek.com> --- drivers/net/usb/r8152.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index 204f4b2..fa29583 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -1813,6 +1813,10 @@ static int rx_bottom(struct r8152 *tp, int budget) unsigned int pkt_len; struct sk_buff *skb; + /* limite the skb numbers for rx_queue */ + if (unlikely(skb_queue_len(&tp->rx_queue) >= 1000)) + break; + pkt_len = le32_to_cpu(rx_desc->opts1) & RX_LEN_MASK; if (pkt_len < ETH_ZLEN) break; -- 2.7.4
[toc] | [prev] | [next] | [standalone]
| From | Hayes Wang <hayeswang@realtek.com> |
|---|---|
| Date | 2017-06-09 11:20 +0200 |
| Subject | [PATCH net-next 04/11] r8152: move the setting of rx aggregation |
| Message-ID | <tQofh-88B-39@gated-at.bofh.it> |
| In reply to | #1662150 |
Move the setting from r8153_first_init() to r8153_init(). It only needs to be set once. Signed-off-by: Hayes Wang <hayeswang@realtek.com> --- drivers/net/usb/r8152.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index 9a794db..e569c48 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -2961,11 +2961,6 @@ static void r8153_first_init(struct r8152 *tp) ocp_write_word(tp, MCU_TYPE_PLA, PLA_RXFIFO_CTRL2, RXFIFO_THR3_NORMAL); /* TX share fifo free credit full threshold */ ocp_write_dword(tp, MCU_TYPE_PLA, PLA_TXFIFO_CTRL, TXFIFO_THR_NORMAL2); - - /* rx aggregation */ - ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_USB_CTRL); - ocp_data &= ~(RX_AGG_DISABLE | RX_ZERO_EN); - ocp_write_word(tp, MCU_TYPE_USB, USB_USB_CTRL, ocp_data); } static void r8153_enter_oob(struct r8152 *tp) @@ -3544,6 +3539,10 @@ static void r8153_init(struct r8152 *tp) r8153_mac_clk_spd(tp, false); usb_enable_lpm(tp->udev); + /* rx aggregation */ + ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_USB_CTRL); + ocp_data &= ~(RX_AGG_DISABLE | RX_ZERO_EN); + ocp_write_word(tp, MCU_TYPE_USB, USB_USB_CTRL, ocp_data); rtl_tally_reset(tp); r8153_u2p3en(tp, true); -- 2.7.4
[toc] | [prev] | [next] | [standalone]
| From | Hayes Wang <hayeswang@realtek.com> |
|---|---|
| Date | 2017-06-09 11:20 +0200 |
| Subject | [PATCH net-next 02/11] r8152: adjust lpm settings for RTL8153 |
| Message-ID | <tQofh-88B-41@gated-at.bofh.it> |
| In reply to | #1662150 |
Enable lpm after r8153_init() and remove other enable/disable lpm.
Signed-off-by: Hayes Wang <hayeswang@realtek.com>
---
drivers/net/usb/r8152.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index 9239dfb..b8c904f 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -2263,7 +2263,6 @@ static int rtl8153_enable(struct r8152 *tp)
if (test_bit(RTL8152_UNPLUG, &tp->flags))
return -ENODEV;
- usb_disable_lpm(tp->udev);
set_tx_qlen(tp);
rtl_set_eee_plus(tp);
r8153_set_rx_early_timeout(tp);
@@ -3003,7 +3002,6 @@ static void rtl8153_disable(struct r8152 *tp)
rtl_disable(tp);
rtl_reset_bmu(tp);
r8153_aldps_en(tp, true);
- usb_enable_lpm(tp->udev);
}
static int rtl8152_set_speed(struct r8152 *tp, u8 autoneg, u16 speed, u8 duplex)
@@ -3127,7 +3125,6 @@ static void rtl8153_up(struct r8152 *tp)
r8153_aldps_en(tp, true);
r8153_u2p3en(tp, true);
r8153_u1u2en(tp, true);
- usb_enable_lpm(tp->udev);
}
static void rtl8153_down(struct r8152 *tp)
@@ -3457,7 +3454,6 @@ static void r8153_init(struct r8152 *tp)
data = r8153_phy_status(tp, PHY_STAT_LAN_ON);
- usb_disable_lpm(tp->udev);
r8153_u2p3en(tp, false);
if (tp->version == RTL_VER_04) {
@@ -3517,6 +3513,7 @@ static void r8153_init(struct r8152 *tp)
r8153_power_cut_en(tp, false);
r8153_u1u2en(tp, true);
+ usb_enable_lpm(tp->udev);
/* MAC clock speed down */
ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL, 0);
--
2.7.4
[toc] | [prev] | [next] | [standalone]
| From | Hayes Wang <hayeswang@realtek.com> |
|---|---|
| Date | 2017-06-09 11:20 +0200 |
| Subject | [PATCH net-next 07/11] r8152: move the default coalesce setting for RTL8153 |
| Message-ID | <tQofh-88B-45@gated-at.bofh.it> |
| In reply to | #1662150 |
Only RTL8153 could set coalesce, so move the default setting for
rtl8152_probe() to r8153_init().
Signed-off-by: Hayes Wang <hayeswang@realtek.com>
---
drivers/net/usb/r8152.c | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index 565ac5b..f78111c 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -3579,6 +3579,19 @@ static void r8153_init(struct r8152 *tp)
ocp_write_word(tp, MCU_TYPE_USB, USB_USB_CTRL, ocp_data);
rtl_tally_reset(tp);
+
+ switch (tp->udev->speed) {
+ case USB_SPEED_SUPER:
+ case USB_SPEED_SUPER_PLUS:
+ tp->coalesce = COALESCE_SUPER;
+ break;
+ case USB_SPEED_HIGH:
+ tp->coalesce = COALESCE_HIGH;
+ break;
+ default:
+ tp->coalesce = COALESCE_SLOW;
+ break;
+ }
}
static int rtl8152_pre_reset(struct usb_interface *intf)
@@ -4524,19 +4537,6 @@ static int rtl8152_probe(struct usb_interface *intf,
tp->mii.reg_num_mask = 0x1f;
tp->mii.phy_id = R8152_PHY_ID;
- switch (udev->speed) {
- case USB_SPEED_SUPER:
- case USB_SPEED_SUPER_PLUS:
- tp->coalesce = COALESCE_SUPER;
- break;
- case USB_SPEED_HIGH:
- tp->coalesce = COALESCE_HIGH;
- break;
- default:
- tp->coalesce = COALESCE_SLOW;
- break;
- }
-
tp->autoneg = AUTONEG_ENABLE;
tp->speed = tp->mii.supports_gmii ? SPEED_1000 : SPEED_100;
tp->duplex = DUPLEX_FULL;
--
2.7.4
[toc] | [prev] | [next] | [standalone]
| From | Hayes Wang <hayeswang@realtek.com> |
|---|---|
| Date | 2017-06-09 11:20 +0200 |
| Subject | [PATCH net-next 01/11] r8152: add r8153_phy_status function |
| Message-ID | <tQofh-88B-47@gated-at.bofh.it> |
| In reply to | #1662150 |
Use r8153_phy_status() to check phy status of RTL8153.
Signed-off-by: Hayes Wang <hayeswang@realtek.com>
---
drivers/net/usb/r8152.c | 37 +++++++++++++++++++++++++------------
1 file changed, 25 insertions(+), 12 deletions(-)
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index fd31fab..9239dfb 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -394,6 +394,7 @@
/* OCP_PHY_STATUS */
#define PHY_STAT_MASK 0x0007
+#define PHY_STAT_EXT_INIT 2
#define PHY_STAT_LAN_ON 3
#define PHY_STAT_PWRDN 5
@@ -2452,6 +2453,28 @@ static void r8153_u2p3en(struct r8152 *tp, bool enable)
ocp_write_word(tp, MCU_TYPE_USB, USB_U2P3_CTRL, ocp_data);
}
+static u16 r8153_phy_status(struct r8152 *tp, u16 desired)
+{
+ u16 data;
+ int i;
+
+ for (i = 0; i < 500; i++) {
+ data = ocp_reg_read(tp, OCP_PHY_STATUS);
+ data &= PHY_STAT_MASK;
+ if (desired) {
+ if (data == desired)
+ break;
+ } else if (data == PHY_STAT_LAN_ON || data == PHY_STAT_PWRDN ||
+ data == PHY_STAT_EXT_INIT) {
+ break;
+ }
+
+ msleep(20);
+ }
+
+ return data;
+}
+
static void r8153_power_cut_en(struct r8152 *tp, bool enable)
{
u32 ocp_data;
@@ -3420,12 +3443,7 @@ static void r8153_init(struct r8152 *tp)
msleep(20);
}
- for (i = 0; i < 500; i++) {
- ocp_data = ocp_reg_read(tp, OCP_PHY_STATUS) & PHY_STAT_MASK;
- if (ocp_data == PHY_STAT_LAN_ON || ocp_data == PHY_STAT_PWRDN)
- break;
- msleep(20);
- }
+ data = r8153_phy_status(tp, 0);
if (tp->version == RTL_VER_03 || tp->version == RTL_VER_04 ||
tp->version == RTL_VER_05)
@@ -3437,12 +3455,7 @@ static void r8153_init(struct r8152 *tp)
r8152_mdio_write(tp, MII_BMCR, data);
}
- for (i = 0; i < 500; i++) {
- ocp_data = ocp_reg_read(tp, OCP_PHY_STATUS) & PHY_STAT_MASK;
- if (ocp_data == PHY_STAT_LAN_ON)
- break;
- msleep(20);
- }
+ data = r8153_phy_status(tp, PHY_STAT_LAN_ON);
usb_disable_lpm(tp->udev);
r8153_u2p3en(tp, false);
--
2.7.4
[toc] | [prev] | [next] | [standalone]
| From | David Miller <davem@davemloft.net> |
|---|---|
| Date | 2017-06-09 21:40 +0200 |
| Message-ID | <tQxVf-5AV-11@gated-at.bofh.it> |
| In reply to | #1662150 |
From: Hayes Wang <hayeswang@realtek.com> Date: Fri, 9 Jun 2017 17:11:37 +0800 > Adjust some code to make it reasonable or satisfy the suggestion from > the engineers. Series applied, thank you.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web