X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Focteontx2%2Fotx2_flow_ctrl.c;h=76bf48100183ec53051683a078f97165b4a4280f;hb=397b4b3c509574a55c58ae161f5a01cc8a4da56a;hp=c6d7b1971ae7f4dbd3db943fb9d35e63f63f4bc9;hpb=c261680cdb82996d30261c1eb4eb762c23ee842e;p=dpdk.git diff --git a/drivers/net/octeontx2/otx2_flow_ctrl.c b/drivers/net/octeontx2/otx2_flow_ctrl.c index c6d7b1971a..76bf481001 100644 --- a/drivers/net/octeontx2/otx2_flow_ctrl.c +++ b/drivers/net/octeontx2/otx2_flow_ctrl.c @@ -200,19 +200,18 @@ int otx2_nix_update_flow_ctrl_mode(struct rte_eth_dev *eth_dev) { struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev); + struct otx2_fc_info *fc = &dev->fc_info; struct rte_eth_fc_conf fc_conf; if (otx2_dev_is_lbk(dev) || otx2_dev_is_sdp(dev)) return 0; memset(&fc_conf, 0, sizeof(struct rte_eth_fc_conf)); - /* Both Rx & Tx flow ctrl get enabled(RTE_FC_FULL) in HW - * by AF driver, update those info in PMD structure. - */ - otx2_nix_flow_ctrl_get(eth_dev, &fc_conf); + fc_conf.mode = fc->mode; /* To avoid Link credit deadlock on Ax, disable Tx FC if it's enabled */ if (otx2_dev_is_Ax(dev) && + (dev->npc_flow.switch_header_type != OTX2_PRIV_FLAGS_HIGIG) && (fc_conf.mode == RTE_FC_FULL || fc_conf.mode == RTE_FC_RX_PAUSE)) { fc_conf.mode = (fc_conf.mode == RTE_FC_FULL || @@ -222,3 +221,32 @@ otx2_nix_update_flow_ctrl_mode(struct rte_eth_dev *eth_dev) return otx2_nix_flow_ctrl_set(eth_dev, &fc_conf); } + +int +otx2_nix_flow_ctrl_init(struct rte_eth_dev *eth_dev) +{ + struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev); + struct otx2_fc_info *fc = &dev->fc_info; + struct rte_eth_fc_conf fc_conf; + int rc; + + if (otx2_dev_is_lbk(dev) || otx2_dev_is_sdp(dev)) + return 0; + + memset(&fc_conf, 0, sizeof(struct rte_eth_fc_conf)); + /* Both Rx & Tx flow ctrl get enabled(RTE_FC_FULL) in HW + * by AF driver, update those info in PMD structure. + */ + rc = otx2_nix_flow_ctrl_get(eth_dev, &fc_conf); + if (rc) + goto exit; + + fc->mode = fc_conf.mode; + fc->rx_pause = (fc_conf.mode == RTE_FC_FULL) || + (fc_conf.mode == RTE_FC_RX_PAUSE); + fc->tx_pause = (fc_conf.mode == RTE_FC_FULL) || + (fc_conf.mode == RTE_FC_TX_PAUSE); + +exit: + return rc; +}