Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp2620720imw; Sun, 10 Jul 2022 10:52:01 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uycOy939iK6fwY7XQtprqk8ewEIstKDTCcgNV6MofYHcKiwDZ9aZTRCJwI2UJ9JK6s3EaY X-Received: by 2002:a17:907:1dda:b0:72b:31e2:905e with SMTP id og26-20020a1709071dda00b0072b31e2905emr10519511ejc.183.1657475521464; Sun, 10 Jul 2022 10:52:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1657475521; cv=pass; d=google.com; s=arc-20160816; b=ZFh/nvU/xClIRp4Em3MeA0s1aOC9KJWe+4LrIZbszxyg3BY4e3wK+XZXDfWNTx2t4J rx+3HVNP44scKXsUzDncsf1RDACgyX+xf2j+XxjcIQM4lBV8MnZddSPOnve2Nt/L5vCW uhTFiZNJH7hs6bXjMH+zA60aZjLFPV3haOBAFa6HkgV5c3y+DrUw8oDP81eIGoHu+POm oj6ABX+O8LKGliNZtijdoN5HvcWYzAZ+JUebS0xqreJ+hsGcn7UayzhkoaBsLpe3uap2 P3T74RNfGGEA/wDwq6wju/4z5fYCBBqy323VSEUbuyZuNorNt4lD+ExPCPuG6df50cA9 tYpA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=dzCyhfYaeB2Ek6YtCtB5Nv65Lr51KT4NBGbnV7kG3bk=; b=EphJqPLz1bc+M00KANC6GZtdICN6r7qbyfCPFlrqL1iU3mcR30ZeKO8/qdg//5TYfp 9GNnhlm3+rOLGJ6s9kqIi5yuN3ZPlREFizfqhsR0mmHPwwEGOfPBulm/DmXfS+RiFJsA yFK+PrVYI03SDkU4VArJGpI3OYpItAfAdF2pfbtUBXEGTT3PthbCf9onYrb1zakZg4pA 2XsT4uPut5y6QPZspr/j7vlbxlbd2Zy/MkOVrs65N1EqqYxrUy/d2I3CB98mMr37DxAh 9DPeJNHXfb/vDCg1YQC4wF1LIBKsHTBpRf2OYBj5Mk2YKVJ3kZ/ttVHVbmUiv8CSADXX th3g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@plvision.eu header.s=selector2 header.b=s76KtEPt; arc=pass (i=1 spf=pass spfdomain=plvision.eu dkim=pass dkdomain=plvision.eu dmarc=pass fromdomain=plvision.eu); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=plvision.eu Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v8-20020a056402348800b0043ac8673d94si5079250edc.614.2022.07.10.10.51.32; Sun, 10 Jul 2022 10:52:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@plvision.eu header.s=selector2 header.b=s76KtEPt; arc=pass (i=1 spf=pass spfdomain=plvision.eu dkim=pass dkdomain=plvision.eu dmarc=pass fromdomain=plvision.eu); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=plvision.eu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229564AbiGJRWi (ORCPT + 99 others); Sun, 10 Jul 2022 13:22:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229492AbiGJRWh (ORCPT ); Sun, 10 Jul 2022 13:22:37 -0400 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60113.outbound.protection.outlook.com [40.107.6.113]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12CA6BF63; Sun, 10 Jul 2022 10:22:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LGRGLWJdN91eAoCZYiw1kPQfc++GxmtELqW84kcXiv4HfxQyOxz2tux3/6xJyB3AuXWz9zxlN+xzUnsT5Ky23qM3ezsNCM0Oed/6tgqwkNXjaUMKLhS3DluQjeGiCRoC2wP95mmoud87hNwF/uUhESINzZeOf7g2wyWLG3XxzBeQAw2ZO13aBZd5yOlqlXTliMj696ydwjo6s2qSqy0drbl9p7di5Pp3FhKfa6ShNg03fq7ZW9iVi9oc5PlG+h6sKzGgBiQQOgOHkoeCtM5voHDqDmHr/zeO5iMDD5UOveipEb3FxkiCuCCiskE1Ituz5I00XNjoSEQPHazGFw8z0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=dzCyhfYaeB2Ek6YtCtB5Nv65Lr51KT4NBGbnV7kG3bk=; b=P8G97mAeQz0YefBxdMSng+23Augq92TyXrwOGSK+TNf2QpdbHqen1g7EA9eWdBcxBuPNx81uwvJKP3gsO8fRv+L7H8IiApp7PgDNbL9hdNUy77FVTD6o1pz3GlsjMp8QIzsQttuhGEK5jfbBS3P1561VKBzKaqktJrzbmPfVs8345eSMndmk2oio5Gd+grZ96o3pRK8Gm3JOjtXIsKbY+/Hc62798w96I+Qcnfk3/9HS8XJYyzNiv5X37Nk6DGdLTx/Qoxm+almWhaWCfLLfbVzzyp5NZNLj35hUzP4BLg0pScCOac/p5PlvOThREu3zBv5gqjW91S20ez/IOdTzOQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=plvision.eu; dmarc=pass action=none header.from=plvision.eu; dkim=pass header.d=plvision.eu; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=plvision.eu; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dzCyhfYaeB2Ek6YtCtB5Nv65Lr51KT4NBGbnV7kG3bk=; b=s76KtEPtmW/iAOZw68lFdSnqn36Iifo5ogkxul1HQR3eectWu7IkRvGkPYP5X7YiAEyqyENP2gWGna5+0EOP8BkID2PQvxpLwWyNHnILfsmqUjhEBWm/makfkvgK66jVXdEIQS+FZYrAdKEsy7mCuiit49+s8LHVVDqgpjixkEg= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=plvision.eu; Received: from PAXP190MB1789.EURP190.PROD.OUTLOOK.COM (2603:10a6:102:283::6) by AS8P190MB1109.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:2e7::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.21; Sun, 10 Jul 2022 17:22:31 +0000 Received: from PAXP190MB1789.EURP190.PROD.OUTLOOK.COM ([fe80::d521:ba19:29db:e42d]) by PAXP190MB1789.EURP190.PROD.OUTLOOK.COM ([fe80::d521:ba19:29db:e42d%3]) with mapi id 15.20.5417.025; Sun, 10 Jul 2022 17:22:31 +0000 From: Yevhen Orlov To: netdev@vger.kernel.org Cc: Volodymyr Mytnyk , Taras Chornyi , Mickey Rachamim , Serhiy Pshyk , Yevhen Orlov , Taras Chornyi , Oleksandr Mazur , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-kernel@vger.kernel.org Subject: [PATCH net-next 0/9] net: marvell: prestera: add nexthop routes offloading Date: Sun, 10 Jul 2022 20:21:58 +0300 Message-Id: <20220710172208.29851-1-yevhen.orlov@plvision.eu> X-Mailer: git-send-email 2.17.1 Content-Type: text/plain X-ClientProxiedBy: GV3P280CA0058.SWEP280.PROD.OUTLOOK.COM (2603:10a6:150:9::28) To PAXP190MB1789.EURP190.PROD.OUTLOOK.COM (2603:10a6:102:283::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d52f856a-d153-4b7f-a4c7-08da6298c52d X-MS-TrafficTypeDiagnostic: AS8P190MB1109:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qYz6fYfRx08nxUGdxKzRnacFORG2dZZfgnQhZ80rlkh/qXDuGALmBpa2iHJK+6+6JAhvBp8SHuUypPic/Et6lEyZCB8pwsjM97tqwgThEw9VAkCjB5xWyZJ7HXcuHSwCYY5HG8Cw4rzKx8w7JhZl/oII+Ya1MRal0n7AVdX5p04XMZbKc5y3nIpNzY8Q0KwQqsMTcns+02ly2H+6ZU0+kwQohYEGxt2Te7CrLFKtPynKji/DAWqhj6BafGRvMY/LC+wOb3gHmPot0ubvD/QS3yelvKAIfqekldKJte0zWImmdgWKkgerZc3vGJpfWlmklUd6HF54xmieaE8RZX2XPq+SkF+RdF+LbmnwZnrqhwe7oUu80N7mjgYRq4DJUh0vmFU0/RqRmFmFUKThcWfxqFSHRzJIWmiKWBBb8e8YgP9kUcVyoL8n8Y/Y7tTutVz6BPX1y0a74Avknf6jRght/hWqmhoVObrLhoUjkQ+mt6cgaoP9F1JrcNZscnElYuwBzTyiKmj4oVjL7fTOxsS4YF2PgDXjw0pTN/wmalN1AP25x/4xuAJKBToEneWSzozJSv0ASpV20zBXVslKWF1DNZBndBcVO7IjNEdI+lSvc40vsZqYw70Xml1apwzg4h+vNtlFk7ZFel5Wld1AehmL1bJtTw40WQn8znhOGjl9JOpgitd7Yv9FQq38GBdnKMe90hAfl1h6a+HZaPRwh/lESJRnKBvtJsvVmQVeP8LXth60KSPhkX3b/jI++RonFeqBt+mXDFQqCGsgBDGveEA8y55TItcmk+PODXszkZyBWaZ3NU9/520RtrGPzX11ZbC+ X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXP190MB1789.EURP190.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230016)(4636009)(396003)(136003)(346002)(39830400003)(376002)(366004)(26005)(41300700001)(1076003)(6666004)(6486002)(83380400001)(6512007)(316002)(66574015)(2616005)(36756003)(52116002)(6506007)(186003)(38350700002)(2906002)(38100700002)(6916009)(54906003)(86362001)(5660300002)(478600001)(8936002)(66946007)(66556008)(4326008)(44832011)(8676002)(66476007);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?LsWcQa4aAbT1+60jZsOu75mGDPPP8OquFtY4A1UJ3ctUPdMsKCXp7uYYEqTi?= =?us-ascii?Q?lm3O/Pj82rYPi3Yyh6B2D7AQIO49AZHuMvWiVYyCqGVc/7U2GYcx4SLAQJ4h?= =?us-ascii?Q?73P/bPTKT2IBxbNnjEgpIYNxVBaR+/oXaSv8PG896mE1sKZ+N5OYiY1ypVGd?= =?us-ascii?Q?tLV7uAZdJ6DPcb7/mlf6LnwEM5eOxjkLWSQ96r+HHOkdsg+BIQaA5VIXjnkL?= =?us-ascii?Q?RZ7zqIIa88PsqGC36nwE+8VEe1dkOQ9gl6Thfb078AhNdQizW2a9Bk9YJ+PT?= =?us-ascii?Q?/9bq6zCDaNYp1u8pIWiUtNg02Sm66SoRnOz1S+GEj3B12j3ab8/6tOldDpsg?= =?us-ascii?Q?yo7NOEjHBearnsOUTY++LGYcIxxaqusY7ujX+AcuL3q1DEI8scAcOBppoSme?= =?us-ascii?Q?FE93/D0pQDp4XMyu8Z1hRiCApshDBkQne5MnT3DEIIvYjNSBz7mKBpv7XYJ9?= =?us-ascii?Q?EjRipS9OSWSJPkKJrYq2ER4PnDi/s5U+mX3IWqlqMgvSguxfOE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Js0RjhtZ+m8WVP8xBzfgmNWWVtFp8g5JGUTZMqi74wnKI4m?= =?us-ascii?Q?8GeqqhlA1B9ulJvmVSoXXnxL8WDNy/QfucRkl8ZVPYXweLzGkmpC+P+16HQb?= =?us-ascii?Q?5YKXst4ICl8EiKhmh/1ak9fbO7+EDaz9fJ1NOaDGxOLniQLaK5iFeKNtwbm+?= =?us-ascii?Q?dRJz7xK0wKOSw6+sQub0l/gYMfd8MebgTYLRVwuvPIipEuGX6p/uTZcaDGj8?= =?us-ascii?Q?6Q=3D=3D?= X-OriginatorOrg: plvision.eu X-MS-Exchange-CrossTenant-Network-Message-Id: d52f856a-d153-4b7f-a4c7-08da6298c52d X-MS-Exchange-CrossTenant-AuthSource: PAXP190MB1789.EURP190.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2022 17:22:31.0093 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 03707b74-30f3-46b6-a0e0-ff0a7438c9c4 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: yQGiUVVGqE8NlRazH/SwVI4xg0ZjxlrE49LGLwpqCl1iT41Ku/dIQ/7pXZIEDAGNh17D0C04Fetl0rDAyuz4MlbpAs70VPuiizdC+eazLWs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8P190MB1109 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add support for nexthop routes for Marvell Prestera driver. Subscribe on NEIGH_UPDATE events. Add features: - Support connected route adding e.g.: "ip address add 1.1.1.1/24 dev sw1p1" e.g.: "ip route add 6.6.6/24 dev sw1p1" - Support nexthop route adding e.g.: "ip route add 5.5.5/24 via 1.1.1.2" - Support ECMP route adding e.g.: "ip route add 5.5.5/24 nexthop via 1.1.1.2 nexthop via 1.1.1.3" - Support "offload" and "trap" flags per each nexthop - Support "offload" flag for neighbours Limitations: - Only "local" and "main" tables supported - Only generic interfaces supported for router (no bridges or vlans) Flags meaning: ip route add 5.5.5/24 nexthop via 2.2.2.2 nexthop via 2.2.2.3 ip route show ... 5.5.5.0/24 rt_offload nexthop via 2.2.2.2 dev sw1p31 weight 1 trap nexthop via 2.2.2.3 dev sw1p31 weight 1 trap ... # When you just add route - lpm entry became occupied # in HW ("rt_offload" flag), but related to nexthops neighbours # still not resolved ("trap" flag). # # After some time... ip route show ... 5.5.5.0/24 rt_offload nexthop via 2.2.2.2 dev sw1p31 weight 1 offload nexthop via 2.2.2.3 dev sw1p31 weight 1 offload ... # You will see, that appropriate neighbours was resolved and nexthop # entries occupied in HW too ("offload" flag) Co-developed-by: Taras Chornyi Signed-off-by: Taras Chornyi Co-developed-by: Oleksandr Mazur Signed-off-by: Oleksandr Mazur Signed-off-by: Yevhen Orlov Yevhen Orlov (9): net: marvell: prestera: Add router nexthops ABI net: marvell: prestera: Add cleanup of allocated fib_nodes net: marvell: prestera: Add strict cleanup of fib arbiter net: marvell: prestera: add delayed wq and flush wq on deinit net: marvell: prestera: Add length macros for prestera_ip_addr net: marvell: prestera: Add heplers to interact with fib_notifier_info net: marvell: prestera: add stub handler neighbour events net: marvell: prestera: Add neighbour cache accounting net: marvell: prestera: Propogate nh state from hw to kernel .../net/ethernet/marvell/prestera/prestera.h | 12 + .../ethernet/marvell/prestera/prestera_hw.c | 124 ++ .../ethernet/marvell/prestera/prestera_hw.h | 11 + .../ethernet/marvell/prestera/prestera_main.c | 11 + .../marvell/prestera/prestera_router.c | 1141 ++++++++++++++++- .../marvell/prestera/prestera_router_hw.c | 379 +++++- .../marvell/prestera/prestera_router_hw.h | 76 +- 7 files changed, 1712 insertions(+), 42 deletions(-) -- 2.17.1