1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
3 * Copyright(c) 2017 - 2020 Intel Corporation.
10 * This file contains Intel Omni-Path (OPA) Virtual Network Interface
11 * Controller (VNIC) specific declarations.
14 #include <rdma/ib_verbs.h>
16 /* 16 header bytes + 2 reserved bytes */
17 #define OPA_VNIC_L2_HDR_LEN (16 + 2)
19 #define OPA_VNIC_L4_HDR_LEN 2
21 #define OPA_VNIC_HDR_LEN (OPA_VNIC_L2_HDR_LEN + \
24 #define OPA_VNIC_L4_ETHR 0x78
26 #define OPA_VNIC_ICRC_LEN 4
27 #define OPA_VNIC_TAIL_LEN 1
28 #define OPA_VNIC_ICRC_TAIL_LEN (OPA_VNIC_ICRC_LEN + OPA_VNIC_TAIL_LEN)
30 #define OPA_VNIC_SKB_MDATA_LEN 4
31 #define OPA_VNIC_SKB_MDATA_ENCAP_ERR 0x1
33 /* opa vnic rdma netdev's private data structure */
34 struct opa_vnic_rdma_netdev {
35 struct rdma_netdev rn; /* keep this first */
36 /* followed by device private data */
40 static inline void *opa_vnic_priv(const struct net_device *dev)
42 struct rdma_netdev *rn = netdev_priv(dev);
47 static inline void *opa_vnic_dev_priv(const struct net_device *dev)
49 struct opa_vnic_rdma_netdev *oparn = netdev_priv(dev);
51 return oparn->dev_priv;
54 /* opa_vnic skb meta data structure */
55 struct opa_vnic_skb_mdata {
62 /* OPA VNIC group statistics */
63 struct opa_vnic_grp_stats {
77 struct opa_vnic_stats {
78 /* standard netdev statistics */
79 struct rtnl_link_stats64 netstats;
81 /* OPA VNIC statistics */
82 struct opa_vnic_grp_stats tx_grp;
83 struct opa_vnic_grp_stats rx_grp;
91 static inline bool rdma_cap_opa_vnic(struct ib_device *device)
93 return !!(device->attrs.kernel_cap_flags & IBK_RDMA_NETDEV_OPA);
96 #endif /* _OPA_VNIC_H */