Re: Question on switchdev

2016-03-10 Thread Murali Karicheri
On 03/08/2016 07:39 PM, Andrew Lunn wrote:
>> Andrew,
>>
>> >From the high level, it looks like netcp switch meets the specifications
>> of a DSA hardware. Can you point me to a specific implementation that
>> I can use as an example to implement this for netcp?
> 
> You need two parts:
> 
> A tagging implementation, in net/dsa/tag_*.c. They are all pretty
> similar, and all pretty simple.
> 
> A switch driver. driver/net/dsa/mv88e6060.c is the simplest. I would
> suggest your first submission implements similar features as to what
> this driver does. This is very minimalistic, but a good start. Once
> that is accepted, you can incrementally add more features.
> 
>  Andrew
> 
Thanks Andrew!

-- 
Murali Karicheri
Linux Kernel, Keystone


Re: Question on switchdev

2016-03-08 Thread Andrew Lunn
> Andrew,
> 
> >From the high level, it looks like netcp switch meets the specifications
> of a DSA hardware. Can you point me to a specific implementation that
> I can use as an example to implement this for netcp?

You need two parts:

A tagging implementation, in net/dsa/tag_*.c. They are all pretty
similar, and all pretty simple.

A switch driver. driver/net/dsa/mv88e6060.c is the simplest. I would
suggest your first submission implements similar features as to what
this driver does. This is very minimalistic, but a good start. Once
that is accepted, you can incrementally add more features.

 Andrew


Re: Question on switchdev

2016-03-07 Thread Murali Karicheri
On 03/03/2016 05:32 PM, Murali Karicheri wrote:
> On 02/29/2016 05:29 PM, Andrew Lunn wrote:
>> On Mon, Feb 29, 2016 at 04:43:16PM -0500, Murali Karicheri wrote:
>>
>> Hi Murali
>>
>> Please can you get your email client to wrap lines at ~ 75 characters.
> Hi Andrew,
> 
> Thanks for responding. I have tried the instruction below and
> it doesn't seem to work for me. Do you know what will I have to
> set in thunderbird to do this?
> 
> http://arapulido.com/2009/12/01/enabling-line-wrapping-in-thunderbird/
> 
>>> TI Keystone netcp h/w has a switch. It has n slave ports and 1 host
>>> port. Currently the netcp driver disables the switch functionality
>>> which makes them appear as n nic ports. However we have requirement
>>> to add switch support in the driver. I have reviewed the
>>> experimental driver documentation
>>> Documentation/networking/switchdev.txt and would like to understand
>>> it better so that I can add this support to keystone netcp driver.
>>  
>>> NetCP h/w has a 1 (host port) x n (slave port) switch. It can do
>>> layer 2 forwarding between ports. In the switch mode, host driver
>>> provides the frame to the switch and switch uses the filter data
>>> base (AKA ALE table, Address Learning Engine table) to forward the
>>> packet. There is a piece of information available per frame (meta
>>> data) to decide if frame to be forwarded to a particular port or use
>>> the fdb for forward decisions.
>>
>> This makes is sound like a good fit for DSA.
>>
>> Documentation/networking/dsa/dsa.txt.
> 
> Let me check and get back to you on this and below after reading
> the above.
> 
> Murali
> 
>>
>> You probably need to implement a new tagging protocol in
>> net/dsa/tag_*.c and a driver in drivers/net/dsa/
>>
>>> 1. How does port netdev differ from regular netdev that carries data
>>>when registering netdev? Any example you can point to?
>>
>> They don't differ at all. You consider each port of the switch to be a
>> normal Linux interface.
>>
>>> 2. I assume port netdev will appear as an interface in ifconfig -a
>>>command and it is not assigned an IP address. Correct?
>>
>> The user can assign an address, if they want. It is a normal Linux
>> interface. They can also create a bridge, and add the interface to the
>> bridge. An advanced DSA driver will keep track of which interfaces are
>> in which bridge, and if possible, offload the bridge to the hardware.
>>
>>> 3. with 1xn switch, so we have n + 1 netdev registered with net
>>>core? I assume, only 1 netdev is for data plane and the rest are
>>>control plane. Is this correct?
>>
>> No. You only have netdev devices for the external ports of the
>> switch. The other port is known as the cpu port, and does not have a
>> netdev.
>>
>>> 4. We have bunch of port specific configuration that we would like
>>> to control or configure from use space using standard tools. For
>>> example, switch port state, flow control etc. Is that possible to
>>> add using this framework? ethtool update needed for this?
>>
>> The whole idea here is that the switch ports are normal Linux
>> interface. You use normal linux APIs to configure them. You probably
>> don't need to add any new features.
>>
>> One key things to get your head around. The switch is a hardware
>> accelerator for the Linux stack. You have to think how you can make
>> your switch accelerate the Linux stack. It takes people a while to get
>> this.
>>
>>   Andrew
>>
> 
> 
Andrew,

>From the high level, it looks like netcp switch meets the specifications
of a DSA hardware. Can you point me to a specific implementation that
I can use as an example to implement this for netcp?

-- 
Murali Karicheri
Linux Kernel, Keystone


Re: Question on switchdev

2016-03-03 Thread Murali Karicheri
On 02/29/2016 05:29 PM, Andrew Lunn wrote:
> On Mon, Feb 29, 2016 at 04:43:16PM -0500, Murali Karicheri wrote:
> 
> Hi Murali
> 
> Please can you get your email client to wrap lines at ~ 75 characters.
Hi Andrew,

Thanks for responding. I have tried the instruction below and
it doesn't seem to work for me. Do you know what will I have to
set in thunderbird to do this?

http://arapulido.com/2009/12/01/enabling-line-wrapping-in-thunderbird/

>> TI Keystone netcp h/w has a switch. It has n slave ports and 1 host
>> port. Currently the netcp driver disables the switch functionality
>> which makes them appear as n nic ports. However we have requirement
>> to add switch support in the driver. I have reviewed the
>> experimental driver documentation
>> Documentation/networking/switchdev.txt and would like to understand
>> it better so that I can add this support to keystone netcp driver.
>  
>> NetCP h/w has a 1 (host port) x n (slave port) switch. It can do
>> layer 2 forwarding between ports. In the switch mode, host driver
>> provides the frame to the switch and switch uses the filter data
>> base (AKA ALE table, Address Learning Engine table) to forward the
>> packet. There is a piece of information available per frame (meta
>> data) to decide if frame to be forwarded to a particular port or use
>> the fdb for forward decisions.
> 
> This makes is sound like a good fit for DSA.
> 
> Documentation/networking/dsa/dsa.txt.

Let me check and get back to you on this and below after reading
the above.

Murali

> 
> You probably need to implement a new tagging protocol in
> net/dsa/tag_*.c and a driver in drivers/net/dsa/
> 
>> 1. How does port netdev differ from regular netdev that carries data
>>when registering netdev? Any example you can point to?
> 
> They don't differ at all. You consider each port of the switch to be a
> normal Linux interface.
> 
>> 2. I assume port netdev will appear as an interface in ifconfig -a
>>command and it is not assigned an IP address. Correct?
> 
> The user can assign an address, if they want. It is a normal Linux
> interface. They can also create a bridge, and add the interface to the
> bridge. An advanced DSA driver will keep track of which interfaces are
> in which bridge, and if possible, offload the bridge to the hardware.
> 
>> 3. with 1xn switch, so we have n + 1 netdev registered with net
>>core? I assume, only 1 netdev is for data plane and the rest are
>>control plane. Is this correct?
> 
> No. You only have netdev devices for the external ports of the
> switch. The other port is known as the cpu port, and does not have a
> netdev.
> 
>> 4. We have bunch of port specific configuration that we would like
>> to control or configure from use space using standard tools. For
>> example, switch port state, flow control etc. Is that possible to
>> add using this framework? ethtool update needed for this?
> 
> The whole idea here is that the switch ports are normal Linux
> interface. You use normal linux APIs to configure them. You probably
> don't need to add any new features.
> 
> One key things to get your head around. The switch is a hardware
> accelerator for the Linux stack. You have to think how you can make
> your switch accelerate the Linux stack. It takes people a while to get
> this.
> 
>   Andrew
> 


-- 
Murali Karicheri
Linux Kernel, Keystone


Re: Question on switchdev

2016-02-29 Thread Andrew Lunn
On Mon, Feb 29, 2016 at 04:43:16PM -0500, Murali Karicheri wrote:

Hi Murali

Please can you get your email client to wrap lines at ~ 75 characters.

> TI Keystone netcp h/w has a switch. It has n slave ports and 1 host
> port. Currently the netcp driver disables the switch functionality
> which makes them appear as n nic ports. However we have requirement
> to add switch support in the driver. I have reviewed the
> experimental driver documentation
> Documentation/networking/switchdev.txt and would like to understand
> it better so that I can add this support to keystone netcp driver.
 
