libnl: /data/src/libnl/include/netlink/route/link/sriov.h Source File

libnl 3.12.0

sriov.h
1/* SPDX-License-Identifier: LGPL-2.1-only */
2/*
3 * Copyright (c) 2016 Intel Corp. All rights reserved.
4 * Copyright (c) 2016 Jef Oliver <jef.oliver@intel.com>
5 */
6
7#ifndef NETLINK_LINK_SRIOV_H_
8#define NETLINK_LINK_SRIOV_H_
9
10#include <netlink/netlink.h>
11#include <netlink/route/link.h>
12
13#ifdef __cplusplus
14extern "C" {
15#endif
16
17#define RTNL_VF_GUID_STR_LEN 23
18
19/**
20 * @ingroup sriov
21 */
22 typedef enum {
23 RTNL_LINK_VF_RATE_API_UNSPEC, /*!< Unspecified API type */
24 RTNL_LINK_VF_RATE_API_OLD, /*!< Old Rate setting API */
25 RTNL_LINK_VF_RATE_API_NEW, /*!< New Rate setting API */
26 __RTNL_LINK_VF_RATE_API_MAX,
27} rtnl_link_rate_api_t;
28
29#define RTNL_LINK_VF_RATE_API_MAX (__RTNL_LINK_VF_RATE_API_MAX - 1)
30
31/**
32 * @ingroup sriov
33 */
34 typedef enum {
35 RTNL_LINK_VF_STATS_RX_PACKETS, /*!< Packets Received */
36 RTNL_LINK_VF_STATS_TX_PACKETS, /*!< Packets Sent */
37 RTNL_LINK_VF_STATS_RX_BYTES, /*!< Bytes Recieved */
38 RTNL_LINK_VF_STATS_TX_BYTES, /*!< Bytes Sent */
39 RTNL_LINK_VF_STATS_BROADCAST, /*!< Broadcast packets received */
40 RTNL_LINK_VF_STATS_MULTICAST, /*!< Multicast packets received */
41 __RTNL_LINK_VF_STATS_MAX,
42} rtnl_link_vf_stats_t;
43
44#define RTNL_LINK_VF_STATS_MAX (__RTNL_LINK_VF_STATS_MAX - 1)
45
46/**
47 * @struct rtnl_link_vf sriov.h "netlink/route/link/sriov.h"
48 * @brief SRIOV VF object
49 * @ingroup sriov
50 *
51 * @copydoc private_struct
52 */
53struct rtnl_link_vf;
54
55/**
56 * @brief SRIOV VF VFLAN settings
57 * @ingroup sriov
58 */
59 typedef struct nl_vf_vlan_info {
60 uint32_t vf_vlan; /*!< VLAN number */
61 uint32_t vf_vlan_qos; /*!< VLAN QOS value */
62 uint16_t vf_vlan_proto; /*!< VLAN protocol */
63} nl_vf_vlan_info_t;
64
65/**
66 * @brief SRIOV VF VLANs information
67 * @ingroup sriov
68 */
69 typedef struct nl_vf_vlans {
70 int ce_refcnt; /*!< Reference counter. Don't change this value */
71 int size; /*!< Number of VLANs on the SRIOV VF */
72 nl_vf_vlan_info_t * vlans; /*!< nl_vf_vlan_info_t array of SRIOV VF VLANs */
73} nl_vf_vlans_t;
74
75/**
76 * @brief VF Rate information structure
77 * @ingroup sriov
78 */
79 struct nl_vf_rate {
80 int api; /*!< rtnl_link_rate_api_t API Version to use */
81 uint32_t rate; /*!< Old API Max Rate in Mbps */
82 uint32_t max_tx_rate; /*!< New API Max Rate in Mbps */
83 uint32_t min_tx_rate; /*!< New API Mix Rate in Mbps */
84};
85
86extern int rtnl_link_vf_add(struct rtnl_link *, struct rtnl_link_vf *);
87extern struct rtnl_link_vf *rtnl_link_vf_alloc(void);
88extern void rtnl_link_vf_free(struct rtnl_link_vf *);
89extern struct rtnl_link_vf *rtnl_link_vf_get(struct rtnl_link *, uint32_t);
90extern void rtnl_link_vf_put(struct rtnl_link_vf *);
91
92extern int rtnl_link_vf_get_addr(struct rtnl_link_vf *, struct nl_addr **);
93extern void rtnl_link_vf_set_addr(struct rtnl_link_vf *, struct nl_addr *);
94
95extern void rtnl_link_vf_set_ib_node_guid(struct rtnl_link_vf *, uint64_t);
96extern void rtnl_link_vf_set_ib_port_guid(struct rtnl_link_vf *, uint64_t);
97
98extern int rtnl_link_vf_get_index(struct rtnl_link_vf *, uint32_t *);
99extern void rtnl_link_vf_set_index(struct rtnl_link_vf *, uint32_t);
100
101extern int rtnl_link_vf_get_linkstate(struct rtnl_link_vf *, uint32_t *);
102extern void rtnl_link_vf_set_linkstate(struct rtnl_link_vf *, uint32_t);
103
104extern int rtnl_link_vf_get_rate(struct rtnl_link_vf *, struct nl_vf_rate *);
105extern void rtnl_link_vf_set_rate(struct rtnl_link_vf *, struct nl_vf_rate *);
106
107extern int rtnl_link_vf_get_rss_query_en(struct rtnl_link_vf *, uint32_t *);
108extern void rtnl_link_vf_set_rss_query_en(struct rtnl_link_vf *, uint32_t);
109
110extern int rtnl_link_vf_get_spoofchk(struct rtnl_link_vf *, uint32_t *);
111extern void rtnl_link_vf_set_spoofchk(struct rtnl_link_vf *, uint32_t);
112
113extern int rtnl_link_vf_get_stat(struct rtnl_link_vf *, rtnl_link_vf_stats_t,
114 uint64_t *);
115
116extern int rtnl_link_vf_get_trust(struct rtnl_link_vf *, uint32_t *);
117extern void rtnl_link_vf_set_trust(struct rtnl_link_vf *, uint32_t);
118
119extern int rtnl_link_vf_get_vlans(struct rtnl_link_vf *, nl_vf_vlans_t **);
120extern void rtnl_link_vf_set_vlans(struct rtnl_link_vf *, nl_vf_vlans_t *);
121
122extern int rtnl_link_vf_vlan_alloc(nl_vf_vlans_t **, int);
123extern void rtnl_link_vf_vlan_free(nl_vf_vlans_t *vf_vlans);
124extern void rtnl_link_vf_vlan_put(nl_vf_vlans_t *);
125
126/* Utility functions */
127extern char *rtnl_link_vf_linkstate2str(uint32_t, char *, size_t);
128extern int rtnl_link_vf_str2linkstate(const char *);
129
130extern char *rtnl_link_vf_vlanproto2str(uint16_t, char *, size_t);
131extern int rtnl_link_vf_str2vlanproto(const char *);
132
133extern int rtnl_link_vf_str2guid(uint64_t *, const char *);
134
135#ifdef __cplusplus
136}
137#endif
138
139#endif
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:1132
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:942
rtnl_link_vf_stats_t
rtnl_link_vf_stats_t
Definition sriov.h:34
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:894
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:1311
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:1335
rtnl_link_rate_api_t
rtnl_link_rate_api_t
Definition sriov.h:22
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:841
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:814
nl_vf_vlan_info_t
struct nl_vf_vlan_info nl_vf_vlan_info_t
SRIOV VF VFLAN settings.
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:910
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:1260
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:871
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:923
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:1104
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:1006
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:1153
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:1282
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:1214
nl_vf_vlans_t
struct nl_vf_vlans nl_vf_vlans_t
SRIOV VF VLANs information.
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:1384
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:1194
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:1240
rtnl_link_vf_free
void rtnl_link_vf_free(struct rtnl_link_vf *)
Free SRIOV VF object.
Definition sriov.c:785
rtnl_link_vf_alloc
struct rtnl_link_vf * rtnl_link_vf_alloc(void)
Allocate a new SRIOV VF object.
Definition sriov.c:767
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:1173
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:962
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:1366
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:982
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:1038
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:732
RTNL_LINK_VF_STATS_TX_BYTES
@ RTNL_LINK_VF_STATS_TX_BYTES
Definition sriov.h:38
RTNL_LINK_VF_STATS_BROADCAST
@ RTNL_LINK_VF_STATS_BROADCAST
Definition sriov.h:39
RTNL_LINK_VF_STATS_RX_PACKETS
@ RTNL_LINK_VF_STATS_RX_PACKETS
Definition sriov.h:35
RTNL_LINK_VF_STATS_MULTICAST
@ RTNL_LINK_VF_STATS_MULTICAST
Definition sriov.h:40
RTNL_LINK_VF_STATS_RX_BYTES
@ RTNL_LINK_VF_STATS_RX_BYTES
Definition sriov.h:37
RTNL_LINK_VF_STATS_TX_PACKETS
@ RTNL_LINK_VF_STATS_TX_PACKETS
Definition sriov.h:36
RTNL_LINK_VF_RATE_API_UNSPEC
@ RTNL_LINK_VF_RATE_API_UNSPEC
Definition sriov.h:23
RTNL_LINK_VF_RATE_API_NEW
@ RTNL_LINK_VF_RATE_API_NEW
Definition sriov.h:25
RTNL_LINK_VF_RATE_API_OLD
@ RTNL_LINK_VF_RATE_API_OLD
Definition sriov.h:24
nl_vf_rate
VF Rate information structure.
Definition sriov.h:79
nl_vf_rate::api
int api
Definition sriov.h:80
nl_vf_rate::min_tx_rate
uint32_t min_tx_rate
Definition sriov.h:83
nl_vf_rate::max_tx_rate
uint32_t max_tx_rate
Definition sriov.h:82
nl_vf_rate::rate
uint32_t rate
Definition sriov.h:81
nl_vf_vlan_info
SRIOV VF VFLAN settings.
Definition sriov.h:59
nl_vf_vlan_info::vf_vlan_proto
uint16_t vf_vlan_proto
Definition sriov.h:62
nl_vf_vlan_info::vf_vlan_qos
uint32_t vf_vlan_qos
Definition sriov.h:61
nl_vf_vlan_info::vf_vlan
uint32_t vf_vlan
Definition sriov.h:60
nl_vf_vlans
SRIOV VF VLANs information.
Definition sriov.h:69
nl_vf_vlans::ce_refcnt
int ce_refcnt
Definition sriov.h:70
nl_vf_vlans::vlans
nl_vf_vlan_info_t * vlans
Definition sriov.h:72
nl_vf_vlans::size
int size
Definition sriov.h:71
rtnl_link_vf
SRIOV VF object.
rtnl_link
Link object.
Definition nl-route.h:29