Re: cascaded switch

2018-05-18 Thread Ran Shalit
On Fri, May 18, 2018 at 11:29 PM, Andrew Lunn  wrote:
>> Hi,
>>
>> I mean the same terminology used in marvell's switch.(I don't think
>> there is more than one terminology for this, please correct me if
>> wrong).
>> Anyway, I can see examples how it is done, but I don't understand the
>> benefit of this constellation, and why device tree needs to be
>> familiar with it.
>>
>> <   switch 1  >---port10port10- <  switch 2 >
>>  | | | | ||
>> port 1-9 |  port 1-9 |
>>  ||
>>  ||
>> --mdio--
>
> Your ASCII art is all messed up, but i get what you mean.
>
> This is the D in DSA. You would use this when a single switch does not
> have enough ports for your use case. So you use two switches.
>
> You need to tell each switch what links are used to get to other
> switches. There is an internal routing table. So you need to describe
> these links in device tree.
>

I understand, thanks,
So, it is used so that the 2 switch will behave as if it is one big switch.

Yet, how does it change the way the ports appears in "ifconfig" ?
Is it that if they were separate switch I wouldn't see incremental
numbers in "lanX" in ifconfig  (as is probably the result in cascaded
switch) ?

Regards,
ranran

>   Andrew


Re: cascaded switch

2018-05-18 Thread Ran Shalit
On Fri, May 18, 2018 at 10:13 PM, Andrew Lunn <and...@lunn.ch> wrote:
> On Fri, May 18, 2018 at 09:35:38PM +0300, Ran Shalit wrote:
>> Hello,
>>
>> I am trying to understand the concept of cascaded switch.
>> I haven't find much information on this topic.
>>
>> Can anyone please explain the general concept, when is it used, and
>> why does the device tree need to know about cascaded switch ?
>
> Hi Ran
>
> I think you first need to define what you mean by cascaded switches.
>
Hi,

I mean the same terminology used in marvell's switch.(I don't think
there is more than one terminology for this, please correct me if
wrong).
Anyway, I can see examples how it is done, but I don't understand the
benefit of this constellation, and why device tree needs to be
familiar with it.

<   switch 1  >---port10port10- <  switch 2 >
 | | | | ||
port 1-9 |  port 1-9 |
 ||
 ||
--mdio--

The term "cascaded switches" is also used in dsa documentation in device tree:
https://www.kernel.org/doc/Documentation/networking/dsa/dsa.txt


Regard,
Ranran

>   Andrew


cascaded switch

2018-05-18 Thread Ran Shalit
Hello,

I am trying to understand the concept of cascaded switch.
I haven't find much information on this topic.

Can anyone please explain the general concept, when is it used, and
why does the device tree need to know about cascaded switch ?

Thank you,
ranran


Re: DSA switch

2018-05-04 Thread Ran Shalit
On Fri, May 4, 2018 at 9:59 AM, Ran Shalit <ransha...@gmail.com> wrote:
> On Fri, May 4, 2018 at 12:05 AM, Andrew Lunn <and...@lunn.ch> wrote:
>>> I am using kernel 2.6.37, but I think it is not kernel issue, but more
>>> bad patches done on kernel.
>>> It is based on TI's kernel, but with some custom modifications on
>>> driver's switch, to make it work with TI's cpsw switch.
>>> Seems like someone made some bad patch, I'll continue investigating it.
>>> You can ignore the question...
>>>
>>> Many thanks a lot for the help,
>>> Ran
>>
>> There is no DSA driver for the cpsw. Are you just using the cpsw to
>> pass frames to a switch which is supported by DSA?
>>
>> In theory, mainline CPSW should just work for passing frames to an
>> external switch. So why not just use mainline?
>>
>
> It seems that the bridge functions OK,
> so I rather keep on working with it, instead of doing too many
> dramatically changes in the custom kernel of TI's which works with our
> chip (dm8148).
>
> Yet, I would like to ask about the bridge:
> Can a bridge also be used with dsa switch when ports are connected to
> different subnets ?
>
> Regards,
> Ran



I also see that there is no bridge function in /drivers/net/dsa files
in our kernel (2.6.37)
I can't find any reference to *bridge* or function used in bridge patch:
https://patchwork.ozlabs.org/patch/16578/

So, how is it that bridge worked in my system ?
Does it mean that it actually does the bridging not in the switch but
in the kernel ip stack ?

Thank you,
ran


Re: DSA switch

2018-05-04 Thread Ran Shalit
On Fri, May 4, 2018 at 12:05 AM, Andrew Lunn  wrote:
>> I am using kernel 2.6.37, but I think it is not kernel issue, but more
>> bad patches done on kernel.
>> It is based on TI's kernel, but with some custom modifications on
>> driver's switch, to make it work with TI's cpsw switch.
>> Seems like someone made some bad patch, I'll continue investigating it.
>> You can ignore the question...
>>
>> Many thanks a lot for the help,
>> Ran
>
> There is no DSA driver for the cpsw. Are you just using the cpsw to
> pass frames to a switch which is supported by DSA?
>
> In theory, mainline CPSW should just work for passing frames to an
> external switch. So why not just use mainline?
>

It seems that the bridge functions OK,
so I rather keep on working with it, instead of doing too many
dramatically changes in the custom kernel of TI's which works with our
chip (dm8148).

Yet, I would like to ask about the bridge:
Can a bridge also be used with dsa switch when ports are connected to
different subnets ?

Regards,
Ran


Re: DSA switch

2018-05-03 Thread Ran Shalit
On Thu, May 3, 2018 at 11:41 PM, Andrew Lunn <and...@lunn.ch> wrote:
> On Thu, May 03, 2018 at 11:35:08PM +0300, Ran Shalit wrote:
>> On Wed, May 2, 2018 at 11:56 PM, Andrew Lunn <and...@lunn.ch> wrote:
>> > On Wed, May 02, 2018 at 11:20:05PM +0300, Ran Shalit wrote:
>> >> Hello,
>> >>
>> >> Is it possible to use switch just like external real switch,
>> >> connecting all ports to the same subnet ?
>> >
>> > Yes. Just bridge all ports/interfaces together and put your host IP
>> > address on the bridge.
>>
>> I also noticed that even before making the bridge connection between
>> all "lanX" interfaces, the ports already communicates with each other
>
> That should not happen. They should be isolated.
>
> What kernel version are you using?
>

I am using kernel 2.6.37, but I think it is not kernel issue, but more
bad patches done on kernel.
It is based on TI's kernel, but with some custom modifications on
driver's switch, to make it work with TI's cpsw switch.
Seems like someone made some bad patch, I'll continue investigating it.
You can ignore the question...

Many thanks a lot for the help,
Ran


Re: DSA switch

2018-05-03 Thread Ran Shalit
On Wed, May 2, 2018 at 11:56 PM, Andrew Lunn <and...@lunn.ch> wrote:
> On Wed, May 02, 2018 at 11:20:05PM +0300, Ran Shalit wrote:
>> Hello,
>>
>> Is it possible to use switch just like external real switch,
>> connecting all ports to the same subnet ?
>
> Yes. Just bridge all ports/interfaces together and put your host IP
> address on the bridge.

I also noticed that even before making the bridge connection between
all "lanX" interfaces, the ports already communicates with each other
(ping between PCs connected to other ports work).
It is only that communication to cpu was not functioning, till I made
the bridge connection.

Is this the normal behavior (or is it that for some reason my switch
behaves different) ? I mean, is it usually by default "flat switch
except cpu" ?

Regards,
Ran


>
> Andrew


Re: DSA switch

2018-05-03 Thread Ran Shalit
On Thu, May 3, 2018 at 10:11 AM, Jiri Pirko <j...@resnulli.us> wrote:
> Thu, May 03, 2018 at 08:50:52AM CEST, ransha...@gmail.com wrote:
>>On Wed, May 2, 2018 at 11:56 PM, Andrew Lunn <and...@lunn.ch> wrote:
>>> On Wed, May 02, 2018 at 11:20:05PM +0300, Ran Shalit wrote:
>>>> Hello,
>>>>
>>>> Is it possible to use switch just like external real switch,
>>>> connecting all ports to the same subnet ?
>>>
>>> Yes. Just bridge all ports/interfaces together and put your host IP
>>> address on the bridge.
>>>
>>> Andrew
>>
>>
>>Hi,
>>
>>I get error on trying to add bridge.
>>I am trying to =understand which configuration is missing probably in my 
>>kernel,
>> I ran strace, but not sure , does it point to any missing configuration ?
>>
>>root@dm814x-evm:~# ip link add br0 type bridge
>
> Is the bridge module enabled in the kernel config?
>
>

Hi,

It seems that although the bridge command functions, it takes several
seconds (~6-7 seconds !) from the time it resturns to shell till a
real communication works (ping between 2 PCs connected to switch).
Does it usually takes so much time ?

Thank you,
ranran


Re: DSA switch

2018-05-03 Thread Ran Shalit
On Thu, May 3, 2018 at 10:11 AM, Jiri Pirko <j...@resnulli.us> wrote:
> Thu, May 03, 2018 at 08:50:52AM CEST, ransha...@gmail.com wrote:
>>On Wed, May 2, 2018 at 11:56 PM, Andrew Lunn <and...@lunn.ch> wrote:
>>> On Wed, May 02, 2018 at 11:20:05PM +0300, Ran Shalit wrote:
>>>> Hello,
>>>>
>>>> Is it possible to use switch just like external real switch,
>>>> connecting all ports to the same subnet ?
>>>
>>> Yes. Just bridge all ports/interfaces together and put your host IP
>>> address on the bridge.
>>>
>>> Andrew
>>
>>
>>Hi,
>>
>>I get error on trying to add bridge.
>>I am trying to =understand which configuration is missing probably in my 
>>kernel,
>> I ran strace, but not sure , does it point to any missing configuration ?
>>
>>root@dm814x-evm:~# ip link add br0 type bridge
>
> Is the bridge module enabled in the kernel config?
Yes, I've also added all configuration listed in
https://www.thelinuxfaq.com/355-rtnetlink-answers-operation-not-supported-on-centos
(we old kernel 2.6.37, which support TI's chip)

>
>
>>RTNETLINK answers: Operation not supported

I've managed doing it with brctl instead and it seems to work fine.
ifconfig lan0 0.0.0.0
ifconfig lan1 0.0.0.0
ifconfig lan2 0.0.0.0
ifconfig lan3 0.0.0.0
brctl addbr br0
brctl addif br0 lan0
brctl addif br0 lan1
brctl addif br0 lan2
brctl addif br0 lan3
ifconfig br0 150.42.40.222

Yet, brctl command seems to take  time (about a second till it
returns), and we have a requirement for fast boot,
So, I wander why " ip link add br0 type bridge" command gave those errors.
I also notice in the strace I've pasted here the following:
open("/usr/lib//ip/link_bridge.so", O_RDONLY) = -1 ENOENT (No such
file or directory)
There is really no such file in my filesystem /usr/lib//ip/link_bridge.so.
Why is it missing ?


Thank you,
ranran


Re: DSA switch

2018-05-03 Thread Ran Shalit
On Wed, May 2, 2018 at 11:56 PM, Andrew Lunn <and...@lunn.ch> wrote:
> On Wed, May 02, 2018 at 11:20:05PM +0300, Ran Shalit wrote:
>> Hello,
>>
>> Is it possible to use switch just like external real switch,
>> connecting all ports to the same subnet ?
>
> Yes. Just bridge all ports/interfaces together and put your host IP
> address on the bridge.
>
> Andrew


Hi,

I get error on trying to add bridge.
I am trying to =understand which configuration is missing probably in my kernel,
 I ran strace, but not sure , does it point to any missing configuration ?

root@dm814x-evm:~# ip link add br0 type bridge
RTNETLINK answers: Operation not supported

root@dm814x-evm:~# ./strace ip link add br0 type bridge
execve("/bin/ip", ["ip", "link", "add", "br0", "type", "bridge"], [/*
11 vars */]) = 0
brk(0)  = 0x44000
uname({sys="Linux", node="dm814x-evm", ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
0) = 0x400c1000
access("/etc/ld.so.preload", R_OK)  = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY)  = -1 ENOENT (No such file or directory)
open("/lib/tls/v7l/fast-mult/half/libresolv.so.2", O_RDONLY) = -1
ENOENT (No such file or directory)
stat64("/lib/tls/v7l/fast-mult/half", 0xbe8bb3c0) = -1 ENOENT (No such
file or directory)
open("/lib/tls/v7l/fast-mult/libresolv.so.2", O_RDONLY) = -1 ENOENT
(No such file or directory)
stat64("/lib/tls/v7l/fast-mult", 0xbe8bb3c0) = -1 ENOENT (No such file
or directory)
open("/lib/tls/v7l/half/libresolv.so.2", O_RDONLY) = -1 ENOENT (No
such file or directory)
stat64("/lib/tls/v7l/half", 0xbe8bb3c0) = -1 ENOENT (No such file or directory)
open("/lib/tls/v7l/libresolv.so.2", O_RDONLY) = -1 ENOENT (No such
file or directory)
stat64("/lib/tls/v7l", 0xbe8bb3c0)  = -1 ENOENT (No such file or directory)
open("/lib/tls/fast-mult/half/libresolv.so.2", O_RDONLY) = -1 ENOENT
(No such file or directory)
stat64("/lib/tls/fast-mult/half", 0xbe8bb3c0) = -1 ENOENT (No such
file or directory)
open("/lib/tls/fast-mult/libresolv.so.2", O_RDONLY) = -1 ENOENT (No
such file or directory)
stat64("/lib/tls/fast-mult", 0xbe8bb3c0) = -1 ENOENT (No such file or directory)
open("/lib/tls/half/libresolv.so.2", O_RDONLY) = -1 ENOENT (No such
file or directory)
stat64("/lib/tls/half", 0xbe8bb3c0) = -1 ENOENT (No such file or directory)
open("/lib/tls/libresolv.so.2", O_RDONLY) = -1 ENOENT (No such file or
directory)
stat64("/lib/tls", 0xbe8bb3c0)  = -1 ENOENT (No such file or directory)
open("/lib/v7l/fast-mult/half/libresolv.so.2", O_RDONLY) = -1 ENOENT
(No such file or directory)
stat64("/lib/v7l/fast-mult/half", 0xbe8bb3c0) = -1 ENOENT (No such
file or directory)
open("/lib/v7l/fast-mult/libresolv.so.2", O_RDONLY) = -1 ENOENT (No
such file or directory)
stat64("/lib/v7l/fast-mult", 0xbe8bb3c0) = -1 ENOENT (No such file or directory)
open("/lib/v7l/half/libresolv.so.2", O_RDONLY) = -1 ENOENT (No such
file or directory)
stat64("/lib/v7l/half", 0xbe8bb3c0) = -1 ENOENT (No such file or directory)
open("/lib/v7l/libresolv.so.2", O_RDONLY) = -1 ENOENT (No such file or
directory)
stat64("/lib/v7l", 0xbe8bb3c0)  = -1 ENOENT (No such file or directory)
open("/lib/fast-mult/half/libresolv.so.2", O_RDONLY) = -1 ENOENT (No
such file or directory)
stat64("/lib/fast-mult/half", 0xbe8bb3c0) = -1 ENOENT (No such file or
directory)
open("/lib/fast-mult/libresolv.so.2", O_RDONLY) = -1 ENOENT (No such
file or directory)
stat64("/lib/fast-mult", 0xbe8bb3c0)= -1 ENOENT (No such file or directory)
open("/lib/half/libresolv.so.2", O_RDONLY) = -1 ENOENT (No such file
or directory)
stat64("/lib/half", 0xbe8bb3c0) = -1 ENOENT (No such file or directory)
open("/lib/libresolv.so.2", O_RDONLY)   = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\234
\0\0004\0\0\0"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=67624, ...}) = 0
mmap2(NULL, 108588, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3,
0) = 0x40164000
mprotect(0x40174000, 28672, PROT_NONE)  = 0
mmap2(0x4017b000, 8192, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xf) = 0x4017b000
mmap2(0x4017d000, 6188, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x4017d000
close(3)= 0
open("/lib/libdl.so.2", O_RDONLY)   = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0l\n\0\0004\0\0\0"...,
512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=18080, ...}) = 

DSA switch

2018-05-02 Thread Ran Shalit
Hello,

Is it possible to use switch just like external real switch,
connecting all ports to the same subnet ?

In our architecture, we prefer that all IPs connected to board shall
be in the same subnet.

Yet, I am not sure if it is possible with dsa switch, because in dsa
the ports are seen in linux as separated interfaces. If we set all
interfaces to the same subnet, it will be problematic, because cpu
won't know in which interface to send output packets, Right ?

for example, can I use the following configuration ? Does it only
require to config ip address of lan0-lan3 ?

net mask 255.255.0.0
lan0 - 10.1.0.1  -- connected to PC 10.1.0.2
lan1 - 10.1.0.3
lan2 - 10.1.0.5
lan3 - 10.1.0.7 -- connected to PC 10.1.0.8

Thank you,
ranran


Re: Q: force netif ON even when there is no real link ?

2018-04-20 Thread Ran Shalit
On Fri, Apr 20, 2018 at 3:14 PM, Ran Shalit <ransha...@gmail.com> wrote:
> On Fri, Apr 20, 2018 at 3:05 PM, Andrew Lunn <and...@lunn.ch> wrote:
>> On Fri, Apr 20, 2018 at 03:01:09PM +0300, Ran Shalit wrote:
>>> On Fri, Apr 20, 2018 at 2:55 PM, Andrew Lunn <and...@lunn.ch> wrote:
>>> > On Fri, Apr 20, 2018 at 11:44:14AM +0300, Ran Shalit wrote:
>>> >> Hello,
>>> >>
>>> >> We configure external switch in u-boot.
>>> >> The configuration is through mdio (cpu is mac and switch is phy).
>>> >>
>>> >> But in Linux we rather not implement any communication in mdio to
>>> >> switch, but it means that we then don't have the information of link
>>> >> state.
>>> >>
>>> >> Is it possible to force in Linux (by default in startup) Ethernet
>>> >> connectivity (netif_carrier_on, netif_wake_queue) even if there is no
>>> >> information of real link state ?
>>> >
>>> > Hi Ran
>>> >
>>> > Use a fixed-phy.
>>> >
>>>
>>> Hi Andrew,
>>>
>>> I'll check about fixed phy,
>>> but in general, is it a problem to have always netif_carrier_on, even
>>> when there is no link ?
>>
>> The link between the CPU and the switch should be up all the
>> time. That is the point of fixed-link.
>>
>
> I understand.
> But what about the mac driver,  does it just do netif_start_queue ?
>

By saying "mac driver", I mean Ethernet driver with fixed phy.

Regards,
Ranran

> Thanks
>
>
>> Andrew


Re: Q: force netif ON even when there is no real link ?

2018-04-20 Thread Ran Shalit
On Fri, Apr 20, 2018 at 3:05 PM, Andrew Lunn <and...@lunn.ch> wrote:
> On Fri, Apr 20, 2018 at 03:01:09PM +0300, Ran Shalit wrote:
>> On Fri, Apr 20, 2018 at 2:55 PM, Andrew Lunn <and...@lunn.ch> wrote:
>> > On Fri, Apr 20, 2018 at 11:44:14AM +0300, Ran Shalit wrote:
>> >> Hello,
>> >>
>> >> We configure external switch in u-boot.
>> >> The configuration is through mdio (cpu is mac and switch is phy).
>> >>
>> >> But in Linux we rather not implement any communication in mdio to
>> >> switch, but it means that we then don't have the information of link
>> >> state.
>> >>
>> >> Is it possible to force in Linux (by default in startup) Ethernet
>> >> connectivity (netif_carrier_on, netif_wake_queue) even if there is no
>> >> information of real link state ?
>> >
>> > Hi Ran
>> >
>> > Use a fixed-phy.
>> >
>>
>> Hi Andrew,
>>
>> I'll check about fixed phy,
>> but in general, is it a problem to have always netif_carrier_on, even
>> when there is no link ?
>
> The link between the CPU and the switch should be up all the
> time. That is the point of fixed-link.
>

I understand.
But what about the mac driver,  does it just do netif_start_queue ?

Thanks


> Andrew


Re: Q: force netif ON even when there is no real link ?

2018-04-20 Thread Ran Shalit
On Fri, Apr 20, 2018 at 2:55 PM, Andrew Lunn <and...@lunn.ch> wrote:
> On Fri, Apr 20, 2018 at 11:44:14AM +0300, Ran Shalit wrote:
>> Hello,
>>
>> We configure external switch in u-boot.
>> The configuration is through mdio (cpu is mac and switch is phy).
>>
>> But in Linux we rather not implement any communication in mdio to
>> switch, but it means that we then don't have the information of link
>> state.
>>
>> Is it possible to force in Linux (by default in startup) Ethernet
>> connectivity (netif_carrier_on, netif_wake_queue) even if there is no
>> information of real link state ?
>
> Hi Ran
>
> Use a fixed-phy.
>

Hi Andrew,

I'll check about fixed phy,
but in general, is it a problem to have always netif_carrier_on, even
when there is no link ?

Thank you,
ranran


Q: force netif ON even when there is no real link ?

2018-04-20 Thread Ran Shalit
Hello,

We configure external switch in u-boot.
The configuration is through mdio (cpu is mac and switch is phy).

But in Linux we rather not implement any communication in mdio to
switch, but it means that we then don't have the information of link
state.

Is it possible to force in Linux (by default in startup) Ethernet
connectivity (netif_carrier_on, netif_wake_queue) even if there is no
information of real link state ?

Thank you,
ranran


Re: marvell switch

2018-04-10 Thread Ran Shalit
On Thu, Apr 5, 2018 at 11:46 PM, Andrew Lunn  wrote:
>> > Hi Ran
>> >
>> > The Marvell driver makes each port act like a normal Linux network
>> > interface. So if you want to enable a port, do
>> >
>> > ip link set lan0 up
>> >
>> > Want to add an ip address to a port
>> >
>> > ip addr add 10.42.42.42/24 dev lan0
>> >

I would please like to ask one more about it, if I may.
I thought I understood it all, but seems not.
The switch ports are connected to other PCs (except for one port which
is connected to cpu).
What is therefore the purpose of adding ip address to such ports (the
ip is configured externally in PC).

Thank you for the time,
ranran

>> > Want to bridge two ports
>> >
>> > ip link add name br0 type bridge
>> > ip link set dev br0 up
>> > ip link set dev lan0 master br0
>> > ip link set dev lan1 master br0
>> >
>> > Just treat them as normal interfaces.
>> >
>>
>> If I may please ask,
>> What is the purpose of using bridge for configuring switch interfaces.
>> Is it in order to isolate some ports from others?
>> I ask because according to my understanding the default configuration of
>> the driver is to enable switch in "flat" configuration, i.e. as if all
>> ports are connected to each other.
>
> Please think about what i said. They are standard Linux network
> interfaces. Do standard Linux network interfaces bridge themselves
> together by default? No, you need to configure a bridge.
>
>  Andrew


Re: marvell switch

2018-04-06 Thread Ran Shalit
On Thu, Apr 5, 2018 at 11:46 PM, Andrew Lunn  wrote:
>> > Hi Ran
>> >
>> > The Marvell driver makes each port act like a normal Linux network
>> > interface. So if you want to enable a port, do
>> >
>> > ip link set lan0 up
>> >
>> > Want to add an ip address to a port
>> >
>> > ip addr add 10.42.42.42/24 dev lan0
>> >
>> > Want to bridge two ports
>> >
>> > ip link add name br0 type bridge
>> > ip link set dev br0 up
>> > ip link set dev lan0 master br0
>> > ip link set dev lan1 master br0
>> >
>> > Just treat them as normal interfaces.
>> >
>>
>> If I may please ask,
>> What is the purpose of using bridge for configuring switch interfaces.
>> Is it in order to isolate some ports from others?
>> I ask because according to my understanding the default configuration of
>> the driver is to enable switch in "flat" configuration, i.e. as if all
>> ports are connected to each other.
>
> Please think about what i said. They are standard Linux network
> interfaces. Do standard Linux network interfaces bridge themselves
> together by default? No, you need to configure a bridge.
>
>  Andrew

I understand now...
Thank you very much.
ranran


Re: marvell switch

2018-04-05 Thread Ran Shalit
On Thu, Apr 5, 2018 at 3:22 PM, Andrew Lunn <and...@lunn.ch> wrote:
> On Thu, Apr 05, 2018 at 05:47:24AM +0300, Ran Shalit wrote:
>> Hello,
>>
>> I am trying to use marvell switch in linux,
>> Is it that the kernel drivers from marvell switch are used just to
>> enable all ports, or do they also provide APIs to userspace to enable
>> specific ports only.
>> I have not find examples or wiki for marvell switch, so I am not too
>> sure as what are the drivers meant for.
>
> Hi Ran
>
> The Marvell driver makes each port act like a normal Linux network
> interface. So if you want to enable a port, do
>
> ip link set lan0 up
>
> Want to add an ip address to a port
>
> ip addr add 10.42.42.42/24 dev lan0
>
> Want to bridge two ports
>
> ip link add name br0 type bridge
> ip link set dev br0 up
> ip link set dev lan0 master br0
> ip link set dev lan1 master br0
>
> Just treat them as normal interfaces.
>

Is there a wiki which explains switch configuration ?
What does it mean that they are treated as normal interfaces ?
Is it possible to open socket and send/recieve on switch ports (lan0
for example) ?
My understanding is that these ports are not treated the same as eth0
interface for example.

Thanks for the assistance,
ranran

>  Andrew


marvell switch

2018-04-04 Thread Ran Shalit
Hello,

I am trying to use marvell switch in linux,
Is it that the kernel drivers from marvell switch are used just to
enable all ports, or do they also provide APIs to userspace to enable
specific ports only.
I have not find examples or wiki for marvell switch, so I am not too
sure as what are the drivers meant for.

Thank you,
ranran


Reduce boot time till ping

2018-03-29 Thread Ran Shalit
Hello,

I'm struggling to understand why it takes a lot of time to boot till
we get ping success.
We use system with i210 , and igb driver.
I use dmesg for time measurement( and gpios to sync dmesg timing with
board power time)

