From: Parav Pandit <parav@mellanox.com>
To: netdev@vger.kernel.org
Cc: saeedm@mellanox.com, davem@davemloft.net, kuba@kernel.org,
jiri@mellanox.com, Parav Pandit <parav@mellanox.com>,
Roi Dayan <roid@mellanox.com>
Subject: [PATCH net-next 6/9] net/mlx5: Move helper to eswitch layer
Date: Fri, 19 Jun 2020 03:32:52 +0000 [thread overview]
Message-ID: <20200619033255.163-7-parav@mellanox.com> (raw)
In-Reply-To: <20200619033255.163-1-parav@mellanox.com>
To use port number to port index conversion at eswitch level, move it to
eswitch header.
Signed-off-by: Parav Pandit <parav@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
---
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 8 +-------
drivers/net/ethernet/mellanox/mlx5/core/eswitch.h | 7 +++++++
2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
index 006807e04eda..20ff8526d212 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
@@ -1181,12 +1181,6 @@ is_devlink_port_supported(const struct mlx5_core_dev *dev,
mlx5_eswitch_is_vf_vport(dev->priv.eswitch, rpriv->rep->vport);
}
-static unsigned int
-vport_to_devlink_port_index(const struct mlx5_core_dev *dev, u16 vport_num)
-{
- return (MLX5_CAP_GEN(dev, vhca_id) << 16) | vport_num;
-}
-
static int register_devlink_port(struct mlx5_core_dev *dev,
struct mlx5e_rep_priv *rpriv)
{
@@ -1200,7 +1194,7 @@ static int register_devlink_port(struct mlx5_core_dev *dev,
return 0;
mlx5e_rep_get_port_parent_id(rpriv->netdev, &ppid);
- dl_port_index = vport_to_devlink_port_index(dev, rep->vport);
+ dl_port_index = mlx5_esw_vport_to_devlink_port_index(dev, rep->vport);
pfnum = PCI_FUNC(dev->pdev->devfn);
if (rep->vport == MLX5_VPORT_UPLINK)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
index dde5a36fee9d..8f537183e977 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
@@ -565,6 +565,13 @@ static inline u16 mlx5_eswitch_index_to_vport_num(struct mlx5_eswitch *esw,
return index;
}
+static inline unsigned int
+mlx5_esw_vport_to_devlink_port_index(const struct mlx5_core_dev *dev,
+ u16 vport_num)
+{
+ return (MLX5_CAP_GEN(dev, vhca_id) << 16) | vport_num;
+}
+
/* TODO: This mlx5e_tc function shouldn't be called by eswitch */
void mlx5e_tc_clean_fdb_peer_flows(struct mlx5_eswitch *esw);
--
2.19.2
next prev parent reply other threads:[~2020-06-19 3:33 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-19 3:32 [PATCH net-next 0/9] devlink: Support get,set mac address of a port function Parav Pandit
2020-06-19 3:32 ` [PATCH net-next 1/9] net/devlink: Prepare devlink port functions to fill extack Parav Pandit
2020-06-19 3:32 ` [PATCH net-next 2/9] net/devlink: Support querying hardware address of port function Parav Pandit
2020-06-19 3:32 ` [PATCH net-next 3/9] net/devlink: Support setting " Parav Pandit
2020-06-19 3:32 ` [PATCH net-next 4/9] net/mlx5: Constify mac address pointer Parav Pandit
2020-06-19 3:32 ` [PATCH net-next 5/9] net/mlx5: E-switch, Introduce and use eswitch support check helper Parav Pandit
2020-06-19 3:32 ` Parav Pandit [this message]
2020-06-19 3:32 ` [PATCH net-next 7/9] net/mlx5: E-switch, Support querying port function mac address Parav Pandit
2020-06-19 3:32 ` [PATCH net-next 8/9] net/mlx5: Split mac address setting function for using state_lock Parav Pandit
2020-06-19 3:32 ` [PATCH net-next 9/9] net/mlx5: E-switch, Supporting setting devlink port function mac address Parav Pandit
2020-06-22 22:29 ` [PATCH net-next 0/9] devlink: Support get,set mac address of a port function 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=20200619033255.163-7-parav@mellanox.com \
--to=parav@mellanox.com \
--cc=davem@davemloft.net \
--cc=jiri@mellanox.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=roid@mellanox.com \
--cc=saeedm@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