2017-04-12 21:36:55 -06:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2017, Mellanox Technologies. All rights reserved.
|
|
|
|
*
|
|
|
|
* This software is available to you under a choice of one of two
|
|
|
|
* licenses. You may choose to be licensed under the terms of the GNU
|
|
|
|
* General Public License (GPL) Version 2, available from the file
|
|
|
|
* COPYING in the main directory of this source tree, or the
|
|
|
|
* OpenIB.org BSD license below:
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or
|
|
|
|
* without modification, are permitted provided that the following
|
|
|
|
* conditions are met:
|
|
|
|
*
|
|
|
|
* - Redistributions of source code must retain the above
|
|
|
|
* copyright notice, this list of conditions and the following
|
|
|
|
* disclaimer.
|
|
|
|
*
|
|
|
|
* - Redistributions in binary form must reproduce the above
|
|
|
|
* copyright notice, this list of conditions and the following
|
|
|
|
* disclaimer in the documentation and/or other materials
|
|
|
|
* provided with the distribution.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
|
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
|
|
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
|
|
|
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
|
|
|
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
|
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
|
* SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __MLX5E_IPOB_H__
|
|
|
|
#define __MLX5E_IPOB_H__
|
|
|
|
|
|
|
|
#include <linux/mlx5/fs.h>
|
|
|
|
#include "en.h"
|
|
|
|
|
|
|
|
#define MLX5I_MAX_NUM_TC 1
|
|
|
|
|
2017-05-15 04:32:28 -06:00
|
|
|
extern const struct ethtool_ops mlx5i_ethtool_ops;
|
2017-09-14 09:02:31 -06:00
|
|
|
extern const struct ethtool_ops mlx5i_pkey_ethtool_ops;
|
2017-05-15 04:32:28 -06:00
|
|
|
|
2017-05-18 08:03:21 -06:00
|
|
|
#define MLX5_IB_GRH_BYTES 40
|
|
|
|
#define MLX5_IPOIB_ENCAP_LEN 4
|
|
|
|
#define MLX5_IPOIB_PSEUDO_LEN 20
|
|
|
|
#define MLX5_IPOIB_HARD_LEN (MLX5_IPOIB_PSEUDO_LEN + MLX5_IPOIB_ENCAP_LEN)
|
|
|
|
|
2017-04-12 21:36:55 -06:00
|
|
|
/* ipoib rdma netdev's private data structure */
|
|
|
|
struct mlx5i_priv {
|
2017-04-27 08:01:34 -06:00
|
|
|
struct rdma_netdev rn; /* keep this first */
|
2017-04-12 21:36:55 -06:00
|
|
|
struct mlx5_core_qp qp;
|
2017-09-14 09:22:50 -06:00
|
|
|
bool sub_interface;
|
2017-04-27 08:01:34 -06:00
|
|
|
u32 qkey;
|
2017-09-13 03:17:50 -06:00
|
|
|
u16 pkey_index;
|
2017-09-14 01:27:25 -06:00
|
|
|
struct mlx5i_pkey_qpn_ht *qpn_htbl;
|
2017-04-12 21:36:55 -06:00
|
|
|
char *mlx5e_priv[0];
|
|
|
|
};
|
|
|
|
|
2017-09-14 05:08:39 -06:00
|
|
|
/* Underlay QP create/destroy functions */
|
|
|
|
int mlx5i_create_underlay_qp(struct mlx5_core_dev *mdev, struct mlx5_core_qp *qp);
|
|
|
|
void mlx5i_destroy_underlay_qp(struct mlx5_core_dev *mdev, struct mlx5_core_qp *qp);
|
|
|
|
|
2017-09-14 07:33:35 -06:00
|
|
|
/* Underlay QP state modification init/uninit functions */
|
|
|
|
int mlx5i_init_underlay_qp(struct mlx5e_priv *priv);
|
|
|
|
void mlx5i_uninit_underlay_qp(struct mlx5e_priv *priv);
|
|
|
|
|
2017-09-14 01:27:25 -06:00
|
|
|
/* Allocate/Free underlay QPN to net-device hash table */
|
|
|
|
int mlx5i_pkey_qpn_ht_init(struct net_device *netdev);
|
|
|
|
void mlx5i_pkey_qpn_ht_cleanup(struct net_device *netdev);
|
|
|
|
|
|
|
|
/* Add/Remove an underlay QPN to net-device mapping to/from the hash table */
|
|
|
|
int mlx5i_pkey_add_qpn(struct net_device *netdev, u32 qpn);
|
|
|
|
int mlx5i_pkey_del_qpn(struct net_device *netdev, u32 qpn);
|
|
|
|
|
|
|
|
/* Get the net-device corresponding to the given underlay QPN */
|
|
|
|
struct net_device *mlx5i_pkey_get_netdev(struct net_device *netdev, u32 qpn);
|
|
|
|
|
2017-09-14 07:33:35 -06:00
|
|
|
/* Shared ndo functionts */
|
|
|
|
int mlx5i_dev_init(struct net_device *dev);
|
|
|
|
void mlx5i_dev_cleanup(struct net_device *dev);
|
|
|
|
|
2017-09-14 05:08:39 -06:00
|
|
|
/* Parent profile functions */
|
|
|
|
void mlx5i_init(struct mlx5_core_dev *mdev,
|
|
|
|
struct net_device *netdev,
|
|
|
|
const struct mlx5e_profile *profile,
|
|
|
|
void *ppriv);
|
|
|
|
|
|
|
|
/* Get child interface nic profile */
|
|
|
|
const struct mlx5e_profile *mlx5i_pkey_get_profile(void);
|
|
|
|
|
2017-04-12 21:36:55 -06:00
|
|
|
/* Extract mlx5e_priv from IPoIB netdev */
|
|
|
|
#define mlx5i_epriv(netdev) ((void *)(((struct mlx5i_priv *)netdev_priv(netdev))->mlx5e_priv))
|
|
|
|
|
2017-04-12 21:37:02 -06:00
|
|
|
netdev_tx_t mlx5i_sq_xmit(struct mlx5e_txqsq *sq, struct sk_buff *skb,
|
|
|
|
struct mlx5_av *av, u32 dqpn, u32 dqkey);
|
2017-04-12 21:37:04 -06:00
|
|
|
void mlx5i_handle_rx_cqe(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe);
|
2017-04-12 21:37:02 -06:00
|
|
|
|
2017-04-12 21:36:55 -06:00
|
|
|
#endif /* __MLX5E_IPOB_H__ */
|