0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033 #ifndef MLX4_DRIVER_H
0034 #define MLX4_DRIVER_H
0035
0036 #include <net/devlink.h>
0037 #include <linux/mlx4/device.h>
0038
0039 struct mlx4_dev;
0040
0041 #define MLX4_MAC_MASK 0xffffffffffffULL
0042
0043 enum mlx4_dev_event {
0044 MLX4_DEV_EVENT_CATASTROPHIC_ERROR,
0045 MLX4_DEV_EVENT_PORT_UP,
0046 MLX4_DEV_EVENT_PORT_DOWN,
0047 MLX4_DEV_EVENT_PORT_REINIT,
0048 MLX4_DEV_EVENT_PORT_MGMT_CHANGE,
0049 MLX4_DEV_EVENT_SLAVE_INIT,
0050 MLX4_DEV_EVENT_SLAVE_SHUTDOWN,
0051 };
0052
0053 enum {
0054 MLX4_INTFF_BONDING = 1 << 0
0055 };
0056
0057 struct mlx4_interface {
0058 void * (*add) (struct mlx4_dev *dev);
0059 void (*remove)(struct mlx4_dev *dev, void *context);
0060 void (*event) (struct mlx4_dev *dev, void *context,
0061 enum mlx4_dev_event event, unsigned long param);
0062 void * (*get_dev)(struct mlx4_dev *dev, void *context, u8 port);
0063 void (*activate)(struct mlx4_dev *dev, void *context);
0064 struct list_head list;
0065 enum mlx4_protocol protocol;
0066 int flags;
0067 };
0068
0069 int mlx4_register_interface(struct mlx4_interface *intf);
0070 void mlx4_unregister_interface(struct mlx4_interface *intf);
0071
0072 int mlx4_bond(struct mlx4_dev *dev);
0073 int mlx4_unbond(struct mlx4_dev *dev);
0074 static inline int mlx4_is_bonded(struct mlx4_dev *dev)
0075 {
0076 return !!(dev->flags & MLX4_FLAG_BONDED);
0077 }
0078
0079 static inline int mlx4_is_mf_bonded(struct mlx4_dev *dev)
0080 {
0081 return (mlx4_is_bonded(dev) && mlx4_is_mfunc(dev));
0082 }
0083
0084 struct mlx4_port_map {
0085 u8 port1;
0086 u8 port2;
0087 };
0088
0089 int mlx4_port_map_set(struct mlx4_dev *dev, struct mlx4_port_map *v2p);
0090
0091 void *mlx4_get_protocol_dev(struct mlx4_dev *dev, enum mlx4_protocol proto, int port);
0092
0093 struct devlink_port *mlx4_get_devlink_port(struct mlx4_dev *dev, int port);
0094
0095 #endif