From mboxrd@z Thu Jan 1 00:00:00 1970 From: Florian Fainelli Subject: Re: Representing cpu-port of a switch Date: Sun, 29 Apr 2018 14:36:55 -0700 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: andrew@lunn.ch, vivien.didelot@savoirfairelinux.com To: "sk.syed2" , netdev@vger.kernel.org, jayaram@xilinx.com, syeds@xilinx.com Return-path: Received: from mail-oi0-f52.google.com ([209.85.218.52]:43024 "EHLO mail-oi0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754073AbeD2VhB (ORCPT ); Sun, 29 Apr 2018 17:37:01 -0400 Received: by mail-oi0-f52.google.com with SMTP id p62-v6so5952533oie.10 for ; Sun, 29 Apr 2018 14:37:00 -0700 (PDT) In-Reply-To: Sender: netdev-owner@vger.kernel.org List-ID: On April 29, 2018 11:43:50 AM PDT, "sk=2Esyed2" wr= ote: >Hi, > Sorry if this has been discussed elsewhere=2E The relevant discussion >is here: https://www=2Espinics=2Enet/lists/netdev/msg407313=2Ehtml=2E > But I have few questions in addition to those answered above=2E We >have simple 3-port switch, with two ports(connected via phys to >external(front panel)) and one cpu port connected to the cpu via dmas=2E Sounds pretty standard so far=2E >Our switch doesn't do any tagging protocol=2E It simply forwards a frame >to cpu based on fdb entry=2E Any frame can only be received/transmitted >only by this internal port=2E Again, pretty standard=2E What you probably meant is that for host destine= d or initiated traffic you must use that internal port to egress/ingress fr= ames towards the other external ports=2E >Without tagging, we cant really use DSA, and hide the cpu/dsa port=2E So >if we expose this cpu port as a interface with fixed-phy >infrastructure does it create any problems? Well the fact that you don't have a tagging protocol does not really mean = you cannot use DSA=2E You could create your own tagging format which in you= r case could be as simple as keeping the prepended DMA packet descriptor an= d have the parsing of that descriptor be done in a DSA tagger driver=2E Not= that I would necessarily recommend that though, see below=2E DSA documentation says one >cannot open a socket on cpu/dsa port and send/receive traffic=2E Is it >fairly common to use internal/cpu port as a network interface- i=2Ee, >creating a socket and send/receive traffic? In the context of DSA, all external ports are represented by a network dev= ice=2E This means that the CPU/management port is only used to ingress/egre= ss frames that include the tag which either the switch hardware inserts on = its way to the host or conversely that the host must insert to have the swi= tch do the appropriate switching operation=2E If you do not use tags and yo= u still have a way to target specific external ports the same representatio= n should happen and you do not want to expose the internal port because it = will only be used to send/receive traffic from the external ports and it wi= ll not be used to send or receive traffic to itself (so to speak)=2E Just l= ike with DSA you should have the ability to create network devices that are= per-port and you can use the HW provided information to deliver packets to= the appropriate destination port, conversely send from the appropriate sou= rce port=2E >One problem is how to report back when network errors(like if both >front panel ports are disconnected, the expectation is to bring this >cpu port down?)=2E The CPU port should be considered always UP and the external ports must ha= ve proper link notifications in place through PHYLIB/PHYLINK preferably=2E = With link management in place the carrier state is properly managed and the= network stack won't send traffic from a port that is not UP=2E >We also need to offload all the switch configuration to switch-dev=2E So >the question is using switch-dev without DSA and representing a cpu >port as a normal network interface would be ok? Using switchdev without DSA is absolutely okay, see rocker and mlxsw, but = neither of those do represent their CPU/management port for the reasons out= lined above that it is only used to convey traffic to/from other ports that= have a proper network device representation=2E > >thanks >-syed Hello, --=20 Florian