From patchwork Wed Jul 12 11:03:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wojciech Drewek X-Patchwork-Id: 13310103 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 AA28F3FFE for ; Wed, 12 Jul 2023 11:05:13 +0000 (UTC) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 266BB1FDB for ; Wed, 12 Jul 2023 04:05:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689159907; x=1720695907; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=IL77i0aNCpws1wKBl0ewdlRnKcbl/Ue98o+c0g+oBqc=; b=f+lyHYZmX06/pgJhcqtMPBIa0N+CJjUHA01x7nY+E/FljlA/+waltp0x A3ffM2IWk0wLMSjf+9e9p7/h6DQojYyTgyTP5Z0H/5KXPvVBTXlOCp8Ac 7DMaUQOO4TjXE2UgxuxvSOh7WvuTl99QZ7KKnOtbnTb6Xq4W/lvtRf4vb XYVpTVPu/H7NKIO471rMi9QTVuNejdoE+XPOar8rnIjkCsWGVDTu1AbY9 idYe9b1zEMMDTg4s1d7IW2vA/I9c06kmTBJKKbe863ZAqRr/ZitEhnEQm b8JqYU7edN2on0rmiv6rJCIpP8XUa6YEl4nw2sptqMC3rsgeW0D7n53Qd A==; X-IronPort-AV: E=McAfee;i="6600,9927,10768"; a="430993749" X-IronPort-AV: E=Sophos;i="6.01,199,1684825200"; d="scan'208";a="430993749" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jul 2023 04:04:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10768"; a="835093732" X-IronPort-AV: E=Sophos;i="6.01,199,1684825200"; d="scan'208";a="835093732" Received: from irvmail002.ir.intel.com ([10.43.11.120]) by fmsmga002.fm.intel.com with ESMTP; 12 Jul 2023 04:04:56 -0700 Received: from rozewie.igk.intel.com (rozewie.igk.intel.com [10.211.8.69]) by irvmail002.ir.intel.com (Postfix) with ESMTP id CA67A34966; Wed, 12 Jul 2023 12:04:54 +0100 (IST) From: Wojciech Drewek To: intel-wired-lan@lists.osuosl.org Cc: netdev@vger.kernel.org, kuba@kernel.org, david.m.ertman@intel.com, michal.swiatkowski@linux.intel.com, marcin.szycik@linux.intel.com, pawel.chmielewski@intel.com, sridhar.samudrala@intel.com, pmenzel@molgen.mpg.de, simon.horman@corigine.com, dan.carpenter@linaro.org, vladbu@nvidia.com Subject: [PATCH iwl-next v6 00/12] ice: switchdev bridge offload Date: Wed, 12 Jul 2023 13:03:25 +0200 Message-Id: <20230712110337.8030-1-wojciech.drewek@intel.com> X-Mailer: git-send-email 2.40.1 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Linux bridge provides ability to learn MAC addresses and vlans detected on bridge's ports. As a result of this, FDB (forward data base) entries are created and they can be offloaded to the HW. By adding VF's port representors to the bridge together with the uplink netdev, we can learn VF's and link partner's MAC addresses. This is achieved by slow/exception-path, where packets that do not match any filters (FDB entries in this case) are send to the bridge ports. Driver keeps track of the netdevs added to the bridge by listening for NETDEV_CHANGEUPPER event. We distinguish two types of bridge ports: uplink port and VF's representor port. Linux bridge always learns src MAC of the packet on rx path. With the current slow-path implementation, it means that we will learn VF's MAC on port repr (when the VF transmits the packet) and link partner's MAC on uplink (when we receive it on uplink from LAN). The driver is notified about learning of the MAC/VLAN by SWITCHDEV_FDB_{ADD|DEL}_TO_DEVICE events. This is followed by creation of the HW filter. The direction of the filter is based on port type (uplink or VF repr). In case of the uplink, rule forwards the packets to the LAN (matching on link partner's MAC). When the notification is received on VF repr then the rule forwards the packets to the associated VF (matching on VF's MAC). This approach would not work on its own however. This is because if one of the directions is offloaded, then the bridge would not be able to learn the other one. If the egress rule is added (learned on uplink) then the response from the VF will be sent directly to the LAN. The packet will not got through slow-path, it would not be seen on VF's port repr. Because of that, the bridge would not learn VF's MAC. This is solved by introducing guard rule. It prevents forward rule from working until the opposite direction is offloaded. Aging is not fully supported yet, aging time is static for now. The follow up submissions will introduce counters that will allow us to keep track if the rule is actually being used or not. A few fixes/changes are needed for this feature to work with ice driver. These are introduced in first 5 patches. Reviewed-by: Vlad Buslov --- v2: two patches were droped from the series: - "ice: Remove exclusion code for RDMA+SRIOV" was sent as separate patch: https://lore.kernel.org/netdev/20230516113055.7336-1-wojciech.drewek@intel.com/ - "ice: Ethtool fdb_cnt stats" was dropped because of the comments suggesting that ethtool is not a good option for such statistic. An alternative will be send as a separate patch. v3: small changes in patch 5, 7 and 8 including kdoc, style fixes. v4: split 1st patch in the series into 4 as Paul suggested v5: drop "ice: Accept LAG netdevs in bridge offloads" patch, it will go with LAG patchset, I kept dev_hold and dev_put since the discussion was not resolved v6: resolve Vlad's comments: delete FDB entries associated with deleted vlan, add missing vlan_ops calls when clearing pvid Marcin Szycik (2): ice: Add guard rule when creating FDB in switchdev ice: Add VLAN FDB support in switchdev mode Michal Swiatkowski (2): ice: implement bridge port vlan ice: implement static version of ageing Pawel Chmielewski (1): ice: add tracepoints for the switchdev bridge Wojciech Drewek (7): ice: Skip adv rules removal upon switchdev release ice: Prohibit rx mode change in switchdev mode ice: Don't tx before switchdev is fully configured ice: Disable vlan pruning for uplink VSI ice: Unset src prune on uplink VSI ice: Implement basic eswitch bridge setup ice: Switchdev FDB events support drivers/net/ethernet/intel/ice/Makefile | 2 +- drivers/net/ethernet/intel/ice/ice.h | 5 +- drivers/net/ethernet/intel/ice/ice_eswitch.c | 46 +- .../net/ethernet/intel/ice/ice_eswitch_br.c | 1308 +++++++++++++++++ .../net/ethernet/intel/ice/ice_eswitch_br.h | 120 ++ drivers/net/ethernet/intel/ice/ice_lib.c | 25 + drivers/net/ethernet/intel/ice/ice_lib.h | 1 + drivers/net/ethernet/intel/ice/ice_main.c | 4 +- drivers/net/ethernet/intel/ice/ice_repr.c | 2 +- drivers/net/ethernet/intel/ice/ice_repr.h | 3 +- drivers/net/ethernet/intel/ice/ice_switch.c | 150 +- drivers/net/ethernet/intel/ice/ice_switch.h | 6 +- drivers/net/ethernet/intel/ice/ice_trace.h | 90 ++ drivers/net/ethernet/intel/ice/ice_type.h | 1 + .../ethernet/intel/ice/ice_vf_vsi_vlan_ops.c | 186 +-- .../ethernet/intel/ice/ice_vf_vsi_vlan_ops.h | 4 + .../net/ethernet/intel/ice/ice_vsi_vlan_lib.c | 84 +- .../net/ethernet/intel/ice/ice_vsi_vlan_lib.h | 8 + .../net/ethernet/intel/ice/ice_vsi_vlan_ops.h | 1 + 19 files changed, 1860 insertions(+), 186 deletions(-) create mode 100644 drivers/net/ethernet/intel/ice/ice_eswitch_br.c create mode 100644 drivers/net/ethernet/intel/ice/ice_eswitch_br.h