This is dmesg with added prints for each IGB function enter and exit time:
https://drive.google.com/file/d/1Zdxp_fljawrzpuM4Q0at5YH6yOahoSse/view?usp=sharing

I see that driver use some watchdog to decide if link is up (as can be
seen in the above log), yet I don't understand why it takes so long
from kernel start till ping success.

Even when link is up it still take a long interval from link up till
ping success, as you can see in the log file.


I can't disable auto-negotiation because we need to use 1Gb.
Is there anything else I can do ?

Thank you,
ranran


Re: switchdev and dsa

2018-03-24 Thread Ran Shalit
On Sat, Mar 24, 2018 at 11:51 PM, Andrew Lunn <and...@lunn.ch> wrote:
> On Sat, Mar 24, 2018 at 11:35:38PM +0300, Ran Shalit wrote:
>> On Sat, Mar 24, 2018 at 10:02 PM, Andrew Lunn <and...@lunn.ch> wrote:
>> > On Sat, Mar 24, 2018 at 07:12:15PM +0300, Ran Shalit wrote:
>> >> Hello,
>> >>
>> >> I am new with switchdev and dsa.
>> >> I would please like to ask if configuring a device tree/board file
>> >> with a switch (for example marvell switch) will provide all ports
>> >> behins the switch as valid interface (ethX) ports in userspace
>> >> ifconfig command ?
>> >
>> > Hi Ranran
>> >
>> > Yes, that is the idea.
>> >
>>
>> I see that in marvell's switch, for example with managed cpu, all
>> ports are disabled.
>> Where in dsa driver the are the ports enabled ? I can't see it in
>> drivers. I use 88E6176.
>
> You need to explain in more detail what you mean by a port being
> enabled?
>

I see in DS that bits 0-1 in port control register (offset 0x4) are
responsible for port enabled/disabled in switch.
But now I think I understand how it works.
I do see that  mv88e6123_61_65_setup() , do set these bits 0-1 to '1'
 (00- disabled, 11- forwarding)

Yet, I would like to ask one more question about it.
I use older kernel (2.6), because these is the Linux from provider chip (TI).
I did not find any example how to configure marvell switch  in board
file, but only in device tree. (we use 88E6176, but any other switch
example would help).
Is there an example maybe for this which someone can provide ?

Thanks again,
ranran
> Andrew


Re: switchdev and dsa

2018-03-24 Thread Ran Shalit
On Sat, Mar 24, 2018 at 10:02 PM, Andrew Lunn <and...@lunn.ch> wrote:
> On Sat, Mar 24, 2018 at 07:12:15PM +0300, Ran Shalit wrote:
>> Hello,
>>
>> I am new with switchdev and dsa.
>> I would please like to ask if configuring a device tree/board file
>> with a switch (for example marvell switch) will provide all ports
>> behins the switch as valid interface (ethX) ports in userspace
>> ifconfig command ?
>
> Hi Ranran
>
> Yes, that is the idea.
>

I see that in marvell's switch, for example with managed cpu, all
ports are disabled.
Where in dsa driver the are the ports enabled ? I can't see it in
drivers. I use 88E6176.


> https://www.netdevconf.org/2.1/session.html?lunn_didelot_fainelli
>
> Andrew

Hi Andrew,

Thanks a lot for the information and slides.

Ranran


switchdev and dsa

2018-03-24 Thread Ran Shalit
Hello,

I am new with switchdev and dsa.
I would please like to ask if configuring a device tree/board file
with a switch (for example marvell switch) will provide all ports
behins the switch as valid interface (ethX) ports in userspace
ifconfig command ?

Thank you,
ranran


Re: Q: How to disable vlan strip in Intel igb driver ?

