xdp/trace: extend tracepoint in devmap with an err

Extending tracepoint xdp:xdp_devmap_xmit in devmap with an err code
allow people to easier identify the reason behind the ndo_xdp_xmit
call to a given driver is failing.

Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
This commit is contained in:
Jesper Dangaard Brouer 2018-05-24 16:46:17 +02:00 committed by Alexei Starovoitov
parent 735fc4054b
commit e74de52e55
2 changed files with 9 additions and 6 deletions

View file

@ -220,7 +220,7 @@ static int bq_xmit_all(struct bpf_dtab_netdev *obj,
struct xdp_bulk_queue *bq)
{
struct net_device *dev = obj->dev;
int sent = 0, drops = 0;
int sent = 0, drops = 0, err = 0;
int i;
if (unlikely(!bq->count))
@ -234,6 +234,7 @@ static int bq_xmit_all(struct bpf_dtab_netdev *obj,
sent = dev->netdev_ops->ndo_xdp_xmit(dev, bq->count, bq->q);
if (sent < 0) {
err = sent;
sent = 0;
goto error;
}
@ -242,7 +243,7 @@ out:
bq->count = 0;
trace_xdp_devmap_xmit(&obj->dtab->map, obj->bit,
sent, drops, bq->dev_rx, dev);
sent, drops, bq->dev_rx, dev, err);
bq->dev_rx = NULL;
return 0;
error: