NMSettingSriov: libnm Reference Manual

## NMSettingSriov NMSettingSriov — Describes SR-IOV connection properties |

## Functions

NMSetting * | nm_setting_sriov_new ()
guint | nm_setting_sriov_get_total_vfs ()
guint | nm_setting_sriov_get_num_vfs ()
NMSriovVF * | nm_setting_sriov_get_vf ()
void | nm_setting_sriov_add_vf ()
void | nm_setting_sriov_remove_vf ()
gboolean | nm_setting_sriov_remove_vf_by_index ()
void | nm_setting_sriov_clear_vfs ()
NMTernary | nm_setting_sriov_get_autoprobe_drivers ()
gboolean | nm_sriov_vf_add_vlan ()
gboolean | nm_sriov_vf_remove_vlan ()
const guint * | nm_sriov_vf_get_vlan_ids ()
void | nm_sriov_vf_set_vlan_qos ()
void | nm_sriov_vf_set_vlan_protocol ()
guint32 | nm_sriov_vf_get_vlan_qos ()
NMSriovVFVlanProtocol | nm_sriov_vf_get_vlan_protocol ()
NMSriovVF * | nm_sriov_vf_new ()
void | nm_sriov_vf_ref ()
void | nm_sriov_vf_unref ()
gboolean | nm_sriov_vf_equal ()
NMSriovVF * | nm_sriov_vf_dup ()
guint | nm_sriov_vf_get_index ()
void | nm_sriov_vf_set_attribute ()
const char ** | nm_sriov_vf_get_attribute_names ()
GVariant * | nm_sriov_vf_get_attribute ()
gboolean | nm_sriov_vf_attribute_validate ()

## Types and Values

#define | NM_SETTING_SRIOV_SETTING_NAME
#define | NM_SETTING_SRIOV_TOTAL_VFS
#define | NM_SETTING_SRIOV_VFS
#define | NM_SETTING_SRIOV_AUTOPROBE_DRIVERS
#define | NM_SRIOV_VF_ATTRIBUTE_MAC
#define | NM_SRIOV_VF_ATTRIBUTE_SPOOF_CHECK
#define | NM_SRIOV_VF_ATTRIBUTE_TRUST
#define | NM_SRIOV_VF_ATTRIBUTE_MIN_TX_RATE
#define | NM_SRIOV_VF_ATTRIBUTE_MAX_TX_RATE
enum | NMSriovVFVlanProtocol

## Object Hierarchy

        GBoxed
        ╰── NMSriovVF
        GEnum
        ╰── NMSriovVFVlanProtocol

## Includes

    #include <nm-setting-sriov.h>

## Description

## Functions

### nm_setting_sriov_new ()

    NMSetting *
    nm_setting_sriov_new (void);

Creates a new NMSettingSriov object with default values.

#### Returns

the new empty NMSettingSriov object.

[transfer full]

Since: 1.14

### nm_setting_sriov_get_total_vfs ()

    guint
    nm_setting_sriov_get_total_vfs (NMSettingSriov *setting);

Returns the value contained in the “total-vfs” property.

#### Parameters

setting | the NMSettingSriov |

#### Returns

the total number of SR-IOV virtual functions to create

Since: 1.14

### nm_setting_sriov_get_num_vfs ()

    guint
    nm_setting_sriov_get_num_vfs (NMSettingSriov *setting);

#### Parameters

setting | the NMSettingSriov |

#### Returns

the number of configured VFs

Since: 1.14

### nm_setting_sriov_get_vf ()

    NMSriovVF *
    nm_setting_sriov_get_vf (NMSettingSriov *setting,
                             guint idx);

#### Parameters

setting | the NMSettingSriov |
idx | index number of the VF to return |

#### Returns

the VF at index `idx` .

[transfer none]

Since: 1.14

### nm_setting_sriov_add_vf ()

    void
    nm_setting_sriov_add_vf (NMSettingSriov *setting,
                             NMSriovVF *vf);

Appends a new VF and associated information to the setting. The given VF is duplicated internally and is not changed by this function.

#### Parameters

setting | the NMSettingSriov |
vf | the VF to add |

Since: 1.14

### nm_setting_sriov_remove_vf ()

    void
    nm_setting_sriov_remove_vf (NMSettingSriov *setting,
                                guint idx);

Removes the VF at index `idx` .

#### Parameters

setting | the NMSettingSriov |
idx | index number of the VF |

Since: 1.14

