From: Tomasz Duszynski Date: Thu, 15 Jul 2021 13:53:30 +0000 (-0500) Subject: raw/cnxk_bphy: support setting FEC X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=1409edec9e5f76d236e2c6330c8765859d1a3161;p=dpdk.git raw/cnxk_bphy: support setting FEC Add support for setting FEC for a given LMAC. Signed-off-by: Tomasz Duszynski --- diff --git a/drivers/raw/cnxk_bphy/cnxk_bphy_cgx.c b/drivers/raw/cnxk_bphy/cnxk_bphy_cgx.c index 693a9cd2d5..ade45ab741 100644 --- a/drivers/raw/cnxk_bphy/cnxk_bphy_cgx.c +++ b/drivers/raw/cnxk_bphy/cnxk_bphy_cgx.c @@ -131,6 +131,10 @@ cnxk_bphy_cgx_process_buf(struct cnxk_bphy_cgx *cgx, unsigned int queue, ret = roc_bphy_cgx_fec_supported_get(cgx->rcgx, lmac, fec); rsp = fec; break; + case CNXK_BPHY_CGX_MSG_TYPE_SET_FEC: + fec = msg->data; + ret = roc_bphy_cgx_fec_set(cgx->rcgx, lmac, *fec); + break; default: return -EINVAL; } diff --git a/drivers/raw/cnxk_bphy/cnxk_bphy_cgx_test.c b/drivers/raw/cnxk_bphy/cnxk_bphy_cgx_test.c index cd3e6b2e97..d96e98661f 100644 --- a/drivers/raw/cnxk_bphy/cnxk_bphy_cgx_test.c +++ b/drivers/raw/cnxk_bphy/cnxk_bphy_cgx_test.c @@ -221,6 +221,25 @@ cnxk_bphy_cgx_dev_selftest(uint16_t dev_id) RTE_LOG(ERR, PMD, "Failed to get supported FEC\n"); break; } + + /* set supported fec */ + msg.type = CNXK_BPHY_CGX_MSG_TYPE_SET_FEC; + msg.data = &fec; + ret = cnxk_bphy_cgx_enq_msg(dev_id, i, &msg); + if (ret) { + RTE_LOG(ERR, PMD, "Failed to set FEC to %d\n", fec); + break; + } + + /* disable fec */ + fec = CNXK_BPHY_CGX_ETH_LINK_FEC_NONE; + msg.type = CNXK_BPHY_CGX_MSG_TYPE_SET_FEC; + msg.data = &fec; + ret = cnxk_bphy_cgx_enq_msg(dev_id, i, &msg); + if (ret) { + RTE_LOG(ERR, PMD, "Failed to disable FEC\n"); + break; + } } rte_rawdev_stop(dev_id); diff --git a/drivers/raw/cnxk_bphy/rte_pmd_bphy.h b/drivers/raw/cnxk_bphy/rte_pmd_bphy.h index 0737964149..d459c3a862 100644 --- a/drivers/raw/cnxk_bphy/rte_pmd_bphy.h +++ b/drivers/raw/cnxk_bphy/rte_pmd_bphy.h @@ -18,6 +18,7 @@ enum cnxk_bphy_cgx_msg_type { CNXK_BPHY_CGX_MSG_TYPE_START_RXTX, CNXK_BPHY_CGX_MSG_TYPE_STOP_RXTX, CNXK_BPHY_CGX_MSG_TYPE_GET_SUPPORTED_FEC, + CNXK_BPHY_CGX_MSG_TYPE_SET_FEC, }; enum cnxk_bphy_cgx_eth_link_speed {