Skip to content

Commit 22c68f8

Browse files
committed
solo5: Minor tweaks to solo5net
1 parent 1d76060 commit 22c68f8

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

src/drivers/solo5net.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ Solo5Net::Solo5Net()
4343
mac_addr = MAC::Addr(solo5_net_mac_str());
4444
}
4545

46-
#include <cstdlib>
4746
void Solo5Net::transmit(net::Packet_ptr pckt)
4847
{
4948
net::Packet_ptr tail = std::move(pckt);
@@ -53,12 +52,8 @@ void Solo5Net::transmit(net::Packet_ptr pckt)
5352
// next in line
5453
auto next = tail->detach_tail();
5554
// write data to network
56-
// explicitly release the data to prevent destructor being called
57-
net::Packet* pckt = tail.release();
58-
uint8_t *buf = pckt->buf();
59-
60-
solo5_net_write_sync(buf, pckt->size());
61-
55+
solo5_net_write_sync(tail->buf(), tail->size());
56+
// set tail to next, releasing tail
6257
tail = std::move(next);
6358
// Stat increase packets transmitted
6459
packets_tx_++;
@@ -99,8 +94,10 @@ net::Packet_ptr Solo5Net::recv_packet()
9994
void Solo5Net::poll()
10095
{
10196
auto pckt_ptr = recv_packet();
102-
if (pckt_ptr != nullptr)
97+
98+
if (LIKELY(pckt_ptr != nullptr)) {
10399
Link::receive(std::move(pckt_ptr));
100+
}
104101
}
105102

106103
void Solo5Net::deactivate()

0 commit comments

Comments
 (0)