Re: [PATCH bpf-next v4 1/2] bpf, xdp: Add tracepoint to xdp attaching failure

Leon Hwang
2023-08-01T03:48:11Z

On 1/8/23 10:43, Jakub Kicinski wrote:
> On Sun, 30 Jul 2023 19:49:50 +0800 Leon Hwang wrote:
>> @@ -9472,6 +9473,7 @@ int bpf_xdp_link_attach(const union bpf_attr *attr, struct bpf_prog *prog)
>> struct bpf_link_primer link_primer;
>> struct bpf_xdp_link *link;
>> struct net_device *dev;
>> + struct netlink_ext_ack extack;
>
> This is not initialized. Also, while fixing that, move it up
> to maintain the line order by decreasing line length.
>

Thank you for your reviewing.

I'll fix it by initializing extack and moving the line to its appropriate position.

Thanks,
Leon

>> int err, fd;
>>
>> rtnl_lock();
>> @@ -9497,12 +9499,13 @@ int bpf_xdp_link_attach(const union bpf_attr *attr, struct bpf_prog *prog)
>> goto unlock;
>> }
>>
>> - err = dev_xdp_attach_link(dev, NULL, link);
>> + err = dev_xdp_attach_link(dev, &extack, link);
>> rtnl_unlock();
>>
>> if (err) {
>> link->dev = NULL;
>> bpf_link_cleanup(&link_primer);
>> + trace_bpf_xdp_link_attach_failed(extack._msg);