-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
net/mlx5e: Add support for devlink-port in non-representors mode
Added devlink_port field to mlx5e_priv structure and a callback to netdev ops to enable devlink to get info about the port. The port registration happens at driver initialization. Signed-off-by: Vladyslav Tarasiuk <vladyslavt@mellanox.com> Reviewed-by: Moshe Shemesh <moshe@mellanox.com> Reviewed-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
- Loading branch information
Vladyslav Tarasiuk
authored and
Saeed Mahameed
committed
Feb 28, 2020
1 parent
ab8f963
commit c6acd62
Showing
5 changed files
with
66 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB | ||
/* Copyright (c) 2020, Mellanox Technologies inc. All rights reserved. */ | ||
|
||
#include "en/devlink.h" | ||
|
||
int mlx5e_devlink_phy_port_register(struct net_device *dev) | ||
{ | ||
struct mlx5e_priv *priv; | ||
struct devlink *devlink; | ||
int err; | ||
|
||
priv = netdev_priv(dev); | ||
devlink = priv_to_devlink(priv->mdev); | ||
|
||
devlink_port_attrs_set(&priv->dl_phy_port, | ||
DEVLINK_PORT_FLAVOUR_PHYSICAL, | ||
PCI_FUNC(priv->mdev->pdev->devfn), | ||
false, 0, | ||
NULL, 0); | ||
err = devlink_port_register(devlink, &priv->dl_phy_port, 1); | ||
if (err) | ||
return err; | ||
devlink_port_type_eth_set(&priv->dl_phy_port, dev); | ||
return 0; | ||
} | ||
|
||
void mlx5e_devlink_phy_port_unregister(struct mlx5e_priv *priv) | ||
{ | ||
devlink_port_unregister(&priv->dl_phy_port); | ||
} | ||
|
||
struct devlink_port *mlx5e_get_devlink_phy_port(struct net_device *dev) | ||
{ | ||
struct mlx5e_priv *priv = netdev_priv(dev); | ||
|
||
return &priv->dl_phy_port; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */ | ||
/* Copyright (c) 2020, Mellanox Technologies inc. All rights reserved. */ | ||
|
||
#ifndef __MLX5E_EN_DEVLINK_H | ||
#define __MLX5E_EN_DEVLINK_H | ||
|
||
#include <net/devlink.h> | ||
#include "en.h" | ||
|
||
int mlx5e_devlink_phy_port_register(struct net_device *dev); | ||
void mlx5e_devlink_phy_port_unregister(struct mlx5e_priv *priv); | ||
struct devlink_port *mlx5e_get_devlink_phy_port(struct net_device *dev); | ||
|
||
#endif | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters