All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 0/3] mlxsw: Add neighbour offload indication
@ 2019-04-14 18:57 Ido Schimmel
  2019-04-14 18:57 ` [PATCH net-next 1/3] mlxsw: spectrum_router: Propagate neighbour update errors Ido Schimmel
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Ido Schimmel @ 2019-04-14 18:57 UTC (permalink / raw)
  To: netdev; +Cc: davem, Jiri Pirko, dsahern, mlxsw, Ido Schimmel

Neighbour entries are programmed to the device's table so that the
correct destination MAC will be specified in a packet after it was
routed.

Despite being programmed to the device and unlike routes and FDB
entries, neighbour entries are currently not marked as offloaded. This
patchset changes that.

Patch #1 is a preparatory patch to make sure we only mark a neighbour as
offloaded in case it was successfully programmed to the device.

Patch #2 sets the offload indication on neighbours.

Patch #3 adds a test to verify above mentioned functionality.

Patched iproute2 version that prints the offload indication is available
here [1].

[1] https://github.com/idosch/iproute2/tree/idosch-next

Ido Schimmel (3):
  mlxsw: spectrum_router: Propagate neighbour update errors
  mlxsw: spectrum_router: Add neighbour offload indication
  selftests: mlxsw: Test neighbour offload indication

 .../ethernet/mellanox/mlxsw/spectrum_router.c | 29 ++++++++++++++-----
 .../selftests/drivers/net/mlxsw/rtnetlink.sh  | 26 +++++++++++++++++
 2 files changed, 47 insertions(+), 8 deletions(-)

-- 
2.20.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH net-next 1/3] mlxsw: spectrum_router: Propagate neighbour update errors
  2019-04-14 18:57 [PATCH net-next 0/3] mlxsw: Add neighbour offload indication Ido Schimmel
@ 2019-04-14 18:57 ` Ido Schimmel
  2019-04-14 18:57 ` [PATCH net-next 2/3] mlxsw: spectrum_router: Add neighbour offload indication Ido Schimmel
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Ido Schimmel @ 2019-04-14 18:57 UTC (permalink / raw)
  To: netdev; +Cc: davem, Jiri Pirko, dsahern, mlxsw, Ido Schimmel

Next patch will add offload indication to neighbours, but the indication
should only be altered in case the neighbour was successfully added to /
deleted from the device.

Propagate neighbour update errors, so that they could be taken into
account by the next patch.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
---
 .../ethernet/mellanox/mlxsw/spectrum_router.c | 23 ++++++++++++-------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
index 5f05723011b4..e159b246ba55 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
@@ -2371,7 +2371,7 @@ static enum mlxsw_reg_rauht_op mlxsw_sp_rauht_op(bool adding)
 			MLXSW_REG_RAUHT_OP_WRITE_DELETE;
 }
 
-static void
+static int
 mlxsw_sp_router_neigh_entry_op4(struct mlxsw_sp *mlxsw_sp,
 				struct mlxsw_sp_neigh_entry *neigh_entry,
 				enum mlxsw_reg_rauht_op op)
@@ -2385,10 +2385,10 @@ mlxsw_sp_router_neigh_entry_op4(struct mlxsw_sp *mlxsw_sp,
 	if (neigh_entry->counter_valid)
 		mlxsw_reg_rauht_pack_counter(rauht_pl,
 					     neigh_entry->counter_index);
-	mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(rauht), rauht_pl);
+	return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(rauht), rauht_pl);
 }
 
-static void
+static int
 mlxsw_sp_router_neigh_entry_op6(struct mlxsw_sp *mlxsw_sp,
 				struct mlxsw_sp_neigh_entry *neigh_entry,
 				enum mlxsw_reg_rauht_op op)
@@ -2402,7 +2402,7 @@ mlxsw_sp_router_neigh_entry_op6(struct mlxsw_sp *mlxsw_sp,
 	if (neigh_entry->counter_valid)
 		mlxsw_reg_rauht_pack_counter(rauht_pl,
 					     neigh_entry->counter_index);
-	mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(rauht), rauht_pl);
+	return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(rauht), rauht_pl);
 }
 
 bool mlxsw_sp_neigh_ipv6_ignore(struct mlxsw_sp_neigh_entry *neigh_entry)
@@ -2424,17 +2424,24 @@ mlxsw_sp_neigh_entry_update(struct mlxsw_sp *mlxsw_sp,
 			    struct mlxsw_sp_neigh_entry *neigh_entry,
 			    bool adding)
 {
+	enum mlxsw_reg_rauht_op op = mlxsw_sp_rauht_op(adding);
+	int err;
+
 	if (!adding && !neigh_entry->connected)
 		return;
 	neigh_entry->connected = adding;
 	if (neigh_entry->key.n->tbl->family == AF_INET) {
-		mlxsw_sp_router_neigh_entry_op4(mlxsw_sp, neigh_entry,
-						mlxsw_sp_rauht_op(adding));
+		err = mlxsw_sp_router_neigh_entry_op4(mlxsw_sp, neigh_entry,
+						      op);
+		if (err)
+			return;
 	} else if (neigh_entry->key.n->tbl->family == AF_INET6) {
 		if (mlxsw_sp_neigh_ipv6_ignore(neigh_entry))
 			return;
-		mlxsw_sp_router_neigh_entry_op6(mlxsw_sp, neigh_entry,
-						mlxsw_sp_rauht_op(adding));
+		err = mlxsw_sp_router_neigh_entry_op6(mlxsw_sp, neigh_entry,
+						      op);
+		if (err)
+			return;
 	} else {
 		WARN_ON_ONCE(1);
 	}
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH net-next 2/3] mlxsw: spectrum_router: Add neighbour offload indication
  2019-04-14 18:57 [PATCH net-next 0/3] mlxsw: Add neighbour offload indication Ido Schimmel
  2019-04-14 18:57 ` [PATCH net-next 1/3] mlxsw: spectrum_router: Propagate neighbour update errors Ido Schimmel
@ 2019-04-14 18:57 ` Ido Schimmel
  2019-04-15  0:37   ` David Ahern
  2019-04-14 18:57 ` [PATCH net-next 3/3] selftests: mlxsw: Test " Ido Schimmel
  2019-04-15 20:29 ` [PATCH net-next 0/3] mlxsw: Add " David Miller
  3 siblings, 1 reply; 6+ messages in thread
From: Ido Schimmel @ 2019-04-14 18:57 UTC (permalink / raw)
  To: netdev; +Cc: davem, Jiri Pirko, dsahern, mlxsw, Ido Schimmel

In a similar fashion to routes and FDB entries, the neighbour table is
reflected to the device.

Set an offload indication on the neighbour in case it was programmed to
the device.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
index e159b246ba55..31656a2a6252 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
@@ -2444,7 +2444,13 @@ mlxsw_sp_neigh_entry_update(struct mlxsw_sp *mlxsw_sp,
 			return;
 	} else {
 		WARN_ON_ONCE(1);
+		return;
 	}
+
+	if (adding)
+		neigh_entry->key.n->flags |= NTF_OFFLOADED;
+	else
+		neigh_entry->key.n->flags &= ~NTF_OFFLOADED;
 }
 
 void
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH net-next 3/3] selftests: mlxsw: Test neighbour offload indication
  2019-04-14 18:57 [PATCH net-next 0/3] mlxsw: Add neighbour offload indication Ido Schimmel
  2019-04-14 18:57 ` [PATCH net-next 1/3] mlxsw: spectrum_router: Propagate neighbour update errors Ido Schimmel
  2019-04-14 18:57 ` [PATCH net-next 2/3] mlxsw: spectrum_router: Add neighbour offload indication Ido Schimmel
@ 2019-04-14 18:57 ` Ido Schimmel
  2019-04-15 20:29 ` [PATCH net-next 0/3] mlxsw: Add " David Miller
  3 siblings, 0 replies; 6+ messages in thread
From: Ido Schimmel @ 2019-04-14 18:57 UTC (permalink / raw)
  To: netdev; +Cc: davem, Jiri Pirko, dsahern, mlxsw, Ido Schimmel

Test that neighbour entries are marked as offloaded.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
---
 .../selftests/drivers/net/mlxsw/rtnetlink.sh  | 26 +++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/tools/testing/selftests/drivers/net/mlxsw/rtnetlink.sh b/tools/testing/selftests/drivers/net/mlxsw/rtnetlink.sh
index c4cf6e6d800e..017d839fcefa 100755
--- a/tools/testing/selftests/drivers/net/mlxsw/rtnetlink.sh
+++ b/tools/testing/selftests/drivers/net/mlxsw/rtnetlink.sh
@@ -26,6 +26,7 @@ ALL_TESTS="
 	lag_dev_deletion_test
 	vlan_interface_uppers_test
 	bridge_extern_learn_test
+	neigh_offload_test
 	devlink_reload_test
 "
 NUM_NETIFS=2
@@ -561,6 +562,31 @@ bridge_extern_learn_test()
 	ip link del dev br0
 }
 
+neigh_offload_test()
+{
+	# Test that IPv4 and IPv6 neighbour entries are marked as offloaded
+	RET=0
+
+	ip -4 address add 192.0.2.1/24 dev $swp1
+	ip -6 address add 2001:db8:1::1/64 dev $swp1
+
+	ip -4 neigh add 192.0.2.2 lladdr de:ad:be:ef:13:37 nud perm dev $swp1
+	ip -6 neigh add 2001:db8:1::2 lladdr de:ad:be:ef:13:37 nud perm \
+		dev $swp1
+
+	ip -4 neigh show dev $swp1 | grep 192.0.2.2 | grep -q offload
+	check_err $? "ipv4 neigh entry not marked as offloaded when should"
+	ip -6 neigh show dev $swp1 | grep 2001:db8:1::2 | grep -q offload
+	check_err $? "ipv6 neigh entry not marked as offloaded when should"
+
+	log_test "neighbour offload indication"
+
+	ip -6 neigh del 2001:db8:1::2 dev $swp1
+	ip -4 neigh del 192.0.2.2 dev $swp1
+	ip -6 address del 2001:db8:1::1/64 dev $swp1
+	ip -4 address del 192.0.2.1/24 dev $swp1
+}
+
 devlink_reload_test()
 {
 	# Test that after executing all the above configuration tests, a
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next 2/3] mlxsw: spectrum_router: Add neighbour offload indication
  2019-04-14 18:57 ` [PATCH net-next 2/3] mlxsw: spectrum_router: Add neighbour offload indication Ido Schimmel
@ 2019-04-15  0:37   ` David Ahern
  0 siblings, 0 replies; 6+ messages in thread
From: David Ahern @ 2019-04-15  0:37 UTC (permalink / raw)
  To: Ido Schimmel, netdev; +Cc: davem, Jiri Pirko, mlxsw

On 4/14/19 12:57 PM, Ido Schimmel wrote:
> In a similar fashion to routes and FDB entries, the neighbour table is
> reflected to the device.
> 
> Set an offload indication on the neighbour in case it was programmed to
> the device.
> 
> Signed-off-by: Ido Schimmel <idosch@mellanox.com>
> Acked-by: Jiri Pirko <jiri@mellanox.com>
> ---
>  drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
> index e159b246ba55..31656a2a6252 100644
> --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
> +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
> @@ -2444,7 +2444,13 @@ mlxsw_sp_neigh_entry_update(struct mlxsw_sp *mlxsw_sp,
>  			return;
>  	} else {
>  		WARN_ON_ONCE(1);
> +		return;
>  	}
> +
> +	if (adding)
> +		neigh_entry->key.n->flags |= NTF_OFFLOADED;
> +	else
> +		neigh_entry->key.n->flags &= ~NTF_OFFLOADED;
>  }
>  
>  void
> 

Reviewed-by: David Ahern <dsahern@gmail.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next 0/3] mlxsw: Add neighbour offload indication
  2019-04-14 18:57 [PATCH net-next 0/3] mlxsw: Add neighbour offload indication Ido Schimmel
                   ` (2 preceding siblings ...)
  2019-04-14 18:57 ` [PATCH net-next 3/3] selftests: mlxsw: Test " Ido Schimmel
@ 2019-04-15 20:29 ` David Miller
  3 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2019-04-15 20:29 UTC (permalink / raw)
  To: idosch; +Cc: netdev, jiri, dsahern, mlxsw

From: Ido Schimmel <idosch@mellanox.com>
Date: Sun, 14 Apr 2019 18:57:46 +0000

> Neighbour entries are programmed to the device's table so that the
> correct destination MAC will be specified in a packet after it was
> routed.
> 
> Despite being programmed to the device and unlike routes and FDB
> entries, neighbour entries are currently not marked as offloaded. This
> patchset changes that.
> 
> Patch #1 is a preparatory patch to make sure we only mark a neighbour as
> offloaded in case it was successfully programmed to the device.
> 
> Patch #2 sets the offload indication on neighbours.
> 
> Patch #3 adds a test to verify above mentioned functionality.
> 
> Patched iproute2 version that prints the offload indication is available
> here [1].
> 
> [1] https://github.com/idosch/iproute2/tree/idosch-next

Series applied, thanks.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-04-15 20:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-14 18:57 [PATCH net-next 0/3] mlxsw: Add neighbour offload indication Ido Schimmel
2019-04-14 18:57 ` [PATCH net-next 1/3] mlxsw: spectrum_router: Propagate neighbour update errors Ido Schimmel
2019-04-14 18:57 ` [PATCH net-next 2/3] mlxsw: spectrum_router: Add neighbour offload indication Ido Schimmel
2019-04-15  0:37   ` David Ahern
2019-04-14 18:57 ` [PATCH net-next 3/3] selftests: mlxsw: Test " Ido Schimmel
2019-04-15 20:29 ` [PATCH net-next 0/3] mlxsw: Add " David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.