* [PATCH v2 1/7] sh_eth: rename sh_eth_cpu_data::hw_checksum
From: Sergei Shtylyov @ 2019-02-04 18:05 UTC (permalink / raw)
To: netdev, David S. Miller; +Cc: linux-renesas-soc, linux-sh
In-Reply-To: <a21deed1-35dc-f1be-6c7e-7061ebe4b56c@cogentembedded.com>
Commit 62e04b7e0e3c ("sh_eth: rename 'sh_eth_cpu_data::hw_crc'") renamed
the field to 'hw_checksum' for the Ether DMAC "intelligent checksum",
however some Ether MACs implement a simpler checksumming scheme, so that
name now seems misleading. Rename that field to 'csmr' as the "intelligent
checksum" is always controlled by the CSMR register.
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
Changes in version 2:
- fixed typos in the patch description;
- added Geert's tag.
drivers/net/ethernet/renesas/sh_eth.c | 14 +++++++-------
drivers/net/ethernet/renesas/sh_eth.h | 2 +-
2 files changed, 8 insertions(+), 8 deletions(-)
Index: renesas/drivers/net/ethernet/renesas/sh_eth.c
===================================================================
--- renesas.orig/drivers/net/ethernet/renesas/sh_eth.c
+++ renesas/drivers/net/ethernet/renesas/sh_eth.c
@@ -555,7 +555,7 @@ static int sh_eth_soft_reset_gether(stru
sh_eth_write(ndev, 0, RDFFR);
/* Reset HW CRC register */
- if (mdp->cd->hw_checksum)
+ if (mdp->cd->csmr)
sh_eth_write(ndev, 0, CSMR);
/* Select MII mode */
@@ -619,7 +619,7 @@ static struct sh_eth_cpu_data r7s72100_d
.no_trimd = 1,
.no_ade = 1,
.xdfar_rw = 1,
- .hw_checksum = 1,
+ .csmr = 1,
.tsu = 1,
.no_tx_cntrs = 1,
};
@@ -668,7 +668,7 @@ static struct sh_eth_cpu_data r8a7740_da
.no_trimd = 1,
.no_ade = 1,
.xdfar_rw = 1,
- .hw_checksum = 1,
+ .csmr = 1,
.tsu = 1,
.select_mii = 1,
.magic = 1,
@@ -793,7 +793,7 @@ static struct sh_eth_cpu_data r8a77980_d
.no_trimd = 1,
.no_ade = 1,
.xdfar_rw = 1,
- .hw_checksum = 1,
+ .csmr = 1,
.select_mii = 1,
.magic = 1,
.cexcr = 1,
@@ -1045,7 +1045,7 @@ static struct sh_eth_cpu_data sh7734_dat
.no_ade = 1,
.xdfar_rw = 1,
.tsu = 1,
- .hw_checksum = 1,
+ .csmr = 1,
.select_mii = 1,
.magic = 1,
.cexcr = 1,
@@ -1633,7 +1633,7 @@ static int sh_eth_rx(struct net_device *
* the RFS bits are from bit 25 to bit 16. So, the
* driver needs right shifting by 16.
*/
- if (mdp->cd->hw_checksum)
+ if (mdp->cd->csmr)
desc_status >>= 16;
skb = mdp->rx_skbuff[entry];
@@ -2173,7 +2173,7 @@ static size_t __sh_eth_get_regs(struct n
add_reg(MAFCR);
if (cd->rtrate)
add_reg(RTRATE);
- if (cd->hw_checksum)
+ if (cd->csmr)
add_reg(CSMR);
if (cd->select_mii)
add_reg(RMII_MII);
Index: renesas/drivers/net/ethernet/renesas/sh_eth.h
===================================================================
--- renesas.orig/drivers/net/ethernet/renesas/sh_eth.h
+++ renesas/drivers/net/ethernet/renesas/sh_eth.h
@@ -499,7 +499,7 @@ struct sh_eth_cpu_data {
unsigned no_ade:1; /* E-DMAC DOES NOT have ADE bit in EESR */
unsigned no_xdfar:1; /* E-DMAC DOES NOT have RDFAR/TDFAR */
unsigned xdfar_rw:1; /* E-DMAC has writeable RDFAR/TDFAR */
- unsigned hw_checksum:1; /* E-DMAC has CSMR */
+ unsigned csmr:1; /* E-DMAC has CSMR */
unsigned select_mii:1; /* EtherC has RMII_MII (MII select register) */
unsigned rmiimode:1; /* EtherC has RMIIMODE register */
unsigned rtrate:1; /* EtherC has RTRATE register */
^ permalink raw reply
* [PATCH v2 0/7] sh_eth: implement simple RX checksum offload
From: Sergei Shtylyov @ 2019-02-04 18:01 UTC (permalink / raw)
To: netdev, David S. Miller; +Cc: linux-renesas-soc, linux-sh
Hello!
Here's a set of 7 patches against DaveM's 'net-next.git' repo. I'm implemeting
the simple RX checksum offload (like was done for the 'ravb' driver by Simon
Horman); it has been only tested on the R8A7740 and R8A77980 SoCs, the other
SoCs should just work (according to their manuals)...
[1/7] sh_eth: rename sh_eth_cpu_data::hw_checksum
[2/7] sh_eth: RX checksum offload support
[3/7] sh_eth: offload RX checksum on R7S72100
[4/7] sh_eth: offload RX checksum on R8A7740
[5/7] sh_eth: offload RX checksum on R8A77980
[6/7] sh_eth: offload RX checksum on SH7734
[7/7] sh_eth: offload RX checksum on SH7763
MBR, Sergei
^ permalink raw reply
* Re: bpf: BPF_PROG_TEST_RUN leads to unkillable process
From: Stanislav Fomichev @ 2019-02-04 17:48 UTC (permalink / raw)
To: Dmitry Vyukov
Cc: Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau,
songliubraving, yhs, netdev, LKML, syzkaller
In-Reply-To: <CACT4Y+aUy-3F43ECZACEps4c3GcbqCne9XFV8q7G8Dm8afn6kA@mail.gmail.com>
On 02/01, Dmitry Vyukov wrote:
> Hello,
>
> The following program leads to an unkillable process that eats CPU in
> an infinite loop in BPF_PROG_TEST_RUN syscall. But kernel does not
> self-detect cpu/rcu/task stalls either. The program contains max
> number of repetitions, but as far as I see the intention is that it
> should be killable. I see that bpf_test_run() checks for
> signal_pending(current), but it does so only if need_resched() is also
> set. Can need_resched() be not set for prolonged periods of time?
> /proc/pid/stack is empty, not sure what other info I can provide.
There is a bunch of places in the kernel where we do the same nested check:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/net/ethernet/broadcom/tg3.c#n12059
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/char/hw_random/s390-trng.c#n80
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/char/random.c#n1049
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/s390/crypto/prng.c#n470
So it's not something unusual we do. OTOH, in the kernel/bpf/verifier.c
do_check() we do signal_pending() and need_resched() sequentially. In
theory, it should not hurt to do them in sequence. Any thoughts about
the patch below? I think we also need to properly return -ERESTARTSYS
when returning from signal_pending().
--
From ce360c909ce4f3caf8eb69f2ad5ce0d3eee1515d Mon Sep 17 00:00:00 2001
Message-Id: <ce360c909ce4f3caf8eb69f2ad5ce0d3eee1515d.1549302207.git.sdf@google.com>
From: Stanislav Fomichev <sdf@google.com>
Date: Mon, 4 Feb 2019 09:17:37 -0800
Subject: [PATCH bpf] bpf/test_run: properly handle signal_pending
Syzbot found out that running BPF_PROG_TEST_RUN with repeat=0xffffffff
makes process unkillable. Let's move signal_pending out of need_resched
and properly return -ERESTARTSYS to the userspace.
In the kernel/bpf/verifier.c do_check() we do:
if (signal_pending())
...
if (need_resched())
...
Reported-by: syzbot <syzkaller@googlegroups.com>
Signed-off-by: Stanislav Fomichev <sdf@google.com>
---
net/bpf/test_run.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/net/bpf/test_run.c b/net/bpf/test_run.c
index fa2644d276ef..a891c60cf248 100644
--- a/net/bpf/test_run.c
+++ b/net/bpf/test_run.c
@@ -28,12 +28,13 @@ static __always_inline u32 bpf_test_run_one(struct bpf_prog *prog, void *ctx,
return ret;
}
-static int bpf_test_run(struct bpf_prog *prog, void *ctx, u32 repeat, u32 *ret,
- u32 *time)
+static int bpf_test_run(struct bpf_prog *prog, void *ctx, u32 repeat,
+ u32 *retval, u32 *time)
{
struct bpf_cgroup_storage *storage[MAX_BPF_CGROUP_STORAGE_TYPE] = { 0 };
enum bpf_cgroup_storage_type stype;
u64 time_start, time_spent = 0;
+ int ret = 0;
u32 i;
for_each_cgroup_storage_type(stype) {
@@ -50,10 +51,12 @@ static int bpf_test_run(struct bpf_prog *prog, void *ctx, u32 repeat, u32 *ret,
repeat = 1;
time_start = ktime_get_ns();
for (i = 0; i < repeat; i++) {
- *ret = bpf_test_run_one(prog, ctx, storage);
+ *retval = bpf_test_run_one(prog, ctx, storage);
+ if (signal_pending(current)) {
+ ret = -ERESTARTSYS;
+ break;
+ }
if (need_resched()) {
- if (signal_pending(current))
- break;
time_spent += ktime_get_ns() - time_start;
cond_resched();
time_start = ktime_get_ns();
@@ -66,7 +69,7 @@ static int bpf_test_run(struct bpf_prog *prog, void *ctx, u32 repeat, u32 *ret,
for_each_cgroup_storage_type(stype)
bpf_cgroup_storage_free(storage[stype]);
- return 0;
+ return ret;
}
static int bpf_test_finish(const union bpf_attr *kattr,
>
> Tested is on upstream commit 4aa9fc2a435abe95a1e8d7f8c7b3d6356514b37a.
> Config is attached.
>
> FTR, generated from the following syzkaller program:
>
> r1 = bpf$PROG_LOAD(0x5, &(0x7f0000000080)={0x3, 0x3,
> &(0x7f0000001fd8)=@framed={{0xffffff85, 0x0, 0x0, 0x0, 0x13, 0x5}},
> &(0x7f0000000000)='\x00', 0x5, 0x487, &(0x7f000000cf3d)=""/195}, 0x48)
> bpf$BPF_PROG_TEST_RUN(0xa, &(0x7f0000000200)={r1, 0x0, 0xe, 0x0,
> &(0x7f0000000100)="8557147d6187677523fea28c88a8", 0x0,
> 0xfffffffffffffffe}, 0x28)
>
>
> // autogenerated by syzkaller (https://github.com/google/syzkaller)
> #define _GNU_SOURCE
> #include <endian.h>
> #include <stdint.h>
> #include <stdio.h>
> #include <stdlib.h>
> #include <string.h>
> #include <sys/syscall.h>
> #include <sys/types.h>
> #include <unistd.h>
>
> int main(void)
> {
> syscall(__NR_mmap, 0x20000000, 0x1000000, 3, 0x32, -1, 0);
> long res = 0;
> *(uint32_t*)0x20000080 = 3;
> *(uint32_t*)0x20000084 = 3;
> *(uint64_t*)0x20000088 = 0x20001fd8;
> *(uint8_t*)0x20001fd8 = 0x85;
> *(uint8_t*)0x20001fd9 = 0x44;
> *(uint16_t*)0x20001fda = 0;
> *(uint32_t*)0x20001fdc = 0x13;
> *(uint8_t*)0x20001fe0 = 5;
> *(uint8_t*)0x20001fe1 = 0;
> *(uint16_t*)0x20001fe2 = 0;
> *(uint32_t*)0x20001fe4 = 0;
> *(uint8_t*)0x20001fe8 = 0x95;
> *(uint8_t*)0x20001fe9 = 0;
> *(uint16_t*)0x20001fea = 0;
> *(uint32_t*)0x20001fec = 0;
> *(uint64_t*)0x20000090 = 0x20000000;
> memcpy((void*)0x20000000, "\000", 1);
> *(uint32_t*)0x20000098 = 5;
> *(uint32_t*)0x2000009c = 0x487;
> *(uint64_t*)0x200000a0 = 0x2000cf3d;
> *(uint32_t*)0x200000a8 = 0;
> *(uint32_t*)0x200000ac = 0;
> *(uint8_t*)0x200000b0 = 0;
> *(uint8_t*)0x200000b1 = 0;
> *(uint8_t*)0x200000b2 = 0;
> *(uint8_t*)0x200000b3 = 0;
> *(uint8_t*)0x200000b4 = 0;
> *(uint8_t*)0x200000b5 = 0;
> *(uint8_t*)0x200000b6 = 0;
> *(uint8_t*)0x200000b7 = 0;
> *(uint8_t*)0x200000b8 = 0;
> *(uint8_t*)0x200000b9 = 0;
> *(uint8_t*)0x200000ba = 0;
> *(uint8_t*)0x200000bb = 0;
> *(uint8_t*)0x200000bc = 0;
> *(uint8_t*)0x200000bd = 0;
> *(uint8_t*)0x200000be = 0;
> *(uint8_t*)0x200000bf = 0;
> *(uint32_t*)0x200000c0 = 0;
> *(uint32_t*)0x200000c4 = 0;
> int fd = syscall(__NR_bpf, 5, 0x20000080, 0x48);
> *(uint32_t*)0x20000200 = fd;
> *(uint32_t*)0x20000204 = 0;
> *(uint32_t*)0x20000208 = 0xe;
> *(uint32_t*)0x2000020c = 0;
> *(uint64_t*)0x20000210 = 0x20000100;
> memcpy((void*)0x20000100,
> "\x85\x57\x14\x7d\x61\x87\x67\x75\x23\xfe\xa2\x8c\x88\xa8", 14);
> *(uint64_t*)0x20000218 = 0;
> *(uint32_t*)0x20000220 = 0xfffffffe;
> *(uint32_t*)0x20000224 = 0;
> syscall(__NR_bpf, 0xa, 0x20000200, 0x28);
> return 0;
> }
^ permalink raw reply related
* Re: [PATCH] s390: bpf: fix JMP32 code-gen
From: Alexei Starovoitov @ 2019-02-04 17:46 UTC (permalink / raw)
To: Heiko Carstens
Cc: Alexei Starovoitov, Martin Schwidefsky, Jiong Wang, linux-s390,
netdev
In-Reply-To: <20190204154455.88687-1-heiko.carstens@de.ibm.com>
On Mon, Feb 04, 2019 at 04:44:55PM +0100, Heiko Carstens wrote:
> Commit 626a5f66da0d19 ("s390: bpf: implement jitting of JMP32") added
> JMP32 code-gen support for s390. However it triggers the warning below
> due to some unusual gotos in the original s390 bpf jit code.
>
> Add a couple of additional "is_jmp32" initializations to fix this.
> Also fix the wrong opcode for the "llilf" instruction that was
> introduced with the same commit.
>
> arch/s390/net/bpf_jit_comp.c: In function 'bpf_jit_insn':
> arch/s390/net/bpf_jit_comp.c:248:55: warning: 'is_jmp32' may be used uninitialized in this function [-Wmaybe-uninitialized]
> _EMIT6(op1 | reg(b1, b2) << 16 | (rel & 0xffff), op2 | mask); \
> ^
> arch/s390/net/bpf_jit_comp.c:1211:8: note: 'is_jmp32' was declared here
> bool is_jmp32 = BPF_CLASS(insn->code) == BPF_JMP32;
>
> Fixes: 626a5f66da0d19 ("s390: bpf: implement jitting of JMP32")
> Cc: Jiong Wang <jiong.wang@netronome.com>
> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Applied to bpf-next. Thanks!
^ permalink raw reply
* Re: [PATCH bpf-next v4 0/3] tools/bpf: changes of libbpf debug interfaces
From: Alexei Starovoitov @ 2019-02-04 17:44 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Yonghong Song, Magnus Karlsson, netdev, Alexei Starovoitov,
Daniel Borkmann, kernel-team, Arnaldo Carvalho de Melo
In-Reply-To: <20190204145134.GA4290@redhat.com>
On Mon, Feb 04, 2019 at 12:51:34PM -0200, Arnaldo Carvalho de Melo wrote:
> Em Sat, Feb 02, 2019 at 08:52:30AM -0800, Alexei Starovoitov escreveu:
> > On Fri, Feb 01, 2019 at 04:14:13PM -0800, Yonghong Song wrote:
> > > These are patches responding to my comments for
> > > Magnus's patch (https://patchwork.ozlabs.org/patch/1032848/).
> > > The goal is to make pr_* macros available to other C files
> > > than libbpf.c, and to simplify API function libbpf_set_print().
> > >
> > > Specifically, Patch #1 used global functions
> > > to facilitate pr_* macros in the header files so they
> > > are available in different C files.
> > > Patch #2 removes the global function libbpf_print_level_available()
> > > which is added in Patch 1.
> > > Patch #3 simplified libbpf_set_print() which takes only one print
> > > function with a debug level argument among others.
> > >
> > > Changelogs:
> > > v3 -> v4:
> > > . rename libbpf internal header util.h to libbpf_util.h
> > > . rename libbpf internal function libbpf_debug_print() to libbpf_print()
> > > v2 -> v3:
> > > . bailed out earlier in libbpf_debug_print() if __libbpf_pr is NULL
> > > . added missing LIBBPF_DEBUG level check in libbpf.c __base_pr().
> > > v1 -> v2:
> > > . Renamed global function libbpf_dprint() to libbpf_debug_print()
> > > to be more expressive.
> > > . Removed libbpf_dprint_level_available() as it is used only
> > > once in btf.c and we can remove it by optimizing for common cases.
> > >
> > > Yonghong Song (3):
> > > tools/bpf: move libbpf pr_* debug print functions to headers
> > > tools/bpf: print out btf log at LIBBPF_WARN level
> > > tools/bpf: simplify libbpf API function libbpf_set_print()
> > >
> > > tools/lib/bpf/btf.c | 110 +++++++++---------
> > > tools/lib/bpf/btf.h | 7 +-
> > > tools/lib/bpf/libbpf.c | 47 ++++----
> > > tools/lib/bpf/libbpf.h | 20 ++--
> > > tools/lib/bpf/libbpf_util.h | 30 +++++
> > > tools/lib/bpf/test_libbpf.cpp | 4 +-
> > > tools/perf/util/bpf-loader.c | 32 ++---
> >
> > Overall looks good to me.
> > Arnaldo, could you ack the set, so we can take it into bpf-next?
>
> LGTM
>
> Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Applied to bpf-next. Thanks!
^ permalink raw reply
* Re: [PATCH net 0/4] s390/qeth: fixes 2019-02-04
From: David Miller @ 2019-02-04 17:44 UTC (permalink / raw)
To: jwi; +Cc: netdev, linux-s390, schwidefsky, heiko.carstens, raspl, ubraun
In-Reply-To: <20190204164009.7245-1-jwi@linux.ibm.com>
From: Julian Wiedmann <jwi@linux.ibm.com>
Date: Mon, 4 Feb 2019 17:40:05 +0100
> please apply the following four fixes to -net.
>
> Patch 1 takes care of a common resource leak in various error paths, while the
> second patch fixes a misordered kfree when cleaning up after an error.
> The other two patches ensure that there's no stale work dangling on workqueues
> when the qeth device has already been offlined and/or removed.
Series applied, thanks.
^ permalink raw reply
* Re: [PATCH bpf-next] bpf: support SO_DEBUG in bpf_setsockopt()
From: Alexei Starovoitov @ 2019-02-04 17:35 UTC (permalink / raw)
To: Yafang Shao; +Cc: kafai, brakmo, ast, daniel, netdev, shaoyafang
In-Reply-To: <1549181707-16864-1-git-send-email-laoar.shao@gmail.com>
On Sun, Feb 03, 2019 at 04:15:07PM +0800, Yafang Shao wrote:
> Then we can enable/disable socket debugging without modifying user code.
> That is more convenient for debugging.
>
> Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
> ---
> include/net/sock.h | 8 ++++++++
> net/core/filter.c | 3 +++
> net/core/sock.c | 8 --------
> 3 files changed, 11 insertions(+), 8 deletions(-)
>
> diff --git a/include/net/sock.h b/include/net/sock.h
> index 2b229f7..8decee9 100644
> --- a/include/net/sock.h
> +++ b/include/net/sock.h
> @@ -1935,6 +1935,14 @@ static inline void sock_confirm_neigh(struct sk_buff *skb, struct neighbour *n)
> }
> }
>
> +static inline void sock_valbool_flag(struct sock *sk, int bit, int valbool)
> +{
> + if (valbool)
> + sock_set_flag(sk, bit);
> + else
> + sock_reset_flag(sk, bit);
> +}
> +
> bool sk_mc_loop(struct sock *sk);
>
> static inline bool sk_can_gso(const struct sock *sk)
> diff --git a/net/core/filter.c b/net/core/filter.c
> index 3a49f68..ce5da57 100644
> --- a/net/core/filter.c
> +++ b/net/core/filter.c
> @@ -4111,6 +4111,9 @@ static unsigned long bpf_xdp_copy(void *dst_buff, const void *src_buff,
>
> /* Only some socketops are supported */
> switch (optname) {
> + case SO_DEBUG:
> + sock_valbool_flag(sk, SOCK_DBG, val);
> + break;
I'm missing the point here.
This flag has any effect only when SOCK_DEBUGGING is set.
But it is off in distros.
Since it's for custom debug kernel only why bother with
setting the flag via bpf prog?
^ permalink raw reply
* [PATCH net-next 1/3] net: nixge: Make mdio child node optional
From: Moritz Fischer @ 2019-02-04 17:30 UTC (permalink / raw)
To: netdev
Cc: devicetree, linux-kernel, alex.williams, andrew, robh+dt, davem,
moritz.fischer, Moritz Fischer
In-Reply-To: <20190204173040.5538-1-moritz.fischer@ettus.com>
From: Moritz Fischer <mdf@kernel.org>
Make MDIO child optional and only instantiate the
MDIO bus if the child is actually present.
There are currently no (in-tree) users of this
binding; all (out-of-tree) users use overlays that
get shipped together with the FPGA images that contain
the IP.
This will significantly increase maintainabilty
of future revisions of this IP.
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Moritz Fischer <mdf@kernel.org>
---
Changes from RFC:
- Add Andrew's Reviewed-by tag
- Rebased on top of net-next
---
.../devicetree/bindings/net/nixge.txt | 27 ++++++++++++++++---
drivers/net/ethernet/ni/nixge.c | 19 ++++++++-----
2 files changed, 37 insertions(+), 9 deletions(-)
diff --git a/Documentation/devicetree/bindings/net/nixge.txt b/Documentation/devicetree/bindings/net/nixge.txt
index 44a7358b4399..bb2929f9c64f 100644
--- a/Documentation/devicetree/bindings/net/nixge.txt
+++ b/Documentation/devicetree/bindings/net/nixge.txt
@@ -16,6 +16,9 @@ Required properties:
- nvmem-cells: Phandle of nvmem cell containing the MAC address
- nvmem-cell-names: Should be "address"
+Optional properties:
+- mdio subnode to indicate presence of MDIO controller
+
Examples (10G generic PHY):
nixge0: ethernet@40000000 {
compatible = "ni,xge-enet-3.00";
@@ -33,8 +36,26 @@ Examples (10G generic PHY):
phy-mode = "xgmii";
phy-handle = <ðernet_phy1>;
- ethernet_phy1: ethernet-phy@4 {
- compatible = "ethernet-phy-ieee802.3-c45";
- reg = <4>;
+ mdio {
+ ethernet_phy1: ethernet-phy@4 {
+ compatible = "ethernet-phy-ieee802.3-c45";
+ reg = <4>;
+ };
};
};
+
+Examples (10G generic PHY, no MDIO):
+ nixge0: ethernet@40000000 {
+ compatible = "ni,xge-enet-2.00";
+ reg = <0x40000000 0x6000>;
+
+ nvmem-cells = <ð1_addr>;
+ nvmem-cell-names = "address";
+
+ interrupts = <0 29 IRQ_TYPE_LEVEL_HIGH>, <0 30 IRQ_TYPE_LEVEL_HIGH>;
+ interrupt-names = "rx", "tx";
+ interrupt-parent = <&intc>;
+
+ phy-mode = "xgmii";
+ phy-handle = <ðernet_phy1>;
+ };
diff --git a/drivers/net/ethernet/ni/nixge.c b/drivers/net/ethernet/ni/nixge.c
index 73a98bd2fcd2..c8dd1e4c759d 100644
--- a/drivers/net/ethernet/ni/nixge.c
+++ b/drivers/net/ethernet/ni/nixge.c
@@ -1284,6 +1284,7 @@ static int nixge_probe(struct platform_device *pdev)
{
struct nixge_priv *priv;
struct net_device *ndev;
+ struct device_node *mn;
const u8 *mac_addr;
int err;
@@ -1335,10 +1336,14 @@ static int nixge_probe(struct platform_device *pdev)
priv->coalesce_count_rx = XAXIDMA_DFT_RX_THRESHOLD;
priv->coalesce_count_tx = XAXIDMA_DFT_TX_THRESHOLD;
- err = nixge_mdio_setup(priv, pdev->dev.of_node);
- if (err) {
- netdev_err(ndev, "error registering mdio bus");
- goto free_netdev;
+ mn = of_get_child_by_name(pdev->dev.of_node, "mdio");
+ if (mn) {
+ err = nixge_mdio_setup(priv, mn);
+ of_node_put(mn);
+ if (err) {
+ netdev_err(ndev, "error registering mdio bus");
+ goto free_netdev;
+ }
}
priv->phy_mode = of_get_phy_mode(pdev->dev.of_node);
@@ -1364,7 +1369,8 @@ static int nixge_probe(struct platform_device *pdev)
return 0;
unregister_mdio:
- mdiobus_unregister(priv->mii_bus);
+ if (priv->mii_bus)
+ mdiobus_unregister(priv->mii_bus);
free_netdev:
free_netdev(ndev);
@@ -1379,7 +1385,8 @@ static int nixge_remove(struct platform_device *pdev)
unregister_netdev(ndev);
- mdiobus_unregister(priv->mii_bus);
+ if (priv->mii_bus)
+ mdiobus_unregister(priv->mii_bus);
free_netdev(ndev);
--
2.20.1
^ permalink raw reply related
* [PATCH net-next 2/3] net: nixge: Add support for fixed-link configurations
From: Moritz Fischer @ 2019-02-04 17:30 UTC (permalink / raw)
To: netdev
Cc: devicetree, linux-kernel, alex.williams, andrew, robh+dt, davem,
moritz.fischer, Moritz Fischer
In-Reply-To: <20190204173040.5538-1-moritz.fischer@ettus.com>
From: Moritz Fischer <mdf@kernel.org>
Add support for fixed-link configurations to nixge driver.
Signed-off-by: Moritz Fischer <mdf@kernel.org>
---
drivers/net/ethernet/ni/nixge.c | 27 ++++++++++++++++++++-------
1 file changed, 20 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/ni/nixge.c b/drivers/net/ethernet/ni/nixge.c
index c8dd1e4c759d..96f7a9818294 100644
--- a/drivers/net/ethernet/ni/nixge.c
+++ b/drivers/net/ethernet/ni/nixge.c
@@ -1282,9 +1282,9 @@ static int nixge_of_get_resources(struct platform_device *pdev)
static int nixge_probe(struct platform_device *pdev)
{
+ struct device_node *mn, *phy_node;
struct nixge_priv *priv;
struct net_device *ndev;
- struct device_node *mn;
const u8 *mac_addr;
int err;
@@ -1353,21 +1353,30 @@ static int nixge_probe(struct platform_device *pdev)
goto unregister_mdio;
}
- priv->phy_node = of_parse_phandle(pdev->dev.of_node, "phy-handle", 0);
- if (!priv->phy_node) {
- netdev_err(ndev, "not find \"phy-handle\" property\n");
- err = -EINVAL;
- goto unregister_mdio;
+ phy_node = of_parse_phandle(pdev->dev.of_node, "phy-handle", 0);
+ if (!phy_node && of_phy_is_fixed_link(pdev->dev.of_node)) {
+ err = of_phy_register_fixed_link(pdev->dev.of_node);
+ if (err < 0) {
+ netdev_err(ndev, "broken fixed-link specification\n");
+ goto unregister_mdio;
+ }
+ phy_node = of_node_get(pdev->dev.of_node);
}
+ priv->phy_node = phy_node;
err = register_netdev(priv->ndev);
if (err) {
netdev_err(ndev, "register_netdev() error (%i)\n", err);
- goto unregister_mdio;
+ goto free_phy;
}
return 0;
+free_phy:
+ if (of_phy_is_fixed_link(pdev->dev.of_node))
+ of_phy_deregister_fixed_link(pdev->dev.of_node);
+ of_node_put(phy_node);
+
unregister_mdio:
if (priv->mii_bus)
mdiobus_unregister(priv->mii_bus);
@@ -1385,6 +1394,10 @@ static int nixge_remove(struct platform_device *pdev)
unregister_netdev(ndev);
+ if (of_phy_is_fixed_link(pdev->dev.of_node))
+ of_phy_deregister_fixed_link(pdev->dev.of_node);
+ of_node_put(priv->phy_node);
+
if (priv->mii_bus)
mdiobus_unregister(priv->mii_bus);
--
2.20.1
^ permalink raw reply related
* [PATCH net-next 3/3] dt-bindings: net: Add fixed-link support
From: Moritz Fischer @ 2019-02-04 17:30 UTC (permalink / raw)
To: netdev
Cc: devicetree, linux-kernel, alex.williams, andrew, robh+dt, davem,
moritz.fischer, Moritz Fischer
In-Reply-To: <20190204173040.5538-1-moritz.fischer@ettus.com>
From: Moritz Fischer <mdf@kernel.org>
Update device-tree binding with fixed-link support.
With fixed-link support the formerly required property 'phy-handle'
is now optional if 'fixed-link' child is present.
Signed-off-by: Moritz Fischer <mdf@kernel.org>
---
.../devicetree/bindings/net/nixge.txt | 33 ++++++++++++++++++-
1 file changed, 32 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/net/nixge.txt b/Documentation/devicetree/bindings/net/nixge.txt
index bb2929f9c64f..85d7240a9b20 100644
--- a/Documentation/devicetree/bindings/net/nixge.txt
+++ b/Documentation/devicetree/bindings/net/nixge.txt
@@ -12,12 +12,14 @@ Required properties:
- interrupts: Should contain tx and rx interrupt
- interrupt-names: Should be "rx" and "tx"
- phy-mode: See ethernet.txt file in the same directory.
-- phy-handle: See ethernet.txt file in the same directory.
- nvmem-cells: Phandle of nvmem cell containing the MAC address
- nvmem-cell-names: Should be "address"
Optional properties:
- mdio subnode to indicate presence of MDIO controller
+- fixed-link : Assume a fixed link. See fixed-link.txt in the same directory.
+ Use instead of phy-handle.
+- phy-handle: See ethernet.txt file in the same directory.
Examples (10G generic PHY):
nixge0: ethernet@40000000 {
@@ -59,3 +61,32 @@ Examples (10G generic PHY, no MDIO):
phy-mode = "xgmii";
phy-handle = <ðernet_phy1>;
};
+
+Examples (1G generic fixed-link + MDIO):
+ nixge0: ethernet@40000000 {
+ compatible = "ni,xge-enet-2.00";
+ reg = <0x40000000 0x6000>;
+
+ nvmem-cells = <ð1_addr>;
+ nvmem-cell-names = "address";
+
+ interrupts = <0 29 IRQ_TYPE_LEVEL_HIGH>, <0 30 IRQ_TYPE_LEVEL_HIGH>;
+ interrupt-names = "rx", "tx";
+ interrupt-parent = <&intc>;
+
+ phy-mode = "xgmii";
+
+ fixed-link {
+ speed = <1000>;
+ pause;
+ link-gpios = <&gpio0 63 GPIO_ACTIVE_HIGH>;
+ };
+
+ mdio {
+ ethernet_phy1: ethernet-phy@4 {
+ compatible = "ethernet-phy-ieee802.3-c22";
+ reg = <4>;
+ };
+ };
+
+ };
--
2.20.1
^ permalink raw reply related
* [PATCH net-next 0/3] nixge: Fixed-link support
From: Moritz Fischer @ 2019-02-04 17:30 UTC (permalink / raw)
To: netdev
Cc: devicetree, linux-kernel, alex.williams, andrew, robh+dt, davem,
moritz.fischer, Moritz Fischer
From: Moritz Fischer <mdf@kernel.org>
This series adds fixed-link support to nixge.
The first patch corrects the binding to correctly reflect
hardware that does not come with MDIO cores instantiated.
The second patch adds fixed link support to the driver.
The third patch updates the binding document with the now
optional (formerly required) phy-handle property and references
the fixed-link docs.
Thanks,
Moritz
Moritz Fischer (3):
net: nixge: Make mdio child node optional
net: nixge: Add support for fixed-link configurations
dt-bindings: net: Add fixed-link support
.../devicetree/bindings/net/nixge.txt | 60 +++++++++++++++++--
drivers/net/ethernet/ni/nixge.c | 44 ++++++++++----
2 files changed, 88 insertions(+), 16 deletions(-)
--
2.20.1
^ permalink raw reply
* Re: [PATCH bpf-next] bpf: support SO_DEBUG in bpf_setsockopt()
From: Quentin Monnet @ 2019-02-04 17:30 UTC (permalink / raw)
To: Yafang Shao, kafai, brakmo, ast, daniel; +Cc: netdev, shaoyafang
In-Reply-To: <1549181707-16864-1-git-send-email-laoar.shao@gmail.com>
2019-02-03 16:15 UTC+0800 ~ Yafang Shao <laoar.shao@gmail.com>
> Then we can enable/disable socket debugging without modifying user code.
> That is more convenient for debugging.
>
> Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
Hi Yafang,
The list of socketopts supported by bpf_setsockopt() is described in the
documentation for this BPF helper in include/uapi/linux/bpf.h. Could you
please update that documentation, too?
Thanks,
Quentin
^ permalink raw reply
* Re: [PATCH net] net: cls_flower: Remove filter from mask before freeing it
From: David Miller @ 2019-02-04 17:21 UTC (permalink / raw)
To: petrm; +Cc: netdev, jhs, xiyou.wangcong, jiri, idosch, paulb
In-Reply-To: <6f8e5a3f3ad2d6bc2f5a81ce1be1167b8aa456df.1549291065.git.petrm@mellanox.com>
From: Petr Machata <petrm@mellanox.com>
Date: Mon, 4 Feb 2019 14:50:38 +0000
> In fl_change(), when adding a new rule (i.e. fold == NULL), a driver may
> reject the new rule, for example due to resource exhaustion. By that
> point, the new rule was already assigned a mask, and it was added to
> that mask's hash table. The clean-up path that's invoked as a result of
> the rejection however neglects to undo the hash table addition, and
> proceeds to free the new rule, thus leaving a dangling pointer in the
> hash table.
>
> Fix by removing fnew from the mask's hash table before it is freed.
>
> Fixes: 35cc3cefc4de ("net/sched: cls_flower: Reject duplicated rules
> also under skip_sw")
Please do not break up lone Fixes: tag lines in the future, I fixed it
up for you this time.
> Signed-off-by: Petr Machata <petrm@mellanox.com>
> Acked-by: Jiri Pirko <jiri@mellanox.com>
> Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Applied and queued up for -stable.
^ permalink raw reply
* Re: [PATCH] PCI / ACPI: Don't clear pme_poll on device that has unreliable ACPI wake
From: Bjorn Helgaas @ 2019-02-04 17:20 UTC (permalink / raw)
To: Kai Heng Feng
Cc: Rafael J. Wysocki, Len Brown, jeffrey.t.kirsher, intel-wired-lan,
netdev, linux-acpi, linux-pci, linux-kernel
In-Reply-To: <CFAC1243-982E-4BAC-BAF6-41568C1C1A9E@canonical.com>
On Sun, Feb 03, 2019 at 01:46:50AM +0800, Kai Heng Feng wrote:
> > On Jan 28, 2019, at 3:51 PM, Kai Heng Feng <kai.heng.feng@canonical.com> wrote:
>
> >> If I understand correctly, the bugzilla lspci
> >> (https://bugzilla.kernel.org/attachment.cgi?id=280691) was collected
> >> at point 8, and it shows PME_Status=1 when it should be 0.
> >>
> >> If we write a 1 to PME_Status to clear it, and it remains set, that's
> >> obviously a hardware defect, and Intel should document that in an
> >> erratum, and a quirk would be the appropriate way to work around it.
> >> But I doubt that's what's happening.
> >
> > I’ll ask them if they can provide an erratum.
>
> Got confirmed with e1000e folks, I219 (the device in question) doesn’t
> really support runtime D3.
Did you get a reference, e.g., an intel.com URL for that? Intel
usually publishes errata for hardware defects, which is nice because
it means every customer doesn't have to experimentally rediscover
them.
> I also checked the behavior of the device under Windows, and it
> stays at D0 all the time even when it’s not in use.
I think there are two possible explanations for this:
1) This device requires a Windows or a driver update with a
device-specific quirk similar to what you're proposing for Linux.
2) Windows correctly detects that this device doesn't support D3,
and Linux has a bug and does not detect that.
Obviously nobody wants to require OS or driver updates just for minor
device changes, and the PCI and ACPI specs are designed to allow
generic, non device-specific code to detect D3 support, so the first
case should be a result of a hardware defect.
> So I sent a patch [1] to disable it.
>
> [1] https://lkml.org/lkml/2019/2/2/200
OK. Since that's in drivers/net/..., I have no objection and the
e1000e maintainers would deal with that.
Bjorn
^ permalink raw reply
* Re: [PATCH] bpf: test_maps: Avoid possible out of bound access
From: David Miller @ 2019-02-04 17:15 UTC (permalink / raw)
To: leitao; +Cc: netdev, daniel, ast
In-Reply-To: <1549297631-27789-1-git-send-email-leitao@debian.org>
From: Breno Leitao <leitao@debian.org>
Date: Mon, 4 Feb 2019 14:27:11 -0200
> When compiling test_maps selftest with GCC-8, it warns that an array might
> be indexed with a negative value, which could cause a negative out of bound
> access, depending on parameters of the function. This is the GCC-8 warning:
>
> gcc -Wall -O2 -I../../../include/uapi -I../../../lib -I../../../lib/bpf -I../../../../include/generated -DHAVE_GENHDR -I../../../include test_maps.c /home/breno/Devel/linux/tools/testing/selftests/bpf/libbpf.a -lcap -lelf -lrt -lpthread -o /home/breno/Devel/linux/tools/testing/selftests/bpf/test_maps
> In file included from test_maps.c:16:
> test_maps.c: In function ‘run_all_tests’:
> test_maps.c:1079:10: warning: array subscript -1 is below array bounds of ‘pid_t[<Ube20> + 1]’ [-Warray-bounds]
> assert(waitpid(pid[i], &status, 0) == pid[i]);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~
> test_maps.c:1059:6: warning: array subscript -1 is below array bounds of ‘pid_t[<Ube20> + 1]’ [-Warray-bounds]
> pid[i] = fork();
> ~~~^~~
>
> This patch simply guarantees that the tasks variable is unsigned, thus, it
> could never be a negative number, hence avoiding an out of bound access
> warning.
>
> Signed-off-by: Breno Leitao <leitao@debian.org>
As good a fix as any...
Acked-by: David S. Miller <davem@davemloft.net>
^ permalink raw reply
* Re: [PATCH] s390: bpf: fix JMP32 code-gen
From: David Miller @ 2019-02-04 17:15 UTC (permalink / raw)
To: heiko.carstens; +Cc: ast, schwidefsky, jiong.wang, linux-s390, netdev
In-Reply-To: <20190204154455.88687-1-heiko.carstens@de.ibm.com>
From: Heiko Carstens <heiko.carstens@de.ibm.com>
Date: Mon, 4 Feb 2019 16:44:55 +0100
> Commit 626a5f66da0d19 ("s390: bpf: implement jitting of JMP32") added
> JMP32 code-gen support for s390. However it triggers the warning below
> due to some unusual gotos in the original s390 bpf jit code.
>
> Add a couple of additional "is_jmp32" initializations to fix this.
> Also fix the wrong opcode for the "llilf" instruction that was
> introduced with the same commit.
>
> arch/s390/net/bpf_jit_comp.c: In function 'bpf_jit_insn':
> arch/s390/net/bpf_jit_comp.c:248:55: warning: 'is_jmp32' may be used uninitialized in this function [-Wmaybe-uninitialized]
> _EMIT6(op1 | reg(b1, b2) << 16 | (rel & 0xffff), op2 | mask); \
> ^
> arch/s390/net/bpf_jit_comp.c:1211:8: note: 'is_jmp32' was declared here
> bool is_jmp32 = BPF_CLASS(insn->code) == BPF_JMP32;
>
> Fixes: 626a5f66da0d19 ("s390: bpf: implement jitting of JMP32")
> Cc: Jiong Wang <jiong.wang@netronome.com>
> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Acked-by: David S. Miller <davem@davemloft.net>
^ permalink raw reply
* Re: [net-next RFC/PATCH] net: nixge: Make mdio child node optional
From: David Miller @ 2019-02-04 17:14 UTC (permalink / raw)
To: andrew; +Cc: mdf, linux-kernel, netdev, devicetree, alex.williams, robh+dt
In-Reply-To: <20190204145854.GD22111@lunn.ch>
From: Andrew Lunn <andrew@lunn.ch>
Date: Mon, 4 Feb 2019 15:58:54 +0100
> On Fri, Feb 01, 2019 at 06:50:48PM -0800, Moritz Fischer wrote:
>> Make MDIO child optional and only instantiate the
>> MDIO bus if the child is actually present.
>>
>> There are currently no (in-tree) users of this
>> binding; all (out-of-tree) users use overlays that
>> get shipped together with the FPGA images that contain
>> the IP.
>>
>> This will significantly increase maintainabilty
>> of future revisions of this IP.
>>
>> Signed-off-by: Moritz Fischer <mdf@kernel.org>
>> Cc: Andrew Lunn <andrew@lunn.ch>
>> Cc: Rob Herring <robh+dt@kernel.org>
>
> Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Moritz, please repost without the RFC tag and with Andrew's tag added.
Thanks.
^ permalink raw reply
* Re: pull-request: wireless-drivers 2019-02-04
From: David Miller @ 2019-02-04 17:12 UTC (permalink / raw)
To: kvalo; +Cc: linux-wireless, netdev, linux-kernel
In-Reply-To: <87y36vejv3.fsf@kamboji.qca.qualcomm.com>
From: Kalle Valo <kvalo@codeaurora.org>
Date: Mon, 04 Feb 2019 15:58:08 +0200
> here are fixes to net tree for 5.0, more info below. Please let me know
> if there are any problems.
Pulled, thanks Kalle.
^ permalink raw reply
* Re: [PATCH net 0/4] net/smc: fixes 2019-02-04
From: David Miller @ 2019-02-04 17:11 UTC (permalink / raw)
To: ubraun; +Cc: netdev, linux-s390, linux-rdma, schwidefsky, heiko.carstens,
raspl
In-Reply-To: <20190204124447.39816-1-ubraun@linux.ibm.com>
From: Ursula Braun <ubraun@linux.ibm.com>
Date: Mon, 4 Feb 2019 13:44:43 +0100
> here are more fixes in the smc code for the net tree:
> Patch 1 fixes an IB-related problem with SMCR.
> Patch 2 fixes a cursor problem for one-way traffic.
> Patch 3 fixes a problem with RMB-reusage.
> Patch 4 fixes a closing issue.
Series applied, thanks.
^ permalink raw reply
* Need to retouch your photos?
From: Stacy @ 2019-02-04 10:42 UTC (permalink / raw)
To: netdev
Need to retouch your photos? Deep etching or masking for your photos?
We are the studio who can do those service for your photos.
Please send photos to start
Thanks,
Stacy
Kerdpen
Hdaltern
^ permalink raw reply
* [PATCH net-next 4/4] dpaa2-eth: Update buffer pool refill threshold
From: Ioana Ciocoi Radulescu @ 2019-02-04 17:00 UTC (permalink / raw)
To: netdev@vger.kernel.org, davem@davemloft.net
Cc: Ioana Ciornei, brouer@redhat.com, ilias.apalodimas@linaro.org
In-Reply-To: <1549299625-28399-1-git-send-email-ruxandra.radulescu@nxp.com>
Add more buffers to the Rx buffer pool as soon as 7 of them
get consumed, instead of waiting for their number to drop
below a fixed threshold.
7 is the number of buffers that can be released in the pool
via a single DPIO command.
Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
---
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h
index 3e29dec..9510928 100644
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h
@@ -53,7 +53,8 @@
*/
#define DPAA2_ETH_MAX_FRAMES_PER_QUEUE (DPAA2_ETH_TAILDROP_THRESH / 64)
#define DPAA2_ETH_NUM_BUFS (DPAA2_ETH_MAX_FRAMES_PER_QUEUE + 256)
-#define DPAA2_ETH_REFILL_THRESH DPAA2_ETH_MAX_FRAMES_PER_QUEUE
+#define DPAA2_ETH_REFILL_THRESH \
+ (DPAA2_ETH_NUM_BUFS - DPAA2_ETH_BUFS_PER_CMD)
/* Maximum number of buffers that can be acquired/released through a single
* QBMan command
--
2.7.4
^ permalink raw reply related
* [PATCH net-next 3/4] dpaa2-eth: Use FQ-based DPIO enqueue API
From: Ioana Ciocoi Radulescu @ 2019-02-04 17:00 UTC (permalink / raw)
To: netdev@vger.kernel.org, davem@davemloft.net
Cc: Ioana Ciornei, brouer@redhat.com, ilias.apalodimas@linaro.org
In-Reply-To: <1549299625-28399-1-git-send-email-ruxandra.radulescu@nxp.com>
Starting with MC10.14.0, dpaa2_io_service_enqueue_fq() API is
functional. Since there are a number of cases where it offers
better performance compared to the currently used enqueue
function, switch to it for firmware versions that support it.
Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
---
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 41 ++++++++++++++++++++----
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h | 4 +++
2 files changed, 39 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
index 3bc5437..87777b0 100644
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
@@ -264,9 +264,7 @@ static int xdp_enqueue(struct dpaa2_eth_priv *priv, struct dpaa2_fd *fd,
fq = &priv->fq[queue_id];
for (i = 0; i < DPAA2_ETH_ENQUEUE_RETRIES; i++) {
- err = dpaa2_io_service_enqueue_qd(fq->channel->dpio,
- priv->tx_qdid, 0,
- fq->tx_qdbin, fd);
+ err = priv->enqueue(priv, fq, fd, 0);
if (err != -EBUSY)
break;
}
@@ -785,9 +783,7 @@ static netdev_tx_t dpaa2_eth_tx(struct sk_buff *skb, struct net_device *net_dev)
queue_mapping = skb_get_queue_mapping(skb);
fq = &priv->fq[queue_mapping];
for (i = 0; i < DPAA2_ETH_ENQUEUE_RETRIES; i++) {
- err = dpaa2_io_service_enqueue_qd(fq->channel->dpio,
- priv->tx_qdid, 0,
- fq->tx_qdbin, &fd);
+ err = priv->enqueue(priv, fq, &fd, 0);
if (err != -EBUSY)
break;
}
@@ -2205,6 +2201,36 @@ static int set_buffer_layout(struct dpaa2_eth_priv *priv)
return 0;
}
+#define DPNI_ENQUEUE_FQID_VER_MAJOR 7
+#define DPNI_ENQUEUE_FQID_VER_MINOR 9
+
+static inline int dpaa2_eth_enqueue_qd(struct dpaa2_eth_priv *priv,
+ struct dpaa2_eth_fq *fq,
+ struct dpaa2_fd *fd, u8 prio)
+{
+ return dpaa2_io_service_enqueue_qd(fq->channel->dpio,
+ priv->tx_qdid, prio,
+ fq->tx_qdbin, fd);
+}
+
+static inline int dpaa2_eth_enqueue_fq(struct dpaa2_eth_priv *priv,
+ struct dpaa2_eth_fq *fq,
+ struct dpaa2_fd *fd,
+ u8 prio __always_unused)
+{
+ return dpaa2_io_service_enqueue_fq(fq->channel->dpio,
+ fq->tx_fqid, fd);
+}
+
+static void set_enqueue_mode(struct dpaa2_eth_priv *priv)
+{
+ if (dpaa2_eth_cmp_dpni_ver(priv, DPNI_ENQUEUE_FQID_VER_MAJOR,
+ DPNI_ENQUEUE_FQID_VER_MINOR) < 0)
+ priv->enqueue = dpaa2_eth_enqueue_qd;
+ else
+ priv->enqueue = dpaa2_eth_enqueue_fq;
+}
+
/* Configure the DPNI object this interface is associated with */
static int setup_dpni(struct fsl_mc_device *ls_dev)
{
@@ -2258,6 +2284,8 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
if (err)
goto close;
+ set_enqueue_mode(priv);
+
priv->cls_rules = devm_kzalloc(dev, sizeof(struct dpaa2_eth_cls_rule) *
dpaa2_eth_fs_count(priv), GFP_KERNEL);
if (!priv->cls_rules)
@@ -2342,6 +2370,7 @@ static int setup_tx_flow(struct dpaa2_eth_priv *priv,
}
fq->tx_qdbin = qid.qdbin;
+ fq->tx_fqid = qid.fqid;
err = dpni_get_queue(priv->mc_io, 0, priv->mc_token,
DPNI_QUEUE_TX_CONFIRM, 0, fq->flowid,
diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h
index da3d039..3e29dec 100644
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h
@@ -276,6 +276,7 @@ struct dpaa2_eth_priv;
struct dpaa2_eth_fq {
u32 fqid;
u32 tx_qdbin;
+ u32 tx_fqid;
u16 flowid;
int target_cpu;
u32 dq_frames;
@@ -328,6 +329,9 @@ struct dpaa2_eth_priv {
u8 num_fqs;
struct dpaa2_eth_fq fq[DPAA2_ETH_MAX_QUEUES];
+ int (*enqueue)(struct dpaa2_eth_priv *priv,
+ struct dpaa2_eth_fq *fq,
+ struct dpaa2_fd *fd, u8 prio);
u8 num_channels;
struct dpaa2_eth_channel *channel[DPAA2_ETH_MAX_DPCONS];
--
2.7.4
^ permalink raw reply related
* [PATCH net-next 2/4] dpaa2-eth: Use napi_consume_skb()
From: Ioana Ciocoi Radulescu @ 2019-02-04 17:00 UTC (permalink / raw)
To: netdev@vger.kernel.org, davem@davemloft.net
Cc: Ioana Ciornei, brouer@redhat.com, ilias.apalodimas@linaro.org
In-Reply-To: <1549299625-28399-1-git-send-email-ruxandra.radulescu@nxp.com>
While in NAPI context, free skbs by calling napi_consume_skb()
instead of dev_kfree_skb(), to take advantage of the bulk freeing
mechanism.
Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
---
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
index 6e58de6..3bc5437 100644
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
@@ -657,7 +657,7 @@ static int build_single_fd(struct dpaa2_eth_priv *priv,
* dpaa2_eth_tx().
*/
static void free_tx_fd(const struct dpaa2_eth_priv *priv,
- const struct dpaa2_fd *fd)
+ const struct dpaa2_fd *fd, bool in_napi)
{
struct device *dev = priv->net_dev->dev.parent;
dma_addr_t fd_addr;
@@ -712,7 +712,7 @@ static void free_tx_fd(const struct dpaa2_eth_priv *priv,
skb_free_frag(skbh);
/* Move on with skb release */
- dev_kfree_skb(skb);
+ napi_consume_skb(skb, in_napi);
}
static netdev_tx_t dpaa2_eth_tx(struct sk_buff *skb, struct net_device *net_dev)
@@ -795,7 +795,7 @@ static netdev_tx_t dpaa2_eth_tx(struct sk_buff *skb, struct net_device *net_dev)
if (unlikely(err < 0)) {
percpu_stats->tx_errors++;
/* Clean up everything, including freeing the skb */
- free_tx_fd(priv, &fd);
+ free_tx_fd(priv, &fd, false);
} else {
fd_len = dpaa2_fd_get_len(&fd);
percpu_stats->tx_packets++;
@@ -837,7 +837,7 @@ static void dpaa2_eth_tx_conf(struct dpaa2_eth_priv *priv,
/* Check frame errors in the FD field */
fd_errors = dpaa2_fd_get_ctrl(fd) & DPAA2_FD_TX_ERR_MASK;
- free_tx_fd(priv, fd);
+ free_tx_fd(priv, fd, true);
if (likely(!fd_errors))
return;
--
2.7.4
^ permalink raw reply related
* [PATCH net-next 1/4] dpaa2-eth: Use a single page per Rx buffer
From: Ioana Ciocoi Radulescu @ 2019-02-04 17:00 UTC (permalink / raw)
To: netdev@vger.kernel.org, davem@davemloft.net
Cc: Ioana Ciornei, brouer@redhat.com, ilias.apalodimas@linaro.org
In-Reply-To: <1549299625-28399-1-git-send-email-ruxandra.radulescu@nxp.com>
Instead of allocating page fragments via the network stack,
use the page allocator directly. For now, we consume one page
for each Rx buffer.
With the new memory model we are free to consider adding more
XDP support.
Performance decreases slightly in some IP forwarding cases.
No visible effect on termination traffic. The driver memory
footprint increases as a result of this change, but it is
still small enough to not really matter.
Another side effect is that now Rx buffer alignment requirements
are naturally satisfied without any additional actions needed.
Remove alignment related code, except in the buffer layout
information conveyed to MC, as hardware still needs to know the
alignment value we guarantee.
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
---
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 61 +++++++++++++-----------
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h | 21 +++-----
2 files changed, 38 insertions(+), 44 deletions(-)
diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
index 04925c7..6e58de6 100644
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
@@ -86,16 +86,16 @@ static void free_rx_fd(struct dpaa2_eth_priv *priv,
for (i = 1; i < DPAA2_ETH_MAX_SG_ENTRIES; i++) {
addr = dpaa2_sg_get_addr(&sgt[i]);
sg_vaddr = dpaa2_iova_to_virt(priv->iommu_domain, addr);
- dma_unmap_single(dev, addr, DPAA2_ETH_RX_BUF_SIZE,
- DMA_BIDIRECTIONAL);
+ dma_unmap_page(dev, addr, DPAA2_ETH_RX_BUF_SIZE,
+ DMA_BIDIRECTIONAL);
- skb_free_frag(sg_vaddr);
+ free_pages((unsigned long)sg_vaddr, 0);
if (dpaa2_sg_is_final(&sgt[i]))
break;
}
free_buf:
- skb_free_frag(vaddr);
+ free_pages((unsigned long)vaddr, 0);
}
/* Build a linear skb based on a single-buffer frame descriptor */
@@ -109,7 +109,7 @@ static struct sk_buff *build_linear_skb(struct dpaa2_eth_channel *ch,
ch->buf_count--;
- skb = build_skb(fd_vaddr, DPAA2_ETH_SKB_SIZE);
+ skb = build_skb(fd_vaddr, DPAA2_ETH_RX_BUF_RAW_SIZE);
if (unlikely(!skb))
return NULL;
@@ -144,19 +144,19 @@ static struct sk_buff *build_frag_skb(struct dpaa2_eth_priv *priv,
/* Get the address and length from the S/G entry */
sg_addr = dpaa2_sg_get_addr(sge);
sg_vaddr = dpaa2_iova_to_virt(priv->iommu_domain, sg_addr);
- dma_unmap_single(dev, sg_addr, DPAA2_ETH_RX_BUF_SIZE,
- DMA_BIDIRECTIONAL);
+ dma_unmap_page(dev, sg_addr, DPAA2_ETH_RX_BUF_SIZE,
+ DMA_BIDIRECTIONAL);
sg_length = dpaa2_sg_get_len(sge);
if (i == 0) {
/* We build the skb around the first data buffer */
- skb = build_skb(sg_vaddr, DPAA2_ETH_SKB_SIZE);
+ skb = build_skb(sg_vaddr, DPAA2_ETH_RX_BUF_RAW_SIZE);
if (unlikely(!skb)) {
/* Free the first SG entry now, since we already
* unmapped it and obtained the virtual address
*/
- skb_free_frag(sg_vaddr);
+ free_pages((unsigned long)sg_vaddr, 0);
/* We still need to subtract the buffers used
* by this FD from our software counter
@@ -211,9 +211,9 @@ static void free_bufs(struct dpaa2_eth_priv *priv, u64 *buf_array, int count)
for (i = 0; i < count; i++) {
vaddr = dpaa2_iova_to_virt(priv->iommu_domain, buf_array[i]);
- dma_unmap_single(dev, buf_array[i], DPAA2_ETH_RX_BUF_SIZE,
- DMA_BIDIRECTIONAL);
- skb_free_frag(vaddr);
+ dma_unmap_page(dev, buf_array[i], DPAA2_ETH_RX_BUF_SIZE,
+ DMA_BIDIRECTIONAL);
+ free_pages((unsigned long)vaddr, 0);
}
}
@@ -378,16 +378,16 @@ static void dpaa2_eth_rx(struct dpaa2_eth_priv *priv,
return;
}
- dma_unmap_single(dev, addr, DPAA2_ETH_RX_BUF_SIZE,
- DMA_BIDIRECTIONAL);
+ dma_unmap_page(dev, addr, DPAA2_ETH_RX_BUF_SIZE,
+ DMA_BIDIRECTIONAL);
skb = build_linear_skb(ch, fd, vaddr);
} else if (fd_format == dpaa2_fd_sg) {
WARN_ON(priv->xdp_prog);
- dma_unmap_single(dev, addr, DPAA2_ETH_RX_BUF_SIZE,
- DMA_BIDIRECTIONAL);
+ dma_unmap_page(dev, addr, DPAA2_ETH_RX_BUF_SIZE,
+ DMA_BIDIRECTIONAL);
skb = build_frag_skb(priv, ch, buf_data);
- skb_free_frag(vaddr);
+ free_pages((unsigned long)vaddr, 0);
percpu_extras->rx_sg_frames++;
percpu_extras->rx_sg_bytes += dpaa2_fd_get_len(fd);
} else {
@@ -903,7 +903,7 @@ static int add_bufs(struct dpaa2_eth_priv *priv,
{
struct device *dev = priv->net_dev->dev.parent;
u64 buf_array[DPAA2_ETH_BUFS_PER_CMD];
- void *buf;
+ struct page *page;
dma_addr_t addr;
int i, err;
@@ -911,14 +911,16 @@ static int add_bufs(struct dpaa2_eth_priv *priv,
/* Allocate buffer visible to WRIOP + skb shared info +
* alignment padding
*/
- buf = napi_alloc_frag(dpaa2_eth_buf_raw_size(priv));
- if (unlikely(!buf))
+ /* allocate one page for each Rx buffer. WRIOP sees
+ * the entire page except for a tailroom reserved for
+ * skb shared info
+ */
+ page = dev_alloc_pages(0);
+ if (!page)
goto err_alloc;
- buf = PTR_ALIGN(buf, priv->rx_buf_align);
-
- addr = dma_map_single(dev, buf, DPAA2_ETH_RX_BUF_SIZE,
- DMA_BIDIRECTIONAL);
+ addr = dma_map_page(dev, page, 0, DPAA2_ETH_RX_BUF_SIZE,
+ DMA_BIDIRECTIONAL);
if (unlikely(dma_mapping_error(dev, addr)))
goto err_map;
@@ -926,7 +928,7 @@ static int add_bufs(struct dpaa2_eth_priv *priv,
/* tracing point */
trace_dpaa2_eth_buf_seed(priv->net_dev,
- buf, dpaa2_eth_buf_raw_size(priv),
+ page, DPAA2_ETH_RX_BUF_RAW_SIZE,
addr, DPAA2_ETH_RX_BUF_SIZE,
bpid);
}
@@ -948,7 +950,7 @@ static int add_bufs(struct dpaa2_eth_priv *priv,
return i;
err_map:
- skb_free_frag(buf);
+ __free_pages(page, 0);
err_alloc:
/* If we managed to allocate at least some buffers,
* release them to hardware
@@ -2134,6 +2136,7 @@ static int set_buffer_layout(struct dpaa2_eth_priv *priv)
{
struct device *dev = priv->net_dev->dev.parent;
struct dpni_buffer_layout buf_layout = {0};
+ u16 rx_buf_align;
int err;
/* We need to check for WRIOP version 1.0.0, but depending on the MC
@@ -2142,9 +2145,9 @@ static int set_buffer_layout(struct dpaa2_eth_priv *priv)
*/
if (priv->dpni_attrs.wriop_version == DPAA2_WRIOP_VERSION(0, 0, 0) ||
priv->dpni_attrs.wriop_version == DPAA2_WRIOP_VERSION(1, 0, 0))
- priv->rx_buf_align = DPAA2_ETH_RX_BUF_ALIGN_REV1;
+ rx_buf_align = DPAA2_ETH_RX_BUF_ALIGN_REV1;
else
- priv->rx_buf_align = DPAA2_ETH_RX_BUF_ALIGN;
+ rx_buf_align = DPAA2_ETH_RX_BUF_ALIGN;
/* tx buffer */
buf_layout.private_data_size = DPAA2_ETH_SWA_SIZE;
@@ -2184,7 +2187,7 @@ static int set_buffer_layout(struct dpaa2_eth_priv *priv)
/* rx buffer */
buf_layout.pass_frame_status = true;
buf_layout.pass_parser_result = true;
- buf_layout.data_align = priv->rx_buf_align;
+ buf_layout.data_align = rx_buf_align;
buf_layout.data_head_room = dpaa2_eth_rx_head_room(priv);
buf_layout.private_data_size = 0;
buf_layout.options = DPNI_BUF_LAYOUT_OPT_PARSER_RESULT |
diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h
index 31fe486..da3d039 100644
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h
@@ -63,9 +63,11 @@
/* Hardware requires alignment for ingress/egress buffer addresses */
#define DPAA2_ETH_TX_BUF_ALIGN 64
-#define DPAA2_ETH_RX_BUF_SIZE 2048
-#define DPAA2_ETH_SKB_SIZE \
- (DPAA2_ETH_RX_BUF_SIZE + SKB_DATA_ALIGN(sizeof(struct skb_shared_info)))
+#define DPAA2_ETH_RX_BUF_RAW_SIZE PAGE_SIZE
+#define DPAA2_ETH_RX_BUF_TAILROOM \
+ SKB_DATA_ALIGN(sizeof(struct skb_shared_info))
+#define DPAA2_ETH_RX_BUF_SIZE \
+ (DPAA2_ETH_RX_BUF_RAW_SIZE - DPAA2_ETH_RX_BUF_TAILROOM)
/* Hardware annotation area in RX/TX buffers */
#define DPAA2_ETH_RX_HWA_SIZE 64
@@ -343,7 +345,6 @@ struct dpaa2_eth_priv {
bool rx_tstamp; /* Rx timestamping enabled */
u16 tx_qdid;
- u16 rx_buf_align;
struct fsl_mc_io *mc_io;
/* Cores which have an affine DPIO/DPCON.
* This is the cpu set on which Rx and Tx conf frames are processed
@@ -418,15 +419,6 @@ enum dpaa2_eth_rx_dist {
DPAA2_ETH_RX_DIST_CLS
};
-/* Hardware only sees DPAA2_ETH_RX_BUF_SIZE, but the skb built around
- * the buffer also needs space for its shared info struct, and we need
- * to allocate enough to accommodate hardware alignment restrictions
- */
-static inline unsigned int dpaa2_eth_buf_raw_size(struct dpaa2_eth_priv *priv)
-{
- return DPAA2_ETH_SKB_SIZE + priv->rx_buf_align;
-}
-
static inline
unsigned int dpaa2_eth_needed_headroom(struct dpaa2_eth_priv *priv,
struct sk_buff *skb)
@@ -451,8 +443,7 @@ unsigned int dpaa2_eth_needed_headroom(struct dpaa2_eth_priv *priv,
*/
static inline unsigned int dpaa2_eth_rx_head_room(struct dpaa2_eth_priv *priv)
{
- return priv->tx_data_offset + DPAA2_ETH_TX_BUF_ALIGN -
- DPAA2_ETH_RX_HWA_SIZE;
+ return priv->tx_data_offset - DPAA2_ETH_RX_HWA_SIZE;
}
int dpaa2_eth_set_hash(struct net_device *net_dev, u64 flags);
--
2.7.4
^ permalink raw reply related
* [PATCH net-next 0/4] dpaa2-eth: Driver updates
From: Ioana Ciocoi Radulescu @ 2019-02-04 17:00 UTC (permalink / raw)
To: netdev@vger.kernel.org, davem@davemloft.net
Cc: Ioana Ciornei, brouer@redhat.com, ilias.apalodimas@linaro.org
First patch moves the driver to a page-per-frame memory model.
The others are minor tweaks and optimizations.
Ioana Radulescu (4):
dpaa2-eth: Use a single page per Rx buffer
dpaa2-eth: Use napi_consume_skb()
dpaa2-eth: Use FQ-based DPIO enqueue API
dpaa2-eth: Update buffer pool refill threshold
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 110 +++++++++++++++--------
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h | 28 +++---
2 files changed, 83 insertions(+), 55 deletions(-)
--
2.7.4
^ 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