|
6 | 6 | #include "lls_linux.h" |
7 | 7 | #include "common/NetworkMapper.h" |
8 | 8 |
|
9 | | -#ifdef __linux__ |
| 9 | +#if defined(__linux__) && !defined(BUILD_XDP_BACKEND) |
10 | 10 |
|
11 | 11 | std::optional<uint64_t> LowLatSocket::get_mac(uint16_t id) { |
12 | 12 | return m_mapper->get_mac_by_uid(id); |
13 | 13 | } |
14 | 14 |
|
15 | | -#ifdef __linux__ |
16 | | - |
17 | 15 | LowLatSocket::LowLatSocket(uint16_t self_uid, std::shared_ptr<NetworkMapper> mapper) { |
18 | 16 | m_socket = 0; |
19 | 17 | m_iface_addr = {}; |
@@ -78,46 +76,6 @@ IfaceMeta get_iface_meta(const std::string &name) { |
78 | 76 | return meta; |
79 | 77 | } |
80 | 78 |
|
81 | | -#else |
82 | | -// Embeddable interface that must be private |
83 | | -extern "C" IfaceMeta _fetch_iface_meta(std::string& name); |
84 | | - |
85 | | -IfaceMeta get_iface_meta(std::string& name) { |
86 | | - return _fetch_iface_meta(name); |
87 | | -} |
88 | | - |
89 | | -LowLatSocket::LowLatSocket(uint16_t self_uid, std::shared_ptr<NetworkMapper> mapper) { |
90 | | - m_socket = 0; |
91 | | - m_self_uid = self_uid; |
92 | | - m_mapper = std::move(mapper); |
93 | | -} |
94 | | - |
95 | | -LowLatSocket::~LowLatSocket() { |
96 | | - |
97 | | -} |
98 | | - |
99 | | -bool LowLatSocket::init_socket(std::string interface, EthProtocol proto) { |
100 | | - IfaceMeta meta = get_iface_meta(interface); |
101 | | - memcpy(m_iface_addr, meta.mac, 6); |
102 | | - |
103 | | - memset(m_hdr.h_dest, 0xFF, 6); |
104 | | - memcpy(m_hdr.h_source, meta.mac, 6); |
105 | | - m_hdr.h_proto = htons(proto); |
106 | | - m_self_proto = proto; |
107 | | - |
108 | | - return true; |
109 | | -} |
110 | | - |
111 | | -int LowLatSocket::send_data_internal(uint8_t *data, size_t size) { |
112 | | - return _send_data(data, size); |
113 | | -} |
114 | | - |
115 | | -int LowLatSocket::recv_data_internal(uint8_t *data, size_t size) const { |
116 | | - return _recv_data(data, size, m_self_proto); |
117 | | -} |
118 | | - |
119 | | -#endif // __linux__ |
120 | | - |
121 | 79 | bool LowLatSocket::format_packet_header(uint8_t *packet_buffer, uint16_t dest_uid, size_t packet_size) { |
122 | 80 | INT_LLP<1>* llpck = reinterpret_cast<INT_LLP<1> *>(packet_buffer); |
123 | 81 | llpck->eth_header = m_hdr; |
|
0 commit comments