* [patch net 0/2] mlxsw: spectrum: Configure TTL of "inherit" for offloaded tunnels
@ 2017-10-20 7:16 Jiri Pirko
2017-10-20 7:16 ` [patch net 1/2] mlxsw: reg: Add Tunneling IPinIP General Configuration Register Jiri Pirko
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Jiri Pirko @ 2017-10-20 7:16 UTC (permalink / raw)
To: netdev; +Cc: davem, petrm, idosch, mlxsw
From: Jiri Pirko <jiri@mellanox.com>
Petr says:
Currently mlxsw only offloads tunnels that are configured with TTL of "inherit"
(which is the default). However, Spectrum defaults to 255 and the driver
neglects to change the configuration. Thus the tunnel packets from offloaded
tunnels always have TTL of 255, even though tunnels with explicit TTL of 255 are
never actually offloaded.
To fix this, introduce support for TIGCR, the register that keeps the related
bits of global tunnel configuration, and use it on first offload to properly
configure inheritance of TTL of tunnel packets from overlay packets.
Petr Machata (2):
mlxsw: reg: Add Tunneling IPinIP General Configuration Register
mlxsw: spectrum_router: Configure TIGCR on init
drivers/net/ethernet/mellanox/mlxsw/reg.h | 31 ++++++++++++++++++++++
.../net/ethernet/mellanox/mlxsw/spectrum_router.c | 11 +++++++-
2 files changed, 41 insertions(+), 1 deletion(-)
--
2.9.5
^ permalink raw reply [flat|nested] 4+ messages in thread
* [patch net 1/2] mlxsw: reg: Add Tunneling IPinIP General Configuration Register
2017-10-20 7:16 [patch net 0/2] mlxsw: spectrum: Configure TTL of "inherit" for offloaded tunnels Jiri Pirko
@ 2017-10-20 7:16 ` Jiri Pirko
2017-10-20 7:16 ` [patch net 2/2] mlxsw: spectrum_router: Configure TIGCR on init Jiri Pirko
2017-10-22 1:19 ` [patch net 0/2] mlxsw: spectrum: Configure TTL of "inherit" for offloaded tunnels David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Jiri Pirko @ 2017-10-20 7:16 UTC (permalink / raw)
To: netdev; +Cc: davem, petrm, idosch, mlxsw
From: Petr Machata <petrm@mellanox.com>
The TIGCR register is used for setting up the IPinIP Tunnel
configuration.
Fixes: ee954d1a91b2 ("mlxsw: spectrum_router: Support GRE tunnels")
Signed-off-by: Petr Machata <petrm@mellanox.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
drivers/net/ethernet/mellanox/mlxsw/reg.h | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/reg.h b/drivers/net/ethernet/mellanox/mlxsw/reg.h
index cc27c5d..4afc848 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/reg.h
+++ b/drivers/net/ethernet/mellanox/mlxsw/reg.h
@@ -6401,6 +6401,36 @@ static inline void mlxsw_reg_mgpc_pack(char *payload, u32 counter_index,
mlxsw_reg_mgpc_opcode_set(payload, opcode);
}
+/* TIGCR - Tunneling IPinIP General Configuration Register
+ * -------------------------------------------------------
+ * The TIGCR register is used for setting up the IPinIP Tunnel configuration.
+ */
+#define MLXSW_REG_TIGCR_ID 0xA801
+#define MLXSW_REG_TIGCR_LEN 0x10
+
+MLXSW_REG_DEFINE(tigcr, MLXSW_REG_TIGCR_ID, MLXSW_REG_TIGCR_LEN);
+
+/* reg_tigcr_ipip_ttlc
+ * For IPinIP Tunnel encapsulation: whether to copy the ttl from the packet
+ * header.
+ * Access: RW
+ */
+MLXSW_ITEM32(reg, tigcr, ttlc, 0x04, 8, 1);
+
+/* reg_tigcr_ipip_ttl_uc
+ * The TTL for IPinIP Tunnel encapsulation of unicast packets if
+ * reg_tigcr_ipip_ttlc is unset.
+ * Access: RW
+ */
+MLXSW_ITEM32(reg, tigcr, ttl_uc, 0x04, 0, 8);
+
+static inline void mlxsw_reg_tigcr_pack(char *payload, bool ttlc, u8 ttl_uc)
+{
+ MLXSW_REG_ZERO(tigcr, payload);
+ mlxsw_reg_tigcr_ttlc_set(payload, ttlc);
+ mlxsw_reg_tigcr_ttl_uc_set(payload, ttl_uc);
+}
+
/* SBPR - Shared Buffer Pools Register
* -----------------------------------
* The SBPR configures and retrieves the shared buffer pools and configuration.
@@ -6881,6 +6911,7 @@ static const struct mlxsw_reg_info *mlxsw_reg_infos[] = {
MLXSW_REG(mcc),
MLXSW_REG(mcda),
MLXSW_REG(mgpc),
+ MLXSW_REG(tigcr),
MLXSW_REG(sbpr),
MLXSW_REG(sbcm),
MLXSW_REG(sbpm),
--
2.9.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [patch net 2/2] mlxsw: spectrum_router: Configure TIGCR on init
2017-10-20 7:16 [patch net 0/2] mlxsw: spectrum: Configure TTL of "inherit" for offloaded tunnels Jiri Pirko
2017-10-20 7:16 ` [patch net 1/2] mlxsw: reg: Add Tunneling IPinIP General Configuration Register Jiri Pirko
@ 2017-10-20 7:16 ` Jiri Pirko
2017-10-22 1:19 ` [patch net 0/2] mlxsw: spectrum: Configure TTL of "inherit" for offloaded tunnels David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Jiri Pirko @ 2017-10-20 7:16 UTC (permalink / raw)
To: netdev; +Cc: davem, petrm, idosch, mlxsw
From: Petr Machata <petrm@mellanox.com>
Spectrum tunnels do not default to ttl of "inherit" like the Linux ones
do. Configure TIGCR on router init so that the TTL of tunnel packets is
copied from the overlay packets.
Fixes: ee954d1a91b2 ("mlxsw: spectrum_router: Support GRE tunnels")
Signed-off-by: Petr Machata <petrm@mellanox.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
index c16718d..5189022a 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
@@ -5896,11 +5896,20 @@ static void mlxsw_sp_rifs_fini(struct mlxsw_sp *mlxsw_sp)
kfree(mlxsw_sp->router->rifs);
}
+static int
+mlxsw_sp_ipip_config_tigcr(struct mlxsw_sp *mlxsw_sp)
+{
+ char tigcr_pl[MLXSW_REG_TIGCR_LEN];
+
+ mlxsw_reg_tigcr_pack(tigcr_pl, true, 0);
+ return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(tigcr), tigcr_pl);
+}
+
static int mlxsw_sp_ipips_init(struct mlxsw_sp *mlxsw_sp)
{
mlxsw_sp->router->ipip_ops_arr = mlxsw_sp_ipip_ops_arr;
INIT_LIST_HEAD(&mlxsw_sp->router->ipip_list);
- return 0;
+ return mlxsw_sp_ipip_config_tigcr(mlxsw_sp);
}
static void mlxsw_sp_ipips_fini(struct mlxsw_sp *mlxsw_sp)
--
2.9.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [patch net 0/2] mlxsw: spectrum: Configure TTL of "inherit" for offloaded tunnels
2017-10-20 7:16 [patch net 0/2] mlxsw: spectrum: Configure TTL of "inherit" for offloaded tunnels Jiri Pirko
2017-10-20 7:16 ` [patch net 1/2] mlxsw: reg: Add Tunneling IPinIP General Configuration Register Jiri Pirko
2017-10-20 7:16 ` [patch net 2/2] mlxsw: spectrum_router: Configure TIGCR on init Jiri Pirko
@ 2017-10-22 1:19 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2017-10-22 1:19 UTC (permalink / raw)
To: jiri; +Cc: netdev, petrm, idosch, mlxsw
From: Jiri Pirko <jiri@resnulli.us>
Date: Fri, 20 Oct 2017 09:16:14 +0200
> From: Jiri Pirko <jiri@mellanox.com>
>
> Petr says:
>
> Currently mlxsw only offloads tunnels that are configured with TTL of "inherit"
> (which is the default). However, Spectrum defaults to 255 and the driver
> neglects to change the configuration. Thus the tunnel packets from offloaded
> tunnels always have TTL of 255, even though tunnels with explicit TTL of 255 are
> never actually offloaded.
>
> To fix this, introduce support for TIGCR, the register that keeps the related
> bits of global tunnel configuration, and use it on first offload to properly
> configure inheritance of TTL of tunnel packets from overlay packets.
Series applied.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-10-22 1:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-20 7:16 [patch net 0/2] mlxsw: spectrum: Configure TTL of "inherit" for offloaded tunnels Jiri Pirko
2017-10-20 7:16 ` [patch net 1/2] mlxsw: reg: Add Tunneling IPinIP General Configuration Register Jiri Pirko
2017-10-20 7:16 ` [patch net 2/2] mlxsw: spectrum_router: Configure TIGCR on init Jiri Pirko
2017-10-22 1:19 ` [patch net 0/2] mlxsw: spectrum: Configure TTL of "inherit" for offloaded tunnels David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).