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 3/6] r8152: change some definitions
Date: Fri, 27 Dec 2013 10:34:07 +0800 [thread overview]
Message-ID: <1388111649-1014-4-git-send-email-hayeswang@realtek.com> (raw)
In-Reply-To: <1388111649-1014-1-git-send-email-hayeswang@realtek.com>
Replace RX_BUF_THR with RX_THR_HIGH.
Replace RWSUME_INDICATE with RESUME_INDICATE.
Add CRC_SIZE, TX_ALIGN, and RX_ALIGN.
Signed-off-by: Hayes Wang <hayeswang@realtek.com>
---
drivers/net/usb/r8152.c | 27 ++++++++++++++++-----------
1 file changed, 16 insertions(+), 11 deletions(-)
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index b8bc3eb..a8ea848 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -209,7 +209,7 @@
#define TX_AGG_MAX_THRESHOLD 0x03
/* USB_RX_BUF_TH */
-#define RX_BUF_THR 0x7a120180
+#define RX_THR_HIGH 0x7a120180
/* USB_TX_DMA */
#define TEST_MODE_DISABLE 0x00000001
@@ -219,7 +219,7 @@
#define POWER_CUT 0x0100
/* USB_PM_CTRL_STATUS */
-#define RWSUME_INDICATE 0x0001
+#define RESUME_INDICATE 0x0001
/* USB_USB_CTRL */
#define RX_AGG_DISABLE 0x0010
@@ -274,6 +274,9 @@ enum rtl_register_content {
#define RTL8152_MAX_TX 10
#define RTL8152_MAX_RX 10
#define INTBUFSIZE 2
+#define CRC_SIZE 4
+#define TX_ALIGN 4
+#define RX_ALIGN 8
#define INTR_LINK 0x0004
@@ -916,12 +919,12 @@ resubmit:
static inline void *rx_agg_align(void *data)
{
- return (void *)ALIGN((uintptr_t)data, 8);
+ return (void *)ALIGN((uintptr_t)data, RX_ALIGN);
}
static inline void *tx_agg_align(void *data)
{
- return (void *)ALIGN((uintptr_t)data, 4);
+ return (void *)ALIGN((uintptr_t)data, TX_ALIGN);
}
static void free_all_mem(struct r8152 *tp)
@@ -990,7 +993,8 @@ static int alloc_all_mem(struct r8152 *tp)
if (buf != rx_agg_align(buf)) {
kfree(buf);
- buf = kmalloc_node(rx_buf_sz + 8, GFP_KERNEL, node);
+ buf = kmalloc_node(rx_buf_sz + RX_ALIGN, GFP_KERNEL,
+ node);
if (!buf)
goto err1;
}
@@ -1015,7 +1019,8 @@ static int alloc_all_mem(struct r8152 *tp)
if (buf != tx_agg_align(buf)) {
kfree(buf);
- buf = kmalloc_node(rx_buf_sz + 4, GFP_KERNEL, node);
+ buf = kmalloc_node(rx_buf_sz + TX_ALIGN, GFP_KERNEL,
+ node);
if (!buf)
goto err1;
}
@@ -1215,7 +1220,7 @@ static void rx_bottom(struct r8152 *tp)
stats = rtl8152_get_stats(netdev);
- pkt_len -= 4; /* CRC */
+ pkt_len -= CRC_SIZE; /* CRC */
rx_data += sizeof(struct rx_desc);
skb = netdev_alloc_skb_ip_align(netdev, pkt_len);
@@ -1230,7 +1235,7 @@ static void rx_bottom(struct r8152 *tp)
stats->rx_packets++;
stats->rx_bytes += pkt_len;
- rx_data = rx_agg_align(rx_data + pkt_len + 4);
+ rx_data = rx_agg_align(rx_data + pkt_len + CRC_SIZE);
rx_desc = (struct rx_desc *)rx_data;
len_used = (int)(rx_data - (u8 *)agg->head);
len_used += sizeof(struct rx_desc);
@@ -1580,7 +1585,7 @@ static void r8152b_exit_oob(struct r8152 *tp)
ocp_write_dword(tp, MCU_TYPE_PLA, PLA_TXFIFO_CTRL, TXFIFO_THR_NORMAL);
ocp_write_byte(tp, MCU_TYPE_USB, USB_TX_AGG, TX_AGG_MAX_THRESHOLD);
- ocp_write_dword(tp, MCU_TYPE_USB, USB_RX_BUF_TH, RX_BUF_THR);
+ ocp_write_dword(tp, MCU_TYPE_USB, USB_RX_BUF_TH, RX_THR_HIGH);
ocp_write_dword(tp, MCU_TYPE_USB, USB_TX_DMA,
TEST_MODE_DISABLE | TX_SIZE_ADJUST1);
@@ -1893,7 +1898,7 @@ static void r8152b_init(struct r8152 *tp)
ocp_write_word(tp, MCU_TYPE_USB, USB_UPS_CTRL, ocp_data);
ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_PM_CTRL_STATUS);
- ocp_data &= ~RWSUME_INDICATE;
+ ocp_data &= ~RESUME_INDICATE;
ocp_write_word(tp, MCU_TYPE_USB, USB_PM_CTRL_STATUS, ocp_data);
r8152b_exit_oob(tp);
@@ -2074,7 +2079,7 @@ static void rtl8152_unload(struct r8152 *tp)
}
ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_PM_CTRL_STATUS);
- ocp_data &= ~RWSUME_INDICATE;
+ ocp_data &= ~RESUME_INDICATE;
ocp_write_word(tp, MCU_TYPE_USB, USB_PM_CTRL_STATUS, ocp_data);
}
--
1.8.3.1
next prev parent reply other threads:[~2013-12-27 2:34 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-27 2:34 [PATCH net-next 0/6] Support new chip Hayes Wang
[not found] ` <1388111649-1014-1-git-send-email-hayeswang-Rasf1IRRPZFBDgjK7y7TUQ@public.gmane.org>
2013-12-27 2:34 ` [PATCH net-next 1/6] r8152: move rtl8152_unload and ocp_reg_write Hayes Wang
2013-12-27 2:34 ` [PATCH net-next 2/6] r8152: modify the method of accessing PHY Hayes Wang
2013-12-27 2:34 ` Hayes Wang [this message]
2013-12-27 18:57 ` [PATCH net-next 3/6] r8152: change some definitions Francois Romieu
2013-12-27 2:34 ` [PATCH net-next 4/6] r8152: add rtl_ops Hayes Wang
2013-12-27 17:28 ` David Miller
2013-12-27 2:34 ` [PATCH net-next 5/6] r8152: split rtl8152_enable Hayes Wang
2013-12-27 2:37 ` [PATCH net-next 6/6] r8152: support RTL8153 Hayes Wang
2013-12-27 19:08 ` Francois Romieu
2014-01-02 3:22 ` [PATCH net-next v2 0/6] support new chip Hayes Wang
2014-01-02 3:22 ` [PATCH net-next v2 1/6] r8152: move rtl8152_unload and ocp_reg_write Hayes Wang
2014-01-02 3:22 ` [PATCH net-next v2 2/6] r8152: modify the method of accessing PHY Hayes Wang
2014-01-02 3:22 ` [PATCH net-next v2 3/6] r8152: change some definitions Hayes Wang
2014-01-02 3:22 ` [PATCH net-next v2 4/6] r8152: add rtl_ops Hayes Wang
2014-01-02 3:22 ` [PATCH net-next v2 5/6] r8152: split rtl8152_enable Hayes Wang
2014-01-02 3:25 ` [PATCH net-next v2 6/6] r8152: support RTL8153 Hayes Wang
2014-01-02 14:25 ` Bjørn Mork
2014-01-03 2:56 ` hayeswang
2014-01-03 7:49 ` Bjørn Mork
2014-01-06 3:20 ` hayeswang
2014-01-06 9:21 ` Bjørn Mork
2014-01-07 12:35 ` hayeswang
[not found] ` <749DBDC9792E47BBA5884BEC7CF2D639-Rasf1IRRPZGoECsaD+WFmw@public.gmane.org>
2014-01-08 18:24 ` Ben Hutchings
[not found] ` <1388632963-1341-1-git-send-email-hayeswang-Rasf1IRRPZFBDgjK7y7TUQ@public.gmane.org>
2014-01-02 3:55 ` [PATCH net-next v2 0/6] support new chip 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=1388111649-1014-4-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;
as well as URLs for NNTP newsgroup(s).