* [PATCH] event/cnxk: add SLMTST support to Tx adapter
@ 2022-04-27 7:06 Pavan Nikhilesh
2022-04-27 9:00 ` Ray Kinsella
0 siblings, 1 reply; 2+ messages in thread
From: Pavan Nikhilesh @ 2022-04-27 7:06 UTC (permalink / raw)
To: jerinj, Nithin Dabilpuram, Kiran Kumar K, Sunil Kumar Kori,
Satha Rao, Ray Kinsella, Pavan Nikhilesh, Shijith Thotton
Cc: dev
Scheduled LMTST uses in-core LSW (LMTST scheduling widget) to
coordinate with SSO and send a LMTST to the destination
coprocessor without the need for the core to be the head of
the scheduling context it is currently holding.
Use SLMTST to send mbuf to NIX-TX for transmit. SLMTST only
supports transmitting a single WQE.
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
---
Depends-on: Series-22634
drivers/common/cnxk/hw/ssow.h | 7 +++++++
drivers/common/cnxk/roc_dev_priv.h | 6 ++++++
drivers/common/cnxk/roc_io.h | 8 ++++++++
drivers/common/cnxk/roc_io_generic.h | 7 +++++++
drivers/common/cnxk/roc_nix.c | 19 +++++++++++++++++++
drivers/common/cnxk/roc_nix.h | 4 ++++
drivers/common/cnxk/roc_sso.c | 23 +++++++++++++++++++++++
drivers/common/cnxk/roc_sso.h | 2 ++
drivers/common/cnxk/version.map | 2 ++
drivers/event/cnxk/cn10k_eventdev.c | 11 +++++++++++
drivers/event/cnxk/cn10k_worker.h | 19 +++++++++++++------
drivers/event/cnxk/cnxk_eventdev.h | 2 +-
12 files changed, 103 insertions(+), 7 deletions(-)
diff --git a/drivers/common/cnxk/hw/ssow.h b/drivers/common/cnxk/hw/ssow.h
index 618ab7973b..b40238bc6c 100644
--- a/drivers/common/cnxk/hw/ssow.h
+++ b/drivers/common/cnxk/hw/ssow.h
@@ -62,6 +62,13 @@
#define SSOW_GW_RESULT_GW_NO_WORK (0x1ull) /* [CN10K, .) */
#define SSOW_GW_RESULT_GW_ERROR (0x2ull) /* [CN10K, .) */
+#define SSOW_LSW_MODE_NO_LSW (0x0)
+#define SSOW_LSW_MODE_WAIT (0x1)
+#define SSOW_LSW_MODE_IMMED (0x2)
+
+#define SSOW_LSW_WQE_RELEASE_WAIT_ACK (0x0)
+#define SSOW_LSW_WQE_RELEASE_IMMED (0x1)
+
#define SSOW_LF_GWS_TAG_PEND_GET_WORK_BIT 63
#define SSOW_LF_GWS_TAG_PEND_SWITCH_BIT 62
#define SSOW_LF_GWS_TAG_PEND_DESCHED_BIT 58
diff --git a/drivers/common/cnxk/roc_dev_priv.h b/drivers/common/cnxk/roc_dev_priv.h
index 302dc0feb0..e301487f4c 100644
--- a/drivers/common/cnxk/roc_dev_priv.h
+++ b/drivers/common/cnxk/roc_dev_priv.h
@@ -54,6 +54,12 @@ dev_get_pf(uint16_t pf_func)
return (pf_func >> RVU_PFVF_PF_SHIFT) & RVU_PFVF_PF_MASK;
}
+static inline int
+dev_get_func(uint16_t pf_func)
+{
+ return (pf_func >> RVU_PFVF_FUNC_SHIFT) & RVU_PFVF_FUNC_MASK;
+}
+
static inline int
dev_pf_func(int pf, int vf)
{
diff --git a/drivers/common/cnxk/roc_io.h b/drivers/common/cnxk/roc_io.h
index 62e98d9d00..6a76e3fa71 100644
--- a/drivers/common/cnxk/roc_io.h
+++ b/drivers/common/cnxk/roc_io.h
@@ -154,6 +154,14 @@ roc_lmt_submit_steorl(uint64_t data, plt_iova_t io_address)
[rs] "r"(io_address));
}
+static __plt_always_inline void
+roc_lmt_submit_stsmaxl(uint64_t data, plt_iova_t io_address)
+{
+ asm volatile(".cpu generic+lse\n"
+ "stsmaxl %x[d], [%[rs]]" ::[d] "r"(data),
+ [rs] "r"(io_address));
+}
+
static __plt_always_inline void
roc_lmt_mov(void *out, const void *in, const uint32_t lmtext)
{
diff --git a/drivers/common/cnxk/roc_io_generic.h b/drivers/common/cnxk/roc_io_generic.h
index 42764455cc..097ed8af09 100644
--- a/drivers/common/cnxk/roc_io_generic.h
+++ b/drivers/common/cnxk/roc_io_generic.h
@@ -98,6 +98,13 @@ roc_lmt_submit_steorl(uint64_t data, plt_iova_t io_address)
PLT_SET_USED(io_address);
}
+static __plt_always_inline void
+roc_lmt_submit_stsmaxl(uint64_t data, plt_iova_t io_address)
+{
+ PLT_SET_USED(data);
+ PLT_SET_USED(io_address);
+}
+
static __plt_always_inline void
roc_lmt_mov(void *out, const void *in, const uint32_t lmtext)
{
diff --git a/drivers/common/cnxk/roc_nix.c b/drivers/common/cnxk/roc_nix.c
index 151d8c3426..16d707b5ff 100644
--- a/drivers/common/cnxk/roc_nix.c
+++ b/drivers/common/cnxk/roc_nix.c
@@ -139,6 +139,25 @@ roc_nix_max_pkt_len(struct roc_nix *roc_nix)
return NIX_RPM_MAX_HW_FRS;
}
+int
+roc_nix_sched_lmt_enable(struct roc_nix *roc_nix)
+{
+ struct nix *nix = roc_nix_to_nix_priv(roc_nix);
+ struct mbox *mbox = (&nix->dev)->mbox;
+ struct lmtst_tbl_setup_req *req;
+
+ req = mbox_alloc_msg_lmtst_tbl_setup(mbox);
+ if (req == NULL)
+ return -ENOSPC;
+ req->pcifunc = 0;
+ req->ssow_pf_func = dev_get_pf(idev_sso_pffunc_get()) << 8;
+ req->ssow_pf_func |=
+ (uint64_t)(dev_get_func(idev_sso_pffunc_get()) & 0xFF);
+ req->sched_ena = 1;
+
+ return mbox_process(mbox);
+}
+
int
roc_nix_lf_alloc(struct roc_nix *roc_nix, uint32_t nb_rxq, uint32_t nb_txq,
uint64_t rx_cfg)
diff --git a/drivers/common/cnxk/roc_nix.h b/drivers/common/cnxk/roc_nix.h
index dbb816d961..b985fb5df4 100644
--- a/drivers/common/cnxk/roc_nix.h
+++ b/drivers/common/cnxk/roc_nix.h
@@ -904,4 +904,8 @@ int __roc_api roc_nix_mcast_mcam_entry_write(struct roc_nix *roc_nix,
uint64_t action);
int __roc_api roc_nix_mcast_mcam_entry_ena_dis(struct roc_nix *roc_nix,
uint32_t index, bool enable);
+
+/* SSO */
+int __roc_api roc_nix_sched_lmt_enable(struct roc_nix *roc_nix);
+
#endif /* _ROC_NIX_H_ */
diff --git a/drivers/common/cnxk/roc_sso.c b/drivers/common/cnxk/roc_sso.c
index f8a0a96533..1b76b439d0 100644
--- a/drivers/common/cnxk/roc_sso.c
+++ b/drivers/common/cnxk/roc_sso.c
@@ -344,6 +344,29 @@ roc_sso_hwgrp_stats_get(struct roc_sso *roc_sso, uint8_t hwgrp,
return 0;
}
+int
+roc_sso_hws_config_lsw(struct roc_sso *roc_sso, uint8_t lsw_mode,
+ uint8_t wqe_release_mode)
+{
+ struct dev *dev = &roc_sso_to_sso_priv(roc_sso)->dev;
+ struct ssow_config_lsw *req;
+
+ if (lsw_mode > SSOW_LSW_MODE_IMMED ||
+ wqe_release_mode > SSOW_LSW_WQE_RELEASE_IMMED)
+ return -EINVAL;
+
+ req = mbox_alloc_msg_ssow_config_lsw(dev->mbox);
+ if (req == NULL)
+ return -ENOSPC;
+
+ req->lsw_mode = lsw_mode;
+ req->wqe_release = wqe_release_mode;
+ if (mbox_process(dev->mbox) < 0)
+ return -EIO;
+
+ return 0;
+}
+
int
roc_sso_hwgrp_hws_link_status(struct roc_sso *roc_sso, uint8_t hws,
uint16_t hwgrp)
diff --git a/drivers/common/cnxk/roc_sso.h b/drivers/common/cnxk/roc_sso.h
index ab7cee1c60..4548f78602 100644
--- a/drivers/common/cnxk/roc_sso.h
+++ b/drivers/common/cnxk/roc_sso.h
@@ -102,6 +102,8 @@ int __roc_api roc_sso_hws_link(struct roc_sso *roc_sso, uint8_t hws,
uint16_t hwgrp[], uint16_t nb_hwgrp);
int __roc_api roc_sso_hws_unlink(struct roc_sso *roc_sso, uint8_t hws,
uint16_t hwgrp[], uint16_t nb_hwgrp);
+int __roc_api roc_sso_hws_config_lsw(struct roc_sso *roc_sso, uint8_t lsw_mode,
+ uint8_t wqe_release_mode);
int __roc_api roc_sso_hwgrp_hws_link_status(struct roc_sso *roc_sso,
uint8_t hws, uint16_t hwgrp);
uintptr_t __roc_api roc_sso_hws_base_get(struct roc_sso *roc_sso, uint8_t hws);
diff --git a/drivers/common/cnxk/version.map b/drivers/common/cnxk/version.map
index 2a122e544d..9c3fe1d31a 100644
--- a/drivers/common/cnxk/version.map
+++ b/drivers/common/cnxk/version.map
@@ -230,6 +230,7 @@ INTERNAL {
roc_nix_rx_drop_re_set;
roc_nix_rx_queue_intr_disable;
roc_nix_rx_queue_intr_enable;
+ roc_nix_sched_lmt_enable;
roc_nix_sq_dump;
roc_nix_sq_fini;
roc_nix_sq_head_tail_get;
@@ -348,6 +349,7 @@ INTERNAL {
roc_sso_hwgrp_set_priority;
roc_sso_hwgrp_stats_get;
roc_sso_hws_base_get;
+ roc_sso_hws_config_lsw;
roc_sso_hws_link;
roc_sso_hws_stats_get;
roc_sso_hws_unlink;
diff --git a/drivers/event/cnxk/cn10k_eventdev.c b/drivers/event/cnxk/cn10k_eventdev.c
index 9b4d2895ec..31dca54ccc 100644
--- a/drivers/event/cnxk/cn10k_eventdev.c
+++ b/drivers/event/cnxk/cn10k_eventdev.c
@@ -57,6 +57,7 @@ cn10k_sso_init_hws_mem(void *arg, uint8_t port_id)
ws->swtag_req = 0;
ws->gw_wdata = cn10k_sso_gw_mode_wdata(dev);
ws->lmt_base = dev->sso.lmt_base;
+ ws->gw_rdata = (SSO_TT_EMPTY << 32) | BIT_ULL(35);
return ws;
}
@@ -567,12 +568,18 @@ cn10k_sso_port_unlink(struct rte_eventdev *event_dev, void *port,
static int
cn10k_sso_start(struct rte_eventdev *event_dev)
{
+ struct cnxk_sso_evdev *dev = cnxk_sso_pmd_priv(event_dev);
int rc;
rc = cn10k_sso_updt_tx_adptr_data(event_dev);
if (rc < 0)
return rc;
+ rc = roc_sso_hws_config_lsw(&dev->sso, SSO_LSW_MODE_WAITW,
+ SSOW_LSW_WQE_RELEASE_IMMED);
+ if (rc < 0)
+ return rc;
+
rc = cnxk_sso_start(event_dev, cn10k_sso_hws_reset,
cn10k_sso_hws_flush_events);
if (rc < 0)
@@ -756,6 +763,10 @@ cn10k_sso_tx_adapter_queue_add(uint8_t id, const struct rte_eventdev *event_dev,
uint64_t tx_offloads;
int rc;
+ rc = roc_nix_sched_lmt_enable(&cnxk_eth_dev->nix);
+ if (rc < 0)
+ return -EINVAL;
+
RTE_SET_USED(id);
rc = cnxk_sso_tx_adapter_queue_add(event_dev, eth_dev, tx_queue_id);
if (rc < 0)
diff --git a/drivers/event/cnxk/cn10k_worker.h b/drivers/event/cnxk/cn10k_worker.h
index c96048f47d..7f36b0020e 100644
--- a/drivers/event/cnxk/cn10k_worker.h
+++ b/drivers/event/cnxk/cn10k_worker.h
@@ -580,11 +580,18 @@ cn10k_sso_tx_one(struct cn10k_sso_hws *ws, struct rte_mbuf *m, uint64_t *cmd,
else
pa = txq->io_addr | ((segdw - 1) << 4);
- if (!CNXK_TAG_IS_HEAD(ws->gw_rdata) && !sched_type)
- ws->gw_rdata = roc_sso_hws_head_wait(ws->base);
+ if (flags & NIX_TX_VWQE_F ||
+ CNXK_TT_FROM_TAG(ws->gw_rdata) == SSO_TT_EMPTY) {
+ if (!CNXK_TAG_IS_HEAD(ws->gw_rdata) && !sched_type)
+ ws->gw_rdata = roc_sso_hws_head_wait(ws->base);
- cn10k_sso_txq_fc_wait(txq);
- roc_lmt_submit_steorl(lmt_id, pa);
+ cn10k_sso_txq_fc_wait(txq);
+ roc_lmt_submit_steorl(lmt_id, pa);
+ } else {
+ cn10k_sso_txq_fc_wait(txq);
+ roc_lmt_submit_stsmaxl(
+ (uint64_t)lmt_id | (uint64_t)ws->hws_id << 16, pa);
+ }
}
static __rte_always_inline void
@@ -616,7 +623,7 @@ cn10k_sso_vwqe_split_tx(struct cn10k_sso_hws *ws, struct rte_mbuf **mbufs,
for (j = 0; j < 4; j++)
cn10k_sso_tx_one(ws, mbufs[i + j], cmd, lmt_id,
lmt_addr, sched_type, txq_data,
- flags);
+ flags | NIX_TX_VWQE_F);
} else {
txq = (struct cn10k_eth_txq
*)(txq_data[(txq_data[port[0]] >> 48) +
@@ -632,7 +639,7 @@ cn10k_sso_vwqe_split_tx(struct cn10k_sso_hws *ws, struct rte_mbuf **mbufs,
for (i = 0; i < scalar; i++) {
cn10k_sso_tx_one(ws, mbufs[i], cmd, lmt_id, lmt_addr,
- sched_type, txq_data, flags);
+ sched_type, txq_data, flags | NIX_TX_VWQE_F);
}
}
diff --git a/drivers/event/cnxk/cnxk_eventdev.h b/drivers/event/cnxk/cnxk_eventdev.h
index 5564746e6d..1cf6517e73 100644
--- a/drivers/event/cnxk/cnxk_eventdev.h
+++ b/drivers/event/cnxk/cnxk_eventdev.h
@@ -129,13 +129,13 @@ struct cn10k_sso_hws {
void *lookup_mem;
uint32_t gw_wdata;
uint8_t swtag_req;
- uint8_t hws_id;
/* Add Work Fastpath data */
uint64_t xaq_lmt __rte_cache_aligned;
uint64_t *fc_mem;
uintptr_t grp_base;
/* Tx Fastpath data */
uintptr_t lmt_base __rte_cache_aligned;
+ uint8_t hws_id;
uint64_t lso_tun_fmt;
uint8_t tx_adptr_data[];
} __rte_cache_aligned;
--
2.25.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] event/cnxk: add SLMTST support to Tx adapter
2022-04-27 7:06 [PATCH] event/cnxk: add SLMTST support to Tx adapter Pavan Nikhilesh
@ 2022-04-27 9:00 ` Ray Kinsella
0 siblings, 0 replies; 2+ messages in thread
From: Ray Kinsella @ 2022-04-27 9:00 UTC (permalink / raw)
To: Pavan Nikhilesh
Cc: jerinj, Nithin Dabilpuram, Kiran Kumar K, Sunil Kumar Kori,
Satha Rao, Shijith Thotton, dev
Pavan Nikhilesh <pbhagavatula@marvell.com> writes:
> Scheduled LMTST uses in-core LSW (LMTST scheduling widget) to
> coordinate with SSO and send a LMTST to the destination
> coprocessor without the need for the core to be the head of
> the scheduling context it is currently holding.
>
> Use SLMTST to send mbuf to NIX-TX for transmit. SLMTST only
> supports transmitting a single WQE.
>
> Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
> ---
> Depends-on: Series-22634
>
> drivers/common/cnxk/hw/ssow.h | 7 +++++++
> drivers/common/cnxk/roc_dev_priv.h | 6 ++++++
> drivers/common/cnxk/roc_io.h | 8 ++++++++
> drivers/common/cnxk/roc_io_generic.h | 7 +++++++
> drivers/common/cnxk/roc_nix.c | 19 +++++++++++++++++++
> drivers/common/cnxk/roc_nix.h | 4 ++++
> drivers/common/cnxk/roc_sso.c | 23 +++++++++++++++++++++++
> drivers/common/cnxk/roc_sso.h | 2 ++
> drivers/common/cnxk/version.map | 2 ++
> drivers/event/cnxk/cn10k_eventdev.c | 11 +++++++++++
> drivers/event/cnxk/cn10k_worker.h | 19 +++++++++++++------
> drivers/event/cnxk/cnxk_eventdev.h | 2 +-
> 12 files changed, 103 insertions(+), 7 deletions(-)
>
Acked-by: Ray Kinsella <mdr@ashroe.eu>
--
Regards, Ray K
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-04-27 9:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-27 7:06 [PATCH] event/cnxk: add SLMTST support to Tx adapter Pavan Nikhilesh
2022-04-27 9:00 ` Ray Kinsella
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).