From: Akhil Goyal <gakhil@marvell.com>
To: <dev@dpdk.org>
Cc: <thomas@monjalon.net>, <david.marchand@redhat.com>,
<vattunuru@marvell.com>, <jerinj@marvell.com>,
<adwivedi@marvell.com>, <ndabilpuram@marvell.com>,
Akhil Goyal <gakhil@marvell.com>
Subject: [PATCH v3 07/15] common/cnxk: add MACsec interrupt APIs
Date: Tue, 13 Jun 2023 12:46:06 +0530 [thread overview]
Message-ID: <20230613071614.2259604-8-gakhil@marvell.com> (raw)
In-Reply-To: <20230613071614.2259604-1-gakhil@marvell.com>
Added ROC APIs to support various MACsec interrupts.
Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
Signed-off-by: Vamsi Attunuru <vattunuru@marvell.com>
Signed-off-by: Akhil Goyal <gakhil@marvell.com>
---
drivers/common/cnxk/roc_dev.c | 86 +++++++++++++++++
drivers/common/cnxk/roc_mbox.h | 37 +++++++-
drivers/common/cnxk/roc_mcs.c | 117 +++++++++++++++++++++++
drivers/common/cnxk/roc_mcs.h | 144 +++++++++++++++++++++++++++++
drivers/common/cnxk/roc_mcs_priv.h | 8 ++
drivers/common/cnxk/version.map | 3 +
6 files changed, 394 insertions(+), 1 deletion(-)
diff --git a/drivers/common/cnxk/roc_dev.c b/drivers/common/cnxk/roc_dev.c
index 571679c968..4b0ba218ed 100644
--- a/drivers/common/cnxk/roc_dev.c
+++ b/drivers/common/cnxk/roc_dev.c
@@ -527,6 +527,91 @@ pf_vf_mbox_send_up_msg(struct dev *dev, void *rec_msg)
}
}
+static int
+mbox_up_handler_mcs_intr_notify(struct dev *dev, struct mcs_intr_info *info, struct msg_rsp *rsp)
+{
+ struct roc_mcs_event_desc desc = {0};
+ struct roc_mcs *mcs;
+
+ plt_base_dbg("pf:%d/vf:%d msg id 0x%x (%s) from: pf:%d/vf:%d", dev_get_pf(dev->pf_func),
+ dev_get_vf(dev->pf_func), info->hdr.id, mbox_id2name(info->hdr.id),
+ dev_get_pf(info->hdr.pcifunc), dev_get_vf(info->hdr.pcifunc));
+
+ mcs = roc_idev_mcs_get(info->mcs_id);
+ if (!mcs)
+ goto exit;
+
+ if (info->intr_mask) {
+ switch (info->intr_mask) {
+ case MCS_CPM_RX_SECTAG_V_EQ1_INT:
+ desc.type = ROC_MCS_EVENT_SECTAG_VAL_ERR;
+ desc.subtype = ROC_MCS_EVENT_RX_SECTAG_V_EQ1;
+ break;
+ case MCS_CPM_RX_SECTAG_E_EQ0_C_EQ1_INT:
+ desc.type = ROC_MCS_EVENT_SECTAG_VAL_ERR;
+ desc.subtype = ROC_MCS_EVENT_RX_SECTAG_E_EQ0_C_EQ1;
+ break;
+ case MCS_CPM_RX_SECTAG_SL_GTE48_INT:
+ desc.type = ROC_MCS_EVENT_SECTAG_VAL_ERR;
+ desc.subtype = ROC_MCS_EVENT_RX_SECTAG_SL_GTE48;
+ break;
+ case MCS_CPM_RX_SECTAG_ES_EQ1_SC_EQ1_INT:
+ desc.type = ROC_MCS_EVENT_SECTAG_VAL_ERR;
+ desc.subtype = ROC_MCS_EVENT_RX_SECTAG_ES_EQ1_SC_EQ1;
+ break;
+ case MCS_CPM_RX_SECTAG_SC_EQ1_SCB_EQ1_INT:
+ desc.type = ROC_MCS_EVENT_SECTAG_VAL_ERR;
+ desc.subtype = ROC_MCS_EVENT_RX_SECTAG_SC_EQ1_SCB_EQ1;
+ break;
+ case MCS_CPM_RX_PACKET_XPN_EQ0_INT:
+ desc.type = ROC_MCS_EVENT_RX_SA_PN_HARD_EXP;
+ desc.metadata.sa_idx = info->sa_id;
+ break;
+ case MCS_CPM_RX_PN_THRESH_REACHED_INT:
+ desc.type = ROC_MCS_EVENT_RX_SA_PN_SOFT_EXP;
+ desc.metadata.sa_idx = info->sa_id;
+ break;
+ case MCS_CPM_TX_PACKET_XPN_EQ0_INT:
+ desc.type = ROC_MCS_EVENT_TX_SA_PN_HARD_EXP;
+ desc.metadata.sa_idx = info->sa_id;
+ break;
+ case MCS_CPM_TX_PN_THRESH_REACHED_INT:
+ desc.type = ROC_MCS_EVENT_TX_SA_PN_SOFT_EXP;
+ desc.metadata.sa_idx = info->sa_id;
+ break;
+ case MCS_CPM_TX_SA_NOT_VALID_INT:
+ desc.type = ROC_MCS_EVENT_SA_NOT_VALID;
+ break;
+ case MCS_BBE_RX_DFIFO_OVERFLOW_INT:
+ case MCS_BBE_TX_DFIFO_OVERFLOW_INT:
+ desc.type = ROC_MCS_EVENT_FIFO_OVERFLOW;
+ desc.subtype = ROC_MCS_EVENT_DATA_FIFO_OVERFLOW;
+ desc.metadata.lmac_id = info->lmac_id;
+ break;
+ case MCS_BBE_RX_PLFIFO_OVERFLOW_INT:
+ case MCS_BBE_TX_PLFIFO_OVERFLOW_INT:
+ desc.type = ROC_MCS_EVENT_FIFO_OVERFLOW;
+ desc.subtype = ROC_MCS_EVENT_POLICY_FIFO_OVERFLOW;
+ desc.metadata.lmac_id = info->lmac_id;
+ break;
+ case MCS_PAB_RX_CHAN_OVERFLOW_INT:
+ case MCS_PAB_TX_CHAN_OVERFLOW_INT:
+ desc.type = ROC_MCS_EVENT_FIFO_OVERFLOW;
+ desc.subtype = ROC_MCS_EVENT_PKT_ASSM_FIFO_OVERFLOW;
+ desc.metadata.lmac_id = info->lmac_id;
+ break;
+ default:
+ goto exit;
+ }
+
+ mcs_event_cb_process(mcs, &desc);
+ }
+
+exit:
+ rsp->hdr.rc = 0;
+ return 0;
+}
+
static int
mbox_up_handler_cgx_link_event(struct dev *dev, struct cgx_link_info_msg *msg,
struct msg_rsp *rsp)
@@ -615,6 +700,7 @@ mbox_process_msgs_up(struct dev *dev, struct mbox_msghdr *req)
return err; \
}
MBOX_UP_CGX_MESSAGES
+ MBOX_UP_MCS_MESSAGES
#undef M
}
diff --git a/drivers/common/cnxk/roc_mbox.h b/drivers/common/cnxk/roc_mbox.h
index 3f3a6aadc8..d964ba9f9d 100644
--- a/drivers/common/cnxk/roc_mbox.h
+++ b/drivers/common/cnxk/roc_mbox.h
@@ -316,6 +316,7 @@ struct mbox_msghdr {
M(MCS_GET_SC_STATS, 0xa00e, mcs_get_sc_stats, mcs_stats_req, mcs_sc_stats) \
M(MCS_GET_PORT_STATS, 0xa010, mcs_get_port_stats, mcs_stats_req, mcs_port_stats) \
M(MCS_CLEAR_STATS, 0xa011, mcs_clear_stats, mcs_clear_stats, msg_rsp) \
+ M(MCS_INTR_CFG, 0xa012, mcs_intr_cfg, mcs_intr_cfg, msg_rsp) \
M(MCS_SET_LMAC_MODE, 0xa013, mcs_set_lmac_mode, mcs_set_lmac_mode, msg_rsp) \
M(MCS_SET_PN_THRESHOLD, 0xa014, mcs_set_pn_threshold, mcs_set_pn_threshold, msg_rsp) \
@@ -324,9 +325,11 @@ struct mbox_msghdr {
M(CGX_LINK_EVENT, 0xC00, cgx_link_event, cgx_link_info_msg, msg_rsp) \
M(CGX_PTP_RX_INFO, 0xC01, cgx_ptp_rx_info, cgx_ptp_rx_info_msg, msg_rsp)
+#define MBOX_UP_MCS_MESSAGES M(MCS_INTR_NOTIFY, 0xE00, mcs_intr_notify, mcs_intr_info, msg_rsp)
+
enum {
#define M(_name, _id, _1, _2, _3) MBOX_MSG_##_name = _id,
- MBOX_MESSAGES MBOX_UP_CGX_MESSAGES
+ MBOX_MESSAGES MBOX_UP_CGX_MESSAGES MBOX_UP_MCS_MESSAGES
#undef M
};
@@ -867,6 +870,38 @@ struct mcs_set_active_lmac {
uint64_t __io rsvd;
};
+#define MCS_CPM_RX_SECTAG_V_EQ1_INT BIT_ULL(0)
+#define MCS_CPM_RX_SECTAG_E_EQ0_C_EQ1_INT BIT_ULL(1)
+#define MCS_CPM_RX_SECTAG_SL_GTE48_INT BIT_ULL(2)
+#define MCS_CPM_RX_SECTAG_ES_EQ1_SC_EQ1_INT BIT_ULL(3)
+#define MCS_CPM_RX_SECTAG_SC_EQ1_SCB_EQ1_INT BIT_ULL(4)
+#define MCS_CPM_RX_PACKET_XPN_EQ0_INT BIT_ULL(5)
+#define MCS_CPM_RX_PN_THRESH_REACHED_INT BIT_ULL(6)
+#define MCS_CPM_TX_PACKET_XPN_EQ0_INT BIT_ULL(7)
+#define MCS_CPM_TX_PN_THRESH_REACHED_INT BIT_ULL(8)
+#define MCS_CPM_TX_SA_NOT_VALID_INT BIT_ULL(9)
+#define MCS_BBE_RX_DFIFO_OVERFLOW_INT BIT_ULL(10)
+#define MCS_BBE_RX_PLFIFO_OVERFLOW_INT BIT_ULL(11)
+#define MCS_BBE_TX_DFIFO_OVERFLOW_INT BIT_ULL(12)
+#define MCS_BBE_TX_PLFIFO_OVERFLOW_INT BIT_ULL(13)
+#define MCS_PAB_RX_CHAN_OVERFLOW_INT BIT_ULL(14)
+#define MCS_PAB_TX_CHAN_OVERFLOW_INT BIT_ULL(15)
+
+struct mcs_intr_cfg {
+ struct mbox_msghdr hdr;
+ uint64_t __io intr_mask; /* Interrupt enable mask */
+ uint8_t __io mcs_id;
+};
+
+struct mcs_intr_info {
+ struct mbox_msghdr hdr;
+ uint64_t __io intr_mask;
+ int __io sa_id;
+ uint8_t __io mcs_id;
+ uint8_t __io lmac_id;
+ uint64_t __io rsvd;
+};
+
struct mcs_set_lmac_mode {
struct mbox_msghdr hdr;
uint8_t __io mode; /* '1' for internal bypass mode (passthrough), '0' for MCS processing */
diff --git a/drivers/common/cnxk/roc_mcs.c b/drivers/common/cnxk/roc_mcs.c
index 38f1e9b2f7..e9090da575 100644
--- a/drivers/common/cnxk/roc_mcs.c
+++ b/drivers/common/cnxk/roc_mcs.c
@@ -5,6 +5,18 @@
#include "roc_api.h"
#include "roc_priv.h"
+struct mcs_event_cb {
+ TAILQ_ENTRY(mcs_event_cb) next;
+ enum roc_mcs_event_type event;
+ roc_mcs_dev_cb_fn cb_fn;
+ void *cb_arg;
+ void *ret_param;
+ uint32_t active;
+};
+TAILQ_HEAD(mcs_event_cb_list, mcs_event_cb);
+
+PLT_STATIC_ASSERT(ROC_MCS_MEM_SZ >= (sizeof(struct mcs_priv) + sizeof(struct mcs_event_cb_list)));
+
int
roc_mcs_hw_info_get(struct roc_mcs_hw_info *hw_info)
{
@@ -109,6 +121,107 @@ roc_mcs_pn_threshold_set(struct roc_mcs *mcs, struct roc_mcs_set_pn_threshold *p
return mbox_process_msg(mcs->mbox, (void *)&rsp);
}
+int
+roc_mcs_intr_configure(struct roc_mcs *mcs, struct roc_mcs_intr_cfg *config)
+{
+ struct mcs_intr_cfg *req;
+ struct msg_rsp *rsp;
+
+ if (config == NULL)
+ return -EINVAL;
+
+ MCS_SUPPORT_CHECK;
+
+ req = mbox_alloc_msg_mcs_intr_cfg(mcs->mbox);
+ if (req == NULL)
+ return -ENOMEM;
+
+ req->intr_mask = config->intr_mask;
+ req->mcs_id = mcs->idx;
+
+ return mbox_process_msg(mcs->mbox, (void *)&rsp);
+}
+
+int
+roc_mcs_event_cb_register(struct roc_mcs *mcs, enum roc_mcs_event_type event,
+ roc_mcs_dev_cb_fn cb_fn, void *cb_arg, void *userdata)
+{
+ struct mcs_event_cb_list *cb_list = (struct mcs_event_cb_list *)roc_mcs_to_mcs_cb_list(mcs);
+ struct mcs_event_cb *cb;
+
+ if (cb_fn == NULL || cb_arg == NULL || userdata == NULL)
+ return -EINVAL;
+
+ MCS_SUPPORT_CHECK;
+
+ TAILQ_FOREACH (cb, cb_list, next) {
+ if (cb->cb_fn == cb_fn && cb->cb_arg == cb_arg && cb->event == event)
+ break;
+ }
+
+ if (cb == NULL) {
+ cb = plt_zmalloc(sizeof(struct mcs_event_cb), 0);
+ if (!cb)
+ return -ENOMEM;
+
+ cb->cb_fn = cb_fn;
+ cb->cb_arg = cb_arg;
+ cb->event = event;
+ mcs->userdata = userdata;
+ TAILQ_INSERT_TAIL(cb_list, cb, next);
+ }
+
+ return 0;
+}
+
+int
+roc_mcs_event_cb_unregister(struct roc_mcs *mcs, enum roc_mcs_event_type event)
+{
+ struct mcs_event_cb_list *cb_list = (struct mcs_event_cb_list *)roc_mcs_to_mcs_cb_list(mcs);
+ struct mcs_event_cb *cb, *next;
+
+ MCS_SUPPORT_CHECK;
+
+ for (cb = TAILQ_FIRST(cb_list); cb != NULL; cb = next) {
+ next = TAILQ_NEXT(cb, next);
+
+ if (cb->event != event)
+ continue;
+
+ if (cb->active == 0) {
+ TAILQ_REMOVE(cb_list, cb, next);
+ plt_free(cb);
+ } else {
+ return -EAGAIN;
+ }
+ }
+
+ return 0;
+}
+
+int
+mcs_event_cb_process(struct roc_mcs *mcs, struct roc_mcs_event_desc *desc)
+{
+ struct mcs_event_cb_list *cb_list = (struct mcs_event_cb_list *)roc_mcs_to_mcs_cb_list(mcs);
+ struct mcs_event_cb mcs_cb;
+ struct mcs_event_cb *cb;
+ int rc = 0;
+
+ TAILQ_FOREACH (cb, cb_list, next) {
+ if (cb->cb_fn == NULL || cb->event != desc->type)
+ continue;
+
+ mcs_cb = *cb;
+ cb->active = 1;
+ mcs_cb.ret_param = desc;
+
+ rc = mcs_cb.cb_fn(mcs->userdata, mcs_cb.ret_param, mcs_cb.cb_arg);
+ cb->active = 0;
+ }
+
+ return rc;
+}
+
static int
mcs_alloc_bmap(uint16_t entries, void **mem, struct plt_bitmap **bmap)
{
@@ -227,6 +340,7 @@ mcs_alloc_rsrc_bmap(struct roc_mcs *mcs)
struct roc_mcs *
roc_mcs_dev_init(uint8_t mcs_idx)
{
+ struct mcs_event_cb_list *cb_list;
struct roc_mcs *mcs;
struct npa_lf *npa;
@@ -255,6 +369,9 @@ roc_mcs_dev_init(uint8_t mcs_idx)
if (mcs_alloc_rsrc_bmap(mcs))
goto exit;
+ cb_list = (struct mcs_event_cb_list *)roc_mcs_to_mcs_cb_list(mcs);
+ TAILQ_INIT(cb_list);
+
roc_idev_mcs_set(mcs);
mcs->refcount++;
diff --git a/drivers/common/cnxk/roc_mcs.h b/drivers/common/cnxk/roc_mcs.h
index 3fbeee13fa..b2ca6ee51b 100644
--- a/drivers/common/cnxk/roc_mcs.h
+++ b/drivers/common/cnxk/roc_mcs.h
@@ -116,6 +116,34 @@ struct roc_mcs_hw_info {
uint64_t rsvd[16];
};
+#define ROC_MCS_CPM_RX_SECTAG_V_EQ1_INT BIT_ULL(0)
+#define ROC_MCS_CPM_RX_SECTAG_E_EQ0_C_EQ1_INT BIT_ULL(1)
+#define ROC_MCS_CPM_RX_SECTAG_SL_GTE48_INT BIT_ULL(2)
+#define ROC_MCS_CPM_RX_SECTAG_ES_EQ1_SC_EQ1_INT BIT_ULL(3)
+#define ROC_MCS_CPM_RX_SECTAG_SC_EQ1_SCB_EQ1_INT BIT_ULL(4)
+#define ROC_MCS_CPM_RX_PACKET_XPN_EQ0_INT BIT_ULL(5)
+#define ROC_MCS_CPM_RX_PN_THRESH_REACHED_INT BIT_ULL(6)
+#define ROC_MCS_CPM_TX_PACKET_XPN_EQ0_INT BIT_ULL(7)
+#define ROC_MCS_CPM_TX_PN_THRESH_REACHED_INT BIT_ULL(8)
+#define ROC_MCS_CPM_TX_SA_NOT_VALID_INT BIT_ULL(9)
+#define ROC_MCS_BBE_RX_DFIFO_OVERFLOW_INT BIT_ULL(10)
+#define ROC_MCS_BBE_RX_PLFIFO_OVERFLOW_INT BIT_ULL(11)
+#define ROC_MCS_BBE_TX_DFIFO_OVERFLOW_INT BIT_ULL(12)
+#define ROC_MCS_BBE_TX_PLFIFO_OVERFLOW_INT BIT_ULL(13)
+#define ROC_MCS_PAB_RX_CHAN_OVERFLOW_INT BIT_ULL(14)
+#define ROC_MCS_PAB_TX_CHAN_OVERFLOW_INT BIT_ULL(15)
+
+struct roc_mcs_intr_cfg {
+ uint64_t intr_mask; /* Interrupt enable mask */
+};
+
+struct roc_mcs_intr_info {
+ uint64_t intr_mask;
+ int sa_id;
+ uint8_t lmac_id;
+ uint64_t rsvd;
+};
+
struct roc_mcs_set_lmac_mode {
uint8_t mode; /* '1' for internal bypass mode (passthrough), '0' for MCS processing */
uint8_t lmac_id;
@@ -205,6 +233,113 @@ struct roc_mcs_clear_stats {
uint8_t all; /* All resources stats mapped to PF are cleared */
};
+enum roc_mcs_event_subtype {
+ ROC_MCS_SUBEVENT_UNKNOWN,
+
+ /* subevents of ROC_MCS_EVENT_SECTAG_VAL_ERR sectag validation events
+ * ROC_MCS_EVENT_RX_SECTAG_V_EQ1
+ * Validation check: SecTag.TCI.V = 1
+ * ROC_MCS_EVENT_RX_SECTAG_E_EQ0_C_EQ1
+ * Validation check: SecTag.TCI.E = 0 && SecTag.TCI.C = 1
+ * ROC_MCS_EVENT_RX_SECTAG_SL_GTE48
+ * Validation check: SecTag.SL >= 'd48
+ * ROC_MCS_EVENT_RX_SECTAG_ES_EQ1_SC_EQ1
+ * Validation check: SecTag.TCI.ES = 1 && SecTag.TCI.SC = 1
+ * ROC_MCS_EVENT_RX_SECTAG_SC_EQ1_SCB_EQ1
+ * Validation check: SecTag.TCI.SC = 1 && SecTag.TCI.SCB = 1
+ */
+ ROC_MCS_EVENT_RX_SECTAG_V_EQ1,
+ ROC_MCS_EVENT_RX_SECTAG_E_EQ0_C_EQ1,
+ ROC_MCS_EVENT_RX_SECTAG_SL_GTE48,
+ ROC_MCS_EVENT_RX_SECTAG_ES_EQ1_SC_EQ1,
+ ROC_MCS_EVENT_RX_SECTAG_SC_EQ1_SCB_EQ1,
+
+ /* subevents of ROC_MCS_EVENT_FIFO_OVERFLOW error event
+ * ROC_MCS_EVENT_DATA_FIFO_OVERFLOW:
+ * Notifies data FIFO overflow fatal error in BBE unit.
+ * ROC_MCS_EVENT_POLICY_FIFO_OVERFLOW
+ * Notifies policy FIFO overflow fatal error in BBE unit.
+ * ROC_MCS_EVENT_PKT_ASSM_FIFO_OVERFLOW,
+ * Notifies output FIFO overflow fatal error in PAB unit.
+ */
+ ROC_MCS_EVENT_DATA_FIFO_OVERFLOW,
+ ROC_MCS_EVENT_POLICY_FIFO_OVERFLOW,
+ ROC_MCS_EVENT_PKT_ASSM_FIFO_OVERFLOW,
+};
+
+enum roc_mcs_event_type {
+ ROC_MCS_EVENT_UNKNOWN,
+
+ /* Notifies BBE_INT_DFIFO/PLFIFO_OVERFLOW or PAB_INT_OVERFLOW
+ * interrupts, it's a fatal error that causes packet corruption.
+ */
+ ROC_MCS_EVENT_FIFO_OVERFLOW,
+
+ /* Notifies CPM_RX_SECTAG_X validation error interrupt */
+ ROC_MCS_EVENT_SECTAG_VAL_ERR,
+ /* Notifies CPM_RX_PACKET_XPN_EQ0 (SecTag.PN == 0 in ingress) interrupt */
+ ROC_MCS_EVENT_RX_SA_PN_HARD_EXP,
+ /* Notifies CPM_RX_PN_THRESH_REACHED interrupt */
+ ROC_MCS_EVENT_RX_SA_PN_SOFT_EXP,
+ /* Notifies CPM_TX_PACKET_XPN_EQ0 (PN wrapped in egress) interrupt */
+ ROC_MCS_EVENT_TX_SA_PN_HARD_EXP,
+ /* Notifies CPM_TX_PN_THRESH_REACHED interrupt */
+ ROC_MCS_EVENT_TX_SA_PN_SOFT_EXP,
+ /* Notifies CPM_TX_SA_NOT_VALID interrupt */
+ ROC_MCS_EVENT_SA_NOT_VALID,
+ /* Notifies recovery of software driven port reset */
+ ROC_MCS_EVENT_PORT_RESET_RECOVERY,
+};
+
+union roc_mcs_event_data {
+ /* Valid for below events
+ * - ROC_MCS_EVENT_RX_SA_PN_SOFT_EXP
+ * - ROC_MCS_EVENT_TX_SA_PN_SOFT_EXP
+ */
+ struct {
+ uint8_t secy_idx;
+ uint8_t sc_idx;
+ uint8_t sa_idx;
+ };
+ /* Valid for below event
+ * - ROC_MCS_EVENT_FIFO_OVERFLOW
+ *
+ * Upon fatal error notification on a MCS port, ROC driver resets below attributes of active
+ * flow entities(sc & sa) and than resets the port.
+ * - Reset NEXT_PN of active SAs to 1.
+ * - Reset TX active SA for each SC, TX_SA_ACTIVE = 0, SA_INDEX0_VLD = 1.
+ * - Clear SA_IN_USE for active ANs in RX_SA_MAP_MEM.
+ * - Clear all stats mapping to this port.
+ * - Reactivate SA_IN_USE for active ANs in RX_SA_MAP_MEM.
+ *
+ * ROC driver notifies the following flow entity(sc & sa) details in application callback,
+ * application is expected to exchange the Tx/Rx NEXT_PN, TX_SA_ACTIVE, active RX SC AN
+ * details with peer device so that peer device can resets it's MACsec flow states and than
+ * resume packet transfers.
+ */
+ struct {
+ uint16_t *tx_sa_array; /* Tx SAs whose PN memories were reset (NEXT_PN=1) */
+ uint16_t *rx_sa_array; /* Rx SAs whose PN memories were reset (NEXT_PN=1) */
+ uint16_t *tx_sc_array; /* Tx SCs whose active SAs were reset (TX_SA_ACTIVE=0) */
+ uint16_t *rx_sc_array; /* Rx SCs whose state was reset */
+ uint8_t *sc_an_array; /* AN of Rx SCs(in rx_sc_array) which were reactivated */
+ uint8_t num_tx_sa; /* num entries in tx_sa_array */
+ uint8_t num_rx_sa; /* num entries in rx_sa_array */
+ uint8_t num_tx_sc; /* num entries in tx_sc_array */
+ uint8_t num_rx_sc; /* num entries in rx_sc_array */
+ uint8_t lmac_id; /* lmac_id/port which was recovered from fatal error */
+ };
+};
+
+struct roc_mcs_event_desc {
+ enum roc_mcs_event_type type;
+ enum roc_mcs_event_subtype subtype;
+ union roc_mcs_event_data metadata;
+};
+
+/** User application callback to be registered for any notifications from driver. */
+typedef int (*roc_mcs_dev_cb_fn)(void *userdata, struct roc_mcs_event_desc *desc, void *cb_arg);
+
struct roc_mcs {
TAILQ_ENTRY(roc_mcs) next;
struct plt_pci_device *pci_dev;
@@ -292,4 +427,13 @@ __roc_api int roc_mcs_port_stats_get(struct roc_mcs *mcs, struct roc_mcs_stats_r
/* Clear stats */
__roc_api int roc_mcs_stats_clear(struct roc_mcs *mcs, struct roc_mcs_clear_stats *mcs_req);
+/* Register user callback routines */
+__roc_api int roc_mcs_event_cb_register(struct roc_mcs *mcs, enum roc_mcs_event_type event,
+ roc_mcs_dev_cb_fn cb_fn, void *cb_arg, void *userdata);
+/* Unregister user callback routines */
+__roc_api int roc_mcs_event_cb_unregister(struct roc_mcs *mcs, enum roc_mcs_event_type event);
+
+/* Configure interrupts */
+__roc_api int roc_mcs_intr_configure(struct roc_mcs *mcs, struct roc_mcs_intr_cfg *config);
+
#endif /* _ROC_MCS_H_ */
diff --git a/drivers/common/cnxk/roc_mcs_priv.h b/drivers/common/cnxk/roc_mcs_priv.h
index 9e0bbe4392..8da03f4295 100644
--- a/drivers/common/cnxk/roc_mcs_priv.h
+++ b/drivers/common/cnxk/roc_mcs_priv.h
@@ -62,4 +62,12 @@ roc_mcs_to_mcs_priv(struct roc_mcs *roc_mcs)
return (struct mcs_priv *)&roc_mcs->reserved[0];
}
+static inline void *
+roc_mcs_to_mcs_cb_list(struct roc_mcs *roc_mcs)
+{
+ return (void *)((uintptr_t)roc_mcs->reserved + sizeof(struct mcs_priv));
+}
+
+int mcs_event_cb_process(struct roc_mcs *mcs, struct roc_mcs_event_desc *desc);
+
#endif /* _ROC_MCS_PRIV_H_ */
diff --git a/drivers/common/cnxk/version.map b/drivers/common/cnxk/version.map
index d8890e3538..d10dfcd84e 100644
--- a/drivers/common/cnxk/version.map
+++ b/drivers/common/cnxk/version.map
@@ -139,11 +139,14 @@ INTERNAL {
roc_mcs_dev_init;
roc_mcs_dev_fini;
roc_mcs_dev_get;
+ roc_mcs_event_cb_register;
+ roc_mcs_event_cb_unregister;
roc_mcs_flowid_entry_enable;
roc_mcs_flowid_entry_read;
roc_mcs_flowid_entry_write;
roc_mcs_flowid_stats_get;
roc_mcs_hw_info_get;
+ roc_mcs_intr_configure;
roc_mcs_lmac_mode_set;
roc_mcs_pn_table_write;
roc_mcs_pn_table_read;
--
2.25.1
next prev parent reply other threads:[~2023-06-13 7:17 UTC|newest]
Thread overview: 166+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-14 18:46 [PATCH 0/3] security: support MACsec Akhil Goyal
2022-08-14 18:46 ` [PATCH 1/3] net: add MACsec header Akhil Goyal
2022-09-22 15:29 ` Akhil Goyal
2022-09-26 12:51 ` Olivier Matz
2022-09-26 13:41 ` [EXT] " Akhil Goyal
2022-09-27 8:36 ` Akhil Goyal
2022-08-14 18:46 ` [PATCH 2/3] security: support MACsec Akhil Goyal
2022-09-22 15:37 ` Akhil Goyal
2022-08-14 18:46 ` [PATCH 3/3] ethdev: add MACsec flow item Akhil Goyal
2022-08-15 12:49 ` Ori Kam
2022-09-28 12:22 ` [PATCH v2 0/3] security: support MACsec Akhil Goyal
2022-09-28 12:22 ` [PATCH v2 1/3] net: add MACsec header Akhil Goyal
2022-09-28 13:04 ` Olivier Matz
2022-09-28 13:44 ` Thomas Monjalon
2022-09-28 14:23 ` Ori Kam
2022-09-28 12:22 ` [PATCH v2 2/3] ethdev: add MACsec flow item Akhil Goyal
2022-09-28 12:22 ` [PATCH v2 3/3] security: support MACsec Akhil Goyal
2022-09-28 12:45 ` [PATCH 0/5] Support and test inline MACsec for cnxk Akhil Goyal
2022-09-28 12:45 ` [PATCH 1/5] common/cnxk: add ROC APIs for MACsec Akhil Goyal
2022-09-28 12:45 ` [PATCH 2/5] common/cnxk: derive hash key " Akhil Goyal
2022-09-28 12:45 ` [PATCH 3/5] net/cnxk: support MACsec Akhil Goyal
2022-09-28 12:45 ` [PATCH 4/5] test/security: add inline MACsec cases Akhil Goyal
2023-05-23 19:49 ` [PATCH 00/13] Add MACsec unit test cases Akhil Goyal
2023-05-23 19:49 ` [PATCH 01/13] security: add direction in SA/SC configuration Akhil Goyal
2023-05-23 19:49 ` [PATCH 02/13] security: add MACsec packet number threshold Akhil Goyal
2023-05-23 21:29 ` Stephen Hemminger
2023-05-24 7:12 ` [EXT] " Akhil Goyal
2023-05-24 8:09 ` Akhil Goyal
2023-05-23 19:49 ` [PATCH 03/13] test/security: add inline MACsec cases Akhil Goyal
2023-05-23 19:49 ` [PATCH 04/13] test/security: add MACsec integrity cases Akhil Goyal
2023-05-23 19:49 ` [PATCH 05/13] test/security: verify multi flow MACsec Akhil Goyal
2023-05-23 19:49 ` [PATCH 06/13] test/security: add MACsec VLAN cases Akhil Goyal
2023-05-23 19:49 ` [PATCH 07/13] test/security: add MACsec negative cases Akhil Goyal
2023-05-23 19:49 ` [PATCH 08/13] test/security: verify MACsec stats Akhil Goyal
2023-05-23 19:49 ` [PATCH 09/13] test/security: verify MACsec interrupts Akhil Goyal
2023-05-23 19:49 ` [PATCH 10/13] test/security: verify MACsec Tx HW rekey Akhil Goyal
2023-05-23 19:49 ` [PATCH 11/13] test/security: verify MACsec Rx rekey Akhil Goyal
2023-05-23 19:49 ` [PATCH 12/13] test/security: verify MACsec anti replay Akhil Goyal
2023-05-23 19:49 ` [PATCH 13/13] test/security: remove no MACsec support case Akhil Goyal
2023-06-07 15:19 ` [PATCH v2 00/13] Add MACsec unit test cases Akhil Goyal
2023-06-07 15:19 ` [PATCH v2 01/13] security: add direction in SA/SC configuration Akhil Goyal
2023-06-07 15:21 ` Akhil Goyal
2023-06-07 19:49 ` David Marchand
2023-06-08 6:58 ` [EXT] " Akhil Goyal
2023-06-07 15:19 ` [PATCH v2 02/13] security: add MACsec packet number threshold Akhil Goyal
2023-06-07 15:19 ` [PATCH v2 03/13] test/security: add inline MACsec cases Akhil Goyal
2023-06-07 15:19 ` [PATCH v2 04/13] test/security: add MACsec integrity cases Akhil Goyal
2023-06-07 15:19 ` [PATCH v2 05/13] test/security: verify multi flow MACsec Akhil Goyal
2023-06-07 15:19 ` [PATCH v2 06/13] test/security: add MACsec VLAN cases Akhil Goyal
2023-06-07 15:19 ` [PATCH v2 07/13] test/security: add MACsec negative cases Akhil Goyal
2023-06-07 15:19 ` [PATCH v2 08/13] test/security: verify MACsec stats Akhil Goyal
2023-06-07 15:19 ` [PATCH v2 09/13] test/security: verify MACsec interrupts Akhil Goyal
2023-06-07 15:19 ` [PATCH v2 10/13] test/security: verify MACsec Tx HW rekey Akhil Goyal
2023-06-07 15:19 ` [PATCH v2 11/13] test/security: verify MACsec Rx rekey Akhil Goyal
2023-06-07 15:19 ` [PATCH v2 12/13] test/security: verify MACsec anti replay Akhil Goyal
2023-06-07 15:19 ` [PATCH v2 13/13] test/security: remove no MACsec support case Akhil Goyal
2023-06-08 6:54 ` [PATCH v3 00/13] Add MACsec unit test cases Akhil Goyal
2023-06-08 6:54 ` [PATCH v3 01/13] security: add direction in SA/SC configuration Akhil Goyal
2023-06-08 6:54 ` [PATCH v3 02/13] security: add MACsec packet number threshold Akhil Goyal
2023-06-08 6:54 ` [PATCH v3 03/13] test/security: add inline MACsec cases Akhil Goyal
2023-06-08 6:54 ` [PATCH v3 04/13] test/security: add MACsec integrity cases Akhil Goyal
2023-06-08 6:54 ` [PATCH v3 05/13] test/security: verify multi flow MACsec Akhil Goyal
2023-06-08 6:54 ` [PATCH v3 06/13] test/security: add MACsec VLAN cases Akhil Goyal
2023-06-08 6:54 ` [PATCH v3 07/13] test/security: add MACsec negative cases Akhil Goyal
2023-06-08 6:54 ` [PATCH v3 08/13] test/security: verify MACsec stats Akhil Goyal
2023-06-08 6:54 ` [PATCH v3 09/13] test/security: verify MACsec interrupts Akhil Goyal
2023-06-08 6:54 ` [PATCH v3 10/13] test/security: verify MACsec Tx HW rekey Akhil Goyal
2023-06-08 6:54 ` [PATCH v3 11/13] test/security: verify MACsec Rx rekey Akhil Goyal
2023-06-08 6:54 ` [PATCH v3 12/13] test/security: verify MACsec anti replay Akhil Goyal
2023-06-08 6:54 ` [PATCH v3 13/13] test/security: remove no MACsec support case Akhil Goyal
2023-06-08 17:19 ` [PATCH v3 00/13] Add MACsec unit test cases Akhil Goyal
2022-09-28 12:45 ` [PATCH 5/5] test/security: add more MACsec cases Akhil Goyal
2023-05-23 20:03 ` [PATCH 00/15] net/cnxk: add MACsec support Akhil Goyal
2023-05-23 20:03 ` [PATCH 01/15] common/cnxk: add ROC MACsec initialization Akhil Goyal
2023-05-26 9:29 ` Jerin Jacob
2023-05-23 20:03 ` [PATCH 02/15] common/cnxk: add MACsec SA configuration Akhil Goyal
2023-05-26 10:16 ` Jerin Jacob
2023-05-23 20:03 ` [PATCH 03/15] common/cnxk: add MACsec SC configuration APIs Akhil Goyal
2023-05-23 20:03 ` [PATCH 04/15] common/cnxk: add MACsec secy and flow configuration Akhil Goyal
2023-05-23 20:03 ` [PATCH 05/15] common/cnxk: add MACsec PN and LMAC mode configuration Akhil Goyal
2023-05-26 10:20 ` Jerin Jacob
2023-05-23 20:03 ` [PATCH 06/15] common/cnxk: add MACsec stats Akhil Goyal
2023-05-23 20:03 ` [PATCH 07/15] common/cnxk: add MACsec interrupt APIs Akhil Goyal
2023-05-23 20:03 ` [PATCH 08/15] common/cnxk: add MACsec port configuration Akhil Goyal
2023-05-23 20:03 ` [PATCH 09/15] common/cnxk: add MACsec control " Akhil Goyal
2023-05-26 10:23 ` Jerin Jacob
2023-05-23 20:03 ` [PATCH 10/15] common/cnxk: add MACsec FIPS mbox Akhil Goyal
2023-05-23 20:03 ` [PATCH 11/15] common/cnxk: derive hash key for MACsec Akhil Goyal
2023-05-23 20:03 ` [PATCH 12/15] net/cnxk: add MACsec initialization Akhil Goyal
2023-05-23 20:03 ` [PATCH 13/15] net/cnxk: create/destroy MACsec SC/SA Akhil Goyal
2023-05-23 20:04 ` [PATCH 14/15] net/cnxk: add MACsec session and flow configuration Akhil Goyal
2023-05-23 20:04 ` [PATCH 15/15] net/cnxk: add MACsec stats Akhil Goyal
2023-06-13 9:46 ` Jerin Jacob
2023-06-07 15:28 ` [PATCH v2 00/15] net/cnxk: add MACsec support Akhil Goyal
2023-06-07 15:28 ` [PATCH v2 01/15] common/cnxk: add ROC MACsec initialization Akhil Goyal
2023-06-12 15:51 ` Jerin Jacob
2023-06-07 15:28 ` [PATCH v2 02/15] common/cnxk: add MACsec SA configuration Akhil Goyal
2023-06-07 15:28 ` [PATCH v2 03/15] common/cnxk: add MACsec SC configuration APIs Akhil Goyal
2023-06-07 15:28 ` [PATCH v2 04/15] common/cnxk: add MACsec secy and flow configuration Akhil Goyal
2023-06-07 15:28 ` [PATCH v2 05/15] common/cnxk: add MACsec PN and LMAC mode configuration Akhil Goyal
2023-06-07 15:28 ` [PATCH v2 06/15] common/cnxk: add MACsec stats Akhil Goyal
2023-06-07 15:28 ` [PATCH v2 07/15] common/cnxk: add MACsec interrupt APIs Akhil Goyal
2023-06-07 15:28 ` [PATCH v2 08/15] common/cnxk: add MACsec port configuration Akhil Goyal
2023-06-07 15:28 ` [PATCH v2 09/15] common/cnxk: add MACsec control " Akhil Goyal
2023-06-07 15:28 ` [PATCH v2 10/15] common/cnxk: add MACsec FIPS mbox Akhil Goyal
2023-06-07 15:28 ` [PATCH v2 11/15] common/cnxk: derive hash key for MACsec Akhil Goyal
2023-06-07 15:28 ` [PATCH v2 12/15] net/cnxk: add MACsec initialization Akhil Goyal
2023-06-07 15:28 ` [PATCH v2 13/15] net/cnxk: create/destroy MACsec SC/SA Akhil Goyal
2023-06-07 15:28 ` [PATCH v2 14/15] net/cnxk: add MACsec session and flow configuration Akhil Goyal
2023-06-07 15:28 ` [PATCH v2 15/15] net/cnxk: add MACsec stats Akhil Goyal
2023-06-13 7:15 ` [PATCH v3 00/15] net/cnxk: add MACsec support Akhil Goyal
2023-06-13 7:16 ` [PATCH v3 01/15] common/cnxk: add ROC MACsec initialization Akhil Goyal
2023-06-13 7:16 ` [PATCH v3 02/15] common/cnxk: add MACsec SA configuration Akhil Goyal
2023-06-13 7:16 ` [PATCH v3 03/15] common/cnxk: add MACsec SC configuration APIs Akhil Goyal
2023-06-13 7:16 ` [PATCH v3 04/15] common/cnxk: add MACsec secy and flow configuration Akhil Goyal
2023-06-13 7:16 ` [PATCH v3 05/15] common/cnxk: add MACsec PN and LMAC mode configuration Akhil Goyal
2023-06-13 7:16 ` [PATCH v3 06/15] common/cnxk: add MACsec stats Akhil Goyal
2023-06-13 7:16 ` Akhil Goyal [this message]
2023-06-13 7:16 ` [PATCH v3 08/15] common/cnxk: add MACsec port configuration Akhil Goyal
2023-06-13 7:16 ` [PATCH v3 09/15] common/cnxk: add MACsec control " Akhil Goyal
2023-06-13 7:16 ` [PATCH v3 10/15] common/cnxk: add MACsec FIPS mbox Akhil Goyal
2023-06-13 7:16 ` [PATCH v3 11/15] common/cnxk: derive hash key for MACsec Akhil Goyal
2023-06-13 7:16 ` [PATCH v3 12/15] net/cnxk: add MACsec initialization Akhil Goyal
2023-06-13 7:16 ` [PATCH v3 13/15] net/cnxk: create/destroy MACsec SC/SA Akhil Goyal
2023-06-13 7:16 ` [PATCH v3 14/15] net/cnxk: add MACsec session and flow configuration Akhil Goyal
2023-06-13 7:16 ` [PATCH v3 15/15] net/cnxk: add MACsec stats Akhil Goyal
2023-06-13 10:19 ` [PATCH v4 00/15] net/cnxk: add MACsec support Akhil Goyal
2023-06-13 10:19 ` [PATCH v4 01/15] common/cnxk: add ROC MACsec initialization Akhil Goyal
2023-06-13 10:19 ` [PATCH v4 02/15] common/cnxk: add MACsec SA configuration Akhil Goyal
2023-06-13 10:19 ` [PATCH v4 03/15] common/cnxk: add MACsec SC configuration APIs Akhil Goyal
2023-06-13 10:19 ` [PATCH v4 04/15] common/cnxk: add MACsec secy and flow configuration Akhil Goyal
2023-06-13 10:19 ` [PATCH v4 05/15] common/cnxk: add MACsec PN and LMAC mode configuration Akhil Goyal
2023-06-13 10:20 ` [PATCH v4 06/15] common/cnxk: add MACsec stats Akhil Goyal
2023-06-13 10:20 ` [PATCH v4 07/15] common/cnxk: add MACsec interrupt APIs Akhil Goyal
2023-06-13 10:20 ` [PATCH v4 08/15] common/cnxk: add MACsec port configuration Akhil Goyal
2023-06-13 10:20 ` [PATCH v4 09/15] common/cnxk: add MACsec control " Akhil Goyal
2023-06-13 10:20 ` [PATCH v4 10/15] common/cnxk: add MACsec FIPS mbox Akhil Goyal
2023-06-13 10:20 ` [PATCH v4 11/15] common/cnxk: derive hash key for MACsec Akhil Goyal
2023-06-13 10:20 ` [PATCH v4 12/15] net/cnxk: add MACsec initialization Akhil Goyal
2023-06-13 10:20 ` [PATCH v4 13/15] net/cnxk: create/destroy MACsec SC/SA Akhil Goyal
2023-06-13 10:20 ` [PATCH v4 14/15] net/cnxk: add MACsec session and flow configuration Akhil Goyal
2023-06-13 10:20 ` [PATCH v4 15/15] net/cnxk: add MACsec stats Akhil Goyal
2023-06-13 15:26 ` Jerin Jacob
2023-06-14 13:08 ` [PATCH v5 00/15] net/cnxk: add MACsec support Akhil Goyal
2023-06-14 13:08 ` [PATCH v5 01/15] common/cnxk: add ROC MACsec initialization Akhil Goyal
2023-06-14 13:08 ` [PATCH v5 02/15] common/cnxk: add MACsec SA configuration Akhil Goyal
2023-06-14 13:08 ` [PATCH v5 03/15] common/cnxk: add MACsec SC configuration APIs Akhil Goyal
2023-06-14 13:08 ` [PATCH v5 04/15] common/cnxk: add MACsec secy and flow configuration Akhil Goyal
2023-06-14 13:08 ` [PATCH v5 05/15] common/cnxk: add MACsec PN and LMAC mode configuration Akhil Goyal
2023-06-14 13:08 ` [PATCH v5 06/15] common/cnxk: add MACsec stats Akhil Goyal
2023-06-14 13:08 ` [PATCH v5 07/15] common/cnxk: add MACsec interrupt APIs Akhil Goyal
2023-06-14 13:08 ` [PATCH v5 08/15] common/cnxk: add MACsec port configuration Akhil Goyal
2023-06-14 13:08 ` [PATCH v5 09/15] common/cnxk: add MACsec control " Akhil Goyal
2023-06-14 13:08 ` [PATCH v5 10/15] common/cnxk: add MACsec FIPS mbox Akhil Goyal
2023-06-14 13:08 ` [PATCH v5 11/15] common/cnxk: derive hash key for MACsec Akhil Goyal
2023-06-14 13:08 ` [PATCH v5 12/15] net/cnxk: add MACsec initialization Akhil Goyal
2023-06-14 13:08 ` [PATCH v5 13/15] net/cnxk: create/destroy MACsec SC/SA Akhil Goyal
2023-06-14 13:09 ` [PATCH v5 14/15] net/cnxk: add MACsec session and flow configuration Akhil Goyal
2023-06-14 13:09 ` [PATCH v5 15/15] net/cnxk: add MACsec stats Akhil Goyal
2023-06-15 7:03 ` Jerin Jacob
2022-09-28 12:52 ` [PATCH v2 0/3] security: support MACsec Akhil Goyal
2022-09-28 18:24 ` [PATCH v3 " Akhil Goyal
2022-09-28 18:24 ` [PATCH v3 1/3] net: add MACsec header Akhil Goyal
2022-09-28 18:24 ` [PATCH v3 2/3] ethdev: add MACsec flow item Akhil Goyal
2022-09-28 18:24 ` [PATCH v3 3/3] security: support MACsec Akhil Goyal
2022-09-28 20:04 ` [PATCH v3 0/3] " Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230613071614.2259604-8-gakhil@marvell.com \
--to=gakhil@marvell.com \
--cc=adwivedi@marvell.com \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=jerinj@marvell.com \
--cc=ndabilpuram@marvell.com \
--cc=thomas@monjalon.net \
--cc=vattunuru@marvell.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).