[PATCH net-next] team: add ethtool get_link_ksettings

2019-05-26 Thread Hangbin Liu
Like bond, add ethtool get_link_ksettings to show the total speed. Signed-off-by: Hangbin Liu --- drivers/net/team/team.c | 25 + 1 file changed, 25 insertions(+) diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c index 2106045b3e16..5e892ee4c006 100644

Re: [PATCH net-next] team: add ethtool get_link_ksettings

2019-05-28 Thread Hangbin Liu
On Tue, May 28, 2019 at 11:08:23AM +0200, Jiri Pirko wrote: > >+static int team_ethtool_get_link_ksettings(struct net_device *dev, > >+ struct ethtool_link_ksettings *cmd) > >+{ > >+struct team *team= netdev_priv(dev); > >+unsigned long speed = 0; > >+

[PATCH bpf] selftests/bpf: move test_lirc_mode2_user to TEST_GEN_PROGS_EXTENDED

2019-06-03 Thread Hangbin Liu
test_lirc_mode2_user is included in test_lirc_mode2.sh test and should not be run directly. Fixes: 6bdd533cee9a ("bpf: add selftest for lirc_mode2 type program") Signed-off-by: Hangbin Liu --- tools/testing/selftests/bpf/Makefile | 7 --- 1 file changed, 4 insertions(+), 3

Re: [PATCH net] fib_rules: return 0 directly if an exactly same rule exists when NLM_F_EXCL not supplied

2019-06-04 Thread Hangbin Liu
and remove it later and b) return 0 directly if the rule exactally the same. Thanks Hangbin > > On Wed, May 8, 2019 at 9:39 AM David Miller wrote: > > > > From: Hangbin Liu > > Date: Tue, 7 May 2019 17:11:18 +0800 > > > > > With commit 153380ec4b9 ("f

Re: [PATCH net] fib_rules: return 0 directly if an exactly same rule exists when NLM_F_EXCL not supplied

2019-06-04 Thread Hangbin Liu
On Wed, Jun 05, 2019 at 10:47:58AM +0900, Lorenzo Colitti wrote: > On Wed, Jun 5, 2019 at 10:43 AM Hangbin Liu wrote: > > Although I'm still not clear what's the difference between > > > > a) adding a dup rule and remove it later > > and > > b) retur

Re: [PATCH net] fib_rules: return 0 directly if an exactly same rule exists when NLM_F_EXCL not supplied

2019-06-04 Thread Hangbin Liu
On Wed, Jun 05, 2019 at 11:25:11AM +0900, Lorenzo Colitti wrote: > On Wed, Jun 5, 2019 at 11:15 AM Hangbin Liu wrote: > > How do you add the rules? with ip cmd it should has NLM_F_EXCL flag and > > you will get -EEXIST error out. > > The fact that the code worked before thi

Re: [PATCH net] fib_rules: return 0 directly if an exactly same rule exists when NLM_F_EXCL not supplied

