Skip to content

Commit 8fce333

Browse files
joabreudavem330
authored andcommitted
net: stmmac: Rework coalesce timer and fix multi-queue races
This follows David Miller advice and tries to fix coalesce timer in multi-queue scenarios. We are now using per-queue coalesce values and per-queue TX timer. Coalesce timer default values was changed to 1ms and the coalesce frames to 25. Tested in B2B setup between XGMAC2 and GMAC5. Signed-off-by: Jose Abreu <joabreu@synopsys.com> Fixes: ce73678 ("net: stmmac: adding multiple buffers for TX") Cc: Florian Fainelli <f.fainelli@gmail.com> Cc: Neil Armstrong <narmstrong@baylibre.com> Cc: Jerome Brunet <jbrunet@baylibre.com> Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Cc: David S. Miller <davem@davemloft.net> Cc: Joao Pinto <jpinto@synopsys.com> Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com> Cc: Alexandre Torgue <alexandre.torgue@st.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 5211da9 commit 8fce333

File tree

4 files changed

+146
-106
lines changed

4 files changed

+146
-106
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,10 +258,10 @@ struct stmmac_safety_stats {
258258
#define MAX_DMA_RIWT 0xff
259259
#define MIN_DMA_RIWT 0x20
260260
/* Tx coalesce parameters */
261-
#define STMMAC_COAL_TX_TIMER 40000
261+
#define STMMAC_COAL_TX_TIMER 1000
262262
#define STMMAC_MAX_COAL_TX_TICK 100000
263263
#define STMMAC_TX_MAX_FRAMES 256
264-
#define STMMAC_TX_FRAMES 64
264+
#define STMMAC_TX_FRAMES 25
265265

266266
/* Packets types */
267267
enum packets_types {

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

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ struct stmmac_tx_info {
4848

4949
/* Frequently used values are kept adjacent for cache effect */
5050
struct stmmac_tx_queue {
51+
u32 tx_count_frames;
52+
struct timer_list txtimer;
5153
u32 queue_index;
5254
struct stmmac_priv *priv_data;
5355
struct dma_extended_desc *dma_etx ____cacheline_aligned_in_smp;
@@ -73,7 +75,14 @@ struct stmmac_rx_queue {
7375
u32 rx_zeroc_thresh;
7476
dma_addr_t dma_rx_phy;
7577
u32 rx_tail_addr;
78+
};
79+
80+
struct stmmac_channel {
7681
struct napi_struct napi ____cacheline_aligned_in_smp;
82+
struct stmmac_priv *priv_data;
83+
u32 index;
84+
int has_rx;
85+
int has_tx;
7786
};
7887

7988
struct stmmac_tc_entry {
@@ -109,14 +118,12 @@ struct stmmac_pps_cfg {
109118

110119
struct stmmac_priv {
111120
/* Frequently used values are kept adjacent for cache effect */
112-
u32 tx_count_frames;
113121
u32 tx_coal_frames;
114122
u32 tx_coal_timer;
115123

116124
int tx_coalesce;
117125
int hwts_tx_en;
118126
bool tx_path_in_lpi_mode;
119-
struct timer_list txtimer;
120127
bool tso;
121128

122129
unsigned int dma_buf_sz;
@@ -137,6 +144,9 @@ struct stmmac_priv {
137144
/* TX Queue */
138145
struct stmmac_tx_queue tx_queue[MTL_MAX_TX_QUEUES];
139146

147+
/* Generic channel for NAPI */
148+
struct stmmac_channel channel[STMMAC_CH_MAX];
149+
140150
bool oldlink;
141151
int speed;
142152
int oldduplex;

0 commit comments

Comments
 (0)