* Re: [PATCH v2] drivers/net/wan/lapbether: Use needed_headroom instead of hard_header_len
From: Xie He @ 2020-08-02 0:58 UTC (permalink / raw)
To: Willem de Bruijn
Cc: David S. Miller, Jakub Kicinski, Linux Kernel Network Developers,
LKML, Linux X25, Brian Norris
In-Reply-To: <CA+FuTSdJ1c0R2qmKtm9vWpKnMv=-B0yAaronGkqg=jYZBfqceA@mail.gmail.com>
On Sat, Aug 1, 2020 at 6:31 AM Willem de Bruijn
<willemdebruijn.kernel@gmail.com> wrote:
>
> The kernel interface cannot be changed. If packet sockets used to pass
> the first byte up to userspace, they have to continue to do so.
>
> So I think you can limit the header_ops to only dev_hard_header.
Actually if we want to keep the kernel interface unchanged, we
shouldn't implement header_ops for dev_hard_header either, because
this changes the way the user space program sends DGRAM packets, too.
Before the change the userspace program needs to add the 1-byte header
before sending, and after the change the userspace program will let
the kernel add the header via dev_hard_header.
> Fixes should be small and targeted. Any larger refactoring is
> best addressed in a separate net-next patch.
I guess the best way for this fix patch would be just add a 0-byte
packet check before the driver reads skb->data[0].
Thanks! I'll add the check and re-send the patch.
^ permalink raw reply
* Re: [GIT] Networking
From: pr-tracker-bot @ 2020-08-02 0:00 UTC (permalink / raw)
To: David Miller; +Cc: torvalds, akpm, netdev, linux-kernel
In-Reply-To: <20200801.143631.1794965770015082550.davem@davemloft.net>
The pull request you sent on Sat, 01 Aug 2020 14:36:31 -0700 (PDT):
> git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git refs/heads/master
has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/ac3a0c8472969a03c0496ae774b3a29eb26c8d5a
Thank you!
--
Deet-doot-dot, I am a bot.
https://korg.wiki.kernel.org/userdoc/prtracker
^ permalink raw reply
* Re: [GIT] Networking
From: Linus Torvalds @ 2020-08-01 23:45 UTC (permalink / raw)
To: David Miller; +Cc: Andrew Morton, Netdev, Linux Kernel Mailing List
In-Reply-To: <20200801.143631.1794965770015082550.davem@davemloft.net>
On Sat, Aug 1, 2020 at 2:36 PM David Miller <davem@davemloft.net> wrote:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git
How is this wrt an rc8 or a final?
I have another possible small reason to do an rc8 right now. And this
roughly doubles my current diff.
On a very much related note, I really wish you didn't send the
networking fixes the day before a release is scheduled.
If it's really quiet., send them on (say) Wed/Thu. And then on
Saturday, send a note saying "no, important stuff", hold on. Or say
"nothing new".
Because right now the "last-minute network pull request" has become a
pattern, and I have a very hard time judging whether I should delay a
release for it.
Linus
^ permalink raw reply
* Re: WARNING in hci_conn_timeout
From: syzbot @ 2020-08-01 22:56 UTC (permalink / raw)
To: coreteam, davem, devel, forest, gregkh, johan.hedberg, kaber,
kadlec, kuba, linux-bluetooth, linux-kernel, marcel, netdev,
netfilter-devel, pablo, rvarsha016, syzkaller-bugs
In-Reply-To: <0000000000007450a405abd572a8@google.com>
syzbot has bisected this issue to:
commit 3d30311c0e4d834c94e6a27d6242a942d6a76b85
Author: Varsha Rao <rvarsha016@gmail.com>
Date: Sun Oct 9 11:13:56 2016 +0000
staging: vt6655: Removes unnecessary blank lines.
bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=17023a14900000
start commit: 7dc6fd0f Merge branch 'i2c/for-current' of git://git.kerne..
git tree: upstream
final oops: https://syzkaller.appspot.com/x/report.txt?x=14823a14900000
console output: https://syzkaller.appspot.com/x/log.txt?x=10823a14900000
kernel config: https://syzkaller.appspot.com/x/.config?x=e59ee776d5aa8d55
dashboard link: https://syzkaller.appspot.com/bug?extid=2446dd3cb07277388db6
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=13f781d4900000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=116a0c14900000
Reported-by: syzbot+2446dd3cb07277388db6@syzkaller.appspotmail.com
Fixes: 3d30311c0e4d ("staging: vt6655: Removes unnecessary blank lines.")
For information about bisection process see: https://goo.gl/tpsmEJ#bisection
^ permalink raw reply
* [GIT] Networking
From: David Miller @ 2020-08-01 21:36 UTC (permalink / raw)
To: torvalds; +Cc: akpm, netdev, linux-kernel
1) Encap offset calculation is incorrect in esp6, from Sabrina Dubroca.
2) Better parameter validation in pfkey_dump(), from Mark Salyzyn.
3) Fix several clang issues on powerpc in selftests, from Tanner Love.
4) cmsghdr_from_user_compat_to_kern() uses the wrong length, from
Al Viro.
5) Out of bounds access in mlx5e driver, from Raed Salem.
6) Fix transfer buffer memleak in lan78xx, from Johan Havold.
7) RCU fixups in rhashtable, from Herbert Xu.
8) Fix ipv6 nexthop refcnt leak, from Xiyu Yang.
9) vxlan FDB dump must be done under RCU, from Ido Schimmel.
10) Fix use after free in mlxsw, from Ido Schimmel.
11) Fix map leak in HASH_OF_MAPS bpf code, from Andrii Nakryiko.
12) Fix bug in mac80211 Tx ack status reporting, from Vasanthakumar
Thiagarajan.
13) Fix memory leaks in IPV6_ADDRFORM code, from Cong Wang.
14) Fix bpf program reference count leaks in mlx5 during
mlx5e_alloc_rq(), from Xin Xiong.
Please pull, thanks a lot!
The following changes since commit 04300d66f0a06d572d9f2ad6768c38cabde22179:
Merge tag 'riscv-for-linus-5.8-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux into master (2020-07-25 14:42:11 -0700)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git
for you to fetch changes up to fda2ec62cf1aa7cbee52289dc8059cd3662795da:
vxlan: fix memleak of fdb (2020-08-01 11:49:18 -0700)
----------------------------------------------------------------
Aaron Ma (1):
e1000e: continue to init PHY even when failed to disable ULP
Al Viro (1):
fix a braino in cmsghdr_from_user_compat_to_kern()
Alaa Hleihel (1):
net/mlx5e: Fix kernel crash when setting vf VLANID on a VF dev
Amit Cohen (1):
selftests: ethtool: Fix test when only two speeds are supported
Andrii Nakryiko (2):
bpf: Fix map leak in HASH_OF_MAPS map
selftests/bpf: Extend map-in-map selftest to detect memory leaks
Aya Levin (1):
net/mlx5e: Fix error path of device attach
Christoph Hellwig (1):
net/bpfilter: Initialize pos in __bpfilter_process_sockopt
Cong Wang (1):
ipv6: fix memory leaks on IPV6_ADDRFORM path
David Howells (1):
rxrpc: Fix race between recvmsg and sendmsg on immediate call failure
David S. Miller (12):
Merge branch 'selftests-net-Fix-clang-warnings-on-powerpc'
Merge branch 'hns3-fixes'
Merge branch 'net-lan78xx-fix-NULL-deref-and-memory-leak'
Merge tag 'mlx5-fixes-2020-07-28' of git://git.kernel.org/.../saeed/linux
Merge branch 'rhashtable-Fix-unprotected-RCU-dereference-in-__rht_ptr'
Merge branch 'Fix-bugs-in-Octeontx2-netdev-driver'
Merge branch 'mlxsw-fixes'
Merge tag 'mac80211-for-davem-2020-07-30' of git://git.kernel.org/.../jberg/mac80211
Merge branch '1GbE' of git://git.kernel.org/.../jkirsher/net-queue
Merge tag 'mlx5-fixes-2020-07-30' of git://git.kernel.org/.../saeed/linux
Merge branch 'master' of git://git.kernel.org/.../klassert/ipsec
Merge git://git.kernel.org/.../bpf/bpf
Eran Ben Elisha (3):
net/mlx5: Fix a bug of using ptp channel index as pin index
net/mlx5: Verify Hardware supports requested ptp function on a given pin
net/mlx5: Query PPS pin operational status before registering it
Felix Fietkau (1):
mac80211: remove STA txq pending airtime underflow warning
Francesco Ruggeri (1):
igb: reinit_locked() should be called with rtnl_lock
Guillaume Nault (1):
bareudp: forbid mixing IP and MPLS in multiproto mode
Guojia Liao (2):
net: hns3: fix aRFS FD rules leftover after add a user FD rule
net: hns3: fix for VLAN config when reset failed
Hangbin Liu (1):
selftests/bpf: fix netdevsim trap_flow_action_cookie read
Herbert Xu (2):
rhashtable: Fix unprotected RCU dereference in __rht_ptr
rhashtable: Restore RCU marking on rhash_lock_head
Ido Schimmel (7):
vxlan: Ensure FDB dump is performed under RCU
ipv4: Silence suspicious RCU usage warning
mlxsw: spectrum_router: Allow programming link-local host routes
mlxsw: spectrum: Use different trap group for externally routed packets
mlxsw: core: Increase scope of RCU read-side critical section
mlxsw: core: Free EMAD transactions using kfree_rcu()
mlxsw: spectrum_router: Fix use-after-free in router init / de-init
Jakub Kicinski (2):
mlx4: disable device on shutdown
devlink: ignore -EOPNOTSUPP errors on dumpit
Jean-Philippe Brucker (1):
selftests/bpf: Fix cgroup sockopt verifier test
Jian Shen (1):
net: hns3: add reset check for VF updating port based VLAN
Jianbo Liu (3):
net/mlx5e: CT: Support restore ipv6 tunnel
net/mlx5e: E-Switch, Add misc bit when misc fields changed for mirroring
net/mlx5e: E-Switch, Specify flow_source for rule with no in_port
Johan Hovold (3):
net: lan78xx: add missing endpoint sanity check
net: lan78xx: fix transfer-buffer memory leak
net: lan78xx: replace bogus endpoint lookup
Joyce Ooi (1):
MAINTAINERS: Replace Thor Thayer as Altera Triple Speed Ethernet maintainer
Julian Squires (1):
cfg80211: check vendor command doit pointer before use
Landen Chao (1):
net: ethernet: mtk_eth_soc: fix MTU warnings
Lu Wei (1):
net: nixge: fix potential memory leak in nixge_probe()
Maor Dickman (1):
net/mlx5e: Fix missing cleanup of ethtool steering during rep rx cleanup
Maor Gottlieb (1):
net/mlx5: Fix forward to next namespace
Mark Salyzyn (1):
af_key: pfkey_dump needs parameter validation
Martin Varghese (1):
Documentation: bareudp: Corrected description of bareudp module.
Matthieu Baerts (1):
mptcp: fix joined subflows with unblocking sk
Parav Pandit (2):
net/mlx5: E-switch, Destroy TSAR when fail to enable the mode
net/mlx5: E-switch, Destroy TSAR after reload interface
Peilin Ye (2):
bpf: Fix NULL pointer dereference in __btf_resolve_helper_id()
rds: Prevent kernel-infoleak in rds_notify_queue_get()
Raed Salem (1):
net/mlx5e: Fix slab-out-of-bounds in mlx5e_rep_is_lag_netdev
Rajkumar Manoharan (1):
mac80211: fix warning in 6 GHz IE addition in mesh mode
Remi Pommarel (2):
mac80211: mesh: Free ie data when leaving mesh
mac80211: mesh: Free pending skb when destroying a mpath
René van Dorst (1):
net: ethernet: mtk_eth_soc: Always call mtk_gmac0_rgmii_adjust() for mt7623
Ron Diskin (1):
net/mlx5e: Modify uplink state on interface up/down
Rustam Kovhaev (1):
usb: hso: check for return value in hso_serial_common_create()
Sabrina Dubroca (7):
xfrm: esp6: fix encapsulation header offset computation
espintcp: support non-blocking sends
espintcp: recv() should return 0 when the peer socket is closed
xfrm: policy: fix IPv6-only espintcp compilation
xfrm: esp6: fix the location of the transport header with encapsulation
espintcp: handle short messages instead of breaking the encap socket
espintcp: count packets dropped in espintcp_rcv
Shannon Nelson (1):
ionic: unlock queue mutex in error path
Steffen Klassert (2):
Merge remote-tracking branch 'origin/testing'
xfrm: Fix crash when the hold queue is used.
Subbaraya Sundeep (3):
octeontx2-pf: Fix reset_task bugs
octeontx2-pf: cancel reset_task work
octeontx2-pf: Unregister netdev at driver remove
Taehee Yoo (1):
vxlan: fix memleak of fdb
Tanner Love (4):
selftests/net: rxtimestamp: fix clang issues for target arch PowerPC
selftests/net: psock_fanout: fix clang issues for target arch PowerPC
selftests/net: so_txtime: fix clang issues for target arch PowerPC
selftests/net: tcp_mmap: fix clang warning for target arch PowerPC
Thomas Falcon (1):
ibmvnic: Fix IRQ mapping disposal in error path
Vasanthakumar Thiagarajan (1):
mac80211: Fix bug in Tx ack status reporting in 802.3 xmit path
Wang Hai (1):
net: gemini: Fix missing clk_disable_unprepare() in error path of gemini_ethernet_port_probe()
Xin Long (1):
xfrm: policy: match with both mark and mask on user interfaces
Xin Xiong (2):
atm: fix atm_dev refcnt leaks in atmtcp_remove_persistent
net/mlx5e: fix bpf_prog reference count leaks in mlx5e_alloc_rq
Xiyu Yang (1):
ipv6: Fix nexthop refcnt leak when creating ipv6 route info
Yonglong Liu (1):
net: hns3: fix a TX timeout issue
Yunsheng Lin (1):
net: hns3: fix desc filling bug when skb is expanded or lineared
laurent brando (1):
net: mscc: ocelot: fix hardware timestamp dequeue logic
liujian (1):
net/sched: The error lable position is corrected in ct_init_module
Documentation/networking/bareudp.rst | 5 ++--
Documentation/networking/devlink/devlink-trap.rst | 4 +++
MAINTAINERS | 2 +-
drivers/atm/atmtcp.c | 10 ++++++--
drivers/net/bareudp.c | 29 ++++++++++++++++-----
drivers/net/ethernet/cortina/gemini.c | 5 +++-
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 18 +++++--------
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 35 +++++++++++++------------
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 38 ++++++++++++++++++---------
drivers/net/ethernet/ibm/ibmvnic.c | 2 +-
drivers/net/ethernet/intel/e1000e/ich8lan.c | 4 +--
drivers/net/ethernet/intel/igb/igb_main.c | 9 +++++++
drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c | 3 +++
drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c | 2 ++
drivers/net/ethernet/mediatek/mtk_eth_soc.c | 21 +++++++++++----
drivers/net/ethernet/mellanox/mlx4/main.c | 2 ++
drivers/net/ethernet/mellanox/mlx5/core/en/rep/bond.c | 7 +++--
drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c | 30 +++++++++++++++-------
drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_geneve.c | 2 ++
drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_gre.c | 2 ++
drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_vxlan.c | 2 ++
drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 31 +++++++++++++++++++----
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 3 +++
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 1 +
drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | 27 ++++++++++++--------
drivers/net/ethernet/mellanox/mlx5/core/eswitch.h | 2 ++
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c | 19 +++++++++-----
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 28 ++++----------------
drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c | 78 ++++++++++++++++++++++++++++++++++++++++++++++----------
drivers/net/ethernet/mellanox/mlxsw/core.c | 8 +++---
drivers/net/ethernet/mellanox/mlxsw/reg.h | 1 +
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c | 59 +++++++++++++++++++-----------------------
drivers/net/ethernet/mellanox/mlxsw/spectrum_trap.c | 14 +++++++---
drivers/net/ethernet/mscc/ocelot.c | 10 ++++----
drivers/net/ethernet/ni/nixge.c | 8 +++---
drivers/net/ethernet/pensando/ionic/ionic_lif.c | 4 ++-
drivers/net/usb/hso.c | 5 +++-
drivers/net/usb/lan78xx.c | 113 +++++++++++++++++++++++----------------------------------------------------------
drivers/net/vxlan.c | 16 +++++++++---
include/linux/mlx5/mlx5_ifc.h | 1 +
include/linux/rhashtable.h | 69 +++++++++++++++++++++++--------------------------
include/net/addrconf.h | 1 +
include/net/devlink.h | 3 +++
include/net/xfrm.h | 15 ++++++-----
kernel/bpf/btf.c | 5 ++++
kernel/bpf/hashtab.c | 12 ++++++---
lib/rhashtable.c | 35 ++++++++++++-------------
net/bpfilter/bpfilter_kern.c | 2 +-
net/compat.c | 2 +-
net/core/devlink.c | 25 +++++++++++++-----
net/ipv4/fib_trie.c | 2 +-
net/ipv6/anycast.c | 17 +++++++++----
net/ipv6/esp6.c | 13 +++++++---
net/ipv6/ipv6_sockglue.c | 1 +
net/ipv6/route.c | 8 +++---
net/key/af_key.c | 11 ++++++--
net/mac80211/cfg.c | 1 +
net/mac80211/mesh.c | 13 ++++++++++
net/mac80211/mesh_pathtbl.c | 1 +
net/mac80211/sta_info.c | 4 +--
net/mac80211/tx.c | 7 ++---
net/mac80211/util.c | 4 +++
net/mptcp/protocol.c | 2 +-
net/rds/recv.c | 3 ++-
net/rxrpc/call_object.c | 27 ++++++++++++++------
net/rxrpc/conn_object.c | 8 +++---
net/rxrpc/recvmsg.c | 2 +-
net/rxrpc/sendmsg.c | 3 +++
net/sched/act_ct.c | 4 +--
net/wireless/nl80211.c | 6 ++---
net/xfrm/espintcp.c | 62 ++++++++++++++++++++++++++++++++++-----------
net/xfrm/xfrm_policy.c | 43 +++++++++++++------------------
net/xfrm/xfrm_user.c | 18 ++++++++-----
tools/testing/selftests/bpf/prog_tests/btf_map_in_map.c | 124 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------
tools/testing/selftests/bpf/test_offload.py | 3 +++
tools/testing/selftests/bpf/verifier/event_output.c | 1 +
tools/testing/selftests/net/forwarding/ethtool.sh | 2 --
tools/testing/selftests/net/psock_fanout.c | 3 ++-
tools/testing/selftests/net/rxtimestamp.c | 3 +--
tools/testing/selftests/net/so_txtime.c | 2 +-
tools/testing/selftests/net/tcp_mmap.c | 6 ++---
81 files changed, 782 insertions(+), 451 deletions(-)
^ permalink raw reply
* Re: [PATCH net-next RFC 01/13] devlink: Add reload level option to devlink reload command
From: Moshe Shemesh @ 2020-08-01 21:32 UTC (permalink / raw)
To: Jakub Kicinski
Cc: Jacob Keller, Jiri Pirko, netdev, linux-kernel, David S. Miller,
Jiri Pirko, Vasundhara Volam
In-Reply-To: <20200730161101.48f42c5b@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
On 7/31/2020 2:11 AM, Jakub Kicinski wrote:
> On Thu, 30 Jul 2020 15:30:45 +0300 Moshe Shemesh wrote:
>>>>> My expectations would be that the driver must perform the lowest
>>>>> reset level possible that satisfies the requested functional change.
>>>>> IOW driver may do more, in fact it should be acceptable for the
>>>>> driver to always for a full HW reset (unless --live or other
>>>>> constraint is specified).
>>>> OK, but some combinations may still not be valid for specific driver
>>>> even if it tries lowest level possible.
>>> Can you give an example?
>> For example take the combination of fw-live-patch and param-init.
>>
>> The fw-live-patch needs no re-initialization, while the param-init
>> requires driver re-initialization.
>>
>> So the only way to do that is to the one command after the other, not
>> really combining.
> You need to read my responses more carefully. I don't have
> fw-live-patch in my proposal. The operation is fw-activate,
> --live is independent and an constraint, not an operation.
OK, I probably didn't get the whole picture right.
I am not sure I got it yet, please review if that's the uAPI that you
mean to:
devlink dev reload [ net-ns-respawn { PID | NAME | ID } ] [
driver-param-init ] [ fw-activate [ --live] ]
Also, I recall that before devlink param was added the devlink reload
was used for devlink resources.
I am not sure it is still used for devlink resources as I don't see it
in the code of devlink reload.
But if it is we probably should add it as another operation.
Jiri, please comment on that.
^ permalink raw reply
* Re: [PATCH v3 2/6] dt-bindings: net: can: binding for CTU CAN FD open-source IP core.
From: Pavel Pisa @ 2020-08-01 21:27 UTC (permalink / raw)
To: Rob Herring
Cc: c.emde, devicetree, mkl, linux-can, socketcan, wg, davem,
mark.rutland, netdev, linux-kernel, martin.jerabek01, ondrej.ille,
jnovak, jara.beran, porazil
In-Reply-To: <202007290112.32007.pisa@cmp.felk.cvut.cz>
Hello Rob ad others,
On Wednesday 29 of July 2020 01:12:31 Pavel Pisa wrote:
> On Saturday 04 of January 2020 00:53:59 Rob Herring wrote:
> > On Sat, Dec 21, 2019 at 03:07:31PM +0100, pisa@cmp.felk.cvut.cz wrote:
> > > From: Pavel Pisa <pisa@cmp.felk.cvut.cz>
> > >
> > > Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
> > > ---
> > > .../devicetree/bindings/net/can/ctu,ctucanfd.txt | 61
> > > ++++++++++++++++++++++ 1 file changed, 61 insertions(+)
> > > create mode 100644
> > > Documentation/devicetree/bindings/net/can/ctu,ctucanfd.txt
> >
> > Bindings are moving DT schema format now. Not something I'd require on a
> > respin I've already reviewed, but OTOH it's been 10 months to respin
> > from v2. So:
> >
> > Reviewed-by: Rob Herring <robh@kernel.org>
> >
> > If you have a v4, then please convert to a schema.
>
...
> I am trying to resolve that only one review feedback which I have received
> before v4 patches sending. I have spent half day to update and integrate
> self build packages to my stable Debian to can run
>
> make -k dt_binding_check
>
> but unfortunately, I have not achieved promissing result even when tested
> on Linux kernel unpatched sources. I used actual git
> dt-schema/dt-doc-validate with 5.4 kernel build but I get only long series
> of
I have succeed to run make dt_binding_check on stable Debian with 5.4
kernel with only denumerable bunch of errors, probably normal one.
Details to make dt_binding_check usable on stable Debian later.
When invoked with base directory specified
/usr/local/bin/dt-doc-validate -u /usr/src/linux-5.4/Documentation/devicetree/bindings/ net/can/ctu,ctucanfd.yaml
then no problem is reported in ctu,ctucanfd.yaml .
Please is the specification correct even after human check?
> pi@baree:/usr/src/linux-5.4-rt/_build/arm/px6$ make dt_binding_check -k
> GNUmakefile:40: *** mixed implicit and normal rules: deprecated syntax
> make -C /usr/src/linux-5.4-rt O=/usr/src/linux-5.4-rt/_build/arm/px6/
> ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- QTDIR=/usr/share/qt4
> dt_binding_check CHKDT Documentation/devicetree/bindings/arm/actions.yaml
> /usr/src/linux-5.4-rt/Documentation/devicetree/bindings/arm/actions.yaml:
> found incompatible YAML document in "<unicode string>", line 2, column 1
> make[3]: ***
The remark to save time of others, actual stable Debian Buster provides package
python3-ruamel.yaml in 0.15.34-1+b1 version. But use of make dt_binding_check
and dt-doc-validate and dt-validate with this version lead to many errors
"found incompatible YAML document". The validation tools can be make
to work when next packages are added and replaced in stable Debian
python3-pyrsistent 0.15.5-1
python3-pyfakefs 4.0.2-1
python3-zipp 1.0.0-3
python3-importlib-metadata 1.6.0
python3-jsonschema 3.2.0-3
python3-ruamel.yaml.clib 0.2.0-3
python3-ruamel.yaml 0.16.10-2
The dependencies and interdependence of the tools are really wide and that
the tools are unusable in the actual regular Debian stable distribution
should be described somewhere visible enough to save developers
time.
Best wishes,
Pavel
--
Pavel Pisa
phone: +420 603531357
e-mail: pisa@cmp.felk.cvut.cz
Department of Control Engineering FEE CVUT
Karlovo namesti 13, 121 35, Prague 2
university: http://dce.fel.cvut.cz/
personal: http://cmp.felk.cvut.cz/~pisa
projects: https://www.openhub.net/accounts/ppisa
CAN related:http://canbus.pages.fel.cvut.cz/
^ permalink raw reply
* [net-next:master 152/153] net/core/fib_rules.c:26:7: warning: "CONFIG_IP_MULTIPLE_TABLES" is not defined, evaluates to 0
From: kernel test robot @ 2020-08-01 21:09 UTC (permalink / raw)
To: Brian Vazquez; +Cc: kbuild-all, netdev
[-- Attachment #1: Type: text/plain, Size: 1771 bytes --]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git master
head: 7126bd5c8bcbc015cf89864cf71d750e8f33f924
commit: 8b66a6fd34f519f4ad42c4ab0152c3c0782a7dbd [152/153] fib: fix another fib_rules_ops indirect call wrapper problem
config: openrisc-randconfig-r026-20200802 (attached as .config)
compiler: or1k-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 8b66a6fd34f519f4ad42c4ab0152c3c0782a7dbd
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=openrisc
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> net/core/fib_rules.c:26:7: warning: "CONFIG_IP_MULTIPLE_TABLES" is not defined, evaluates to 0 [-Wundef]
26 | #elif CONFIG_IP_MULTIPLE_TABLES
| ^~~~~~~~~~~~~~~~~~~~~~~~~
vim +/CONFIG_IP_MULTIPLE_TABLES +26 net/core/fib_rules.c
18
19 #ifdef CONFIG_IPV6_MULTIPLE_TABLES
20 #ifdef CONFIG_IP_MULTIPLE_TABLES
21 #define INDIRECT_CALL_MT(f, f2, f1, ...) \
22 INDIRECT_CALL_INET(f, f2, f1, __VA_ARGS__)
23 #else
24 #define INDIRECT_CALL_MT(f, f2, f1, ...) INDIRECT_CALL_1(f, f2, __VA_ARGS__)
25 #endif
> 26 #elif CONFIG_IP_MULTIPLE_TABLES
27 #define INDIRECT_CALL_MT(f, f2, f1, ...) INDIRECT_CALL_1(f, f1, __VA_ARGS__)
28 #else
29 #define INDIRECT_CALL_MT(f, f2, f1, ...) f(__VA_ARGS__)
30 #endif
31
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 20530 bytes --]
^ permalink raw reply
* [PATCH 2/2 v2 net-next] lib8390: Fix coding-style issues and remove verion printing
From: Armin Wolf @ 2020-08-01 20:54 UTC (permalink / raw)
To: davem; +Cc: netdev
Fix various checkpatch warnings.
Remove version printing so modules including lib8390 do not
have to provide a global version string for successful
compilation.
Replace pr_cont() with SMP-safe construct.
Signed-off-by: Armin Wolf <W_Armin@gmx.de>
---
drivers/net/ethernet/8390/lib8390.c | 606 ++++++++++++++--------------
1 file changed, 301 insertions(+), 305 deletions(-)
diff --git a/drivers/net/ethernet/8390/lib8390.c b/drivers/net/ethernet/8390/lib8390.c
index babc92e2692e..e13693b20660 100644
--- a/drivers/net/ethernet/8390/lib8390.c
+++ b/drivers/net/ethernet/8390/lib8390.c
@@ -1,54 +1,51 @@
-/* 8390.c: A general NS8390 ethernet driver core for linux. */
-/*
- Written 1992-94 by Donald Becker.
-
- Copyright 1993 United States Government as represented by the
- Director, National Security Agency.
-
- This software may be used and distributed according to the terms
- of the GNU General Public License, incorporated herein by reference.
-
- The author may be reached as becker@scyld.com, or C/O
- Scyld Computing Corporation
- 410 Severn Ave., Suite 210
- Annapolis MD 21403
-
-
- This is the chip-specific code for many 8390-based ethernet adaptors.
- This is not a complete driver, it must be combined with board-specific
- code such as ne.c, wd.c, 3c503.c, etc.
-
- Seeing how at least eight drivers use this code, (not counting the
- PCMCIA ones either) it is easy to break some card by what seems like
- a simple innocent change. Please contact me or Donald if you think
- you have found something that needs changing. -- PG
-
-
- Changelog:
-
- Paul Gortmaker : remove set_bit lock, other cleanups.
- Paul Gortmaker : add ei_get_8390_hdr() so we can pass skb's to
- ei_block_input() for eth_io_copy_and_sum().
- Paul Gortmaker : exchange static int ei_pingpong for a #define,
- also add better Tx error handling.
- Paul Gortmaker : rewrite Rx overrun handling as per NS specs.
- Alexey Kuznetsov : use the 8390's six bit hash multicast filter.
- Paul Gortmaker : tweak ANK's above multicast changes a bit.
- Paul Gortmaker : update packet statistics for v2.1.x
- Alan Cox : support arbitrary stupid port mappings on the
- 68K Macintosh. Support >16bit I/O spaces
- Paul Gortmaker : add kmod support for auto-loading of the 8390
- module by all drivers that require it.
- Alan Cox : Spinlocking work, added 'BUG_83C690'
- Paul Gortmaker : Separate out Tx timeout code from Tx path.
- Paul Gortmaker : Remove old unused single Tx buffer code.
- Hayato Fujiwara : Add m32r support.
- Paul Gortmaker : use skb_padto() instead of stack scratch area
-
- Sources:
- The National Semiconductor LAN Databook, and the 3Com 3c503 databook.
-
- */
+/* lib8390.c: A general NS8390 ethernet driver core for linux. */
+/* Written 1992-94 by Donald Becker.
+ *
+ * Copyright 1993 United States Government as represented by the
+ * Director, National Security Agency.
+ *
+ * This software may be used and distributed according to the terms
+ * of the GNU General Public License, incorporated herein by reference.
+ *
+ * The author may be reached as becker@scyld.com, or C/O
+ * Scyld Computing Corporation
+ * 410 Severn Ave., Suite 210
+ * Annapolis MD 21403
+ *
+ * This is the chip-specific code for many 8390-based ethernet adaptors.
+ * This is not a complete driver, it must be combined with board-specific
+ * code such as ne.c, wd.c, 3c503.c, etc.
+ *
+ * Seeing how at least eight drivers use this code, (not counting the
+ * PCMCIA ones either) it is easy to break some card by what seems like
+ * a simple innocent change. Please contact me or Donald if you think
+ * you have found something that needs changing. -- PG
+ */
+
+/* Changelog:
+ *
+ * Paul Gortmaker : remove set_bit lock, other cleanups.
+ * Paul Gortmaker : add ei_get_8390_hdr() so we can pass skb's to
+ * ei_block_input() for eth_io_copy_and_sum().
+ * Paul Gortmaker : exchange static int ei_pingpong for a #define,
+ * also add better Tx error handling.
+ * Paul Gortmaker : rewrite Rx overrun handling as per NS specs.
+ * Alexey Kuznetsov : use the 8390's six bit hash multicast filter.
+ * Paul Gortmaker : tweak ANK's above multicast changes a bit.
+ * Paul Gortmaker : update packet statistics for v2.1.x
+ * Alan Cox : support arbitrary stupid port mappings on the
+ * 68K Macintosh. Support >16bit I/O spaces
+ * Paul Gortmaker : add kmod support for auto-loading of the 8390
+ * module by all drivers that require it.
+ * Alan Cox : Spinlocking work, added 'BUG_83C690'
+ * Paul Gortmaker : Separate out Tx timeout code from Tx path.
+ * Paul Gortmaker : Remove old unused single Tx buffer code.
+ * Hayato Fujiwara : Add m32r support.
+ * Paul Gortmaker : use skb_padto() instead of stack scratch area
+ *
+ * Sources:
+ * The National Semiconductor LAN Databook, and the 3Com 3c503 databook.
+ */
#include <linux/module.h>
#include <linux/kernel.h>
@@ -77,23 +74,25 @@
#define BUG_83C690
/* These are the operational function interfaces to board-specific
- routines.
- void reset_8390(struct net_device *dev)
- Resets the board associated with DEV, including a hardware reset of
- the 8390. This is only called when there is a transmit timeout, and
- it is always followed by 8390_init().
- void block_output(struct net_device *dev, int count, const unsigned char *buf,
- int start_page)
- Write the COUNT bytes of BUF to the packet buffer at START_PAGE. The
- "page" value uses the 8390's 256-byte pages.
- void get_8390_hdr(struct net_device *dev, struct e8390_hdr *hdr, int ring_page)
- Read the 4 byte, page aligned 8390 header. *If* there is a
- subsequent read, it will be of the rest of the packet.
- void block_input(struct net_device *dev, int count, struct sk_buff *skb, int ring_offset)
- Read COUNT bytes from the packet buffer into the skb data area. Start
- reading from RING_OFFSET, the address as the 8390 sees it. This will always
- follow the read of the 8390 header.
-*/
+ * routines.
+ * void reset_8390(struct net_device *dev)
+ * Resets the board associated with DEV, including a hardware reset
+ * of the 8390. This is only called when there is a transmit
+ * timeout, and it is always followed by 8390_init().
+ * void block_output(struct net_device *dev, int count,
+ * const unsigned char *buf, int start_page)
+ * Write the COUNT bytes of BUF to the packet buffer at START_PAGE.
+ * The "page" value uses the 8390's 256-byte pages.
+ * void get_8390_hdr(struct net_device *dev, struct e8390_hdr *hdr,
+ * int ring_page)
+ * Read the 4 byte, page aligned 8390 header. *If* there is a
+ * subsequent read, it will be of the rest of the packet.
+ * void block_input(struct net_device *dev, int count,
+ * struct sk_buff *skb, int ring_offset)
+ * Read COUNT bytes from the packet buffer into the skb data area.
+ * Start reading from RING_OFFSET, the address as the 8390 sees it.
+ * This will always follow the read of the 8390 header.
+ */
#define ei_reset_8390 (ei_local->reset_8390)
#define ei_block_output (ei_local->block_output)
#define ei_block_input (ei_local->block_input)
@@ -106,90 +105,86 @@ static void ei_receive(struct net_device *dev);
static void ei_rx_overrun(struct net_device *dev);
/* Routines generic to NS8390-based boards. */
-static void NS8390_trigger_send(struct net_device *dev, unsigned int length,
- int start_page);
+static void NS8390_trigger_send(struct net_device *dev,
+ unsigned int length, int start_page);
static void do_set_multicast_list(struct net_device *dev);
static void __NS8390_init(struct net_device *dev, int startp);
-static unsigned version_printed;
static u32 msg_enable;
+
module_param(msg_enable, uint, 0444);
MODULE_PARM_DESC(msg_enable, "Debug message level (see linux/netdevice.h for bitmap)");
-/*
- * SMP and the 8390 setup.
+/* SMP and the 8390 setup.
*
- * The 8390 isn't exactly designed to be multithreaded on RX/TX. There is
- * a page register that controls bank and packet buffer access. We guard
- * this with ei_local->page_lock. Nobody should assume or set the page other
- * than zero when the lock is not held. Lock holders must restore page 0
- * before unlocking. Even pure readers must take the lock to protect in
- * page 0.
+ * The 8390 isn't exactly designed to be multithreaded on RX/TX. There is
+ * a page register that controls bank and packet buffer access. We guard
+ * this with ei_local->page_lock. Nobody should assume or set the page other
+ * than zero when the lock is not held. Lock holders must restore page 0
+ * before unlocking. Even pure readers must take the lock to protect in
+ * page 0.
*
- * To make life difficult the chip can also be very slow. We therefore can't
- * just use spinlocks. For the longer lockups we disable the irq the device
- * sits on and hold the lock. We must hold the lock because there is a dual
- * processor case other than interrupts (get stats/set multicast list in
- * parallel with each other and transmit).
+ * To make life difficult the chip can also be very slow. We therefore can't
+ * just use spinlocks. For the longer lockups we disable the irq the device
+ * sits on and hold the lock. We must hold the lock because there is a dual
+ * processor case other than interrupts (get stats/set multicast list in
+ * parallel with each other and transmit).
*
- * Note: in theory we can just disable the irq on the card _but_ there is
- * a latency on SMP irq delivery. So we can easily go "disable irq" "sync irqs"
- * enter lock, take the queued irq. So we waddle instead of flying.
+ * Note: in theory we can just disable the irq on the card _but_ there is
+ * a latency on SMP irq delivery. So we can easily go "disable irq" "sync irqs"
+ * enter lock, take the queued irq. So we waddle instead of flying.
*
- * Finally by special arrangement for the purpose of being generally
- * annoying the transmit function is called bh atomic. That places
- * restrictions on the user context callers as disable_irq won't save
- * them.
+ * Finally by special arrangement for the purpose of being generally
+ * annoying the transmit function is called bh atomic. That places
+ * restrictions on the user context callers as disable_irq won't save
+ * them.
*
- * Additional explanation of problems with locking by Alan Cox:
+ * Additional explanation of problems with locking by Alan Cox:
*
- * "The author (me) didn't use spin_lock_irqsave because the slowness of the
- * card means that approach caused horrible problems like losing serial data
- * at 38400 baud on some chips. Remember many 8390 nics on PCI were ISA
- * chips with FPGA front ends.
+ * "The author (me) didn't use spin_lock_irqsave because the slowness of the
+ * card means that approach caused horrible problems like losing serial data
+ * at 38400 baud on some chips. Remember many 8390 nics on PCI were ISA
+ * chips with FPGA front ends.
*
- * Ok the logic behind the 8390 is very simple:
+ * Ok the logic behind the 8390 is very simple:
*
- * Things to know
- * - IRQ delivery is asynchronous to the PCI bus
- * - Blocking the local CPU IRQ via spin locks was too slow
- * - The chip has register windows needing locking work
+ * Things to know
+ * - IRQ delivery is asynchronous to the PCI bus
+ * - Blocking the local CPU IRQ via spin locks was too slow
+ * - The chip has register windows needing locking work
*
- * So the path was once (I say once as people appear to have changed it
- * in the mean time and it now looks rather bogus if the changes to use
- * disable_irq_nosync_irqsave are disabling the local IRQ)
+ * So the path was once (I say once as people appear to have changed it
+ * in the mean time and it now looks rather bogus if the changes to use
+ * disable_irq_nosync_irqsave are disabling the local IRQ)
*
+ * Take the page lock
+ * Mask the IRQ on chip
+ * Disable the IRQ (but not mask locally- someone seems to have
+ * broken this with the lock validator stuff)
+ * [This must be _nosync as the page lock may otherwise deadlock us]
*
- * Take the page lock
- * Mask the IRQ on chip
- * Disable the IRQ (but not mask locally- someone seems to have
- * broken this with the lock validator stuff)
- * [This must be _nosync as the page lock may otherwise
- * deadlock us]
- * Drop the page lock and turn IRQs back on
+ * Drop the page lock and turn IRQs back on
*
- * At this point an existing IRQ may still be running but we can't
- * get a new one
+ * At this point an existing IRQ may still be running but we can't
+ * get a new one
*
- * Take the lock (so we know the IRQ has terminated) but don't mask
+ * Take the lock (so we know the IRQ has terminated) but don't mask
* the IRQs on the processor
- * Set irqlock [for debug]
*
- * Transmit (slow as ****)
+ * Set irqlock [for debug]
*
- * re-enable the IRQ
+ * Transmit (slow as ****)
*
+ * re-enable the IRQ
*
- * We have to use disable_irq because otherwise you will get delayed
- * interrupts on the APIC bus deadlocking the transmit path.
+ * We have to use disable_irq because otherwise you will get delayed
+ * interrupts on the APIC bus deadlocking the transmit path.
*
- * Quite hairy but the chip simply wasn't designed for SMP and you can't
- * even ACK an interrupt without risking corrupting other parallel
- * activities on the chip." [lkml, 25 Jul 2007]
+ * Quite hairy but the chip simply wasn't designed for SMP and you can't
+ * even ACK an interrupt without risking corrupting other parallel
+ * activities on the chip." [lkml, 25 Jul 2007]
*/
-
-
/**
* ei_open - Open/initialize the board.
* @dev: network device to initialize
@@ -206,15 +201,15 @@ static int __ei_open(struct net_device *dev)
if (dev->watchdog_timeo <= 0)
dev->watchdog_timeo = TX_TIMEOUT;
- /*
- * Grab the page lock so we own the register set, then call
- * the init function.
+ /* Grab the page lock so we own the register set, then call
+ * the init function.
*/
spin_lock_irqsave(&ei_local->page_lock, flags);
__NS8390_init(dev, 1);
/* Set the flag before we drop the lock, That way the IRQ arrives
- after its set and we get no silly warnings */
+ * after its set and we get no silly warnings
+ */
netif_start_queue(dev);
spin_unlock_irqrestore(&ei_local->page_lock, flags);
ei_local->irqlock = 0;
@@ -232,9 +227,7 @@ static int __ei_close(struct net_device *dev)
struct ei_device *ei_local = netdev_priv(dev);
unsigned long flags;
- /*
- * Hold the page lock during close
- */
+ /* Hold the page lock during close */
spin_lock_irqsave(&ei_local->page_lock, flags);
__NS8390_init(dev, 0);
@@ -261,8 +254,8 @@ static void __ei_tx_timeout(struct net_device *dev, unsigned int txqueue)
dev->stats.tx_errors++;
spin_lock_irqsave(&ei_local->page_lock, flags);
- txsr = ei_inb(e8390_base+EN0_TSR);
- isr = ei_inb(e8390_base+EN0_ISR);
+ txsr = ei_inb(e8390_base + EN0_TSR);
+ isr = ei_inb(e8390_base + EN0_ISR);
spin_unlock_irqrestore(&ei_local->page_lock, flags);
netdev_dbg(dev, "Tx timed out, %s TSR=%#2x, ISR=%#2x, t=%d\n",
@@ -308,25 +301,24 @@ static netdev_tx_t __ei_start_xmit(struct sk_buff *skb,
char *data = skb->data;
if (skb->len < ETH_ZLEN) {
- memset(buf, 0, ETH_ZLEN); /* more efficient than doing just the needed bits */
+ /* More efficient than doing just the needed bits */
+ memset(buf, 0, ETH_ZLEN);
memcpy(buf, data, skb->len);
send_length = ETH_ZLEN;
data = buf;
}
/* Mask interrupts from the ethercard.
- SMP: We have to grab the lock here otherwise the IRQ handler
- on another CPU can flip window and race the IRQ mask set. We end
- up trashing the mcast filter not disabling irqs if we don't lock */
+ * SMP: We have to grab the lock here otherwise the IRQ handler
+ * on another CPU can flip window and race the IRQ mask set. We end
+ * up trashing the mcast filter not disabling irqs if we don't lock.
+ */
spin_lock_irqsave(&ei_local->page_lock, flags);
ei_outb_p(0x00, e8390_base + EN0_IMR);
spin_unlock_irqrestore(&ei_local->page_lock, flags);
-
- /*
- * Slow phase with lock held.
- */
+ /* Slow phase with lock held. */
disable_irq_nosync_lockdep_irqsave(dev->irq, &flags);
@@ -334,8 +326,7 @@ static netdev_tx_t __ei_start_xmit(struct sk_buff *skb,
ei_local->irqlock = 1;
- /*
- * We have two Tx slots available for use. Find the first free
+ /* We have two Tx slots available for use. Find the first free
* slot, and then perform some sanity checks. With two Tx bufs,
* you get very close to transmitting back-to-back packets. With
* only one Tx buf, the transmitter sits idle while you reload the
@@ -347,18 +338,18 @@ static netdev_tx_t __ei_start_xmit(struct sk_buff *skb,
ei_local->tx1 = send_length;
if ((netif_msg_tx_queued(ei_local)) &&
ei_local->tx2 > 0)
- netdev_dbg(dev,
- "idle transmitter tx2=%d, lasttx=%d, txing=%d\n",
- ei_local->tx2, ei_local->lasttx, ei_local->txing);
+ netdev_dbg(dev, "idle transmitter tx2=%d, lasttx=%d, txing=%d\n",
+ ei_local->tx2, ei_local->lasttx,
+ ei_local->txing);
} else if (ei_local->tx2 == 0) {
- output_page = ei_local->tx_start_page + TX_PAGES/2;
+ output_page = ei_local->tx_start_page + TX_PAGES / 2;
ei_local->tx2 = send_length;
if ((netif_msg_tx_queued(ei_local)) &&
ei_local->tx1 > 0)
- netdev_dbg(dev,
- "idle transmitter, tx1=%d, lasttx=%d, txing=%d\n",
- ei_local->tx1, ei_local->lasttx, ei_local->txing);
- } else { /* We should never get here. */
+ netdev_dbg(dev, "idle transmitter, tx1=%d, lasttx=%d, txing=%d\n",
+ ei_local->tx1, ei_local->lasttx,
+ ei_local->txing);
+ } else { /* We should never get here. */
netif_dbg(ei_local, tx_err, dev,
"No Tx buffers free! tx1=%d tx2=%d last=%d\n",
ei_local->tx1, ei_local->tx2, ei_local->lasttx);
@@ -371,8 +362,7 @@ static netdev_tx_t __ei_start_xmit(struct sk_buff *skb,
return NETDEV_TX_BUSY;
}
- /*
- * Okay, now upload the packet and trigger a send if the transmitter
+ /* Okay, now upload the packet and trigger a send if the transmitter
* isn't already sending. If it is busy, the interrupt handler will
* trigger the send later, upon receiving a Tx done interrupt.
*/
@@ -389,8 +379,9 @@ static netdev_tx_t __ei_start_xmit(struct sk_buff *skb,
ei_local->tx2 = -1;
ei_local->lasttx = -2;
}
- } else
+ } else {
ei_local->txqueue++;
+ }
if (ei_local->tx1 && ei_local->tx2)
netif_stop_queue(dev);
@@ -429,15 +420,12 @@ static irqreturn_t __ei_interrupt(int irq, void *dev_id)
int interrupts, nr_serviced = 0;
struct ei_device *ei_local = netdev_priv(dev);
- /*
- * Protect the irq test too.
- */
+ /* Protect the irq test too. */
spin_lock(&ei_local->page_lock);
if (ei_local->irqlock) {
- /*
- * This might just be an interrupt for a PCI device sharing
+ /* This might just be an interrupt for a PCI device sharing
* this line
*/
netdev_err(dev, "Interrupted while interrupts are masked! isr=%#2x imr=%#2x\n",
@@ -448,7 +436,7 @@ static irqreturn_t __ei_interrupt(int irq, void *dev_id)
}
/* Change to page 0 and read the intr status reg. */
- ei_outb_p(E8390_NODMA+E8390_PAGE0, e8390_base + E8390_CMD);
+ ei_outb_p(E8390_NODMA + E8390_PAGE0, e8390_base + E8390_CMD);
netif_dbg(ei_local, intr, dev, "interrupt(isr=%#2.2x)\n",
ei_inb_p(e8390_base + EN0_ISR));
@@ -462,9 +450,9 @@ static irqreturn_t __ei_interrupt(int irq, void *dev_id)
interrupts = 0;
break;
}
- if (interrupts & ENISR_OVER)
+ if (interrupts & ENISR_OVER) {
ei_rx_overrun(dev);
- else if (interrupts & (ENISR_RX+ENISR_RX_ERR)) {
+ } else if (interrupts & (ENISR_RX + ENISR_RX_ERR)) {
/* Got a good (?) packet. */
ei_receive(dev);
}
@@ -475,30 +463,39 @@ static irqreturn_t __ei_interrupt(int irq, void *dev_id)
ei_tx_err(dev);
if (interrupts & ENISR_COUNTERS) {
- dev->stats.rx_frame_errors += ei_inb_p(e8390_base + EN0_COUNTER0);
- dev->stats.rx_crc_errors += ei_inb_p(e8390_base + EN0_COUNTER1);
- dev->stats.rx_missed_errors += ei_inb_p(e8390_base + EN0_COUNTER2);
- ei_outb_p(ENISR_COUNTERS, e8390_base + EN0_ISR); /* Ack intr. */
+ dev->stats.rx_frame_errors +=
+ ei_inb_p(e8390_base + EN0_COUNTER0);
+ dev->stats.rx_crc_errors +=
+ ei_inb_p(e8390_base + EN0_COUNTER1);
+ dev->stats.rx_missed_errors +=
+ ei_inb_p(e8390_base + EN0_COUNTER2);
+ /* Ack intr. */
+ ei_outb_p(ENISR_COUNTERS, e8390_base + EN0_ISR);
}
/* Ignore any RDC interrupts that make it back to here. */
if (interrupts & ENISR_RDC)
ei_outb_p(ENISR_RDC, e8390_base + EN0_ISR);
- ei_outb_p(E8390_NODMA+E8390_PAGE0+E8390_START, e8390_base + E8390_CMD);
+ ei_outb_p(E8390_NODMA + E8390_PAGE0 + E8390_START,
+ e8390_base + E8390_CMD);
}
if (interrupts && (netif_msg_intr(ei_local))) {
- ei_outb_p(E8390_NODMA+E8390_PAGE0+E8390_START, e8390_base + E8390_CMD);
+ ei_outb_p(E8390_NODMA + E8390_PAGE0 + E8390_START,
+ e8390_base + E8390_CMD);
if (nr_serviced >= MAX_SERVICE) {
/* 0xFF is valid for a card removal */
if (interrupts != 0xFF)
netdev_warn(dev, "Too much work at interrupt, status %#2.2x\n",
interrupts);
- ei_outb_p(ENISR_ALL, e8390_base + EN0_ISR); /* Ack. most intrs. */
+ /* Ack. most intrs. */
+ ei_outb_p(ENISR_ALL, e8390_base + EN0_ISR);
} else {
- netdev_warn(dev, "unknown interrupt %#2x\n", interrupts);
- ei_outb_p(0xff, e8390_base + EN0_ISR); /* Ack. all intrs. */
+ netdev_warn(dev, "unknown interrupt %#2x\n",
+ interrupts);
+ /* Ack. all intrs. */
+ ei_outb_p(0xff, e8390_base + EN0_ISR);
}
}
spin_unlock(&ei_local->page_lock);
@@ -532,30 +529,22 @@ static void ei_tx_err(struct net_device *dev)
{
unsigned long e8390_base = dev->base_addr;
/* ei_local is used on some platforms via the EI_SHIFT macro */
- struct ei_device *ei_local __maybe_unused = netdev_priv(dev);
- unsigned char txsr = ei_inb_p(e8390_base+EN0_TSR);
- unsigned char tx_was_aborted = txsr & (ENTSR_ABT+ENTSR_FU);
-
-#ifdef VERBOSE_ERROR_DUMP
- netdev_dbg(dev, "transmitter error (%#2x):", txsr);
- if (txsr & ENTSR_ABT)
- pr_cont(" excess-collisions ");
- if (txsr & ENTSR_ND)
- pr_cont(" non-deferral ");
- if (txsr & ENTSR_CRS)
- pr_cont(" lost-carrier ");
- if (txsr & ENTSR_FU)
- pr_cont(" FIFO-underrun ");
- if (txsr & ENTSR_CDH)
- pr_cont(" lost-heartbeat ");
- pr_cont("\n");
-#endif
-
+ struct ei_device *ei_local = netdev_priv(dev);
+ unsigned char txsr = ei_inb_p(e8390_base + EN0_TSR);
+ unsigned char tx_was_aborted = txsr & (ENTSR_ABT + ENTSR_FU);
+
+ if (netif_msg_tx_err(ei_local)) {
+ netdev_err(dev, "Transmitter error %#2x ( %s%s%s%s%s)", txsr,
+ (txsr & ENTSR_ABT) ? "excess-collisions " : "",
+ (txsr & ENTSR_ND) ? "non-deferral " : "",
+ (txsr & ENTSR_CRS) ? "lost-carrier " : "",
+ (txsr & ENTSR_FU) ? "FIFO-underrun " : "",
+ (txsr & ENTSR_CDH) ? "lost-heartbeat " : "");
+ }
ei_outb_p(ENISR_TX_ERR, e8390_base + EN0_ISR); /* Ack intr. */
-
- if (tx_was_aborted)
+ if (tx_was_aborted) {
ei_tx_intr(dev);
- else {
+ } else {
dev->stats.tx_errors++;
if (txsr & ENTSR_CRS)
dev->stats.tx_carrier_errors++;
@@ -582,8 +571,7 @@ static void ei_tx_intr(struct net_device *dev)
ei_outb_p(ENISR_TX, e8390_base + EN0_ISR); /* Ack intr. */
- /*
- * There are two Tx buffers, see which one finished, and trigger
+ /* There are two Tx buffers, see which one finished, and trigger
* the send of another one if it exists.
*/
ei_local->txqueue--;
@@ -595,12 +583,14 @@ static void ei_tx_intr(struct net_device *dev)
ei_local->tx1 = 0;
if (ei_local->tx2 > 0) {
ei_local->txing = 1;
- NS8390_trigger_send(dev, ei_local->tx2, ei_local->tx_start_page + 6);
+ NS8390_trigger_send(dev, ei_local->tx2,
+ ei_local->tx_start_page + 6);
netif_trans_update(dev);
ei_local->tx2 = -1,
ei_local->lasttx = 2;
- } else
+ } else {
ei_local->lasttx = 20, ei_local->txing = 0;
+ }
} else if (ei_local->tx2 < 0) {
if (ei_local->lasttx != 2 && ei_local->lasttx != -2)
pr_err("%s: bogus last_tx_buffer %d, tx2=%d\n",
@@ -608,23 +598,27 @@ static void ei_tx_intr(struct net_device *dev)
ei_local->tx2 = 0;
if (ei_local->tx1 > 0) {
ei_local->txing = 1;
- NS8390_trigger_send(dev, ei_local->tx1, ei_local->tx_start_page);
+ NS8390_trigger_send(dev, ei_local->tx1,
+ ei_local->tx_start_page);
netif_trans_update(dev);
ei_local->tx1 = -1;
ei_local->lasttx = 1;
- } else
+ } else {
ei_local->lasttx = 10, ei_local->txing = 0;
- } /* else
- netdev_warn(dev, "unexpected TX-done interrupt, lasttx=%d\n",
- ei_local->lasttx);
-*/
+ }
+ }
+ /* else {
+ * netdev_warn(dev, "unexpected TX-done interrupt, lasttx=%d\n",
+ * ei_local->lasttx);
+ * }
+ */
/* Minimize Tx latency: update the statistics after we restart TXing. */
if (status & ENTSR_COL)
dev->stats.collisions++;
- if (status & ENTSR_PTX)
+ if (status & ENTSR_PTX) {
dev->stats.tx_packets++;
- else {
+ } else {
dev->stats.tx_errors++;
if (status & ENTSR_ABT) {
dev->stats.tx_aborted_errors++;
@@ -658,26 +652,29 @@ static void ei_receive(struct net_device *dev)
unsigned short current_offset;
int rx_pkt_count = 0;
struct e8390_pkt_hdr rx_frame;
- int num_rx_pages = ei_local->stop_page-ei_local->rx_start_page;
+ int num_rx_pages = ei_local->stop_page - ei_local->rx_start_page;
while (++rx_pkt_count < 10) {
int pkt_len, pkt_stat;
/* Get the rx page (incoming packet pointer). */
- ei_outb_p(E8390_NODMA+E8390_PAGE1, e8390_base + E8390_CMD);
+ ei_outb_p(E8390_NODMA + E8390_PAGE1, e8390_base + E8390_CMD);
rxing_page = ei_inb_p(e8390_base + EN1_CURPAG);
- ei_outb_p(E8390_NODMA+E8390_PAGE0, e8390_base + E8390_CMD);
+ ei_outb_p(E8390_NODMA + E8390_PAGE0, e8390_base + E8390_CMD);
- /* Remove one frame from the ring. Boundary is always a page behind. */
+ /* Remove one frame from the ring.
+ * Boundary is always a page behind.
+ */
this_frame = ei_inb_p(e8390_base + EN0_BOUNDARY) + 1;
if (this_frame >= ei_local->stop_page)
this_frame = ei_local->rx_start_page;
- /* Someday we'll omit the previous, iff we never get this message.
- (There is at least one clone claimed to have a problem.)
-
- Keep quiet if it looks like a card removal. One problem here
- is that some clones crash in roughly the same way.
+ /* Someday we'll omit the previous, if we never get
+ * this message. (There is at least one clone claimed
+ * to have a problem.)
+ *
+ * Keep quiet if it looks like a card removal. One problem
+ * here is that some clones crash in roughly the same way.
*/
if ((netif_msg_rx_status(ei_local)) &&
this_frame != ei_local->current_page &&
@@ -695,17 +692,19 @@ static void ei_receive(struct net_device *dev)
pkt_len = rx_frame.count - sizeof(struct e8390_pkt_hdr);
pkt_stat = rx_frame.status;
- next_frame = this_frame + 1 + ((pkt_len+4)>>8);
+ next_frame = this_frame + 1 + ((pkt_len + 4) >> 8);
- /* Check for bogosity warned by 3c503 book: the status byte is never
- written. This happened a lot during testing! This code should be
- cleaned up someday. */
+ /* Check for bogosity warned by 3c503 book: the status byte is
+ * never written. This happened a lot during testing! This code
+ * should be cleaned up someday.
+ */
if (rx_frame.next != next_frame &&
rx_frame.next != next_frame + 1 &&
rx_frame.next != next_frame - num_rx_pages &&
rx_frame.next != next_frame + 1 - num_rx_pages) {
ei_local->current_page = rxing_page;
- ei_outb(ei_local->current_page-1, e8390_base+EN0_BOUNDARY);
+ ei_outb(ei_local->current_page - 1,
+ e8390_base + EN0_BOUNDARY);
dev->stats.rx_errors++;
continue;
}
@@ -721,24 +720,22 @@ static void ei_receive(struct net_device *dev)
struct sk_buff *skb;
skb = netdev_alloc_skb(dev, pkt_len + 2);
- if (skb == NULL) {
- netif_err(ei_local, rx_err, dev,
- "Couldn't allocate a sk_buff of size %d\n",
- pkt_len);
+ if (!skb) {
dev->stats.rx_dropped++;
break;
- } else {
- skb_reserve(skb, 2); /* IP headers on 16 byte boundaries */
- skb_put(skb, pkt_len); /* Make room */
- ei_block_input(dev, pkt_len, skb, current_offset + sizeof(rx_frame));
- skb->protocol = eth_type_trans(skb, dev);
- if (!skb_defer_rx_timestamp(skb))
- netif_rx(skb);
- dev->stats.rx_packets++;
- dev->stats.rx_bytes += pkt_len;
- if (pkt_stat & ENRSR_PHY)
- dev->stats.multicast++;
}
+ /* IP headers on 16 byte boundaries */
+ skb_reserve(skb, 2);
+ skb_put(skb, pkt_len); /* Make room */
+ ei_block_input(dev, pkt_len, skb,
+ current_offset + sizeof(rx_frame));
+ skb->protocol = eth_type_trans(skb, dev);
+ if (!skb_defer_rx_timestamp(skb))
+ netif_rx(skb);
+ dev->stats.rx_packets++;
+ dev->stats.rx_bytes += pkt_len;
+ if (pkt_stat & ENRSR_PHY)
+ dev->stats.multicast++;
} else {
netif_err(ei_local, rx_err, dev,
"bogus packet: status=%#2x nxpg=%#2x size=%d\n",
@@ -751,19 +748,22 @@ static void ei_receive(struct net_device *dev)
}
next_frame = rx_frame.next;
- /* This _should_ never happen: it's here for avoiding bad clones. */
+ /* This _should_ never happen:
+ * it's here for avoiding bad clones.
+ */
if (next_frame >= ei_local->stop_page) {
netdev_notice(dev, "next frame inconsistency, %#2x\n",
next_frame);
next_frame = ei_local->rx_start_page;
}
ei_local->current_page = next_frame;
- ei_outb_p(next_frame-1, e8390_base+EN0_BOUNDARY);
+ ei_outb_p(next_frame - 1, e8390_base + EN0_BOUNDARY);
}
/* We used to also ack ENISR_OVER here, but that would sometimes mask
- a real overrun, leaving the 8390 in a stopped state with rec'vr off. */
- ei_outb_p(ENISR_RX+ENISR_RX_ERR, e8390_base+EN0_ISR);
+ * a real overrun, leaving the 8390 in a stopped state with rec'vr off.
+ */
+ ei_outb_p(ENISR_RX + ENISR_RX_ERR, e8390_base + EN0_ISR);
}
/**
@@ -786,18 +786,16 @@ static void ei_rx_overrun(struct net_device *dev)
/* ei_local is used on some platforms via the EI_SHIFT macro */
struct ei_device *ei_local __maybe_unused = netdev_priv(dev);
- /*
- * Record whether a Tx was in progress and then issue the
+ /* Record whether a Tx was in progress and then issue the
* stop command.
*/
- was_txing = ei_inb_p(e8390_base+E8390_CMD) & E8390_TRANS;
- ei_outb_p(E8390_NODMA+E8390_PAGE0+E8390_STOP, e8390_base+E8390_CMD);
+ was_txing = ei_inb_p(e8390_base + E8390_CMD) & E8390_TRANS;
+ ei_outb_p(E8390_NODMA + E8390_PAGE0 + E8390_STOP, e8390_base + E8390_CMD);
netif_dbg(ei_local, rx_err, dev, "Receiver overrun\n");
dev->stats.rx_over_errors++;
- /*
- * Wait a full Tx time (1.2ms) + some guard time, NS says 1.6ms total.
+ /* Wait a full Tx time (1.2ms) + some guard time, NS says 1.6ms total.
* Early datasheets said to poll the reset bit, but now they say that
* it "is not a reliable indicator and subsequently should be ignored."
* We wait at least 10ms.
@@ -805,47 +803,44 @@ static void ei_rx_overrun(struct net_device *dev)
mdelay(10);
- /*
- * Reset RBCR[01] back to zero as per magic incantation.
- */
- ei_outb_p(0x00, e8390_base+EN0_RCNTLO);
- ei_outb_p(0x00, e8390_base+EN0_RCNTHI);
+ /* Reset RBCR[01] back to zero as per magic incantation. */
+ ei_outb_p(0x00, e8390_base + EN0_RCNTLO);
+ ei_outb_p(0x00, e8390_base + EN0_RCNTHI);
- /*
- * See if any Tx was interrupted or not. According to NS, this
+ /* See if any Tx was interrupted or not. According to NS, this
* step is vital, and skipping it will cause no end of havoc.
*/
if (was_txing) {
- unsigned char tx_completed = ei_inb_p(e8390_base+EN0_ISR) & (ENISR_TX+ENISR_TX_ERR);
+ unsigned char tx_completed = ei_inb_p(e8390_base + EN0_ISR) &
+ (ENISR_TX + ENISR_TX_ERR);
+
if (!tx_completed)
must_resend = 1;
}
- /*
- * Have to enter loopback mode and then restart the NIC before
+ /* Have to enter loopback mode and then restart the NIC before
* you are allowed to slurp packets up off the ring.
*/
+
ei_outb_p(E8390_TXOFF, e8390_base + EN0_TXCR);
- ei_outb_p(E8390_NODMA + E8390_PAGE0 + E8390_START, e8390_base + E8390_CMD);
+ ei_outb_p(E8390_NODMA + E8390_PAGE0 + E8390_START,
+ e8390_base + E8390_CMD);
+
+ /* Clear the Rx ring of all the debris, and ack the interrupt. */
- /*
- * Clear the Rx ring of all the debris, and ack the interrupt.
- */
ei_receive(dev);
- ei_outb_p(ENISR_OVER, e8390_base+EN0_ISR);
+ ei_outb_p(ENISR_OVER, e8390_base + EN0_ISR);
+
+ /* Leave loopback mode, and resend any packet that got stopped */
- /*
- * Leave loopback mode, and resend any packet that got stopped.
- */
ei_outb_p(E8390_TXCONFIG, e8390_base + EN0_TXCR);
if (must_resend)
- ei_outb_p(E8390_NODMA + E8390_PAGE0 + E8390_START + E8390_TRANS, e8390_base + E8390_CMD);
+ ei_outb_p(E8390_NODMA + E8390_PAGE0 + E8390_START + E8390_TRANS,
+ e8390_base + E8390_CMD);
}
-/*
- * Collect the stats. This is called unlocked and from several contexts.
- */
+/* Collect the stats. This is called unlocked and from several contexts. */
static struct net_device_stats *__ei_get_stats(struct net_device *dev)
{
@@ -867,8 +862,7 @@ static struct net_device_stats *__ei_get_stats(struct net_device *dev)
return &dev->stats;
}
-/*
- * Form the 64 bit 8390 multicast table from the linked list of addresses
+/* Form the 64 bit 8390 multicast table from the linked list of addresses
* associated with this dev structure.
*/
@@ -878,11 +872,10 @@ static inline void make_mc_bits(u8 *bits, struct net_device *dev)
netdev_for_each_mc_addr(ha, dev) {
u32 crc = ether_crc(ETH_ALEN, ha->addr);
- /*
- * The 8390 uses the 6 most significant bits of the
+ /* The 8390 uses the 6 most significant bits of the
* CRC to index the multicast table.
*/
- bits[crc>>29] |= (1<<((crc>>26)&7));
+ bits[crc >> 29] |= (1 << ((crc >> 26) & 7));
}
}
@@ -900,15 +893,16 @@ static void do_set_multicast_list(struct net_device *dev)
int i;
struct ei_device *ei_local = netdev_priv(dev);
- if (!(dev->flags&(IFF_PROMISC|IFF_ALLMULTI))) {
+ if (!(dev->flags & (IFF_PROMISC | IFF_ALLMULTI))) {
memset(ei_local->mcfilter, 0, 8);
if (!netdev_mc_empty(dev))
make_mc_bits(ei_local->mcfilter, dev);
- } else
- memset(ei_local->mcfilter, 0xFF, 8); /* mcast set to accept-all */
+ } else {
+ /* mcast set to accept-all */
+ memset(ei_local->mcfilter, 0xFF, 8);
+ }
- /*
- * DP8390 manuals don't specify any magic sequence for altering
+ /* DP8390 manuals don't specify any magic sequence for altering
* the multicast regs on an already running card. To be safe, we
* ensure multicast mode is off prior to loading up the new hash
* table. If this proves to be not enough, we can always resort
@@ -924,16 +918,17 @@ static void do_set_multicast_list(struct net_device *dev)
ei_outb_p(E8390_RXCONFIG, e8390_base + EN0_RXCR);
ei_outb_p(E8390_NODMA + E8390_PAGE1, e8390_base + E8390_CMD);
for (i = 0; i < 8; i++) {
- ei_outb_p(ei_local->mcfilter[i], e8390_base + EN1_MULT_SHIFT(i));
+ ei_outb_p(ei_local->mcfilter[i],
+ e8390_base + EN1_MULT_SHIFT(i));
#ifndef BUG_83C690
- if (ei_inb_p(e8390_base + EN1_MULT_SHIFT(i)) != ei_local->mcfilter[i])
- netdev_err(dev, "Multicast filter read/write mismap %d\n",
- i);
+ if (ei_inb_p(e8390_base + EN1_MULT_SHIFT(i)) !=
+ ei_local->mcfilter[i])
+ netdev_err(dev, "Multicast filter read/write mismap %d\n", i);
#endif
}
ei_outb_p(E8390_NODMA + E8390_PAGE0, e8390_base + E8390_CMD);
- if (dev->flags&IFF_PROMISC)
+ if (dev->flags & IFF_PROMISC)
ei_outb_p(E8390_RXCONFIG | 0x18, e8390_base + EN0_RXCR);
else if (dev->flags & IFF_ALLMULTI || !netdev_mc_empty(dev))
ei_outb_p(E8390_RXCONFIG | 0x08, e8390_base + EN0_RXCR);
@@ -941,10 +936,9 @@ static void do_set_multicast_list(struct net_device *dev)
ei_outb_p(E8390_RXCONFIG, e8390_base + EN0_RXCR);
}
-/*
- * Called without lock held. This is invoked from user context and may
- * be parallel to just about everything else. Its also fairly quick and
- * not called too often. Must protect against both bh and irq users
+/* Called without lock held. This is invoked from user context and may
+ * be parallel to just about everything else. Its also fairly quick and
+ * not called too often. Must protect against both bh and irq users
*/
static void __ei_set_multicast_list(struct net_device *dev)
@@ -969,9 +963,6 @@ static void ethdev_setup(struct net_device *dev)
{
struct ei_device *ei_local = netdev_priv(dev);
- if ((msg_enable & NETIF_MSG_DRV) && (version_printed++ == 0))
- pr_info("%s", version);
-
ether_setup(dev);
spin_lock_init(&ei_local->page_lock);
@@ -991,9 +982,6 @@ static struct net_device *____alloc_ei_netdev(int size)
NET_NAME_UNKNOWN, ethdev_setup);
}
-
-
-
/* This page of functions should be 8390 generic */
/* Follow National Semi's recommendations for initializing the "NIC". */
@@ -1017,7 +1005,8 @@ static void __NS8390_init(struct net_device *dev, int startp)
if (sizeof(struct e8390_pkt_hdr) != 4)
panic("8390.c: header struct mispacked\n");
/* Follow National Semi's recommendations for initing the DP83902. */
- ei_outb_p(E8390_NODMA+E8390_PAGE0+E8390_STOP, e8390_base+E8390_CMD); /* 0x21 */
+ ei_outb_p(E8390_NODMA + E8390_PAGE0 + E8390_STOP,
+ e8390_base + E8390_CMD); /* 0x21 */
ei_outb_p(endcfg, e8390_base + EN0_DCFG); /* 0x48 or 0x49 */
/* Clear the remote byte count registers. */
ei_outb_p(0x00, e8390_base + EN0_RCNTLO);
@@ -1027,10 +1016,13 @@ static void __NS8390_init(struct net_device *dev, int startp)
ei_outb_p(E8390_TXOFF, e8390_base + EN0_TXCR); /* 0x02 */
/* Set the transmit page and receive ring. */
ei_outb_p(ei_local->tx_start_page, e8390_base + EN0_TPSR);
- ei_local->tx1 = ei_local->tx2 = 0;
+ ei_local->tx1 = 0;
+ ei_local->tx2 = 0;
ei_outb_p(ei_local->rx_start_page, e8390_base + EN0_STARTPG);
- ei_outb_p(ei_local->stop_page-1, e8390_base + EN0_BOUNDARY); /* 3c503 says 0x3f,NS0x26*/
- ei_local->current_page = ei_local->rx_start_page; /* assert boundary+1 */
+ /* 3c503 says 0x3f,NS0x26*/
+ ei_outb_p(ei_local->stop_page - 1, e8390_base + EN0_BOUNDARY);
+ /* assert boundary+1 */
+ ei_local->current_page = ei_local->rx_start_page;
ei_outb_p(ei_local->stop_page, e8390_base + EN0_STOPPG);
/* Clear the pending interrupts and mask. */
ei_outb_p(0xFF, e8390_base + EN0_ISR);
@@ -1038,25 +1030,28 @@ static void __NS8390_init(struct net_device *dev, int startp)
/* Copy the station address into the DS8390 registers. */
- ei_outb_p(E8390_NODMA + E8390_PAGE1 + E8390_STOP, e8390_base+E8390_CMD); /* 0x61 */
+ ei_outb_p(E8390_NODMA + E8390_PAGE1 + E8390_STOP,
+ e8390_base + E8390_CMD); /* 0x61 */
for (i = 0; i < 6; i++) {
ei_outb_p(dev->dev_addr[i], e8390_base + EN1_PHYS_SHIFT(i));
- if ((netif_msg_probe(ei_local)) &&
- ei_inb_p(e8390_base + EN1_PHYS_SHIFT(i)) != dev->dev_addr[i])
+ if ((netif_msg_probe(ei_local)) && ei_inb_p(e8390_base +
+ EN1_PHYS_SHIFT(i)) != dev->dev_addr[i])
netdev_err(dev,
"Hw. address read/write mismap %d\n", i);
}
ei_outb_p(ei_local->rx_start_page, e8390_base + EN1_CURPAG);
- ei_outb_p(E8390_NODMA+E8390_PAGE0+E8390_STOP, e8390_base+E8390_CMD);
+ ei_outb_p(E8390_NODMA + E8390_PAGE0 + E8390_STOP, e8390_base + E8390_CMD);
- ei_local->tx1 = ei_local->tx2 = 0;
+ ei_local->tx1 = 0;
+ ei_local->tx2 = 0;
ei_local->txing = 0;
if (startp) {
ei_outb_p(0xff, e8390_base + EN0_ISR);
ei_outb_p(ENISR_ALL, e8390_base + EN0_IMR);
- ei_outb_p(E8390_NODMA+E8390_PAGE0+E8390_START, e8390_base+E8390_CMD);
+ ei_outb_p(E8390_NODMA + E8390_PAGE0 + E8390_START,
+ e8390_base + E8390_CMD);
ei_outb_p(E8390_TXCONFIG, e8390_base + EN0_TXCR); /* xmit on. */
/* 3c503 TechMan says rxconfig only after the NIC is started. */
ei_outb_p(E8390_RXCONFIG, e8390_base + EN0_RXCR); /* rx on, */
@@ -1065,15 +1060,16 @@ static void __NS8390_init(struct net_device *dev, int startp)
}
/* Trigger a transmit start, assuming the length is valid.
- Always called with the page lock held */
+ * Always called with the page lock held.
+ */
static void NS8390_trigger_send(struct net_device *dev, unsigned int length,
- int start_page)
+ int start_page)
{
unsigned long e8390_base = dev->base_addr;
struct ei_device *ei_local __attribute((unused)) = netdev_priv(dev);
- ei_outb_p(E8390_NODMA+E8390_PAGE0, e8390_base+E8390_CMD);
+ ei_outb_p(E8390_NODMA + E8390_PAGE0, e8390_base + E8390_CMD);
if (ei_inb_p(e8390_base + E8390_CMD) & E8390_TRANS) {
netdev_warn(dev, "trigger_send() called with the transmitter busy\n");
@@ -1082,5 +1078,5 @@ static void NS8390_trigger_send(struct net_device *dev, unsigned int length,
ei_outb_p(length & 0xff, e8390_base + EN0_TCNTLO);
ei_outb_p(length >> 8, e8390_base + EN0_TCNTHI);
ei_outb_p(start_page, e8390_base + EN0_TPSR);
- ei_outb_p(E8390_NODMA+E8390_TRANS+E8390_START, e8390_base+E8390_CMD);
+ ei_outb_p(E8390_NODMA + E8390_TRANS + E8390_START, e8390_base + E8390_CMD);
}
--
2.20.1
^ permalink raw reply related
* [PATCH 1/2 v2 net-next] 8390: Miscellaneous cleanups
From: Armin Wolf @ 2020-08-01 20:52 UTC (permalink / raw)
To: davem; +Cc: netdev
Replace version string with MODULE_* macros.
Include necessary libraries.
Fix two minor coding-style issues.
Signed-off-by: Armin Wolf <W_Armin@gmx.de>
---
drivers/net/ethernet/8390/8390.c | 25 ++++++++++++++++++++-----
1 file changed, 20 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/8390/8390.c b/drivers/net/ethernet/8390/8390.c
index 0e0aa4016858..aabb637c1fbf 100644
--- a/drivers/net/ethernet/8390/8390.c
+++ b/drivers/net/ethernet/8390/8390.c
@@ -1,11 +1,26 @@
// SPDX-License-Identifier: GPL-2.0-only
-/* 8390 core for usual drivers */
-static const char version[] =
- "8390.c:v1.10cvs 9/23/94 Donald Becker (becker@cesdis.gsfc.nasa.gov)\n";
+#define DRV_NAME "8390"
+#define DRV_DESCRIPTION "8390 core for usual drivers"
+#define DRV_AUTHOR "Donald Becker (becker@cesdis.gsfc.nasa.gov)"
+#define DRV_VERSION "1.10cvs"
+#define DRV_RELDATE "9/23/1994"
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/export.h>
+
+#include <linux/netdevice.h>
+#include <linux/etherdevice.h>
#include "lib8390.c"
+MODULE_AUTHOR(DRV_AUTHOR);
+MODULE_DESCRIPTION(DRV_DESCRIPTION);
+MODULE_VERSION(DRV_VERSION);
+MODULE_LICENSE("GPL");
+
int ei_open(struct net_device *dev)
{
return __ei_open(dev);
@@ -64,7 +79,7 @@ const struct net_device_ops ei_netdev_ops = {
.ndo_get_stats = ei_get_stats,
.ndo_set_rx_mode = ei_set_multicast_list,
.ndo_validate_addr = eth_validate_addr,
- .ndo_set_mac_address = eth_mac_addr,
+ .ndo_set_mac_address = eth_mac_addr,
#ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller = ei_poll,
#endif
@@ -74,6 +89,7 @@ EXPORT_SYMBOL(ei_netdev_ops);
struct net_device *__alloc_ei_netdev(int size)
{
struct net_device *dev = ____alloc_ei_netdev(size);
+
if (dev)
dev->netdev_ops = &ei_netdev_ops;
return dev;
@@ -100,4 +116,3 @@ static void __exit ns8390_module_exit(void)
module_init(ns8390_module_init);
module_exit(ns8390_module_exit);
#endif /* MODULE */
-MODULE_LICENSE("GPL");
--
2.20.1
^ permalink raw reply related
* [PATCH 0/2 v2 net-next] 8390: core cleanups
From: Armin Wolf @ 2020-08-01 20:51 UTC (permalink / raw)
To: davem; +Cc: netdev
The purpose of this patchset is to do some
cleanups in lib8390.c and 8390.c.
While most cleanups are coding-style related,
pt_cont() usage was replaced by a more SMP-safe construct.
Other functional changes include the removal of
version-printing in lib8390.c so modules using lib8390.c
do not need a global version-string in order to compile
successfully.
Patches do compile and run flawless on 5.8.0-rc6 with
a RTL8029AS nic using ne2k-pci.
v2 changes:
- change "librarys" to "libraries" in 8390.c commit
- improve 8390.c commit
- prevent uneven whitespaces in error message (lib8390.c)
- do not destroy kernel doc comments in lib8390.c
- fix some typos in lib8390.c
Armin Wolf (2):
8390: Miscellaneous cleanups
lib8390: Fix coding-style issues and remove verion printing
drivers/net/ethernet/8390/8390.c | 25 +-
drivers/net/ethernet/8390/lib8390.c | 606 ++++++++++++++--------------
2 files changed, 321 insertions(+), 310 deletions(-)
--
2.20.1
^ permalink raw reply
* Re: [PATCH net-next v3 2/2] net: dsa: qca8k: Add 802.1q VLAN support
From: Florian Fainelli @ 2020-08-01 20:50 UTC (permalink / raw)
To: Jonathan McDowell, Andrew Lunn, Vivien Didelot, Vladimir Oltean,
David Miller, Jakub Kicinski, Russell King - ARM Linux admin,
Matthew Hagan, netdev, linux-kernel
In-Reply-To: <ec320e8e5a9691b85ee79f6ef03f1b0b6a562655.1596301468.git.noodles@earth.li>
On 8/1/2020 10:06 AM, Jonathan McDowell wrote:
> This adds full 802.1q VLAN support to the qca8k, allowing the use of
> vlan_filtering and more complicated bridging setups than allowed by
> basic port VLAN support.
>
> Tested with a number of untagged ports with separate VLANs and then a
> trunk port with all the VLANs tagged on it.
>
> v3:
> - Pull QCA8K_PORT_VID_DEF changes into separate cleanup patch
> - Reverse Christmas tree notation for variable definitions
> - Use untagged instead of tagged for consistency
> v2:
> - Return sensible errnos on failure rather than -1 (rmk)
> - Style cleanups based on Florian's feedback
> - Silently allow VLAN 0 as device correctly treats this as no tag
>
> Signed-off-by: Jonathan McDowell <noodles@earth.li>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
--
Florian
^ permalink raw reply
* Re: [PATCH net-next v3 1/2] net: dsa: qca8k: Add define for port VID
From: Florian Fainelli @ 2020-08-01 20:48 UTC (permalink / raw)
To: Jonathan McDowell, Andrew Lunn, Vivien Didelot, Vladimir Oltean,
David Miller, Jakub Kicinski, Russell King - ARM Linux admin,
Matthew Hagan, netdev, linux-kernel
In-Reply-To: <08fd70c48668544408bdb7932ef23e13d1080ad1.1596301468.git.noodles@earth.li>
On 8/1/2020 10:05 AM, Jonathan McDowell wrote:
> Rather than using a magic value of 1 when configuring the port VIDs add
> a QCA8K_PORT_VID_DEF define and use that instead. Also fix up the
> bitmask in the process; the top 4 bits are reserved so this wasn't a
> problem, but only masking 12 bits is the correct approach.
>
> Signed-off-by: Jonathan McDowell <noodles@earth.li>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
--
Florian
^ permalink raw reply
* Re: [PATCH net] net/bpfilter: initialize pos in __bpfilter_process_sockopt
From: Alexei Starovoitov @ 2020-08-01 19:48 UTC (permalink / raw)
To: Daniel Borkmann
Cc: Christian Brauner, Christoph Hellwig, davem, kuba, ast, netdev,
bpf, Rodrigo Madera
In-Reply-To: <03954b8f-0db7-427b-cfd6-7146da9b5466@iogearbox.net>
On Fri, Jul 31, 2020 at 02:07:42AM +0200, Daniel Borkmann wrote:
> On 7/30/20 6:13 PM, Christian Brauner wrote:
> > On Thu, Jul 30, 2020 at 06:09:00PM +0200, Christoph Hellwig wrote:
> > > __bpfilter_process_sockopt never initialized the pos variable passed to
> > > the pipe write. This has been mostly harmless in the past as pipes
> > > ignore the offset, but the switch to kernel_write no verified the
> >
> > s/no/now/
> >
> > > position, which can lead to a failure depending on the exact stack
> > > initialization patter. Initialize the variable to zero to make
> >
> > s/patter/pattern/
> >
> > > rw_verify_area happy.
> > >
> > > Fixes: 6955a76fbcd5 ("bpfilter: switch to kernel_write")
> > > Reported-by: Christian Brauner <christian.brauner@ubuntu.com>
> > > Reported-by: Rodrigo Madera <rodrigo.madera@gmail.com>
> > > Signed-off-by: Christoph Hellwig <hch@lst.de>
> > > Tested-by: Rodrigo Madera <rodrigo.madera@gmail.com>
> > > ---
> >
> > Thanks for tracking this down, Christoph! This fixes the logging issue
> > for me.
> > Tested-by: Christian Brauner <christian.brauner@ubuntu.com>
> > Reviewed-by: Christian Brauner <christian.brauner@ubuntu.com>
>
> Applied to bpf & fixed up the typos in the commit msg, thanks everyone!
Daniel,
why is it necessary in bpf tree?
I fixed it already in bpf-next in commit a4fa458950b4 ("bpfilter: Initialize pos variable")
two weeks ago...
^ permalink raw reply
* [Linux-kernel-mentees] [PATCH net] net/smc: Prevent kernel-infoleak in __smc_diag_dump()
From: Peilin Ye @ 2020-08-01 19:44 UTC (permalink / raw)
To: Ursula Braun, Karsten Graul
Cc: Peilin Ye, Hans Wippel, David S. Miller, Jakub Kicinski,
Dan Carpenter, Arnd Bergmann, Greg Kroah-Hartman, linux-s390,
netdev, linux-kernel-mentees, linux-kernel
__smc_diag_dump() is potentially copying uninitialized kernel stack memory
into socket buffers, since the compiler may leave a 4-byte hole near the
beginning of `struct smcd_diag_dmbinfo`. Fix it by initializing `dinfo`
with memset().
Cc: stable@vger.kernel.org
Fixes: 4b1b7d3b30a6 ("net/smc: add SMC-D diag support")
Suggested-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Peilin Ye <yepeilin.cs@gmail.com>
---
Reference: https://lwn.net/Articles/417989/
$ pahole -C "smcd_diag_dmbinfo" net/smc/smc_diag.o
struct smcd_diag_dmbinfo {
__u32 linkid; /* 0 4 */
/* XXX 4 bytes hole, try to pack */
__u64 peer_gid __attribute__((__aligned__(8))); /* 8 8 */
__u64 my_gid __attribute__((__aligned__(8))); /* 16 8 */
__u64 token __attribute__((__aligned__(8))); /* 24 8 */
__u64 peer_token __attribute__((__aligned__(8))); /* 32 8 */
/* size: 40, cachelines: 1, members: 5 */
/* sum members: 36, holes: 1, sum holes: 4 */
/* forced alignments: 4, forced holes: 1, sum forced holes: 4 */
/* last cacheline: 40 bytes */
} __attribute__((__aligned__(8)));
$ _
net/smc/smc_diag.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/net/smc/smc_diag.c b/net/smc/smc_diag.c
index e1f64f4ba236..da9ba6d1679b 100644
--- a/net/smc/smc_diag.c
+++ b/net/smc/smc_diag.c
@@ -170,13 +170,15 @@ static int __smc_diag_dump(struct sock *sk, struct sk_buff *skb,
(req->diag_ext & (1 << (SMC_DIAG_DMBINFO - 1))) &&
!list_empty(&smc->conn.lgr->list)) {
struct smc_connection *conn = &smc->conn;
- struct smcd_diag_dmbinfo dinfo = {
- .linkid = *((u32 *)conn->lgr->id),
- .peer_gid = conn->lgr->peer_gid,
- .my_gid = conn->lgr->smcd->local_gid,
- .token = conn->rmb_desc->token,
- .peer_token = conn->peer_token
- };
+ struct smcd_diag_dmbinfo dinfo;
+
+ memset(&dinfo, 0, sizeof(dinfo));
+
+ dinfo.linkid = *((u32 *)conn->lgr->id);
+ dinfo.peer_gid = conn->lgr->peer_gid;
+ dinfo.my_gid = conn->lgr->smcd->local_gid;
+ dinfo.token = conn->rmb_desc->token;
+ dinfo.peer_token = conn->peer_token;
if (nla_put(skb, SMC_DIAG_DMBINFO, sizeof(dinfo), &dinfo) < 0)
goto errout;
--
2.25.1
^ permalink raw reply related
* WARNING in hci_conn_timeout
From: syzbot @ 2020-08-01 18:55 UTC (permalink / raw)
To: davem, johan.hedberg, kuba, linux-bluetooth, linux-kernel, marcel,
netdev, syzkaller-bugs
Hello,
syzbot found the following issue on:
HEAD commit: 7dc6fd0f Merge branch 'i2c/for-current' of git://git.kerne..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=12a70832900000
kernel config: https://syzkaller.appspot.com/x/.config?x=e59ee776d5aa8d55
dashboard link: https://syzkaller.appspot.com/bug?extid=2446dd3cb07277388db6
compiler: clang version 10.0.0 (https://github.com/llvm/llvm-project/ c2443155a0fb245c8f17f2c1c72b6ea391e86e81)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=13f781d4900000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=116a0c14900000
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+2446dd3cb07277388db6@syzkaller.appspotmail.com
------------[ cut here ]------------
WARNING: CPU: 0 PID: 6953 at net/bluetooth/hci_conn.c:412 hci_conn_timeout+0x20f/0x290 net/bluetooth/hci_conn.c:412
Kernel panic - not syncing: panic_on_warn set ...
CPU: 1 PID: 6953 Comm: kworker/u5:2 Not tainted 5.8.0-rc7-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: hci0 hci_conn_timeout
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x1f0/0x31e lib/dump_stack.c:118
panic+0x264/0x7a0 kernel/panic.c:231
__warn+0x227/0x250 kernel/panic.c:600
report_bug+0x1b1/0x2e0 lib/bug.c:198
handle_bug+0x42/0x80 arch/x86/kernel/traps.c:235
exc_invalid_op+0x16/0x40 arch/x86/kernel/traps.c:255
asm_exc_invalid_op+0x12/0x20 arch/x86/include/asm/idtentry.h:540
RIP: 0010:hci_conn_timeout+0x20f/0x290 net/bluetooth/hci_conn.c:412
Code: c7 50 4d 8d 89 e8 71 d0 5f fa 48 8b 35 6a 7c 39 02 bf 40 00 00 00 4c 89 f2 5b 41 5c 41 5e 41 5f e9 46 69 f8 f9 e8 61 c1 20 fa <0f> 0b e9 5c fe ff ff 89 d9 80 e1 07 80 c1 03 38 c1 0f 8c 1a fe ff
RSP: 0018:ffffc90001577cc8 EFLAGS: 00010293
RAX: ffffffff8753d0ff RBX: 00000000ffffffff RCX: ffff888092948440
RDX: 0000000000000000 RSI: 00000000ffffffff RDI: 0000000000000000
RBP: ffff8880a9b7b008 R08: ffffffff8753cf3b R09: ffffed1010da5003
R10: ffffed1010da5003 R11: 0000000000000000 R12: ffff8880a7290d00
R13: ffff8880a7290d18 R14: ffff888086d28128 R15: dffffc0000000000
process_one_work+0x789/0xfc0 kernel/workqueue.c:2269
worker_thread+0xaa4/0x1460 kernel/workqueue.c:2415
kthread+0x37e/0x3a0 drivers/block/aoe/aoecmd.c:1234
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:293
Kernel Offset: disabled
Rebooting in 86400 seconds..
---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@googlegroups.com.
syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
syzbot can test patches for this issue, for details see:
https://goo.gl/tpsmEJ#testing-patches
^ permalink raw reply
* Re: [PATCH net-next] mptcp: fix syncookie build error on UP
From: David Miller @ 2020-08-01 18:53 UTC (permalink / raw)
To: fw; +Cc: netdev
In-Reply-To: <20200801143959.211300-1-fw@strlen.de>
From: Florian Westphal <fw@strlen.de>
Date: Sat, 1 Aug 2020 16:39:59 +0200
> kernel test robot says:
> net/mptcp/syncookies.c: In function 'mptcp_join_cookie_init':
> include/linux/kernel.h:47:38: warning: division by zero [-Wdiv-by-zero]
> #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
>
> I forgot that spinock_t size is 0 on UP, so ARRAY_SIZE cannot be used.
>
> Fixes: 9466a1ccebbe54 ("mptcp: enable JOIN requests even if cookies are in use")
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Florian Westphal <fw@strlen.de>
Applied, thanks.
^ permalink raw reply
* Re: [PATCH net] vxlan: fix memleak of fdb
From: David Miller @ 2020-08-01 18:50 UTC (permalink / raw)
To: ap420073; +Cc: kuba, netdev, roopa
In-Reply-To: <20200801070750.7993-1-ap420073@gmail.com>
From: Taehee Yoo <ap420073@gmail.com>
Date: Sat, 1 Aug 2020 07:07:50 +0000
> When vxlan interface is deleted, all fdbs are deleted by vxlan_flush().
> vxlan_flush() flushes fdbs but it doesn't delete fdb, which contains
> all-zeros-mac because it is deleted by vxlan_uninit().
> But vxlan_uninit() deletes only the fdb, which contains both all-zeros-mac
> and default vni.
> So, the fdb, which contains both all-zeros-mac and non-default vni
> will not be deleted.
>
> Test commands:
> ip link add vxlan0 type vxlan dstport 4789 external
> ip link set vxlan0 up
> bridge fdb add to 00:00:00:00:00:00 dst 172.0.0.1 dev vxlan0 via lo \
> src_vni 10000 self permanent
> ip link del vxlan0
>
> kmemleak reports as follows:
...
> Fixes: 3ad7a4b141eb ("vxlan: support fdb and learning in COLLECT_METADATA mode")
> Signed-off-by: Taehee Yoo <ap420073@gmail.com>
Applied and queued up for -stable, thank you.
^ permalink raw reply
* Re: [PATCH net-next] fib: fix another fib_rules_ops indirect call wrapper problem
From: David Miller @ 2020-08-01 18:47 UTC (permalink / raw)
To: brianvv
Cc: brianvv.kernel, edumazet, pabeni, linux-kernel, netdev, rdunlap,
sfr
In-Reply-To: <20200801030110.747164-1-brianvv@google.com>
From: Brian Vazquez <brianvv@google.com>
Date: Fri, 31 Jul 2020 20:01:10 -0700
> It turns out that on commit 41d707b7332f ("fib: fix fib_rules_ops
> indirect calls wrappers") I forgot to include the case when
> CONFIG_IP_MULTIPLE_TABLES is not set.
>
> Fixes: 41d707b7332f ("fib: fix fib_rules_ops indirect calls wrappers")
> Reported-by: Randy Dunlap <rdunlap@infradead.org>
> Cc: Stephen Rothwell <sfr@canb.auug.org.au>
> Signed-off-by: Brian Vazquez <brianvv@google.com>
Applied.
^ permalink raw reply
* Re: [PATCH net-next] tcp: fix build fong CONFIG_MPTCP=n
From: David Miller @ 2020-08-01 18:46 UTC (permalink / raw)
To: edumazet; +Cc: netdev, eric.dumazet, fw
In-Reply-To: <20200801020929.3000802-1-edumazet@google.com>
From: Eric Dumazet <edumazet@google.com>
Date: Fri, 31 Jul 2020 19:09:29 -0700
> Fixes these errors:
>
> net/ipv4/syncookies.c: In function 'tcp_get_cookie_sock':
> net/ipv4/syncookies.c:216:19: error: 'struct tcp_request_sock' has no
> member named 'drop_req'
> 216 | if (tcp_rsk(req)->drop_req) {
> | ^~
> net/ipv4/syncookies.c: In function 'cookie_tcp_reqsk_alloc':
> net/ipv4/syncookies.c:289:27: warning: unused variable 'treq'
> [-Wunused-variable]
> 289 | struct tcp_request_sock *treq;
> | ^~~~
> make[3]: *** [scripts/Makefile.build:280: net/ipv4/syncookies.o] Error 1
> make[3]: *** Waiting for unfinished jobs....
>
> Fixes: 9466a1ccebbe ("mptcp: enable JOIN requests even if cookies are in use")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Florian Westphal <fw@strlen.de>
Applied, thank you.
^ permalink raw reply
* Re: [PATCH bpf-next] bpf: make __htab_lookup_and_delete_batch faster when map is almost empty
From: Brian Vazquez @ 2020-08-01 18:11 UTC (permalink / raw)
To: Yonghong Song
Cc: Brian Vazquez, Alexei Starovoitov, Daniel Borkmann,
David S . Miller, open list, Linux NetDev, bpf, Luigi Rizzo
In-Reply-To: <4cd10805-b056-21a7-fdc2-d3f66e94dcf6@fb.com>
On Sat, Aug 1, 2020 at 9:59 AM Yonghong Song <yhs@fb.com> wrote:
>
>
>
> On 7/31/20 9:57 PM, Brian Vazquez wrote:
> > While running some experiments it was observed that map_lookup_batch was much
> > slower than get_next_key + lookup when the syscall overhead is minimal.
> > This was because the map_lookup_batch implementation was more expensive
> > traversing empty buckets, this can be really costly when the pre-allocated
> > map is too big.
> >
> > This patch optimizes the case when the bucket is empty so we can move quickly
> > to next bucket.
> >
> > The benchmark to exercise this is as follows:
> >
> > -The map was populate with a single entry to make sure that the syscall overhead
> > is not helping the map_batch_lookup.
> > -The size of the preallocated map was increased to show the effect of
> > traversing empty buckets.
> >
> > Results:
> >
> > Using get_next_key + lookup:
> >
> > Benchmark Time(ns) CPU(ns) Iteration
> > ---------------------------------------------------------------
> > BM_DumpHashMap/1/1k 3593 3586 192680
> > BM_DumpHashMap/1/4k 6004 5972 100000
> > BM_DumpHashMap/1/16k 15755 15710 44341
> > BM_DumpHashMap/1/64k 59525 59376 10000
>
> I think "BM_DumpHashMap/1/64k" means the program "BM_DumpHashMap",
> the map having only "1" entry, and the map preallocated size is "64k"?
> What is the "Iteration" here? The number of runs with the same dump?
> The CPU(ns) is the system cpu consumption, right? The Time/CPU is for
> all iterations, not just one, right? It would be good
> if the above results can be described better, so people can
> understand the results better.
>
Hi Yonghong, thanks for reviewing it!
I'll fix it in next iteration.
> >
> > Using htab_lookup_batch before this patch:
> > Benchmark Time(ns) CPU(ns) Iterations
> > ---------------------------------------------------------------
> > BM_DumpHashMap/1/1k 3933 3927 177978
> > BM_DumpHashMap/1/4k 9192 9177 73951
> > BM_DumpHashMap/1/16k 42011 41970 16789
> > BM_DumpHashMap/1/64k 117895 117661 6135
> >
> > Using htab_lookup_batch with this patch:
> > Benchmark Time(ns) CPU(ns) Iterations
> > ---------------------------------------------------------------
> > BM_DumpHashMap/1/1k 2809 2803 249212
> > BM_DumpHashMap/1/4k 5318 5316 100000
> > BM_DumpHashMap/1/16k 14925 14895 47448
> > BM_DumpHashMap/1/64k 58870 58674 10000
> >
> > Suggested-by: Luigi Rizzo <lrizzo@google.com>
> > Cc: Yonghong Song <yhs@fb.com>
> > Signed-off-by: Brian Vazquez <brianvv@google.com>
> > ---
> > kernel/bpf/hashtab.c | 23 ++++++++---------------
> > 1 file changed, 8 insertions(+), 15 deletions(-)
> >
> > diff --git a/kernel/bpf/hashtab.c b/kernel/bpf/hashtab.c
> > index 2137e2200d95..150015ea6737 100644
> > --- a/kernel/bpf/hashtab.c
> > +++ b/kernel/bpf/hashtab.c
> > @@ -1351,7 +1351,6 @@ __htab_map_lookup_and_delete_batch(struct bpf_map *map,
> > struct hlist_nulls_head *head;
> > struct hlist_nulls_node *n;
> > unsigned long flags = 0;
> > - bool locked = false;
> > struct htab_elem *l;
> > struct bucket *b;
> > int ret = 0;
> > @@ -1410,19 +1409,19 @@ __htab_map_lookup_and_delete_batch(struct bpf_map *map,
> > dst_val = values;
> > b = &htab->buckets[batch];
> > head = &b->head;
> > - /* do not grab the lock unless need it (bucket_cnt > 0). */
> > - if (locked)
> > - flags = htab_lock_bucket(htab, b);
> >
> > + l = hlist_nulls_entry_safe(rcu_dereference_raw(hlist_nulls_first_rcu(head)),
> > + struct htab_elem, hash_node);
> > + if (!l && (batch + 1 < htab->n_buckets)) {
> > + batch++;
> > + goto again_nocopy;
> > + }
> > +
> > + flags = htab_lock_bucket(htab, b);
> [...]
^ permalink raw reply
* [PATCH V2 bpf-next] bpf: make __htab_lookup_and_delete_batch faster when map is almost empty
From: Brian Vazquez @ 2020-08-01 18:09 UTC (permalink / raw)
To: Brian Vazquez, Brian Vazquez, Alexei Starovoitov, Daniel Borkmann,
David S . Miller
Cc: linux-kernel, netdev, bpf, Luigi Rizzo, Yonghong Song
While running some experiments it was observed that map_lookup_batch was 2x
slower than get_next_key + lookup when the syscall overhead is minimal.
This was because the map_lookup_batch implementation was more expensive
traversing empty buckets, this can be really costly when the pre-allocated
map is too big.
This patch optimizes the case when the bucket is empty so we can move
quickly to next bucket.
The Benchmark was generated using the google/benchmark library[1]. When
the benckmark is executed the number of iterations is governed by the
amount of time the benckmarks takes, the number of iterations is at
least 1 and not more than 1e9, until CPU time(of the entire binary, not
just the part to measure), is greater than 0.5s. Time and CPU reported
are the average of a single iteration over the iteration runs.
The experiments to exercise the empty buckets are as follows:
-The map was populated with a single entry to make sure that the syscall
overhead is not helping the map_batch_lookup.
-The size of the preallocated map was increased to show the effect of
traversing empty buckets.
To interpret the results, Benchmark is the name of the experiment where
the first number correspond to the number of elements in the map, and
the next one correspond to the size of the pre-allocated map. Time and
CPU are average and correspond to the time elapsed per iteration and the
system time consumtion per iteration.
Results:
Using get_next_key + lookup:
Benchmark Time(ns) CPU(ns) Iteration
---------------------------------------------------------------
BM_DumpHashMap/1/1k 3593 3586 192680
BM_DumpHashMap/1/4k 6004 5972 100000
BM_DumpHashMap/1/16k 15755 15710 44341
BM_DumpHashMap/1/64k 59525 59376 10000
Using htab_lookup_batch before this patch:
Benchmark Time(ns) CPU(ns) Iterations
---------------------------------------------------------------
BM_DumpHashMap/1/1k 3933 3927 177978
BM_DumpHashMap/1/4k 9192 9177 73951
BM_DumpHashMap/1/16k 42011 41970 16789
BM_DumpHashMap/1/64k 117895 117661 6135
Using htab_lookup_batch with this patch:
Benchmark Time(ns) CPU(ns) Iterations
---------------------------------------------------------------
BM_DumpHashMap/1/1k 2809 2803 249212
BM_DumpHashMap/1/4k 5318 5316 100000
BM_DumpHashMap/1/16k 14925 14895 47448
BM_DumpHashMap/1/64k 58870 58674 10000
[1] https://github.com/google/benchmark.git
Changelog:
v1 -> v2:
- Add more information about how to interpret the results
Suggested-by: Luigi Rizzo <lrizzo@google.com>
Cc: Yonghong Song <yhs@fb.com>
Signed-off-by: Brian Vazquez <brianvv@google.com>
---
kernel/bpf/hashtab.c | 23 ++++++++---------------
1 file changed, 8 insertions(+), 15 deletions(-)
diff --git a/kernel/bpf/hashtab.c b/kernel/bpf/hashtab.c
index 024276787055..b6d28bd6345b 100644
--- a/kernel/bpf/hashtab.c
+++ b/kernel/bpf/hashtab.c
@@ -1349,7 +1349,6 @@ __htab_map_lookup_and_delete_batch(struct bpf_map *map,
struct hlist_nulls_head *head;
struct hlist_nulls_node *n;
unsigned long flags = 0;
- bool locked = false;
struct htab_elem *l;
struct bucket *b;
int ret = 0;
@@ -1408,19 +1407,19 @@ __htab_map_lookup_and_delete_batch(struct bpf_map *map,
dst_val = values;
b = &htab->buckets[batch];
head = &b->head;
- /* do not grab the lock unless need it (bucket_cnt > 0). */
- if (locked)
- flags = htab_lock_bucket(htab, b);
+ l = hlist_nulls_entry_safe(rcu_dereference_raw(hlist_nulls_first_rcu(head)),
+ struct htab_elem, hash_node);
+ if (!l && (batch + 1 < htab->n_buckets)) {
+ batch++;
+ goto again_nocopy;
+ }
+
+ flags = htab_lock_bucket(htab, b);
bucket_cnt = 0;
hlist_nulls_for_each_entry_rcu(l, n, head, hash_node)
bucket_cnt++;
- if (bucket_cnt && !locked) {
- locked = true;
- goto again_nocopy;
- }
-
if (bucket_cnt > (max_count - total)) {
if (total == 0)
ret = -ENOSPC;
@@ -1446,10 +1445,6 @@ __htab_map_lookup_and_delete_batch(struct bpf_map *map,
goto alloc;
}
- /* Next block is only safe to run if you have grabbed the lock */
- if (!locked)
- goto next_batch;
-
hlist_nulls_for_each_entry_safe(l, n, head, hash_node) {
memcpy(dst_key, l->key, key_size);
@@ -1492,7 +1487,6 @@ __htab_map_lookup_and_delete_batch(struct bpf_map *map,
}
htab_unlock_bucket(htab, b, flags);
- locked = false;
while (node_to_free) {
l = node_to_free;
@@ -1500,7 +1494,6 @@ __htab_map_lookup_and_delete_batch(struct bpf_map *map,
bpf_lru_push_free(&htab->lru, &l->lru_node);
}
-next_batch:
/* If we are not copying data, we can go to next bucket and avoid
* unlocking the rcu.
*/
--
2.28.0.163.g6104cc2f0b6-goog
^ permalink raw reply related
* [RFC] replace SNAPSHOT with auto-generated version
From: Stephen Hemminger @ 2020-08-01 17:32 UTC (permalink / raw)
To: netdev; +Cc: Stephen Hemminger
In-Reply-To: <CAJ3xEMhk+EQ_avGSBDB5_Gnj09w3goUJKkxzt8innWvFkTeEVA@mail.gmail.com>
Replace the iproute2 snapshot with a version string which is
autogenerated as part of the build process using git describe.
This will also allow seeing if the version of the command
is built from the same sources is as upstream.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
One additional tweak needed will be to put Version.h in the
tarball for building outside of git.
.gitignore | 1 +
Makefile | 10 +++++-----
bridge/bridge.c | 2 +-
devlink/devlink.c | 4 ++--
genl/genl.c | 4 ++--
ip/ip.c | 4 ++--
ip/rtmon.c | 4 ++--
misc/ifstat.c | 4 ++--
misc/nstat.c | 4 ++--
misc/rtacct.c | 4 ++--
misc/ss.c | 4 ++--
rdma/rdma.c | 6 +++---
tc/tc.c | 4 ++--
13 files changed, 28 insertions(+), 27 deletions(-)
diff --git a/.gitignore b/.gitignore
index e5234a3dc948..8c553394453a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,7 @@
Config
static-syms.h
config.*
+include/Version.h
*.o
*.a
*.so
diff --git a/Makefile b/Makefile
index 25d05fac952a..61056cf6d7b2 100644
--- a/Makefile
+++ b/Makefile
@@ -60,7 +60,7 @@ SUBDIRS=lib ip tc bridge misc netem genl tipc devlink rdma man
LIBNETLINK=../lib/libutil.a ../lib/libnetlink.a
LDLIBS += $(LIBNETLINK)
-all: config.mk
+all: config.mk include/Version.h
@set -e; \
for i in $(SUBDIRS); \
do echo; echo $$i; $(MAKE) $(MFLAGS) -C $$i; done
@@ -93,9 +93,9 @@ install: all
install -m 0644 bash-completion/devlink $(DESTDIR)$(BASH_COMPDIR)
install -m 0644 include/bpf_elf.h $(DESTDIR)$(HDRDIR)
-snapshot:
- echo "static const char SNAPSHOT[] = \""`date +%y%m%d`"\";" \
- > include/SNAPSHOT.h
+include/Version.h:
+ echo "static const char Version[] = \""`git describe --tags --long`"\";" \
+ > include/Version.h
clean:
@for i in $(SUBDIRS) testsuite; \
@@ -104,7 +104,7 @@ clean:
clobber:
touch config.mk
$(MAKE) $(MFLAGS) clean
- rm -f config.mk cscope.*
+ rm -f config.mk cscope.* include/Version.h
distclean: clobber
diff --git a/bridge/bridge.c b/bridge/bridge.c
index a50d9d59b4c5..db2984ad7d88 100644
--- a/bridge/bridge.c
+++ b/bridge/bridge.c
@@ -12,7 +12,7 @@
#include <string.h>
#include <errno.h>
-#include "SNAPSHOT.h"
+#include "Version.h"
#include "utils.h"
#include "br_common.h"
#include "namespace.h"
diff --git a/devlink/devlink.c b/devlink/devlink.c
index 7f83fb746fd6..b558137caa0e 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -34,7 +34,7 @@
#include <sys/socket.h>
#include <sys/types.h>
-#include "SNAPSHOT.h"
+#include "Version.h"
#include "list.h"
#include "mnlg.h"
#include "json_print.h"
@@ -7606,7 +7606,7 @@ int main(int argc, char **argv)
switch (opt) {
case 'V':
- printf("devlink utility, iproute2-ss%s\n", SNAPSHOT);
+ printf("devlink utility, iproute2-%s\n", Version);
ret = EXIT_SUCCESS;
goto dl_free;
case 'f':
diff --git a/genl/genl.c b/genl/genl.c
index aba3c13afd34..cf30c7af20f6 100644
--- a/genl/genl.c
+++ b/genl/genl.c
@@ -22,7 +22,7 @@
#include <errno.h>
#include <linux/netlink.h>
#include <linux/rtnetlink.h> /* until we put our own header */
-#include "SNAPSHOT.h"
+#include "Version.h"
#include "utils.h"
#include "genl_utils.h"
@@ -118,7 +118,7 @@ int main(int argc, char **argv)
} else if (matches(argv[1], "-raw") == 0) {
++show_raw;
} else if (matches(argv[1], "-Version") == 0) {
- printf("genl utility, iproute2-ss%s\n", SNAPSHOT);
+ printf("genl utility, iproute2-%s\n", Version);
exit(0);
} else if (matches(argv[1], "-help") == 0) {
usage();
diff --git a/ip/ip.c b/ip/ip.c
index 4249df0377f9..ac7caa1b0171 100644
--- a/ip/ip.c
+++ b/ip/ip.c
@@ -18,7 +18,7 @@
#include <string.h>
#include <errno.h>
-#include "SNAPSHOT.h"
+#include "Version.h"
#include "utils.h"
#include "ip_common.h"
#include "namespace.h"
@@ -255,7 +255,7 @@ int main(int argc, char **argv)
++timestamp;
++timestamp_short;
} else if (matches(opt, "-Version") == 0) {
- printf("ip utility, iproute2-ss%s\n", SNAPSHOT);
+ printf("ip utility, iproute2-%s\n", Version);
exit(0);
} else if (matches(opt, "-force") == 0) {
++force;
diff --git a/ip/rtmon.c b/ip/rtmon.c
index bccddedddd17..d42bbd30c0fb 100644
--- a/ip/rtmon.c
+++ b/ip/rtmon.c
@@ -19,7 +19,7 @@
#include <netinet/in.h>
#include <string.h>
-#include "SNAPSHOT.h"
+#include "Version.h"
#include "utils.h"
#include "libnetlink.h"
@@ -107,7 +107,7 @@ main(int argc, char **argv)
} else if (strcmp(argv[1], "-0") == 0) {
family = AF_PACKET;
} else if (matches(argv[1], "-Version") == 0) {
- printf("rtmon utility, iproute2-ss%s\n", SNAPSHOT);
+ printf("rtmon utility, iproute2-%s\n", Version);
exit(0);
} else if (matches(argv[1], "file") == 0) {
argc--;
diff --git a/misc/ifstat.c b/misc/ifstat.c
index 03327af83ae8..abbd10cb9866 100644
--- a/misc/ifstat.c
+++ b/misc/ifstat.c
@@ -33,7 +33,7 @@
#include "libnetlink.h"
#include "json_writer.h"
-#include "SNAPSHOT.h"
+#include "Version.h"
#include "utils.h"
int dump_zeros;
@@ -869,7 +869,7 @@ int main(int argc, char *argv[])
break;
case 'v':
case 'V':
- printf("ifstat utility, iproute2-ss%s\n", SNAPSHOT);
+ printf("ifstat utility, iproute2-%s\n", Version);
exit(0);
case 'h':
case '?':
diff --git a/misc/nstat.c b/misc/nstat.c
index 88f52eaf8c8c..189a2d74602e 100644
--- a/misc/nstat.c
+++ b/misc/nstat.c
@@ -29,7 +29,7 @@
#include <getopt.h>
#include <json_writer.h>
-#include <SNAPSHOT.h>
+#include "Version.h"
#include "utils.h"
int dump_zeros;
@@ -621,7 +621,7 @@ int main(int argc, char *argv[])
break;
case 'v':
case 'V':
- printf("nstat utility, iproute2-ss%s\n", SNAPSHOT);
+ printf("nstat utility, iproute2-%s\n", Version);
exit(0);
case 'h':
case '?':
diff --git a/misc/rtacct.c b/misc/rtacct.c
index c4bb5bc3888c..ec475b9b5bd7 100644
--- a/misc/rtacct.c
+++ b/misc/rtacct.c
@@ -30,7 +30,7 @@
#include "rt_names.h"
-#include <SNAPSHOT.h>
+#include "Version.h"
int reset_history;
int ignore_history;
@@ -463,7 +463,7 @@ int main(int argc, char *argv[])
break;
case 'v':
case 'V':
- printf("rtacct utility, iproute2-ss%s\n", SNAPSHOT);
+ printf("rtacct utility, iproute2-%s\n", Version);
exit(0);
case 'M':
/* Some secret undocumented option, nobody
diff --git a/misc/ss.c b/misc/ss.c
index 5aa10e4a715f..08521672a154 100644
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -35,7 +35,7 @@
#include "ll_map.h"
#include "libnetlink.h"
#include "namespace.h"
-#include "SNAPSHOT.h"
+#include "Version.h"
#include "rt_names.h"
#include "cg_map.h"
@@ -5411,7 +5411,7 @@ int main(int argc, char *argv[])
break;
case 'v':
case 'V':
- printf("ss utility, iproute2-ss%s\n", SNAPSHOT);
+ printf("ss utility, iproute2-%s\n", Version);
exit(0);
case 'z':
show_sock_ctx++;
diff --git a/rdma/rdma.c b/rdma/rdma.c
index 22050555735d..0e7251fe26ef 100644
--- a/rdma/rdma.c
+++ b/rdma/rdma.c
@@ -5,7 +5,7 @@
*/
#include "rdma.h"
-#include "SNAPSHOT.h"
+#include "Version.h"
#include "color.h"
static void help(char *name)
@@ -131,8 +131,8 @@ int main(int argc, char **argv)
long_options, NULL)) >= 0) {
switch (opt) {
case 'V':
- printf("%s utility, iproute2-ss%s\n",
- filename, SNAPSHOT);
+ printf("%s utility, iproute2-%s\n",
+ filename, Version);
return EXIT_SUCCESS;
case 'p':
pretty = 1;
diff --git a/tc/tc.c b/tc/tc.c
index b72657ec2e60..31c9030d1ed1 100644
--- a/tc/tc.c
+++ b/tc/tc.c
@@ -24,7 +24,7 @@
#include <string.h>
#include <errno.h>
-#include "SNAPSHOT.h"
+#include "Version.h"
#include "utils.h"
#include "tc_util.h"
#include "tc_common.h"
@@ -299,7 +299,7 @@ int main(int argc, char **argv)
} else if (matches(argv[1], "-graph") == 0) {
show_graph = 1;
} else if (matches(argv[1], "-Version") == 0) {
- printf("tc utility, iproute2-ss%s\n", SNAPSHOT);
+ printf("tc utility, iproute2-%s\n", Version);
return 0;
} else if (matches(argv[1], "-iec") == 0) {
++use_iec;
--
2.27.0
^ permalink raw reply related
* Re: [PATCH net] vxlan: fix memleak of fdb
From: Roopa Prabhu @ 2020-08-01 17:09 UTC (permalink / raw)
To: Taehee Yoo, davem, kuba, netdev; +Cc: roopa
In-Reply-To: <20200801070750.7993-1-ap420073@gmail.com>
On 8/1/20 12:07 AM, Taehee Yoo wrote:
> External email: Use caution opening links or attachments
>
>
> When vxlan interface is deleted, all fdbs are deleted by vxlan_flush().
> vxlan_flush() flushes fdbs but it doesn't delete fdb, which contains
> all-zeros-mac because it is deleted by vxlan_uninit().
> But vxlan_uninit() deletes only the fdb, which contains both all-zeros-mac
> and default vni.
> So, the fdb, which contains both all-zeros-mac and non-default vni
> will not be deleted.
>
> Test commands:
> ip link add vxlan0 type vxlan dstport 4789 external
> ip link set vxlan0 up
> bridge fdb add to 00:00:00:00:00:00 dst 172.0.0.1 dev vxlan0 via lo \
> src_vni 10000 self permanent
> ip link del vxlan0
>
> kmemleak reports as follows:
> unreferenced object 0xffff9486b25ced88 (size 96):
> comm "bridge", pid 2151, jiffies 4294701712 (age 35506.901s)
> hex dump (first 32 bytes):
> 02 00 00 00 ac 00 00 01 40 00 09 b1 86 94 ff ff ........@.......
> 46 02 00 00 00 00 00 00 a7 03 00 00 12 b5 6a 6b F.............jk
> backtrace:
> [<00000000c10cf651>] vxlan_fdb_append.part.51+0x3c/0xf0 [vxlan]
> [<000000006b31a8d9>] vxlan_fdb_create+0x184/0x1a0 [vxlan]
> [<0000000049399045>] vxlan_fdb_update+0x12f/0x220 [vxlan]
> [<0000000090b1ef00>] vxlan_fdb_add+0x12a/0x1b0 [vxlan]
> [<0000000056633c2c>] rtnl_fdb_add+0x187/0x270
> [<00000000dd5dfb6b>] rtnetlink_rcv_msg+0x264/0x490
> [<00000000fc44dd54>] netlink_rcv_skb+0x4a/0x110
> [<00000000dff433e7>] netlink_unicast+0x18e/0x250
> [<00000000b87fb421>] netlink_sendmsg+0x2e9/0x400
> [<000000002ed55153>] ____sys_sendmsg+0x237/0x260
> [<00000000faa51c66>] ___sys_sendmsg+0x88/0xd0
> [<000000006c3982f1>] __sys_sendmsg+0x4e/0x80
> [<00000000a8f875d2>] do_syscall_64+0x56/0xe0
> [<000000003610eefa>] entry_SYSCALL_64_after_hwframe+0x44/0xa9
> unreferenced object 0xffff9486b1c40080 (size 128):
> comm "bridge", pid 2157, jiffies 4294701754 (age 35506.866s)
> hex dump (first 32 bytes):
> 00 00 00 00 00 00 00 00 f8 dc 42 b2 86 94 ff ff ..........B.....
> 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk
> backtrace:
> [<00000000a2981b60>] vxlan_fdb_create+0x67/0x1a0 [vxlan]
> [<0000000049399045>] vxlan_fdb_update+0x12f/0x220 [vxlan]
> [<0000000090b1ef00>] vxlan_fdb_add+0x12a/0x1b0 [vxlan]
> [<0000000056633c2c>] rtnl_fdb_add+0x187/0x270
> [<00000000dd5dfb6b>] rtnetlink_rcv_msg+0x264/0x490
> [<00000000fc44dd54>] netlink_rcv_skb+0x4a/0x110
> [<00000000dff433e7>] netlink_unicast+0x18e/0x250
> [<00000000b87fb421>] netlink_sendmsg+0x2e9/0x400
> [<000000002ed55153>] ____sys_sendmsg+0x237/0x260
> [<00000000faa51c66>] ___sys_sendmsg+0x88/0xd0
> [<000000006c3982f1>] __sys_sendmsg+0x4e/0x80
> [<00000000a8f875d2>] do_syscall_64+0x56/0xe0
> [<000000003610eefa>] entry_SYSCALL_64_after_hwframe+0x44/0xa9
>
> Fixes: 3ad7a4b141eb ("vxlan: support fdb and learning in COLLECT_METADATA mode")
> Signed-off-by: Taehee Yoo <ap420073@gmail.com>
> ---
Acked-by: Roopa Prabhu <roopa@cumulusnetworks.com>
looks right, thanks
^ permalink raw reply
* [PATCH net-next v3 2/2] net: dsa: qca8k: Add 802.1q VLAN support
From: Jonathan McDowell @ 2020-08-01 17:06 UTC (permalink / raw)
To: Andrew Lunn, Vivien Didelot, Florian Fainelli, Vladimir Oltean,
David Miller, Jakub Kicinski, Russell King - ARM Linux admin,
Matthew Hagan, netdev, linux-kernel
In-Reply-To: <20200721171624.GK23489@earth.li>
This adds full 802.1q VLAN support to the qca8k, allowing the use of
vlan_filtering and more complicated bridging setups than allowed by
basic port VLAN support.
Tested with a number of untagged ports with separate VLANs and then a
trunk port with all the VLANs tagged on it.
v3:
- Pull QCA8K_PORT_VID_DEF changes into separate cleanup patch
- Reverse Christmas tree notation for variable definitions
- Use untagged instead of tagged for consistency
v2:
- Return sensible errnos on failure rather than -1 (rmk)
- Style cleanups based on Florian's feedback
- Silently allow VLAN 0 as device correctly treats this as no tag
Signed-off-by: Jonathan McDowell <noodles@earth.li>
---
drivers/net/dsa/qca8k.c | 181 ++++++++++++++++++++++++++++++++++++++++
drivers/net/dsa/qca8k.h | 27 ++++++
2 files changed, 208 insertions(+)
diff --git a/drivers/net/dsa/qca8k.c b/drivers/net/dsa/qca8k.c
index 3ebc4da63074..f1e484477e35 100644
--- a/drivers/net/dsa/qca8k.c
+++ b/drivers/net/dsa/qca8k.c
@@ -408,6 +408,112 @@ qca8k_fdb_flush(struct qca8k_priv *priv)
mutex_unlock(&priv->reg_mutex);
}
+static int
+qca8k_vlan_access(struct qca8k_priv *priv, enum qca8k_vlan_cmd cmd, u16 vid)
+{
+ u32 reg;
+
+ /* Set the command and VLAN index */
+ reg = QCA8K_VTU_FUNC1_BUSY;
+ reg |= cmd;
+ reg |= vid << QCA8K_VTU_FUNC1_VID_S;
+
+ /* Write the function register triggering the table access */
+ qca8k_write(priv, QCA8K_REG_VTU_FUNC1, reg);
+
+ /* wait for completion */
+ if (qca8k_busy_wait(priv, QCA8K_REG_VTU_FUNC1, QCA8K_VTU_FUNC1_BUSY))
+ return -ETIMEDOUT;
+
+ /* Check for table full violation when adding an entry */
+ if (cmd == QCA8K_VLAN_LOAD) {
+ reg = qca8k_read(priv, QCA8K_REG_VTU_FUNC1);
+ if (reg & QCA8K_VTU_FUNC1_FULL)
+ return -ENOMEM;
+ }
+
+ return 0;
+}
+
+static int
+qca8k_vlan_add(struct qca8k_priv *priv, u8 port, u16 vid, bool untagged)
+{
+ u32 reg;
+ int ret;
+
+ /*
+ We do the right thing with VLAN 0 and treat it as untagged while
+ preserving the tag on egress.
+ */
+ if (vid == 0)
+ return 0;
+
+ mutex_lock(&priv->reg_mutex);
+ ret = qca8k_vlan_access(priv, QCA8K_VLAN_READ, vid);
+ if (ret < 0)
+ goto out;
+
+ reg = qca8k_read(priv, QCA8K_REG_VTU_FUNC0);
+ reg |= QCA8K_VTU_FUNC0_VALID | QCA8K_VTU_FUNC0_IVL_EN;
+ reg &= ~(QCA8K_VTU_FUNC0_EG_MODE_MASK << QCA8K_VTU_FUNC0_EG_MODE_S(port));
+ if (untagged)
+ reg |= QCA8K_VTU_FUNC0_EG_MODE_UNTAG <<
+ QCA8K_VTU_FUNC0_EG_MODE_S(port);
+ else
+ reg |= QCA8K_VTU_FUNC0_EG_MODE_TAG <<
+ QCA8K_VTU_FUNC0_EG_MODE_S(port);
+
+ qca8k_write(priv, QCA8K_REG_VTU_FUNC0, reg);
+ ret = qca8k_vlan_access(priv, QCA8K_VLAN_LOAD, vid);
+
+out:
+ mutex_unlock(&priv->reg_mutex);
+
+ return ret;
+}
+
+static int
+qca8k_vlan_del(struct qca8k_priv *priv, u8 port, u16 vid)
+{
+ u32 reg, mask;
+ int ret, i;
+ bool del;
+
+ mutex_lock(&priv->reg_mutex);
+ ret = qca8k_vlan_access(priv, QCA8K_VLAN_READ, vid);
+ if (ret < 0)
+ goto out;
+
+ reg = qca8k_read(priv, QCA8K_REG_VTU_FUNC0);
+ reg &= ~(3 << QCA8K_VTU_FUNC0_EG_MODE_S(port));
+ reg |= QCA8K_VTU_FUNC0_EG_MODE_NOT <<
+ QCA8K_VTU_FUNC0_EG_MODE_S(port);
+
+ /* Check if we're the last member to be removed */
+ del = true;
+ for (i = 0; i < QCA8K_NUM_PORTS; i++) {
+ mask = QCA8K_VTU_FUNC0_EG_MODE_NOT;
+ mask <<= QCA8K_VTU_FUNC0_EG_MODE_S(i);
+
+ if ((reg & mask) != mask) {
+ del = false;
+ break;
+ }
+ }
+
+ if (del) {
+ ret = qca8k_vlan_access(priv, QCA8K_VLAN_PURGE, vid);
+ } else {
+ qca8k_write(priv, QCA8K_REG_VTU_FUNC0, reg);
+ ret = qca8k_vlan_access(priv, QCA8K_VLAN_LOAD, vid);
+ }
+
+out:
+ mutex_unlock(&priv->reg_mutex);
+
+ return ret;
+}
+
static void
qca8k_mib_init(struct qca8k_priv *priv)
{
@@ -1187,6 +1293,76 @@ qca8k_port_fdb_dump(struct dsa_switch *ds, int port,
return 0;
}
+static int
+qca8k_port_vlan_filtering(struct dsa_switch *ds, int port, bool vlan_filtering)
+{
+ struct qca8k_priv *priv = ds->priv;
+
+ if (vlan_filtering) {
+ qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(port),
+ QCA8K_PORT_LOOKUP_VLAN_MODE,
+ QCA8K_PORT_LOOKUP_VLAN_MODE_SECURE);
+ } else {
+ qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(port),
+ QCA8K_PORT_LOOKUP_VLAN_MODE,
+ QCA8K_PORT_LOOKUP_VLAN_MODE_NONE);
+ }
+
+ return 0;
+}
+
+static int
+qca8k_port_vlan_prepare(struct dsa_switch *ds, int port,
+ const struct switchdev_obj_port_vlan *vlan)
+{
+ return 0;
+}
+
+static void
+qca8k_port_vlan_add(struct dsa_switch *ds, int port,
+ const struct switchdev_obj_port_vlan *vlan)
+{
+ bool untagged = vlan->flags & BRIDGE_VLAN_INFO_UNTAGGED;
+ bool pvid = vlan->flags & BRIDGE_VLAN_INFO_PVID;
+ struct qca8k_priv *priv = ds->priv;
+ int ret = 0;
+ u16 vid;
+
+ for (vid = vlan->vid_begin; vid <= vlan->vid_end && !ret; ++vid)
+ ret = qca8k_vlan_add(priv, port, vid, untagged);
+
+ if (ret)
+ dev_err(priv->dev, "Failed to add VLAN to port %d (%d)", port, ret);
+
+ if (pvid) {
+ int shift = 16 * (port % 2);
+
+ qca8k_rmw(priv, QCA8K_EGRESS_VLAN(port),
+ 0xfff << shift,
+ vlan->vid_end << shift);
+ qca8k_write(priv, QCA8K_REG_PORT_VLAN_CTRL0(port),
+ QCA8K_PORT_VLAN_CVID(vlan->vid_end) |
+ QCA8K_PORT_VLAN_SVID(vlan->vid_end));
+ }
+}
+
+static int
+qca8k_port_vlan_del(struct dsa_switch *ds, int port,
+ const struct switchdev_obj_port_vlan *vlan)
+{
+ struct qca8k_priv *priv = ds->priv;
+ int ret = 0;
+ u16 vid;
+
+ for (vid = vlan->vid_begin; vid <= vlan->vid_end && !ret; ++vid)
+ ret = qca8k_vlan_del(priv, port, vid);
+
+ if (ret)
+ dev_err(priv->dev, "Failed to delete VLAN from port %d (%d)", port, ret);
+
+ return ret;
+}
+
static enum dsa_tag_protocol
qca8k_get_tag_protocol(struct dsa_switch *ds, int port,
enum dsa_tag_protocol mp)
@@ -1212,6 +1388,10 @@ static const struct dsa_switch_ops qca8k_switch_ops = {
.port_fdb_add = qca8k_port_fdb_add,
.port_fdb_del = qca8k_port_fdb_del,
.port_fdb_dump = qca8k_port_fdb_dump,
+ .port_vlan_filtering = qca8k_port_vlan_filtering,
+ .port_vlan_prepare = qca8k_port_vlan_prepare,
+ .port_vlan_add = qca8k_port_vlan_add,
+ .port_vlan_del = qca8k_port_vlan_del,
.phylink_validate = qca8k_phylink_validate,
.phylink_mac_link_state = qca8k_phylink_mac_link_state,
.phylink_mac_config = qca8k_phylink_mac_config,
@@ -1262,6 +1442,7 @@ qca8k_sw_probe(struct mdio_device *mdiodev)
priv->ds->dev = &mdiodev->dev;
priv->ds->num_ports = QCA8K_NUM_PORTS;
+ priv->ds->configure_vlan_while_not_filtering = true;
priv->ds->priv = priv;
priv->ops = qca8k_switch_ops;
priv->ds->ops = &priv->ops;
diff --git a/drivers/net/dsa/qca8k.h b/drivers/net/dsa/qca8k.h
index 92216a52daa5..7ca4b93e0bb5 100644
--- a/drivers/net/dsa/qca8k.h
+++ b/drivers/net/dsa/qca8k.h
@@ -128,6 +128,19 @@
#define QCA8K_ATU_FUNC_FULL BIT(12)
#define QCA8K_ATU_FUNC_PORT_M 0xf
#define QCA8K_ATU_FUNC_PORT_S 8
+#define QCA8K_REG_VTU_FUNC0 0x610
+#define QCA8K_VTU_FUNC0_VALID BIT(20)
+#define QCA8K_VTU_FUNC0_IVL_EN BIT(19)
+#define QCA8K_VTU_FUNC0_EG_MODE_S(_i) (4 + (_i) * 2)
+#define QCA8K_VTU_FUNC0_EG_MODE_MASK 3
+#define QCA8K_VTU_FUNC0_EG_MODE_UNMOD 0
+#define QCA8K_VTU_FUNC0_EG_MODE_UNTAG 1
+#define QCA8K_VTU_FUNC0_EG_MODE_TAG 2
+#define QCA8K_VTU_FUNC0_EG_MODE_NOT 3
+#define QCA8K_REG_VTU_FUNC1 0x614
+#define QCA8K_VTU_FUNC1_BUSY BIT(31)
+#define QCA8K_VTU_FUNC1_VID_S 16
+#define QCA8K_VTU_FUNC1_FULL BIT(4)
#define QCA8K_REG_GLOBAL_FW_CTRL0 0x620
#define QCA8K_GLOBAL_FW_CTRL0_CPU_PORT_EN BIT(10)
#define QCA8K_REG_GLOBAL_FW_CTRL1 0x624
@@ -137,6 +150,11 @@
#define QCA8K_GLOBAL_FW_CTRL1_UC_DP_S 0
#define QCA8K_PORT_LOOKUP_CTRL(_i) (0x660 + (_i) * 0xc)
#define QCA8K_PORT_LOOKUP_MEMBER GENMASK(6, 0)
+#define QCA8K_PORT_LOOKUP_VLAN_MODE GENMASK(9, 8)
+#define QCA8K_PORT_LOOKUP_VLAN_MODE_NONE (0 << 8)
+#define QCA8K_PORT_LOOKUP_VLAN_MODE_FALLBACK (1 << 8)
+#define QCA8K_PORT_LOOKUP_VLAN_MODE_CHECK (2 << 8)
+#define QCA8K_PORT_LOOKUP_VLAN_MODE_SECURE (3 << 8)
#define QCA8K_PORT_LOOKUP_STATE_MASK GENMASK(18, 16)
#define QCA8K_PORT_LOOKUP_STATE_DISABLED (0 << 16)
#define QCA8K_PORT_LOOKUP_STATE_BLOCKING (1 << 16)
@@ -180,6 +198,15 @@ enum qca8k_fdb_cmd {
QCA8K_FDB_SEARCH = 7,
};
+enum qca8k_vlan_cmd {
+ QCA8K_VLAN_FLUSH = 1,
+ QCA8K_VLAN_LOAD = 2,
+ QCA8K_VLAN_PURGE = 3,
+ QCA8K_VLAN_REMOVE_PORT = 4,
+ QCA8K_VLAN_NEXT = 5,
+ QCA8K_VLAN_READ = 6,
+};
+
struct ar8xxx_port_status {
int enabled;
};
--
2.20.1
^ permalink raw reply related
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