From: Valentine Fatiev <valentinef@nvidia.com>
Subject: [PATCH] BACKPORT: drivers/net/ethernet/mellanox/mlx5/core/sf/sf.h

Change-Id: I31ce6b9a99fd49b1cf3c7e6435da5427d25db564
---
 .../net/ethernet/mellanox/mlx5/core/sf/sf.h   | 24 +++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

--- a/drivers/net/ethernet/mellanox/mlx5/core/sf/sf.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/sf/sf.h
@@ -20,15 +20,35 @@ void mlx5_sf_table_cleanup(struct mlx5_c
 int mlx5_devlink_sf_port_new(struct devlink *devlink,
 			     const struct devlink_port_new_attrs *add_attr,
 			     struct netlink_ext_ack *extack,
+#ifdef HAVE_DEVLINK_PORT_OPS
 			     struct devlink_port **dl_port);
+#else
+			     unsigned int *new_port_index);
+#endif
+
+#ifdef HAVE_DEVLINK_PORT_OPS
 int mlx5_devlink_sf_port_del(struct devlink *devlink,
 			     struct devlink_port *dl_port,
 			     struct netlink_ext_ack *extack);
-int mlx5_devlink_sf_port_fn_state_get(struct devlink_port *dl_port,
+#else
+int mlx5_devlink_sf_port_del(struct devlink *devlink, unsigned int port_index,
+			     struct netlink_ext_ack *extack);
+#endif
+#if defined(HAVE_PORT_FUNCTION_STATE_GET_4_PARAM) || defined(HAVE_DEVLINK_PORT_OPS)
+int mlx5_devlink_sf_port_fn_state_get(
+#else
+int mlx5_devlink_sf_port_fn_state_get(struct devlink *devlink,
+#endif
+				      struct devlink_port *dl_port,
 				      enum devlink_port_fn_state *state,
 				      enum devlink_port_fn_opstate *opstate,
 				      struct netlink_ext_ack *extack);
-int mlx5_devlink_sf_port_fn_state_set(struct devlink_port *dl_port,
+#if defined(HAVE_PORT_FUNCTION_STATE_GET_4_PARAM) || defined(HAVE_DEVLINK_PORT_OPS)
+int mlx5_devlink_sf_port_fn_state_set(
+#else
+int mlx5_devlink_sf_port_fn_state_set(struct devlink *devlink,
+#endif
+				      struct devlink_port *dl_port,
 				      enum devlink_port_fn_state state,
 				      struct netlink_ext_ack *extack);
 #if IS_ENABLED(CONFIG_MLXDEVM)
