Skip to content

Commit

Permalink
Merge pull request #33 from n7space/feature-n7s-tmcc#357-passthrough-…
Browse files Browse the repository at this point in the history
…packetizer-fix

Fix in passthroughpacketizer to allow connection without destination …
  • Loading branch information
rphh authored Jan 23, 2024
2 parents 63a60de + cedddff commit c4c9ccd
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Packetizer/PassthroughPacketizer.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PassthroughPacketizer_init(Packetizer* const self, const enum SystemBus busId, s

*headerSize = 0;

if(bus_to_unique_port_map[busId] == INTERFACE_INVALID_ID) {
if(bus_to_unique_port_map[busId] == INTERFACE_INVALID_ID && bus_has_any_destination_port[busId] != 0) {
// Passthrough Packetizer requires an unique interface on bus.
abort();
}
Expand Down
15 changes: 15 additions & 0 deletions src/RuntimeCommon/RoutingHelper.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,18 @@ find_unique_destination(const enum SystemBus bus)

return (enum RemoteInterface)found_interface;
}

int
check_bus_has_any_destination_port(const enum SystemBus bus)
{
size_t index;
int result = 0;
for(index = 0; index < INTERFACE_MAX_ID; ++index) {
if(port_to_partition_bus_map[index].partition != PARTITION_NAME
&& port_to_partition_bus_map[index].bus == bus) {
result = 1;
}
}

return result;
}
7 changes: 7 additions & 0 deletions src/RuntimeCommon/RoutingHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,11 @@
*/
enum RemoteInterface find_unique_destination(const enum SystemBus bus);

/** @brief Check if bus has any destination port.
*
* @param[bus] system bus
* @return 0 if bus does not have any destination port, otherwise non-zero value
*/
int check_bus_has_any_destination_port(const enum SystemBus bus);

#endif
1 change: 1 addition & 0 deletions src/RuntimeMocks/routing.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "routing.h"

enum RemoteInterface bus_to_unique_port_map[] = { INTERFACE_INVALID_ID };
int bus_has_any_destination_port[] = { 0 };
1 change: 1 addition & 0 deletions src/RuntimeMocks/routing.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
#define PARTITION_NAME X86_PARTITION

extern enum RemoteInterface bus_to_unique_port_map[];
extern int bus_has_any_destination_port[];

0 comments on commit c4c9ccd

Please sign in to comment.