From: Jiri Pirko <jiri@resnulli.us>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, idosch@mellanox.com, yotamg@mellanox.com,
eladr@mellanox.com, nogahf@mellanox.com, ogerlitz@mellanox.com,
sfeldma@gmail.com, roopa@cumulusnetworks.com, andy@greyhouse.net,
dsa@cumulusnetworks.com, tgraf@suug.ch, jhs@mojatatu.com,
linville@tuxdriver.com, ivecera@redhat.com
Subject: [patch net-next 08/18] mlxsw: spectrum: Add router interface struct
Date: Sat, 2 Jul 2016 09:26:30 +0200 [thread overview]
Message-ID: <1467444400-9480-9-git-send-email-jiri@resnulli.us> (raw)
In-Reply-To: <1467444400-9480-1-git-send-email-jiri@resnulli.us>
From: Ido Schimmel <idosch@mellanox.com>
When enabling the router in the device we will represent L3 netdevs
using router interfaces (RIFs). These will be specified whenever
programming routes or neighbours on the netdev.
Introduce the basic RIF infrastructure which allows one to lookup a RIF
by its netdev. Later patches in the series will extend this, but the
basic routines are needed now in order to direct traffic to CPU.
Pointers to the RIF structs are stored in an array indexed by the RIF's
number. This will allow us to efficiently update the kernel's neighbour
table when regularly dumping the device's table.
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 3 +++
drivers/net/ethernet/mellanox/mlxsw/spectrum.h | 19 +++++++++++++++++++
2 files changed, 22 insertions(+)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
index d011902..d15ebf3 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
@@ -2470,6 +2470,7 @@ err_rx_listener_register:
static void mlxsw_sp_fini(struct mlxsw_core *mlxsw_core)
{
struct mlxsw_sp *mlxsw_sp = mlxsw_core_driver_priv(mlxsw_core);
+ int i;
mlxsw_sp_ports_remove(mlxsw_sp);
mlxsw_sp_router_fini(mlxsw_sp);
@@ -2478,6 +2479,8 @@ static void mlxsw_sp_fini(struct mlxsw_core *mlxsw_core)
mlxsw_sp_traps_fini(mlxsw_sp);
mlxsw_sp_event_unregister(mlxsw_sp, MLXSW_TRAP_ID_PUDE);
WARN_ON(!list_empty(&mlxsw_sp->fids));
+ for (i = 0; i < MLXSW_SP_RIF_MAX; i++)
+ WARN_ON_ONCE(mlxsw_sp->rifs[i]);
}
static struct mlxsw_config_profile mlxsw_sp_config_profile = {
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h
index c2ac037..83d5807 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h
@@ -98,6 +98,11 @@ struct mlxsw_sp_fid {
u16 vid;
};
+struct mlxsw_sp_rif {
+ struct net_device *dev;
+ u16 rif;
+};
+
struct mlxsw_sp_mid {
struct list_head list;
unsigned char addr[ETH_ALEN];
@@ -169,6 +174,7 @@ struct mlxsw_sp {
DECLARE_BITMAP(mapped, MLXSW_SP_MID_MAX);
} br_mids;
struct list_head fids; /* VLAN-aware bridge FIDs */
+ struct mlxsw_sp_rif *rifs[MLXSW_SP_RIF_MAX];
struct mlxsw_sp_port **ports;
struct mlxsw_core *core;
const struct mlxsw_bus_info *bus_info;
@@ -327,6 +333,19 @@ mlxsw_sp_port_vport_find_by_fid(const struct mlxsw_sp_port *mlxsw_sp_port,
return NULL;
}
+static inline struct mlxsw_sp_rif *
+mlxsw_sp_rif_find_by_dev(const struct mlxsw_sp *mlxsw_sp,
+ const struct net_device *dev)
+{
+ int i;
+
+ for (i = 0; i < MLXSW_SP_RIF_MAX; i++)
+ if (mlxsw_sp->rifs[i] && mlxsw_sp->rifs[i]->dev == dev)
+ return mlxsw_sp->rifs[i];
+
+ return NULL;
+}
+
enum mlxsw_sp_flood_table {
MLXSW_SP_FLOOD_TABLE_UC,
MLXSW_SP_FLOOD_TABLE_BM,
--
2.5.5
next prev parent reply other threads:[~2016-07-02 7:27 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-02 7:26 [patch net-next 00/18] mlxsw: Do preparations before ipv4 router offload introduction Jiri Pirko
2016-07-02 7:26 ` [patch net-next 01/18] mlxsw: spectrum: Send untagged packets through a port netdev Jiri Pirko
2016-07-02 7:26 ` [patch net-next 02/18] mlxsw: spectrum: Remove VLANs configuration via SELF flag Jiri Pirko
2016-07-02 7:26 ` [patch net-next 03/18] mlxsw: spectrum: Sync PVID vPort LAG status Jiri Pirko
2016-07-02 7:26 ` [patch net-next 04/18] mlxsw: spectrum: Remove RIF from PVID vPort when joining / leaving LAG Jiri Pirko
2016-07-02 7:26 ` [patch net-next 05/18] mlxsw: reg: Add Router General Configuration Register Jiri Pirko
2016-07-02 7:26 ` [patch net-next 06/18] mlxsw: spectrum: Initialize ports at the end of init sequence Jiri Pirko
2016-07-02 7:26 ` [patch net-next 07/18] mlxsw: spectrum_router: Add basic ipv4 router initialization Jiri Pirko
2016-07-02 7:26 ` Jiri Pirko [this message]
2016-07-02 7:26 ` [patch net-next 09/18] mlxsw: reg: Add FDB action to forward to router Jiri Pirko
2016-07-02 7:26 ` [patch net-next 10/18] mlxsw: reg: Add Router Interface Table Register Jiri Pirko
2016-07-02 7:26 ` [patch net-next 11/18] mlxsw: spectrum: Use action 'discard' when removing traps Jiri Pirko
2016-07-02 7:26 ` [patch net-next 12/18] mlxsw: spectrum: Add traps needed for router implementation Jiri Pirko
2016-07-02 7:26 ` [patch net-next 13/18] mlxsw: spectrum: Add couple of lower device helper functions Jiri Pirko
2016-07-02 7:26 ` [patch net-next 14/18] mlxsw: spectrum: Edit RIF properties based on netdev events Jiri Pirko
2016-07-02 7:26 ` [patch net-next 15/18] mlxsw: spectrum: Introduce support for router interfaces Jiri Pirko
2016-07-02 7:26 ` [patch net-next 16/18] mlxsw: spectrum: Unsplit the vFID range Jiri Pirko
2016-07-02 7:26 ` [patch net-next 17/18] mlxsw: spectrum: Configure FIDs based on bridge events Jiri Pirko
2016-07-02 7:26 ` [patch net-next 18/18] mlxsw: spectrum: Enable L3 interfaces on top of bridge devices Jiri Pirko
2016-07-02 8:37 ` [patch net-next 00/18] mlxsw: Do preparations before ipv4 router offload introduction Jiri Pirko
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=1467444400-9480-9-git-send-email-jiri@resnulli.us \
--to=jiri@resnulli.us \
--cc=andy@greyhouse.net \
--cc=davem@davemloft.net \
--cc=dsa@cumulusnetworks.com \
--cc=eladr@mellanox.com \
--cc=idosch@mellanox.com \
--cc=ivecera@redhat.com \
--cc=jhs@mojatatu.com \
--cc=linville@tuxdriver.com \
--cc=netdev@vger.kernel.org \
--cc=nogahf@mellanox.com \
--cc=ogerlitz@mellanox.com \
--cc=roopa@cumulusnetworks.com \
--cc=sfeldma@gmail.com \
--cc=tgraf@suug.ch \
--cc=yotamg@mellanox.com \
/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).