Skip to content

Commit ac975af

Browse files
committed
Merge branch 'fix-pfc-related-issues'
Suman Ghosh says: ==================== Fix PFC related issues This patchset fixes multiple PFC related issues related to Octeon. Patch #1: octeontx2-pf: Fix PFC TX scheduler free Patch #2: octeontx2-af: CN10KB: fix PFC configuration Patch #3: octeonxt2-pf: Fix backpressure config for multiple PFC priorities to work simultaneously ==================== Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 931abcd + 597d0ec commit ac975af

File tree

3 files changed

+16
-21
lines changed

3 files changed

+16
-21
lines changed

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

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -355,8 +355,8 @@ int rpm_lmac_enadis_pause_frm(void *rpmd, int lmac_id, u8 tx_pause,
355355

356356
void rpm_lmac_pause_frm_config(void *rpmd, int lmac_id, bool enable)
357357
{
358+
u64 cfg, pfc_class_mask_cfg;
358359
rpm_t *rpm = rpmd;
359-
u64 cfg;
360360

361361
/* ALL pause frames received are completely ignored */
362362
cfg = rpm_read(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG);
@@ -380,9 +380,11 @@ void rpm_lmac_pause_frm_config(void *rpmd, int lmac_id, bool enable)
380380
rpm_write(rpm, 0, RPMX_CMR_CHAN_MSK_OR, ~0ULL);
381381

382382
/* Disable all PFC classes */
383-
cfg = rpm_read(rpm, lmac_id, RPMX_CMRX_PRT_CBFC_CTL);
383+
pfc_class_mask_cfg = is_dev_rpm2(rpm) ? RPM2_CMRX_PRT_CBFC_CTL :
384+
RPMX_CMRX_PRT_CBFC_CTL;
385+
cfg = rpm_read(rpm, lmac_id, pfc_class_mask_cfg);
384386
cfg = FIELD_SET(RPM_PFC_CLASS_MASK, 0, cfg);
385-
rpm_write(rpm, lmac_id, RPMX_CMRX_PRT_CBFC_CTL, cfg);
387+
rpm_write(rpm, lmac_id, pfc_class_mask_cfg, cfg);
386388
}
387389

388390
int rpm_get_rx_stats(void *rpmd, int lmac_id, int idx, u64 *rx_stat)
@@ -605,8 +607,11 @@ int rpm_lmac_pfc_config(void *rpmd, int lmac_id, u8 tx_pause, u8 rx_pause, u16 p
605607
if (!is_lmac_valid(rpm, lmac_id))
606608
return -ENODEV;
607609

610+
pfc_class_mask_cfg = is_dev_rpm2(rpm) ? RPM2_CMRX_PRT_CBFC_CTL :
611+
RPMX_CMRX_PRT_CBFC_CTL;
612+
608613
cfg = rpm_read(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG);
609-
class_en = rpm_read(rpm, lmac_id, RPMX_CMRX_PRT_CBFC_CTL);
614+
class_en = rpm_read(rpm, lmac_id, pfc_class_mask_cfg);
610615
pfc_en |= FIELD_GET(RPM_PFC_CLASS_MASK, class_en);
611616

612617
if (rx_pause) {
@@ -635,10 +640,6 @@ int rpm_lmac_pfc_config(void *rpmd, int lmac_id, u8 tx_pause, u8 rx_pause, u16 p
635640
cfg |= RPMX_MTI_MAC100X_COMMAND_CONFIG_PFC_MODE;
636641

637642
rpm_write(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG, cfg);
638-
639-
pfc_class_mask_cfg = is_dev_rpm2(rpm) ? RPM2_CMRX_PRT_CBFC_CTL :
640-
RPMX_CMRX_PRT_CBFC_CTL;
641-
642643
rpm_write(rpm, lmac_id, pfc_class_mask_cfg, class_en);
643644

644645
return 0;

drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -804,6 +804,7 @@ void otx2_txschq_free_one(struct otx2_nic *pfvf, u16 lvl, u16 schq)
804804

805805
mutex_unlock(&pfvf->mbox.lock);
806806
}
807+
EXPORT_SYMBOL(otx2_txschq_free_one);
807808

808809
void otx2_txschq_stop(struct otx2_nic *pfvf)
809810
{

drivers/net/ethernet/marvell/octeontx2/nic/otx2_dcbnl.c

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ static int otx2_pfc_txschq_alloc_one(struct otx2_nic *pfvf, u8 prio)
7070
* link config level. These rest of the scheduler can be
7171
* same as hw.txschq_list.
7272
*/
73-
for (lvl = 0; lvl < pfvf->hw.txschq_link_cfg_lvl; lvl++)
73+
for (lvl = 0; lvl <= pfvf->hw.txschq_link_cfg_lvl; lvl++)
7474
req->schq[lvl] = 1;
7575

7676
rc = otx2_sync_mbox_msg(&pfvf->mbox);
@@ -83,7 +83,7 @@ static int otx2_pfc_txschq_alloc_one(struct otx2_nic *pfvf, u8 prio)
8383
return PTR_ERR(rsp);
8484

8585
/* Setup transmit scheduler list */
86-
for (lvl = 0; lvl < pfvf->hw.txschq_link_cfg_lvl; lvl++) {
86+
for (lvl = 0; lvl <= pfvf->hw.txschq_link_cfg_lvl; lvl++) {
8787
if (!rsp->schq[lvl])
8888
return -ENOSPC;
8989

@@ -125,19 +125,12 @@ int otx2_pfc_txschq_alloc(struct otx2_nic *pfvf)
125125

126126
static int otx2_pfc_txschq_stop_one(struct otx2_nic *pfvf, u8 prio)
127127
{
128-
struct nix_txsch_free_req *free_req;
128+
int lvl;
129129

130-
mutex_lock(&pfvf->mbox.lock);
131130
/* free PFC TLx nodes */
132-
free_req = otx2_mbox_alloc_msg_nix_txsch_free(&pfvf->mbox);
133-
if (!free_req) {
134-
mutex_unlock(&pfvf->mbox.lock);
135-
return -ENOMEM;
136-
}
137-
138-
free_req->flags = TXSCHQ_FREE_ALL;
139-
otx2_sync_mbox_msg(&pfvf->mbox);
140-
mutex_unlock(&pfvf->mbox.lock);
131+
for (lvl = 0; lvl <= pfvf->hw.txschq_link_cfg_lvl; lvl++)
132+
otx2_txschq_free_one(pfvf, lvl,
133+
pfvf->pfc_schq_list[lvl][prio]);
141134

142135
pfvf->pfc_alloc_status[prio] = false;
143136
return 0;

0 commit comments

Comments
 (0)