0001
0002
0003
0004
0005
0006 #ifndef _OPA_VNIC_H
0007 #define _OPA_VNIC_H
0008
0009
0010
0011
0012
0013
0014 #include <rdma/ib_verbs.h>
0015
0016
0017 #define OPA_VNIC_L2_HDR_LEN (16 + 2)
0018
0019 #define OPA_VNIC_L4_HDR_LEN 2
0020
0021 #define OPA_VNIC_HDR_LEN (OPA_VNIC_L2_HDR_LEN + \
0022 OPA_VNIC_L4_HDR_LEN)
0023
0024 #define OPA_VNIC_L4_ETHR 0x78
0025
0026 #define OPA_VNIC_ICRC_LEN 4
0027 #define OPA_VNIC_TAIL_LEN 1
0028 #define OPA_VNIC_ICRC_TAIL_LEN (OPA_VNIC_ICRC_LEN + OPA_VNIC_TAIL_LEN)
0029
0030 #define OPA_VNIC_SKB_MDATA_LEN 4
0031 #define OPA_VNIC_SKB_MDATA_ENCAP_ERR 0x1
0032
0033
0034 struct opa_vnic_rdma_netdev {
0035 struct rdma_netdev rn;
0036
0037 char *dev_priv[];
0038 };
0039
0040 static inline void *opa_vnic_priv(const struct net_device *dev)
0041 {
0042 struct rdma_netdev *rn = netdev_priv(dev);
0043
0044 return rn->clnt_priv;
0045 }
0046
0047 static inline void *opa_vnic_dev_priv(const struct net_device *dev)
0048 {
0049 struct opa_vnic_rdma_netdev *oparn = netdev_priv(dev);
0050
0051 return oparn->dev_priv;
0052 }
0053
0054
0055 struct opa_vnic_skb_mdata {
0056 u8 vl;
0057 u8 entropy;
0058 u8 flags;
0059 u8 rsvd;
0060 } __packed;
0061
0062
0063 struct opa_vnic_grp_stats {
0064 u64 unicast;
0065 u64 mcastbcast;
0066 u64 untagged;
0067 u64 vlan;
0068 u64 s_64;
0069 u64 s_65_127;
0070 u64 s_128_255;
0071 u64 s_256_511;
0072 u64 s_512_1023;
0073 u64 s_1024_1518;
0074 u64 s_1519_max;
0075 };
0076
0077 struct opa_vnic_stats {
0078
0079 struct rtnl_link_stats64 netstats;
0080
0081
0082 struct opa_vnic_grp_stats tx_grp;
0083 struct opa_vnic_grp_stats rx_grp;
0084 u64 tx_dlid_zero;
0085 u64 tx_drop_state;
0086 u64 rx_drop_state;
0087 u64 rx_runt;
0088 u64 rx_oversize;
0089 };
0090
0091 static inline bool rdma_cap_opa_vnic(struct ib_device *device)
0092 {
0093 return !!(device->attrs.kernel_cap_flags & IBK_RDMA_NETDEV_OPA);
0094 }
0095
0096 #endif