From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4403E45BB3; Wed, 23 Oct 2024 17:01:56 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3258240F16; Wed, 23 Oct 2024 17:01:56 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 3FF3C40613 for ; Wed, 23 Oct 2024 17:01:54 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49NDGhTk027824 for ; Wed, 23 Oct 2024 08:01:53 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= cc:content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to; s=pfpt0220; bh=Bunqi9p9X1w9jXKMsYsKBPV ezX7phbwx2NvnxLYopZM=; b=hsJhrR6YfQWgpTVDIjO7szfOzCPHcNyjGt6b4/c h8xp7N+hqXvwOJm5mH9aGAaocNpf9PTKbLT/PqIhCWXxW/Bd+3eZ9ekzxD1cB4ab c2dU2u+PTc6XDLWB79XXUpwAU0LP1e6plexzccxnZ5iFo6fh5iyAIw9J8SiRKxQS Pg2TbJ5EWMANTrCUcPlE+jJptfggCy3SnHdpmWqa0OQsyAitoYOnVBcBjCXzXJ+J ZC4mWQpLvvbqmjt9hy0/HSRUTTDeLC+/poSN4bOfI4dDWZNz9gIW0DTMnG5oAR2A OMuTZNIsCfK3HKQjuhTl4MsYEconWNeMCZFCtmZ7ETzAAew== Received: from dc5-exch05.marvell.com ([199.233.59.128]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 42f1vsg87d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 23 Oct 2024 08:01:53 -0700 (PDT) Received: from DC5-EXCH05.marvell.com (10.69.176.209) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Wed, 23 Oct 2024 08:01:52 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Wed, 23 Oct 2024 08:01:52 -0700 Received: from localhost.localdomain (unknown [10.29.52.211]) by maili.marvell.com (Postfix) with ESMTP id 356C73F7069; Wed, 23 Oct 2024 08:01:48 -0700 (PDT) From: Harman Kalra To: Nithin Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao , Harman Kalra CC: , Ankur Dwivedi Subject: [PATCH 1/8] common/cnxk: common mbox for representor events Date: Wed, 23 Oct 2024 20:31:35 +0530 Message-ID: <20241023150143.113877-1-hkalra@marvell.com> X-Mailer: git-send-email 2.46.0.469.g4590f2e941 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: kyyfSA7Y8zhPGqYp1D1XeHUFwWmcCv_K X-Proofpoint-GUID: kyyfSA7Y8zhPGqYp1D1XeHUFwWmcCv_K X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Ankur Dwivedi Adding a common mbox which can process multiple representor events under one mbox ID. Different types of events like, representee state change, MTU change all can be sent as different events but via same mbox. Signed-off-by: Ankur Dwivedi Signed-off-by: Harman Kalra --- drivers/common/cnxk/roc_dev.c | 68 +++++++++++++------------------ drivers/common/cnxk/roc_eswitch.h | 7 ++++ drivers/common/cnxk/roc_mbox.h | 28 ++++++++----- 3 files changed, 53 insertions(+), 50 deletions(-) diff --git a/drivers/common/cnxk/roc_dev.c b/drivers/common/cnxk/roc_dev.c index c905d35ea6..45f007325e 100644 --- a/drivers/common/cnxk/roc_dev.c +++ b/drivers/common/cnxk/roc_dev.c @@ -543,16 +543,16 @@ pf_vf_mbox_send_up_msg(struct dev *dev, void *rec_msg) } static int -mbox_up_handler_rep_repte_notify(struct dev *dev, struct rep_repte_req *req, struct msg_rsp *rsp) +mbox_up_handler_rep_event_up_notify(struct dev *dev, struct rep_event *req, struct msg_rsp *rsp) { struct roc_eswitch_repte_notify_msg *notify_msg; int rc = 0; + plt_base_dbg("mbox_up_handler_rep_event_up_notify"); 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), req->hdr.id, mbox_id2name(req->hdr.id), dev_get_pf(req->hdr.pcifunc), dev_get_vf(req->hdr.pcifunc)); - plt_base_dbg("repte pcifunc %x, enable %d", req->repte_pcifunc, req->enable); if (dev->ops && dev->ops->repte_notify) { notify_msg = plt_zmalloc(sizeof(struct roc_eswitch_repte_notify_msg), 0); if (!notify_msg) { @@ -560,49 +560,39 @@ mbox_up_handler_rep_repte_notify(struct dev *dev, struct rep_repte_req *req, str rc = -ENOMEM; goto fail; } - notify_msg->type = ROC_ESWITCH_REPTE_STATE; - notify_msg->state.hw_func = req->repte_pcifunc; - notify_msg->state.enable = req->enable; - rc = dev->ops->repte_notify(dev->roc_nix, (void *)notify_msg); - if (rc < 0) - plt_err("Failed to sent new representee %x notification to %s", - req->repte_pcifunc, (req->enable == true) ? "enable" : "disable"); - - plt_free(notify_msg); - } -fail: - rsp->hdr.rc = rc; - return rc; -} - -static int -mbox_up_handler_rep_set_mtu(struct dev *dev, struct rep_mtu *req, struct msg_rsp *rsp) -{ - struct roc_eswitch_repte_notify_msg *notify_msg; - int rc = 0; - - 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), req->hdr.id, mbox_id2name(req->hdr.id), - dev_get_pf(req->hdr.pcifunc), dev_get_vf(req->hdr.pcifunc)); - - plt_base_dbg("rep pcifunc %x, rep id %d mtu %d", req->rep_pcifunc, req->rep_id, req->mtu); - if (dev->ops && dev->ops->repte_notify) { - notify_msg = plt_zmalloc(sizeof(struct roc_eswitch_repte_notify_msg), 0); - if (!notify_msg) { - plt_err("Failed to allocate memory"); - rc = -ENOMEM; + switch (req->event) { + case RVU_EVENT_PORT_STATE: + plt_base_dbg("pcifunc %x, port_state %d", req->pcifunc, + req->evt_data.port_state); + notify_msg->type = ROC_ESWITCH_LINK_STATE; + notify_msg->link.hw_func = req->pcifunc; + notify_msg->link.enable = req->evt_data.port_state; + break; + case RVU_EVENT_PFVF_STATE: + plt_base_dbg("pcifunc %x, repte_state %d", req->pcifunc, + req->evt_data.vf_state); + notify_msg->type = ROC_ESWITCH_REPTE_STATE; + notify_msg->state.hw_func = req->pcifunc; + notify_msg->state.enable = req->evt_data.vf_state; + break; + case RVU_EVENT_MTU_CHANGE: + plt_base_dbg("pcifunc %x, mtu val %d", req->pcifunc, req->evt_data.mtu); + notify_msg->type = ROC_ESWITCH_REPTE_MTU; + notify_msg->mtu.hw_func = req->pcifunc; + notify_msg->mtu.mtu = req->evt_data.mtu; + break; + default: + plt_err("Unknown event type %u", req->event); + plt_free(notify_msg); + rc = -EINVAL; goto fail; } - notify_msg->type = ROC_ESWITCH_REPTE_MTU; - notify_msg->mtu.hw_func = req->rep_pcifunc; - notify_msg->mtu.rep_id = req->rep_id; - notify_msg->mtu.mtu = req->mtu; rc = dev->ops->repte_notify(dev->roc_nix, (void *)notify_msg); if (rc < 0) - plt_err("Failed to send new mtu notification for representee %x ", - req->rep_pcifunc); + plt_err("Failed to send notification type %x for representee %x", + notify_msg->type, notify_msg->state.hw_func); plt_free(notify_msg); } diff --git a/drivers/common/cnxk/roc_eswitch.h b/drivers/common/cnxk/roc_eswitch.h index b701ea69ee..45400ae77a 100644 --- a/drivers/common/cnxk/roc_eswitch.h +++ b/drivers/common/cnxk/roc_eswitch.h @@ -10,6 +10,7 @@ typedef enum roc_eswitch_repte_notify_msg_type { ROC_ESWITCH_REPTE_STATE = 0, + ROC_ESWITCH_LINK_STATE, ROC_ESWITCH_REPTE_MTU, } roc_eswitch_repte_notify_msg_type_t; @@ -18,6 +19,11 @@ struct roc_eswitch_repte_state { uint16_t hw_func; }; +struct roc_eswitch_link_state { + bool enable; + uint16_t hw_func; +}; + struct roc_eswitch_repte_mtu { uint16_t mtu; uint16_t rep_id; @@ -28,6 +34,7 @@ struct roc_eswitch_repte_notify_msg { roc_eswitch_repte_notify_msg_type_t type; union { struct roc_eswitch_repte_state state; + struct roc_eswitch_link_state link; struct roc_eswitch_repte_mtu mtu; }; }; diff --git a/drivers/common/cnxk/roc_mbox.h b/drivers/common/cnxk/roc_mbox.h index dd65946e9e..0864c0e8c0 100644 --- a/drivers/common/cnxk/roc_mbox.h +++ b/drivers/common/cnxk/roc_mbox.h @@ -361,9 +361,7 @@ struct mbox_msghdr { #define MBOX_UP_MCS_MESSAGES M(MCS_INTR_NOTIFY, 0xE00, mcs_intr_notify, mcs_intr_info, msg_rsp) -#define MBOX_UP_REP_MESSAGES \ -M(REP_REPTE_NOTIFY, 0xEF1, rep_repte_notify, rep_repte_req, msg_rsp) \ -M(REP_SET_MTU, 0xEF2, rep_set_mtu, rep_mtu, msg_rsp) +#define MBOX_UP_REP_MESSAGES M(REP_EVENT_UP_NOTIFY, 0xEF0, rep_event_up_notify, rep_event, msg_rsp) enum { #define M(_name, _id, _1, _2, _3) MBOX_MSG_##_name = _id, @@ -2919,16 +2917,24 @@ struct nix_spi_to_sa_delete_req { uint8_t __io way; }; -struct rep_repte_req { - struct mbox_msghdr hdr; - uint16_t __io repte_pcifunc; - bool __io enable; +struct rep_evt_data { + uint8_t __io port_state; + uint8_t __io vf_state; + uint16_t __io rx_mode; + uint16_t __io rx_flags; + uint16_t __io mtu; + uint64_t __io rsvd[5]; }; -struct rep_mtu { +struct rep_event { struct mbox_msghdr hdr; - uint16_t __io rep_pcifunc; - uint16_t __io rep_id; - uint16_t __io mtu; + uint16_t __io pcifunc; +#define RVU_EVENT_PORT_STATE BIT_ULL(0) +#define RVU_EVENT_PFVF_STATE BIT_ULL(1) +#define RVU_EVENT_MTU_CHANGE BIT_ULL(2) +#define RVU_EVENT_RX_MODE_CHANGE BIT_ULL(3) + uint16_t __io event; + struct rep_evt_data evt_data; }; + #endif /* __ROC_MBOX_H__ */ -- 2.46.0.469.g4590f2e941