### nm_setting_sriov_remove_vf_by_index ()

    gboolean
    nm_setting_sriov_remove_vf_by_index (NMSettingSriov *setting,
                                         guint index);

Removes the VF with VF index `index` .

#### Parameters

setting | the NMSettingSriov |
index | the VF index of the VF to remove |

#### Returns

`TRUE` if the VF was found and removed; `FALSE` if it was not

Since: 1.14

### nm_setting_sriov_clear_vfs ()

    void
    nm_setting_sriov_clear_vfs (NMSettingSriov *setting);

Removes all configured VFs.

#### Parameters

setting | the NMSettingSriov |

Since: 1.14

### nm_setting_sriov_get_autoprobe_drivers ()

    NMTernary
    nm_setting_sriov_get_autoprobe_drivers
                                   (NMSettingSriov *setting);

Returns the value contained in the “autoprobe-drivers” property.

#### Parameters

setting | the NMSettingSriov |

#### Returns

the autoprobe-drivers property value

Since: 1.14

### nm_sriov_vf_add_vlan ()

    gboolean
    nm_sriov_vf_add_vlan (NMSriovVF *vf,
                          guint vlan_id);

Adds a VLAN to the VF.

#### Parameters

vf | the NMSriovVF |
vlan_id | the VLAN id |

#### Returns

`TRUE` if the VLAN was added; `FALSE` if it already existed

Since: 1.14

### nm_sriov_vf_remove_vlan ()

    gboolean
    nm_sriov_vf_remove_vlan (NMSriovVF *vf,
                             guint vlan_id);

Removes a VLAN from a VF.

#### Parameters

vf | the NMSriovVF |
vlan_id | the VLAN id |

#### Returns

`TRUE` if the VLAN was removed, `FALSE` if the VLAN `vlan_id` did not belong to the VF.

Since: 1.14

### nm_sriov_vf_get_vlan_ids ()

    const guint *
    nm_sriov_vf_get_vlan_ids (const NMSriovVF *vf,
                              guint *length);

Returns the VLANs currently configured on the VF.

#### Parameters

vf | the NMSriovVF |
length | on return, the number of VLANs configured. | [out][allow-none]

#### Returns

a list of VLAN ids configured on the VF.

[transfer none][array length=length]

Since: 1.14

### nm_sriov_vf_set_vlan_qos ()

    void
    nm_sriov_vf_set_vlan_qos (NMSriovVF *vf,
                              guint vlan_id,
                              guint32 qos);

Sets a QoS value for the given VLAN.

#### Parameters

vf | the NMSriovVF |
vlan_id | the VLAN id |
qos | a QoS (priority) value |

Since: 1.14

### nm_sriov_vf_set_vlan_protocol ()

    void
    nm_sriov_vf_set_vlan_protocol (NMSriovVF *vf,
                                   guint vlan_id,
                                   NMSriovVFVlanProtocol protocol);

Sets the protocol for the given VLAN.

#### Parameters

vf | the NMSriovVF |
vlan_id | the VLAN id |
protocol | the VLAN protocol |

Since: 1.14

### nm_sriov_vf_get_vlan_qos ()

    guint32
    nm_sriov_vf_get_vlan_qos (const NMSriovVF *vf,
                              guint vlan_id);

Returns the QoS value for the given VLAN.

#### Parameters

vf | the NMSriovVF |
vlan_id | the VLAN id |

#### Returns

the QoS value

Since: 1.14

### nm_sriov_vf_get_vlan_protocol ()

    NMSriovVFVlanProtocol
    nm_sriov_vf_get_vlan_protocol (const NMSriovVF *vf,
                                   guint vlan_id);

### nm_sriov_vf_new ()

    NMSriovVF *
    nm_sriov_vf_new (guint index);

Creates a new NMSriovVF object.

#### Parameters

index | the VF index |

#### Returns

the new NMSriovVF object.

[transfer full]

Since: 1.14

### nm_sriov_vf_ref ()

    void
    nm_sriov_vf_ref (NMSriovVF *vf);

Increases the reference count of the object.

#### Parameters

vf | the NMSriovVF |

Since: 1.14

### nm_sriov_vf_unref ()

    void
    nm_sriov_vf_unref (NMSriovVF *vf);

Decreases the reference count of the object. If the reference count reaches zero, the object will be destroyed.

#### Parameters

vf | the NMSriovVF |

Since: 1.14

### nm_sriov_vf_equal ()

    gboolean
    nm_sriov_vf_equal (const NMSriovVF *vf,
                       const NMSriovVF *other);

