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-a8vdEicXXN_yiRgBfptHx5=_RgX3VjfqiOv+UQY3G3+9oQ@mail.gmail.com>
Date:   Thu, 26 Jul 2018 08:38:45 +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

Hi Andrew,

Thanks for the reply.

On Wed, Jul 25, 2018 at 5:19 PM, Andrew Lunn <andrew@...n.ch> wrote:
> On Wed, Jul 25, 2018 at 09:39:50AM +0100, Lad, Prabhakar wrote:
>> Hi,
>>
>> We are trying to integrate a MAC to an external switch as following:
>>
>> +-------------------+            +------------------+
>> |                    | RGMII   |                    |
>> |                    +------------+  KSZ9897   +------ 1000baseT MDI ("LAN1")
>> |                    | PORT 6 |  7-port         +------ 1000baseT MDI ("LAN2")
>> |    AM572x    |              |  Ethernet     +------ 1000baseT MDI ("LAN3")
>> |     CPSW     |MIImgmt |  switch        +------ 1000baseT MDI ("LAN4")
>> |                    +-------------+                  +------
>> 1000baseT MDI ("LAN5")
>> |                    |    SPI    |                    |
>> |                    |              |                   |
>> |                    |              |                   +------
>> 1000baseT MII ("LAN7")
>> |                    |              |                   |
>> +------------------+             +------------------+
>
> Please use a fixed size font, otherwise this is unreadable.
>
sorry about that, Ill take care of it henceforth.

>>
>> I have done all the configuration required for the MAC controller and
>> enabled the KSZ driver in the kernel, I can see the following:
>> ~$ ip link show
>> 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
>> mode DEFAULT group default qlen 1000
>>     link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
>> 2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state
>> DOWN mode DEFAULT group default qlen 1000
>
> eth0 is you master device. NO-CARRIER is bad, since that means you
> cannot send/receive from from the switch. Are you using a fixed phy on
> the CPSW? What does your device tree look like?
>

With my earlier post, the dsa was linking to eth0, which is incorrect
as the switch is connected to eth1.
I had to patch the dsa to pickup eth1 instead of eth0.

CPSW can support two ports internally one port is connected to KSZ9031
phy chip which is eth0 and the
other port is connected to KSZ9897 chip eth1, following is the ip link
dump with my patch applied.

~$ ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state
DOWN mode DEFAULT group default qlen 1000
    link/ether c4:f3:12:08:fe:7e brd ff:ff:ff:ff:ff:ff
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP
mode DEFAULT group default qlen 1000
    link/ether c4:f3:12:08:fe:7f brd ff:ff:ff:ff:ff:ff
4: sit0@...E: <NOARP> mtu 1480 qdisc noop state DOWN mode DEFAULT
group default qlen 1000
    link/sit 0.0.0.0 brd 0.0.0.0
5: lan0@...1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN
mode DEFAULT group default qlen 1000
    link/ether c4:f3:12:08:fe:7f brd ff:ff:ff:ff:ff:ff
6: lan1@...1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN
mode DEFAULT group default qlen 1000
    link/ether c4:f3:12:08:fe:7f brd ff:ff:ff:ff:ff:ff
7: lan2@...1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN
mode DEFAULT group default qlen 1000
    link/ether c4:f3:12:08:fe:7f brd ff:ff:ff:ff:ff:ff
8: lan3@...1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN
mode DEFAULT group default qlen 1000
    link/ether c4:f3:12:08:fe:7f brd ff:ff:ff:ff:ff:ff
9: lan4@...1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN
mode DEFAULT group default qlen 1000
    link/ether c4:f3:12:08:fe:7f brd ff:ff:ff:ff:ff:ff
10: lan6@...1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN
mode DEFAULT group default qlen 1000
    link/ether c4:f3:12:08:fe:7f brd ff:ff:ff:ff:ff:ff
~$

Yes I am using fixed phy on slave1, following is my dts:

        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>;

            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>;

                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>;
                    };

                    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)


Cheers,
--Prabhakar

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