Introducing a new Mailbox for registering base device behind
all representors and also registering debug log type for representors
and base device driver.

Signed-off-by: Harman Kalra <hka...@marvell.com>
---
 doc/guides/nics/cnxk.rst            |  4 ++++
 drivers/common/cnxk/roc_constants.h |  1 +
 drivers/common/cnxk/roc_mbox.h      |  8 ++++++++
 drivers/common/cnxk/roc_nix.c       | 31 +++++++++++++++++++++++++++++
 drivers/common/cnxk/roc_nix.h       |  3 +++
 drivers/common/cnxk/roc_platform.c  |  2 ++
 drivers/common/cnxk/roc_platform.h  |  4 ++++
 drivers/common/cnxk/version.map     |  3 +++
 8 files changed, 56 insertions(+)

diff --git a/doc/guides/nics/cnxk.rst b/doc/guides/nics/cnxk.rst
index 9ec52e380f..58cb8e2283 100644
--- a/doc/guides/nics/cnxk.rst
+++ b/doc/guides/nics/cnxk.rst
@@ -627,3 +627,7 @@ Debugging Options
    +---+------------+-------------------------------------------------------+
    | 2 | NPC        | --log-level='pmd\.net.cnxk\.flow,8'                   |
    +---+------------+-------------------------------------------------------+
+   | 3 | REP        | --log-level='pmd\.net.cnxk\.rep,8'                    |
+   +---+------------+-------------------------------------------------------+
+   | 4 | ESW        | --log-level='pmd\.net.cnxk\.esw,8'                    |
+   +---+------------+-------------------------------------------------------+
diff --git a/drivers/common/cnxk/roc_constants.h 
b/drivers/common/cnxk/roc_constants.h
index 291b6a4bc9..cb4edbea58 100644
--- a/drivers/common/cnxk/roc_constants.h
+++ b/drivers/common/cnxk/roc_constants.h
@@ -43,6 +43,7 @@
 #define PCI_DEVID_CNXK_RVU_NIX_INL_VF 0xA0F1
 #define PCI_DEVID_CNXK_RVU_REE_PF     0xA0f4
 #define PCI_DEVID_CNXK_RVU_REE_VF     0xA0f5
+#define PCI_DEVID_CNXK_RVU_ESWITCH_PF 0xA0E0
 
 #define PCI_DEVID_CN9K_CGX  0xA059
 #define PCI_DEVID_CN10K_RPM 0xA060
