diff --git a/src/libnm-client-impl/libnm.ver b/src/libnm-client-impl/libnm.ver index 17fc25c6c..73fdec5ba 100644 --- a/src/libnm-client-impl/libnm.ver +++ b/src/libnm-client-impl/libnm.ver @@ -1969,4 +1969,8 @@ global: nm_setting_get_enum_property_type; nm_setting_sriov_get_eswitch_mode; nm_sriov_eswitch_mode_get_type; + nm_setting_sriov_get_eswitch_inline_mode; + nm_sriov_eswitch_inline_mode_get_type; + nm_setting_sriov_get_eswitch_encap_mode; + nm_sriov_eswitch_encap_mode_get_type; } libnm_1_44_0; diff --git a/src/libnm-core-impl/gen-metadata-nm-settings-libnm-core.xml.in b/src/libnm-core-impl/gen-metadata-nm-settings-libnm-core.xml.in index f3fa8e162..b2748beb1 100644 --- a/src/libnm-core-impl/gen-metadata-nm-settings-libnm-core.xml.in +++ b/src/libnm-core-impl/gen-metadata-nm-settings-libnm-core.xml.in @@ -2198,6 +2198,14 @@ dbus-type="i" gprop-type="NMTernary" /> + + eswitch_mode; } +/** + * nm_setting_sriov_get_eswitch_inline_mode: + * @setting: the #NMSettingSriov + * + * Returns: the value contained in the #NMSettingSriov:eswitch-inline-mode property. + * + * Since: 1.46 + */ +NMSriovEswitchInlineMode +nm_setting_sriov_get_eswitch_inline_mode(NMSettingSriov *setting) +{ + g_return_val_if_fail(NM_IS_SETTING_SRIOV(setting), NM_SRIOV_ESWITCH_INLINE_MODE_PRESERVE); + + return setting->eswitch_inline_mode; +} + +/** + * nm_setting_sriov_get_eswitch_encap_mode: + * @setting: the #NMSettingSriov + * + * Returns: the value contained in the #NMSettingSriov:eswitch-encap-mode property. + * + * Since: 1.46 + */ +NMSriovEswitchEncapMode +nm_setting_sriov_get_eswitch_encap_mode(NMSettingSriov *setting) +{ + g_return_val_if_fail(NM_IS_SETTING_SRIOV(setting), NM_SRIOV_ESWITCH_ENCAP_MODE_PRESERVE); + + return setting->eswitch_encap_mode; +} + static int vf_index_compare(gconstpointer a, gconstpointer b) { @@ -1376,6 +1412,56 @@ nm_setting_sriov_class_init(NMSettingSriovClass *klass) NMSettingSriov, eswitch_mode); + /** + * NMSettingSriov:eswitch-inline-mode + * + * Select the eswitch inline-mode of the device. Some HWs need the VF driver to put + * part of the packet headers on the TX descriptor so the e-switch can do proper + * matching and steering. + * + * Currently it's only supported for PCI PF devices, and only if the eswitch device + * is managed from the same PCI address than the PF. + * + * If set to %NM_SRIOV_ESWITCH_INLINE_MODE_PRESERVE (default) the eswitch inline-mode + * won't be modified by NetworkManager. + * + * Since: 1.46 + */ + _nm_setting_property_define_direct_enum(properties_override, + obj_properties, + NM_SETTING_SRIOV_ESWITCH_INLINE_MODE, + PROP_ESWITCH_INLINE_MODE, + NM_TYPE_SRIOV_ESWITCH_INLINE_MODE, + NM_SRIOV_ESWITCH_INLINE_MODE_PRESERVE, + NM_SETTING_PARAM_FUZZY_IGNORE, + NULL, + NMSettingSriov, + eswitch_inline_mode); + + /** + * NMSettingSriov:eswitch-encap-mode + * + * Select the eswitch encapsulation support. + * + * Currently it's only supported for PCI PF devices, and only if the eswitch device + * is managed from the same PCI address than the PF. + * + * If set to %NM_SRIOV_ESWITCH_ENCAP_MODE_PRESERVE (default) the eswitch encap-mode + * won't be modified by NetworkManager. + * + * Since: 1.46 + */ + _nm_setting_property_define_direct_enum(properties_override, + obj_properties, + NM_SETTING_SRIOV_ESWITCH_ENCAP_MODE, + PROP_ESWITCH_ENCAP_MODE, + NM_TYPE_SRIOV_ESWITCH_ENCAP_MODE, + NM_SRIOV_ESWITCH_ENCAP_MODE_PRESERVE, + NM_SETTING_PARAM_FUZZY_IGNORE, + NULL, + NMSettingSriov, + eswitch_encap_mode); + g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties); _nm_setting_class_commit(setting_class, diff --git a/src/libnm-core-public/nm-setting-sriov.h b/src/libnm-core-public/nm-setting-sriov.h index 16e493258..e210ccbdc 100644 --- a/src/libnm-core-public/nm-setting-sriov.h +++ b/src/libnm-core-public/nm-setting-sriov.h @@ -26,10 +26,12 @@ G_BEGIN_DECLS #define NM_SETTING_SRIOV_SETTING_NAME "sriov" -#define NM_SETTING_SRIOV_TOTAL_VFS "total-vfs" -#define NM_SETTING_SRIOV_VFS "vfs" -#define NM_SETTING_SRIOV_AUTOPROBE_DRIVERS "autoprobe-drivers" -#define NM_SETTING_SRIOV_ESWITCH_MODE "eswitch-mode" +#define NM_SETTING_SRIOV_TOTAL_VFS "total-vfs" +#define NM_SETTING_SRIOV_VFS "vfs" +#define NM_SETTING_SRIOV_AUTOPROBE_DRIVERS "autoprobe-drivers" +#define NM_SETTING_SRIOV_ESWITCH_MODE "eswitch-mode" +#define NM_SETTING_SRIOV_ESWITCH_INLINE_MODE "eswitch-inline-mode" +#define NM_SETTING_SRIOV_ESWITCH_ENCAP_MODE "eswitch-encap-mode" #define NM_SRIOV_VF_ATTRIBUTE_MAC "mac" #define NM_SRIOV_VF_ATTRIBUTE_SPOOF_CHECK "spoof-check" @@ -68,6 +70,38 @@ typedef enum { NM_SRIOV_ESWITCH_MODE_SWITCHDEV = 1, } NMSriovEswitchMode; +/** + * NMSriovEswitchInlineMode: + * @NM_SRIOV_ESWITCH_INLINE_MODE_PRESERVE: don't modify current inline-mode + * @NM_SRIOV_ESWITCH_INLINE_MODE_NONE: don't use inline mode + * @NM_SRIOV_ESWITCH_INLINE_MODE_LINK: L2 mode + * @NM_SRIOV_ESWITCH_INLINE_MODE_NETWORK: L3 mode + * @NM_SRIOV_ESWITCH_INLINE_MODE_TRANSPORT: L4 mode + * + * Since: 1.46 + */ +typedef enum { + NM_SRIOV_ESWITCH_INLINE_MODE_PRESERVE = -1, + NM_SRIOV_ESWITCH_INLINE_MODE_NONE = 0, + NM_SRIOV_ESWITCH_INLINE_MODE_LINK = 1, + NM_SRIOV_ESWITCH_INLINE_MODE_NETWORK = 2, + NM_SRIOV_ESWITCH_INLINE_MODE_TRANSPORT = 3, +} NMSriovEswitchInlineMode; + +/** + * NMSriovEswitchEncapMode: + * @NM_SRIOV_ESWITCH_ENCAP_MODE_PRESERVE: don't modify current encap-mode + * @NM_SRIOV_ESWITCH_ENCAP_MODE_NONE: disable encapsulation mode + * @NM_SRIOV_ESWITCH_ENCAP_MODE_BASIC: enable encapsulation mode + * + * Since: 1.46 + */ +typedef enum { + NM_SRIOV_ESWITCH_ENCAP_MODE_PRESERVE = -1, + NM_SRIOV_ESWITCH_ENCAP_MODE_NONE = 0, + NM_SRIOV_ESWITCH_ENCAP_MODE_BASIC = 1, +} NMSriovEswitchEncapMode; + NM_AVAILABLE_IN_1_14 GType nm_setting_sriov_get_type(void); NM_AVAILABLE_IN_1_14 @@ -90,6 +124,10 @@ NM_AVAILABLE_IN_1_14 NMTernary nm_setting_sriov_get_autoprobe_drivers(NMSettingSriov *setting); NM_AVAILABLE_IN_1_46 NMSriovEswitchMode nm_setting_sriov_get_eswitch_mode(NMSettingSriov *setting); +NM_AVAILABLE_IN_1_46 +NMSriovEswitchInlineMode nm_setting_sriov_get_eswitch_inline_mode(NMSettingSriov *setting); +NM_AVAILABLE_IN_1_46 +NMSriovEswitchEncapMode nm_setting_sriov_get_eswitch_encap_mode(NMSettingSriov *setting); NM_AVAILABLE_IN_1_14 gboolean nm_sriov_vf_add_vlan(NMSriovVF *vf, guint vlan_id); diff --git a/src/libnmc-setting/nm-meta-setting-desc.c b/src/libnmc-setting/nm-meta-setting-desc.c index 8a53af36e..4876acc2e 100644 --- a/src/libnmc-setting/nm-meta-setting-desc.c +++ b/src/libnmc-setting/nm-meta-setting-desc.c @@ -7366,6 +7366,12 @@ static const NMMetaPropertyInfo *const property_infos_SRIOV[] = { PROPERTY_INFO_WITH_DESC (NM_SETTING_SRIOV_ESWITCH_MODE, .property_type = &_pt_gobject_enum, ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_SRIOV_ESWITCH_INLINE_MODE, + .property_type = &_pt_gobject_enum, + ), + PROPERTY_INFO_WITH_DESC (NM_SETTING_SRIOV_ESWITCH_ENCAP_MODE, + .property_type = &_pt_gobject_enum, + ), NULL }; diff --git a/src/libnmc-setting/settings-docs.h.in b/src/libnmc-setting/settings-docs.h.in index 7e88de3a7..0ca03e523 100644 --- a/src/libnmc-setting/settings-docs.h.in +++ b/src/libnmc-setting/settings-docs.h.in @@ -310,6 +310,8 @@ #define DESCRIBE_DOC_NM_SETTING_SERIAL_SEND_DELAY N_("Time to delay between each byte sent to the modem, in microseconds.") #define DESCRIBE_DOC_NM_SETTING_SERIAL_STOPBITS N_("Number of stop bits for communication on the serial port. Either 1 or 2. The 1 in \"8n1\" for example.") #define DESCRIBE_DOC_NM_SETTING_SRIOV_AUTOPROBE_DRIVERS N_("Whether to autoprobe virtual functions by a compatible driver. If set to \"true\" (1), the kernel will try to bind VFs to a compatible driver and if this succeeds a new network interface will be instantiated for each VF. If set to \"false\" (0), VFs will not be claimed and no network interfaces will be created for them. When set to \"default\" (-1), the global default is used; in case the global default is unspecified it is assumed to be \"true\" (1).") +#define DESCRIBE_DOC_NM_SETTING_SRIOV_ESWITCH_ENCAP_MODE N_("Select the eswitch encapsulation support. Currently it's only supported for PCI PF devices, and only if the eswitch device is managed from the same PCI address than the PF. If set to \"preserve\" (-1) (default) the eswitch encap-mode won't be modified by NetworkManager.") +#define DESCRIBE_DOC_NM_SETTING_SRIOV_ESWITCH_INLINE_MODE N_("Select the eswitch inline-mode of the device. Some HWs need the VF driver to put part of the packet headers on the TX descriptor so the e-switch can do proper matching and steering. Currently it's only supported for PCI PF devices, and only if the eswitch device is managed from the same PCI address than the PF. If set to \"preserve\" (-1) (default) the eswitch inline-mode won't be modified by NetworkManager.") #define DESCRIBE_DOC_NM_SETTING_SRIOV_ESWITCH_MODE N_("Select the eswitch mode of the device. Currently it's only supported for PCI PF devices, and only if the eswitch device is managed from the same PCI address than the PF. If set to \"preserve\" (-1) (default) the eswitch mode won't be modified by NetworkManager.") #define DESCRIBE_DOC_NM_SETTING_SRIOV_TOTAL_VFS N_("The total number of virtual functions to create. Note that when the sriov setting is present NetworkManager enforces the number of virtual functions on the interface (also when it is zero) during activation and resets it upon deactivation. To prevent any changes to SR-IOV parameters don't add a sriov setting to the connection.") #define DESCRIBE_DOC_NM_SETTING_SRIOV_VFS N_("Array of virtual function descriptors. Each VF descriptor is a dictionary mapping attribute names to GVariant values. The 'index' entry is mandatory for each VF. When represented as string a VF is in the form: \"INDEX [ATTR=VALUE[ ATTR=VALUE]...]\". for example: \"2 mac=00:11:22:33:44:55 spoof-check=true\". Multiple VFs can be specified using a comma as separator. Currently, the following attributes are supported: mac, spoof-check, trust, min-tx-rate, max-tx-rate, vlans. The \"vlans\" attribute is represented as a semicolon-separated list of VLAN descriptors, where each descriptor has the form \"ID[.PRIORITY[.PROTO]]\". PROTO can be either 'q' for 802.1Q (the default) or 'ad' for 802.1ad.") diff --git a/src/nmcli/gen-metadata-nm-settings-nmcli.xml.in b/src/nmcli/gen-metadata-nm-settings-nmcli.xml.in index 177b1a5e7..fa43bdcf7 100644 --- a/src/nmcli/gen-metadata-nm-settings-nmcli.xml.in +++ b/src/nmcli/gen-metadata-nm-settings-nmcli.xml.in @@ -1824,6 +1824,14 @@ nmcli-description="Select the eswitch mode of the device. Currently it's only supported for PCI PF devices, and only if the eswitch device is managed from the same PCI address than the PF. If set to "preserve" (-1) (default) the eswitch mode won't be modified by NetworkManager." format="choice (NMSriovEswitchMode)" values="preserve (-1), legacy (0), switchdev (1)" /> + +