2019-06-04 Thread Hangbin Liu
On Wed, Jun 05, 2019 at 12:43:44PM +0900, Lorenzo Colitti wrote: > On Wed, Jun 5, 2019 at 12:29 PM Hangbin Liu wrote: > > > We rely on being able to add a rule and either have a dup be created > > > (in which case we'll remove it later) or have it fail with EEXIST (in

Re: [PATCH net] fib_rules: return 0 directly if an exactly same rule exists when NLM_F_EXCL not supplied

2019-06-04 Thread Hangbin Liu
On Tue, Jun 04, 2019 at 09:57:56PM -0600, David Ahern wrote: > On 6/4/19 7:43 PM, Hangbin Liu wrote: > > Hi David Ahern, > > > > On Fri, May 31, 2019 at 06:43:42PM -0700, Maciej Żenczykowski wrote: > >> FYI, this userspace visible change in behaviour breaks Andro

[PATCH net] Revert "fib_rules: return 0 directly if an exactly same rule exists when NLM_F_EXCL not supplied"

2019-06-04 Thread Hangbin Liu
: Nathan Chancellor Fixes: e9919a24d302 ("fib_rules: return 0 directly if an exactly same rule exists when NLM_F_EXCL not supplied") Signed-off-by: Hangbin Liu --- net/core/fib_rules.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/core/fib_rules.c

Re: [PATCH v2 net-next 03/11] net/ipv4: Plumb support for filtering route dumps

2019-07-18 Thread Hangbin Liu
Hi David, Before commit 18a8021a7be3 ("net/ipv4: Plumb support for filtering route dumps"), when we dump a non-exist table, ip cmd exits silently. # ip -4 route list table 1 # echo $? 0 After commit 18a8021a7be3 ("net/ipv4: Plumb support for filtering route dumps"). When we dump a non-exist tabl

Re: [PATCH v2 net-next 03/11] net/ipv4: Plumb support for filtering route dumps

2019-07-21 Thread Hangbin Liu
On Fri, Jul 19, 2019 at 10:55:49AM -0600, David Ahern wrote: > Hi: > > On 7/18/19 10:17 PM, Hangbin Liu wrote: > > Hi David, > > > > Before commit 18a8021a7be3 ("net/ipv4: Plumb support for filtering route > > dumps"), when we dump a non-exist table, ip

[PATCH net] ipv4/route: do not check saddr dev if iif is LOOPBACK_IFINDEX

2019-08-01 Thread Hangbin Liu
via fe80:52:0:4982::1fe dev eth0 proto ra src \ 2620::2cf:e2ff:fe40:37 metric 1024 hoplimit 64 pref medium Fix it by disabling the __ip_dev_find() check if iif is LOOPBACK_IFINDEX. Reported-by: Jianlin Shi Signed-off-by: Hangbin Liu --- net/ipv4/route.c | 3 ++- 1 file changed, 2

[PATCH net] ibmveth: use net_err_ratelimited when set_multicast_list

2019-08-01 Thread Hangbin Liu
ned-off-by: Hangbin Liu --- drivers/net/ethernet/ibm/ibmveth.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c index d654c234aaf7..3b9406a4ca92 100644 --- a/drivers/net/ethernet/ibm/ibmveth.c +++ b/d

Re: [PATCH net] ibmveth: use net_err_ratelimited when set_multicast_list

2019-08-01 Thread Hangbin Liu
On Thu, Aug 01, 2019 at 03:28:43AM -0700, Joe Perches wrote: > Perhaps add the netdev__ratelimited variants and use that instead > > Somthing like: Yes, that looks better. Do you mind if I take your code and add your Signed-off-by info? Thanks Hangbin > > --- > include/linux/netdevice.h | 54

Re: [PATCH net] ipv4/route: do not check saddr dev if iif is LOOPBACK_IFINDEX

2019-08-01 Thread Hangbin Liu
On Thu, Aug 01, 2019 at 01:51:25PM -0600, David Ahern wrote: > On 8/1/19 2:29 AM, Hangbin Liu wrote: > > Jianlin reported a bug that for IPv4, ip route get from src_addr would fail > > if src_addr is not an address on local system. > > > > \# ip route get 1.1.1.1

Re: [PATCH net] ibmveth: use net_err_ratelimited when set_multicast_list

2019-08-02 Thread Hangbin Liu
On Thu, Aug 01, 2019 at 12:51:14PM -0400, David Miller wrote: > From: Hangbin Liu > Date: Thu, 1 Aug 2019 17:03:47 +0800 > > > When setting lots of multicast list on ibmveth, e.g. add 3000 membership on > > a > > multicast group, the following error message flushes

[PATCHv2 net 2/2] ibmveth: use netdev_err_ratelimited when set_multicast_list

2019-08-08 Thread Hangbin Liu
: h_multicast_ctrl rc=4 when adding an entry to the filter table We got 1.5 million lines of messages in 1.3h. Let's replace netdev_err() by netdev_err_ratelimited() to avoid this issue. Signed-off-by: Hangbin Liu --- drivers/net/ethernet/ibm/ibmveth.c | 5 ++--- 1 file changed, 2 inser

[PATCHv2 net 1/2] netdevice.h: add netdev_level_ratelimited for netdevice

2019-08-08 Thread Hangbin Liu
Add netdev_level_ratelimited so we can use it in the future. The code is copied from device.h. Suggested-by: Joe Perches Signed-off-by: Hangbin Liu --- include/linux/netdevice.h | 53 +++ 1 file changed, 53 insertions(+) diff --git a/include/linux

[PATCHv2 net 0/2] Add netdev_level_ratelimited to avoid netdev msg flush

2019-08-08 Thread Hangbin Liu
filter table error when add more thann 256 memberships in one multicast group. I haven't found this issue on other driver. It looks like an ibm driver issue and need to be fixed separately. v2: add netdev_level_ratelimited as Joe Perches suggested Hangbin Liu (2): netdevice.h

Re: [PATCHv2 net 0/2] Add netdev_level_ratelimited to avoid netdev msg flush

2019-08-12 Thread Hangbin Liu
On Sun, Aug 11, 2019 at 09:08:20PM -0700, David Miller wrote: > From: Hangbin Liu > Date: Fri, 9 Aug 2019 08:29:39 +0800 > > > ibmveth 3003 env3: h_multicast_ctrl rc=4 when adding an entry to the > > filter table > > error when add more thann 256 membership

[PATCH net] ipv6/addrconf: allow adding multicast addr if IFA_F_MCAUTOJOIN is set

2019-08-13 Thread Hangbin Liu
The ip address autojoin is not working for IPv6 as ipv6_add_addr() will return -EADDRNOTAVAIL when adding a multicast address. Reported-by: Jianlin Shi Fixes: 93a714d6b53d ("multicast: Extend ip address command to enable multicast group join/leave on") Signed-off-by: Hangbin Liu ---

[PATCHv14 bpf-next 0/6] xdp: add a new helper for dev map multicast support

2021-01-14 Thread Hangbin Liu
e whole loop. e) Remove READ_ONCE/WRITE_ONCE for ex_map. v2: Add new syscall bpf_xdp_redirect_map_multi() which could accept include/exclude maps directly. Hangbin Liu (5): bpf: add a new bpf argument type ARG_CONST_MAP_PTR_OR_NULL xdp: add a new helper for dev map multicast support sample/bpf: add xd

[PATCHv14 bpf-next 1/6] bpf: run devmap xdp_prog on flush instead of bulk enqueue

2021-01-14 Thread Hangbin Liu
>i40e |2.0M | 9.5M | 7.5M 5.10 rc6 + patch | xdp_redirect_map i40e->veth |1.7M | 11.6M | 9.1M [1] https://patchwork.ozlabs.org/project/netdev/patch/20201208120159.2278277-1-liuhang...@gmail.com/ Signed-off-by: Jesper Dangaard Brouer Signed-off-by: Hangbin Liu -- v14: no u

[PATCHv14 bpf-next 2/6] bpf: add a new bpf argument type ARG_CONST_MAP_PTR_OR_NULL

2021-01-14 Thread Hangbin Liu
Add a new bpf argument type ARG_CONST_MAP_PTR_OR_NULL which could be used when we want to allow NULL pointer for map parameter. The bpf helper need to take care and check if the map is NULL when use this type. Signed-off-by: Hangbin Liu --- v11-v14: rebase the patch to latest bpf-next v10

[PATCHv14 bpf-next 3/6] xdp: add a new helper for dev map multicast support

2021-01-14 Thread Hangbin Liu
calls to get better performace. [0] https://xdp-project.net/#Handling-multicast Signed-off-by: Hangbin Liu --- v14: no update, only rebase the code v13: pass xdp_prog through bq_enqueue v12: rebase the code based on Jespoer's devmap xdp_prog patch v11: Fix bpf_redirect_map_multi() hel

[PATCHv14 bpf-next 6/6] selftests/bpf: add xdp_redirect_multi test

