Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp1382309lqt; Sat, 20 Apr 2024 12:29:37 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX20hc/BrEgJSWVyZps55prZ1NJ8W+Ebs/bLHuA4/Gzw8P2Vd2JvMmsNi+nEr+7HXvoitOFyAIQO52QvRn3wyGGavZBch+PUbLl/ZtrEw== X-Google-Smtp-Source: AGHT+IGQ8Psx3e9Ch8v5cjPB13AIr14AwBXmEkxTkiKG8S+nVxCCHbDprAr3xv716OTKn2UQvSsY X-Received: by 2002:a05:6a20:5653:b0:1a7:bc31:933b with SMTP id is19-20020a056a20565300b001a7bc31933bmr6664675pzc.47.1713641376890; Sat, 20 Apr 2024 12:29:36 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713641376; cv=pass; d=google.com; s=arc-20160816; b=EyT1VgHnQDjTQqngMz4uRNBLPcFix5/HaoJPpzL0bWJauih/HXnJwBf8T9zn82TdEw oKFm42fbEyr4DgrgbyeOmpkn5u6sGtmYQZkSz4ZYhFyfNeVLJ3CyU45ElJqRgfhQRdgV uj4o2H5Q7e/Q3wk4eRkINYNt/mFP11B2FtWjxirVpkYV4wNLU/pwdTnGtLcLFaJmFEj8 /lpN9bpnY3pdt/p3FfEt6YWAKqEJ2poljNIHSbxqBWwFR5PsO15F93r2os8wYjheWaNi TFG8cJniXjUzfwZA5az6U2h6hKWYWb67XD8NyBPXNUlQz96fiafA6rh8gMcqpU63bsz2 zgSA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:from :dkim-signature; bh=/SVCNcwkT5iB+P1u3v+0z0GuSWILpFtey4ZS94C/W5c=; fh=UQq7t8uvK2iUNO1MW2Ou8S2LAb+LVP9puPAKMbRd+Ns=; b=uO6NeO9uW9pNjVEO6z7fcbolo2FyrjE8ZkccwaWPgIuiy3B1QP341tQt6MADLpfhv3 xcJ5wnrL2IiBl5NPlatQXps6OyMf4giCUcGDzl8yGebJf1VYDQNpiy1EGgrYB4tIPSEf 6C9z2aKsS8OETfpnW+OTp0s4fKOoGBgXiIZA2tChFPGWzWyBDvLrUaus3lPADIiw7HlV NOQ/wx+EXoQh4wd+jAyGs5Na3/coznAly8t0Q2NRGV73x0Yyg1Ie5e19DwWRIVpH4PWJ 6aNjmb4gJdSEWXp7Wbde6p9cewDHVCIjDNZXggr3jYkrW2Pg6BvTSsnyW9j0PaKK2DzX Kxrg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=X071cx1Z; arc=pass (i=1 spf=pass spfdomain=microchip.com dkim=pass dkdomain=microchip.com dmarc=pass fromdomain=microchip.com); spf=pass (google.com: domain of linux-kernel+bounces-152357-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-152357-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microchip.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 32-20020a631360000000b005dc8914839bsi5175803pgt.5.2024.04.20.12.29.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 20 Apr 2024 12:29:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-152357-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=X071cx1Z; arc=pass (i=1 spf=pass spfdomain=microchip.com dkim=pass dkdomain=microchip.com dmarc=pass fromdomain=microchip.com); spf=pass (google.com: domain of linux-kernel+bounces-152357-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-152357-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microchip.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id B2756B20D03 for ; Sat, 20 Apr 2024 19:29:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D1911405EC; Sat, 20 Apr 2024 19:29:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="X071cx1Z" Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) (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 DB9C4205E00; Sat, 20 Apr 2024 19:29:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.154.123 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713641366; cv=none; b=A0Bm00pyeOo9FivIeel8TgOjuEEi5SaV0lsjcsMEefW++4H06y3awAbKitPELr2kwWRLjUiplIOmOTyVmbVy9TacW8azACRMKtKgZkJX4qkFDy2/GrPCe1Ah7BdUlRfBqSv8DvY601gD9IM9lmfTEdnJrATHzHTZhlwLfzVXD14= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713641366; c=relaxed/simple; bh=DPhpx3ogNvTeYIGyGZ1Z7G8Y4I9wQYO2ncB5m9y1fGM=; h=From:Subject:Date:Message-ID:MIME-Version:Content-Type:To:CC; b=NzoBsa8dCJJcYdvmk2eUckV1W780og5iYSZUgR1Dns0X0PA2Wx1cRGeQJLh8YjWcksnBwfRS/TxpJImkDWvdZwzblm48d2Vj7FJgDDFlqXb78PrO0pE/UY4aKB8KwfrpFhiXFoCeC4XpL53iuLX1tGahXncH96549rnuHrC8cyo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=X071cx1Z; arc=none smtp.client-ip=68.232.154.123 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1713641363; x=1745177363; h=from:subject:date:message-id:mime-version: content-transfer-encoding:to:cc; bh=DPhpx3ogNvTeYIGyGZ1Z7G8Y4I9wQYO2ncB5m9y1fGM=; b=X071cx1ZtLa9L1FXNxmsMrJdPjngFZ3T8QFtCt7TWI7JAPNk7+QSzPDd 64PDy/KlTpzkm88YIIyB5XezFQBwjiGuWQOyrIV2cwojt1TBxzoMcm4RK iz76fMI4irq7jr1YVX+5R72IbpnM8EWxiGUEP7oTA24Wrv7Dj2traLOZM d0YRccS+EldwwKUXhvrrRBhFg08u72iAAuac0YdE+QX1zpeBo4+hg+Q/o 3WxFTNZG9FO48PYYCagtPcacAJ5D4Kn6V1pt6l0aUjiji7Zy4RJ4up/26 y8PT151HDhCs5JW1xAlmS1KSkfK+VoyeRudvQ+V2Og2O2TxNQyrhXjGya w==; X-CSE-ConnectionGUID: SORlnsJnTTyKwP8vKnva5A== X-CSE-MsgGUID: T38QHzjBSBGSmRtFYPP18g== X-IronPort-AV: E=Sophos;i="6.07,217,1708412400"; d="scan'208";a="21911450" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa4.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 20 Apr 2024 12:29:22 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Sat, 20 Apr 2024 12:29:19 -0700 Received: from DEN-DL-M70577.microchip.com (10.10.85.11) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Sat, 20 Apr 2024 12:29:16 -0700 From: Daniel Machon Subject: [PATCH net-next v3 0/5] net: sparx5: add support for port mirroring Date: Sat, 20 Apr 2024 21:29:09 +0200 Message-ID: <20240420-port-mirroring-v3-0-0fe3ac52006d@microchip.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-B4-Tracking: v=1; b=H4sIAIUXJGYC/33NzQ6DIBAE4FcxnEvDjyjpqe/R9GDpqnsQzEKIj fHdS+jNQ4+TyXyzswiEENmt2RlBxojBl6AvDXPz4Cfg+C6ZKaFa0QrF10CJL0gUCP3Erey1kb0 ENw6sjFaCEbcKPpiHxD1siT1LM2NMgT71Kcva/1Bpz2iWXHAQxmkjRO+MuS/oKLgZ16sLS+Wy+ k+oQijRtcp29qVtdyaO4/gCS5W0pv0AAAA= To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Lars Povlsen , "Steen Hegelund" , , Russell King CC: , , , Horatiu Vultur , "Russell King (Oracle)" , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Vladimir Oltean , Yue Haibing , Daniel Machon X-Mailer: b4 0.14-dev This series adds support for port mirroring, and port mirroring stats, through tc matchall action FLOW_ACTION_MIRRED. The hardware has three independent mirroring probes. Each probe can be configured with a separate set of filtering conditions that must be fulfilled before traffic is mirrored. A mirror probe can have up to 64 source ports and a single monitor port. The direction of a mirror probe determines if rx or tx traffic is mirrored from the source port to the monitor port. To: David S. Miller To: Eric Dumazet To: Jakub Kicinski To: Paolo Abeni To: Lars Povlsen To: Steen Hegelund To: UNGLinuxDriver@microchip.com To: Russell King Cc: netdev@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Cc: Horatiu Vultur Cc: Russell King (Oracle) Cc: Uwe Kleine-König Cc: Vladimir Oltean Cc: Yue Haibing Signed-off-by: Daniel Machon --- Changes in v3: - Ditch do_div() (patch #3) to fix warning on hexagon arch, reported by intel bot - Link to v2: https://lore.kernel.org/r/20240418-port-mirroring-v2-0-20642868b386@microchip.com Changes in v2: - Fix clang build warning about uninitialized variable 'err' - Link to v1: https://lore.kernel.org/r/20240418-port-mirroring-v1-0-e05c35007c55@microchip.com --- Daniel Machon (5): net: sparx5: add new register definitions net: sparx5: add bookkeeping code for matchall rules net: sparx5: add port mirroring implementation net: sparx5: add the tc glue to support port mirroring net: sparx5: add support for matchall mirror stats drivers/net/ethernet/microchip/sparx5/Makefile | 3 +- .../net/ethernet/microchip/sparx5/sparx5_main.c | 3 + .../net/ethernet/microchip/sparx5/sparx5_main.h | 25 +++ .../ethernet/microchip/sparx5/sparx5_main_regs.h | 68 ++++++ .../net/ethernet/microchip/sparx5/sparx5_mirror.c | 235 +++++++++++++++++++++ .../ethernet/microchip/sparx5/sparx5_tc_matchall.c | 125 ++++++++++- 6 files changed, 449 insertions(+), 10 deletions(-) --- base-commit: 1c25fe9a044d5334153a3585754b26553f8287b9 change-id: 20240402-port-mirroring-81735171ecfa Best regards, -- Daniel Machon