net: stmmac: Clean-up and tune-up
Subsystems (6)
v3 cover net: stmmac: Clean-up and tune-up
This targets to uniformize the handling of the different GMAC versions in stmmac_main.c file and also tune-up the HW.
Currently there are some if/else conditions in the main source file which calls different callbacks depending on the ID of GMAC.
With the introducion of a generic HW interface handling which automatically selects the GMAC callbacks to be used, it is now unpleasant to see if conditions in the main code because this should be completely agnostic of the GMAC version.
This series removes most of these conditions. There are some if conditions that remain untouched but the callbacks handling are now uniformized.
Tested in GMAC5, hope I didn't break any previous versions.
Please check [1] for performance analisys of patches 3-12.
---
David,
This will probably generate a merge conflict with [2] (which was not merged yet). I'm waiting for Corentin input and then, if this series is merged before, I will rebase [2]. Or the other way around if you prefer :D
Thanks
---
[1] https://marc.info/?l=linux-netdev&m=152656352607905&w=2
[2] https://patchwork.ozlabs.org/patch/915286/
Jose Abreu (12):
net: stmmac: Enable OSP for GMAC4
net: stmmac: Do not keep rearming the coalesce timer in stmmac_xmit
net: stmmac: Let descriptor code set skbuff address
net: stmmac: Let descriptor code clear the descriptor
net: stmmac: Uniformize the use of dma_{rx/tx}_mode callbacks
net: stmmac: Remove uneeded checks for GMAC version
net: stmmac: Move PTP and MMC base address calculation to hwif.c
net: stmmac: Uniformize the use of dma_init_* callbacks
net: stmmac: Remove uneeded check for GMAC version in stmmac_xmit
net: stmmac: Uniformize set_rx_owner()
net: stmmac: Let descriptor code get skbuff address
net: stmmac: Remove if condition by taking advantage of hwif return
code
drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 82 +++++--- .../net/ethernet/stmicro/stmmac/dwmac1000_dma.c | 92 ++++++---- drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c | 35 +++-- drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c | 34 +++- drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c | 7 +- drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.h | 1 - drivers/net/ethernet/stmicro/stmmac/enh_desc.c | 20 ++- drivers/net/ethernet/stmicro/stmmac/hwif.c | 34 ++++ drivers/net/ethernet/stmicro/stmmac/hwif.h | 27 ++- drivers/net/ethernet/stmicro/stmmac/norm_desc.c | 20 ++- drivers/net/ethernet/stmicro/stmmac/stmmac.h | 1 + drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 198 +++++++------------- 12 files changed, 323 insertions(+), 228 deletions(-)
PATCH v3 1/12 net: stmmac: Enable OSP for GMAC4
This enables OSP (Operate on Second Packet) for GMAC4. The feature allows DMA to fetch second descriptor while its still processing the first one.
Running iperf, the performance gain is +/- 38%.
--- drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c +4 -0
@@ -94,6 +94,10 @@ static void dwmac4_dma_init_tx_chan(void __iomem *ioaddr, value =readl (ioaddr +DMA_CHAN_TX_CONTROL (chan)); value = value | (txpbl <<DMA_BUS_MODE_PBL_SHIFT ); + +/* Enable OSP to get best performance */ + value |=DMA_CONTROL_OSP ; +writel (value, ioaddr +DMA_CHAN_TX_CONTROL (chan));writel (dma_tx_phy, ioaddr +DMA_CHAN_TX_BASE_ADDR (chan));
Signature · 1 line
1.7.1
PATCH v3 2/12 net: stmmac: Do not keep rearming the coalesce timer in stmmac_xmit
In reply to Jose AbreuThis is cutting down performance. Once the timer is armed it should run after the time expires for the first packet sent and not the last one.
After this change, running iperf, the performance gain is +/- 24%.
--- drivers/net/ethernet/stmicro/stmmac/stmmac.h | 1 + drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 5 ++++- 2 files changed, 5 insertions(+), 1 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac.h +1 -0
@@ -105,6 +105,7 @@ struct stmmac_priv {u32 tx_count_frames;u32 tx_coal_frames;u32 tx_coal_timer; +bool tx_timer_armed;int tx_coalesce;int hwts_tx_en;
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +4 -1
@@ -3158,13 +3158,16 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)* element in case of no SG. */ priv->tx_count_frames += nfrags +1 ; -if (likely (priv->tx_coal_frames > priv->tx_count_frames)) { +if (likely (priv->tx_coal_frames > priv->tx_count_frames) && + !priv->tx_timer_armed) {mod_timer (&priv->txtimer,STMMAC_COAL_TIMER (priv->tx_coal_timer)); + priv->tx_timer_armed = true; }else { priv->tx_count_frames =0 ;stmmac_set_tx_ic (priv, desc); priv->xstats.tx_set_ic_bit++; + priv->tx_timer_armed = false; }skb_tx_timestamp (skb);
Signature · 1 line
1.7.1
Jerome Brunet
reviewerRe: [v3, net-next, 02/12] net: stmmac: Do not keep rearming the coalesce timer in stmmac_xmit
Quoted 4 lines · Jose Abreu
This is cutting down performance. Once the timer is armed it should run after the time expires for the first packet sent and not the last one.
After this change, running iperf, the performance gain is +/- 24%.
Hi Guys,
Since v4.18, we are getting a serious regression on Amlogic based SoCs. I have tested this on amlogic's:
* gxbb S905 p200 (Micrel KSZ9031 - 1GBps)
* axg A113 s400 (Realtek RTL8211F - 1GBps)
Both SoCs use the synopsys gmac with stmmac driver.
I first noticed that running NFS root filesystem became unstable but I could not understand why. Then, running a download as simple test with iperf3 (from an initramfs) will break the 'network' in matter of seconds.
I don't know exactly what breaks but bisect clearly assign the blame to this change. Reverting the change solve this problem.
I'll be happy to make more tests to help understand what is happening here.
In the meantime, should we consider reverting this patch ?
Best Regards
Jerome
Quoted 46 lines
Signed-off-by Jose Abreu <[email protected]>Cc David S. Miller <[email protected]>Cc Joao Pinto <[email protected]>Cc Vitor Soares <[email protected]>Cc Giuseppe Cavallaro <[email protected]>Cc Alexandre Torgue <[email protected]>--- drivers/net/ethernet/stmicro/stmmac/stmmac.h | 1 + drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 5 ++++- 2 files changed, 5 insertions(+), 1 deletions(-)drivers/net/ethernet/stmicro/stmmac/stmmac.h +1
-0@@ -105,6 +105,7 @@ struct stmmac_priv {u32 tx_count_frames;u32 tx_coal_frames;u32 tx_coal_timer; +bool tx_timer_armed;int tx_coalesce;int hwts_tx_en;drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +4
-1@@ -3158,13 +3158,16 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)* element in case of no SG. */ priv->tx_count_frames += nfrags +1 ; -if (likely (priv->tx_coal_frames > priv->tx_count_frames)) { +if (likely (priv->tx_coal_frames > priv->tx_count_frames) && + !priv->tx_timer_armed) {mod_timer (&priv->txtimer,STMMAC_COAL_TIMER (priv->tx_coal_timer)); + priv->tx_timer_armed = true; }else { priv->tx_count_frames =0 ;stmmac_set_tx_ic (priv, desc); priv->xstats.tx_set_ic_bit++; + priv->tx_timer_armed = false; }skb_tx_timestamp (skb);
Martin Blumenstingl
reviewerRe: [v3, net-next, 02/12] net: stmmac: Do not keep rearming the coalesce timer in stmmac_xmit
Hi,
Quoted 7 lines · Jerome Brunet
Quoted 4 lines · Jose Abreu
This is cutting down performance. Once the timer is armed it should run after the time expires for the first packet sent and not the last one.
After this change, running iperf, the performance gain is +/- 24%.
Quoted 8 lines
Hi Guys,
Since v4.18, we are getting a serious regression on Amlogic based SoCs. I have tested this on amlogic's:
* gxbb S905 p200 (Micrel KSZ9031 - 1GBps)
* axg A113 s400 (Realtek RTL8211F - 1GBps)Both SoCs use the synopsys gmac with stmmac driver.
I can confirm this on Odroid-C1 (Meson8b SoC with RTL8211F RGMII PHY) as well
Quoted 3 lines
I first noticed that running NFS root filesystem became unstable but I could not understand why. Then, running a download as simple test with iperf3 (from an initramfs) will break the 'network' in matter of seconds.
I didn't run iperf, simply downloading the latest rootfs package updates (on Arch Linux ARM) caused the network to break
Quoted 4 lines
I don't know exactly what breaks but bisect clearly assign the blame to this change. Reverting the change solve this problem.
I'll be happy to make more tests to help understand what is happening here.
if some latency is fine then I can also help testing
here's a bootlog excerpt with the info from the dwmac-meson8b driver (used on all platforms listed above):
meson8b-dwmac c9410000.ethernet: PTP uses main clock meson8b-dwmac c9410000.ethernet: User ID: 0x10, Synopsys ID: 0x37 meson8b-dwmac c9410000.ethernet: DWMAC1000
meson8b-dwmac c9410000.ethernet: DMA HW capability register supported meson8b-dwmac c9410000.ethernet: RX Checksum Offload Engine supported meson8b-dwmac c9410000.ethernet: COE Type 2
meson8b-dwmac c9410000.ethernet: TX Checksum insertion supported meson8b-dwmac c9410000.ethernet: Wake-Up On Lan supported meson8b-dwmac c9410000.ethernet: Normal descriptors meson8b-dwmac c9410000.ethernet: Ring mode enabled meson8b-dwmac c9410000.ethernet: Enable RX Mitigation via HW Watchdog Timer
...
meson8b-dwmac c9410000.ethernet eth0: device MAC address [...random mac address...]
RTL8211F Gigabit Ethernet stmmac-0:00: attached PHY driver [RTL8211F Gigabit Ethernet] (mii_bus:phy_addr=stmmac-0:00, irq=27)
...
meson8b-dwmac c9410000.ethernet eth0: No Safety Features support found meson8b-dwmac c9410000.ethernet eth0: PTP not supported by HW
IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
Regards
Martin
PATCH v3 3/12 net: stmmac: Let descriptor code set skbuff address
In reply to Jose AbreuStop using if conditions depending on the GMAC version for setting the the descriptor skbuff address and use instead a helper implemented in the descriptor files.
--- drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c | 7 +++++ drivers/net/ethernet/stmicro/stmmac/enh_desc.c | 6 ++++ drivers/net/ethernet/stmicro/stmmac/hwif.h | 4 +++ drivers/net/ethernet/stmicro/stmmac/norm_desc.c | 6 ++++ drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 25 ++++--------------- 5 files changed, 29 insertions(+), 19 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c +7 -0
@@ -424,6 +424,12 @@ static void dwmac4_set_mss_ctxt(struct dma_desc *p, unsigned int mss) p->des3 =cpu_to_le32 (TDES3_CONTEXT_TYPE |TDES3_CTXT_TCMSSV ); } +static void dwmac4_set_addr (struct dma_desc *p,dma_addr_t addr) +{ + p->des0 =cpu_to_le32 (addr); + p->des1 =0 ; +} +const struct stmmac_desc_ops dwmac4_desc_ops = { .tx_status = dwmac4_wrback_get_tx_status, .rx_status = dwmac4_wrback_get_rx_status,
@@ -445,6 +451,7 @@ static void dwmac4_set_mss_ctxt(struct dma_desc *p, unsigned int mss) .init_tx_desc = dwmac4_rd_init_tx_desc, .display_ring = dwmac4_display_ring, .set_mss = dwmac4_set_mss_ctxt, + .set_addr = dwmac4_set_addr, };const struct stmmac_mode_ops dwmac4_ring_mode_ops = { };
drivers/net/ethernet/stmicro/stmmac/enh_desc.c +6 -0
@@ -437,6 +437,11 @@ static void enh_desc_display_ring(void *head, unsigned int size, bool rx)pr_info ("\n" ); } +static void enh_desc_set_addr (struct dma_desc *p,dma_addr_t addr) +{ + p->des2 =cpu_to_le32 (addr); +} +const struct stmmac_desc_ops enh_desc_ops = { .tx_status = enh_desc_get_tx_status, .rx_status = enh_desc_get_rx_status,
@@ -457,4 +462,5 @@ static void enh_desc_display_ring(void *head, unsigned int size, bool rx) .get_timestamp = enh_desc_get_timestamp, .get_rx_timestamp_status = enh_desc_get_rx_timestamp_status, .display_ring = enh_desc_display_ring, + .set_addr = enh_desc_set_addr, };
drivers/net/ethernet/stmicro/stmmac/hwif.h +4 -0
@@ -79,6 +79,8 @@ struct stmmac_desc_ops {void (*display_ring)(void *head,unsigned int size,bool rx);/* set MSS via context descriptor */ void (*set_mss)(struct dma_desc *p,unsigned int mss); +/* set descriptor skbuff address */ +void (*set_addr)(struct dma_desc *p,dma_addr_t addr); }; #define stmmac_init_rx_desc(__priv, __args...) \
@@ -123,6 +125,8 @@ struct stmmac_desc_ops { stmmac_do_void_callback(__priv, desc, display_ring, __args) #define stmmac_set_mss(__priv, __args...) \ stmmac_do_void_callback(__priv, desc, set_mss, __args) +#define stmmac_set_desc_addr(__priv, __args...) \ + stmmac_do_void_callback(__priv, desc, set_addr, __args)struct stmmac_dma_cfg ;struct dma_features ;
drivers/net/ethernet/stmicro/stmmac/norm_desc.c +6 -0
@@ -297,6 +297,11 @@ static void ndesc_display_ring(void *head, unsigned int size, bool rx)pr_info ("\n" ); } +static void ndesc_set_addr (struct dma_desc *p,dma_addr_t addr) +{ + p->des2 =cpu_to_le32 (addr); +} +const struct stmmac_desc_ops ndesc_ops = { .tx_status = ndesc_get_tx_status, .rx_status = ndesc_get_rx_status,
@@ -316,4 +321,5 @@ static void ndesc_display_ring(void *head, unsigned int size, bool rx) .get_timestamp = ndesc_get_timestamp, .get_rx_timestamp_status = ndesc_get_rx_timestamp_status, .display_ring = ndesc_display_ring, + .set_addr = ndesc_set_addr, };
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +6 -19
@@ -1156,10 +1156,7 @@ static int stmmac_init_rx_buffers(struct stmmac_priv *priv, struct dma_desc *p,return -EINVAL ; } -if (priv->synopsys_id >=DWMAC_CORE_4_00 ) - p->des0 =cpu_to_le32 (rx_q->rx_skbuff_dma[i]); -else - p->des2 =cpu_to_le32 (rx_q->rx_skbuff_dma[i]); +stmmac_set_desc_addr (priv, p, rx_q->rx_skbuff_dma[i]);if (priv->dma_buf_sz == BUF_SIZE_16KiB)stmmac_init_desc3 (priv, p);
@@ -3100,10 +3097,8 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) goto dma_map_err;/* should reuse desc w/o issues */ tx_q->tx_skbuff_dma[entry].buf = des; -if (unlikely (priv->synopsys_id >=DWMAC_CORE_4_00 )) - desc->des0 =cpu_to_le32 (des); -else - desc->des2 =cpu_to_le32 (des); + +stmmac_set_desc_addr (priv, desc, des); tx_q->tx_skbuff_dma[entry].map_as_page = true; tx_q->tx_skbuff_dma[entry].len = len;
@@ -3185,10 +3180,8 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) goto dma_map_err; tx_q->tx_skbuff_dma[first_entry].buf = des; -if (unlikely (priv->synopsys_id >=DWMAC_CORE_4_00 )) - first->des0 =cpu_to_le32 (des); -else - first->des2 =cpu_to_le32 (des); + +stmmac_set_desc_addr (priv, first, des); tx_q->tx_skbuff_dma[first_entry].len = nopaged_len; tx_q->tx_skbuff_dma[first_entry].last_segment = last_segment;
@@ -3302,13 +3295,7 @@ static inline void stmmac_rx_refill(struct stmmac_priv *priv, u32 queue)break ; } -if (unlikely (priv->synopsys_id >=DWMAC_CORE_4_00 )) { - p->des0 =cpu_to_le32 (rx_q->rx_skbuff_dma[entry]); - p->des1 =0 ; - }else { - p->des2 =cpu_to_le32 (rx_q->rx_skbuff_dma[entry]); - } - +stmmac_set_desc_addr (priv, p, rx_q->rx_skbuff_dma[entry]);stmmac_refill_desc3 (priv, rx_q, p);if (rx_q->rx_zeroc_thresh >0 )
Signature · 1 line
1.7.1
PATCH v3 4/12 net: stmmac: Let descriptor code clear the descriptor
In reply to Jose AbreuStop using if conditions depending on the GMAC version for clearing the descriptor and use instead a helper implemented in the descriptor files.
--- drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c | 9 +++++++++ drivers/net/ethernet/stmicro/stmmac/enh_desc.c | 6 ++++++ drivers/net/ethernet/stmicro/stmmac/hwif.h | 4 ++++ drivers/net/ethernet/stmicro/stmmac/norm_desc.c | 6 ++++++ drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 9 +-------- 5 files changed, 26 insertions(+), 8 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c +9 -0
@@ -430,6 +430,14 @@ static void dwmac4_set_addr(struct dma_desc *p, dma_addr_t addr) p->des1 =0 ; } +static void dwmac4_clear (struct dma_desc *p) +{ + p->des0 =0 ; + p->des1 =0 ; + p->des2 =0 ; + p->des3 =0 ; +} +const struct stmmac_desc_ops dwmac4_desc_ops = { .tx_status = dwmac4_wrback_get_tx_status, .rx_status = dwmac4_wrback_get_rx_status,
@@ -452,6 +460,7 @@ static void dwmac4_set_addr(struct dma_desc *p, dma_addr_t addr) .display_ring = dwmac4_display_ring, .set_mss = dwmac4_set_mss_ctxt, .set_addr = dwmac4_set_addr, + .clear = dwmac4_clear, };const struct stmmac_mode_ops dwmac4_ring_mode_ops = { };
drivers/net/ethernet/stmicro/stmmac/enh_desc.c +6 -0
@@ -442,6 +442,11 @@ static void enh_desc_set_addr(struct dma_desc *p, dma_addr_t addr) p->des2 =cpu_to_le32 (addr); } +static void enh_desc_clear (struct dma_desc *p) +{ + p->des2 =0 ; +} +const struct stmmac_desc_ops enh_desc_ops = { .tx_status = enh_desc_get_tx_status, .rx_status = enh_desc_get_rx_status,
@@ -463,4 +468,5 @@ static void enh_desc_set_addr(struct dma_desc *p, dma_addr_t addr) .get_rx_timestamp_status = enh_desc_get_rx_timestamp_status, .display_ring = enh_desc_display_ring, .set_addr = enh_desc_set_addr, + .clear = enh_desc_clear, };
drivers/net/ethernet/stmicro/stmmac/hwif.h +4 -0
@@ -81,6 +81,8 @@ struct stmmac_desc_ops {void (*set_mss)(struct dma_desc *p,unsigned int mss);/* set descriptor skbuff address */ void (*set_addr)(struct dma_desc *p,dma_addr_t addr); +/* clear descriptor */ +void (*clear)(struct dma_desc *p); }; #define stmmac_init_rx_desc(__priv, __args...) \
@@ -127,6 +129,8 @@ struct stmmac_desc_ops { stmmac_do_void_callback(__priv, desc, set_mss, __args) #define stmmac_set_desc_addr(__priv, __args...) \ stmmac_do_void_callback(__priv, desc, set_addr, __args) +#define stmmac_clear_desc(__priv, __args...) \ + stmmac_do_void_callback(__priv, desc, clear, __args)struct stmmac_dma_cfg ;struct dma_features ;
drivers/net/ethernet/stmicro/stmmac/norm_desc.c +6 -0
@@ -302,6 +302,11 @@ static void ndesc_set_addr(struct dma_desc *p, dma_addr_t addr) p->des2 =cpu_to_le32 (addr); } +static void ndesc_clear (struct dma_desc *p) +{ + p->des2 =0 ; +} +const struct stmmac_desc_ops ndesc_ops = { .tx_status = ndesc_get_tx_status, .rx_status = ndesc_get_rx_status,
@@ -322,4 +327,5 @@ static void ndesc_set_addr(struct dma_desc *p, dma_addr_t addr) .get_rx_timestamp_status = ndesc_get_rx_timestamp_status, .display_ring = ndesc_display_ring, .set_addr = ndesc_set_addr, + .clear = ndesc_clear, };
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +1 -8
@@ -1341,14 +1341,7 @@ static int init_dma_tx_desc_rings(struct net_device *dev)else p = tx_q->dma_tx + i; -if (priv->synopsys_id >=DWMAC_CORE_4_00 ) { - p->des0 =0 ; - p->des1 =0 ; - p->des2 =0 ; - p->des3 =0 ; - }else { - p->des2 =0 ; - } +stmmac_clear_desc (priv, p); tx_q->tx_skbuff_dma[i].buf =0 ; tx_q->tx_skbuff_dma[i].map_as_page = false;
Signature · 1 line
1.7.1
PATCH v3 5/12 net: stmmac: Uniformize the use of dma_{rx/tx}_mode callbacks
In reply to Jose AbreuInstead of relying on the GMAC version for choosing if we need to use dma_{rx/tx}_mode or just dma_mode callback lets uniformize this and always use the dma_{rx/tx}_mode callbacks.
--- drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 57 +++++++++------- .../net/ethernet/stmicro/stmmac/dwmac1000_dma.c | 67 +++++++++++--------- drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c | 10 ++-- drivers/net/ethernet/stmicro/stmmac/hwif.h | 6 -- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 32 +++------ 5 files changed, 86 insertions(+), 86 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c +32 -25
@@ -437,13 +437,36 @@ static int sun8i_dwmac_dma_interrupt(void __iomem *ioaddr,return ret; } -static void sun8i_dwmac_dma_operation_mode (void __iomem *ioaddr,int txmode, -int rxmode,int rxfifosz) +static void sun8i_dwmac_dma_operation_mode_rx (void __iomem *ioaddr,int mode, +u32 channel,int fifosz,u8 qmode) +{ +u32 v; + + v =readl (ioaddr +EMAC_RX_CTL1 ); +if (mode ==SF_DMA_MODE ) { + v |=EMAC_RX_MD ; + }else { + v &= ~EMAC_RX_MD ; + v &= ~EMAC_RX_TH_MASK ; +if (mode <32 ) + v |=EMAC_RX_TH_32 ; +else if (mode <64 ) + v |=EMAC_RX_TH_64 ; +else if (mode <96 ) + v |=EMAC_RX_TH_96 ; +else if (mode <128 ) + v |=EMAC_RX_TH_128 ; + } +writel (v, ioaddr +EMAC_RX_CTL1 ); +} + +static void sun8i_dwmac_dma_operation_mode_tx (void __iomem *ioaddr,int mode, +u32 channel,int fifosz,u8 qmode) {u32 v; v =readl (ioaddr +EMAC_TX_CTL1 ); -if (txmode ==SF_DMA_MODE ) { +if (mode ==SF_DMA_MODE ) { v |=EMAC_TX_MD ;/* Undocumented bit (called TX_NEXT_FRM in BSP), the original * comment is
@@ -454,40 +477,24 @@ static void sun8i_dwmac_dma_operation_mode(void __iomem *ioaddr, int txmode, }else { v &= ~EMAC_TX_MD ; v &= ~EMAC_TX_TH_MASK ; -if (txmode <64 ) +if (mode <64 ) v |=EMAC_TX_TH_64 ; -else if (txmode <128 ) +else if (mode <128 ) v |=EMAC_TX_TH_128 ; -else if (txmode <192 ) +else if (mode <192 ) v |=EMAC_TX_TH_192 ; -else if (txmode <256 ) +else if (mode <256 ) v |=EMAC_TX_TH_256 ; }writel (v, ioaddr +EMAC_TX_CTL1 ); - - v =readl (ioaddr +EMAC_RX_CTL1 ); -if (rxmode ==SF_DMA_MODE ) { - v |=EMAC_RX_MD ; - }else { - v &= ~EMAC_RX_MD ; - v &= ~EMAC_RX_TH_MASK ; -if (rxmode <32 ) - v |=EMAC_RX_TH_32 ; -else if (rxmode <64 ) - v |=EMAC_RX_TH_64 ; -else if (rxmode <96 ) - v |=EMAC_RX_TH_96 ; -else if (rxmode <128 ) - v |=EMAC_RX_TH_128 ; - } -writel (v, ioaddr +EMAC_RX_CTL1 ); }static const struct stmmac_dma_ops sun8i_dwmac_dma_ops = { .reset = sun8i_dwmac_dma_reset, .init = sun8i_dwmac_dma_init, .dump_regs = sun8i_dwmac_dump_regs, - .dma_mode = sun8i_dwmac_dma_operation_mode, + .dma_rx_mode = sun8i_dwmac_dma_operation_mode_rx, + .dma_tx_mode = sun8i_dwmac_dma_operation_mode_tx, .enable_dma_transmission = sun8i_dwmac_enable_dma_transmission, .enable_dma_irq = sun8i_dwmac_enable_dma_irq, .disable_dma_irq = sun8i_dwmac_disable_dma_irq,
drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c +38 -29
99 lines not on this page · raw message
drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c +5 -5
@@ -51,14 +51,14 @@ static void dwmac100_dma_init(void __iomem *ioaddr,* The transmit threshold can be programmed by setting the TTC bits in the DMA * control register. */ -static void dwmac100_dma_operation_mode (void __iomem *ioaddr,int txmode, -int rxmode,int rxfifosz) +static void dwmac100_dma_operation_mode_tx (void __iomem *ioaddr,int mode, +u32 channel,int fifosz,u8 qmode) {u32 csr6 =readl (ioaddr +DMA_CONTROL ); -if (txmode <=32 ) +if (mode <=32 ) csr6 |=DMA_CONTROL_TTC_32 ; -else if (txmode <=64 ) +else if (mode <=64 ) csr6 |=DMA_CONTROL_TTC_64 ;else csr6 |=DMA_CONTROL_TTC_128 ;
@@ -113,7 +113,7 @@ static void dwmac100_dma_diagnostic_fr(void *data, struct stmmac_extra_stats *x, .reset = dwmac_dma_reset, .init = dwmac100_dma_init, .dump_regs = dwmac100_dump_dma_regs, - .dma_mode = dwmac100_dma_operation_mode, + .dma_tx_mode = dwmac100_dma_operation_mode_tx, .dma_diagnostic_fr = dwmac100_dma_diagnostic_fr, .enable_dma_transmission = dwmac_enable_dma_transmission, .enable_dma_irq = dwmac_enable_dma_irq,
drivers/net/ethernet/stmicro/stmmac/hwif.h +0 -6
@@ -153,10 +153,6 @@ struct stmmac_dma_ops {void (*axi)(void __iomem *ioaddr,struct stmmac_axi *axi);/* Dump DMA registers */ void (*dump_regs)(void __iomem *ioaddr,u32 *reg_space); -/* Set tx/rx threshold in the csr6 register -* An invalid value enables the store-and-forward mode */ -void (*dma_mode)(void __iomem *ioaddr,int txmode,int rxmode, -int rxfifosz);void (*dma_rx_mode)(void __iomem *ioaddr,int mode,u32 channel,int fifosz,u8 qmode); void (*dma_tx_mode)(void __iomem *ioaddr, int mode, u32 channel,
@@ -199,8 +195,6 @@ struct stmmac_dma_ops { stmmac_do_void_callback(__priv, dma, axi, __args) #define stmmac_dump_dma_regs(__priv, __args...) \ stmmac_do_void_callback(__priv, dma, dump_regs, __args) -#define stmmac_dma_mode(__priv, __args...) \ - stmmac_do_void_callback(__priv, dma, dma_mode, __args) #define stmmac_dma_rx_mode(__priv, __args...) \ stmmac_do_void_callback(__priv, dma, dma_rx_mode, __args) #define stmmac_dma_tx_mode(__priv, __args...) \
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +11 -21
@@ -1787,22 +1787,18 @@ static void stmmac_dma_operation_mode(struct stmmac_priv *priv) }/* configure all channels */ -if (priv->synopsys_id >=DWMAC_CORE_4_00 ) { -for (chan =0 ; chan < rx_channels_count; chan++) { - qmode = priv->plat->rx_queues_cfg[chan].mode_to_use; +for (chan =0 ; chan < rx_channels_count; chan++) { + qmode = priv->plat->rx_queues_cfg[chan].mode_to_use; -stmmac_dma_rx_mode (priv, priv->ioaddr, rxmode, chan, - rxfifosz, qmode); - } +stmmac_dma_rx_mode (priv, priv->ioaddr, rxmode, chan, + rxfifosz, qmode); + } -for (chan =0 ; chan < tx_channels_count; chan++) { - qmode = priv->plat->tx_queues_cfg[chan].mode_to_use; +for (chan =0 ; chan < tx_channels_count; chan++) { + qmode = priv->plat->tx_queues_cfg[chan].mode_to_use; -stmmac_dma_tx_mode (priv, priv->ioaddr, txmode, chan, - txfifosz, qmode); - } - }else { -stmmac_dma_mode (priv, priv->ioaddr, txmode, rxmode, rxfifosz); +stmmac_dma_tx_mode (priv, priv->ioaddr, txmode, chan, + txfifosz, qmode); } }
@@ -1971,14 +1967,8 @@ static void stmmac_set_dma_operation_mode(struct stmmac_priv *priv, u32 txmode, rxfifosz /= rx_channels_count; txfifosz /= tx_channels_count; -if (priv->synopsys_id >=DWMAC_CORE_4_00 ) { -stmmac_dma_rx_mode (priv, priv->ioaddr, rxmode, chan, rxfifosz, - rxqmode); -stmmac_dma_tx_mode (priv, priv->ioaddr, txmode, chan, txfifosz, - txqmode); - }else { -stmmac_dma_mode (priv, priv->ioaddr, txmode, rxmode, rxfifosz); - } +stmmac_dma_rx_mode (priv, priv->ioaddr, rxmode, chan, rxfifosz, rxqmode); +stmmac_dma_tx_mode (priv, priv->ioaddr, txmode, chan, txfifosz, txqmode); }static bool stmmac_safety_feat_interrupt (struct stmmac_priv *priv)
Signature · 1 line
1.7.1
PATCH v3 6/12 net: stmmac: Remove uneeded checks for GMAC version
In reply to Jose AbreuWith the introducion of callbacks check in hwif.h we only call the callback if HW supports it so there is no longer need to check for GMAC version.
--- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 16 +++++----------- 1 files changed, 5 insertions(+), 11 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +5 -11
@@ -1973,11 +1973,8 @@ static void stmmac_set_dma_operation_mode(struct stmmac_priv *priv, u32 txmode,static bool stmmac_safety_feat_interrupt (struct stmmac_priv *priv) { -int ret = false; +int ret; -/* Safety features are only available in cores >= 5.10 */ -if (priv->synopsys_id <DWMAC_CORE_5_10 ) -return ret; ret =stmmac_safety_feat_irq_status (priv, priv->dev, priv->ioaddr, priv->dma_cap.asp, &priv->sstats);if (ret && (ret != -EINVAL )) {
@@ -2495,12 +2492,10 @@ static int stmmac_hw_setup(struct net_device *dev, bool init_ptp)stmmac_core_init (priv, priv->hw, dev);/* Initialize MTL*/ -if (priv->synopsys_id >=DWMAC_CORE_4_00 ) -stmmac_mtl_configuration (priv); +stmmac_mtl_configuration (priv);/* Initialize Safety Features */ -if (priv->synopsys_id >=DWMAC_CORE_5_10 ) -stmmac_safety_feat_configuration (priv); +stmmac_safety_feat_configuration (priv); ret =stmmac_rx_ipc (priv, priv->hw);if (!ret) {
@@ -3054,10 +3049,9 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)if (enh_desc) is_jumbo =stmmac_is_jumbo_frm (priv, skb->len, enh_desc); -if (unlikely (is_jumbo) &&likely (priv->synopsys_id < -DWMAC_CORE_4_00 )) { +if (unlikely (is_jumbo)) { entry =stmmac_jumbo_frm (priv, tx_q, skb, csum_insertion); -if (unlikely (entry <0 )) +if (unlikely (entry <0 ) && (entry != -EINVAL )) goto dma_map_err; }
Signature · 1 line
1.7.1
PATCH v3 7/12 net: stmmac: Move PTP and MMC base address calculation to hwif.c
In reply to Jose AbreuPTP and MMC modules base address can depend on the GMAC version. As this is HW specific lets move this base address calculation to hwif.c. Also, add an entry in the HW table so that we can specify the module offset. This can later be extended to more modules, if deemed necessary.
--- drivers/net/ethernet/stmicro/stmmac/hwif.c | 34 +++++++++++++++++++++ drivers/net/ethernet/stmicro/stmmac/hwif.h | 5 +++ drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 8 ----- 3 files changed, 39 insertions(+), 8 deletions(-)
drivers/net/ethernet/stmicro/stmmac/hwif.c +34 -0
@@ -6,6 +6,7 @@#include "common.h" #include "stmmac.h" +#include "stmmac_ptp.h" static u32 stmmac_get_id (struct stmmac_priv *priv,u32 id_reg) {
@@ -72,6 +73,7 @@ static int stmmac_dwmac4_quirks(struct stmmac_priv *priv)bool gmac;bool gmac4;u32 min_id; +const struct stmmac_regs_off regs;const void *desc;const void *dma;const void *mac;
@@ -86,6 +88,10 @@ static int stmmac_dwmac4_quirks(struct stmmac_priv *priv) .gmac = false, .gmac4 = false, .min_id = 0, + .regs = { + .ptp_off = PTP_GMAC3_X_OFFSET, + .mmc_off = MMC_GMAC3_X_OFFSET, + }, .desc = NULL, .dma = &dwmac100_dma_ops, .mac = &dwmac100_ops,
@@ -98,6 +104,10 @@ static int stmmac_dwmac4_quirks(struct stmmac_priv *priv) .gmac = true, .gmac4 = false, .min_id = 0, + .regs = { + .ptp_off = PTP_GMAC3_X_OFFSET, + .mmc_off = MMC_GMAC3_X_OFFSET, + }, .desc = NULL, .dma = &dwmac1000_dma_ops, .mac = &dwmac1000_ops,
@@ -110,6 +120,10 @@ static int stmmac_dwmac4_quirks(struct stmmac_priv *priv) .gmac = false, .gmac4 = true, .min_id = 0, + .regs = { + .ptp_off = PTP_GMAC4_OFFSET, + .mmc_off = MMC_GMAC4_OFFSET, + }, .desc = &dwmac4_desc_ops, .dma = &dwmac4_dma_ops, .mac = &dwmac4_ops,
@@ -122,6 +136,10 @@ static int stmmac_dwmac4_quirks(struct stmmac_priv *priv) .gmac = false, .gmac4 = true, .min_id = DWMAC_CORE_4_00, + .regs = { + .ptp_off = PTP_GMAC4_OFFSET, + .mmc_off = MMC_GMAC4_OFFSET, + }, .desc = &dwmac4_desc_ops, .dma = &dwmac4_dma_ops, .mac = &dwmac410_ops,
@@ -134,6 +152,10 @@ static int stmmac_dwmac4_quirks(struct stmmac_priv *priv) .gmac = false, .gmac4 = true, .min_id = DWMAC_CORE_4_10, + .regs = { + .ptp_off = PTP_GMAC4_OFFSET, + .mmc_off = MMC_GMAC4_OFFSET, + }, .desc = &dwmac4_desc_ops, .dma = &dwmac410_dma_ops, .mac = &dwmac410_ops,
@@ -146,6 +168,10 @@ static int stmmac_dwmac4_quirks(struct stmmac_priv *priv) .gmac = false, .gmac4 = true, .min_id = DWMAC_CORE_5_10, + .regs = { + .ptp_off = PTP_GMAC4_OFFSET, + .mmc_off = MMC_GMAC4_OFFSET, + }, .desc = &dwmac4_desc_ops, .dma = &dwmac410_dma_ops, .mac = &dwmac510_ops,
@@ -175,6 +201,12 @@ int stmmac_hwif_init(struct stmmac_priv *priv)/* Save ID for later use */ priv->synopsys_id = id; +/* Lets assume some safe values first */ + priv->ptpaddr = priv->ioaddr + + (needs_gmac4 ?PTP_GMAC4_OFFSET :PTP_GMAC3_X_OFFSET ); + priv->mmcaddr = priv->ioaddr + + (needs_gmac4 ?MMC_GMAC4_OFFSET :MMC_GMAC3_X_OFFSET ); +/* Check for HW specific setup first */ if (priv->plat->setup) { priv->hw = priv->plat->setup (priv);
@@ -206,6 +238,8 @@ int stmmac_hwif_init(struct stmmac_priv *priv) mac->tc = entry->tc; priv->hw = mac; + priv->ptpaddr = priv->ioaddr + entry->regs.ptp_off; + priv->mmcaddr = priv->ioaddr + entry->regs.mmc_off;/* Entry found */ ret = entry->setup (priv);
drivers/net/ethernet/stmicro/stmmac/hwif.h +5 -0
@@ -442,6 +442,11 @@ struct stmmac_tc_ops { #define stmmac_tc_setup_cls_u32(__priv, __args...) \ stmmac_do_callback(__priv, tc, setup_cls_u32, __args) +struct stmmac_regs_off { +u32 ptp_off; +u32 mmc_off; +}; +extern const struct stmmac_ops dwmac100_ops;extern const struct stmmac_dma_ops dwmac100_dma_ops;extern const struct stmmac_ops dwmac1000_ops;
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +0 -8
@@ -2085,14 +2085,6 @@ static void stmmac_mmc_setup(struct stmmac_priv *priv)unsigned int mode =MMC_CNTRL_RESET_ON_READ |MMC_CNTRL_COUNTER_RESET |MMC_CNTRL_PRESET |MMC_CNTRL_FULL_HALF_PRESET ; -if (priv->synopsys_id >=DWMAC_CORE_4_00 ) { - priv->ptpaddr = priv->ioaddr +PTP_GMAC4_OFFSET ; - priv->mmcaddr = priv->ioaddr +MMC_GMAC4_OFFSET ; - }else { - priv->ptpaddr = priv->ioaddr +PTP_GMAC3_X_OFFSET ; - priv->mmcaddr = priv->ioaddr +MMC_GMAC3_X_OFFSET ; - } -dwmac_mmc_intr_all_mask (priv->mmcaddr);if (priv->dma_cap.rmon) {
Signature · 1 line
1.7.1
PATCH v3 8/12 net: stmmac: Uniformize the use of dma_init_* callbacks
In reply to Jose AbreuInstead of relying on the GMAC version for choosing if we need to use dma_init or dma_init_{rx/tx}_chan callback, lets uniformize this and always use the dma_init_{rx/tx}_chan callbacks.
While at it, fix the use of dma_init_chan callback, which shall be called for as many channels as the max of rx/tx channels.
--- drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 25 ++++++-- .../net/ethernet/stmicro/stmmac/dwmac1000_dma.c | 25 ++++++-- drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c | 25 ++++++-- drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c | 3 +- drivers/net/ethernet/stmicro/stmmac/hwif.h | 2 +- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 62 ++++++++----------- 6 files changed, 83 insertions(+), 59 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c +19 -6
@@ -276,17 +276,28 @@ static int sun8i_dwmac_dma_reset(void __iomem *ioaddr)* Called from stmmac via stmmac_dma_ops->init */ static void sun8i_dwmac_dma_init (void __iomem *ioaddr, -struct stmmac_dma_cfg *dma_cfg, -u32 dma_tx,u32 dma_rx,int atds) +struct stmmac_dma_cfg *dma_cfg,int atds) { -/* Write TX and RX descriptors address */ -writel (dma_rx, ioaddr +EMAC_RX_DESC_LIST ); -writel (dma_tx, ioaddr +EMAC_TX_DESC_LIST ); -writel (EMAC_RX_INT |EMAC_TX_INT , ioaddr +EMAC_INT_EN );writel (0x1FFFFFF , ioaddr +EMAC_INT_STA ); } +static void sun8i_dwmac_dma_init_rx (void __iomem *ioaddr, +struct stmmac_dma_cfg *dma_cfg, +u32 dma_rx_phy,u32 chan) +{ +/* Write RX descriptors address */ +writel (dma_rx_phy, ioaddr +EMAC_RX_DESC_LIST ); +} + +static void sun8i_dwmac_dma_init_tx (void __iomem *ioaddr, +struct stmmac_dma_cfg *dma_cfg, +u32 dma_tx_phy,u32 chan) +{ +/* Write TX descriptors address */ +writel (dma_tx_phy, ioaddr +EMAC_TX_DESC_LIST ); +} +/* sun8i_dwmac_dump_regs() - Dump EMAC address space * Called from stmmac_dma_ops->dump_regs * Used for ethtool
@@ -492,6 +503,8 @@ static void sun8i_dwmac_dma_operation_mode_tx(void __iomem *ioaddr, int mode,static const struct stmmac_dma_ops sun8i_dwmac_dma_ops = { .reset = sun8i_dwmac_dma_reset, .init = sun8i_dwmac_dma_init, + .init_rx_chan = sun8i_dwmac_dma_init_rx, + .init_tx_chan = sun8i_dwmac_dma_init_tx, .dump_regs = sun8i_dwmac_dump_regs, .dma_rx_mode = sun8i_dwmac_dma_operation_mode_rx, .dma_tx_mode = sun8i_dwmac_dma_operation_mode_tx,
drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c +18 -7
@@ -81,8 +81,7 @@ static void dwmac1000_dma_axi(void __iomem *ioaddr, struct stmmac_axi *axi) }static void dwmac1000_dma_init (void __iomem *ioaddr, -struct stmmac_dma_cfg *dma_cfg, -u32 dma_tx,u32 dma_rx,int atds) +struct stmmac_dma_cfg *dma_cfg,int atds) {u32 value =readl (ioaddr +DMA_BUS_MODE );int txpbl = dma_cfg->txpbl ?: dma_cfg->pbl;
@@ -119,12 +118,22 @@ static void dwmac1000_dma_init(void __iomem *ioaddr,/* Mask interrupts by writing to CSR7 */ writel (DMA_INTR_DEFAULT_MASK , ioaddr +DMA_INTR_ENA ); +} -/* RX/TX descriptor base address lists must be written into -* DMA CSR3 and CSR4, respectively -*/ -writel (dma_tx, ioaddr +DMA_TX_BASE_ADDR ); -writel (dma_rx, ioaddr +DMA_RCV_BASE_ADDR ); +static void dwmac1000_dma_init_rx (void __iomem *ioaddr, +struct stmmac_dma_cfg *dma_cfg, +u32 dma_rx_phy,u32 chan) +{ +/* RX descriptor base address list must be written into DMA CSR3 */ +writel (dma_rx_phy, ioaddr +DMA_RCV_BASE_ADDR ); +} + +static void dwmac1000_dma_init_tx (void __iomem *ioaddr, +struct stmmac_dma_cfg *dma_cfg, +u32 dma_tx_phy,u32 chan) +{ +/* TX descriptor base address list must be written into DMA CSR4 */ +writel (dma_tx_phy, ioaddr +DMA_TX_BASE_ADDR ); }static u32 dwmac1000_configure_fc (u32 csr6,int rxfifosz)
@@ -264,6 +273,8 @@ static void dwmac1000_rx_watchdog(void __iomem *ioaddr, u32 riwt,const struct stmmac_dma_ops dwmac1000_dma_ops = { .reset = dwmac_dma_reset, .init = dwmac1000_dma_init, + .init_rx_chan = dwmac1000_dma_init_rx, + .init_tx_chan = dwmac1000_dma_init_tx, .axi = dwmac1000_dma_axi, .dump_regs = dwmac1000_dump_dma_regs, .dma_rx_mode = dwmac1000_dma_operation_mode_rx,
drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c +18 -7
@@ -29,8 +29,7 @@#include "dwmac_dma.h" static void dwmac100_dma_init (void __iomem *ioaddr, -struct stmmac_dma_cfg *dma_cfg, -u32 dma_tx,u32 dma_rx,int atds) +struct stmmac_dma_cfg *dma_cfg,int atds) {/* Enable Application Access by writing to DMA CSR0 */ writel(DMA_BUS_MODE_DEFAULT | (dma_cfg->pbl << DMA_BUS_MODE_PBL_SHIFT),
@@ -38,12 +37,22 @@ static void dwmac100_dma_init(void __iomem *ioaddr,/* Mask interrupts by writing to CSR7 */ writel (DMA_INTR_DEFAULT_MASK , ioaddr +DMA_INTR_ENA ); +} -/* RX/TX descriptor base addr lists must be written into -* DMA CSR3 and CSR4, respectively -*/ -writel (dma_tx, ioaddr +DMA_TX_BASE_ADDR ); -writel (dma_rx, ioaddr +DMA_RCV_BASE_ADDR ); +static void dwmac100_dma_init_rx (void __iomem *ioaddr, +struct stmmac_dma_cfg *dma_cfg, +u32 dma_rx_phy,u32 chan) +{ +/* RX descriptor base addr lists must be written into DMA CSR3 */ +writel (dma_rx_phy, ioaddr +DMA_RCV_BASE_ADDR ); +} + +static void dwmac100_dma_init_tx (void __iomem *ioaddr, +struct stmmac_dma_cfg *dma_cfg, +u32 dma_tx_phy,u32 chan) +{ +/* TX descriptor base addr lists must be written into DMA CSR4 */ +writel (dma_tx_phy, ioaddr +DMA_TX_BASE_ADDR ); }/* Store and Forward capability is not used at all.
@@ -112,6 +121,8 @@ static void dwmac100_dma_diagnostic_fr(void *data, struct stmmac_extra_stats *x,const struct stmmac_dma_ops dwmac100_dma_ops = { .reset = dwmac_dma_reset, .init = dwmac100_dma_init, + .init_rx_chan = dwmac100_dma_init_rx, + .init_tx_chan = dwmac100_dma_init_tx, .dump_regs = dwmac100_dump_dma_regs, .dma_tx_mode = dwmac100_dma_operation_mode_tx, .dma_diagnostic_fr = dwmac100_dma_diagnostic_fr,
drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c +1 -2
@@ -120,8 +120,7 @@ static void dwmac4_dma_init_channel(void __iomem *ioaddr, }static void dwmac4_dma_init (void __iomem *ioaddr, -struct stmmac_dma_cfg *dma_cfg, -u32 dma_tx,u32 dma_rx,int atds) +struct stmmac_dma_cfg *dma_cfg,int atds) {u32 value =readl (ioaddr +DMA_SYS_BUS_MODE );
drivers/net/ethernet/stmicro/stmmac/hwif.h +1 -1
@@ -140,7 +140,7 @@ struct stmmac_dma_ops {/* DMA core initialization */ int (*reset)(void __iomem *ioaddr);void (*init)(void __iomem *ioaddr,struct stmmac_dma_cfg *dma_cfg, -u32 dma_tx,u32 dma_rx,int atds); +int atds);void (*init_chan)(void __iomem *ioaddr,struct stmmac_dma_cfg *dma_cfg,u32 chan); void (*init_rx_chan)(void __iomem *ioaddr,
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +28 -38
86 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH v3 9/12 net: stmmac: Remove uneeded check for GMAC version in stmmac_xmit
In reply to Jose AbreuWe either have .enable_dma_transmission or .set_tx_tail_ptr in the HW table callbacks, we can never have both so there is no need to check for GMAC version.
--- drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.h | 1 - drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 7 ++----- 2 files changed, 2 insertions(+), 6 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.h +0 -1
@@ -184,7 +184,6 @@#define DMA_CHAN0_DBG_STAT_RPS_SHIFT 8int dwmac4_dma_reset (void __iomem *ioaddr); -void dwmac4_enable_dma_transmission (void __iomem *ioaddr,u32 tail_ptr);void dwmac4_enable_dma_irq (void __iomem *ioaddr,u32 chan);void dwmac410_enable_dma_irq (void __iomem *ioaddr,u32 chan);void dwmac4_disable_dma_irq (void __iomem *ioaddr,u32 chan);
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +2 -5
@@ -3166,11 +3166,8 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)netdev_tx_sent_queue (netdev_get_tx_queue (dev, queue), skb->len); -if (priv->synopsys_id <DWMAC_CORE_4_00 ) -stmmac_enable_dma_transmission (priv, priv->ioaddr); -else -stmmac_set_tx_tail_ptr (priv, priv->ioaddr, tx_q->tx_tail_addr, - queue); +stmmac_enable_dma_transmission (priv, priv->ioaddr); +stmmac_set_tx_tail_ptr (priv, priv->ioaddr, tx_q->tx_tail_addr, queue);return NETDEV_TX_OK ;
Signature · 1 line
1.7.1
PATCH v3 10/12 net: stmmac: Uniformize set_rx_owner()
In reply to Jose AbreuCurrently an if condition is used to select the correct callback to set rx_onwer in descriptor. Lets keep this simple and always use the same callback.
--- drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c | 12 ++++++------ drivers/net/ethernet/stmicro/stmmac/enh_desc.c | 2 +- drivers/net/ethernet/stmicro/stmmac/hwif.h | 2 +- drivers/net/ethernet/stmicro/stmmac/norm_desc.c | 2 +- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 5 +---- 5 files changed, 10 insertions(+), 13 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c +6 -6
@@ -189,9 +189,12 @@ static void dwmac4_set_tx_owner(struct dma_desc *p) p->des3 |=cpu_to_le32 (TDES3_OWN ); } -static void dwmac4_set_rx_owner (struct dma_desc *p) +static void dwmac4_set_rx_owner (struct dma_desc *p,int disable_rx_ic) { - p->des3 |=cpu_to_le32 (RDES3_OWN ); + p->des3 =cpu_to_le32 (RDES3_OWN |RDES3_BUFFER1_VALID_ADDR ); + +if (!disable_rx_ic) + p->des3 |=cpu_to_le32 (RDES3_INT_ON_COMPLETION_EN ); }static int dwmac4_get_tx_ls (struct dma_desc *p)
@@ -292,10 +295,7 @@ static int dwmac4_wrback_get_rx_timestamp_status(void *desc, void *next_desc,static void dwmac4_rd_init_rx_desc (struct dma_desc *p,int disable_rx_ic,int mode,int end) { - p->des3 =cpu_to_le32 (RDES3_OWN |RDES3_BUFFER1_VALID_ADDR ); - -if (!disable_rx_ic) - p->des3 |=cpu_to_le32 (RDES3_INT_ON_COMPLETION_EN ); +dwmac4_set_rx_owner (p, disable_rx_ic); }static void dwmac4_rd_init_tx_desc (struct dma_desc *p,int mode,int end)
drivers/net/ethernet/stmicro/stmmac/enh_desc.c +1 -1
@@ -292,7 +292,7 @@ static void enh_desc_set_tx_owner(struct dma_desc *p) p->des0 |=cpu_to_le32 (ETDES0_OWN ); } -static void enh_desc_set_rx_owner (struct dma_desc *p) +static void enh_desc_set_rx_owner (struct dma_desc *p,int disable_rx_ic) { p->des0 |=cpu_to_le32 (RDES0_OWN ); }
drivers/net/ethernet/stmicro/stmmac/hwif.h +1 -1
@@ -59,7 +59,7 @@ struct stmmac_desc_ops {/* Get the buffer size from the descriptor */ int (*get_tx_len)(struct dma_desc *p);/* Handle extra events on specific interrupts hw dependent */ -void (*set_rx_owner)(struct dma_desc *p); +void (*set_rx_owner)(struct dma_desc *p,int disable_rx_ic);/* Get the receive frame size */ int (*get_rx_frame_len)(struct dma_desc *p,int rx_coe_type);/* Return the reception status looking at the RDES1 */
drivers/net/ethernet/stmicro/stmmac/norm_desc.c +1 -1
@@ -168,7 +168,7 @@ static void ndesc_set_tx_owner(struct dma_desc *p) p->des0 |=cpu_to_le32 (TDES0_OWN ); } -static void ndesc_set_rx_owner (struct dma_desc *p) +static void ndesc_set_rx_owner (struct dma_desc *p,int disable_rx_ic) { p->des0 |=cpu_to_le32 (RDES0_OWN ); }
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +1 -4
@@ -3262,10 +3262,7 @@ static inline void stmmac_rx_refill(struct stmmac_priv *priv, u32 queue) }dma_wmb (); -if (unlikely (priv->synopsys_id >=DWMAC_CORE_4_00 )) -stmmac_init_rx_desc (priv, p, priv->use_riwt,0 ,0 ); -else -stmmac_set_rx_owner (priv, p); +stmmac_set_rx_owner (priv, p, priv->use_riwt);dma_wmb ();
Signature · 1 line
1.7.1
PATCH v3 11/12 net: stmmac: Let descriptor code get skbuff address
In reply to Jose AbreuStop using if conditions depending on the GMAC version for getting the descriptor skbuff address and use instead a helper implemented in the descriptor files.
--- drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c | 6 ++++++ drivers/net/ethernet/stmicro/stmmac/enh_desc.c | 6 ++++++ drivers/net/ethernet/stmicro/stmmac/hwif.h | 4 ++++ drivers/net/ethernet/stmicro/stmmac/norm_desc.c | 6 ++++++ drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 6 +----- 5 files changed, 23 insertions(+), 5 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c +6 -0
@@ -424,6 +424,11 @@ static void dwmac4_set_mss_ctxt(struct dma_desc *p, unsigned int mss) p->des3 =cpu_to_le32 (TDES3_CONTEXT_TYPE |TDES3_CTXT_TCMSSV ); } +static void dwmac4_get_addr (struct dma_desc *p,unsigned int *addr) +{ + *addr =le32_to_cpu (p->des0); +} +static void dwmac4_set_addr (struct dma_desc *p,dma_addr_t addr) { p->des0 =cpu_to_le32 (addr);
@@ -459,6 +464,7 @@ static void dwmac4_clear(struct dma_desc *p) .init_tx_desc = dwmac4_rd_init_tx_desc, .display_ring = dwmac4_display_ring, .set_mss = dwmac4_set_mss_ctxt, + .get_addr = dwmac4_get_addr, .set_addr = dwmac4_set_addr, .clear = dwmac4_clear, };
drivers/net/ethernet/stmicro/stmmac/enh_desc.c +6 -0
@@ -437,6 +437,11 @@ static void enh_desc_display_ring(void *head, unsigned int size, bool rx)pr_info ("\n" ); } +static void enh_desc_get_addr (struct dma_desc *p,unsigned int *addr) +{ + *addr =le32_to_cpu (p->des2); +} +static void enh_desc_set_addr (struct dma_desc *p,dma_addr_t addr) { p->des2 =cpu_to_le32 (addr);
@@ -467,6 +472,7 @@ static void enh_desc_clear(struct dma_desc *p) .get_timestamp = enh_desc_get_timestamp, .get_rx_timestamp_status = enh_desc_get_rx_timestamp_status, .display_ring = enh_desc_display_ring, + .get_addr = enh_desc_get_addr, .set_addr = enh_desc_set_addr, .clear = enh_desc_clear, };
drivers/net/ethernet/stmicro/stmmac/hwif.h +4 -0
@@ -79,6 +79,8 @@ struct stmmac_desc_ops {void (*display_ring)(void *head,unsigned int size,bool rx);/* set MSS via context descriptor */ void (*set_mss)(struct dma_desc *p,unsigned int mss); +/* get descriptor skbuff address */ +void (*get_addr)(struct dma_desc *p,unsigned int *addr);/* set descriptor skbuff address */ void (*set_addr)(struct dma_desc *p,dma_addr_t addr);/* clear descriptor */
@@ -127,6 +129,8 @@ struct stmmac_desc_ops { stmmac_do_void_callback(__priv, desc, display_ring, __args) #define stmmac_set_mss(__priv, __args...) \ stmmac_do_void_callback(__priv, desc, set_mss, __args) +#define stmmac_get_desc_addr(__priv, __args...) \ + stmmac_do_void_callback(__priv, desc, get_addr, __args) #define stmmac_set_desc_addr(__priv, __args...) \ stmmac_do_void_callback(__priv, desc, set_addr, __args) #define stmmac_clear_desc(__priv, __args...) \
drivers/net/ethernet/stmicro/stmmac/norm_desc.c +6 -0
@@ -297,6 +297,11 @@ static void ndesc_display_ring(void *head, unsigned int size, bool rx)pr_info ("\n" ); } +static void ndesc_get_addr (struct dma_desc *p,unsigned int *addr) +{ + *addr =le32_to_cpu (p->des2); +} +static void ndesc_set_addr (struct dma_desc *p,dma_addr_t addr) { p->des2 =cpu_to_le32 (addr);
@@ -326,6 +331,7 @@ static void ndesc_clear(struct dma_desc *p) .get_timestamp = ndesc_get_timestamp, .get_rx_timestamp_status = ndesc_get_rx_timestamp_status, .display_ring = ndesc_display_ring, + .get_addr = ndesc_get_addr, .set_addr = ndesc_set_addr, .clear = ndesc_clear, };
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +1 -5
@@ -3350,11 +3350,7 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue)int frame_len;unsigned int des; -if (unlikely (priv->synopsys_id >=DWMAC_CORE_4_00 )) - des =le32_to_cpu (p->des0); -else - des =le32_to_cpu (p->des2); - +stmmac_get_desc_addr (priv, p, &des); frame_len =stmmac_get_rx_frame_len (priv, p, coe);/* If frame length is greater than skb buffer size
Signature · 1 line
1.7.1
PATCH v3 12/12 net: stmmac: Remove if condition by taking advantage of hwif return code
In reply to Jose AbreuWe can remove the if condition and check if return code is different than -EINVAL, meaning callback is present.
--- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 23 ++++++++++----------- 1 files changed, 11 insertions(+), 12 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +11 -12
@@ -3644,6 +3644,7 @@ static irqreturn_t stmmac_interrupt(int irq, void *dev_id)/* To handle GMAC own interrupts */ if ((priv->plat->has_gmac) || (priv->plat->has_gmac4)) {int status =stmmac_host_irq_status (priv, priv->hw, &priv->xstats); +int mtl_status;if (unlikely (status)) {/* For LPI we need to save the tx status */
@@ -3653,20 +3654,18 @@ static irqreturn_t stmmac_interrupt(int irq, void *dev_id) priv->tx_path_in_lpi_mode = false; } -if (priv->synopsys_id >=DWMAC_CORE_4_00 ) { -for (queue =0 ; queue < queues_count; queue++) { -struct stmmac_rx_queue *rx_q = - &priv->rx_queue[queue]; +for (queue =0 ; queue < queues_count; queue++) { +struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue]; - status |=stmmac_host_mtl_irq_status (priv, - priv->hw, queue); + mtl_status =stmmac_host_mtl_irq_status (priv, priv->hw, + queue); +if (mtl_status != -EINVAL ) + status |= mtl_status; -if (status &CORE_IRQ_MTL_RX_OVERFLOW ) -stmmac_set_rx_tail_ptr (priv, - priv->ioaddr, - rx_q->rx_tail_addr, - queue); - } +if (status &CORE_IRQ_MTL_RX_OVERFLOW ) +stmmac_set_rx_tail_ptr (priv, priv->ioaddr, + rx_q->rx_tail_addr, + queue); }/* PCS link status */
Signature · 1 line
1.7.1
Quoted 52 lines · Jose Abreu
This targets to uniformize the handling of the different GMAC versions in
stmmac_main.cfile and also tune-up the HW.Currently there are some if/else conditions in the main source file which calls different callbacks depending on the ID of GMAC.
With the introducion of a generic HW interface handling which automatically selects the GMAC callbacks to be used, it is now unpleasant to see if conditions in the main code because this should be completely agnostic of the GMAC version.
This series removes most of these conditions. There are some if conditions that remain untouched but the callbacks handling are now uniformized.
Tested in GMAC5, hope I didn't break any previous versions.
Please check [1] for performance analisys of patches 3-12.
---
David,This will probably generate a merge conflict with [2] (which was not merged yet). I'm waiting for Corentin input and then, if this series is merged before, I will rebase [2]. Or the other way around if you prefer :D
Thanks
---Cc David S. Miller <[email protected]>Cc Joao Pinto <[email protected]>Cc Vitor Soares <[email protected]>Cc Giuseppe Cavallaro <[email protected]>Cc Alexandre Torgue <[email protected]>[1] https://marc.info/?l=linux-netdev&m=152656352607905&w=2
[2] https://patchwork.ozlabs.org/patch/915286/Jose Abreu (12):
net: stmmac: Enable OSP for GMAC4
net: stmmac: Do not keep rearming the coalesce timer instmmac_xmit
net: stmmac: Let descriptor code set skbuff address
net: stmmac: Let descriptor code clear the descriptor
net: stmmac: Uniformize the use of dma_{rx/tx}_mode callbacks
net: stmmac: Remove uneeded checks for GMAC version
net: stmmac: Move PTP and MMC base address calculation tohwif.c
net: stmmac: Uniformize the use of dma_init_* callbacks
net: stmmac: Remove uneeded check for GMAC version instmmac_xmit
net: stmmac: Uniformizeset_rx_owner()
net: stmmac: Let descriptor code get skbuff address
net: stmmac: Remove if condition by taking advantage of hwif return
code
Quoted 15 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 82 +++++--- .../net/ethernet/stmicro/stmmac/dwmac1000_dma.c | 92 ++++++---- drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c | 35 +++-- drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c | 34 +++- drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c | 7 +- drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.h | 1 - drivers/net/ethernet/stmicro/stmmac/enh_desc.c | 20 ++- drivers/net/ethernet/stmicro/stmmac/hwif.c | 34 ++++ drivers/net/ethernet/stmicro/stmmac/hwif.h | 27 ++- drivers/net/ethernet/stmicro/stmmac/norm_desc.c | 20 ++- drivers/net/ethernet/stmicro/stmmac/stmmac.h | 1 + drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 198 +++++++------------- 12 files changed, 323 insertions(+), 228 deletions(-)
Hello
You didnt have put in CC [email protected] as required by get_maintener.pl letting more people to see this series. Since this series touch dwmac-sun8i.c you should have also added Chen-Yu Tsai/Maxime Ripard (as also asked by get_maintainer).
Regards
Hi Corentin,
Quoted 68 lines · Corentin Labbe
Quoted 52 lines · Jose Abreu
This targets to uniformize the handling of the different GMAC versions in
stmmac_main.cfile and also tune-up the HW.Currently there are some if/else conditions in the main source file which calls different callbacks depending on the ID of GMAC.
With the introducion of a generic HW interface handling which automatically selects the GMAC callbacks to be used, it is now unpleasant to see if conditions in the main code because this should be completely agnostic of the GMAC version.
This series removes most of these conditions. There are some if conditions that remain untouched but the callbacks handling are now uniformized.
Tested in GMAC5, hope I didn't break any previous versions.
Please check [1] for performance analisys of patches 3-12.
---
David,This will probably generate a merge conflict with [2] (which was not merged yet). I'm waiting for Corentin input and then, if this series is merged before, I will rebase [2]. Or the other way around if you prefer :D
Thanks
---Cc David S. Miller <[email protected]>Cc Joao Pinto <[email protected]>Cc Vitor Soares <[email protected]>Cc Giuseppe Cavallaro <[email protected]>Cc Alexandre Torgue <[email protected]>[1] https://urldefense.proofpoint.com/v2/url?u=https-3A__marc.info_-3Fl-3Dlinux-2Dnetdev-26m-3D152656352607905-26w-3D2&d=DwIBAg&c=DPL6_X_6JkXFx7AXWqB0tg&r=WHDsc6kcWAl4i96Vm5hJ_19IJiuxx_p_Rzo2g-uHDKw&m=a7bgrSQpisaMSa5fT-je94smZ_TM7QTxNFKqkvI5Nns&s=Tr23Xj_UCR_PaJp8AYiy18hfhbILnsaCsKDT5_4m2z4&e=
[2] https://urldefense.proofpoint.com/v2/url?u=https-3A__patchwork.ozlabs.org_patch_915286_&d=DwIBAg&c=DPL6_X_6JkXFx7AXWqB0tg&r=WHDsc6kcWAl4i96Vm5hJ_19IJiuxx_p_Rzo2g-uHDKw&m=a7bgrSQpisaMSa5fT-je94smZ_TM7QTxNFKqkvI5Nns&s=Q0SV-ZR35zIJWjiaLNXqlOWchppQ2CsO-Fh-BFCjCB8&e=Jose Abreu (12):
net: stmmac: Enable OSP for GMAC4
net: stmmac: Do not keep rearming the coalesce timer instmmac_xmit
net: stmmac: Let descriptor code set skbuff address
net: stmmac: Let descriptor code clear the descriptor
net: stmmac: Uniformize the use of dma_{rx/tx}_mode callbacks
net: stmmac: Remove uneeded checks for GMAC version
net: stmmac: Move PTP and MMC base address calculation tohwif.c
net: stmmac: Uniformize the use of dma_init_* callbacks
net: stmmac: Remove uneeded check for GMAC version instmmac_xmit
net: stmmac: Uniformizeset_rx_owner()
net: stmmac: Let descriptor code get skbuff address
net: stmmac: Remove if condition by taking advantage of hwif return
codeQuoted 15 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 82 +++++--- .../net/ethernet/stmicro/stmmac/dwmac1000_dma.c | 92 ++++++---- drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c | 35 +++-- drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c | 34 +++- drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c | 7 +- drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.h | 1 - drivers/net/ethernet/stmicro/stmmac/enh_desc.c | 20 ++- drivers/net/ethernet/stmicro/stmmac/hwif.c | 34 ++++ drivers/net/ethernet/stmicro/stmmac/hwif.h | 27 ++- drivers/net/ethernet/stmicro/stmmac/norm_desc.c | 20 ++- drivers/net/ethernet/stmicro/stmmac/stmmac.h | 1 + drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 198 +++++++------------- 12 files changed, 323 insertions(+), 228 deletions(-)
Quoted 4 lines
Hello
You didnt have put in CC [email protected] as required by get_maintener.pl letting more people to see this series. Since this series touch
dwmac-sun8i.cyou should have also added Chen-Yu Tsai/Maxime Ripard (as also asked byget_maintainer).
Usually I just cc according to MAINTAINERS file but thanks for noticing. Added in cc now.
Thanks and Best Regards,
Jose Miguel Abreu
Quoted 2 lines
Regards
Quoted 71 lines · Jose Abreu
Hi Corentin,
Quoted 68 lines · Corentin Labbe
Quoted 67 lines · Jose Abreu
This targets to uniformize the handling of the different GMAC versions in
stmmac_main.cfile and also tune-up the HW.Currently there are some if/else conditions in the main source file which calls different callbacks depending on the ID of GMAC.
With the introducion of a generic HW interface handling which automatically selects the GMAC callbacks to be used, it is now unpleasant to see if conditions in the main code because this should be completely agnostic of the GMAC version.
This series removes most of these conditions. There are some if conditions that remain untouched but the callbacks handling are now uniformized.
Tested in GMAC5, hope I didn't break any previous versions.
Please check [1] for performance analisys of patches 3-12.
---
David,This will probably generate a merge conflict with [2] (which was not merged yet). I'm waiting for Corentin input and then, if this series is merged before, I will rebase [2]. Or the other way around if you prefer :D
Thanks
---Cc David S. Miller <[email protected]>Cc Joao Pinto <[email protected]>Cc Vitor Soares <[email protected]>Cc Giuseppe Cavallaro <[email protected]>Cc Alexandre Torgue <[email protected]>[1] https://urldefense.proofpoint.com/v2/url?u=https-3A__marc.info_-3Fl-3Dlinux-2Dnetdev-26m-3D152656352607905-26w-3D2&d=DwIBAg&c=DPL6_X_6JkXFx7AXWqB0tg&r=WHDsc6kcWAl4i96Vm5hJ_19IJiuxx_p_Rzo2g-uHDKw&m=a7bgrSQpisaMSa5fT-je94smZ_TM7QTxNFKqkvI5Nns&s=Tr23Xj_UCR_PaJp8AYiy18hfhbILnsaCsKDT5_4m2z4&e=
[2] https://urldefense.proofpoint.com/v2/url?u=https-3A__patchwork.ozlabs.org_patch_915286_&d=DwIBAg&c=DPL6_X_6JkXFx7AXWqB0tg&r=WHDsc6kcWAl4i96Vm5hJ_19IJiuxx_p_Rzo2g-uHDKw&m=a7bgrSQpisaMSa5fT-je94smZ_TM7QTxNFKqkvI5Nns&s=Q0SV-ZR35zIJWjiaLNXqlOWchppQ2CsO-Fh-BFCjCB8&e=Jose Abreu (12):
net: stmmac: Enable OSP for GMAC4
net: stmmac: Do not keep rearming the coalesce timer instmmac_xmit
net: stmmac: Let descriptor code set skbuff address
net: stmmac: Let descriptor code clear the descriptor
net: stmmac: Uniformize the use of dma_{rx/tx}_mode callbacks
net: stmmac: Remove uneeded checks for GMAC version
net: stmmac: Move PTP and MMC base address calculation tohwif.c
net: stmmac: Uniformize the use of dma_init_* callbacks
net: stmmac: Remove uneeded check for GMAC version instmmac_xmit
net: stmmac: Uniformizeset_rx_owner()
net: stmmac: Let descriptor code get skbuff address
net: stmmac: Remove if condition by taking advantage of hwif return
codedrivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 82 +++++--- .../net/ethernet/stmicro/stmmac/dwmac1000_dma.c | 92 ++++++---- drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c | 35 +++-- drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c | 34 +++- drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c | 7 +- drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.h | 1 - drivers/net/ethernet/stmicro/stmmac/enh_desc.c | 20 ++- drivers/net/ethernet/stmicro/stmmac/hwif.c | 34 ++++ drivers/net/ethernet/stmicro/stmmac/hwif.h | 27 ++- drivers/net/ethernet/stmicro/stmmac/norm_desc.c | 20 ++- drivers/net/ethernet/stmicro/stmmac/stmmac.h | 1 + drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 198 +++++++------------- 12 files changed, 323 insertions(+), 228 deletions(-)
Quoted 8 lines
Quoted 4 lines
Hello
You didnt have put in CC [email protected] as required by get_maintener.pl letting more people to see this series. Since this series touch
dwmac-sun8i.cyou should have also added Chen-Yu Tsai/Maxime Ripard (as also asked byget_maintainer).Usually I just cc according to
MAINTAINERSfile but thanks for noticing. Added in cc now.
./scripts/get_maintainer.pl does this for you (and it use MAINTAINERS).
You have to use it at least, since it handle regex that could be easily unseen like for dwmac-sun8i.
David Miller
maintainerFrom: Jose Abreu <[email protected]>
Date: Fri, 18 May 2018 14:55:57 +0100
Quoted 11 lines
This targets to uniformize the handling of the different GMAC versions in
stmmac_main.cfile and also tune-up the HW.Currently there are some if/else conditions in the main source file which calls different callbacks depending on the ID of GMAC.
With the introducion of a generic HW interface handling which automatically selects the GMAC callbacks to be used, it is now unpleasant to see if conditions in the main code because this should be completely agnostic of the GMAC version.
Quoted 6 lines
This series removes most of these conditions. There are some if conditions that remain untouched but the callbacks handling are now uniformized.
Tested in GMAC5, hope I didn't break any previous versions.
Please check [1] for performance analisys of patches 3-12.
This looks a lot better, series applied, thanks.
Quoted 3 lines
This will probably generate a merge conflict with [2] (which was not merged yet). I'm waiting for Corentin input and then, if this series is merged before, I will rebase [2]. Or the other way around if you prefer :D
Since I just merged this, please rebase 2.
Thank you.