lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+V-a8uBoZ-vbJEkYdSBssgd+rG=ng6_JNpO5G4DtmLV409L0g@mail.gmail.com>
Date:   Thu, 26 Jul 2018 16:20:43 +0100
From:   "Lad, Prabhakar" <prabhakar.csengg@...il.com>
To:     Andrew Lunn <andrew@...n.ch>
Cc:     netdev <netdev@...r.kernel.org>
Subject: Re: [Query]: DSA Understanding

On Thu, Jul 26, 2018 at 3:08 PM, Andrew Lunn <andrew@...n.ch> wrote:
>> Yes I am using fixed phy on slave1, following is my dts:
>
> Posting the original DTS file is better, not the decompiled version.
>
My bad will take care of it next time.

>>
>>         ethernet@...84000 {
>>             compatible = "ti,dra7-cpsw", "ti,cpsw";
>>             ti,hwmods = "gmac";
>>             clocks = <0x124 0x125>;
>>             clock-names = "fck", "cpts";
>>             cpdma_channels = <0x8>;
>>             ale_entries = <0x400>;
>>             bd_ram_size = <0x2000>;
>>             mac_control = <0x20>;
>>             slaves = <0x2>;
>>             active_slave = <0x0>;
>>             cpts_clock_mult = <0x784cfe14>;
>>             cpts_clock_shift = <0x1d>;
>>             reg = <0x48484000 0x1000 0x48485200 0x2e00>;
>>             #address-cells = <0x1>;
>>             #size-cells = <0x1>;
>>             ti,no-idle;
>>             interrupts = <0x0 0x14e 0x4 0x0 0x14f 0x4 0x0 0x150 0x4
>> 0x0 0x151 0x4>;
>>             ranges;
>>             syscon = <0x8>;
>>             status = "okay";
>>             pinctrl-names = "default", "sleep";
>>             pinctrl-0 = <0x126 0x127>;
>>             pinctrl-1 = <0x128 0x129>;
>>             dual_emac;
>>             linux,phandle = <0x500>;
>>             phandle = <0x500>;
>
> So here is 0x500
>
>>
>>             mdio@...85000 {
>>                 compatible = "ti,cpsw-mdio", "ti,davinci_mdio";
>>                 #address-cells = <0x1>;
>>                 #size-cells = <0x0>;
>>                 ti,hwmods = "davinci_mdio";
>>                 bus_freq = <0xf4240>;
>>                 reg = <0x48485000 0x100>;
>>                 status = "okay";
>>                 pinctrl-names = "default", "sleep";
>>                 pinctrl-0 = <0x12a>;
>>                 pinctrl-1 = <0x12b>;
>>
>>                 ethernet-phy@1 {
>>                     reg = <0x1>;
>>                     linux,phandle = <0x12c>;
>>                     phandle = <0x12c>;
>>                 };
>>             };
>>
>>             slave@...80200 {
>>                 mac-address = [00 00 00 00 00 00];
>>                 status = "okay";
>>                 phy-handle = <0x12c>;
>>                 phy-mode = "rgmii";
>>                 dual_emac_res_vlan = <0x1>;
>>             };
>>
>>             slave@...80300 {
>>                 mac-address = [00 00 00 00 00 00];
>>                 status = "okay";
>>                 phy-mode = "rgmii";
>>                 dual_emac_res_vlan = <0x2>;
>>                 linux,phandle = <0xf3>;
>>                 phandle = <0xf3>;
>
> This is the actual interface you are using and it has a phandle of
> 0xf3.
>
The dsa of_find_net_device_by_node() looks for ethernet device node,
but the above node is for the cpsw slave. I tried adding 0xf3 and got
probe defer,
that is the reason I added 0x500 (mdio) reference to cpu switch and
patched to pick
up eth1 instead of eth0.

>>
>>                 fixed-link {
>>                     speed = <0x3e8>;
>>                     full-duplex;
>>                 };
>>             };
>>
>>             cpsw-phy-sel@...02554 {
>>                 compatible = "ti,dra7xx-cpsw-phy-sel";
>>                 reg = <0x4a002554 0x4>;
>>                 reg-names = "gmii-sel";
>>             };
>>         };
>>
>>         spi@...ba000 {
>>             compatible = "ti,omap4-mcspi";
>>             reg = <0x480ba000 0x200>;
>>             interrupts = <0x0 0x2b 0x4>;
>>             #address-cells = <0x1>;
>>             #size-cells = <0x0>;
>>             ti,hwmods = "mcspi4";
>>             ti,spi-num-cs = <0x1>;
>>             dmas = <0xb2 0x46 0xb2 0x47>;
>>             dma-names = "tx0", "rx0";
>>             status = "okay";
>>             ti,pindir-d0-out-d1-in;
>>
>>             ksz9477@0 {
>>                 compatible = "microchip,ksz9477";
>>                 reg = <0x0>;
>>                 spi-max-frequency = <0x2dc6c00>;
>>                 spi-cpha;
>>                 spi-cpol;
>>
>>                 ports {
>>                     #address-cells = <0x1>;
>>                     #size-cells = <0x0>;
>>
>>                     port@0 {
>>                         reg = <0x0>;
>>                         label = "lan0";
>>                     };
>>
>>                     port@1 {
>>                         reg = <0x1>;
>>                         label = "lan1";
>>                     };
>>
>>                     port@2 {
>>                         reg = <0x2>;
>>                         label = "lan2";
>>                     };
>>
>>                     port@3 {
>>                         reg = <0x3>;
>>                         label = "lan3";
>>                     };
>>
>>                     port@4 {
>>                         reg = <0x4>;
>>                         label = "lan4";
>>                     };
>>
>>                     port@5 {
>>                         reg = <0x5>;
>>                         label = "cpu";
>>                         ethernet = <0x500>;
>
> So here you are pointing to the container node, not the actual
> interface. You talk of having to patch DSA. That i would say is
> wrong. You should be using the phandle of the actual interface.
>
As mentioned due to above reason. agreed  the patch is wrong.

>>                     };
>>
>>                     port@6 {
>>                         reg = <0x6>;
>>                         label = "lan6";
>>                     };
>>                 };
>>             };
>>         };
>>
>> Where port 6 of ksz9897 chip is connected to slave 1 (eth1) of cpsw
>> via rgmii interface. Following is the dmesg log:
>>
>> [    2.596958] Microchip KSZ9477 dsa-0.0:00: attached PHY driver
>> [Microchip KSZ9477] (mii_bus:phy_addr=dsa-0.0:00, irq=POLL)
>> [    2.714959] Microchip KSZ9477 dsa-0.0:01: attached PHY driver
>> [Microchip KSZ9477] (mii_bus:phy_addr=dsa-0.0:01, irq=POLL)
>> [    2.832958] Microchip KSZ9477 dsa-0.0:02: attached PHY driver
>> [Microchip KSZ9477] (mii_bus:phy_addr=dsa-0.0:02, irq=POLL)
>> [    2.950960] Microchip KSZ9477 dsa-0.0:03: attached PHY driver
>> [Microchip KSZ9477] (mii_bus:phy_addr=dsa-0.0:03, irq=POLL)
>> [    3.068958] Microchip KSZ9477 dsa-0.0:04: attached PHY driver
>> [Microchip KSZ9477] (mii_bus:phy_addr=dsa-0.0:04, irq=POLL)
>> [    3.080953] Generic PHY dsa-0.0:06: attached PHY driver [Generic
>> PHY] (mii_bus:phy_addr=dsa-0.0:06, irq=POLL)
>
> You might also need a fixed-link for the cpu port of the switch.
>
> What do the statistics counters show? Is it trying to send/receiver
> frames out eth1? Are bad frames received? Maybe you need to set rgmii
> delays?
>
Yes I can see the statistics, I was sending dhcp requests from the
devices connected on lan0 and lan4 ports.

