From: "WanRenyong" <wanry@yunsilicon.com>
To: <dev@dpdk.org>
Cc: <ferruh.yigit@amd.com>, "WanRenyong" <wanry@yunsilicon.com>
Subject: [PATCH v3 11/19] net/xsc: add mailbox and structure
Date: Wed, 18 Sep 2024 14:09:28 +0800 [thread overview]
Message-ID: <20240918060936.1231758-12-wanry@yunsilicon.com> (raw)
Mailbox is a communication channel between driver and firmware.
Signed-off-by: WanRenyong <wanry@yunsilicon.com>
---
drivers/net/xsc/xsc_ctrl.c | 8 ++++++++
drivers/net/xsc/xsc_ctrl.h | 31 +++++++++++++++++++++++++++++++
2 files changed, 39 insertions(+)
diff --git a/drivers/net/xsc/xsc_ctrl.c b/drivers/net/xsc/xsc_ctrl.c
index 956a8549e6..fe294a8bc7 100644
--- a/drivers/net/xsc/xsc_ctrl.c
+++ b/drivers/net/xsc/xsc_ctrl.c
@@ -55,3 +55,11 @@ xsc_ioctl(struct xsc_dev *dev, int cmd, int opcode,
free(hdr);
return ret;
}
+
+int
+xsc_mailbox_exec(struct xsc_dev *dev, void *data_in,
+ int in_len, void *data_out, int out_len)
+{
+ /* ignore opcode in hdr->attr when cmd = XSC_IOCTL_CMDQ_RAW */
+ return xsc_ioctl(dev, XSC_IOCTL_CMDQ_RAW, 0, data_in, in_len, data_out, out_len);
+}
diff --git a/drivers/net/xsc/xsc_ctrl.h b/drivers/net/xsc/xsc_ctrl.h
index 833984745b..7b4d9db9ed 100644
--- a/drivers/net/xsc/xsc_ctrl.h
+++ b/drivers/net/xsc/xsc_ctrl.h
@@ -40,6 +40,35 @@ struct xsc_ioctl_hdr {
struct xsc_ioctl_attr attr;
};
+/* ioctl */
+struct xsc_inbox_hdr {
+ __be16 opcode;
+ uint8_t rsvd[4];
+ __be16 opmod;
+};
+
+struct xsc_outbox_hdr {
+ uint8_t status;
+ uint8_t rsvd[3];
+ __be32 syndrome;
+};
+
+/* ioctl mbox */
+struct xsc_ioctl_mbox_in {
+ struct xsc_inbox_hdr hdr;
+ __be16 len;
+ __be16 rsvd;
+ uint8_t data[];
+};
+
+struct xsc_ioctl_mbox_out {
+ struct xsc_outbox_hdr hdr;
+ __be32 error;
+ __be16 len;
+ __be16 rsvd;
+ uint8_t data[];
+};
+
struct xsc_ioctl_data_tl {
uint16_t table;
uint16_t opmod;
@@ -82,5 +111,7 @@ struct xsc_ioctl_get_hwinfo {
int xsc_ioctl(struct xsc_dev *dev, int cmd, int opcode,
void *data_in, int in_len, void *data_out, int out_len);
+int xsc_mailbox_exec(struct xsc_dev *dev, void *data_in,
+ int in_len, void *data_out, int out_len);
#endif /* _XSC_CTRL_H_ */
--
2.25.1
reply other threads:[~2024-09-18 6:11 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20240918060936.1231758-12-wanry@yunsilicon.com \
--to=wanry@yunsilicon.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@amd.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).