octeontx2-af: cn10k: Use appropriate register for LMAC enable
CN10K platforms uses RPM(0..2)_MTI_MAC100(0..3)_COMMAND_CONFIG
register for lmac TX/RX enable whereas CN9xxx platforms use
CGX_CMRX_CONFIG register. This config change was missed when
adding support for CN10K RPM.
Fixes: 91c6945ea1
("octeontx2-af: cn10k: Add RPM MAC support")
Signed-off-by: Geetha sowjanya <gakula@marvell.com>
Signed-off-by: Subbaraya Sundeep <sbhatta@marvell.com>
Signed-off-by: Sunil Goutham <sgoutham@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
03ffbc9914
commit
fae80edeaf
@ -1570,6 +1570,8 @@ static struct mac_ops cgx_mac_ops = {
|
||||
.mac_enadis_pause_frm = cgx_lmac_enadis_pause_frm,
|
||||
.mac_pause_frm_config = cgx_lmac_pause_frm_config,
|
||||
.mac_enadis_ptp_config = cgx_lmac_ptp_config,
|
||||
.mac_rx_tx_enable = cgx_lmac_rx_tx_enable,
|
||||
.mac_tx_enable = cgx_lmac_tx_enable,
|
||||
};
|
||||
|
||||
static int cgx_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
||||
|
@ -107,6 +107,9 @@ struct mac_ops {
|
||||
void (*mac_enadis_ptp_config)(void *cgxd,
|
||||
int lmac_id,
|
||||
bool enable);
|
||||
|
||||
int (*mac_rx_tx_enable)(void *cgxd, int lmac_id, bool enable);
|
||||
int (*mac_tx_enable)(void *cgxd, int lmac_id, bool enable);
|
||||
};
|
||||
|
||||
struct cgx {
|
||||
|
@ -30,6 +30,8 @@ static struct mac_ops rpm_mac_ops = {
|
||||
.mac_enadis_pause_frm = rpm_lmac_enadis_pause_frm,
|
||||
.mac_pause_frm_config = rpm_lmac_pause_frm_config,
|
||||
.mac_enadis_ptp_config = rpm_lmac_ptp_config,
|
||||
.mac_rx_tx_enable = rpm_lmac_rx_tx_enable,
|
||||
.mac_tx_enable = rpm_lmac_tx_enable,
|
||||
};
|
||||
|
||||
struct mac_ops *rpm_get_mac_ops(void)
|
||||
@ -54,6 +56,43 @@ int rpm_get_nr_lmacs(void *rpmd)
|
||||
return hweight8(rpm_read(rpm, 0, CGXX_CMRX_RX_LMACS) & 0xFULL);
|
||||
}
|
||||
|
||||
int rpm_lmac_tx_enable(void *rpmd, int lmac_id, bool enable)
|
||||
{
|
||||
rpm_t *rpm = rpmd;
|
||||
u64 cfg, last;
|
||||
|
||||
if (!is_lmac_valid(rpm, lmac_id))
|
||||
return -ENODEV;
|
||||
|
||||
cfg = rpm_read(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG);
|
||||
last = cfg;
|
||||
if (enable)
|
||||
cfg |= RPM_TX_EN;
|
||||
else
|
||||
cfg &= ~(RPM_TX_EN);
|
||||
|
||||
if (cfg != last)
|
||||
rpm_write(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG, cfg);
|
||||
return !!(last & RPM_TX_EN);
|
||||
}
|
||||
|
||||
int rpm_lmac_rx_tx_enable(void *rpmd, int lmac_id, bool enable)
|
||||
{
|
||||
rpm_t *rpm = rpmd;
|
||||
u64 cfg;
|
||||
|
||||
if (!is_lmac_valid(rpm, lmac_id))
|
||||
return -ENODEV;
|
||||
|
||||
cfg = rpm_read(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG);
|
||||
if (enable)
|
||||
cfg |= RPM_RX_EN | RPM_TX_EN;
|
||||
else
|
||||
cfg &= ~(RPM_RX_EN | RPM_TX_EN);
|
||||
rpm_write(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG, cfg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void rpm_lmac_enadis_rx_pause_fwding(void *rpmd, int lmac_id, bool enable)
|
||||
{
|
||||
rpm_t *rpm = rpmd;
|
||||
|
@ -43,6 +43,8 @@
|
||||
#define RPMX_MTI_STAT_DATA_HI_CDC 0x10038
|
||||
|
||||
#define RPM_LMAC_FWI 0xa
|
||||
#define RPM_TX_EN BIT_ULL(0)
|
||||
#define RPM_RX_EN BIT_ULL(1)
|
||||
|
||||
/* Function Declarations */
|
||||
int rpm_get_nr_lmacs(void *rpmd);
|
||||
@ -57,4 +59,6 @@ int rpm_lmac_enadis_pause_frm(void *rpmd, int lmac_id, u8 tx_pause,
|
||||
int rpm_get_tx_stats(void *rpmd, int lmac_id, int idx, u64 *tx_stat);
|
||||
int rpm_get_rx_stats(void *rpmd, int lmac_id, int idx, u64 *rx_stat);
|
||||
void rpm_lmac_ptp_config(void *rpmd, int lmac_id, bool enable);
|
||||
int rpm_lmac_rx_tx_enable(void *rpmd, int lmac_id, bool enable);
|
||||
int rpm_lmac_tx_enable(void *rpmd, int lmac_id, bool enable);
|
||||
#endif /* RPM_H */
|
||||
|
@ -806,6 +806,7 @@ bool is_mac_feature_supported(struct rvu *rvu, int pf, int feature);
|
||||
u32 rvu_cgx_get_fifolen(struct rvu *rvu);
|
||||
void *rvu_first_cgx_pdata(struct rvu *rvu);
|
||||
int cgxlmac_to_pf(struct rvu *rvu, int cgx_id, int lmac_id);
|
||||
int rvu_cgx_config_tx(void *cgxd, int lmac_id, bool enable);
|
||||
|
||||
int npc_get_nixlf_mcam_index(struct npc_mcam *mcam, u16 pcifunc, int nixlf,
|
||||
int type);
|
||||
|
@ -441,16 +441,26 @@ void rvu_cgx_enadis_rx_bp(struct rvu *rvu, int pf, bool enable)
|
||||
int rvu_cgx_config_rxtx(struct rvu *rvu, u16 pcifunc, bool start)
|
||||
{
|
||||
int pf = rvu_get_pf(pcifunc);
|
||||
struct mac_ops *mac_ops;
|
||||
u8 cgx_id, lmac_id;
|
||||
void *cgxd;
|
||||
|
||||
if (!is_cgx_config_permitted(rvu, pcifunc))
|
||||
return LMAC_AF_ERR_PERM_DENIED;
|
||||
|
||||
rvu_get_cgx_lmac_id(rvu->pf2cgxlmac_map[pf], &cgx_id, &lmac_id);
|
||||
cgxd = rvu_cgx_pdata(cgx_id, rvu);
|
||||
mac_ops = get_mac_ops(cgxd);
|
||||
|
||||
cgx_lmac_rx_tx_enable(rvu_cgx_pdata(cgx_id, rvu), lmac_id, start);
|
||||
return mac_ops->mac_rx_tx_enable(cgxd, lmac_id, start);
|
||||
}
|
||||
|
||||
return 0;
|
||||
int rvu_cgx_config_tx(void *cgxd, int lmac_id, bool enable)
|
||||
{
|
||||
struct mac_ops *mac_ops;
|
||||
|
||||
mac_ops = get_mac_ops(cgxd);
|
||||
return mac_ops->mac_tx_enable(cgxd, lmac_id, enable);
|
||||
}
|
||||
|
||||
void rvu_cgx_disable_dmac_entries(struct rvu *rvu, u16 pcifunc)
|
||||
|
@ -2068,8 +2068,8 @@ static int nix_smq_flush(struct rvu *rvu, int blkaddr,
|
||||
/* enable cgx tx if disabled */
|
||||
if (is_pf_cgxmapped(rvu, pf)) {
|
||||
rvu_get_cgx_lmac_id(rvu->pf2cgxlmac_map[pf], &cgx_id, &lmac_id);
|
||||
restore_tx_en = !cgx_lmac_tx_enable(rvu_cgx_pdata(cgx_id, rvu),
|
||||
lmac_id, true);
|
||||
restore_tx_en = !rvu_cgx_config_tx(rvu_cgx_pdata(cgx_id, rvu),
|
||||
lmac_id, true);
|
||||
}
|
||||
|
||||
cfg = rvu_read64(rvu, blkaddr, NIX_AF_SMQX_CFG(smq));
|
||||
@ -2092,7 +2092,7 @@ static int nix_smq_flush(struct rvu *rvu, int blkaddr,
|
||||
rvu_cgx_enadis_rx_bp(rvu, pf, true);
|
||||
/* restore cgx tx state */
|
||||
if (restore_tx_en)
|
||||
cgx_lmac_tx_enable(rvu_cgx_pdata(cgx_id, rvu), lmac_id, false);
|
||||
rvu_cgx_config_tx(rvu_cgx_pdata(cgx_id, rvu), lmac_id, false);
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -3878,7 +3878,7 @@ nix_config_link_credits(struct rvu *rvu, int blkaddr, int link,
|
||||
/* Enable cgx tx if disabled for credits to be back */
|
||||
if (is_pf_cgxmapped(rvu, pf)) {
|
||||
rvu_get_cgx_lmac_id(rvu->pf2cgxlmac_map[pf], &cgx_id, &lmac_id);
|
||||
restore_tx_en = !cgx_lmac_tx_enable(rvu_cgx_pdata(cgx_id, rvu),
|
||||
restore_tx_en = !rvu_cgx_config_tx(rvu_cgx_pdata(cgx_id, rvu),
|
||||
lmac_id, true);
|
||||
}
|
||||
|
||||
@ -3918,7 +3918,7 @@ exit:
|
||||
|
||||
/* Restore state of cgx tx */
|
||||
if (restore_tx_en)
|
||||
cgx_lmac_tx_enable(rvu_cgx_pdata(cgx_id, rvu), lmac_id, false);
|
||||
rvu_cgx_config_tx(rvu_cgx_pdata(cgx_id, rvu), lmac_id, false);
|
||||
|
||||
mutex_unlock(&rvu->rsrc_lock);
|
||||
return rc;
|
||||
|
Loading…
Reference in New Issue
Block a user