From: Jiri Pirko <jiri@resnulli.us>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, idosch@mellanox.com, mlxsw@mellanox.com
Subject: [patch net-next 4/8] mlxsw: spectrum_router: Store weight in nexthop struct
Date: Sun, 22 Oct 2017 23:11:46 +0200 [thread overview]
Message-ID: <20171022211150.2567-5-jiri@resnulli.us> (raw)
In-Reply-To: <20171022211150.2567-1-jiri@resnulli.us>
From: Ido Schimmel <idosch@mellanox.com>
As the first step towards non-equal-cost multi-path support, store each
nexthop's weight.
For IPv6 nexthops always set the weight to 1, as it only supports ECMP.
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
index cb0d25e..8cd422d 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
@@ -2203,6 +2203,7 @@ struct mlxsw_sp_nexthop {
struct mlxsw_sp_nexthop_key key;
unsigned char gw_addr[sizeof(struct in6_addr)];
int ifindex;
+ int nh_weight;
struct mlxsw_sp_rif *rif;
u8 should_offload:1, /* set indicates this neigh is connected and
* should be put to KVD linear area of this group.
@@ -3045,6 +3046,11 @@ static int mlxsw_sp_nexthop4_init(struct mlxsw_sp *mlxsw_sp,
nh->nh_grp = nh_grp;
nh->key.fib_nh = fib_nh;
+#ifdef CONFIG_IP_ROUTE_MULTIPATH
+ nh->nh_weight = fib_nh->nh_weight;
+#else
+ nh->nh_weight = 1;
+#endif
memcpy(&nh->gw_addr, &fib_nh->nh_gw, sizeof(fib_nh->nh_gw));
err = mlxsw_sp_nexthop_insert(mlxsw_sp, nh);
if (err)
@@ -4304,6 +4310,7 @@ static int mlxsw_sp_nexthop6_init(struct mlxsw_sp *mlxsw_sp,
struct net_device *dev = rt->dst.dev;
nh->nh_grp = nh_grp;
+ nh->nh_weight = 1;
memcpy(&nh->gw_addr, &rt->rt6i_gateway, sizeof(nh->gw_addr));
mlxsw_sp_nexthop_counter_alloc(mlxsw_sp, nh);
--
2.9.5
next prev parent reply other threads:[~2017-10-22 21:11 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-22 21:11 [patch net-next 0/8] mlxsw: Add support for non-equal-cost multi-path Jiri Pirko
2017-10-22 21:11 ` [patch net-next 1/8] mlxsw: spectrum_dpipe: Add adjacency group size Jiri Pirko
2017-10-22 21:11 ` [patch net-next 2/8] mlxsw: spectrum: Better represent KVDL partitions Jiri Pirko
2017-10-22 21:11 ` [patch net-next 3/8] mlxsw: spectrum: Add ability to query KVDL allocation size Jiri Pirko
2017-10-22 21:11 ` Jiri Pirko [this message]
2017-10-22 21:11 ` [patch net-next 5/8] mlxsw: spectrum_router: Prepare for large adjacency groups Jiri Pirko
2017-10-22 21:11 ` [patch net-next 6/8] mlxsw: spectrum_router: Populate adjacency entries according to weights Jiri Pirko
2017-10-22 21:11 ` [patch net-next 7/8] mlxsw: spectrum: Increase number of linear entries Jiri Pirko
2017-10-22 21:11 ` [patch net-next 8/8] mlxsw: spectrum: Add another partition to KVD linear Jiri Pirko
2017-10-23 4:27 ` [patch net-next 0/8] mlxsw: Add support for non-equal-cost multi-path David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171022211150.2567-5-jiri@resnulli.us \
--to=jiri@resnulli.us \
--cc=davem@davemloft.net \
--cc=idosch@mellanox.com \
--cc=mlxsw@mellanox.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).