1225c7b1feef1b41170f7037a5b10a65cd8a42c54Roland Dreier/* 2225c7b1feef1b41170f7037a5b10a65cd8a42c54Roland Dreier * Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. 3225c7b1feef1b41170f7037a5b10a65cd8a42c54Roland Dreier * 4225c7b1feef1b41170f7037a5b10a65cd8a42c54Roland Dreier * This software is available to you under a choice of one of two 5225c7b1feef1b41170f7037a5b10a65cd8a42c54Roland Dreier * licenses. You may choose to be licensed under the terms of the GNU 6225c7b1feef1b41170f7037a5b10a65cd8a42c54Roland Dreier * General Public License (GPL) Version 2, available from the file 7225c7b1feef1b41170f7037a5b10a65cd8a42c54Roland Dreier * COPYING in the main directory of this source tree, or the 8225c7b1feef1b41170f7037a5b10a65cd8a42c54Roland Dreier * OpenIB.org BSD license below: 9225c7b1feef1b41170f7037a5b10a65cd8a42c54Roland Dreier * 10225c7b1feef1b41170f7037a5b10a65cd8a42c54Roland Dreier * Redistribution and use in source and binary forms, with or 11225c7b1feef1b41170f7037a5b10a65cd8a42c54Roland Dreier * without modification, are permitted provided that the following 12225c7b1feef1b41170f7037a5b10a65cd8a42c54Roland Dreier * conditions are met: 13225c7b1feef1b41170f7037a5b10a65cd8a42c54Roland Dreier * 14225c7b1feef1b41170f7037a5b10a65cd8a42c54Roland Dreier * - Redistributions of source code must retain the above 15225c7b1feef1b41170f7037a5b10a65cd8a42c54Roland Dreier * copyright notice, this list of conditions and the following 16225c7b1feef1b41170f7037a5b10a65cd8a42c54Roland Dreier * disclaimer. 17225c7b1feef1b41170f7037a5b10a65cd8a42c54Roland Dreier * 18225c7b1feef1b41170f7037a5b10a65cd8a42c54Roland Dreier * - Redistributions in binary form must reproduce the above 19225c7b1feef1b41170f7037a5b10a65cd8a42c54Roland Dreier * copyright notice, this list of conditions and the following 20225c7b1feef1b41170f7037a5b10a65cd8a42c54Roland Dreier * disclaimer in the documentation and/or other materials 21225c7b1feef1b41170f7037a5b10a65cd8a42c54Roland Dreier * provided with the distribution. 22225c7b1feef1b41170f7037a5b10a65cd8a42c54Roland Dreier * 23225c7b1feef1b41170f7037a5b10a65cd8a42c54Roland Dreier * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 24225c7b1feef1b41170f7037a5b10a65cd8a42c54Roland Dreier * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 25225c7b1feef1b41170f7037a5b10a65cd8a42c54Roland Dreier * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 26225c7b1feef1b41170f7037a5b10a65cd8a42c54Roland Dreier * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 27225c7b1feef1b41170f7037a5b10a65cd8a42c54Roland Dreier * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 28225c7b1feef1b41170f7037a5b10a65cd8a42c54Roland Dreier * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 29225c7b1feef1b41170f7037a5b10a65cd8a42c54Roland Dreier * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 30225c7b1feef1b41170f7037a5b10a65cd8a42c54Roland Dreier * SOFTWARE. 31225c7b1feef1b41170f7037a5b10a65cd8a42c54Roland Dreier */ 32225c7b1feef1b41170f7037a5b10a65cd8a42c54Roland Dreier 33225c7b1feef1b41170f7037a5b10a65cd8a42c54Roland Dreier#ifndef MLX4_DRIVER_H 34225c7b1feef1b41170f7037a5b10a65cd8a42c54Roland Dreier#define MLX4_DRIVER_H 35225c7b1feef1b41170f7037a5b10a65cd8a42c54Roland Dreier 36da995a8aee044bc5d0847e19e351cd48a2cb8bccAleksey Senin#include <linux/mlx4/device.h> 37225c7b1feef1b41170f7037a5b10a65cd8a42c54Roland Dreier 38225c7b1feef1b41170f7037a5b10a65cd8a42c54Roland Dreierstruct mlx4_dev; 39225c7b1feef1b41170f7037a5b10a65cd8a42c54Roland Dreier 40af22d9de45caf8b2a99f2b27a927169c029528b4Amir Vadai#define MLX4_MAC_MASK 0xffffffffffffULL 41af22d9de45caf8b2a99f2b27a927169c029528b4Amir Vadai 42225c7b1feef1b41170f7037a5b10a65cd8a42c54Roland Dreierenum mlx4_dev_event { 43225c7b1feef1b41170f7037a5b10a65cd8a42c54Roland Dreier MLX4_DEV_EVENT_CATASTROPHIC_ERROR, 44225c7b1feef1b41170f7037a5b10a65cd8a42c54Roland Dreier MLX4_DEV_EVENT_PORT_UP, 45225c7b1feef1b41170f7037a5b10a65cd8a42c54Roland Dreier MLX4_DEV_EVENT_PORT_DOWN, 46225c7b1feef1b41170f7037a5b10a65cd8a42c54Roland Dreier MLX4_DEV_EVENT_PORT_REINIT, 4700f5ce99dc6ee46c3113393cc8fa12173f9bbcd7Jack Morgenstein MLX4_DEV_EVENT_PORT_MGMT_CHANGE, 48fc06573dfaf8a33bc0533bb70c49de13fa5232a4Jack Morgenstein MLX4_DEV_EVENT_SLAVE_INIT, 49fc06573dfaf8a33bc0533bb70c49de13fa5232a4Jack Morgenstein MLX4_DEV_EVENT_SLAVE_SHUTDOWN, 50225c7b1feef1b41170f7037a5b10a65cd8a42c54Roland Dreier}; 51225c7b1feef1b41170f7037a5b10a65cd8a42c54Roland Dreier 52225c7b1feef1b41170f7037a5b10a65cd8a42c54Roland Dreierstruct mlx4_interface { 53225c7b1feef1b41170f7037a5b10a65cd8a42c54Roland Dreier void * (*add) (struct mlx4_dev *dev); 54225c7b1feef1b41170f7037a5b10a65cd8a42c54Roland Dreier void (*remove)(struct mlx4_dev *dev, void *context); 55225c7b1feef1b41170f7037a5b10a65cd8a42c54Roland Dreier void (*event) (struct mlx4_dev *dev, void *context, 5600f5ce99dc6ee46c3113393cc8fa12173f9bbcd7Jack Morgenstein enum mlx4_dev_event event, unsigned long param); 5733c87f0af60146b375220809c1cb745ac1a86edfEli Cohen void * (*get_dev)(struct mlx4_dev *dev, void *context, u8 port); 58225c7b1feef1b41170f7037a5b10a65cd8a42c54Roland Dreier struct list_head list; 5933c87f0af60146b375220809c1cb745ac1a86edfEli Cohen enum mlx4_protocol protocol; 60225c7b1feef1b41170f7037a5b10a65cd8a42c54Roland Dreier}; 61225c7b1feef1b41170f7037a5b10a65cd8a42c54Roland Dreier 62225c7b1feef1b41170f7037a5b10a65cd8a42c54Roland Dreierint mlx4_register_interface(struct mlx4_interface *intf); 63225c7b1feef1b41170f7037a5b10a65cd8a42c54Roland Dreiervoid mlx4_unregister_interface(struct mlx4_interface *intf); 64225c7b1feef1b41170f7037a5b10a65cd8a42c54Roland Dreier 6533c87f0af60146b375220809c1cb745ac1a86edfEli Cohenvoid *mlx4_get_protocol_dev(struct mlx4_dev *dev, enum mlx4_protocol proto, int port); 6633c87f0af60146b375220809c1cb745ac1a86edfEli Cohen 679813337a4b16ea5b1701b1d00f7e410f5decdfa5Eugenia Emantayevstatic inline u64 mlx4_mac_to_u64(u8 *addr) 689813337a4b16ea5b1701b1d00f7e410f5decdfa5Eugenia Emantayev{ 699813337a4b16ea5b1701b1d00f7e410f5decdfa5Eugenia Emantayev u64 mac = 0; 709813337a4b16ea5b1701b1d00f7e410f5decdfa5Eugenia Emantayev int i; 719813337a4b16ea5b1701b1d00f7e410f5decdfa5Eugenia Emantayev 729813337a4b16ea5b1701b1d00f7e410f5decdfa5Eugenia Emantayev for (i = 0; i < ETH_ALEN; i++) { 739813337a4b16ea5b1701b1d00f7e410f5decdfa5Eugenia Emantayev mac <<= 8; 749813337a4b16ea5b1701b1d00f7e410f5decdfa5Eugenia Emantayev mac |= addr[i]; 759813337a4b16ea5b1701b1d00f7e410f5decdfa5Eugenia Emantayev } 769813337a4b16ea5b1701b1d00f7e410f5decdfa5Eugenia Emantayev return mac; 779813337a4b16ea5b1701b1d00f7e410f5decdfa5Eugenia Emantayev} 789813337a4b16ea5b1701b1d00f7e410f5decdfa5Eugenia Emantayev 79225c7b1feef1b41170f7037a5b10a65cd8a42c54Roland Dreier#endif /* MLX4_DRIVER_H */ 80