Skip to content

Commit

Permalink
Minor bugs fixed.
Browse files Browse the repository at this point in the history
The nethuns_send return value is ether: -1 (in case of error), 0 (no space for packet), > 0 (the length of the packet).
  • Loading branch information
awgn committed Dec 30, 2023
1 parent e3bd081 commit 58a4dbb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/nethuns/sockets/netmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -373,12 +373,13 @@ nethuns_send_netmap(struct nethuns_socket_netmap *s, uint8_t const *packet, unsi
uint8_t *dst;

if (__atomic_load_n(&slot->inuse, __ATOMIC_RELAXED))
return -1;
return 0;

dst = nethuns_get_buf_addr_netmap(s, b->tx_ring.tail);
nm_pkt_copy(packet, dst, len);
nethuns_send_slot(s, b->tx_ring.tail, len);
b->tx_ring.tail++;
return 1;
return len;
}


Expand Down
3 changes: 1 addition & 2 deletions src/nethuns/sockets/xdp.c
Original file line number Diff line number Diff line change
Expand Up @@ -796,8 +796,7 @@ nethuns_send_xdp(struct nethuns_socket_xdp *s, uint8_t const *packet, unsigned i
memcpy(frame, packet, len);
s->base.tx_ring.tail++;
nethuns_send_slot(s, tail, len);
//printf("marking slot %d\n", tail);
return 1;
return len;
}

int
Expand Down

0 comments on commit 58a4dbb

Please sign in to comment.