> NetCP h/w has a 1 (host port) x n (slave port) switch. It can do
> layer 2 forwarding between ports. In the switch mode, host driver
> provides the frame to the switch and switch uses the filter data
> base (AKA ALE table, Address Learning Engine table) to forward the
> packet. There is a piece of information available per frame (meta
> data) to decide if frame to be forwarded to a particular port or use
> the fdb for forward decisions.

This makes is sound like a good fit for DSA.

Documentation/networking/dsa/dsa.txt.

You probably need to implement a new tagging protocol in
net/dsa/tag_*.c and a driver in drivers/net/dsa/

> 1. How does port netdev differ from regular netdev that carries data
>when registering netdev? Any example you can point to?

They don't differ at all. You consider each port of the switch to be a
normal Linux interface.

> 2. I assume port netdev will appear as an interface in ifconfig -a
>command and it is not assigned an IP address. Correct?

The user can assign an address, if they want. It is a normal Linux
interface. They can also create a bridge, and add the interface to the
bridge. An advanced DSA driver will keep track of which interfaces are
in which bridge, and if possible, offload the bridge to the hardware.

> 3. with 1xn switch, so we have n + 1 netdev registered with net
>core? I assume, only 1 netdev is for data plane and the rest are
>control plane. Is this correct?

No. You only have netdev devices for the external ports of the
switch. The other port is known as the cpu port, and does not have a
netdev.

> 4. We have bunch of port specific configuration that we would like
> to control or configure from use space using standard tools. For
> example, switch port state, flow control etc. Is that possible to
> add using this framework? ethtool update needed for this?

The whole idea here is that the switch ports are normal Linux
interface. You use normal linux APIs to configure them. You probably
don't need to add any new features.

One key things to get your head around. The switch is a hardware
accelerator for the Linux stack. You have to think how you can make
your switch accelerate the Linux stack. It takes people a while to get
this.

  Andrew


Question on switchdev

2016-02-29 Thread Murali Karicheri
Hi Jiri, Scott, or other switchdev experts,

TI Keystone netcp h/w has a switch. It has n slave ports and 1 host port. 
Currently the netcp driver disables the switch functionality which makes them 
appear as n nic ports. However we have requirement to add switch support in the 
driver. I have reviewed the experimental driver documentation 
Documentation/networking/switchdev.txt and would like to understand it better 
so that I can add this support to keystone netcp driver.

NetCP h/w has a 1 (host port) x n (slave port) switch. It can do layer 2 
forwarding between ports. In the switch mode, host driver provides the frame to 
the switch and switch uses the filter data base (AKA ALE table, Address 
Learning Engine table) to forward the packet. There is a piece of information 
available per frame (meta data) to decide if frame to be forwarded to a 
particular port or use the fdb for forward decisions. I see following 
description in the above documentation.

===From Documentation/networking/switchdev.txt==
On switchdev driver initialization, the driver will allocate and register a 
struct net_device (using register_netdev()) for each enumerated physical switch 
port, called the port netdev.  A port netdev is the software representation of 
the physical port and provides a conduit for control traffic to/from the 
controller (the kernel) and the network, as well as an anchor point for higher 
level constructs such as bridges, bonds, VLANs, tunnels, and L3 routers.  Using 
standard netdev tools (iproute2, ethtool, etc), the port netdev can also 
provide to the user access to the physical properties of the switch port such 
as PHY link state and I/O statistics.
=

1. How does port netdev differ from regular netdev that carries data when 
registering netdev? Any example you can point to? 
2. I assume port netdev will appear as an interface in ifconfig -a command and 
it is not assigned an IP address. Correct?
3. with 1xn switch, so we have n + 1 netdev registered with net core? I assume, 
only 1 netdev is for data plane and the rest are control plane. Is this correct?
4. We have bunch of port specific configuration that we would like to control 
or configure from use space using standard tools. For example, switch port 
state, flow control etc. Is that possible to add using this framework? ethtool 
update needed for this?
5. This feature is marked as experimental. Hope having more drivers added to 
this switch dev framework can eventually get this out of experimental to 
regular status. Right?

I have more questions that I will defer for now. It would be great if I can 
work with you to implement this in netcp driver. Hope you can respond with your 
comment.

Thanks.
-- 
Murali Karicheri
Linux Kernel, Keystone