Skip to content

Commit 15bc812

Browse files
shinas-marvelldavem330
authored andcommitted
octeon_ep: set backpressure watermark for RX queues
Set backpressure watermark for hardware RX queues. Backpressure gets triggered when the available buffers of a hardware RX queue falls below the set watermark. This backpressure will propagate to packet processing pipeline in the OCTEON card, so that the host receives fewer packets and prevents packet dropping at host. Signed-off-by: Shinas Rasheed <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 0cd523e commit 15bc812

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

drivers/net/ethernet/marvell/octeon_ep/octep_cnxk_pf.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ static void octep_init_config_cnxk_pf(struct octep_device *oct)
258258
conf->oq.refill_threshold = OCTEP_OQ_REFILL_THRESHOLD;
259259
conf->oq.oq_intr_pkt = OCTEP_OQ_INTR_PKT_THRESHOLD;
260260
conf->oq.oq_intr_time = OCTEP_OQ_INTR_TIME_THRESHOLD;
261+
conf->oq.wmark = OCTEP_OQ_WMARK_MIN;
261262

262263
conf->msix_cfg.non_ioq_msix = CNXK_NUM_NON_IOQ_INTR;
263264
conf->msix_cfg.ioq_msix = conf->pf_ring_cfg.active_io_rings;
@@ -378,6 +379,12 @@ static void octep_setup_oq_regs_cnxk_pf(struct octep_device *oct, int oq_no)
378379
reg_val = ((u64)time_threshold << 32) |
379380
CFG_GET_OQ_INTR_PKT(oct->conf);
380381
octep_write_csr64(oct, CNXK_SDP_R_OUT_INT_LEVELS(oq_no), reg_val);
382+
383+
/* set watermark for backpressure */
384+
reg_val = octep_read_csr64(oct, CNXK_SDP_R_OUT_WMARK(oq_no));
385+
reg_val &= ~0xFFFFFFFFULL;
386+
reg_val |= CFG_GET_OQ_WMARK(oct->conf);
387+
octep_write_csr64(oct, CNXK_SDP_R_OUT_WMARK(oq_no), reg_val);
381388
}
382389

383390
/* Setup registers for a PF mailbox */

drivers/net/ethernet/marvell/octeon_ep/octep_config.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
/* Packet threshold for Tx queue interrupt */
2121
#define OCTEP_IQ_INTR_THRESHOLD 0x0
2222

23+
/* Minimum watermark for backpressure */
24+
#define OCTEP_OQ_WMARK_MIN 256
25+
2326
/* Rx Queue: maximum descriptors per ring */
2427
#define OCTEP_OQ_MAX_DESCRIPTORS 1024
2528

@@ -67,6 +70,7 @@
6770
#define CFG_GET_OQ_REFILL_THRESHOLD(cfg) ((cfg)->oq.refill_threshold)
6871
#define CFG_GET_OQ_INTR_PKT(cfg) ((cfg)->oq.oq_intr_pkt)
6972
#define CFG_GET_OQ_INTR_TIME(cfg) ((cfg)->oq.oq_intr_time)
73+
#define CFG_GET_OQ_WMARK(cfg) ((cfg)->oq.wmark)
7074

7175
#define CFG_GET_PORTS_MAX_IO_RINGS(cfg) ((cfg)->pf_ring_cfg.max_io_rings)
7276
#define CFG_GET_PORTS_ACTIVE_IO_RINGS(cfg) ((cfg)->pf_ring_cfg.active_io_rings)
@@ -136,6 +140,12 @@ struct octep_oq_config {
136140
* default. The time is specified in microseconds.
137141
*/
138142
u32 oq_intr_time;
143+
144+
/* Water mark for backpressure.
145+
* Output queue sends backpressure signal to source when
146+
* free buffer count falls below wmark.
147+
*/
148+
u32 wmark;
139149
};
140150

141151
/* Tx/Rx configuration */

drivers/net/ethernet/marvell/octeon_ep/octep_regs_cnxk_pf.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,9 @@
143143
#define CNXK_SDP_R_OUT_SLIST_DBELL(ring) \
144144
(CNXK_SDP_R_OUT_SLIST_DBELL_START + ((ring) * CNXK_RING_OFFSET))
145145

146+
#define CNXK_SDP_R_OUT_WMARK(ring) \
147+
(CNXK_SDP_R_OUT_WMARK_START + ((ring) * CNXK_RING_OFFSET))
148+
146149
#define CNXK_SDP_R_OUT_CNTS(ring) \
147150
(CNXK_SDP_R_OUT_CNTS_START + ((ring) * CNXK_RING_OFFSET))
148151

0 commit comments

Comments
 (0)