]> git.droids-corp.org - dpdk.git/commitdiff
common/cnxk: support flow control on loopback interface
authorNithin Dabilpuram <ndabilpuram@marvell.com>
Tue, 2 Nov 2021 15:54:14 +0000 (21:24 +0530)
committerJerin Jacob <jerinj@marvell.com>
Wed, 3 Nov 2021 15:05:47 +0000 (16:05 +0100)
Support flow control enable/disable on LBK VF's as HW
supports backpressure on LBK links.

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
drivers/common/cnxk/roc_nix.c
drivers/common/cnxk/roc_nix_fc.c

index 949be80ed9e79601cc2c0c9097c852661d846143..fbfc550beaba7a9ecba561d3bab38fd4271d1ad0 100644 (file)
@@ -414,6 +414,12 @@ skip_dev_init:
        nix->reta_sz = reta_sz;
        nix->mtu = ROC_NIX_DEFAULT_HW_FRS;
 
+       /* Always start with full FC for LBK */
+       if (nix->lbk_link) {
+               nix->rx_pause = 1;
+               nix->tx_pause = 1;
+       }
+
        /* Register error and ras interrupts */
        rc = nix_register_irqs(nix);
        if (rc)
index 7eac7d01d4b4f86ddad5b95d5f7773e2b2bda573..ef46842bfab3e7020d4d9f2384a9d2aa43634f6a 100644 (file)
@@ -157,7 +157,7 @@ nix_fc_cq_config_set(struct roc_nix *roc_nix, struct roc_nix_fc_cfg *fc_cfg)
 int
 roc_nix_fc_config_get(struct roc_nix *roc_nix, struct roc_nix_fc_cfg *fc_cfg)
 {
-       if (roc_nix_is_vf_or_sdp(roc_nix))
+       if (roc_nix_is_vf_or_sdp(roc_nix) && !roc_nix_is_lbk(roc_nix))
                return 0;
 
        if (fc_cfg->cq_cfg_valid)
@@ -169,7 +169,7 @@ roc_nix_fc_config_get(struct roc_nix *roc_nix, struct roc_nix_fc_cfg *fc_cfg)
 int
 roc_nix_fc_config_set(struct roc_nix *roc_nix, struct roc_nix_fc_cfg *fc_cfg)
 {
-       if (roc_nix_is_vf_or_sdp(roc_nix))
+       if (roc_nix_is_vf_or_sdp(roc_nix) && !roc_nix_is_lbk(roc_nix))
                return 0;
 
        if (fc_cfg->cq_cfg_valid)
@@ -188,8 +188,17 @@ roc_nix_fc_mode_get(struct roc_nix *roc_nix)
        enum roc_nix_fc_mode mode;
        int rc = -ENOSPC;
 
-       if (roc_nix_is_lbk(roc_nix))
-               return ROC_NIX_FC_NONE;
+       /* Flow control on LBK link is always available */
+       if (roc_nix_is_lbk(roc_nix)) {
+               if (nix->tx_pause && nix->rx_pause)
+                       return ROC_NIX_FC_FULL;
+               else if (nix->rx_pause)
+                       return ROC_NIX_FC_RX;
+               else if (nix->tx_pause)
+                       return ROC_NIX_FC_TX;
+               else
+                       return ROC_NIX_FC_NONE;
+       }
 
        req = mbox_alloc_msg_cgx_cfg_pause_frm(mbox);
        if (req == NULL)
@@ -226,12 +235,16 @@ roc_nix_fc_mode_set(struct roc_nix *roc_nix, enum roc_nix_fc_mode mode)
        uint8_t tx_pause, rx_pause;
        int rc = -ENOSPC;
 
-       if (roc_nix_is_lbk(roc_nix))
-               return NIX_ERR_OP_NOTSUP;
-
        rx_pause = (mode == ROC_NIX_FC_FULL) || (mode == ROC_NIX_FC_RX);
        tx_pause = (mode == ROC_NIX_FC_FULL) || (mode == ROC_NIX_FC_TX);
 
+       /* Nothing much to do for LBK links */
+       if (roc_nix_is_lbk(roc_nix)) {
+               nix->rx_pause = rx_pause;
+               nix->tx_pause = tx_pause;
+               return 0;
+       }
+
        req = mbox_alloc_msg_cgx_cfg_pause_frm(mbox);
        if (req == NULL)
                return rc;