xref: /linux-6.15/include/linux/mlx4/driver.h (revision c138cdb8)
1225c7b1fSRoland Dreier /*
2225c7b1fSRoland Dreier  * Copyright (c) 2006 Cisco Systems, Inc.  All rights reserved.
3225c7b1fSRoland Dreier  *
4225c7b1fSRoland Dreier  * This software is available to you under a choice of one of two
5225c7b1fSRoland Dreier  * licenses.  You may choose to be licensed under the terms of the GNU
6225c7b1fSRoland Dreier  * General Public License (GPL) Version 2, available from the file
7225c7b1fSRoland Dreier  * COPYING in the main directory of this source tree, or the
8225c7b1fSRoland Dreier  * OpenIB.org BSD license below:
9225c7b1fSRoland Dreier  *
10225c7b1fSRoland Dreier  *     Redistribution and use in source and binary forms, with or
11225c7b1fSRoland Dreier  *     without modification, are permitted provided that the following
12225c7b1fSRoland Dreier  *     conditions are met:
13225c7b1fSRoland Dreier  *
14225c7b1fSRoland Dreier  *      - Redistributions of source code must retain the above
15225c7b1fSRoland Dreier  *        copyright notice, this list of conditions and the following
16225c7b1fSRoland Dreier  *        disclaimer.
17225c7b1fSRoland Dreier  *
18225c7b1fSRoland Dreier  *      - Redistributions in binary form must reproduce the above
19225c7b1fSRoland Dreier  *        copyright notice, this list of conditions and the following
20225c7b1fSRoland Dreier  *        disclaimer in the documentation and/or other materials
21225c7b1fSRoland Dreier  *        provided with the distribution.
22225c7b1fSRoland Dreier  *
23225c7b1fSRoland Dreier  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24225c7b1fSRoland Dreier  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25225c7b1fSRoland Dreier  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26225c7b1fSRoland Dreier  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27225c7b1fSRoland Dreier  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28225c7b1fSRoland Dreier  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29225c7b1fSRoland Dreier  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30225c7b1fSRoland Dreier  * SOFTWARE.
31225c7b1fSRoland Dreier  */
32225c7b1fSRoland Dreier 
33225c7b1fSRoland Dreier #ifndef MLX4_DRIVER_H
34225c7b1fSRoland Dreier #define MLX4_DRIVER_H
35225c7b1fSRoland Dreier 
3609d4d087SJiri Pirko #include <net/devlink.h>
37*8c2d2b87SPetr Pavlu #include <linux/auxiliary_bus.h>
3873d68002SPetr Pavlu #include <linux/notifier.h>
39da995a8aSAleksey Senin #include <linux/mlx4/device.h>
40225c7b1fSRoland Dreier 
41*8c2d2b87SPetr Pavlu #define MLX4_ADEV_NAME "mlx4_core"
42*8c2d2b87SPetr Pavlu 
43225c7b1fSRoland Dreier struct mlx4_dev;
44225c7b1fSRoland Dreier 
45af22d9deSAmir Vadai #define MLX4_MAC_MASK	   0xffffffffffffULL
46af22d9deSAmir Vadai 
47225c7b1fSRoland Dreier enum mlx4_dev_event {
48225c7b1fSRoland Dreier 	MLX4_DEV_EVENT_CATASTROPHIC_ERROR,
49225c7b1fSRoland Dreier 	MLX4_DEV_EVENT_PORT_UP,
50225c7b1fSRoland Dreier 	MLX4_DEV_EVENT_PORT_DOWN,
51225c7b1fSRoland Dreier 	MLX4_DEV_EVENT_PORT_REINIT,
5200f5ce99SJack Morgenstein 	MLX4_DEV_EVENT_PORT_MGMT_CHANGE,
53fc06573dSJack Morgenstein 	MLX4_DEV_EVENT_SLAVE_INIT,
54fc06573dSJack Morgenstein 	MLX4_DEV_EVENT_SLAVE_SHUTDOWN,
55225c7b1fSRoland Dreier };
56225c7b1fSRoland Dreier 
5753f33ae2SMoni Shoua enum {
5853f33ae2SMoni Shoua 	MLX4_INTFF_BONDING	= 1 << 0
5953f33ae2SMoni Shoua };
6053f33ae2SMoni Shoua 
61*8c2d2b87SPetr Pavlu struct mlx4_adrv {
62*8c2d2b87SPetr Pavlu 	struct auxiliary_driver	adrv;
63*8c2d2b87SPetr Pavlu 	enum mlx4_protocol	protocol;
64*8c2d2b87SPetr Pavlu 	int			flags;
65*8c2d2b87SPetr Pavlu };
66*8c2d2b87SPetr Pavlu 
67*8c2d2b87SPetr Pavlu int mlx4_register_auxiliary_driver(struct mlx4_adrv *madrv);
68*8c2d2b87SPetr Pavlu void mlx4_unregister_auxiliary_driver(struct mlx4_adrv *madrv);
69225c7b1fSRoland Dreier 
7073d68002SPetr Pavlu int mlx4_register_event_notifier(struct mlx4_dev *dev,
7173d68002SPetr Pavlu 				 struct notifier_block *nb);
7273d68002SPetr Pavlu int mlx4_unregister_event_notifier(struct mlx4_dev *dev,
7373d68002SPetr Pavlu 				   struct notifier_block *nb);
7473d68002SPetr Pavlu 
7509d4d087SJiri Pirko struct devlink_port *mlx4_get_devlink_port(struct mlx4_dev *dev, int port);
7609d4d087SJiri Pirko 
77225c7b1fSRoland Dreier #endif /* MLX4_DRIVER_H */
78