2021-01-14 Thread Hangbin Liu
dpdrv ping6 ns2-4 Pass: xdpegress mac ns1-2 Pass: xdpegress mac ns1-3 Pass: xdpegress mac ns1-4 Pass: xdpegress ping ns1-2 Pass: xdpegress ping ns1-3 Pass: xdpegress ping ns1-4 Summary: PASS 24, FAIL 0 Signed-off-by: Hangbin Liu --- v14: no update, only rebase the code v13: remove setrlimit v12

[PATCHv14 bpf-next 5/6] selftests/bpf: Add verifier tests for bpf arg ARG_CONST_MAP_PTR_OR_NULL

2021-01-14 Thread Hangbin Liu
FAILED Signed-off-by: Hangbin Liu --- tools/testing/selftests/bpf/test_verifier.c | 22 +- .../testing/selftests/bpf/verifier/map_ptr.c | 70 +++ 2 files changed, 91 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/test_verifier.c b/tools/testing

[PATCHv14 bpf-next 4/6] sample/bpf: add xdp_redirect_map_multicast test

2021-01-14 Thread Hangbin Liu
This is a sample for xdp multicast. In the sample we could forward all packets between given interfaces. There is also an option -X that could enable 2nd xdp_prog on egress interface. Signed-off-by: Hangbin Liu --- v13-v14: no update, only rebase the code v12: add devmap xdp_prog on egress

[PATCHv6 bpf-next] samples/bpf: add xdp program on egress for xdp_redirect_map

2021-01-14 Thread Hangbin Liu
This patch add a xdp program on egress to show that we can modify the packet on egress. In this sample we will set the pkt's src mac to egress's mac address. The xdp_prog will be attached when -X option supplied. Signed-off-by: Hangbin Liu --- v6: no code update, only rebase the code

Re: [PATCHv6 bpf-next] samples/bpf: add xdp program on egress for xdp_redirect_map

2021-01-14 Thread Hangbin Liu
Hi Yonghong, On Thu, Jan 14, 2021 at 01:01:28PM -0800, Yonghong Song wrote: > > +/* map to stroe egress interface mac address */ > > s/stroe/store Thanks, I will fix it. > > - struct bpf_program *prog, *dummy_prog; > > + struct bpf_program *prog, *dummy_prog, *devmap_prog; > > + int devmap_

[PATCHv7 bpf-next] samples/bpf: add xdp program on egress for xdp_redirect_map

2021-01-14 Thread Hangbin Liu
This patch add a xdp program on egress to show that we can modify the packet on egress. In this sample we will set the pkt's src mac to egress's mac address. The xdp_prog will be attached when -X option supplied. Signed-off-by: Hangbin Liu --- v7: a) use bpf_object__find_progr

Re: [PATCHv14 bpf-next 3/6] xdp: add a new helper for dev map multicast support

2021-01-18 Thread Hangbin Liu
Hi John, Thanks for the reviewing. On Sun, Jan 17, 2021 at 04:10:40PM -0800, John Fastabend wrote: > > + * The forwarding *map* could be either > > BPF_MAP_TYPE_DEVMAP or > > + * BPF_MAP_TYPE_DEVMAP_HASH. But the *ex_map* must be > > + * BPF_MAP_TY

Re: [PATCHv14 bpf-next 1/6] bpf: run devmap xdp_prog on flush instead of bulk enqueue

2021-01-18 Thread Hangbin Liu
On Sun, Jan 17, 2021 at 02:57:02PM -0800, John Fastabend wrote: [...] > It looks like we could embed xdp_buff in xdp_frame and then keep the metadata > at the end. > > Because you are working performance here wdyt? <- @Jesper as well. Leave this question to Jesper. > > > > - sent = dev->netd

[PATCH net] selftests/net/fib_tests: remove duplicate log test

2021-01-18 Thread Hangbin Liu
sting") Signed-off-by: Hangbin Liu --- tools/testing/selftests/net/fib_tests.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/testing/selftests/net/fib_tests.sh b/tools/testing/selftests/net/fib_tests.sh index 84205c3a55eb..2b5707738609 100755 --- a/tools/testing/selftests/net/fi

[PATCHv8 bpf-next] samples/bpf: add xdp program on egress for xdp_redirect_map

2021-01-18 Thread Hangbin Liu
This patch add a xdp program on egress to show that we can modify the packet on egress. In this sample we will set the pkt's src mac to egress's mac address. The xdp_prog will be attached when -X option supplied. Acked-by: Yonghong Song Signed-off-by: Hangbin Liu --- v8: Fix some

[PATCHv15 bpf-next 4/6] sample/bpf: add xdp_redirect_map_multicast test

2021-01-19 Thread Hangbin Liu
This is a sample for xdp multicast. In the sample we could forward all packets between given interfaces. There is also an option -X that could enable 2nd xdp_prog on egress interface. Signed-off-by: Hangbin Liu --- v15: use bpf_object__find_program_by_name() instead of

[PATCHv15 bpf-next 5/6] selftests/bpf: Add verifier tests for bpf arg ARG_CONST_MAP_PTR_OR_NULL

2021-01-19 Thread Hangbin Liu
FAILED Signed-off-by: Hangbin Liu --- tools/testing/selftests/bpf/test_verifier.c | 22 +- .../testing/selftests/bpf/verifier/map_ptr.c | 70 +++ 2 files changed, 91 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/test_verifier.c b/tools/testing

[PATCHv15 bpf-next 0/6] xdp: add a new helper for dev map multicast support

2021-01-19 Thread Hangbin Liu
c) Fix one more xdpf clone in dev_map_enqueue_multi(). d) Go find next one in dev_map_enqueue_multi() if the interface is not able to forward instead of abort the whole loop. e) Remove READ_ONCE/WRITE_ONCE for ex_map. v2: Add new syscall bpf_xdp_redirect_map_multi() which could accept includ

[PATCHv15 bpf-next 6/6] selftests/bpf: add xdp_redirect_multi test

