From patchwork Mon May 5 16:26:30 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 887981 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 38FE4268C6B; Mon, 5 May 2025 16:26:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746462399; cv=none; b=Z7XhNW/ESaw5IvH0mDVSMCRAEgjCPhfADo6s1FR/BTfh4+aamyLGz76uXv0mbezlSudEvlE2Qr4aoyhKFc1JeO43zSjmiab5+fE9D2Wf4RaOngtlA+Xjr06i0E6RG3uV/1Zs3aD6Jc6vGhNvQh6UN3zv7pdZXwCwFHNlyf91+dQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746462399; c=relaxed/simple; bh=7EWkjNZqORDuh00BaGAtBZ8Z9eEoHrJNgufwJtmAgHo=; h=From:Subject:Date:Message-Id:MIME-Version:Content-Type:To:Cc; b=C7E390+yhIKzaoZJGkoR5zawytjbkVVpo5KhCOn2Rw2tVr0Js4bX/dWYvz4tHhKpsqhyJoAmLGXmzI8Bhpr625RbzOX5gU38E/ULvVi4hG0JANIkRtRZWCbWUEhgskv+SNlUCa0Vzl3ySgO3pX0QgK6vnHLSoAXNtNak//xyAMk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=mkMwFPOM; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="mkMwFPOM" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5562C4CEE4; Mon, 5 May 2025 16:26:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1746462398; bh=7EWkjNZqORDuh00BaGAtBZ8Z9eEoHrJNgufwJtmAgHo=; h=From:Subject:Date:To:Cc:From; b=mkMwFPOMGHy2yPXWNP2N8qMGjq5u86yYdRs34jlQsx7NzImbApiTvV364JefFJDM/ kIonsGsps6Bgvh66CuGXLorW7vhJHpJJ+KVei09gNYY1BZuE4JQaA63OlXXSTeTPPO 8YQm5okCBRAHu1Ygw6GI4K2osO9P4OyN+vLPNXNG2SfQxNXp4/SEi6uFPkcKyfdl5Y wLYrdAj0QiQVhSC9mmbzVGTsSTzevR8mAIIlui5hs9LSb/9vcYlwHuZbpirWtBE2Jc PfrYq3wgvFSEmrOx6t0YzSyQlrc/LoBLRBB+YQvNmcrOTUl8RR4UOWJTaW4Qk1PJmk LMXAdFiNdeyXg== From: Roger Quadros Subject: [PATCH net-next v2 0/9] net: ethernet: ti: am65-cpsw: add network flow classification support Date: Mon, 05 May 2025 19:26:30 +0300 Message-Id: <20250505-am65-cpsw-rx-class-v2-0-5359ea025144@kernel.org> Precedence: bulk X-Mailing-List: linux-omap@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIALbmGGgC/22NQQ6CMBBFr2Jm7ZihSg2uvIdhUegAjVjIDEEM4 e42uHX58vLfX0FZAivcDisIz0HDEBOY4wHqzsWWMfjEYMjkdKYc3cvmWI/6Rlmw7p0qWmuJbOO qwntIw1G4CcsefUDkCSMvE5TJdEGnQT7725zt/hfOin/hOUNCUzWePV0vBfH9yRK5Pw3SQrlt2 xcktMa+vwAAAA== To: Siddharth Vadapalli , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Russell King , danishanwar@ti.com Cc: srk@ti.com, linux-omap@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Roger Quadros X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=3406; i=rogerq@kernel.org; h=from:subject:message-id; bh=7EWkjNZqORDuh00BaGAtBZ8Z9eEoHrJNgufwJtmAgHo=; b=owEBbQKS/ZANAwAIAdJaa9O+djCTAcsmYgBoGOa6/XierbiFdsMm+5FAvoZm/hNU9EL+54M96 q4tZnA63c2JAjMEAAEIAB0WIQRBIWXUTJ9SeA+rEFjSWmvTvnYwkwUCaBjmugAKCRDSWmvTvnYw kzywEADO4LGU1jAn4j7kr7/fyix3iZTpJ7RavRdX5o/jSxotSFpLNCaZnDTRelWFnIMWy9kC0SQ xwWSCBQo7tvFKwdIv47ewW9J6K9aP50urI3XcgJy5gXb/+J2mN9rnADzLu9Fa+vGhH8q5VeG+nd PcbG64lMPUne0Sm7HqwcLFaW6bs0yFMibEZJxSgmQWNOp5oMq8tBfr/7XdfjD2azeJZyR0A7ZfV B4Rrqs40BqsQKycyLpWfBn5i1hPL9CTWj7OnaFC+JNz7x47rOAQEYDUJLGWdZmXThvU9i5K2B4D 3/PCgZwrQS04NyQkbG0r8FZIk0GukiGI/MHBA8ei+dUP6hkhAniqog7j+Bf6t9WGNhDzwQz/iL6 3cf/f0K5gI3nFQHz37GZT8jVjE9ifBwZ45GQNprRKSNlQ/bGxGRNWDeRKs91nRElJZCJcNrnP0R lKl0QXdL9B418Aps95cntS3TOJdC8X0E2y1DF+BXY4qszeFzlCIV2dQeaZ/m1niuFi/8g1qoWH8 h8JpgnlQEEvAUBZB1i5yteIMJjbSI/wjzDP7n6U8L+eg5F1perycm6wkPzna5ahN/xE8cRs25Ap cNFmPD0+633dj9xikTp+9vJIvulfosl7HhSwO0vuRcfua/GMMY1brh7qXVhZFoiaHlS32l2u9C4 sABUzrgGmZeE7RA== X-Developer-Key: i=rogerq@kernel.org; a=openpgp; fpr=412165D44C9F52780FAB1058D25A6BD3BE763093 Adds support for -N/--config-nfc ethtool command for configuring RX classfiers. Currently only raw Ethernet (flow-type ether) matching is added based on source/destination addresses and VLAN Priority (PCP). The ALE policer engine is used to perform the matching and routing to a specific RX channel. Test cases: Increase number of RX channels to 8 ip link set end1 down ip link set end0 down ethtool -L end0 rx 8 1) Ether source address test ethtool -N end0 flow-type ether src xx:yy:zz:aa:bb:cc action 5 Traffic from that address should route to channel 5 2) Ether destination address test ethtool -N eth0 flow-type ether dst yy:zz:aa:bb:cc:dd action 4 Traffic to that address should route to channel 4 3) Drop test ethtool -N end0 flow-type ether src xx:yy:zz:aa:bb:cc action -1 Traffic from that address should be dropped 4) VLAN PCP test on Remote create VLAN with ID 5 and all traffic mapping to required priority to test. e.g. 7 sudo ip link add link eno1 name eno1.5 type vlan id 5 egress-qos-map 0:7 1:7 2:7 3:7 4:7 5:7 6:7 7:7 sudo ifconfig eno1.5 192.168.10.1 on DUT create VLAN with id 5 ip link add link end0 name end0.5 type vlan id 5 ifconfig end0.5 192.168.10.5 VLAN pcp 7 vid 5 route to RX channel 6 ethtool -N end0 flow-type ether vlan 0xe005 action 6 Traffic from that VLAN with PCP 7 should route to channel 6 Signed-off-by: Roger Quadros --- Changes in v2: - Error out if VLAN_ID > 0 as VLAN ID based flow routing still doesn't seem to work. Drop commented out code. - Limit lines to 80 characters whereever possible. - Change struct am65_cpsw_rxnfc_rule.location from int to unsigned int. - Add information about order of rules evaluation and multiple matches in commit log. - Link to v1: https://lore.kernel.org/r/20250319-am65-cpsw-rx-class-v1-0-2bfded07490e@kernel.org --- Roger Quadros (9): net: ethernet: ti: cpsw_ale: Update Policer fields for more ALE size/ports net: ethernet: ti: cpsw_ale: return ALE index in cpsw_ale_add_vlan() net: ethernet: ti: cpsw_ale: return ALE index in cpsw_ale_vlan_add_modify() net: ethernet: ti: cpsw_ale: return ALE index in cpsw_ale_add_ucast() net: ethernet: ti: cpsw_ale: add cpsw_ale_policer_reset_entry() net: ethernet: ti: cpsw_ale: add cpsw_ale_policer_set/clr_entry() net: ethernet: ti: cpsw_ale: add policer save restore for PM sleep net: ethernet: ti: am65-cpsw: add network flow classification support net: ethernet: ti: am65-cpsw: remove cpsw_ale_classifier_setup_default() drivers/net/ethernet/ti/am65-cpsw-ethtool.c | 355 ++++++++++++++++++++++++++ drivers/net/ethernet/ti/am65-cpsw-nuss.c | 32 ++- drivers/net/ethernet/ti/am65-cpsw-nuss.h | 16 ++ drivers/net/ethernet/ti/am65-cpsw-switchdev.c | 6 +- drivers/net/ethernet/ti/cpsw.c | 4 +- drivers/net/ethernet/ti/cpsw_ale.c | 214 ++++++++++------ drivers/net/ethernet/ti/cpsw_ale.h | 37 ++- drivers/net/ethernet/ti/cpsw_new.c | 4 +- drivers/net/ethernet/ti/cpsw_switchdev.c | 6 +- 9 files changed, 581 insertions(+), 93 deletions(-) --- base-commit: 836b313a14a316290886dcc2ce7e78bf5ecc8658 change-id: 20250305-am65-cpsw-rx-class-666006fab9dd Best regards,