Skip to content

Commit

Permalink
Fix: error handling in mt_af_xdp.c
Browse files Browse the repository at this point in the history
xsk_umem__create can return positive and negative values as error codes

Signed-off-by: Kasiewicz, Marek <marek.kasiewicz@intel.com>
  • Loading branch information
Sakoram committed Feb 17, 2025
1 parent 6ac463d commit a0b9073
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/src/dev/mt_af_xdp.c
Original file line number Diff line number Diff line change
Expand Up @@ -317,13 +317,13 @@ static int xdp_umem_init(struct mt_xdp_priv* xdp, struct mt_xdp_queue* xq) {
umem_size);
ret = xsk_umem__create(&xq->umem, aligned_base_addr, umem_size, &xq->rx_prod,
&xq->tx_cons, &cfg);
if (ret < 0) {
if (ret) {
err("%s(%d,%u), umem create fail %d %s\n", __func__, port, q, ret, strerror(errno));
if (ret == -EPERM)
err("%s(%d,%u), please add capability for the app: sudo setcap 'cap_net_raw+ep' "
"<app>\n",
__func__, port, q);
return ret;
return -EINVAL;
}
xq->umem_buffer = aligned_base_addr;

Expand Down

0 comments on commit a0b9073

Please sign in to comment.