octeontx2-af: Support to get NIX HW constants from AF
authorKiran Kumar <kirankumark@marvell.com>
Mon, 19 Nov 2018 10:47:25 +0000 (16:17 +0530)
committerDavid S. Miller <davem@davemloft.net>
Tue, 20 Nov 2018 01:56:07 +0000 (17:56 -0800)
This patch adds reading HW limits like number of Rx/Tx stats,
number of queue IRQs supported per NIX LF from AF registers
and sync them to PF/VF.

Signed-off-by: Kiran Kumar <kirankumark@marvell.com>
Signed-off-by: Sunil Goutham <sgoutham@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/marvell/octeontx2/af/mbox.h
drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c

index 1e362d4587686650d22d71165cea146e32ef3db3..7a229a54b9a36f349646793e8e827a4b122efb6a 100644 (file)
@@ -398,6 +398,10 @@ struct nix_lf_alloc_rsp {
        u8      lso_tsov4_idx;
        u8      lso_tsov6_idx;
        u8      mac_addr[ETH_ALEN];
+       u8      lf_rx_stats; /* NIX_AF_CONST1::LF_RX_STATS */
+       u8      lf_tx_stats; /* NIX_AF_CONST1::LF_TX_STATS */
+       u16     cints; /* NIX_AF_CONST2::CINTS */
+       u16     qints; /* NIX_AF_CONST2::QINTS */
 };
 
 /* NIX AQ enqueue msg */
index e010fe7982093db5bff661b7ed818f907f6e07b9..c779a0a2166d1b7dfc3f0b7d90b58cb758872e1d 100644 (file)
@@ -829,6 +829,14 @@ exit:
        rsp->tx_chan_cnt = pfvf->tx_chan_cnt;
        rsp->lso_tsov4_idx = NIX_LSO_FORMAT_IDX_TSOV4;
        rsp->lso_tsov6_idx = NIX_LSO_FORMAT_IDX_TSOV6;
+       /* Get HW supported stat count */
+       cfg = rvu_read64(rvu, blkaddr, NIX_AF_CONST1);
+       rsp->lf_rx_stats = ((cfg >> 32) & 0xFF);
+       rsp->lf_tx_stats = ((cfg >> 24) & 0xFF);
+       /* Get count of CQ IRQs and error IRQs supported per LF */
+       cfg = rvu_read64(rvu, blkaddr, NIX_AF_CONST2);
+       rsp->qints = ((cfg >> 12) & 0xFFF);
+       rsp->cints = ((cfg >> 24) & 0xFFF);
        return rc;
 }