@@ -177,6 +177,11 @@ struct peer {
177
177
uint8_t endpoint_type ;
178
178
uint8_t medium_spec ;
179
179
} recovery ;
180
+
181
+ // Pool size
182
+ uint8_t pool_size ;
183
+ uint8_t pool_start ;
184
+
180
185
};
181
186
typedef struct peer peer ;
182
187
@@ -1313,7 +1318,7 @@ static int endpoint_query_phys(ctx *ctx, const dest_phys *dest,
1313
1318
}
1314
1319
1315
1320
/* returns -ECONNREFUSED if the endpoint returns failure. */
1316
- static int endpoint_send_set_endpoint_id (const peer * peer , mctp_eid_t * new_eid )
1321
+ static int endpoint_send_set_endpoint_id (peer * peer , mctp_eid_t * new_eid )
1317
1322
{
1318
1323
struct sockaddr_mctp_ext addr ;
1319
1324
struct mctp_ctrl_cmd_set_eid req = {0 };
@@ -1360,9 +1365,11 @@ static int endpoint_send_set_endpoint_id(const peer *peer, mctp_eid_t *new_eid)
1360
1365
1361
1366
alloc = resp -> status & 0x3 ;
1362
1367
if (alloc != 0 ) {
1363
- // TODO for bridges
1364
- warnx ("%s requested allocation pool, unimplemented" ,
1365
- dest_phys_tostr (dest ));
1368
+ peer -> pool_size = resp -> eid_pool_size ;
1369
+ if (peer -> ctx -> verbose ) {
1370
+ warnx ("%s requested allocation of pool size = %d" ,
1371
+ dest_phys_tostr (dest ), peer -> pool_size );
1372
+ }
1366
1373
}
1367
1374
1368
1375
rc = 0 ;
@@ -2114,7 +2121,7 @@ static int method_assign_endpoint_static(sd_bus_message *call, void *data,
2114
2121
char * peer_path = NULL ;
2115
2122
peer * peer = NULL ;
2116
2123
ctx * ctx = data ;
2117
- uint8_t eid ;
2124
+ uint8_t eid , start_eid ;
2118
2125
int rc ;
2119
2126
2120
2127
dest -> ifindex = interface_call_to_ifindex_busowner (ctx , call );
@@ -2130,6 +2137,10 @@ static int method_assign_endpoint_static(sd_bus_message *call, void *data,
2130
2137
if (rc < 0 )
2131
2138
goto err ;
2132
2139
2140
+ rc = sd_bus_message_read (call , "y" , & start_eid );
2141
+ if (rc < 0 )
2142
+ goto err ;
2143
+
2133
2144
rc = validate_dest_phys (ctx , dest );
2134
2145
if (rc < 0 )
2135
2146
return sd_bus_error_setf (berr , SD_BUS_ERROR_INVALID_ARGS ,
@@ -2173,6 +2184,11 @@ static int method_assign_endpoint_static(sd_bus_message *call, void *data,
2173
2184
}
2174
2185
dfree (peer_path );
2175
2186
2187
+ /* MCTP Bridge Support */
2188
+ if (peer -> pool_size > 0 ) {
2189
+ peer -> pool_start = start_eid ;
2190
+ }
2191
+
2176
2192
return sd_bus_reply_method_return (call , "yisb" ,
2177
2193
peer -> eid , peer -> net , peer_path , 1 );
2178
2194
err :
@@ -2852,9 +2868,10 @@ static const sd_bus_vtable bus_owner_vtable[] = {
2852
2868
0 ),
2853
2869
2854
2870
SD_BUS_METHOD_WITH_NAMES ("AssignEndpointStatic" ,
2855
- "ayy " ,
2871
+ "ayyy " ,
2856
2872
SD_BUS_PARAM (physaddr )
2857
- SD_BUS_PARAM (eid ),
2873
+ SD_BUS_PARAM (eid )
2874
+ SD_BUS_PARAM (start_eid ),
2858
2875
"yisb" ,
2859
2876
SD_BUS_PARAM (eid )
2860
2877
SD_BUS_PARAM (net )
0 commit comments