From: Nithin Dabilpuram Date: Tue, 2 Nov 2021 15:54:19 +0000 (+0530) Subject: net/cnxk: allow FC on LBK and enable TM BP on Rx pause X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=dfe5f0a1f554d2a74495308298927c628eeb275a;p=dpdk.git net/cnxk: allow FC on LBK and enable TM BP on Rx pause Allow flow control on LBK VF's and enable TM to listen on backpressure when Rx pause is enabled. Signed-off-by: Nithin Dabilpuram Acked-by: Jerin Jacob --- diff --git a/drivers/net/cnxk/cnxk_ethdev.c b/drivers/net/cnxk/cnxk_ethdev.c index 5059fcaff4..a62ded6b47 100644 --- a/drivers/net/cnxk/cnxk_ethdev.c +++ b/drivers/net/cnxk/cnxk_ethdev.c @@ -332,7 +332,7 @@ nix_update_flow_ctrl_config(struct rte_eth_dev *eth_dev) struct cnxk_fc_cfg *fc = &dev->fc_cfg; struct rte_eth_fc_conf fc_cfg = {0}; - if (roc_nix_is_vf_or_sdp(&dev->nix)) + if (roc_nix_is_vf_or_sdp(&dev->nix) && !roc_nix_is_lbk(&dev->nix)) return 0; fc_cfg.mode = fc->mode; @@ -1233,6 +1233,11 @@ cnxk_nix_configure(struct rte_eth_dev *eth_dev) goto cq_fini; } + /* Setup Inline security support */ + rc = nix_security_setup(dev); + if (rc) + goto cq_fini; + /* Init flow control configuration */ fc_cfg.type = ROC_NIX_FC_RXCHAN_CFG; fc_cfg.rxchan_cfg.enable = true; @@ -1249,11 +1254,6 @@ cnxk_nix_configure(struct rte_eth_dev *eth_dev) goto cq_fini; } - /* Setup Inline security support */ - rc = nix_security_setup(dev); - if (rc) - goto cq_fini; - /* * Restore queue config when reconfigure followed by * reconfigure and no queue configure invoked from application case. diff --git a/drivers/net/cnxk/cnxk_ethdev_ops.c b/drivers/net/cnxk/cnxk_ethdev_ops.c index e0696f1ae5..ce5f1f7240 100644 --- a/drivers/net/cnxk/cnxk_ethdev_ops.c +++ b/drivers/net/cnxk/cnxk_ethdev_ops.c @@ -251,7 +251,7 @@ cnxk_nix_flow_ctrl_set(struct rte_eth_dev *eth_dev, uint8_t rx_pause, tx_pause; int rc, i; - if (roc_nix_is_vf_or_sdp(nix)) { + if (roc_nix_is_vf_or_sdp(nix) && !roc_nix_is_lbk(nix)) { plt_err("Flow control configuration is not allowed on VFs"); return -ENOTSUP; } @@ -288,6 +288,18 @@ cnxk_nix_flow_ctrl_set(struct rte_eth_dev *eth_dev, } } + /* Check if RX pause frame is enabled or not */ + if (fc->rx_pause ^ rx_pause) { + struct roc_nix_fc_cfg fc_cfg; + + memset(&fc_cfg, 0, sizeof(struct roc_nix_fc_cfg)); + fc_cfg.type = ROC_NIX_FC_TM_CFG; + fc_cfg.tm_cfg.enable = !!rx_pause; + rc = roc_nix_fc_config_set(nix, &fc_cfg); + if (rc) + return rc; + } + rc = roc_nix_fc_mode_set(nix, mode_map[fc_conf->mode]); if (rc) return rc;