Received: by 2002:ab2:23c8:0:b0:1f2:fdbc:cb93 with SMTP id a8csp243273lqe; Wed, 27 Mar 2024 04:42:40 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVV8tKvbWbydiVzEZfSJKLbwRJfBRn1x8U8n1dFP+QtJJLwBVKUmOniGM98HqsuVJR4fOsyHArUAUBkot/FRFe8M4ktv50xtiyvcLfJeA== X-Google-Smtp-Source: AGHT+IGjidVQHf4taoMdV/flnHvOQVLJZEkbhory8hJf5z7fN2AVbbaloDP02GtQTAtzTo9NOsnn X-Received: by 2002:a05:6870:169c:b0:222:12dc:8af7 with SMTP id j28-20020a056870169c00b0022212dc8af7mr2263936oae.59.1711539760225; Wed, 27 Mar 2024 04:42:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711539760; cv=pass; d=google.com; s=arc-20160816; b=slJ5SxIak3GBh7eus6mdg1Tu7FwTgxrc2lZMY3DMzuFtCFgn7ZCbTd5ZDPlDwS1DD0 fhrpbN1V44Ilk0AaSCLTjboJYO1G+sMkM2Uh7SRCXfqAxd/BZKvKxsjqBKoC1KC1Rs6q EyR9ifPi4dQBsgzFdaf5MpV5OVBsMKLVagOAegqFV+oWJ4nvws89/CO9u4I495HgXCMH 87ugGlDerIaUXPmpztjB6m7+KU2lg9FuvUMUi3uVB2qgGtUVhxchjKtExGlCPEmlPo5H kGZqYsxOg6aK1d+l4LljNHoZ3o2qpakW4Y7XrfjM+Zh6D3WVqTLkzdq+MCykaHBiCgHB lo0Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=UgBAmGa0xTUagxwLDTjgPxO9yR714D/ocgy+2OQSpwk=; fh=Ka986yHZpNRw5ouviFo0VN+pOYOLtWNA2V8fyQsl9XU=; b=l4eSMXtq6x8frfFO5M9VwWANyD7gBDf22t59e4F9AckHSy0KVnY7C8xgZe3ADvG2+E n+wMXEAIAutLLq64L6IkJ1xP8Tkn3zs+8lGdTZVW/ermoIL4t2MDGWAo+1hvLbr9A3Rr 239eisZwrMaK2+bWZbBrqJ1aXmVUPZUCS+q7ArffxpfL9JQ2Bwl43Jd4WSdJ1R9w2ElZ 735r6YPIePTWQsxNvyphe95W69qiswHo79OTBd9lobtMPSxOIhsEclFlxgaWnsJkJwQ/ ERJndUxvORwlIiKAuSLs9mKdrFWcrUL+TBLSoP/pIXGKAo9jFUfFvxiVANXZoW1Qycf5 oJVw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=Q0ba12QM; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-120766-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-120766-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id w2-20020ac87e82000000b0043148fa2816si8201910qtj.676.2024.03.27.04.42.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 04:42:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-120766-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=Q0ba12QM; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-120766-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-120766-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 7B8E01C28F96 for ; Wed, 27 Mar 2024 11:42:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5E7431292FD; Wed, 27 Mar 2024 11:41:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="Q0ba12QM" Received: from lelv0142.ext.ti.com (lelv0142.ext.ti.com [198.47.23.249]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 71AF3127B63; Wed, 27 Mar 2024 11:41:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.23.249 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711539694; cv=none; b=GkUDpC3CM3Oc2H1kKq7pRwFjWG1fLHqHfbhROvNk4rSAIBLZsS8yO/vJwdDlibbyw60m2SKRJphyjVyQibtsMGfojHZ1rnLPJ3ydSnwUIGHT2YBvx/3sLrDYANhxrbdDQoJCpUx9aFOmCsH6C136jJh7uNIXiqX6IHEM2UMkVow= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711539694; c=relaxed/simple; bh=8S10TShbK7NVAgLMK/uY9/tW32bHuspxRSfeBNPPsco=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=c30C/ZTEdt/Z8f3ky1BlTnUgr8J4JfEq/HzoGvg8Qv90NOWZa6lUyKw0XE4QQ/aliBCYL7Itu7+2F2iIzOqHq62TjrbBiEgix0+3X5+/YNt1efZqslCPFle/0weNsQKKjYGI86OQsl40K80I1hIbTxJ+qlzaU1sReB6WiGLnHYQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com; spf=pass smtp.mailfrom=ti.com; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b=Q0ba12QM; arc=none smtp.client-ip=198.47.23.249 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ti.com Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 42RBewSo017493; Wed, 27 Mar 2024 06:40:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1711539658; bh=UgBAmGa0xTUagxwLDTjgPxO9yR714D/ocgy+2OQSpwk=; h=From:To:CC:Subject:Date; b=Q0ba12QM9msCoeqNEJe1rvaBYe8/NCsMp/T37zM6pTKdAFEr50bUdSrHG8LKS/z38 dAkCS6ihFRSY+PZV0qWbKCeq1Hc4Hie5k5FTviO3lwbbdALezkITtru3RBKeOFFDyD ETT2Mes3D8EeBffACT945IdTscJVeDbRElsIW/Fw= Received: from DLEE109.ent.ti.com (dlee109.ent.ti.com [157.170.170.41]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 42RBew2w010203 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 27 Mar 2024 06:40:58 -0500 Received: from DLEE108.ent.ti.com (157.170.170.38) by DLEE109.ent.ti.com (157.170.170.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Wed, 27 Mar 2024 06:40:57 -0500 Received: from fllvsmtp8.itg.ti.com (10.64.41.158) by DLEE108.ent.ti.com (157.170.170.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Wed, 27 Mar 2024 06:40:58 -0500 Received: from fllv0122.itg.ti.com (fllv0122.itg.ti.com [10.247.120.72]) by fllvsmtp8.itg.ti.com (8.15.2/8.15.2) with ESMTP id 42RBevBc002603; Wed, 27 Mar 2024 06:40:57 -0500 Received: from localhost (danish-tpc.dhcp.ti.com [10.24.69.25]) by fllv0122.itg.ti.com (8.14.7/8.14.7) with ESMTP id 42RBev9E025437; Wed, 27 Mar 2024 06:40:57 -0500 From: MD Danish Anwar To: Diogo Ivo , Rob Herring , Dan Carpenter , Jan Kiszka , Simon Horman , Andrew Lunn , Wolfram Sang , Arnd Bergmann , Vignesh Raghavendra , Vladimir Oltean , Roger Quadros , MD Danish Anwar , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" CC: , , , , Subject: [PATCH net-next v3 0/3] Introduce switch mode support for ICSSG driver Date: Wed, 27 Mar 2024 17:10:51 +0530 Message-ID: <20240327114054.1907278-1-danishanwar@ti.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 This series adds support for switch-mode for ICSSG driver. This series also introduces helper APIs to configure firmware maintained FDB (Forwarding Database) and VLAN tables. These APIs are later used by ICSSG driver in switch mode. Now the driver will boot by default in dual EMAC mode. When first ICSSG interface is added to bridge driver will still be in EMAC mode. As soon as second ICSSG interface is added to same bridge, switch-mode will be enabled and switch firmwares will be loaded to PRU cores. The driver will remain in dual EMAC mode if ICSSG interfaces are added to two different bridges or if two differnet interfaces (One ICSSG, one other) is added to the same bridge. We'll only enable is_switch_mode flag when two ICSSG interfaces are added to same bridge. We start in dual MAC mode. Let's say lan0 and lan1 are ICSSG interfaces ip link add name br0 type bridge ip link set lan0 master br0 At this point, we get a CHANGEUPPER event. Only one port is a member of the bridge, so we will still be in dual MAC mode. ip link set lan1 master br0 We get a second CHANGEUPPER event, the second interface lan1 is also ICSSG interface so we will set the is_switch_mode flag and when interfaces are brought up again, ICSSG switch firmwares will be loaded to PRU Cores. There are some other cases to consider as well. ip link add name br0 type bridge ip link add name br1 type bridge ip link set lan0 master br0 ip link set ppp0 master br0 Here we are adding lan0 (ICSSG) and ppp0 (non ICSSG) to same bridge, as they both are not ICSSG, we will still be running in dual EMAC mode. ip link set lan1 master br1 ip link set vpn0 master br1 Here we are adding lan1 (ICSSG) and vpn0 (non ICSSG) to same bridge, as they both are not ICSSG, we will still be running in dual EMAC mode. This is v2 of the series [1]. It addresses commenst made on v1 [1]. Changes from v2 [2] to v3: *) Dropped RFC tag. *) Used ether_addr_copy() instead of manually copying mac address using for loop in patch 1/3 as suggested by Andrew Lunn *) Added helper API icssg_fdb_setup() in patch 1/3 to reduce code duplication as suggested by Andrew Lunn *) In prueth_switchdev_stp_state_set() removed BR_STATE_LEARNING as learning without forwarding is not supported by ICSSG firmware. *) Used ether_addr_equal() wherever possible in patch 2/3 as suggested by Andrew Lunn *) Fixed typo "nit: s/prueth_switchdevice_nb/prueth_switchdev_nb/" in patch 2/3 as suggested by Simon Horman *) Squashed "#include "icssg_mii_rt.h" to patch 2/3 from patch 3/3 as suggested by Simon Horman *) Rebased on latest net-next/main. Changes from v1 to v2: *) Removed TAPRIO support patch from this series. *) Stopped using devlink for enabling switch-mode as suggested by Andrew L *) Added read_poll_timeout() in patch 1 / 3 as suggested by Andrew L. [1] https://lore.kernel.org/all/20230830110847.1219515-4-danishanwar@ti.com/ [2] https://lore.kernel.org/all/20240118071005.1514498-1-danishanwar@ti.com/ Thanks and Regards, Md Danish Anwar MD Danish Anwar (3): net: ti: icssg-prueth: Add helper functions to configure FDB net: ti: icssg-switch: Add switchdev based driver for ethernet switch support net: ti: icssg-prueth: Add support for ICSSG switch firmware drivers/net/ethernet/ti/Kconfig | 1 + drivers/net/ethernet/ti/Makefile | 3 +- drivers/net/ethernet/ti/icssg/icssg_config.c | 306 ++++++++++- drivers/net/ethernet/ti/icssg/icssg_config.h | 26 + drivers/net/ethernet/ti/icssg/icssg_prueth.c | 199 +++++++- drivers/net/ethernet/ti/icssg/icssg_prueth.h | 36 ++ .../net/ethernet/ti/icssg/icssg_switchdev.c | 477 ++++++++++++++++++ .../net/ethernet/ti/icssg/icssg_switchdev.h | 13 + 8 files changed, 1048 insertions(+), 13 deletions(-) create mode 100644 drivers/net/ethernet/ti/icssg/icssg_switchdev.c create mode 100644 drivers/net/ethernet/ti/icssg/icssg_switchdev.h base-commit: 237bb5f7f7f55ec5f773469a974c61a49c298625 -- 2.34.1