transport: Fix doxygen and variables for send and recv functions
This was missed updated properly when making the transport functions
work for both requesters and responders.
Fixes: c1b66f420912 ("requester: Add new APIs to support multiple transports")
Signed-off-by: Rashmica Gupta <rashmica@linux.ibm.com>
Change-Id: Ie32f11a98ab1b11caaafbca5e837e1eda5c9cc37
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 55155f4..9662f8b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -33,6 +33,7 @@
1. transport: register init_pollfd callback for af-mctp
2. transport: fix init_pollfd function parameter
+3. transport: Fix doxygen and variables for send and recv functions
## [0.5.0] - 2023-08-09
diff --git a/include/libpldm/transport.h b/include/libpldm/transport.h
index bea0436..6554c4f 100644
--- a/include/libpldm/transport.h
+++ b/include/libpldm/transport.h
@@ -39,11 +39,10 @@
*
* @param[in] ctx - pldm transport instance
* @param[in] tid - destination PLDM TID
- * @param[in] pldm_req_msg - caller owned pointer to PLDM request msg or async
- * notification. If this is NULL, PLDM_REQUESTER_INVALID_SETUP is
- * returned.
- * @param[in] req_msg_len - size of PLDM request msg. If this is less than the
- * minimum size of a PLDM msg PLDM_REQUESTER_NOT_REQ_MSG is returned.
+ * @param[in] pldm_msg - caller owned pointer to PLDM msg. If this is NULL,
+ * PLDM_REQUESTER_INVALID_SETUP is returned.
+ * @param[in] msg_len - size of PLDM msg. If this is less than the minimum size
+ * of a PLDM msg PLDM_REQUESTER_NOT_REQ_MSG is returned.
* Otherwise, if this is not the correct length of the PLDM msg,
* behaviour is undefined.
*
@@ -51,12 +50,11 @@
*/
pldm_requester_rc_t pldm_transport_send_msg(struct pldm_transport *transport,
pldm_tid_t tid,
- const void *pldm_req_msg,
- size_t req_msg_len);
+ const void *pldm_msg,
+ size_t msg_len);
/**
- * @brief Asynchronously get a PLDM response message for the given TID
- * regardless of instance ID. Control is immediately returned to the
+ * @brief Asynchronously get a PLDM message. Control is immediately returned to the
* caller.
*
* @pre The pldm transport instance must be initialised; otherwise,
@@ -66,22 +64,21 @@
*
* @param[in] ctx - pldm transport instance
* @param[in] tid - destination PLDM TID
- * @param[out] pldm_resp_msg - *pldm_resp_msg will point to PLDM response msg if
+ * @param[out] pldm_msg - *pldm_msg will point to the received PLDM msg if
* return code is PLDM_REQUESTER_SUCCESS; otherwise, NULL. On
* success this function allocates memory, caller to
- * free(*pldm_resp_msg).
- * @param[out] resp_msg_len - caller owned pointer that will be made to point to
- * the size of the PLDM response msg. If NULL,
+ * free(*pldm_msg).
+ * @param[out] msg_len - caller owned pointer that will be made to point to
+ * the size of the PLDM msg. If NULL,
* PLDM_REQUESTER_INVALID_SETUP is returned.
*
* @return pldm_requester_rc_t (errno may be set). Failure is returned if no
- * PLDM response messages are available.
+ * PLDM messages are available.
*
*/
pldm_requester_rc_t pldm_transport_recv_msg(struct pldm_transport *transport,
- pldm_tid_t tid,
- void **pldm_resp_msg,
- size_t *resp_msg_len);
+ pldm_tid_t tid, void **pldm_msg,
+ size_t *msg_len);
/**
* @brief Synchronously send a PLDM request and receive the response. Control is
diff --git a/src/transport/af-mctp.c b/src/transport/af-mctp.c
index ab2cc1c..fa8ba2e 100644
--- a/src/transport/af-mctp.c
+++ b/src/transport/af-mctp.c
@@ -81,8 +81,8 @@
static pldm_requester_rc_t pldm_transport_af_mctp_recv(struct pldm_transport *t,
pldm_tid_t tid,
- void **pldm_resp_msg,
- size_t *resp_msg_len)
+ void **pldm_msg,
+ size_t *msg_len)
{
struct pldm_transport_af_mctp *af_mctp = transport_to_af_mctp(t);
mctp_eid_t eid = 0;
@@ -95,20 +95,21 @@
if (length <= 0) {
return PLDM_REQUESTER_RECV_FAIL;
}
- *pldm_resp_msg = malloc(length);
- length = recv(af_mctp->socket, *pldm_resp_msg, length, MSG_TRUNC);
+ *pldm_msg = malloc(length);
+ length = recv(af_mctp->socket, *pldm_msg, length, MSG_TRUNC);
if (length < (ssize_t)sizeof(struct pldm_msg_hdr)) {
- free(*pldm_resp_msg);
+ free(*pldm_msg);
return PLDM_REQUESTER_INVALID_RECV_LEN;
}
- *resp_msg_len = length;
+ *msg_len = length;
+
return PLDM_REQUESTER_SUCCESS;
}
static pldm_requester_rc_t pldm_transport_af_mctp_send(struct pldm_transport *t,
pldm_tid_t tid,
- const void *pldm_req_msg,
- size_t req_msg_len)
+ const void *pldm_msg,
+ size_t msg_len)
{
struct pldm_transport_af_mctp *af_mctp = transport_to_af_mctp(t);
mctp_eid_t eid = 0;
@@ -122,13 +123,13 @@
addr.smctp_type = MCTP_MSG_TYPE_PLDM;
addr.smctp_tag = MCTP_TAG_OWNER;
- if (req_msg_len > INT_MAX ||
+ if (msg_len > INT_MAX ||
pldm_socket_sndbuf_accomodate(&(af_mctp->socket_send_buf),
- (int)req_msg_len)) {
+ (int)msg_len)) {
return PLDM_REQUESTER_SEND_FAIL;
}
- ssize_t rc = sendto(af_mctp->socket, pldm_req_msg, req_msg_len, 0,
+ ssize_t rc = sendto(af_mctp->socket, pldm_msg, msg_len, 0,
(struct sockaddr *)&addr, sizeof(addr));
if (rc == -1) {
return PLDM_REQUESTER_SEND_FAIL;
diff --git a/src/transport/mctp-demux.c b/src/transport/mctp-demux.c
index 25b1eb3..1aed605 100644
--- a/src/transport/mctp-demux.c
+++ b/src/transport/mctp-demux.c
@@ -112,7 +112,7 @@
static pldm_requester_rc_t
pldm_transport_mctp_demux_recv(struct pldm_transport *t, pldm_tid_t tid,
- void **pldm_resp_msg, size_t *resp_msg_len)
+ void **pldm_msg, size_t *msg_len)
{
struct pldm_transport_mctp_demux *demux = transport_to_demux(t);
mctp_eid_t eid = 0;
@@ -157,14 +157,14 @@
free(buf);
return PLDM_REQUESTER_NOT_PLDM_MSG;
}
- *pldm_resp_msg = buf;
- *resp_msg_len = pldm_len;
+ *pldm_msg = buf;
+ *msg_len = pldm_len;
return PLDM_REQUESTER_SUCCESS;
}
static pldm_requester_rc_t
pldm_transport_mctp_demux_send(struct pldm_transport *t, pldm_tid_t tid,
- const void *pldm_req_msg, size_t req_msg_len)
+ const void *pldm_msg, size_t msg_len)
{
struct pldm_transport_mctp_demux *demux = transport_to_demux(t);
mctp_eid_t eid = 0;
@@ -177,16 +177,16 @@
struct iovec iov[2];
iov[0].iov_base = hdr;
iov[0].iov_len = sizeof(hdr);
- iov[1].iov_base = (uint8_t *)pldm_req_msg;
- iov[1].iov_len = req_msg_len;
+ iov[1].iov_base = (uint8_t *)pldm_msg;
+ iov[1].iov_len = msg_len;
struct msghdr msg = { 0 };
msg.msg_iov = iov;
msg.msg_iovlen = sizeof(iov) / sizeof(iov[0]);
- if (req_msg_len > INT_MAX ||
+ if (msg_len > INT_MAX ||
pldm_socket_sndbuf_accomodate(&(demux->socket_send_buf),
- (int)req_msg_len)) {
+ (int)msg_len)) {
return PLDM_REQUESTER_SEND_FAIL;
}
diff --git a/src/transport/transport.c b/src/transport/transport.c
index b860e2c..c78ec89 100644
--- a/src/transport/transport.c
+++ b/src/transport/transport.c
@@ -60,39 +60,38 @@
LIBPLDM_ABI_TESTING
pldm_requester_rc_t pldm_transport_send_msg(struct pldm_transport *transport,
pldm_tid_t tid,
- const void *pldm_req_msg,
- size_t req_msg_len)
+ const void *pldm_msg,
+ size_t msg_len)
{
- if (!transport || !pldm_req_msg) {
+ if (!transport || !pldm_msg) {
return PLDM_REQUESTER_INVALID_SETUP;
}
- if (req_msg_len < sizeof(struct pldm_msg_hdr)) {
+ if (msg_len < sizeof(struct pldm_msg_hdr)) {
return PLDM_REQUESTER_NOT_REQ_MSG;
}
- return transport->send(transport, tid, pldm_req_msg, req_msg_len);
+ return transport->send(transport, tid, pldm_msg, msg_len);
}
LIBPLDM_ABI_TESTING
pldm_requester_rc_t pldm_transport_recv_msg(struct pldm_transport *transport,
- pldm_tid_t tid,
- void **pldm_resp_msg,
- size_t *resp_msg_len)
+ pldm_tid_t tid, void **pldm_msg,
+ size_t *msg_len)
{
- if (!transport || !resp_msg_len) {
+ if (!transport || !msg_len) {
return PLDM_REQUESTER_INVALID_SETUP;
}
pldm_requester_rc_t rc =
- transport->recv(transport, tid, pldm_resp_msg, resp_msg_len);
+ transport->recv(transport, tid, pldm_msg, msg_len);
if (rc != PLDM_REQUESTER_SUCCESS) {
return rc;
}
- if (*resp_msg_len < sizeof(struct pldm_msg_hdr)) {
- free(*pldm_resp_msg);
- *pldm_resp_msg = NULL;
+ if (*msg_len < sizeof(struct pldm_msg_hdr)) {
+ free(*pldm_msg);
+ *pldm_msg = NULL;
return PLDM_REQUESTER_INVALID_RECV_LEN;
}
return PLDM_REQUESTER_SUCCESS;
diff --git a/src/transport/transport.h b/src/transport/transport.h
index 0353b25..dd18c02 100644
--- a/src/transport/transport.h
+++ b/src/transport/transport.h
@@ -18,11 +18,11 @@
const char *name;
uint8_t version;
pldm_requester_rc_t (*recv)(struct pldm_transport *transport,
- pldm_tid_t tid, void **pldm_resp_msg,
- size_t *resp_msg_len);
+ pldm_tid_t tid, void **pldm_msg,
+ size_t *msg_len);
pldm_requester_rc_t (*send)(struct pldm_transport *transport,
- pldm_tid_t tid, const void *pldm_req_msg,
- size_t req_msg_len);
+ pldm_tid_t tid, const void *pldm_msg,
+ size_t msg_len);
int (*init_pollfd)(struct pldm_transport *transport,
struct pollfd *pollfd);
};