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 __MLX5E_IPOB_H__
0034 #define __MLX5E_IPOB_H__
0035
0036 #ifdef CONFIG_MLX5_CORE_IPOIB
0037
0038 #include <linux/mlx5/fs.h>
0039 #include "en.h"
0040
0041 #define MLX5I_MAX_NUM_TC 1
0042
0043 extern const struct ethtool_ops mlx5i_ethtool_ops;
0044 extern const struct ethtool_ops mlx5i_pkey_ethtool_ops;
0045 extern const struct mlx5e_rx_handlers mlx5i_rx_handlers;
0046
0047 #define MLX5_IB_GRH_BYTES 40
0048 #define MLX5_IPOIB_ENCAP_LEN 4
0049 #define MLX5_IPOIB_PSEUDO_LEN 20
0050 #define MLX5_IPOIB_HARD_LEN (MLX5_IPOIB_PSEUDO_LEN + MLX5_IPOIB_ENCAP_LEN)
0051
0052
0053 struct mlx5i_priv {
0054 struct rdma_netdev rn;
0055 u32 qpn;
0056 bool sub_interface;
0057 u32 qkey;
0058 u16 pkey_index;
0059 struct mlx5i_pkey_qpn_ht *qpn_htbl;
0060 char *mlx5e_priv[];
0061 };
0062
0063 int mlx5i_create_tis(struct mlx5_core_dev *mdev, u32 underlay_qpn, u32 *tisn);
0064
0065
0066 int mlx5i_create_underlay_qp(struct mlx5e_priv *priv);
0067 void mlx5i_destroy_underlay_qp(struct mlx5_core_dev *mdev, u32 qpn);
0068
0069
0070 int mlx5i_init_underlay_qp(struct mlx5e_priv *priv);
0071 void mlx5i_uninit_underlay_qp(struct mlx5e_priv *priv);
0072
0073
0074 int mlx5i_pkey_qpn_ht_init(struct net_device *netdev);
0075 void mlx5i_pkey_qpn_ht_cleanup(struct net_device *netdev);
0076
0077
0078 int mlx5i_pkey_add_qpn(struct net_device *netdev, u32 qpn);
0079 int mlx5i_pkey_del_qpn(struct net_device *netdev, u32 qpn);
0080
0081
0082 struct net_device *mlx5i_pkey_get_netdev(struct net_device *netdev, u32 qpn);
0083
0084
0085 int mlx5i_dev_init(struct net_device *dev);
0086 void mlx5i_dev_cleanup(struct net_device *dev);
0087 int mlx5i_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
0088
0089
0090 int mlx5i_init(struct mlx5_core_dev *mdev, struct net_device *netdev);
0091 void mlx5i_cleanup(struct mlx5e_priv *priv);
0092
0093 int mlx5i_update_nic_rx(struct mlx5e_priv *priv);
0094
0095
0096 const struct mlx5e_profile *mlx5i_pkey_get_profile(void);
0097
0098
0099 #define mlx5i_epriv(netdev) ((void *)(((struct mlx5i_priv *)netdev_priv(netdev))->mlx5e_priv))
0100
0101 struct mlx5_wqe_eth_pad {
0102 u8 rsvd0[16];
0103 };
0104
0105 struct mlx5i_tx_wqe {
0106 struct mlx5_wqe_ctrl_seg ctrl;
0107 struct mlx5_wqe_datagram_seg datagram;
0108 struct mlx5_wqe_eth_pad pad;
0109 struct mlx5_wqe_eth_seg eth;
0110 struct mlx5_wqe_data_seg data[];
0111 };
0112
0113 #define MLX5I_SQ_FETCH_WQE(sq, pi) \
0114 ((struct mlx5i_tx_wqe *)mlx5e_fetch_wqe(&(sq)->wq, pi, sizeof(struct mlx5i_tx_wqe)))
0115
0116 void mlx5i_sq_xmit(struct mlx5e_txqsq *sq, struct sk_buff *skb,
0117 struct mlx5_av *av, u32 dqpn, u32 dqkey, bool xmit_more);
0118 void mlx5i_get_stats(struct net_device *dev, struct rtnl_link_stats64 *stats);
0119
0120 #endif
0121 #endif