libnl 3.7.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 */
22typedef 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,
28
29#define RTNL_LINK_VF_RATE_API_MAX (__RTNL_LINK_VF_RATE_API_MAX - 1)
30
31/**
32 * @ingroup sriov
33 */
34typedef 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,
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 */
59typedef 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 */
64
65/**
66 * @brief SRIOV VF VLANs information
67 * @ingroup sriov
68 */
69typedef 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 */
74
75/**
76 * @brief VF Rate information structure
77 * @ingroup sriov
78 */
79struct 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
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);
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
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:1111
int rtnl_link_vf_get_index(struct rtnl_link_vf *, uint32_t *)
Get index of SRIOV Virtual Function.
Definition: sriov.c:921
rtnl_link_vf_stats_t
Definition: sriov.h:34
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:873
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:1290
int rtnl_link_vf_vlan_alloc(nl_vf_vlans_t **, int)
Allocate a SRIOV VF VLAN object.
Definition: sriov.c:1314
rtnl_link_rate_api_t
Definition: sriov.h:22
void rtnl_link_vf_put(struct rtnl_link_vf *)
Return SRIOV VF object to the owning link object.
Definition: sriov.c:820
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:793
struct nl_vf_vlan_info nl_vf_vlan_info_t
SRIOV VF VFLAN settings.
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:889
void rtnl_link_vf_set_trust(struct rtnl_link_vf *, uint32_t)
Set user trust setting on SRIOV Virtual Function Object.
Definition: sriov.c:1239
int rtnl_link_vf_get_addr(struct rtnl_link_vf *, struct nl_addr **)
Get link layer address of SRIOV Virtual Function.
Definition: sriov.c:850
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:902
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:1083
void rtnl_link_vf_set_linkstate(struct rtnl_link_vf *, uint32_t)
Set link state of SRIOV Virtual Function object.
Definition: sriov.c:985
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:1132
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:1261
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:1193
struct nl_vf_vlans nl_vf_vlans_t
SRIOV VF VLANs information.
void rtnl_link_vf_vlan_put(nl_vf_vlans_t *)
Return SRIOV VF VLANs object to the owning SRIOV VF object.
Definition: sriov.c:1363
void rtnl_link_vf_set_spoofchk(struct rtnl_link_vf *, uint32_t)
Set spoof checking value of SRIOV Virtual Function Object.
Definition: sriov.c:1173
int rtnl_link_vf_get_trust(struct rtnl_link_vf *, uint32_t *)
Get trust setting of SRIOV Virtual Function.
Definition: sriov.c:1219
void rtnl_link_vf_free(struct rtnl_link_vf *)
Free SRIOV VF object.
Definition: sriov.c:764
struct rtnl_link_vf * rtnl_link_vf_alloc(void)
Allocate a new SRIOV VF object.
Definition: sriov.c:746
int rtnl_link_vf_get_spoofchk(struct rtnl_link_vf *, uint32_t *)
Get spoof checking value of SRIOV Virtual Function.
Definition: sriov.c:1152
void rtnl_link_vf_set_index(struct rtnl_link_vf *, uint32_t)
Set index of SRIOV Virtual Function object.
Definition: sriov.c:941
void rtnl_link_vf_vlan_free(nl_vf_vlans_t *vf_vlans)
Free an allocated SRIOV VF VLANs object.
Definition: sriov.c:1345
int rtnl_link_vf_get_linkstate(struct rtnl_link_vf *, uint32_t *)
Get link state of SRIOV Virtual Function.
Definition: sriov.c:961
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:1017
int rtnl_link_vf_add(struct rtnl_link *, struct rtnl_link_vf *)
Add a SRIOV VF object to a link object.
Definition: sriov.c:711
@ RTNL_LINK_VF_STATS_TX_BYTES
Definition: sriov.h:38
@ RTNL_LINK_VF_STATS_BROADCAST
Definition: sriov.h:39
@ RTNL_LINK_VF_STATS_RX_PACKETS
Definition: sriov.h:35
@ RTNL_LINK_VF_STATS_MULTICAST
Definition: sriov.h:40
@ RTNL_LINK_VF_STATS_RX_BYTES
Definition: sriov.h:37
@ RTNL_LINK_VF_STATS_TX_PACKETS
Definition: sriov.h:36
@ RTNL_LINK_VF_RATE_API_UNSPEC
Definition: sriov.h:23
@ RTNL_LINK_VF_RATE_API_NEW
Definition: sriov.h:25
@ RTNL_LINK_VF_RATE_API_OLD
Definition: sriov.h:24
VF Rate information structure.
Definition: sriov.h:79
int api
Definition: sriov.h:80
uint32_t min_tx_rate
Definition: sriov.h:83
uint32_t max_tx_rate
Definition: sriov.h:82
uint32_t rate
Definition: sriov.h:81
SRIOV VF VFLAN settings.
Definition: sriov.h:59
uint16_t vf_vlan_proto
Definition: sriov.h:62
uint32_t vf_vlan_qos
Definition: sriov.h:61
uint32_t vf_vlan
Definition: sriov.h:60
SRIOV VF VLANs information.
Definition: sriov.h:69
int ce_refcnt
Definition: sriov.h:70
nl_vf_vlan_info_t * vlans
Definition: sriov.h:72
int size
Definition: sriov.h:71