2016-05-01 Thread Ran Shalit
On Sun, May 1, 2016 at 11:51 PM, Peter PalĂșch  wrote:
> Hi Ran,
>
>
>> Alex,
>> I don't see rx-vlan-offload option in my ethtool. strange, maybe it is
>> not available in all ethtool versions ?
>
>
> According to my manpage for ethtool v4.5, the relevant -K option is
> "rxvlan".
>
>> Hi Peter,
>> Yes, I'm using AF_PACKET (I can't validate it now for 100%, but I
>> quite sure about it).
>
>
> Okay - but I assume that you are writing a userspace application, not a
> kernelspace driver or module, right?
>
>> I'm accessing the ethernet header, and it always gives me non extended
>> ethernet header (without vlan information).
>
>
> It seems that this behavior has been around for a long time, and is
> intentional. See the following thread for more information:
>
> http://www.spinics.net/lists/netdev/msg244668.html
>
> The only legit way of accessing VLAN tag info on an AF_PACKET socket I know
> about is by setting the PACKET_AUXDATA socket option, and reading the
> auxiliary data as a struct tpacket_auxdata using recvmsg().
>
> In addition, however, there seems to be a bug in the kernel in that the
> tp_vlan_tci member of the struct tpacket_auxdata is filled in only if the
> AF_PACKET socket is bound to htons(ETH_P_ALL). If the socket is bound to any
> other specific protocol, the tp_vlan_tci is set to 0. I have raised this
> issue recently in the following thread(s) but have not received a response
> yet:
>
> http://www.spinics.net/lists/netdev/msg372830.html
> http://www.spinics.net/lists/netdev/msg373112.html
>
>
>> I can see the vlan tag in vlan_tci field in sk_buff, but this is not
>> exactly what I need, I need the header AS-IS with the original
>> (extended) ethernet header.
>
>
> How are you accessing the vlan_tci field from your software?
>
> In any case, with AF_PACKET sockets, I am afraid you don't have much choice.
> Even libpcap reconstructs VLAN-tagged frames by reading the VLAN tag from an
> auxiliary structure and then re-inserting it into the frame, because the
> frame delivered through an AF_PACKET socket does not have the VLAN tag
> present anymore.
>

Hi Peter,

I have a patch (hook) in the igb (Intel) driver which reads the skb
buffer into our buffer, this is without using socket actually. ipstack
is not involved, so socket as
I mentioned before are not relevant (AF_PACKET not relevant).
the problem seems in the driver that the driver strip vlan information
(there is a lot of mention of strip and vlan in the igb driver, and I
tried many things, but still it always strip this information from the
data in the sk_buff.)
will ethtool assist in this case ? I don;t see any vlan option in my
ethtool. Does ethtool communicated with the driver and command it not
to strip the vlan info ?

Thanks,
Ran


Re: Q: How to disable vlan strip in Intel igb driver ?

2016-05-01 Thread Ran Shalit
>> Ran
>
> You should be able to turn off the offload by setting
> "rx-vlan-offload" to "off" via "ethtool -K".
>
> - Alex

Alex,
I don't see rx-vlan-offload option in my ethtool. strange, maybe it is
not available in all ethtool versions ?



On Sun, May 1, 2016 at 9:22 PM, Peter PalĂșch <peter.pal...@fri.uniza.sk> wrote:
> Ran,
>
> How are you accessing the VLAN tag information - and how do you know that
> the VLAN tag is not being passed through? Are you using AF_PACKET socket in
> your application?
>
> Best regards,
> Peter
>
>
Hi Peter,

Yes, I'm using AF_PACKET (I can't validate it now for 100%, but I
quite sure about it).
I'm accessing the ethernet header, and it always gives me non extended
ethernet header (without vlan information).
I can see the vlan tag in vlan_tci field in sk_buff, but this is not
exactly what I need, I need the header AS-IS with the original
(extended) ethernet header.

Thanks.
Ran
>
> On 01.05.2016 15:13, Ran Shalit wrote:
>>
>> Hello,
>>
>>
>> I am using intel igb driver in Linux.
>>
>> The driver strip the packet from vlan inofmation. But we need this
>> information in the packet.
>>
>> We tried to change build flag, or see if there is any feature with
>> ethtool that can disable this feature, but nothing helps.
>>
>>
>> Is there any way to achive this ?
>>
>> Regards,
>>
>> Ran
>
>


Q: How to disable vlan strip in Intel igb driver ?

2016-05-01 Thread Ran Shalit
Hello,


I am using intel igb driver in Linux.

The driver strip the packet from vlan inofmation. But we need this
information in the packet.

We tried to change build flag, or see if there is any feature with
ethtool that can disable this feature, but nothing helps.


Is there any way to achive this ?

Regards,

Ran


smc911 vs smsc911

2016-04-23 Thread Ran Shalit
Hello,

Does anyone can say what's the difference between smc911 and smsc911 ?

On reading the first comments in each file it seems that there is
overlapping between them:

smc911x.c

 * This is a driver for SMSC's LAN911{5,6,7,8} single-chip Ethernet devices.


smsc911x.c
===
 * Supported devices:
 *   LAN9115, LAN9116, LAN9117, LAN9118
 *   LAN9215, LAN9216, LAN9217, LAN9218
 *   LAN9210, LAN9211
 *   LAN9220, LAN9221
 *   LAN89218
 *
  */

Regards,
Ran