diff --git a/drivers/common/cnxk/roc_mbox.h b/drivers/common/cnxk/roc_mbox.h
index 3257a370bc..b7e2f43d45 100644
--- a/drivers/common/cnxk/roc_mbox.h
+++ b/drivers/common/cnxk/roc_mbox.h
@@ -68,6 +68,7 @@ struct mbox_msghdr {
        M(NDC_SYNC_OP, 0x009, ndc_sync_op, ndc_sync_op, msg_rsp)               \
        M(LMTST_TBL_SETUP, 0x00a, lmtst_tbl_setup, lmtst_tbl_setup_req,        \
          msg_rsp)                                                             \
+       M(GET_REP_CNT, 0x00d, get_rep_cnt, msg_req, get_rep_cnt_rsp)           \
        /* CGX mbox IDs (range 0x200 - 0x3FF) */                               \
        M(CGX_START_RXTX, 0x200, cgx_start_rxtx, msg_req, msg_rsp)             \
        M(CGX_STOP_RXTX, 0x201, cgx_stop_rxtx, msg_req, msg_rsp)               \
@@ -546,6 +547,13 @@ struct lmtst_tbl_setup_req {
        uint64_t __io rsvd[2]; /* Future use */
 };
 
+#define MAX_PFVF_REP 64
+struct get_rep_cnt_rsp {
+       struct mbox_msghdr hdr;
+       uint16_t __io rep_cnt;
+       uint16_t __io rep_pfvf_map[MAX_PFVF_REP];
+};
+
 /* CGX mbox message formats */
 /* CGX mailbox error codes
  * Range 1101 - 1200.
diff --git a/drivers/common/cnxk/roc_nix.c b/drivers/common/cnxk/roc_nix.c
index f64933a1d9..7e327a7e6e 100644
--- a/drivers/common/cnxk/roc_nix.c
+++ b/drivers/common/cnxk/roc_nix.c
@@ -531,3 +531,34 @@ roc_nix_dev_fini(struct roc_nix *roc_nix)
        rc |= dev_fini(&nix->dev, nix->pci_dev);
        return rc;
 }
+
+int
+roc_nix_max_rep_count(struct roc_nix *roc_nix)
+{
+       struct nix *nix = roc_nix_to_nix_priv(roc_nix);
+       struct dev *dev = &nix->dev;
+       struct mbox *mbox = mbox_get(dev->mbox);
+       struct get_rep_cnt_rsp *rsp;
+       struct msg_req *req;
+       int rc, i;
+
+       req = mbox_alloc_msg_get_rep_cnt(mbox);
+       if (!req) {
+               rc = -ENOSPC;
+               goto exit;
+       }
+
+       req->hdr.pcifunc = roc_nix_get_pf_func(roc_nix);
+
+       rc = mbox_process_msg(mbox, (void *)&rsp);
+       if (rc)
+               goto exit;
+
+       roc_nix->rep_cnt = rsp->rep_cnt;
+       for (i = 0; i < rsp->rep_cnt; i++)
+               roc_nix->rep_pfvf_map[i] = rsp->rep_pfvf_map[i];
+
+exit:
+       mbox_put(mbox);
+       return rc;
+}
diff --git a/drivers/common/cnxk/roc_nix.h b/drivers/common/cnxk/roc_nix.h
index 84e6fc3df5..b369335fc4 100644
--- a/drivers/common/cnxk/roc_nix.h
+++ b/drivers/common/cnxk/roc_nix.h
@@ -483,6 +483,8 @@ struct roc_nix {
        uint32_t buf_sz;
        uint64_t meta_aura_handle;
        uintptr_t meta_mempool;
+       uint16_t rep_cnt;
+       uint16_t rep_pfvf_map[MAX_PFVF_REP];
        TAILQ_ENTRY(roc_nix) next;
 
 #define ROC_NIX_MEM_SZ (6 * 1070)
@@ -1013,4 +1015,5 @@ int __roc_api roc_nix_mcast_list_setup(struct mbox *mbox, 
uint8_t intf, int nb_e
                                       uint16_t *pf_funcs, uint16_t *channels, 
uint32_t *rqs,
                                       uint32_t *grp_index, uint32_t 
*start_index);
 int __roc_api roc_nix_mcast_list_free(struct mbox *mbox, uint32_t 
mcast_grp_index);
+int __roc_api roc_nix_max_rep_count(struct roc_nix *roc_nix);
 #endif /* _ROC_NIX_H_ */
diff --git a/drivers/common/cnxk/roc_platform.c 
b/drivers/common/cnxk/roc_platform.c
index 15cbb6d68f..181902a585 100644
--- a/drivers/common/cnxk/roc_platform.c
+++ b/drivers/common/cnxk/roc_platform.c
@@ -96,4 +96,6 @@ RTE_LOG_REGISTER_DEFAULT(cnxk_logtype_sso, NOTICE);
 RTE_LOG_REGISTER_DEFAULT(cnxk_logtype_tim, NOTICE);
 RTE_LOG_REGISTER_DEFAULT(cnxk_logtype_tm, NOTICE);
 RTE_LOG_REGISTER_DEFAULT(cnxk_logtype_dpi, NOTICE);
+RTE_LOG_REGISTER_DEFAULT(cnxk_logtype_rep, NOTICE);
+RTE_LOG_REGISTER_DEFAULT(cnxk_logtype_esw, NOTICE);
 RTE_LOG_REGISTER_DEFAULT(cnxk_logtype_ree, NOTICE);
diff --git a/drivers/common/cnxk/roc_platform.h 
b/drivers/common/cnxk/roc_platform.h
index ba23b2e0d7..e08eb7f6ba 100644
--- a/drivers/common/cnxk/roc_platform.h
+++ b/drivers/common/cnxk/roc_platform.h
@@ -264,6 +264,8 @@ extern int cnxk_logtype_tim;
 extern int cnxk_logtype_tm;
 extern int cnxk_logtype_ree;
 extern int cnxk_logtype_dpi;
+extern int cnxk_logtype_rep;
+extern int cnxk_logtype_esw;
 
 #define plt_err(fmt, args...)                                                  
\
        RTE_LOG(ERR, PMD, "%s():%u " fmt "\n", __func__, __LINE__, ##args)
@@ -293,6 +295,8 @@ extern int cnxk_logtype_dpi;
 #define plt_tm_dbg(fmt, ...)   plt_dbg(tm, fmt, ##__VA_ARGS__)
 #define plt_ree_dbg(fmt, ...)  plt_dbg(ree, fmt, ##__VA_ARGS__)
 #define plt_dpi_dbg(fmt, ...)  plt_dbg(dpi, fmt, ##__VA_ARGS__)
+#define plt_rep_dbg(fmt, ...)  plt_dbg(rep, fmt, ##__VA_ARGS__)
+#define plt_esw_dbg(fmt, ...)  plt_dbg(esw, fmt, ##__VA_ARGS__)
 
 /* Datapath logs */
 #define plt_dp_err(fmt, args...)                                               
\
diff --git a/drivers/common/cnxk/version.map b/drivers/common/cnxk/version.map
index 7b6afa63a9..bd28803013 100644
--- a/drivers/common/cnxk/version.map
+++ b/drivers/common/cnxk/version.map
@@ -8,12 +8,14 @@ INTERNAL {
        cnxk_logtype_base;
        cnxk_logtype_cpt;
        cnxk_logtype_dpi;
+       cnxk_logtype_esw;
        cnxk_logtype_mbox;
        cnxk_logtype_ml;
        cnxk_logtype_nix;
        cnxk_logtype_npa;
        cnxk_logtype_npc;
        cnxk_logtype_ree;
+       cnxk_logtype_rep;
        cnxk_logtype_sso;
        cnxk_logtype_tim;
        cnxk_logtype_tm;
@@ -216,6 +218,7 @@ INTERNAL {
        roc_nix_get_base_chan;
        roc_nix_get_pf;
        roc_nix_get_pf_func;
+       roc_nix_max_rep_count;
        roc_nix_get_rx_chan_cnt;
        roc_nix_get_vf;
        roc_nix_get_vwqe_interval;
-- 
2.18.0

Reply via email to