2021-01-19 Thread Hangbin Liu
dpdrv ping6 ns2-4 Pass: xdpegress mac ns1-2 Pass: xdpegress mac ns1-3 Pass: xdpegress mac ns1-4 Pass: xdpegress ping ns1-2 Pass: xdpegress ping ns1-3 Pass: xdpegress ping ns1-4 Summary: PASS 24, FAIL 0 Signed-off-by: Hangbin Liu --- v15: use bpf_object__find_program_by_name inste

[PATCHv15 bpf-next 3/6] xdp: add a new helper for dev map multicast support

2021-01-19 Thread Hangbin Liu
calls to get better performace. [0] https://xdp-project.net/#Handling-multicast Signed-off-by: Hangbin Liu --- v15: a) Update bpf_redirect_map_multi() helper description that ex_map must be keyed by ifindex. b) remove variable last_one in dev_map_enqueue_multi() as it's pointless. c) a

[PATCHv15 bpf-next 2/6] bpf: add a new bpf argument type ARG_CONST_MAP_PTR_OR_NULL

2021-01-19 Thread Hangbin Liu
Add a new bpf argument type ARG_CONST_MAP_PTR_OR_NULL which could be used when we want to allow NULL pointer for map parameter. The bpf helper need to take care and check if the map is NULL when use this type. Signed-off-by: Hangbin Liu --- v13-v15: no update v11-v12: rebase the patch to latest

[PATCHv15 bpf-next 1/6] bpf: run devmap xdp_prog on flush instead of bulk enqueue

2021-01-19 Thread Hangbin Liu
>i40e |2.0M | 9.5M | 7.5M 5.10 rc6 + patch | xdp_redirect_map i40e->veth |1.7M | 11.6M | 9.1M [1] https://patchwork.ozlabs.org/project/netdev/patch/20201208120159.2278277-1-liuhang...@gmail.com/ Signed-off-by: Jesper Dangaard Brouer Signed-off-by: Hangbin Liu --- v15: a) do

Re: [PATCHv8 bpf-next] samples/bpf: add xdp program on egress for xdp_redirect_map

2021-01-19 Thread Hangbin Liu
On Tue, Jan 19, 2021 at 03:51:27PM +0100, Jesper Dangaard Brouer wrote: > > @@ -73,13 +90,63 @@ int xdp_redirect_map_prog(struct xdp_md *ctx) > > > > /* count packet in global counter */ > > value = bpf_map_lookup_elem(&rxcnt, &key); > > - if (value) > > + if (value) { > >

[PATCH net] selftests/net: set link down before enslave

2021-01-20 Thread Hangbin Liu
Set the link down before enslave it to a bond device, to avoid Error: Device can not be enslaved while up. Fixes: 6374a5606990 ("selftests: rtnetlink: Test bridge enslavement with different parent IDs") Signed-off-by: Hangbin Liu --- tools/testing/selftests/net/rtnetlink.sh | 2

Re: [PATCH net] selftests/net: set link down before enslave

2021-01-20 Thread Hangbin Liu
Hi Ido, On Wed, Jan 20, 2021 at 12:42:10PM +0200, Ido Schimmel wrote: > > diff --git a/tools/testing/selftests/net/rtnetlink.sh > > b/tools/testing/selftests/net/rtnetlink.sh > > index c9ce3dfa42ee..a26fddc63992 100755 > > --- a/tools/testing/selftests/net/rtnetlink.sh > > +++ b/tools/testing/sel

Re: [PATCHv15 bpf-next 1/6] bpf: run devmap xdp_prog on flush instead of bulk enqueue

2021-01-20 Thread Hangbin Liu
Hi Maciej, On Wed, Jan 20, 2021 at 11:42:38PM +0100, Maciej Fijalkowski wrote: > > +static int dev_map_bpf_prog_run(struct bpf_prog *xdp_prog, > > + struct xdp_frame **frames, int n, > > + struct net_device *dev) > > +{ > > + struct xdp_txq_info

Re: [PATCH net] selftests/net: set link down before enslave

2021-01-20 Thread Hangbin Liu
On Wed, Jan 20, 2021 at 05:46:51PM -0800, Jakub Kicinski wrote: > On Wed, 20 Jan 2021 21:43:28 +0200 Ido Schimmel wrote: > > On Wed, Jan 20, 2021 at 10:38:47PM +0800, Hangbin Liu wrote: > > > Hi Ido, > > > > > > On Wed, Jan 20, 2021 at 12:42:10PM +0200, Ido Sc

[PATCHv9 bpf-next] samples/bpf: add xdp program on egress for xdp_redirect_map

2021-01-21 Thread Hangbin Liu
This patch add a xdp program on egress to show that we can modify the packet on egress. In this sample we will set the pkt's src mac to egress's mac address. The xdp_prog will be attached when -X option supplied. Signed-off-by: Hangbin Liu --- v9: roll back to just set src mac

[PATCHv10 bpf-next] samples/bpf: add xdp program on egress for xdp_redirect_map

2021-01-21 Thread Hangbin Liu
This patch add a xdp program on egress to show that we can modify the packet on egress. In this sample we will set the pkt's src mac to egress's mac address. The xdp_prog will be attached when -X option supplied. Signed-off-by: Hangbin Liu --- v10: make xdp_redirect_map() always i

[PATCHv16 bpf-next 0/6] xdp: add a new helper for dev map multicast support

2021-01-21 Thread Hangbin Liu
bpf_xdp_redirect_map_multi() which could accept include/exclude maps directly. Hangbin Liu (5): bpf: add a new bpf argument type ARG_CONST_MAP_PTR_OR_NULL xdp: add a new helper for dev map multicast support sample/bpf: add xdp_redirect_map_multicast test selftests/bpf: Add verifier tests for

[PATCHv16 bpf-next 1/6] bpf: run devmap xdp_prog on flush instead of bulk enqueue

2021-01-21 Thread Hangbin Liu
>i40e |2.0M | 9.5M | 7.5M 5.10 rc6 + patch | xdp_redirect_map i40e->veth |1.7M | 11.6M | 9.1M [1] https://lore.kernel.org/bpf/20210122025007.2968381-1-liuhang...@gmail.com Signed-off-by: Jesper Dangaard Brouer Signed-off-by: Hangbin Liu --- v16: a) refactor bq_xmit_all logic

[PATCHv16 bpf-next 2/6] bpf: add a new bpf argument type ARG_CONST_MAP_PTR_OR_NULL

2021-01-21 Thread Hangbin Liu
Add a new bpf argument type ARG_CONST_MAP_PTR_OR_NULL which could be used when we want to allow NULL pointer for map parameter. The bpf helper need to take care and check if the map is NULL when use this type. Signed-off-by: Hangbin Liu --- v13-v15: no update v11-v12: rebase the patch to latest

[PATCHv16 bpf-next 3/6] xdp: add a new helper for dev map multicast support

2021-01-21 Thread Hangbin Liu
calls to get better performace. [0] https://xdp-project.net/#Handling-multicast Signed-off-by: Hangbin Liu --- v15: a) Update bpf_redirect_map_multi() helper description that ex_map must be keyed by ifindex. b) remove variable last_one in dev_map_enqueue_multi() as it's pointless. c) a

[PATCHv16 bpf-next 6/6] selftests/bpf: add xdp_redirect_multi test

2021-01-21 Thread Hangbin Liu
dpdrv ping6 ns2-4 Pass: xdpegress mac ns1-2 Pass: xdpegress mac ns1-3 Pass: xdpegress mac ns1-4 Pass: xdpegress ping ns1-2 Pass: xdpegress ping ns1-3 Pass: xdpegress ping ns1-4 Summary: PASS 24, FAIL 0 Signed-off-by: Hangbin Liu --- v15: use bpf_object__find_program_by_name inste

[PATCHv16 bpf-next 4/6] sample/bpf: add xdp_redirect_map_multicast test

2021-01-21 Thread Hangbin Liu
This is a sample for xdp multicast. In the sample we could forward all packets between given interfaces. There is also an option -X that could enable 2nd xdp_prog on egress interface. Signed-off-by: Hangbin Liu --- v15: use bpf_object__find_program_by_name() instead of

[PATCHv16 bpf-next 5/6] selftests/bpf: Add verifier tests for bpf arg ARG_CONST_MAP_PTR_OR_NULL

2021-01-21 Thread Hangbin Liu
FAILED Signed-off-by: Hangbin Liu --- tools/testing/selftests/bpf/test_verifier.c | 21 +- .../testing/selftests/bpf/verifier/map_ptr.c | 70 +++ 2 files changed, 90 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/test_verifier.c b/tools/testing

[PATCHv5 bpf-next] samples/bpf: add xdp program on egress for xdp_redirect_map

2020-12-10 Thread Hangbin Liu
This patch add a xdp program on egress to show that we can modify the packet on egress. In this sample we will set the pkt's src mac to egress's mac address. The xdp_prog will be attached when -X option supplied. Signed-off-by: Hangbin Liu --- v5: a) close fd when err out in get_ma

[PATCHv12 bpf-next 0/6] xdp: add a new helper for dev map multicast support

2020-12-16 Thread Hangbin Liu
ev_map_enqueue_multi(). d) Go find next one in dev_map_enqueue_multi() if the interface is not able to forward instead of abort the whole loop. e) Remove READ_ONCE/WRITE_ONCE for ex_map. v2: Add new syscall bpf_xdp_redirect_map_multi() which could accept include/exclude maps directly. Hangbin Liu (5):

[PATCHv12 bpf-next 1/6] bpf: run devmap xdp_prog on flush instead of bulk enqueue

2020-12-16 Thread Hangbin Liu
>i40e |2.0M | 9.5M | 7.5M 5.10 rc6 + patch | xdp_redirect_map i40e->veth |1.7M | 11.6M | 9.1M [1] https://patchwork.ozlabs.org/project/netdev/patch/20201208120159.2278277-1-liuhang...@gmail.com/ Signed-off-by: Jesper Dangaard Brouer Signed-off-by: Hangbin Liu --- ker

[PATCHv12 bpf-next 2/6] bpf: add a new bpf argument type ARG_CONST_MAP_PTR_OR_NULL

2020-12-16 Thread Hangbin Liu
Add a new bpf argument type ARG_CONST_MAP_PTR_OR_NULL which could be used when we want to allow NULL pointer for map parameter. The bpf helper need to take care and check if the map is NULL when use this type. Signed-off-by: Hangbin Liu --- v11-v12: rebase the patch to latest bpf-next v10

[PATCHv12 bpf-next 5/6] selftests/bpf: Add verifier tests for bpf arg ARG_CONST_MAP_PTR_OR_NULL

2020-12-16 Thread Hangbin Liu
FAILED Signed-off-by: Hangbin Liu --- tools/testing/selftests/bpf/test_verifier.c | 22 +- .../testing/selftests/bpf/verifier/map_ptr.c | 70 +++ 2 files changed, 91 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/test_verifier.c b/tools/testing

[PATCHv12 bpf-next 3/6] xdp: add a new helper for dev map multicast support

2020-12-16 Thread Hangbin Liu
calls to get better performace. [0] https://xdp-project.net/#Handling-multicast Signed-off-by: Hangbin Liu --- v12: rebase the code based on Jespoer's devmap xdp_prog patch v11: Fix bpf_redirect_map_multi() helper description typo. Add loop limit for devmap_get_next_obj() and dev_m

[PATCHv12 bpf-next 4/6] sample/bpf: add xdp_redirect_map_multicast test

2020-12-16 Thread Hangbin Liu
This is a sample for xdp multicast. In the sample we could forward all packets between given interfaces. There is also an option -X that could enable 2nd xdp_prog on egress interface. Signed-off-by: Hangbin Liu --- v12: add devmap xdp_prog on egress support v10-v11: no update v9: use NULL

