From patchwork Sun Jul 8 09:15:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 10513051 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id F397860329 for ; Sun, 8 Jul 2018 09:16:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E20F72893C for ; Sun, 8 Jul 2018 09:16:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D4B0328961; Sun, 8 Jul 2018 09:16:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, MAILING_LIST_MULTI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0C64028948 for ; Sun, 8 Jul 2018 09:16:24 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 41NjWV2PGqzDr4m for ; Sun, 8 Jul 2018 19:16:22 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.b="qIolxsem"; dkim-atps=neutral X-Original-To: linux-mlxsw@lists.ozlabs.org Delivered-To: linux-mlxsw@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=mellanox.com (client-ip=40.107.0.43; helo=eur02-am5-obe.outbound.protection.outlook.com; envelope-from=idosch@mellanox.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.b="qIolxsem"; dkim-atps=neutral Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00043.outbound.protection.outlook.com [40.107.0.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41NjWJ2gZHzDr0d for ; Sun, 8 Jul 2018 19:16:12 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/3SXZZtCeTnzunLOaP7DdBveBvU/pX/IskdzK8VulqQ=; b=qIolxsemGVoua/Cv1OwsvziIiJI4y839PcG1fKErDWon7jmMCxm8BaIeRGGZX3tbf0kB8wsAybI2qPtjWd/3NAx5h9oR0HRHNUsgO1RR1b2Fnu0A7SvLgT7lFScqAP+0p8Sf8wBeBIXqFyIWmhBhn1L4jbdf2/AumIgBc0Po4bk= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=idosch@mellanox.com; Received: from splinter.mtl.com (193.47.165.251) by VI1PR0501MB2333.eurprd05.prod.outlook.com (2603:10a6:800:2c::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.930.19; Sun, 8 Jul 2018 09:16:01 +0000 From: Ido Schimmel To: linux-internal@mellanox.com Subject: [PATCH net-next mlxsw v2 4/4] mlxsw: spectrum_router: Optimize processing of VRRP MACs Date: Sun, 8 Jul 2018 12:15:38 +0300 Message-Id: <20180708091538.22068-5-idosch@mellanox.com> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180708091538.22068-1-idosch@mellanox.com> References: <20180708091538.22068-1-idosch@mellanox.com> MIME-Version: 1.0 X-Originating-IP: [193.47.165.251] X-ClientProxiedBy: DB6PR07CA0018.eurprd07.prod.outlook.com (2603:10a6:6:2d::28) To VI1PR0501MB2333.eurprd05.prod.outlook.com (2603:10a6:800:2c::22) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5d24dd54-4813-4ee6-959a-08d5e4b36ce6 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600053)(711020)(48565401081)(2017052603328)(7153060)(7193020); SRVR:VI1PR0501MB2333; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0501MB2333; 3:nAWZPvgA9GZ41Lb62alUNdaZNHJE33MfMih0ZbT3ltbJ5SV3b6EJRdGJ/joSFWxnZWdYpKEJoHr5N8DHS9z+di2sanFZZE3yzzKKc9cmhzw1QHXE4eXN6EKMHIBZKrDjfMnSHRlqvSKyhaGZxlpmF4IUHLTWE4ZuTWEWv6qfX1wwZvqEE0uSn6cCEifskStc2HQxpvJ4+UX2rr9x0nj+ShrVRK3XmZV2TdVZAoPeuiyWthcqNH8G0Wi3Xjjr54r9; 25:+iEH/nrhJq1X4DoImtChTPVJ1kPt7zU9P3MawZ/3YQcpKMyWDdTtnci6BHfZ7dol0GV/0Tx4KUZica1NZBKkfTLIJY6NMwaBMztIzihCeWDctNpShaaA3PZBYEAzOtqkrQ9dSbhuaev0d185Jy597qpmttKjIuGs9F1ipVHkXdBjnK+7XN5XHyiuSz6yPaPzIiNEP1CopcRezOFpdjW4A0bTIHhQociHK5RO5Wj+/LqGiLsz3IAZ+39mT0iWofAiZIKZd+RSWk8/n2KQHHFDX0d7025AX34qeBBmQekARj9rXB4ou6TRKZxf8w7/NDteZRA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Y229w1OY3M7zcwIepDqzKlwZ8NKI9/A+CAQa5AKg/AvEXNbVcV6bRhDhcJ8euQ== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(10201501046)(3231311)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(20161123560045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123558120)(6072148)(201708071742011)(7699016); SRVR:VI1PR0501MB2333; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0501MB2333; X-Forefront-PRVS: 0727122FC6 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(346002)(136003)(396003)(376002)(39860400002)(189003)(199004)(3846002)(81166006)(5660300001)(47776003)(81156014)(8676002)(6116002)(107886003)(316002)(16586007)(1076002)(34206002)(37006003)(6666003)(66066001)(36756003)(48376002)(26005)(6512007)(4326008)(50466002)(6636002)(25786009)(6306002)(16526019)(86362001)(52116002)(76176011)(51416003)(8936002)(6506007)(6486002)(53416004)(478600001)(2351001)(106356001)(305945005)(966005)(486006)(7736002)(446003)(476003)(105586002)(68736007)(2616005)(956004)(11346002)(2361001)(14444005)(386003)(2906002)(50226002)(53936002)(97736004); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0501MB2333; H:splinter.mtl.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR0501MB2333; 23:6cE+5Fr7nDsvPop34M3tVmj5MTDgS2h2d6SKGNb?= =?us-ascii?Q?RXut61gnEaZ0ckQnIq9uWCfPIRSlEnusMRCPvMrmmUT+hVXDEkMNYFIRe7cs?= =?us-ascii?Q?q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H4RvJtZCHWsgHsJSUy5Rukg50xAMXZzBBS2u/w4FQ/oGPdvU+tfGboy8fInlsJFk5OnJYidMjOV8L5sTa0AJMWjNyuFDqM8CoDFzD7AtIHbKlKxB4dITx2nCEK+2PpFfWWnZK+yTimetsGvrBylBvhN7bI3uqTCzo7TneollhUShxnSrjET0r2kLAN3A2h2yDbxK/yPUZTd8d+w1qYfqBWUn5WkxLrIMq6vDgVW7g/zOXQ8pkcAGPxuSXvjIF7mnHfe5HFIof3VmJWNbmlltumAy+l6OkZsQTtVLjSRwXONh9GpzwzVQzuNHWGpJgtw==; 5:yEjM+s8yMY96FT5VKgnuCZ1PyOJer4K8P/nfet8/mgPoNiTVFkad1qrUulWCqRjG+bbiCYxXML5Slqu0HvhDpRwErrfr/yPxAJSVFJXCPTJSoHopQFz67FfL6j1MG0Kux65e5skWG2yxC9tRvTuPDP6ePNa1k/+6Fgjr+S5VoKM=; 24:ZPGcs2xZxkMvG5prBSEGS0Doxf+s0YhFXK4QEBtgg43v0+wejlo1wgneauKYvZSoa2XTUwwf32BTTsDr7AttXymNO1N+z5Q1GJVJ3R0cli0= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR0501MB2333; 7:Vrf643aycmvaF+m1wmgmgw1/7Cj3DFSxp06tubuyt94G9641FhAIXrvU+QZPypHBn6J+jBrAOOWrM5jNUl+o+XrACYzgaR73r/ine0lcgN8iYPGYtkXsCMXNiQDycWgsJJNmKuBlUU85xMX+QKOvPxP77N4QY6vCZy4orf5l7v6MSxLSyGYh7bgjcG/kuFoeFSR4lWNAQMnWOWtfpoc/m8Y5J9DXuceJcho7oAORMGkXH0Kqzk0mqYRj4+JgS9Le X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2018 09:16:01.3327 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5d24dd54-4813-4ee6-959a-08d5e4b36ce6 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0501MB2333 X-BeenThere: linux-mlxsw@lists.ozlabs.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: mlxsw driver development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-mlxsw-bounces+patchwork-linux-mlxsw=patchwork.kernel.org@lists.ozlabs.org X-Virus-Scanned: ClamAV using ClamSMTP Hosts using a VRRP router send their packets with a destination MAC of the VRRP router which is of the following form [1]: IPv4 - 00-00-5E-00-01-{VRID} IPv6 - 00-00-5E-00-02-{VRID} Where VRID is the ID of the virtual router. Such packets are directed to the router block in the ASIC by an FDB entry that was added in the previous patch. However, in certain cases it is possible to skip this FDB lookup and send such packets directly to the router. This is accomplished by adding these special MAC addresses to the RIF cache. If the cache is hit, the packet will skip the L2 lookup and ingress the router with the RIF specified in the cache entry. 1. https://tools.ietf.org/html/rfc5798#section-7.3 Signed-off-by: Ido Schimmel --- Notes: v2: * Change wording * Note that VRRP fields are reserved for RIF types other than Sub-port, VLAN and FID * Consolidate mlxsw_sp_rif_vrrp_add and mlxsw_sp_rif_vrrp_del() into one function drivers/net/ethernet/mellanox/mlxsw/reg.h | 14 ++++++ .../net/ethernet/mellanox/mlxsw/spectrum_router.c | 52 ++++++++++++++++++++++ 2 files changed, 66 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlxsw/reg.h b/drivers/net/ethernet/mellanox/mlxsw/reg.h index 29c51ae91241..2ead028fbc19 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/reg.h +++ b/drivers/net/ethernet/mellanox/mlxsw/reg.h @@ -4343,6 +4343,20 @@ MLXSW_ITEM32(reg, ritr, if_swid, 0x08, 24, 8); */ MLXSW_ITEM_BUF(reg, ritr, if_mac, 0x12, 6); +/* reg_ritr_if_vrrp_id_ipv6 + * VRRP ID for IPv6 + * Note: Reserved for RIF types other than VLAN, FID and Sub-port. + * Access: RW + */ +MLXSW_ITEM32(reg, ritr, if_vrrp_id_ipv6, 0x1C, 8, 8); + +/* reg_ritr_if_vrrp_id_ipv4 + * VRRP ID for IPv4 + * Note: Reserved for RIF types other than VLAN, FID and Sub-port. + * Access: RW + */ +MLXSW_ITEM32(reg, ritr, if_vrrp_id_ipv4, 0x1C, 0, 8); + /* VLAN Interface */ /* reg_ritr_vlan_if_vid diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c index 1fbacfe10e02..e73112eb556c 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c @@ -6443,6 +6443,46 @@ static int mlxsw_sp_inetaddr_vlan_event(struct net_device *vlan_dev, return 0; } +static bool mlxsw_sp_rif_macvlan_is_vrrp4(const u8 *mac) +{ + u8 vrrp4[ETH_ALEN] = { 0x00, 0x00, 0x5e, 0x00, 0x01, 0x00 }; + u8 mask[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0x00 }; + + return ether_addr_equal_masked(mac, vrrp4, mask); +} + +static bool mlxsw_sp_rif_macvlan_is_vrrp6(const u8 *mac) +{ + u8 vrrp6[ETH_ALEN] = { 0x00, 0x00, 0x5e, 0x00, 0x02, 0x00 }; + u8 mask[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0x00 }; + + return ether_addr_equal_masked(mac, vrrp6, mask); +} + +static int mlxsw_sp_rif_vrrp_op(struct mlxsw_sp *mlxsw_sp, u16 rif_index, + const u8 *mac, bool adding) +{ + char ritr_pl[MLXSW_REG_RITR_LEN]; + u8 vrrp_id = adding ? mac[5] : 0; + int err; + + if (!mlxsw_sp_rif_macvlan_is_vrrp4(mac) && + !mlxsw_sp_rif_macvlan_is_vrrp6(mac)) + return 0; + + mlxsw_reg_ritr_rif_pack(ritr_pl, rif_index); + err = mlxsw_reg_query(mlxsw_sp->core, MLXSW_REG(ritr), ritr_pl); + if (err) + return err; + + if (mlxsw_sp_rif_macvlan_is_vrrp4(mac)) + mlxsw_reg_ritr_if_vrrp_id_ipv4_set(ritr_pl, vrrp_id); + else + mlxsw_reg_ritr_if_vrrp_id_ipv6_set(ritr_pl, vrrp_id); + + return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(ritr), ritr_pl); +} + static int mlxsw_sp_rif_macvlan_add(struct mlxsw_sp *mlxsw_sp, const struct net_device *macvlan_dev, struct netlink_ext_ack *extack) @@ -6462,6 +6502,11 @@ static int mlxsw_sp_rif_macvlan_add(struct mlxsw_sp *mlxsw_sp, if (err) return err; + err = mlxsw_sp_rif_vrrp_op(mlxsw_sp, rif->rif_index, + macvlan_dev->dev_addr, true); + if (err) + goto err_rif_vrrp_add; + /* Make sure the bridge driver does not have this MAC pointing at * some other port. */ @@ -6469,6 +6514,11 @@ static int mlxsw_sp_rif_macvlan_add(struct mlxsw_sp *mlxsw_sp, rif->ops->fdb_del(rif, macvlan_dev->dev_addr); return 0; + +err_rif_vrrp_add: + mlxsw_sp_rif_fdb_op(mlxsw_sp, macvlan_dev->dev_addr, + mlxsw_sp_fid_index(rif->fid), false); + return err; } void mlxsw_sp_rif_macvlan_del(struct mlxsw_sp *mlxsw_sp, @@ -6483,6 +6533,8 @@ void mlxsw_sp_rif_macvlan_del(struct mlxsw_sp *mlxsw_sp, */ if (!rif) return; + mlxsw_sp_rif_vrrp_op(mlxsw_sp, rif->rif_index, macvlan_dev->dev_addr, + false); mlxsw_sp_rif_fdb_op(mlxsw_sp, macvlan_dev->dev_addr, mlxsw_sp_fid_index(rif->fid), false); }