Determines if two NMSriovVF objects have the same index, attributes and VLANs.

#### Parameters

vf | the NMSriovVF |
other | the NMSriovVF to compare `vf` to. |

#### Returns

`TRUE` if the objects contain the same values, `FALSE` if they do not.

Since: 1.14

### nm_sriov_vf_dup ()

    NMSriovVF *
    nm_sriov_vf_dup (const NMSriovVF *vf);

Creates a copy of `vf` .

#### Parameters

vf | the NMSriovVF |

#### Returns

a copy of `vf` .

[transfer full]

Since: 1.14

### nm_sriov_vf_get_index ()

    guint
    nm_sriov_vf_get_index (const NMSriovVF *vf);

Gets the index property of this VF object.

#### Parameters

vf | the NMSriovVF |

#### Returns

the VF index

Since: 1.14

### nm_sriov_vf_set_attribute ()

    void
    nm_sriov_vf_set_attribute (NMSriovVF *vf,
                               const char *name,
                               GVariant *value);

Sets the named attribute on `vf` to the given value.

#### Parameters

vf | the NMSriovVF |
name | the name of a route attribute |
value | the value. | [transfer none][allow-none]

Since: 1.14

### nm_sriov_vf_get_attribute_names ()

    const char **
    nm_sriov_vf_get_attribute_names (const NMSriovVF *vf);

Gets an array of attribute names defined on `vf` .

#### Parameters

vf | the NMSriovVF |

#### Returns

a `NULL`-terminated array of attribute names.

[transfer container]

Since: 1.14

### nm_sriov_vf_get_attribute ()

    GVariant *
    nm_sriov_vf_get_attribute (const NMSriovVF *vf,
                               const char *name);

Gets the value of the attribute with name `name` on `vf`

#### Parameters

vf | the NMSriovVF |
name | the name of a VF attribute |

#### Returns

the value of the attribute with name `name` on `vf` , or `NULL` if `vf` has no such attribute.

[transfer none]

Since: 1.14

### nm_sriov_vf_attribute_validate ()

    gboolean
    nm_sriov_vf_attribute_validate (const char *name,
                                    GVariant *value,
                                    gboolean *known,
                                    GError **error);

Validates a VF attribute, i.e. checks that the attribute is a known one, the value is of the correct type and well-formed.

#### Parameters

name | the attribute name |
value | the attribute value |
known | on return, whether the attribute name is a known one. | [out]
error | return location for a GError, or `NULL`. | [allow-none]

#### Returns

`TRUE` if the attribute is valid, `FALSE` otherwise

Since: 1.14

## Types and Values

### NM_SETTING_SRIOV_SETTING_NAME

    #define NM_SETTING_SRIOV_SETTING_NAME "sriov"

### NM_SETTING_SRIOV_TOTAL_VFS

    #define NM_SETTING_SRIOV_TOTAL_VFS         "total-vfs"

### NM_SETTING_SRIOV_VFS

    #define NM_SETTING_SRIOV_VFS               "vfs"

### NM_SETTING_SRIOV_AUTOPROBE_DRIVERS

    #define NM_SETTING_SRIOV_AUTOPROBE_DRIVERS "autoprobe-drivers"

### NM_SRIOV_VF_ATTRIBUTE_MAC

    #define NM_SRIOV_VF_ATTRIBUTE_MAC         "mac"

### NM_SRIOV_VF_ATTRIBUTE_SPOOF_CHECK

    #define NM_SRIOV_VF_ATTRIBUTE_SPOOF_CHECK "spoof-check"

### NM_SRIOV_VF_ATTRIBUTE_TRUST

    #define NM_SRIOV_VF_ATTRIBUTE_TRUST       "trust"

### NM_SRIOV_VF_ATTRIBUTE_MIN_TX_RATE

    #define NM_SRIOV_VF_ATTRIBUTE_MIN_TX_RATE "min-tx-rate"

### NM_SRIOV_VF_ATTRIBUTE_MAX_TX_RATE

    #define NM_SRIOV_VF_ATTRIBUTE_MAX_TX_RATE "max-tx-rate"

### enum NMSriovVFVlanProtocol

NMSriovVFVlanProtocol indicates the VLAN protocol to use.

#### Members

NM_SRIOV_VF_VLAN_PROTOCOL_802_1Q | use 802.1Q |
NM_SRIOV_VF_VLAN_PROTOCOL_802_1AD | use 802.1ad |

Since: 1.14