csp_if_udp: rx_work: Pass MTU
csp_if_udp_rx_work uses iface->mtu in two places.  We pass in iface to
the function so the function can get mtu from iface, but passing mtu
highlights that iface is only used for csp_qfifo_write().
@@ -39,16 +39,16 @@ static int csp_if_udp_tx(const csp_route_t * ifroute, csp_packet_t * packet) {
return CSP_ERR_NONE;
}
-int csp_if_udp_rx_work(int sockfd, struct sockaddr_in * peer_addr, csp_iface_t * iface) {
+int csp_if_udp_rx_work(int sockfd, size_t mtu, struct sockaddr_in * peer_addr, csp_iface_t * iface) {
- csp_packet_t * packet = csp_buffer_get(iface->mtu);
+ csp_packet_t * packet = csp_buffer_get(mtu);
if (packet == NULL) {
return CSP_ERR_NOMEM;
}
/* Setup RX frane to point to ID */
int header_size = csp_id_setup_rx(packet);
- int received_len = recvfrom(sockfd, (char *)packet->frame_begin, iface->mtu + header_size, MSG_WAITALL, (struct sockaddr *)peer_addr, NULL);
+ int received_len = recvfrom(sockfd, (char *)packet->frame_begin, mtu + header_size, MSG_WAITALL, (struct sockaddr *)peer_addr, NULL);
packet->frame_length = received_len;
csp_log_info("UDP peer address: %s", inet_ntoa(peer_addr->sin_addr));
@@ -87,7 +87,7 @@ CSP_DEFINE_TASK(csp_if_udp_rx_loop) {
while (1) {
int ret;
- ret = csp_if_udp_rx_work(sockfd, &ifconf->peer_addr, iface);
+ ret = csp_if_udp_rx_work(sockfd, iface->mtu, &ifconf->peer_addr, iface);
if (ret == CSP_ERR_INVAL) {
iface->rx_error++;
} else if (ret == CSP_ERR_NOMEM) {