~$ ifconfig
eth0      Link encap:Ethernet  HWaddr C4:F3:12:08:FE:7E
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:102

eth1      Link encap:Ethernet  HWaddr C4:F3:12:08:FE:7F
          inet6 addr: fe80::c6f3:12ff:fe08:fe7f%lo/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:879 errors:0 dropped:0 overruns:0 frame:0
          TX packets:171 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:389836 (380.6 KiB)  TX bytes:23128 (22.5 KiB)

lan0      Link encap:Ethernet  HWaddr C4:F3:12:08:FE:7F
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:660 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:336530 (328.6 KiB)  TX bytes:0 (0.0 B)

lan3      Link encap:Ethernet  HWaddr C4:F3:12:08:FE:7F
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lan4      Link encap:Ethernet  HWaddr C4:F3:12:08:FE:7F
          inet6 addr: fe80::c6f3:12ff:fe08:fe7f%lo/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:219 errors:0 dropped:0 overruns:0 frame:0
          TX packets:85 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:36605 (35.7 KiB)  TX bytes:11732 (11.4 KiB)

~$

I am bit confused on how dsa needs to be actually working,
Q's
1] should I be running a dhcp server on eth1 (where switch is connected)
    so that devices connected on lan* devices get an ip ?

2] From the device where switch is connected if the cpu port wants to send
   any data to any other user ports lan* how do i do it (just open
socket on eth1 or lan*) ?
   I wrote a simple C code to dump some data onto port with lan0 but
couldn’t see
   anything on the device where lan0 is connected (using tcpdump).

  I also tried sending data from lan0 to lan4 but I couldnt see
anything on tcpdump
  but I can ping lan0 and lan4. (I have set lan0 and lan4 as local link only)

3] What is the ideal setup for dsa to work

Cheers,
--Prabhakar

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