* Re: [PATCH net-next v2 1/2] netlink: ipv4 igmp join notifications
From: Patrick Ruddy @ 2018-09-04 7:54 UTC (permalink / raw)
To: Roopa Prabhu; +Cc: netdev, Jiří Pírko, Stephen Hemminger
In-Reply-To: <CAJieiUgG+mz88jSBOMCk2LXftuxS92-7iJ89x8voxOGRh2V+QQ@mail.gmail.com>
On Mon, 2018-09-03 at 16:12 -0700, Roopa Prabhu wrote:
> On Sun, Sep 2, 2018 at 4:18 AM, Patrick Ruddy
> <pruddy@vyatta.att-mail.com> wrote:
> > Hi Roopa
> >
> > inline
> >
> > thx
> >
> > -pr
> >
> > On Fri, 2018-08-31 at 09:29 -0700, Roopa Prabhu wrote:
> > > On Fri, Aug 31, 2018 at 4:20 AM, Patrick Ruddy
> > > <pruddy@vyatta.att-mail.com> wrote:
> > > > Some userspace applications need to know about IGMP joins from the kernel
> > > > for 2 reasons
> > > > 1. To allow the programming of multicast MAC filters in hardware
> > > > 2. To form a multicast FORUS list for non link-local multicast
> > > > groups to be sent to the kernel and from there to the interested
> > > > party.
> > > > (1) can be fulfilled but simply sending the hardware multicast MAC
> > > > address to be programmed but (2) requires the L3 address to be sent
> > > > since this cannot be constructed from the MAC address whereas the
> > > > reverse translation is a standard library function.
> > > >
> > > > This commit provides addition and deletion of multicast addresses
> > > > using the RTM_NEWADDR and RTM_DELADDR messages. It also provides
> > > > the RTM_GETADDR extension to allow multicast join state to be read
> > > > from the kernel.
> > > >
> > > > Signed-off-by: Patrick Ruddy <pruddy@vyatta.att-mail.com>
> > > > ---
> > > > v2: fix kbuild warnings.
> > >
> > > I am still going through the series, but AFAICT, user-space caches listening to
> > > RTNLGRP_IPV4_IFADDR will now also get multicast addresses by default ?
> > >
> >
> > Yes that's the crux of this change. It's unfortunate that I could not
> > use IFA_MULTICAST to distinguish the SAFI. I suppose the other option
> > would be to create a set of new NEW/DEL/GETMULTICAST messages but the
> > partial code for RTM_GETMULTICAST in ipv6/mcast.c complicates that
> > slightly. Happy to look at it if you think that would be be better.
> >
>
> yeah, true. Thinking about this some more, you are adding an interface
> for multicast entries learnt via igmp.
> There is already a netlink channel for layer2 mc addresses via igmp. I
> can't see why that cannot be used.
> It is RTM_*MDB msgs. It is currently only available for the bridge.
> But, I have a requirement for it to be
> available via a vxlan dev...so, I am looking at making it available on
> other devices.
>
> The reason I think it should be possible is because this is similar to
> bridge fdb entries.
> The bridge fdb api (RTM_NEWNEIGH with AF_BRIDGE) is overloaded to
> notify and dump netdev unicast addresses.
> similarly I think the mdb api can be overloaded to notify and dump
> netdev multicast addresses (statically added or learnt via igmp)
OK I'll take a look at this.
^ permalink raw reply
* Re: [PATCH v2 net-next] failover: Add missing check to validate 'slave_dev' in net_failover_slave_unregister
From: Liran Alon @ 2018-09-04 7:36 UTC (permalink / raw)
To: yuehaibing
Cc: sridhar.samudrala, alexander.h.duyck, stephen, jeffrey.t.kirsher,
netdev, dan.carpenter, davem, kernel-janitors, joao.m.martins
----- yuehaibing@huawei.com wrote:
> Fixes gcc '-Wunused-but-set-variable' warning:
>
> drivers/net/net_failover.c: In function
> 'net_failover_slave_unregister':
> drivers/net/net_failover.c:598:35: warning:
> variable 'primary_dev' set but not used [-Wunused-but-set-variable]
>
> There should check the validity of 'slave_dev'.
>
> Fixes: cfc80d9a1163 ("net: Introduce net_failover driver")
>
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
> v2: use WARN_ON_ONCE as Liran Alon suggested
> ---
> drivers/net/net_failover.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/net/net_failover.c b/drivers/net/net_failover.c
> index 7ae1856..5a749dc 100644
> --- a/drivers/net/net_failover.c
> +++ b/drivers/net/net_failover.c
> @@ -603,6 +603,9 @@ static int net_failover_slave_unregister(struct
> net_device *slave_dev,
> primary_dev = rtnl_dereference(nfo_info->primary_dev);
> standby_dev = rtnl_dereference(nfo_info->standby_dev);
>
> + if (WARN_ON_ONCE(slave_dev != primary_dev && slave_dev !=
> standby_dev))
> + return -ENODEV;
> +
I prefer to put () around different conditions but that's just a matter of taste.
Reviewed-by: Liran Alon <liran.alon@oracle.com>
> vlan_vids_del_by_dev(slave_dev, failover_dev);
> dev_uc_unsync(slave_dev, failover_dev);
> dev_mc_unsync(slave_dev, failover_dev);
^ permalink raw reply
* Re: Why not use all the syn queues? in the function "tcp_conn_request", I have some questions.
From: Eric Dumazet @ 2018-09-04 7:23 UTC (permalink / raw)
To: Ttttabcd, netdev@vger.kernel.org
In-Reply-To: <47NgfBCN4YlW5rstCQGVJicSQ3yqiWFZpYPuBnmE1Jer0vxuBffWYbZzM2VmkeNNdk8gFgnMYo5T1fODpWGiRKnElyAY7bUmS_r-Z-SSaf4=@protonmail.com>
On 09/03/2018 10:31 PM, Ttttabcd wrote:
> Hello everyone,recently I am looking at the source code for handling TCP three-way handshake(Linux Kernel version 4.18.5).
>
> I found some strange places in the source code for handling syn messages.
>
> in the function "tcp_conn_request"
>
> This code will be executed when we don't enable the syn cookies.
>
> if (!net->ipv4.sysctl_tcp_syncookies &&
> (net->ipv4.sysctl_max_syn_backlog - inet_csk_reqsk_queue_len(sk) <
> (net->ipv4.sysctl_max_syn_backlog >> 2)) &&
> !tcp_peer_is_proven(req, dst)) {
> /* Without syncookies last quarter of
> * backlog is filled with destinations,
> * proven to be alive.
> * It means that we continue to communicate
> * to destinations, already remembered
> * to the moment of synflood.
> */
> pr_drop_req(req, ntohs(tcp_hdr(skb)->source),
> rsk_ops->family);
> goto drop_and_release;
> }
>
> But why don't we use all the syn queues?
Isn't it explained in the comment ?
Anyway, I am not sure anyone disables syn cookies.
^ permalink raw reply
* Re: [Patch net] tipc: orphan sock in tipc_release()
From: Ying Xue @ 2018-09-04 11:40 UTC (permalink / raw)
To: Cong Wang, netdev; +Cc: tipc-discussion
In-Reply-To: <20180904021241.11426-2-xiyou.wangcong@gmail.com>
On 09/04/2018 10:12 AM, Cong Wang wrote:
> Before we unlock the sock in tipc_release(), we have to
> detach sk->sk_socket from sk, otherwise a parallel
> tipc_sk_fill_sock_diag() could stil read it after we
> free this socket.
>
> Fixes: c30b70deb5f4 ("tipc: implement socket diagnostics for AF_TIPC")
> Reported-and-tested-by: syzbot+48804b87c16588ad491d@syzkaller.appspotmail.com
> Cc: Jon Maloy <jon.maloy@ericsson.com>
> Cc: Ying Xue <ying.xue@windriver.com>
> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Acked-by: Ying Xue <ying.xue@windriver.com>
> ---
> net/tipc/socket.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/net/tipc/socket.c b/net/tipc/socket.c
> index a19b2b1c77ed..b5a6635e4dfa 100644
> --- a/net/tipc/socket.c
> +++ b/net/tipc/socket.c
> @@ -576,6 +576,7 @@ static int tipc_release(struct socket *sock)
> sk_stop_timer(sk, &sk->sk_timer);
> tipc_sk_remove(tsk);
>
> + sock_orphan(sk);
> /* Reject any messages that accumulated in backlog queue */
> release_sock(sk);
> tipc_dest_list_purge(&tsk->cong_links);
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
^ permalink raw reply
* Re: [PATCH] [RFC v2] Drop all 00-INDEX files from Documentation/
From: Pavel Machek @ 2018-09-04 11:30 UTC (permalink / raw)
To: Henrik Austad
Cc: Mark Rutland, linux-mips, linux-fbdev, x86, kvm, linux-doc,
Peter Zijlstra, James Hogan, Will Deacon, dri-devel,
Masahiro Yamada, Jan Kandziora, Paul Mackerras, Henrik Austad,
H. Peter Anvin, Evgeniy Polyakov, linux-s390, Ian Kent,
linux-security-module, Paul Moore, Jonathan Corbet,
Michael Ellerman, Helge Deller, Radim Krčmář,
James E.J. Bottomley, Ingo Molnar
In-Reply-To: <1536012923-16275-1-git-send-email-henrik@austad.us>
[-- Attachment #1.1: Type: text/plain, Size: 1036 bytes --]
Hi!
> The 00-INDEX files are supposed to give a summary of all files present
> in a directory, but these files are horribly out of date and their
> usefulness is brought into question. Often a simple "ls" would reveal
> the same information as the filenames are generally quite descriptive as
> a short introduction to what the file covers (it should not surprise
> -SAK.txt
> - - info on Secure Attention Keys.
> -SM501.txt
> - - Silicon Motion SM501 multimedia companion chip
> -btmrvl.txt
> - - info on Marvell Bluetooth driver usage.
Well, I don't know what sm501 is, but description helps me. SAK is
similar. .. as is btmrvl.
I'd say this is still quite valueable, and it might be worth fixing,
rather then removing completely.
And yes, moving stuff to subdirectories and naming files reasonably
would help, too. "btmrvl" is really bad name...
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
[-- Attachment #2: Type: text/plain, Size: 160 bytes --]
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply
* RE: [net-next 02/15] i40e: move ethtool stats boiler plate code to i40e_ethtool_stats.h
From: Keller, Jacob E @ 2018-09-04 6:41 UTC (permalink / raw)
To: David Miller, Kirsher, Jeffrey T
Cc: netdev@vger.kernel.org, nhorman@redhat.com, sassmann@redhat.com,
jogreene@redhat.com
In-Reply-To: <20180829.200526.960850869217922028.davem@davemloft.net>
> -----Original Message-----
> From: netdev-owner@vger.kernel.org [mailto:netdev-owner@vger.kernel.org]
> On Behalf Of David Miller
> Sent: Wednesday, August 29, 2018 8:05 PM
> To: Kirsher, Jeffrey T <jeffrey.t.kirsher@intel.com>
> Cc: Keller, Jacob E <jacob.e.keller@intel.com>; netdev@vger.kernel.org;
> nhorman@redhat.com; sassmann@redhat.com; jogreene@redhat.com
> Subject: Re: [net-next 02/15] i40e: move ethtool stats boiler plate code to
> i40e_ethtool_stats.h
>
> From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> Date: Wed, 29 Aug 2018 15:48:21 -0700
>
> > diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool_stats.h
> b/drivers/net/ethernet/intel/i40e/i40e_ethtool_stats.h
> > new file mode 100644
> > index 000000000000..0290ade7494b
> > --- /dev/null
> > +++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool_stats.h
> > @@ -0,0 +1,221 @@
> ...
> > +/**
> > + * __i40e_add_stat_strings - copy stat strings into ethtool buffer
> > + * @p: ethtool supplied buffer
> > + * @stats: stat definitions array
> > + * @size: size of the stats array
> > + *
> > + * Format and copy the strings described by stats into the buffer pointed at
> > + * by p.
> > + **/
> > +static void __i40e_add_stat_strings(u8 **p, const struct i40e_stats stats[],
> > + const unsigned int size, ...)
>
> Need to be marked inline.
Marking this inline seems to be causing build problems on some systems because it uses variadic arguments.
Thanks,
Jake
^ permalink raw reply
* Re: [PATCH net 0/3] bnxt_en: Bug fixes.
From: Michael Chan @ 2018-09-04 6:30 UTC (permalink / raw)
To: David Miller; +Cc: Netdev
In-Reply-To: <CACKFLi=VmicKZU0KAaNki43z4xyzzkBa2--KN5JB20SjdcqEtQ@mail.gmail.com>
On Mon, Sep 3, 2018 at 10:50 PM, Michael Chan <michael.chan@broadcom.com> wrote:
> On Mon, Sep 3, 2018 at 10:01 PM, David Miller <davem@davemloft.net> wrote:
>>
>> From: Michael Chan <michael.chan@broadcom.com>
>> Date: Mon, 3 Sep 2018 04:23:16 -0400
>>
>> > This short series fixes resource related logic in the driver, mostly
>> > affecting the RDMA driver under corner cases.
>>
>> Series applied, thanks Michael.
>>
>> Do you want patch #3 queued up for -stable?
>
> Yes, please go ahead. Thanks.
But there is a dependency on patch #2 though. So #2 needs to be queued as well.
^ permalink raw reply
* [PATCH v6] selftests: add headers_install to lib.mk
From: Anders Roxell @ 2018-09-04 10:47 UTC (permalink / raw)
To: yamada.masahiro, michal.lkml, shuah, bamv2005, brgl, pbonzini,
akpm, rppt, aarcange
Cc: linux-kbuild, linux-kernel, linux-kselftest, netdev,
Anders Roxell
In-Reply-To: <20180809080402.24469-1-anders.roxell@linaro.org>
If the kernel headers aren't installed we can't build all the tests.
Add a new make target rule 'khdr' in the file lib.mk to generate the
kernel headers and that gets include for every test-dir Makefile that
includes lib.mk If the testdir in turn have its own sub-dirs the
top_srcdir needs to be set to the linux-rootdir to be able to generate
the kernel headers.
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
Reviewed-by: Fathi Boudra <fathi.boudra@linaro.org>
---
I sent this (v5) a month ago and wondered if it got lost. Resending
unchanged.
Cheers,
Anders
Makefile | 14 +-------------
scripts/subarch.include | 13 +++++++++++++
tools/testing/selftests/android/Makefile | 2 +-
tools/testing/selftests/android/ion/Makefile | 2 ++
tools/testing/selftests/futex/functional/Makefile | 1 +
tools/testing/selftests/gpio/Makefile | 7 ++-----
tools/testing/selftests/kvm/Makefile | 7 ++-----
tools/testing/selftests/lib.mk | 12 ++++++++++++
tools/testing/selftests/net/Makefile | 1 +
.../selftests/networking/timestamping/Makefile | 1 +
tools/testing/selftests/vm/Makefile | 4 ----
11 files changed, 36 insertions(+), 28 deletions(-)
create mode 100644 scripts/subarch.include
diff --git a/Makefile b/Makefile
index 19948e556941..9c781e77fa24 100644
--- a/Makefile
+++ b/Makefile
@@ -299,19 +299,7 @@ KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null)
KERNELVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION)
export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION
-# SUBARCH tells the usermode build what the underlying arch is. That is set
-# first, and if a usermode build is happening, the "ARCH=um" on the command
-# line overrides the setting of ARCH below. If a native build is happening,
-# then ARCH is assigned, getting whatever value it gets normally, and
-# SUBARCH is subsequently ignored.
-
-SUBARCH := $(shell uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/ \
- -e s/sun4u/sparc64/ \
- -e s/arm.*/arm/ -e s/sa110/arm/ \
- -e s/s390x/s390/ -e s/parisc64/parisc/ \
- -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
- -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ \
- -e s/riscv.*/riscv/)
+include scripts/subarch.include
# Cross compiling and selecting different set of gcc/bin-utils
# ---------------------------------------------------------------------------
diff --git a/scripts/subarch.include b/scripts/subarch.include
new file mode 100644
index 000000000000..650682821126
--- /dev/null
+++ b/scripts/subarch.include
@@ -0,0 +1,13 @@
+# SUBARCH tells the usermode build what the underlying arch is. That is set
+# first, and if a usermode build is happening, the "ARCH=um" on the command
+# line overrides the setting of ARCH below. If a native build is happening,
+# then ARCH is assigned, getting whatever value it gets normally, and
+# SUBARCH is subsequently ignored.
+
+SUBARCH := $(shell uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/ \
+ -e s/sun4u/sparc64/ \
+ -e s/arm.*/arm/ -e s/sa110/arm/ \
+ -e s/s390x/s390/ -e s/parisc64/parisc/ \
+ -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
+ -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ \
+ -e s/riscv.*/riscv/)
diff --git a/tools/testing/selftests/android/Makefile b/tools/testing/selftests/android/Makefile
index 72c25a3cb658..d9a725478375 100644
--- a/tools/testing/selftests/android/Makefile
+++ b/tools/testing/selftests/android/Makefile
@@ -6,7 +6,7 @@ TEST_PROGS := run.sh
include ../lib.mk
-all:
+all: khdr
@for DIR in $(SUBDIRS); do \
BUILD_TARGET=$(OUTPUT)/$$DIR; \
mkdir $$BUILD_TARGET -p; \
diff --git a/tools/testing/selftests/android/ion/Makefile b/tools/testing/selftests/android/ion/Makefile
index e03695287f76..88cfe88e466f 100644
--- a/tools/testing/selftests/android/ion/Makefile
+++ b/tools/testing/selftests/android/ion/Makefile
@@ -10,6 +10,8 @@ $(TEST_GEN_FILES): ipcsocket.c ionutils.c
TEST_PROGS := ion_test.sh
+KSFT_KHDR_INSTALL := 1
+top_srcdir = ../../../../..
include ../../lib.mk
$(OUTPUT)/ionapp_export: ionapp_export.c ipcsocket.c ionutils.c
diff --git a/tools/testing/selftests/futex/functional/Makefile b/tools/testing/selftests/futex/functional/Makefile
index ff8feca49746..ad1eeb14fda7 100644
--- a/tools/testing/selftests/futex/functional/Makefile
+++ b/tools/testing/selftests/futex/functional/Makefile
@@ -18,6 +18,7 @@ TEST_GEN_FILES := \
TEST_PROGS := run.sh
+top_srcdir = ../../../../..
include ../../lib.mk
$(TEST_GEN_FILES): $(HEADERS)
diff --git a/tools/testing/selftests/gpio/Makefile b/tools/testing/selftests/gpio/Makefile
index 1bbb47565c55..4665cdbf1a8d 100644
--- a/tools/testing/selftests/gpio/Makefile
+++ b/tools/testing/selftests/gpio/Makefile
@@ -21,11 +21,8 @@ endef
CFLAGS += -O2 -g -std=gnu99 -Wall -I../../../../usr/include/
LDLIBS += -lmount -I/usr/include/libmount
-$(BINARIES): ../../../gpio/gpio-utils.o ../../../../usr/include/linux/gpio.h
+$(BINARIES):| khdr
+$(BINARIES): ../../../gpio/gpio-utils.o
../../../gpio/gpio-utils.o:
make ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C ../../../gpio
-
-../../../../usr/include/linux/gpio.h:
- make -C ../../../.. headers_install INSTALL_HDR_PATH=$(shell pwd)/../../../../usr/
-
diff --git a/tools/testing/selftests/kvm/Makefile b/tools/testing/selftests/kvm/Makefile
index 03b0f551bedf..87d1a8488af8 100644
--- a/tools/testing/selftests/kvm/Makefile
+++ b/tools/testing/selftests/kvm/Makefile
@@ -37,9 +37,6 @@ $(LIBKVM_OBJ): $(OUTPUT)/%.o: %.c
$(OUTPUT)/libkvm.a: $(LIBKVM_OBJ)
$(AR) crs $@ $^
-$(LINUX_HDR_PATH):
- make -C $(top_srcdir) headers_install
-
-all: $(STATIC_LIBS) $(LINUX_HDR_PATH)
+all: $(STATIC_LIBS)
$(TEST_GEN_PROGS): $(STATIC_LIBS)
-$(TEST_GEN_PROGS) $(LIBKVM_OBJ): | $(LINUX_HDR_PATH)
+$(STATIC_LIBS):| khdr
diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
index 17ab36605a8e..0a8e75886224 100644
--- a/tools/testing/selftests/lib.mk
+++ b/tools/testing/selftests/lib.mk
@@ -16,8 +16,20 @@ TEST_GEN_PROGS := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_PROGS))
TEST_GEN_PROGS_EXTENDED := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_PROGS_EXTENDED))
TEST_GEN_FILES := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_FILES))
+top_srcdir ?= ../../../..
+include $(top_srcdir)/scripts/subarch.include
+ARCH ?= $(SUBARCH)
+
all: $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES)
+.PHONY: khdr
+khdr:
+ make ARCH=$(ARCH) -C $(top_srcdir) headers_install
+
+ifdef KSFT_KHDR_INSTALL
+$(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES):| khdr
+endif
+
.ONESHELL:
define RUN_TEST_PRINT_RESULT
TEST_HDR_MSG="selftests: "`basename $$PWD`:" $$BASENAME_TEST"; \
diff --git a/tools/testing/selftests/net/Makefile b/tools/testing/selftests/net/Makefile
index cccdb2295567..256d82d5fa87 100644
--- a/tools/testing/selftests/net/Makefile
+++ b/tools/testing/selftests/net/Makefile
@@ -15,6 +15,7 @@ TEST_GEN_FILES += udpgso udpgso_bench_tx udpgso_bench_rx ip_defrag
TEST_GEN_PROGS = reuseport_bpf reuseport_bpf_cpu reuseport_bpf_numa
TEST_GEN_PROGS += reuseport_dualstack reuseaddr_conflict tls
+KSFT_KHDR_INSTALL := 1
include ../lib.mk
$(OUTPUT)/reuseport_bpf_numa: LDFLAGS += -lnuma
diff --git a/tools/testing/selftests/networking/timestamping/Makefile b/tools/testing/selftests/networking/timestamping/Makefile
index a728040edbe1..14cfcf006936 100644
--- a/tools/testing/selftests/networking/timestamping/Makefile
+++ b/tools/testing/selftests/networking/timestamping/Makefile
@@ -5,6 +5,7 @@ TEST_PROGS := hwtstamp_config rxtimestamp timestamping txtimestamp
all: $(TEST_PROGS)
+top_srcdir = ../../../../..
include ../../lib.mk
clean:
diff --git a/tools/testing/selftests/vm/Makefile b/tools/testing/selftests/vm/Makefile
index 9881876d2aa0..e94b7b14bcb2 100644
--- a/tools/testing/selftests/vm/Makefile
+++ b/tools/testing/selftests/vm/Makefile
@@ -26,10 +26,6 @@ TEST_PROGS := run_vmtests
include ../lib.mk
-$(OUTPUT)/userfaultfd: ../../../../usr/include/linux/kernel.h
$(OUTPUT)/userfaultfd: LDLIBS += -lpthread
$(OUTPUT)/mlock-random-test: LDLIBS += -lcap
-
-../../../../usr/include/linux/kernel.h:
- make -C ../../../.. headers_install
--
2.18.0
^ permalink raw reply related
* Re: [PATCH 01/25] tty: Change return type to void
From: Sergei Shtylyov @ 2018-09-04 10:45 UTC (permalink / raw)
To: Jaejoong Kim, linux-um, netdev, linux-mmc, linux-s390, devel,
greybus-dev, linuxppc-dev, linux-serial, sparclinux, linux-usb,
linux-bluetooth, linux-kernel
Cc: Greg Kroah-Hartman, Jiri Slaby
In-Reply-To: <1536029091-4426-2-git-send-email-climbbb.kim@gmail.com>
Hello!
On 9/4/2018 5:44 AM, Jaejoong Kim wrote:
> Many drivers with tty use the tty_stand_install(). But, there is no
> need to handle the error, since it always returns 0. So, change the
> return type of tty_standard_install() and tty_port_install() to void
> type and remove unnecessary exception handling where we use these
> functions.
>
> Signed-off-by: Jaejoong Kim <climbbb.kim@gmail.com>
> ---
> drivers/tty/tty_io.c | 10 ++++++----
> drivers/tty/tty_port.c | 4 ++--
> include/linux/tty.h | 4 ++--
> 3 files changed, 10 insertions(+), 8 deletions(-)
>
[...]
> diff --git a/include/linux/tty.h b/include/linux/tty.h
> index c56e397..63cdac1 100644
> --- a/include/linux/tty.h
> +++ b/include/linux/tty.h
> @@ -556,7 +556,7 @@ extern struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx);
> extern void tty_release_struct(struct tty_struct *tty, int idx);
> extern int tty_release(struct inode *inode, struct file *filp);
> extern void tty_init_termios(struct tty_struct *tty);
> -extern int tty_standard_install(struct tty_driver *driver,
> +extern void tty_standard_install(struct tty_driver *driver,
> struct tty_struct *tty);
>
> extern struct mutex tty_mutex;
> @@ -688,7 +688,7 @@ extern int tty_port_close_start(struct tty_port *port,
> extern void tty_port_close_end(struct tty_port *port, struct tty_struct *tty);
> extern void tty_port_close(struct tty_port *port,
> struct tty_struct *tty, struct file *filp);
> -extern int tty_port_install(struct tty_port *port, struct tty_driver *driver,
> +extern void tty_port_install(struct tty_port *port, struct tty_driver *driver,
> struct tty_struct *tty);
You need to update all the callers in the same patch -- the kernel must
remain buildable after each patch but you seem to have spread that update
among a lot of patches..
[...]
MBR, Sergei
^ permalink raw reply
* Re: [PATCH] [RFC v2] Drop all 00-INDEX files from Documentation/
From: Mark Brown @ 2018-09-04 10:41 UTC (permalink / raw)
To: Henrik Austad
Cc: Mark Rutland, linux-mips, linux-fbdev, x86, kvm, linux-doc,
Peter Zijlstra, James Hogan, Will Deacon, dri-devel,
Masahiro Yamada, Jan Kandziora, Paul Mackerras, Henrik Austad,
Pavel Machek, H. Peter Anvin, Evgeniy Polyakov, linux-s390,
Ian Kent, linux-security-module, Paul Moore, Jonathan Corbet,
Michael Ellerman, Helge Deller, Radim Krčmář,
James E.J. Bottomley
In-Reply-To: <1536012923-16275-1-git-send-email-henrik@austad.us>
[-- Attachment #1.1: Type: text/plain, Size: 307 bytes --]
On Tue, Sep 04, 2018 at 12:15:23AM +0200, Henrik Austad wrote:
> This is a respin with a wider audience (all that get_maintainer returned)
> and I know this spams a *lot* of people. Not sure what would be the correct
> way, so my apologies for ruining your inbox.
Acked-by: Mark Brown <broonie@kernel.org>
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
[-- Attachment #2: Type: text/plain, Size: 160 bytes --]
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply
* Re: [PATCH] iwlwifi: mvm: fix spelling mistake "Recieved" -> "Received"
From: Luciano Coelho @ 2018-09-04 6:02 UTC (permalink / raw)
To: Colin King, Johannes Berg, Emmanuel Grumbach,
Intel Linux Wireless, Kalle Valo, David S . Miller,
linux-wireless, netdev
Cc: kernel-janitors, linux-kernel
In-Reply-To: <20180826223117.12892-1-colin.king@canonical.com>
On Sun, 2018-08-26 at 23:31 +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Trivial fix to spelling mistake in debug message.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
> index b15b0d84bb7e..5f32d3131d62 100644
> --- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
> +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
> @@ -3320,7 +3320,7 @@ static bool iwl_mvm_rx_aux_roc(struct iwl_notif_wait_data *notif_wait,
> resp = (void *)pkt->data;
>
> IWL_DEBUG_TE(mvm,
> - "Aux ROC: Recieved response from ucode: status=%d uid=%d\n",
> + "Aux ROC: Received response from ucode: status=%d uid=%d\n",
> resp->status, resp->event_unique_id);
>
> te_data->uid = le32_to_cpu(resp->event_unique_id);
Thanks! I pushed this to our internal tree and it will reach upstream
following our normal process.
^ permalink raw reply
* Re: [PATCH net 0/3] bnxt_en: Bug fixes.
From: Michael Chan @ 2018-09-04 5:50 UTC (permalink / raw)
To: David Miller; +Cc: Netdev
In-Reply-To: <20180903.220108.1715486066701916741.davem@davemloft.net>
On Mon, Sep 3, 2018 at 10:01 PM, David Miller <davem@davemloft.net> wrote:
>
> From: Michael Chan <michael.chan@broadcom.com>
> Date: Mon, 3 Sep 2018 04:23:16 -0400
>
> > This short series fixes resource related logic in the driver, mostly
> > affecting the RDMA driver under corner cases.
>
> Series applied, thanks Michael.
>
> Do you want patch #3 queued up for -stable?
Yes, please go ahead. Thanks.
^ permalink raw reply
* Why not use all the syn queues? in the function "tcp_conn_request", I have some questions.
From: Ttttabcd @ 2018-09-04 5:31 UTC (permalink / raw)
To: netdev@vger.kernel.org
Hello everyone,recently I am looking at the source code for handling TCP three-way handshake(Linux Kernel version 4.18.5).
I found some strange places in the source code for handling syn messages.
in the function "tcp_conn_request"
This code will be executed when we don't enable the syn cookies.
if (!net->ipv4.sysctl_tcp_syncookies &&
(net->ipv4.sysctl_max_syn_backlog - inet_csk_reqsk_queue_len(sk) <
(net->ipv4.sysctl_max_syn_backlog >> 2)) &&
!tcp_peer_is_proven(req, dst)) {
/* Without syncookies last quarter of
* backlog is filled with destinations,
* proven to be alive.
* It means that we continue to communicate
* to destinations, already remembered
* to the moment of synflood.
*/
pr_drop_req(req, ntohs(tcp_hdr(skb)->source),
rsk_ops->family);
goto drop_and_release;
}
But why don't we use all the syn queues?
Why do we need to leave the size of (net->ipv4.sysctl_max_syn_backlog >> 2) in the queue?
Even if the system is attacked by a syn flood, there is no need to leave a part. Why do we need to leave a part?
The value of sysctl_max_syn_backlog is the maximum length of the queue only if syn cookies are enabled.
This is the first strange place, here is another strange place
__u32 isn = TCP_SKB_CB(skb)->tcp_tw_isn;
if ((net->ipv4.sysctl_tcp_syncookies == 2 ||
inet_csk_reqsk_queue_is_full(sk)) && !isn) {
if (!want_cookie && !isn) {
The value of "isn" comes from TCP_SKB_CB(skb)->tcp_tw_isn, then it is judged twice whether its value is indeed 0.
But "tcp_tw_isn" is initialized in the function "tcp_v4_fill_cb"
TCP_SKB_CB(skb)->tcp_tw_isn = 0;
So it has always been 0, I used printk to test, and the result is always 0.
Since it is always 0, why do you need to judge twice?
This is two strange places I found.
Can anyone tell me why the code here is written like this?
^ permalink raw reply
* Re: [PATCH v3 0/6] Ethernet over hdlc
From: David Miller @ 2018-09-04 5:14 UTC (permalink / raw)
To: david.gounaris; +Cc: qiang.zhao, netdev, linuxppc-dev, joakim.tjernlund
In-Reply-To: <20180903124730.1551-1-david.gounaris@infinera.com>
From: David Gounaris <david.gounaris@infinera.com>
Date: Mon, 3 Sep 2018 14:47:24 +0200
> Here is what has been changed in v3 after the review comments from v2.
>
> v3-0001: corrected style problems
> v3-0002: corrected style problems
> v3-0003: corrected style problems
> v3-0004: corrected style problems
> v3-0005: corrected style problems
> v3-0006: corrected style problems
>
> Sorry for that, I did not know about scripts/checkpatch.pl.
Series applied to net-next.
^ permalink raw reply
* Re: pull-request: mac80211 2018-09-03
From: David Miller @ 2018-09-04 5:12 UTC (permalink / raw)
To: johannes; +Cc: netdev, linux-wireless
In-Reply-To: <20180903121546.27673-1-johannes@sipsolutions.net>
From: Johannes Berg <johannes@sipsolutions.net>
Date: Mon, 3 Sep 2018 14:15:45 +0200
> This time around for mac80211 I have a larger than usual number of
> fixes, in part because Luca dumped our (Intel's) patches out after
> quite a while - we'll try to make sure this doesn't happen again.
>
> Shortlog below, as usual, each fix is pretty self-contained but it
> adds up to quite a bit overall.
>
> Please pull and let me know if there's any problem.
Ok pulled, I'll try to get this merged into net-next in the next day
or two.
Thanks.
^ permalink raw reply
* Re: [PATCH net-next v2] cxgb4: collect hardware queue descriptors
From: David Miller @ 2018-09-04 5:10 UTC (permalink / raw)
To: rahul.lakkireddy; +Cc: netdev, ganeshgr, nirranjan, indranil
In-Reply-To: <1535976689-21710-1-git-send-email-rahul.lakkireddy@chelsio.com>
From: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Date: Mon, 3 Sep 2018 17:41:29 +0530
> Collect descriptors of all ULD and LLD hardware queues managed
> by LLD.
>
> Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
> Signed-off-by: Ganesh Goudar <ganeshgr@chelsio.com>
> ---
> v2:
> - Move inline functions to header file.
> - Add missing undefine for QDESC_GET_* macros.
Applied.
^ permalink raw reply
* Re: [PATCH net-next] cxgb4: when max_tx_rate is 0 disable tx rate limiting
From: David Miller @ 2018-09-04 5:10 UTC (permalink / raw)
To: ganeshgr; +Cc: netdev, nirranjan, indranil, dt, leedom
In-Reply-To: <1535971906-31762-1-git-send-email-ganeshgr@chelsio.com>
From: Ganesh Goudar <ganeshgr@chelsio.com>
Date: Mon, 3 Sep 2018 16:21:46 +0530
> in ndo_set_vf_rate() when max_tx_rate is 0 disable tx
> rate limiting for that vf.
>
> Signed-off-by: Casey Leedom <leedom@chelsio.com>
> Signed-off-by: Ganesh Goudar <ganeshgr@chelsio.com>
Applied, thanks.
^ permalink raw reply
* Re: [PATCH net-next 2/2] tipc: correct spelling errors for tipc_topsrv_queue_evt() comments
From: David Miller @ 2018-09-04 5:03 UTC (permalink / raw)
To: zhenbo.gao; +Cc: jon.maloy, tipc-discussion, netdev, ying.xue, yue.tao
In-Reply-To: <1535963806-27142-2-git-send-email-zhenbo.gao@windriver.com>
From: Zhenbo Gao <zhenbo.gao@windriver.com>
Date: Mon, 3 Sep 2018 16:36:46 +0800
> tipc_conn_queue_evt -> tipc_topsrv_queue_evt
> tipc_send_work -> tipc_conn_send_work
> tipc_send_to_sock -> tipc_conn_send_to_sock
>
> Signed-off-by: Zhenbo Gao <zhenbo.gao@windriver.com>
> Reviewed-by: Ying Xue <ying.xue@windriver.com>
Applied.
^ permalink raw reply
* Re: [PATCH net-next 1/2] tipc: correct spelling errors for struct tipc_bc_base's comment
From: David Miller @ 2018-09-04 5:03 UTC (permalink / raw)
To: zhenbo.gao; +Cc: jon.maloy, tipc-discussion, netdev, ying.xue, yue.tao
In-Reply-To: <1535963806-27142-1-git-send-email-zhenbo.gao@windriver.com>
From: Zhenbo Gao <zhenbo.gao@windriver.com>
Date: Mon, 3 Sep 2018 16:36:45 +0800
> Trivial fix for two spelling mistakes.
>
> Signed-off-by: Zhenbo Gao <zhenbo.gao@windriver.com>
> Reviewed-by: Ying Xue <ying.xue@windriver.com>
Applied.
^ permalink raw reply
* [PATCH RFC net-next] net: Poptrie based routing table lookup
From: Md. Islam @ 2018-09-04 5:02 UTC (permalink / raw)
To: Netdev, David Miller, David Ahern, Alexey Kuznetsov,
alexei.starovoitov, Jesper Dangaard Brouer, Stephen Hemminger,
makita.toshiaki, panda, yasuhiro.ohara, Eric Dumazet,
john fastabend
[-- Attachment #1: Type: text/plain, Size: 18982 bytes --]
This patch implements Poptrie based routing table
lookup/insert/delete/flush. Currently many carrier routers use kernel
bypass frameworks such as DPDK and VPP to implement the data plane.
XDP along with this patch will enable Linux to work as such a router.
Currently it supports up to 255 ports. Many real word backbone routers
have up to 233 ports (to the best of my knowledge), so it seems to be
sufficient at this moment.
I also have attached a draft paper to explain it works (poptrie.pdf).
Please set CONFIG_FIB_POPTRIE=y (default n) before testing the patch.
Note that, poptrie_lookup() is not being called from anywhere. It will
be used by XDP forwarding.
>From 3dc9683298ed896dd3080733503c35d68f05370e Mon Sep 17 00:00:00 2001
From: tamimcse <tamim@csebuet.org>
Date: Mon, 3 Sep 2018 23:56:43 -0400
Subject: [PATCH] Poptrie based routing table lookup
Signed-off-by: tamimcse <tamim@csebuet.org>
---
include/net/ip_fib.h | 42 +++++
net/ipv4/Kconfig | 4 +
net/ipv4/Makefile | 1 +
net/ipv4/fib_poptrie.c | 483 +++++++++++++++++++++++++++++++++++++++++++++++++
net/ipv4/fib_trie.c | 12 ++
5 files changed, 542 insertions(+)
create mode 100644 net/ipv4/fib_poptrie.c
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index 81d0f21..76be548 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -197,6 +197,45 @@ struct fib_entry_notifier_info {
u32 tb_id;
};
+#if IS_ENABLED(CONFIG_FIB_POPTRIE)
+/*
+ * The router can have upto 255 ports. This limitation
+ * allows us to represent fib_index as u8
+ */
+#define NEXT_HOP_MAX 255
+
+struct next_hops {
+ struct net_device *netdev_arr[NEXT_HOP_MAX];
+ /*Total number of next-hops*/
+ u8 count;
+};
+
+struct poptrie_node {
+ u64 vector;
+ u64 leafvec;
+ u64 nodevec;
+ struct poptrie_node *child_nodes;
+ u8 *leaves;
+ u8 *prefixes;
+ struct rcu_head rcu;
+};
+
+struct poptrie {
+ char def_nh;
+ struct next_hops nhs;
+ struct poptrie_node __rcu *root;
+ spinlock_t lock;
+};
+
+int poptrie_insert(struct poptrie *pt, u32 key,
+ u8 prefix_len, struct net_device *dev);
+int poptrie_delete(struct poptrie *pt, u32 key,
+ u8 prefix_len);
+int poptrie_flush(struct poptrie *pt);
+int poptrie_lookup(struct poptrie *pt, __be32 dest,
+ struct net_device **dev);
+#endif
+
struct fib_nh_notifier_info {
struct fib_notifier_info info; /* must be first */
struct fib_nh *fib_nh;
@@ -219,6 +258,9 @@ struct fib_table {
int tb_num_default;
struct rcu_head rcu;
unsigned long *tb_data;
+#if IS_ENABLED(CONFIG_FIB_POPTRIE)
+ struct poptrie pt;
+#endif
unsigned long __data[0];
};
diff --git a/net/ipv4/Kconfig b/net/ipv4/Kconfig
index 80dad30..75e9c9a 100644
--- a/net/ipv4/Kconfig
+++ b/net/ipv4/Kconfig
@@ -52,6 +52,10 @@ config IP_ADVANCED_ROUTER
If unsure, say N here.
+config FIB_POPTRIE
+ bool
+ default n
+
config IP_FIB_TRIE_STATS
bool "FIB TRIE statistics"
depends on IP_ADVANCED_ROUTER
diff --git a/net/ipv4/Makefile b/net/ipv4/Makefile
index b379520..fae4bd4 100644
--- a/net/ipv4/Makefile
+++ b/net/ipv4/Makefile
@@ -62,6 +62,7 @@ obj-$(CONFIG_TCP_CONG_LP) += tcp_lp.o
obj-$(CONFIG_TCP_CONG_YEAH) += tcp_yeah.o
obj-$(CONFIG_TCP_CONG_ILLINOIS) += tcp_illinois.o
obj-$(CONFIG_NETLABEL) += cipso_ipv4.o
+obj-$(CONFIG_FIB_POPTRIE) += fib_poptrie.o
obj-$(CONFIG_XFRM) += xfrm4_policy.o xfrm4_state.o xfrm4_input.o \
xfrm4_output.o xfrm4_protocol.o
diff --git a/net/ipv4/fib_poptrie.c b/net/ipv4/fib_poptrie.c
new file mode 100644
index 0000000..3f231e7
--- /dev/null
+++ b/net/ipv4/fib_poptrie.c
@@ -0,0 +1,483 @@
+// SPDX-License-Identifier: GPL-2.0
+/*This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ *
+ * Author: MD Iftakharul Islam (Tamim) <mislam4@kent.edu>.
+ *
+ * Asai, Hirochika, and Yasuhiro Ohara. "Poptrie: A compressed trie
+ * with population count for fast and scalable software IP routing
+ * table lookup." ACM SIGCOMM Computer Communication Review. 2015.
+ *
+ */
+
+#include <net/ip_fib.h>
+
+/*Get next-hop index from next-hop*/
+static u8 get_fib_index(struct next_hops *nhs, struct net_device *dev)
+{
+ u8 i;
+
+ for (i = 0; i < nhs->count; i++) {
+ if (nhs->netdev_arr[i] == dev)
+ return i;
+ }
+ nhs->netdev_arr[nhs->count++] = dev;
+ return nhs->count - 1;
+}
+
+/*Extracts 6 bytes from key starting from offset*/
+static u32 extract(u32 key, int offset)
+{
+ if (likely(offset < 26))
+ return (key >> (26 - offset)) & 63;
+ else
+ return (key << 4) & 63;
+}
+
+/*Set FIB index and prefix length to a leaf*/
+static void set_fib_index(struct poptrie_node *node,
+ unsigned long leaf_index,
+ char fib_index, char prefix_len)
+{
+ node->leaves[leaf_index] = fib_index;
+ node->prefixes[leaf_index] = prefix_len;
+}
+
+/*Insert a leaf at index*/
+static bool insert_leaf(struct poptrie_node *node,
+ char index, char fib_index,
+ char prefix_len)
+{
+ int i, j;
+ char *leaves;
+ char *prefixes;
+ int size = (int)hweight64(node->leafvec);
+
+ if (index > size) {
+ pr_err("Index needs to be smaller or equal to size");
+ return false;
+ }
+
+ leaves = kcalloc(size + 1, sizeof(*leaves), GFP_ATOMIC);
+ prefixes = kcalloc(size + 1, sizeof(*prefixes), GFP_ATOMIC);
+
+ for (i = 0, j = 0; i < (size + 1); i++) {
+ if (i == index) {
+ leaves[i] = fib_index;
+ prefixes[i] = prefix_len;
+ } else {
+ leaves[i] = node->leaves[j];
+ prefixes[i] = node->prefixes[j];
+ j++;
+ }
+ }
+
+ kfree(node->leaves);
+ kfree(node->prefixes);
+ node->leaves = leaves;
+ node->prefixes = prefixes;
+ return true;
+}
+
+/*Insert a new node at index*/
+static void insert_chield_node(struct poptrie_node *node,
+ char index)
+{
+ int i, j;
+ struct poptrie_node *arr;
+ int arr_size = (int)hweight64(node->nodevec);
+
+ arr = kcalloc(arr_size + 1, sizeof(*arr), GFP_ATOMIC);
+ for (i = 0, j = 0; i < (arr_size + 1); i++) {
+ if (i != index && j < arr_size)
+ arr[i] = node->child_nodes[j++];
+ }
+
+ kfree(node->child_nodes);
+ node->child_nodes = arr;
+}
+
+/*Delete a leaf at index*/
+static bool delete_leaf(struct poptrie_node *node,
+ char index)
+{
+ int i, j;
+ char *leaves;
+ char *prefixes;
+ int size = (int)hweight64(node->leafvec);
+
+ if (index >= size) {
+ pr_err("Index needs to be smaller or equal to size");
+ return false;
+ }
+
+ leaves = kcalloc(size - 1, sizeof(*leaves), GFP_ATOMIC);
+ prefixes = kcalloc(size - 1, sizeof(*prefixes), GFP_ATOMIC);
+
+ for (i = 0, j = 0; i < size; i++) {
+ if (i != index) {
+ leaves[j] = node->leaves[i];
+ prefixes[j] = node->prefixes[i];
+ j++;
+ }
+ }
+
+ kfree(node->leaves);
+ kfree(node->prefixes);
+ node->leaves = leaves;
+ node->prefixes = prefixes;
+ return true;
+}
+
+int poptrie_insert(struct poptrie *pt, u32 key,
+ u8 prefix_len, struct net_device *dev)
+{
+ int offset, i;
+ u32 index;
+ u8 consecutive_leafs;
+ u64 bitmap;
+ u64 bitmap_hp;
+ int arr_size;
+ unsigned long chield_index;
+ unsigned long leaf_index, prev_leaf_index;
+ unsigned long index_hp;
+ struct poptrie_node *node;
+ u8 prev_fib_index, prev_prefix_len;
+ u8 fib_index = get_fib_index(&pt->nhs, dev);
+
+ spin_lock(&pt->lock);
+
+ node = rcu_dereference(pt->root);
+ if (!node) {
+ node = kzalloc(sizeof(*node), GFP_ATOMIC);
+ rcu_assign_pointer(pt->root, node);
+ }
+
+ /* Default route */
+ if (prefix_len == 0) {
+ pt->def_nh = fib_index;
+ goto finish;
+ }
+
+ /*Iterate through the nodes*/
+ offset = 0;
+ while (prefix_len > (offset + 6)) {
+ index = extract(key, offset);
+ bitmap = 1ULL << index;
+ chield_index = hweight64(node->nodevec & (bitmap - 1));
+
+ /*No node for this index, so need to insert a node*/
+ if (!(node->nodevec & bitmap)) {
+ insert_chield_node(node, chield_index);
+ node->nodevec |= bitmap;
+ }
+ node = &node->child_nodes[chield_index];
+ offset += 6;
+ }
+
+ /*Now need to insert a leaf*/
+
+ index = extract(key, offset);
+ bitmap = 1ULL << index;
+ consecutive_leafs = 1 << (offset + 6 - prefix_len);
+
+ if (node->vector & bitmap && node->leafvec & bitmap) {
+ /*A leaf already exist for this index,
+ *so update the existing leaf
+ */
+ leaf_index = hweight64(node->leafvec & (bitmap - 1));
+ arr_size = (int)hweight64(node->leafvec);
+ if (leaf_index >= arr_size)
+ goto error;
+ /*Ignore the prefix*/
+ if (node->prefixes[leaf_index] > prefix_len) {
+ goto finish;
+ } else if (node->prefixes[leaf_index] == prefix_len) {
+ set_fib_index(node, leaf_index, fib_index, prefix_len);
+ } else {
+ /*hole punching*/
+ bitmap_hp = bitmap << consecutive_leafs;
+ if (!(node->leafvec & bitmap_hp)) {
+ index_hp = hweight64(node->leafvec &
+ (bitmap_hp - 1)) - 1;
+ if (node->prefixes[index_hp] <= prefix_len) {
+ insert_leaf(node, index_hp,
+ fib_index, prefix_len);
+ node->leafvec |= bitmap_hp;
+ }
+
+ for (i = leaf_index; i < index_hp ; i++) {
+ if (node->prefixes[i] <= prefix_len)
+ set_fib_index(node, i, fib_index, prefix_len);
+ }
+ } else {
+ index_hp = hweight64(node->leafvec &
+ (bitmap_hp - 1)) - 1;
+ for (i = leaf_index; i <= index_hp ; i++) {
+ if (node->prefixes[i] <= prefix_len)
+ set_fib_index(node, i, fib_index, prefix_len);
+ }
+ }
+ }
+ } else if (!(node->vector & bitmap)) {
+ /*No leaf for this index, so need to insert a leaf*/
+ leaf_index = hweight64(node->leafvec & (bitmap - 1));
+ insert_leaf(node, leaf_index, fib_index, prefix_len);
+ node->leafvec |= bitmap;
+ } else if (node->vector & bitmap && !(node->leafvec & bitmap)) {
+ /*There is a leaf for this index created by another
+ * prefix with smaller length
+ */
+ prev_leaf_index = hweight64(node->leafvec & (bitmap - 1)) - 1;
+ arr_size = (int)hweight64(node->leafvec);
+ if (prev_leaf_index >= arr_size)
+ goto error;
+ if (node->prefixes[prev_leaf_index] <= prefix_len) {
+ insert_leaf(node, prev_leaf_index + 1,
+ fib_index, prefix_len);
+ node->leafvec |= bitmap;
+ }
+
+ /*hole punching*/
+ prev_fib_index = node->leaves[prev_leaf_index];
+ prev_prefix_len = node->prefixes[prev_leaf_index];
+
+ bitmap_hp = bitmap << consecutive_leafs;
+ if (!(node->leafvec & bitmap_hp)) {
+ index_hp = hweight64(node->leafvec &
+ (bitmap_hp - 1)) - 1;
+ if (node->prefixes[index_hp] <= prefix_len) {
+ if (prev_leaf_index < 0)
+ goto error;
+ insert_leaf(node, index_hp + 1,
+ prev_fib_index, prev_prefix_len);
+ node->leafvec |= bitmap_hp;
+ }
+ }
+
+ for (i = 2; i < consecutive_leafs; i++) {
+ bitmap_hp = bitmap << (i - 1);
+ if (node->leafvec & bitmap_hp) {
+ index_hp = hweight64(node->leafvec &
+ (bitmap_hp - 1)) - 1;
+ insert_leaf(node, index_hp + 1,
+ fib_index, prefix_len);
+ node->leafvec |= bitmap_hp;
+ }
+ }
+ }
+
+ if (consecutive_leafs > 1)
+ node->vector |= ((1ULL << consecutive_leafs) - 1) << index;
+ else
+ node->vector |= bitmap;
+
+ goto finish;
+
+error:
+ pr_err("Something is very wrong !!!!");
+finish:
+ spin_unlock(&pt->lock);
+ return 0;
+}
+
+int poptrie_delete(struct poptrie *pt, u32 key,
+ u8 prefix_len)
+{
+ int offset, i;
+ u32 index;
+ u8 consecutive_leafs;
+ u64 bitmap;
+ int arr_size;
+ unsigned long chield_index;
+ unsigned long leaf_index;
+ struct poptrie_node *node;
+ bool update_vector = true;
+
+ spin_lock(&pt->lock);
+
+ node = rcu_dereference(pt->root);
+
+ if (!node || prefix_len == 0)
+ goto finish;
+
+ /*Iterate through the nodes*/
+ offset = 0;
+ while (prefix_len > (offset + 6)) {
+ index = extract(key, offset);
+ bitmap = 1ULL << index;
+ chield_index = hweight64(node->nodevec & (bitmap - 1));
+ /*No node for this index*/
+ if (!(node->nodevec & bitmap))
+ goto finish;
+ node = &node->child_nodes[chield_index];
+ offset += 6;
+ }
+
+ /*Now need to delete the leaf*/
+
+ index = extract(key, offset);
+ bitmap = 1ULL << index;
+ consecutive_leafs = 1 << (offset + 6 - prefix_len);
+
+ /*The prefix does not exist*/
+ if (!(node->vector & bitmap) || !(node->leafvec & bitmap))
+ goto finish;
+
+ leaf_index = hweight64(node->leafvec & (bitmap - 1));
+ arr_size = (int)hweight64(node->leafvec);
+ if (leaf_index >= arr_size)
+ goto error;
+
+ /*The prefix-length does not match*/
+ if (node->prefixes[leaf_index] != prefix_len)
+ goto finish;
+
+ /*Check if this prefix will replaced
+ * by another prefix with smaller length
+ */
+ for (i = leaf_index - 1; i >= 0; i--) {
+ if (node->prefixes[leaf_index] < prefix_len) {
+ update_vector = false;
+ break;
+ }
+ }
+
+ if (update_vector) {
+ if (consecutive_leafs > 1)
+ node->vector &=
+ ~(((1ULL << consecutive_leafs) - 1) << index);
+ else
+ node->vector &= ~bitmap;
+ }
+
+ if (consecutive_leafs > 1) {
+ for (i = 0; i < consecutive_leafs; i++) {
+ if ((node->leafvec & bitmap) &&
+ node->prefixes[leaf_index] == prefix_len) {
+ delete_leaf(node, leaf_index);
+ node->leafvec &= ~bitmap;
+ }
+ bitmap <<= 1;
+ leaf_index = hweight64(node->leafvec & (bitmap - 1));
+ }
+ } else {
+ delete_leaf(node, leaf_index);
+ node->leafvec &= ~bitmap;
+ }
+
+ goto finish;
+error:
+ pr_err("Something is very wrong !!!!");
+finish:
+ spin_unlock(&pt->lock);
+ return 0;
+}
+
+/*This recursive function frees all
+ * the nodes in depth-first-search fashion
+ */
+static int poptrie_node_free(struct poptrie_node *node)
+{
+ int i;
+ int child_count;
+
+ if (!node)
+ return 0;
+ child_count = hweight64(node->nodevec);
+ if (node->child_nodes) {
+ for (i = 0; i < child_count; i++)
+ poptrie_node_free(&node->child_nodes[i]);
+ }
+
+ kfree(node->leaves);
+ kfree(node->prefixes);
+ kfree(node->child_nodes);
+
+ node->leaves = NULL;
+ node->prefixes = NULL;
+ node->child_nodes = NULL;
+
+ node->vector = 0;
+ node->leafvec = 0;
+ node->nodevec = 0;
+
+ return 0;
+}
+
+static void poptrie_rcu_free(struct rcu_head *rcu)
+{
+ poptrie_node_free(container_of(rcu, struct poptrie_node, rcu));
+}
+
+int poptrie_flush(struct poptrie *pt)
+{
+ struct poptrie_node *rt = rcu_dereference(pt->root);
+
+ if (!rt)
+ return 0;
+
+ RCU_INIT_POINTER(pt->root, NULL);
+ /* Wait for all references to be released */
+ call_rcu(&rt->rcu, poptrie_rcu_free);
+ return 0;
+}
+
+int poptrie_lookup(struct poptrie *pt, __be32 dest, struct net_device **dev)
+{
+ register u32 index;
+ register u64 bitmap, bitmask;
+ register unsigned long leaf_index;
+ register unsigned long node_index;
+ register struct poptrie_node *node;
+ register u8 fib_index = pt->def_nh;
+ register u8 carry = 0;
+ register u8 carry_bit = 2;
+
+ rcu_read_lock();
+
+ node = rcu_dereference(pt->root);
+
+ if (!node)
+ goto finish;
+
+ while (1) {
+ /*Extract 6 bytes from dest */
+ if (likely(carry_bit != 8)) {
+ index = ((dest & 252) >> carry_bit) | carry;
+ carry = (dest & ((1 << carry_bit) - 1))
+ << (6 - carry_bit);
+ carry_bit = carry_bit + 2;
+ dest = dest >> 8;
+ } else {
+ index = carry;
+ carry = 0;
+ carry_bit = 2;
+ }
+
+ /*Create a bitmap based on the the extracted value*/
+ bitmap = 1ULL << index;
+ bitmask = bitmap - 1;
+
+ /*Find corresponding leaf*/
+ if (likely(node->vector & bitmap)) {
+ leaf_index = hweight64(node->leafvec & bitmask);
+ if (!(node->leafvec & bitmap))
+ leaf_index--;
+ fib_index = node->leaves[leaf_index];
+ }
+
+ /*Find corresponding node*/
+ if (likely(node->nodevec & bitmap)) {
+ node_index = hweight64(node->nodevec & bitmask);
+ node = &node->child_nodes[node_index];
+ continue;
+ }
+finish:
+ *dev = pt->nhs.netdev_arr[fib_index];
+ rcu_read_unlock();
+ return 0;
+ }
+}
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index 3dcffd3..a34998c 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -1280,6 +1280,10 @@ int fib_table_insert(struct net *net, struct
fib_table *tb,
if (err)
goto out_fib_notif;
+#if IS_ENABLED(CONFIG_FIB_POPTRIE)
+ poptrie_insert(&tb->pt, key, plen, fi->fib_dev);
+#endif
+
if (!plen)
tb->tb_num_default++;
@@ -1564,6 +1568,10 @@ int fib_table_delete(struct net *net, struct
fib_table *tb,
pr_debug("Deleting %08x/%d tos=%d t=%p\n", key, plen, tos, t);
+#if IS_ENABLED(CONFIG_FIB_POPTRIE)
+ poptrie_delete(&tb->pt, key, plen);
+#endif
+
fa_to_delete = NULL;
hlist_for_each_entry_from(fa, fa_list) {
struct fib_info *fi = fa->fa_info;
@@ -1925,6 +1933,10 @@ int fib_table_flush(struct net *net, struct
fib_table *tb)
}
}
+#if IS_ENABLED(CONFIG_FIB_POPTRIE)
+ poptrie_flush(&tb->pt);
+#endif
+
pr_debug("trie_flush found=%d\n", found);
return found;
}
--
2.7.4
[-- Attachment #2: poptrie.pdf --]
[-- Type: application/pdf, Size: 208517 bytes --]
^ permalink raw reply related
* Re: [PATCH net 0/3] bnxt_en: Bug fixes.
From: David Miller @ 2018-09-04 5:01 UTC (permalink / raw)
To: michael.chan; +Cc: netdev
In-Reply-To: <1535962999-10013-1-git-send-email-michael.chan@broadcom.com>
From: Michael Chan <michael.chan@broadcom.com>
Date: Mon, 3 Sep 2018 04:23:16 -0400
> This short series fixes resource related logic in the driver, mostly
> affecting the RDMA driver under corner cases.
Series applied, thanks Michael.
Do you want patch #3 queued up for -stable?
^ permalink raw reply
* Re: [PATCH net-next v2 4/7] net: phy: mscc: read 'vsc8531,edge-slowdown' as an u32 [UNSCANNED]
From: Richard Fitzgerald @ 2018-09-04 9:21 UTC (permalink / raw)
To: Quentin Schulz, Andrew Lunn
Cc: davem, robh+dt, mark.rutland, f.fainelli, allan.nielsen, netdev,
devicetree, linux-kernel, thomas.petazzoni, rf
In-Reply-To: <20180904072630.zc6sdz2xdti5nku4@qschulz>
On 04/09/18 08:26, Quentin Schulz wrote:
> Hi Andrew,
>
> On Mon, Sep 03, 2018 at 10:05:54PM +0200, Andrew Lunn wrote:
>>> Just to be sure, we're talking here about making sure the value stored
>>> in the DT is not bigger than the specified value (here an u8)? If so,
>>> that isn't the reason why I'm suggesting those two patches.
>>>
>>> Without /bits 8/ in the DT property, whatever were the values I put in
>>> the property, I'd always get a 0. So I need to fix it either in the DT
>>> (but Rob does not really like it) or in the driver.
>>
>> Hi Quentin
>>
>> Ah, you are fixing endian issues. That was not clear to me from the
>> commit message.
>>
>> I don't know enough about how DT stores values in the blob. Is there
>> type info? Can the DT core tell if a value in the blob is a u8 or a
>> u32? It would be nice if it warned about reading a u8 from a u32
>> blob.
>>
>
> From my quick research, the lower bound checking is performed by
> of_property_read_u* functions but not the higher bound checking (the
> internal function of_find_property_value_of_size allows higher bound
> checking but it seems it's never used by those functions (see 0 in
> sz_max of of_property_read_variable_u*_array)).
>
> sz_max is used by of_property_read_variable_u*_array to copy at a
> maximum of sz_max values in the output buffer. If sz_max is 0, it takes
> sz_min so it's an array of definite size.
> So since sz_max is 0 for all calls to of_property_read_variable_u*_array
> by of_property_read_u*_array, we basically know we'll get a buffer of
> sz_min values but we don't actually make use of the higher bound
> checking of of_find_property_value_of_size.
>
This was the original behaviour of the of_property_read_u*_array functions.
If you look back at the of_property_read_u*_array implementations
before my patch they passed max=0 to of_find_property_value_of_size.
To avoid duplicating code I reimplemented the of_property_read_u*_array
to use the new of_property_read_variable_u*_array hence they pass
sz_max=0 to preserve the original behaviour that max=0 to
of_find_property_value_of_size, so that I didn't break any code that might
depend on that.
> We could enforce this higher bound check by, instead of setting sz_max
> to 0, setting sz_max to sz_min in calls to of_property_read_u*_array.
>
> But I guess there is a reason for sz_max being 0. Rob, Richard (commit
> signer of this code) do you know why? Could you explain?
>
>> Anyway, this change still removes some bounds checking. Are they
>> important? Do they need to be added back?
>>
>
> The edge-slowdown and the vddmac values are compared against a const
> array so we´re fine with those ones.
>
> For the led-X-mode, I added a constant for supported modes that gets
> checked when retrieving the DT property. So we´re fine here too.
>
> Quentin
>
^ permalink raw reply
* Re: [PATCH net 0/2] sctp: two fixes for spp_ipv6_flowlabel and spp_dscp sockopts
From: David Miller @ 2018-09-04 4:58 UTC (permalink / raw)
To: marcelo.leitner; +Cc: lucien.xin, netdev, linux-sctp, nhorman
In-Reply-To: <20180903220606.GA19741@localhost.localdomain>
From: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Date: Mon, 3 Sep 2018 19:06:06 -0300
> On Mon, Sep 03, 2018 at 03:47:09PM +0800, Xin Long wrote:
>> This patchset fixes two problems in sctp_apply_peer_addr_params()
>> when setting spp_ipv6_flowlabel or spp_dscp.
>>
>> Xin Long (2):
>> sctp: fix invalid reference to the index variable of the iterator
>> sctp: not traverse asoc trans list if non-ipv6 trans exists for
>> ipv6_flowlabel
>>
>> net/sctp/socket.c | 34 +++++++++++++++++++---------------
>> 1 file changed, 19 insertions(+), 15 deletions(-)
>
> Series
> Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Series applied.
^ permalink raw reply
* Re: [PATCH net-next] net: sched: null actions array pointer before releasing action
From: David Miller @ 2018-09-04 4:47 UTC (permalink / raw)
To: xiyou.wangcong; +Cc: vladbu, netdev, jhs, jiri
In-Reply-To: <CAM_iQpU+3O1oxTPg2D6_O-FxuEMjWYZjaHrBEzg5Jy5=3=Nq6A@mail.gmail.com>
From: Cong Wang <xiyou.wangcong@gmail.com>
Date: Mon, 3 Sep 2018 11:18:43 -0700
> On Mon, Sep 3, 2018 at 12:05 AM Vlad Buslov <vladbu@mellanox.com> wrote:
>>
>> Currently, tcf_action_delete() nulls actions array pointer after putting
>> and deleting it. However, if tcf_idr_delete_index() returns an error,
>> pointer to action is not set to null. That results it being released second
>> time in error handling code of tca_action_gd().
>
> Oops, good catch.
>
> Acked-by: Cong Wang <xiyou.wangcong@gmail.com>
>
> David, this one should also go to -net rather than -net-next.
Applied to 'net', thanks.
^ permalink raw reply
* Re: [PATCH net-next] tipc: correct structure parameter comments for topsrv
From: David Miller @ 2018-09-04 4:44 UTC (permalink / raw)
To: zhenbo.gao; +Cc: jon.maloy, tipc-discussion, netdev, ying.xue, yue.tao
In-Reply-To: <1535954920-2722-1-git-send-email-zhenbo.gao@windriver.com>
From: Zhenbo Gao <zhenbo.gao@windriver.com>
Date: Mon, 3 Sep 2018 14:08:40 +0800
> Remove the following obsolete parameter comments of tipc_topsrv struct:
> @rcvbuf_cache
> @tipc_conn_new
> @tipc_conn_release
> @tipc_conn_recvmsg
> @imp
> @type
>
> Add the comments for the missing parameters below of tipc_topsrv struct:
> @awork
> @listener
>
> Remove the unused or duplicated parameter comments of tipc_conn struct:
> @outqueue_lock
> @rx_action
>
> Signed-off-by: Zhenbo Gao <zhenbo.gao@windriver.com>
> Reviewed-by: Ying Xue <ying.xue@windriver.com>
Applied, thank you.
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox