From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ido Schimmel Subject: [PATCH net-next v2 10/18] mlxsw: spectrum_router: Configure matching local routes for NVE decap Date: Wed, 17 Oct 2018 08:53:19 +0000 Message-ID: <20181017085215.26607-11-idosch@mellanox.com> References: <20181017085215.26607-1-idosch@mellanox.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Cc: "davem@davemloft.net" , Jiri Pirko , Petr Machata , "jakub.kicinski@netronome.com" , "ivecera@redhat.com" , "roopa@cumulusnetworks.com" , "nikolay@cumulusnetworks.com" , "andrew@lunn.ch" , "vivien.didelot@savoirfairelinux.com" , "f.fainelli@gmail.com" , "stephen@networkplumber.org" , "bridge@lists.linux-foundation.org" , mlxsw , Ido Schimmel To: "netdev@vger.kernel.org" Return-path: Received: from mail-eopbgr50050.outbound.protection.outlook.com ([40.107.5.50]:20448 "EHLO EUR03-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726957AbeJQQsP (ORCPT ); Wed, 17 Oct 2018 12:48:15 -0400 In-Reply-To: <20181017085215.26607-1-idosch@mellanox.com> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: When a local route that matches the source IP of an offloaded NVE tunnel is notified, the driver needs to program it to perform NVE decapsulation instead of merely trapping packets to the CPU. This patch complements "mlxsw: spectrum_router: Enable local routes promotion to perform NVE decap" where existing local routes were promoted to perform NVE decapsulation. Signed-off-by: Ido Schimmel Reviewed-by: Petr Machata --- drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/driver= s/net/ethernet/mellanox/mlxsw/spectrum_router.c index 31b5491d6737..9e9bb57134f2 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c @@ -4247,6 +4247,7 @@ mlxsw_sp_fib4_entry_type_set(struct mlxsw_sp *mlxsw_s= p, struct mlxsw_sp_fib_entry *fib_entry) { union mlxsw_sp_l3addr dip =3D { .addr4 =3D htonl(fen_info->dst) }; + u32 tb_id =3D mlxsw_sp_fix_tb_id(fen_info->tb_id); struct net_device *dev =3D fen_info->fi->fib_dev; struct mlxsw_sp_ipip_entry *ipip_entry; struct fib_info *fi =3D fen_info->fi; @@ -4261,6 +4262,15 @@ mlxsw_sp_fib4_entry_type_set(struct mlxsw_sp *mlxsw_= sp, fib_entry, ipip_entry); } + if (mlxsw_sp_nve_ipv4_route_is_decap(mlxsw_sp, tb_id, + dip.addr4)) { + u32 t_index; + + t_index =3D mlxsw_sp_nve_decap_tunnel_index_get(mlxsw_sp); + fib_entry->decap.tunnel_index =3D t_index; + fib_entry->type =3D MLXSW_SP_FIB_ENTRY_TYPE_NVE_DECAP; + return 0; + } /* fall through */ case RTN_BROADCAST: fib_entry->type =3D MLXSW_SP_FIB_ENTRY_TYPE_TRAP; --=20 2.17.2