Skip to content

Commit d1e8884

Browse files
Hariprasad KelamPaolo Abeni
authored andcommitted
octeontx2-af: RPM: Fix low network performance
Low network performance is observed even on RPMs with larger FIFO lengths. The cn10kb silicon has three RPM blocks with the following FIFO sizes: -------------------- | RPM0 | 256KB | | RPM1 | 256KB | | RPM2 | 128KB | -------------------- The current design stores the FIFO length in a common structure for all RPMs (mac_ops). As a result, the FIFO length of the last RPM is applied to all RPMs, leading to reduced network performance. This patch resolved the problem by storing the fifo length in per MAC structure (cgx). Fixes: b9d0fed ("octeontx2-af: cn10kb: Add RPM_USX MAC support") Signed-off-by: Hariprasad Kelam <hkelam@marvell.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
1 parent 7ebbbb2 commit d1e8884

File tree

5 files changed

+19
-11
lines changed

5 files changed

+19
-11
lines changed

drivers/net/ethernet/marvell/octeontx2/af/cgx.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,11 @@ struct mac_ops *get_mac_ops(void *cgxd)
112112
return ((struct cgx *)cgxd)->mac_ops;
113113
}
114114

115+
u32 cgx_get_fifo_len(void *cgxd)
116+
{
117+
return ((struct cgx *)cgxd)->fifo_len;
118+
}
119+
115120
void cgx_write(struct cgx *cgx, u64 lmac, u64 offset, u64 val)
116121
{
117122
writeq(val, cgx->reg_base + (lmac << cgx->mac_ops->lmac_offset) +
@@ -501,7 +506,7 @@ static u32 cgx_get_lmac_fifo_len(void *cgxd, int lmac_id)
501506
u8 num_lmacs;
502507
u32 fifo_len;
503508

504-
fifo_len = cgx->mac_ops->fifo_len;
509+
fifo_len = cgx->fifo_len;
505510
num_lmacs = cgx->mac_ops->get_nr_lmacs(cgx);
506511

507512
switch (num_lmacs) {
@@ -1764,7 +1769,7 @@ static void cgx_populate_features(struct cgx *cgx)
17641769
u64 cfg;
17651770

17661771
cfg = cgx_read(cgx, 0, CGX_CONST);
1767-
cgx->mac_ops->fifo_len = FIELD_GET(CGX_CONST_RXFIFO_SIZE, cfg);
1772+
cgx->fifo_len = FIELD_GET(CGX_CONST_RXFIFO_SIZE, cfg);
17681773
cgx->max_lmac_per_mac = FIELD_GET(CGX_CONST_MAX_LMACS, cfg);
17691774

17701775
if (is_dev_rpm(cgx))

drivers/net/ethernet/marvell/octeontx2/af/cgx.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,4 +185,5 @@ int cgx_lmac_get_pfc_frm_cfg(void *cgxd, int lmac_id, u8 *tx_pause,
185185
int verify_lmac_fc_cfg(void *cgxd, int lmac_id, u8 tx_pause, u8 rx_pause,
186186
int pfvf_idx);
187187
int cgx_lmac_reset(void *cgxd, int lmac_id, u8 pf_req_flr);
188+
u32 cgx_get_fifo_len(void *cgxd);
188189
#endif /* CGX_H */

drivers/net/ethernet/marvell/octeontx2/af/lmac_common.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ struct mac_ops {
7272
u8 irq_offset;
7373
u8 int_ena_bit;
7474
u8 lmac_fwi;
75-
u32 fifo_len;
7675
bool non_contiguous_serdes_lane;
7776
/* RPM & CGX differs in number of Receive/transmit stats */
7877
u8 rx_stats_cnt;
@@ -142,6 +141,10 @@ struct cgx {
142141
u8 lmac_count;
143142
/* number of LMACs per MAC could be 4 or 8 */
144143
u8 max_lmac_per_mac;
144+
/* length of fifo varies depending on the number
145+
* of LMACS
146+
*/
147+
u32 fifo_len;
145148
#define MAX_LMAC_COUNT 8
146149
struct lmac *lmac_idmap[MAX_LMAC_COUNT];
147150
struct work_struct cgx_cmd_work;

drivers/net/ethernet/marvell/octeontx2/af/rpm.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ u32 rpm_get_lmac_fifo_len(void *rpmd, int lmac_id)
480480
u8 num_lmacs;
481481
u32 fifo_len;
482482

483-
fifo_len = rpm->mac_ops->fifo_len;
483+
fifo_len = rpm->fifo_len;
484484
num_lmacs = rpm->mac_ops->get_nr_lmacs(rpm);
485485

486486
switch (num_lmacs) {
@@ -533,9 +533,9 @@ u32 rpm2_get_lmac_fifo_len(void *rpmd, int lmac_id)
533533
*/
534534
max_lmac = (rpm_read(rpm, 0, CGX_CONST) >> 24) & 0xFF;
535535
if (max_lmac > 4)
536-
fifo_len = rpm->mac_ops->fifo_len / 2;
536+
fifo_len = rpm->fifo_len / 2;
537537
else
538-
fifo_len = rpm->mac_ops->fifo_len;
538+
fifo_len = rpm->fifo_len;
539539

540540
if (lmac_id < 4) {
541541
num_lmacs = hweight8(lmac_info & 0xF);

drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -923,13 +923,12 @@ int rvu_mbox_handler_cgx_features_get(struct rvu *rvu,
923923

924924
u32 rvu_cgx_get_fifolen(struct rvu *rvu)
925925
{
926-
struct mac_ops *mac_ops;
927-
u32 fifo_len;
926+
void *cgxd = rvu_first_cgx_pdata(rvu);
928927

929-
mac_ops = get_mac_ops(rvu_first_cgx_pdata(rvu));
930-
fifo_len = mac_ops ? mac_ops->fifo_len : 0;
928+
if (!cgxd)
929+
return 0;
931930

932-
return fifo_len;
931+
return cgx_get_fifo_len(cgxd);
933932
}
934933

935934
u32 rvu_cgx_get_lmac_fifolen(struct rvu *rvu, int cgx, int lmac)

0 commit comments

Comments
 (0)