Commit 54139cf3 authored by Joao Pinto's avatar Joao Pinto Committed by David S. Miller

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: default avatarJoao Pinto <jpinto@synopsys.com>
Tested-by: default avatarNiklas Cassel <niklas.cassel@axis.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 71fedb01
...@@ -136,15 +136,16 @@ static void stmmac_init_dma_chain(void *des, dma_addr_t phy_addr, ...@@ -136,15 +136,16 @@ static void stmmac_init_dma_chain(void *des, dma_addr_t phy_addr,
static void stmmac_refill_desc3(void *priv_ptr, struct dma_desc *p) static void stmmac_refill_desc3(void *priv_ptr, struct dma_desc *p)
{ {
struct stmmac_priv *priv = (struct stmmac_priv *)priv_ptr; struct stmmac_rx_queue *rx_q = (struct stmmac_rx_queue *)priv_ptr;
struct stmmac_priv *priv = rx_q->priv_data;
if (priv->hwts_rx_en && !priv->extend_desc) if (priv->hwts_rx_en && !priv->extend_desc)
/* NOTE: Device will overwrite des3 with timestamp value if /* NOTE: Device will overwrite des3 with timestamp value if
* 1588-2002 time stamping is enabled, hence reinitialize it * 1588-2002 time stamping is enabled, hence reinitialize it
* to keep explicit chaining in the descriptor. * to keep explicit chaining in the descriptor.
*/ */
p->des3 = cpu_to_le32((unsigned int)(priv->dma_rx_phy + p->des3 = cpu_to_le32((unsigned int)(rx_q->dma_rx_phy +
(((priv->dirty_rx) + 1) % (((rx_q->dirty_rx) + 1) %
DMA_RX_SIZE) * DMA_RX_SIZE) *
sizeof(struct dma_desc))); sizeof(struct dma_desc)));
} }
......
...@@ -46,6 +46,20 @@ struct stmmac_tx_info { ...@@ -46,6 +46,20 @@ struct stmmac_tx_info {
bool is_jumbo; bool is_jumbo;
}; };
struct stmmac_rx_queue {
u32 queue_index;
struct stmmac_priv *priv_data;
struct dma_extended_desc *dma_erx;
struct dma_desc *dma_rx ____cacheline_aligned_in_smp;
struct sk_buff **rx_skbuff;
dma_addr_t *rx_skbuff_dma;
unsigned int cur_rx;
unsigned int dirty_rx;
u32 rx_zeroc_thresh;
dma_addr_t dma_rx_phy;
u32 rx_tail_addr;
};
struct stmmac_priv { struct stmmac_priv {
/* Frequently used values are kept adjacent for cache effect */ /* Frequently used values are kept adjacent for cache effect */
struct dma_extended_desc *dma_etx ____cacheline_aligned_in_smp; struct dma_extended_desc *dma_etx ____cacheline_aligned_in_smp;
...@@ -64,18 +78,10 @@ struct stmmac_priv { ...@@ -64,18 +78,10 @@ struct stmmac_priv {
struct timer_list txtimer; struct timer_list txtimer;
bool tso; bool tso;
struct dma_desc *dma_rx ____cacheline_aligned_in_smp;
struct dma_extended_desc *dma_erx;
struct sk_buff **rx_skbuff;
unsigned int cur_rx;
unsigned int dirty_rx;
unsigned int dma_buf_sz; unsigned int dma_buf_sz;
unsigned int rx_copybreak; unsigned int rx_copybreak;
unsigned int rx_zeroc_thresh;
u32 rx_riwt; u32 rx_riwt;
int hwts_rx_en; int hwts_rx_en;
dma_addr_t *rx_skbuff_dma;
dma_addr_t dma_rx_phy;
struct napi_struct napi ____cacheline_aligned_in_smp; struct napi_struct napi ____cacheline_aligned_in_smp;
...@@ -85,6 +91,9 @@ struct stmmac_priv { ...@@ -85,6 +91,9 @@ struct stmmac_priv {
struct mac_device_info *hw; struct mac_device_info *hw;
spinlock_t lock; spinlock_t lock;
/* RX Queue */
struct stmmac_rx_queue rx_queue[MTL_MAX_RX_QUEUES];
int oldlink; int oldlink;
int speed; int speed;
int oldduplex; int oldduplex;
...@@ -119,7 +128,6 @@ struct stmmac_priv { ...@@ -119,7 +128,6 @@ struct stmmac_priv {
spinlock_t ptp_lock; spinlock_t ptp_lock;
void __iomem *mmcaddr; void __iomem *mmcaddr;
void __iomem *ptpaddr; void __iomem *ptpaddr;
u32 rx_tail_addr;
u32 tx_tail_addr; u32 tx_tail_addr;
u32 mss; u32 mss;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment