[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <877d6kcx5o.fsf@toke.dk>
Date: Tue, 17 May 2022 11:42:59 +0200
From: Toke Høiland-Jørgensen <toke@...nel.org>
To: shaozhengchao <shaozhengchao@...wei.com>,
"bpf@...r.kernel.org" <bpf@...r.kernel.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"ast@...nel.org" <ast@...nel.org>,
"daniel@...earbox.net" <daniel@...earbox.net>,
"davem@...emloft.net" <davem@...emloft.net>,
"kuba@...nel.org" <kuba@...nel.org>,
"hawk@...nel.org" <hawk@...nel.org>,
"john.fastabend@...il.com" <john.fastabend@...il.com>,
"andrii@...nel.org" <andrii@...nel.org>,
"kafai@...com" <kafai@...com>,
"songliubraving@...com" <songliubraving@...com>,
"yhs@...com" <yhs@...com>,
"kpsingh@...nel.org" <kpsingh@...nel.org>
Cc: "weiyongjun (A)" <weiyongjun1@...wei.com>,
yuehaibing <yuehaibing@...wei.com>
Subject: Re: 答复: 答复: [PATCH bpf-next] samples/bpf:
check detach prog exist
or not in xdp_fwd
> Could I add helper function to implement this function which can check
> the program name and see if it attach to the device.
You just need to call bpf_prog_get_fd_by_id() followed by
bpf_obj_get_info_by_fd(), and the program name will be in info.name.
Here's an example in libxdp where we pull out the prog name:
https://github.com/xdp-project/xdp-tools/blob/master/lib/libxdp/libxdp.c#L1165
-Toke
Powered by blists - more mailing lists