net: sxgbe: Added tail point update
Subsystems (4)
Byungho An
maintainerPATCH 1/1 net: sxgbe: Added tail point update
This patch adds tail point update function for rx path after rx_refill function. It indicates tail point for rx dma.
--- drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.c | 14 +++++++++++++- drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.h | 4 ++++ drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c | 5 +++++ 3 files changed, 22 insertions(+), 1 deletion(-)
drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.c +13 -1
@@ -112,7 +112,7 @@ static void sxgbe_dma_channel_init(void __iomem *ioaddr, int cha_num, dma_addr = dma_rx + ((r_rsize -1 ) *SXGBE_DESC_SIZE_BYTES );writel (lower_32_bits (dma_addr), - ioaddr +SXGBE_DMA_CHA_RXDESC_LADD_REG (cha_num)); + ioaddr +SXGBE_DMA_CHA_RXDESC_TAILPTR_REG (cha_num));/* program the ring sizes */ writel (t_rsize -1 , ioaddr +SXGBE_DMA_CHA_TXDESC_RINGLEN_REG (cha_num));writel (r_rsize -1 , ioaddr +SXGBE_DMA_CHA_RXDESC_RINGLEN_REG (cha_num));
@@ -370,6 +370,17 @@ static void sxgbe_enable_tso(void __iomem *ioaddr, u8 chan_num)writel (ctrl, ioaddr +SXGBE_DMA_CHA_TXCTL_REG (chan_num)); } +static void sxgbe_dma_update_rxdesc_tail_ptr (void __iomem *ioaddr,u8 chan_num, +dma_addr_t dma_rx_phy,int cur_rx, +int rxsize) +{ +u32 reg_val; + + reg_val = (dma_rx_phy &0xFFFFFFFF ) + ((cur_rx % rxsize) * +SXGBE_DESC_SIZE_BYTES ); +writel (reg_val, ioaddr +SXGBE_DMA_CHA_RXDESC_TAILPTR_REG (chan_num)); +} +static const struct sxgbe_dma_ops sxgbe_dma_ops = { .init = sxgbe_dma_init, .cha_init = sxgbe_dma_channel_init,
@@ -386,6 +397,7 @@ static const struct sxgbe_dma_ops sxgbe_dma_ops = { .rx_dma_int_status = sxgbe_rx_dma_int_status, .rx_watchdog = sxgbe_dma_rx_watchdog, .enable_tso = sxgbe_enable_tso, + .update_rxdesc_tail_ptr = sxgbe_dma_update_rxdesc_tail_ptr, };const struct sxgbe_dma_ops *sxgbe_get_dma_ops (void )
drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.h +4 -0
@@ -43,6 +43,10 @@ struct sxgbe_dma_ops {void (*rx_watchdog)(void __iomem *ioaddr,u32 riwt);/* Enable TSO for each DMA channel */ void (*enable_tso)(void __iomem *ioaddr,u8 chan_num); +void (*update_rxdesc_tail_ptr)(void __iomem *ioaddr,u8 chan_num, +dma_addr_t dma_rx,int r_rentry, +int r_rsize); + };const struct sxgbe_dma_ops *sxgbe_get_dma_ops (void );
drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c +5 -0
@@ -1521,6 +1521,7 @@ static int sxgbe_rx(struct sxgbe_priv_data *priv, int limit)skb_put (skb, frame_len); skb->ip_summed = checksum; + skb->protocol =eth_type_trans (skb, priv->dev);if (checksum ==CHECKSUM_NONE )netif_receive_skb (skb);else
@@ -1530,6 +1531,10 @@ static int sxgbe_rx(struct sxgbe_priv_data *priv, int limit) }sxgbe_rx_refill (priv); + priv->hw->dma->update_rxdesc_tail_ptr (priv->ioaddr, qnum, + priv->rxq[qnum]->dma_rx_phy, + priv->rxq[qnum]->cur_rx, + priv->dma_rx_size);return count; }
Signature · 1 line
1.7.10.4
2014-05-07 1:14 GMT-07:00 Byungho An <[email protected]>:
Quoted 25 lines
This patch adds tail point update function for rx path after
rx_refillfunction. It indicates tail point for rx dma.Signed-off-by Byungho An <[email protected]>--- drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.c | 14 +++++++++++++- drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.h | 4 ++++ drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c | 5 +++++ 3 files changed, 22 insertions(+), 1 deletion(-)drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.c +1
-1@@ -112,7 +112,7 @@ static void sxgbe_dma_channel_init(void __iomem *ioaddr, int cha_num, dma_addr = dma_rx + ((r_rsize -1 ) *SXGBE_DESC_SIZE_BYTES );writel (lower_32_bits (dma_addr), - ioaddr +SXGBE_DMA_CHA_RXDESC_LADD_REG (cha_num)); + ioaddr +SXGBE_DMA_CHA_RXDESC_TAILPTR_REG (cha_num));/* program the ring sizes */ writel (t_rsize -1 , ioaddr +SXGBE_DMA_CHA_TXDESC_RINGLEN_REG (cha_num));writel (r_rsize -1 , ioaddr +SXGBE_DMA_CHA_RXDESC_RINGLEN_REG (cha_num));
drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.c static void sxgbe_enable_tso(void __iomem *ioaddr, u8 chan_num) · line 375
Quoted 6 lines
drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.c +3
-0@@ -370,6 +370,17 @@ static void sxgbe_enable_tso(void __iomem *ioaddr, u8 chan_num)writel (ctrl, ioaddr +SXGBE_DMA_CHA_TXCTL_REG (chan_num)); } +static void sxgbe_dma_update_rxdesc_tail_ptr (void __iomem *ioaddr,u8 chan_num, +dma_addr_t dma_rx_phy,int cur_rx, +int rxsize)
I think that at some point you should revisit your abstraction, all the patches that I see do take a void __iomem * argument as the first function argument, you should probably use your driver private context here. The day you support a different version of the hardware, there might be other differences that need to be taken care of.
Quoted 65 lines
drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.c +9
-0+{ +u32 reg_val; + + reg_val = (dma_rx_phy &0xFFFFFFFF ) + ((cur_rx % rxsize) * +SXGBE_DESC_SIZE_BYTES ); +writel (reg_val, ioaddr +SXGBE_DMA_CHA_RXDESC_TAILPTR_REG (chan_num)); +} +static const struct sxgbe_dma_ops sxgbe_dma_ops = { .init = sxgbe_dma_init, .cha_init = sxgbe_dma_channel_init,@@ -386,6 +397,7 @@ static const struct sxgbe_dma_ops sxgbe_dma_ops = { .rx_dma_int_status = sxgbe_rx_dma_int_status, .rx_watchdog = sxgbe_dma_rx_watchdog, .enable_tso = sxgbe_enable_tso, + .update_rxdesc_tail_ptr = sxgbe_dma_update_rxdesc_tail_ptr, };const struct sxgbe_dma_ops *sxgbe_get_dma_ops (void )drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.h +4
-0@@ -43,6 +43,10 @@ struct sxgbe_dma_ops {void (*rx_watchdog)(void __iomem *ioaddr,u32 riwt);/* Enable TSO for each DMA channel */ void (*enable_tso)(void __iomem *ioaddr,u8 chan_num); +void (*update_rxdesc_tail_ptr)(void __iomem *ioaddr,u8 chan_num, +dma_addr_t dma_rx,int r_rentry, +int r_rsize); + };const struct sxgbe_dma_ops *sxgbe_get_dma_ops (void );drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c +5
-1@@ -1521,6 +1521,7 @@ static int sxgbe_rx(struct sxgbe_priv_data *priv, int limit)skb_put (skb, frame_len); skb->ip_summed = checksum; + skb->protocol =eth_type_trans (skb, priv->dev);if (checksum ==CHECKSUM_NONE )netif_receive_skb (skb);else @@ -1530,6 +1531,10 @@ static int sxgbe_rx(struct sxgbe_priv_data *priv, int limit) }sxgbe_rx_refill (priv); + priv->hw->dma->update_rxdesc_tail_ptr (priv->ioaddr, qnum, + priv->rxq[qnum]->dma_rx_phy, + priv->rxq[qnum]->cur_rx, + priv->dma_rx_size);return count; } --1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 1 line
Florian
Byungho An
maintainerQuoted 36 lines · Florian Fainelli
2014-05-07 1:14 GMT-07:00 Byungho An <[email protected]>:
Quoted 4 lines
This patch adds tail point update function for rx path after
rx_refillfunction. It indicates tail point for rx dma.Review
Quoted 8 lines
Signed-off-by Byungho An <[email protected]>--- drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.c | 14 +++++++++++++- drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.h | 4 ++++ drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c | 5 +++++ 3 files changed, 22 insertions(+), 1 deletion(-)(quoted diff) +0
-0
b/drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.cdrivers/net/ethernet/samsung/sxgbe/sxgbe_dma.c static void sxgbe_dma_channel_init(void __iomem
Quoted 4 lines
index 49240c9..249b0e0 100644
drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.c +0
-0@@ -112,7 +112,7 @@ static void sxgbe_dma_channel_init(void __iomem*ioaddr, int
cha_num,drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.c static void sxgbe_dma_channel_init(void __iomem *ioaddr, int cha_num,
Quoted 7 lines
drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.c +1
-1dma_addr = dma_rx + ((r_rsize -1 ) *SXGBE_DESC_SIZE_BYTES );writel (lower_32_bits (dma_addr), - ioaddr +SXGBE_DMA_CHA_RXDESC_LADD_REG (cha_num)); + ioaddr +SXGBE_DMA_CHA_RXDESC_TAILPTR_REG (cha_num));/* program the ring sizes */ writel(t_rsize - 1, ioaddr +
SXGBE_DMA_CHA_TXDESC_RINGLEN_REG(cha_num));drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.c static void sxgbe_dma_channel_init(void __iomem · line 117
Quoted 1 line
drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.c +0
-0writel(r_rsize - 1, ioaddr +
SXGBE_DMA_CHA_RXDESC_RINGLEN_REG(cha_num));drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.c static void sxgbe_enable_tso(void __iomem *ioaddr,
Quoted 1 line
drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.c +0
-0@@ -370,6 +370,17 @@ static void sxgbe_enable_tso(void __iomem *ioaddr,u8
chan_num)drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.c static void sxgbe_enable_tso(void __iomem *ioaddr, u8 chan_num)
Quoted 4 lines
drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.c +1
-0writel (ctrl, ioaddr +SXGBE_DMA_CHA_TXCTL_REG (chan_num)); } +static void sxgbe_dma_update_rxdesc_tail_ptr(void __iomem *ioaddr, u8
chan_num,
Quoted 9 lines
drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.c static void sxgbe_enable_tso(void __iomem *ioaddr, u8 chan_num) · line 375
Quoted 2 lines
drivers/net/ethernet/samsung/sxgbe/sxgbe_dma.c +2
-0+ dma_addr_t dma_rx_phy, int cur_rx, + int rxsize)I think that at some point you should revisit your abstraction, all the patches that I see do take a void
__iomem* argument as the first function argument, you should probably use your driver private context here. The day you support a different version of the hardware, there might be other differences that need to be taken care of.
I agree with you, it would be more robust for different version of the hardware and make simple function argument. But most functions of this driver deal with read/write register using ioaddr.
As of now I think it is enough but I'll consider it later.
[snip]
Quoted 4 lines
--
Florian
Byungho An <[email protected]> :
Quoted 1 line
Florian Fainelli wrote:
[...]
Quoted 8 lines
Quoted 6 lines
I think that at some point you should revisit your abstraction, all the patches that I see do take a void
__iomem* argument as the first function argument, you should probably use your driver private context here. The day you support a different version of the hardware, there might be other differences that need to be taken care of.I agree with you, it would be more robust for different version of the hardware and make simple function argument. But most functions of this driver deal with read/write register using ioaddr.
It does not imply that they should urge on ioaddr.
drivers/net/ethernet/broadcom/tg3.c gets it right and there is no reason why sxgbe should be different.
Quoted 1 line
As of now I think it is enough but I'll consider it later.
In the meantime:
1) more use-once function pointers are added
2) their parameter list keeps growing
Please reconsider sooner than later.
Signature · 1 line
Ueimor
Byungho An
maintainerQuoted 10 lines · Francois Romieu
Byungho An <[email protected]> :
Quoted 1 line
Florian Fainelli wrote:
[...]
Quoted 7 lines
Quoted 6 lines
I think that at some point you should revisit your abstraction, all the patches that I see do take a void
__iomem* argument as the first function argument, you should probably use your driver private context here. The day you support a different version of the hardware, there might be other differences that need to be taken care of.I agree with you, it would be more robust for different version of the
Quoted 9 lines
hardware and make simple function argument.
Quoted 1 line
But most functions of this driver deal with read/write register using
ioaddr.
It does not imply that they should urge on ioaddr.
drivers/net/ethernet/broadcom/tg3.cgets it right and there is no reason why sxgbe should be different.
I fully understood.
Quoted 7 lines
Quoted 1 line
As of now I think it is enough but I'll consider it later.
In the meantime:
1) more use-once function pointers are added
2) their parameter list keeps growingPlease reconsider sooner than later.
I'll revisit above things sooner (after this patch set). Thanks.
Quoted 3 lines
--
Ueimor