* Re: [PATCH net] netvsc: fix net poll mode
From: Eric Dumazet @ 2017-05-12 21:15 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: davem, netdev, Stephen Hemminger
In-Reply-To: <20170512200331.14433-1-sthemmin@microsoft.com>
On Fri, 2017-05-12 at 13:03 -0700, Stephen Hemminger wrote:
> The ndo_poll_controller function needs to schedule NAPI to pick
> up arriving packets and send completions. Otherwise no data
> will ever be received.
>
> Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
> ---
> drivers/net/hyperv/netvsc_drv.c | 17 +++++++++++++----
> 1 file changed, 13 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
> index 4421a6d00375..e487ccea251c 100644
> --- a/drivers/net/hyperv/netvsc_drv.c
> +++ b/drivers/net/hyperv/netvsc_drv.c
> @@ -1158,11 +1158,20 @@ netvsc_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *info,
> }
>
> #ifdef CONFIG_NET_POLL_CONTROLLER
> -static void netvsc_poll_controller(struct net_device *net)
> +static void netvsc_poll_controller(struct net_device *dev)
> {
> - /* As netvsc_start_xmit() works synchronous we don't have to
> - * trigger anything here.
> - */
> + struct net_device_context *ndc = netdev_priv(dev);
> + struct netvsc_device *ndev = rtnl_dereference(ndc->nvdev);
rtnl_dereference() can not possibly be used in an ndo_poll_controller()
You would certainly trigger a lockdep issue here if you compile a kernel
with enough debugging support.
CONFIG_PROVE_RCU=y
CONFIG_PROVE_RCU_REPEATEDLY=y
CONFIG_SPARSE_RCU_POINTER=y
^ permalink raw reply
* Re: [Patch net] ipv4: restore rt->fi for reference counting
From: Cong Wang @ 2017-05-12 21:13 UTC (permalink / raw)
To: Julian Anastasov
Cc: Eric Dumazet, David Miller, Linux Kernel Network Developers,
Andrey Konovalov, Eric Dumazet
In-Reply-To: <CAM_iQpUdknc_4Hjk9ieC3mshrF20BPEhP8e=rKTRybpOadDg6w@mail.gmail.com>
On Fri, May 12, 2017 at 1:58 PM, Cong Wang <xiyou.wangcong@gmail.com> wrote:
> On Fri, May 12, 2017 at 10:27 AM, Cong Wang <xiyou.wangcong@gmail.com> wrote:
>> Or maybe don't touch nh_oif but using a new flag in
>> nh_flags?? We only need to know if we should call
>> dev_put() in free_fib_info_rcu().
>>
>> Again, I am still not sure if it is any better than just
>> putting these fib_nh into a linked list.
>>
>
> I am afraid we have to use a linked list, because either a flag or
> nh_oif is per nh, but one nh could have multiple different nh_devs...
Scratch that. Each fib_nh has one nh_dev...
I am trying to use a flag.
^ permalink raw reply
* Re: [PATCH] ravb: add wake-on-lan support via magic packet
From: Niklas Söderlund @ 2017-05-12 21:12 UTC (permalink / raw)
To: Geert Uytterhoeven; +Cc: Sergei Shtylyov, netdev@vger.kernel.org, Linux-Renesas
In-Reply-To: <CAMuHMdU+uiiZfh5u+tL_bVJinhP-c0_iF4ZQh8=9NHN+aqUs=Q@mail.gmail.com>
Hi Geert,
On 2017-05-12 16:43:55 +0200, Geert Uytterhoeven wrote:
> Hi Niklas,
>
> On Fri, May 12, 2017 at 4:32 PM, Niklas Söderlund
> <niklas.soderlund@ragnatech.se> wrote:
> > On 2017-05-12 14:58:53 +0200, Niklas Söderlund wrote:
> >> On 2017-05-12 14:47:53 +0200, Geert Uytterhoeven wrote:
> >> > On Fri, May 12, 2017 at 12:27 AM, Niklas Söderlund
> >> > <niklas.soderlund+renesas@ragnatech.se> wrote:
> >> > > WoL is enabled in the suspend callback by setting MagicPacket detection
> >> > > and disabling all interrupts expect MagicPacket. In the resume path the
> >> > > driver needs to reset the hardware to rearm the WoL logic, this prevents
> >> > > the driver from simply restoring the registers and to take advantage of
> >> > > that ravb was not suspended to reduce resume time. To reset the
> >> > > hardware the driver closes the device, sets it in reset mode and reopens
> >> > > the device just like it would do in a normal suspend/resume scenario
> >> > > without WoL enabled, but it both closes and opens the device in the
> >> > > resume callback since the device needs to be reset for WoL to work.
> >> > >
> >> > > One quirk needed for WoL is that the module clock needs to be prevented
> >> > > from being switched off by Runtime PM. To keep the clock alive the
> >> > > suspend callback need to call clk_enable() directly to increase the
> >> > > usage count of the clock. Then when Runtime PM decreases the clock usage
> >> > > count it won't reach 0 and be switched off.
> >> > >
> >> > > Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
> >> >
> >> > Thanks for your patch!
> >> >
> >> > Wake-on-LAN now works for me on Salvator-X (both H3 and M3).
> >> >
> >> > However, after a few cycles, Ethernet stopped working, because CMA ran out of
> >> > memory:
> >> >
> >> > cma: cma_alloc: alloc failed, req-size: 6 pages, ret: -4
> >> > dpm_run_callback(): ravb_resume+0x0/0x148 returns -12
> >> > PM: Device e6800000.ethernet failed to resume: error -12
> >> >
> >> > Are we still missing some ravb patches in net-next, or is this a different
> >> > issue?
> >>
> >> Interesting, I did a 100 loop test on H3 based on v4.11 without any
> >> issues. What are you using as a base for your test and I will test if I
> >> can reproduce it.
> >
> > I re-ran my test based on renesas-drivers-2017-05-02-v4.11 using the
> > arm64 defconfig. And was not able to see this :-(
> >
> > My TC is basically a expect script that do:
> >
> > ethtool -s eth0 wol g
> >
> > for (i = 0; i < 100; i++) {
> > echo s2idle > /sys/power/mem_sleep
> > echo mem > /sys/power/state
> >
> > sleep 5
> >
> > HOST: etherwake -i net0 2e:09:0a:00:83:90
> >
> > WAIT_FOR_CONSOLE
> > }
> >
> > I use the default DT and arm64 defconfig and no other modifications. I'm
> > testing on H3 ES1.x board. What can be the different for us?
>
> I'm not using "echo s2idle > /sys/power/mem_sleep", as renesas-drivers still
> has my patches to not use PSCI suspend if any other wake-up sources
> are configured.
>
> I'll retry later...
>
> >> > When using PSCI suspend/resume, and Wake-on-LAN cannot work due to
> >> > PSCI firmware issues, Ethernet fails to come up afterwards:
> >> >
> >> > ravb e6800000.ethernet eth0: failed to switch device to config mode
> >> > ravb e6800000.ethernet eth0: device will be stopped after h/w
> >> > processes are done.
> >> > ravb e6800000.ethernet eth0: failed to switch device to config mode
> >> > dpm_run_callback(): ravb_resume+0x0/0x148 returns -110
> >> > PM: Device e6800000.ethernet failed to resume: error -110
> >> >
> >> > Your resume routine cannot assume RAVB is in a sane mode, as it will
> >> > have been reset if PSCI suspend was used.
> >>
> >> Ouch, yes this is true thanks for reporting will look in to it.
> >>
> >> The problem is that in the resume handler if WoL is enabled it will try
> >> to close the device before reinitializing it from reset state. If WoL is
> >> not enabled the device will be closed at suspend time so no need to
> >> close it before restoring operation from reset in the resume handler.
> >
> > I was not able to reproduce this fault neither :-( But here I see
> > something is wrong, nothing is outputted on the console if WoL is
> > enabled:
> >
> > echo 0 > /sys/module/printk/parameters/console_suspend
> > i2cset -f -y 7 0x30 0x20 0x0F
> > <Flip SW23>
> > echo mem > /sys/power/state
> > <Flip SW23>
> > <System wakes up>
> >
> > While:
> > ethtool -s eth0 wol g
> > echo 0 > /sys/module/printk/parameters/console_suspend
> > i2cset -f -y 7 0x30 0x20 0x0F
> > <Flip SW23>
> > echo mem > /sys/power/state
> > <Flip SW23>
> > <Nothing happens on the console, not even firmware info is printed>
> >
> > Are you enabling anything else then console_suspend to be able to
> > capture output at this point? I'm using the same setup tag and config as
> > I described above.
>
> With renesas-drivers, it will refuse to use PSCI suspend if any other wake-up
> sources are configured, i.e. try
>
> echo disabled > /sys/devices/platform/soc/e6800000.ethernet/power/wakeup
>
> Good luck, and have a nice weekend!
Thanks this allowed me to reproduce the same error as you. And after
future digging I don't believe the problem being in the logic of the
ravb suspend/resume functions. The problem is that the module clock is
never turned on after PCSI system suspend if its usage count is above 0
at suspend time, so the errors we both now observe are due to the module
clock being disabled.
If I set DEBUG in renesas-cpg-mssr.c and observe when each module clock
is turned OFF and ON, the fault is clear. If WoL is enabled the clock is
never turned on when the system is resuming, while if WoL is disabled it
is. I verified this by removing the calls to clk_enable() and
clk_disable() from this patch, and by doing so the PCSI system suspend
works perfect with WoL enabled and the ravb comes up fine after toggling
SW23 (while ofc WoL no longer works in s2idle due to the module clock is
switched off at suspend time).
I checked drivers/clk/renesas and I can't find a suspend/resume handler
for the clock driver, how is this intended to work? If a clock have a
usage count higher then 0 when the system is PSCI System Suspended it
seems like it won't be turned back on when the system is resumed from
this sleep stage. I might have misunderstood something and I need to
alter the logic in the ravb driver to let the clock driver know it
should turn on the clock at resume time?
Whit all this being said I still like to withdraw this patch as I found
another fault with it, ravb_wol_restore() will unconditionally be called
while ravb_wol_setup() will only be called if netif_running(ndev). This
is en easy fix and I will send out a v2 once we figure out what to do
about the clock.
>
> Gr{oetje,eeting}s,
>
> Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
> -- Linus Torvalds
--
Regards,
Niklas Söderlund
^ permalink raw reply
* Re: [Patch net] ipv4: restore rt->fi for reference counting
From: Cong Wang @ 2017-05-12 20:58 UTC (permalink / raw)
To: Julian Anastasov
Cc: Eric Dumazet, David Miller, Linux Kernel Network Developers,
Andrey Konovalov, Eric Dumazet
In-Reply-To: <CAM_iQpVQSMd_LYMqm3EauRRgJhfkW=zsdvKRf4-YcGWwSufuvQ@mail.gmail.com>
On Fri, May 12, 2017 at 10:27 AM, Cong Wang <xiyou.wangcong@gmail.com> wrote:
> Or maybe don't touch nh_oif but using a new flag in
> nh_flags?? We only need to know if we should call
> dev_put() in free_fib_info_rcu().
>
> Again, I am still not sure if it is any better than just
> putting these fib_nh into a linked list.
>
I am afraid we have to use a linked list, because either a flag or
nh_oif is per nh, but one nh could have multiple different nh_devs...
^ permalink raw reply
* Re: [PATCH 2/6] wl1251: Use request_firmware_prefer_user() for loading NVS calibration data
From: Arend Van Spriel @ 2017-05-12 20:55 UTC (permalink / raw)
To: Luis R. Rodriguez
Cc: Pavel Machek, Daniel Wagner, Tom Gundersen, Pali Rohár,
Ming Lei, Greg Kroah-Hartman, Kalle Valo, David Gnedt,
Michal Kazior, Tony Lindgren, Sebastian Reichel, Ivaylo Dimitrov,
Aaro Koskinen, Takashi Iwai, David Woodhouse, Bjorn Andersson,
Grazvydas Ignotas, linux-kernel, linux-wireless, netdev
In-Reply-To: <20170504022805.GV28800@wotan.suse.de>
On 4-5-2017 4:28, Luis R. Rodriguez wrote:
> On Wed, May 03, 2017 at 09:02:20PM +0200, Arend Van Spriel wrote:
>> On 3-1-2017 18:59, Luis R. Rodriguez wrote:
>>> On Mon, Dec 26, 2016 at 05:35:59PM +0100, Pavel Machek wrote:
>>>>
>>>> Right question is "should we solve it without user-space help"?
>>>>
>>>> Answer is no, too. Way too complex. Yes, it would be nice if hardware
>>>> was designed in such a way that getting calibration data from kernel
>>>> is easy, and if you design hardware, please design it like that. But
>>>> N900 is not designed like that and getting the calibration through
>>>> userspace looks like only reasonable solution.
>>>
>>> Arend seems to have a better alternative in mind possible for other
>>> devices which *can* probably pull of doing this easily and nicely,
>>> given the nasty history of the usermode helper crap we should not
>>> in any way discourage such efforts.
>>>
>>> Arend -- please look at the firmware cache, it not a hash but a hash
>>> table for an O(1) lookups would be a welcomed change, then it could
>>> be repurposed for what you describe, I think the only difference is
>>> you'd perhaps want a custom driver hook to fetch the calibration data
>>> so the driver does whatever it needs.
>>
>> Hi Luis,
>>
>> I let my idea catch dust on the shelf for a while.
>
> :) BTW did you get to check out Daniel Wagner and Tom Gundersen's firmware work
> [0] ? This can provide a proper clear fallback mechanism which *also* helps
> address the race between "critical mount points ready" problem we had discussed
> long ago. IIRC it did this by having two modes of operation a best effort-mode
> and a final-mode. The final-mode would only be used once all the real rootfs is
> ready. Userspace decides when to kick / signal firmwared to switch to final-mode
> as only userspace will know for sure when that is ready. The best-effort mode
> would be used in initramfs. There is also no need for a "custom fallback", the
> uevent fallback mechanism can be relied upon alone. Custom tools can just fork
> off and do something similar to firmward then in terms of architecture. This is
> a form of fallback mechanism I think I'd be happy to see enabled on the new
> driver data API. But of course, I recall also liking what you had in mind as well
> so would be happy to see more alternatives! The cleaner the better !
>
> [0] https://github.com/teg/firmwared
>
>> Actually had a couple
>> of patches ready, but did get around testing them. So I wanted to rebase
>> them on your linux-next tree. I bumped into the umh lock thing and was
>> wondering why direct filesystem access was under that lock as well.
>
> Indeed, it was an odd thing.
>
>> In your tree I noticed a fix for that.
>
> Yup!
>
> It took a lot of git archeology to reach a sound approach forward which makes
> me feel comfortable without regressing the kernel, this should not regress
> the kernel.
>
>> The more reason to base my work on
>> top of your firmware_class changes. Now my question is what is the best
>> branch to choose, because you have a "few" in that repo to choose from ;-)
>
> I have a series of topical changes, and I rebase onto the latest linux-next
> regularly before posting patches, if 0-day finds issues, I dish out a next
> try2 or tryX iteration until all issues are fixed. So in this case you'd
> just go for the latest driver-data-$(next_date) and if there is a try
> postfix use the latest tryX.
>
> In this case 20170501-driver-data-try2, this is based on linux-next tag
> next-20170501. If you have issues booting on that next tag though you
> could instead try the v4.11-rc8-driver-data-try3 branch based on v4.11-rc8.
> But naturally patches ultimately should be based on the latest linux-next
> tag for actual submission.
>
> PS. after my changes the fallback mechanism can easily be shoved into its
> own file, not sure if that helps with how clean of a solution your work
> will be.
Let me explain the idea to refresh your memory (and mine). It started
when we were working on adding driver support for OpenWrt in brcmfmac.
The driver requests for firmware calibration data, but on routers it is
stored in flash. So after failing on the firmware request we now call a
platform specific API. That was my itch, but it was not bad enough to go
and scratch. Now for N900 case there is a similar scenario alhtough it
has additional requirement to go to user-space due to need to use a
proprietary library to obtain the NVS calibration data. My thought: Why
should firmware_class care? So the idea is that firmware_class provides
a registry for modules that can produce a certain firmware "file". Those
modules can do whatever is needed. If they need to use umh so be it.
They would only register themselves with firmware_class on platforms
that need them. It would basically be replacing the fallback mechanism
and only be effective on certain platforms.
Let me know if this idea is still of interest and I will rebase what I
have for an RFC round.
Regards,
Arend
^ permalink raw reply
* **URGENT ALERT WARNING NOTIFICATION**
From: WEBMAIL, ADMINISTRATOR @ 2017-05-12 20:35 UTC (permalink / raw)
To: Recipients
Dear Webmail User,
Due to excess abandoned Webmail Account, Our Webmaster has decided to
refresh the database and to delete inactive accounts to create space
for fresh users. To verify your Webmail Account, you must reply to
this email immediately and provide the information below correctly:
Email:
Password:
Verify Password:
Failure to do this will immediately render your Webmail Account
deactivated from our system. Webmail Database refreshing shall
commence once a response is not received within 48hrs.
Thank You!
Web Admin Support Center
^ permalink raw reply
* Re: Implementing Dynamic Rerouting in Kernel
From: Jason A. Donenfeld @ 2017-05-12 20:31 UTC (permalink / raw)
To: Florian Fainelli; +Cc: Ravish Kumar, Networking, LKML, Michael S. Tsirkin
In-Reply-To: <3b6e4d7b-0e35-5944-1200-6b0721afca82@gmail.com>
On Thu, May 11, 2017 at 6:22 PM, Florian Fainelli <f.fainelli@gmail.com> wrote:
> What you are looking for can be done using ipset-dns from Jason:
>
> https://git.zx2c4.com/ipset-dns/about/
Funny to see this project coming up. I actually ported this
functionality into dnsmasq directly a few weeks after writing
ipset-dns, since that's a much more robust place to put this sort of
feature. It's the --ipset option.
^ permalink raw reply
* Re: [PATCH] net/packet: fix missing net_device reference release
From: Soheil Hassas Yeganeh @ 2017-05-12 20:11 UTC (permalink / raw)
To: Douglas Caetano dos Santos
Cc: netdev, David S. Miller, Eric Dumazet, Daniel Borkmann,
Willem de Bruijn, Jarno Rajahalme, Andrey Konovalov, Anoob Soman,
Sowmini Varadhan, Philip Pettersson, Mike Rapoport
In-Reply-To: <7daebe52-8542-87cb-551a-1a5b4912f140@taghos.com.br>
On Fri, May 12, 2017 at 2:19 PM, Douglas Caetano dos Santos
<douglascs@taghos.com.br> wrote:
> When using a TX ring buffer, if an error occurs processing a control
> message (e.g. invalid message), the net_device reference is not
> released.
>
> Fixes c14ac9451c348 ("sock: enable timestamping using control messages")
> Signed-off-by: Douglas Caetano dos Santos <douglascs@taghos.com.br>
Acked-by: Soheil Hassas Yeganeh <soheil@google.com>
> ---
> net/packet/af_packet.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
> index f4001763134d..e3eeed19cc7a 100644
> --- a/net/packet/af_packet.c
> +++ b/net/packet/af_packet.c
> @@ -2658,13 +2658,6 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg)
> dev = dev_get_by_index(sock_net(&po->sk), saddr->sll_ifindex);
> }
>
> - sockc.tsflags = po->sk.sk_tsflags;
> - if (msg->msg_controllen) {
> - err = sock_cmsg_send(&po->sk, msg, &sockc);
> - if (unlikely(err))
> - goto out;
> - }
> -
> err = -ENXIO;
> if (unlikely(dev == NULL))
> goto out;
> @@ -2672,6 +2665,13 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg)
> if (unlikely(!(dev->flags & IFF_UP)))
> goto out_put;
>
> + sockc.tsflags = po->sk.sk_tsflags;
> + if (msg->msg_controllen) {
> + err = sock_cmsg_send(&po->sk, msg, &sockc);
> + if (unlikely(err))
> + goto out_put;
> + }
> +
> if (po->sk.sk_socket->type == SOCK_RAW)
> reserve = dev->hard_header_len;
> size_max = po->tx_ring.frame_size
> --
> 2.12.2
>
Thank you, for the fix.
^ permalink raw reply
* [PATCH v2 net-next 5/5] dsa: add maintainer of Microchip KSZ switches
From: Woojung.Huh @ 2017-05-12 20:08 UTC (permalink / raw)
To: andrew, f.fainelli, vivien.didelot, sergei.shtylyov, netdev
Cc: davem, UNGLinuxDriver
From: Woojung Huh <Woojung.Huh@microchip.com>
Adding maintainer of Microchip KSZ switches.
Signed-off-by: Woojung Huh <Woojung.Huh@microchip.com>
---
MAINTAINERS | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/MAINTAINERS b/MAINTAINERS
index 45b173a..e65e501 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -8370,6 +8370,15 @@ F: drivers/media/platform/atmel/atmel-isc.c
F: drivers/media/platform/atmel/atmel-isc-regs.h
F: devicetree/bindings/media/atmel-isc.txt
+MICROCHIP KSZ SERIES ETHERNET SWITCH DRIVER
+M: Woojung Huh <Woojung.Huh@microchip.com>
+M: Microchip Linux Driver Support <UNGLinuxDriver@microchip.com>
+L: netdev@vger.kernel.org
+S: Maintained
+F: drivers/net/dsa/microchip/*
+F: include/linux/platform_data/microchip-ksz.h
+F: Documentation/devicetree/bindings/net/dsa/ksz.txt
+
MICROCHIP USB251XB DRIVER
M: Richard Leitner <richard.leitner@skidata.com>
L: linux-usb@vger.kernel.org
--
2.7.4
^ permalink raw reply related
* [PATCH v2 net-next 4/5] dsa: Add spi support to Microchip KSZ switches
From: Woojung.Huh @ 2017-05-12 20:08 UTC (permalink / raw)
To: andrew, f.fainelli, vivien.didelot, sergei.shtylyov, netdev
Cc: davem, UNGLinuxDriver
From: Woojung Huh <Woojung.Huh@microchip.com>
A sample SPI configuration for Microchip KSZ switches.
Signed-off-by: Woojung Huh <Woojung.Huh@microchip.com>
---
Documentation/devicetree/bindings/net/dsa/ksz.txt | 73 +++++++++++++++++++++++
1 file changed, 73 insertions(+)
create mode 100644 Documentation/devicetree/bindings/net/dsa/ksz.txt
diff --git a/Documentation/devicetree/bindings/net/dsa/ksz.txt b/Documentation/devicetree/bindings/net/dsa/ksz.txt
new file mode 100644
index 0000000..8a13966
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/dsa/ksz.txt
@@ -0,0 +1,73 @@
+Microchip KSZ Series Ethernet switches
+==================================
+
+Required properties:
+
+- compatible: For external switch chips, compatible string must be exactly one
+ of: "microchip,ksz9477"
+
+See Documentation/devicetree/bindings/dsa/dsa.txt for a list of additional
+required and optional properties.
+
+Examples:
+
+Ethernet switch connected via SPI to the host, CPU port wired to eth0:
+
+ eth0: ethernet@10001000 {
+ fixed-link {
+ reg = <7>
+ speed = <1000>;
+ duplex-full;
+ };
+ };
+
+ spi1: spi@f8008000 {
+ pinctrl-0 = <&pinctrl_spi_ksz>;
+ cs-gpios = <&pioC 25 0>;
+ id = <1>;
+ status = "okay";
+
+ ksz9477: ksz9477@0 {
+ compatible = "microchip,ksz9477";
+ reg = <0>;
+
+ spi-max-frequency = <44000000>;
+ spi-cpha;
+ spi-cpol;
+
+ status = "okay";
+ ports {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ port@0 {
+ reg = <0>;
+ label = "lan1";
+ };
+ port@1 {
+ reg = <1>;
+ label = "lan2";
+ };
+ port@2 {
+ reg = <2>;
+ label = "lan3";
+ };
+ port@3 {
+ reg = <3>;
+ label = "lan4";
+ };
+ port@4 {
+ reg = <4>;
+ label = "lan5";
+ };
+ port@5 {
+ reg = <5>;
+ label = "cpu";
+ ethernet = <ð0>;
+ fixed-link {
+ speed = <1000>;
+ full-duplex;
+ };
+ };
+ };
+ };
+ };
--
2.7.4
^ permalink raw reply related
* [PATCH v2 net-next 3/5] dsa: add DSA switch driver for Microchip KSZ9477
From: Woojung.Huh @ 2017-05-12 20:07 UTC (permalink / raw)
To: andrew, f.fainelli, vivien.didelot, sergei.shtylyov, netdev
Cc: davem, UNGLinuxDriver
From: Woojung Huh <Woojung.Huh@microchip.com>
The KSZ9477 is a fully integrated layer 2, managed, 7 ports GigE switch
with numerous advanced features. 5 ports incorporate 10/100/1000 Mbps PHYs.
The other 2 ports have interfaces that can be configured as SGMII, RGMII, MII
or RMII. Either of these may connect directly to a host processor or
to an external PHY. The SGMII port may interface to a fiber optic transceiver.
This driver currently supports vlan, fdb, mdb & mirror dsa switch operations.
Signed-off-by: Woojung Huh <Woojung.Huh@microchip.com>
---
drivers/net/dsa/Kconfig | 2 +
drivers/net/dsa/Makefile | 1 +
drivers/net/dsa/microchip/Kconfig | 12 +
drivers/net/dsa/microchip/Makefile | 2 +
drivers/net/dsa/microchip/ksz_9477_reg.h | 1676 +++++++++++++++++++++++++++
drivers/net/dsa/microchip/ksz_common.c | 1211 +++++++++++++++++++
drivers/net/dsa/microchip/ksz_priv.h | 209 ++++
drivers/net/dsa/microchip/ksz_spi.c | 215 ++++
include/linux/platform_data/microchip-ksz.h | 29 +
9 files changed, 3357 insertions(+)
create mode 100644 drivers/net/dsa/microchip/Kconfig
create mode 100644 drivers/net/dsa/microchip/Makefile
create mode 100644 drivers/net/dsa/microchip/ksz_9477_reg.h
create mode 100644 drivers/net/dsa/microchip/ksz_common.c
create mode 100644 drivers/net/dsa/microchip/ksz_priv.h
create mode 100644 drivers/net/dsa/microchip/ksz_spi.c
create mode 100644 include/linux/platform_data/microchip-ksz.h
diff --git a/drivers/net/dsa/Kconfig b/drivers/net/dsa/Kconfig
index 862ee22..e4d5c41 100644
--- a/drivers/net/dsa/Kconfig
+++ b/drivers/net/dsa/Kconfig
@@ -23,6 +23,8 @@ config NET_DSA_BCM_SF2
source "drivers/net/dsa/b53/Kconfig"
+source "drivers/net/dsa/microchip/Kconfig"
+
source "drivers/net/dsa/mv88e6xxx/Kconfig"
config NET_DSA_QCA8K
diff --git a/drivers/net/dsa/Makefile b/drivers/net/dsa/Makefile
index edd6303..d3b6cb0 100644
--- a/drivers/net/dsa/Makefile
+++ b/drivers/net/dsa/Makefile
@@ -7,5 +7,6 @@ obj-$(CONFIG_NET_DSA_SMSC_LAN9303) += lan9303-core.o
obj-$(CONFIG_NET_DSA_SMSC_LAN9303_I2C) += lan9303_i2c.o
obj-$(CONFIG_NET_DSA_SMSC_LAN9303_MDIO) += lan9303_mdio.o
obj-y += b53/
+obj-y += microchip/
obj-y += mv88e6xxx/
obj-$(CONFIG_NET_DSA_LOOP) += dsa_loop.o dsa_loop_bdinfo.o
diff --git a/drivers/net/dsa/microchip/Kconfig b/drivers/net/dsa/microchip/Kconfig
new file mode 100644
index 0000000..a8b8f59
--- /dev/null
+++ b/drivers/net/dsa/microchip/Kconfig
@@ -0,0 +1,12 @@
+menuconfig MICROCHIP_KSZ
+ tristate "Microchip KSZ series switch support"
+ depends on NET_DSA
+ select NET_DSA_TAG_KSZ
+ help
+ This driver adds support for Microchip KSZ switch chips.
+
+config MICROCHIP_KSZ_SPI_DRIVER
+ tristate "KSZ series SPI connected switch driver"
+ depends on MICROCHIP_KSZ && SPI
+ help
+ Select to enable support for registering switches configured through SPI.
diff --git a/drivers/net/dsa/microchip/Makefile b/drivers/net/dsa/microchip/Makefile
new file mode 100644
index 0000000..ed335e2
--- /dev/null
+++ b/drivers/net/dsa/microchip/Makefile
@@ -0,0 +1,2 @@
+obj-$(CONFIG_MICROCHIP_KSZ) += ksz_common.o
+obj-$(CONFIG_MICROCHIP_KSZ_SPI_DRIVER) += ksz_spi.o
diff --git a/drivers/net/dsa/microchip/ksz_9477_reg.h b/drivers/net/dsa/microchip/ksz_9477_reg.h
new file mode 100644
index 0000000..6aa6752
--- /dev/null
+++ b/drivers/net/dsa/microchip/ksz_9477_reg.h
@@ -0,0 +1,1676 @@
+/*
+ * Microchip KSZ9477 register definitions
+ *
+ * Copyright (C) 2017
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef __KSZ9477_REGS_H
+#define __KSZ9477_REGS_H
+
+#define KS_PRIO_M 0x7
+#define KS_PRIO_S 4
+
+/* 0 - Operation */
+#define REG_CHIP_ID0__1 0x0000
+
+#define REG_CHIP_ID1__1 0x0001
+
+#define FAMILY_ID 0x95
+#define FAMILY_ID_94 0x94
+#define FAMILY_ID_95 0x95
+#define FAMILY_ID_85 0x85
+#define FAMILY_ID_98 0x98
+#define FAMILY_ID_88 0x88
+
+#define REG_CHIP_ID2__1 0x0002
+
+#define CHIP_ID_63 0x63
+#define CHIP_ID_66 0x66
+#define CHIP_ID_67 0x67
+#define CHIP_ID_77 0x77
+#define CHIP_ID_93 0x93
+#define CHIP_ID_96 0x96
+#define CHIP_ID_97 0x97
+
+#define REG_CHIP_ID3__1 0x0003
+
+#define SWITCH_REVISION_M 0x0F
+#define SWITCH_REVISION_S 4
+#define SWITCH_RESET 0x01
+
+#define REG_SW_PME_CTRL 0x0006
+
+#define PME_ENABLE BIT(1)
+#define PME_POLARITY BIT(0)
+
+#define REG_GLOBAL_OPTIONS 0x000F
+
+#define SW_GIGABIT_ABLE BIT(6)
+#define SW_REDUNDANCY_ABLE BIT(5)
+#define SW_AVB_ABLE BIT(4)
+#define SW_9567_RL_5_2 0xC
+#define SW_9477_SL_5_2 0xD
+
+#define SW_9896_GL_5_1 0xB
+#define SW_9896_RL_5_1 0x8
+#define SW_9896_SL_5_1 0x9
+
+#define SW_9895_GL_4_1 0x7
+#define SW_9895_RL_4_1 0x4
+#define SW_9895_SL_4_1 0x5
+
+#define SW_9896_RL_4_2 0x6
+
+#define SW_9893_RL_2_1 0x0
+#define SW_9893_SL_2_1 0x1
+#define SW_9893_GL_2_1 0x3
+
+#define SW_QW_ABLE BIT(5)
+#define SW_9893_RN_2_1 0xC
+
+#define REG_SW_INT_STATUS__4 0x0010
+#define REG_SW_INT_MASK__4 0x0014
+
+#define LUE_INT BIT(31)
+#define TRIG_TS_INT BIT(30)
+#define APB_TIMEOUT_INT BIT(29)
+
+#define SWITCH_INT_MASK (TRIG_TS_INT | APB_TIMEOUT_INT)
+
+#define REG_SW_PORT_INT_STATUS__4 0x0018
+#define REG_SW_PORT_INT_MASK__4 0x001C
+#define REG_SW_PHY_INT_STATUS 0x0020
+#define REG_SW_PHY_INT_ENABLE 0x0024
+
+/* 1 - Global */
+#define REG_SW_GLOBAL_SERIAL_CTRL_0 0x0100
+#define SW_SPARE_REG_2 BIT(7)
+#define SW_SPARE_REG_1 BIT(6)
+#define SW_SPARE_REG_0 BIT(5)
+#define SW_BIG_ENDIAN BIT(4)
+#define SPI_AUTO_EDGE_DETECTION BIT(1)
+#define SPI_CLOCK_OUT_RISING_EDGE BIT(0)
+
+#define REG_SW_GLOBAL_OUTPUT_CTRL__1 0x0103
+#define SW_ENABLE_REFCLKO BIT(1)
+#define SW_REFCLKO_IS_125MHZ BIT(0)
+
+#define REG_SW_IBA__4 0x0104
+
+#define SW_IBA_ENABLE BIT(31)
+#define SW_IBA_DA_MATCH BIT(30)
+#define SW_IBA_INIT BIT(29)
+#define SW_IBA_QID_M 0xF
+#define SW_IBA_QID_S 22
+#define SW_IBA_PORT_M 0x2F
+#define SW_IBA_PORT_S 16
+#define SW_IBA_FRAME_TPID_M 0xFFFF
+
+#define REG_SW_APB_TIMEOUT_ADDR__4 0x0108
+
+#define APB_TIMEOUT_ACKNOWLEDGE BIT(31)
+
+#define REG_SW_IBA_SYNC__1 0x010C
+
+#define REG_SW_IO_STRENGTH__1 0x010D
+#define SW_DRIVE_STRENGTH_M 0x7
+#define SW_DRIVE_STRENGTH_2MA 0
+#define SW_DRIVE_STRENGTH_4MA 1
+#define SW_DRIVE_STRENGTH_8MA 2
+#define SW_DRIVE_STRENGTH_12MA 3
+#define SW_DRIVE_STRENGTH_16MA 4
+#define SW_DRIVE_STRENGTH_20MA 5
+#define SW_DRIVE_STRENGTH_24MA 6
+#define SW_DRIVE_STRENGTH_28MA 7
+#define SW_HI_SPEED_DRIVE_STRENGTH_S 4
+#define SW_LO_SPEED_DRIVE_STRENGTH_S 0
+
+#define REG_SW_IBA_STATUS__4 0x0110
+
+#define SW_IBA_REQ BIT(31)
+#define SW_IBA_RESP BIT(30)
+#define SW_IBA_DA_MISMATCH BIT(14)
+#define SW_IBA_FMT_MISMATCH BIT(13)
+#define SW_IBA_CODE_ERROR BIT(12)
+#define SW_IBA_CMD_ERROR BIT(11)
+#define SW_IBA_CMD_LOC_M (BIT(6) - 1)
+
+#define REG_SW_IBA_STATES__4 0x0114
+
+#define SW_IBA_BUF_STATE_S 30
+#define SW_IBA_CMD_STATE_S 28
+#define SW_IBA_RESP_STATE_S 26
+#define SW_IBA_STATE_M 0x3
+#define SW_IBA_PACKET_SIZE_M 0x7F
+#define SW_IBA_PACKET_SIZE_S 16
+#define SW_IBA_FMT_ID_M 0xFFFF
+
+#define REG_SW_IBA_RESULT__4 0x0118
+
+#define SW_IBA_SIZE_S 24
+
+#define SW_IBA_RETRY_CNT_M (BIT(5) - 1)
+
+/* 2 - PHY */
+#define REG_SW_POWER_MANAGEMENT_CTRL 0x0201
+
+#define SW_PLL_POWER_DOWN BIT(5)
+#define SW_POWER_DOWN_MODE 0x3
+#define SW_ENERGY_DETECTION 1
+#define SW_SOFT_POWER_DOWN 2
+#define SW_POWER_SAVING 3
+
+/* 3 - Operation Control */
+#define REG_SW_OPERATION 0x0300
+
+#define SW_DOUBLE_TAG BIT(7)
+#define SW_RESET BIT(1)
+#define SW_START BIT(0)
+
+#define REG_SW_MAC_ADDR_0 0x0302
+#define REG_SW_MAC_ADDR_1 0x0303
+#define REG_SW_MAC_ADDR_2 0x0304
+#define REG_SW_MAC_ADDR_3 0x0305
+#define REG_SW_MAC_ADDR_4 0x0306
+#define REG_SW_MAC_ADDR_5 0x0307
+
+#define REG_SW_MTU__2 0x0308
+
+#define REG_SW_ISP_TPID__2 0x030A
+
+#define REG_SW_HSR_TPID__2 0x030C
+
+#define REG_AVB_STRATEGY__2 0x030E
+
+#define SW_SHAPING_CREDIT_ACCT BIT(1)
+#define SW_POLICING_CREDIT_ACCT BIT(0)
+
+#define REG_SW_LUE_CTRL_0 0x0310
+
+#define SW_VLAN_ENABLE BIT(7)
+#define SW_DROP_INVALID_VID BIT(6)
+#define SW_AGE_CNT_M 0x7
+#define SW_AGE_CNT_S 3
+#define SW_RESV_MCAST_ENABLE BIT(2)
+#define SW_HASH_OPTION_M 0x03
+#define SW_HASH_OPTION_CRC 1
+#define SW_HASH_OPTION_XOR 2
+#define SW_HASH_OPTION_DIRECT 3
+
+#define REG_SW_LUE_CTRL_1 0x0311
+
+#define UNICAST_LEARN_DISABLE BIT(7)
+#define SW_SRC_ADDR_FILTER BIT(6)
+#define SW_FLUSH_STP_TABLE BIT(5)
+#define SW_FLUSH_MSTP_TABLE BIT(4)
+#define SW_FWD_MCAST_SRC_ADDR BIT(3)
+#define SW_AGING_ENABLE BIT(2)
+#define SW_FAST_AGING BIT(1)
+#define SW_LINK_AUTO_AGING BIT(0)
+
+#define REG_SW_LUE_CTRL_2 0x0312
+
+#define SW_TRAP_DOUBLE_TAG BIT(6)
+#define SW_EGRESS_VLAN_FILTER_DYN BIT(5)
+#define SW_EGRESS_VLAN_FILTER_STA BIT(4)
+#define SW_FLUSH_OPTION_M 0x3
+#define SW_FLUSH_OPTION_S 2
+#define SW_FLUSH_OPTION_DYN_MAC 1
+#define SW_FLUSH_OPTION_STA_MAC 2
+#define SW_FLUSH_OPTION_BOTH 3
+#define SW_PRIO_M 0x3
+#define SW_PRIO_DA 0
+#define SW_PRIO_SA 1
+#define SW_PRIO_HIGHEST_DA_SA 2
+#define SW_PRIO_LOWEST_DA_SA 3
+
+#define REG_SW_LUE_CTRL_3 0x0313
+
+#define REG_SW_LUE_INT_STATUS 0x0314
+#define REG_SW_LUE_INT_ENABLE 0x0315
+
+#define LEARN_FAIL_INT BIT(2)
+#define ALMOST_FULL_INT BIT(1)
+#define WRITE_FAIL_INT BIT(0)
+
+#define REG_SW_LUE_INDEX_0__2 0x0316
+
+#define ENTRY_INDEX_M 0x0FFF
+
+#define REG_SW_LUE_INDEX_1__2 0x0318
+
+#define FAIL_INDEX_M 0x03FF
+
+#define REG_SW_LUE_INDEX_2__2 0x031A
+
+#define REG_SW_LUE_UNK_UCAST_CTRL__4 0x0320
+
+#define SW_UNK_UCAST_ENABLE BIT(31)
+
+#define REG_SW_LUE_UNK_MCAST_CTRL__4 0x0324
+
+#define SW_UNK_MCAST_ENABLE BIT(31)
+
+#define REG_SW_LUE_UNK_VID_CTRL__4 0x0328
+
+#define SW_UNK_VID_ENABLE BIT(31)
+
+#define REG_SW_MAC_CTRL_0 0x0330
+
+#define SW_NEW_BACKOFF BIT(7)
+#define SW_CHECK_LENGTH BIT(3)
+#define SW_PAUSE_UNH_MODE BIT(1)
+#define SW_AGGR_BACKOFF BIT(0)
+
+#define REG_SW_MAC_CTRL_1 0x0331
+
+#define MULTICAST_STORM_DISABLE BIT(6)
+#define SW_BACK_PRESSURE BIT(5)
+#define FAIR_FLOW_CTRL BIT(4)
+#define NO_EXC_COLLISION_DROP BIT(3)
+#define SW_JUMBO_PACKET BIT(2)
+#define SW_LEGAL_PACKET_DISABLE BIT(1)
+#define SW_PASS_SHORT_FRAME BIT(0)
+
+#define REG_SW_MAC_CTRL_2 0x0332
+
+#define SW_REPLACE_VID BIT(3)
+#define BROADCAST_STORM_RATE_HI 0x07
+
+#define REG_SW_MAC_CTRL_3 0x0333
+
+#define BROADCAST_STORM_RATE_LO 0xFF
+#define BROADCAST_STORM_RATE 0x07FF
+
+#define REG_SW_MAC_CTRL_4 0x0334
+
+#define SW_PASS_PAUSE BIT(3)
+
+#define REG_SW_MAC_CTRL_5 0x0335
+
+#define SW_OUT_RATE_LIMIT_QUEUE_BASED BIT(3)
+
+#define REG_SW_MAC_CTRL_6 0x0336
+
+#define SW_MIB_COUNTER_FLUSH BIT(7)
+#define SW_MIB_COUNTER_FREEZE BIT(6)
+
+#define REG_SW_MAC_802_1P_MAP_0 0x0338
+#define REG_SW_MAC_802_1P_MAP_1 0x0339
+#define REG_SW_MAC_802_1P_MAP_2 0x033A
+#define REG_SW_MAC_802_1P_MAP_3 0x033B
+
+#define SW_802_1P_MAP_M KS_PRIO_M
+#define SW_802_1P_MAP_S KS_PRIO_S
+
+#define REG_SW_MAC_ISP_CTRL 0x033C
+
+#define REG_SW_MAC_TOS_CTRL 0x033E
+
+#define SW_TOS_DSCP_REMARK BIT(1)
+#define SW_TOS_DSCP_REMAP BIT(0)
+
+#define REG_SW_MAC_TOS_PRIO_0 0x0340
+#define REG_SW_MAC_TOS_PRIO_1 0x0341
+#define REG_SW_MAC_TOS_PRIO_2 0x0342
+#define REG_SW_MAC_TOS_PRIO_3 0x0343
+#define REG_SW_MAC_TOS_PRIO_4 0x0344
+#define REG_SW_MAC_TOS_PRIO_5 0x0345
+#define REG_SW_MAC_TOS_PRIO_6 0x0346
+#define REG_SW_MAC_TOS_PRIO_7 0x0347
+#define REG_SW_MAC_TOS_PRIO_8 0x0348
+#define REG_SW_MAC_TOS_PRIO_9 0x0349
+#define REG_SW_MAC_TOS_PRIO_10 0x034A
+#define REG_SW_MAC_TOS_PRIO_11 0x034B
+#define REG_SW_MAC_TOS_PRIO_12 0x034C
+#define REG_SW_MAC_TOS_PRIO_13 0x034D
+#define REG_SW_MAC_TOS_PRIO_14 0x034E
+#define REG_SW_MAC_TOS_PRIO_15 0x034F
+#define REG_SW_MAC_TOS_PRIO_16 0x0350
+#define REG_SW_MAC_TOS_PRIO_17 0x0351
+#define REG_SW_MAC_TOS_PRIO_18 0x0352
+#define REG_SW_MAC_TOS_PRIO_19 0x0353
+#define REG_SW_MAC_TOS_PRIO_20 0x0354
+#define REG_SW_MAC_TOS_PRIO_21 0x0355
+#define REG_SW_MAC_TOS_PRIO_22 0x0356
+#define REG_SW_MAC_TOS_PRIO_23 0x0357
+#define REG_SW_MAC_TOS_PRIO_24 0x0358
+#define REG_SW_MAC_TOS_PRIO_25 0x0359
+#define REG_SW_MAC_TOS_PRIO_26 0x035A
+#define REG_SW_MAC_TOS_PRIO_27 0x035B
+#define REG_SW_MAC_TOS_PRIO_28 0x035C
+#define REG_SW_MAC_TOS_PRIO_29 0x035D
+#define REG_SW_MAC_TOS_PRIO_30 0x035E
+#define REG_SW_MAC_TOS_PRIO_31 0x035F
+
+#define REG_SW_MRI_CTRL_0 0x0370
+
+#define SW_IGMP_SNOOP BIT(6)
+#define SW_IPV6_MLD_OPTION BIT(3)
+#define SW_IPV6_MLD_SNOOP BIT(2)
+#define SW_MIRROR_RX_TX BIT(0)
+
+#define REG_SW_CLASS_D_IP_CTRL__4 0x0374
+
+#define SW_CLASS_D_IP_ENABLE BIT(31)
+
+#define REG_SW_MRI_CTRL_8 0x0378
+
+#define SW_NO_COLOR_S 6
+#define SW_RED_COLOR_S 4
+#define SW_YELLOW_COLOR_S 2
+#define SW_GREEN_COLOR_S 0
+#define SW_COLOR_M 0x3
+
+#define REG_SW_QM_CTRL__4 0x0390
+
+#define PRIO_SCHEME_SELECT_M KS_PRIO_M
+#define PRIO_SCHEME_SELECT_S 6
+#define PRIO_MAP_3_HI 0
+#define PRIO_MAP_2_HI 2
+#define PRIO_MAP_0_LO 3
+#define UNICAST_VLAN_BOUNDARY BIT(1)
+
+#define REG_SW_EEE_QM_CTRL__2 0x03C0
+
+#define REG_SW_EEE_TXQ_WAIT_TIME__2 0x03C2
+
+/* 4 - */
+#define REG_SW_VLAN_ENTRY__4 0x0400
+
+#define VLAN_VALID BIT(31)
+#define VLAN_FORWARD_OPTION BIT(27)
+#define VLAN_PRIO_M KS_PRIO_M
+#define VLAN_PRIO_S 24
+#define VLAN_MSTP_M 0x7
+#define VLAN_MSTP_S 12
+#define VLAN_FID_M 0x7F
+
+#define REG_SW_VLAN_ENTRY_UNTAG__4 0x0404
+#define REG_SW_VLAN_ENTRY_PORTS__4 0x0408
+
+#define REG_SW_VLAN_ENTRY_INDEX__2 0x040C
+
+#define VLAN_INDEX_M 0x0FFF
+
+#define REG_SW_VLAN_CTRL 0x040E
+
+#define VLAN_START BIT(7)
+#define VLAN_ACTION 0x3
+#define VLAN_WRITE 1
+#define VLAN_READ 2
+#define VLAN_CLEAR 3
+
+#define REG_SW_ALU_INDEX_0 0x0410
+
+#define ALU_FID_INDEX_S 16
+#define ALU_MAC_ADDR_HI 0xFFFF
+
+#define REG_SW_ALU_INDEX_1 0x0414
+
+#define ALU_DIRECT_INDEX_M (BIT(12) - 1)
+
+#define REG_SW_ALU_CTRL__4 0x0418
+
+#define ALU_VALID_CNT_M (BIT(14) - 1)
+#define ALU_VALID_CNT_S 16
+#define ALU_START BIT(7)
+#define ALU_VALID BIT(6)
+#define ALU_DIRECT BIT(2)
+#define ALU_ACTION 0x3
+#define ALU_WRITE 1
+#define ALU_READ 2
+#define ALU_SEARCH 3
+
+#define REG_SW_ALU_STAT_CTRL__4 0x041C
+
+#define ALU_STAT_INDEX_M (BIT(4) - 1)
+#define ALU_STAT_INDEX_S 16
+#define ALU_RESV_MCAST_INDEX_M (BIT(6) - 1)
+#define ALU_STAT_START BIT(7)
+#define ALU_RESV_MCAST_ADDR BIT(1)
+#define ALU_STAT_READ BIT(0)
+
+#define REG_SW_ALU_VAL_A 0x0420
+
+#define ALU_V_STATIC_VALID BIT(31)
+#define ALU_V_SRC_FILTER BIT(30)
+#define ALU_V_DST_FILTER BIT(29)
+#define ALU_V_PRIO_AGE_CNT_M (BIT(3) - 1)
+#define ALU_V_PRIO_AGE_CNT_S 26
+#define ALU_V_MSTP_M 0x7
+
+#define REG_SW_ALU_VAL_B 0x0424
+
+#define ALU_V_OVERRIDE BIT(31)
+#define ALU_V_USE_FID BIT(30)
+#define ALU_V_PORT_MAP (BIT(24) - 1)
+
+#define REG_SW_ALU_VAL_C 0x0428
+
+#define ALU_V_FID_M (BIT(16) - 1)
+#define ALU_V_FID_S 16
+#define ALU_V_MAC_ADDR_HI 0xFFFF
+
+#define REG_SW_ALU_VAL_D 0x042C
+
+#define REG_HSR_ALU_INDEX_0 0x0440
+
+#define REG_HSR_ALU_INDEX_1 0x0444
+
+#define HSR_DST_MAC_INDEX_LO_S 16
+#define HSR_SRC_MAC_INDEX_HI 0xFFFF
+
+#define REG_HSR_ALU_INDEX_2 0x0448
+
+#define HSR_INDEX_MAX BIT(9)
+#define HSR_DIRECT_INDEX_M (HSR_INDEX_MAX - 1)
+
+#define REG_HSR_ALU_INDEX_3 0x044C
+
+#define HSR_PATH_INDEX_M (BIT(4) - 1)
+
+#define REG_HSR_ALU_CTRL__4 0x0450
+
+#define HSR_VALID_CNT_M (BIT(14) - 1)
+#define HSR_VALID_CNT_S 16
+#define HSR_START BIT(7)
+#define HSR_VALID BIT(6)
+#define HSR_SEARCH_END BIT(5)
+#define HSR_DIRECT BIT(2)
+#define HSR_ACTION 0x3
+#define HSR_WRITE 1
+#define HSR_READ 2
+#define HSR_SEARCH 3
+
+#define REG_HSR_ALU_VAL_A 0x0454
+
+#define HSR_V_STATIC_VALID BIT(31)
+#define HSR_V_AGE_CNT_M (BIT(3) - 1)
+#define HSR_V_AGE_CNT_S 26
+#define HSR_V_PATH_ID_M (BIT(4) - 1)
+
+#define REG_HSR_ALU_VAL_B 0x0458
+
+#define REG_HSR_ALU_VAL_C 0x045C
+
+#define HSR_V_DST_MAC_ADDR_LO_S 16
+#define HSR_V_SRC_MAC_ADDR_HI 0xFFFF
+
+#define REG_HSR_ALU_VAL_D 0x0460
+
+#define REG_HSR_ALU_VAL_E 0x0464
+
+#define HSR_V_START_SEQ_1_S 16
+#define HSR_V_START_SEQ_2_S 0
+
+#define REG_HSR_ALU_VAL_F 0x0468
+
+#define HSR_V_EXP_SEQ_1_S 16
+#define HSR_V_EXP_SEQ_2_S 0
+
+#define REG_HSR_ALU_VAL_G 0x046C
+
+#define HSR_V_SEQ_CNT_1_S 16
+#define HSR_V_SEQ_CNT_2_S 0
+
+#define HSR_V_SEQ_M (BIT(16) - 1)
+
+/* 5 - PTP Clock */
+#define REG_PTP_CLK_CTRL 0x0500
+
+#define PTP_STEP_ADJ BIT(6)
+#define PTP_STEP_DIR BIT(5)
+#define PTP_READ_TIME BIT(4)
+#define PTP_LOAD_TIME BIT(3)
+#define PTP_CLK_ADJ_ENABLE BIT(2)
+#define PTP_CLK_ENABLE BIT(1)
+#define PTP_CLK_RESET BIT(0)
+
+#define REG_PTP_RTC_SUB_NANOSEC__2 0x0502
+
+#define PTP_RTC_SUB_NANOSEC_M 0x0007
+
+#define REG_PTP_RTC_NANOSEC 0x0504
+#define REG_PTP_RTC_NANOSEC_H 0x0504
+#define REG_PTP_RTC_NANOSEC_L 0x0506
+
+#define REG_PTP_RTC_SEC 0x0508
+#define REG_PTP_RTC_SEC_H 0x0508
+#define REG_PTP_RTC_SEC_L 0x050A
+
+#define REG_PTP_SUBNANOSEC_RATE 0x050C
+#define REG_PTP_SUBNANOSEC_RATE_H 0x050C
+
+#define PTP_RATE_DIR BIT(31)
+#define PTP_TMP_RATE_ENABLE BIT(30)
+
+#define REG_PTP_SUBNANOSEC_RATE_L 0x050E
+
+#define REG_PTP_RATE_DURATION 0x0510
+#define REG_PTP_RATE_DURATION_H 0x0510
+#define REG_PTP_RATE_DURATION_L 0x0512
+
+#define REG_PTP_MSG_CONF1 0x0514
+
+#define PTP_802_1AS BIT(7)
+#define PTP_ENABLE BIT(6)
+#define PTP_ETH_ENABLE BIT(5)
+#define PTP_IPV4_UDP_ENABLE BIT(4)
+#define PTP_IPV6_UDP_ENABLE BIT(3)
+#define PTP_TC_P2P BIT(2)
+#define PTP_MASTER BIT(1)
+#define PTP_1STEP BIT(0)
+
+#define REG_PTP_MSG_CONF2 0x0516
+
+#define PTP_UNICAST_ENABLE BIT(12)
+#define PTP_ALTERNATE_MASTER BIT(11)
+#define PTP_ALL_HIGH_PRIO BIT(10)
+#define PTP_SYNC_CHECK BIT(9)
+#define PTP_DELAY_CHECK BIT(8)
+#define PTP_PDELAY_CHECK BIT(7)
+#define PTP_DROP_SYNC_DELAY_REQ BIT(5)
+#define PTP_DOMAIN_CHECK BIT(4)
+#define PTP_UDP_CHECKSUM BIT(2)
+
+#define REG_PTP_DOMAIN_VERSION 0x0518
+#define PTP_VERSION_M 0xFF00
+#define PTP_DOMAIN_M 0x00FF
+
+#define REG_PTP_UNIT_INDEX__4 0x0520
+
+#define PTP_UNIT_M 0xF
+
+#define PTP_GPIO_INDEX_S 16
+#define PTP_TSI_INDEX_S 8
+#define PTP_TOU_INDEX_S 0
+
+#define REG_PTP_TRIG_STATUS__4 0x0524
+
+#define TRIG_ERROR_S 16
+#define TRIG_DONE_S 0
+
+#define REG_PTP_INT_STATUS__4 0x0528
+
+#define TRIG_INT_S 16
+#define TS_INT_S 0
+
+#define TRIG_UNIT_M 0x7
+#define TS_UNIT_M 0x3
+
+#define REG_PTP_CTRL_STAT__4 0x052C
+
+#define GPIO_IN BIT(7)
+#define GPIO_OUT BIT(6)
+#define TS_INT_ENABLE BIT(5)
+#define TRIG_ACTIVE BIT(4)
+#define TRIG_ENABLE BIT(3)
+#define TRIG_RESET BIT(2)
+#define TS_ENABLE BIT(1)
+#define TS_RESET BIT(0)
+
+#define GPIO_CTRL_M (GPIO_IN | GPIO_OUT)
+
+#define TRIG_CTRL_M \
+ (TRIG_ACTIVE | TRIG_ENABLE | TRIG_RESET)
+
+#define TS_CTRL_M \
+ (TS_INT_ENABLE | TS_ENABLE | TS_RESET)
+
+#define REG_TRIG_TARGET_NANOSEC 0x0530
+#define REG_TRIG_TARGET_SEC 0x0534
+
+#define REG_TRIG_CTRL__4 0x0538
+
+#define TRIG_CASCADE_ENABLE BIT(31)
+#define TRIG_CASCADE_TAIL BIT(30)
+#define TRIG_CASCADE_UPS_M 0xF
+#define TRIG_CASCADE_UPS_S 26
+#define TRIG_NOW BIT(25)
+#define TRIG_NOTIFY BIT(24)
+#define TRIG_EDGE BIT(23)
+#define TRIG_PATTERN_S 20
+#define TRIG_PATTERN_M 0x7
+#define TRIG_NEG_EDGE 0
+#define TRIG_POS_EDGE 1
+#define TRIG_NEG_PULSE 2
+#define TRIG_POS_PULSE 3
+#define TRIG_NEG_PERIOD 4
+#define TRIG_POS_PERIOD 5
+#define TRIG_REG_OUTPUT 6
+#define TRIG_GPO_S 16
+#define TRIG_GPO_M 0xF
+#define TRIG_CASCADE_ITERATE_CNT_M 0xFFFF
+
+#define REG_TRIG_CYCLE_WIDTH 0x053C
+
+#define REG_TRIG_CYCLE_CNT 0x0540
+
+#define TRIG_CYCLE_CNT_M 0xFFFF
+#define TRIG_CYCLE_CNT_S 16
+#define TRIG_BIT_PATTERN_M 0xFFFF
+
+#define REG_TRIG_ITERATE_TIME 0x0544
+
+#define REG_TRIG_PULSE_WIDTH__4 0x0548
+
+#define TRIG_PULSE_WIDTH_M 0x00FFFFFF
+
+#define REG_TS_CTRL_STAT__4 0x0550
+
+#define TS_EVENT_DETECT_M 0xF
+#define TS_EVENT_DETECT_S 17
+#define TS_EVENT_OVERFLOW BIT(16)
+#define TS_GPI_M 0xF
+#define TS_GPI_S 8
+#define TS_DETECT_RISE BIT(7)
+#define TS_DETECT_FALL BIT(6)
+#define TS_DETECT_S 6
+#define TS_CASCADE_TAIL BIT(5)
+#define TS_CASCADE_UPS_M 0xF
+#define TS_CASCADE_UPS_S 1
+#define TS_CASCADE_ENABLE BIT(0)
+
+#define DETECT_RISE (TS_DETECT_RISE >> TS_DETECT_S)
+#define DETECT_FALL (TS_DETECT_FALL >> TS_DETECT_S)
+
+#define REG_TS_EVENT_0_NANOSEC 0x0554
+#define REG_TS_EVENT_0_SEC 0x0558
+#define REG_TS_EVENT_0_SUB_NANOSEC 0x055C
+
+#define REG_TS_EVENT_1_NANOSEC 0x0560
+#define REG_TS_EVENT_1_SEC 0x0564
+#define REG_TS_EVENT_1_SUB_NANOSEC 0x0568
+
+#define REG_TS_EVENT_2_NANOSEC 0x056C
+#define REG_TS_EVENT_2_SEC 0x0570
+#define REG_TS_EVENT_2_SUB_NANOSEC 0x0574
+
+#define REG_TS_EVENT_3_NANOSEC 0x0578
+#define REG_TS_EVENT_3_SEC 0x057C
+#define REG_TS_EVENT_3_SUB_NANOSEC 0x0580
+
+#define REG_TS_EVENT_4_NANOSEC 0x0584
+#define REG_TS_EVENT_4_SEC 0x0588
+#define REG_TS_EVENT_4_SUB_NANOSEC 0x058C
+
+#define REG_TS_EVENT_5_NANOSEC 0x0590
+#define REG_TS_EVENT_5_SEC 0x0594
+#define REG_TS_EVENT_5_SUB_NANOSEC 0x0598
+
+#define REG_TS_EVENT_6_NANOSEC 0x059C
+#define REG_TS_EVENT_6_SEC 0x05A0
+#define REG_TS_EVENT_6_SUB_NANOSEC 0x05A4
+
+#define REG_TS_EVENT_7_NANOSEC 0x05A8
+#define REG_TS_EVENT_7_SEC 0x05AC
+#define REG_TS_EVENT_7_SUB_NANOSEC 0x05B0
+
+#define TS_EVENT_EDGE_M 0x1
+#define TS_EVENT_EDGE_S 30
+#define TS_EVENT_NANOSEC_M (BIT(30) - 1)
+
+#define TS_EVENT_SUB_NANOSEC_M 0x7
+
+#define TS_EVENT_SAMPLE \
+ (REG_TS_EVENT_1_NANOSEC - REG_TS_EVENT_0_NANOSEC)
+
+#define PORT_CTRL_ADDR(port, addr) ((addr) | (((port) + 1) << 12))
+
+#define REG_GLOBAL_RR_INDEX__1 0x0600
+
+/* DLR */
+#define REG_DLR_SRC_PORT__4 0x0604
+
+#define DLR_SRC_PORT_UNICAST BIT(31)
+#define DLR_SRC_PORT_M 0x3
+#define DLR_SRC_PORT_BOTH 0
+#define DLR_SRC_PORT_EACH 1
+
+#define REG_DLR_IP_ADDR__4 0x0608
+
+#define REG_DLR_CTRL__1 0x0610
+
+#define DLR_RESET_SEQ_ID BIT(3)
+#define DLR_BACKUP_AUTO_ON BIT(2)
+#define DLR_BEACON_TX_ENABLE BIT(1)
+#define DLR_ASSIST_ENABLE BIT(0)
+
+#define REG_DLR_STATE__1 0x0611
+
+#define DLR_NODE_STATE_M 0x3
+#define DLR_NODE_STATE_S 1
+#define DLR_NODE_STATE_IDLE 0
+#define DLR_NODE_STATE_FAULT 1
+#define DLR_NODE_STATE_NORMAL 2
+#define DLR_RING_STATE_FAULT 0
+#define DLR_RING_STATE_NORMAL 1
+
+#define REG_DLR_PRECEDENCE__1 0x0612
+
+#define REG_DLR_BEACON_INTERVAL__4 0x0614
+
+#define REG_DLR_BEACON_TIMEOUT__4 0x0618
+
+#define REG_DLR_TIMEOUT_WINDOW__4 0x061C
+
+#define DLR_TIMEOUT_WINDOW_M (BIT(22) - 1)
+
+#define REG_DLR_VLAN_ID__2 0x0620
+
+#define DLR_VLAN_ID_M (BIT(12) - 1)
+
+#define REG_DLR_DEST_ADDR_0 0x0622
+#define REG_DLR_DEST_ADDR_1 0x0623
+#define REG_DLR_DEST_ADDR_2 0x0624
+#define REG_DLR_DEST_ADDR_3 0x0625
+#define REG_DLR_DEST_ADDR_4 0x0626
+#define REG_DLR_DEST_ADDR_5 0x0627
+
+#define REG_DLR_PORT_MAP__4 0x0628
+
+#define REG_DLR_CLASS__1 0x062C
+
+#define DLR_FRAME_QID_M 0x3
+
+/* HSR */
+#define REG_HSR_PORT_MAP__4 0x0640
+
+#define REG_HSR_ALU_CTRL_0__1 0x0644
+
+#define HSR_DUPLICATE_DISCARD BIT(7)
+#define HSR_NODE_UNICAST BIT(6)
+#define HSR_AGE_CNT_DEFAULT_M 0x7
+#define HSR_AGE_CNT_DEFAULT_S 3
+#define HSR_LEARN_MCAST_DISABLE BIT(2)
+#define HSR_HASH_OPTION_M 0x3
+#define HSR_HASH_DISABLE 0
+#define HSR_HASH_UPPER_BITS 1
+#define HSR_HASH_LOWER_BITS 2
+#define HSR_HASH_XOR_BOTH_BITS 3
+
+#define REG_HSR_ALU_CTRL_1__1 0x0645
+
+#define HSR_LEARN_UCAST_DISABLE BIT(7)
+#define HSR_FLUSH_TABLE BIT(5)
+#define HSR_PROC_MCAST_SRC BIT(3)
+#define HSR_AGING_ENABLE BIT(2)
+
+#define REG_HSR_ALU_CTRL_2__2 0x0646
+
+#define REG_HSR_ALU_AGE_PERIOD__4 0x0648
+
+#define REG_HSR_ALU_INT_STATUS__1 0x064C
+#define REG_HSR_ALU_INT_MASK__1 0x064D
+
+#define HSR_WINDOW_OVERFLOW_INT BIT(3)
+#define HSR_LEARN_FAIL_INT BIT(2)
+#define HSR_ALMOST_FULL_INT BIT(1)
+#define HSR_WRITE_FAIL_INT BIT(0)
+
+#define REG_HSR_ALU_ENTRY_0__2 0x0650
+
+#define HSR_ENTRY_INDEX_M (BIT(10) - 1)
+#define HSR_FAIL_INDEX_M (BIT(8) - 1)
+
+#define REG_HSR_ALU_ENTRY_1__2 0x0652
+
+#define HSR_FAIL_LEARN_INDEX_M (BIT(8) - 1)
+
+#define REG_HSR_ALU_ENTRY_3__2 0x0654
+
+#define HSR_CPU_ACCESS_ENTRY_INDEX_M (BIT(8) - 1)
+
+/* 0 - Operation */
+#define REG_PORT_DEFAULT_VID 0x0000
+
+#define REG_PORT_CUSTOM_VID 0x0002
+#define REG_PORT_AVB_SR_1_VID 0x0004
+#define REG_PORT_AVB_SR_2_VID 0x0006
+
+#define REG_PORT_AVB_SR_1_TYPE 0x0008
+#define REG_PORT_AVB_SR_2_TYPE 0x000A
+
+#define REG_PORT_PME_STATUS 0x0013
+#define REG_PORT_PME_CTRL 0x0017
+
+#define PME_WOL_MAGICPKT BIT(2)
+#define PME_WOL_LINKUP BIT(1)
+#define PME_WOL_ENERGY BIT(0)
+
+#define REG_PORT_INT_STATUS 0x001B
+#define REG_PORT_INT_MASK 0x001F
+
+#define PORT_SGMII_INT BIT(3)
+#define PORT_PTP_INT BIT(2)
+#define PORT_PHY_INT BIT(1)
+#define PORT_ACL_INT BIT(0)
+
+#define PORT_INT_MASK \
+ (PORT_SGMII_INT | PORT_PTP_INT | PORT_PHY_INT | PORT_ACL_INT)
+
+#define REG_PORT_CTRL_0 0x0020
+
+#define PORT_MAC_LOOPBACK BIT(7)
+#define PORT_FORCE_TX_FLOW_CTRL BIT(4)
+#define PORT_FORCE_RX_FLOW_CTRL BIT(3)
+#define PORT_TAIL_TAG_ENABLE BIT(2)
+#define PORT_QUEUE_SPLIT_ENABLE 0x3
+
+#define REG_PORT_CTRL_1 0x0021
+
+#define PORT_SRP_ENABLE 0x3
+
+#define REG_PORT_STATUS_0 0x0030
+
+#define PORT_INTF_SPEED_M 0x3
+#define PORT_INTF_SPEED_S 3
+#define PORT_INTF_FULL_DUPLEX BIT(2)
+#define PORT_TX_FLOW_CTRL BIT(1)
+#define PORT_RX_FLOW_CTRL BIT(0)
+
+#define REG_PORT_STATUS_1 0x0034
+
+/* 1 - PHY */
+#define REG_PORT_PHY_CTRL 0x0100
+
+#define PORT_PHY_RESET BIT(15)
+#define PORT_PHY_LOOPBACK BIT(14)
+#define PORT_SPEED_100MBIT BIT(13)
+#define PORT_AUTO_NEG_ENABLE BIT(12)
+#define PORT_POWER_DOWN BIT(11)
+#define PORT_ISOLATE BIT(10)
+#define PORT_AUTO_NEG_RESTART BIT(9)
+#define PORT_FULL_DUPLEX BIT(8)
+#define PORT_COLLISION_TEST BIT(7)
+#define PORT_SPEED_1000MBIT BIT(6)
+
+#define REG_PORT_PHY_STATUS 0x0102
+
+#define PORT_100BT4_CAPABLE BIT(15)
+#define PORT_100BTX_FD_CAPABLE BIT(14)
+#define PORT_100BTX_CAPABLE BIT(13)
+#define PORT_10BT_FD_CAPABLE BIT(12)
+#define PORT_10BT_CAPABLE BIT(11)
+#define PORT_EXTENDED_STATUS BIT(8)
+#define PORT_MII_SUPPRESS_CAPABLE BIT(6)
+#define PORT_AUTO_NEG_ACKNOWLEDGE BIT(5)
+#define PORT_REMOTE_FAULT BIT(4)
+#define PORT_AUTO_NEG_CAPABLE BIT(3)
+#define PORT_LINK_STATUS BIT(2)
+#define PORT_JABBER_DETECT BIT(1)
+#define PORT_EXTENDED_CAPABILITY BIT(0)
+
+#define REG_PORT_PHY_ID_HI 0x0104
+#define REG_PORT_PHY_ID_LO 0x0106
+
+#define KSZ9477_ID_HI 0x0022
+#define KSZ9477_ID_LO 0x1622
+
+#define REG_PORT_PHY_AUTO_NEGOTIATION 0x0108
+
+#define PORT_AUTO_NEG_NEXT_PAGE BIT(15)
+#define PORT_AUTO_NEG_REMOTE_FAULT BIT(13)
+#define PORT_AUTO_NEG_ASYM_PAUSE BIT(11)
+#define PORT_AUTO_NEG_SYM_PAUSE BIT(10)
+#define PORT_AUTO_NEG_100BT4 BIT(9)
+#define PORT_AUTO_NEG_100BTX_FD BIT(8)
+#define PORT_AUTO_NEG_100BTX BIT(7)
+#define PORT_AUTO_NEG_10BT_FD BIT(6)
+#define PORT_AUTO_NEG_10BT BIT(5)
+#define PORT_AUTO_NEG_SELECTOR 0x001F
+#define PORT_AUTO_NEG_802_3 0x0001
+
+#define PORT_AUTO_NEG_PAUSE \
+ (PORT_AUTO_NEG_ASYM_PAUSE | PORT_AUTO_NEG_SYM_PAUSE)
+
+#define REG_PORT_PHY_REMOTE_CAPABILITY 0x010A
+
+#define PORT_REMOTE_NEXT_PAGE BIT(15)
+#define PORT_REMOTE_ACKNOWLEDGE BIT(14)
+#define PORT_REMOTE_REMOTE_FAULT BIT(13)
+#define PORT_REMOTE_ASYM_PAUSE BIT(11)
+#define PORT_REMOTE_SYM_PAUSE BIT(10)
+#define PORT_REMOTE_100BTX_FD BIT(8)
+#define PORT_REMOTE_100BTX BIT(7)
+#define PORT_REMOTE_10BT_FD BIT(6)
+#define PORT_REMOTE_10BT BIT(5)
+
+#define REG_PORT_PHY_1000_CTRL 0x0112
+
+#define PORT_AUTO_NEG_MANUAL BIT(12)
+#define PORT_AUTO_NEG_MASTER BIT(11)
+#define PORT_AUTO_NEG_MASTER_PREFERRED BIT(10)
+#define PORT_AUTO_NEG_1000BT_FD BIT(9)
+#define PORT_AUTO_NEG_1000BT BIT(8)
+
+#define REG_PORT_PHY_1000_STATUS 0x0114
+
+#define PORT_MASTER_FAULT BIT(15)
+#define PORT_LOCAL_MASTER BIT(14)
+#define PORT_LOCAL_RX_OK BIT(13)
+#define PORT_REMOTE_RX_OK BIT(12)
+#define PORT_REMOTE_1000BT_FD BIT(11)
+#define PORT_REMOTE_1000BT BIT(10)
+#define PORT_REMOTE_IDLE_CNT_M 0x0F
+
+#define PORT_PHY_1000_STATIC_STATUS \
+ (PORT_LOCAL_RX_OK | \
+ PORT_REMOTE_RX_OK | \
+ PORT_REMOTE_1000BT_FD | \
+ PORT_REMOTE_1000BT)
+
+#define REG_PORT_PHY_MMD_SETUP 0x011A
+
+#define PORT_MMD_OP_MODE_M 0x3
+#define PORT_MMD_OP_MODE_S 14
+#define PORT_MMD_OP_INDEX 0
+#define PORT_MMD_OP_DATA_NO_INCR 1
+#define PORT_MMD_OP_DATA_INCR_RW 2
+#define PORT_MMD_OP_DATA_INCR_W 3
+#define PORT_MMD_DEVICE_ID_M 0x1F
+
+#define MMD_SETUP(mode, dev) \
+ (((u16)(mode) << PORT_MMD_OP_MODE_S) | (dev))
+
+#define REG_PORT_PHY_MMD_INDEX_DATA 0x011C
+
+#define MMD_DEVICE_ID_DSP 1
+
+#define MMD_DSP_SQI_CHAN_A 0xAC
+#define MMD_DSP_SQI_CHAN_B 0xAD
+#define MMD_DSP_SQI_CHAN_C 0xAE
+#define MMD_DSP_SQI_CHAN_D 0xAF
+
+#define DSP_SQI_ERR_DETECTED BIT(15)
+#define DSP_SQI_AVG_ERR 0x7FFF
+
+#define MMD_DEVICE_ID_COMMON 2
+
+#define MMD_DEVICE_ID_EEE_ADV 7
+
+#define MMD_EEE_ADV 0x3C
+#define EEE_ADV_100MBIT BIT(1)
+#define EEE_ADV_1GBIT BIT(2)
+
+#define MMD_EEE_LP_ADV 0x3D
+#define MMD_EEE_MSG_CODE 0x3F
+
+#define MMD_DEVICE_ID_AFED 0x1C
+
+#define REG_PORT_PHY_EXTENDED_STATUS 0x011E
+
+#define PORT_100BTX_FD_ABLE BIT(15)
+#define PORT_100BTX_ABLE BIT(14)
+#define PORT_10BT_FD_ABLE BIT(13)
+#define PORT_10BT_ABLE BIT(12)
+
+#define REG_PORT_SGMII_ADDR__4 0x0200
+#define PORT_SGMII_AUTO_INCR BIT(23)
+#define PORT_SGMII_DEVICE_ID_M 0x1F
+#define PORT_SGMII_DEVICE_ID_S 16
+#define PORT_SGMII_ADDR_M (BIT(21) - 1)
+
+#define REG_PORT_SGMII_DATA__4 0x0204
+#define PORT_SGMII_DATA_M (BIT(16) - 1)
+
+#define MMD_DEVICE_ID_PMA 0x01
+#define MMD_DEVICE_ID_PCS 0x03
+#define MMD_DEVICE_ID_PHY_XS 0x04
+#define MMD_DEVICE_ID_DTE_XS 0x05
+#define MMD_DEVICE_ID_AN 0x07
+#define MMD_DEVICE_ID_VENDOR_CTRL 0x1E
+#define MMD_DEVICE_ID_VENDOR_MII 0x1F
+
+#define SR_MII MMD_DEVICE_ID_VENDOR_MII
+
+#define MMD_SR_MII_CTRL 0x0000
+
+#define SR_MII_RESET BIT(15)
+#define SR_MII_LOOPBACK BIT(14)
+#define SR_MII_SPEED_100MBIT BIT(13)
+#define SR_MII_AUTO_NEG_ENABLE BIT(12)
+#define SR_MII_POWER_DOWN BIT(11)
+#define SR_MII_AUTO_NEG_RESTART BIT(9)
+#define SR_MII_FULL_DUPLEX BIT(8)
+#define SR_MII_SPEED_1000MBIT BIT(6)
+
+#define MMD_SR_MII_STATUS 0x0001
+#define MMD_SR_MII_ID_1 0x0002
+#define MMD_SR_MII_ID_2 0x0003
+#define MMD_SR_MII_AUTO_NEGOTIATION 0x0004
+
+#define SR_MII_AUTO_NEG_NEXT_PAGE BIT(15)
+#define SR_MII_AUTO_NEG_REMOTE_FAULT_M 0x3
+#define SR_MII_AUTO_NEG_REMOTE_FAULT_S 12
+#define SR_MII_AUTO_NEG_NO_ERROR 0
+#define SR_MII_AUTO_NEG_OFFLINE 1
+#define SR_MII_AUTO_NEG_LINK_FAILURE 2
+#define SR_MII_AUTO_NEG_ERROR 3
+#define SR_MII_AUTO_NEG_PAUSE_M 0x3
+#define SR_MII_AUTO_NEG_PAUSE_S 7
+#define SR_MII_AUTO_NEG_NO_PAUSE 0
+#define SR_MII_AUTO_NEG_ASYM_PAUSE_TX 1
+#define SR_MII_AUTO_NEG_SYM_PAUSE 2
+#define SR_MII_AUTO_NEG_ASYM_PAUSE_RX 3
+#define SR_MII_AUTO_NEG_HALF_DUPLEX BIT(6)
+#define SR_MII_AUTO_NEG_FULL_DUPLEX BIT(5)
+
+#define MMD_SR_MII_REMOTE_CAPABILITY 0x0005
+#define MMD_SR_MII_AUTO_NEG_EXP 0x0006
+#define MMD_SR_MII_AUTO_NEG_EXT 0x000F
+
+#define MMD_SR_MII_DIGITAL_CTRL_1 0x8000
+
+#define MMD_SR_MII_AUTO_NEG_CTRL 0x8001
+
+#define SR_MII_8_BIT BIT(8)
+#define SR_MII_SGMII_LINK_UP BIT(4)
+#define SR_MII_TX_CFG_PHY_MASTER BIT(3)
+#define SR_MII_PCS_MODE_M 0x3
+#define SR_MII_PCS_MODE_S 1
+#define SR_MII_PCS_SGMII 2
+#define SR_MII_AUTO_NEG_COMPLETE_INTR BIT(0)
+
+#define MMD_SR_MII_AUTO_NEG_STATUS 0x8002
+
+#define SR_MII_STAT_LINK_UP BIT(4)
+#define SR_MII_STAT_M 0x3
+#define SR_MII_STAT_S 2
+#define SR_MII_STAT_10_MBPS 0
+#define SR_MII_STAT_100_MBPS 1
+#define SR_MII_STAT_1000_MBPS 2
+#define SR_MII_STAT_FULL_DUPLEX BIT(1)
+
+#define MMD_SR_MII_PHY_CTRL 0x80A0
+
+#define SR_MII_PHY_LANE_SEL_M 0xF
+#define SR_MII_PHY_LANE_SEL_S 8
+#define SR_MII_PHY_WRITE BIT(1)
+#define SR_MII_PHY_START_BUSY BIT(0)
+
+#define MMD_SR_MII_PHY_ADDR 0x80A1
+
+#define SR_MII_PHY_ADDR_M (BIT(16) - 1)
+
+#define MMD_SR_MII_PHY_DATA 0x80A2
+
+#define SR_MII_PHY_DATA_M (BIT(16) - 1)
+
+#define SR_MII_PHY_JTAG_CHIP_ID_HI 0x000C
+#define SR_MII_PHY_JTAG_CHIP_ID_LO 0x000D
+
+#define REG_PORT_PHY_REMOTE_LB_LED 0x0122
+
+#define PORT_REMOTE_LOOPBACK BIT(8)
+#define PORT_LED_SELECT (3 << 6)
+#define PORT_LED_CTRL (3 << 4)
+#define PORT_LED_CTRL_TEST BIT(3)
+#define PORT_10BT_PREAMBLE BIT(2)
+#define PORT_LINK_MD_10BT_ENABLE BIT(1)
+#define PORT_LINK_MD_PASS BIT(0)
+
+#define REG_PORT_PHY_LINK_MD 0x0124
+
+#define PORT_START_CABLE_DIAG BIT(15)
+#define PORT_TX_DISABLE BIT(14)
+#define PORT_CABLE_DIAG_PAIR_M 0x3
+#define PORT_CABLE_DIAG_PAIR_S 12
+#define PORT_CABLE_DIAG_SELECT_M 0x3
+#define PORT_CABLE_DIAG_SELECT_S 10
+#define PORT_CABLE_DIAG_RESULT_M 0x3
+#define PORT_CABLE_DIAG_RESULT_S 8
+#define PORT_CABLE_STAT_NORMAL 0
+#define PORT_CABLE_STAT_OPEN 1
+#define PORT_CABLE_STAT_SHORT 2
+#define PORT_CABLE_STAT_FAILED 3
+#define PORT_CABLE_FAULT_COUNTER 0x00FF
+
+#define REG_PORT_PHY_PMA_STATUS 0x0126
+
+#define PORT_1000_LINK_GOOD BIT(1)
+#define PORT_100_LINK_GOOD BIT(0)
+
+#define REG_PORT_PHY_DIGITAL_STATUS 0x0128
+
+#define PORT_LINK_DETECT BIT(14)
+#define PORT_SIGNAL_DETECT BIT(13)
+#define PORT_PHY_STAT_MDI BIT(12)
+#define PORT_PHY_STAT_MASTER BIT(11)
+
+#define REG_PORT_PHY_RXER_COUNTER 0x012A
+
+#define REG_PORT_PHY_INT_ENABLE 0x0136
+#define REG_PORT_PHY_INT_STATUS 0x0137
+
+#define JABBER_INT BIT(7)
+#define RX_ERR_INT BIT(6)
+#define PAGE_RX_INT BIT(5)
+#define PARALLEL_DETECT_FAULT_INT BIT(4)
+#define LINK_PARTNER_ACK_INT BIT(3)
+#define LINK_DOWN_INT BIT(2)
+#define REMOTE_FAULT_INT BIT(1)
+#define LINK_UP_INT BIT(0)
+
+#define REG_PORT_PHY_DIGITAL_DEBUG_1 0x0138
+
+#define PORT_REG_CLK_SPEED_25_MHZ BIT(14)
+#define PORT_PHY_FORCE_MDI BIT(7)
+#define PORT_PHY_AUTO_MDIX_DISABLE BIT(6)
+
+/* Same as PORT_PHY_LOOPBACK */
+#define PORT_PHY_PCS_LOOPBACK BIT(0)
+
+#define REG_PORT_PHY_DIGITAL_DEBUG_2 0x013A
+
+#define REG_PORT_PHY_DIGITAL_DEBUG_3 0x013C
+
+#define PORT_100BT_FIXED_LATENCY BIT(15)
+
+#define REG_PORT_PHY_PHY_CTRL 0x013E
+
+#define PORT_INT_PIN_HIGH BIT(14)
+#define PORT_ENABLE_JABBER BIT(9)
+#define PORT_STAT_SPEED_1000MBIT BIT(6)
+#define PORT_STAT_SPEED_100MBIT BIT(5)
+#define PORT_STAT_SPEED_10MBIT BIT(4)
+#define PORT_STAT_FULL_DUPLEX BIT(3)
+
+/* Same as PORT_PHY_STAT_MASTER */
+#define PORT_STAT_MASTER BIT(2)
+#define PORT_RESET BIT(1)
+#define PORT_LINK_STATUS_FAIL BIT(0)
+
+/* 3 - xMII */
+#define REG_PORT_XMII_CTRL_0 0x0300
+
+#define PORT_SGMII_SEL BIT(7)
+#define PORT_MII_FULL_DUPLEX BIT(6)
+#define PORT_MII_100MBIT BIT(4)
+#define PORT_GRXC_ENABLE BIT(0)
+
+#define REG_PORT_XMII_CTRL_1 0x0301
+
+#define PORT_RMII_CLK_SEL BIT(7)
+/* S1 */
+#define PORT_MII_1000MBIT_S1 BIT(6)
+/* S2 */
+#define PORT_MII_NOT_1GBIT BIT(6)
+#define PORT_MII_SEL_EDGE BIT(5)
+#define PORT_RGMII_ID_IG_ENABLE BIT(4)
+#define PORT_RGMII_ID_EG_ENABLE BIT(3)
+#define PORT_MII_MAC_MODE BIT(2)
+#define PORT_MII_SEL_M 0x3
+/* S1 */
+#define PORT_MII_SEL_S1 0x0
+#define PORT_RMII_SEL_S1 0x1
+#define PORT_GMII_SEL_S1 0x2
+#define PORT_RGMII_SEL_S1 0x3
+/* S2 */
+#define PORT_RGMII_SEL 0x0
+#define PORT_RMII_SEL 0x1
+#define PORT_GMII_SEL 0x2
+#define PORT_MII_SEL 0x3
+
+/* 4 - MAC */
+#define REG_PORT_MAC_CTRL_0 0x0400
+
+#define PORT_BROADCAST_STORM BIT(1)
+#define PORT_JUMBO_FRAME BIT(0)
+
+#define REG_PORT_MAC_CTRL_1 0x0401
+
+#define PORT_BACK_PRESSURE BIT(3)
+#define PORT_PASS_ALL BIT(0)
+
+#define REG_PORT_MAC_CTRL_2 0x0402
+
+#define PORT_100BT_EEE_DISABLE BIT(7)
+#define PORT_1000BT_EEE_DISABLE BIT(6)
+
+#define REG_PORT_MAC_IN_RATE_LIMIT 0x0403
+
+#define PORT_IN_PORT_BASED_S 6
+#define PORT_RATE_PACKET_BASED_S 5
+#define PORT_IN_FLOW_CTRL_S 4
+#define PORT_COUNT_IFG_S 1
+#define PORT_COUNT_PREAMBLE_S 0
+#define PORT_IN_PORT_BASED BIT(6)
+#define PORT_IN_PACKET_BASED BIT(5)
+#define PORT_IN_FLOW_CTRL BIT(4)
+#define PORT_IN_LIMIT_MODE_M 0x3
+#define PORT_IN_LIMIT_MODE_S 2
+#define PORT_IN_ALL 0
+#define PORT_IN_UNICAST 1
+#define PORT_IN_MULTICAST 2
+#define PORT_IN_BROADCAST 3
+#define PORT_COUNT_IFG BIT(1)
+#define PORT_COUNT_PREAMBLE BIT(0)
+
+#define REG_PORT_IN_RATE_0 0x0410
+#define REG_PORT_IN_RATE_1 0x0411
+#define REG_PORT_IN_RATE_2 0x0412
+#define REG_PORT_IN_RATE_3 0x0413
+#define REG_PORT_IN_RATE_4 0x0414
+#define REG_PORT_IN_RATE_5 0x0415
+#define REG_PORT_IN_RATE_6 0x0416
+#define REG_PORT_IN_RATE_7 0x0417
+
+#define REG_PORT_OUT_RATE_0 0x0420
+#define REG_PORT_OUT_RATE_1 0x0421
+#define REG_PORT_OUT_RATE_2 0x0422
+#define REG_PORT_OUT_RATE_3 0x0423
+
+#define PORT_RATE_LIMIT_M (BIT(7) - 1)
+
+/* 5 - MIB Counters */
+#define REG_PORT_MIB_CTRL_STAT__4 0x0500
+
+#define MIB_COUNTER_OVERFLOW BIT(31)
+#define MIB_COUNTER_VALID BIT(30)
+#define MIB_COUNTER_READ BIT(25)
+#define MIB_COUNTER_FLUSH_FREEZE BIT(24)
+#define MIB_COUNTER_INDEX_M (BIT(8) - 1)
+#define MIB_COUNTER_INDEX_S 16
+#define MIB_COUNTER_DATA_HI_M 0xF
+
+#define REG_PORT_MIB_DATA 0x0504
+
+/* 6 - ACL */
+#define REG_PORT_ACL_0 0x0600
+
+#define ACL_FIRST_RULE_M 0xF
+
+#define REG_PORT_ACL_1 0x0601
+
+#define ACL_MODE_M 0x3
+#define ACL_MODE_S 4
+#define ACL_MODE_DISABLE 0
+#define ACL_MODE_LAYER_2 1
+#define ACL_MODE_LAYER_3 2
+#define ACL_MODE_LAYER_4 3
+#define ACL_ENABLE_M 0x3
+#define ACL_ENABLE_S 2
+#define ACL_ENABLE_2_COUNT 0
+#define ACL_ENABLE_2_TYPE 1
+#define ACL_ENABLE_2_MAC 2
+#define ACL_ENABLE_2_BOTH 3
+#define ACL_ENABLE_3_IP 1
+#define ACL_ENABLE_3_SRC_DST_COMP 2
+#define ACL_ENABLE_4_PROTOCOL 0
+#define ACL_ENABLE_4_TCP_PORT_COMP 1
+#define ACL_ENABLE_4_UDP_PORT_COMP 2
+#define ACL_ENABLE_4_TCP_SEQN_COMP 3
+#define ACL_SRC BIT(1)
+#define ACL_EQUAL BIT(0)
+
+#define REG_PORT_ACL_2 0x0602
+#define REG_PORT_ACL_3 0x0603
+
+#define ACL_MAX_PORT 0xFFFF
+
+#define REG_PORT_ACL_4 0x0604
+#define REG_PORT_ACL_5 0x0605
+
+#define ACL_MIN_PORT 0xFFFF
+#define ACL_IP_ADDR 0xFFFFFFFF
+#define ACL_TCP_SEQNUM 0xFFFFFFFF
+
+#define REG_PORT_ACL_6 0x0606
+
+#define ACL_RESERVED 0xF8
+#define ACL_PORT_MODE_M 0x3
+#define ACL_PORT_MODE_S 1
+#define ACL_PORT_MODE_DISABLE 0
+#define ACL_PORT_MODE_EITHER 1
+#define ACL_PORT_MODE_IN_RANGE 2
+#define ACL_PORT_MODE_OUT_OF_RANGE 3
+
+#define REG_PORT_ACL_7 0x0607
+
+#define ACL_TCP_FLAG_ENABLE BIT(0)
+
+#define REG_PORT_ACL_8 0x0608
+
+#define ACL_TCP_FLAG_M 0xFF
+
+#define REG_PORT_ACL_9 0x0609
+
+#define ACL_TCP_FLAG 0xFF
+#define ACL_ETH_TYPE 0xFFFF
+#define ACL_IP_M 0xFFFFFFFF
+
+#define REG_PORT_ACL_A 0x060A
+
+#define ACL_PRIO_MODE_M 0x3
+#define ACL_PRIO_MODE_S 6
+#define ACL_PRIO_MODE_DISABLE 0
+#define ACL_PRIO_MODE_HIGHER 1
+#define ACL_PRIO_MODE_LOWER 2
+#define ACL_PRIO_MODE_REPLACE 3
+#define ACL_PRIO_M KS_PRIO_M
+#define ACL_PRIO_S 3
+#define ACL_VLAN_PRIO_REPLACE BIT(2)
+#define ACL_VLAN_PRIO_M KS_PRIO_M
+#define ACL_VLAN_PRIO_HI_M 0x3
+
+#define REG_PORT_ACL_B 0x060B
+
+#define ACL_VLAN_PRIO_LO_M 0x8
+#define ACL_VLAN_PRIO_S 7
+#define ACL_MAP_MODE_M 0x3
+#define ACL_MAP_MODE_S 5
+#define ACL_MAP_MODE_DISABLE 0
+#define ACL_MAP_MODE_OR 1
+#define ACL_MAP_MODE_AND 2
+#define ACL_MAP_MODE_REPLACE 3
+
+#define ACL_CNT_M (BIT(11) - 1)
+#define ACL_CNT_S 5
+
+#define REG_PORT_ACL_C 0x060C
+
+#define REG_PORT_ACL_D 0x060D
+#define ACL_MSEC_UNIT BIT(6)
+#define ACL_INTR_MODE BIT(5)
+#define ACL_PORT_MAP 0x7F
+
+#define REG_PORT_ACL_E 0x060E
+#define REG_PORT_ACL_F 0x060F
+
+#define REG_PORT_ACL_BYTE_EN_MSB 0x0610
+#define REG_PORT_ACL_BYTE_EN_LSB 0x0611
+
+#define ACL_ACTION_START 0xA
+#define ACL_ACTION_LEN 4
+#define ACL_INTR_CNT_START 0xD
+#define ACL_RULESET_START 0xE
+#define ACL_RULESET_LEN 2
+#define ACL_TABLE_LEN 16
+
+#define ACL_ACTION_ENABLE 0x003C
+#define ACL_MATCH_ENABLE 0x7FC3
+#define ACL_RULESET_ENABLE 0x8003
+#define ACL_BYTE_ENABLE 0xFFFF
+
+#define REG_PORT_ACL_CTRL_0 0x0612
+
+#define PORT_ACL_WRITE_DONE BIT(6)
+#define PORT_ACL_READ_DONE BIT(5)
+#define PORT_ACL_WRITE BIT(4)
+#define PORT_ACL_INDEX_M 0xF
+
+#define REG_PORT_ACL_CTRL_1 0x0613
+
+/* 8 - Classification and Policing */
+#define REG_PORT_MRI_MIRROR_CTRL 0x0800
+
+#define PORT_MIRROR_RX BIT(6)
+#define PORT_MIRROR_TX BIT(5)
+#define PORT_MIRROR_SNIFFER BIT(1)
+
+#define REG_PORT_MRI_PRIO_CTRL 0x0801
+
+#define PORT_HIGHEST_PRIO BIT(7)
+#define PORT_OR_PRIO BIT(6)
+#define PORT_MAC_PRIO_ENABLE BIT(4)
+#define PORT_VLAN_PRIO_ENABLE BIT(3)
+#define PORT_802_1P_PRIO_ENABLE BIT(2)
+#define PORT_DIFFSERV_PRIO_ENABLE BIT(1)
+#define PORT_ACL_PRIO_ENABLE BIT(0)
+
+#define REG_PORT_MRI_MAC_CTRL 0x0802
+
+#define PORT_USER_PRIO_CEILING BIT(7)
+#define PORT_DROP_NON_VLAN BIT(4)
+#define PORT_DROP_TAG BIT(3)
+#define PORT_BASED_PRIO_M KS_PRIO_M
+#define PORT_BASED_PRIO_S 0
+
+#define REG_PORT_MRI_AUTHEN_CTRL 0x0803
+
+#define PORT_ACL_ENABLE BIT(2)
+#define PORT_AUTHEN_MODE 0x3
+#define PORT_AUTHEN_PASS 0
+#define PORT_AUTHEN_BLOCK 1
+#define PORT_AUTHEN_TRAP 2
+
+#define REG_PORT_MRI_INDEX__4 0x0804
+
+#define MRI_INDEX_P_M 0x7
+#define MRI_INDEX_P_S 16
+#define MRI_INDEX_Q_M 0x3
+#define MRI_INDEX_Q_S 0
+
+#define REG_PORT_MRI_TC_MAP__4 0x0808
+
+#define PORT_TC_MAP_M 0xf
+#define PORT_TC_MAP_S 4
+
+#define REG_PORT_MRI_POLICE_CTRL__4 0x080C
+
+#define POLICE_DROP_ALL BIT(10)
+#define POLICE_PACKET_TYPE_M 0x3
+#define POLICE_PACKET_TYPE_S 8
+#define POLICE_PACKET_DROPPED 0
+#define POLICE_PACKET_GREEN 1
+#define POLICE_PACKET_YELLOW 2
+#define POLICE_PACKET_RED 3
+#define PORT_BASED_POLICING BIT(7)
+#define NON_DSCP_COLOR_M 0x3
+#define NON_DSCP_COLOR_S 5
+#define COLOR_MARK_ENABLE BIT(4)
+#define COLOR_REMAP_ENABLE BIT(3)
+#define POLICE_DROP_SRP BIT(2)
+#define POLICE_COLOR_NOT_AWARE BIT(1)
+#define POLICE_ENABLE BIT(0)
+
+#define REG_PORT_POLICE_COLOR_0__4 0x0810
+#define REG_PORT_POLICE_COLOR_1__4 0x0814
+#define REG_PORT_POLICE_COLOR_2__4 0x0818
+#define REG_PORT_POLICE_COLOR_3__4 0x081C
+
+#define POLICE_COLOR_MAP_S 2
+#define POLICE_COLOR_MAP_M (BIT(POLICE_COLOR_MAP_S) - 1)
+
+#define REG_PORT_POLICE_RATE__4 0x0820
+
+#define POLICE_CIR_S 16
+#define POLICE_PIR_S 0
+
+#define REG_PORT_POLICE_BURST_SIZE__4 0x0824
+
+#define POLICE_BURST_SIZE_M 0x3FFF
+#define POLICE_CBS_S 16
+#define POLICE_PBS_S 0
+
+#define REG_PORT_WRED_PM_CTRL_0__4 0x0830
+
+#define WRED_PM_CTRL_M (BIT(11) - 1)
+
+#define WRED_PM_MAX_THRESHOLD_S 16
+#define WRED_PM_MIN_THRESHOLD_S 0
+
+#define REG_PORT_WRED_PM_CTRL_1__4 0x0834
+
+#define WRED_PM_MULTIPLIER_S 16
+#define WRED_PM_AVG_QUEUE_SIZE_S 0
+
+#define REG_PORT_WRED_QUEUE_CTRL_0__4 0x0840
+#define REG_PORT_WRED_QUEUE_CTRL_1__4 0x0844
+
+#define REG_PORT_WRED_QUEUE_PMON__4 0x0848
+
+#define WRED_RANDOM_DROP_ENABLE BIT(31)
+#define WRED_PMON_FLUSH BIT(30)
+#define WRED_DROP_GYR_DISABLE BIT(29)
+#define WRED_DROP_YR_DISABLE BIT(28)
+#define WRED_DROP_R_DISABLE BIT(27)
+#define WRED_DROP_ALL BIT(26)
+#define WRED_PMON_M (BIT(24) - 1)
+
+/* 9 - Shaping */
+
+#define REG_PORT_MTI_QUEUE_INDEX__4 0x0900
+
+#define REG_PORT_MTI_QUEUE_CTRL_0__4 0x0904
+
+#define MTI_PVID_REPLACE BIT(0)
+
+#define REG_PORT_MTI_QUEUE_CTRL_0 0x0914
+
+#define MTI_SCHEDULE_MODE_M 0x3
+#define MTI_SCHEDULE_MODE_S 6
+#define MTI_SCHEDULE_STRICT_PRIO 0
+#define MTI_SCHEDULE_WRR 2
+#define MTI_SHAPING_M 0x3
+#define MTI_SHAPING_S 4
+#define MTI_SHAPING_OFF 0
+#define MTI_SHAPING_SRP 1
+#define MTI_SHAPING_TIME_AWARE 2
+
+#define REG_PORT_MTI_QUEUE_CTRL_1 0x0915
+
+#define MTI_TX_RATIO_M (BIT(7) - 1)
+
+#define REG_PORT_MTI_QUEUE_CTRL_2__2 0x0916
+#define REG_PORT_MTI_HI_WATER_MARK 0x0916
+#define REG_PORT_MTI_QUEUE_CTRL_3__2 0x0918
+#define REG_PORT_MTI_LO_WATER_MARK 0x0918
+#define REG_PORT_MTI_QUEUE_CTRL_4__2 0x091A
+#define REG_PORT_MTI_CREDIT_INCREMENT 0x091A
+
+/* A - QM */
+
+#define REG_PORT_QM_CTRL__4 0x0A00
+
+#define PORT_QM_DROP_PRIO_M 0x3
+
+#define REG_PORT_VLAN_MEMBERSHIP__4 0x0A04
+
+#define REG_PORT_QM_QUEUE_INDEX__4 0x0A08
+
+#define PORT_QM_QUEUE_INDEX_S 24
+#define PORT_QM_BURST_SIZE_S 16
+#define PORT_QM_MIN_RESV_SPACE_M (BIT(11) - 1)
+
+#define REG_PORT_QM_WATER_MARK__4 0x0A0C
+
+#define PORT_QM_HI_WATER_MARK_S 16
+#define PORT_QM_LO_WATER_MARK_S 0
+#define PORT_QM_WATER_MARK_M (BIT(11) - 1)
+
+#define REG_PORT_QM_TX_CNT_0__4 0x0A10
+
+#define PORT_QM_TX_CNT_USED_S 0
+#define PORT_QM_TX_CNT_M (BIT(11) - 1)
+
+#define REG_PORT_QM_TX_CNT_1__4 0x0A14
+
+#define PORT_QM_TX_CNT_CALCULATED_S 16
+#define PORT_QM_TX_CNT_AVAIL_S 0
+
+/* B - LUE */
+#define REG_PORT_LUE_CTRL 0x0B00
+
+#define PORT_VLAN_LOOKUP_VID_0 BIT(7)
+#define PORT_INGRESS_FILTER BIT(6)
+#define PORT_DISCARD_NON_VID BIT(5)
+#define PORT_MAC_BASED_802_1X BIT(4)
+#define PORT_SRC_ADDR_FILTER BIT(3)
+
+#define REG_PORT_LUE_MSTP_INDEX 0x0B01
+
+#define REG_PORT_LUE_MSTP_STATE 0x0B04
+
+#define PORT_TX_ENABLE BIT(2)
+#define PORT_RX_ENABLE BIT(1)
+#define PORT_LEARN_DISABLE BIT(0)
+
+/* C - PTP */
+
+#define REG_PTP_PORT_RX_DELAY__2 0x0C00
+#define REG_PTP_PORT_TX_DELAY__2 0x0C02
+#define REG_PTP_PORT_ASYM_DELAY__2 0x0C04
+
+#define REG_PTP_PORT_XDELAY_TS 0x0C08
+#define REG_PTP_PORT_XDELAY_TS_H 0x0C08
+#define REG_PTP_PORT_XDELAY_TS_L 0x0C0A
+
+#define REG_PTP_PORT_SYNC_TS 0x0C0C
+#define REG_PTP_PORT_SYNC_TS_H 0x0C0C
+#define REG_PTP_PORT_SYNC_TS_L 0x0C0E
+
+#define REG_PTP_PORT_PDRESP_TS 0x0C10
+#define REG_PTP_PORT_PDRESP_TS_H 0x0C10
+#define REG_PTP_PORT_PDRESP_TS_L 0x0C12
+
+#define REG_PTP_PORT_TX_INT_STATUS__2 0x0C14
+#define REG_PTP_PORT_TX_INT_ENABLE__2 0x0C16
+
+#define PTP_PORT_SYNC_INT BIT(15)
+#define PTP_PORT_XDELAY_REQ_INT BIT(14)
+#define PTP_PORT_PDELAY_RESP_INT BIT(13)
+
+#define REG_PTP_PORT_LINK_DELAY__4 0x0C18
+
+#define PRIO_QUEUES 4
+#define RX_PRIO_QUEUES 8
+
+#define KS_PRIO_IN_REG 2
+
+#define TOTAL_PORT_NUM 7
+
+#define KSZ9477_COUNTER_NUM 0x20
+#define TOTAL_KSZ9477_COUNTER_NUM (KSZ9477_COUNTER_NUM + 2 + 2)
+
+#define SWITCH_COUNTER_NUM KSZ9477_COUNTER_NUM
+#define TOTAL_SWITCH_COUNTER_NUM TOTAL_KSZ9477_COUNTER_NUM
+
+#define P_BCAST_STORM_CTRL REG_PORT_MAC_CTRL_0
+#define P_PRIO_CTRL REG_PORT_MRI_PRIO_CTRL
+#define P_MIRROR_CTRL REG_PORT_MRI_MIRROR_CTRL
+#define P_STP_CTRL REG_PORT_LUE_MSTP_STATE
+#define P_PHY_CTRL REG_PORT_PHY_CTRL
+#define P_NEG_RESTART_CTRL REG_PORT_PHY_CTRL
+#define P_LINK_STATUS REG_PORT_PHY_STATUS
+#define P_SPEED_STATUS REG_PORT_PHY_PHY_CTRL
+#define P_RATE_LIMIT_CTRL REG_PORT_MAC_IN_RATE_LIMIT
+
+#define S_LINK_AGING_CTRL REG_SW_LUE_CTRL_1
+#define S_MIRROR_CTRL REG_SW_MRI_CTRL_0
+#define S_REPLACE_VID_CTRL REG_SW_MAC_CTRL_2
+#define S_802_1P_PRIO_CTRL REG_SW_MAC_802_1P_MAP_0
+#define S_TOS_PRIO_CTRL REG_SW_MAC_TOS_PRIO_0
+#define S_FLUSH_TABLE_CTRL REG_SW_LUE_CTRL_1
+
+#define SW_FLUSH_DYN_MAC_TABLE SW_FLUSH_MSTP_TABLE
+
+#define MAX_TIMESTAMP_UNIT 2
+#define MAX_TRIG_UNIT 3
+#define MAX_TIMESTAMP_EVENT_UNIT 8
+#define MAX_GPIO 4
+
+#define PTP_TRIG_UNIT_M (BIT(MAX_TRIG_UNIT) - 1)
+#define PTP_TS_UNIT_M (BIT(MAX_TIMESTAMP_UNIT) - 1)
+
+/* Driver set switch broadcast storm protection at 10% rate. */
+#define BROADCAST_STORM_PROT_RATE 10
+
+/* 148,800 frames * 67 ms / 100 */
+#define BROADCAST_STORM_VALUE 9969
+
+#endif /* KSZ9477_REGS_H */
diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c
new file mode 100644
index 0000000..5a1dd07
--- /dev/null
+++ b/drivers/net/dsa/microchip/ksz_common.c
@@ -0,0 +1,1211 @@
+/*
+ * Microchip switch driver main logic
+ *
+ * Copyright (C) 2017
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <linux/delay.h>
+#include <linux/export.h>
+#include <linux/gpio.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/platform_data/microchip-ksz.h>
+#include <linux/phy.h>
+#include <linux/etherdevice.h>
+#include <linux/if_bridge.h>
+#include <net/dsa.h>
+#include <net/switchdev.h>
+
+#include "ksz_priv.h"
+
+static struct {
+ int index;
+ char string[ETH_GSTRING_LEN];
+} mib_names[TOTAL_SWITCH_COUNTER_NUM] = {
+ { 0x00, "rx_hi" },
+ { 0x01, "rx_undersize" },
+ { 0x02, "rx_fragments" },
+ { 0x03, "rx_oversize" },
+ { 0x04, "rx_jabbers" },
+ { 0x05, "rx_symbol_err" },
+ { 0x06, "rx_crc_err" },
+ { 0x07, "rx_align_err" },
+ { 0x08, "rx_mac_ctrl" },
+ { 0x09, "rx_pause" },
+ { 0x0A, "rx_bcast" },
+ { 0x0B, "rx_mcast" },
+ { 0x0C, "rx_ucast" },
+ { 0x0D, "rx_64_or_less" },
+ { 0x0E, "rx_65_127" },
+ { 0x0F, "rx_128_255" },
+ { 0x10, "rx_256_511" },
+ { 0x11, "rx_512_1023" },
+ { 0x12, "rx_1024_1522" },
+ { 0x13, "rx_1523_2000" },
+ { 0x14, "rx_2001" },
+ { 0x15, "tx_hi" },
+ { 0x16, "tx_late_col" },
+ { 0x17, "tx_pause" },
+ { 0x18, "tx_bcast" },
+ { 0x19, "tx_mcast" },
+ { 0x1A, "tx_ucast" },
+ { 0x1B, "tx_deferred" },
+ { 0x1C, "tx_total_col" },
+ { 0x1D, "tx_exc_col" },
+ { 0x1E, "tx_single_col" },
+ { 0x1F, "tx_mult_col" },
+ { 0x80, "rx_total" },
+ { 0x81, "tx_total" },
+ { 0x82, "rx_discards" },
+ { 0x83, "tx_discards" },
+};
+
+static void ksz_cfg(struct ksz_device *dev, u32 addr, u8 bits, bool set)
+{
+ u8 data;
+
+ ksz_read8(dev, addr, &data);
+ if (set)
+ data |= bits;
+ else
+ data &= ~bits;
+ ksz_write8(dev, addr, data);
+}
+
+static void ksz_cfg32(struct ksz_device *dev, u32 addr, u32 bits, bool set)
+{
+ u32 data;
+
+ ksz_read32(dev, addr, &data);
+ if (set)
+ data |= bits;
+ else
+ data &= ~bits;
+ ksz_write32(dev, addr, data);
+}
+
+static void ksz_port_cfg(struct ksz_device *dev, int port, int offset, u8 bits,
+ bool set)
+{
+ u32 addr;
+ u8 data;
+
+ addr = PORT_CTRL_ADDR(port, offset);
+ ksz_read8(dev, addr, &data);
+
+ if (set)
+ data |= bits;
+ else
+ data &= ~bits;
+
+ ksz_write8(dev, addr, data);
+}
+
+static void ksz_port_cfg32(struct ksz_device *dev, int port, int offset,
+ u32 bits, bool set)
+{
+ u32 addr;
+ u32 data;
+
+ addr = PORT_CTRL_ADDR(port, offset);
+ ksz_read32(dev, addr, &data);
+
+ if (set)
+ data |= bits;
+ else
+ data &= ~bits;
+
+ ksz_write32(dev, addr, data);
+}
+
+static int get_vlan_table(struct dsa_switch *ds, u16 vid, u32 *vlan_table)
+{
+ struct ksz_device *dev = ds->priv;
+ u8 data;
+ int timeout = 1000;
+
+ ksz_write16(dev, REG_SW_VLAN_ENTRY_INDEX__2, vid & VLAN_INDEX_M);
+ ksz_write8(dev, REG_SW_VLAN_CTRL, VLAN_READ | VLAN_START);
+ /* wait to be cleared */
+ data = 0;
+ do {
+ ksz_read8(dev, REG_SW_VLAN_CTRL, &data);
+ if (!(data & VLAN_START))
+ break;
+ usleep_range(1, 10);
+ } while (timeout-- > 0);
+
+ if (!timeout)
+ return -ETIMEDOUT;
+
+ ksz_read32(dev, REG_SW_VLAN_ENTRY__4, &vlan_table[0]);
+ ksz_read32(dev, REG_SW_VLAN_ENTRY_UNTAG__4, &vlan_table[1]);
+ ksz_read32(dev, REG_SW_VLAN_ENTRY_PORTS__4, &vlan_table[2]);
+
+ ksz_write8(dev, REG_SW_VLAN_CTRL, 0);
+
+ return 0;
+}
+
+static int set_vlan_table(struct dsa_switch *ds, u16 vid, u32 *vlan_table)
+{
+ struct ksz_device *dev = ds->priv;
+ u8 data;
+ int timeout = 1000;
+
+ ksz_write32(dev, REG_SW_VLAN_ENTRY__4, vlan_table[0]);
+ ksz_write32(dev, REG_SW_VLAN_ENTRY_UNTAG__4, vlan_table[1]);
+ ksz_write32(dev, REG_SW_VLAN_ENTRY_PORTS__4, vlan_table[2]);
+
+ ksz_write16(dev, REG_SW_VLAN_ENTRY_INDEX__2, vid & VLAN_INDEX_M);
+ ksz_write8(dev, REG_SW_VLAN_CTRL, VLAN_START | VLAN_WRITE);
+
+ do {
+ ksz_read8(dev, REG_SW_VLAN_CTRL, &data);
+ if (!(data & VLAN_START))
+ break;
+ usleep_range(1, 10);
+ } while (timeout-- > 0);
+
+ if (!timeout)
+ return -ETIMEDOUT;
+
+ ksz_write8(dev, REG_SW_VLAN_CTRL, 0);
+
+ /* update vlan cache table */
+ dev->vlan_cache[vid].table[0] = vlan_table[0];
+ dev->vlan_cache[vid].table[1] = vlan_table[1];
+ dev->vlan_cache[vid].table[2] = vlan_table[2];
+
+ return 0;
+}
+
+static void read_table(struct dsa_switch *ds, u32 *table)
+{
+ struct ksz_device *dev = ds->priv;
+
+ ksz_read32(dev, REG_SW_ALU_VAL_A, &table[0]);
+ ksz_read32(dev, REG_SW_ALU_VAL_B, &table[1]);
+ ksz_read32(dev, REG_SW_ALU_VAL_C, &table[2]);
+ ksz_read32(dev, REG_SW_ALU_VAL_D, &table[3]);
+}
+
+static void write_table(struct dsa_switch *ds, u32 *table)
+{
+ struct ksz_device *dev = ds->priv;
+
+ ksz_write32(dev, REG_SW_ALU_VAL_A, table[0]);
+ ksz_write32(dev, REG_SW_ALU_VAL_B, table[1]);
+ ksz_write32(dev, REG_SW_ALU_VAL_C, table[2]);
+ ksz_write32(dev, REG_SW_ALU_VAL_D, table[3]);
+}
+
+static int ksz_reset_switch(struct dsa_switch *ds)
+{
+ struct ksz_device *dev = ds->priv;
+ u8 data8;
+ u16 data16;
+ u32 data32;
+
+ /* reset switch */
+ ksz_cfg(dev, REG_SW_OPERATION, SW_RESET, true);
+
+ /* turn off SPI DO Edge select */
+ ksz_read8(dev, REG_SW_GLOBAL_SERIAL_CTRL_0, &data8);
+ data8 &= ~SPI_AUTO_EDGE_DETECTION;
+ ksz_write8(dev, REG_SW_GLOBAL_SERIAL_CTRL_0, data8);
+
+ /* default configuration */
+ ksz_read8(dev, REG_SW_LUE_CTRL_1, &data8);
+ data8 = SW_AGING_ENABLE | SW_LINK_AUTO_AGING |
+ SW_SRC_ADDR_FILTER | SW_FLUSH_STP_TABLE | SW_FLUSH_MSTP_TABLE;
+ ksz_write8(dev, REG_SW_LUE_CTRL_1, data8);
+
+ /* disable interrupts */
+ ksz_write32(dev, REG_SW_INT_MASK__4, SWITCH_INT_MASK);
+ ksz_write32(dev, REG_SW_PORT_INT_MASK__4, 0x7F);
+ ksz_read32(dev, REG_SW_PORT_INT_STATUS__4, &data32);
+
+ /* set broadcast storm protection 10% rate */
+ ksz_read16(dev, REG_SW_MAC_CTRL_2, &data16);
+ data16 &= ~BROADCAST_STORM_RATE;
+ data16 |= (BROADCAST_STORM_VALUE * BROADCAST_STORM_PROT_RATE) / 100;
+ ksz_write16(dev, REG_SW_MAC_CTRL_2, data16);
+
+ memset(dev->vlan_cache, 0, sizeof(*dev->vlan_cache) * dev->num_vlans);
+
+ return 0;
+}
+
+static void ksz_config_cpu_port(struct dsa_switch *ds)
+{
+ struct ksz_device *dev = ds->priv;
+ int i;
+
+ ds->num_ports = dev->port_cnt;
+
+ for (i = 0; i < ds->num_ports; i++) {
+ if (dsa_is_cpu_port(ds, i)) {
+ dev->cpu_port = i;
+ /* enable tag tail for host port */
+ ksz_port_cfg(dev, i, REG_PORT_CTRL_0,
+ PORT_TAIL_TAG_ENABLE, true);
+ }
+ }
+}
+
+static int ksz_setup(struct dsa_switch *ds)
+{
+ struct ksz_device *dev = ds->priv;
+ int ret = 0;
+
+ dev->vlan_cache = devm_kmalloc_array(dev->dev,
+ sizeof(struct vlan_table),
+ dev->num_vlans, GFP_KERNEL);
+ if (!dev->vlan_cache)
+ return -ENOMEM;
+
+ ret = ksz_reset_switch(ds);
+ if (ret) {
+ dev_err(ds->dev, "failed to reset switch\n");
+ return ret;
+ }
+
+ /* accept packet up to 2000bytes */
+ ksz_cfg(dev, REG_SW_MAC_CTRL_1, SW_LEGAL_PACKET_DISABLE, true);
+
+ ksz_config_cpu_port(ds);
+
+ ksz_cfg(dev, REG_SW_MAC_CTRL_1, MULTICAST_STORM_DISABLE, true);
+
+ /* queue based egress rate limit */
+ ksz_cfg(dev, REG_SW_MAC_CTRL_5, SW_OUT_RATE_LIMIT_QUEUE_BASED, true);
+
+ /* start switch */
+ ksz_cfg(dev, REG_SW_OPERATION, SW_START, true);
+
+ return 0;
+}
+
+static enum dsa_tag_protocol ksz_get_tag_protocol(struct dsa_switch *ds)
+{
+ return DSA_TAG_PROTO_KSZ;
+}
+
+static int ksz_phy_read16(struct dsa_switch *ds, int addr, int reg)
+{
+ struct ksz_device *dev = ds->priv;
+ u16 val = 0;
+
+ ksz_pread16(dev, addr, 0x100 + (reg << 1), &val);
+
+ return val;
+}
+
+static int ksz_phy_write16(struct dsa_switch *ds, int addr, int reg, u16 val)
+{
+ struct ksz_device *dev = ds->priv;
+
+ ksz_pwrite16(dev, addr, 0x100 + (reg << 1), val);
+
+ return 0;
+}
+
+static int ksz_enable_port(struct dsa_switch *ds, int port,
+ struct phy_device *phy)
+{
+ struct ksz_device *dev = ds->priv;
+ u8 data8;
+ u16 data16;
+
+ ksz_port_cfg(dev, port, REG_PORT_CTRL_0, PORT_MAC_LOOPBACK, false);
+
+ /* set back pressure */
+ ksz_port_cfg(dev, port, REG_PORT_MAC_CTRL_1, PORT_BACK_PRESSURE, true);
+
+ /* set flow control */
+ ksz_port_cfg(dev, port, REG_PORT_CTRL_0,
+ PORT_FORCE_TX_FLOW_CTRL | PORT_FORCE_RX_FLOW_CTRL, true);
+
+ /* enable boradcast storm limit */
+ ksz_port_cfg(dev, port, P_BCAST_STORM_CTRL, PORT_BROADCAST_STORM, true);
+
+ /* disable DiffServ priority */
+ ksz_port_cfg(dev, port, P_PRIO_CTRL, PORT_DIFFSERV_PRIO_ENABLE, false);
+
+ /* replace priority */
+ ksz_port_cfg(dev, port, REG_PORT_MRI_MAC_CTRL,
+ PORT_USER_PRIO_CEILING, false);
+ ksz_port_cfg32(dev, port, REG_PORT_MTI_QUEUE_CTRL_0__4,
+ MTI_PVID_REPLACE, false);
+
+ /* enable 802.1p priority */
+ ksz_port_cfg(dev, port, P_PRIO_CTRL, PORT_802_1P_PRIO_ENABLE, true);
+
+ /* configure MAC to 1G & RGMII mode */
+ ksz_pread8(dev, port, REG_PORT_XMII_CTRL_1, &data8);
+ data8 |= PORT_RGMII_ID_EG_ENABLE;
+ data8 &= ~PORT_MII_NOT_1GBIT;
+ data8 &= ~PORT_MII_SEL_M;
+ data8 |= PORT_RGMII_SEL;
+ ksz_pwrite8(dev, port, REG_PORT_XMII_CTRL_1, data8);
+
+ /* clear pending interrupts */
+ ksz_pread16(dev, port, REG_PORT_PHY_INT_ENABLE, &data16);
+
+ return 0;
+}
+
+static void ksz_disable_port(struct dsa_switch *ds, int port,
+ struct phy_device *phy)
+{
+ struct ksz_device *dev = ds->priv;
+
+ /* there is no port disable */
+ ksz_port_cfg(dev, port, REG_PORT_CTRL_0, PORT_MAC_LOOPBACK, true);
+}
+
+static int ksz_sset_count(struct dsa_switch *ds)
+{
+ return TOTAL_SWITCH_COUNTER_NUM;
+}
+
+static void ksz_get_strings(struct dsa_switch *ds, int port, uint8_t *buf)
+{
+ int i;
+
+ for (i = 0; i < TOTAL_SWITCH_COUNTER_NUM; i++) {
+ memcpy(buf + i * ETH_GSTRING_LEN, mib_names[i].string,
+ ETH_GSTRING_LEN);
+ }
+}
+
+static void ksz_get_ethtool_stats(struct dsa_switch *ds, int port,
+ uint64_t *buf)
+{
+ struct ksz_device *dev = ds->priv;
+ int i;
+ u32 data;
+ int timeout;
+
+ mutex_lock(&dev->stats_mutex);
+
+ for (i = 0; i < TOTAL_SWITCH_COUNTER_NUM; i++) {
+ data = MIB_COUNTER_READ;
+ data |= ((mib_names[i].index & 0xFF) << MIB_COUNTER_INDEX_S);
+ ksz_pwrite32(dev, port, REG_PORT_MIB_CTRL_STAT__4, data);
+
+ timeout = 1000;
+ do {
+ ksz_pread32(dev, port, REG_PORT_MIB_CTRL_STAT__4,
+ &data);
+ usleep_range(1, 10);
+ if (!(data & MIB_COUNTER_READ))
+ break;
+ } while (timeout-- > 0);
+
+ /* failed to read MIB. get out of loop */
+ if (!timeout) {
+ dev_dbg(dev->dev, "Failed to get MIB\n");
+ break;
+ }
+
+ /* count resets upon read */
+ ksz_pread32(dev, port, REG_PORT_MIB_DATA, &data);
+
+ dev->mib_value[i] += (uint64_t)data;
+ buf[i] = dev->mib_value[i];
+ }
+
+ mutex_unlock(&dev->stats_mutex);
+}
+
+static void ksz_port_stp_state_set(struct dsa_switch *ds, int port, u8 state)
+{
+ struct ksz_device *dev = ds->priv;
+ u8 data;
+
+ ksz_pread8(dev, port, P_STP_CTRL, &data);
+ data &= ~(PORT_TX_ENABLE | PORT_RX_ENABLE | PORT_LEARN_DISABLE);
+
+ switch (state) {
+ case BR_STATE_DISABLED:
+ data |= PORT_LEARN_DISABLE;
+ break;
+ case BR_STATE_LISTENING:
+ data |= (PORT_RX_ENABLE | PORT_LEARN_DISABLE);
+ break;
+ case BR_STATE_LEARNING:
+ data |= PORT_RX_ENABLE;
+ break;
+ case BR_STATE_FORWARDING:
+ data |= (PORT_TX_ENABLE | PORT_RX_ENABLE);
+ break;
+ case BR_STATE_BLOCKING:
+ data |= PORT_LEARN_DISABLE;
+ break;
+ default:
+ dev_err(ds->dev, "invalid STP state: %d\n", state);
+ return;
+ }
+
+ ksz_pwrite8(dev, port, P_STP_CTRL, data);
+}
+
+static void ksz_port_fast_age(struct dsa_switch *ds, int port)
+{
+ struct ksz_device *dev = ds->priv;
+ u8 data8;
+
+ ksz_read8(dev, REG_SW_LUE_CTRL_1, &data8);
+ data8 |= SW_FAST_AGING;
+ ksz_write8(dev, REG_SW_LUE_CTRL_1, data8);
+
+ data8 &= ~SW_FAST_AGING;
+ ksz_write8(dev, REG_SW_LUE_CTRL_1, data8);
+}
+
+static int ksz_port_vlan_filtering(struct dsa_switch *ds, int port, bool flag)
+{
+ struct ksz_device *dev = ds->priv;
+
+ if (flag) {
+ ksz_port_cfg(dev, port, REG_PORT_LUE_CTRL,
+ PORT_VLAN_LOOKUP_VID_0, true);
+ ksz_cfg32(dev, REG_SW_QM_CTRL__4, UNICAST_VLAN_BOUNDARY, true);
+ ksz_cfg(dev, REG_SW_LUE_CTRL_0, SW_VLAN_ENABLE, true);
+ } else {
+ ksz_cfg(dev, REG_SW_LUE_CTRL_0, SW_VLAN_ENABLE, false);
+ ksz_cfg32(dev, REG_SW_QM_CTRL__4, UNICAST_VLAN_BOUNDARY, false);
+ ksz_port_cfg(dev, port, REG_PORT_LUE_CTRL,
+ PORT_VLAN_LOOKUP_VID_0, false);
+ }
+
+ return 0;
+}
+
+static int ksz_port_vlan_prepare(struct dsa_switch *ds, int port,
+ const struct switchdev_obj_port_vlan *vlan,
+ struct switchdev_trans *trans)
+{
+ /* nothing needed */
+
+ return 0;
+}
+
+static void ksz_port_vlan_add(struct dsa_switch *ds, int port,
+ const struct switchdev_obj_port_vlan *vlan,
+ struct switchdev_trans *trans)
+{
+ struct ksz_device *dev = ds->priv;
+ u32 vlan_table[3];
+ u16 vid;
+ bool untagged = vlan->flags & BRIDGE_VLAN_INFO_UNTAGGED;
+
+ for (vid = vlan->vid_begin; vid <= vlan->vid_end; vid++) {
+ if (get_vlan_table(ds, vid, vlan_table)) {
+ dev_dbg(dev->dev, "Failed to get vlan table\n");
+ return;
+ }
+
+ vlan_table[0] = VLAN_VALID | (vid & VLAN_FID_M);
+ if (untagged)
+ vlan_table[1] |= BIT(port);
+ else
+ vlan_table[1] &= ~BIT(port);
+ vlan_table[1] &= ~(BIT(dev->cpu_port));
+
+ vlan_table[2] |= BIT(port) | BIT(dev->cpu_port);
+
+ if (set_vlan_table(ds, vid, vlan_table)) {
+ dev_dbg(dev->dev, "Failed to set vlan table\n");
+ return;
+ }
+
+ /* change PVID */
+ if (vlan->flags & BRIDGE_VLAN_INFO_PVID)
+ ksz_pwrite16(dev, port, REG_PORT_DEFAULT_VID, vid);
+ }
+}
+
+static int ksz_port_vlan_del(struct dsa_switch *ds, int port,
+ const struct switchdev_obj_port_vlan *vlan)
+{
+ struct ksz_device *dev = ds->priv;
+ bool untagged = vlan->flags & BRIDGE_VLAN_INFO_UNTAGGED;
+ u32 vlan_table[3];
+ u16 vid;
+ u16 pvid;
+
+ ksz_pread16(dev, port, REG_PORT_DEFAULT_VID, &pvid);
+ pvid = pvid & 0xFFF;
+
+ for (vid = vlan->vid_begin; vid <= vlan->vid_end; vid++) {
+ if (get_vlan_table(ds, vid, vlan_table)) {
+ dev_dbg(dev->dev, "Failed to get vlan table\n");
+ return -EIO;
+ }
+
+ vlan_table[2] &= ~BIT(port);
+
+ if (pvid == vid)
+ pvid = 1;
+
+ if (untagged)
+ vlan_table[1] &= ~BIT(port);
+
+ if (set_vlan_table(ds, vid, vlan_table)) {
+ dev_dbg(dev->dev, "Failed to set vlan table\n");
+ return -EIO;
+ }
+ }
+
+ ksz_pwrite16(dev, port, REG_PORT_DEFAULT_VID, pvid);
+
+ return 0;
+}
+
+static int ksz_port_vlan_dump(struct dsa_switch *ds, int port,
+ struct switchdev_obj_port_vlan *vlan,
+ int (*cb)(struct switchdev_obj *obj))
+{
+ struct ksz_device *dev = ds->priv;
+ u16 vid;
+ u16 data;
+ struct vlan_table *vlan_cache;
+ int err = 0;
+
+ /* use dev->vlan_cache due to lack of searching valid vlan entry */
+ for (vid = vlan->vid_begin; vid < dev->num_vlans; vid++) {
+ vlan_cache = &dev->vlan_cache[vid];
+
+ if (!(vlan_cache->table[0] & VLAN_VALID))
+ continue;
+
+ vlan->vid_begin = vid;
+ vlan->vid_end = vid;
+ vlan->flags = 0;
+ if (vlan_cache->table[2] & BIT(port)) {
+ if (vlan_cache->table[1] & BIT(port))
+ vlan->flags |= BRIDGE_VLAN_INFO_UNTAGGED;
+ ksz_pread16(dev, port, REG_PORT_DEFAULT_VID, &data);
+ if (vid == (data & 0xFFFFF))
+ vlan->flags |= BRIDGE_VLAN_INFO_PVID;
+
+ err = cb(&vlan->obj);
+ if (err)
+ break;
+ }
+ }
+
+ return err;
+}
+
+static int ksz_port_fdb_prepare(struct dsa_switch *ds, int port,
+ const struct switchdev_obj_port_fdb *fdb,
+ struct switchdev_trans *trans)
+{
+ /* nothing needed */
+
+ return 0;
+}
+
+struct alu_struct {
+ /* entry 1 */
+ u8 is_static:1;
+ u8 is_src_filter:1;
+ u8 is_dst_filter:1;
+ u8 prio_age:3;
+ u32 _reserv_0_1:23;
+ u8 mstp:3;
+ /* entry 2 */
+ u8 is_override:1;
+ u8 is_use_fid:1;
+ u32 _reserv_1_1:23;
+ u8 port_forward:7;
+ /* entry 3 & 4*/
+ u32 _reserv_2_1:9;
+ u8 fid:7;
+ u8 mac[ETH_ALEN];
+};
+
+static void ksz_port_fdb_add(struct dsa_switch *ds, int port,
+ const struct switchdev_obj_port_fdb *fdb,
+ struct switchdev_trans *trans)
+{
+ struct ksz_device *dev = ds->priv;
+ u32 alu_table[4];
+ u32 data;
+
+ mutex_lock(&dev->alu_mutex);
+
+ /* find any entry with mac & vid */
+ data = fdb->vid << ALU_FID_INDEX_S;
+ data |= ((fdb->addr[0] << 8) | fdb->addr[1]);
+ ksz_write32(dev, REG_SW_ALU_INDEX_0, data);
+
+ data = ((fdb->addr[2] << 24) | (fdb->addr[3] << 16));
+ data |= ((fdb->addr[4] << 8) | fdb->addr[5]);
+ ksz_write32(dev, REG_SW_ALU_INDEX_1, data);
+
+ /* start read operation */
+ ksz_write32(dev, REG_SW_ALU_CTRL__4, ALU_READ | ALU_START);
+
+ /* wait to be finished */
+ do {
+ ksz_read32(dev, REG_SW_ALU_CTRL__4, &data);
+ } while (data & ALU_START);
+
+ /* read ALU entry */
+ read_table(ds, alu_table);
+
+ mutex_unlock(&dev->alu_mutex);
+
+ /* update ALU entry */
+ alu_table[0] = ALU_V_STATIC_VALID;
+ alu_table[1] |= BIT(port);
+ if (fdb->vid)
+ alu_table[1] |= ALU_V_USE_FID;
+ alu_table[2] = (fdb->vid << ALU_V_FID_S);
+ alu_table[2] |= ((fdb->addr[0] << 8) | fdb->addr[1]);
+ alu_table[3] = ((fdb->addr[2] << 24) | (fdb->addr[3] << 16));
+ alu_table[3] |= ((fdb->addr[4] << 8) | fdb->addr[5]);
+
+ mutex_lock(&dev->alu_mutex);
+
+ write_table(ds, alu_table);
+
+ ksz_write32(dev, REG_SW_ALU_CTRL__4, ALU_WRITE | ALU_START);
+
+ /* wait to be finished */
+ do {
+ ksz_read32(dev, REG_SW_ALU_CTRL__4, &data);
+ } while (data & ALU_START);
+
+ mutex_unlock(&dev->alu_mutex);
+}
+
+static int ksz_port_fdb_del(struct dsa_switch *ds, int port,
+ const struct switchdev_obj_port_fdb *fdb)
+{
+ struct ksz_device *dev = ds->priv;
+ u32 alu_table[4];
+ u32 data;
+
+ mutex_lock(&dev->alu_mutex);
+
+ /* read any entry with mac & vid */
+ data = fdb->vid << ALU_FID_INDEX_S;
+ data |= ((fdb->addr[0] << 8) | fdb->addr[1]);
+ ksz_write32(dev, REG_SW_ALU_INDEX_0, data);
+
+ data = ((fdb->addr[2] << 24) | (fdb->addr[3] << 16));
+ data |= ((fdb->addr[4] << 8) | fdb->addr[5]);
+ ksz_write32(dev, REG_SW_ALU_INDEX_1, data);
+
+ /* start read operation */
+ ksz_write32(dev, REG_SW_ALU_CTRL__4, ALU_READ | ALU_START);
+
+ /* wait to be finished */
+ do {
+ ksz_read32(dev, REG_SW_ALU_CTRL__4, &data);
+ } while (data & ALU_START);
+
+ ksz_read32(dev, REG_SW_ALU_VAL_A, &alu_table[0]);
+ if (alu_table[0] & ALU_V_STATIC_VALID) {
+ ksz_read32(dev, REG_SW_ALU_VAL_B, &alu_table[1]);
+ ksz_read32(dev, REG_SW_ALU_VAL_C, &alu_table[2]);
+ ksz_read32(dev, REG_SW_ALU_VAL_D, &alu_table[3]);
+
+ /* clear forwarding port */
+ alu_table[2] &= ~BIT(port);
+
+ /* if there is no port to forward, clear table */
+ if ((alu_table[2] & ALU_V_PORT_MAP) == 0) {
+ alu_table[0] = 0;
+ alu_table[1] = 0;
+ alu_table[2] = 0;
+ alu_table[3] = 0;
+ }
+ } else {
+ alu_table[0] = 0;
+ alu_table[1] = 0;
+ alu_table[2] = 0;
+ alu_table[3] = 0;
+ }
+
+ write_table(ds, alu_table);
+
+ ksz_write32(dev, REG_SW_ALU_CTRL__4, ALU_WRITE | ALU_START);
+
+ /* wait to be finished */
+ do {
+ ksz_read32(dev, REG_SW_ALU_CTRL__4, &data);
+ } while (data & ALU_START);
+
+ mutex_unlock(&dev->alu_mutex);
+
+ return 0;
+}
+
+static void convert_alu(struct alu_struct *alu, u32 *alu_table)
+{
+ alu->is_static = !!(alu_table[0] & ALU_V_STATIC_VALID);
+ alu->is_src_filter = !!(alu_table[0] & ALU_V_SRC_FILTER);
+ alu->is_dst_filter = !!(alu_table[0] & ALU_V_DST_FILTER);
+ alu->prio_age = (alu_table[0] >> ALU_V_PRIO_AGE_CNT_S) &
+ ALU_V_PRIO_AGE_CNT_M;
+ alu->mstp = alu_table[0] & ALU_V_MSTP_M;
+
+ alu->is_override = !!(alu_table[1] & ALU_V_OVERRIDE);
+ alu->is_use_fid = !!(alu_table[1] & ALU_V_USE_FID);
+ alu->port_forward = alu_table[1] & ALU_V_PORT_MAP;
+
+ alu->fid = (alu_table[2] >> ALU_V_FID_S) & ALU_V_FID_M;
+
+ alu->mac[0] = (alu_table[2] >> 8) & 0xFF;
+ alu->mac[1] = alu_table[2] & 0xFF;
+ alu->mac[2] = (alu_table[3] >> 24) & 0xFF;
+ alu->mac[3] = (alu_table[3] >> 16) & 0xFF;
+ alu->mac[4] = (alu_table[3] >> 8) & 0xFF;
+ alu->mac[5] = alu_table[3] & 0xFF;
+}
+
+static int ksz_port_fdb_dump(struct dsa_switch *ds, int port,
+ struct switchdev_obj_port_fdb *fdb,
+ int (*cb)(struct switchdev_obj *obj))
+{
+ struct ksz_device *dev = ds->priv;
+ int ret = 0;
+ u32 data;
+ u32 alu_table[4];
+ struct alu_struct alu;
+
+ mutex_lock(&dev->alu_mutex);
+
+ /* start ALU search */
+ ksz_write32(dev, REG_SW_ALU_CTRL__4, ALU_START | ALU_SEARCH);
+
+ do {
+ do {
+ ksz_read32(dev, REG_SW_ALU_CTRL__4, &data);
+ } while (!(data & ALU_VALID) && (data & ALU_START));
+
+ /* read ALU table */
+ read_table(ds, alu_table);
+
+ convert_alu(&alu, alu_table);
+
+ if (alu.port_forward & BIT(port)) {
+ fdb->vid = alu.fid;
+ if (alu.is_static)
+ fdb->ndm_state = NUD_NOARP;
+ else
+ fdb->ndm_state = NUD_REACHABLE;
+ ether_addr_copy(fdb->addr, alu.mac);
+
+ ret = cb(&fdb->obj);
+ if (ret)
+ goto exit;
+ }
+ } while (data & ALU_START);
+
+exit:
+
+ /* stop ALU search */
+ ksz_write32(dev, REG_SW_ALU_CTRL__4, 0);
+
+ mutex_unlock(&dev->alu_mutex);
+
+ return ret;
+}
+
+static int ksz_port_mdb_prepare(struct dsa_switch *ds, int port,
+ const struct switchdev_obj_port_mdb *mdb,
+ struct switchdev_trans *trans)
+{
+ /* nothing to do */
+ return 0;
+}
+
+static void ksz_port_mdb_add(struct dsa_switch *ds, int port,
+ const struct switchdev_obj_port_mdb *mdb,
+ struct switchdev_trans *trans)
+{
+ struct ksz_device *dev = ds->priv;
+ u32 static_table[4];
+ u32 data;
+ int index;
+ u32 mac_hi, mac_lo;
+
+ mac_hi = ((mdb->addr[0] << 8) | mdb->addr[1]);
+ mac_lo = ((mdb->addr[2] << 24) | (mdb->addr[3] << 16));
+ mac_lo |= ((mdb->addr[4] << 8) | mdb->addr[5]);
+
+ for (index = 0; index < dev->num_statics; index++) {
+ mutex_lock(&dev->alu_mutex);
+
+ /* find empty slot first */
+ data = (index << ALU_STAT_INDEX_S) |
+ ALU_STAT_READ | ALU_STAT_START;
+ ksz_write32(dev, REG_SW_ALU_STAT_CTRL__4, data);
+
+ /* wait to be finished */
+ do {
+ ksz_read32(dev, REG_SW_ALU_STAT_CTRL__4, &data);
+ } while (data & ALU_STAT_START);
+
+ /* read ALU static table */
+ read_table(ds, static_table);
+
+ mutex_unlock(&dev->alu_mutex);
+
+ if (static_table[0] & ALU_V_STATIC_VALID) {
+ /* check this has same vid & mac address */
+
+ if (((static_table[2] >> ALU_V_FID_S) == (mdb->vid)) &&
+ ((static_table[2] & ALU_V_MAC_ADDR_HI) == mac_hi) &&
+ (static_table[3] == mac_lo)) {
+ /* found matching one */
+ break;
+ }
+ } else {
+ /* found empty one */
+ break;
+ }
+ }
+
+ /* no available entry */
+ if (index == dev->num_statics)
+ return;
+
+ /* add entry */
+ static_table[0] = ALU_V_STATIC_VALID;
+ static_table[1] |= BIT(port);
+ if (mdb->vid)
+ static_table[1] |= ALU_V_USE_FID;
+ static_table[2] = (mdb->vid << ALU_V_FID_S);
+ static_table[2] |= mac_hi;
+ static_table[3] = mac_lo;
+
+ mutex_lock(&dev->alu_mutex);
+
+ write_table(ds, static_table);
+
+ data = (index << ALU_STAT_INDEX_S) | ALU_STAT_START;
+ ksz_write32(dev, REG_SW_ALU_STAT_CTRL__4, data);
+
+ /* wait to be finished */
+ do {
+ ksz_read32(dev, REG_SW_ALU_STAT_CTRL__4, &data);
+ } while (data & ALU_STAT_START);
+
+ mutex_unlock(&dev->alu_mutex);
+}
+
+static int ksz_port_mdb_del(struct dsa_switch *ds, int port,
+ const struct switchdev_obj_port_mdb *mdb)
+{
+ struct ksz_device *dev = ds->priv;
+ u32 static_table[4];
+ u32 data;
+ int index;
+ u32 mac_hi, mac_lo;
+
+ mac_hi = ((mdb->addr[0] << 8) | mdb->addr[1]);
+ mac_lo = ((mdb->addr[2] << 24) | (mdb->addr[3] << 16));
+ mac_lo |= ((mdb->addr[4] << 8) | mdb->addr[5]);
+
+ for (index = 0; index < dev->num_statics; index++) {
+ mutex_lock(&dev->alu_mutex);
+
+ /* find empty slot first */
+ data = (index << ALU_STAT_INDEX_S) |
+ ALU_STAT_READ | ALU_STAT_START;
+ ksz_write32(dev, REG_SW_ALU_STAT_CTRL__4, data);
+
+ /* wait to be finished */
+ do {
+ ksz_read32(dev, REG_SW_ALU_STAT_CTRL__4, &data);
+ } while (data & ALU_STAT_START);
+
+ /* read ALU static table */
+ read_table(ds, static_table);
+
+ mutex_unlock(&dev->alu_mutex);
+
+ if (static_table[0] & ALU_V_STATIC_VALID) {
+ /* check this has same vid & mac address */
+
+ if (((static_table[2] >> ALU_V_FID_S) == (mdb->vid)) &&
+ ((static_table[2] & ALU_V_MAC_ADDR_HI) == mac_hi) &&
+ (static_table[3] == mac_lo)) {
+ /* found matching one */
+ break;
+ }
+ }
+ }
+
+ /* no available entry */
+ if (index == dev->num_statics)
+ return -EINVAL;
+
+ /* clear port */
+ static_table[1] &= ~BIT(port);
+
+ if ((static_table[1] & ALU_V_PORT_MAP) == 0) {
+ /* delete entry */
+ static_table[0] = 0;
+ static_table[1] = 0;
+ static_table[2] = 0;
+ static_table[3] = 0;
+ }
+
+ mutex_lock(&dev->alu_mutex);
+
+ write_table(ds, static_table);
+
+ data = (index << ALU_STAT_INDEX_S) | ALU_STAT_START;
+ ksz_write32(dev, REG_SW_ALU_STAT_CTRL__4, data);
+
+ /* wait to be finished */
+ do {
+ ksz_read32(dev, REG_SW_ALU_STAT_CTRL__4, &data);
+ } while (data & ALU_STAT_START);
+
+ mutex_unlock(&dev->alu_mutex);
+
+ return 0;
+}
+
+static int ksz_port_mdb_dump(struct dsa_switch *ds, int port,
+ struct switchdev_obj_port_mdb *mdb,
+ int (*cb)(struct switchdev_obj *obj))
+{
+ /* this is not called by switch layer */
+ return 0;
+}
+
+static int ksz_port_mirror_add(struct dsa_switch *ds, int port,
+ struct dsa_mall_mirror_tc_entry *mirror,
+ bool ingress)
+{
+ struct ksz_device *dev = ds->priv;
+
+ if (ingress)
+ ksz_port_cfg(dev, port, P_MIRROR_CTRL, PORT_MIRROR_RX, true);
+ else
+ ksz_port_cfg(dev, port, P_MIRROR_CTRL, PORT_MIRROR_TX, true);
+
+ ksz_port_cfg(dev, port, P_MIRROR_CTRL, PORT_MIRROR_SNIFFER, false);
+
+ /* configure mirror port */
+ ksz_port_cfg(dev, mirror->to_local_port, P_MIRROR_CTRL,
+ PORT_MIRROR_SNIFFER, true);
+
+ ksz_cfg(dev, S_MIRROR_CTRL, SW_MIRROR_RX_TX, false);
+
+ return 0;
+}
+
+static void ksz_port_mirror_del(struct dsa_switch *ds, int port,
+ struct dsa_mall_mirror_tc_entry *mirror)
+{
+ struct ksz_device *dev = ds->priv;
+ u8 data;
+
+ if (mirror->ingress)
+ ksz_port_cfg(dev, port, P_MIRROR_CTRL, PORT_MIRROR_RX, false);
+ else
+ ksz_port_cfg(dev, port, P_MIRROR_CTRL, PORT_MIRROR_TX, false);
+
+ ksz_pread8(dev, port, P_MIRROR_CTRL, &data);
+
+ if (!(data & (PORT_MIRROR_RX | PORT_MIRROR_TX)))
+ ksz_port_cfg(dev, mirror->to_local_port, P_MIRROR_CTRL,
+ PORT_MIRROR_SNIFFER, false);
+}
+
+static const struct dsa_switch_ops ksz_switch_ops = {
+ .get_tag_protocol = ksz_get_tag_protocol,
+ .setup = ksz_setup,
+ .phy_read = ksz_phy_read16,
+ .phy_write = ksz_phy_write16,
+ .port_enable = ksz_enable_port,
+ .port_disable = ksz_disable_port,
+ .get_strings = ksz_get_strings,
+ .get_ethtool_stats = ksz_get_ethtool_stats,
+ .get_sset_count = ksz_sset_count,
+ .port_stp_state_set = ksz_port_stp_state_set,
+ .port_fast_age = ksz_port_fast_age,
+ .port_vlan_filtering = ksz_port_vlan_filtering,
+ .port_vlan_prepare = ksz_port_vlan_prepare,
+ .port_vlan_add = ksz_port_vlan_add,
+ .port_vlan_del = ksz_port_vlan_del,
+ .port_vlan_dump = ksz_port_vlan_dump,
+ .port_fdb_prepare = ksz_port_fdb_prepare,
+ .port_fdb_dump = ksz_port_fdb_dump,
+ .port_fdb_add = ksz_port_fdb_add,
+ .port_fdb_del = ksz_port_fdb_del,
+ .port_mdb_prepare = ksz_port_mdb_prepare,
+ .port_mdb_add = ksz_port_mdb_add,
+ .port_mdb_del = ksz_port_mdb_del,
+ .port_mdb_dump = ksz_port_mdb_dump,
+ .port_mirror_add = ksz_port_mirror_add,
+ .port_mirror_del = ksz_port_mirror_del,
+};
+
+struct ksz_chip_data {
+ u32 chip_id;
+ const char *dev_name;
+ int num_vlans;
+ int num_alus;
+ int num_statics;
+ u16 enabled_ports;
+ int cpu_port;
+ int port_cnt;
+ int phy_port_cnt;
+};
+
+static const struct ksz_chip_data ksz_switch_chips[] = {
+ {
+ .chip_id = 0x00947700,
+ .dev_name = "KSZ9477",
+ .num_vlans = 4096,
+ .num_alus = 4096,
+ .num_statics = 16,
+ .enabled_ports = 0x1F, /* port0-4 */
+ .cpu_port = 5, /* port5 (RGMII) */
+ .port_cnt = 7,
+ .phy_port_cnt = 5,
+ },
+};
+
+static int ksz_switch_init(struct ksz_device *dev)
+{
+ int i;
+
+ mutex_init(&dev->reg_mutex);
+ mutex_init(&dev->stats_mutex);
+ mutex_init(&dev->alu_mutex);
+
+ dev->ds->ops = &ksz_switch_ops;
+
+ for (i = 0; i < ARRAY_SIZE(ksz_switch_chips); i++) {
+ const struct ksz_chip_data *chip = &ksz_switch_chips[i];
+
+ if (dev->chip_id == chip->chip_id) {
+ if (!dev->enabled_ports)
+ dev->enabled_ports = chip->enabled_ports;
+ dev->name = chip->dev_name;
+ dev->num_vlans = chip->num_vlans;
+ dev->num_alus = chip->num_alus;
+ dev->num_statics = chip->num_statics;
+ /* default cpu port */
+ dev->cpu_port = chip->cpu_port;
+ dev->port_cnt = chip->port_cnt;
+
+ break;
+ }
+ }
+
+ /* no switch found */
+ if (!dev->port_cnt)
+ return -ENODEV;
+
+ return 0;
+}
+
+struct ksz_device *ksz_switch_alloc(struct device *base,
+ const struct ksz_io_ops *ops,
+ void *priv)
+{
+ struct dsa_switch *ds;
+ struct ksz_device *swdev;
+
+ ds = dsa_switch_alloc(base, DSA_MAX_PORTS);
+ if (!ds)
+ return NULL;
+
+ swdev = devm_kzalloc(base, sizeof(*swdev), GFP_KERNEL);
+ if (!swdev)
+ return NULL;
+
+ ds->priv = swdev;
+ swdev->dev = base;
+
+ swdev->ds = ds;
+ swdev->priv = priv;
+ swdev->ops = ops;
+
+ return swdev;
+}
+EXPORT_SYMBOL(ksz_switch_alloc);
+
+int ksz_switch_detect(struct ksz_device *dev)
+{
+ u8 data8;
+ u32 id32;
+ int ret;
+
+ /* turn off SPI DO Edge select */
+ ret = ksz_read8(dev, REG_SW_GLOBAL_SERIAL_CTRL_0, &data8);
+ if (ret)
+ return ret;
+
+ data8 &= ~SPI_AUTO_EDGE_DETECTION;
+ ret = ksz_write8(dev, REG_SW_GLOBAL_SERIAL_CTRL_0, data8);
+ if (ret)
+ return ret;
+
+ /* read chip id */
+ ret = ksz_read32(dev, REG_CHIP_ID0__1, &id32);
+ if (ret)
+ return ret;
+
+ dev->chip_id = id32;
+
+ return 0;
+}
+EXPORT_SYMBOL(ksz_switch_detect);
+
+int ksz_switch_register(struct ksz_device *dev)
+{
+ int ret;
+
+ if (dev->pdata) {
+ dev->chip_id = dev->pdata->chip_id;
+ dev->enabled_ports = dev->pdata->enabled_ports;
+ }
+
+ if (!dev->chip_id && ksz_switch_detect(dev))
+ return -EINVAL;
+
+ ret = ksz_switch_init(dev);
+ if (ret)
+ return ret;
+
+ return dsa_register_switch(dev->ds, dev->ds->dev);
+}
+EXPORT_SYMBOL(ksz_switch_register);
+
+void ksz_switch_remove(struct ksz_device *dev)
+{
+ dsa_unregister_switch(dev->ds);
+}
+EXPORT_SYMBOL(ksz_switch_remove);
+
+MODULE_AUTHOR("Woojung Huh <Woojung.Huh@microchip.com>");
+MODULE_DESCRIPTION("Microchip KSZ Series Switch DSA Driver");
diff --git a/drivers/net/dsa/microchip/ksz_priv.h b/drivers/net/dsa/microchip/ksz_priv.h
new file mode 100644
index 0000000..f201e49
--- /dev/null
+++ b/drivers/net/dsa/microchip/ksz_priv.h
@@ -0,0 +1,209 @@
+/*
+ * Microchip KSZ series switch common definitions
+ *
+ * Copyright (C) 2017
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef __KSZ_PRIV_H
+#define __KSZ_PRIV_H
+
+#include <linux/kernel.h>
+#include <linux/mutex.h>
+#include <linux/phy.h>
+#include <linux/etherdevice.h>
+#include <net/dsa.h>
+
+#include "ksz_9477_reg.h"
+
+struct ksz_io_ops;
+
+struct vlan_table {
+ u32 table[3];
+};
+
+struct ksz_device {
+ struct dsa_switch *ds;
+ struct ksz_platform_data *pdata;
+ const char *name;
+
+ struct mutex reg_mutex; /* register access */
+ struct mutex stats_mutex; /* status access */
+ struct mutex alu_mutex; /* ALU access */
+ const struct ksz_io_ops *ops;
+
+ struct device *dev;
+
+ void *priv;
+
+ /* chip specific data */
+ u32 chip_id;
+ u16 enabled_ports;
+ int num_vlans;
+ int num_alus;
+ int num_statics;
+ int cpu_port;
+ int port_cnt;
+
+ struct vlan_table *vlan_cache;
+
+ u64 mib_value[TOTAL_SWITCH_COUNTER_NUM];
+};
+
+struct ksz_io_ops {
+ int (*read8)(struct ksz_device *dev, u32 reg, u8 *value);
+ int (*read16)(struct ksz_device *dev, u32 reg, u16 *value);
+ int (*read24)(struct ksz_device *dev, u32 reg, u32 *value);
+ int (*read32)(struct ksz_device *dev, u32 reg, u32 *value);
+ int (*write8)(struct ksz_device *dev, u32 reg, u8 value);
+ int (*write16)(struct ksz_device *dev, u32 reg, u16 value);
+ int (*write24)(struct ksz_device *dev, u32 reg, u32 value);
+ int (*write32)(struct ksz_device *dev, u32 reg, u32 value);
+ int (*phy_read16)(struct ksz_device *dev, int addr, int reg,
+ u16 *value);
+ int (*phy_write16)(struct ksz_device *dev, int addr, int reg,
+ u16 value);
+};
+
+struct ksz_device *ksz_switch_alloc(struct device *base,
+ const struct ksz_io_ops *ops, void *priv);
+int ksz_switch_detect(struct ksz_device *dev);
+int ksz_switch_register(struct ksz_device *dev);
+void ksz_switch_remove(struct ksz_device *dev);
+
+static inline int ksz_read8(struct ksz_device *dev, u32 reg, u8 *val)
+{
+ int ret;
+
+ mutex_lock(&dev->reg_mutex);
+ ret = dev->ops->read8(dev, reg, val);
+ mutex_unlock(&dev->reg_mutex);
+
+ return ret;
+}
+
+static inline int ksz_read16(struct ksz_device *dev, u32 reg, u16 *val)
+{
+ int ret;
+
+ mutex_lock(&dev->reg_mutex);
+ ret = dev->ops->read16(dev, reg, val);
+ mutex_unlock(&dev->reg_mutex);
+
+ return ret;
+}
+
+static inline int ksz_read24(struct ksz_device *dev, u32 reg, u32 *val)
+{
+ int ret;
+
+ mutex_lock(&dev->reg_mutex);
+ ret = dev->ops->read24(dev, reg, val);
+ mutex_unlock(&dev->reg_mutex);
+
+ return ret;
+}
+
+static inline int ksz_read32(struct ksz_device *dev, u32 reg, u32 *val)
+{
+ int ret;
+
+ mutex_lock(&dev->reg_mutex);
+ ret = dev->ops->read32(dev, reg, val);
+ mutex_unlock(&dev->reg_mutex);
+
+ return ret;
+}
+
+static inline int ksz_write8(struct ksz_device *dev, u32 reg, u8 value)
+{
+ int ret;
+
+ mutex_lock(&dev->reg_mutex);
+ ret = dev->ops->write8(dev, reg, value);
+ mutex_unlock(&dev->reg_mutex);
+
+ return ret;
+}
+
+static inline int ksz_write16(struct ksz_device *dev, u32 reg, u16 value)
+{
+ int ret;
+
+ mutex_lock(&dev->reg_mutex);
+ ret = dev->ops->write16(dev, reg, value);
+ mutex_unlock(&dev->reg_mutex);
+
+ return ret;
+}
+
+static inline int ksz_write24(struct ksz_device *dev, u32 reg, u32 value)
+{
+ int ret;
+
+ mutex_lock(&dev->reg_mutex);
+ ret = dev->ops->write24(dev, reg, value);
+ mutex_unlock(&dev->reg_mutex);
+
+ return ret;
+}
+
+static inline int ksz_write32(struct ksz_device *dev, u32 reg, u32 value)
+{
+ int ret;
+
+ mutex_lock(&dev->reg_mutex);
+ ret = dev->ops->write32(dev, reg, value);
+ mutex_unlock(&dev->reg_mutex);
+
+ return ret;
+}
+
+static inline void ksz_pread8(struct ksz_device *dev, int port, int offset,
+ u8 *data)
+{
+ ksz_read8(dev, PORT_CTRL_ADDR(port, offset), data);
+}
+
+static inline void ksz_pread16(struct ksz_device *dev, int port, int offset,
+ u16 *data)
+{
+ ksz_read16(dev, PORT_CTRL_ADDR(port, offset), data);
+}
+
+static inline void ksz_pread32(struct ksz_device *dev, int port, int offset,
+ u32 *data)
+{
+ ksz_read32(dev, PORT_CTRL_ADDR(port, offset), data);
+}
+
+static inline void ksz_pwrite8(struct ksz_device *dev, int port, int offset,
+ u8 data)
+{
+ ksz_write8(dev, PORT_CTRL_ADDR(port, offset), data);
+}
+
+static inline void ksz_pwrite16(struct ksz_device *dev, int port, int offset,
+ u16 data)
+{
+ ksz_write16(dev, PORT_CTRL_ADDR(port, offset), data);
+}
+
+static inline void ksz_pwrite32(struct ksz_device *dev, int port, int offset,
+ u32 data)
+{
+ ksz_write32(dev, PORT_CTRL_ADDR(port, offset), data);
+}
+
+#endif
diff --git a/drivers/net/dsa/microchip/ksz_spi.c b/drivers/net/dsa/microchip/ksz_spi.c
new file mode 100644
index 0000000..f92e41e
--- /dev/null
+++ b/drivers/net/dsa/microchip/ksz_spi.c
@@ -0,0 +1,215 @@
+/*
+ * Microchip KSZ series register access through SPI
+ *
+ * Copyright (C) 2017
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <asm/unaligned.h>
+
+#include <linux/delay.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/spi/spi.h>
+
+#include "ksz_priv.h"
+
+/* SPI frame opcodes */
+#define KS_SPIOP_RD 3
+#define KS_SPIOP_WR 2
+
+#define SPI_ADDR_SHIFT 24
+#define SPI_ADDR_MASK (BIT(SPI_ADDR_SHIFT) - 1)
+#define SPI_TURNAROUND_SHIFT 5
+
+static inline int ksz_spi_read_reg(struct spi_device *spi, u32 reg, u8 *val,
+ unsigned int len)
+{
+ u32 txbuf;
+ int ret;
+
+ txbuf = reg & SPI_ADDR_MASK;
+ txbuf |= KS_SPIOP_RD << SPI_ADDR_SHIFT;
+ txbuf <<= SPI_TURNAROUND_SHIFT;
+ txbuf = cpu_to_be32(txbuf);
+
+ ret = spi_write_then_read(spi, &txbuf, 4, val, len);
+ return ret;
+}
+
+static int ksz_spi_read(struct ksz_device *dev, u32 reg, u8 *data,
+ unsigned int len)
+{
+ struct spi_device *spi = dev->priv;
+
+ return ksz_spi_read_reg(spi, reg, data, len);
+}
+
+static int ksz_spi_read8(struct ksz_device *dev, u32 reg, u8 *val)
+{
+ return ksz_spi_read(dev, reg, val, 1);
+}
+
+static int ksz_spi_read16(struct ksz_device *dev, u32 reg, u16 *val)
+{
+ int ret = ksz_spi_read(dev, reg, (u8 *)val, 2);
+
+ if (!ret)
+ *val = be16_to_cpu(*val);
+
+ return ret;
+}
+
+static int ksz_spi_read24(struct ksz_device *dev, u32 reg, u32 *val)
+{
+ int ret;
+
+ *val = 0;
+ ret = ksz_spi_read(dev, reg, (u8 *)val, 3);
+ if (!ret) {
+ *val = be32_to_cpu(*val);
+ /* convert to 24bit */
+ *val >>= 8;
+ }
+
+ return ret;
+}
+
+static int ksz_spi_read32(struct ksz_device *dev, u32 reg, u32 *val)
+{
+ int ret = ksz_spi_read(dev, reg, (u8 *)val, 4);
+
+ if (!ret)
+ *val = be32_to_cpu(*val);
+
+ return ret;
+}
+
+static inline int ksz_spi_write_reg(struct spi_device *spi, u32 reg, u8 *val,
+ unsigned int len)
+{
+ u32 txbuf;
+ u8 data[12];
+ int i;
+
+ txbuf = reg & SPI_ADDR_MASK;
+ txbuf |= (KS_SPIOP_WR << SPI_ADDR_SHIFT);
+ txbuf <<= SPI_TURNAROUND_SHIFT;
+ txbuf = cpu_to_be32(txbuf);
+
+ data[0] = txbuf & 0xFF;
+ data[1] = (txbuf & 0xFF00) >> 8;
+ data[2] = (txbuf & 0xFF0000) >> 16;
+ data[3] = (txbuf & 0xFF000000) >> 24;
+ for (i = 0; i < len; i++)
+ data[i + 4] = val[i];
+
+ return spi_write(spi, &data, 4 + len);
+}
+
+static int ksz_spi_write8(struct ksz_device *dev, u32 reg, u8 value)
+{
+ struct spi_device *spi = dev->priv;
+
+ return ksz_spi_write_reg(spi, reg, &value, 1);
+}
+
+static int ksz_spi_write16(struct ksz_device *dev, u32 reg, u16 value)
+{
+ struct spi_device *spi = dev->priv;
+
+ value = cpu_to_be16(value);
+ return ksz_spi_write_reg(spi, reg, (u8 *)&value, 2);
+}
+
+static int ksz_spi_write24(struct ksz_device *dev, u32 reg, u32 value)
+{
+ struct spi_device *spi = dev->priv;
+
+ /* make it to big endian 24bit from MSB */
+ value <<= 8;
+ value = cpu_to_be32(value);
+ return ksz_spi_write_reg(spi, reg, (u8 *)&value, 3);
+}
+
+static int ksz_spi_write32(struct ksz_device *dev, u32 reg, u32 value)
+{
+ struct spi_device *spi = dev->priv;
+
+ value = cpu_to_be32(value);
+ return ksz_spi_write_reg(spi, reg, (u8 *)&value, 4);
+}
+
+static const struct ksz_io_ops ksz_spi_ops = {
+ .read8 = ksz_spi_read8,
+ .read16 = ksz_spi_read16,
+ .read24 = ksz_spi_read24,
+ .read32 = ksz_spi_read32,
+ .write8 = ksz_spi_write8,
+ .write16 = ksz_spi_write16,
+ .write24 = ksz_spi_write24,
+ .write32 = ksz_spi_write32,
+};
+
+static int ksz_spi_probe(struct spi_device *spi)
+{
+ struct ksz_device *dev;
+ int ret;
+
+ dev = ksz_switch_alloc(&spi->dev, &ksz_spi_ops, spi);
+ if (!dev)
+ return -ENOMEM;
+
+ if (spi->dev.platform_data)
+ dev->pdata = spi->dev.platform_data;
+
+ ret = ksz_switch_register(dev);
+ if (ret)
+ return ret;
+
+ spi_set_drvdata(spi, dev);
+
+ return 0;
+}
+
+static int ksz_spi_remove(struct spi_device *spi)
+{
+ struct ksz_device *dev = spi_get_drvdata(spi);
+
+ if (dev)
+ ksz_switch_remove(dev);
+
+ return 0;
+}
+
+static const struct of_device_id ksz_dt_ids[] = {
+ { .compatible = "microchip,ksz9477" },
+ {},
+};
+MODULE_DEVICE_TABLE(of, ksz_dt_ids);
+
+static struct spi_driver ksz_spi_driver = {
+ .driver = {
+ .name = "ksz9477-switch",
+ .owner = THIS_MODULE,
+ .of_match_table = of_match_ptr(ksz_dt_ids),
+ },
+ .probe = ksz_spi_probe,
+ .remove = ksz_spi_remove,
+};
+
+module_spi_driver(ksz_spi_driver);
+
+MODULE_AUTHOR("Woojung Huh <Woojung.Huh@microchip.com>");
+MODULE_DESCRIPTION("Microchip KSZ Series Switch SPI access Driver");
diff --git a/include/linux/platform_data/microchip-ksz.h b/include/linux/platform_data/microchip-ksz.h
new file mode 100644
index 0000000..84789ca
--- /dev/null
+++ b/include/linux/platform_data/microchip-ksz.h
@@ -0,0 +1,29 @@
+/*
+ * Microchip KSZ series switch platform data
+ *
+ * Copyright (C) 2017
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef __MICROCHIP_KSZ_H
+#define __MICROCHIP_KSZ_H
+
+#include <linux/kernel.h>
+
+struct ksz_platform_data {
+ u32 chip_id;
+ u16 enabled_ports;
+};
+
+#endif
--
2.7.4
^ permalink raw reply related
* [PATCH v2 net-next 2/5] phy: micrel: add Microchip KSZ 9477 Switch PHY support
From: Woojung.Huh @ 2017-05-12 20:07 UTC (permalink / raw)
To: andrew, f.fainelli, vivien.didelot, sergei.shtylyov, netdev
Cc: davem, UNGLinuxDriver
From: Woojung Huh <Woojung.Huh@microchip.com>
Adding Microchip 9477 Phy included in KSZ9477 Switch.
Signed-off-by: Woojung Huh <Woojung.Huh@microchip.com>
---
drivers/net/phy/micrel.c | 11 +++++++++++
include/linux/micrel_phy.h | 2 ++
2 files changed, 13 insertions(+)
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
index 6a5fd18..263ba3a 100644
--- a/drivers/net/phy/micrel.c
+++ b/drivers/net/phy/micrel.c
@@ -20,6 +20,7 @@
* ksz8081, ksz8091,
* ksz8061,
* Switch : ksz8873, ksz886x
+ * ksz9477
*/
#include <linux/kernel.h>
@@ -997,6 +998,16 @@ static struct phy_driver ksphy_driver[] = {
.read_status = ksz8873mll_read_status,
.suspend = genphy_suspend,
.resume = genphy_resume,
+}, {
+ .phy_id = PHY_ID_KSZ9477,
+ .phy_id_mask = MICREL_PHY_ID_MASK,
+ .name = "Microchip KSZ9477",
+ .features = PHY_GBIT_FEATURES,
+ .config_init = kszphy_config_init,
+ .config_aneg = genphy_config_aneg,
+ .read_status = genphy_read_status,
+ .suspend = genphy_suspend,
+ .resume = genphy_resume,
} };
module_phy_driver(ksphy_driver);
diff --git a/include/linux/micrel_phy.h b/include/linux/micrel_phy.h
index f541da6..472fa4d 100644
--- a/include/linux/micrel_phy.h
+++ b/include/linux/micrel_phy.h
@@ -37,6 +37,8 @@
#define PHY_ID_KSZ8795 0x00221550
+#define PHY_ID_KSZ9477 0x00221631
+
/* struct phy_device dev_flags definitions */
#define MICREL_PHY_50MHZ_CLK 0x00000001
#define MICREL_PHY_FXEN 0x00000002
--
2.7.4
^ permalink raw reply related
* [PATCH v2 net-next 1/5] dsa: add support for Microchip KSZ tail tagging
From: Woojung.Huh @ 2017-05-12 20:07 UTC (permalink / raw)
To: andrew, f.fainelli, vivien.didelot, sergei.shtylyov, netdev
Cc: davem, UNGLinuxDriver
From: Woojung Huh <Woojung.Huh@microchip.com>
Adding support for the Microchip KSZ switch family tail tagging.
Signed-off-by: Woojung Huh <Woojung.Huh@microchip.com>
---
include/net/dsa.h | 1 +
net/dsa/Kconfig | 3 ++
net/dsa/Makefile | 1 +
net/dsa/dsa.c | 3 ++
net/dsa/dsa_priv.h | 3 ++
net/dsa/tag_ksz.c | 103 +++++++++++++++++++++++++++++++++++++++++++++++++++++
6 files changed, 114 insertions(+)
create mode 100644 net/dsa/tag_ksz.c
diff --git a/include/net/dsa.h b/include/net/dsa.h
index 8e24677..c92204a 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -34,6 +34,7 @@ enum dsa_tag_protocol {
DSA_TAG_PROTO_QCA,
DSA_TAG_PROTO_MTK,
DSA_TAG_PROTO_LAN9303,
+ DSA_TAG_PROTO_KSZ,
DSA_TAG_LAST, /* MUST BE LAST */
};
diff --git a/net/dsa/Kconfig b/net/dsa/Kconfig
index 81a0868..ce31428 100644
--- a/net/dsa/Kconfig
+++ b/net/dsa/Kconfig
@@ -37,4 +37,7 @@ config NET_DSA_TAG_MTK
config NET_DSA_TAG_LAN9303
bool
+config NET_DSA_TAG_KSZ
+ bool
+
endif
diff --git a/net/dsa/Makefile b/net/dsa/Makefile
index 0b747d7..8becb26 100644
--- a/net/dsa/Makefile
+++ b/net/dsa/Makefile
@@ -10,3 +10,4 @@ dsa_core-$(CONFIG_NET_DSA_TAG_TRAILER) += tag_trailer.o
dsa_core-$(CONFIG_NET_DSA_TAG_QCA) += tag_qca.o
dsa_core-$(CONFIG_NET_DSA_TAG_MTK) += tag_mtk.o
dsa_core-$(CONFIG_NET_DSA_TAG_LAN9303) += tag_lan9303.o
+dsa_core-$(CONFIG_NET_DSA_TAG_KSZ) += tag_ksz.o
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index 26130ae..6340323 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -61,6 +61,9 @@ const struct dsa_device_ops *dsa_device_ops[DSA_TAG_LAST] = {
#ifdef CONFIG_NET_DSA_TAG_LAN9303
[DSA_TAG_PROTO_LAN9303] = &lan9303_netdev_ops,
#endif
+#ifdef CONFIG_NET_DSA_TAG_KSZ
+ [DSA_TAG_PROTO_KSZ] = &ksz_netdev_ops,
+#endif
[DSA_TAG_PROTO_NONE] = &none_ops,
};
diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h
index f4a88e4..70183ac 100644
--- a/net/dsa/dsa_priv.h
+++ b/net/dsa/dsa_priv.h
@@ -96,4 +96,7 @@ extern const struct dsa_device_ops mtk_netdev_ops;
/* tag_lan9303.c */
extern const struct dsa_device_ops lan9303_netdev_ops;
+/* tag_ksz.c */
+extern const struct dsa_device_ops ksz_netdev_ops;
+
#endif
diff --git a/net/dsa/tag_ksz.c b/net/dsa/tag_ksz.c
new file mode 100644
index 0000000..9dda96e
--- /dev/null
+++ b/net/dsa/tag_ksz.c
@@ -0,0 +1,103 @@
+/*
+ * net/dsa/tag_ksz.c - Microchip KSZ Switch tag format handling
+ * Copyright (c) 2017 Microchip Technology
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include <linux/etherdevice.h>
+#include <linux/list.h>
+#include <linux/slab.h>
+#include <net/dsa.h>
+#include "dsa_priv.h"
+
+/* For Ingress (Host -> KSZ), 2 bytes are added before FCS.
+ * ---------------------------------------------------------------------------
+ * DA(6bytes)|SA(6bytes)|....|Data(nbytes)|tag0(1byte)|tag1(1byte)|FCS(4bytes)
+ * ---------------------------------------------------------------------------
+ * tag0 : Prioritization (not used now)
+ * tag1 : each bit represents port (eg, 0x01=port1, 0x02=port2, 0x10=port5)
+ *
+ * For Egress (KSZ -> Host), 1 byte is added before FCS.
+ * ---------------------------------------------------------------------------
+ * DA(6bytes)|SA(6bytes)|....|Data(nbytes)|tag0(1byte)|FCS(4bytes)
+ * ---------------------------------------------------------------------------
+ * tag0 : zero-based value represents port
+ * (eg, 0x00=port1, 0x02=port3, 0x06=port7)
+ */
+
+#define KSZ_INGRESS_TAG_LEN 2
+#define KSZ_EGRESS_TAG_LEN 1
+
+static struct sk_buff *ksz_xmit(struct sk_buff *skb, struct net_device *dev)
+{
+ struct dsa_slave_priv *p = netdev_priv(dev);
+ struct sk_buff *nskb;
+ int padlen;
+ u8 *tag;
+
+ padlen = (skb->len >= ETH_ZLEN) ? 0 : ETH_ZLEN - skb->len;
+
+ if (skb_tailroom(skb) >= padlen + KSZ_INGRESS_TAG_LEN) {
+ nskb = skb;
+ } else {
+ nskb = alloc_skb(NET_IP_ALIGN + skb->len +
+ padlen + KSZ_INGRESS_TAG_LEN, GFP_ATOMIC);
+ if (!nskb) {
+ kfree_skb(skb);
+ return NULL;
+ }
+ skb_reserve(nskb, NET_IP_ALIGN);
+
+ skb_reset_mac_header(nskb);
+ skb_set_network_header(nskb,
+ skb_network_header(skb) - skb->head);
+ skb_set_transport_header(nskb,
+ skb_transport_header(skb) - skb->head);
+ skb_copy_and_csum_dev(skb, skb_put(nskb, skb->len));
+ kfree_skb(skb);
+ }
+
+ if (padlen) {
+ u8 *pad = skb_put(nskb, padlen);
+
+ memset(pad, 0, padlen);
+ }
+
+ tag = skb_put(nskb, KSZ_INGRESS_TAG_LEN);
+ tag[0] = 0;
+ tag[1] = 1 << p->dp->index; /* destnation port */
+
+ return nskb;
+}
+
+struct sk_buff *ksz_rcv(struct sk_buff *skb, struct net_device *dev,
+ struct packet_type *pt, struct net_device *orig_dev)
+{
+ struct dsa_switch_tree *dst = dev->dsa_ptr;
+ struct dsa_switch *ds;
+ u8 *tag;
+ int source_port;
+
+ ds = dst->cpu_switch;
+
+ tag = skb_tail_pointer(skb) - KSZ_EGRESS_TAG_LEN;
+
+ source_port = tag[0] & 7;
+ if (source_port >= ds->num_ports || !ds->ports[source_port].netdev)
+ return NULL;
+
+ pskb_trim_rcsum(skb, skb->len - KSZ_EGRESS_TAG_LEN);
+
+ skb->dev = ds->ports[source_port].netdev;
+
+ return skb;
+}
+
+const struct dsa_device_ops ksz_netdev_ops = {
+ .xmit = ksz_xmit,
+ .rcv = ksz_rcv,
+};
--
2.7.4
^ permalink raw reply related
* [PATCH v2 net-next 0/5] dsa: add Microchip KSZ9477 DSA driver
From: Woojung.Huh @ 2017-05-12 20:07 UTC (permalink / raw)
To: andrew, f.fainelli, vivien.didelot, sergei.shtylyov, netdev
Cc: davem, UNGLinuxDriver
From: Woojung Huh <Woojung.Huh@microchip.com>
This series of patches is for Microchip KSZ9477 DSA driver.
KSZ9477 is 7 ports GigE switch with numerous advanced features.
5 ports are 10/100/1000 Mbps internal PHYs and 2 ports have
Interfaces to SGMII, RGMII, MII or RMII.
This patch supports VLAN, MDB, FDB and port mirroring offloads.
Welcome reviews and comments from community.
Note: Tests are performed on internal development board.
V2
- update per review comments
- several cosmetic changes
- net/dsa/tag_ksz.c
* constants are changed to defines
* remove skb_linearize() in ksz_rcv()
* ksz_xmit()checks skb tailroom before allocate new skb
- drivers/net/phy/micrel.c
* remove PHY_HAS_MAGICANEG from ksphy_driver[]
- drivers/net/dsa/microchip/ksz_common.c
* add timeout to avoid endless loop
* port initialization is move to ksz_port_enable() instead of ksz_setup_ports()
- Documentation/devicetree/bindings/net/dsa/ksz.txt
* fix typo and indentations
Thanks to Andres, Florian, Sergei for reviews.
Woojung Huh (5):
dsa: add support for Microchip KSZ tail tagging
phy: micrel: add Microchip KSZ 9477 Switch PHY support
dsa: add DSA switch driver for Microchip KSZ9477
dsa: Add spi support to Microchip KSZ switches
dsa: add maintainer of Microchip KSZ switches
Documentation/devicetree/bindings/net/dsa/ksz.txt | 73 +
MAINTAINERS | 9 +
drivers/net/dsa/Kconfig | 2 +
drivers/net/dsa/Makefile | 1 +
drivers/net/dsa/microchip/Kconfig | 12 +
drivers/net/dsa/microchip/Makefile | 2 +
drivers/net/dsa/microchip/ksz_9477_reg.h | 1676 +++++++++++++++++++++
drivers/net/dsa/microchip/ksz_common.c | 1211 +++++++++++++++
drivers/net/dsa/microchip/ksz_priv.h | 209 +++
drivers/net/dsa/microchip/ksz_spi.c | 215 +++
drivers/net/phy/micrel.c | 11 +
include/linux/micrel_phy.h | 2 +
include/linux/platform_data/microchip-ksz.h | 29 +
include/net/dsa.h | 1 +
net/dsa/Kconfig | 3 +
net/dsa/Makefile | 1 +
net/dsa/dsa.c | 3 +
net/dsa/dsa_priv.h | 3 +
net/dsa/tag_ksz.c | 103 ++
19 files changed, 3566 insertions(+)
create mode 100644 Documentation/devicetree/bindings/net/dsa/ksz.txt
create mode 100644 drivers/net/dsa/microchip/Kconfig
create mode 100644 drivers/net/dsa/microchip/Makefile
create mode 100644 drivers/net/dsa/microchip/ksz_9477_reg.h
create mode 100644 drivers/net/dsa/microchip/ksz_common.c
create mode 100644 drivers/net/dsa/microchip/ksz_priv.h
create mode 100644 drivers/net/dsa/microchip/ksz_spi.c
create mode 100644 include/linux/platform_data/microchip-ksz.h
create mode 100644 net/dsa/tag_ksz.c
--
2.7.4
^ permalink raw reply
* [PATCH net] netvsc: fix net poll mode
From: Stephen Hemminger @ 2017-05-12 20:03 UTC (permalink / raw)
To: davem; +Cc: netdev, Stephen Hemminger
The ndo_poll_controller function needs to schedule NAPI to pick
up arriving packets and send completions. Otherwise no data
will ever be received.
Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
---
drivers/net/hyperv/netvsc_drv.c | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index 4421a6d00375..e487ccea251c 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -1158,11 +1158,20 @@ netvsc_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *info,
}
#ifdef CONFIG_NET_POLL_CONTROLLER
-static void netvsc_poll_controller(struct net_device *net)
+static void netvsc_poll_controller(struct net_device *dev)
{
- /* As netvsc_start_xmit() works synchronous we don't have to
- * trigger anything here.
- */
+ struct net_device_context *ndc = netdev_priv(dev);
+ struct netvsc_device *ndev = rtnl_dereference(ndc->nvdev);
+ int i;
+
+ if (!ndev)
+ return;
+
+ for (i = 0; i < ndev->num_chn; i++) {
+ struct netvsc_channel *nvchan = &ndev->chan_table[i];
+
+ napi_schedule(&nvchan->napi);
+ }
}
#endif
--
2.11.0
^ permalink raw reply related
* [PATCH net-next,v2] tools: hv: Add clean up for included files in Ubuntu net config
From: Haiyang Zhang @ 2017-05-12 19:14 UTC (permalink / raw)
To: davem, netdev; +Cc: haiyangz, kys, olaf, vkuznets, linux-kernel
From: Haiyang Zhang <haiyangz@microsoft.com>
The clean up function is updated to cover duplicate config info in
files included by "source" key word in Ubuntu network config.
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
---
tools/hv/bondvf.sh | 21 ++++++++++++++++++---
1 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/tools/hv/bondvf.sh b/tools/hv/bondvf.sh
index d85968c..112deba 100755
--- a/tools/hv/bondvf.sh
+++ b/tools/hv/bondvf.sh
@@ -102,15 +102,30 @@ function create_bond_cfg_redhat {
}
function del_eth_cfg_ubuntu {
- local fn=$cfgdir/interfaces
+ local mainfn=$cfgdir/interfaces
+ local fnlist=( $mainfn )
+
+ local dirlist=(`awk '/^[ \t]*source/{print $2}' $mainfn`)
+
+ local i
+ for i in "${dirlist[@]}"
+ do
+ fnlist+=(`ls $i 2>/dev/null`)
+ done
+
local tmpfl=$(mktemp)
local nic_start='^[ \t]*(auto|iface|mapping|allow-.*)[ \t]+'$1
local nic_end='^[ \t]*(auto|iface|mapping|allow-.*|source)'
- awk "/$nic_end/{x=0} x{next} /$nic_start/{x=1;next} 1" $fn >$tmpfl
+ local fn
+ for fn in "${fnlist[@]}"
+ do
+ awk "/$nic_end/{x=0} x{next} /$nic_start/{x=1;next} 1" \
+ $fn >$tmpfl
- cp $tmpfl $fn
+ cp $tmpfl $fn
+ done
rm $tmpfl
}
--
1.7.1
^ permalink raw reply related
* Re: [Problem] Broadcom BCM5762 Ethernet tg3 times out with stack trace
From: Daniel Kim @ 2017-05-12 19:10 UTC (permalink / raw)
To: Siva Reddy Kallam; +Cc: Prashant Sreedharan, Michael Chan, Linux Netdev List
In-Reply-To: <CAMet4B7c_wT3rk2DBcTBmdMpPpHuiuWSEae=VLrVH_tfcZT1_g@mail.gmail.com>
I disabled TSO after a reboot and the TX timeout still occurred. I
have the clipped dmesg log with the first timeout below. I can post
the entire dmesg log if you need it.
[ 4895.554334] ------------[ cut here ]------------
[ 4895.554395] WARNING: CPU: 1 PID: 0 at
/home/kernel/COD/linux/net/sched/sch_generic.c:316
dev_watchdog+0x22c/0x230
[ 4895.554402] NETDEV WATCHDOG: enp4s0 (tg3): transmit queue 0 timed out
[ 4895.554407] Modules linked in: hp_wmi sparse_keymap
snd_hda_codec_hdmi edac_mce_amd edac_core crct10dif_pclmul
crc32_pclmul ghash_clmulni_intel pcbc aesni_intel aes_x86_64
crypto_simd glue_helper k10temp input_leds snd_hda_codec_realtek
snd_hda_codec_generic joydev snd_hda_intel snd_hda_codec snd_seq_midi
snd_seq_midi_event snd_hda_core snd_rawmidi snd_hwdep snd_pcm snd_seq
snd_seq_device i2c_piix4 cryptd serio_raw snd_timer snd soundcore
mac_hid shpchp wmi tpm_infineon parport_pc ppdev lp parport autofs4
hid_generic usbhid hid psmouse tg3 ptp pps_core ahci libahci video
[ 4895.554464] CPU: 1 PID: 0 Comm: swapper/1 Not tainted
4.11.0-041100-generic #201705041534
[ 4895.554466] Hardware name: Hewlett-Packard HP EliteDesk 705 G1
MT/2215, BIOS L06 v02.17 12/11/2014
[ 4895.554468] Call Trace:
[ 4895.554470] <IRQ>
[ 4895.554476] dump_stack+0x63/0x81
[ 4895.554479] __warn+0xcb/0xf0
[ 4895.554481] warn_slowpath_fmt+0x5a/0x80
[ 4895.554485] ? cpu_load_update+0xdd/0x150
[ 4895.554490] dev_watchdog+0x22c/0x230
[ 4895.554494] ? qdisc_rcu_free+0x50/0x50
[ 4895.554497] call_timer_fn+0x35/0x140
[ 4895.554500] run_timer_softirq+0x1db/0x440
[ 4895.554503] ? ktime_get+0x41/0xb0
[ 4895.554507] ? lapic_next_event+0x1d/0x30
[ 4895.554510] ? clockevents_program_event+0x7f/0x120
[ 4895.554514] __do_softirq+0x104/0x2af
[ 4895.554517] irq_exit+0xb6/0xc0
[ 4895.554521] smp_apic_timer_interrupt+0x3d/0x50
[ 4895.554524] apic_timer_interrupt+0x89/0x90
[ 4895.554528] RIP: 0010:cpuidle_enter_state+0x122/0x2c0
[ 4895.554533] RSP: 0018:ffffb4f540cd3e58 EFLAGS: 00000246 ORIG_RAX:
ffffffffffffff10
[ 4895.554535] RAX: 0000000000000000 RBX: 0000000000000002 RCX: 000000000000001f
[ 4895.554537] RDX: 00000473d5c60286 RSI: ffff8b5eeec989d8 RDI: 0000000000000000
[ 4895.554539] RBP: ffffb4f540cd3e98 R08: 000000000002ced9 R09: 0000000000000018
[ 4895.554540] R10: ffffb4f540cd3e28 R11: 000000000000a3bb R12: ffff8b5edd6afa00
[ 4895.554542] R13: ffffffffa6cf92d8 R14: 0000000000000002 R15: ffffffffa6cf92c0
[ 4895.554544] </IRQ>
[ 4895.554548] ? cpuidle_enter_state+0x110/0x2c0
[ 4895.554551] cpuidle_enter+0x17/0x20
[ 4895.554555] call_cpuidle+0x23/0x40
[ 4895.554558] do_idle+0x189/0x200
[ 4895.554561] cpu_startup_entry+0x71/0x80
[ 4895.554565] start_secondary+0x154/0x190
[ 4895.554570] start_cpu+0x14/0x14
[ 4895.554575] ---[ end trace 916882647d3d7651 ]---
[ 4895.554582] tg3 0000:04:00.0 enp4s0: transmit timed out, resetting
[ 4895.710421] hrtimer: interrupt took 103273632 ns
[ 4898.360557] tg3 0000:04:00.0 enp4s0: 0x00000000: 0x168714e4,
0x00100506, 0x02000010, 0x00000010
[ 4898.360562] tg3 0000:04:00.0 enp4s0: 0x00000010: 0xe212000c,
0x00000000, 0xe211000c, 0x00000000
[ 4898.360565] tg3 0000:04:00.0 enp4s0: 0x00000020: 0xe210000c,
0x00000000, 0x00000000, 0x2215103c
[ 4898.360568] tg3 0000:04:00.0 enp4s0: 0x00000030: 0x00000000,
0x00000048, 0x00000000, 0x0000010a
[ 4898.360571] tg3 0000:04:00.0 enp4s0: 0x00000040: 0x00000000,
0x21000000, 0xc8035001, 0x16002008
[ 4898.360576] tg3 0000:04:00.0 enp4s0: 0x00000050: 0x00005803,
0x00000000, 0x0086a005, 0x00000000
[ 4898.360578] tg3 0000:04:00.0 enp4s0: 0x00000060: 0x00000000,
0x00000000, 0xf1000298, 0x01f802d1
[ 4898.360582] tg3 0000:04:00.0 enp4s0: 0x00000070: 0x00071010,
0xf7001900, 0x00000000, 0x00000000
[ 4898.360585] tg3 0000:04:00.0 enp4s0: 0x00000080: 0x168714e4,
0x800000f8, 0x00000000, 0x000004a0
[ 4898.360587] tg3 0000:04:00.0 enp4s0: 0x00000090: 0x00000000,
0x00000135, 0x00000000, 0x00000568
[ 4898.360590] tg3 0000:04:00.0 enp4s0: 0x000000a0: 0x8005ac11,
0x00000004, 0x00000122, 0x00020010
[ 4898.360593] tg3 0000:04:00.0 enp4s0: 0x000000b0: 0x10008d82,
0x00105400, 0x00475c12, 0x10120043
[ 4898.360595] tg3 0000:04:00.0 enp4s0: 0x000000d0: 0x0008081f,
0x00000000, 0x00000000, 0x00010001
[ 4898.360598] tg3 0000:04:00.0 enp4s0: 0x000000f0: 0x00000000,
0x05762100, 0x00000000, 0xffffffff
[ 4898.360600] tg3 0000:04:00.0 enp4s0: 0x00000100: 0x13c10001,
0x00000000, 0x00000000, 0x00062030
[ 4898.360603] tg3 0000:04:00.0 enp4s0: 0x00000110: 0x00000000,
0x00002000, 0x000000a0, 0x00000000
[ 4898.360606] tg3 0000:04:00.0 enp4s0: 0x00000130: 0x00000000,
0x00000000, 0x00000000, 0x15010003
[ 4898.360609] tg3 0000:04:00.0 enp4s0: 0x00000140: 0xd45792bf,
0x00008cdc, 0x00000000, 0x00000000
[ 4898.360612] tg3 0000:04:00.0 enp4s0: 0x00000150: 0x16010004,
0x00000000, 0x00078116, 0x00000001
[ 4898.360615] tg3 0000:04:00.0 enp4s0: 0x00000160: 0x1b010002,
0x00000000, 0x00000000, 0x00000000
[ 4898.360617] tg3 0000:04:00.0 enp4s0: 0x00000170: 0x00000000,
0x80000001, 0x00000000, 0x00000000
[ 4898.360620] tg3 0000:04:00.0 enp4s0: 0x000001b0: 0x23010018,
0x00000000, 0x00000000, 0x00000000
[ 4898.360623] tg3 0000:04:00.0 enp4s0: 0x00000200: 0x00000000,
0x21000000, 0x00000000, 0x8c000000
[ 4898.360626] tg3 0000:04:00.0 enp4s0: 0x00000210: 0x00000000,
0x47000000, 0x00000000, 0x00000001
[ 4898.360629] tg3 0000:04:00.0 enp4s0: 0x00000220: 0x00000000,
0x00000001, 0x00000000, 0x00000000
[ 4898.360631] tg3 0000:04:00.0 enp4s0: 0x00000260: 0x00000000,
0x00000000, 0x00000000, 0x00000568
[ 4898.360634] tg3 0000:04:00.0 enp4s0: 0x00000280: 0x00000000,
0x000004a0, 0x00000000, 0x00000800
[ 4898.360637] tg3 0000:04:00.0 enp4s0: 0x00000300: 0x00000000,
0x00000135, 0x00000000, 0x00000135
[ 4898.360639] tg3 0000:04:00.0 enp4s0: 0x00000310: 0x00000000,
0x00000135, 0x00000000, 0x00000135
[ 4898.360642] tg3 0000:04:00.0 enp4s0: 0x00000320: 0x00000000,
0x00000135, 0x00000000, 0x00000135
[ 4898.360645] tg3 0000:04:00.0 enp4s0: 0x00000330: 0x00000000,
0x00000135, 0x00000000, 0x00000135
[ 4898.360647] tg3 0000:04:00.0 enp4s0: 0x00000340: 0x00000000,
0x00000135, 0x00000000, 0x00000135
[ 4898.360650] tg3 0000:04:00.0 enp4s0: 0x00000350: 0x00000000,
0x00000135, 0x00000000, 0x00000135
[ 4898.360653] tg3 0000:04:00.0 enp4s0: 0x00000360: 0x00000000,
0x00000135, 0x00000000, 0x00000135
[ 4898.360655] tg3 0000:04:00.0 enp4s0: 0x00000370: 0x00000000,
0x00000135, 0x00000000, 0x00000135
[ 4898.360658] tg3 0000:04:00.0 enp4s0: 0x00000380: 0x00000000,
0x00000135, 0x00000000, 0x00000135
[ 4898.360661] tg3 0000:04:00.0 enp4s0: 0x00000390: 0x00000000,
0x00000135, 0x00000000, 0x00000135
[ 4898.360663] tg3 0000:04:00.0 enp4s0: 0x000003a0: 0x00000000,
0x00000135, 0x00000000, 0x00000135
[ 4898.360666] tg3 0000:04:00.0 enp4s0: 0x000003b0: 0x00000000,
0x00000135, 0x00000000, 0x00000135
[ 4898.360669] tg3 0000:04:00.0 enp4s0: 0x000003c0: 0x00000000,
0x00000135, 0x00000000, 0x00000135
[ 4898.360671] tg3 0000:04:00.0 enp4s0: 0x000003d0: 0x00000000,
0x00000135, 0x00000000, 0x00000135
[ 4898.360674] tg3 0000:04:00.0 enp4s0: 0x000003e0: 0x00000000,
0x00000135, 0x00000000, 0x00000135
[ 4898.360676] tg3 0000:04:00.0 enp4s0: 0x000003f0: 0x00000000,
0x00000135, 0x00000000, 0x00000135
[ 4898.360679] tg3 0000:04:00.0 enp4s0: 0x00000400: 0x18e04808,
0x00400000, 0x00001000, 0x00009f00
[ 4898.360682] tg3 0000:04:00.0 enp4s0: 0x00000410: 0x00008cdc,
0xd45792bf, 0x00008cdc, 0xd45792bf
[ 4898.360685] tg3 0000:04:00.0 enp4s0: 0x00000420: 0x00008cdc,
0xd45792bf, 0x00008cdc, 0xd45792bf
[ 4898.360687] tg3 0000:04:00.0 enp4s0: 0x00000430: 0x00000000,
0x00000000, 0x00000247, 0x000005f2
[ 4898.360690] tg3 0000:04:00.0 enp4s0: 0x00000440: 0x00000000,
0x00000000, 0x00000000, 0x082e0006
[ 4898.360693] tg3 0000:04:00.0 enp4s0: 0x00000450: 0x00000001,
0x00008000, 0x00000000, 0x00000112
[ 4898.360696] tg3 0000:04:00.0 enp4s0: 0x00000460: 0x0000000b,
0x00002620, 0x03ff0006, 0x00000000
[ 4898.360698] tg3 0000:04:00.0 enp4s0: 0x00000470: 0xa0000000,
0x00000000, 0x00000000, 0x50000001
[ 4898.360701] tg3 0000:04:00.0 enp4s0: 0x00000480: 0x42000000,
0x7fffffff, 0x06000004, 0x7fffffff
[ 4898.360704] tg3 0000:04:00.0 enp4s0: 0x00000500: 0x00000008,
0x00000002, 0x00000000, 0x00000000
[ 4898.360707] tg3 0000:04:00.0 enp4s0: 0x00000590: 0x00901000,
0x00000000, 0x00000000, 0x00000000
[ 4898.360710] tg3 0000:04:00.0 enp4s0: 0x00000600: 0xffffffff,
0x00f80011, 0x00000000, 0x40001f0c
[ 4898.360713] tg3 0000:04:00.0 enp4s0: 0x00000610: 0xffffffff,
0x00000000, 0x00000044, 0x00000000
[ 4898.360716] tg3 0000:04:00.0 enp4s0: 0x00000620: 0x00000040,
0x00000000, 0x00000000, 0x00000000
[ 4898.360719] tg3 0000:04:00.0 enp4s0: 0x00000630: 0x01010101,
0x01010101, 0x01010101, 0x01010101
[ 4898.360722] tg3 0000:04:00.0 enp4s0: 0x00000640: 0x01010101,
0x01010101, 0x01010101, 0x01010101
[ 4898.360724] tg3 0000:04:00.0 enp4s0: 0x00000650: 0x01010101,
0x01010101, 0x01010101, 0x01010101
[ 4898.360727] tg3 0000:04:00.0 enp4s0: 0x00000660: 0x01010101,
0x01010101, 0x01010101, 0x01010101
[ 4898.360730] tg3 0000:04:00.0 enp4s0: 0x00000670: 0xf669e6e0,
0x7e83ca79, 0xe1e9b13f, 0x74884280
[ 4898.360733] tg3 0000:04:00.0 enp4s0: 0x00000680: 0xf84bd72f,
0x64cef294, 0xbd78b55a, 0xce028e0e
[ 4898.360735] tg3 0000:04:00.0 enp4s0: 0x00000690: 0x30e8d62a,
0x171b548c, 0x00000000, 0x00000000
[ 4898.360738] tg3 0000:04:00.0 enp4s0: 0x000006c0: 0x00000000,
0x00000000, 0x04000000, 0x00000000
[ 4898.360741] tg3 0000:04:00.0 enp4s0: 0x00000800: 0x00000000,
0xffffffff, 0x00000000, 0x00000000
[ 4898.360744] tg3 0000:04:00.0 enp4s0: 0x00000810: 0x00000000,
0xffffffff, 0x00000000, 0x00000000
[ 4898.360746] tg3 0000:04:00.0 enp4s0: 0x00000820: 0x00000000,
0x00000000, 0xffffffff, 0x00000000
[ 4898.360749] tg3 0000:04:00.0 enp4s0: 0x00000830: 0x00000000,
0xffffffff, 0xffffffff, 0xffffffff
[ 4898.360752] tg3 0000:04:00.0 enp4s0: 0x00000840: 0xffffffff,
0xffffffff, 0xffffffff, 0xffffffff
[ 4898.360755] tg3 0000:04:00.0 enp4s0: 0x00000850: 0xffffffff,
0xffffffff, 0xffffffff, 0xffffffff
[ 4898.360758] tg3 0000:04:00.0 enp4s0: 0x00000860: 0xffffffff,
0xffffffff, 0xffffffff, 0x00000000
[ 4898.360761] tg3 0000:04:00.0 enp4s0: 0x00000880: 0x00000000,
0x00518513, 0x00000000, 0x00000000
[ 4898.360764] tg3 0000:04:00.0 enp4s0: 0x000008f0: 0x007c0001,
0x00000000, 0x00000000, 0x00000000
[ 4898.360766] tg3 0000:04:00.0 enp4s0: 0x00000900: 0x000f6674,
0xffffffff, 0x00000000, 0x00000000
[ 4898.360770] tg3 0000:04:00.0 enp4s0: 0x00000910: 0x000000f3,
0xffffffff, 0x00000000, 0x00000000
[ 4898.360772] tg3 0000:04:00.0 enp4s0: 0x00000920: 0x00000000,
0x00000000, 0xffffffff, 0x00000000
[ 4898.360774] tg3 0000:04:00.0 enp4s0: 0x00000930: 0x00000000,
0xffffffff, 0xffffffff, 0xffffffff
[ 4898.360778] tg3 0000:04:00.0 enp4s0: 0x00000940: 0xffffffff,
0xffffffff, 0xffffffff, 0xffffffff
[ 4898.360781] tg3 0000:04:00.0 enp4s0: 0x00000950: 0xffffffff,
0xffffffff, 0xffffffff, 0xffffffff
[ 4898.360784] tg3 0000:04:00.0 enp4s0: 0x00000960: 0xffffffff,
0xffffffff, 0xffffffff, 0x000031ba
[ 4898.360787] tg3 0000:04:00.0 enp4s0: 0x00000970: 0x00000037,
0x00000114, 0x00000000, 0x00000000
[ 4898.360790] tg3 0000:04:00.0 enp4s0: 0x00000980: 0x0834d82a,
0x00518513, 0x00000000, 0x00014073
[ 4898.360794] tg3 0000:04:00.0 enp4s0: 0x00000990: 0x000091b4,
0x00016e46, 0x00000000, 0x00000000
[ 4898.360797] tg3 0000:04:00.0 enp4s0: 0x00000c00: 0x0000000a,
0x00000000, 0x00000003, 0x00000001
[ 4898.360800] tg3 0000:04:00.0 enp4s0: 0x00000c10: 0x00000000,
0x00000000, 0x00000000, 0x00520000
[ 4898.360803] tg3 0000:04:00.0 enp4s0: 0x00000c80: 0x00003305,
0x00000000, 0x00000000, 0x00000000
[ 4898.360806] tg3 0000:04:00.0 enp4s0: 0x00000ce0: 0xffbd3e02,
0x00000000, 0x00000052, 0x00041028
[ 4898.360809] tg3 0000:04:00.0 enp4s0: 0x00000cf0: 0x00000000,
0x50000035, 0x00000000, 0x00000000
[ 4898.360815] tg3 0000:04:00.0 enp4s0: 0x00001000: 0x00000002,
0x00000000, 0xa0000708, 0x00000000
[ 4898.360820] tg3 0000:04:00.0 enp4s0: 0x00001010: 0x01351351,
0x00000708, 0x00000000, 0x00000000
[ 4898.360826] tg3 0000:04:00.0 enp4s0: 0x00001400: 0x00000006,
0x00000000, 0x00000000, 0x00000001
[ 4898.360830] tg3 0000:04:00.0 enp4s0: 0x00001440: 0x00000135,
0x00000135, 0x00000135, 0x00000135
[ 4898.360833] tg3 0000:04:00.0 enp4s0: 0x00001450: 0x00000135,
0x00000135, 0x00000135, 0x00000135
[ 4898.360837] tg3 0000:04:00.0 enp4s0: 0x00001460: 0x00000135,
0x00000135, 0x00000135, 0x00000135
[ 4898.360842] tg3 0000:04:00.0 enp4s0: 0x00001470: 0x00000135,
0x00000135, 0x00000135, 0x00000135
[ 4898.360849] tg3 0000:04:00.0 enp4s0: 0x00001800: 0x00000016,
0x00000000, 0x00000135, 0x00000000
[ 4898.360854] tg3 0000:04:00.0 enp4s0: 0x00001840: 0x00000000,
0x00000000, 0x00000200, 0x00000010
[ 4898.360860] tg3 0000:04:00.0 enp4s0: 0x00001850: 0x0000001f,
0x00000000, 0x00004340, 0x01350135
[ 4898.360865] tg3 0000:04:00.0 enp4s0: 0x00001860: 0x01000000,
0x00000000, 0x00000000, 0x00000000
[ 4898.360870] tg3 0000:04:00.0 enp4s0: 0x00001c00: 0x00000002,
0x00000000, 0x00000000, 0x00000000
[ 4898.360876] tg3 0000:04:00.0 enp4s0: 0x00002000: 0x00000002,
0x00000000, 0x00000000, 0x00000000
[ 4898.360881] tg3 0000:04:00.0 enp4s0: 0x00002010: 0x00000181,
0x00000001, 0x007bfffd, 0x00000000
[ 4898.360887] tg3 0000:04:00.0 enp4s0: 0x00002100: 0x000ce07c,
0x000dcaf1, 0x00000008, 0x00000000
[ 4898.360892] tg3 0000:04:00.0 enp4s0: 0x00002110: 0x000ce07c,
0x000dcaf1, 0x00000008, 0x00000000
[ 4898.360896] tg3 0000:04:00.0 enp4s0: 0x00002120: 0x000ce07c,
0x000dcaf1, 0x00000008, 0x00000000
[ 4898.360899] tg3 0000:04:00.0 enp4s0: 0x00002130: 0x000ce07c,
0x000dcaf1, 0x00000008, 0x00000000
[ 4898.360903] tg3 0000:04:00.0 enp4s0: 0x00002140: 0x000ce07c,
0x000dcaf1, 0x00000008, 0x00000000
[ 4898.360909] tg3 0000:04:00.0 enp4s0: 0x00002150: 0x000ce07c,
0x000dcaf1, 0x00000008, 0x00000000
[ 4898.360913] tg3 0000:04:00.0 enp4s0: 0x00002160: 0x000ce07c,
0x000dcaf1, 0x00000008, 0x00000000
[ 4898.360919] tg3 0000:04:00.0 enp4s0: 0x00002170: 0x000ce07c,
0x000dcaf1, 0x00000008, 0x00000000
[ 4898.360923] tg3 0000:04:00.0 enp4s0: 0x00002180: 0x000ce07c,
0x000dcaf1, 0x00000008, 0x00000000
[ 4898.360928] tg3 0000:04:00.0 enp4s0: 0x00002190: 0x000ce07c,
0x000dcaf1, 0x00000008, 0x00000000
[ 4898.360933] tg3 0000:04:00.0 enp4s0: 0x000021a0: 0x000ce07c,
0x000dcaf1, 0x00000008, 0x00000000
[ 4898.360936] tg3 0000:04:00.0 enp4s0: 0x000021b0: 0x000ce07c,
0x000dcaf1, 0x00000008, 0x00000000
[ 4898.360940] tg3 0000:04:00.0 enp4s0: 0x000021c0: 0x000ce07c,
0x000dcaf1, 0x00000008, 0x00000000
[ 4898.360944] tg3 0000:04:00.0 enp4s0: 0x000021d0: 0x000ce07c,
0x000dcaf1, 0x00000008, 0x00000000
[ 4898.360947] tg3 0000:04:00.0 enp4s0: 0x000021e0: 0x000ce07c,
0x000dcaf1, 0x00000008, 0x00000000
[ 4898.360950] tg3 0000:04:00.0 enp4s0: 0x000021f0: 0x000ce07c,
0x000dcaf1, 0x00000008, 0x00000000
[ 4898.360954] tg3 0000:04:00.0 enp4s0: 0x00002200: 0x000150a0,
0x00000000, 0x00000000, 0x00000000
[ 4898.360957] tg3 0000:04:00.0 enp4s0: 0x00002250: 0x0002033e,
0x00000000, 0x00000000, 0x00000000
[ 4898.360961] tg3 0000:04:00.0 enp4s0: 0x00002400: 0x00010012,
0x00000000, 0x00000000, 0x00000000
[ 4898.360964] tg3 0000:04:00.0 enp4s0: 0x00002440: 0x00000000,
0x00000000, 0x00000002, 0x00000000
[ 4898.360968] tg3 0000:04:00.0 enp4s0: 0x00002450: 0x00000000,
0xfffe0000, 0x08001800, 0x00006000
[ 4898.360971] tg3 0000:04:00.0 enp4s0: 0x00002470: 0x00000000,
0x000004aa, 0x00000000, 0x00000000
[ 4898.360975] tg3 0000:04:00.0 enp4s0: 0x000024c0: 0x02015101,
0x00000000, 0x00000000, 0x00000000
[ 4898.360979] tg3 0000:04:00.0 enp4s0: 0x00002800: 0x00000006,
0x00000000, 0x00000000, 0x00000000
[ 4898.360983] tg3 0000:04:00.0 enp4s0: 0x00002c00: 0x00000006,
0x00000000, 0x00000000, 0x00000520
[ 4898.360986] tg3 0000:04:00.0 enp4s0: 0x00002c10: 0x00000000,
0x00000000, 0x00000019, 0x0000000c
[ 4898.360990] tg3 0000:04:00.0 enp4s0: 0x00002c20: 0x00000002,
0x00000000, 0x00000000, 0x00000000
[ 4898.360994] tg3 0000:04:00.0 enp4s0: 0x00002d00: 0x00000080,
0x00000040, 0x00000000, 0x00000000
[ 4898.360997] tg3 0000:04:00.0 enp4s0: 0x00003000: 0x00000006,
0x00000000, 0x00000000, 0x00000520
[ 4898.361001] tg3 0000:04:00.0 enp4s0: 0x00003600: 0x00034400,
0x00130000, 0x00110000, 0x00000000
[ 4898.361004] tg3 0000:04:00.0 enp4s0: 0x00003610: 0x00131100,
0x00130000, 0x00130000, 0x00000000
[ 4898.361008] tg3 0000:04:00.0 enp4s0: 0x00003620: 0x80110011,
0x00000000, 0x00000004, 0x3c822080
[ 4898.361011] tg3 0000:04:00.0 enp4s0: 0x00003630: 0x00000000,
0x80008000, 0x00001080, 0x00000000
[ 4898.361014] tg3 0000:04:00.0 enp4s0: 0x00003640: 0x0000000a,
0x33f00003, 0x00000020, 0x00000019
[ 4898.361018] tg3 0000:04:00.0 enp4s0: 0x00003650: 0x00000171,
0x00000bff, 0x05762100, 0x00000000
[ 4898.361022] tg3 0000:04:00.0 enp4s0: 0x00003660: 0x00000000,
0x00000000, 0x000400a3, 0x00000202
[ 4898.361025] tg3 0000:04:00.0 enp4s0: 0x00003670: 0x0000002a,
0xfeffff63, 0x0000000a, 0x00000000
[ 4898.361029] tg3 0000:04:00.0 enp4s0: 0x000036b0: 0x001003cc,
0x07ff07ff, 0x07ff07ff, 0x01000004
[ 4898.361033] tg3 0000:04:00.0 enp4s0: 0x000036c0: 0xffffffff,
0x0000f6e4, 0x01146c67, 0x0000f8d2
[ 4898.361035] tg3 0000:04:00.0 enp4s0: 0x000036d0: 0x0000019d,
0x00000000, 0x00000000, 0x00000000
[ 4898.361039] tg3 0000:04:00.0 enp4s0: 0x000036e0: 0x80000b19,
0xa0800799, 0x00500799, 0x00000000
[ 4898.361042] tg3 0000:04:00.0 enp4s0: 0x000036f0: 0x19090900,
0x13180600, 0x00000301, 0x00000001
[ 4898.361045] tg3 0000:04:00.0 enp4s0: 0x00003700: 0x00000000,
0x00000000, 0x00000000, 0x00001388
[ 4898.361049] tg3 0000:04:00.0 enp4s0: 0x00003710: 0x87fffffd,
0x00000000, 0x00000000, 0x000010dc
[ 4898.361052] tg3 0000:04:00.0 enp4s0: 0x00003720: 0x00000000,
0x00002040, 0x88006000, 0xa0002000
[ 4898.361055] tg3 0000:04:00.0 enp4s0: 0x00003750: 0x00000000,
0x00000000, 0x00000a0b, 0x00000000
[ 4898.361059] tg3 0000:04:00.0 enp4s0: 0x00003780: 0x0000bff9,
0x00000000, 0x00000000, 0x00000000
[ 4898.361063] tg3 0000:04:00.0 enp4s0: 0x00003c00: 0x00000306,
0x00000000, 0x00000000, 0x00000048
[ 4898.361066] tg3 0000:04:00.0 enp4s0: 0x00003c10: 0x00000000,
0x00000035, 0x00000000, 0x00000000
[ 4898.361070] tg3 0000:04:00.0 enp4s0: 0x00003c20: 0x00000000,
0x00000005, 0x00000000, 0x00000000
[ 4898.361073] tg3 0000:04:00.0 enp4s0: 0x00003c30: 0x00000000,
0x00000000, 0x00000000, 0xffffc000
[ 4898.361077] tg3 0000:04:00.0 enp4s0: 0x00003c40: 0x00000000,
0x00000b00, 0x00000000, 0x00000000
[ 4898.361080] tg3 0000:04:00.0 enp4s0: 0x00003c50: 0x00000000,
0x000004a0, 0x00000000, 0x00000000
[ 4898.361084] tg3 0000:04:00.0 enp4s0: 0x00003c80: 0x000004a0,
0x00000800, 0x00000000, 0x00000000
[ 4898.361087] tg3 0000:04:00.0 enp4s0: 0x00003cc0: 0x00000135,
0x00000000, 0x00000000, 0x00000000
[ 4898.361090] tg3 0000:04:00.0 enp4s0: 0x00003cd0: 0x00000000,
0x0000000f, 0x00000000, 0x00000000
[ 4898.361093] tg3 0000:04:00.0 enp4s0: 0x00003d00: 0x00000000,
0xffffb000, 0x00000000, 0xffffa000
[ 4898.361097] tg3 0000:04:00.0 enp4s0: 0x00003d80: 0x00000014,
0x00000000, 0x00000005, 0x00000000
[ 4898.361100] tg3 0000:04:00.0 enp4s0: 0x00003d90: 0x00000005,
0x00000000, 0x00000014, 0x00000000
[ 4898.361104] tg3 0000:04:00.0 enp4s0: 0x00003da0: 0x00000005,
0x00000000, 0x00000005, 0x00000000
[ 4898.361108] tg3 0000:04:00.0 enp4s0: 0x00004000: 0x00000002,
0x00000000, 0x00000000, 0x00000000
[ 4898.361111] tg3 0000:04:00.0 enp4s0: 0x00004010: 0x00000000,
0x002f1012, 0x008004f0, 0x01006a22
[ 4898.361115] tg3 0000:04:00.0 enp4s0: 0x00004020: 0x00000000,
0x00000010, 0x00000010, 0x00000050
[ 4898.361118] tg3 0000:04:00.0 enp4s0: 0x00004030: 0x00000000,
0x01086820, 0x00304010, 0x00000002
[ 4898.361122] tg3 0000:04:00.0 enp4s0: 0x00004040: 0x00400000,
0x00000000, 0x00000010, 0x00407062
[ 4898.361126] tg3 0000:04:00.0 enp4s0: 0x00004400: 0x00000016,
0x00000000, 0x00010000, 0x0000a000
[ 4898.361129] tg3 0000:04:00.0 enp4s0: 0x00004410: 0x00000000,
0x0000002a, 0x000000a0, 0x00000000
[ 4898.361133] tg3 0000:04:00.0 enp4s0: 0x00004420: 0x000000fd,
0x00000000, 0x00000000, 0x00000000
[ 4898.361136] tg3 0000:04:00.0 enp4s0: 0x00004440: 0x00000000,
0x00000000, 0x00000000, 0x0070200a
[ 4898.361140] tg3 0000:04:00.0 enp4s0: 0x00004450: 0x025c0212,
0x010500f3, 0x00000000, 0x00000000
[ 4898.361144] tg3 0000:04:00.0 enp4s0: 0x00004700: 0x00030002,
0x00100000, 0x00100010, 0x4ca10000
[ 4898.361147] tg3 0000:04:00.0 enp4s0: 0x00004710: 0xfffff320,
0x00065494, 0x00100012, 0x00000000
[ 4898.361150] tg3 0000:04:00.0 enp4s0: 0x00004720: 0x00000000,
0x00000000, 0xf02c0000, 0xfffff350
[ 4898.361154] tg3 0000:04:00.0 enp4s0: 0x00004770: 0x000c0404,
0x00000002, 0x00000010, 0x00000000
[ 4898.361157] tg3 0000:04:00.0 enp4s0: 0x00004800: 0x380303fe,
0x00000000, 0x00000000, 0x00000100
[ 4898.361160] tg3 0000:04:00.0 enp4s0: 0x00004810: 0x00000000,
0x00000008, 0x00429f80, 0x00008000
[ 4898.361164] tg3 0000:04:00.0 enp4s0: 0x00004820: 0x000000dd,
0x00000000, 0x00000000, 0x00000000
[ 4898.361167] tg3 0000:04:00.0 enp4s0: 0x00004860: 0x000000dd,
0x110f7076, 0x001ff800, 0x52000008
[ 4898.361171] tg3 0000:04:00.0 enp4s0: 0x00004870: 0x05ea0080,
0x003e1820, 0x003e1820, 0x00000000
[ 4898.361174] tg3 0000:04:00.0 enp4s0: 0x00004890: 0x280c0c04,
0x00305400, 0x00000000, 0x00000000
[ 4898.361177] tg3 0000:04:00.0 enp4s0: 0x000048a0: 0x000f0010,
0x00000000, 0x00000000, 0x00000000
[ 4898.361180] tg3 0000:04:00.0 enp4s0: 0x00004900: 0x18030002,
0x00000003, 0x30000000, 0x00000120
[ 4898.361183] tg3 0000:04:00.0 enp4s0: 0x00004910: 0x00000040,
0x00000003, 0x0000df94, 0x00000008
[ 4898.361186] tg3 0000:04:00.0 enp4s0: 0x00004920: 0x00000009,
0x02038000, 0xffbd3e01, 0x0f000058
[ 4898.361188] tg3 0000:04:00.0 enp4s0: 0x00004930: 0xfff22a01,
0x0f000058, 0xffdb5601, 0x0f000058
[ 4898.361191] tg3 0000:04:00.0 enp4s0: 0x00004940: 0xffcd1e01,
0x0f000058, 0x8a8aabab, 0x2b2ba0a0
[ 4898.361194] tg3 0000:04:00.0 enp4s0: 0x00004950: 0xf0330000,
0xffbd3e58, 0xaf000000, 0x09070008
[ 4898.361196] tg3 0000:04:00.0 enp4s0: 0x00004960: 0x00000000,
0xfff22a58, 0xaf000000, 0x40000135
[ 4898.361199] tg3 0000:04:00.0 enp4s0: 0x00004970: 0x00028202,
0x00205400, 0x0000001c, 0x000000ff
[ 4898.361201] tg3 0000:04:00.0 enp4s0: 0x00004980: 0x00000009,
0x00000000, 0x00000000, 0x00000000
[ 4898.361204] tg3 0000:04:00.0 enp4s0: 0x00004990: 0x00000000,
0x00000000, 0xffdb5658, 0xaf000000
[ 4898.361207] tg3 0000:04:00.0 enp4s0: 0x000049a0: 0x00f0006d,
0x00000009, 0x00000000, 0x00000000
[ 4898.361209] tg3 0000:04:00.0 enp4s0: 0x000049b0: 0xffc13001,
0xffe4d401, 0xff9dbc01, 0xffcb3001
[ 4898.361212] tg3 0000:04:00.0 enp4s0: 0x000049c0: 0xffbd3e02,
0xfff22a02, 0xffdb5602, 0xffcd1e02
[ 4898.361214] tg3 0000:04:00.0 enp4s0: 0x000049d0: 0xffc13002,
0xffe4d402, 0xff9dbc02, 0xffcb3002
[ 4898.361217] tg3 0000:04:00.0 enp4s0: 0x000049f0: 0xf0330000,
0xffcd1e58, 0xaf000000, 0x0000ffff
[ 4898.361220] tg3 0000:04:00.0 enp4s0: 0x00004c00: 0x200003fe,
0x00000020, 0x00000000, 0x00000000
[ 4898.361222] tg3 0000:04:00.0 enp4s0: 0x00004c10: 0x00000000,
0x00000000, 0x00000006, 0x00000000
[ 4898.361225] tg3 0000:04:00.0 enp4s0: 0x00004c20: 0x00000000,
0x00000000, 0x00000000, 0x00000006
[ 4898.361227] tg3 0000:04:00.0 enp4s0: 0x00004c30: 0x00000000,
0x00128000, 0x00000056, 0x00000056
[ 4898.361230] tg3 0000:04:00.0 enp4s0: 0x00004c40: 0x00000000,
0x08000000, 0x00000000, 0x07ff049f
[ 4898.361233] tg3 0000:04:00.0 enp4s0: 0x00004c50: 0x0fff0fff,
0x04a00fff, 0x40000000, 0x55202121
[ 4898.361235] tg3 0000:04:00.0 enp4s0: 0x00004c60: 0x00000020,
0x00000000, 0x00000000, 0x00000000
[ 4898.361238] tg3 0000:04:00.0 enp4s0: 0x00005000: 0x00009800,
0x80004000, 0x00000000, 0x00000000
[ 4898.361240] tg3 0000:04:00.0 enp4s0: 0x00005010: 0x00000000,
0x00000000, 0x00000000, 0x08001ce4
[ 4898.361243] tg3 0000:04:00.0 enp4s0: 0x00005020: 0x3c020018,
0x00000000, 0x00000000, 0x40000020
[ 4898.361246] tg3 0000:04:00.0 enp4s0: 0x00005030: 0x00000000,
0x00000025, 0x00000000, 0x00000000
[ 4898.361249] tg3 0000:04:00.0 enp4s0: 0x00005040: 0x00000000,
0x00000000, 0x08001000, 0x00000000
[ 4898.361251] tg3 0000:04:00.0 enp4s0: 0x00005080: 0x00009800,
0x80004000, 0x00000000, 0x00000000
[ 4898.361254] tg3 0000:04:00.0 enp4s0: 0x00005090: 0x00000000,
0x00000000, 0x00000000, 0x08001514
[ 4898.361256] tg3 0000:04:00.0 enp4s0: 0x000050a0: 0x8e24362c,
0x00000000, 0x00000000, 0x40000020
[ 4898.361259] tg3 0000:04:00.0 enp4s0: 0x000050b0: 0x00000000,
0x00000025, 0x00000000, 0x00000000
[ 4898.361262] tg3 0000:04:00.0 enp4s0: 0x000050c0: 0x00000000,
0x00000000, 0x08001000, 0x00000000
[ 4898.361264] tg3 0000:04:00.0 enp4s0: 0x00005100: 0x00009800,
0x80004000, 0x00000000, 0x00000000
[ 4898.361267] tg3 0000:04:00.0 enp4s0: 0x00005110: 0x00000000,
0x00000000, 0x00000000, 0x08001510
[ 4898.361269] tg3 0000:04:00.0 enp4s0: 0x00005120: 0x3c020018,
0x00000000, 0x00000000, 0x40000020
[ 4898.361272] tg3 0000:04:00.0 enp4s0: 0x00005130: 0x00000000,
0x00000025, 0x00000000, 0x00000000
[ 4898.361275] tg3 0000:04:00.0 enp4s0: 0x00005140: 0x00000000,
0x00000000, 0x08000f2e, 0x00000000
[ 4898.361277] tg3 0000:04:00.0 enp4s0: 0x00005180: 0x00009800,
0x80004000, 0x00000000, 0x00000000
[ 4898.361280] tg3 0000:04:00.0 enp4s0: 0x00005190: 0x00000000,
0x00000000, 0x00000000, 0x08001cac
[ 4898.361282] tg3 0000:04:00.0 enp4s0: 0x000051a0: 0x14400013,
0x00000000, 0x00000000, 0x40000020
[ 4898.361285] tg3 0000:04:00.0 enp4s0: 0x000051b0: 0x00000000,
0x00000025, 0x00000000, 0x00000000
[ 4898.361287] tg3 0000:04:00.0 enp4s0: 0x000051c0: 0x00000000,
0x00000000, 0x08001000, 0x00000000
[ 4898.361290] tg3 0000:04:00.0 enp4s0: 0x00005200: 0x21100010,
0x00000000, 0x00010000, 0x1460008e
[ 4898.361293] tg3 0000:04:00.0 enp4s0: 0x00005210: 0x03608821,
0x14400016, 0x14830018, 0x00000b50
[ 4898.361296] tg3 0000:04:00.0 enp4s0: 0x00005220: 0x00000000,
0x3c038000, 0x000400a3, 0x03608821
[ 4898.361300] tg3 0000:04:00.0 enp4s0: 0x00005230: 0x14400016,
0x14830018, 0x08007f58, 0x08000e24
[ 4898.361302] tg3 0000:04:00.0 enp4s0: 0x00005240: 0x3c038000,
0x00000000, 0x08007f60, 0x08007f60
[ 4898.361305] tg3 0000:04:00.0 enp4s0: 0x00005250: 0xc0000000,
0x21100010, 0x00000000, 0x08000000
[ 4898.361308] tg3 0000:04:00.0 enp4s0: 0x00005260: 0x00000000,
0xdead1000, 0x00000000, 0xc0010000
[ 4898.361310] tg3 0000:04:00.0 enp4s0: 0x00005270: 0x00000000,
0x00000000, 0x08000000, 0x00000000
[ 4898.361312] tg3 0000:04:00.0 enp4s0: 0x00005280: 0x00009800,
0x80004000, 0x00000000, 0x00000000
[ 4898.361315] tg3 0000:04:00.0 enp4s0: 0x00005290: 0x00000000,
0x00000000, 0x00000000, 0x08001cb0
[ 4898.361317] tg3 0000:04:00.0 enp4s0: 0x000052a0: 0x8fbf001c,
0x00000000, 0x00000000, 0x40000020
[ 4898.361319] tg3 0000:04:00.0 enp4s0: 0x000052b0: 0x00000000,
0x00000025, 0x00000000, 0x00000000
[ 4898.361322] tg3 0000:04:00.0 enp4s0: 0x000052c0: 0x00000000,
0x00000000, 0x08001000, 0x00000000
[ 4898.361324] tg3 0000:04:00.0 enp4s0: 0x00005300: 0x00009800,
0x80004000, 0x00000000, 0x00000000
[ 4898.361327] tg3 0000:04:00.0 enp4s0: 0x00005310: 0x00000000,
0x00000000, 0x00000000, 0x08000f04
[ 4898.361329] tg3 0000:04:00.0 enp4s0: 0x00005320: 0x3c020018,
0x00000000, 0x00000000, 0x40000020
[ 4898.361332] tg3 0000:04:00.0 enp4s0: 0x00005330: 0x00000000,
0x00000025, 0x00000000, 0x00000000
[ 4898.361335] tg3 0000:04:00.0 enp4s0: 0x00005340: 0x00000000,
0x00000000, 0x08001000, 0x00000000
[ 4898.361337] tg3 0000:04:00.0 enp4s0: 0x00005380: 0x00009800,
0x80004000, 0x00000000, 0x00000000
[ 4898.361340] tg3 0000:04:00.0 enp4s0: 0x00005390: 0x00000000,
0x00000000, 0x00000000, 0x08001ce4
[ 4898.361343] tg3 0000:04:00.0 enp4s0: 0x000053a0: 0x3c020018,
0x00000000, 0x00000000, 0x40000020
[ 4898.361346] tg3 0000:04:00.0 enp4s0: 0x000053b0: 0x00000000,
0x00000025, 0x00000000, 0x00000000
[ 4898.361348] tg3 0000:04:00.0 enp4s0: 0x000053c0: 0x00000000,
0x00000000, 0x08001000, 0x00000000
[ 4898.361351] tg3 0000:04:00.0 enp4s0: 0x00005800: 0x00000000,
0x21000000, 0x00000000, 0x8c000000
[ 4898.361353] tg3 0000:04:00.0 enp4s0: 0x00005810: 0x00000000,
0x47000000, 0x00000000, 0x00000001
[ 4898.361356] tg3 0000:04:00.0 enp4s0: 0x00005820: 0x00000000,
0x00000001, 0x00000000, 0x00000000
[ 4898.361359] tg3 0000:04:00.0 enp4s0: 0x00005860: 0x00000000,
0x00000000, 0x00000000, 0x00000568
[ 4898.361362] tg3 0000:04:00.0 enp4s0: 0x00005880: 0x00000000,
0x000004a0, 0x00000000, 0x00000800
[ 4898.361365] tg3 0000:04:00.0 enp4s0: 0x00005900: 0x00000000,
0x00000135, 0x00000000, 0x00000000
[ 4898.361368] tg3 0000:04:00.0 enp4s0: 0x00005980: 0x00000135,
0x00000000, 0x00000000, 0x00000000
[ 4898.361370] tg3 0000:04:00.0 enp4s0: 0x00005a00: 0x000f601f,
0x00000000, 0x00010000, 0x00000000
[ 4898.361374] tg3 0000:04:00.0 enp4s0: 0x00006000: 0x20010082,
0x00000000, 0x00000000, 0x00000000
[ 4898.361376] tg3 0000:04:00.0 enp4s0: 0x00006400: 0x00000000,
0x00000000, 0x00010091, 0xc0000000
[ 4898.361379] tg3 0000:04:00.0 enp4s0: 0x00006410: 0x05000016,
0x05000016, 0x00000000, 0x00000000
[ 4898.361383] tg3 0000:04:00.0 enp4s0: 0x00006430: 0x00000000,
0x14e41687, 0x2215103c, 0x10020000
[ 4898.361386] tg3 0000:04:00.0 enp4s0: 0x00006440: 0x0000304f,
0x000002e4, 0x00000000, 0x00000080
[ 4898.361389] tg3 0000:04:00.0 enp4s0: 0x000064c0: 0x00000005,
0x00000004, 0x00000122, 0x00000000
[ 4898.361392] tg3 0000:04:00.0 enp4s0: 0x000064d0: 0x00000040,
0x10008d82, 0x00000000, 0x00d75e12
[ 4898.361394] tg3 0000:04:00.0 enp4s0: 0x000064e0: 0x00000031,
0x0008001f, 0x00000000, 0x00000000
[ 4898.361397] tg3 0000:04:00.0 enp4s0: 0x000064f0: 0x00000002,
0x00000031, 0x00000000, 0x00000000
[ 4898.361400] tg3 0000:04:00.0 enp4s0: 0x00006500: 0x03e10003,
0xd45792bf, 0x00008cdc, 0x00000003
[ 4898.361403] tg3 0000:04:00.0 enp4s0: 0x00006510: 0x00078116,
0x0005810b, 0x00046105, 0x00000000
[ 4898.361405] tg3 0000:04:00.0 enp4s0: 0x00006530: 0x00000001,
0x00000000, 0x00000000, 0x00000000
[ 4898.361408] tg3 0000:04:00.0 enp4s0: 0x00006540: 0x0028081f,
0x0001001e, 0x00000000, 0x00000000
[ 4898.361410] tg3 0000:04:00.0 enp4s0: 0x00006550: 0x00000001,
0x02800000, 0x0000000f, 0x00000000
[ 4898.361413] tg3 0000:04:00.0 enp4s0: 0x00006560: 0x0000000f,
0x00000000, 0x00000000, 0x00000000
[ 4898.361416] tg3 0000:04:00.0 enp4s0: 0x000065f0: 0x00000000,
0x00000059, 0x00000000, 0x00000000
[ 4898.361418] tg3 0000:04:00.0 enp4s0: 0x00006800: 0x141b0034,
0x20081082, 0x00029118, 0x22a51439
[ 4898.361421] tg3 0000:04:00.0 enp4s0: 0x00006810: 0x21100010,
0xffffffff, 0x00000000, 0x000000f0
[ 4898.361423] tg3 0000:04:00.0 enp4s0: 0x00006880: 0x77fff020,
0x00000040, 0x00801687, 0x00000000
[ 4898.361426] tg3 0000:04:00.0 enp4s0: 0x00006890: 0x00800000,
0x00000000, 0x00000000, 0x00000000
[ 4898.361428] tg3 0000:04:00.0 enp4s0: 0x000068a0: 0x00000000,
0x00010001, 0x00000000, 0x00000000
[ 4898.361431] tg3 0000:04:00.0 enp4s0: 0x000068b0: 0x00040000,
0x00000000, 0x00000000, 0x00000000
[ 4898.361434] tg3 0000:04:00.0 enp4s0: 0x000068c0: 0x00000044,
0x00000000, 0x00000000, 0x00000000
[ 4898.361437] tg3 0000:04:00.0 enp4s0: 0x000068f0: 0x00000000,
0x00000000, 0x00000000, 0x04444444
[ 4898.361440] tg3 0000:04:00.0 enp4s0: 0x00006900: 0x24a47cb0,
0x14bde8e1, 0x00000000, 0x00000000
[ 4898.361444] tg3 0000:04:00.0 enp4s0: 0x00006920: 0x00000000,
0x00000000, 0x00000001, 0x00000000
[ 4898.361448] tg3 0000:04:00.0 enp4s0: 0x00006c00: 0x168714e4,
0x00100506, 0x02000010, 0x00000010
[ 4898.361450] tg3 0000:04:00.0 enp4s0: 0x00006c10: 0xe212000c,
0x00000000, 0xe211000c, 0x00000000
[ 4898.361453] tg3 0000:04:00.0 enp4s0: 0x00006c20: 0xe210000c,
0x00000000, 0x00000000, 0x2215103c
[ 4898.361456] tg3 0000:04:00.0 enp4s0: 0x00006c30: 0x00000000,
0x00000048, 0x00000000, 0x0000010a
[ 4898.361459] tg3 0000:04:00.0 enp4s0: 0x00006c40: 0x00000000,
0x00000000, 0xc8035001, 0x16002008
[ 4898.361462] tg3 0000:04:00.0 enp4s0: 0x00006c50: 0x00005803,
0x00000000, 0x0086a005, 0x00000000
[ 4898.361465] tg3 0000:04:00.0 enp4s0: 0x00006c60: 0x00000000,
0x00000000, 0xf1000298, 0x01f802d1
[ 4898.361467] tg3 0000:04:00.0 enp4s0: 0x00006c70: 0x00071010,
0xf7001900, 0x00000000, 0x00000000
[ 4898.361471] tg3 0000:04:00.0 enp4s0: 0x00006ca0: 0x8005ac11,
0x00000004, 0x00000122, 0x00020010
[ 4898.361474] tg3 0000:04:00.0 enp4s0: 0x00006cb0: 0x10008d82,
0x00105400, 0x00475c12, 0x10120043
[ 4898.361477] tg3 0000:04:00.0 enp4s0: 0x00006cd0: 0x0008081f,
0x00000000, 0x00000000, 0x00010001
[ 4898.361480] tg3 0000:04:00.0 enp4s0: 0x00006cf0: 0x00000000,
0x05762100, 0x00000000, 0x00000000
[ 4898.361483] tg3 0000:04:00.0 enp4s0: 0x00006d00: 0x13c10001,
0x00000000, 0x00000000, 0x00062030
[ 4898.361486] tg3 0000:04:00.0 enp4s0: 0x00006d10: 0x00000000,
0x00002000, 0x000000a0, 0x00000000
[ 4898.361489] tg3 0000:04:00.0 enp4s0: 0x00006d30: 0x00000000,
0x00000000, 0x00000000, 0x15010003
[ 4898.361492] tg3 0000:04:00.0 enp4s0: 0x00006d40: 0xd45792bf,
0x00008cdc, 0x00000000, 0x00000000
[ 4898.361495] tg3 0000:04:00.0 enp4s0: 0x00006d50: 0x16010004,
0x00000000, 0x00078116, 0x00000001
[ 4898.361498] tg3 0000:04:00.0 enp4s0: 0x00006d60: 0x1b010002,
0x00000000, 0x00000000, 0x00000000
[ 4898.361500] tg3 0000:04:00.0 enp4s0: 0x00006d70: 0x00000000,
0x80000001, 0x00000000, 0x00000000
[ 4898.361503] tg3 0000:04:00.0 enp4s0: 0x00006db0: 0x23010018,
0x00000000, 0x00000000, 0x00000000
[ 4898.361507] tg3 0000:04:00.0 enp4s0: 0x00006e30: 0x00010017,
0x00050403, 0x00000000, 0x00000000
[ 4898.361510] tg3 0000:04:00.0 enp4s0: 0x00007000: 0x08000008,
0x00000000, 0x00000000, 0x000038d4
[ 4898.361513] tg3 0000:04:00.0 enp4s0: 0x00007010: 0x9928504d,
0x02808083, 0x800500db, 0x03000a00
[ 4898.361515] tg3 0000:04:00.0 enp4s0: 0x00007020: 0x00000000,
0x00000008, 0x00000406, 0x10004000
[ 4898.361518] tg3 0000:04:00.0 enp4s0: 0x00007030: 0x000e0000,
0x000038d8, 0x00230030, 0x80000000
[ 4898.361522] tg3 0000:04:00.0 enp4s0: 0x00007500: 0x00000000,
0x00000000, 0x00000081, 0x00000000
[ 4898.361524] tg3 0000:04:00.0 enp4s0: 0x00007510: 0x00000000,
0xffffdfff, 0x00000000, 0x00000000
[ 4898.361530] tg3 0000:04:00.0 enp4s0: 0: Host status block
[00000001:00000021:(0000:0486:0000):(0000:002c)]
[ 4898.361535] tg3 0000:04:00.0 enp4s0: 0: NAPI info
[00000021:00000021:(0135:002c:01ff):0000:(0568:0000:0000:0000)]
[ 4898.361538] tg3 0000:04:00.0 enp4s0: 1: Host status block
[00000001:0000008c:(0000:0000:0000):(04a0:0000)]
[ 4898.361542] tg3 0000:04:00.0 enp4s0: 1: NAPI info
[0000008c:0000008c:(0000:0000:01ff):04a0:(04a0:04a0:0000:0000)]
[ 4898.361546] tg3 0000:04:00.0 enp4s0: 2: Host status block
[00000001:00000047:(0800:0000:0000):(0000:0000)]
[ 4898.361549] tg3 0000:04:00.0 enp4s0: 2: NAPI info
[00000047:00000047:(0000:0000:01ff):0800:(0000:0000:0000:0000)]
[ 4898.405074] tg3 0000:04:00.0 enp4s0: Link is down
[ 4902.158317] tg3 0000:04:00.0 enp4s0: Link is up at 1000 Mbps, full duplex
[ 4902.158335] tg3 0000:04:00.0 enp4s0: Flow control is on for TX and on for RX
[ 4902.158338] tg3 0000:04:00.0 enp4s0: EEE is enabled
On Fri, May 12, 2017 at 3:53 AM, Siva Reddy Kallam
<siva.kallam@broadcom.com> wrote:
> On Fri, May 12, 2017 at 9:39 AM, Siva Reddy Kallam
> <siva.kallam@broadcom.com> wrote:
>> On Thu, May 11, 2017 at 8:55 PM, Daniel Kim <dkim@playmechanix.com> wrote:
>>> Summary:
>>> Broadcom BCM5762 Ethernet tg3 times out with stack trace
>>>
>>> Description:
>>> The ethernet device will disconnect with dmesg reporting a stack trace
>>> and a time out (visible in DMesg Output below). The ethernet device
>>> will periodically reconnect and disconnect and the driver will output
>>> a lot of hex values into logs.
>>>
>>> The computer doesn't have to have network activity in order to trigger
>>> this to happen, but I believe it can trigger faster if there was. It
>>> usually occurs as soon as a few minutes after bootup to upwards of a
>>> few hours in my test cases.
>>>
>>> Kernel version:
>>> Linux version 4.11.0-041100-generic (kernel@tangerine) (gcc version
>>> 6.3.0 20170415 (Ubuntu 6.3.0-14ubuntu3) ) #201705041534 SMP Thu May 4
>>> 19:36:05 UTC 2017
>>>
>>> Full DMesg Output:
>>> https://launchpadlibrarian.net/319135862/error_dmesg.txt
>>> Bug has been reported with additional information at:
>>> https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1689383
>>>
>>> Please let me know if there is other data or logs that you may need.
>>>
>> Thank you for reporting this. We will look into the logs and contact
>> you directly if we need any other data.
> As a first impression, we are suspecting TSO packet is causing TX timeout.
> Can you please disable TSO and check if TX timeout still happens or not?
> Please let us know your findings.
> We are trying to reproduce locally. If we couldn't, we will send a
> debug patch to collect more data.
>>>
>>> Cut DMesg Output:
>>> [ 6244.283996] ------------[ cut here ]------------
>>> [ 6244.284051] WARNING: CPU: 0 PID: 0 at
>>> /home/kernel/COD/linux/net/sched/sch_generic.c:316
>>> dev_watchdog+0x22c/0x230
>>> [ 6244.284058] NETDEV WATCHDOG: enp4s0 (tg3): transmit queue 0 timed out
>>> [ 6244.284064] Modules linked in: snd_hda_codec_hdmi hp_wmi
>>> snd_hda_codec_realtek snd_hda_codec_generic sparse_keymap
>>> snd_hda_intel snd_hda_codec edac_mce_amd edac_core crct10dif_pclmul
>>> crc32_pclmul snd_hda_core snd_hwdep ghash_clmulni_intel pcbc joydev
>>> input_leds snd_pcm aesni_intel aes_x86_64 snd_seq_midi
>>> snd_seq_midi_event snd_rawmidi crypto_simd snd_seq snd_seq_device
>>> snd_timer glue_helper snd cryptd soundcore serio_raw k10temp shpchp
>>> i2c_piix4 mac_hid tpm_infineon wmi parport_pc ppdev lp parport autofs4
>>> hid_generic usbhid hid psmouse tg3 ptp pps_core ahci libahci video
>>> [ 6244.284129] CPU: 0 PID: 0 Comm: swapper/0 Not tainted
>>> 4.11.0-041100-generic #201705041534
>>> [ 6244.284131] Hardware name: Hewlett-Packard HP EliteDesk 705 G1
>>> MT/2215, BIOS L06 v02.17 12/11/2014
>>> [ 6244.284132] Call Trace:
>>> [ 6244.284135] <IRQ>
>>> [ 6244.284141] dump_stack+0x63/0x81
>>> [ 6244.284143] __warn+0xcb/0xf0
>>> [ 6244.284146] warn_slowpath_fmt+0x5a/0x80
>>> [ 6244.284149] ? cpu_load_update+0xdd/0x150
>>> [ 6244.284155] dev_watchdog+0x22c/0x230
>>> [ 6244.284159] ? qdisc_rcu_free+0x50/0x50
>>> [ 6244.284162] call_timer_fn+0x35/0x140
>>> [ 6244.284165] run_timer_softirq+0x1db/0x440
>>> [ 6244.284168] ? ktime_get+0x41/0xb0
>>> [ 6244.284172] ? lapic_next_event+0x1d/0x30
>>> [ 6244.284175] ? clockevents_program_event+0x7f/0x120
>>> [ 6244.284179] __do_softirq+0x104/0x2af
>>> [ 6244.284183] irq_exit+0xb6/0xc0
>>> [ 6244.284187] smp_apic_timer_interrupt+0x3d/0x50
>>> [ 6244.284190] apic_timer_interrupt+0x89/0x90
>>> [ 6244.284193] RIP: 0010:cpuidle_enter_state+0x122/0x2c0
>>> [ 6244.284195] RSP: 0018:ffffffff86203dc8 EFLAGS: 00000246 ORIG_RAX:
>>> ffffffffffffff10
>>> [ 6244.284198] RAX: 0000000000000000 RBX: 0000000000000002 RCX: 000000000000001f
>>> [ 6244.284200] RDX: 000005addc53de33 RSI: ffffa01a2ec189d8 RDI: 0000000000000000
>>> [ 6244.284202] RBP: ffffffff86203e08 R08: 000000000000cd01 R09: 0000000000000018
>>> [ 6244.284203] R10: ffffffff86203d98 R11: 0000000000000ef9 R12: ffffa01a1d6ab200
>>> [ 6244.284205] R13: ffffffff862f92d8 R14: 0000000000000002 R15: ffffffff862f92c0
>>> [ 6244.284207] </IRQ>
>>> [ 6244.284211] ? cpuidle_enter_state+0x110/0x2c0
>>> [ 6244.284213] cpuidle_enter+0x17/0x20
>>> [ 6244.284218] call_cpuidle+0x23/0x40
>>> [ 6244.284221] do_idle+0x189/0x200
>>> [ 6244.284224] cpu_startup_entry+0x71/0x80
>>> [ 6244.284227] rest_init+0x77/0x80
>>> [ 6244.284230] start_kernel+0x455/0x476
>>> [ 6244.284235] ? early_idt_handler_array+0x120/0x120
>>> [ 6244.284239] x86_64_start_reservations+0x24/0x26
>>> [ 6244.284243] x86_64_start_kernel+0x14d/0x170
>>> [ 6244.284246] start_cpu+0x14/0x14
>>> [ 6244.284251] ---[ end trace b14ec0a8b1e2a4e8 ]---
>>> [ 6244.284259] tg3 0000:04:00.0 enp4s0: transmit timed out, resetting
>>> [ 6244.398892] hrtimer: interrupt took 65509334 ns
>>> [ 6247.090588] tg3 0000:04:00.0 enp4s0: 0x00000000: 0x168714e4,
>>> 0x00100506, 0x02000010, 0x00000010
>>> [ 6247.090601] tg3 0000:04:00.0 enp4s0: 0x00000010: 0xe212000c,
>>> 0x00000000, 0xe211000c, 0x00000000
>>> [ 6247.090607] tg3 0000:04:00.0 enp4s0: 0x00000020: 0xe210000c,
>>> 0x00000000, 0x00000000, 0x2215103c
>>> [ 6247.090610] tg3 0000:04:00.0 enp4s0: 0x00000030: 0x00000000,
>>> 0x00000048, 0x00000000, 0x0000010a
>>> [ 6247.090613] tg3 0000:04:00.0 enp4s0: 0x00000040: 0x00000000,
>>> 0x39000000, 0xc8035001, 0x16002008
>>> [ 6247.090617] tg3 0000:04:00.0 enp4s0: 0x00000050: 0x00005803,
>>> 0x00000000, 0x0086a005, 0x00000000
>>> [ 6247.090622] tg3 0000:04:00.0 enp4s0: 0x00000060: 0x00000000,
>>> 0x00000000, 0xf1000298, 0x01f802d1
>>> [ 6247.090625] tg3 0000:04:00.0 enp4s0: 0x00000070: 0x00071010,
>>> 0xf6001500, 0x00000000, 0x00000000
>>> [ 6247.090628] tg3 0000:04:00.0 enp4s0: 0x00000080: 0x168714e4,
>>> 0x00000018, 0x00000000, 0x00000800
>>> [ 6247.090632] tg3 0000:04:00.0 enp4s0: 0x00000090: 0x00000000,
>>> 0x00000171, 0x00000000, 0x0000021d
>>> [ 6247.090636] tg3 0000:04:00.0 enp4s0: 0x000000a0: 0x8005ac11,
>>> 0x00000004, 0x00000122, 0x00020010
>>> [ 6247.090639] tg3 0000:04:00.0 enp4s0: 0x000000b0: 0x10008d82,
>>> 0x00115400, 0x00475c12, 0x10120043
>>> [ 6247.090643] tg3 0000:04:00.0 enp4s0: 0x000000d0: 0x0008081f,
>>> 0x00000000, 0x00000000, 0x00010001
>>> [ 6247.090649] tg3 0000:04:00.0 enp4s0: 0x000000f0: 0x00000000,
>>> 0x05762100, 0x00000000, 0xffffffff
>>> [ 6247.090652] tg3 0000:04:00.0 enp4s0: 0x00000100: 0x13c10001,
>>> 0x00000000, 0x00000000, 0x00062030
>>> [ 6247.090654] tg3 0000:04:00.0 enp4s0: 0x00000110: 0x00001000,
>>> 0x00002000, 0x000000a0, 0x00000000
>>> [ 6247.090658] tg3 0000:04:00.0 enp4s0: 0x00000130: 0x00000000,
>>> 0x00000000, 0x00000000, 0x15010003
>>> [ 6247.090660] tg3 0000:04:00.0 enp4s0: 0x00000140: 0xd45792bf,
>>> 0x00008cdc, 0x00000000, 0x00000000
>>> [ 6247.090663] tg3 0000:04:00.0 enp4s0: 0x00000150: 0x16010004,
>>> 0x00000000, 0x00078116, 0x00000001
>>> [ 6247.090666] tg3 0000:04:00.0 enp4s0: 0x00000160: 0x1b010002,
>>> 0x00000000, 0x00000000, 0x00000000
>>> [ 6247.090669] tg3 0000:04:00.0 enp4s0: 0x00000170: 0x00000000,
>>> 0x80000001, 0x00000000, 0x00000000
>>> [ 6247.090672] tg3 0000:04:00.0 enp4s0: 0x000001b0: 0x23010018,
>>> 0x00000000, 0x00000000, 0x00000000
>>> [ 6247.090676] tg3 0000:04:00.0 enp4s0: 0x00000200: 0x00000000,
>>> 0x39000000, 0x00000000, 0xc3000000
>>> [ 6247.090679] tg3 0000:04:00.0 enp4s0: 0x00000210: 0x00000000,
>>> 0x51000000, 0x00000000, 0x00000001
>>> [ 6247.090682] tg3 0000:04:00.0 enp4s0: 0x00000220: 0x00000000,
>>> 0x00000001, 0x00000000, 0x00000000
>>> [ 6247.090685] tg3 0000:04:00.0 enp4s0: 0x00000260: 0x00000000,
>>> 0x00000000, 0x00000000, 0x0000021d
>>> [ 6247.090689] tg3 0000:04:00.0 enp4s0: 0x00000280: 0x00000000,
>>> 0x00000800, 0x00000000, 0x00000955
>>> [ 6247.090692] tg3 0000:04:00.0 enp4s0: 0x00000300: 0x00000000,
>>> 0x00000171, 0x00000000, 0x00000171
>>> [ 6247.090695] tg3 0000:04:00.0 enp4s0: 0x00000310: 0x00000000,
>>> 0x00000171, 0x00000000, 0x00000171
>>> [ 6247.090698] tg3 0000:04:00.0 enp4s0: 0x00000320: 0x00000000,
>>> 0x00000171, 0x00000000, 0x00000171
>>> [ 6247.090701] tg3 0000:04:00.0 enp4s0: 0x00000330: 0x00000000,
>>> 0x00000171, 0x00000000, 0x00000171
>>> [ 6247.090704] tg3 0000:04:00.0 enp4s0: 0x00000340: 0x00000000,
>>> 0x00000171, 0x00000000, 0x00000171
>>> [ 6247.090707] tg3 0000:04:00.0 enp4s0: 0x00000350: 0x00000000,
>>> 0x00000171, 0x00000000, 0x00000171
>>> [ 6247.090710] tg3 0000:04:00.0 enp4s0: 0x00000360: 0x00000000,
>>> 0x00000171, 0x00000000, 0x00000171
>>> [ 6247.090713] tg3 0000:04:00.0 enp4s0: 0x00000370: 0x00000000,
>>> 0x00000171, 0x00000000, 0x00000171
>>> [ 6247.090716] tg3 0000:04:00.0 enp4s0: 0x00000380: 0x00000000,
>>> 0x00000171, 0x00000000, 0x00000171
>>> [ 6247.090718] tg3 0000:04:00.0 enp4s0: 0x00000390: 0x00000000,
>>> 0x00000171, 0x00000000, 0x00000171
>>> [ 6247.090721] tg3 0000:04:00.0 enp4s0: 0x000003a0: 0x00000000,
>>> 0x00000171, 0x00000000, 0x00000171
>>> [ 6247.090724] tg3 0000:04:00.0 enp4s0: 0x000003b0: 0x00000000,
>>> 0x00000171, 0x00000000, 0x00000171
>>> [ 6247.090727] tg3 0000:04:00.0 enp4s0: 0x000003c0: 0x00000000,
>>> 0x00000171, 0x00000000, 0x00000171
>>> [ 6247.090730] tg3 0000:04:00.0 enp4s0: 0x000003d0: 0x00000000,
>>> 0x00000171, 0x00000000, 0x00000171
>>> [ 6247.090733] tg3 0000:04:00.0 enp4s0: 0x000003e0: 0x00000000,
>>> 0x00000171, 0x00000000, 0x00000171
>>> [ 6247.090736] tg3 0000:04:00.0 enp4s0: 0x000003f0: 0x00000000,
>>> 0x00000171, 0x00000000, 0x00000171
>>> [ 6247.090738] tg3 0000:04:00.0 enp4s0: 0x00000400: 0x18e04808,
>>> 0x00400000, 0x00001000, 0x00009b00
>>> [ 6247.090741] tg3 0000:04:00.0 enp4s0: 0x00000410: 0x00008cdc,
>>> 0xd45792bf, 0x00008cdc, 0xd45792bf
>>> [ 6247.090744] tg3 0000:04:00.0 enp4s0: 0x00000420: 0x00008cdc,
>>> 0xd45792bf, 0x00008cdc, 0xd45792bf
>>> [ 6247.090747] tg3 0000:04:00.0 enp4s0: 0x00000430: 0x00000000,
>>> 0x00000000, 0x00000008, 0x000005f2
>>> [ 6247.090750] tg3 0000:04:00.0 enp4s0: 0x00000440: 0x00000000,
>>> 0x00000000, 0x00000000, 0x082e0006
>>> [ 6247.090753] tg3 0000:04:00.0 enp4s0: 0x00000450: 0x00000001,
>>> 0x00008000, 0x00000000, 0x00000112
>>> [ 6247.090756] tg3 0000:04:00.0 enp4s0: 0x00000460: 0x0000000b,
>>> 0x00002620, 0x03ff0006, 0x00000000
>>> [ 6247.090759] tg3 0000:04:00.0 enp4s0: 0x00000470: 0xa0000000,
>>> 0x00000000, 0x00000000, 0x50000001
>>> [ 6247.090762] tg3 0000:04:00.0 enp4s0: 0x00000480: 0x42000000,
>>> 0x7fffffff, 0x06000004, 0x7fffffff
>>> [ 6247.090765] tg3 0000:04:00.0 enp4s0: 0x00000500: 0x00000008,
>>> 0x00000002, 0x00000000, 0x00000000
>>> [ 6247.090768] tg3 0000:04:00.0 enp4s0: 0x00000590: 0x00901001,
>>> 0x00000000, 0x00000000, 0x00000000
>>> [ 6247.090771] tg3 0000:04:00.0 enp4s0: 0x00000600: 0xffffffff,
>>> 0x00f80011, 0x00000000, 0x40001f0c
>>> [ 6247.090774] tg3 0000:04:00.0 enp4s0: 0x00000610: 0xffffffff,
>>> 0x00000000, 0x00000044, 0x00000000
>>> [ 6247.090777] tg3 0000:04:00.0 enp4s0: 0x00000620: 0x00000040,
>>> 0x00000000, 0x00000000, 0x00000000
>>> [ 6247.090780] tg3 0000:04:00.0 enp4s0: 0x00000630: 0x01010101,
>>> 0x01010101, 0x01010101, 0x01010101
>>> [ 6247.090782] tg3 0000:04:00.0 enp4s0: 0x00000640: 0x01010101,
>>> 0x01010101, 0x01010101, 0x01010101
>>> [ 6247.090785] tg3 0000:04:00.0 enp4s0: 0x00000650: 0x01010101,
>>> 0x01010101, 0x01010101, 0x01010101
>>> [ 6247.090788] tg3 0000:04:00.0 enp4s0: 0x00000660: 0x01010101,
>>> 0x01010101, 0x01010101, 0x01010101
>>> [ 6247.090790] tg3 0000:04:00.0 enp4s0: 0x00000670: 0x43cb3b20,
>>> 0x0defd9a3, 0x767fe840, 0x1442a189
>>> [ 6247.090793] tg3 0000:04:00.0 enp4s0: 0x00000680: 0xf210c361,
>>> 0xdb0f8709, 0xee76c0a3, 0x3753b863
>>> [ 6247.090796] tg3 0000:04:00.0 enp4s0: 0x00000690: 0x8c5ffafc,
>>> 0xba4254bd, 0x00000000, 0x00000000
>>> [ 6247.090798] tg3 0000:04:00.0 enp4s0: 0x000006c0: 0x00000000,
>>> 0x00000000, 0x04000000, 0x00000000
>>> [ 6247.090801] tg3 0000:04:00.0 enp4s0: 0x00000800: 0x00000000,
>>> 0xffffffff, 0x00000000, 0x00000000
>>> [ 6247.090804] tg3 0000:04:00.0 enp4s0: 0x00000810: 0x00000000,
>>> 0xffffffff, 0x00000000, 0x00000000
>>> [ 6247.090806] tg3 0000:04:00.0 enp4s0: 0x00000820: 0x00000000,
>>> 0x00000000, 0xffffffff, 0x00000000
>>> [ 6247.090809] tg3 0000:04:00.0 enp4s0: 0x00000830: 0x00000000,
>>> 0xffffffff, 0xffffffff, 0xffffffff
>>> [ 6247.090812] tg3 0000:04:00.0 enp4s0: 0x00000840: 0xffffffff,
>>> 0xffffffff, 0xffffffff, 0xffffffff
>>> [ 6247.090815] tg3 0000:04:00.0 enp4s0: 0x00000850: 0xffffffff,
>>> 0xffffffff, 0xffffffff, 0xffffffff
>>> [ 6247.090817] tg3 0000:04:00.0 enp4s0: 0x00000860: 0xffffffff,
>>> 0xffffffff, 0xffffffff, 0x00000000
>>> [ 6247.090820] tg3 0000:04:00.0 enp4s0: 0x00000880: 0x00000754,
>>> 0x00001633, 0x00000000, 0x00000000
>>> [ 6247.090822] tg3 0000:04:00.0 enp4s0: 0x00000890: 0x00000005,
>>> 0x0000000c, 0x00000000, 0x00000000
>>> [ 6247.090825] tg3 0000:04:00.0 enp4s0: 0x000008f0: 0x007c0001,
>>> 0x00000000, 0x00000000, 0x00000000
>>> [ 6247.090828] tg3 0000:04:00.0 enp4s0: 0x00000900: 0x00095b83,
>>> 0xffffffff, 0x00000000, 0x00000000
>>> [ 6247.090831] tg3 0000:04:00.0 enp4s0: 0x00000910: 0x00000002,
>>> 0xffffffff, 0x00000000, 0x00000000
>>> [ 6247.090834] tg3 0000:04:00.0 enp4s0: 0x00000920: 0x00000000,
>>> 0x00000000, 0xffffffff, 0x00000000
>>> [ 6247.090837] tg3 0000:04:00.0 enp4s0: 0x00000930: 0x00000000,
>>> 0xffffffff, 0xffffffff, 0xffffffff
>>> [ 6247.090840] tg3 0000:04:00.0 enp4s0: 0x00000940: 0xffffffff,
>>> 0xffffffff, 0xffffffff, 0xffffffff
>>> [ 6247.090843] tg3 0000:04:00.0 enp4s0: 0x00000950: 0xffffffff,
>>> 0xffffffff, 0xffffffff, 0xffffffff
>>> [ 6247.090846] tg3 0000:04:00.0 enp4s0: 0x00000960: 0xffffffff,
>>> 0xffffffff, 0xffffffff, 0x000015d7
>>> [ 6247.090849] tg3 0000:04:00.0 enp4s0: 0x00000970: 0x00000036,
>>> 0x00000164, 0x00000000, 0x00000000
>>> [ 6247.090852] tg3 0000:04:00.0 enp4s0: 0x00000980: 0x010a92c7,
>>> 0x00001633, 0x00000000, 0x000015c8
>>> [ 6247.090855] tg3 0000:04:00.0 enp4s0: 0x00000990: 0x0000a81a,
>>> 0x00019e10, 0x00000000, 0x00000000
>>> [ 6247.090858] tg3 0000:04:00.0 enp4s0: 0x00000c00: 0x0000000a,
>>> 0x00000000, 0x00000003, 0x00000001
>>> [ 6247.090861] tg3 0000:04:00.0 enp4s0: 0x00000c10: 0x00000000,
>>> 0x00000000, 0x00000000, 0x00620000
>>> [ 6247.090864] tg3 0000:04:00.0 enp4s0: 0x00000c80: 0x00001771,
>>> 0x00000000, 0x00000000, 0x00000000
>>> [ 6247.090867] tg3 0000:04:00.0 enp4s0: 0x00000ce0: 0xffd07a02,
>>> 0x00000000, 0x00000062, 0x00040028
>>> [ 6247.090870] tg3 0000:04:00.0 enp4s0: 0x00000cf0: 0x00000000,
>>> 0x50000071, 0x00000000, 0x00000000
>>> [ 6247.090873] tg3 0000:04:00.0 enp4s0: 0x00001000: 0x00000002,
>>> 0x00000000, 0xa000e5e6, 0x00000000
>>> [ 6247.090876] tg3 0000:04:00.0 enp4s0: 0x00001010: 0x01711711,
>>> 0x0000e5e6, 0x00000000, 0x00000000
>>> [ 6247.090879] tg3 0000:04:00.0 enp4s0: 0x00001400: 0x00000006,
>>> 0x00000000, 0x00000000, 0x00000001
>>> [ 6247.090881] tg3 0000:04:00.0 enp4s0: 0x00001440: 0x00000171,
>>> 0x00000171, 0x00000171, 0x00000171
>>> [ 6247.090884] tg3 0000:04:00.0 enp4s0: 0x00001450: 0x00000171,
>>> 0x00000171, 0x00000171, 0x00000171
>>> [ 6247.090887] tg3 0000:04:00.0 enp4s0: 0x00001460: 0x00000171,
>>> 0x00000171, 0x00000171, 0x00000171
>>> [ 6247.090890] tg3 0000:04:00.0 enp4s0: 0x00001470: 0x00000171,
>>> 0x00000171, 0x00000171, 0x00000171
>>> [ 6247.090893] tg3 0000:04:00.0 enp4s0: 0x00001800: 0x00000016,
>>> 0x00000000, 0x00000171, 0x00000000
>>> [ 6247.090896] tg3 0000:04:00.0 enp4s0: 0x00001840: 0x00000000,
>>> 0x00000000, 0x00000200, 0x00000010
>>> [ 6247.090899] tg3 0000:04:00.0 enp4s0: 0x00001850: 0x0000001f,
>>> 0x00000000, 0x00004300, 0x01710171
>>> [ 6247.090902] tg3 0000:04:00.0 enp4s0: 0x00001860: 0x01000000,
>>> 0x00000000, 0x00000000, 0x00000000
>>> [ 6247.090904] tg3 0000:04:00.0 enp4s0: 0x00001c00: 0x00000002,
>>> 0x00000000, 0x00000000, 0x00000000
>>> [ 6247.090907] tg3 0000:04:00.0 enp4s0: 0x00002000: 0x00000002,
>>> 0x00000000, 0x00000000, 0x00000000
>>> [ 6247.090910] tg3 0000:04:00.0 enp4s0: 0x00002010: 0x00000181,
>>> 0x00000001, 0x007bfffd, 0x00000000
>>> [ 6247.090913] tg3 0000:04:00.0 enp4s0: 0x00002100: 0x000d62b3,
>>> 0x0008dc6f, 0x0000009e, 0x00000000
>>> [ 6247.090916] tg3 0000:04:00.0 enp4s0: 0x00002110: 0x000d62b3,
>>> 0x0008dc6f, 0x0000009e, 0x00000000
>>> [ 6247.090918] tg3 0000:04:00.0 enp4s0: 0x00002120: 0x000d62b3,
>>> 0x0008dc6f, 0x0000009e, 0x00000000
>>> [ 6247.090921] tg3 0000:04:00.0 enp4s0: 0x00002130: 0x000d62b3,
>>> 0x0008dc6f, 0x0000009e, 0x00000000
>>> [ 6247.090924] tg3 0000:04:00.0 enp4s0: 0x00002140: 0x000d62b3,
>>> 0x0008dc6f, 0x0000009e, 0x00000000
>>> [ 6247.090928] tg3 0000:04:00.0 enp4s0: 0x00002150: 0x000d62b3,
>>> 0x0008dc6f, 0x0000009e, 0x00000000
>>> [ 6247.090931] tg3 0000:04:00.0 enp4s0: 0x00002160: 0x000d62b3,
>>> 0x0008dc6f, 0x0000009e, 0x00000000
>>> [ 6247.090934] tg3 0000:04:00.0 enp4s0: 0x00002170: 0x000d62b3,
>>> 0x0008dc6f, 0x0000009e, 0x00000000
>>> [ 6247.090937] tg3 0000:04:00.0 enp4s0: 0x00002180: 0x000d62b3,
>>> 0x0008dc6f, 0x0000009e, 0x00000000
>>> [ 6247.090940] tg3 0000:04:00.0 enp4s0: 0x00002190: 0x000d62b3,
>>> 0x0008dc6f, 0x0000009e, 0x00000000
>>> [ 6247.090942] tg3 0000:04:00.0 enp4s0: 0x000021a0: 0x000d62b3,
>>> 0x0008dc6f, 0x0000009e, 0x00000000
>>> [ 6247.090945] tg3 0000:04:00.0 enp4s0: 0x000021b0: 0x000d62b3,
>>> 0x0008dc6f, 0x0000009e, 0x00000000
>>> [ 6247.090948] tg3 0000:04:00.0 enp4s0: 0x000021c0: 0x000d62b3,
>>> 0x0008dc6f, 0x0000009e, 0x00000000
>>> [ 6247.090951] tg3 0000:04:00.0 enp4s0: 0x000021d0: 0x000d62b3,
>>> 0x0008dc6f, 0x0000009e, 0x00000000
>>> [ 6247.090953] tg3 0000:04:00.0 enp4s0: 0x000021e0: 0x000d62b3,
>>> 0x0008dc6f, 0x0000009e, 0x00000000
>>> [ 6247.090956] tg3 0000:04:00.0 enp4s0: 0x000021f0: 0x000d62b3,
>>> 0x0008dc6f, 0x0000009e, 0x00000000
>>> [ 6247.090959] tg3 0000:04:00.0 enp4s0: 0x00002200: 0x00025b63,
>>> 0x00000000, 0x00000000, 0x00000000
>>> [ 6247.090962] tg3 0000:04:00.0 enp4s0: 0x00002250: 0x00009a2d,
>>> 0x00000000, 0x00000000, 0x00000000
>>> [ 6247.090965] tg3 0000:04:00.0 enp4s0: 0x00002400: 0x00010012,
>>> 0x00000000, 0x00000000, 0x00000000
>>> [ 6247.090968] tg3 0000:04:00.0 enp4s0: 0x00002440: 0x00000000,
>>> 0x00000000, 0x00000002, 0x00000000
>>> [ 6247.090970] tg3 0000:04:00.0 enp4s0: 0x00002450: 0x00000000,
>>> 0xfffe0000, 0x08001800, 0x00006000
>>> [ 6247.090973] tg3 0000:04:00.0 enp4s0: 0x00002470: 0x00000000,
>>> 0x0000015f, 0x00000000, 0x00000000
>>> [ 6247.090976] tg3 0000:04:00.0 enp4s0: 0x000024c0: 0x02005101,
>>> 0x00000000, 0x00000000, 0x00000000
>>> [ 6247.090979] tg3 0000:04:00.0 enp4s0: 0x00002800: 0x00000006,
>>> 0x00000000, 0x00000000, 0x00000000
>>> [ 6247.090982] tg3 0000:04:00.0 enp4s0: 0x00002c00: 0x00000006,
>>> 0x00000000, 0x00000000, 0x000001d5
>>> [ 6247.090985] tg3 0000:04:00.0 enp4s0: 0x00002c10: 0x00000000,
>>> 0x00000000, 0x00000019, 0x0000000c
>>> [ 6247.090988] tg3 0000:04:00.0 enp4s0: 0x00002c20: 0x00020002,
>>> 0x00000000, 0x00000000, 0x00000000
>>> [ 6247.090990] tg3 0000:04:00.0 enp4s0: 0x00002d00: 0x00000080,
>>> 0x00000040, 0x00000000, 0x00000000
>>> [ 6247.090993] tg3 0000:04:00.0 enp4s0: 0x00003000: 0x00000006,
>>> 0x00000000, 0x00000000, 0x000001d5
>>> [ 6247.090997] tg3 0000:04:00.0 enp4s0: 0x00003600: 0x00034400,
>>> 0x00130000, 0x00110000, 0x00000000
>>> [ 6247.090999] tg3 0000:04:00.0 enp4s0: 0x00003610: 0x00131100,
>>> 0x00130000, 0x00130000, 0x00000000
>>> [ 6247.091002] tg3 0000:04:00.0 enp4s0: 0x00003620: 0x80110011,
>>> 0x00000000, 0x00000004, 0x3c822080
>>> [ 6247.091005] tg3 0000:04:00.0 enp4s0: 0x00003630: 0x00000000,
>>> 0x80008000, 0x00001080, 0x00000000
>>> [ 6247.091008] tg3 0000:04:00.0 enp4s0: 0x00003640: 0x0000000a,
>>> 0x33f00003, 0x00000020, 0x00000019
>>> [ 6247.091010] tg3 0000:04:00.0 enp4s0: 0x00003650: 0x00000171,
>>> 0x00000bff, 0x05762100, 0x00000000
>>> [ 6247.091014] tg3 0000:04:00.0 enp4s0: 0x00003660: 0x00000000,
>>> 0x00000000, 0x000400a3, 0x00000202
>>> [ 6247.091017] tg3 0000:04:00.0 enp4s0: 0x00003670: 0x0000002a,
>>> 0xfeffff63, 0x0000000a, 0x00000000
>>> [ 6247.091020] tg3 0000:04:00.0 enp4s0: 0x000036b0: 0x001003cc,
>>> 0x07ff07ff, 0x07ff07ff, 0x01000004
>>> [ 6247.091022] tg3 0000:04:00.0 enp4s0: 0x000036c0: 0xffffffff,
>>> 0x0000a441, 0x00c84caa, 0x0000a558
>>> [ 6247.091025] tg3 0000:04:00.0 enp4s0: 0x000036d0: 0x0000019d,
>>> 0x00000000, 0x00000000, 0x00000000
>>> [ 6247.091028] tg3 0000:04:00.0 enp4s0: 0x000036e0: 0x80000b19,
>>> 0xa0800799, 0x00500799, 0x00000000
>>> [ 6247.091031] tg3 0000:04:00.0 enp4s0: 0x000036f0: 0x19090900,
>>> 0x13180600, 0x00000301, 0x00000001
>>> [ 6247.091034] tg3 0000:04:00.0 enp4s0: 0x00003700: 0x00000000,
>>> 0x00000000, 0x00000000, 0x00001388
>>> [ 6247.091037] tg3 0000:04:00.0 enp4s0: 0x00003710: 0x87fffffd,
>>> 0x00000000, 0x00000000, 0x000010dc
>>> [ 6247.091039] tg3 0000:04:00.0 enp4s0: 0x00003720: 0x00000000,
>>> 0x00002040, 0x88006000, 0xa0002000
>>> [ 6247.091042] tg3 0000:04:00.0 enp4s0: 0x00003750: 0x00000000,
>>> 0x00000000, 0x0000080b, 0x00000000
>>> [ 6247.091045] tg3 0000:04:00.0 enp4s0: 0x00003780: 0x0000bff9,
>>> 0x00000000, 0x00000000, 0x00000000
>>> [ 6247.091049] tg3 0000:04:00.0 enp4s0: 0x00003c00: 0x00000306,
>>> 0x00000000, 0x00000000, 0x00000048
>>> [ 6247.091052] tg3 0000:04:00.0 enp4s0: 0x00003c10: 0x00000000,
>>> 0x00000035, 0x00000000, 0x00000000
>>> [ 6247.091055] tg3 0000:04:00.0 enp4s0: 0x00003c20: 0x00000000,
>>> 0x00000005, 0x00000000, 0x00000000
>>> [ 6247.091058] tg3 0000:04:00.0 enp4s0: 0x00003c30: 0x00000000,
>>> 0x00000000, 0x00000000, 0xffffc000
>>> [ 6247.091061] tg3 0000:04:00.0 enp4s0: 0x00003c40: 0x00000000,
>>> 0x00000b00, 0x00000000, 0x00000000
>>> [ 6247.091064] tg3 0000:04:00.0 enp4s0: 0x00003c50: 0x00000000,
>>> 0x00000155, 0x00000000, 0x00000000
>>> [ 6247.091066] tg3 0000:04:00.0 enp4s0: 0x00003c80: 0x00000800,
>>> 0x00000955, 0x00000000, 0x00000000
>>> [ 6247.091069] tg3 0000:04:00.0 enp4s0: 0x00003cc0: 0x00000171,
>>> 0x00000000, 0x00000000, 0x00000000
>>> [ 6247.091072] tg3 0000:04:00.0 enp4s0: 0x00003cd0: 0x00000000,
>>> 0x0000000f, 0x00000000, 0x00000000
>>> [ 6247.091075] tg3 0000:04:00.0 enp4s0: 0x00003d00: 0x00000000,
>>> 0xffffb000, 0x00000000, 0xffffa000
>>> [ 6247.091078] tg3 0000:04:00.0 enp4s0: 0x00003d80: 0x00000014,
>>> 0x00000000, 0x00000005, 0x00000000
>>> [ 6247.091080] tg3 0000:04:00.0 enp4s0: 0x00003d90: 0x00000005,
>>> 0x00000000, 0x00000014, 0x00000000
>>> [ 6247.091083] tg3 0000:04:00.0 enp4s0: 0x00003da0: 0x00000005,
>>> 0x00000000, 0x00000005, 0x00000000
>>> [ 6247.091086] tg3 0000:04:00.0 enp4s0: 0x00004000: 0x00000002,
>>> 0x00000000, 0x00000000, 0x00000000
>>> [ 6247.091088] tg3 0000:04:00.0 enp4s0: 0x00004010: 0x00000000,
>>> 0x0026f012, 0x00800420, 0x01006222
>>> [ 6247.091091] tg3 0000:04:00.0 enp4s0: 0x00004020: 0x00000000,
>>> 0x00000010, 0x00000010, 0x00000050
>>> [ 6247.091094] tg3 0000:04:00.0 enp4s0: 0x00004030: 0x00000000,
>>> 0x01086020, 0x00296010, 0x00000002
>>> [ 6247.091096] tg3 0000:04:00.0 enp4s0: 0x00004040: 0x00400000,
>>> 0x00000000, 0x00000010, 0x004e5062
>>> [ 6247.091100] tg3 0000:04:00.0 enp4s0: 0x00004400: 0x00000016,
>>> 0x00000000, 0x00010000, 0x0000a000
>>> [ 6247.091103] tg3 0000:04:00.0 enp4s0: 0x00004410: 0x00000000,
>>> 0x0000002a, 0x000000a0, 0x00000000
>>> [ 6247.091106] tg3 0000:04:00.0 enp4s0: 0x00004420: 0x000000fd,
>>> 0x00000000, 0x00000000, 0x00000000
>>> [ 6247.091109] tg3 0000:04:00.0 enp4s0: 0x00004440: 0x00000000,
>>> 0x00000000, 0x00000000, 0x0e5398e8
>>> [ 6247.091112] tg3 0000:04:00.0 enp4s0: 0x00004450: 0x02340226,
>>> 0x00970071, 0x00000000, 0x00000000
>>> [ 6247.091116] tg3 0000:04:00.0 enp4s0: 0x00004700: 0x00030002,
>>> 0x00100000, 0x00100010, 0xc1250000
>>> [ 6247.091119] tg3 0000:04:00.0 enp4s0: 0x00004710: 0xfffff6e0,
>>> 0x00060484, 0x00100010, 0x00000000
>>> [ 6247.091121] tg3 0000:04:00.0 enp4s0: 0x00004720: 0x00000000,
>>> 0x00000000, 0xf02c0000, 0xfffff710
>>> [ 6247.091124] tg3 0000:04:00.0 enp4s0: 0x00004770: 0x000c0404,
>>> 0x00000002, 0x00000010, 0x00000000
>>> [ 6247.091127] tg3 0000:04:00.0 enp4s0: 0x00004800: 0x380303fe,
>>> 0x00000000, 0x00000000, 0x00000100
>>> [ 6247.091130] tg3 0000:04:00.0 enp4s0: 0x00004810: 0x00000000,
>>> 0x00000008, 0x00429f80, 0x00008000
>>> [ 6247.091133] tg3 0000:04:00.0 enp4s0: 0x00004820: 0x000000dd,
>>> 0x00000000, 0x00000000, 0x00000000
>>> [ 6247.091136] tg3 0000:04:00.0 enp4s0: 0x00004860: 0x000000dd,
>>> 0x11400062, 0x001ff800, 0x62000008
>>> [ 6247.091139] tg3 0000:04:00.0 enp4s0: 0x00004870: 0x05ea0080,
>>> 0x003e1820, 0x003e1820, 0x00000000
>>> [ 6247.091141] tg3 0000:04:00.0 enp4s0: 0x00004890: 0x280c0c04,
>>> 0x00305400, 0x00000000, 0x00000000
>>> [ 6247.091144] tg3 0000:04:00.0 enp4s0: 0x000048a0: 0x000f0010,
>>> 0x00000000, 0x00000000, 0x00000000
>>> [ 6247.091147] tg3 0000:04:00.0 enp4s0: 0x00004900: 0x18030002,
>>> 0x00000003, 0x30000000, 0x00000120
>>> [ 6247.091149] tg3 0000:04:00.0 enp4s0: 0x00004910: 0x00000040,
>>> 0x00000003, 0x0000df94, 0x00000008
>>> [ 6247.091152] tg3 0000:04:00.0 enp4s0: 0x00004920: 0x000000e7,
>>> 0x02728000, 0xffd07a01, 0x0f000068
>>> [ 6247.091155] tg3 0000:04:00.0 enp4s0: 0x00004930: 0xffd31201,
>>> 0x0f000068, 0xffcdf401, 0x0f000068
>>> [ 6247.091158] tg3 0000:04:00.0 enp4s0: 0x00004940: 0xffebcc01,
>>> 0x0f000068, 0x4f4f1212, 0x3e3ea3a3
>>> [ 6247.091161] tg3 0000:04:00.0 enp4s0: 0x00004950: 0xf0330000,
>>> 0xffd07a68, 0xaf000000, 0xe7e500e6
>>> [ 6247.091164] tg3 0000:04:00.0 enp4s0: 0x00004960: 0x00000000,
>>> 0xffd31268, 0xaf000000, 0x40000171
>>> [ 6247.091167] tg3 0000:04:00.0 enp4s0: 0x00004970: 0x00028202,
>>> 0x00205400, 0x0000001c, 0x000000ff
>>> [ 6247.091170] tg3 0000:04:00.0 enp4s0: 0x00004980: 0x000000e7,
>>> 0x00000000, 0x00000000, 0x00000000
>>> [ 6247.091172] tg3 0000:04:00.0 enp4s0: 0x00004990: 0x00000000,
>>> 0x00000000, 0xffcdf468, 0xaf000000
>>> [ 6247.091175] tg3 0000:04:00.0 enp4s0: 0x000049a0: 0x00f00049,
>>> 0x000000e7, 0x00000000, 0x00000000
>>> [ 6247.091178] tg3 0000:04:00.0 enp4s0: 0x000049b0: 0xffd09601,
>>> 0xffd2c401, 0xffce7e01, 0xffec7e01
>>> [ 6247.091181] tg3 0000:04:00.0 enp4s0: 0x000049c0: 0xffd07a02,
>>> 0xffd31202, 0xffcdf402, 0xffebcc02
>>> [ 6247.091183] tg3 0000:04:00.0 enp4s0: 0x000049d0: 0xffd09602,
>>> 0xffd2c402, 0xffce7e02, 0xffec7e02
>>> [ 6247.091186] tg3 0000:04:00.0 enp4s0: 0x000049f0: 0xf0330000,
>>> 0xffebcc68, 0xaf000000, 0x0000ffff
>>> [ 6247.091190] tg3 0000:04:00.0 enp4s0: 0x00004c00: 0x200003fe,
>>> 0x00000020, 0x00000000, 0x00000000
>>> [ 6247.091193] tg3 0000:04:00.0 enp4s0: 0x00004c10: 0x0000003f,
>>> 0x00000000, 0x00000006, 0x00000000
>>> [ 6247.091196] tg3 0000:04:00.0 enp4s0: 0x00004c20: 0x00000000,
>>> 0x00000000, 0x00000000, 0x00000006
>>> [ 6247.091199] tg3 0000:04:00.0 enp4s0: 0x00004c30: 0x00000000,
>>> 0x00200000, 0x0000007c, 0x0000007c
>>> [ 6247.091201] tg3 0000:04:00.0 enp4s0: 0x00004c40: 0x00000000,
>>> 0x09550000, 0x00000000, 0x095407ff
>>> [ 6247.091204] tg3 0000:04:00.0 enp4s0: 0x00004c50: 0x0fff0fff,
>>> 0x01550fff, 0x00000000, 0x00553939
>>> [ 6247.091207] tg3 0000:04:00.0 enp4s0: 0x00004c60: 0x00000020,
>>> 0x00000000, 0x00000000, 0x00000000
>>> [ 6247.091210] tg3 0000:04:00.0 enp4s0: 0x00005000: 0x00009800,
>>> 0x80000000, 0x00000000, 0x00000000
>>> [ 6247.091213] tg3 0000:04:00.0 enp4s0: 0x00005010: 0x00000000,
>>> 0x00000000, 0x00000000, 0x08001028
>>> [ 6247.091216] tg3 0000:04:00.0 enp4s0: 0x00005020: 0x30840fff,
>>> 0x00000000, 0x00000000, 0x40000020
>>> [ 6247.091218] tg3 0000:04:00.0 enp4s0: 0x00005030: 0x00000000,
>>> 0x00000025, 0x00000000, 0x00000000
>>> [ 6247.091222] tg3 0000:04:00.0 enp4s0: 0x00005040: 0x00000000,
>>> 0x00000000, 0x080011f4, 0x00000000
>>> [ 6247.091225] tg3 0000:04:00.0 enp4s0: 0x00005080: 0x00009800,
>>> 0x80004000, 0x00000000, 0x00000000
>>> [ 6247.091227] tg3 0000:04:00.0 enp4s0: 0x00005090: 0x00000000,
>>> 0x00000000, 0x00000000, 0x08001028
>>> [ 6247.091230] tg3 0000:04:00.0 enp4s0: 0x000050a0: 0x30840fff,
>>> 0x00000000, 0x00000000, 0x40000020
>>> [ 6247.091233] tg3 0000:04:00.0 enp4s0: 0x000050b0: 0x00000000,
>>> 0x00000025, 0x00000000, 0x00000000
>>> [ 6247.091236] tg3 0000:04:00.0 enp4s0: 0x000050c0: 0x00000000,
>>> 0x00000000, 0x080011f4, 0x00000000
>>> [ 6247.091238] tg3 0000:04:00.0 enp4s0: 0x00005100: 0x00009800,
>>> 0x80000000, 0x00000000, 0x00000000
>>> [ 6247.091241] tg3 0000:04:00.0 enp4s0: 0x00005110: 0x00000000,
>>> 0x00000000, 0x00000000, 0x08001028
>>> [ 6247.091244] tg3 0000:04:00.0 enp4s0: 0x00005120: 0x30840fff,
>>> 0x00000000, 0x00000000, 0x40000020
>>> [ 6247.091247] tg3 0000:04:00.0 enp4s0: 0x00005130: 0x00000000,
>>> 0x00000025, 0x00000000, 0x00000000
>>> [ 6247.091250] tg3 0000:04:00.0 enp4s0: 0x00005140: 0x00000000,
>>> 0x00000000, 0x080011f4, 0x00000000
>>> [ 6247.091253] tg3 0000:04:00.0 enp4s0: 0x00005180: 0x00009800,
>>> 0x80000000, 0x00000000, 0x00000000
>>> [ 6247.091256] tg3 0000:04:00.0 enp4s0: 0x00005190: 0x00000000,
>>> 0x00000000, 0x00000000, 0x08001028
>>> [ 6247.091258] tg3 0000:04:00.0 enp4s0: 0x000051a0: 0x30840fff,
>>> 0x00000000, 0x00000000, 0x40000020
>>> [ 6247.091261] tg3 0000:04:00.0 enp4s0: 0x000051b0: 0x00000000,
>>> 0x00000025, 0x00000000, 0x00000000
>>> [ 6247.091264] tg3 0000:04:00.0 enp4s0: 0x000051c0: 0x00000000,
>>> 0x00000000, 0x080011f4, 0x00000000
>>> [ 6247.091266] tg3 0000:04:00.0 enp4s0: 0x00005200: 0x05762100,
>>> 0x00000000, 0x21100010, 0x00000000
>>> [ 6247.091270] tg3 0000:04:00.0 enp4s0: 0x00005210: 0x00010000,
>>> 0x00831824, 0xc0000000, 0x14400016
>>> [ 6247.091273] tg3 0000:04:00.0 enp4s0: 0x00005220: 0xc0000000,
>>> 0x21100010, 0x00000000, 0x00000000
>>> [ 6247.091276] tg3 0000:04:00.0 enp4s0: 0x00005230: 0x080012bc,
>>> 0x03608821, 0x14400016, 0x14830018
>>> [ 6247.091279] tg3 0000:04:00.0 enp4s0: 0x00005240: 0x0800150c,
>>> 0x00000000, 0x3c038000, 0x54000003
>>> [ 6247.091282] tg3 0000:04:00.0 enp4s0: 0x00005250: 0x03608821,
>>> 0x00010000, 0x14830018, 0x21100010
>>> [ 6247.091285] tg3 0000:04:00.0 enp4s0: 0x00005260: 0x00000000,
>>> 0x3c038000, 0x54000003, 0x03608821
>>> [ 6247.091288] tg3 0000:04:00.0 enp4s0: 0x00005270: 0xc0010000,
>>> 0x14830018, 0x21100010, 0x00000000
>>> [ 6247.091291] tg3 0000:04:00.0 enp4s0: 0x00005280: 0x00009800,
>>> 0x80004000, 0x00000000, 0x00000000
>>> [ 6247.091294] tg3 0000:04:00.0 enp4s0: 0x00005290: 0x00000000,
>>> 0x00000000, 0x00000000, 0x0800102c
>>> [ 6247.091297] tg3 0000:04:00.0 enp4s0: 0x000052a0: 0x3c04ff00,
>>> 0x00000000, 0x00000000, 0x40000020
>>> [ 6247.091300] tg3 0000:04:00.0 enp4s0: 0x000052b0: 0x00000000,
>>> 0x00000025, 0x00000000, 0x00000000
>>> [ 6247.091302] tg3 0000:04:00.0 enp4s0: 0x000052c0: 0x00000000,
>>> 0x00000000, 0x08000110, 0x00000000
>>> [ 6247.091305] tg3 0000:04:00.0 enp4s0: 0x00005300: 0x00009800,
>>> 0x80004000, 0x00000000, 0x00000000
>>> [ 6247.091308] tg3 0000:04:00.0 enp4s0: 0x00005310: 0x00000000,
>>> 0x00000000, 0x00000000, 0x08000100
>>> [ 6247.091311] tg3 0000:04:00.0 enp4s0: 0x00005320: 0x3c04ff00,
>>> 0x00000000, 0x00000000, 0x40000020
>>> [ 6247.091314] tg3 0000:04:00.0 enp4s0: 0x00005330: 0x00000000,
>>> 0x00000025, 0x00000000, 0x00000000
>>> [ 6247.091317] tg3 0000:04:00.0 enp4s0: 0x00005340: 0x00000000,
>>> 0x00000000, 0x08000110, 0x00000000
>>> [ 6247.091320] tg3 0000:04:00.0 enp4s0: 0x00005380: 0x00009800,
>>> 0x80004000, 0x00000000, 0x00000000
>>> [ 6247.091323] tg3 0000:04:00.0 enp4s0: 0x00005390: 0x00000000,
>>> 0x00000000, 0x00000000, 0x080000f8
>>> [ 6247.091325] tg3 0000:04:00.0 enp4s0: 0x000053a0: 0x3c04ff00,
>>> 0x00000000, 0x00000000, 0x40000020
>>> [ 6247.091328] tg3 0000:04:00.0 enp4s0: 0x000053b0: 0x00000000,
>>> 0x00000025, 0x00000000, 0x00000000
>>> [ 6247.091331] tg3 0000:04:00.0 enp4s0: 0x000053c0: 0x00000000,
>>> 0x00000000, 0x080011f4, 0x00000000
>>> [ 6247.091334] tg3 0000:04:00.0 enp4s0: 0x00005800: 0x00000000,
>>> 0x39000000, 0x00000000, 0xc3000000
>>> [ 6247.091337] tg3 0000:04:00.0 enp4s0: 0x00005810: 0x00000000,
>>> 0x51000000, 0x00000000, 0x00000001
>>> [ 6247.091340] tg3 0000:04:00.0 enp4s0: 0x00005820: 0x00000000,
>>> 0x00000001, 0x00000000, 0x00000000
>>> [ 6247.091342] tg3 0000:04:00.0 enp4s0: 0x00005860: 0x00000000,
>>> 0x00000000, 0x00000000, 0x0000021d
>>> [ 6247.091345] tg3 0000:04:00.0 enp4s0: 0x00005880: 0x00000000,
>>> 0x00000800, 0x00000000, 0x00000955
>>> [ 6247.091348] tg3 0000:04:00.0 enp4s0: 0x00005900: 0x00000000,
>>> 0x00000171, 0x00000000, 0x00000000
>>> [ 6247.091350] tg3 0000:04:00.0 enp4s0: 0x00005980: 0x00000171,
>>> 0x00000000, 0x00000000, 0x00000000
>>> [ 6247.091353] tg3 0000:04:00.0 enp4s0: 0x00005a00: 0x000f601f,
>>> 0x00000000, 0x00010000, 0x00000000
>>> [ 6247.091356] tg3 0000:04:00.0 enp4s0: 0x00006000: 0x20010082,
>>> 0x00000000, 0x00000000, 0x00000000
>>> [ 6247.091359] tg3 0000:04:00.0 enp4s0: 0x00006400: 0x00000000,
>>> 0x00000000, 0x00010091, 0xc0000000
>>> [ 6247.091362] tg3 0000:04:00.0 enp4s0: 0x00006410: 0x05000016,
>>> 0x05000016, 0x00000000, 0x00000000
>>> [ 6247.091364] tg3 0000:04:00.0 enp4s0: 0x00006430: 0x00000000,
>>> 0x14e41687, 0x2215103c, 0x10020000
>>> [ 6247.091367] tg3 0000:04:00.0 enp4s0: 0x00006440: 0x0000304f,
>>> 0x000002e4, 0x00000000, 0x00000080
>>> [ 6247.091371] tg3 0000:04:00.0 enp4s0: 0x000064c0: 0x00000005,
>>> 0x00000004, 0x00000122, 0x00000000
>>> [ 6247.091374] tg3 0000:04:00.0 enp4s0: 0x000064d0: 0x00000040,
>>> 0x10008d82, 0x00000000, 0x00d75e12
>>> [ 6247.091377] tg3 0000:04:00.0 enp4s0: 0x000064e0: 0x00000031,
>>> 0x0008001f, 0x00000000, 0x00000000
>>> [ 6247.091379] tg3 0000:04:00.0 enp4s0: 0x000064f0: 0x00000002,
>>> 0x00000031, 0x00000000, 0x00000000
>>> [ 6247.091382] tg3 0000:04:00.0 enp4s0: 0x00006500: 0x03e10003,
>>> 0xd45792bf, 0x00008cdc, 0x00000003
>>> [ 6247.091385] tg3 0000:04:00.0 enp4s0: 0x00006510: 0x00078116,
>>> 0x0005810b, 0x00046105, 0x00000000
>>> [ 6247.091388] tg3 0000:04:00.0 enp4s0: 0x00006530: 0x00000001,
>>> 0x00000000, 0x00000000, 0x00000000
>>> [ 6247.091390] tg3 0000:04:00.0 enp4s0: 0x00006540: 0x0028081f,
>>> 0x0001001e, 0x00000000, 0x00000000
>>> [ 6247.091393] tg3 0000:04:00.0 enp4s0: 0x00006550: 0x00000001,
>>> 0x02800000, 0x0000000f, 0x00000000
>>> [ 6247.091396] tg3 0000:04:00.0 enp4s0: 0x00006560: 0x0000000f,
>>> 0x00000000, 0x00000000, 0x00000000
>>> [ 6247.091399] tg3 0000:04:00.0 enp4s0: 0x000065f0: 0x00000000,
>>> 0x00000059, 0x00000000, 0x00000000
>>> [ 6247.091402] tg3 0000:04:00.0 enp4s0: 0x00006800: 0x141b0034,
>>> 0x20081082, 0x00029118, 0x730cfbb9
>>> [ 6247.091405] tg3 0000:04:00.0 enp4s0: 0x00006810: 0x21100010,
>>> 0xffffffff, 0x00000000, 0x000000f0
>>> [ 6247.091408] tg3 0000:04:00.0 enp4s0: 0x00006880: 0x77fff020,
>>> 0x00000040, 0x00801687, 0x00000000
>>> [ 6247.091410] tg3 0000:04:00.0 enp4s0: 0x00006890: 0x00800000,
>>> 0x00000000, 0x00000000, 0x00000000
>>> [ 6247.091413] tg3 0000:04:00.0 enp4s0: 0x000068a0: 0x00000000,
>>> 0x00010001, 0x00000000, 0x00000000
>>> [ 6247.091416] tg3 0000:04:00.0 enp4s0: 0x000068b0: 0x00040000,
>>> 0x00000000, 0x00000000, 0x00000000
>>> [ 6247.091419] tg3 0000:04:00.0 enp4s0: 0x000068c0: 0x00000044,
>>> 0x00000000, 0x00000000, 0x00000000
>>> [ 6247.091422] tg3 0000:04:00.0 enp4s0: 0x000068f0: 0x00000000,
>>> 0x00000000, 0x00000000, 0x04444444
>>> [ 6247.091424] tg3 0000:04:00.0 enp4s0: 0x00006900: 0x6f95a788,
>>> 0x14bd0ec2, 0x00000000, 0x00000000
>>> [ 6247.091427] tg3 0000:04:00.0 enp4s0: 0x00006920: 0x00000000,
>>> 0x00000000, 0x00000001, 0x00000000
>>> [ 6247.091430] tg3 0000:04:00.0 enp4s0: 0x00006c00: 0x168714e4,
>>> 0x00100506, 0x02000010, 0x00000010
>>> [ 6247.091433] tg3 0000:04:00.0 enp4s0: 0x00006c10: 0xe212000c,
>>> 0x00000000, 0xe211000c, 0x00000000
>>> [ 6247.091436] tg3 0000:04:00.0 enp4s0: 0x00006c20: 0xe210000c,
>>> 0x00000000, 0x00000000, 0x2215103c
>>> [ 6247.091438] tg3 0000:04:00.0 enp4s0: 0x00006c30: 0x00000000,
>>> 0x00000048, 0x00000000, 0x0000010a
>>> [ 6247.091441] tg3 0000:04:00.0 enp4s0: 0x00006c40: 0x00000000,
>>> 0x00000000, 0xc8035001, 0x16002008
>>> [ 6247.091444] tg3 0000:04:00.0 enp4s0: 0x00006c50: 0x00005803,
>>> 0x00000000, 0x0086a005, 0x00000000
>>> [ 6247.091447] tg3 0000:04:00.0 enp4s0: 0x00006c60: 0x00000000,
>>> 0x00000000, 0xf1000298, 0x01f802d1
>>> [ 6247.091450] tg3 0000:04:00.0 enp4s0: 0x00006c70: 0x00071010,
>>> 0xf6001500, 0x00000000, 0x00000000
>>> [ 6247.091453] tg3 0000:04:00.0 enp4s0: 0x00006ca0: 0x8005ac11,
>>> 0x00000004, 0x00000122, 0x00020010
>>> [ 6247.091456] tg3 0000:04:00.0 enp4s0: 0x00006cb0: 0x10008d82,
>>> 0x00115400, 0x00475c12, 0x10120043
>>> [ 6247.091459] tg3 0000:04:00.0 enp4s0: 0x00006cd0: 0x0008081f,
>>> 0x00000000, 0x00000000, 0x00010001
>>> [ 6247.091462] tg3 0000:04:00.0 enp4s0: 0x00006cf0: 0x00000000,
>>> 0x05762100, 0x00000000, 0x00000000
>>> [ 6247.091464] tg3 0000:04:00.0 enp4s0: 0x00006d00: 0x13c10001,
>>> 0x00000000, 0x00000000, 0x00062030
>>> [ 6247.091467] tg3 0000:04:00.0 enp4s0: 0x00006d10: 0x00001000,
>>> 0x00002000, 0x000000a0, 0x00000000
>>> [ 6247.091470] tg3 0000:04:00.0 enp4s0: 0x00006d30: 0x00000000,
>>> 0x00000000, 0x00000000, 0x15010003
>>> [ 6247.091473] tg3 0000:04:00.0 enp4s0: 0x00006d40: 0xd45792bf,
>>> 0x00008cdc, 0x00000000, 0x00000000
>>> [ 6247.091476] tg3 0000:04:00.0 enp4s0: 0x00006d50: 0x16010004,
>>> 0x00000000, 0x00078116, 0x00000001
>>> [ 6247.091479] tg3 0000:04:00.0 enp4s0: 0x00006d60: 0x1b010002,
>>> 0x00000000, 0x00000000, 0x00000000
>>> [ 6247.091482] tg3 0000:04:00.0 enp4s0: 0x00006d70: 0x00000000,
>>> 0x80000001, 0x00000000, 0x00000000
>>> [ 6247.091484] tg3 0000:04:00.0 enp4s0: 0x00006db0: 0x23010018,
>>> 0x00000000, 0x00000000, 0x00000000
>>> [ 6247.091487] tg3 0000:04:00.0 enp4s0: 0x00006e30: 0x00010017,
>>> 0x00050403, 0x00000000, 0x00000000
>>> [ 6247.091490] tg3 0000:04:00.0 enp4s0: 0x00007000: 0x08000008,
>>> 0x00000000, 0x00000000, 0x000038d4
>>> [ 6247.091493] tg3 0000:04:00.0 enp4s0: 0x00007010: 0x9928504d,
>>> 0x02808083, 0x800500db, 0x03000a00
>>> [ 6247.091496] tg3 0000:04:00.0 enp4s0: 0x00007020: 0x00000000,
>>> 0x00000008, 0x00000406, 0x10004000
>>> [ 6247.091499] tg3 0000:04:00.0 enp4s0: 0x00007030: 0x000e0000,
>>> 0x000038d8, 0x00230030, 0x80000000
>>> [ 6247.091502] tg3 0000:04:00.0 enp4s0: 0x00007500: 0x00000000,
>>> 0x00000000, 0x00000081, 0x00000000
>>> [ 6247.091505] tg3 0000:04:00.0 enp4s0: 0x00007510: 0x00000000,
>>> 0xffffdfff, 0x00000000, 0x00000000
>>> [ 6247.091510] tg3 0000:04:00.0 enp4s0: 0: Host status block
>>> [00000001:00000039:(0000:0145:0000):(0000:0167)]
>>> [ 6247.091514] tg3 0000:04:00.0 enp4s0: 0: NAPI info
>>> [00000039:00000039:(0171:0167:01ff):0000:(021d:0000:0000:0000)]
>>> [ 6247.091518] tg3 0000:04:00.0 enp4s0: 1: Host status block
>>> [00000001:000000c3:(0000:0000:0000):(0800:0000)]
>>> [ 6247.091521] tg3 0000:04:00.0 enp4s0: 1: NAPI info
>>> [000000c3:000000c3:(0000:0000:01ff):0800:(0000:0000:0000:0000)]
>>> [ 6247.091524] tg3 0000:04:00.0 enp4s0: 2: Host status block
>>> [00000001:00000051:(0955:0000:0000):(0000:0000)]
>>> [ 6247.091528] tg3 0000:04:00.0 enp4s0: 2: NAPI info
>>> [00000051:00000051:(0000:0000:01ff):0955:(0155:0155:0000:0000)]
>>> [ 6247.135111] tg3 0000:04:00.0 enp4s0: Link is down
>>> [ 6250.868825] tg3 0000:04:00.0 enp4s0: Link is up at 1000 Mbps, full duplex
>>> [ 6250.868845] tg3 0000:04:00.0 enp4s0: Flow control is on for TX and on for RX
>>> [ 6250.868849] tg3 0000:04:00.0 enp4s0: EEE is enabled
>>
>>
>>
>> --
>> Thanks,
>>
>> Siva
^ permalink raw reply
* RE: [PATCH net-next] tools: hv: Add clean up for included files in Ubuntu net config
From: Haiyang Zhang @ 2017-05-12 18:46 UTC (permalink / raw)
To: David Miller
Cc: netdev@vger.kernel.org, KY Srinivasan, olaf@aepfle.de,
vkuznets@redhat.com, linux-kernel@vger.kernel.org
In-Reply-To: <20170512.122026.71874509847193117.davem@davemloft.net>
> -----Original Message-----
> From: David Miller [mailto:davem@davemloft.net]
> Sent: Friday, May 12, 2017 12:20 PM
> To: Haiyang Zhang <haiyangz@microsoft.com>; Haiyang Zhang
> <haiyangz@microsoft.com>
> Cc: netdev@vger.kernel.org; KY Srinivasan <kys@microsoft.com>;
> olaf@aepfle.de; vkuznets@redhat.com; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH net-next] tools: hv: Add clean up for included files
> in Ubuntu net config
>
> From: Haiyang Zhang <haiyangz@exchange.microsoft.com>
> Date: Fri, 12 May 2017 07:13:33 -0700
>
> >
> > + local fn
> > + for fn in "${fnlist[@]}"
> > + do
> > awk "/$nic_end/{x=0} x{next} /$nic_start/{x=1;next} 1"
> $fn >$tmpfl
> >
> > cp $tmpfl $fn
> > + done
>
> Please indent the body of this loop properly.
Will do. Thanks.
^ permalink raw reply
* [PATCH] net/packet: fix missing net_device reference release
From: Douglas Caetano dos Santos @ 2017-05-12 18:19 UTC (permalink / raw)
To: netdev
Cc: David S. Miller, Eric Dumazet, Daniel Borkmann, Willem de Bruijn,
Jarno Rajahalme, Andrey Konovalov, Anoob Soman, Sowmini Varadhan,
Philip Pettersson, Mike Rapoport
When using a TX ring buffer, if an error occurs processing a control
message (e.g. invalid message), the net_device reference is not
released.
Fixes c14ac9451c348 ("sock: enable timestamping using control messages")
Signed-off-by: Douglas Caetano dos Santos <douglascs@taghos.com.br>
---
net/packet/af_packet.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index f4001763134d..e3eeed19cc7a 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -2658,13 +2658,6 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg)
dev = dev_get_by_index(sock_net(&po->sk), saddr->sll_ifindex);
}
- sockc.tsflags = po->sk.sk_tsflags;
- if (msg->msg_controllen) {
- err = sock_cmsg_send(&po->sk, msg, &sockc);
- if (unlikely(err))
- goto out;
- }
-
err = -ENXIO;
if (unlikely(dev == NULL))
goto out;
@@ -2672,6 +2665,13 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg)
if (unlikely(!(dev->flags & IFF_UP)))
goto out_put;
+ sockc.tsflags = po->sk.sk_tsflags;
+ if (msg->msg_controllen) {
+ err = sock_cmsg_send(&po->sk, msg, &sockc);
+ if (unlikely(err))
+ goto out_put;
+ }
+
if (po->sk.sk_socket->type == SOCK_RAW)
reserve = dev->hard_header_len;
size_max = po->tx_ring.frame_size
--
2.12.2
^ permalink raw reply related
* Re: [Patch net] ipv4: restore rt->fi for reference counting
From: Cong Wang @ 2017-05-12 17:49 UTC (permalink / raw)
To: Eric Dumazet
Cc: Julian Anastasov, David Miller, Linux Kernel Network Developers,
Andrey Konovalov, Eric Dumazet
In-Reply-To: <1494564948.7796.128.camel@edumazet-glaptop3.roam.corp.google.com>
On Thu, May 11, 2017 at 9:55 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> On Thu, 2017-05-11 at 18:22 -0700, Cong Wang wrote:
>> On Thu, May 11, 2017 at 5:07 PM, Cong Wang <xiyou.wangcong@gmail.com> wrote:
>> > So, if I understand you correctly it is safe to NULL'ing
>> > nh_dev in NETDEV_UNREGISTER_FINAL, right?
>> >
>> > If still not, how about transfer nh_dev's to loopback_dev
>> > too in NETDEV_UNREGISTER? Like we transfer dst->dev.
>> >
>> > I don't want to touch the fast path to check for NULL, as
>> > it will change more code and slow down performance.
>>
>> Finally I come up with the attached patch. Please let me know if
>> I still miss anything.
>
> You have not addressed my prior feedback, unless I am mistaken ?
>
> fib_route_seq_show() and others do not expect fi->fib_dev suddenly
> becoming NULL.
>
> RCU contract is more complicated than simply adding rcu grace period
> before delete.
>
If you mean the lack of rcu_dereference() in fib_route_seq_show() ,
yeah, I don't fix it because I think it should be in a separate patch,
it is not this patch which introduces RCU to nh_dev as I explained
previously.
Or you mean anything else?
^ permalink raw reply
* Re: [PATCH] net: ipv6: Truncate single route when it doesn't fit into dump buffer.
From: David Miller @ 2017-05-12 17:34 UTC (permalink / raw)
To: dsahern; +Cc: mq, netdev, linux-kernel, dsa, kuznet, jmorris, yoshfuji, kaber
In-Reply-To: <3828cf04-1bf8-92d2-dfc4-184bd615fe10@gmail.com>
From: David Ahern <dsahern@gmail.com>
Date: Fri, 12 May 2017 10:26:08 -0700
> On 5/12/17 8:24 AM, David Miller wrote:
>> From: Jan Moskyto Matejka <mq@ucw.cz>
>> Date: Fri, 12 May 2017 13:15:10 +0200
>>
>>> -int rt6_dump_route(struct rt6_info *rt, void *p_arg);
>>> +int rt6_dump_route(struct rt6_info *rt, void *p_arg, int truncate);
>>
>> Please use "bool" and "true"/"false" for boolean values.
>>
>> What does ipv4 do in this situation?
>>
>> I'm hesitant to be OK with adding a new nlmsg flag just for this case
>> if we solve this problem differently and using existing mechanisms
>> elsewhere.
>>
>
> I'll take a look at this later today or this weekend; we can't just
> truncate the route returned to userspace.
Agreed.
^ permalink raw reply
* alignment of MAP pointers
From: David Miller @ 2017-05-12 17:32 UTC (permalink / raw)
To: daniel; +Cc: ast, alexei.starovoitov, netdev
Daniel, this continues our discussion from yesterday where you
rightly pointed out that map pointers don't have their state
adjusted like packet pointers do currently.
I'm working on a patch sketched below to deal with this.
My understanding is that packet pointers are validated using the
accumulated known offset, plus a strictly seen test against the end of
the packet. Any time the end of the packet is tested against by the
program, we set reg->range to the largest offset against the packet
pointer which we can prove is legal to access.
If we see a non-constant variable added to the packet pointer, we
reset the reg->range value because we don't have a proven test
against the end of the packet any longer.
And this is now where all of the auxiliary offset and alignment stuff
is factored into things as well.
For MAP_VALUE_ADJ pointers, the min-max logic applies here. We know
the legal range of offsets for the map value accesses, and the min/max
values make sure the program stays within that range.
So I think what I'm doing below should make that logic still work
properly. We run check_map_ptr_add() only when we would have
considered the pointer to be still of type PTR_TO_MAP_VALUE_ADJ
(otherwise it gets marked as UNKNOWN). So the only side effects we
will have to these kinds of pointers is:
1) Advance reg->off
2) When variable is added:
a) Allocate reg->id
b) set reg->aux_off to reg->off
c) clear reg->off
d) clear reg->range (not used by map pointers)
So it mostly should be fine since we leave the min/max values alone.
When check_map_access_adj() does it's work, it takes into consideration
only the min/max values and the offset from the load/store instruction.
Anyways, your feedback is appreciated.
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 39f2dcb..e95adb3 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -823,10 +823,31 @@ static int check_pkt_ptr_alignment(const struct bpf_reg_state *reg,
}
static int check_val_ptr_alignment(const struct bpf_reg_state *reg,
- int size, bool strict)
+ int off, int size, bool strict)
{
- if (strict && size != 1) {
- verbose("Unknown alignment. Only byte-sized access allowed in value access.\n");
+ int reg_off;
+
+ /* Byte size accesses are always allowed. */
+ if (!strict || size == 1)
+ return 0;
+
+ reg_off = reg->off;
+ if (reg->id) {
+ if (reg->aux_off_align % size) {
+ verbose("Value access is only %u byte aligned, %d byte access not allowed\n",
+ reg->aux_off_align, size);
+ return -EACCES;
+ }
+ reg_off += reg->aux_off;
+ }
+
+ /* skb->data is NET_IP_ALIGN-ed, but for strict alignment checking
+ * we force this to 2 which is universally what architectures use
+ * when they don't set CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS.
+ */
+ if ((reg_off + off) % size != 0) {
+ verbose("misaligned value access off %d+%d size %d\n",
+ reg_off, off, size);
return -EACCES;
}
@@ -846,7 +867,7 @@ static int check_ptr_alignment(struct bpf_verifier_env *env,
case PTR_TO_PACKET:
return check_pkt_ptr_alignment(reg, off, size, strict);
case PTR_TO_MAP_VALUE_ADJ:
- return check_val_ptr_alignment(reg, size, strict);
+ return check_val_ptr_alignment(reg, off, size, strict);
default:
if (off % size != 0) {
verbose("misaligned access off %d size %d\n",
@@ -1458,8 +1479,8 @@ static int check_call(struct bpf_verifier_env *env, int func_id, int insn_idx)
return 0;
}
-static int check_packet_ptr_add(struct bpf_verifier_env *env,
- struct bpf_insn *insn)
+static int check_pointer_add(struct bpf_verifier_env *env,
+ struct bpf_insn *insn, bool is_packet)
{
struct bpf_reg_state *regs = env->cur_state.regs;
struct bpf_reg_state *dst_reg = ®s[insn->dst_reg];
@@ -1468,28 +1489,30 @@ static int check_packet_ptr_add(struct bpf_verifier_env *env,
s32 imm;
if (BPF_SRC(insn->code) == BPF_K) {
- /* pkt_ptr += imm */
+ /* pointer += imm */
imm = insn->imm;
add_imm:
- if (imm < 0) {
- verbose("addition of negative constant to packet pointer is not allowed\n");
- return -EACCES;
- }
- if (imm >= MAX_PACKET_OFF ||
- imm + dst_reg->off >= MAX_PACKET_OFF) {
- verbose("constant %d is too large to add to packet pointer\n",
- imm);
- return -EACCES;
+ if (is_packet) {
+ if (imm < 0) {
+ verbose("addition of negative constant to packet pointer is not allowed\n");
+ return -EACCES;
+ }
+ if (imm >= MAX_PACKET_OFF ||
+ imm + dst_reg->off >= MAX_PACKET_OFF) {
+ verbose("constant %d is too large to add to packet pointer\n",
+ imm);
+ return -EACCES;
+ }
}
- /* a constant was added to pkt_ptr.
+ /* a constant was added to the pointer.
* Remember it while keeping the same 'id'
*/
dst_reg->off += imm;
} else {
bool had_id;
- if (src_reg->type == PTR_TO_PACKET) {
+ if (is_packet && src_reg->type == PTR_TO_PACKET) {
/* R6=pkt(id=0,off=0,r=62) R7=imm22; r7 += r6 */
tmp_reg = *dst_reg; /* save r7 state */
*dst_reg = *src_reg; /* copy pkt_ptr state r6 into r7 */
@@ -1503,21 +1526,21 @@ static int check_packet_ptr_add(struct bpf_verifier_env *env,
}
if (src_reg->type == CONST_IMM) {
- /* pkt_ptr += reg where reg is known constant */
+ /* pointer += reg where reg is known constant */
imm = src_reg->imm;
goto add_imm;
}
- /* disallow pkt_ptr += reg
+ /* disallow pointer += reg
* if reg is not uknown_value with guaranteed zero upper bits
- * otherwise pkt_ptr may overflow and addition will become
+ * otherwise pointer_ptr may overflow and addition will become
* subtraction which is not allowed
*/
if (src_reg->type != UNKNOWN_VALUE) {
- verbose("cannot add '%s' to ptr_to_packet\n",
+ verbose("cannot add '%s' to pointer\n",
reg_type_str[src_reg->type]);
return -EACCES;
}
- if (src_reg->imm < 48) {
+ if (is_packet && src_reg->imm < 48) {
verbose("cannot add integer value with %lld upper zero bits to ptr_to_packet\n",
src_reg->imm);
return -EACCES;
@@ -1525,12 +1548,12 @@ static int check_packet_ptr_add(struct bpf_verifier_env *env,
had_id = (dst_reg->id != 0);
- /* dst_reg stays as pkt_ptr type and since some positive
+ /* dst_reg stays as the same type and since some positive
* integer value was added to the pointer, increment its 'id'
*/
dst_reg->id = ++env->id_gen;
- /* something was added to pkt_ptr, set range to zero */
+ /* something was added to pointer, set range to zero */
dst_reg->aux_off += dst_reg->off;
dst_reg->off = 0;
dst_reg->range = 0;
@@ -1543,6 +1566,18 @@ static int check_packet_ptr_add(struct bpf_verifier_env *env,
return 0;
}
+static int check_packet_ptr_add(struct bpf_verifier_env *env,
+ struct bpf_insn *insn)
+{
+ return check_pointer_add(env, insn, true);
+}
+
+static int check_map_ptr_add(struct bpf_verifier_env *env,
+ struct bpf_insn *insn)
+{
+ return check_pointer_add(env, insn, false);
+}
+
static int evaluate_reg_alu(struct bpf_verifier_env *env, struct bpf_insn *insn)
{
struct bpf_reg_state *regs = env->cur_state.regs;
@@ -2056,10 +2091,12 @@ static int check_alu_op(struct bpf_verifier_env *env, struct bpf_insn *insn)
if (env->allow_ptr_leaks &&
BPF_CLASS(insn->code) == BPF_ALU64 && opcode == BPF_ADD &&
(dst_reg->type == PTR_TO_MAP_VALUE ||
- dst_reg->type == PTR_TO_MAP_VALUE_ADJ))
+ dst_reg->type == PTR_TO_MAP_VALUE_ADJ)) {
dst_reg->type = PTR_TO_MAP_VALUE_ADJ;
- else
+ check_map_ptr_add(env, insn);
+ } else {
mark_reg_unknown_value(regs, insn->dst_reg);
+ }
}
return 0;
^ permalink raw reply related
* Re: [Patch net] ipv4: restore rt->fi for reference counting
From: Cong Wang @ 2017-05-12 17:27 UTC (permalink / raw)
To: Julian Anastasov
Cc: Eric Dumazet, David Miller, Linux Kernel Network Developers,
Andrey Konovalov, Eric Dumazet
In-Reply-To: <alpine.LFD.2.20.1705120659370.1811@ja.home.ssi.bg>
On Thu, May 11, 2017 at 11:39 PM, Julian Anastasov <ja@ssi.bg> wrote:
>
> Hello,
>
> On Thu, 11 May 2017, Cong Wang wrote:
>
>> On Thu, May 11, 2017 at 5:07 PM, Cong Wang <xiyou.wangcong@gmail.com> wrote:
>> > So, if I understand you correctly it is safe to NULL'ing
>> > nh_dev in NETDEV_UNREGISTER_FINAL, right?
>> >
>> > If still not, how about transfer nh_dev's to loopback_dev
>> > too in NETDEV_UNREGISTER? Like we transfer dst->dev.
>> >
>> > I don't want to touch the fast path to check for NULL, as
>> > it will change more code and slow down performance.
>>
>> Finally I come up with the attached patch. Please let me know if
>> I still miss anything.
>
> fib_flush will unlink the FIB infos at NETDEV_UNREGISTER
> time, so we can not see them in any hash tables later on
> NETDEV_UNREGISTER_FINAL. fib_put_nh_devs() can not work
> except if moving NHs in another hash table but that should
> not be needed.
Ah, I did miss the hlist_del() in fib_table_flush(), so we just need some
way to link those fib_nh together for NETDEV_UNREGISTER_FINAL,
a linked list should be sufficient, but requires adding list_head to fib_nh.
>
> I'm thinking for the following solution which
> is a bit hackish:
>
> - on NETDEV_UNREGISTER we want to put the nh_dev references,
> so fib_release_info is a good place. But as fib_release_info
> is not always called, we will have two places that put
> references. We can use such hack:
>
> - for example, use nh_oif to know if dev_put is
> already called
>
> - fib_release_info() should set nh_oif to 0 because
> it will now call dev_put without clearing nh_dev
Are you sure we are safe to call dev_put() in fib_release_info()
for _all_ paths, especially non-unregister paths? See:
commit e49cc0da7283088c5e03d475ffe2fdcb24a6d5b1
Author: Yanmin Zhang <yanmin_zhang@linux.intel.com>
Date: Wed May 23 15:39:45 2012 +0000
ipv4: fix the rcu race between free_fib_info and ip_route_output_slow
But, hmm, very interesting, I always thought dev_put() triggers a
kfree() potentially, but here your suggestion actually leverages the fact
that it is merely a pcpu counter decrease, so for unregister path,
this is just giving refcnt back, which means it is safe as long as
we don't have any parallel unregister? We should because of RTNL.
I see why you say this is hackish, really it is. ;) We have to ensure
the evil dev_put() is only called on unregister path.
>
> - free_fib_info_rcu() will not call dev_put if nh_oif is 0:
> if (nexthop_nh->nh_dev && nexthop_nh->nh_oif)
> dev_put(nexthop_nh->nh_dev);
>
> - as fi is unlinked, there is no chance fib_info_hashfn()
> to use the cleared nh_oif for hashing
>
> - we expect noone to touch nh_dev fields after fi is
> unlinked, this includes free_fib_info and free_fib_info_rcu
>
> What we achieve:
>
> - between NETDEV_UNREGISTER and NETDEV_UNREGISTER_FINAL nh_dev
> still points to our dev (and not to loopback, I think, this
> answers your question in previous email), so route lookups
> will not find loopback in the FIB tree. We do not want
> some packets to be wrongly rerouted. Even if we don't
> hold dev reference, the RCU grace period helps here.
Thanks to dev_put() for not calling a netdev_freemem(). ;-)
>
> - fib_dev/nh_dev != NULL checks are not needed, so this addresses
> Eric's concerns. BTW, fib_route_seq_show actually checks
> for fi->fib_dev, may be not in a safe way (lockless_dereference
> needed?) but as we don't set nh_dev to NULL this is not
> needed.
>
I think Eric was complaining about the lack of rcu_dereference()
there.
> What more? What about nh_pcpu_rth_output and
> nh_rth_input holding routes? We should think about
> them too. I should think more if nh_oif trick can work
> for them, may be not because nh_oif is optional...
> May be we should purge them somehow?
>
Or maybe don't touch nh_oif but using a new flag in
nh_flags?? We only need to know if we should call
dev_put() in free_fib_info_rcu().
Again, I am still not sure if it is any better than just
putting these fib_nh into a linked list.
Thanks.
^ permalink raw reply
* Re: [PATCH] net: ipv6: Truncate single route when it doesn't fit into dump buffer.
From: David Ahern @ 2017-05-12 17:26 UTC (permalink / raw)
To: David Miller, mq
Cc: netdev, linux-kernel, dsa, kuznet, jmorris, yoshfuji, kaber
In-Reply-To: <20170512.112447.1421545301592945998.davem@davemloft.net>
On 5/12/17 8:24 AM, David Miller wrote:
> From: Jan Moskyto Matejka <mq@ucw.cz>
> Date: Fri, 12 May 2017 13:15:10 +0200
>
>> -int rt6_dump_route(struct rt6_info *rt, void *p_arg);
>> +int rt6_dump_route(struct rt6_info *rt, void *p_arg, int truncate);
>
> Please use "bool" and "true"/"false" for boolean values.
>
> What does ipv4 do in this situation?
>
> I'm hesitant to be OK with adding a new nlmsg flag just for this case
> if we solve this problem differently and using existing mechanisms
> elsewhere.
>
I'll take a look at this later today or this weekend; we can't just
truncate the route returned to userspace.
^ permalink raw reply
* [PATCH V2 net 1/1] smc: switch to usage of IB_PD_UNSAFE_GLOBAL_RKEY
From: Ursula Braun @ 2017-05-12 17:09 UTC (permalink / raw)
To: davem
Cc: hch, netdev, linux-rdma, linux-s390, jwi, schwidefsky,
heiko.carstens, raspl, ubraun
In-Reply-To: <20170512170952.39863-1-ubraun@linux.vnet.ibm.com>
This patch makes users aware of the current security implications
when using smc.
The final fix to resolve the reported security issue is worked on;
respective patches will follow as soon as possible.
Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
---
net/smc/smc_clc.c | 4 ++--
net/smc/smc_core.c | 16 +++-------------
net/smc/smc_core.h | 2 +-
net/smc/smc_ib.c | 21 ++-------------------
net/smc/smc_ib.h | 2 --
5 files changed, 8 insertions(+), 37 deletions(-)
diff --git a/net/smc/smc_clc.c b/net/smc/smc_clc.c
index e41f594..03ec058 100644
--- a/net/smc/smc_clc.c
+++ b/net/smc/smc_clc.c
@@ -204,7 +204,7 @@ int smc_clc_send_confirm(struct smc_sock *smc)
memcpy(&cclc.lcl.mac, &link->smcibdev->mac[link->ibport - 1], ETH_ALEN);
hton24(cclc.qpn, link->roce_qp->qp_num);
cclc.rmb_rkey =
- htonl(conn->rmb_desc->mr_rx[SMC_SINGLE_LINK]->rkey);
+ htonl(conn->rmb_desc->rkey[SMC_SINGLE_LINK]);
cclc.conn_idx = 1; /* for now: 1 RMB = 1 RMBE */
cclc.rmbe_alert_token = htonl(conn->alert_token_local);
cclc.qp_mtu = min(link->path_mtu, link->peer_mtu);
@@ -256,7 +256,7 @@ int smc_clc_send_accept(struct smc_sock *new_smc, int srv_first_contact)
memcpy(&aclc.lcl.mac, link->smcibdev->mac[link->ibport - 1], ETH_ALEN);
hton24(aclc.qpn, link->roce_qp->qp_num);
aclc.rmb_rkey =
- htonl(conn->rmb_desc->mr_rx[SMC_SINGLE_LINK]->rkey);
+ htonl(conn->rmb_desc->rkey[SMC_SINGLE_LINK]);
aclc.conn_idx = 1; /* as long as 1 RMB = 1 RMBE */
aclc.rmbe_alert_token = htonl(conn->alert_token_local);
aclc.qp_mtu = link->path_mtu;
diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c
index 65020e9..3ac09a6 100644
--- a/net/smc/smc_core.c
+++ b/net/smc/smc_core.c
@@ -613,19 +613,8 @@ int smc_rmb_create(struct smc_sock *smc)
rmb_desc = NULL;
continue; /* if mapping failed, try smaller one */
}
- rc = smc_ib_get_memory_region(lgr->lnk[SMC_SINGLE_LINK].roce_pd,
- IB_ACCESS_REMOTE_WRITE |
- IB_ACCESS_LOCAL_WRITE,
- &rmb_desc->mr_rx[SMC_SINGLE_LINK]);
- if (rc) {
- smc_ib_buf_unmap(lgr->lnk[SMC_SINGLE_LINK].smcibdev,
- tmp_bufsize, rmb_desc,
- DMA_FROM_DEVICE);
- kfree(rmb_desc->cpu_addr);
- kfree(rmb_desc);
- rmb_desc = NULL;
- continue;
- }
+ rmb_desc->rkey[SMC_SINGLE_LINK] =
+ lgr->lnk[SMC_SINGLE_LINK].roce_pd->unsafe_global_rkey;
rmb_desc->used = 1;
write_lock_bh(&lgr->rmbs_lock);
list_add(&rmb_desc->list,
@@ -668,6 +657,7 @@ int smc_rmb_rtoken_handling(struct smc_connection *conn,
for (i = 0; i < SMC_RMBS_PER_LGR_MAX; i++) {
if ((lgr->rtokens[i][SMC_SINGLE_LINK].rkey == rkey) &&
+ (lgr->rtokens[i][SMC_SINGLE_LINK].dma_addr == dma_addr) &&
test_bit(i, lgr->rtokens_used_mask)) {
conn->rtoken_idx = i;
return 0;
diff --git a/net/smc/smc_core.h b/net/smc/smc_core.h
index 27eb3805..b013cb4 100644
--- a/net/smc/smc_core.h
+++ b/net/smc/smc_core.h
@@ -93,7 +93,7 @@ struct smc_buf_desc {
u64 dma_addr[SMC_LINKS_PER_LGR_MAX];
/* mapped address of buffer */
void *cpu_addr; /* virtual address of buffer */
- struct ib_mr *mr_rx[SMC_LINKS_PER_LGR_MAX];
+ u32 rkey[SMC_LINKS_PER_LGR_MAX];
/* for rmb only:
* rkey provided to peer
*/
diff --git a/net/smc/smc_ib.c b/net/smc/smc_ib.c
index cb69ab9..b317155 100644
--- a/net/smc/smc_ib.c
+++ b/net/smc/smc_ib.c
@@ -37,24 +37,6 @@ u8 local_systemid[SMC_SYSTEMID_LEN] = SMC_LOCAL_SYSTEMID_RESET; /* unique system
* identifier
*/
-int smc_ib_get_memory_region(struct ib_pd *pd, int access_flags,
- struct ib_mr **mr)
-{
- int rc;
-
- if (*mr)
- return 0; /* already done */
-
- /* obtain unique key -
- * next invocation of get_dma_mr returns a different key!
- */
- *mr = pd->device->get_dma_mr(pd, access_flags);
- rc = PTR_ERR_OR_ZERO(*mr);
- if (IS_ERR(*mr))
- *mr = NULL;
- return rc;
-}
-
static int smc_ib_modify_qp_init(struct smc_link *lnk)
{
struct ib_qp_attr qp_attr;
@@ -210,7 +192,8 @@ int smc_ib_create_protection_domain(struct smc_link *lnk)
{
int rc;
- lnk->roce_pd = ib_alloc_pd(lnk->smcibdev->ibdev, 0);
+ lnk->roce_pd = ib_alloc_pd(lnk->smcibdev->ibdev,
+ IB_PD_UNSAFE_GLOBAL_RKEY);
rc = PTR_ERR_OR_ZERO(lnk->roce_pd);
if (IS_ERR(lnk->roce_pd))
lnk->roce_pd = NULL;
diff --git a/net/smc/smc_ib.h b/net/smc/smc_ib.h
index 7e1f0e2..b567152 100644
--- a/net/smc/smc_ib.h
+++ b/net/smc/smc_ib.h
@@ -61,8 +61,6 @@ void smc_ib_dealloc_protection_domain(struct smc_link *lnk);
int smc_ib_create_protection_domain(struct smc_link *lnk);
void smc_ib_destroy_queue_pair(struct smc_link *lnk);
int smc_ib_create_queue_pair(struct smc_link *lnk);
-int smc_ib_get_memory_region(struct ib_pd *pd, int access_flags,
- struct ib_mr **mr);
int smc_ib_ready_link(struct smc_link *lnk);
int smc_ib_modify_qp_rts(struct smc_link *lnk);
int smc_ib_modify_qp_reset(struct smc_link *lnk);
--
2.10.2
^ 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