Skip to content

Commit 54139cf

Browse files
Joao Pintodavem330
authored andcommitted
net: stmmac: adding multiple buffers for rx
This patch adds the structure stmmac_rx_queue which contains rx queues specific data (previously in stmmac_priv). Signed-off-by: Joao Pinto <[email protected]> Tested-by: Niklas Cassel <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 71fedb0 commit 54139cf

File tree

3 files changed

+306
-184
lines changed

3 files changed

+306
-184
lines changed

drivers/net/ethernet/stmicro/stmmac/chain_mode.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,15 +136,16 @@ static void stmmac_init_dma_chain(void *des, dma_addr_t phy_addr,
136136

137137
static void stmmac_refill_desc3(void *priv_ptr, struct dma_desc *p)
138138
{
139-
struct stmmac_priv *priv = (struct stmmac_priv *)priv_ptr;
139+
struct stmmac_rx_queue *rx_q = (struct stmmac_rx_queue *)priv_ptr;
140+
struct stmmac_priv *priv = rx_q->priv_data;
140141

141142
if (priv->hwts_rx_en && !priv->extend_desc)
142143
/* NOTE: Device will overwrite des3 with timestamp value if
143144
* 1588-2002 time stamping is enabled, hence reinitialize it
144145
* to keep explicit chaining in the descriptor.
145146
*/
146-
p->des3 = cpu_to_le32((unsigned int)(priv->dma_rx_phy +
147-
(((priv->dirty_rx) + 1) %
147+
p->des3 = cpu_to_le32((unsigned int)(rx_q->dma_rx_phy +
148+
(((rx_q->dirty_rx) + 1) %
148149
DMA_RX_SIZE) *
149150
sizeof(struct dma_desc)));
150151
}

drivers/net/ethernet/stmicro/stmmac/stmmac.h

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,20 @@ struct stmmac_tx_info {
4646
bool is_jumbo;
4747
};
4848

49+
struct stmmac_rx_queue {
50+
u32 queue_index;
51+
struct stmmac_priv *priv_data;
52+
struct dma_extended_desc *dma_erx;
53+
struct dma_desc *dma_rx ____cacheline_aligned_in_smp;
54+
struct sk_buff **rx_skbuff;
55+
dma_addr_t *rx_skbuff_dma;
56+
unsigned int cur_rx;
57+
unsigned int dirty_rx;
58+
u32 rx_zeroc_thresh;
59+
dma_addr_t dma_rx_phy;
60+
u32 rx_tail_addr;
61+
};
62+
4963
struct stmmac_priv {
5064
/* Frequently used values are kept adjacent for cache effect */
5165
struct dma_extended_desc *dma_etx ____cacheline_aligned_in_smp;
@@ -64,18 +78,10 @@ struct stmmac_priv {
6478
struct timer_list txtimer;
6579
bool tso;
6680

67-
struct dma_desc *dma_rx ____cacheline_aligned_in_smp;
68-
struct dma_extended_desc *dma_erx;
69-
struct sk_buff **rx_skbuff;
70-
unsigned int cur_rx;
71-
unsigned int dirty_rx;
7281
unsigned int dma_buf_sz;
7382
unsigned int rx_copybreak;
74-
unsigned int rx_zeroc_thresh;
7583
u32 rx_riwt;
7684
int hwts_rx_en;
77-
dma_addr_t *rx_skbuff_dma;
78-
dma_addr_t dma_rx_phy;
7985

8086
struct napi_struct napi ____cacheline_aligned_in_smp;
8187

@@ -85,6 +91,9 @@ struct stmmac_priv {
8591
struct mac_device_info *hw;
8692
spinlock_t lock;
8793

94+
/* RX Queue */
95+
struct stmmac_rx_queue rx_queue[MTL_MAX_RX_QUEUES];
96+
8897
int oldlink;
8998
int speed;
9099
int oldduplex;
@@ -119,7 +128,6 @@ struct stmmac_priv {
119128
spinlock_t ptp_lock;
120129
void __iomem *mmcaddr;
121130
void __iomem *ptpaddr;
122-
u32 rx_tail_addr;
123131
u32 tx_tail_addr;
124132
u32 mss;
125133

0 commit comments

Comments
 (0)