From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Hayes Wang <hayeswang@realtek.com>, netdev@vger.kernel.org
Cc: nic_swsd@realtek.com, linux-kernel@vger.kernel.org,
linux-usb@vger.kernel.org
Subject: Re: [PATCH net-next 1/3] r8152: separate USB_RX_EARLY_AGG
Date: Wed, 11 Feb 2015 16:52:20 +0300 [thread overview]
Message-ID: <54DB5E94.6010101@cogentembedded.com> (raw)
In-Reply-To: <1394712342-15778-138-Taiwan-albertk@realtek.com>
Hello.
On 2/11/2015 9:46 AM, Hayes Wang wrote:
> Separate USB_RX_EARLY_AGG into USB_RX_EARLY_TIMEOUT and USB_RX_EARLY_SIZE.
> Replace r8153_set_rx_agg() with r8153_set_rx_early_timeout() and
> r8153_set_rx_early_size().
> Set the default timeout value according to the USB speed.
> Signed-off-by: Hayes Wang <hayeswang@realtek.com>
> ---
> drivers/net/usb/r8152.c | 55 ++++++++++++++++++++++++++-----------------------
> 1 file changed, 29 insertions(+), 26 deletions(-)
> diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
> index 5980ac6..b043c7f 100644
> --- a/drivers/net/usb/r8152.c
> +++ b/drivers/net/usb/r8152.c
[...]
> @@ -2114,28 +2116,21 @@ static int rtl8152_enable(struct r8152 *tp)
> return rtl_enable(tp);
> }
>
> -static void r8153_set_rx_agg(struct r8152 *tp)
> +static void r8153_set_rx_early_timeout(struct r8152 *tp)
> {
> - u8 speed;
> + u32 ocp_data;
>
[...]
> + ocp_data = tp->coalesce / 8;
Why not do it in the initializer?
> + ocp_write_word(tp, MCU_TYPE_USB, USB_RX_EARLY_TIMEOUT, ocp_data);
> +}
> +
> +static void r8153_set_rx_early_size(struct r8152 *tp)
> +{
> + struct net_device *dev = tp->netdev;
Not sure you actually need this variable.
> + u32 ocp_data;
> +
> + ocp_data = (agg_buf_sz - dev->mtu - VLAN_ETH_HLEN - VLAN_HLEN) / 4;
Why not in initializer?
> + ocp_write_word(tp, MCU_TYPE_USB, USB_RX_EARLY_SIZE, ocp_data);
> }
[...]
> @@ -3911,6 +3907,13 @@ static int rtl8152_probe(struct usb_interface *intf,
> tp->mii.reg_num_mask = 0x1f;
> tp->mii.phy_id = R8152_PHY_ID;
>
> + if (udev->speed == USB_SPEED_SUPER)
> + tp->coalesce = COALESCE_SUPER;
> + else if (udev->speed == USB_SPEED_HIGH)
> + tp->coalesce = COALESCE_HIGH;
> + else
> + tp->coalesce = COALESCE_SLOW;
This is asking to be a *switch* statement.
[...]
WBR, Sergei
WARNING: multiple messages have this Message-ID (diff)
From: Sergei Shtylyov <sergei.shtylyov-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>
To: Hayes Wang <hayeswang-Rasf1IRRPZFBDgjK7y7TUQ@public.gmane.org>,
netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: nic_swsd-Rasf1IRRPZFBDgjK7y7TUQ@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH net-next 1/3] r8152: separate USB_RX_EARLY_AGG
Date: Wed, 11 Feb 2015 16:52:20 +0300 [thread overview]
Message-ID: <54DB5E94.6010101@cogentembedded.com> (raw)
In-Reply-To: <1394712342-15778-138-Taiwan-albertk-Rasf1IRRPZFBDgjK7y7TUQ@public.gmane.org>
Hello.
On 2/11/2015 9:46 AM, Hayes Wang wrote:
> Separate USB_RX_EARLY_AGG into USB_RX_EARLY_TIMEOUT and USB_RX_EARLY_SIZE.
> Replace r8153_set_rx_agg() with r8153_set_rx_early_timeout() and
> r8153_set_rx_early_size().
> Set the default timeout value according to the USB speed.
> Signed-off-by: Hayes Wang <hayeswang-Rasf1IRRPZFBDgjK7y7TUQ@public.gmane.org>
> ---
> drivers/net/usb/r8152.c | 55 ++++++++++++++++++++++++++-----------------------
> 1 file changed, 29 insertions(+), 26 deletions(-)
> diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
> index 5980ac6..b043c7f 100644
> --- a/drivers/net/usb/r8152.c
> +++ b/drivers/net/usb/r8152.c
[...]
> @@ -2114,28 +2116,21 @@ static int rtl8152_enable(struct r8152 *tp)
> return rtl_enable(tp);
> }
>
> -static void r8153_set_rx_agg(struct r8152 *tp)
> +static void r8153_set_rx_early_timeout(struct r8152 *tp)
> {
> - u8 speed;
> + u32 ocp_data;
>
[...]
> + ocp_data = tp->coalesce / 8;
Why not do it in the initializer?
> + ocp_write_word(tp, MCU_TYPE_USB, USB_RX_EARLY_TIMEOUT, ocp_data);
> +}
> +
> +static void r8153_set_rx_early_size(struct r8152 *tp)
> +{
> + struct net_device *dev = tp->netdev;
Not sure you actually need this variable.
> + u32 ocp_data;
> +
> + ocp_data = (agg_buf_sz - dev->mtu - VLAN_ETH_HLEN - VLAN_HLEN) / 4;
Why not in initializer?
> + ocp_write_word(tp, MCU_TYPE_USB, USB_RX_EARLY_SIZE, ocp_data);
> }
[...]
> @@ -3911,6 +3907,13 @@ static int rtl8152_probe(struct usb_interface *intf,
> tp->mii.reg_num_mask = 0x1f;
> tp->mii.phy_id = R8152_PHY_ID;
>
> + if (udev->speed == USB_SPEED_SUPER)
> + tp->coalesce = COALESCE_SUPER;
> + else if (udev->speed == USB_SPEED_HIGH)
> + tp->coalesce = COALESCE_HIGH;
> + else
> + tp->coalesce = COALESCE_SLOW;
This is asking to be a *switch* statement.
[...]
WBR, Sergei
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2015-02-11 13:52 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-11 6:46 [PATCH net-next 0/3] Adjust the settings about USB_RX_EARLY_AGG Hayes Wang
2015-02-11 6:46 ` [PATCH net-next 1/3] r8152: separate USB_RX_EARLY_AGG Hayes Wang
2015-02-11 13:52 ` Sergei Shtylyov [this message]
2015-02-11 13:52 ` Sergei Shtylyov
2015-02-12 2:36 ` Hayes Wang
2015-02-12 6:04 ` Hayes Wang
2015-02-12 11:37 ` Sergei Shtylyov
2015-02-11 6:46 ` [PATCH net-next 2/3] r8152: change rx early size when the mtu is changed Hayes Wang
2015-02-11 6:46 ` [PATCH net-next 3/3] r8152: support setting rx coalesce Hayes Wang
2015-02-12 6:33 ` [PATCH net-next v2 0/3] Adjust the settings about USB_RX_EARLY_AGG Hayes Wang
2015-02-12 6:33 ` Hayes Wang
2015-02-12 6:33 ` [PATCH net-next v2 1/3] r8152: separate USB_RX_EARLY_AGG Hayes Wang
2015-02-12 6:33 ` [PATCH net-next v2 2/3] r8152: change rx early size when the mtu is changed Hayes Wang
2015-02-12 6:33 ` [PATCH net-next v2 3/3] r8152: support setting rx coalesce Hayes Wang
2015-02-19 20:09 ` [PATCH net-next v2 0/3] Adjust the settings about USB_RX_EARLY_AGG David Miller
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=54DB5E94.6010101@cogentembedded.com \
--to=sergei.shtylyov@cogentembedded.com \
--cc=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.