]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mlxsw: spectrum_router: Use eXtended mezzanine to offload IPv4 router
authorJiri Pirko <jiri@nvidia.com>
Mon, 14 Dec 2020 11:30:41 +0000 (13:30 +0200)
committerJakub Kicinski <kuba@kernel.org>
Tue, 15 Dec 2020 03:09:55 +0000 (19:09 -0800)
In case the eXtended mezzanine is present on the system, use it for IPv4
router offload.

Signed-off-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.h
drivers/net/ethernet/mellanox/mlxsw/spectrum_router_xm.c

index 62d51b281b584188775095cba8f94a9032add662..41424ee909a0834e4e630919cd8c24a9025979cc 100644 (file)
@@ -9213,7 +9213,9 @@ int mlxsw_sp_router_init(struct mlxsw_sp *mlxsw_sp,
        if (err)
                goto err_xm_init;
 
-       router->proto_ll_ops[MLXSW_SP_L3_PROTO_IPV4] = &mlxsw_sp_router_ll_basic_ops;
+       router->proto_ll_ops[MLXSW_SP_L3_PROTO_IPV4] = mlxsw_sp_router_xm_ipv4_is_supported(mlxsw_sp) ?
+                                                      &mlxsw_sp_router_ll_xm_ops :
+                                                      &mlxsw_sp_router_ll_basic_ops;
        router->proto_ll_ops[MLXSW_SP_L3_PROTO_IPV6] = &mlxsw_sp_router_ll_basic_ops;
 
        err = mlxsw_sp_router_ll_op_ctx_init(router);
index 31612891ad487917f7197f0e9b906fbfe6736f2d..2875ee8ec5378dcf19a4b920ba76b1ccad10b1a2 100644 (file)
@@ -227,5 +227,6 @@ extern const struct mlxsw_sp_router_ll_ops mlxsw_sp_router_ll_xm_ops;
 
 int mlxsw_sp_router_xm_init(struct mlxsw_sp *mlxsw_sp);
 void mlxsw_sp_router_xm_fini(struct mlxsw_sp *mlxsw_sp);
+bool mlxsw_sp_router_xm_ipv4_is_supported(const struct mlxsw_sp *mlxsw_sp);
 
 #endif /* _MLXSW_ROUTER_H_*/
index 2f1e70e5a262c5b8e76f97e9973efe15d849bb25..d213af723a2a586ab23b1970b1b153c26a016b6f 100644 (file)
@@ -803,3 +803,10 @@ void mlxsw_sp_router_xm_fini(struct mlxsw_sp *mlxsw_sp)
        rhashtable_destroy(&router_xm->ltable_ht);
        kfree(router_xm);
 }
+
+bool mlxsw_sp_router_xm_ipv4_is_supported(const struct mlxsw_sp *mlxsw_sp)
+{
+       struct mlxsw_sp_router_xm *router_xm = mlxsw_sp->router->xm;
+
+       return router_xm && router_xm->ipv4_supported;
+}