[PATCHv12 bpf-next 6/6] selftests/bpf: add xdp_redirect_multi test

2020-12-16 Thread Hangbin Liu
dpdrv ping6 ns2-4 Pass: xdpegress mac ns1-2 Pass: xdpegress mac ns1-3 Pass: xdpegress mac ns1-4 Pass: xdpegress ping ns1-2 Pass: xdpegress ping ns1-3 Pass: xdpegress ping ns1-4 Summary: PASS 24, FAIL 0 Signed-off-by: Hangbin Liu --- v12: add devmap prog test on egress v9: use NULL directly for arg

Re: [PATCHv12 bpf-next 1/6] bpf: run devmap xdp_prog on flush instead of bulk enqueue

2020-12-18 Thread Hangbin Liu
Hi David, Thanks for the comment. On Thu, Dec 17, 2020 at 09:07:03AM -0700, David Ahern wrote: > > + return n - nframes; /* dropped frames count */ > > just return nframes here, since ... > > > + xdp_drop = dev_map_bpf_prog_run(bq->xdp_prog, bq->q, cnt, dev); > > + cnt -=

Re: [PATCHv12 bpf-next 1/6] bpf: run devmap xdp_prog on flush instead of bulk enqueue

2020-12-21 Thread Hangbin Liu
Hi David, I just aware that, On Thu, Dec 17, 2020 at 09:07:03AM -0700, David Ahern wrote: > > +static int dev_map_bpf_prog_run(struct bpf_prog *xdp_prog, > > + struct xdp_frame **frames, int n, > > + struct net_device *dev) > > +{ > > + struct

[PATCHv13 bpf-next 0/6] xdp: add a new helper for dev map multicast support

2020-12-21 Thread Hangbin Liu
bpf_xdp_redirect_map_multi() which could accept include/exclude maps directly. Hangbin Liu (5): bpf: add a new bpf argument type ARG_CONST_MAP_PTR_OR_NULL xdp: add a new helper for dev map multicast support sample/bpf: add xdp_redirect_map_multicast test selftests/bpf: Add verifier tests for

[PATCHv13 bpf-next 4/6] sample/bpf: add xdp_redirect_map_multicast test

2020-12-21 Thread Hangbin Liu
This is a sample for xdp multicast. In the sample we could forward all packets between given interfaces. There is also an option -X that could enable 2nd xdp_prog on egress interface. Signed-off-by: Hangbin Liu --- v12: add devmap xdp_prog on egress support v10-v11: no update v9: use NULL

[PATCHv13 bpf-next 3/6] xdp: add a new helper for dev map multicast support

2020-12-21 Thread Hangbin Liu
calls to get better performace. [0] https://xdp-project.net/#Handling-multicast Signed-off-by: Hangbin Liu --- v13: pass xdp_prog through bq_enqueue v12: rebase the code based on Jespoer's devmap xdp_prog patch v11: Fix bpf_redirect_map_multi() helper description typo. Add

[PATCHv13 bpf-next 2/6] bpf: add a new bpf argument type ARG_CONST_MAP_PTR_OR_NULL

2020-12-21 Thread Hangbin Liu
-off-by: Hangbin Liu --- v11-v12: rebase the patch to latest bpf-next v10: remove useless CONST_PTR_TO_MAP_OR_NULL and Copy-paste comment. v9: merge the patch from [1] in to this series. v1-v8: no this patch --- include/linux/bpf.h | 1 + kernel/bpf/verifier.c | 10 ++ 2 files changed

[PATCHv13 bpf-next 1/6] bpf: run devmap xdp_prog on flush instead of bulk enqueue

2020-12-21 Thread Hangbin Liu
>i40e |2.0M | 9.5M | 7.5M 5.10 rc6 + patch | xdp_redirect_map i40e->veth |1.7M | 11.6M | 9.1M [1] https://patchwork.ozlabs.org/project/netdev/patch/20201208120159.2278277-1-liuhang...@gmail.com/ Signed-off-by: Jesper Dangaard Brouer Signed-off-by: Hangbin Liu --- v13: pa

[PATCHv13 bpf-next 6/6] selftests/bpf: add xdp_redirect_multi test

2020-12-21 Thread Hangbin Liu
dpdrv ping6 ns2-4 Pass: xdpegress mac ns1-2 Pass: xdpegress mac ns1-3 Pass: xdpegress mac ns1-4 Pass: xdpegress ping ns1-2 Pass: xdpegress ping ns1-3 Pass: xdpegress ping ns1-4 Summary: PASS 24, FAIL 0 Signed-off-by: Hangbin Liu --- v13: remove setrlimit v12: add devmap prog test on egress v9: use

[PATCHv13 bpf-next 5/6] selftests/bpf: Add verifier tests for bpf arg ARG_CONST_MAP_PTR_OR_NULL

2020-12-21 Thread Hangbin Liu
FAILED Signed-off-by: Hangbin Liu --- tools/testing/selftests/bpf/test_verifier.c | 22 +- .../testing/selftests/bpf/verifier/map_ptr.c | 70 +++ 2 files changed, 91 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/test_verifier.c b/tools/testing

Re: [PATCHv2 bpf-next] samples/bpf: add xdp program on egress for xdp_redirect_map

2020-11-29 Thread Hangbin Liu
On Thu, Nov 26, 2020 at 10:31:56PM -0800, Yonghong Song wrote: > > index 35e16dee613e..8bdec0865e1d 100644 > > --- a/samples/bpf/xdp_redirect_map_user.c > > +++ b/samples/bpf/xdp_redirect_map_user.c > > @@ -21,12 +21,13 @@ > > static int ifindex_in; > > static int ifindex_out; > > -static bool

Re: [PATCHv2 bpf-next] samples/bpf: add xdp program on egress for xdp_redirect_map

2020-11-30 Thread Hangbin Liu
On Mon, Nov 30, 2020 at 10:32:08AM +0100, Jesper Dangaard Brouer wrote: > > I plan to write a example about vlan header modification based on egress > > index. I will post the patch later. > > I did notice the internal thread you had with Toke. I still think it > will be more simple to modify the

[PATCHv3 bpf-next] samples/bpf: add xdp program on egress for xdp_redirect_map

2020-12-08 Thread Hangbin Liu
This patch add a xdp program on egress to show that we can modify the packet on egress. In this sample we will set the pkt's src mac to egress's mac address. The xdp_prog will be attached when -X option supplied. Signed-off-by: Hangbin Liu --- v3: a) modify the src mac address based

