]> git.baikalelectronics.ru Git - kernel.git/commitdiff
octeontx2-pf: Calculate LBK link instead of hardcoding
authorSubbaraya Sundeep <sbhatta@marvell.com>
Thu, 29 Oct 2020 05:15:47 +0000 (10:45 +0530)
committerJakub Kicinski <kuba@kernel.org>
Sat, 31 Oct 2020 21:16:47 +0000 (14:16 -0700)
CGX links are followed by LBK links but number of
CGX and LBK links varies between platforms. Hence
get the number of links present in hardware from
AF and use it to calculate LBK link number.

Signed-off-by: Subbaraya Sundeep <sbhatta@marvell.com>
Signed-off-by: Sunil Goutham <sgoutham@marvell.com>
Signed-off-by: Rakesh Babu <rsaladi2@marvell.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h

index d2581090f9a408be5f5c5b77d26e0c1319f9b399..fc765e86988e9f3ea6e89ed589d4e620129f5bc2 100644 (file)
@@ -531,8 +531,10 @@ static int otx2_get_link(struct otx2_nic *pfvf)
                link = 4 * ((map >> 8) & 0xF) + ((map >> 4) & 0xF);
        }
        /* LBK channel */
-       if (pfvf->hw.tx_chan_base < SDP_CHAN_BASE)
-               link = 12;
+       if (pfvf->hw.tx_chan_base < SDP_CHAN_BASE) {
+               map = pfvf->hw.tx_chan_base & 0x7FF;
+               link = pfvf->hw.cgx_links | ((map >> 8) & 0xF);
+       }
 
        return link;
 }
@@ -1503,6 +1505,8 @@ void mbox_handler_nix_lf_alloc(struct otx2_nic *pfvf,
        pfvf->hw.tx_chan_base = rsp->tx_chan_base;
        pfvf->hw.lso_tsov4_idx = rsp->lso_tsov4_idx;
        pfvf->hw.lso_tsov6_idx = rsp->lso_tsov6_idx;
+       pfvf->hw.cgx_links = rsp->cgx_links;
+       pfvf->hw.lbk_links = rsp->lbk_links;
 }
 EXPORT_SYMBOL(mbox_handler_nix_lf_alloc);
 
index d6253f2a414d39c496da64405df8d2dfd13f7a32..386cb08497e48fa89b8fac3445b1811e45123718 100644 (file)
@@ -197,6 +197,8 @@ struct otx2_hw {
        struct otx2_drv_stats   drv_stats;
        u64                     cgx_rx_stats[CGX_RX_STATS_COUNT];
        u64                     cgx_tx_stats[CGX_TX_STATS_COUNT];
+       u8                      cgx_links;  /* No. of CGX links present in HW */
+       u8                      lbk_links;  /* No. of LBK links present in HW */
 };
 
 struct otx2_vf_config {