libnl 3.5.0

sriov.h
1 /*
2 * include/netlink/route/link/sriov.h SRIOV VF Info
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation version 2.1
7 * of the License.
8 *
9 * Copyright (c) 2016 Intel Corp. All rights reserved.
10 * Copyright (c) 2016 Jef Oliver <jef.oliver@intel.com>
11 */
12
13 #ifndef NETLINK_LINK_SRIOV_H_
14 #define NETLINK_LINK_SRIOV_H_
15
16 #include <netlink/netlink.h>
17 #include <netlink/route/link.h>
18
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22
23 #define RTNL_VF_GUID_STR_LEN 23
24
25 /**
26 * @ingroup sriov
27 */
28 typedef enum {
29 RTNL_LINK_VF_RATE_API_UNSPEC, /*!< Unspecified API type */
30 RTNL_LINK_VF_RATE_API_OLD, /*!< Old Rate setting API */
31 RTNL_LINK_VF_RATE_API_NEW, /*!< New Rate setting API */
32 __RTNL_LINK_VF_RATE_API_MAX,
33 } rtnl_link_rate_api_t;
34
35 #define RTNL_LINK_VF_RATE_API_MAX (__RTNL_LINK_VF_RATE_API_MAX - 1)
36
37 /**
38 * @ingroup sriov
39 */
40 typedef enum {
41 RTNL_LINK_VF_STATS_RX_PACKETS, /*!< Packets Received */
42 RTNL_LINK_VF_STATS_TX_PACKETS, /*!< Packets Sent */
43 RTNL_LINK_VF_STATS_RX_BYTES, /*!< Bytes Recieved */
44 RTNL_LINK_VF_STATS_TX_BYTES, /*!< Bytes Sent */
45 RTNL_LINK_VF_STATS_BROADCAST, /*!< Broadcast packets received */
46 RTNL_LINK_VF_STATS_MULTICAST, /*!< Multicast packets received */
47 __RTNL_LINK_VF_STATS_MAX,
48 } rtnl_link_vf_stats_t;
49
50 #define RTNL_LINK_VF_STATS_MAX (__RTNL_LINK_VF_STATS_MAX - 1)
51
52 /**
53 * @struct rtnl_link_vf sriov.h "netlink/route/link/sriov.h"
54 * @brief SRIOV VF object
55 * @ingroup sriov
56 *
57 * @copydoc private_struct
58 */
59 struct rtnl_link_vf;
60
61 /**
62 * @brief SRIOV VF VFLAN settings
63 * @ingroup sriov
64 */
65 typedef struct nl_vf_vlan_info {
66 uint32_t vf_vlan; /*!< VLAN number */
67 uint32_t vf_vlan_qos; /*!< VLAN QOS value */
68 uint16_t vf_vlan_proto; /*!< VLAN protocol */
69 } nl_vf_vlan_info_t;
70
71 /**
72 * @brief SRIOV VF VLANs information
73 * @ingroup sriov
74 */
75 typedef struct nl_vf_vlans {
76 int ce_refcnt; /*!< Reference counter. Don't change this value */
77 int size; /*!< Number of VLANs on the SRIOV VF */
78 nl_vf_vlan_info_t * vlans; /*!< nl_vf_vlan_info_t array of SRIOV VF VLANs */
79 } nl_vf_vlans_t;
80
81 /**
82 * @brief VF Rate information structure
83 * @ingroup sriov
84 */
85 struct nl_vf_rate {
86 int api; /*!< rtnl_link_rate_api_t API Version to use */
87 uint32_t rate; /*!< Old API Max Rate in Mbps */
88 uint32_t max_tx_rate; /*!< New API Max Rate in Mbps */
89 uint32_t min_tx_rate; /*!< New API Mix Rate in Mbps */
90 };
91
92 extern int rtnl_link_vf_add(struct rtnl_link *, struct rtnl_link_vf *);
93 extern struct rtnl_link_vf *rtnl_link_vf_alloc(void);
94 extern void rtnl_link_vf_free(struct rtnl_link_vf *);
95 extern struct rtnl_link_vf *rtnl_link_vf_get(struct rtnl_link *, uint32_t);
96 extern void rtnl_link_vf_put(struct rtnl_link_vf *);
97
98 extern int rtnl_link_vf_get_addr(struct rtnl_link_vf *, struct nl_addr **);
99 extern void rtnl_link_vf_set_addr(struct rtnl_link_vf *, struct nl_addr *);
100
101 extern void rtnl_link_vf_set_ib_node_guid(struct rtnl_link_vf *, uint64_t);
102 extern void rtnl_link_vf_set_ib_port_guid(struct rtnl_link_vf *, uint64_t);
103
104 extern int rtnl_link_vf_get_index(struct rtnl_link_vf *, uint32_t *);
105 extern void rtnl_link_vf_set_index(struct rtnl_link_vf *, uint32_t);
106
107 extern int rtnl_link_vf_get_linkstate(struct rtnl_link_vf *, uint32_t *);
108 extern void rtnl_link_vf_set_linkstate(struct rtnl_link_vf *, uint32_t);
109
110 extern int rtnl_link_vf_get_rate(struct rtnl_link_vf *, struct nl_vf_rate *);
111 extern void rtnl_link_vf_set_rate(struct rtnl_link_vf *, struct nl_vf_rate *);
112
113 extern int rtnl_link_vf_get_rss_query_en(struct rtnl_link_vf *, uint32_t *);
114 extern void rtnl_link_vf_set_rss_query_en(struct rtnl_link_vf *, uint32_t);
115
116 extern int rtnl_link_vf_get_spoofchk(struct rtnl_link_vf *, uint32_t *);
117 extern void rtnl_link_vf_set_spoofchk(struct rtnl_link_vf *, uint32_t);
118
119 extern int rtnl_link_vf_get_stat(struct rtnl_link_vf *, rtnl_link_vf_stats_t,
120 uint64_t *);
121
122 extern int rtnl_link_vf_get_trust(struct rtnl_link_vf *, uint32_t *);
123 extern void rtnl_link_vf_set_trust(struct rtnl_link_vf *, uint32_t);
124
125 extern int rtnl_link_vf_get_vlans(struct rtnl_link_vf *, nl_vf_vlans_t **);
126 extern void rtnl_link_vf_set_vlans(struct rtnl_link_vf *, nl_vf_vlans_t *);
127
128 extern int rtnl_link_vf_vlan_alloc(nl_vf_vlans_t **, int);
129 extern void rtnl_link_vf_vlan_free(nl_vf_vlans_t *vf_vlans);
130 extern void rtnl_link_vf_vlan_put(nl_vf_vlans_t *);
131
132 /* Utility functions */
133 extern char *rtnl_link_vf_linkstate2str(uint32_t, char *, size_t);
134 extern int rtnl_link_vf_str2linkstate(const char *);
135
136 extern char *rtnl_link_vf_vlanproto2str(uint16_t, char *, size_t);
137 extern int rtnl_link_vf_str2vlanproto(const char *);
138
139 extern int rtnl_link_vf_str2guid(uint64_t *, const char *);
140
141 #ifdef __cplusplus
142 }
143 #endif
144
145 #endif
rtnl_link_vf_get_trust
int rtnl_link_vf_get_trust(struct rtnl_link_vf *, uint32_t *)
Get trust setting of SRIOV Virtual Function.
Definition: sriov.c:1227
nl_vf_vlans
SRIOV VF VLANs information.
Definition: sriov.h:75
nl_vf_vlans::size
int size
Definition: sriov.h:77
rtnl_link_vf_get_stat
int rtnl_link_vf_get_stat(struct rtnl_link_vf *, rtnl_link_vf_stats_t, uint64_t *)
Get value of stat counter for SRIOV Virtual Function.
Definition: sriov.c:1201
RTNL_LINK_VF_RATE_API_UNSPEC
Definition: sriov.h:29
nl_vf_vlan_info::vf_vlan
uint32_t vf_vlan
Definition: sriov.h:66
nl_vf_rate::api
int api
Definition: sriov.h:86
nl_vf_rate::rate
uint32_t rate
Definition: sriov.h:87
rtnl_link_vf_alloc
struct rtnl_link_vf * rtnl_link_vf_alloc(void)
Allocate a new SRIOV VF object.
Definition: sriov.c:754
rtnl_link_vf_put
void rtnl_link_vf_put(struct rtnl_link_vf *)
Return SRIOV VF object to the owning link object.
Definition: sriov.c:828
nl_vf_vlan_info
SRIOV VF VFLAN settings.
Definition: sriov.h:65
rtnl_link_vf_set_index
void rtnl_link_vf_set_index(struct rtnl_link_vf *, uint32_t)
Set index of SRIOV Virtual Function object.
Definition: sriov.c:949
rtnl_link
Link object.
rtnl_link_vf_set_spoofchk
void rtnl_link_vf_set_spoofchk(struct rtnl_link_vf *, uint32_t)
Set spoof checking value of SRIOV Virtual Function Object.
Definition: sriov.c:1181
rtnl_link_vf_set_linkstate
void rtnl_link_vf_set_linkstate(struct rtnl_link_vf *, uint32_t)
Set link state of SRIOV Virtual Function object.
Definition: sriov.c:993
rtnl_link_vf_get_vlans
int rtnl_link_vf_get_vlans(struct rtnl_link_vf *, nl_vf_vlans_t **)
Get an array of VLANS on SRIOV Virtual Function.
Definition: sriov.c:1269
nl_vf_vlan_info_t
struct nl_vf_vlan_info nl_vf_vlan_info_t
SRIOV VF VFLAN settings.
rtnl_link_vf_vlan_put
void rtnl_link_vf_vlan_put(nl_vf_vlans_t *)
Return SRIOV VF VLANs object to the owning SRIOV VF object.
Definition: sriov.c:1371
RTNL_LINK_VF_STATS_TX_BYTES
Definition: sriov.h:44
rtnl_link_rate_api_t
rtnl_link_rate_api_t
Definition: sriov.h:28
RTNL_LINK_VF_STATS_RX_PACKETS
Definition: sriov.h:41
nl_vf_vlans::vlans
nl_vf_vlan_info_t * vlans
Definition: sriov.h:78
rtnl_link_vf_get_addr
int rtnl_link_vf_get_addr(struct rtnl_link_vf *, struct nl_addr **)
Get link layer address of SRIOV Virtual Function.
Definition: sriov.c:858
RTNL_LINK_VF_RATE_API_OLD
Definition: sriov.h:30
RTNL_LINK_VF_STATS_RX_BYTES
Definition: sriov.h:43
nl_vf_rate::min_tx_rate
uint32_t min_tx_rate
Definition: sriov.h:89
rtnl_link_vf_get_index
int rtnl_link_vf_get_index(struct rtnl_link_vf *, uint32_t *)
Get index of SRIOV Virtual Function.
Definition: sriov.c:929
rtnl_link_vf_set_rss_query_en
void rtnl_link_vf_set_rss_query_en(struct rtnl_link_vf *, uint32_t)
Set RSS configuration querying of SRIOV Virtual Function Object.
Definition: sriov.c:1140
rtnl_link_vf_get
struct rtnl_link_vf * rtnl_link_vf_get(struct rtnl_link *, uint32_t)
Lookup SRIOV VF in link object by VF index.
Definition: sriov.c:801
nl_vf_vlans_t
struct nl_vf_vlans nl_vf_vlans_t
SRIOV VF VLANs information.
rtnl_link_vf_set_addr
void rtnl_link_vf_set_addr(struct rtnl_link_vf *, struct nl_addr *)
Set link layer address of SRIOV Virtual Function object.
Definition: sriov.c:881
rtnl_link_vf_set_ib_port_guid
void rtnl_link_vf_set_ib_port_guid(struct rtnl_link_vf *, uint64_t)
Set the Infiniband port GUID for the SRIOV Virtual Function object.
Definition: sriov.c:910
rtnl_link_vf_add
int rtnl_link_vf_add(struct rtnl_link *, struct rtnl_link_vf *)
Add a SRIOV VF object to a link object.
Definition: sriov.c:719
rtnl_link_vf_get_rss_query_en
int rtnl_link_vf_get_rss_query_en(struct rtnl_link_vf *, uint32_t *)
Get RSS Query EN value of SRIOV Virtual Function.
Definition: sriov.c:1119
RTNL_LINK_VF_RATE_API_NEW
Definition: sriov.h:31
rtnl_link_vf_get_rate
int rtnl_link_vf_get_rate(struct rtnl_link_vf *, struct nl_vf_rate *)
Get TX Rate Limit of SRIOV Virtual Function.
Definition: sriov.c:1025
rtnl_link_vf_set_ib_node_guid
void rtnl_link_vf_set_ib_node_guid(struct rtnl_link_vf *, uint64_t)
Set the Infiniband node GUID for the SRIOV Virtual Function object.
Definition: sriov.c:897
nl_vf_vlan_info::vf_vlan_proto
uint16_t vf_vlan_proto
Definition: sriov.h:68
nl_vf_vlans::ce_refcnt
int ce_refcnt
Definition: sriov.h:76
RTNL_LINK_VF_STATS_BROADCAST
Definition: sriov.h:45
rtnl_link_vf_vlan_alloc
int rtnl_link_vf_vlan_alloc(nl_vf_vlans_t **, int)
Allocate a SRIOV VF VLAN object.
Definition: sriov.c:1322
RTNL_LINK_VF_STATS_MULTICAST
Definition: sriov.h:46
rtnl_link_vf_set_rate
void rtnl_link_vf_set_rate(struct rtnl_link_vf *, struct nl_vf_rate *)
Set TX Rate Limit of SRIOV Virtual Function object.
Definition: sriov.c:1091
nl_vf_vlan_info::vf_vlan_qos
uint32_t vf_vlan_qos
Definition: sriov.h:67
rtnl_link_vf_get_spoofchk
int rtnl_link_vf_get_spoofchk(struct rtnl_link_vf *, uint32_t *)
Get spoof checking value of SRIOV Virtual Function.
Definition: sriov.c:1160
RTNL_LINK_VF_STATS_TX_PACKETS
Definition: sriov.h:42
rtnl_link_vf_free
void rtnl_link_vf_free(struct rtnl_link_vf *)
Free SRIOV VF object.
Definition: sriov.c:772
nl_vf_rate
VF Rate information structure.
Definition: sriov.h:85
rtnl_link_vf_set_vlans
void rtnl_link_vf_set_vlans(struct rtnl_link_vf *, nl_vf_vlans_t *)
Add a SRIOV VF VLANs object to the SRIOV Virtual Function Object.
Definition: sriov.c:1298
nl_vf_rate::max_tx_rate
uint32_t max_tx_rate
Definition: sriov.h:88
rtnl_link_vf_stats_t
rtnl_link_vf_stats_t
Definition: sriov.h:40
rtnl_link_vf_set_trust
void rtnl_link_vf_set_trust(struct rtnl_link_vf *, uint32_t)
Set user trust setting on SRIOV Virtual Function Object.
Definition: sriov.c:1247
rtnl_link_vf
SRIOV VF object.
rtnl_link_vf_vlan_free
void rtnl_link_vf_vlan_free(nl_vf_vlans_t *vf_vlans)
Free an allocated SRIOV VF VLANs object.
Definition: sriov.c:1353
rtnl_link_vf_get_linkstate
int rtnl_link_vf_get_linkstate(struct rtnl_link_vf *, uint32_t *)
Get link state of SRIOV Virtual Function.
Definition: sriov.c:969