Re: [PATCHv3 bpf-next] samples/bpf: add xdp program on egress for xdp_redirect_map

2020-12-08 Thread Hangbin Liu
On Tue, Dec 08, 2020 at 11:39:14AM +0100, Jesper Dangaard Brouer wrote: > > + /* If -X supplied, load 2nd xdp prog on egress. > > +* If not, just load dummy prog on egress. > > +*/ > > The dummy prog need to be loaded, regardless of 2nd xdp prog on egress. Thanks for this remind, Now I

[PATCHv4 bpf-next] samples/bpf: add xdp program on egress for xdp_redirect_map

2020-12-08 Thread Hangbin Liu
This patch add a xdp program on egress to show that we can modify the packet on egress. In this sample we will set the pkt's src mac to egress's mac address. The xdp_prog will be attached when -X option supplied. Signed-off-by: Hangbin Liu --- v4: a) Update get_mac_addr socket creati

[PATCHv6 iproute2-next 0/5] iproute2: add libbpf support

2020-11-23 Thread Hangbin Liu
d 90 I also run the following upstream kselftest with patches iproute2 and all passed. test_lwt_ip_encap.sh test_xdp_redirect.sh test_tc_redirect.sh test_xdp_meta.sh test_xdp_veth.sh test_xdp_vlan.sh Hangbin Liu (5): iproute2: add check_libbpf() and get_libbpf_version() lib: make ipvrf able t

[PATCHv6 iproute2-next 1/5] iproute2: add check_libbpf() and get_libbpf_version()

2020-11-23 Thread Hangbin Liu
can't be sure that the version we discovered at compile time is actually the one we are using at runtime. This can lead to hard-to-debug errors. So we add a new file lib/bpf_glue.c and a helper function get_libbpf_version() to get correct libbpf version at runtime. Signed-off-by: Hangbin Liu --

[PATCHv6 iproute2-next 2/5] lib: make ipvrf able to use libbpf and fix function name conflicts

2020-11-23 Thread Hangbin Liu
pport in iproute2. Reviewed-by: Toke Høiland-Jørgensen Signed-off-by: Hangbin Liu --- v6: bpf_glue.c is created in previous patch. So I changed the commit description. v5: Fix bpf_prog_load_dev typo. v4: Add new file bpf_glue.c v2-v3: no update --- include/bpf_util.h | 10 +++--

[PATCHv6 iproute2-next 3/5] lib: add libbpf support

2020-11-23 Thread Hangbin Liu
. For tail calls, we find it first and update the element after prog load. Other maps/progs will be loaded by libbpf directly. [1] https://lore.kernel.org/bpf/20190820114706.18546-1-t...@redhat.com/ Reviewed-by: Toke Høiland-Jørgensen Signed-off-by: Hangbin Liu --- v6: also make bpf_libbpf.c

[PATCHv6 iproute2-next 5/5] examples/bpf: add bpf examples with BTF defined maps

2020-11-23 Thread Hangbin Liu
Users should try use the new BTF defined maps instead of struct bpf_elf_map defined maps. The tail call examples are not added yet as libbpf doesn't currently support declaratively populating tail call maps. Reviewed-by: Toke Høiland-Jørgensen Signed-off-by: Hangbin Liu --- examples/bpf/R

[PATCHv6 iproute2-next 4/5] examples/bpf: move struct bpf_elf_map defined maps to legacy folder

2020-11-23 Thread Hangbin Liu
Reviewed-by: Toke Høiland-Jørgensen Signed-off-by: Hangbin Liu --- examples/bpf/README| 14 +- examples/bpf/{ => legacy}/bpf_cyclic.c | 2 +- examples/bpf/{ => legacy}/bpf_graft.c | 2 +- examples/bpf/{ => legacy}/bpf_map_in_map.c | 2 +-

[PATCHv2 bpf-next] samples/bpf: add xdp program on egress for xdp_redirect_map

2020-11-26 Thread Hangbin Liu
dex 5: 66 pkt/s, out ifindex 6: 66 pkt/s Signed-off-by: Hangbin Liu --- v2: a) use pkt counter instead of IP ttl modification on egress program b) make the egress program selectable by option -X --- samples/bpf/xdp_redirect_map_kern.c | 26 +++-- samples/bpf/xdp_redirect_map_user.c

Re: [PATCHv2 bpf-next] samples/bpf: add xdp program on egress for xdp_redirect_map

2020-11-26 Thread Hangbin Liu
On Thu, Nov 26, 2020 at 11:51:19AM +0100, Jesper Dangaard Brouer wrote: > On Thu, 26 Nov 2020 16:43:25 +0800 > Hangbin Liu wrote: > > > Current sample test xdp_redirect_map only count pkts on ingress. But we > > can't know whether the pkts are redirected or droppe

[PATCHv3 bpf 2/2] samples/bpf: remove unused test_ipip.sh

2020-11-09 Thread Hangbin Liu
The tcbpf2_kern.o and related kernel sections are moved to bpf selftest folder since b05cd7404323 ("samples/bpf: remove the bpf tunnel testsuite."). Remove this one as well. Fixes: b05cd7404323 ("samples/bpf: remove the bpf tunnel testsuite.") Acked-by: Martin KaFai Lau Si

[PATCHv3 bpf 1/2] selftest/bpf: add missed ip6ip6 test back

2020-11-09 Thread Hangbin Liu
e ip6ip6 test back to bpf tunnel test. Update the ipip6's topology for both IPv4 and IPv6 testing. Since iperf test is removed as currect framework simplified it in purpose, I also removed unused tcp checkings in test_tunnel_kern.c. Fixes: 933a741e3b82 ("selftests/bpf: bpf tunnel test.")

[PATCHv3 bpf 0/2] Remove unused test_ipip.sh test and add missed ip6ip6 test

2020-11-09 Thread Hangbin Liu
2: Keep ip6ip6 section in test_tunnel_kern.c. Hangbin Liu (2): selftest/bpf: add missed ip6ip6 test back samples/bpf: remove unused test_ipip.sh samples/bpf/test_ipip.sh | 179 -- .../selftests/bpf/progs/test_tunnel_kern.c| 42 +--- tools/testing/selftests/bp

[PATCH bpf-next] samples/bpf: add xdp_redirect_map with xdp_prog support

2020-11-10 Thread Hangbin Liu
This patch add running xdp program on egress interface support for xdp_redirect_map sample. The new prog will change the IP ttl based on egress ifindex. Signed-off-by: Hangbin Liu --- samples/bpf/xdp_redirect_map_kern.c | 74 - samples/bpf/xdp_redirect_map_user.c

Re: [PATCH bpf-next] samples/bpf: add xdp_redirect_map with xdp_prog support

2020-11-10 Thread Hangbin Liu
On Tue, Nov 10, 2020 at 03:25:10PM +0100, Jesper Dangaard Brouer wrote: > On Tue, 10 Nov 2020 20:46:39 +0800 > Hangbin Liu wrote: > > > This patch add running xdp program on egress interface support for > > xdp_redirect_map sample. The new prog will change the IP ttl based

Re: [PATCHv4 iproute2-next 2/5] lib: rename bpf.c to bpf_legacy.c

2020-11-15 Thread Hangbin Liu
On Fri, Nov 13, 2020 at 08:24:41PM -0700, David Ahern wrote: > On 11/9/20 12:07 AM, Hangbin Liu wrote: > > diff --git a/lib/bpf_glue.c b/lib/bpf_glue.c > > new file mode 100644 > > index ..7626a893 > > --- /dev/null > > +++ b/lib/bpf_glue.c > > ...

Re: [PATCHv4 iproute2-next 1/5] configure: add check_libbpf() for later libbpf support

2020-11-15 Thread Hangbin Liu
On Fri, Nov 13, 2020 at 08:26:51PM -0700, David Ahern wrote: > > +# Influential LIBBPF environment variables: > > +# LIBBPF_FORCE={on,off} on: require link against libbpf; > > +# off: disable libbpf probing > > +# LIBBPF_LIBDIR Path to libbpf to use > > +

[PATCHv5 iproute2-next 4/5] examples/bpf: move struct bpf_elf_map defined maps to legacy folder

2020-11-15 Thread Hangbin Liu
Reviewed-by: Toke Høiland-Jørgensen Signed-off-by: Hangbin Liu --- examples/bpf/README| 14 +- examples/bpf/{ => legacy}/bpf_cyclic.c | 2 +- examples/bpf/{ => legacy}/bpf_graft.c | 2 +- examples/bpf/{ => legacy}/bpf_map_in_map.c | 2 +-

[PATCHv5 iproute2-next 1/5] configure: add check_libbpf() for later libbpf support

2020-11-15 Thread Hangbin Liu
iproute2 with libbpf. If set to on, then force to build with libbpf and exit if not available. If set to off, then force to not build with libbpf. Signed-off-by: Hangbin Liu --- v5: 1) Fix LIBBPF_DIR typo and description, use libbpf DESTDIR as LIBBPF_DIR dest. v4: 1) Remove duplicate

[PATCHv5 iproute2-next 5/5] examples/bpf: add bpf examples with BTF defined maps

2020-11-15 Thread Hangbin Liu
Users should try use the new BTF defined maps instead of struct bpf_elf_map defined maps. The tail call examples are not added yet as libbpf doesn't currently support declaratively populating tail call maps. Reviewed-by: Toke Høiland-Jørgensen Signed-off-by: Hangbin Liu --- examples/bpf/R

[PATCHv5 iproute2-next 3/5] lib: add libbpf support

2020-11-15 Thread Hangbin Liu
. For tail calls, we find it first and update the element after prog load. Other maps/progs will be loaded by libbpf directly. [1] https://lore.kernel.org/bpf/20190820114706.18546-1-t...@redhat.com/ Reviewed-by: Toke Høiland-Jørgensen Signed-off-by: Hangbin Liu --- v4: Move ipvrf code to patch 02

[PATCHv5 iproute2-next 0/5] iproute2: add libbpf support

2020-11-15 Thread Hangbin Liu
.sh test_xdp_veth.sh test_xdp_vlan.sh Hangbin Liu (5): configure: add check_libbpf() for later libbpf support lib: rename bpf.c to bpf_legacy.c lib: add libbpf support examples/bpf: move struct bpf_elf_map defined maps to legacy folder examples/bpf: add bpf examples with BTF defi

[PATCHv5 iproute2-next 2/5] lib: rename bpf.c to bpf_legacy.c

2020-11-15 Thread Hangbin Liu
ibbpf function name. Signed-off-by: Hangbin Liu --- v5: Fix bpf_prog_load_dev typo. v4: Add new file bpf_glue.c v2-v3: no update --- include/bpf_util.h | 10 +++--- ip/ipvrf.c | 6 +++--- lib/Makefile| 2 +- lib/bpf_glue.c

Re: [PATCHv5 iproute2-next 0/5] iproute2: add libbpf support

2020-11-16 Thread Hangbin Liu
On Mon, Nov 16, 2020 at 06:37:57PM -0800, Alexei Starovoitov wrote: > On Mon, Nov 16, 2020 at 03:54:46PM +0100, Jesper Dangaard Brouer wrote: > > > > Thus, IMHO we MUST move forward and get started with converting > > iproute2 to libbpf, and start on the work to deprecate the build in > > BPF-ELF-

  1   2   3   4   5   6   7   8   >