transport: Generalise the pldm_transport_recv_msg() API

Currently pldm_transport_recv_msg() only works for requesters as the TID
param is an input. Responders need the source TID of the message
received so they know where to send the response.

The TID was being used to look up the EID mapped to the TID and failing
the function call if it didn't match. This check doesn't need to happen
at this level, and can be added in at the requester API level if
required.

Make the TID param an output, and use the EID of the message to lookup
the TID.

Change-Id: I671dbfe2d94a9ad8d77ea0ef150f1c744f928c53
Signed-off-by: Rashmica Gupta <rashmica@linux.ibm.com>
diff --git a/src/transport/transport.c b/src/transport/transport.c
index c78ec89..e800ef9 100644
--- a/src/transport/transport.c
+++ b/src/transport/transport.c
@@ -76,7 +76,7 @@
 
 LIBPLDM_ABI_TESTING
 pldm_requester_rc_t pldm_transport_recv_msg(struct pldm_transport *transport,
-					    pldm_tid_t tid, void **pldm_msg,
+					    pldm_tid_t *tid, void **pldm_msg,
 					    size_t *msg_len)
 {
 	if (!transport || !msg_len) {
@@ -172,7 +172,8 @@
 	for (cnt = 0; cnt <= (PLDM_INSTANCE_MAX + 1) * PLDM_MAX_TIDS &&
 		      pldm_transport_poll(transport, 0) == 1;
 	     cnt++) {
-		rc = pldm_transport_recv_msg(transport, tid, pldm_resp_msg,
+		pldm_tid_t l_tid;
+		rc = pldm_transport_recv_msg(transport, &l_tid, pldm_resp_msg,
 					     resp_msg_len);
 		if (rc == PLDM_REQUESTER_SUCCESS) {
 			/* This isn't the message we wanted */
@@ -207,11 +208,13 @@
 			break;
 		}
 
-		rc = pldm_transport_recv_msg(transport, tid, pldm_resp_msg,
+		pldm_tid_t src_tid;
+		rc = pldm_transport_recv_msg(transport, &src_tid, pldm_resp_msg,
 					     resp_msg_len);
 		if (rc == PLDM_REQUESTER_SUCCESS) {
 			const struct pldm_msg_hdr *resp_hdr = *pldm_resp_msg;
-			if (req_hdr->instance_id == resp_hdr->instance_id) {
+			if ((src_tid == tid) &&
+			    (req_hdr->instance_id == resp_hdr->instance_id)) {
 				return rc;
 			}