Skip to content

Commit 4079fd9

Browse files
committed
mctpd: remove req_type argument from endpoint query functions
We're a MCTP Control Protocol implementation, all our messages will be the control protocol type. Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
1 parent 4759f5e commit 4079fd9

1 file changed

Lines changed: 22 additions & 24 deletions

File tree

src/mctpd.c

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1772,9 +1772,8 @@ static int endpoint_query_addr(struct ctx *ctx,
17721772

17731773
/* Queries an endpoint peer. Addressing is standard eid/net.
17741774
*/
1775-
static int endpoint_query_peer(const struct peer *peer, uint8_t req_type,
1776-
const void *req, size_t req_len, uint8_t **resp,
1777-
size_t *resp_len,
1775+
static int endpoint_query_peer(const struct peer *peer, const void *req,
1776+
size_t req_len, uint8_t **resp, size_t *resp_len,
17781777
struct sockaddr_mctp_ext *resp_addr)
17791778
{
17801779
struct sockaddr_mctp_ext addr = { 0 };
@@ -1788,7 +1787,7 @@ static int endpoint_query_peer(const struct peer *peer, uint8_t req_type,
17881787
addr.smctp_base.smctp_network = peer->net;
17891788
addr.smctp_base.smctp_addr.s_addr = peer->eid;
17901789

1791-
addr.smctp_base.smctp_type = req_type;
1790+
addr.smctp_base.smctp_type = MCTP_CTRL_HDR_MSG_TYPE;
17921791
addr.smctp_base.smctp_tag = MCTP_TAG_OWNER;
17931792

17941793
return endpoint_query_addr(peer->ctx, &addr, false, req, req_len, resp,
@@ -1798,8 +1797,8 @@ static int endpoint_query_peer(const struct peer *peer, uint8_t req_type,
17981797
/* Queries an endpoint using physical addressing, null EID.
17991798
*/
18001799
static int endpoint_query_phys(struct ctx *ctx, const dest_phys *dest,
1801-
uint8_t req_type, const void *req,
1802-
size_t req_len, uint8_t **resp, size_t *resp_len,
1800+
const void *req, size_t req_len, uint8_t **resp,
1801+
size_t *resp_len,
18031802
struct sockaddr_mctp_ext *resp_addr)
18041803
{
18051804
struct sockaddr_mctp_ext addr = { 0 };
@@ -1818,7 +1817,7 @@ static int endpoint_query_phys(struct ctx *ctx, const dest_phys *dest,
18181817
addr.smctp_halen = dest->hwaddr_len;
18191818
memcpy(addr.smctp_haddr, dest->hwaddr, dest->hwaddr_len);
18201819

1821-
addr.smctp_base.smctp_type = req_type;
1820+
addr.smctp_base.smctp_type = MCTP_CTRL_HDR_MSG_TYPE;
18221821
addr.smctp_base.smctp_tag = MCTP_TAG_OWNER;
18231822

18241823
return endpoint_query_addr(ctx, &addr, true, req, req_len, resp,
@@ -1854,8 +1853,8 @@ static int endpoint_send_set_endpoint_id(const struct peer *peer,
18541853
req.operation =
18551854
mctp_ctrl_cmd_set_eid_set_eid; // TODO: do we want Force?
18561855
req.eid = peer->eid;
1857-
rc = endpoint_query_phys(peer->ctx, dest, MCTP_CTRL_HDR_MSG_TYPE, &req,
1858-
sizeof(req), &buf, &buf_size, &addr);
1856+
rc = endpoint_query_phys(peer->ctx, dest, &req, sizeof(req), &buf,
1857+
&buf_size, &addr);
18591858
if (rc < 0)
18601859
goto out;
18611860

@@ -2473,12 +2472,11 @@ static int query_get_endpoint_id(struct ctx *ctx, const dest_phys *dest,
24732472
MCTP_CTRL_CMD_GET_ENDPOINT_ID);
24742473

24752474
if (peer)
2476-
rc = endpoint_query_peer(peer, MCTP_CTRL_HDR_MSG_TYPE, &req,
2477-
sizeof(req), &buf, &buf_size, &addr);
2475+
rc = endpoint_query_peer(peer, &req, sizeof(req), &buf,
2476+
&buf_size, &addr);
24782477
else
2479-
rc = endpoint_query_phys(ctx, dest, MCTP_CTRL_HDR_MSG_TYPE,
2480-
&req, sizeof(req), &buf, &buf_size,
2481-
&addr);
2478+
rc = endpoint_query_phys(ctx, dest, &req, sizeof(req), &buf,
2479+
&buf_size, &addr);
24822480
if (rc < 0)
24832481
goto out;
24842482

@@ -2583,8 +2581,8 @@ static int query_get_peer_msgtypes(struct peer *peer)
25832581
mctp_ctrl_msg_hdr_init_req(&req.ctrl_hdr, iid,
25842582
MCTP_CTRL_CMD_GET_MESSAGE_TYPE_SUPPORT);
25852583

2586-
rc = endpoint_query_peer(peer, MCTP_CTRL_HDR_MSG_TYPE, &req,
2587-
sizeof(req), &buf, &buf_size, &addr);
2584+
rc = endpoint_query_peer(peer, &req, sizeof(req), &buf, &buf_size,
2585+
&addr);
25882586
if (rc < 0)
25892587
goto out;
25902588

@@ -2642,8 +2640,8 @@ static int query_get_peer_vdm_types(struct peer *peer)
26422640
free(buf);
26432641
buf = NULL;
26442642
}
2645-
rc = endpoint_query_peer(peer, MCTP_CTRL_HDR_MSG_TYPE, &req,
2646-
sizeof(req), &buf, &buf_size, &addr);
2643+
rc = endpoint_query_peer(peer, &req, sizeof(req), &buf,
2644+
&buf_size, &addr);
26472645
if (rc < 0)
26482646
break;
26492647

@@ -2750,8 +2748,8 @@ static int query_get_peer_uuid_by_phys(struct ctx *ctx, const dest_phys *dest,
27502748
mctp_ctrl_msg_hdr_init_req(&req.ctrl_hdr, iid,
27512749
MCTP_CTRL_CMD_GET_ENDPOINT_UUID);
27522750

2753-
rc = endpoint_query_phys(ctx, dest, MCTP_CTRL_HDR_MSG_TYPE, &req,
2754-
sizeof(req), &buf, &buf_size, &addr);
2751+
rc = endpoint_query_phys(ctx, dest, &req, sizeof(req), &buf, &buf_size,
2752+
&addr);
27552753
if (rc < 0)
27562754
goto out;
27572755

@@ -2790,8 +2788,8 @@ static int query_get_peer_uuid(struct peer *peer)
27902788
mctp_ctrl_msg_hdr_init_req(&req.ctrl_hdr, iid,
27912789
MCTP_CTRL_CMD_GET_ENDPOINT_UUID);
27922790

2793-
rc = endpoint_query_peer(peer, MCTP_CTRL_HDR_MSG_TYPE, &req,
2794-
sizeof(req), &buf, &buf_size, &addr);
2791+
rc = endpoint_query_peer(peer, &req, sizeof(req), &buf, &buf_size,
2792+
&addr);
27952793
if (rc < 0)
27962794
goto out;
27972795

@@ -5820,8 +5818,8 @@ static int endpoint_send_allocate_endpoint_ids(
58205818
req.alloc_eid_op = (uint8_t)(op & 0x03);
58215819
req.pool_size = eid_pool_size;
58225820
req.start_eid = eid_start;
5823-
rc = endpoint_query_peer(peer, MCTP_CTRL_HDR_MSG_TYPE, &req,
5824-
sizeof(req), &buf, &buf_size, &addr);
5821+
rc = endpoint_query_peer(peer, &req, sizeof(req), &buf, &buf_size,
5822+
&addr);
58255823
if (rc < 0)
58265824
goto out;
58275825

0 commit comments

Comments
 (0)