Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1701670yba; Thu, 25 Apr 2019 04:25:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqzbVTGo0Om52mWKZakAu0UW0dmOaoENGkKJTCVj5H8+ZYQpPocOhsHqlyLPMoKyiGOIqB/t X-Received: by 2002:aa7:8190:: with SMTP id g16mr39638817pfi.92.1556191509058; Thu, 25 Apr 2019 04:25:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556191509; cv=none; d=google.com; s=arc-20160816; b=k+QHfXPmGIKBXztFVycb6ocdnoTstFTNkrGq+XJFBA+6k5k6bFyADkZnNN91Zg1DpX FP5GjY9jHUCtOxhOy/zWoISXle4sA1mxW39M238TXjkzF9+Yyb17ONLnm/y3Bo4/SH/X O/Ok28z8GbbBu+/MLRDiyYTYoXbre6uAPS2SUpnQjJ+q2FP6f91XvqlaFQLDA9QntY/1 kQIXr6OzXVzacbP8Pap7aLQoAWrZmrE+hNFKNIBZsfJfjp7b8Klbf13MMRQId1WxEmi8 P9dIBYF2TF0NABtESkB0iKDpL7te7Fe4B7UnnhD30FrCE0ApGRIWIU+cY8uOs0fsDUMd vf6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=P6vZmZAFETt4Q0b+EePKmb0qxtoqnt3HQMJIynOtemo=; b=Lg0u5FmWry9ubnyYQrvEY7usjhEc7s08FNsMArPeXkO9dalWlGOFjn4soU48RarXq4 wi/BW4wzwmG40lJB3QWwn7vbcHwBKTrw8DdiBTLH0TaKEaWZokbjwycfAcHVmwb77Uej MkQjvpDbze3gtJXo9QZMCk+QfTKLb6FDjjrmtmhNmJKJkngeAnkewwzfS24/Jl3ajzcc 0KzrB4ElIy/FgxvBiLN+2zxKLsdnQtfxhvalwTTynAwL7/wDzFh0V8YaFWoRqA5mwZ1N 3x/r+zea3OsItS6G6uyIjfM8f1nCJ2LoKap5ceUMZCSpl92aQmsy4qivLtmq4d5L+6Ec Ct/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=w+25MVGM; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x24si4864057plr.207.2019.04.25.04.24.54; Thu, 25 Apr 2019 04:25:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=w+25MVGM; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387820AbfDXWYs (ORCPT + 99 others); Wed, 24 Apr 2019 18:24:48 -0400 Received: from fllv0015.ext.ti.com ([198.47.19.141]:41104 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727517AbfDXWYk (ORCPT ); Wed, 24 Apr 2019 18:24:40 -0400 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id x3OMOVsC020818; Wed, 24 Apr 2019 17:24:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1556144671; bh=P6vZmZAFETt4Q0b+EePKmb0qxtoqnt3HQMJIynOtemo=; h=From:To:CC:Subject:Date; b=w+25MVGMLx+UjE5iJe+dId9jpc/sRRJ79ttmvWvqJCMDBY58UIvvqzXmx18lsV1WT hQMqUBsBimNIyh2Lopa/qaSk5++pZf+m2I9uQZcsmdqoTuCvbVOelZZPeN+t9a59/o hzPprP4Ang4ZQkqoG73qJ4Evr+xXJLcQngfEn8Hs= Received: from DFLE111.ent.ti.com (dfle111.ent.ti.com [10.64.6.32]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x3OMOVPv110532 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 24 Apr 2019 17:24:31 -0500 Received: from DFLE113.ent.ti.com (10.64.6.34) by DFLE111.ent.ti.com (10.64.6.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Wed, 24 Apr 2019 17:24:31 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DFLE113.ent.ti.com (10.64.6.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Wed, 24 Apr 2019 17:24:31 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id x3OMOUTs060129; Wed, 24 Apr 2019 17:24:30 -0500 From: Grygorii Strashko To: , Ilias Apalodimas , Andrew Lunn , "David S . Miller" , Ivan Khoronzhuk , Jiri Pirko CC: Florian Fainelli , Sekhar Nori , , , Murali Karicheri , Ivan Vecera , Grygorii Strashko Subject: [RFC PATCH v3 net-next 00/11] net: ethernet: ti: introduce new cpsw switchdev based driver Date: Thu, 25 Apr 2019 01:24:16 +0300 Message-ID: <1556144667-27997-1-git-send-email-grygorii.strashko@ti.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi All, This series based on work [1][2] done by Ilias Apalodimas . This the RFC v3 which introduces new CPSW switchdev based driver which is operating in dual-emac mode by default, thus working as 2 individual network interfaces. When both interfaces joined the bridge - CPSW driver will enter a switch mode and discard dual_mac configuration. The CPSW will be switched back to dual_mac mode if any port leaves the bridge. All configuration is going to be implemented via switchdev API. patches #1 - 2: preparation patcces which also moves common code to cpsw_priv.c patch #3: Adds functions to ALE for modifying VLANs/MDBs. patch #4: Adds support of force untagged VLAN traffic to Host P0 port which required for proper support of default VLANs. patch #5: Prepares cpsw driver for switchdev mode, without changing any of the funtionality. patches #6-9: Introduce TI CPSW switch driver based on switchdev and new DT bindings, resolve build dependencies patch #10: CPSW switchdev driver documentation (tbd) patch #11: DT nodes for new CPSW switchdev driver added for DRA7/am571x-idk as and example. Most of the contents of the previous cover-letter have been added in new driver documentation, so please refer to that for configuration, testing and future work. These patches can be found at: git@git.ti.com:~gragst/ti-linux-kernel/gragsts-ti-linux-kernel.git branch: lkml-5.1-switch-tbd [1] Dependencies: This series depends on prerequisite series https://lkml.org/lkml/2019/4/23/476 [1] https://patchwork.ozlabs.org/cover/929367/ [2] https://patches.linaro.org/cover/136709/ Changes in v3: - alot of work done to split properly common code between legacy and switchdev CPSW drivers and clean up code - CPSW switchdev interface updated to the current LKML switchdev interface - actually new CPSW switchdev based driver introduced - optimized dual_mac mode in new driver. Main change is that in promiscuous mode P0_UNI_FLOOD (both ports) is enabled in addition to ALLMULTI (current port) instead of ALE_BYPASS. So, port in non promiscuous mode will keep possibility of mcast and vlan filtering. - changed bridge join sequnce: now switch mode will be enabled only when both ports joined the bridge. CPSW will be switched to dual_mac mode if any port leave bridge. ALE table is completly cleared and then refiled while switching to switch mode - this simplidies code a lot, but introduces some limitation to bridge setup sequence: ip link add name br0 type bridge ip link set dev br0 type bridge ageing_time 1000 ip link set dev br0 type bridge vlan_filtering 0 <- disable echo 0 > /sys/class/net/br0/bridge/default_vlan ip link set dev sw0p1 up <- add ports ip link set dev sw0p2 up ip link set dev sw0p1 master br0 ip link set dev sw0p2 master br0 echo 1 > /sys/class/net/br0/bridge/default_vlan <- enable ip link set dev br0 type bridge vlan_filtering 1 bridge vlan add dev br0 vid 1 pvid untagged self - STP tested with vlan_filtering 1/0. To make STP work I've had to set NO_SA_UPDATE for all slave ports (see comment in code). It also required to statically register STP mcast address {0x01, 0x80, 0xc2, 0x0, 0x0, 0x0}; - allowed build both TI_CPSW and TI_CPSW_SWITCHDEV drivers - PTP can be enabled on both ports in dual_mac mode - Future work: 1. port QDISC_CBS and QDISC_MQPRIO support 2. Add support for more Bridge flags and SWITCHDEV_ATTR 3. Add support for ageing configuration 4. More testing and documentation updates Issues: 1. I've not found that configuring VLANs on Bridge port itself bridge vlan add dev br0 vid 100 pvid untagged self does not allow to set PVID on Host P0 port. The only way to set it is to change default_vlan, introduces some mess in ALE table (also causes overwrite of already configfured PVID). bridge vlan add dev sw0p1 vid 100 pvid untagged master ip link set dev br0 type bridge vlan_filtering 0 echo 2 > /sys/class/net/br0/bridge/default_vlan ip link set dev br0 type bridge vlan_filtering 1 (but it could be our mess also:() 2. Are there any way to identify Bridge default_vlan while processing SWITCHDEV_OBJ_ID_PORT_VLAN?? Grygorii Strashko (7): net: ethernet: ti: cpts: use devm_get_clk_from_child net: ethernet: ti: cpsw: move set of common functions in cpsw_priv net: ethernet: ti: cpsw: allow untagged traffic on host port dt-bindings: net: ti: add new cpsw switch driver bindings net: ethernet: ti: cpsw: fix build of cpsw drivers phy: ti: phy-gmii-sel: dependency from ti cpsw-switchdev driver ARM: dts: am57xx-idk: add dt nodes for new cpsw switch dev driver Ilias Apalodimas (4): net: ethernet: ti: cpsw: ale: add functions to modify VLANs/MDBs net: ethernet: ti: cpsw: add switchdev API for cpsw driver net: ethernet: ti: cpsw: introduce cpsw switch driver based on switchdev Documentation: networking: add cpsw switchdev based driver documentation .../bindings/net/ti,cpsw-switch.txt | 117 + .../device_drivers/ti/cpsw_switchdev.txt | 159 ++ arch/arm/boot/dts/am571x-idk.dts | 28 + arch/arm/boot/dts/am57xx-idk-common.dtsi | 2 +- arch/arm/boot/dts/dra7-l4.dtsi | 53 + drivers/net/ethernet/ti/Kconfig | 20 +- drivers/net/ethernet/ti/Makefile | 2 + drivers/net/ethernet/ti/cpsw.c | 596 +----- drivers/net/ethernet/ti/cpsw_ale.c | 199 +- drivers/net/ethernet/ti/cpsw_ale.h | 15 + drivers/net/ethernet/ti/cpsw_new.c | 1891 +++++++++++++++++ drivers/net/ethernet/ti/cpsw_priv.c | 562 ++++- drivers/net/ethernet/ti/cpsw_priv.h | 51 +- drivers/net/ethernet/ti/cpsw_switchdev.c | 394 ++++ drivers/net/ethernet/ti/cpsw_switchdev.h | 22 + drivers/net/ethernet/ti/cpts.c | 2 +- drivers/phy/ti/Kconfig | 4 +- 17 files changed, 3521 insertions(+), 596 deletions(-) create mode 100644 Documentation/devicetree/bindings/net/ti,cpsw-switch.txt create mode 100644 Documentation/networking/device_drivers/ti/cpsw_switchdev.txt create mode 100644 drivers/net/ethernet/ti/cpsw_new.c create mode 100644 drivers/net/ethernet/ti/cpsw_switchdev.c create mode 100644 drivers/net/ethernet/ti/cpsw_switchdev.h -- 2.17.1